Public Member Functions | |
TrackFileNTuple (G4String category, G4String name, G4String fields, G4String filename) | |
~TrackFileNTuple () | |
virtual void | appendRow (double data[], int n) |
virtual bool | readRow (double data[], int ndata) |
void | flush () |
void | close () |
void | doSummary () |
Private Attributes | |
BLTrackFile * | tf |
G4String | title |
int | entries |
Static Private Attributes | |
static std::vector < TrackFileNTuple * > | list |
TrackFileNTuple::TrackFileNTuple | ( | G4String | category, | |
G4String | name, | |||
G4String | fields, | |||
G4String | filename | |||
) |
References entries, list, BLNTuple::nData, NTrackFields, tf, title, and TrackFields.
00328 : BLNTuple(name,_fields) 00329 { 00330 nData = NTrackFields; 00331 fields = TrackFields; 00332 if(filename == "") filename = name+".txt"; 00333 if(filename.find(".txt") == filename.npos) 00334 filename += ".txt"; 00335 tf = new BLTrackFile(filename,category+"/"+name,"w"); 00336 title = name; 00337 entries = 0; 00338 list.push_back(this); 00339 }
TrackFileNTuple::~TrackFileNTuple | ( | ) | [inline] |
void TrackFileNTuple::appendRow | ( | double | data[], | |
int | n | |||
) | [virtual] |
Implements BLNTuple.
References BLAssert, BLNTuple::doCallbacks(), E, entries, NTrackFields, tf, and BLTrackFile::write().
00342 { 00343 BLAssert(n == NTrackFields); 00344 00345 // make values too small for a float be exactly zero 00346 for(int i=0; i<n; ++i) { 00347 if(fabs(data[i]) < 1.0E-44) data[i] = 0.0; 00348 } 00349 00350 G4ThreeVector pos(data[0]*mm,data[1]*mm,data[2]*mm); 00351 G4ThreeVector momentum(data[3]*MeV,data[4]*MeV,data[5]*MeV); 00352 G4double time = data[6]*ns; 00353 int PDGid = (int)data[7]; 00354 int eventID = (int)data[8]; 00355 int trackID = (int)data[9]; 00356 int parentID = (int)data[10]; 00357 double weight = data[11]; 00358 00359 tf->write(pos,time,momentum,PDGid,eventID,trackID,parentID,weight); 00360 00361 ++entries; 00362 00363 doCallbacks(data,n); 00364 }
virtual bool TrackFileNTuple::readRow | ( | double | data[], | |
int | ndata | |||
) | [inline, virtual] |
void TrackFileNTuple::flush | ( | ) | [inline, virtual] |
void TrackFileNTuple::close | ( | ) | [inline, virtual] |
void TrackFileNTuple::doSummary | ( | ) | [inline, virtual] |
BLTrackFile* TrackFileNTuple::tf [private] |
Referenced by appendRow(), and TrackFileNTuple().
G4String TrackFileNTuple::title [private] |
Referenced by TrackFileNTuple().
int TrackFileNTuple::entries [private] |
Referenced by appendRow(), and TrackFileNTuple().
std::vector< TrackFileNTuple * > TrackFileNTuple::list [static, private] |