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 ---
29 #include "AliEMCALReconstructor.h"
32 #include "AliRunLoader.h"
33 #include "AliEMCALLoader.h"
34 #include "AliEMCALClusterizerv1.h"
35 #include "AliEMCALRecPoint.h"
36 #include "AliEMCALPID.h"
37 #include "AliRawReader.h"
40 ClassImp(AliEMCALReconstructor)
42 //____________________________________________________________________________
43 AliEMCALReconstructor::AliEMCALReconstructor()
49 //____________________________________________________________________________
50 AliEMCALReconstructor::AliEMCALReconstructor(const AliEMCALReconstructor & rec)
51 : AliReconstructor(rec),
57 //____________________________________________________________________________
58 AliEMCALReconstructor::~AliEMCALReconstructor()
63 //____________________________________________________________________________
64 void AliEMCALReconstructor::Reconstruct(AliRunLoader* runLoader) const
66 // method called by AliReconstruction;
67 // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track
68 // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by
69 // the global tracking.
71 TString headerFile(runLoader->GetFileName()) ;
72 TString branchName(runLoader->GetEventFolder()->GetName() ) ;
74 AliEMCALClusterizerv1 clu(headerFile, branchName);
75 clu.SetEventRange(0, -1) ; // do all the events
77 clu.ExecuteTask("deb all") ;
79 clu.ExecuteTask("pseudo") ;
83 //____________________________________________________________________________
84 void AliEMCALReconstructor::Reconstruct(AliRunLoader* runLoader, AliRawReader* rawreader) const
86 // method called by AliReconstruction;
87 // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track
88 // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by
89 // the global tracking.
90 // Here we reconstruct from Raw Data
93 TString headerFile(runLoader->GetFileName()) ;
94 TString branchName(runLoader->GetEventFolder()->GetName()) ;
96 AliEMCALClusterizerv1 clu(headerFile, branchName);
97 clu.SetEventRange(0, -1) ; // do all the events
99 clu.ExecuteTask("deb pseudo all") ;
101 clu.ExecuteTask("pseudo") ;
105 //____________________________________________________________________________
106 void AliEMCALReconstructor::FillESD(AliRunLoader* runLoader, AliESD* esd) const
108 // Called by AliReconstruct after Reconstruct() and global tracking and vertxing
110 Int_t eventNumber = runLoader->GetEventNumber() ;
112 TString headerFile(runLoader->GetFileName()) ;
113 TString branchName(runLoader->GetEventFolder()->GetName()) ;
114 // Creates AliESDCaloCluster from AliEMCALRecPoints
115 AliRunLoader *rl = AliRunLoader::GetRunLoader();
116 AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL"));
118 rl->LoadKinematics(); // To get the primary label
119 rl->LoadDigits(); // To get the primary label
120 rl->LoadHits(); // To get the primary label
121 rl->GetEvent(eventNumber);
122 TObjArray *clusters = emcalLoader->RecPoints();
123 Int_t nClusters = clusters->GetEntries();
124 esd->SetNumberOfEMCALClusters(nClusters) ;
125 esd->SetFirstEMCALCluster(esd->GetNumberOfCaloClusters()) ;
127 for (Int_t iClust = 0 ; iClust < nClusters ; iClust++) {
128 const AliEMCALRecPoint * clust = emcalLoader->RecPoint(iClust);
130 if (Debug()) clust->Print();
131 AliESDCaloCluster * ec = new AliESDCaloCluster() ;
132 // fills the ESDCaloCluster
135 clust->GetGlobalPosition(gpos);
136 for (Int_t ixyz=0; ixyz<3; ixyz++)
137 xyz[ixyz] = gpos[ixyz];
139 Int_t digitMult = clust->GetMultiplicity();
140 UShort_t *amplList = new UShort_t[digitMult];
141 UShort_t *timeList = new UShort_t[digitMult];
142 UShort_t *digiList = new UShort_t[digitMult];
143 Float_t *amplFloat = clust->GetEnergiesList();
144 Float_t *timeFloat = clust->GetTimeList();
145 Int_t *digitInts = clust->GetAbsId();
147 clust->GetElipsAxis(elipAxis);
149 // Convert Float_t* and Int_t* to UShort_t* to save memory
150 Int_t newdigitMult = digitMult ;
151 for (Int_t iDigit=0; iDigit<digitMult; iDigit++) {
152 if(timeFloat[iDigit] < 65536/1e9*100){
153 amplList[iDigit] = (UShort_t)(amplFloat[iDigit]*500);
154 timeList[iDigit] = (UShort_t)(timeFloat[iDigit]*1e9*100); //Time in units of 100 ns = 0.1 ps
155 digiList[iDigit] = (UShort_t)(digitInts[iDigit]);
158 newdigitMult = newdigitMult - 1 ;
161 ec->SetClusterType(clust->GetClusterType());
162 ec->SetGlobalPosition(xyz);
163 ec->SetClusterEnergy(clust->GetEnergy());
164 ec->SetDigitAmplitude(amplList); //energies
165 ec->SetDigitTime(timeList); //times
166 ec->SetDigitIndex(digiList); //indices
167 ec->SetNumberOfDigits(newdigitMult);
168 if(clust->GetClusterType()== AliESDCaloCluster::kClusterv1){
169 ec->SetClusterDisp(clust->GetDispersion());
170 ec->SetClusterChi2(-1); //not yet implemented
171 ec->SetM02(elipAxis[0]*elipAxis[0]) ;
172 ec->SetM20(elipAxis[1]*elipAxis[1]) ;
173 ec->SetM11(-1) ; //not yet implemented
174 ec->SetPrimaryIndex(clust->GetPrimaryIndex());
176 // add the cluster to the esd object
177 esd->AddCaloCluster(ec);
181 //Fill ESDCaloCluster with PID weights
183 AliEMCALPID *pid = new AliEMCALPID;
184 //pid->SetPrintInfo(kTRUE);
185 pid->SetReconstructor(kTRUE);