]>
Commit | Line | Data |
---|---|---|
1963b290 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2004, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | //_________________________________________________________________________ | |
d87bd045 | 19 | //*-- Implementation version v2 of EMCAL Manager class; SHASHLYK version |
1963b290 | 20 | //*-- An object of this class does not produce digits |
21 | //*-- It is the one to use if you do want to produce outputs in TREEH | |
22 | //*-- | |
d87bd045 | 23 | //*-- Author : Aleksei Pavlinov (WSU) |
24 | ||
1963b290 | 25 | // This Class not stores information on all particles prior to EMCAL entry - in order to facilitate analysis. |
26 | // This is done by setting fIShunt =2, and flagging all parents of particles entering the EMCAL. | |
27 | ||
7dd95fbf | 28 | #include <cassert> |
1963b290 | 29 | // --- ROOT system --- |
cde6a23d | 30 | #include <TBrowser.h> |
7ca4655f | 31 | #include <TClonesArray.h> |
cde6a23d | 32 | #include <TH1.h> |
33 | #include <TH2.h> | |
7ca4655f | 34 | #include <TParticle.h> |
a1e17193 | 35 | #include <TROOT.h> |
7ca4655f | 36 | #include <TVirtualMC.h> |
1963b290 | 37 | |
38 | // --- Standard library --- | |
39 | ||
40 | // --- AliRoot header files --- | |
41 | #include "AliEMCALv2.h" | |
42 | #include "AliEMCALHit.h" | |
43 | #include "AliEMCALGeometry.h" | |
44 | #include "AliRun.h" | |
45 | #include "AliHeader.h" | |
46 | #include "AliMC.h" | |
47 | #include "AliPoints.h" | |
dc7da436 | 48 | // for TRD1 case only; May 31,2006 |
1963b290 | 49 | |
50 | ClassImp(AliEMCALv2) | |
51 | ||
1963b290 | 52 | //______________________________________________________________________ |
18a21c7c | 53 | AliEMCALv2::AliEMCALv2() |
54 | : AliEMCALv1(), | |
18a21c7c | 55 | fHDe(0), |
56 | fHNhits(0) | |
57 | { | |
1963b290 | 58 | // ctor |
1963b290 | 59 | } |
60 | ||
61 | //______________________________________________________________________ | |
18a21c7c | 62 | AliEMCALv2::AliEMCALv2(const char *name, const char *title) |
63 | : AliEMCALv1(name,title), | |
18a21c7c | 64 | fHDe(0), |
65 | fHNhits(0) | |
66 | { | |
1963b290 | 67 | // Standard Creator. |
68 | ||
1963b290 | 69 | fHits= new TClonesArray("AliEMCALHit",1000); |
70 | gAlice->GetMCApp()->AddHitList(fHits); | |
71 | ||
72 | fNhits = 0; | |
73 | fIshunt = 2; // All hits are associated with particles entering the calorimeter | |
74 | fTimeCut = 30e-09; | |
75 | ||
76 | fGeometry = GetGeometry(); | |
905263da | 77 | fHDe = fHNhits = 0; |
1963b290 | 78 | // if (gDebug>0){ |
79 | if (1){ | |
80 | TH1::AddDirectory(0); | |
1d46d1f6 | 81 | fHDe = new TH1F("fHDe","De in EMCAL", 1000, 0., 10.); |
c01485dd | 82 | fHNhits = new TH1F("fHNhits","#hits in EMCAL", 2001, -0.5, 2000.5); |
1963b290 | 83 | fHistograms->Add(fHDe); |
905263da | 84 | fHistograms->Add(fHNhits); |
1963b290 | 85 | TH1::AddDirectory(1); |
86 | } | |
87 | } | |
88 | ||
89 | //______________________________________________________________________ | |
90 | AliEMCALv2::~AliEMCALv2(){ | |
91 | // dtor | |
92 | ||
93 | if ( fHits) { | |
94 | fHits->Delete(); | |
95 | delete fHits; | |
96 | fHits = 0; | |
97 | } | |
98 | } | |
99 | ||
100 | //______________________________________________________________________ | |
101 | void AliEMCALv2::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t iparent, Float_t ienergy, | |
102 | Int_t id, Float_t * hits,Float_t * p){ | |
103 | // Add a hit to the hit list. | |
104 | // An EMCAL hit is the sum of all hits in a tower section | |
105 | // originating from the same entering particle | |
106 | static Int_t hitCounter; | |
107 | static AliEMCALHit *newHit, *curHit; | |
108 | static Bool_t deja; | |
109 | ||
110 | deja = kFALSE; | |
111 | ||
112 | newHit = new AliEMCALHit(shunt, primary, tracknumber, iparent, ienergy, id, hits, p); | |
113 | for ( hitCounter = fNhits-1; hitCounter >= 0 && !deja; hitCounter-- ) { | |
114 | curHit = (AliEMCALHit*) (*fHits)[hitCounter]; | |
115 | // We add hits with the same tracknumber, while GEANT treats | |
116 | // primaries succesively | |
117 | if(curHit->GetPrimary() != primary) | |
118 | break; | |
119 | if( *curHit == *newHit ) { | |
120 | *curHit = *curHit + *newHit; | |
121 | deja = kTRUE; | |
122 | // break; // 30-aug-04 by PAI | |
123 | } // end if | |
124 | } // end for hitCounter | |
125 | ||
126 | if ( !deja ) { | |
127 | new((*fHits)[fNhits]) AliEMCALHit(*newHit); | |
128 | fNhits++; | |
129 | } | |
130 | // printf(" fNhits %i \n", fNhits); | |
131 | delete newHit; | |
132 | } | |
133 | //______________________________________________________________________ | |
134 | void AliEMCALv2::StepManager(void){ | |
135 | // Accumulates hits as long as the track stays in a tower | |
136 | ||
137 | // position wrt MRS and energy deposited | |
138 | static Float_t xyzte[5]={0.,0.,0.,0.,0.};// position wrt MRS, time and energy deposited | |
139 | static Float_t pmom[4]={0.,0.,0.,0.}; | |
d25f2c54 | 140 | static TLorentzVector pos; // Lorentz vector of the track current position. |
141 | static TLorentzVector mom; // Lorentz vector of the track current momentum. | |
142 | static Float_t ienergy = 0; // part->Energy(); | |
1963b290 | 143 | static TString curVolName; |
144 | static int supModuleNumber, moduleNumber, yNumber, xNumber, absid; | |
cde6a23d | 145 | static int keyGeom=1; |
146 | static char *vn = "SCMX"; // Apr 13, 2006 - only TRD1 case now | |
1963b290 | 147 | static int nSMOP[7]={1,3,5,7,9,11}; // 30-mar-05 |
148 | static int nSMON[7]={2,4,6,8,10,12}; | |
149 | static Float_t depositedEnergy=0.0; | |
150 | ||
151 | if(keyGeom == 0) { | |
152 | keyGeom = 2; | |
153 | if(gMC->VolId("PBMO")==0 || gMC->VolId("WSUC")==1) { | |
154 | vn = "SCMX"; // old TRD2(TRD1) or WSUC | |
155 | keyGeom = 1; | |
156 | } | |
157 | printf("AliEMCALv2::StepManager(): keyGeom %i : Sensetive volume %s \n", | |
158 | keyGeom, vn); | |
159 | if(gMC->VolId("WSUC")==1) printf(" WSUC - cosmic ray stand geometry \n"); | |
160 | } | |
161 | Int_t tracknumber = gAlice->GetMCApp()->GetCurrentTrackNumber(); | |
162 | ||
163 | curVolName = gMC->CurrentVolName(); | |
1d46d1f6 | 164 | if(curVolName.Contains(vn) || curVolName.Contains("SCX")) { // We are in a scintillator layer; SCX for 3X3 |
1963b290 | 165 | |
166 | if( ((depositedEnergy = gMC->Edep()) > 0.) && (gMC->TrackTime() < fTimeCut)){// Track is inside a scintillator and deposits some energy | |
167 | // Info("StepManager "," entry %i DE %f",++ientry, depositedEnergy); // for testing | |
168 | if (fCurPrimary==-1) | |
169 | fCurPrimary=gAlice->GetMCApp()->GetPrimary(tracknumber); | |
170 | ||
171 | if (fCurParent==-1 || tracknumber != fCurTrack) { | |
172 | // Check parentage | |
173 | Int_t parent=tracknumber; | |
174 | if (fCurParent != -1) { | |
175 | while (parent != fCurParent && parent != -1) { | |
176 | TParticle *part=gAlice->GetMCApp()->Particle(parent); | |
177 | parent=part->GetFirstMother(); | |
178 | } | |
179 | } | |
180 | if (fCurParent==-1 || parent==-1) { | |
181 | Int_t parent=tracknumber; | |
182 | TParticle *part=gAlice->GetMCApp()->Particle(parent); | |
183 | while (parent != -1 && fGeometry->IsInEMCAL(part->Vx(),part->Vy(),part->Vz())) { | |
184 | parent=part->GetFirstMother(); | |
185 | if (parent!=-1) | |
186 | part=gAlice->GetMCApp()->Particle(parent); | |
187 | } | |
188 | fCurParent=parent; | |
189 | if (fCurParent==-1) | |
190 | Error("StepManager","Cannot find parent"); | |
191 | else { | |
192 | TParticle *part=gAlice->GetMCApp()->Particle(fCurParent); | |
193 | ienergy = part->Energy(); | |
194 | } | |
195 | while (parent != -1) { | |
196 | part=gAlice->GetMCApp()->Particle(parent); | |
197 | part->SetBit(kKeepBit); | |
198 | parent=part->GetFirstMother(); | |
199 | } | |
200 | } | |
201 | fCurTrack=tracknumber; | |
202 | } | |
203 | gMC->TrackPosition(pos); | |
204 | xyzte[0] = pos[0]; | |
205 | xyzte[1] = pos[1]; | |
206 | xyzte[2] = pos[2]; | |
207 | xyzte[3] = gMC->TrackTime() ; | |
208 | ||
209 | gMC->TrackMomentum(mom); | |
210 | pmom[0] = mom[0]; | |
211 | pmom[1] = mom[1]; | |
212 | pmom[2] = mom[2]; | |
213 | pmom[3] = mom[3]; | |
214 | ||
215 | // if(ientry%200 > 0) return; // testing | |
216 | supModuleNumber = moduleNumber = yNumber = xNumber = absid = 0; | |
d25f2c54 | 217 | if(keyGeom >= 1) { // TRD1 case now |
1963b290 | 218 | gMC->CurrentVolOffID(4, supModuleNumber); |
219 | gMC->CurrentVolOffID(3, moduleNumber); | |
220 | gMC->CurrentVolOffID(1, yNumber); | |
221 | gMC->CurrentVolOffID(0, xNumber); // really x number now | |
d87bd045 | 222 | if(strcmp(gMC->CurrentVolOffName(4),"SM10")==0) supModuleNumber += 10; // 13-oct-05 |
1d46d1f6 | 223 | // Nov 10,2006 |
d25f2c54 | 224 | if(strcmp(gMC->CurrentVolOffName(0),vn) != 0) { // 3X3 case |
225 | if (strcmp(gMC->CurrentVolOffName(0),"SCX1")==0) xNumber=1; | |
226 | else if(strcmp(gMC->CurrentVolOffName(0),"SCX2")==0) xNumber=2; | |
227 | else if(strcmp(gMC->CurrentVolOffName(0),"SCX3")==0) xNumber=3; | |
228 | else Fatal("StepManager()", "Wrong name of sensetive volume in 3X3 case : %s ", gMC->CurrentVolOffName(0)); | |
1d46d1f6 | 229 | } |
1963b290 | 230 | } else { |
231 | gMC->CurrentVolOffID(5, supModuleNumber); | |
232 | gMC->CurrentVolOffID(4, moduleNumber); | |
233 | gMC->CurrentVolOffID(1, yNumber); | |
d87bd045 | 234 | gMC->CurrentVolOffID(0, xNumber); |
235 | if (strcmp(gMC->CurrentVolOffName(5),"SMOP")==0) supModuleNumber = nSMOP[supModuleNumber-1]; | |
1963b290 | 236 | else if(strcmp(gMC->CurrentVolOffName(5),"SMON")==0) supModuleNumber = nSMON[supModuleNumber-1]; |
237 | else assert(0); // something wrong | |
238 | } | |
dc7da436 | 239 | absid = fGeometry->GetAbsCellId(supModuleNumber-1, moduleNumber-1, yNumber-1, xNumber-1); |
1963b290 | 240 | |
1d46d1f6 | 241 | if (absid < 0) { |
242 | printf(" supModuleNumber %i : moduleNumber %i : yNumber %i : xNumber %i \n", | |
243 | supModuleNumber, moduleNumber, yNumber, xNumber); | |
244 | Fatal("StepManager()", "Wrong id : %i ", absid) ; | |
245 | } | |
1963b290 | 246 | |
247 | Float_t lightYield = depositedEnergy ; | |
248 | // Apply Birk's law (copied from G3BIRK) | |
249 | ||
250 | if (gMC->TrackCharge()!=0) { // Check | |
cde6a23d | 251 | Float_t birkC1Mod = 0; |
1963b290 | 252 | if (fBirkC0==1){ // Apply correction for higher charge states |
cde6a23d | 253 | if (TMath::Abs(gMC->TrackCharge())>=2) birkC1Mod = fBirkC1*7.2/12.6; |
254 | else birkC1Mod = fBirkC1; | |
1963b290 | 255 | } |
256 | ||
257 | Float_t dedxcm; | |
258 | if (gMC->TrackStep()>0) dedxcm=1000.*gMC->Edep()/gMC->TrackStep(); | |
259 | else dedxcm=0; | |
cde6a23d | 260 | lightYield=lightYield/(1.+birkC1Mod*dedxcm+fBirkC2*dedxcm*dedxcm); |
1963b290 | 261 | } |
262 | ||
263 | // use sampling fraction to get original energy --HG | |
264 | // xyzte[4] = lightYield * fGeometry->GetSampling(); | |
265 | xyzte[4] = lightYield; // 15-dec-04 | |
266 | ||
267 | if (gDebug == -2) | |
268 | printf("#sm %2i #m %3i #x %1i #z %1i -> absid %i : xyzte[4] = %f\n", | |
269 | supModuleNumber,moduleNumber,yNumber,xNumber,absid, xyzte[4]); | |
270 | ||
271 | AddHit(fIshunt, fCurPrimary,tracknumber, fCurParent, ienergy, absid, xyzte, pmom); | |
272 | } // there is deposited energy | |
273 | } | |
274 | } | |
275 | ||
276 | void AliEMCALv2::FinishEvent() | |
cde6a23d | 277 | { |
278 | // Calculate deposit energy and fill control histogram; 26-may-05 | |
1963b290 | 279 | static double de=0.; |
905263da | 280 | fHNhits->Fill(double(fHits->GetEntries())); |
1963b290 | 281 | de = GetDepositEnergy(0); |
282 | if(fHDe) fHDe->Fill(de); | |
283 | } | |
284 | ||
285 | Double_t AliEMCALv2::GetDepositEnergy(int print) | |
cde6a23d | 286 | { |
287 | // 23-mar-05 - for testing | |
1963b290 | 288 | if(fHits == 0) return 0.; |
289 | AliEMCALHit *hit=0; | |
290 | Double_t de=0.; | |
291 | for(int ih=0; ih<fHits->GetEntries(); ih++) { | |
292 | hit = (AliEMCALHit*)fHits->UncheckedAt(ih); | |
293 | de += hit->GetEnergy(); | |
294 | } | |
295 | if(print>0) { | |
c63c3c5d | 296 | cout<<"AliEMCALv2::GetDepositEnergy() : fHits "<<fHits<<endl; |
1963b290 | 297 | printf(" #hits %i de %f \n", fHits->GetEntries(), de); |
298 | if(print>1) { | |
299 | printf(" #primary particles %i\n", gAlice->GetHeader()->GetNprimary()); | |
300 | } | |
301 | } | |
302 | return de; | |
303 | } | |
304 | ||
305 | void AliEMCALv2::Browse(TBrowser* b) | |
306 | { | |
307 | TObject::Browse(b); | |
308 | } | |
309 | ||
310 | void AliEMCALv2::DrawCalorimeterCut(const char *name, int axis, double dcut) | |
cde6a23d | 311 | { |
312 | // Size of tower is 5.6x5.6x24.8 (25.0); cut on Z axiz | |
d87bd045 | 313 | TString g(fGeometry->GetName()); |
314 | g.ToUpper(); | |
1963b290 | 315 | gMC->Gsatt("*", "seen", 0); |
316 | ||
317 | int fill = 1; | |
318 | ||
319 | if(axis!=1) SetVolumeAttributes("STPL", 1, 1, fill); | |
320 | ||
321 | int colo=4; | |
322 | TString sn(name); | |
323 | if(sn.Contains("SCM")) colo=5; | |
324 | SetVolumeAttributes(name, 1, colo, fill); | |
d87bd045 | 325 | if(g.Contains("110DEG") && sn=="SMOD") SetVolumeAttributes("SM10", 1, colo, fill); |
1963b290 | 326 | |
905263da | 327 | TString st(GetTitle()); |
328 | st += ", zcut, "; | |
1963b290 | 329 | st += name; |
330 | ||
331 | char *optShad = "on", *optHide="on"; | |
332 | double cxy=0.02; | |
333 | if (axis==1) { | |
334 | dcut = 0.; | |
335 | // optHide = optShad = "off"; | |
336 | } else if(axis==2){ | |
337 | if(dcut==0.) SetVolumeAttributes("SCM0", 1, 5, fill); // yellow | |
338 | } | |
339 | ||
340 | gMC->Gdopt("hide", optHide); | |
341 | gMC->Gdopt("shad", optShad); | |
342 | ||
343 | gROOT->ProcessLine("TGeant3 *g3 = (TGeant3*)gMC"); | |
344 | char cmd[200]; | |
345 | sprintf(cmd,"g3->Gdrawc(\"XEN1\", %i, %5.1f, 12., 8., %3.2f, %3.2f)\n", axis, dcut, cxy,cxy); | |
346 | printf("\n%s\n",cmd); gROOT->ProcessLine(cmd); | |
347 | ||
348 | sprintf(cmd,"gMC->Gdhead(1111, \"%s\")\n", st.Data()); | |
349 | printf("%s\n",cmd); gROOT->ProcessLine(cmd); | |
350 | } | |
351 | ||
352 | void AliEMCALv2::DrawSuperModuleCut(const char *name, int axis, double dcut, int fill) | |
cde6a23d | 353 | { |
354 | // Size of tower is 5.6x5.6x24.8 (25.0); cut on Z axiz | |
1963b290 | 355 | TString sn(GetGeometry()->GetName()); |
356 | sn.ToUpper(); | |
357 | char *tit[3]={"xcut", "ycut", "zcut"}; | |
358 | if(axis<1) axis=1; if(axis>3) axis=3; | |
359 | ||
360 | gMC->Gsatt("*", "seen", 0); | |
361 | // int fill = 6; | |
362 | ||
363 | // SetVolumeAttributes("SMOD", 1, 1, fill); // black | |
364 | SetVolumeAttributes(name, 1, 5, fill); // yellow | |
365 | ||
366 | double cxy=0.055, x0=10., y0=10.; | |
367 | char *optShad = "on", *optHide="on"; | |
368 | if(sn.Contains("TRD1")) { | |
369 | SetVolumeAttributes("STPL", 1, 3, fill); // green | |
370 | if (axis==1) { | |
371 | gMC->Gsatt("STPL", "seen", 0); | |
372 | dcut = 0.; | |
373 | optHide = "off"; | |
374 | optShad = "off"; | |
375 | } else if(axis==3) cxy = 0.1; | |
376 | } else if(sn.Contains("TRD2")) { | |
377 | y0 = -10.; | |
378 | if (axis==2) cxy=0.06; | |
379 | } | |
380 | gMC->Gdopt("hide", optHide); | |
381 | gMC->Gdopt("shad", optShad); | |
382 | ||
383 | TString st("Shish-Kebab, Compact, SMOD, "); | |
384 | if(sn.Contains("TWIST")) st = "Shish-Kebab, Twist, SMOD, "; | |
385 | st += tit[axis-1];; | |
386 | ||
387 | gROOT->ProcessLine("TGeant3 *g3 = (TGeant3*)gMC"); | |
388 | char cmd[200]; | |
389 | sprintf(cmd,"g3->Gdrawc(\"SMOD\", %i, %6.3f, %5.1f, %5.1f, %5.3f, %5.3f)\n",axis,dcut,x0,y0,cxy,cxy); | |
390 | printf("\n%s\n",cmd); gROOT->ProcessLine(cmd); | |
391 | ||
392 | sprintf(cmd,"gMC->Gdhead(1111, \"%s\")\n", st.Data()); | |
393 | printf("%s\n",cmd); gROOT->ProcessLine(cmd); | |
394 | // hint for testing | |
395 | if(sn.Contains("TRD1")){ | |
396 | printf("Begin of super module\n"); | |
397 | printf("g3->Gdrawc(\"SMOD\", 2, 0.300, 89., 10., 0.5, 0.5)\n"); | |
398 | printf("Center of super modules\n"); | |
399 | printf("g3->Gdrawc(\"SMOD\", 2, 0.300, 0., 10., 0.5, 0.5)\n"); | |
400 | printf("end of super modules\n"); | |
401 | printf("g3->Gdrawc(\"SMOD\", 2, 0.300, -70., 10., 0.5, 0.5)\n"); | |
402 | } else if(sn.Contains("TRD2")){ | |
403 | printf("Begin of super module ** TRD2 ** \n"); | |
404 | printf("g3->Gdrawc(\"SMOD\", 2, 0.00, 40., -80, 0.2, 0.2)\n"); | |
405 | printf("end of super modules\n"); | |
406 | printf("g3->Gdrawc(\"SMOD\", 2, 0.00, -20., -80, 0.2, 0.2)\n"); | |
407 | ||
408 | printf(" *** Z cut (Y|X plane)\n scale 0.4\n"); | |
409 | printf("g3->Gdrawc(\"SMOD\", 3, -170.,-165.,10.,0.4,0.4)\n"); | |
410 | printf(" scale 0.2\n"); | |
411 | printf("g3->Gdrawc(\"SMOD\", 3, -170.,-80.,10.,0.2,0.2)\n"); | |
412 | printf(" scale 0.12\n"); | |
413 | printf("g3->Gdrawc(\"SMOD\", 3, -170.,-45.,10.,0.12,0.12)\n"); | |
414 | } | |
415 | } | |
416 | ||
417 | void AliEMCALv2::DrawTowerCut(const char *name, int axis, double dcut, int fill, char *optShad) | |
cde6a23d | 418 | { |
419 | // Size of tower is 5.6x5.6x24.8 (25.0); cut on Z axiz | |
1963b290 | 420 | if(axis<1) axis=1; if(axis>3) axis=3; |
421 | TString mn(name); mn.ToUpper(); | |
422 | TString sn(GetGeometry()->GetName()); | |
423 | ||
424 | gMC->Gsatt("*", "seen", 0); | |
425 | gMC->Gsatt("*", "fill", fill); | |
426 | ||
427 | // int mainColo=5; // yellow | |
428 | if(mn == "EMOD") { | |
429 | SetVolumeAttributes(mn.Data(), 1, 1, fill); | |
430 | SetVolumeAttributes("SCM0", 1, 5, fill); // yellow | |
431 | SetVolumeAttributes("SCPA", 1, 3, fill); // green - 13-may-05 | |
432 | } else if(mn == "SCM0") { // first division | |
433 | SetVolumeAttributes(mn.Data(), 1, 1, fill); | |
434 | SetVolumeAttributes("SCMY", 1, 5, fill); // yellow | |
435 | } else if(mn == "SCMY") { // first division | |
436 | SetVolumeAttributes(mn.Data(), 1, 1, fill); | |
437 | if(sn.Contains("TEST") && sn.Contains("3X3")) { | |
438 | SetVolumeAttributes("SCX1", 1, 5, fill); // yellow | |
439 | SetVolumeAttributes("SCX2", 1, 2, fill); // red | |
440 | SetVolumeAttributes("SCX3", 1, 3, fill); // green | |
441 | } else { | |
442 | SetVolumeAttributes("SCMX", 1, 5, fill); // yellow | |
443 | } | |
444 | } else if(mn == "SCMX" || mn.Contains("SCX")) { | |
445 | SetVolumeAttributes(mn.Data(), 1, 5, fill);// yellow | |
446 | SetVolumeAttributes("PBTI", 1, 4, fill); | |
447 | } else { | |
448 | printf("<W> for volume |%s| did not defined volume attributes\n", mn.Data()); | |
449 | } | |
450 | ||
451 | // TString st("Shish-Kebab, 2x2 mm sampling, 62 layers, "); | |
452 | TString st("Shashlyk, 2x2 mm sampling, 62 layers, "); | |
453 | if (sn.Contains("25")) st = "Shish-Kebab, 5x5 mm sampling, 25 layers, "; | |
454 | else if(sn.Contains("MAY05")) st = "Shish-Kebab, 5x5 mm sampling, 77 layers, "; | |
455 | if(sn.Contains("TRD1")) st += " TRD1, "; | |
456 | if(sn.Contains("3X3")) st += " 3x3, "; | |
457 | st += name; | |
458 | ||
459 | gROOT->ProcessLine("TGeant3 *g3 = (TGeant3*)gMC"); | |
460 | double cx=0.78, cy=2.; | |
461 | if (axis==1 && sn.Contains("TRD")==0) { | |
462 | cx = cy = 1.; | |
463 | gMC->Gsatt("PBTI", "seen", 0); | |
464 | } else if (sn.Contains("TEST") && sn.Contains("3X3")) { | |
465 | cx = cy = 0.7; | |
466 | if (axis==3) cx = cy = 1.; | |
467 | } else if (sn.Contains("TRD2")) { | |
468 | if (axis==3) cx = cy = 2.; | |
469 | } else if (mn.Contains("EMOD")) { | |
470 | cx = cy = 0.5; | |
471 | } | |
472 | char cmd[200]; | |
473 | ||
474 | gMC->Gdopt("hide", optShad); | |
475 | gMC->Gdopt("shad", optShad); | |
476 | ||
477 | sprintf(cmd,"g3->Gdrawc(\"%s\", %i, %6.2f, 10., 10., %5.3f, %5.3f)\n",name, axis,dcut,cx,cy); | |
478 | printf("\n%s\n",cmd); gROOT->ProcessLine(cmd); | |
479 | ||
480 | sprintf(cmd,"gMC->Gdhead(1111, \"%s\")\n", st.Data()); | |
481 | printf("%s\n",cmd); gROOT->ProcessLine(cmd); | |
482 | } | |
483 | ||
484 | void AliEMCALv2::DrawAlicWithHits(int mode) | |
cde6a23d | 485 | { |
486 | // 20-sep-04; does not work now | |
1963b290 | 487 | static TH2F *h2; |
488 | if(h2==0) h2 = new TH2F("h2","test fo hits", 60,0.5,60.5, 28,0.5,28.5); | |
489 | else h2->Reset(); | |
490 | if(mode==0) { | |
491 | gROOT->ProcessLine("TGeant3 *g3 = (TGeant3*)gMC"); | |
492 | gMC->Gsatt("*","seen",0); | |
493 | gMC->Gsatt("scm0","seen",5); | |
494 | ||
495 | gROOT->ProcessLine("g3->Gdrawc(\"ALIC\", 1, 2.0, 12., -130, 0.3, 0.3)"); | |
496 | // g3->Gdrawc("ALIC", 1, 2.0, 10., -14, 0.05, 0.05) | |
497 | } | |
498 | ||
499 | TClonesArray *hits = Hits(); | |
2bb3725c | 500 | Int_t nhits = hits->GetEntries(), absId, nSupMod, nModule, nIphi, nIeta, iphi, ieta; |
1963b290 | 501 | AliEMCALHit *hit = 0; |
502 | Double_t de, des=0.; | |
503 | for(Int_t i=0; i<nhits; i++) { | |
504 | hit = (AliEMCALHit*)hits->UncheckedAt(i); | |
505 | absId = hit->GetId(); | |
506 | de = hit->GetEnergy(); | |
507 | des += de; | |
2bb3725c | 508 | if(fGeometry->GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta)){ |
1963b290 | 509 | // printf(" de %f abs id %i smod %i tower %i | cell iphi %i : ieta %i\n", |
2bb3725c | 510 | // de, absId, nSupMod, nModule, nIphi, nIeta); |
1963b290 | 511 | if(nSupMod==3) { |
2bb3725c | 512 | fGeometry->GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi,ieta); |
1963b290 | 513 | // printf(" iphi %i : ieta %i\n", iphi,ieta); |
514 | h2->Fill(double(ieta),double(iphi), de); | |
515 | } | |
516 | } | |
517 | // hit->Dump(); | |
518 | } | |
519 | printf(" #hits %i : sum de %f -> %f \n", nhits, des, h2->Integral()); | |
520 | if(mode>0 && h2->Integral()>0.) h2->Draw(); | |
521 | } | |
522 | ||
eb0b1051 | 523 | void AliEMCALv2::SetVolumeAttributes(const char *name, int seen, int color, int fill) |
1963b290 | 524 | { |
525 | /* seen=-2:volume is visible but none of its descendants; | |
526 | -1:volume is not visible together with all its descendants; | |
527 | 0:volume is not visible; | |
528 | 1:volume is visible. */ | |
529 | gMC->Gsatt(name, "seen", seen); | |
530 | gMC->Gsatt(name, "colo", color); | |
531 | gMC->Gsatt(name, "fill", fill); | |
532 | printf(" %s : seen %i color %i fill %i \n", name, seen, color, fill); | |
533 | } | |
534 | ||
535 | void AliEMCALv2::TestIndexTransition(int pri, int idmax) | |
cde6a23d | 536 | { |
537 | // Test for EMCAL_SHISH geometry | |
1963b290 | 538 | TString sn(fGeometry->GetName()); |
539 | if(!sn.Contains("SHISH")) { | |
540 | printf("Wrong geometry |%s| ! Bye \n", sn.Data()); | |
541 | return; | |
542 | } | |
543 | ||
2bb3725c | 544 | Int_t nSupMod, nModule, nIphi, nIeta, idNew, nGood=0; |
1963b290 | 545 | if(idmax==0) idmax = fGeometry->GetNCells(); |
546 | for(Int_t id=1; id<=idmax; id++) { | |
2bb3725c | 547 | if(!fGeometry->GetCellIndex(id, nSupMod, nModule, nIphi, nIeta)){ |
1963b290 | 548 | printf(" Wrong abs ID %i : #cells %i\n", id, fGeometry->GetNCells()); |
549 | break; | |
550 | } | |
2bb3725c | 551 | idNew = fGeometry->GetAbsCellId(nSupMod, nModule, nIphi, nIeta); |
1963b290 | 552 | if(id != idNew || pri>0) { |
553 | printf(" ID %i : %i <- new id\n", id, idNew); | |
554 | printf(" nSupMod %i ", nSupMod); | |
2bb3725c | 555 | printf(" nModule %i ", nModule); |
1963b290 | 556 | printf(" nIphi %i ", nIphi); |
557 | printf(" nIeta %i \n", nIeta); | |
558 | ||
559 | } else nGood++; | |
560 | } | |
561 | printf(" Good decoding %i : %i <- #cells \n", nGood, fGeometry->GetNCells()); | |
562 | } |