If multiple instances specify different filename-s, the first one wins.
Public Member Functions | |
FOR009NTuple (G4String category, G4String name, G4String fields, G4String filename) | |
~FOR009NTuple () | |
virtual void | appendRow (float data[], int n) |
virtual bool | readRow (float data[], int ndata) |
virtual bool | needsReference () |
void | flush () |
void | close () |
void | doSummary () |
Private Attributes | |
G4String | title |
int | entries |
Static Private Attributes | |
static BLFOR009 * | for009file = 0 |
static G4String | for009filename = "" |
static std::vector < FOR009NTuple * > | for009list |
FOR009NTuple::FOR009NTuple | ( | G4String | category, | |
G4String | name, | |||
G4String | fields, | |||
G4String | filename | |||
) |
References entries, for009file, for009filename, for009list, BLNTuple::nData, NTraceFields, BLCommand::printError(), title, and TraceFields.
00414 : BLNTuple(name,_fields) 00415 { 00416 nData = NTraceFields; 00417 fields = TraceFields; 00418 G4String file=filename; 00419 if(file == "") file = name; 00420 if(file.find(".txt") == file.npos) 00421 file += ".txt"; 00422 if(for009file == 0) { 00423 for009filename = file; 00424 for009file = new BLFOR009(file,category+"/"+name,"w"); 00425 } else if(filename != "" && file != for009filename) { 00426 BLCommand::printError("ERROR: only one filename can be specified for FOR009.DAT format"); 00427 BLCommand::printError(" '%s' is used",for009filename.c_str()); 00428 } 00429 title = name; 00430 entries = 0; 00431 for009list.push_back(this); 00432 }
void FOR009NTuple::appendRow | ( | float | data[], | |
int | n | |||
) | [virtual] |
Implements BLNTuple.
References BLAssert, BLNTuple::doCallbacks(), entries, for009file, BLManager::getEventID(), BLManager::getObject(), NTraceFields, and BLFOR009::write().
00435 { 00436 BLAssert(n == NTraceFields); 00437 00438 G4ThreeVector pos(data[0]*mm,data[1]*mm,data[2]*mm); 00439 G4ThreeVector momentum(data[3]*MeV,data[4]*MeV,data[5]*MeV); 00440 G4ThreeVector Bfield(data[12]*tesla,data[13]*tesla,data[14]*tesla); 00441 G4ThreeVector Efield(data[15]*(megavolt/meter), 00442 data[16]*(megavolt/meter),data[17]*(megavolt/meter)); 00443 G4double time = data[6]*ns; 00444 int PDGid = (int)data[7]; 00445 int eventID = (int)data[8]; 00446 int trackID = (int)data[9]; 00447 int parentID = (int)data[10]; 00448 double weight = data[11]; 00449 00450 // special fix for eventID to avoid truncation due to float 00451 int eventID2=BLManager::getObject()->getEventID(); 00452 if(fabs((double)(data[8]-(float)eventID2)) < 0.1) 00453 eventID = eventID2; 00454 00455 for009file->write(pos,time,momentum,Bfield,Efield,PDGid,eventID,trackID, 00456 parentID,weight); 00457 00458 ++entries; 00459 00460 doCallbacks(data,n); 00461 }
virtual bool FOR009NTuple::readRow | ( | float | data[], | |
int | ndata | |||
) | [inline, virtual] |
virtual bool FOR009NTuple::needsReference | ( | ) | [inline, virtual] |
void FOR009NTuple::flush | ( | ) | [inline, virtual] |
void FOR009NTuple::close | ( | ) | [virtual] |
Implements BLNTuple.
References BLFOR009::close(), and for009file.
Referenced by AsciiNTuple::~AsciiNTuple().
00464 { 00465 if(for009file) for009file->close(); 00466 for009file = 0; 00467 }
void FOR009NTuple::doSummary | ( | ) | [inline, virtual] |
G4String FOR009NTuple::title [private] |
Referenced by AsciiNTuple::doSummary(), and FOR009NTuple().
int FOR009NTuple::entries [private] |
Referenced by appendRow(), AsciiNTuple::doSummary(), and FOR009NTuple().
BLFOR009 * FOR009NTuple::for009file = 0 [static, private] |
Referenced by appendRow(), close(), and FOR009NTuple().
G4String FOR009NTuple::for009filename = "" [static, private] |
Referenced by FOR009NTuple().
std::vector< FOR009NTuple * > FOR009NTuple::for009list [static, private] |
Referenced by FOR009NTuple().