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