FOR009NTuple Class Reference

Inheritance diagram for FOR009NTuple:

BLNTuple

List of all members.


Detailed Description

class FOR009NTuple implements a FOR009.DAT NTuple.

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 (float data[], int n)
virtual bool readRow (float data[], int ndata)
virtual bool needsReference ()
void flush ()
void close ()
void doSummary ()

Private Attributes

G4String title
int entries

Static Private Attributes

static BLFOR009for009file = 0
static G4String for009filename = ""
static std::vector
< FOR009NTuple * > 
for009list


Constructor & Destructor Documentation

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

References entries, for009file, for009filename, for009list, BLNTuple::nData, NTraceFields, BLCommand::printError(), title, and TraceFields.

00414                                                      : BLNTuple(name,_fields)
00415 {
00416         nData = NTraceFields;
00417         fields = TraceFields;
00418         G4String file=filename;
00419         if(file == "") file = name;
00420         if(file.find(".txt") == file.npos)
00421                 file += ".txt";
00422         if(for009file == 0) {
00423                 for009filename = file;
00424                 for009file = new BLFOR009(file,category+"/"+name,"w");
00425         } else if(filename != "" && file != for009filename) {
00426                 BLCommand::printError("ERROR: only one filename can be specified for FOR009.DAT format");
00427                 BLCommand::printError("       '%s' is used",for009filename.c_str());
00428         }
00429         title = name;
00430         entries = 0;
00431         for009list.push_back(this);
00432 }

FOR009NTuple::~FOR009NTuple (  )  [inline]

00381 { }


Member Function Documentation

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

Implements BLNTuple.

References BLAssert, BLNTuple::doCallbacks(), entries, for009file, BLManager::getEventID(), BLManager::getObject(), NTraceFields, and BLFOR009::write().

00435 {
00436         BLAssert(n == NTraceFields);
00437 
00438         G4ThreeVector pos(data[0]*mm,data[1]*mm,data[2]*mm);
00439         G4ThreeVector momentum(data[3]*MeV,data[4]*MeV,data[5]*MeV);
00440         G4ThreeVector Bfield(data[12]*tesla,data[13]*tesla,data[14]*tesla);
00441         G4ThreeVector Efield(data[15]*(megavolt/meter),
00442                         data[16]*(megavolt/meter),data[17]*(megavolt/meter));
00443         G4double time = data[6]*ns;
00444         int PDGid = (int)data[7];
00445         int eventID = (int)data[8];
00446         int trackID = (int)data[9];
00447         int parentID = (int)data[10];
00448         double weight = data[11];
00449 
00450         // special fix for eventID to avoid truncation due to float
00451         int eventID2=BLManager::getObject()->getEventID();
00452         if(fabs((double)(data[8]-(float)eventID2)) < 0.1)
00453                 eventID = eventID2;
00454 
00455         for009file->write(pos,time,momentum,Bfield,Efield,PDGid,eventID,trackID,
00456                                                         parentID,weight);
00457 
00458         ++entries;
00459 
00460         doCallbacks(data,n);
00461 }

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

Implements BLNTuple.

00383 { return false; }

virtual bool FOR009NTuple::needsReference (  )  [inline, virtual]

Reimplemented from BLNTuple.

00384 { return true; }

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

Implements BLNTuple.

00385 { }

void FOR009NTuple::close (  )  [virtual]

Implements BLNTuple.

References BLFOR009::close(), and for009file.

Referenced by AsciiNTuple::~AsciiNTuple().

00464 {
00465         if(for009file) for009file->close();
00466         for009file = 0;
00467 }

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

Implements BLNTuple.

00387 { /* close provides summary per region */ }


Member Data Documentation

G4String FOR009NTuple::title [private]

int FOR009NTuple::entries [private]

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().


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