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 //_________________________________________________________________________
20 //*-- Yves Schutz (SUBATECH)
21 // Reconstruction class. Redesigned from the old AliReconstructionner class and
22 // derived from STEER/AliReconstructor.
24 // --- ROOT system ---
26 // --- Standard library ---
28 // --- AliRoot header files ---
30 #include "AliPHOSReconstructor.h"
31 #include "AliPHOSClusterizerv1.h"
32 #include "AliPHOSTrackSegmentMakerv1.h"
33 #include "AliPHOSPIDv1.h"
34 #include "AliPHOSGetter.h"
35 #include "AliPHOSTracker.h"
36 #include "AliRawReader.h"
39 ClassImp(AliPHOSReconstructor)
41 Bool_t AliPHOSReconstructor::fgDebug = kFALSE ;
43 //____________________________________________________________________________
44 AliPHOSReconstructor::AliPHOSReconstructor()
50 //____________________________________________________________________________
51 AliPHOSReconstructor::~AliPHOSReconstructor()
57 //____________________________________________________________________________
58 void AliPHOSReconstructor::Reconstruct(AliRunLoader* runLoader) const
60 // method called by AliReconstruction;
61 // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track
62 // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by
63 // the global tracking.
65 TString headerFile(runLoader->GetFileName()) ;
66 TString branchName(runLoader->GetEventFolder()->GetName()) ;
68 AliPHOSClusterizerv1 clu(headerFile, branchName);
69 clu.SetEventRange(0, -1) ; // do all the events
71 clu.ExecuteTask("deb all") ;
77 //____________________________________________________________________________
78 void AliPHOSReconstructor::Reconstruct(AliRunLoader* runLoader, AliRawReader* rawreader) const
80 // method called by AliReconstruction;
81 // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track
82 // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by
83 // the global tracking.
84 // Here we reconstruct from Raw Data
87 TString headerFile(runLoader->GetFileName()) ;
88 TString branchName(runLoader->GetEventFolder()->GetName()) ;
90 AliPHOSClusterizerv1 clu(headerFile, branchName);
91 clu.SetEventRange(0, -1) ; // do all the events
92 clu.SetRawReader(rawreader);
94 TString option = GetOption();
95 if (option.Contains("OldRCUFormat"))
96 clu.SetOldRCUFormat(kTRUE);
99 clu.ExecuteTask("deb all") ;
101 clu.ExecuteTask("") ;
105 //____________________________________________________________________________
106 void AliPHOSReconstructor::FillESD(AliRunLoader* runLoader, AliESD* esd) const
108 // This function creates AliESDtracks from AliPHOSRecParticles
110 // writes them to the ESD
112 Int_t eventNumber = runLoader->GetEventNumber() ;
114 AliPHOSGetter *gime = AliPHOSGetter::Instance();
115 gime->Event(eventNumber, "DRTP") ;
116 TClonesArray *recParticles = gime->RecParticles();
117 Int_t nOfRecParticles = recParticles->GetEntries();
119 esd->SetNumberOfPHOSClusters(nOfRecParticles) ;
120 esd->SetFirstPHOSCluster(esd->GetNumberOfCaloClusters()) ;
122 for (Int_t recpart = 0 ; recpart < nOfRecParticles ; recpart++) {
123 AliPHOSRecParticle * rp = dynamic_cast<AliPHOSRecParticle*>(recParticles->At(recpart));
126 // Get track segment and EMC rec.point associated with this rec.particle
127 AliPHOSTrackSegment *ts = gime->TrackSegment(rp->GetPHOSTSIndex());
128 AliPHOSEmcRecPoint *emcRP = gime->EmcRecPoint(ts->GetEmcIndex());
129 AliESDCaloCluster *ec = new AliESDCaloCluster() ;
131 // fills the ESDCaloCluster
133 for (Int_t ixyz=0; ixyz<3; ixyz++)
134 xyz[ixyz] = rp->GetPos()[ixyz];
136 Int_t digitMult = emcRP->GetDigitsMultiplicity();
137 Int_t *digitsList = emcRP->GetDigitsList();
138 UShort_t *amplList = new UShort_t[digitMult];
139 UShort_t *timeList = new UShort_t[digitMult];
140 UShort_t *digiList = new UShort_t[digitMult];
142 // Convert Float_t* and Int_t* to UShort_t* to save memory
143 for (Int_t iDigit=0; iDigit<digitMult; iDigit++) {
144 AliPHOSDigit *digit = gime->Digit(digitsList[iDigit]);
145 amplList[iDigit] = (UShort_t)(digit->GetEnergy()*500);
146 amplList[iDigit] = (UShort_t)(digit->GetTime()*1e9*100);
147 digiList[iDigit] = (UShort_t)(digit->GetId());
149 ec->SetGlobalPosition(xyz); //rec.point position in MARS
150 ec->SetClusterEnergy(rp->Energy()); //total particle energy
151 ec->SetClusterDisp(emcRP->GetDispersion()); //cluster dispersion
152 ec->SetPid (rp->GetPID()) ; //array of particle identification
153 ec->SetPrimaryIndex (rp->GetPrimaryIndex());//index of primary particle (for simulations)
154 ec->SetM02(emcRP->GetM2x()) ; //second moment M2x
155 ec->SetM20(emcRP->GetM2z()) ; //second moment M2z
156 ec->SetNExMax(emcRP->GetNExMax()); //number of local maxima
157 ec->SetNumberOfDigits(digitMult); //digit multiplicity
158 ec->SetDigitAmplitude(amplList); //energies in 1/500 of GeV
159 ec->SetDigitTime(timeList); //times in 1/100 on ns
160 ec->SetDigitIndex(digiList); //abs id of the cell
161 ec->SetEmcCpvDistance(-1); //not yet implemented
162 ec->SetClusterChi2(-1); //not yet implemented
163 ec->SetM11(-1) ; //not yet implemented
165 // add the track to the esd object
166 esd->AddCaloCluster(ec);
171 AliTracker* AliPHOSReconstructor::CreateTracker(AliRunLoader* runLoader) const
173 // creates the PHOS tracker
174 if (!runLoader) return NULL;
175 return new AliPHOSTracker(runLoader);