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.
00410 : BLNTuple(name,_fields) 00411 { 00412 nData = NTraceFields; 00413 fields = TraceFields; 00414 G4String file=filename; 00415 if(file == "") file = name; 00416 if(file.find(".txt") == file.npos) 00417 file += ".txt"; 00418 if(for009file == 0) { 00419 for009filename = file; 00420 for009file = new BLFOR009(file,category+"/"+name,"w"); 00421 } else if(filename != "" && file != for009filename) { 00422 BLCommand::printError("ERROR: only one filename can be specified for FOR009.DAT format"); 00423 BLCommand::printError(" '%s' is used",for009filename.c_str()); 00424 } 00425 title = name; 00426 entries = 0; 00427 for009list.push_back(this); 00428 }
void FOR009NTuple::appendRow | ( | float | data[], | |
int | n | |||
) | [virtual] |
Implements BLNTuple.
References BLNTuple::doCallbacks(), entries, for009file, BLManager::getEventID(), BLManager::getObject(), NTraceFields, and BLFOR009::write().
00431 { 00432 assert(n == NTraceFields); 00433 00434 G4ThreeVector pos(data[0]*mm,data[1]*mm,data[2]*mm); 00435 G4ThreeVector momentum(data[3]*MeV,data[4]*MeV,data[5]*MeV); 00436 G4ThreeVector Bfield(data[12]*tesla,data[13]*tesla,data[14]*tesla); 00437 G4ThreeVector Efield(data[15]*(megavolt/meter), 00438 data[16]*(megavolt/meter),data[17]*(megavolt/meter)); 00439 G4double time = data[6]*ns; 00440 int PDGid = (int)data[7]; 00441 int eventID = (int)data[8]; 00442 int trackID = (int)data[9]; 00443 int parentID = (int)data[10]; 00444 double weight = data[11]; 00445 00446 // special fix for eventID to avoid truncation due to float 00447 int eventID2=BLManager::getObject()->getEventID(); 00448 if(fabs((double)(data[8]-(float)eventID2)) < 0.1) 00449 eventID = eventID2; 00450 00451 for009file->write(pos,time,momentum,Bfield,Efield,PDGid,eventID,trackID, 00452 parentID,weight); 00453 00454 ++entries; 00455 00456 doCallbacks(data,n); 00457 }
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().
00460 { 00461 if(for009file) for009file->close(); 00462 for009file = 0; 00463 }
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().