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