FairRoot/PandaRoot
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PndPythia6Generator Class Reference

#include <PndPythia6Generator.h>

Inheritance diagram for PndPythia6Generator:

Public Member Functions

 PndPythia6Generator ()
 
 PndPythia6Generator (const char *fileName)
 
virtual ~PndPythia6Generator ()
 
virtual Bool_t ReadEvent (FairPrimaryGenerator *primGen)
 
void SetVerbose (Int_t verb)
 

Private Member Functions

void CloseInput ()
 Verbose Level. More...
 
 ClassDef (PndPythia6Generator, 1)
 

Private Attributes

const Char_t * fFileName
 
FILE * fInputFile
 Input file Name. More...
 
Int_t fVerbose
 File. More...
 

Detailed Description

Definition at line 60 of file PndPythia6Generator.h.

Constructor & Destructor Documentation

PndPythia6Generator::PndPythia6Generator ( )

Default constructor without arguments should not be used.

Definition at line 17 of file PndPythia6Generator.cxx.

17 {}
PndPythia6Generator::PndPythia6Generator ( const char *  fileName)

Standard constructor.

Parameters
fileNameThe input file name

Definition at line 23 of file PndPythia6Generator.cxx.

References fFileName, fInputFile, and fVerbose.

23  {
24  fFileName = fileName;
25  fVerbose = 0;
26  cout << "-I PndPythia6Generator: Opening input file " << fileName << endl;
27  if ((fInputFile = fopen(fFileName,"r"))==NULL)
28  // fInputFile = new ifstream(fFileName);
29  // if ( ! fInputFile->is_open() )
30  Fatal("PndPythia6Generator","Cannot open input file.");
31 
32  // fPDG=TDatabasePDG::Instance();
33 }
FILE * fInputFile
Input file Name.
const Char_t * fFileName
PndPythia6Generator::~PndPythia6Generator ( )
virtual

Destructor.

Definition at line 39 of file PndPythia6Generator.cxx.

References CloseInput().

39  {
40  CloseInput();
41 }
void CloseInput()
Verbose Level.

Member Function Documentation

PndPythia6Generator::ClassDef ( PndPythia6Generator  ,
 
)
private

PDG data base

void PndPythia6Generator::CloseInput ( )
private

Verbose Level.

Private method CloseInput. Just for convenience. Closes the input file properly. Called from destructor and from ReadEvent.

Definition at line 111 of file PndPythia6Generator.cxx.

References fFileName, and fInputFile.

Referenced by ReadEvent(), and ~PndPythia6Generator().

111  {
112  if ( fInputFile ) {
113  //if ( fInputFile->is_open() ) {
114  {
115  cout << "-I PndPythia6Generator: Closing input file "
116  << fFileName << endl;
117  // fInputFile->close();
118 
119  fclose(fInputFile);
120  }
121  delete fInputFile;
122  fInputFile = NULL;
123  }
124 }
FILE * fInputFile
Input file Name.
const Char_t * fFileName
Bool_t PndPythia6Generator::ReadEvent ( FairPrimaryGenerator *  primGen)
virtual

Reads on event from the input file and pushes the tracks onto the stack. Abstract method in base class.

Parameters
primGenpointer to the CbmrimaryGenerator

Definition at line 47 of file PndPythia6Generator.cxx.

References CloseInput(), fInputFile, fT, and fVerbose.

47  {
48 
49  // Check for input file
50  if (!fInputFile) {
51  // if ( ! fInputFile->is_open() ) {
52  cout << "-E PndPythia6Generator: Input file not open!" << endl;
53  return kFALSE;
54  }
55 
56  // Define event variable to be read from file
57  Int_t ntracks = 0, eventID = 0, ncols = 0;
58 
59  // Define track variables to be read from file
60  Int_t nLev = 0, pdgID = 0, nM1 = -1, nM2 = -1, nDF = -1, nDL = -1;
61  Float_t fPx = 0., fPy = 0., fPz = 0., fM = 0., fE = 0.;
62  Float_t fVx = 0., fVy = 0., fVz = 0., fT = 0.;
63 
64  // Read event header line from input file
65 
66  //Int_t max_nr = 0; //[R.K. 01/2017] unused variable?
67 
68  //Text_t buffer[200]; //[R.K. 01/2017] unused variable?
69  ncols = fscanf(fInputFile,"%d\t%d", &eventID, &ntracks);
70 
71  if (ncols && ntracks>0) {
72 
73  if (fVerbose>0) cout << "Event number: " << eventID << "\tNtracks: " << ntracks << endl;
74 
75  for (Int_t ll=0; ll<ntracks; ll++)
76  {
77  ncols = fscanf(fInputFile,"%d %d %d %d %d %d %f %f %f %f %f %f %f %f %f", &nLev, &pdgID, &nM1, &nM2, &nDF, &nDL, &fPx, &fPy, &fPz, &fE, &fM, &fVx, &fVy, &fVz, &fT);
78  if (fVerbose>0) cout << nLev << "\t" << pdgID << "\t" << nM1 << "\t" << nM2 << "\t" << nDF << "\t" << nDL <<
79  "\t" << fPx << "\t" << fPy << "\t" << fPz << "\t" << fE << "\t" << fM << "\t" << fVx << "\t" << fVy << "\t" << fVz << "\t" << fT << endl;
80  if (nLev==1)
81  primGen->AddTrack(pdgID, fPx, fPy, fPz, fVx, fVy, fVz);
82  }
83  }
84  else {
85  cout << "-I PndPythia6Generator: End of input file reached " << endl;
86  CloseInput();
87  return kFALSE;
88  }
89 
90 
91  // If end of input file is reached : close it and abort run
92  if ( feof(fInputFile) ) {
93  cout << "-I PndPythia6Generator: End of input file reached " << endl;
94  CloseInput();
95  return kFALSE;
96  }
97 
98  /*
99  cout << "-I PndPythia6Generator: Event " << eventID << ", vertex = ("
100  << vx << "," << vy << "," << vz << ") cm, multiplicity "
101  << ntracks << endl;
102  */
103 
104  return kTRUE;
105 }
TClonesArray * fT
Definition: drawGLTracks.C:13
void CloseInput()
Verbose Level.
FairPrimaryGenerator * primGen
Definition: sim_emc_apd.C:81
FILE * fInputFile
Input file Name.
void PndPythia6Generator::SetVerbose ( Int_t  verb)
inline

Definition at line 85 of file PndPythia6Generator.h.

References fVerbose.

85 { fVerbose = verb; };

Member Data Documentation

const Char_t* PndPythia6Generator::fFileName
private

Definition at line 85 of file PndPythia6Generator.h.

Referenced by CloseInput(), and PndPythia6Generator().

FILE* PndPythia6Generator::fInputFile
private

Input file Name.

Definition at line 91 of file PndPythia6Generator.h.

Referenced by CloseInput(), PndPythia6Generator(), and ReadEvent().

Int_t PndPythia6Generator::fVerbose
private

File.

Definition at line 92 of file PndPythia6Generator.h.

Referenced by PndPythia6Generator(), ReadEvent(), and SetVerbose().


The documentation for this class was generated from the following files: