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

#include <PndHypBupGenerator.h>

Inheritance diagram for PndHypBupGenerator:

Public Member Functions

 PndHypBupGenerator ()
 
 PndHypBupGenerator (const char *fileName)
 
virtual ~PndHypBupGenerator ()
 
void SetPhiRange (Double32_t phimin=0, Double32_t phimax=360)
 
void SetThetaRange (Double32_t thetamin=0, Double32_t thetamax=90)
 
void SetPRange (Double32_t pmin=0, Double32_t pmax=10)
 
void GammaEmissPar (Bool_t On=kFALSE)
 
virtual Bool_t ReadEvent (FairPrimaryGenerator *primGen)
 
 PndHypBupGenerator ()
 
 PndHypBupGenerator (const char *fileName)
 
virtual ~PndHypBupGenerator ()
 
virtual Bool_t ReadEvent (FairPrimaryGenerator *primGen)
 

Private Member Functions

void CloseInput ()
 
 ClassDef (PndHypBupGenerator, 2)
 
void CloseInput ()
 Particle array from PLUTO. More...
 
 ClassDef (PndHypBupGenerator, 1)
 

Private Attributes

Int_t iEvent
 PDG database. More...
 
const Char_t * fFileName
 Event number. More...
 
TFile * fInputFile
 Input file name. More...
 
TTree * fInputTree
 Pointer to input file. More...
 
TClonesArray * fParticles
 Pointer to input tree. More...
 
Double32_t fPMin
 Particle array. More...
 
Double32_t fPMax
 
Double32_t fPhiMin
 Transverse momentum range [GeV]. More...
 
Double32_t fPhiMax
 
Double32_t fThetaMin
 Azimuth angle range [degree]. More...
 
Double32_t fThetaMax
 
Bool_t fThetaRangeIsSet
 Polar angle range in lab system [degree]. More...
 
Bool_t fPRangeIsSet
 
Bool_t fGamOn
 

Detailed Description

Definition at line 36 of file detectors/hyp/hypTools/PndHypBupGenerator.h.

Constructor & Destructor Documentation

PndHypBupGenerator::PndHypBupGenerator ( )

Default constructor without arguments should not be used.

Definition at line 25 of file detectors/hyp/hypTools/PndHypBupGenerator.cxx.

References fInputFile, fInputTree, and iEvent.

25  :fPMin(0),fPMax(0),
28  iEvent = 0;
29  fInputFile = NULL;
30  fInputTree = NULL;
31 }
TTree * fInputTree
Pointer to input file.
Double32_t fThetaMin
Azimuth angle range [degree].
Bool_t fThetaRangeIsSet
Polar angle range in lab system [degree].
Double32_t fPhiMin
Transverse momentum range [GeV].
PndHypBupGenerator::PndHypBupGenerator ( const char *  fileName)

Standard constructor.

Parameters
fileNameThe input file name

Definition at line 37 of file detectors/hyp/hypTools/PndHypBupGenerator.cxx.

References fFileName, fInputFile, fInputTree, fParticles, and iEvent.

37  :fPMin(0),fPMax(0),
40 
41 
42  fFileName = fileName;
43  iEvent = 0;
44  fInputFile = new TFile(fFileName);
45  fInputTree = (TTree*) fInputFile->Get("data");
46  fParticles = new TClonesArray("THParticle",100);
47  fInputTree->SetBranchAddress("Particles", &fParticles);
48 
49 
50 
51 }
const Char_t * fFileName
Event number.
TTree * fInputTree
Pointer to input file.
TClonesArray * fParticles
Pointer to input tree.
Double32_t fThetaMin
Azimuth angle range [degree].
Bool_t fThetaRangeIsSet
Polar angle range in lab system [degree].
Double32_t fPhiMin
Transverse momentum range [GeV].
PndHypBupGenerator::~PndHypBupGenerator ( )
virtual

Destructor.

Definition at line 57 of file detectors/hyp/hypTools/PndHypBupGenerator.cxx.

References CloseInput().

PndHypBupGenerator::PndHypBupGenerator ( )

Default constructor without arguments should not be used.

PndHypBupGenerator::PndHypBupGenerator ( const char *  fileName)

Standard constructor.

Parameters
fileNameThe input file name
virtual PndHypBupGenerator::~PndHypBupGenerator ( )
virtual

Destructor.

Member Function Documentation

PndHypBupGenerator::ClassDef ( PndHypBupGenerator  ,
 
)
private

Private method RegisterIons. Goes through the input file and registers any ion needed. STL map from ion name to CbmIon

PndHypBupGenerator::ClassDef ( PndHypBupGenerator  ,
 
)
private

Private method RegisterIons. Goes through the input file and registers any ion needed. STL map from ion name to CbmIon

void PndHypBupGenerator::CloseInput ( )
private

Particle array from PLUTO.

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

