1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //_________________________________________________________________________
19 // Implementation version v0 of PHOS Manager class
20 // Layout EMC + PPSD has name GPS2
21 // The main goal of this version of AliPHOS is to calculte the
22 // induced charged in the PIN diode, taking into account light
23 // tracking in the PbWO4 crystal, induced signal in the
24 // PIN due to MIPS particle and electronic noise.
25 // This is done in the StepManager
27 //*-- Author: Odd Harald Odland & Gines Martinez (SUBATECH)
30 // --- ROOT system ---
33 // --- Standard library ---
38 #include <strstream.h>
40 // --- AliRoot header files ---
42 #include "AliPHOSv3.h"
43 #include "AliPHOSHit.h"
44 #include "AliPHOSCPVDigit.h"
48 #include "AliPHOSGeometry.h"
52 //____________________________________________________________________________
53 AliPHOSv3::AliPHOSv3(void) : AliPHOSv1()
55 // default ctor: initialize daa members
57 fLightYieldMean = 0. ;
58 fIntrinsicPINEfficiency = 0. ;
59 fLightYieldAttenuation = 0. ;
60 fRecalibrationFactor = 0. ;
61 fElectronsPerGeV = 0. ;
66 //____________________________________________________________________________
67 AliPHOSv3::AliPHOSv3(const char *name, const char *title):
72 // The light yield is a poissonian distribution of the number of
73 // photons created in the PbWo4 crystal, calculated using following formula
74 // NumberOfPhotons = EnergyLost * LightYieldMean* APDEfficiency *
75 // exp (-LightYieldAttenuation * DistanceToPINdiodeFromTheHit);
76 // LightYieldMean is parameter calculated to be over 47000 photons per GeV
77 // APDEfficiency is 0.02655
78 // k_0 is 0.0045 from Valery Antonenko
79 // The number of electrons created in the APD is
80 // NumberOfElectrons = APDGain * LightYield
81 // The APD Gain is 300
83 fLightYieldMean = 47000;
84 fIntrinsicPINEfficiency = 0.02655 ; //APD= 0.1875/0.1271 * 0.018 (PIN)
85 fLightYieldAttenuation = 0.0045 ;
86 fRecalibrationFactor = 13.418/ fLightYieldMean ;
87 fElectronsPerGeV = 2.77e+8 ;
91 // //____________________________________________________________________________
92 // AliPHOSv3::AliPHOSv3(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title):
93 // AliPHOSv1(Reconstructioner,name,title)
97 // // Number of electrons created in the PIN due to light collected in the PbWo4 crystal is calculated using
98 // // following formula
99 // // NumberOfElectrons = EnergyLost * LightYield * PINEfficiency *
100 // // exp (-LightYieldAttenuation * DistanceToPINdiodeFromTheHit) *
101 // // RecalibrationFactor ;
102 // // LightYield is obtained as a Poissonian distribution with a mean at 700000 photons per GeV fromValery Antonenko
103 // // PINEfficiency is 0.1875
104 // // k_0 is 0.0045 from Valery Antonenko
106 // fLightYieldMean = 700000.;
107 // fIntrinsicPINEfficiency = 0.1875 ;
108 // fLightYieldAttenuation = 0.0045 ;
109 // fRecalibrationFactor = 6.2 / fLightYieldMean ;
110 // fRecalibrationFactor = 5.67 /fLightYieldMean ;//25.04.2001 OHO
111 // fElectronsPerGeV = 2.77e+8 ;
113 //____________________________________________________________________________
115 void AliPHOSv3::StepManager(void)
117 // Accumulates hits as long as the track stays in a single crystal or PPSD gas Cell
119 // if (gMC->IsTrackEntering())
120 // cout << "Track enters the volume " << gMC->CurrentVolName() << endl;
121 // if (gMC->IsTrackExiting())
122 // cout << "Track leaves the volume " << gMC->CurrentVolName() << endl;
124 Int_t relid[4] ; // (box, layer, row, column) indices
125 Int_t absid ; // absolute cell ID number
126 Float_t xyze[4]={0,0,0,0} ; // position wrt MRS and energy deposited
128 TLorentzVector pos ; // Lorentz vector of the track current position
130 Float_t fLightYield ; // Light Yield per GeV
132 Int_t tracknumber = gAlice->CurrentTrack() ;
133 Int_t primary = gAlice->GetPrimary( gAlice->CurrentTrack() );
134 TString name = GetGeometry()->GetName() ;
140 if ( name == "GPS2" || name == "MIXT" ) { // ======> CPV is a GPS' PPSD
142 if( gMC->CurrentVolID(copy) == gMC->VolId("PPCE") ) // We are inside a gas cell
144 gMC->TrackPosition(pos) ;
148 xyze[3] = gMC->Edep() ;
150 if ( xyze[3] != 0) { // there is deposited energy
151 gMC->CurrentVolOffID(5, relid[0]) ; // get the PHOS Module number
152 if ( name == "MIXT" && strcmp(gMC->CurrentVolOffName(5),"PHO1") == 0 ){
153 relid[0] += GetGeometry()->GetNModules() - GetGeometry()->GetNPPSDModules();
155 gMC->CurrentVolOffID(3, relid[1]) ; // get the Micromegas Module number
156 // 1-> GetGeometry()->GetNumberOfModulesPhi() * GetGeometry()->GetNumberOfModulesZ() upper
157 // > GetGeometry()->GetNumberOfModulesPhi() * GetGeometry()->GetNumberOfModulesZ() lower
158 gMC->CurrentVolOffID(1, relid[2]) ; // get the row number of the cell
159 gMC->CurrentVolID(relid[3]) ; // get the column number
161 // get the absolute Id number
163 GetGeometry()->RelToAbsNumbering(relid, absid) ;
165 // add current hit to the hit list
166 AddHit(fIshunt, primary, tracknumber, absid, xyze);
169 } // there is deposited energy
170 } // We are inside the gas of the CPV
171 } // GPS2 configuration
173 if ( name == "IHEP" || name == "MIXT" ) { // ======> CPV is a IHEP's one
175 // Yuri Kharlov, 28 September 2000
177 if( gMC->CurrentVolID(copy) == gMC->VolId("PCPQ") &&
178 gMC->IsTrackEntering() &&
179 gMC->TrackCharge() != 0) {
181 gMC -> TrackPosition(pos);
182 Float_t xyzm[3], xyzd[3] ;
184 for (i=0; i<3; i++) xyzm[i] = pos[i];
185 gMC -> Gmtod (xyzm, xyzd, 1); // transform coordinate from master to daughter system
187 Float_t xyd[3]={0,0,0} ; //local posiiton of the entering
193 // Current momentum of the hit's track in the local ref. system
194 TLorentzVector pmom ; //momentum of the particle initiated hit
195 gMC -> TrackMomentum(pmom);
196 Float_t pm[3], pd[3];
197 for (i=0; i<3; i++) pm[i] = pmom[i];
198 gMC -> Gmtod (pm, pd, 2); // transform 3-momentum from master to daughter system
203 // Digitize the current CPV hit:
205 // 1. find pad response and
208 gMC->CurrentVolOffID(3,moduleNumber);
212 TClonesArray *cpvDigits = new TClonesArray("AliPHOSCPVDigit",0); // array of digits for current hit
213 CPVDigitize(pmom,xyd,moduleNumber,cpvDigits);
218 Int_t idigit,ndigits;
220 // 2. go through the current digit list and sum digits in pads
222 ndigits = cpvDigits->GetEntriesFast();
223 for (idigit=0; idigit<ndigits-1; idigit++) {
224 AliPHOSCPVDigit *cpvDigit1 = dynamic_cast<AliPHOSCPVDigit*>(cpvDigits->UncheckedAt(idigit));
225 Float_t x1 = cpvDigit1->GetXpad() ;
226 Float_t z1 = cpvDigit1->GetYpad() ;
227 for (Int_t jdigit=idigit+1; jdigit<ndigits; jdigit++) {
228 AliPHOSCPVDigit *cpvDigit2 = dynamic_cast<AliPHOSCPVDigit*>(cpvDigits->UncheckedAt(jdigit));
229 Float_t x2 = cpvDigit2->GetXpad() ;
230 Float_t z2 = cpvDigit2->GetYpad() ;
231 if (x1==x2 && z1==z2) {
232 Float_t qsum = cpvDigit1->GetQpad() + cpvDigit2->GetQpad() ;
233 cpvDigit2->SetQpad(qsum) ;
234 cpvDigits->RemoveAt(idigit) ;
238 cpvDigits->Compress() ;
240 // 3. add digits to temporary hit list fTmpHits
242 ndigits = cpvDigits->GetEntriesFast();
243 for (idigit=0; idigit<ndigits; idigit++) {
244 AliPHOSCPVDigit *cpvDigit = dynamic_cast<AliPHOSCPVDigit*>(cpvDigits->UncheckedAt(idigit));
245 relid[0] = moduleNumber + 1 ; // CPV (or PHOS) module number
246 relid[1] =-1 ; // means CPV
247 relid[2] = cpvDigit->GetXpad() ; // column number of a pad
248 relid[3] = cpvDigit->GetYpad() ; // row number of a pad
250 // get the absolute Id number
251 GetGeometry()->RelToAbsNumbering(relid, absid) ;
253 // add current digit to the temporary hit list
257 xyze[3] = cpvDigit->GetQpad() ; // amplitude in a pad
258 primary = -1; // No need in primary for CPV
259 AddHit(fIshunt, primary, tracknumber, absid, xyze);
261 if (cpvDigit->GetQpad() > 0.02) {
262 xmean += cpvDigit->GetQpad() * (cpvDigit->GetXpad() + 0.5);
263 zmean += cpvDigit->GetQpad() * (cpvDigit->GetYpad() + 0.5);
264 qsum += cpvDigit->GetQpad();
269 } // end of IHEP configuration
272 if(gMC->CurrentVolID(copy)==gMC->VolId("PXTL")){// We are inside a PBWO4 crystal
273 gMC->TrackPosition(pos) ;
280 lostenergy = gMC->Edep();
281 xyze[3] = gMC->Edep() ;
284 if ( (xyze[3] != 0) ){//Track is inside the crystal and deposits some energy
286 gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ;
288 if ( name == "MIXT" && strcmp(gMC->CurrentVolOffName(10),"PHO1") == 0 )
289 relid[0] += GetGeometry()->GetNModules() - GetGeometry()->GetNPPSDModules();
291 relid[1] = 0 ; // means PBW04
292 gMC->CurrentVolOffID(4, relid[2]) ; // get the row number inside the module
293 gMC->CurrentVolOffID(3, relid[3]) ; // get the cell number inside the module
295 // get the absolute Id number
297 GetGeometry()->RelToAbsNumbering(relid, absid) ;
299 gMC->Gmtod(global, local, 1) ;
301 //Calculates the light yield, the number of photns produced in the
303 fLightYield = gRandom->Poisson(
304 fLightYieldMean * lostenergy *
305 fIntrinsicPINEfficiency *
306 exp(-fLightYieldAttenuation *
307 (local[1]+GetGeometry()->GetCrystalSize(1)/2.0 ))
309 //Calculates de energy deposited in the crystal
310 xyze[3] = (fRecalibrationFactor/100.) * fAPDGain * fLightYield ;
313 // cout<<"xyze[3]: "<<xyze[3]<< endl;
314 //cout<<"lostenergy: "<<lostenergy<<endl;
319 // add current hit to the hit list
322 if (xyze[3] != 0.) AddHit(fIshunt, primary,tracknumber, absid, xyze);
325 } // there is deposited energy
326 } // we are inside a PHOS Xtal
328 // if(gMC->CurrentVolID(copy) == gMC->VolId("PPIN"))//We are inside the PIN diode
330 // cout<<" Inside PIN "<<endl;
331 // gMC->TrackPosition(pos) ;
332 // global[0] = pos[0] ;
333 // global[1] = pos[1] ;
334 // global[2] = pos[2] ;
335 // xyze[0] = pos[0] ;
336 // xyze[1] = pos[1] ;
337 // xyze[2] = pos[2] ;
338 // lostenergy = gMC->Edep() ;
339 // xyze[3] = gMC->Edep() ;
341 // if ( xyze[3] != 0 ) {
342 // gMC->CurrentVolOffID(11, relid[0]) ; // get the PHOS module number ;
343 // relid[1] = 0 ; // means PW04 and PIN
344 // gMC->CurrentVolOffID(5, relid[2]) ; // get the row number inside the module
345 // gMC->CurrentVolOffID(4, relid[3]) ; // get the cell number inside the module
347 // // get the absolute Id number
350 // GetGeometry()->RelToAbsNumbering(relid,absid) ;
351 // gMC->Gmtod(global, local, 1) ;
353 // // calculating number of electrons in the PIN diode asociated to this hit
355 // //nElectrons = lostenergy * fElectronsPerGeV ;
356 // // xyze[3] = nElectrons * fRecalibrationFactor ;
357 // apdgain = gRandom->Poisson(300.) ;
358 // // apdgain = 300.;
359 // //if(local[1]<-0.0045) xyze[3] = apdgain * nElectrons * fRecalibrationFactor/10000.;
361 // if(local[1]<-0.0045) xyze[3] = apdgain * lostenergy * fElectronsPerGeV* (fRecalibrationFactor/100.);
363 // //if((local[1]>-0.0045)&&(gMC->TrackPid()==-11)) xyze[3] = apdgain * nElectrons * fRecalibrationFactor/10000.;
365 // if((local[1]>-0.0045)&&(gMC->TrackPid()==-11)) xyze[3] = apdgain * lostenergy * fElectronsPerGeV * (fRecalibrationFactor/100.);
367 // //if(local[1]>-0.0045) xyze[3] = nElectrons * fRecalibrationFactor/10000.;
369 // if(local[1]>-0.0045) xyze[3] = lostenergy * fElectronsPerGeV * (fRecalibrationFactor/100.);
371 // // add current hit to the hit list
373 // AddHit(fIshunt, primary, tracknumber, absid, xyze);
375 // //printf("PIN volume is %d, %d, %d, %d \n",relid[0],relid[1],relid[2],relid[3]);
376 // printf("Lost energy in the PIN is %f \n",lostenergy) ;
377 // } // there is deposited energy
378 // } // we are inside a PHOS XtalPHOS PIN diode