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