void PndHypBupGenerator::CloseInput ( )
private

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

Definition at line 168 of file detectors/hyp/hypTools/PndHypBupGenerator.cxx.

References fFileName, and fInputFile.

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

168  {
169 
170  if ( fInputFile) {
171  cout << "-I- CbmHypBupGenerator: Closing input file "
172  << fFileName << endl;
173  fInputFile->Close();
174 
175  delete fInputFile;
176  }
177 
178  fInputFile = NULL;
179  }
const Char_t * fFileName
Event number.
void PndHypBupGenerator::GammaEmissPar ( Bool_t  On = kFALSE)
inline

Definition at line 65 of file detectors/hyp/hypTools/PndHypBupGenerator.h.

References fGamOn.

Referenced by run(), run_test(), and sim_Gamma().

virtual Bool_t PndHypBupGenerator::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 CbmPrimaryGenerator
Bool_t PndHypBupGenerator::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 CbmPrimaryGenerator

Definition at line 65 of file detectors/hyp/hypTools/PndHypBupGenerator.cxx.

References acos(), CloseInput(), CAMath::Cos(), cos(), Double_t, fGamOn, fInputFile, fInputTree, fParticles, fPMax, fPMin, fThetaMax, fThetaMin, g, THParticle::GetPdgCode(), iEvent, p, phi, pz, CAMath::Sin(), theta, THParticle::Vx(), THParticle::Vy(), and THParticle::Vz().

65  {
66 
67  // Check for input file
68  if ( ! fInputFile ) {
69  cout << "-E- PndHypBupGenerator: Input file not open!" << endl;
70  return kFALSE;
71  }
72  // Check for number of events in input file
73  if ( iEvent > fInputTree->GetEntries() ) {
74  cout << "-E PndDpmGenerator: No more events in input file!" << endl;
75  CloseInput();
76  return kFALSE;
77  }
78 
79  // Defining kinematics variables, angle is expressed in degrees.
80  Double_t phi, p=0.0,theta=0.0;
81 
82  TFile *g=gFile;
83  fInputFile->cd();
84  fInputTree->GetEntry(iEvent++);
85  g->cd();
86 
87  // Get number of particle in TClonesrray
88  Int_t nParts = fParticles->GetEntriesFast();
89 
90  // Loop over particles in TClonesArray
91 
92  for (Int_t iPart=0; iPart < nParts; iPart++) {
93  THParticle* part = (THParticle*) fParticles->At(iPart);
94  Int_t pdgType = part->GetPdgCode();
95 
96  // Check if particle type is known to database
97  if ( ! pdgType ) {
98  cout << "-W PndDpmGenerator: Unknown type " << part->GetPdgCode()
99  << ", skipping particle." << endl;
100  continue;
101  }
102 
103  Double_t px = 0.;
104  Double_t py = 0.;
105  Double_t pz = 0.;
106 
107  Double_t vx ;
108  Double_t vy ;
109  Double_t vz ;
110 
111  if(fGamOn){
112 
113  phi = gRandom->Uniform(0,360)* TMath::DegToRad();
114  p = gRandom->Uniform(fPMin,fPMax);
115  theta = acos(gRandom->Uniform(cos(fThetaMin* TMath::DegToRad()),cos(fThetaMax* TMath::DegToRad())));
116 
117  pz = p*TMath::Cos(theta);
118  py = p*TMath::Sin(theta)*TMath::Sin(phi);
119  px = p*TMath::Sin(theta)*TMath::Cos(phi);
120 
121  vx = part->Vx();
122  vy = part->Vy();
123  vz = part->Vz();
124 
125 
126  cout<<" Secondary vertex for stopping Xi - gammas "<<vx<<" "
127  <<vy<<" "<<vz<<endl;
128 
129  // Give track to PrimaryGenerator
130 
131 
132  primGen->AddTrack(22, px, py, pz, vx, vy,vz);
133 
134 
135 
136  }else
137  {
138  px= part->Px();
139  py= part->Py();
140  pz= part->Pz();
141 
142 
143  vx = part->Vx();
144  vy = part->Vy();
145  vz = part->Vz();
146 
147 
148  cout<<" Secondary vertex for stopping Xi - "<<pdgType<<" "<<vx<<" "
149  <<vy<<" "<<vz<<endl;
150 
151  // Give track to PrimaryGenerator
152 
153 
154  primGen->AddTrack(pdgType, px, py, pz, vx, vy,vz);
155  }
156 
157 
158  }
159 
160 
161  return kTRUE;
162 }
friend F32vec4 acos(const F32vec4 &a)
Definition: P4_F32vec4.h:113
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
TTree * fInputTree
Pointer to input file.
Double_t Vy() const
Definition: THParticle.h:70
Double_t Vz() const
Definition: THParticle.h:71
static T Sin(const T &x)
Definition: PndCAMath.h:42
TFile * g
static T Cos(const T &x)
Definition: PndCAMath.h:43
Double_t p
Definition: anasim.C:58
FairPrimaryGenerator * primGen
Definition: sim_emc_apd.C:81
TClonesArray * fParticles
Pointer to input tree.
Double_t
Double32_t fThetaMin
Azimuth angle range [degree].
Double_t Vx() const
Definition: THParticle.h:69
Int_t GetPdgCode() const
Definition: THParticle.h:60
double pz[39]
Definition: pipisigmas.h:14
void PndHypBupGenerator::SetPhiRange ( Double32_t  phimin = 0,
Double32_t  phimax = 360 
)
inline

