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

#include <hcalStructure.h>

Inheritance diagram for hcalStructure:
Collaboration diagram for hcalStructure:

Public Member Functions

 hcalStructure (hcalInf *hcalinf)
 
void SetUseMC (Int_t mc=0)
 
Int_t GetUseMC () const
 
void Construct ()
 
Int_t GetNumber (Int_t x, Int_t y) const
 
Bool_t AddEnergy (Float_t x, Float_t y, Float_t energy, Float_t energy2)
 
Float_t GetEnergy (Float_t x, Float_t y, Int_t section=0) const
 
hcalModuleGetModule (Float_t x, Float_t y) const
 
Int_t GetModuleNumber (Float_t x, Float_t y) const
 
Float_t GetX1 () const
 
Float_t GetY1 () const
 
Float_t GetX2 () const
 
Float_t GetY2 () const
 
hcalInfGetHcalInf () const
 
void GetStructure (std::vector< hcalModule * > &stru) const
 
void GetModules (std::list< hcalModule * > &mdls) const
 
void ResetModules ()
 
hcalModuleCreateModule (char type, Int_t number, Float_t x1, Float_t y1, Float_t x2, Float_t y2)
 
Int_t GetHitId (Float_t x, Float_t y) const
 
void GetHitXY (const Int_t hitId, Float_t &x, Float_t &y) const
 
hcalModuleGetModule (Int_t fVolId, Int_t &section)
 
hcalModuleGetHitModule (const Int_t hitId) const
 

Private Member Functions

Int_t GetNum (Int_t x, Int_t y) const
 
void Serialize ()
 
 hcalStructure (const hcalStructure &)
 
hcalStructureoperator= (const hcalStructure &)
 
 ClassDef (hcalStructure, 1)
 

Private Attributes

Int_t fUseMC
 
Float_t fX1
 
Float_t fY1
 
hcalInffHcalInf
 
std::vector< hcalModule * > fStructure
 
std::list< hcalModule * > fModules
 
std::vector< hcalModule * > fHash
 

Detailed Description

Definition at line 20 of file hcalStructure.h.

Constructor & Destructor Documentation

◆ hcalStructure() [1/2]

hcalStructure::hcalStructure ( hcalInf hcalinf)

Definition at line 69 of file hcalStructure.cxx.

70 : TNamed("hcalStructure", "Hadron calorimeter structure"),
71 fUseMC(0),
72 fX1(0.),
73 fY1(0.),
74 fHcalInf(hcalinf),
75 fStructure(),
76 fModules(),
77 fHash()
78{
81}
Double_t GetYPos() const
Definition hcalInf.h:33
Double_t GetModuleSize() const
Definition hcalInf.h:36
Double_t GetXPos() const
Definition hcalInf.h:32
Int_t GetYSize() const
Definition hcalInf.h:47
Int_t GetXSize() const
Definition hcalInf.h:46
std::vector< hcalModule * > fStructure
std::vector< hcalModule * > fHash
hcalInf * fHcalInf
std::list< hcalModule * > fModules

◆ hcalStructure() [2/2]

hcalStructure::hcalStructure ( const hcalStructure )
private

Member Function Documentation

◆ AddEnergy()

Bool_t hcalStructure::AddEnergy ( Float_t  x,
Float_t  y,
Float_t  energy,
Float_t  energy2 
)
inline

Add preshower or calorimeter energy to a module with coordinate (x,y)

Definition at line 125 of file hcalStructure.h.

126{
128 hcalModule* mdl=GetModule(x,y);
129 if (mdl)
130 {
131 mdl->AddEnergy(energy);
132 mdl->AddEnergy2(energy2);
133 }
134 else
135 return kFALSE;
136 return kTRUE;
137}
void AddEnergy2(Float_t energy)
Definition hcalModule.h:58
void AddEnergy(Float_t energy)
Definition hcalModule.h:57
hcalModule * GetModule(Float_t x, Float_t y) const

◆ ClassDef()

hcalStructure::ClassDef ( hcalStructure  ,
 
)
private

◆ Construct()

void hcalStructure::Construct ( )

Definition at line 84 of file hcalStructure.cxx.

