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

#include <ALPACAGenerator.h>

Inheritance diagram for ALPACAGenerator:
Collaboration diagram for ALPACAGenerator:

Public Member Functions

 ALPACAGenerator ()
 
virtual ~ALPACAGenerator ()
 
Bool_t ReadEvent (FairPrimaryGenerator *)
 
virtual Bool_t Init (const char *, int)
 
virtual Bool_t Init (const char *)
 
Int_t GetNevents ()
 

Protected Member Functions

 ClassDef (ALPACAGenerator, 1)
 

Protected Attributes

Float_t pdg
 
Float_t parent
 
Float_t event
 
Float_t track
 
Float_t e
 
Float_t tof
 
Float_t x
 
Float_t y
 
Float_t z
 
Float_t px
 
Float_t py
 
Float_t pz
 
Float_t w
 
TFile * fInputFile
 
TTree * fTree
 
FairLogger * fLogger
 
int fNevents
 don't make it persistent, magic ROOT command
 
int fn
 

Detailed Description

Definition at line 11 of file ALPACAGenerator.h.

Constructor & Destructor Documentation

◆ ALPACAGenerator()

ALPACAGenerator::ALPACAGenerator ( )

default constructor

Definition at line 17 of file ALPACAGenerator.cxx.

17{}

◆ ~ALPACAGenerator()

ALPACAGenerator::~ALPACAGenerator ( )
virtual

destructor

Definition at line 52 of file ALPACAGenerator.cxx.

53{
54 // cout << "destroy Ntuple" << endl;
55 fInputFile->Close();
56 fInputFile->Delete();
57 delete fInputFile;
58}

Member Function Documentation

◆ ClassDef()

ALPACAGenerator::ClassDef ( ALPACAGenerator  ,
 
)
protected

◆ GetNevents()

Int_t ALPACAGenerator::GetNevents ( )

Definition at line 92 of file ALPACAGenerator.cxx.

93{
94 return fNevents/3;
95}
int fNevents
don't make it persistent, magic ROOT command

◆ Init() [1/2]

Bool_t ALPACAGenerator::Init ( const char *  fileName)
virtual

Definition at line 20 of file ALPACAGenerator.cxx.

20 {
21 return Init(fileName, 0);
22}
virtual Bool_t Init(const char *, int)

◆ Init() [2/2]

Bool_t ALPACAGenerator::Init ( const char *  fileName,
int  firstEvent 
)
virtual

Definition at line 24 of file ALPACAGenerator.cxx.

24 {
25 cout << "Info ALPACAGenerator: Opening input file " << fileName << endl;
26 fInputFile = new TFile(fileName);
27 if (fInputFile->IsZombie()) {
28 cout << "-E ALPACAGenerator: Error opening the Signal file" << fileName << endl;
29 }
30 fTree = (TTree *)fInputFile->Get("MCTrack");
31 fNevents = fTree->GetEntries();
33 fTree->SetBranchAddress("event",&event); //event no.
34 fTree->SetBranchAddress("track",&track); //track no.
35 fTree->SetBranchAddress("pdg",&pdg); // particle pdg
36 fTree->SetBranchAddress("parent",&parent); // parent track number
37 fTree->SetBranchAddress("tof",&tof); // time of flight
38 fTree->SetBranchAddress("e",&e); // incoming muon energy
39 fTree->SetBranchAddress("w",&w); // weight of event
40 fTree->SetBranchAddress("x",&x); // position in x
41 fTree->SetBranchAddress("y",&y); // position in y
42 fTree->SetBranchAddress("z",&z); // position in z
43 fTree->SetBranchAddress("px",&px); // momentum in x
44 fTree->SetBranchAddress("py",&py); // momentum in y
45 fTree->SetBranchAddress("pz",&pz); // momentum in z
46 return kTRUE;
47}
int firstEvent
Definition MufluxReco.py:13

◆ ReadEvent()

Bool_t ALPACAGenerator::ReadEvent ( FairPrimaryGenerator *  cpg)

public method ReadEvent

Definition at line 62 of file ALPACAGenerator.cxx.

63{
64 if (fn<fNevents) {
65 fTree->GetEntry(fn); // ALP is getting,
66 if (track==0&&parent==-1) {
67 cpg->AddTrack(pdg,px,py,pz,x,y,z,-1.,false,e,tof,w); // ALP track is added.
68 }
69 fTree->GetEntry(fn+1); // First daughter/photon is getting,
70 if (track==1&&parent==0) {
71 cpg->AddTrack(pdg,px,py,pz,x,y,z,0,true,e,tof,w); // First daughter/photon track is added.
72 }
73 fTree->GetEntry(fn+2); // Second daughter/photon is getting,
74 if (track==2&&parent==0) {
75 cpg->AddTrack(pdg,px,py,pz,x,y,z,0,true,e,tof,w); // Second daughter/photon track is added.
76 }
77 else {
78 return kFALSE;
79 }
80 fn=fn+3; // Goes to next event, more specifically next ALP,
81 cout << "Event Number:"<<fn/3 <<endl; // this division is due to the fact that ntuple is recorded in track based and every event has three tracks.
82 return kTRUE;
83 }
84 else {
85 cout << "No more input events"<<endl;
86 return kFALSE;
87 }
88}

Member Data Documentation

◆ e

Float_t ALPACAGenerator::e
protected

Definition at line 30 of file ALPACAGenerator.h.

◆ event

Float_t ALPACAGenerator::event
protected

Definition at line 29 of file ALPACAGenerator.h.

◆ fInputFile

TFile* ALPACAGenerator::fInputFile
protected

Definition at line 32 of file ALPACAGenerator.h.

◆ fLogger

FairLogger* ALPACAGenerator::fLogger
protected

Definition at line 34 of file ALPACAGenerator.h.

◆ fn

int ALPACAGenerator::fn
protected

Definition at line 36 of file ALPACAGenerator.h.

◆ fNevents

int ALPACAGenerator::fNevents
protected

don't make it persistent, magic ROOT command

Definition at line 35 of file ALPACAGenerator.h.

◆ fTree

TTree* ALPACAGenerator::fTree
protected

Definition at line 33 of file ALPACAGenerator.h.

◆ parent

Float_t ALPACAGenerator::parent
protected

Definition at line 29 of file ALPACAGenerator.h.

◆ pdg

Float_t ALPACAGenerator::pdg
protected

Definition at line 29 of file ALPACAGenerator.h.

◆ px

Float_t ALPACAGenerator::px
protected

Definition at line 30 of file ALPACAGenerator.h.

◆ py

Float_t ALPACAGenerator::py
protected

Definition at line 30 of file ALPACAGenerator.h.

◆ pz

Float_t ALPACAGenerator::pz
protected

Definition at line 30 of file ALPACAGenerator.h.

◆ tof

Float_t ALPACAGenerator::tof
protected

Definition at line 30 of file ALPACAGenerator.h.

◆ track

Float_t ALPACAGenerator::track
protected

Definition at line 29 of file ALPACAGenerator.h.

◆ w

Float_t ALPACAGenerator::w
protected

Definition at line 31 of file ALPACAGenerator.h.

◆ x

Float_t ALPACAGenerator::x
protected

Definition at line 30 of file ALPACAGenerator.h.

◆ y

Float_t ALPACAGenerator::y
protected

Definition at line 30 of file ALPACAGenerator.h.

◆ z

Float_t ALPACAGenerator::z
protected

Definition at line 30 of file ALPACAGenerator.h.


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