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 (double data[], int n)
virtual bool readRow (double 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.

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

FOR009NTuple::~FOR009NTuple (  )  [inline]

00383 { }


Member Function Documentation

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

Implements BLNTuple.

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

00437 {
00438         BLAssert(n == NTraceFields);
00439 
00440         G4ThreeVector pos(data[0]*mm,data[1]*mm,data[2]*mm);
00441         G4ThreeVector momentum(data[3]*MeV,data[4]*MeV,data[5]*MeV);
00442         G4ThreeVector Bfield(data[12]*tesla,data[13]*tesla,data[14]*tesla);
00443         G4ThreeVector Efield(data[15]*(megavolt/meter),
00444                         data[16]*(megavolt/meter),data[17]*(megavolt/meter));
00445         G4double time = data[6]*ns;
00446         int PDGid = (int)data[7];
00447         int eventID = (int)data[8];
00448         int trackID = (int)data[9];
00449         int parentID = (int)data[10];
00450         double weight = data[11];
00451 
00452         for009file->write(pos,time,momentum,Bfield,Efield,PDGid,eventID,trackID,
00453                                                         parentID,weight);
00454 
00455         ++entries;
00456 
00457         doCallbacks(data,n);
00458 }

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

Implements BLNTuple.

00385 { return false; }

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

Reimplemented from BLNTuple.

00386 { return true; }

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

Implements BLNTuple.

00387 { }

void FOR009NTuple::close (  )  [virtual]

Implements BLNTuple.

References BLFOR009::close(), and for009file.

Referenced by AsciiNTuple::~AsciiNTuple().

00461 {
00462         if(for009file) for009file->close();
00463         for009file = 0;
00464 }

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

Implements BLNTuple.

00389 { /* 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