]>
Commit | Line | Data |
---|---|---|
d15a28e7 | 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 | ||
b2a60966 | 16 | /* $Id$ */ |
17 | ||
d15a28e7 | 18 | //_________________________________________________________________________ |
a5e00016 | 19 | //-- |
20 | //-- Yves Schutz (SUBATECH) | |
dfe0be07 | 21 | // Reconstruction class. Redesigned from the old AliReconstructionner class and |
22 | // derived from STEER/AliReconstructor. | |
23 | // | |
d15a28e7 | 24 | // --- ROOT system --- |
bb5c37a5 | 25 | #include "TGeoManager.h" |
26 | #include "TGeoMatrix.h" | |
00cfce1d | 27 | |
d15a28e7 | 28 | // --- Standard library --- |
364de5c6 | 29 | |
d15a28e7 | 30 | // --- AliRoot header files --- |
9a2cdbdf | 31 | #include "AliLog.h" |
b3006690 | 32 | #include "AliAltroMapping.h" |
af885e0f | 33 | #include "AliESDEvent.h" |
33ba95c3 | 34 | #include "AliESDCaloCluster.h" |
a5e00016 | 35 | #include "AliESDCaloCells.h" |
f444a19f | 36 | #include "AliPHOSReconstructor.h" |
7acf6008 | 37 | #include "AliPHOSClusterizerv1.h" |
7acf6008 | 38 | #include "AliPHOSTrackSegmentMakerv1.h" |
39 | #include "AliPHOSPIDv1.h" | |
23904d16 | 40 | #include "AliPHOSTracker.h" |
d22dd3b4 | 41 | #include "AliRawReader.h" |
d3aa2291 | 42 | #include "AliPHOSCalibData.h" |
7e88424f | 43 | #include "AliCDBEntry.h" |
44 | #include "AliCDBManager.h" | |
64df000d | 45 | #include "AliPHOSTrigger.h" |
46 | #include "AliPHOSGeometry.h" | |
9a2cdbdf | 47 | #include "AliPHOSDigit.h" |
48 | #include "AliPHOSTrackSegment.h" | |
49 | #include "AliPHOSEmcRecPoint.h" | |
50 | #include "AliPHOSRecParticle.h" | |
379c5c09 | 51 | #include "AliPHOSRawFitterv0.h" |
52 | #include "AliPHOSRawFitterv1.h" | |
53 | #include "AliPHOSRawFitterv2.h" | |
f4a5c5fd | 54 | #include "AliPHOSRawFitterv3.h" |
9a2cdbdf | 55 | #include "AliPHOSRawDigiProducer.h" |
56 | #include "AliPHOSPulseGenerator.h" | |
e957fea8 | 57 | |
f444a19f | 58 | ClassImp(AliPHOSReconstructor) |
d15a28e7 | 59 | |
2e60107f | 60 | Bool_t AliPHOSReconstructor::fgDebug = kFALSE ; |
6483babc | 61 | TClonesArray* AliPHOSReconstructor::fgDigitsArray = 0; // Array of PHOS digits |
62 | TObjArray* AliPHOSReconstructor::fgEMCRecPoints = 0; // Array of EMC rec.points | |
d3aa2291 | 63 | AliPHOSCalibData * AliPHOSReconstructor::fgCalibData = 0 ; |
64 | ||
2e60107f | 65 | |
d15a28e7 | 66 | //____________________________________________________________________________ |
9a2cdbdf | 67 | AliPHOSReconstructor::AliPHOSReconstructor() : |
dcab1c7e | 68 | fGeom(NULL),fClusterizer(NULL),fTSM(NULL),fPID(NULL) |
d15a28e7 | 69 | { |
b2a60966 | 70 | // ctor |
8d8258f6 | 71 | fGeom = AliPHOSGeometry::GetInstance("IHEP",""); |
dcab1c7e | 72 | fClusterizer = new AliPHOSClusterizerv1 (fGeom); |
73 | fTSM = new AliPHOSTrackSegmentMakerv1(fGeom); | |
74 | fPID = new AliPHOSPIDv1 (fGeom); | |
6483babc | 75 | fgDigitsArray = new TClonesArray("AliPHOSDigit",100); |
76 | fgEMCRecPoints= new TObjArray(100) ; | |
d3aa2291 | 77 | if (!fgCalibData) |
78 | fgCalibData = new AliPHOSCalibData(-1); //use AliCDBManager's run number | |
79 | ||
e68222ce | 80 | } |
6ad0bfa0 | 81 | |
0379a13e | 82 | //____________________________________________________________________________ |
83 | AliPHOSReconstructor::~AliPHOSReconstructor() | |
84 | { | |
85 | // dtor | |
9a2cdbdf | 86 | delete fGeom; |
8d8258f6 | 87 | delete fClusterizer; |
dcab1c7e | 88 | delete fTSM; |
89 | delete fPID; | |
6483babc | 90 | delete fgDigitsArray; |
91 | delete fgEMCRecPoints; | |
0379a13e | 92 | } |
7acf6008 | 93 | |
7acf6008 | 94 | //____________________________________________________________________________ |
9a2cdbdf | 95 | void AliPHOSReconstructor::Reconstruct(TTree* digitsTree, TTree* clustersTree) const |
35293055 | 96 | { |
9a2cdbdf | 97 | // 'single-event' local reco method called by AliReconstruction; |
dfe0be07 | 98 | // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track |
af885e0f | 99 | // segment maker needs access to the AliESDEvent object to retrieve the tracks reconstructed by |
dfe0be07 | 100 | // the global tracking. |
9a2cdbdf | 101 | |
7e88424f | 102 | fClusterizer->InitParameters(); |
8d8258f6 | 103 | fClusterizer->SetInput(digitsTree); |
104 | fClusterizer->SetOutput(clustersTree); | |
a68156e6 | 105 | if ( Debug() ) |
8d8258f6 | 106 | fClusterizer->Digits2Clusters("deb all") ; |
a68156e6 | 107 | else |
8d8258f6 | 108 | fClusterizer->Digits2Clusters("") ; |
a68156e6 | 109 | } |
110 | ||
111 | //____________________________________________________________________________ | |
9a2cdbdf | 112 | void AliPHOSReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree, |
113 | AliESDEvent* esd) const | |
a68156e6 | 114 | { |
9a2cdbdf | 115 | // This method produces PHOS rec-particles, |
116 | // then it creates AliESDtracks out of them and | |
117 | // write tracks to the ESD | |
118 | ||
e68222ce | 119 | |
9a2cdbdf | 120 | // do current event; the loop over events is done by AliReconstruction::Run() |
dcab1c7e | 121 | fTSM->SetESD(esd) ; |
122 | fTSM->SetInput(clustersTree); | |
9a2cdbdf | 123 | if ( Debug() ) |
dcab1c7e | 124 | fTSM->Clusters2TrackSegments("deb all") ; |
9a2cdbdf | 125 | else |
dcab1c7e | 126 | fTSM->Clusters2TrackSegments("") ; |
35293055 | 127 | |
71994f35 | 128 | fPID->SetEnergyCorrectionOn(GetRecoParam()->GetEMCEnergyCorrectionOn()); |
129 | ||
dcab1c7e | 130 | fPID->SetInput(clustersTree, fTSM->GetTrackSegments()) ; |
131 | fPID->SetESD(esd) ; | |
dfe0be07 | 132 | if ( Debug() ) |
dcab1c7e | 133 | fPID->TrackSegments2RecParticles("deb all") ; |
dfe0be07 | 134 | else |
dcab1c7e | 135 | fPID->TrackSegments2RecParticles("") ; |
7acf6008 | 136 | |
dcab1c7e | 137 | TClonesArray *recParticles = fPID->GetRecParticles(); |
138 | Int_t nOfRecParticles = recParticles->GetEntriesFast(); | |
a5fa6165 | 139 | |
85c60a8e | 140 | esd->SetNumberOfPHOSClusters(nOfRecParticles) ; |
dd7ee508 | 141 | esd->SetFirstPHOSCluster(esd->GetNumberOfCaloClusters()) ; |
a5e00016 | 142 | |
9a2cdbdf | 143 | AliDebug(2,Form("%d rec. particles, option %s",nOfRecParticles,GetOption())); |
a5e00016 | 144 | |
145 | // Read digits array | |
146 | ||
147 | TBranch *branch = digitsTree->GetBranch("PHOS"); | |
148 | if (!branch) { | |
149 | AliError("can't get the branch with the PHOS digits !"); | |
150 | return; | |
151 | } | |
6483babc | 152 | branch->SetAddress(&fgDigitsArray); |
a5e00016 | 153 | branch->GetEntry(0); |
154 | ||
155 | // Get the clusters array | |
156 | ||
157 | TBranch *emcbranch = clustersTree->GetBranch("PHOSEmcRP"); | |
158 | if (!emcbranch) { | |
159 | AliError("can't get the branch with the PHOS EMC clusters !"); | |
160 | return; | |
161 | } | |
162 | ||
6483babc | 163 | emcbranch->SetAddress(&fgEMCRecPoints); |
a5e00016 | 164 | emcbranch->GetEntry(0); |
8013c27e | 165 | |
64df000d | 166 | //#########Calculate trigger and set trigger info########### |
a5e00016 | 167 | |
64df000d | 168 | AliPHOSTrigger tr ; |
169 | // tr.SetPatchSize(1);//create 4x4 patches | |
bfae5a5d | 170 | tr.SetSimulation(kFALSE); |
6483babc | 171 | tr.Trigger(fgDigitsArray); |
64df000d | 172 | |
173 | Float_t maxAmp2x2 = tr.Get2x2MaxAmplitude(); | |
174 | Float_t maxAmpnxn = tr.GetnxnMaxAmplitude(); | |
175 | Float_t ampOutOfPatch2x2 = tr.Get2x2AmpOutOfPatch() ; | |
176 | Float_t ampOutOfPatchnxn = tr.GetnxnAmpOutOfPatch() ; | |
177 | ||
64df000d | 178 | Int_t iSM2x2 = tr.Get2x2SuperModule(); |
179 | Int_t iSMnxn = tr.GetnxnSuperModule(); | |
180 | Int_t iCrystalPhi2x2 = tr.Get2x2CrystalPhi(); | |
181 | Int_t iCrystalPhinxn = tr.GetnxnCrystalPhi(); | |
182 | Int_t iCrystalEta2x2 = tr.Get2x2CrystalEta(); | |
183 | Int_t iCrystalEtanxn = tr.GetnxnCrystalEta(); | |
184 | ||
a5e00016 | 185 | AliDebug(2, Form("Trigger 2x2 max amp %f, out amp %f, SM %d, iphi %d ieta %d", |
186 | maxAmp2x2, ampOutOfPatch2x2, iSM2x2,iCrystalPhi2x2, iCrystalEta2x2)); | |
187 | AliDebug(2, Form("Trigger 4x4 max amp %f , out amp %f, SM %d, iphi %d, ieta %d", | |
188 | maxAmpnxn, ampOutOfPatchnxn, iSMnxn,iCrystalPhinxn, iCrystalEtanxn)); | |
64df000d | 189 | |
bfae5a5d | 190 | // Attention! PHOS modules in order to calculate AbsId need to be 1-5 not 0-4 as returns trigger. |
191 | Int_t iRelId2x2 []= {iSM2x2+1,0,iCrystalPhi2x2,iCrystalEta2x2}; | |
64df000d | 192 | Int_t iAbsId2x2 =-1; |
bfae5a5d | 193 | Int_t iRelIdnxn []= {iSMnxn+1,0,iCrystalPhinxn,iCrystalEtanxn}; |
64df000d | 194 | Int_t iAbsIdnxn =-1; |
195 | TVector3 pos2x2(-1,-1,-1); | |
196 | TVector3 posnxn(-1,-1,-1); | |
9a2cdbdf | 197 | fGeom->RelToAbsNumbering(iRelId2x2, iAbsId2x2); |
198 | fGeom->RelToAbsNumbering(iRelIdnxn, iAbsIdnxn); | |
199 | fGeom->RelPosInAlice(iAbsId2x2, pos2x2); | |
200 | fGeom->RelPosInAlice(iAbsIdnxn, posnxn); | |
64df000d | 201 | |
202 | TArrayF triggerPosition(6); | |
203 | triggerPosition[0] = pos2x2(0) ; | |
204 | triggerPosition[1] = pos2x2(1) ; | |
205 | triggerPosition[2] = pos2x2(2) ; | |
206 | triggerPosition[3] = posnxn(0) ; | |
207 | triggerPosition[4] = posnxn(1) ; | |
208 | triggerPosition[5] = posnxn(2) ; | |
209 | ||
210 | TArrayF triggerAmplitudes(4); | |
211 | triggerAmplitudes[0] = maxAmp2x2 ; | |
212 | triggerAmplitudes[1] = ampOutOfPatch2x2 ; | |
213 | triggerAmplitudes[2] = maxAmpnxn ; | |
214 | triggerAmplitudes[3] = ampOutOfPatchnxn ; | |
215 | ||
216 | //esd->SetPHOSTriggerCells(triggerPosition); | |
217 | esd->AddPHOSTriggerPosition(triggerPosition); | |
218 | esd->AddPHOSTriggerAmplitudes(triggerAmplitudes); | |
219 | ||
e68222ce | 220 | |
a5e00016 | 221 | //######################################## |
222 | //############# Fill CaloCells ########### | |
223 | //######################################## | |
224 | ||
6483babc | 225 | Int_t nDigits = fgDigitsArray->GetEntries(); |
a5e00016 | 226 | Int_t idignew = 0 ; |
227 | AliDebug(1,Form("%d digits",nDigits)); | |
228 | ||
229 | const Int_t knEMC = fGeom->GetNModules()*fGeom->GetNPhi()*fGeom->GetNZ(); | |
230 | AliESDCaloCells &phsCells = *(esd->GetPHOSCells()); | |
231 | phsCells.CreateContainer(nDigits); | |
232 | phsCells.SetType(AliESDCaloCells::kPHOSCell); | |
233 | ||
234 | // Add to CaloCells only EMC digits with non-zero energy | |
235 | for (Int_t idig = 0 ; idig < nDigits ; idig++) { | |
6483babc | 236 | const AliPHOSDigit * dig = (const AliPHOSDigit*)fgDigitsArray->At(idig); |
12dd7f10 | 237 | if(dig->GetId() <= knEMC && |
238 | Calibrate(dig->GetEnergy(),dig->GetId()) > GetRecoParam()->GetEMCMinE() ){ | |
6f47f50d | 239 | phsCells.SetCell(idignew,dig->GetId(), Calibrate(dig->GetEnergy(),dig->GetId()), |
240 | CalibrateT(dig->GetTime(),dig->GetId())); | |
a5e00016 | 241 | idignew++; |
242 | } | |
e68222ce | 243 | } |
a5e00016 | 244 | phsCells.SetNumberOfCells(idignew); |
245 | phsCells.Sort(); | |
e68222ce | 246 | |
a5e00016 | 247 | //######################################## |
248 | //############## Fill CaloClusters ####### | |
249 | //######################################## | |
f4e0dd30 | 250 | |
dfe0be07 | 251 | for (Int_t recpart = 0 ; recpart < nOfRecParticles ; recpart++) { |
a5e00016 | 252 | AliPHOSRecParticle *rp = dynamic_cast<AliPHOSRecParticle*>(recParticles->At(recpart)); |
dfe0be07 | 253 | if (Debug()) |
254 | rp->Print(); | |
25ed816e | 255 | // Get track segment and EMC rec.point associated with this rec.particle |
dcab1c7e | 256 | AliPHOSTrackSegment *ts = static_cast<AliPHOSTrackSegment *>(fTSM->GetTrackSegments() |
a5e00016 | 257 | ->At(rp->GetPHOSTSIndex())); |
9a2cdbdf | 258 | |
6483babc | 259 | AliPHOSEmcRecPoint *emcRP = static_cast<AliPHOSEmcRecPoint *>(fgEMCRecPoints->At(ts->GetEmcIndex())); |
25ed816e | 260 | AliESDCaloCluster *ec = new AliESDCaloCluster() ; |
e68222ce | 261 | |
85c60a8e | 262 | Float_t xyz[3]; |
8013c27e | 263 | for (Int_t ixyz=0; ixyz<3; ixyz++) |
264 | xyz[ixyz] = rp->GetPos()[ixyz]; | |
dd7ee508 | 265 | |
266 | AliDebug(2,Form("Global position xyz=(%f,%f,%f)",xyz[0],xyz[1],xyz[2])); | |
77ea1c6f | 267 | |
a5e00016 | 268 | // Create cell lists |
269 | ||
270 | Int_t cellMult = emcRP->GetDigitsMultiplicity(); | |
271 | Int_t *digitsList = emcRP->GetDigitsList(); | |
272 | Float_t *rpElist = emcRP->GetEnergiesList() ; | |
273 | UShort_t *absIdList = new UShort_t[cellMult]; | |
274 | Double_t *fracList = new Double_t[cellMult]; | |
275 | ||
276 | for (Int_t iCell=0; iCell<cellMult; iCell++) { | |
6483babc | 277 | AliPHOSDigit *digit = static_cast<AliPHOSDigit *>(fgDigitsArray->At(digitsList[iCell])); |
a5e00016 | 278 | absIdList[iCell] = (UShort_t)(digit->GetId()); |
279 | if (digit->GetEnergy() > 0) | |
d3aa2291 | 280 | fracList[iCell] = rpElist[iCell]/(Calibrate(digit->GetEnergy(),digit->GetId())); |
a5e00016 | 281 | else |
282 | fracList[iCell] = 0; | |
25ed816e | 283 | } |
77ea1c6f | 284 | |
7592dfc4 | 285 | //Primaries |
286 | Int_t primMult = 0; | |
4dd59c4a | 287 | Int_t *primList = emcRP->GetPrimaries(primMult); |
a5e00016 | 288 | |
48c5db5b | 289 | Float_t energy; |
7e88424f | 290 | if (GetRecoParam()->EMCEcore2ESD()) |
48c5db5b | 291 | energy = emcRP->GetCoreEnergy(); |
292 | else | |
293 | energy = rp->Energy(); | |
294 | ||
7592dfc4 | 295 | // fills the ESDCaloCluster |
8ada0ffe | 296 | ec->SetClusterType(AliESDCaloCluster::kPHOSCluster); |
a5e00016 | 297 | ec->SetPosition(xyz); //rec.point position in MARS |
48c5db5b | 298 | ec->SetE(energy); //total or core particle energy |
25ed816e | 299 | ec->SetClusterDisp(emcRP->GetDispersion()); //cluster dispersion |
e68222ce | 300 | ec->SetPid(rp->GetPID()) ; //array of particle identification |
25ed816e | 301 | ec->SetM02(emcRP->GetM2x()) ; //second moment M2x |
302 | ec->SetM20(emcRP->GetM2z()) ; //second moment M2z | |
303 | ec->SetNExMax(emcRP->GetNExMax()); //number of local maxima | |
a5e00016 | 304 | ec->SetEmcCpvDistance(ts->GetCpvDistance("r")); //Only radius, what about separate x,z???? |
25ed816e | 305 | ec->SetClusterChi2(-1); //not yet implemented |
6f47f50d | 306 | ec->SetTOF(emcRP->GetTime()); //Time of flight - already calibrated in EMCRecPoint |
78902954 | 307 | |
a5e00016 | 308 | //Cells contributing to clusters |
309 | ec->SetNCells(cellMult); | |
310 | ec->SetCellsAbsId(absIdList); | |
311 | ec->SetCellsAmplitudeFraction(fracList); | |
7592dfc4 | 312 | |
3744a6cf | 313 | //Distance to the nearest bad crystal |
314 | ec->SetDistanceToBadChannel(emcRP->GetDistanceToBadCrystal()); | |
7592dfc4 | 315 | |
316 | //Array of MC indeces | |
4dd59c4a | 317 | TArrayI arrayPrim(primMult,primList); |
7592dfc4 | 318 | ec->AddLabels(arrayPrim); |
64df000d | 319 | |
e44c41e9 | 320 | //Matched ESD track |
321 | TArrayI arrayTrackMatched(1); | |
322 | arrayTrackMatched[0]= ts->GetTrackIndex(); | |
323 | ec->AddTracksMatched(arrayTrackMatched); | |
324 | ||
85c60a8e | 325 | esd->AddCaloCluster(ec); |
9a2cdbdf | 326 | delete ec; |
091d150a | 327 | delete [] fracList; |
328 | delete [] absIdList; | |
e68222ce | 329 | } |
6483babc | 330 | fgDigitsArray ->Delete(); |
331 | fgEMCRecPoints->Delete(); | |
332 | recParticles ->Delete(); | |
bb5c37a5 | 333 | |
334 | //Store PHOS misalignment matrixes | |
335 | FillMisalMatrixes(esd) ; | |
336 | ||
dd7ee508 | 337 | } |
338 | ||
e68222ce | 339 | //____________________________________________________________________________ |
d76c31f4 | 340 | AliTracker* AliPHOSReconstructor::CreateTracker() const |
dd7ee508 | 341 | { |
9a2cdbdf | 342 | // creates the PHOS tracker |
343 | return new AliPHOSTracker(); | |
344 | } | |
dd7ee508 | 345 | |
1267d56d | 346 | //____________________________________________________________________________ |
9a2cdbdf | 347 | void AliPHOSReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const |
348 | { | |
349 | // Converts raw data to | |
350 | // PHOS digits | |
351 | // Works on a single-event basis | |
9a2cdbdf | 352 | rawReader->Reset() ; |
dd7ee508 | 353 | |
379c5c09 | 354 | AliPHOSRawFitterv0 * fitter ; |
77ea1c6f | 355 | |
7e88424f | 356 | const TObjArray* maps = AliPHOSRecoParam::GetMappings(); |
b3006690 | 357 | if(!maps) AliFatal("Cannot retrieve ALTRO mappings!!"); |
358 | ||
47ba0d5d | 359 | AliAltroMapping *mapping[20]; |
360 | for(Int_t i = 0; i < 20; i++) { | |
b3006690 | 361 | mapping[i] = (AliAltroMapping*)maps->At(i); |
362 | } | |
363 | ||
379c5c09 | 364 | if (strcmp(GetRecoParam()->EMCFitterVersion(),"v1")==0) |
365 | fitter=new AliPHOSRawFitterv1(); | |
366 | else if (strcmp(GetRecoParam()->EMCFitterVersion(),"v2")==0) | |
367 | fitter=new AliPHOSRawFitterv2(); | |
f4a5c5fd | 368 | else if (strcmp(GetRecoParam()->EMCFitterVersion(),"v3")==0) |
369 | fitter=new AliPHOSRawFitterv3(); | |
7e88424f | 370 | else |
379c5c09 | 371 | fitter=new AliPHOSRawFitterv0(); |
77ea1c6f | 372 | |
379c5c09 | 373 | fitter->SubtractPedestals(GetRecoParam()->EMCSubtractPedestals()); |
374 | fitter->SetAmpOffset (GetRecoParam()->GetGlobalAltroOffset()); | |
375 | fitter->SetAmpThreshold (GetRecoParam()->GetGlobalAltroThreshold()); | |
8be3a30a | 376 | |
9a2cdbdf | 377 | TClonesArray *digits = new TClonesArray("AliPHOSDigit",1); |
378 | digits->SetName("DIGITS"); | |
379 | Int_t bufsize = 32000; | |
380 | digitsTree->Branch("PHOS", &digits, bufsize); | |
dd7ee508 | 381 | |
379c5c09 | 382 | AliPHOSRawDigiProducer rdp(rawReader,mapping); |
8be3a30a | 383 | |
379c5c09 | 384 | rdp.SetEmcMinAmp(GetRecoParam()->GetEMCRawDigitThreshold()); // in ADC |
385 | rdp.SetCpvMinAmp(GetRecoParam()->GetCPVMinE()); | |
386 | rdp.SetSampleQualityCut(GetRecoParam()->GetEMCSampleQualityCut()); | |
387 | rdp.MakeDigits(digits,fitter); | |
77ea1c6f | 388 | |
379c5c09 | 389 | delete fitter ; |
7592dfc4 | 390 | |
379c5c09 | 391 | if (AliLog::GetGlobalDebugLevel() == 1) { |
392 | Int_t modMax=-111; | |
393 | Int_t colMax=-111; | |
394 | Int_t rowMax=-111; | |
395 | Float_t eMax=-333; | |
396 | //!!!for debug!!! | |
397 | ||
398 | Int_t relId[4]; | |
399 | for(Int_t iDigit=0; iDigit<digits->GetEntries(); iDigit++) { | |
400 | AliPHOSDigit* digit = (AliPHOSDigit*)digits->At(iDigit); | |
401 | if(digit->GetEnergy()>eMax) { | |
402 | fGeom->AbsToRelNumbering(digit->GetId(),relId); | |
403 | eMax=digit->GetEnergy(); | |
404 | modMax=relId[0]; | |
405 | rowMax=relId[2]; | |
406 | colMax=relId[3]; | |
407 | } | |
dd7ee508 | 408 | } |
379c5c09 | 409 | |
410 | AliDebug(1,Form("Digit with max. energy: modMax %d colMax %d rowMax %d eMax %f\n\n", | |
411 | modMax,colMax,rowMax,eMax)); | |
dd7ee508 | 412 | } |
413 | ||
9a2cdbdf | 414 | digitsTree->Fill(); |
e68222ce | 415 | digits->Delete(); |
416 | delete digits; | |
d7d3b67b | 417 | } |
d3aa2291 | 418 | //================================================================================== |
419 | Float_t AliPHOSReconstructor::Calibrate(Float_t amp, Int_t absId)const{ | |
420 | // Calibrate EMC digit, i.e. multiply its Amp by a factor read from CDB | |
421 | ||
422 | const AliPHOSGeometry *geom = AliPHOSGeometry::GetInstance() ; | |
423 | ||
424 | //Determine rel.position of the cell absolute ID | |
425 | Int_t relId[4]; | |
426 | geom->AbsToRelNumbering(absId,relId); | |
427 | Int_t module=relId[0]; | |
428 | Int_t row =relId[2]; | |
429 | Int_t column=relId[3]; | |
430 | if(relId[1]){ //CPV | |
431 | Float_t calibration = fgCalibData->GetADCchannelCpv(module,column,row); | |
432 | return amp*calibration ; | |
433 | } | |
434 | else{ //EMC | |
435 | Float_t calibration = fgCalibData->GetADCchannelEmc(module,column,row); | |
436 | return amp*calibration ; | |
437 | } | |
438 | } | |
bb5c37a5 | 439 | //================================================================================== |
6f47f50d | 440 | Float_t AliPHOSReconstructor::CalibrateT(Float_t time, Int_t absId)const{ |
441 | // Calibrate EMC digit, i.e. multiply its Amp by a factor read from CDB | |
442 | ||
443 | const AliPHOSGeometry *geom = AliPHOSGeometry::GetInstance() ; | |
444 | ||
445 | //Determine rel.position of the cell absolute ID | |
446 | Int_t relId[4]; | |
447 | geom->AbsToRelNumbering(absId,relId); | |
448 | Int_t module=relId[0]; | |
449 | Int_t row =relId[2]; | |
450 | Int_t column=relId[3]; | |
451 | if(relId[1]){ //CPV | |
452 | return 0. ; | |
453 | } | |
454 | else{ //EMC | |
455 | time += fgCalibData->GetTimeShiftEmc(module,column,row); | |
456 | return time ; | |
457 | } | |
458 | } | |
459 | //================================================================================== | |
bb5c37a5 | 460 | void AliPHOSReconstructor::FillMisalMatrixes(AliESDEvent* esd)const{ |
461 | //Store PHOS matrixes in ESD Header | |
462 | ||
463 | //Check, if matrixes was already stored | |
464 | for(Int_t mod=0 ;mod<5; mod++){ | |
465 | if(esd->GetPHOSMatrix(mod)!=0) | |
466 | return ; | |
467 | } | |
468 | ||
469 | //Create and store matrixes | |
470 | if(!gGeoManager){ | |
471 | AliError("Can not store misal. matrixes: no gGeoManager! \n") ; | |
472 | return ; | |
473 | } | |
474 | //Note, that owner of copied marixes will be header | |
475 | char path[255] ; | |
476 | TGeoHMatrix * m ; | |
477 | for(Int_t mod=0; mod<5; mod++){ | |
478 | sprintf(path,"/ALIC_1/PHOS_%d",mod+1) ; //In Geometry modules numbered 1,2,.,5 | |
479 | if (gGeoManager->cd(path)){ | |
480 | m = gGeoManager->GetCurrentMatrix() ; | |
481 | esd->SetPHOSMatrix(new TGeoHMatrix(*m),mod) ; | |
482 | } | |
483 | else{ | |
484 | esd->SetPHOSMatrix(NULL,mod) ; | |
485 | } | |
486 | } | |
487 | ||
488 | } | |
d3aa2291 | 489 | |
490 |