New ALIPHOSv1: includes the light transport in the Xtal
[u/mrichter/AliRoot.git] / PHOS / AliPHOSv1.cxx
CommitLineData
7587f5a5 1/**************************************************************************
2 * Copyright(c) 1998-1999, 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//_________________________________________________________________________
17// Manager class for PHOS version SUBATECH
18//*-- Author : Odd Harald Oddland & Gines Martinez Feb-2000
19// The main goal of this version of AliPHOS is to calculted the
20// induced charged in the PIN diode, taking into account light
21// tracking in the PbWO4 crystal, induced signal in the
22// PIN due to MIPS particle and electronic noise.
23// In this respect, this class derived from AliPHOSv0 and
24// only the StepManager function has been "surcharged"
25//////////////////////////////////////////////////////////////////////////////
26
27// --- ROOT system ---
28#include "TRandom.h"
29
30// --- Standard library ---
31
32#include <cstdio>
33#include <cstring>
34#include <cstdlib>
35#include <strstream>
36#include <cassert>
37
38// --- AliRoot header files ---
39
40#include "AliPHOSv1.h"
41#include "AliPHOSHit.h"
42#include "AliPHOSDigit.h"
43#include "AliRun.h"
44#include "AliConst.h"
45
46ClassImp(AliPHOSv1)
47
48//____________________________________________________________________________
49 AliPHOSv1::AliPHOSv1() :
50 AliPHOSv0()
51{
52}
53
54//____________________________________________________________________________
55AliPHOSv1::AliPHOSv1(const char *name, const char *title):
56 AliPHOSv0(name,title)
57{
58 fLightYieldMean = 700000. ;
59 fIntrinsicPINEfficiency = 0.1875 ;
60 fLightYieldAttenuation = 0.0045 ;
61 fRecalibrationFactor = 6.2 / fLightYieldMean ;
62}
63//____________________________________________________________________________
64AliPHOSv1::AliPHOSv1(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title):
65 AliPHOSv0(Reconstructioner,name,title)
66{
67 fLightYieldMean = 700000.;
68 fIntrinsicPINEfficiency = 0.1875 ;
69 fLightYieldAttenuation = 0.0045 ;
70 fRecalibrationFactor = 6.2 / fLightYieldMean ;
71}
72
73//____________________________________________________________________________
74AliPHOSv1::~AliPHOSv1()
75{
76
77}
78
79//____________________________________________________________________________
80
81
82
83
84
85
86//____________________________________________________________________________
87void AliPHOSv1::StepManager(void)
88{
89 Int_t relid[4] ; // (box, layer, row, column) indices
90 Float_t xyze[4] ; // position wrt MRS and energy deposited
91 TLorentzVector pos ;
92 Int_t copy;
93 Float_t lightyield ; // Light Yield per GeV
94 Float_t nElectrons ; // Number of electrons in the PIN diode
95 TString name = fGeom->GetName() ;
96 Float_t global[3] ;
97 Float_t local[3] ;
98 Float_t lostenergy ;
99
100 if ( name == "GPS2" ) { // the CPV is a PPSD
101 if( gMC->CurrentVolID(copy) == gMC->VolId("GCEL") )
102 // if( strcmp ( gMC->CurrentVolName(), "GCEL" ) == 0 ) // We are inside a gas cell
103 {
104 gMC->TrackPosition(pos) ;
105 xyze[0] = pos[0] ;
106 xyze[1] = pos[1] ;
107 xyze[2] = pos[2] ;
108 xyze[3] = gMC->Edep() ;
109
110
111 if ( xyze[3] != 0 ) { // there is deposited energy
112 gMC->CurrentVolOffID(5, relid[0]) ; // get the PHOS Module number
113 gMC->CurrentVolOffID(3, relid[1]) ; // get the Micromegas Module number
114 // 1-> Geom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() upper
115 // > fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() lower
116 gMC->CurrentVolOffID(1, relid[2]) ; // get the row number of the cell
117 gMC->CurrentVolID(relid[3]) ; // get the column number
118
119 // get the absolute Id number
120
121 Int_t absid ;
122 fGeom->RelToAbsNumbering(relid,absid) ;
123
124
125 AddHit(gAlice->CurrentTrack(), absid, xyze );
126
127 } // there is deposited energy
128 } // We are inside the gas of the CPV
129 } // GPS2 configuration
130
131 if(gMC->CurrentVolID(copy) == gMC->VolId("PXTL") )
132 // if( strcmp ( gMC->CurrentVolName(), "PXTL" ) == 0 ) { // We are inside a PWO crystal
133 {
134 gMC->TrackPosition(pos) ;
135 xyze[0] = pos[0] ;
136 xyze[1] = pos[1] ;
137 xyze[2] = pos[2] ;
138 lostenergy = gMC->Edep() ;
139
140 global[0] = pos[0] ;
141 global[1] = pos[1] ;
142 global[2] = pos[2] ;
143
144 if ( xyze[3] != 0 ) {
145 gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ;
146 relid[1] = 0 ; // means PW04
147 gMC->CurrentVolOffID(4, relid[2]) ; // get the row number inside the module
148 gMC->CurrentVolOffID(3, relid[3]) ; // get the cell number inside the module
149
150 // get the absolute Id number
151
152 Int_t absid ;
153 fGeom->RelToAbsNumbering(relid,absid) ;
154 gMC->Gmtod(global, local, 1) ;
155
156 // calculating number of electrons in the PIN diode asociated to this hit
157 lightyield = gRandom->Poisson(fLightYieldMean) ;
158 nElectrons = lostenergy * lightyield * fIntrinsicPINEfficiency *
159 exp(-fLightYieldAttenuation * (local[1]+fGeom->GetCrystalSize(1)/2.0 ) ) ;
160
161 xyze[3] = nElectrons * fRecalibrationFactor ;
162 // add current hit to the hit list
163 AddHit(gAlice->CurrentTrack(), absid, xyze);
164
165 } // there is deposited energy
166 } // we are inside a PHOS Xtal
167}
168