]>
Commit | Line | Data |
---|---|---|
58feed7c | 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; SHASHLYK version | |
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 : Aleksei Pavlinov (WSU) | |
24 | ||
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 | // --- ROOT system --- | |
29 | #include "AliEMCALv3.h" | |
30 | #include "AliEMCALHitv1.h" | |
31 | ||
32 | #include "TParticle.h" | |
33 | #include "TVirtualMC.h" | |
34 | #include "TBrowser.h" | |
58feed7c | 35 | #include "TH2.h" |
21e7df44 | 36 | #include <cassert> |
58feed7c | 37 | |
38 | // --- Standard library --- | |
39 | ||
40 | // --- AliRoot header files --- | |
41 | #include "AliEMCALGeometry.h" | |
42 | #include "AliRun.h" | |
43 | #include "AliHeader.h" | |
44 | #include "AliMC.h" | |
5bf6eb16 | 45 | #include "AliStack.h" |
58feed7c | 46 | #include "AliPoints.h" |
58feed7c | 47 | // for TRD1,2 case |
48 | ||
49 | ClassImp(AliEMCALv3) | |
50 | ||
51 | //extern "C" void gdaxis_(float &x0, float &y0, float &z0, float &axsiz); | |
52 | ||
53 | ||
54 | //______________________________________________________________________ | |
55 | AliEMCALv3::AliEMCALv3():AliEMCALv1(){ | |
56 | // ctor | |
57 | ||
58 | } | |
59 | ||
60 | //______________________________________________________________________ | |
61 | AliEMCALv3::AliEMCALv3(const char *name, const char *title): AliEMCALv1(name,title) { | |
62 | // Standard Creator. | |
63 | ||
64 | fHits= new TClonesArray("AliEMCALHitv1",2000); | |
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(); | |
58feed7c | 72 | } |
73 | ||
0a4cb131 | 74 | //______________________________________________________________________ |
75 | AliEMCALv3::AliEMCALv3(const AliEMCALv3 & emcal):AliEMCALv1(emcal) | |
76 | { | |
77 | fGeometry = emcal.fGeometry; | |
0a4cb131 | 78 | } |
79 | ||
58feed7c | 80 | //______________________________________________________________________ |
81 | AliEMCALv3::~AliEMCALv3(){ | |
82 | // dtor | |
83 | ||
84 | if ( fHits) { | |
85 | fHits->Delete(); | |
86 | delete fHits; | |
87 | fHits = 0; | |
88 | } | |
89 | } | |
90 | ||
91 | //______________________________________________________________________ | |
92 | void AliEMCALv3::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t iparent, Float_t ienergy, | |
93 | Int_t id, Float_t * hits,Float_t * p){ | |
94 | // Add a hit to the hit list. | |
95 | // An EMCAL hit is the sum of all hits in a tower section | |
96 | // originating from the same entering particle | |
97 | static Int_t hitCounter; | |
98 | static AliEMCALHitv1 *newHit, *curHit; | |
99 | static Bool_t deja; | |
100 | ||
101 | deja = kFALSE; | |
102 | ||
103 | newHit = new AliEMCALHitv1(shunt, primary, tracknumber, iparent, ienergy, id, hits, p); | |
104 | for ( hitCounter = fNhits-1; hitCounter >= 0 && !deja; hitCounter-- ) { | |
105 | curHit = (AliEMCALHitv1*) (*fHits)[hitCounter]; | |
106 | // We add hits with the same tracknumber, while GEANT treats | |
107 | // primaries succesively | |
108 | if(curHit->GetPrimary() != primary) | |
109 | break; | |
110 | if( *curHit == *newHit ) { | |
111 | *curHit = *curHit + *newHit; | |
112 | deja = kTRUE; | |
113 | // break; // 30-aug-04 by PAI | |
114 | } // end if | |
115 | } // end for hitCounter | |
116 | ||
117 | if ( !deja ) { | |
118 | new((*fHits)[fNhits]) AliEMCALHitv1(*newHit); | |
119 | fNhits++; | |
120 | } | |
121 | // printf(" fNhits %i \n", fNhits); | |
122 | delete newHit; | |
123 | } | |
124 | //______________________________________________________________________ | |
125 | void AliEMCALv3::StepManager(void){ | |
126 | // Accumulates hits as long as the track stays in a tower | |
127 | ||
128 | // position wrt MRS and energy deposited | |
129 | static Float_t xyzte[5]={0.,0.,0.,0.,0.};// position wrt MRS, time and energy deposited | |
130 | static Float_t pmom[4]={0.,0.,0.,0.}; | |
131 | static TLorentzVector pos; // Lorentz vector of the track current position. | |
132 | static TLorentzVector mom; // Lorentz vector of the track current momentum. | |
133 | static Float_t ienergy = 0; | |
134 | static TString curVolName; | |
135 | static int supModuleNumber, moduleNumber, yNumber, xNumber, absid; | |
136 | static int keyGeom=0; | |
137 | static char *vn = "SX"; // 15-mar-05 | |
138 | static int nSMOP[7]={1,3,5,7,9,11}; // 30-mar-05 | |
139 | static int nSMON[7]={2,4,6,8,10,12}; | |
140 | static Float_t depositedEnergy=0.0; | |
141 | ||
142 | if(keyGeom == 0) { | |
143 | keyGeom = 2; | |
144 | if(gMC->VolId("PBMO")==0 || gMC->VolId("WSUC")==1) { | |
145 | vn = "SCMX"; // old TRD2(TRD1) or WSUC | |
146 | keyGeom = 1; | |
147 | } | |
148 | printf("AliEMCALv3::StepManager(): keyGeom %i : Sensetive volume %s \n", | |
149 | keyGeom, vn); | |
150 | if(gMC->VolId("WSUC")==1) printf(" WSUC - cosmic ray stand geometry \n"); | |
151 | } | |
152 | Int_t tracknumber = gAlice->GetMCApp()->GetCurrentTrackNumber(); | |
153 | ||
154 | curVolName = gMC->CurrentVolName(); | |
155 | if(curVolName.Contains(vn)) { // We are in a scintillator layer | |
156 | // printf(" keyGeom %i : Sensetive volume %s (%s) \n", keyGeom, curVolName.Data(), vn); | |
157 | ||
158 | if( ((depositedEnergy = gMC->Edep()) > 0.) && (gMC->TrackTime() < fTimeCut)){// Track is inside a scintillator and deposits some energy | |
159 | // Info("StepManager "," entry %i DE %f",++ientry, depositedEnergy); // for testing | |
160 | if (fCurPrimary==-1) | |
161 | fCurPrimary=gAlice->GetMCApp()->GetPrimary(tracknumber); | |
162 | ||
163 | if (fCurParent==-1 || tracknumber != fCurTrack) { | |
164 | // Check parentage | |
165 | Int_t parent=tracknumber; | |
166 | if (fCurParent != -1) { | |
167 | while (parent != fCurParent && parent != -1) { | |
168 | TParticle *part=gAlice->GetMCApp()->Particle(parent); | |
169 | parent=part->GetFirstMother(); | |
170 | } | |
171 | } | |
172 | if (fCurParent==-1 || parent==-1) { | |
173 | Int_t parent=tracknumber; | |
174 | TParticle *part=gAlice->GetMCApp()->Particle(parent); | |
175 | while (parent != -1 && fGeometry->IsInEMCAL(part->Vx(),part->Vy(),part->Vz())) { | |
176 | parent=part->GetFirstMother(); | |
177 | if (parent!=-1) | |
178 | part=gAlice->GetMCApp()->Particle(parent); | |
179 | } | |
180 | fCurParent=parent; | |
181 | if (fCurParent==-1) | |
182 | Error("StepManager","Cannot find parent"); | |
183 | else { | |
184 | TParticle *part=gAlice->GetMCApp()->Particle(fCurParent); | |
185 | ienergy = part->Energy(); | |
186 | } | |
187 | while (parent != -1) { | |
188 | part=gAlice->GetMCApp()->Particle(parent); | |
189 | part->SetBit(kKeepBit); | |
190 | parent=part->GetFirstMother(); | |
191 | } | |
192 | } | |
193 | fCurTrack=tracknumber; | |
194 | } | |
195 | gMC->TrackPosition(pos); | |
196 | xyzte[0] = pos[0]; | |
197 | xyzte[1] = pos[1]; | |
198 | xyzte[2] = pos[2]; | |
199 | xyzte[3] = gMC->TrackTime() ; | |
200 | ||
201 | gMC->TrackMomentum(mom); | |
202 | pmom[0] = mom[0]; | |
203 | pmom[1] = mom[1]; | |
204 | pmom[2] = mom[2]; | |
205 | pmom[3] = mom[3]; | |
206 | ||
207 | // if(ientry%200 > 0) return; // testing | |
208 | supModuleNumber = moduleNumber = yNumber = xNumber = absid = 0; | |
209 | if(keyGeom >= 1) { // old style | |
210 | gMC->CurrentVolOffID(4, supModuleNumber); | |
211 | gMC->CurrentVolOffID(3, moduleNumber); | |
212 | gMC->CurrentVolOffID(1, yNumber); | |
213 | gMC->CurrentVolOffID(0, xNumber); // really x number now | |
214 | if(strcmp(gMC->CurrentVolOffName(4),"SM10")==0) supModuleNumber += 10; // 13-oct-05 | |
215 | } else { | |
216 | gMC->CurrentVolOffID(5, supModuleNumber); | |
217 | gMC->CurrentVolOffID(4, moduleNumber); | |
218 | gMC->CurrentVolOffID(1, yNumber); | |
219 | gMC->CurrentVolOffID(0, xNumber); | |
220 | if (strcmp(gMC->CurrentVolOffName(5),"SMOP")==0) supModuleNumber = nSMOP[supModuleNumber-1]; | |
221 | else if(strcmp(gMC->CurrentVolOffName(5),"SMON")==0) supModuleNumber = nSMON[supModuleNumber-1]; | |
222 | else assert(0); // something wrong | |
223 | } | |
224 | absid = fGeometry->GetAbsCellId(supModuleNumber, moduleNumber, yNumber, xNumber); | |
225 | ||
226 | if (absid == -1) Fatal("StepManager()", "Wrong id ") ; | |
227 | ||
228 | Float_t lightYield = depositedEnergy ; | |
229 | // Apply Birk's law (copied from G3BIRK) | |
230 | ||
231 | if (gMC->TrackCharge()!=0) { // Check | |
232 | Float_t BirkC1_mod = 0; | |
233 | if (fBirkC0==1){ // Apply correction for higher charge states | |
234 | if (TMath::Abs(gMC->TrackCharge())>=2) BirkC1_mod=fBirkC1*7.2/12.6; | |
235 | else BirkC1_mod=fBirkC1; | |
236 | } | |
237 | ||
238 | Float_t dedxcm; | |
239 | if (gMC->TrackStep()>0) dedxcm=1000.*gMC->Edep()/gMC->TrackStep(); | |
240 | else dedxcm=0; | |
241 | lightYield=lightYield/(1.+BirkC1_mod*dedxcm+fBirkC2*dedxcm*dedxcm); | |
242 | } | |
243 | ||
244 | xyzte[4] = lightYield; // 15-dec-04 | |
245 | Float_t xd[5]; // see Gmtod | |
246 | gMC->Gmtod(xyzte, xd, 1); | |
247 | xd[3] = xyzte[3]; | |
248 | xd[4] = xyzte[4]; | |
249 | // printf(" x %7.2f y %7.2f z %7.2f de %f\n", xd[0], xd[1], xd[2], xd[4]); | |
250 | ||
251 | if (gDebug == -2) | |
252 | printf("#sm %2i #m %3i #x %1i #z %1i -> absid %i : xyzte[4] = %f\n", | |
253 | supModuleNumber,moduleNumber,yNumber,xNumber,absid, xd[4]); | |
254 | ||
255 | AddHit(fIshunt, fCurPrimary,tracknumber, fCurParent, ienergy, absid, xd, pmom); | |
256 | } // there is deposited energy | |
257 | } | |
258 | } | |
259 | ||
ab6a174f | 260 | //_____________________________________________ |
58feed7c | 261 | void AliEMCALv3::Browse(TBrowser* b) |
262 | { | |
263 | TObject::Browse(b); | |
264 | } |