TrackFileNTuple Class Reference

Inheritance diagram for TrackFileNTuple:

BLNTuple

List of all members.

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)
virtual int getNData ()
void flush ()
void close ()
void doSummary ()

Private Attributes

BLTrackFiletf
G4String title
int entries

Static Private Attributes

static std::vector
< TrackFileNTuple * > 
list


Constructor & Destructor Documentation

TrackFileNTuple::TrackFileNTuple ( G4String  category,
G4String  name,
G4String  fields,
G4String  filename 
)

References entries, list, tf, and title.

00299 {
00300         if(filename == "") filename = name+".txt";
00301         if(filename.find(".txt") == filename.npos)
00302                 filename += ".txt";
00303         tf = new BLTrackFile(filename,category+"/"+name,"w");
00304         title = name;
00305         entries = 0;
00306         list.push_back(this);
00307 }

TrackFileNTuple::~TrackFileNTuple (  )  [inline]

References BLNTuple::close().

00267 { close(); }


Member Function Documentation

void TrackFileNTuple::appendRow ( float  data[],
int  n 
) [virtual]

Implements BLNTuple.

References entries, tf, and BLTrackFile::write().

00310 {
00311         assert(n == NTrackFileFields);
00312 
00313         G4ThreeVector pos(data[0]*mm,data[1]*mm,data[2]*mm);
00314         G4ThreeVector momentum(data[3]*MeV,data[4]*MeV,data[5]*MeV);
00315         G4double time = data[6]*ns;
00316         int PDGid = (int)data[7];
00317         int eventID = (int)data[8];
00318         int trackID = (int)data[9];
00319         int parentID = (int)data[10];
00320         double weight = data[11];
00321         tf->write(pos,time,momentum,PDGid,eventID,trackID,parentID,weight);
00322 
00323         ++entries;
00324 }

virtual bool TrackFileNTuple::readRow ( float  data[],
int  ndata 
) [inline, virtual]

Implements BLNTuple.

00269 { return false; }

virtual int TrackFileNTuple::getNData (  )  [inline, virtual]

Implements BLNTuple.

00270 { return NTrackFileFields; }

void TrackFileNTuple::flush (  )  [inline, virtual]

Implements BLNTuple.

00271 { if(tf) tf->flush(); }

void TrackFileNTuple::close (  )  [inline, virtual]

Implements BLNTuple.

00272 { if(tf) delete tf; tf = 0; }

void TrackFileNTuple::doSummary (  )  [inline, virtual]

Implements BLNTuple.

00273                          {
00274                 printf("NTuple %-15s %8d entries\n",title.c_str(), entries);
00275         }


Member Data Documentation

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]

Reimplemented from BLNTuple.

Referenced by TrackFileNTuple().


The documentation for this class was generated from the following file:
g4beamline