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 "AliRawReader.h"
39 ClassImp(AliEMCALReconstructor)
41 //____________________________________________________________________________
42 AliEMCALReconstructor::AliEMCALReconstructor()
48 //____________________________________________________________________________
49 AliEMCALReconstructor::AliEMCALReconstructor(const AliEMCALReconstructor & rec)
50 : AliReconstructor(rec),
56 //____________________________________________________________________________
57 AliEMCALReconstructor::~AliEMCALReconstructor()
62 //____________________________________________________________________________
63 void AliEMCALReconstructor::Reconstruct(AliRunLoader* runLoader) const
65 // method called by AliReconstruction;
66 // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track
67 // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by
68 // the global tracking.
70 TString headerFile(runLoader->GetFileName()) ;
71 TString branchName(runLoader->GetEventFolder()->GetName() ) ;
73 AliEMCALClusterizerv1 clu(headerFile, branchName);
74 clu.SetEventRange(0, -1) ; // do all the events
76 clu.ExecuteTask("deb all") ;
78 clu.ExecuteTask("pseudo") ;
82 //____________________________________________________________________________
83 void AliEMCALReconstructor::Reconstruct(AliRunLoader* runLoader, AliRawReader* rawreader) const
85 // method called by AliReconstruction;
86 // Only the clusterization is performed,; the rest of the reconstruction is done in FillESD because the track
87 // segment maker needs access to the AliESD object to retrieve the tracks reconstructed by
88 // the global tracking.
89 // Here we reconstruct from Raw Data
92 TString headerFile(runLoader->GetFileName()) ;
93 TString branchName(runLoader->GetEventFolder()->GetName()) ;
95 AliEMCALClusterizerv1 clu(headerFile, branchName);
96 clu.SetEventRange(0, -1) ; // do all the events
98 clu.ExecuteTask("deb pseudo all") ;
100 clu.ExecuteTask("pseudo") ;
104 //____________________________________________________________________________
105 void AliEMCALReconstructor::FillESD(AliRunLoader* runLoader, AliESD* esd) const
107 // Called by AliReconstruct after Reconstruct() and global tracking and vertxing
109 Int_t eventNumber = runLoader->GetEventNumber() ;
111 TString headerFile(runLoader->GetFileName()) ;
112 TString branchName(runLoader->GetEventFolder()->GetName()) ;
113 // Creates AliESDCaloCluster from AliEMCALRecPoints
114 AliRunLoader *rl = AliRunLoader::GetRunLoader();
115 AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetDetectorLoader("EMCAL"));
117 rl->LoadKinematics(); // To get the primary label
118 rl->LoadDigits(); // To get the primary label
119 rl->LoadHits(); // To get the primary label
120 rl->GetEvent(eventNumber);
121 TObjArray *clusters = emcalLoader->RecPoints();
122 Int_t nClusters = clusters->GetEntries();
123 esd->SetNumberOfEMCALClusters(nClusters) ;
124 esd->SetFirstEMCALCluster(esd->GetNumberOfCaloClusters()) ;
126 for (Int_t iClust = 0 ; iClust < nClusters ; iClust++) {
127 const AliEMCALRecPoint * clust = emcalLoader->RecPoint(iClust);
129 if (Debug()) clust->Print();
130 AliESDCaloCluster * ec = new AliESDCaloCluster() ;
131 // fills the ESDCaloCluster
134 clust->GetGlobalPosition(gpos);
135 for (Int_t ixyz=0; ixyz<3; ixyz++)
136 xyz[ixyz] = gpos[ixyz];
138 Int_t digitMult = clust->GetMultiplicity();
139 UShort_t *amplList = new UShort_t[digitMult];
140 UShort_t *timeList = new UShort_t[digitMult];
141 UShort_t *digiList = new UShort_t[digitMult];
142 Float_t *amplFloat = clust->GetEnergiesList();
143 Float_t *timeFloat = clust->GetTimeList();
144 Int_t *digitInts = clust->GetAbsId();
145 Float_t *elipAxis = new Float_t();
146 clust->GetElipsAxis(elipAxis);
148 // Convert Float_t* and Int_t* to UShort_t* to save memory
149 Int_t newdigitMult = digitMult ;
150 for (Int_t iDigit=0; iDigit<digitMult; iDigit++) {
151 if(timeFloat[iDigit] < 65536/1e9*100){
152 amplList[iDigit] = (UShort_t)(amplFloat[iDigit]*500);
153 timeList[iDigit] = (UShort_t)(timeFloat[iDigit]*1e9*100); //Time in units of 100 ns = 0.1 ps
154 digiList[iDigit] = (UShort_t)(digitInts[iDigit]);
157 newdigitMult = newdigitMult - 1 ;
160 ec->SetClusterType(clust->GetClusterType());
161 ec->SetGlobalPosition(xyz);
162 ec->SetClusterEnergy(clust->GetEnergy());
163 ec->SetDigitAmplitude(amplList); //energies
164 ec->SetDigitTime(timeList); //times
165 ec->SetDigitIndex(digiList); //indices
166 ec->SetNumberOfDigits(newdigitMult);
167 if(clust->GetClusterType()== AliESDCaloCluster::kClusterv1){
168 ec->SetClusterDisp(clust->GetDispersion());
169 ec->SetClusterChi2(-1); //not yet implemented
170 ec->SetM02(elipAxis[0]*elipAxis[0]) ;
171 ec->SetM20(elipAxis[1]*elipAxis[1]) ;
172 ec->SetM11(-1) ; //not yet implemented
173 ec->SetPrimaryIndex(clust->GetPrimaryIndex());
175 // add the cluster to the esd object
176 esd->AddCaloCluster(ec);