85{
86 if (!fHcalInf) return;
87
88 Float_t x1=GetX1();
89 Float_t y1=GetY1();
90 Float_t x;
91 Float_t y;
92 Float_t dx;
93 Float_t dy;
94 Int_t i;
95 Int_t j;
96 Int_t k;
97 Int_t number;
98 char type;
99
100 fStructure.resize(fHcalInf->GetXSize()*fHcalInf->GetYSize(), NULL);
101
104 //Creating ECAL Matrix
105 for(i=0;i<fHcalInf->GetXSize();i++)
106 for(j=0;j<fHcalInf->GetYSize();j++) {
107 type=fHcalInf->GetType(i,j);
108 if (type) {
109 x=x1+i*dx;
110 y=y1+j*dy;
111 number=(i*100+j)*100;
112 fStructure[GetNum(i,j)]=CreateModule(type,number,x,y,x+dx,y+dy);
113 }
114 else
115 fStructure[GetNum(i,j)]=NULL;
116 }
117#ifdef _DECALSTRUCT
118 Info("Construct()", "Calorimeter matrix created.");
119#endif
120 //Now HCAL matrix created
121 list<hcalModule*> neib;
122 vector<hcalModule*> cl;
123 vector<hcalModule*>::const_iterator pcl;
124
125 Int_t num;
126 //We want neighbors for ecalModules be ecalModules
127 for(i=0;i<fHcalInf->GetXSize();i++)
128 for(j=0;j<fHcalInf->GetYSize();j++)
129 if (fStructure[GetNum(i,j)]) {
130 neib.clear();
131
132 num=GetNumber(i-1,j);
133 if (-1!=num) {
134 neib.push_back(fStructure[num]);
135 }
136
137 num=GetNumber(i-1,j+1);
138 if (-1!=num) {
139 neib.push_back(fStructure[num]);
140 }
141
142 num=GetNumber(i,j+1);
143 if (-1!=num) {
144 neib.push_back(fStructure[num]);
145 }
146
147 num=GetNumber(i+1,j+1);
148 if (-1!=num) {
149 neib.push_back(fStructure[num]);
150 }
151
152 num=GetNumber(i+1,j);
153 if (-1!=num) {
154 neib.push_back(fStructure[num]);
155 }
156
157 num=GetNumber(i+1,j-1);
158 if (-1!=num) {
159 neib.push_back(fStructure[num]);
160 }
161
162 num=GetNumber(i,j-1);
163 if (-1!=num) {
164 neib.push_back(fStructure[num]);
165 }
166
167 num=GetNumber(i-1,j-1);
168 if (-1!=num) {
169 neib.push_back(fStructure[num]);
170 }
171
172 num=GetNumber(i,j);
173 fStructure[num]->SetNeighborsList(neib);
174 }
175 Serialize();
176}
char GetType(Int_t x, Int_t y) const
Definition hcalInf.h:158
hcalModule * CreateModule(char type, Int_t number, Float_t x1, Float_t y1, Float_t x2, Float_t y2)
Int_t GetNum(Int_t x, Int_t y) const
Float_t GetX1() const
Int_t GetNumber(Int_t x, Int_t y) const
Float_t GetY1() const
int i
Definition ShipAna.py:86

◆ CreateModule()

hcalModule * hcalStructure::CreateModule ( char  type,
Int_t  number,
Float_t  x1,
Float_t  y1,
Float_t  x2,
Float_t  y2 
)

Definition at line 55 of file hcalStructure.cxx.

56{
57 if (type!=1)
58 {
59 Fatal("CreateModule", "All modules in hcal should have type 1");
60 return NULL;
61 }
62 if (fUseMC)
63 return new hcalModuleMC(number, x1, y1, x2, y2);
64 else
65 return new hcalModule(number, x1, y1, x2, y2);
66}

◆ GetEnergy()

Float_t hcalStructure::GetEnergy ( Float_t  x,
Float_t  y,
Int_t  section = 0 
) const
inline

Definition at line 139 of file hcalStructure.h.

