]>
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 | //_________________________________________________________________________ |
a3dfe79c | 19 | //*-- |
dfe0be07 | 20 | //*-- Yves Schutz (SUBATECH) |
21 | // Reconstruction class. Redesigned from the old AliReconstructionner class and | |
22 | // derived from STEER/AliReconstructor. | |
23 | // | |
d15a28e7 | 24 | // --- ROOT system --- |
25 | ||
d15a28e7 | 26 | // --- Standard library --- |
364de5c6 | 27 | |
d15a28e7 | 28 | // --- AliRoot header files --- |
af885e0f | 29 | #include "AliESDEvent.h" |
33ba95c3 | 30 | #include "AliESDCaloCluster.h" |
f444a19f | 31 | #include "AliPHOSReconstructor.h" |
7acf6008 | 32 | #include "AliPHOSClusterizerv1.h" |
7acf6008 | 33 | #include "AliPHOSTrackSegmentMakerv1.h" |
34 | #include "AliPHOSPIDv1.h" | |
35293055 | 35 | #include "AliPHOSGetter.h" |
23904d16 | 36 | #include "AliPHOSTracker.h" |
d22dd3b4 | 37 | #include "AliRawReader.h" |
64df000d | 38 | #include "AliPHOSTrigger.h" |
39 | #include "AliPHOSGeometry.h" | |
3799bcb5 | 40 | #include "AliPHOSRecoParamEmc.h" |
41 | #include "AliPHOSRecoParamCpv.h" | |
e957fea8 | 42 | |
f444a19f | 43 | ClassImp(AliPHOSReconstructor) |
d15a28e7 | 44 | |
2e60107f | 45 | Bool_t AliPHOSReconstructor::fgDebug = kFALSE ; |
3799bcb5 | 46 | AliPHOSRecoParam* AliPHOSReconstructor::fgkRecoParamEmc =0; // EMC rec. parameters |
47 | AliPHOSRecoParam* AliPHOSReconstructor::fgkRecoParamCpv =0; // CPV rec. parameters | |
2e60107f | 48 | |
d15a28e7 | 49 | //____________________________________________________________________________ |
2e60107f | 50 | AliPHOSReconstructor::AliPHOSReconstructor() |
d15a28e7 | 51 | { |
b2a60966 | 52 | // ctor |
0379a13e | 53 | |
3799bcb5 | 54 | if (!fgkRecoParamEmc) { |
55 | AliWarning("The Reconstruction parameters for EMC nonitialized - Used default one"); | |
56 | fgkRecoParamEmc = AliPHOSRecoParamEmc::GetEmcDefaultParameters(); | |
57 | } | |
58 | ||
59 | if (!fgkRecoParamCpv) { | |
60 | AliWarning("The Reconstruction parameters for CPV nonitialized - Used default one"); | |
61 | fgkRecoParamCpv = AliPHOSRecoParamCpv::GetCpvDefaultParameters(); | |
62 | } | |
63 | ||
6ad0bfa0 | 64 | } |
65 | ||
0379a13e | 66 | //____________________________________________________________________________ |
67 | AliPHOSReconstructor::~AliPHOSReconstructor() | |
68 | { | |
69 | // dtor | |
70 | ||
71 | } | |
7acf6008 | 72 | |
7acf6008 | 73 | //____________________________________________________________________________ |
772634e0 | 74 | void AliPHOSReconstructor::Reconstruct(AliRunLoader* runLoader) const |
35293055 | 75 | { |
dfe0be07 | 76 | // method called by AliReconstruction; |
77 | // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track | |
af885e0f | 78 | // segment maker needs access to the AliESDEvent object to retrieve the tracks reconstructed by |
dfe0be07 | 79 | // the global tracking. |
80 | ||
81 | TString headerFile(runLoader->GetFileName()) ; | |
9ee4fde2 | 82 | TString branchName(runLoader->GetEventFolder()->GetName()) ; |
a68156e6 | 83 | |
84 | AliPHOSClusterizerv1 clu(headerFile, branchName); | |
85 | clu.SetEventRange(0, -1) ; // do all the events | |
86 | if ( Debug() ) | |
87 | clu.ExecuteTask("deb all") ; | |
88 | else | |
89 | clu.ExecuteTask("") ; | |
90 | ||
91 | } | |
92 | ||
93 | //____________________________________________________________________________ | |
772634e0 | 94 | void AliPHOSReconstructor::Reconstruct(AliRunLoader* runLoader, AliRawReader* rawreader) const |
a68156e6 | 95 | { |
96 | // method called by AliReconstruction; | |
97 | // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track | |
af885e0f | 98 | // segment maker needs access to the AliESDEvent object to retrieve the tracks reconstructed by |
a68156e6 | 99 | // the global tracking. |
100 | // Here we reconstruct from Raw Data | |
772634e0 | 101 | |
a68156e6 | 102 | rawreader->Reset() ; |
103 | TString headerFile(runLoader->GetFileName()) ; | |
104 | TString branchName(runLoader->GetEventFolder()->GetName()) ; | |
35293055 | 105 | |
dfe0be07 | 106 | AliPHOSClusterizerv1 clu(headerFile, branchName); |
f88e2313 | 107 | clu.SetEventRange(0, -1) ; // do all the events |
d22dd3b4 | 108 | clu.SetRawReader(rawreader); |
f5eaa851 | 109 | |
110 | TString option = GetOption(); | |
111 | if (option.Contains("OldRCUFormat")) | |
112 | clu.SetOldRCUFormat(kTRUE); | |
113 | ||
dfe0be07 | 114 | if ( Debug() ) |
115 | clu.ExecuteTask("deb all") ; | |
116 | else | |
d22dd3b4 | 117 | clu.ExecuteTask("") ; |
0379a13e | 118 | |
35293055 | 119 | } |
7acf6008 | 120 | |
7acf6008 | 121 | //____________________________________________________________________________ |
af885e0f | 122 | void AliPHOSReconstructor::FillESD(AliRunLoader* runLoader, AliESDEvent* esd) const |
7acf6008 | 123 | { |
23904d16 | 124 | // This function creates AliESDtracks from AliPHOSRecParticles |
125 | // and | |
126 | // writes them to the ESD | |
bf72996e | 127 | |
23904d16 | 128 | Int_t eventNumber = runLoader->GetEventNumber() ; |
dfe0be07 | 129 | |
a5fa6165 | 130 | |
25ed816e | 131 | AliPHOSGetter *gime = AliPHOSGetter::Instance(); |
132 | gime->Event(eventNumber, "DRTP") ; | |
133 | TClonesArray *recParticles = gime->RecParticles(); | |
dfe0be07 | 134 | Int_t nOfRecParticles = recParticles->GetEntries(); |
a5fa6165 | 135 | |
136 | ||
85c60a8e | 137 | esd->SetNumberOfPHOSClusters(nOfRecParticles) ; |
dd7ee508 | 138 | esd->SetFirstPHOSCluster(esd->GetNumberOfCaloClusters()) ; |
a5fa6165 | 139 | |
140 | Int_t maxClu = esd->GetNumberOfPHOSClusters() ; | |
141 | ||
dd7ee508 | 142 | AliDebug(2,Form("%d digits and %d rec. particles in event %d, option %s",gime->Digits()->GetEntries(),nOfRecParticles,eventNumber,GetOption())); |
8013c27e | 143 | |
64df000d | 144 | |
145 | //#########Calculate trigger and set trigger info########### | |
146 | ||
147 | AliPHOSTrigger tr ; | |
148 | // tr.SetPatchSize(1);//create 4x4 patches | |
149 | tr.Trigger(); | |
150 | ||
151 | Float_t maxAmp2x2 = tr.Get2x2MaxAmplitude(); | |
152 | Float_t maxAmpnxn = tr.GetnxnMaxAmplitude(); | |
153 | Float_t ampOutOfPatch2x2 = tr.Get2x2AmpOutOfPatch() ; | |
154 | Float_t ampOutOfPatchnxn = tr.GetnxnAmpOutOfPatch() ; | |
155 | ||
156 | AliPHOSGeometry * geom = gime->PHOSGeometry(); | |
157 | ||
158 | Int_t iSM2x2 = tr.Get2x2SuperModule(); | |
159 | Int_t iSMnxn = tr.GetnxnSuperModule(); | |
160 | Int_t iCrystalPhi2x2 = tr.Get2x2CrystalPhi(); | |
161 | Int_t iCrystalPhinxn = tr.GetnxnCrystalPhi(); | |
162 | Int_t iCrystalEta2x2 = tr.Get2x2CrystalEta(); | |
163 | Int_t iCrystalEtanxn = tr.GetnxnCrystalEta(); | |
164 | ||
165 | AliDebug(2, Form("Trigger 2x2 max amp %f, out amp %f, SM %d, iphi %d ieta %d", maxAmp2x2, ampOutOfPatch2x2, iSM2x2,iCrystalPhi2x2, iCrystalEta2x2)); | |
166 | AliDebug(2, Form("Trigger 4x4 max amp %f , out amp %f, SM %d, iphi %d, ieta %d", maxAmpnxn, ampOutOfPatchnxn, iSMnxn,iCrystalPhinxn, iCrystalEtanxn)); | |
167 | ||
24b8fcca | 168 | Int_t iRelId2x2 []= {iSM2x2+1,0,iCrystalPhi2x2,iCrystalEta2x2};// PHOS modules in order to calculate AbsId need to be 1-5 not 0-4 as returns trigger. |
64df000d | 169 | Int_t iAbsId2x2 =-1; |
24b8fcca | 170 | Int_t iRelIdnxn []= {iSMnxn+1,0,iCrystalPhinxn,iCrystalEtanxn};// PHOS modules in order to calculate AbsId need to be 1-5 not 0-4 as returns trigger. |
64df000d | 171 | Int_t iAbsIdnxn =-1; |
172 | TVector3 pos2x2(-1,-1,-1); | |
173 | TVector3 posnxn(-1,-1,-1); | |
174 | geom->RelToAbsNumbering(iRelId2x2, iAbsId2x2); | |
175 | geom->RelToAbsNumbering(iRelIdnxn, iAbsIdnxn); | |
176 | geom->RelPosInAlice(iAbsId2x2, pos2x2); | |
177 | geom->RelPosInAlice(iAbsIdnxn, posnxn); | |
178 | ||
179 | TArrayF triggerPosition(6); | |
180 | triggerPosition[0] = pos2x2(0) ; | |
181 | triggerPosition[1] = pos2x2(1) ; | |
182 | triggerPosition[2] = pos2x2(2) ; | |
183 | triggerPosition[3] = posnxn(0) ; | |
184 | triggerPosition[4] = posnxn(1) ; | |
185 | triggerPosition[5] = posnxn(2) ; | |
186 | ||
187 | TArrayF triggerAmplitudes(4); | |
188 | triggerAmplitudes[0] = maxAmp2x2 ; | |
189 | triggerAmplitudes[1] = ampOutOfPatch2x2 ; | |
190 | triggerAmplitudes[2] = maxAmpnxn ; | |
191 | triggerAmplitudes[3] = ampOutOfPatchnxn ; | |
192 | ||
193 | //esd->SetPHOSTriggerCells(triggerPosition); | |
194 | esd->AddPHOSTriggerPosition(triggerPosition); | |
195 | esd->AddPHOSTriggerAmplitudes(triggerAmplitudes); | |
196 | ||
197 | //###################################### | |
7592dfc4 | 198 | |
64df000d | 199 | //Fill CaloClusters |
f4e0dd30 | 200 | const Float_t kBigShort = std::numeric_limits<short int>::max() - 1; |
201 | const Float_t nsec100 = 1e9*100.; // units of 0.01 ns | |
202 | const Float_t gev500 = 500.; // units of GeV/500 | |
203 | ||
dfe0be07 | 204 | for (Int_t recpart = 0 ; recpart < nOfRecParticles ; recpart++) { |
205 | AliPHOSRecParticle * rp = dynamic_cast<AliPHOSRecParticle*>(recParticles->At(recpart)); | |
206 | if (Debug()) | |
207 | rp->Print(); | |
25ed816e | 208 | // Get track segment and EMC rec.point associated with this rec.particle |
209 | AliPHOSTrackSegment *ts = gime->TrackSegment(rp->GetPHOSTSIndex()); | |
210 | AliPHOSEmcRecPoint *emcRP = gime->EmcRecPoint(ts->GetEmcIndex()); | |
211 | AliESDCaloCluster *ec = new AliESDCaloCluster() ; | |
7592dfc4 | 212 | |
85c60a8e | 213 | Float_t xyz[3]; |
8013c27e | 214 | for (Int_t ixyz=0; ixyz<3; ixyz++) |
215 | xyz[ixyz] = rp->GetPos()[ixyz]; | |
dd7ee508 | 216 | |
217 | AliDebug(2,Form("Global position xyz=(%f,%f,%f)",xyz[0],xyz[1],xyz[2])); | |
218 | ||
7592dfc4 | 219 | //Create digits lists |
25ed816e | 220 | Int_t digitMult = emcRP->GetDigitsMultiplicity(); |
221 | Int_t *digitsList = emcRP->GetDigitsList(); | |
7592dfc4 | 222 | Short_t *amplList = new Short_t[digitMult]; |
223 | Short_t *timeList = new Short_t[digitMult]; | |
224 | Short_t *digiList = new Short_t[digitMult]; | |
25ed816e | 225 | |
7592dfc4 | 226 | // Convert Float_t* and Int_t* to Short_t* to save memory |
25ed816e | 227 | for (Int_t iDigit=0; iDigit<digitMult; iDigit++) { |
228 | AliPHOSDigit *digit = gime->Digit(digitsList[iDigit]); | |
f4e0dd30 | 229 | amplList[iDigit] = |
230 | (Short_t)(TMath::Min(digit->GetEnergy()*gev500,kBigShort)); // Energy in units of GeV/500 | |
231 | timeList[iDigit] = | |
232 | (Short_t)(TMath::Min(digit->GetTime()*nsec100,kBigShort)); // time in units of 0.01 ns | |
7592dfc4 | 233 | digiList[iDigit] = (Short_t)(digit->GetId()); |
25ed816e | 234 | } |
7592dfc4 | 235 | |
236 | //Primaries | |
237 | Int_t primMult = 0; | |
238 | Int_t *primInts = emcRP->GetPrimaries(primMult); | |
239 | Short_t *primList = new Short_t[primMult]; | |
240 | for (Int_t ipr=0; ipr<primMult; ipr++) | |
241 | primList[ipr] = (Short_t)(primInts[ipr]); | |
242 | ||
243 | // fills the ESDCaloCluster | |
244 | ||
34541ea2 | 245 | ec->SetPHOS(kTRUE); |
7592dfc4 | 246 | ec->SetPosition(xyz); //rec.point position in MARS |
247 | ec->SetE(rp->Energy()); //total particle energy | |
25ed816e | 248 | ec->SetClusterDisp(emcRP->GetDispersion()); //cluster dispersion |
249 | ec->SetPid (rp->GetPID()) ; //array of particle identification | |
25ed816e | 250 | ec->SetM02(emcRP->GetM2x()) ; //second moment M2x |
251 | ec->SetM20(emcRP->GetM2z()) ; //second moment M2z | |
252 | ec->SetNExMax(emcRP->GetNExMax()); //number of local maxima | |
25ed816e | 253 | ec->SetEmcCpvDistance(-1); //not yet implemented |
254 | ec->SetClusterChi2(-1); //not yet implemented | |
255 | ec->SetM11(-1) ; //not yet implemented | |
3744a6cf | 256 | |
7592dfc4 | 257 | //Digits Lists |
258 | TArrayS arrayAmpList(digitMult,amplList); | |
259 | TArrayS arrayTimeList(digitMult,timeList); | |
260 | TArrayS arrayIndexList(digitMult,digiList); | |
261 | ec->AddDigitAmplitude(arrayAmpList); | |
262 | ec->AddDigitTime(arrayTimeList); | |
263 | ec->AddDigitIndex(arrayIndexList); | |
264 | ||
3744a6cf | 265 | //Distance to the nearest bad crystal |
266 | ec->SetDistanceToBadChannel(emcRP->GetDistanceToBadCrystal()); | |
7592dfc4 | 267 | |
268 | //Array of MC indeces | |
269 | TArrayS arrayPrim(primMult,primList); | |
270 | ec->AddLabels(arrayPrim); | |
271 | ||
272 | //Array of tracks uncomment when available in future | |
273 | //TArrayS arrayTrackMatched(1);// Only one track, temporal solution. | |
274 | //arrayTrackMatched[0]= (Short_t)(matchedTrack[iClust]); | |
275 | //ec->AddTracksMatched(arrayTrackMatched); | |
64df000d | 276 | |
dfe0be07 | 277 | // add the track to the esd object |
85c60a8e | 278 | esd->AddCaloCluster(ec); |
dd7ee508 | 279 | delete ec; |
280 | } | |
281 | } | |
282 | ||
34541ea2 | 283 | //____________________________________________________________________________ |
dd7ee508 | 284 | void AliPHOSReconstructor::FillESD(AliRunLoader* runLoader, |
af885e0f | 285 | AliRawReader* rawReader, AliESDEvent* esd) const |
dd7ee508 | 286 | { |
287 | //This function creates AliESDtracks from AliPHOSRecParticles | |
288 | //and writes them to the ESD in the case of raw data reconstruction. | |
289 | ||
290 | Int_t eventNumber = runLoader->GetEventNumber() ; | |
291 | ||
dd7ee508 | 292 | AliPHOSGetter *gime = AliPHOSGetter::Instance(); |
cbddd97f | 293 | gime->Event(eventNumber, "DRTP") ; |
dd7ee508 | 294 | |
295 | TClonesArray *recParticles = gime->RecParticles(); | |
296 | Int_t nOfRecParticles = recParticles->GetEntries(); | |
297 | ||
298 | esd->SetNumberOfPHOSClusters(nOfRecParticles) ; | |
299 | esd->SetFirstPHOSCluster(esd->GetNumberOfCaloClusters()) ; | |
300 | ||
301 | AliDebug(2,Form("%d digits and %d rec. particles in event %d, option %s",gime->Digits()->GetEntries(),nOfRecParticles,eventNumber,GetOption())); | |
302 | ||
303 | for (Int_t recpart = 0 ; recpart < nOfRecParticles ; recpart++) { | |
304 | AliPHOSRecParticle * rp = dynamic_cast<AliPHOSRecParticle*>(recParticles->At(recpart)); | |
305 | ||
306 | if(rp) { | |
307 | Float_t xyz[3]; | |
308 | for (Int_t ixyz=0; ixyz<3; ixyz++) | |
309 | xyz[ixyz] = rp->GetPos()[ixyz]; | |
310 | ||
311 | AliDebug(2,Form("Global position xyz=(%f,%f,%f)",xyz[0],xyz[1],xyz[2])); | |
312 | ||
313 | AliPHOSTrackSegment *ts = gime->TrackSegment(rp->GetPHOSTSIndex()); | |
314 | AliPHOSEmcRecPoint *emcRP = gime->EmcRecPoint(ts->GetEmcIndex()); | |
315 | AliESDCaloCluster *ec = new AliESDCaloCluster() ; | |
316 | ||
317 | Int_t digitMult = emcRP->GetDigitsMultiplicity(); | |
318 | Int_t *digitsList = emcRP->GetDigitsList(); | |
7592dfc4 | 319 | Short_t *amplList = new Short_t[digitMult]; |
320 | Short_t *digiList = new Short_t[digitMult]; | |
dd7ee508 | 321 | |
322 | // Convert Float_t* and Int_t* to UShort_t* to save memory | |
323 | for (Int_t iDigit=0; iDigit<digitMult; iDigit++) { | |
324 | AliPHOSDigit *digit = gime->Digit(digitsList[iDigit]); | |
325 | if(!digit) { | |
326 | AliFatal(Form("Digit not found at the expected position %d!",iDigit)); | |
327 | } | |
328 | else { | |
7592dfc4 | 329 | amplList[iDigit] = (Short_t)digit->GetEnergy(); |
330 | digiList[iDigit] = (Short_t)(digit->GetId()); | |
331 | //timeList[iDigit] = (Short_t)(digit->GetTime()); | |
dd7ee508 | 332 | } |
333 | } | |
334 | ||
34541ea2 | 335 | ec->SetPHOS(kTRUE); |
7592dfc4 | 336 | ec->SetPosition(xyz); //rec.point position in MARS |
337 | ec->SetE(rp->Energy()); //total particle energy | |
dd7ee508 | 338 | ec->SetClusterDisp(emcRP->GetDispersion()); //cluster dispersion |
339 | ec->SetPid (rp->GetPID()) ; //array of particle identification | |
340 | ec->SetM02(emcRP->GetM2x()) ; //second moment M2x | |
341 | ec->SetM20(emcRP->GetM2z()) ; //second moment M2z | |
342 | ec->SetNExMax(emcRP->GetNExMax()); //number of local maxima | |
7592dfc4 | 343 | |
dd7ee508 | 344 | ec->SetEmcCpvDistance(-1); //not yet implemented |
345 | ec->SetClusterChi2(-1); //not yet implemented | |
346 | ec->SetM11(-1) ; //not yet implemented | |
7592dfc4 | 347 | // TArrayS arrayAmpList(digitMult,amplList); |
348 | // TArrayS arrayTimeList(digitMult,timeList); | |
349 | // TArrayS arrayIndexList(digitMult,digiList); | |
350 | // ec->AddDigitAmplitude(arrayAmpList); | |
351 | // ec->AddDigitTime(arrayTimeList); | |
352 | // ec->AddDigitIndex(arrayIndexList); | |
3744a6cf | 353 | //Distance to the nearest bad crystal |
354 | ec->SetDistanceToBadChannel(emcRP->GetDistanceToBadCrystal()); | |
355 | ||
dd7ee508 | 356 | // add the track to the esd object |
357 | esd->AddCaloCluster(ec); | |
358 | delete ec; | |
3744a6cf | 359 | |
dd7ee508 | 360 | } |
361 | } | |
362 | ||
363 | ||
d7d3b67b | 364 | } |
23904d16 | 365 | |
366 | AliTracker* AliPHOSReconstructor::CreateTracker(AliRunLoader* runLoader) const | |
367 | { | |
368 | // creates the PHOS tracker | |
369 | if (!runLoader) return NULL; | |
370 | return new AliPHOSTracker(runLoader); | |
371 | } | |
372 |