Modifiers

Definition at line 56 of file detectors/hyp/hypTools/PndHypBupGenerator.h.

References fPhiMax, and fPhiMin.

Referenced by run(), run_test(), and sim_Gamma().

57  {fPhiMin=phimin; fPhiMax=phimax;};
Double32_t fPhiMin
Transverse momentum range [GeV].
void PndHypBupGenerator::SetPRange ( Double32_t  pmin = 0,
Double32_t  pmax = 10 
)
inline
void PndHypBupGenerator::SetThetaRange ( Double32_t  thetamin = 0,
Double32_t  thetamax = 90 
)
inline

Definition at line 59 of file detectors/hyp/hypTools/PndHypBupGenerator.h.

References fThetaMax, fThetaMin, and fThetaRangeIsSet.

Referenced by run(), run_test(), and sim_Gamma().

60  {fThetaMin=thetamin; fThetaMax=thetamax; fThetaRangeIsSet=kTRUE;};
Double32_t fThetaMin
Azimuth angle range [degree].
Bool_t fThetaRangeIsSet
Polar angle range in lab system [degree].

Member Data Documentation

const Char_t * PndHypBupGenerator::fFileName
private

Event number.

Definition at line 79 of file detectors/hyp/hypTools/PndHypBupGenerator.h.

Referenced by CloseInput(), and PndHypBupGenerator().

Bool_t PndHypBupGenerator::fGamOn
private

Definition at line 89 of file detectors/hyp/hypTools/PndHypBupGenerator.h.

Referenced by GammaEmissPar(), and ReadEvent().

TFile * PndHypBupGenerator::fInputFile
private

Input file name.

Definition at line 80 of file detectors/hyp/hypTools/PndHypBupGenerator.h.

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

TTree * PndHypBupGenerator::fInputTree
private

Pointer to input file.

Definition at line 81 of file detectors/hyp/hypTools/PndHypBupGenerator.h.

Referenced by PndHypBupGenerator(), and ReadEvent().

TClonesArray * PndHypBupGenerator::fParticles
private

Pointer to input tree.

Definition at line 82 of file detectors/hyp/hypTools/PndHypBupGenerator.h.

Referenced by PndHypBupGenerator(), and ReadEvent().

Double32_t PndHypBupGenerator::fPhiMax
private

Definition at line 85 of file detectors/hyp/hypTools/PndHypBupGenerator.h.

Referenced by SetPhiRange().

Double32_t PndHypBupGenerator::fPhiMin
private

Transverse momentum range [GeV].

Definition at line 85 of file detectors/hyp/hypTools/PndHypBupGenerator.h.

Referenced by SetPhiRange().

Double32_t PndHypBupGenerator::fPMax
private

Definition at line 84 of file detectors/hyp/hypTools/PndHypBupGenerator.h.

Referenced by ReadEvent(), and SetPRange().

Double32_t PndHypBupGenerator::fPMin
private

Particle array.

Definition at line 84 of file detectors/hyp/hypTools/PndHypBupGenerator.h.

Referenced by ReadEvent(), and SetPRange().

Bool_t PndHypBupGenerator::fPRangeIsSet
private

Definition at line 88 of file detectors/hyp/hypTools/PndHypBupGenerator.h.

Referenced by SetPRange().

Double32_t PndHypBupGenerator::fThetaMax
private

Definition at line 86 of file detectors/hyp/hypTools/PndHypBupGenerator.h.

Referenced by ReadEvent(), and SetThetaRange().

Double32_t PndHypBupGenerator::fThetaMin
private

Azimuth angle range [degree].

Definition at line 86 of file detectors/hyp/hypTools/PndHypBupGenerator.h.

Referenced by ReadEvent(), and SetThetaRange().

Bool_t PndHypBupGenerator::fThetaRangeIsSet
private

Polar angle range in lab system [degree].

Definition at line 87 of file detectors/hyp/hypTools/PndHypBupGenerator.h.

Referenced by SetThetaRange().

Int_t PndHypBupGenerator::iEvent
private

PDG database.

Definition at line 78 of file detectors/hyp/hypTools/PndHypBupGenerator.h.

Referenced by PndHypBupGenerator(), and ReadEvent().


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