140{
141 hcalModule* mdl=GetModule(x,y);
142 if (mdl)
143 {
144 if (section==1)
145 return mdl->GetEnergy2();
146 else
147 return mdl->GetEnergy();
148 }
149 return -1111;
150}
Float_t GetEnergy() const
Definition hcalModule.h:41
Float_t GetEnergy2() const
Definition hcalModule.h:42

◆ GetHcalInf()

hcalInf * hcalStructure::GetHcalInf ( ) const
inline

Definition at line 38 of file hcalStructure.h.

38{return fHcalInf;}

◆ GetHitId()

Int_t hcalStructure::GetHitId ( Float_t  x,
Float_t  y 
) const
inline

Definition at line 153 of file hcalStructure.h.

154{
155 hcalModule* mdl=GetModule(x,y);
156 if (mdl)
157 return mdl->GetNumber();
158 else
159 return -1111;
160}
Int_t GetNumber() const
Definition hcalModule.h:39

◆ GetHitModule()

hcalModule * hcalStructure::GetHitModule ( const Int_t  hitId) const

Hit Id -> Cell

Definition at line 215 of file hcalStructure.cxx.

216{
219 // Some translation from x*100+y to y*sizex+x coding...
220
221 Int_t mnum=hitId/10;
222 Int_t cellx = mnum/100;
223 Int_t celly = mnum%100;
224 mnum = GetNum(cellx, celly);
225
226 // end translation
227
228 return fStructure[mnum];
229}

◆ GetHitXY()

void hcalStructure::GetHitXY ( const Int_t  hitId,
Float_t &  x,
Float_t &  y 
) const

Hit Id -> (x,y)

Definition at line 195 of file hcalStructure.cxx.

196{
199 // Some translation from x*100+y to y*sizex+x coding...
200
201 Int_t mnum=hitId/10;
202 Int_t cellx = mnum/100;
203 Int_t celly = mnum%100;
204 mnum = GetNum(cellx, celly);
205
206 // end translation
207
208 hcalModule* module=fStructure[mnum];
209 if (module==NULL) return;
210 x=module->GetCenterX();
211 y=module->GetCenterY();
212}

◆ GetModule() [1/2]

hcalModule * hcalStructure::GetModule ( Float_t  x,
Float_t  y 
) const
inline

get ECAL module by known module center coordinate (x,y)

Definition at line 82 of file hcalStructure.h.

83{
85 Int_t num=GetModuleNumber(x,y);
86 if (-1==num) return NULL; else return fStructure[num];
87}
Int_t GetModuleNumber(Float_t x, Float_t y) const

◆ GetModule() [2/2]

hcalModule * hcalStructure::GetModule ( Int_t  fVolId,
Int_t &  section 
)

Definition at line 20 of file hcalStructure.cxx.

21{
22 UInt_t i;
23 static Int_t volidmax = 0;
24 volidmax=10000000;
25
26 if ((Int_t)fHash.size()<volidmax)
27 {
28 fHash.resize(volidmax);
29 for(i=0;i<fHash.size();i++)
30 fHash[i]=NULL;
31 }
32 if (volId>volidmax)
33 return NULL;
34 if (fHash[volId]==NULL)
35 {
36 Float_t x;
37 Float_t y;
38 hcal::GetCellCoordInf(volId, x, y, section);
39 fHash[volId]=GetModule(x+0.025,y+0.025);
40 }
41 section=volId%10;
42 return fHash[volId];
43}
static Bool_t GetCellCoordInf(Int_t fVolumeID, Float_t &x, Float_t &y, Int_t &section)
Definition hcal.cxx:1174

◆ GetModuleNumber()

Int_t hcalStructure::GetModuleNumber ( Float_t  x,
Float_t  y 
) const
inline

get ECAL module by known module center coordinate (x,y)

Definition at line 89 of file hcalStructure.h.

90{
92 Int_t ix=(Int_t)TMath::Floor((x-GetX1())/fHcalInf->GetModuleSize());
93 Int_t iy=(Int_t)TMath::Floor((y-GetY1())/fHcalInf->GetModuleSize());
94 return GetNumber(ix,iy);
95}

◆ GetModules()

void hcalStructure::GetModules ( std::list< hcalModule * > &  mdls) const
inline

