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.
00326 : BLNTuple(name,_fields) 00327 { 00328 nData = NTrackFields; 00329 fields = TrackFields; 00330 if(filename == "") filename = name+".txt"; 00331 if(filename.find(".txt") == filename.npos) 00332 filename += ".txt"; 00333 tf = new BLTrackFile(filename,category+"/"+name,"w"); 00334 title = name; 00335 entries = 0; 00336 list.push_back(this); 00337 }
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().
00340 { 00341 BLAssert(n == NTrackFields); 00342 00343 G4ThreeVector pos(data[0]*mm,data[1]*mm,data[2]*mm); 00344 G4ThreeVector momentum(data[3]*MeV,data[4]*MeV,data[5]*MeV); 00345 G4double time = data[6]*ns; 00346 int PDGid = (int)data[7]; 00347 int eventID = (int)data[8]; 00348 int trackID = (int)data[9]; 00349 int parentID = (int)data[10]; 00350 double weight = data[11]; 00351 00352 // special fix for eventID to avoid truncation due to float 00353 int eventID2=BLManager::getObject()->getEventID(); 00354 if(fabs((double)(data[8]-(float)eventID2)) < 0.1) 00355 eventID = eventID2; 00356 00357 tf->write(pos,time,momentum,PDGid,eventID,trackID,parentID,weight); 00358 00359 ++entries; 00360 00361 doCallbacks(data,n); 00362 }
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] |