SND@LHC Software
Loading...
Searching...
No Matches
Pythia6Generator Class Reference

#include <Pythia6Generator.h>

Inheritance diagram for Pythia6Generator:
Collaboration diagram for Pythia6Generator:

Public Member Functions

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

Private Member Functions

void CloseInput ()
 Verbose Level.
 
 ClassDef (Pythia6Generator, 1)
 

Private Attributes

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

Detailed Description

Definition at line 60 of file Pythia6Generator.h.

Constructor & Destructor Documentation

◆ Pythia6Generator() [1/2]

Pythia6Generator::Pythia6Generator ( )

Default constructor without arguments should not be used.

Definition at line 17 of file Pythia6Generator.cxx.

17{}

◆ Pythia6Generator() [2/2]

Pythia6Generator::Pythia6Generator ( const char *  fileName)

Standard constructor.

Parameters
fileNameThe input file name

Definition at line 23 of file Pythia6Generator.cxx.

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

◆ ~Pythia6Generator()

Pythia6Generator::~Pythia6Generator ( )
virtual

Destructor.

Definition at line 39 of file Pythia6Generator.cxx.

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

Member Function Documentation

◆ ClassDef()

Pythia6Generator::ClassDef ( Pythia6Generator  ,
 
)
private

PDG data base

◆ CloseInput()

void Pythia6Generator::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 Pythia6Generator.cxx.

111 {
112 if ( fInputFile ) {
113 //if ( fInputFile->is_open() ) {
114 {
115 cout << "-I Pythia6Generator: Closing input file "
116 << fFileName << endl;
117 // fInputFile->close();
118
119 fclose(fInputFile);
120 }
121 delete fInputFile;
122 fInputFile = NULL;
123 }
124}

◆ ReadEvent()

Bool_t Pythia6Generator::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 Pythia6Generator.cxx.

47 {
48
49 // Check for input file
50 if (!fInputFile) {
51 // if ( ! fInputFile->is_open() ) {
52 cout << "-E Pythia6Generator: 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;
67
68 Text_t buffer[200];
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 Pythia6Generator: 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 Pythia6Generator: End of input file reached " << endl;
94 CloseInput();
95 return kFALSE;
96 }
97
98 /*
99 cout << "-I Pythia6Generator: Event " << eventID << ", vertex = ("
100 << vx << "," << vy << "," << vz << ") cm, multiplicity "
101 << ntracks << endl;
102 */
103
104 return kTRUE;
105}

◆ SetVerbose()

void Pythia6Generator::SetVerbose ( Int_t  verb)
inline

Definition at line 85 of file Pythia6Generator.h.

85{ fVerbose = verb; };

Member Data Documentation

◆ fFileName

const Char_t* Pythia6Generator::fFileName
private

Definition at line 90 of file Pythia6Generator.h.

◆ fInputFile

FILE* Pythia6Generator::fInputFile
private

Input file Name.

Definition at line 91 of file Pythia6Generator.h.

◆ fVerbose

Int_t Pythia6Generator::fVerbose
private

File.

Definition at line 92 of file Pythia6Generator.h.


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