Public Member Functions | |
TrackFileNTuple (G4String category, G4String name, G4String fields, G4String filename) | |
~TrackFileNTuple () | |
virtual void | appendRow (float data[], int n) |
virtual bool | readRow (float 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 | ( | float | data[], | |
int | n | |||
) | [virtual] |
Implements BLNTuple.
References BLAssert, BLNTuple::doCallbacks(), entries, BLManager::getEventID(), BLManager::getObject(), NTrackFields, tf, and BLTrackFile::write().
00342 { 00343 BLAssert(n == NTrackFields); 00344 00345 G4ThreeVector pos(data[0]*mm,data[1]*mm,data[2]*mm); 00346 G4ThreeVector momentum(data[3]*MeV,data[4]*MeV,data[5]*MeV); 00347 G4double time = data[6]*ns; 00348 int PDGid = (int)data[7]; 00349 int eventID = (int)data[8]; 00350 int trackID = (int)data[9]; 00351 int parentID = (int)data[10]; 00352 double weight = data[11]; 00353 00354 // special fix for eventID to avoid truncation due to float 00355 int eventID2=BLManager::getObject()->getEventID(); 00356 if(fabs((double)(data[8]-(float)eventID2)) < 0.1) 00357 eventID = eventID2; 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 | ( | float | 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] |