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

#include <ecalMatch.h>

Inheritance diagram for ecalMatch:
Collaboration diagram for ecalMatch:

Public Member Functions

 ecalMatch (const char *name, const Int_t verbose)
 
 ecalMatch ()
 
Int_t GetUse3x3 () const
 
void SetUse3x3 (Int_t use3x3=0)
 
virtual void Finish ()
 
virtual void Exec (Option_t *option, TClonesArray *reconstructed, TClonesArray *mctracks)
 
virtual InitStatus Init ()
 
void InitPython (ecalStructure *str, TClonesArray *reconstructed, TClonesArray *mctracks)
 
 ~ecalMatch ()
 

Private Attributes

Int_t fEv
 
Int_t fN
 
Int_t fRejected
 
Int_t fUse3x3
 
TClonesArray * fReconstucted
 
TClonesArray * fMCTracks
 
ecalStructurefStr
 

Detailed Description

Definition at line 11 of file ecalMatch.h.

Constructor & Destructor Documentation

◆ ecalMatch() [1/2]

ecalMatch::ecalMatch ( const char *  name,
const Int_t  verbose 
)

Standard constructor

Definition at line 120 of file ecalMatch.cxx.

121 : FairTask(name, verbose), fEv(0), fN(0), fRejected(0), fUse3x3(0),
122 fReconstucted(NULL), fMCTracks(NULL), fStr(NULL)
123{
124 ;
125}
TClonesArray * fReconstucted
Definition ecalMatch.h:43
ecalStructure * fStr
Definition ecalMatch.h:47
Int_t fN
Definition ecalMatch.h:36
Int_t fRejected
Definition ecalMatch.h:38
Int_t fUse3x3
Definition ecalMatch.h:40
TClonesArray * fMCTracks
Definition ecalMatch.h:45
Int_t fEv
Definition ecalMatch.h:34

◆ ecalMatch() [2/2]

ecalMatch::ecalMatch ( )

Only to comply with frame work.

Definition at line 128 of file ecalMatch.cxx.

129 : FairTask(), fEv(0), fN(0), fRejected(0), fUse3x3(0),
130 fReconstucted(NULL), fMCTracks(NULL), fStr(NULL)
131{
132 ;
133}

◆ ~ecalMatch()

ecalMatch::~ecalMatch ( )

Destructor

Definition at line 142 of file ecalMatch.cxx.

143{
144 ;
145}

Member Function Documentation

◆ Exec()

void ecalMatch::Exec ( Option_t *  option,
TClonesArray *  reconstructed,
TClonesArray *  mctracks 
)
virtual

Exec a task

Definition at line 17 of file ecalMatch.cxx.

18{
19 fReconstucted=reconstructed;
20 fMCTracks=mctracks;
21 fEv++; fN=0; fRejected=0;
22
23 Int_t n=fReconstucted->GetEntries();
24 Int_t i;
26 ecalCell* cell;
27 ecalCellMC* mccell;
28 list<ecalCell*> cells;
29 list<ecalCell*>::const_iterator p;
30 map<Int_t, Float_t> e;
31 map<Int_t, Float_t> e2;
32 map<Int_t, Float_t>::const_iterator ep;
33 map<Int_t, Float_t>::reverse_iterator rp;
34 ShipMCTrack* tr;
35 Int_t trn;
36 Float_t max;
37// if (fVerbose>0) Info("Exec", "Event %d.", fEv);
38 for(i=0;i<n;i++)
39 {
41 cell=fStr->GetHitCell(rc->CellNum());
42 cells.clear();
43
44 if (fUse3x3)
45 {
46 cell->GetNeighborsList(cells); //3x3 without maximum
47 cells.push_back(cell);
48 }
49 else
50 cell->Get5x5Cluster(cells);
51
52 e.clear(); e2.clear();
53 //Counting energy depositions for all particles
54 for(p=cells.begin();p!=cells.end();++p)
55 {
56 mccell=(ecalCellMC*)(*p);
57 for(ep=mccell->GetTrackEnergyBegin();ep!=mccell->GetTrackEnergyEnd();++ep)
58 {
59 if (e.find(ep->first)==e.end())
60 e[ep->first]=ep->second;
61 else
62 e[ep->first]+=ep->second;
63 }
64 }
65
66 //...and parent photons and electrons/positrons
67 for(ep=e.begin();ep!=e.end();++ep)
68 {
69 if (e2.find(ep->first)==e.end())
70 e2[ep->first]=ep->second;
71 else
72 e2[ep->first]+=ep->second;
73 if (ep->first<0&&fVerbose==0) continue;
74 tr=(ShipMCTrack*)fMCTracks->At(ep->first);
75 if (tr==NULL)
76 {
77 Info("Exec", "Event %d. Can't find MCTrack %d.", fEv, ep->first);
78 continue;
79 }
80 for(;;)
81 {
82 if (tr->GetPdgCode()!=22&&TMath::Abs(tr->GetPdgCode())!=11) break;
83 trn=tr->GetMotherId();
84 if (trn<0) break;
85 tr=(ShipMCTrack*)fMCTracks->At(trn);
86 if (tr==NULL)
87 {
88 Info("Exec", "Event %d. Can't find MCTrack %d.", fEv, ep->first);
89 break;
90 }
91 if (tr->GetPdgCode()!=22&&TMath::Abs(tr->GetPdgCode())!=11) break;
92 if (e2.find(trn)==e2.end())
93 e2[trn]=ep->second;
94 else
95 e2[trn]+=ep->second;
96 }
97 }
98
99 //Maximum location
100 max=-1e11; trn=-1111;
101 for(rp=e2.rbegin();rp!=e2.rend();++rp)
102 {
103 if (rp->second>max)
104 { max=rp->second; trn=rp->first;}
105 }
106
107 if (trn>=0)
108 {
109 rc->SetMCTrack(trn);
110 fN++;
111 }
112 else
113 fRejected++;
114 }
115
116 if (fVerbose>0) Info("Exec", "Event %d. Matched %d. Skipped %d maxs.", fEv, fN, fRejected);
117}
Int_t GetPdgCode() const
Definition ShipMCTrack.h:58
Int_t GetMotherId() const
Definition ShipMCTrack.h:59
std::map< Int_t, Float_t >::const_iterator GetTrackEnergyBegin() const
Definition ecalCellMC.h:50
std::map< Int_t, Float_t >::const_iterator GetTrackEnergyEnd() const
Definition ecalCellMC.h:52
void GetNeighborsList(std::list< ecalCell * > &neib) const
Definition ecalCell.h:48
void Get5x5Cluster(std::list< ecalCell * > &cls)
Definition ecalCell.h:58
ecalCell * GetHitCell(const Int_t hitId) const
int i
Definition ShipAna.py:86