Definition at line 40 of file hcalStructure.h.

40{mdls=fModules;}

◆ GetNum()

Int_t hcalStructure::GetNum ( Int_t  x,
Int_t  y 
) const
inlineprivate

get ECAL absolute module number by known module relative number (x,y)

Definition at line 107 of file hcalStructure.h.

108{
110 return y*fHcalInf->GetXSize()+x;
111}

◆ GetNumber()

Int_t hcalStructure::GetNumber ( Int_t  x,
Int_t  y 
) const
inline

get ECAL absolute module number by known module relative number (x,y) with check for the ECAL boundaries

Definition at line 97 of file hcalStructure.h.

98{
101 if (x>-1&&y>-1)
102 if (x<fHcalInf->GetXSize()&&y<fHcalInf->GetYSize())
103 return GetNum(x,y);
104 return -1;
105}

◆ GetStructure()

void hcalStructure::GetStructure ( std::vector< hcalModule * > &  stru) const
inline

Definition at line 39 of file hcalStructure.h.

39{stru=fStructure;}

◆ GetUseMC()

Int_t hcalStructure::GetUseMC ( ) const
inline

Definition at line 25 of file hcalStructure.h.

25{return fUseMC;}

◆ GetX1()

Float_t hcalStructure::GetX1 ( ) const
inline

Definition at line 34 of file hcalStructure.h.

34{return fX1;};

◆ GetX2()

Float_t hcalStructure::GetX2 ( ) const
inline

get ECAL right edge coordinate in cm

Definition at line 113 of file hcalStructure.h.

114{
117}

◆ GetY1()

Float_t hcalStructure::GetY1 ( ) const
inline

Definition at line 35 of file hcalStructure.h.

35{return fY1;};

◆ GetY2()

Float_t hcalStructure::GetY2 ( ) const
inline

get ECAL upper edge coordinate in cm

Definition at line 119 of file hcalStructure.h.

120{
123}

◆ operator=()

hcalStructure & hcalStructure::operator= ( const hcalStructure )
private

◆ ResetModules()

void hcalStructure::ResetModules ( )

Definition at line 179 of file hcalStructure.cxx.

180{
181 list<hcalModule*>::const_iterator p=fModules.begin();
182 if (fUseMC==0)
183 {
184 for(;p!=fModules.end();++p)
185 (*p)->ResetEnergyFast();
186 }
187 else
188 {
189 for(;p!=fModules.end();++p)
190 ((hcalModuleMC*)(*p))->ResetEnergy();
191 }
192}

◆ Serialize()

void hcalStructure::Serialize ( )
private

Creates modules lists

Definition at line 46 of file hcalStructure.cxx.

47{
48 fModules.clear();
49 for(UInt_t i=0;i<fStructure.size();i++)
50 if (fStructure[i])
51 fModules.push_back(fStructure[i]);
52}

◆ SetUseMC()

void hcalStructure::SetUseMC ( Int_t  mc = 0)
inline

Definition at line 24 of file hcalStructure.h.

Member Data Documentation

◆ fHash

std::vector<hcalModule*> hcalStructure::fHash
private

MCPoint id -> HCAL mdoule

Definition at line 74 of file hcalStructure.h.

◆ fHcalInf

hcalInf* hcalStructure::fHcalInf
private

HCAL geometry container

Definition at line 68 of file hcalStructure.h.

◆ fModules

std::list<hcalModule*> hcalStructure::fModules
private

All ECAL modules

Definition at line 72 of file hcalStructure.h.

◆ fStructure

std::vector<hcalModule*> hcalStructure::fStructure
private

vector of HCAL modules

Definition at line 70 of file hcalStructure.h.

◆ fUseMC

Int_t hcalStructure::fUseMC
private

Use store MC information in modules

Definition at line 62 of file hcalStructure.h.

◆ fX1

Float_t hcalStructure::fX1
private

X coordibate of left bottom angle of ECAL

Definition at line 64 of file hcalStructure.h.

◆ fY1

Float_t hcalStructure::fY1
private

Y coordibate of left bottom angle of ECAL

Definition at line 66 of file hcalStructure.h.


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