AliRoot Core  edcc906 (edcc906)
AliEMCALAfterBurnerUF.cxx
Go to the documentation of this file.
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 
16 // --- ROOT system ---
17 #include <TObjArray.h>
18 #include <TClonesArray.h>
19 #include <TGeoManager.h>
20 
21 // --- Standard library --
22 
23 // --- AliRoot header files ---
24 #include <AliEMCALAfterBurnerUF.h>
25 #include <AliEMCALGeometry.h>
26 #include <AliEMCALUnfolding.h>
27 #include <AliAODCaloCluster.h>
28 #include <AliVCaloCells.h>
29 #include <AliEMCALRecPoint.h>
30 #include <AliEMCALDigit.h>
31 
33 ClassImp(AliEMCALAfterBurnerUF) ;
35 
38 //------------------------------------------------------------------------
40  fGeom(NULL),
41  fLogWeight(4.5), // correct?
42  fECALocMaxCut(0.03), // value suggested by Adam
43  fMinECut(0.01),
44  fRecPoints(NULL),
45  fDigitsArr(NULL),
46  fClusterUnfolding(NULL)
47 {
48  Init();
49 }
50 
60 //------------------------------------------------------------------------
61 AliEMCALAfterBurnerUF::AliEMCALAfterBurnerUF(Float_t logWeight, Float_t ecaLocMaxCut, Float_t minECut):
62  fGeom(NULL),
63  fLogWeight(logWeight),
64  fECALocMaxCut(ecaLocMaxCut),
65  fMinECut(minECut),
66  fRecPoints(NULL),
67  fDigitsArr(NULL),
68  fClusterUnfolding(NULL)
69 {
70  Init();
71 }
72 
79 //------------------------------------------------------------------------
81 {
82  if (!gGeoManager)
83  Warning("AliEMCALAfterBurnerUF::Init","GeoManager not found, please import the geometry.root file or pass to the geometry the misalignment matrices");
84  // TGeoManager::Import("geometry.root");
85 
86  // required for global cluster position recalculation
87  if (!gGeoManager)
88  Info("AliEMCALAfterBurnerUF::Init", "gGeoManager was not set, be careful");
89 
90  // initialize geometry, if not yet initialized
92  Warning("AliEMCALAfterBurnerUF::Init", "AliEMCALGeometry is not yet initialized. Initializing with EMCAL_COMPLETE12SMV1_DCAL_8SM");
93  AliEMCALGeometry::GetInstance("EMCAL_COMPLETE12SMV1_DCAL_8SM");
94  }
95 
96  // AliEMCALRecPoint is using exactly this call
98  if (!fGeom)
99  Fatal("AliEMCALAfterBurnerUF::AliEMCALAfterBurnerUF", "could not get EMCAL geometry");
100 
104 
105  // clusters --> recPoints, cells --> digits and back ;)
106  fRecPoints = new TObjArray(100);
107  fDigitsArr = new TClonesArray("AliEMCALDigit",1152);
108 }
109 
112 //------------------------------------------------------------------------
114 {
116 
117  if (fRecPoints)
118  {
119  fRecPoints->Delete();
120  delete fRecPoints;
121  }
122 
123  if (fDigitsArr)
124  {
125  fDigitsArr->Clear("C");
126  delete fDigitsArr;
127  }
128 }
129 
132 //------------------------------------------------------------------------
134 {
135  if (fRecPoints) fRecPoints->Delete(); // do not Clear(), it leaks, why?
136  if (fDigitsArr) fDigitsArr->Clear("C");
137 }
138 
146 //------------------------------------------------------------------------
148 {
149  for(Int_t i = 0; i < fRecPoints->GetEntriesFast(); i++)
150  {
151  AliEMCALRecPoint *recPoint = (AliEMCALRecPoint*) fRecPoints->At(i);
152 
153  const Int_t ncells = recPoint->GetMultiplicity();
154  Int_t ncellsTrue = 0;
155 
156  // cells and their amplitude fractions
157  UShort_t absIds[ncells]; // NOTE: unfolding must not give recPoints with no cells!
158  Double32_t ratios[ncells];
159 
160  for (Int_t c = 0; c < ncells; c++)
161  {
162  AliEMCALDigit *digit = (AliEMCALDigit*) fDigitsArr->At(recPoint->GetDigitsList()[c]);
163 
164  absIds[ncellsTrue] = digit->GetId();
165  ratios[ncellsTrue] = recPoint->GetEnergiesList()[c]/digit->GetAmplitude();
166 
167  if (ratios[ncellsTrue] > 0.001) ncellsTrue++;
168  }
169 
170  if (ncellsTrue < 1)
171  {
172  Warning("AliEMCALAfterBurnerUF::RecPoints2Clusters", "skipping cluster with no cells");
173  continue;
174  }
175 
176  TVector3 gpos;
177  Float_t g[3];
178 
179  // calculate new cluster position
181  recPoint->GetGlobalPosition(gpos);
182  gpos.GetXYZ(g);
183 
184  // create a new cluster
185  AliAODCaloCluster *clus = new AliAODCaloCluster();
187  clus->SetE(recPoint->GetEnergy());
188  clus->SetPosition(g);
189  clus->SetNCells(ncellsTrue);
190  clus->SetCellsAbsId(absIds);
191  clus->SetCellsAmplitudeFraction(ratios);
192  // TODO: time not stored
193  // TODO: some other properties not stored
194 
195  clusArray->Add(clus);
196  } // recPoints loop
197 }
198 
204 //------------------------------------------------------------------------
206 {
207  Int_t ndigits = 0;
208 
209  Int_t nclus = clusArray->GetEntriesFast();
210 
211  /* Fill recPoints with digits
212  */
213  for (Int_t i = 0; i < nclus; i++)
214  {
215  AliVCluster *clus = (AliVCluster*) clusArray->At(i);
216  if (!clus->IsEMCAL()) continue;
217 
218  // new recPoint
219  AliEMCALRecPoint *recPoint = new AliEMCALRecPoint("");
221  fRecPoints->Add(recPoint);
222 
223  // fill digits
224  for (Int_t c = 0; c < clus->GetNCells(); c++)
225  {
226  Int_t absId = clus->GetCellAbsId(c);
227  Double_t amp = cellsEMCAL->GetCellAmplitude(absId);
228  Double_t time = cellsEMCAL->GetCellTime(absId);
229 
230  // NOTE: it is easy to include cells recalibration here:
231  // amp *= factor;
232 
233  AliEMCALDigit *digit = (AliEMCALDigit*) fDigitsArr->New(ndigits);
234 
235  digit->SetId(absId);
236  digit->SetAmplitude(amp);
237  digit->SetTime(time);
238  digit->SetTimeR(time);
239  digit->SetIndexInList(ndigits);
240 
241  recPoint->AddDigit(*digit, amp, kFALSE);
242 
243  ndigits++;
244  }
245 
246  // this cluster will be substituted with the result of unfolding
247  clusArray->RemoveAt(i);
248  delete clus;
249  } // cluster loop
250 
251 
252  /* Peform unfolding
253  */
256 
257  /* Restore clusters from recPoints.
258  */
259  RecPoints2Clusters(clusArray);
260 
261  // clean up
262  fRecPoints->Delete(); // do not Clear(), it leaks, why?
263  fDigitsArr->Clear("C");
264 
265  clusArray->Compress();
266 }
Class for calorimeter cluster, EMCal and PHOS, data handling.
virtual Double_t GetCellTime(Short_t cellNumber)=0
After-burner for the EMCAL cluster unfolding algorithm.
#define TObjArray
Virtual class for calorimeter cell data handling.
Definition: AliVCaloCells.h:19
void SetId(Int_t idt)
Definition: AliEMCALDigit.h:73
void SetCellsAmplitudeFraction(Double32_t *array)
virtual void SetInput(Int_t numberOfECAClusters, TObjArray *recPoints, TClonesArray *digitsArr)
void SetCellsAbsId(UShort_t *array)
virtual Float_t GetEnergy() const
virtual int * GetDigitsList(void) const
Virtual class for calorimeter cluster data handling.
Definition: AliVCluster.h:20
EMCal digits object.
Definition: AliEMCALDigit.h:30
void SetPosition(Float_t *x)
Base class for the cluster unfolding algorithm.
void SetNCells(Int_t n)
void SetTime(Float_t time)
Definition: AliEMCALDigit.h:74
Int_t GetMultiplicity(void) const
virtual void Clear()
Clean the arrays.
virtual void MakeUnfolding()
virtual void AddDigit(AliEMCALDigit &digit, const Float_t energy, const Bool_t shared)
EMCal rec_points object.
TGeoManager * gGeoManager
TObjArray * fRecPoints
! list of cluster <=> recPoint
void SetType(Char_t ttype)
Definition: AliAODCluster.h:89
Float_t * GetEnergiesList() const
virtual Double_t GetCellAmplitude(Short_t cellNumber)=0
virtual void RecPoints2Clusters(TObjArray *clusArray)
Float_t fECALocMaxCut
This amount of energy must distinguish a local maximum from its neighbours.
AliEMCALUnfolding * fClusterUnfolding
unfolding class instance
void SetIndexInList(Int_t val)
Definition: AliDigitNew.h:25
AliEMCALGeometry * fGeom
EMCAL geometry.
void SetTimeR(Float_t time)
Definition: AliEMCALDigit.h:75
virtual void SetECALocalMaxCut(Float_t cut)
virtual void GetGlobalPosition(TVector3 &gpos) const
virtual void UnfoldClusters(TObjArray *clusArray, AliVCaloCells *cellsEMCAL)
virtual Bool_t IsEMCAL() const
Definition: AliVCluster.h:90
Int_t GetId() const
Definition: AliDigitNew.h:23
void SetE(Double32_t energy)
Definition: AliAODCluster.h:87
TClonesArray * fDigitsArr
list of cell <=> digit
AliEMCALAfterBurnerUF()
Default constructor.
Float_t fLogWeight
Used in AliEMCALRecPoint::EvalGlobalPosition()
virtual ~AliEMCALAfterBurnerUF()
Destructor.
virtual void SetThreshold(Float_t energy)
static AliEMCALGeometry * GetInstance()
virtual Int_t GetNCells() const
Definition: AliVCluster.h:118
virtual void SetClusterType(Int_t ver)
Float_t fMinECut
Minimum energy of cell.
Float_t GetAmplitude() const
Definition: AliEMCALDigit.h:55
virtual void EvalGlobalPosition(Float_t logWeight, TClonesArray *digits)
Calculates the center of gravity in the global ALICE coordinates.
virtual Int_t GetCellAbsId(Int_t) const
Definition: AliVCluster.h:123
void SetAmplitude(Float_t amp)
Definition: AliEMCALDigit.h:72