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