SND@LHC Software
Loading...
Searching...
No Matches
ecalCellMC.cxx
Go to the documentation of this file.
1
7#include "ecalCellMC.h"
8
9#include <algorithm>
10#include <iostream>
11
12using std::cout;
13using std::endl;
14using std::map;
15using std::list;
16
17//-----------------------------------------------------------------------------
18ecalCellMC::ecalCellMC(Int_t cellnumber, Float_t x1, Float_t y1, Float_t x2, Float_t y2, Char_t type, Float_t energy)
19 : ecalCell(cellnumber, x1, y1, x2, y2, type, energy),
20 fTrackEnergy(),
21 fTrackTime()
22{
23}
24//-----------------------------------------------------------------------------
25Float_t ecalCellMC::GetTrackTime(Int_t num) const
26{
27 map<Int_t, Float_t>::const_iterator p=fTrackTime.find(num);
28 if (p==fTrackTime.end()) return 0; else return p->second;
29}
30
31
32//-----------------------------------------------------------------------------
33Float_t ecalCellMC::GetTrackEnergy(Int_t num) const
34{
35 map<Int_t, Float_t>::const_iterator p=fTrackEnergy.find(num);
36 if (p==fTrackEnergy.end()) return 0; else return p->second;
37}
38
39//-----------------------------------------------------------------------------
41{
43 fTrackEnergy.clear();
44 fTrackTime.clear();
45}
46
47//-----------------------------------------------------------------------------
49{
50 Float_t energy=GetTrackEnergy(num);
51 list<ecalCell*> cls; GetNeighborsList(cls);
52 list<ecalCell*>::const_iterator p=cls.begin();
53 for(;p!=cls.end();++p)
54 energy+=((ecalCellMC*)(*p))->GetTrackEnergy(num);
55 return energy;
56}
57
58// Don't use slow methods except in emergency!!!
59//-----------------------------------------------------------------------------
60void ecalCellMC::GetTrackEnergySlow(Int_t n, Int_t& trackid, Double_t& energy_dep)
61{
62 map<Int_t, Float_t>::const_iterator p=fTrackEnergy.begin();
63 if (n>=fTrackEnergy.size()) {trackid=-1111; energy_dep=-1111; return; }
64 Int_t i=0;
65 for(i=0;i<n;i++) (++p);
66 trackid=p->first; energy_dep=p->second;
67}
68
69// Don't use slow methods except in emergency!!!
70//-----------------------------------------------------------------------------
71void ecalCellMC::GetTrackTimeSlow(Int_t n, Int_t& trackid, Float_t& time)
72{
73 map<Int_t, Float_t>::const_iterator p=fTrackTime.begin();
74 if (n>=fTrackTime.size()) {trackid=-1111; time=-1111; return; }
75 Int_t i=0;
76 for(i=0;i<n;i++) (++p);
77 trackid=p->first; time=p->second;
78}
79
81
Float_t GetTrackEnergy(Int_t num) const
Float_t GetTrackTime(Int_t num) const
std::map< Int_t, Float_t > fTrackTime
Definition ecalCellMC.h:65
void ResetEnergy()
Float_t GetTrackClusterEnergy(Int_t num)
ecalCellMC(Int_t cellnumber, Float_t x1=0, Float_t y1=0, Float_t x2=0, Float_t y2=0, Char_t type=0, Float_t energy=0)
void GetTrackTimeSlow(Int_t n, Int_t &trackid, Float_t &time)
void GetTrackEnergySlow(Int_t n, Int_t &trackid, Double_t &energy_dep)
std::map< Int_t, Float_t > fTrackEnergy
Definition ecalCellMC.h:62
void GetNeighborsList(std::list< ecalCell * > &neib) const
Definition ecalCell.h:48
void ResetEnergyFast()
Definition ecalCell.h:109
ClassImp(ecalContFact) ecalContFact