◆ Finish()

void ecalMatch::Finish ( )
virtual

Finish a task

Definition at line 136 of file ecalMatch.cxx.

137{
138 ;
139}

◆ GetUse3x3()

Int_t ecalMatch::GetUse3x3 ( ) const
inline

Should we use 3x3 cluster instead of 5x5

Definition at line 20 of file ecalMatch.h.

20{return fUse3x3;}

◆ Init()

InitStatus ecalMatch::Init ( )
virtual

Initialization

Definition at line 147 of file ecalMatch.cxx.

148{
149 FairRootManager* io=FairRootManager::Instance();
150 if (!io)
151 {
152 Fatal("Init", "Can't find IOManager.");
153 return kFATAL;
154 }
155 fStr=(ecalStructure*)io->GetObject("EcalStructure");
156 if (!fStr)
157 {
158 Fatal("Init()", "Can't find calorimeter structure in the system.");
159 return kFATAL;
160 }
161 fReconstucted=(TClonesArray*)io->GetObject("EcalReco");
162 if (!fReconstucted)
163 {
164 Fatal("Init", "Can't find array of reconstructed calorimeter objects in the system.");
165 return kFATAL;
166 }
167 fMCTracks=(TClonesArray*)io->GetObject("MCTrack");
168 if (!fMCTracks)
169 {
170 Fatal("Init", "Can't find array of MC tracks in the system.");
171 return kFATAL;
172 }
173
174 fEv=0;
175 return kSUCCESS;
176}

◆ InitPython()

void ecalMatch::InitPython ( ecalStructure str,
TClonesArray *  reconstructed,
TClonesArray *  mctracks 
)

Definition at line 178 of file ecalMatch.cxx.

179{
180 fStr=str;
181 fReconstucted=reconstructed;
182 fMCTracks=mctracks;
183
184 fEv=0;
185}

◆ SetUse3x3()

void ecalMatch::SetUse3x3 ( Int_t  use3x3 = 0)
inline

Definition at line 21 of file ecalMatch.h.

21{fUse3x3=use3x3;}

Member Data Documentation

◆ fEv

Int_t ecalMatch::fEv
private

Current event

Definition at line 34 of file ecalMatch.h.

◆ fMCTracks

TClonesArray* ecalMatch::fMCTracks
private

Array of MC tracks

Definition at line 45 of file ecalMatch.h.

◆ fN

Int_t ecalMatch::fN
private

Current reconstructed particle

Definition at line 36 of file ecalMatch.h.

◆ fReconstucted

TClonesArray* ecalMatch::fReconstucted
private

Array of reconstructed objects

Definition at line 43 of file ecalMatch.h.

◆ fRejected

Int_t ecalMatch::fRejected
private

Number of rejected clusters

Definition at line 38 of file ecalMatch.h.

◆ fStr

ecalStructure* ecalMatch::fStr
private

A calorimeter structure

Definition at line 47 of file ecalMatch.h.

◆ fUse3x3

Int_t ecalMatch::fUse3x3
private

Use 3x3 cluster instead of 5x5

Definition at line 40 of file ecalMatch.h.


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