Line data Source code
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 : //-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (SUBATECH & Kurchatov Institute)
17 : //-- Gustavo Conesa (LPSC-Grenoble), move common clusterizer functionalities to mother class
18 : //////////////////////////////////////////////////////////////////////////////
19 : // Clusterization class. Performs clusterization (collects neighbouring active cells) and
20 : // unfolds the clusters having several local maxima.
21 : // Results are stored in TreeR#, branches EMCALTowerRP (EMC recPoints),
22 : // EMCALPreShoRP (CPV RecPoints) and AliEMCALClusterizer (Clusterizer with all
23 : // parameters including input digits branch title, thresholds etc.)
24 : //
25 :
26 : // --- ROOT system ---
27 :
28 : #include <TFile.h>
29 : #include <TMath.h>
30 : #include <TMinuit.h>
31 : #include <TTree.h>
32 : #include <TBenchmark.h>
33 : #include <TBrowser.h>
34 : #include <TROOT.h>
35 : #include <TList.h>
36 : #include <TClonesArray.h>
37 :
38 : // --- Standard library ---
39 : #include <cassert>
40 :
41 : // --- AliRoot header files ---
42 : #include "AliLog.h"
43 : #include "AliEMCALClusterizerv2.h"
44 : #include "AliEMCALRecPoint.h"
45 : #include "AliEMCALDigit.h"
46 : #include "AliEMCALGeometry.h"
47 : #include "AliCaloCalibPedestal.h"
48 : #include "AliEMCALCalibData.h"
49 : #include "AliEMCALCalibTime.h"
50 : #include "AliESDCaloCluster.h"
51 : #include "AliEMCALUnfolding.h"
52 :
53 42 : ClassImp(AliEMCALClusterizerv2)
54 :
55 : //____________________________________________________________________________
56 : AliEMCALClusterizerv2::AliEMCALClusterizerv2()
57 0 : : AliEMCALClusterizerv1(), fDoEnGradCut(1)
58 0 : {
59 : // ctor with the indication of the file where header Tree and digits Tree are stored
60 0 : }
61 :
62 : //____________________________________________________________________________
63 : AliEMCALClusterizerv2::AliEMCALClusterizerv2(AliEMCALGeometry* geometry)
64 0 : : AliEMCALClusterizerv1(geometry), fDoEnGradCut(1)
65 0 : {
66 : // ctor with the indication of the file where header Tree and digits Tree are stored
67 : // use this contructor to avoid usage of Init() which uses runloader
68 : // change needed by HLT - MP
69 0 : }
70 :
71 : //____________________________________________________________________________
72 : AliEMCALClusterizerv2::AliEMCALClusterizerv2(AliEMCALGeometry* geometry,
73 : AliEMCALCalibData* calib,
74 : AliEMCALCalibTime* calibt,
75 : AliCaloCalibPedestal* caloped)
76 0 : : AliEMCALClusterizerv1(geometry, calib, calibt, caloped), fDoEnGradCut(1)
77 0 : {
78 : // ctor, geometry and calibration are initialized elsewhere.
79 0 : }
80 :
81 : //____________________________________________________________________________
82 : AliEMCALClusterizerv2::~AliEMCALClusterizerv2()
83 0 : {
84 : // dtor
85 0 : }
86 :
87 : //____________________________________________________________________________
88 : Int_t AliEMCALClusterizerv2::AreNeighbours(AliEMCALDigit* d1, AliEMCALDigit* d2, Bool_t& shared) const
89 : {
90 : // Gives the neighbourness of two digits = 0 are not neighbour; continue searching
91 : // = 1 are neighbour
92 : // = 2 is in different SM; continue searching
93 : // In case it is in different SM, but same phi rack, check if neigbours at eta=0
94 : // neighbours are defined as digits having at least a common side
95 : // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster
96 : // which is compared to a digit (d2) not yet in a cluster
97 :
98 0 : if (fDoEnGradCut) {
99 0 : if (d2->GetCalibAmp()>d1->GetCalibAmp()+fECALocMaxCut){
100 0 : return 3; // energy of neighboring cell should be smaller in order to become a neighbor
101 : }
102 : }
103 0 : return AliEMCALClusterizerv1::AreNeighbours(d1,d2,shared);
104 0 : }
105 :
106 : //____________________________________________________________________________
107 : void AliEMCALClusterizerv2::MakeClusters()
108 : {
109 : // Make list of clusters. Start from highest energy cell.
110 :
111 0 : if (fGeom==0)
112 0 : AliFatal("Did not get geometry from EMCALLoader");
113 :
114 0 : fRecPoints->Delete();
115 :
116 : // set up TObjArray with pointers to digits to work on, calibrate digits
117 0 : TObjArray digitsC;
118 : Double_t ehs = 0.0;
119 : AliEMCALDigit *digit = 0;
120 0 : TIter nextdigit(fDigitsArr);
121 0 : while ( (digit = static_cast<AliEMCALDigit*>(nextdigit())) ) {
122 0 : Float_t dEnergyCalibrated = digit->GetAmplitude();
123 0 : Float_t time = digit->GetTime();
124 0 : Calibrate(dEnergyCalibrated, time ,digit->GetId());
125 0 : digit->SetCalibAmp(dEnergyCalibrated);
126 0 : digit->SetTime(time);
127 0 : if (dEnergyCalibrated < fMinECut || time > fTimeMax || time < fTimeMin)
128 0 : continue;
129 0 : if (!fGeom->CheckAbsCellId(digit->GetId()))
130 0 : continue;
131 0 : ehs += dEnergyCalibrated;
132 0 : digitsC.AddLast(digit);
133 0 : }
134 :
135 0 : AliDebug(1,Form("MakeClusters: Number of digits %d -> ehs %f (minE %f)\n",
136 : fDigitsArr->GetEntries(),ehs,fMinECut));
137 :
138 0 : TIter nextdigitC(&digitsC);
139 : while (1) {
140 : Int_t iMaxEnergyDigit = -1;
141 : Float_t dMaxEnergyDigit = -1;
142 : AliEMCALDigit *pMaxEnergyDigit = 0;
143 0 : nextdigitC.Reset();
144 0 : while ( (digit = static_cast<AliEMCALDigit *>(nextdigitC())) ) {
145 0 : Float_t dEnergyCalibrated = digit->GetCalibAmp();
146 0 : if (dEnergyCalibrated>fECAClusteringThreshold && dEnergyCalibrated>dMaxEnergyDigit) {
147 : dMaxEnergyDigit = dEnergyCalibrated;
148 0 : iMaxEnergyDigit = digit->GetId();
149 : pMaxEnergyDigit = digit;
150 0 : }
151 : }
152 0 : if (iMaxEnergyDigit<0 || digitsC.GetEntries() <= 0) {
153 0 : break;
154 : }
155 :
156 0 : if (fNumberOfECAClusters>=fRecPoints->GetSize())
157 0 : fRecPoints->Expand(2*fNumberOfECAClusters+1);
158 :
159 0 : AliEMCALRecPoint *recPoint = new AliEMCALRecPoint("");
160 0 : recPoint->SetClusterType(AliVCluster::kEMCALClusterv1);
161 0 : recPoint->AddDigit(*pMaxEnergyDigit, pMaxEnergyDigit->GetCalibAmp(), kFALSE);
162 0 : fRecPoints->AddAt(recPoint, fNumberOfECAClusters++);
163 0 : digitsC.Remove(pMaxEnergyDigit);
164 0 : TObjArray clusterDigits;
165 0 : clusterDigits.AddLast(pMaxEnergyDigit);
166 0 : TIter nextClusterDigit(&clusterDigits);
167 0 : Float_t time = pMaxEnergyDigit->GetTime();
168 :
169 0 : AliDebug(1,Form("MakeClusters: Max digit found id = %d, ene = %f , clus.th. = %f \n",
170 : iMaxEnergyDigit, dMaxEnergyDigit, fECAClusteringThreshold));
171 :
172 0 : while ( (digit = static_cast<AliEMCALDigit*>(nextClusterDigit())) ) { // scan over digits in cluster
173 0 : TIter nextdigitN(&digitsC);
174 : AliEMCALDigit *digitN = 0; // digi neighbor
175 0 : while ( (digitN = static_cast<AliEMCALDigit*>(nextdigitN())) ) { // scan over all digits to look for neighbours
176 : //Do not add digits with too different time
177 0 : if (TMath::Abs(time - digitN->GetTime()) > fTimeCut )
178 : continue;
179 0 : Bool_t shared = kFALSE; //cluster shared by 2 SuperModules?
180 0 : if (AreNeighbours(digit, digitN, shared)==1) {
181 0 : recPoint->AddDigit(*digitN, digitN->GetCalibAmp(), shared);
182 0 : clusterDigits.AddLast(digitN);
183 0 : digitsC.Remove(digitN);
184 : }
185 0 : }
186 0 : }
187 0 : AliDebug(2,Form("MakeClusters: %d digitd, energy %f \n", clusterDigits.GetEntries(), recPoint->GetEnergy()));
188 0 : }
189 0 : AliDebug(1,Form("total no of clusters %d from %d digits",fNumberOfECAClusters,fDigitsArr->GetEntriesFast()));
190 0 : }
191 :
|