]>
Commit | Line | Data |
---|---|---|
16d3c94d | 1 | /************************************************************************** |
0fc11500 | 2 | * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * |
16d3c94d | 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 | ||
8ada0ffe | 16 | /* $Log$ |
9e02e8c6 | 17 | /* Revision 1.4 2007/10/15 15:50:58 pavlinov |
18 | /* fixed code violation | |
19 | /* | |
7227086e | 20 | /* Revision 1.3 2007/10/09 08:46:10 hristov |
21 | /* The data members fEMCALClusterCluster and fPHOSCluster are removed from AliESDCaloCluster, the fClusterType is used to select PHOS or EMCAL clusters. Changes, needed to use correctly the new AliESDCaloCluster. (Christian) | |
22 | /* | |
8ada0ffe | 23 | /* Revision 1.2 2007/09/11 19:38:15 pavlinov |
24 | /* added pi0 calibration, linearity, shower profile | |
25 | /*co: warning: `/* $Log' is obsolescent; use ` * $Log'. | |
0fc11500 | 26 | * Revision 1.1 2007/08/08 15:58:01 hristov |
27 | * New calibration classes. (Aleksei) | |
28 | * */ | |
16d3c94d | 29 | //_________________________________________________________________________ |
30 | // This is selector for making a set of histogramms from ESD for rec.points | |
31 | //*-- Authors: Aleksei Pavlinov (WSU) | |
0fc11500 | 32 | //*-- Feb 17, 2007 - Sep 11, 2007 |
16d3c94d | 33 | //*-- Pi0 calibration |
0fc11500 | 34 | //*-- Recalibration, linearity, shower profile |
16d3c94d | 35 | //_________________________________________________________________________ |
36 | ||
37 | #include "AliEMCALRecPointsQaESDSelector.h" | |
38 | #include "AliEMCALFolder.h" | |
39 | #include "AliEMCALSuperModule.h" | |
40 | #include "AliEMCALCell.h" | |
0fc11500 | 41 | #include "AliEMCALCellInfo.h" |
16d3c94d | 42 | #include "AliEMCALPi0SelectionParam.h" |
43 | #include "AliEMCALHistoUtilities.h" | |
44 | #include "AliEMCALCalibCoefs.h" | |
45 | #include "AliEMCALGeometry.h" | |
46 | #include "AliLog.h" | |
47 | #include "AliESD.h" | |
48 | #include "AliEMCALRecPoint.h" | |
0fc11500 | 49 | #include "AliRunLoader.h" |
50 | #include "AliStack.h" | |
51 | #include "jetfinder/AliEMCALJetMicroDst.h" // Sgpdge | |
52 | #include "AliEMCALDigit.h" | |
53 | ||
54 | #include <iostream> | |
55 | #include <iomanip> | |
56 | #include <fstream> | |
16d3c94d | 57 | #include <assert.h> |
58 | #include <map> | |
59 | #include <string> | |
60 | ||
61 | #include <TROOT.h> | |
62 | #include <TStyle.h> | |
63 | #include <TSystem.h> | |
64 | #include <TCanvas.h> | |
65 | #include <TVector3.h> | |
66 | #include <TLorentzVector.h> | |
0fc11500 | 67 | #include <TParticle.h> |
16d3c94d | 68 | #include <TChain.h> |
69 | #include <TFile.h> | |
70 | #include <TH1F.h> | |
0fc11500 | 71 | #include <TH1D.h> |
72 | #include <TH2F.h> | |
16d3c94d | 73 | #include <TF1.h> |
74 | #include <TMath.h> | |
16d3c94d | 75 | #include <TBrowser.h> |
0fc11500 | 76 | #include <TList.h> |
77 | #include <TCanvas.h> | |
78 | #include <TLine.h> | |
79 | #include <TObjString.h> | |
80 | #include <TArrayI.h> | |
81 | #include <TGraphErrors.h> | |
82 | #include <TLegend.h> | |
83 | #include <TLegendEntry.h> | |
84 | #include <TNtuple.h> | |
16d3c94d | 85 | |
86 | using namespace std; | |
87 | ||
88 | typedef AliEMCALHistoUtilities u; | |
89 | ||
7227086e | 90 | AliEMCALGeometry* AliEMCALRecPointsQaESDSelector::fgEmcalGeo=0; |
91 | Int_t AliEMCALRecPointsQaESDSelector::fgNmaxCell = 4*12*24*11; | |
0fc11500 | 92 | |
7227086e | 93 | Double_t AliEMCALRecPointsQaESDSelector::fgDistEff = 3.; |
94 | Double_t AliEMCALRecPointsQaESDSelector::fgW0 = 4.5; | |
95 | Double_t AliEMCALRecPointsQaESDSelector::fgSlopePhiShift = 0.01; // ?? just guess | |
0fc11500 | 96 | |
7227086e | 97 | AliEMCALFolder* AliEMCALRecPointsQaESDSelector::fgEMCAL = 0; |
98 | AliEMCALFolder* AliEMCALRecPointsQaESDSelector::fgEMCALOld = 0; | |
0fc11500 | 99 | |
7227086e | 100 | Char_t **AliEMCALRecPointsQaESDSelector::fgAnaOpt=0; |
101 | Int_t AliEMCALRecPointsQaESDSelector::fgNanaOpt = 0; | |
0fc11500 | 102 | enum keyOpt{ |
103 | kCORR1, | |
104 | kRECALIB, | |
105 | kIDEAL, | |
106 | kPI0, | |
107 | kGAMMA, | |
108 | kKINE, | |
109 | kPROF, | |
110 | kFIT, | |
111 | //-- | |
112 | kEND | |
113 | }; | |
7227086e | 114 | |
0fc11500 | 115 | // Enumeration variables |
116 | // enum {kUndefined=-1, kLed=0, kBeam=1}; | |
117 | // enum {kPatchResponse=0, kClusterResponse=1}; | |
118 | // enum {kSkip=0, kSaveToMemory=1}; | |
119 | ||
16d3c94d | 120 | ClassImp(AliEMCALRecPointsQaESDSelector) |
121 | ||
16d3c94d | 122 | AliEMCALRecPointsQaESDSelector::AliEMCALRecPointsQaESDSelector() : |
123 | AliSelector(), | |
0fc11500 | 124 | fPmom(0), |
16d3c94d | 125 | fChain(0), |
126 | fLofHistsPC(0), | |
127 | fLofHistsRP(0), | |
0fc11500 | 128 | fLKineVsRP(0), |
129 | fLShowerProfile(0), | |
130 | fCellsInfo(0), | |
16d3c94d | 131 | fEmcalPool(0), |
0fc11500 | 132 | fRunOpts(0), |
133 | fArrOpts(0), | |
134 | fKeyOpts(0) | |
16d3c94d | 135 | { |
136 | // | |
137 | // Constructor. Initialization of pointers | |
138 | // | |
7227086e | 139 | Char_t *anaOpt[]={ |
140 | "CORR1", // GetCorrectedEnergyForGamma_1(Double_t eRec); | |
141 | "RECALIB", | |
142 | "IDEAL", | |
143 | "PI0", | |
144 | "GAMMA", | |
145 | "KINE", // reading kine file | |
146 | "PROF", // Shower profile: phi direction now | |
147 | "FIT" // define parameters : deff, w0 and phislope | |
148 | }; | |
149 | ||
150 | fgNanaOpt = sizeof(anaOpt) / sizeof(Char_t*); | |
151 | fgAnaOpt = new Char_t*[fgNanaOpt]; | |
152 | for(int i=0; i<fgNanaOpt; i++) fgAnaOpt[i] = anaOpt[i]; | |
16d3c94d | 153 | } |
154 | ||
155 | AliEMCALRecPointsQaESDSelector::~AliEMCALRecPointsQaESDSelector() | |
156 | { | |
157 | // | |
158 | // Destructor | |
159 | // | |
160 | ||
161 | // histograms are in the output list and deleted when the output | |
162 | // list is deleted by the TSelector dtor | |
163 | } | |
164 | ||
165 | void AliEMCALRecPointsQaESDSelector::Begin(TTree* tree) | |
166 | { | |
167 | // Begin function | |
168 | ||
169 | AliSelector::Begin(tree); | |
170 | } | |
171 | ||
16d3c94d | 172 | void AliEMCALRecPointsQaESDSelector::SlaveBegin(TTree* tree) |
173 | { | |
174 | // The SlaveBegin() function is called after the Begin() function. | |
175 | // When running with PROOF SlaveBegin() is called on each slave server. | |
176 | // The tree argument is deprecated (on PROOF 0 is passed). | |
177 | ||
178 | printf("**** <I> Slave Begin \n **** "); | |
179 | ||
180 | AliSelector::SlaveBegin(tree); | |
181 | } | |
182 | ||
0fc11500 | 183 | void AliEMCALRecPointsQaESDSelector::Init(TTree* tree) |
184 | { | |
185 | // Init function | |
186 | ||
187 | AliSelector::Init(tree); | |
188 | } | |
189 | Bool_t AliEMCALRecPointsQaESDSelector::Notify() | |
190 | { | |
191 | // The Notify() function is called when a new file is opened. This | |
192 | // can be either for a new TTree in a TChain or when when a new TTree | |
193 | // is started when using PROOF. Typically here the branch pointers | |
194 | // will be retrieved. It is normaly not necessary to make changes | |
195 | // to the generated code, but the routine can be extended by the | |
196 | // user if needed. | |
197 | ||
198 | return AliSelector::Notify(); | |
199 | } | |
200 | ||
16d3c94d | 201 | void AliEMCALRecPointsQaESDSelector::InitStructure(Int_t it) |
202 | { | |
7227086e | 203 | // |
204 | // Initialize the common structure of selector | |
205 | // | |
206 | fgEmcalGeo = AliEMCALGeometry::GetInstance("SHISH_TRD1_CURRENT_2X2"); // initialize geometry just once | |
207 | fCellsInfo = AliEMCALCellInfo::GetTableForGeometry(fgEmcalGeo); | |
0fc11500 | 208 | |
209 | if(fRunOpts.Length()>0) CheckRunOpts(); | |
16d3c94d | 210 | |
0fc11500 | 211 | Int_t key = 0; |
212 | if(GetKeyOptsValue(kGAMMA)) key = 1; | |
213 | fLofHistsRP = DefineHistsOfRP("RP", fPmom, key); | |
214 | fLofHistsPC = DefineHistsOfRP("PseudoCl", fPmom); | |
16d3c94d | 215 | |
0fc11500 | 216 | fEmcalPool = new TFolder("PoolOfEMCAL",""); |
217 | if(it <= 1) { | |
7227086e | 218 | fgEMCAL = new AliEMCALFolder(it); // folder for first itteration |
219 | fEmcalPool->Add(fgEMCAL); | |
16d3c94d | 220 | } |
0fc11500 | 221 | //if(it<=0) SetName("GammaSel"); // For convinience |
222 | //else SetName("Pi0Sel"); | |
223 | if(GetKeyOptsValue(kKINE)) fLKineVsRP = DefineHistsOfKineVsRP("KineVsRP",fPmom, key); | |
224 | if(GetKeyOptsValue(kPROF)) fLShowerProfile = DefineHistsForShowerProfile("ProfY", fPmom); | |
225 | } | |
226 | ||
227 | void AliEMCALRecPointsQaESDSelector::CheckRunOpts() | |
228 | { | |
7227086e | 229 | // Check run options |
0fc11500 | 230 | fRunOpts.ToUpper(); |
231 | int nopt = u::ParseString(fRunOpts, fArrOpts); | |
7227086e | 232 | printf("<I> AliEMCALRecPointsQaESDSelector::CheckRunOpts() analyze %i(%i) options : fgNanaOpt %i\n", |
233 | nopt, fArrOpts.GetEntries(), fgNanaOpt); | |
0fc11500 | 234 | if(nopt <=0) return; |
235 | ||
7227086e | 236 | fKeyOpts = new TArrayI(fgNanaOpt); |
237 | for(Int_t i=0; i<fgNanaOpt; i++) (*fKeyOpts)[i] = 0; | |
0fc11500 | 238 | |
239 | for(Int_t i=0; i<fArrOpts.GetEntries(); i++ ) { | |
240 | TObjString *o = (TObjString*)fArrOpts.At(i); | |
241 | ||
242 | TString runOpt = o->String(); | |
243 | Int_t indj=-1; | |
244 | ||
7227086e | 245 | for(Int_t j=0; j<fgNanaOpt; j++) { |
246 | TString opt = fgAnaOpt[j]; | |
0fc11500 | 247 | if(runOpt.Contains(opt,TString::kIgnoreCase)) { |
248 | indj = j; | |
249 | break; | |
250 | } | |
251 | } | |
252 | if(indj<0) { | |
253 | printf("<E> option |%s| unavailable **\n", | |
254 | runOpt.Data()); | |
255 | assert(0); | |
256 | } else { | |
257 | (*fKeyOpts)[indj] = 1; | |
258 | printf("<I> option |%s| is valid : number %i : |%s| \n", | |
7227086e | 259 | runOpt.Data(), indj, fgAnaOpt[indj]); |
0fc11500 | 260 | } |
261 | } | |
262 | } | |
263 | ||
264 | Int_t AliEMCALRecPointsQaESDSelector::GetKeyOptsValue(Int_t key) | |
265 | { | |
7227086e | 266 | // Oct 14, 2007 |
0fc11500 | 267 | static Int_t val=0; |
268 | val = 0; | |
269 | if(fKeyOpts && key>=0 && key<fKeyOpts->GetSize()) { | |
270 | val = fKeyOpts->At(key); | |
271 | } | |
7227086e | 272 | // printf(" key %i : val %i : opt %s \n", key, val, fgAnaOpt[key]); |
0fc11500 | 273 | return val; |
16d3c94d | 274 | } |
275 | ||
276 | Bool_t AliEMCALRecPointsQaESDSelector::Process(Long64_t entry) | |
277 | { | |
278 | // The Process() function is called for each entry in the tree (or possibly | |
279 | // keyed object in the case of PROOF) to be processed. The entry argument | |
280 | // specifies which entry in the currently loaded tree is to be processed. | |
281 | // It can be passed to either TTree::GetEntry() or TBranch::GetEntry() | |
282 | // to read either all or the required parts of the data. When processing | |
283 | // keyed objects with PROOF, the object is already loaded and is available | |
284 | // via the fObject pointer. | |
285 | // | |
286 | // This function should contain the "body" of the analysis. It can contain | |
287 | // simple or elaborate selection criteria, run algorithms on the data | |
288 | // of the event and typically fill histograms. | |
289 | ||
290 | // WARNING when a selector is used with a TChain, you must use | |
291 | // the pointer to the current TTree to call GetEntry(entry). | |
292 | // The entry is always the local entry number in the current tree. | |
293 | // Assuming that fTree is the pointer to the TChain being processed, | |
294 | // use fTree->GetTree()->GetEntry(entry). | |
295 | ||
0fc11500 | 296 | if (AliSelector::Process(entry) == kFALSE) { |
297 | AliDebug(AliLog::kError, Form("Entry %i is not available ",entry)); | |
16d3c94d | 298 | return kFALSE; |
0fc11500 | 299 | } |
300 | ||
301 | // esd->ReadFromTree(tree); | |
302 | // AliESDEvent * esd = new AliESDEvent(); | |
16d3c94d | 303 | |
304 | // Check prerequisites | |
305 | if (!fESD) | |
306 | { | |
307 | AliDebug(AliLog::kError, "ESD branch not available"); | |
308 | return kFALSE; | |
309 | } | |
0fc11500 | 310 | |
16d3c94d | 311 | static pi0SelectionParam* rPar = GetEmcalFolder()->GetPi0SelectionParRow(0); |
312 | ||
313 | static Int_t nEmcalClusters, indOfFirstEmcalRP, nEmcalRP,nEmcalPseudoClusters; | |
314 | nEmcalClusters = fESD->GetNumberOfEMCALClusters(); | |
315 | indOfFirstEmcalRP = fESD->GetFirstEMCALCluster(); | |
316 | u::FillH1(fLofHistsRP, 1, double(indOfFirstEmcalRP)); | |
317 | ||
7227086e | 318 | static AliRunLoader* rl = 0; |
0fc11500 | 319 | static Int_t nev = 0; // Temporary - 0nly for reading one file now !! |
320 | ||
16d3c94d | 321 | static AliESDCaloCluster *cl = 0; |
322 | nEmcalRP = nEmcalPseudoClusters = 0; | |
323 | TList *l=0; | |
324 | double eDigi=0; | |
325 | ||
326 | TClonesArray lvM1("TLorentzVector", 100); // for convenience; 100 is enough now | |
327 | TArrayI indLv(100); // index of RP | |
328 | ||
329 | static TLorentzVector v, vcl; | |
330 | int nrp = 0; // # of RP for gg analysis | |
0fc11500 | 331 | static Double_t erec=0., ecorr=0.0; |
16d3c94d | 332 | for(int i=indOfFirstEmcalRP; i<indOfFirstEmcalRP+nEmcalClusters; i++) { |
333 | cl = fESD->GetCaloCluster(i); | |
8ada0ffe | 334 | if(cl->GetClusterType() == AliESDCaloCluster::kEMCALPseudoCluster) { |
16d3c94d | 335 | nEmcalPseudoClusters++; |
336 | l = fLofHistsPC; | |
8ada0ffe | 337 | } else if(cl->GetClusterType() == AliESDCaloCluster::kEMCALClusterv1){ |
16d3c94d | 338 | nEmcalRP++; |
7227086e | 339 | if(fgEMCAL->GetIterationNumber()>1||GetKeyOptsValue(kIDEAL)||GetKeyOptsValue(kRECALIB)||GetKeyOptsValue(kFIT)) { |
0fc11500 | 340 | AliEMCALRecPoint *rp=0; |
7227086e | 341 | if(GetKeyOptsValue(kFIT) == kFALSE) fgDistEff = -1.; // No fitting ; Sep 4, 2007 |
0fc11500 | 342 | if(GetKeyOptsValue(kIDEAL)) { |
7227086e | 343 | rp = AliEMCALFolder::GetRecPoint(cl, fgEMCAL->GetCCFirst(), 0, fLofHistsRP, fgDistEff, fgW0, fgSlopePhiShift); |
0fc11500 | 344 | } else { |
7227086e | 345 | rp = AliEMCALFolder::GetRecPoint(cl, fgEMCAL->GetCCFirst(), fgEMCAL->GetCCIn(), fLofHistsRP, fgDistEff, fgW0, fgSlopePhiShift); |
0fc11500 | 346 | } |
347 | if(GetKeyOptsValue(kPROF)) { | |
348 | FillHistsForShowerProfile( GetListShowerProfile(), rp, GetCellsInfo()); | |
349 | } | |
350 | //if(rp->GetPointEnergy()>=rPar->eOfRpMin && u::GetLorentzVectorFromRecPoint(v, rp)) { | |
16d3c94d | 351 | if(u::GetLorentzVectorFromRecPoint(v, rp)) { // comparing with RP |
0fc11500 | 352 | if(GetKeyOptsValue(kCORR1)) { |
353 | erec = v.Rho(); | |
354 | ecorr = u::GetCorrectedEnergyForGamma_1(erec); | |
355 | v.SetRho(ecorr); | |
356 | v.SetE(ecorr); // This is gamma | |
357 | //printf("<1> erec %f | ecorr %f \n", erec, ecorr); | |
358 | } | |
16d3c94d | 359 | new(lvM1[nrp]) TLorentzVector(v); |
360 | indLv[nrp] = i; | |
361 | nrp++; | |
362 | // Conroling of recalibration | |
363 | u::GetLorentzVectorFromESDCluster(vcl, cl); | |
364 | u::FillH1(fLofHistsRP, 11, vcl.P()-v.P()); | |
365 | u::FillH1(fLofHistsRP, 12, TMath::RadToDeg()*(vcl.Theta()-v.Theta())); | |
366 | u::FillH1(fLofHistsRP, 13, TMath::RadToDeg()*(vcl.Phi()-v.Phi())); | |
0fc11500 | 367 | |
368 | u::FillH1(fLofHistsRP, 16, v.P()); | |
369 | u::FillH2(fLofHistsRP, 17, vcl.P(), vcl.P()-v.P()); | |
16d3c94d | 370 | l = 0; // no filling |
0fc11500 | 371 | if(GetKeyOptsValue(kIDEAL) || GetKeyOptsValue(kRECALIB)) l = fLofHistsRP; |
16d3c94d | 372 | } |
0fc11500 | 373 | if(rp) delete rp; |
16d3c94d | 374 | } else { // first iteration |
375 | // if(cl->E()>=rPar->eOfRpMin && u::GetLorentzVectorFromESDCluster(v, cl)) { | |
376 | if(u::GetLorentzVectorFromESDCluster(v, cl)) { // comparing with RP | |
377 | // cut 0.4 GeV may be high ! | |
0fc11500 | 378 | if(GetKeyOptsValue(kCORR1)) { |
379 | erec = v.Rho(); | |
380 | ecorr = u::GetCorrectedEnergyForGamma_1(erec); | |
381 | v.SetRho(ecorr); | |
382 | v.SetE(ecorr); // This is gamma now | |
383 | // printf("<2> erec %f | ecorr %f \n", erec, ecorr); | |
384 | // printf(" v.Rho() %f \n", v.Rho()); | |
385 | } | |
16d3c94d | 386 | new(lvM1[nrp]) TLorentzVector(v); |
387 | indLv[nrp] = i; | |
388 | nrp++; | |
389 | l = fLofHistsRP; | |
390 | } | |
391 | } | |
392 | ||
393 | } else { | |
394 | printf(" wrong cluster type : %i\n", cl->GetClusterType()); | |
395 | assert(0); | |
396 | } | |
397 | u::FillH1(l, 2, double(cl->GetClusterType())); | |
398 | ||
399 | u::FillH1(l, 3, double(cl->GetNumberOfDigits())); | |
400 | u::FillH1(l, 4, double(cl->E())); | |
401 | // Cycle on digits (towers) | |
402 | Short_t *digiAmpl = cl->GetDigitAmplitude()->GetArray(); | |
403 | Short_t *digiTime = cl->GetDigitTime()->GetArray(); | |
404 | Short_t *digiAbsId = cl->GetDigitIndex()->GetArray(); | |
405 | for(int id=0; id<cl->GetNumberOfDigits(); id++) { | |
406 | eDigi = double(digiAmpl[id]) / 500.; // See AliEMCALClusterizerv1 | |
407 | // if(eDigi <= 0.0) { // sometimes it is happen | |
8ada0ffe | 408 | //if(eDigi > 10.0 && cl->GetClusterType() == AliESDCaloCluster::kEMCALClusterv1) { |
16d3c94d | 409 | // printf(" %i digiAmpl %i : %f \n", id, int(digiAmpl[id]), eDigi); |
410 | //} | |
411 | u::FillH1(l, 5, eDigi); | |
412 | u::FillH1(l, 6, double(digiTime[id])); | |
413 | u::FillH1(l, 7, double(digiAbsId[id])); | |
7227086e | 414 | if(int(digiAbsId[id]) >= fgNmaxCell) { |
16d3c94d | 415 | printf(" id %i : digiAbsId[id] %i (%i) : %s \n", |
7227086e | 416 | id, int(digiAbsId[id]), fgNmaxCell, l->GetName()); |
16d3c94d | 417 | } |
418 | } | |
419 | } | |
420 | u::FillH1(fLofHistsRP, 0, double(nEmcalRP)); | |
421 | u::FillH1(fLofHistsPC, 0, double(nEmcalPseudoClusters)); | |
422 | ||
423 | static TLorentzVector *lv1=0, *lv2=0, lgg; | |
0fc11500 | 424 | for(int i1=0; i1<nrp; i1++){ |
425 | lv1 = (TLorentzVector*)lvM1.At(i1); | |
426 | u::FillH1(fLofHistsRP, 18, lv1->P()); | |
427 | } | |
16d3c94d | 428 | static Double_t mgg, pgg; |
429 | mgg = pgg = 0.; | |
430 | nrp = lvM1.GetEntriesFast(); | |
431 | if(nrp >= 2) { | |
432 | // eff.mass analysis | |
433 | for(int i1=0; i1<nrp-1; i1++){ | |
434 | lv1 = (TLorentzVector*)lvM1.At(i1); | |
435 | for(int i2=i1+1; i2<nrp; i2++){ | |
436 | lv2 = (TLorentzVector*)lvM1.At(i2); | |
437 | lgg = (*lv1) + (*lv2); | |
438 | mgg = lgg.M(); // eff.mass | |
439 | pgg = lgg.P(); // momentum | |
440 | u::FillH1(fLofHistsRP, 8, mgg); | |
441 | ||
442 | if((mgg>=rPar->massGGMin && mgg<=rPar->massGGMax)) {// pi0 candidates | |
443 | if((pgg>=rPar->momPi0Min && pgg>=rPar->momPi0Min)) { | |
7227086e | 444 | if(fgEMCAL && fgEMCAL->GetIterationNumber()>=1) { |
445 | fgEMCAL->FillPi0Candidate(mgg,fESD->GetCaloCluster(indLv[i1]),fESD->GetCaloCluster(indLv[i2])); | |
0fc11500 | 446 | u::FillH1(fLofHistsRP, 9, pgg); |
447 | u::FillH1(fLofHistsRP,10, lv1->P()); | |
448 | u::FillH1(fLofHistsRP,10, lv2->P()); | |
449 | } | |
16d3c94d | 450 | } |
451 | } | |
452 | } | |
453 | } | |
454 | } | |
455 | ||
0fc11500 | 456 | // static Int_t fileNumber = 0; |
457 | static TString curFileName; | |
458 | // if(GetKeyOptsValue(kKINE) && nev<fChain->GetEntries()) { | |
459 | if(GetKeyOptsValue(kKINE)) { | |
460 | // Get galice.root file in current directory | |
461 | if(nev%1000==0) { | |
462 | printf(" current file |%s|\n", fChain->GetCurrentFile()->GetName()); | |
463 | curFileName = fChain->GetCurrentFile()->GetName(); | |
464 | curFileName.ReplaceAll("AliESDs.","galice."); | |
465 | } | |
7227086e | 466 | rl = u::InitKinematics(nev, curFileName.Data()); |
0fc11500 | 467 | // Compare kineamtics vs EMCal clusters |
7227086e | 468 | FillHistsOfKineVsRP(fLKineVsRP, rl, lvM1); |
0fc11500 | 469 | } |
470 | ||
16d3c94d | 471 | lvM1.Delete(); |
472 | ||
473 | if(nEmcalClusters != (nEmcalRP+nEmcalPseudoClusters)) | |
474 | Info("Process","nEmcalClusters %i : RP %i + PC %i ",nEmcalClusters, nEmcalRP, nEmcalPseudoClusters); | |
475 | ||
0fc11500 | 476 | nev++; |
477 | ||
16d3c94d | 478 | return kTRUE; |
479 | } | |
480 | ||
481 | void AliEMCALRecPointsQaESDSelector::SlaveTerminate() | |
482 | { | |
483 | // The SlaveTerminate() function is called after all entries or objects | |
484 | // have been processed. When running with PROOF SlaveTerminate() is called | |
485 | // on each slave server. | |
486 | ||
487 | AliSelector::SlaveTerminate(); | |
488 | ||
489 | // Add the histograms to the output on each slave server | |
490 | if (!fOutput) | |
491 | { | |
492 | AliDebug(AliLog::kError, Form("ERROR: Output list not initialized.")); | |
493 | return; | |
494 | } | |
495 | ||
496 | // fOutput->Add(fMultiplicity); | |
497 | } | |
498 | ||
499 | void AliEMCALRecPointsQaESDSelector::Terminate() | |
500 | { | |
501 | // The Terminate() function is the last function to be called during | |
502 | // a query. It always runs on the client, it can be used to present | |
503 | // the results graphically or save the results to file. | |
504 | ||
505 | AliSelector::Terminate(); | |
16d3c94d | 506 | |
16d3c94d | 507 | PrintInfo(); |
508 | } | |
0fc11500 | 509 | |
16d3c94d | 510 | // |
0fc11500 | 511 | TList *AliEMCALRecPointsQaESDSelector::DefineHistsOfRP(const char *name,Double_t p,Int_t keyOpt) |
16d3c94d | 512 | { |
7227086e | 513 | // |
514 | // Define histogramms of rec.points | |
515 | // | |
0fc11500 | 516 | printf("<I> DefineHistsOfRP :%s : p %f : keyOpt %i \n", name, p, keyOpt); |
7227086e | 517 | Double_t adcChannelEC = 0.0153; // ~15mev per adc count |
0fc11500 | 518 | Double_t xma = p*1.4, xmi=0.0, step=0.0, xmic=xmi, xmac = xma; |
519 | if(xma<0) xma = 20.; | |
520 | Int_t nmax=1000, scale=4, nmaxc = nmax; | |
16d3c94d | 521 | |
522 | gROOT->cd(); | |
523 | TH1::AddDirectory(1); | |
524 | new TH1F("00_EmcalMultiplicity", "multiplicity of EMCAL ", 201, -0.5, 200.5); // real and pseudo | |
525 | new TH1F("01_IndexOfFirstEmcal", "index of first emcal rec.points ", 201, -0.5, 200.5); | |
526 | ||
527 | new TH1F("02_NumberOf", "number of ", 6, -0.5, 5.5); | |
528 | new TH1F("03_NumberOfDigitsIn", "number of digits(towers) in rec.points ", 101, -0.5, 100.5); | |
16d3c94d | 529 | |
0fc11500 | 530 | if(keyOpt==1 && p>0.1) { |
531 | if (p>=100.) scale=12; | |
532 | else if(p>=50.) scale=10; | |
533 | else if(p>=30.) scale=8; | |
534 | xma = p + scale*(0.15*TMath::Sqrt(p)); | |
535 | xmi = p - scale*(0.15*TMath::Sqrt(p)); | |
536 | step = (xma-xmi)/nmax; | |
537 | } | |
538 | ||
539 | if(step < 0.0153) { | |
7227086e | 540 | nmax = int((xma-xmi) / adcChannelEC)+1; |
541 | xma = xmi + adcChannelEC*nmax; | |
0fc11500 | 542 | } |
543 | new TH1F("04_EnergyOf", "energy of ", nmax, xmi, xma); | |
544 | nmaxc = nmax; xmic=xmi; xmac = xma; | |
545 | ||
546 | nmax = 10000; | |
7227086e | 547 | xmi = adcChannelEC/2.; xma = xmi + adcChannelEC*nmax; |
16d3c94d | 548 | // All energy(momentum) unit is GeV if don't notice |
0fc11500 | 549 | new TH1F("05_DigitEnergyIn", "digit energy in ", nmaxc, xmic, xmac); |
16d3c94d | 550 | new TH1F("06_DigitTimeIn", "digit time in 10ps(0.01ns) ", 1000, 0.0, 3.e+3); // ns/100 = 10 ps |
7227086e | 551 | new TH1F("07_DigitAbsIdIn", "digit abs id in ", fgNmaxCell, -0.5, double(fgNmaxCell)-0.5); |
16d3c94d | 552 | new TH1F("08_EffMass", "effective mass of #gamma,#gamma(m_{#pi^{0}}=134.9766 MeV)", 100, 0.0, 0.5); |
553 | new TH1F("09_MomOfPi0Candidate", "momentum of #pi^{0} candidates (0.085 <mgg<0.185)", 600, 0.0, 30.0); | |
554 | new TH1F("10_MomOfRpPi0Candidate", "momentum of RP for #pi^{0} candidates (0.085 <mgg<0.185)", 600, 0.0, 30.0); | |
555 | // Recalibration staf | |
0fc11500 | 556 | Double_t pmax=11., dpmax=0.20; |
557 | if(p>0.1) { | |
558 | pmax=p*1.2; | |
559 | dpmax *= p; | |
560 | } | |
561 | new TH1F("11_MomClESD-RpRecalib", "difference of momentum cl(ESD) - rp(Recalib)", 100, -.01, dpmax); | |
16d3c94d | 562 | new TH1F("12_ThetaClESD-RpRecalib", "difference of #theta cl(ESD) - rp(Recalib) in degree", 100, -0.05, +0.05); |
563 | new TH1F("13_PhiClESD-RpRecalib", "difference of #phi cl(ESD) - rp(Recalib) in degree ", 100, -0.05, +0.05); | |
564 | // Digi | |
565 | new TH1F("14_EDigiRecalib", "energy of digits after recalibration", 2000, 0.0, 20.); | |
0fc11500 | 566 | // AliEMCALGeometry* g = AliEMCALGeometry::GetInstance(); |
7227086e | 567 | new TH1F("15_AbsIdRecalib", "abs Id of digits after recalibration", fgEmcalGeo->GetNCells(),-0.5,Double_t(fgEmcalGeo->GetNCells())-0.5); |
0fc11500 | 568 | new TH1F("16_EnergyOfRecalibRp_", "energy of recalibrated rec.points", nmaxc, xmic, xmac); // Jul 12, 2007 |
569 | new TH2F("17_ShiftRecalib_", "E(clESD) - E(recalib)", 110,0.0, pmax, 50,0.0,dpmax); // Jul 13, 2007 | |
16d3c94d | 570 | |
0fc11500 | 571 | // Corrected staff |
572 | new TH1F("18_EnergyOfCorrectedLV", "energy of corrected LV", nmaxc, xmic, xmac); | |
573 | ||
574 | TString st = Form("ListOfHists%s_P=%5.1f",name,p); | |
575 | st.ReplaceAll(" ",""); | |
576 | TList *l = u::MoveHistsToList(st.Data(), kFALSE); | |
577 | st = Form("%s_P=%5.1f",name,p); | |
578 | st.ReplaceAll(" ",""); | |
579 | u::AddToNameAndTitleToList(l, st.Data(), st.Data()); | |
580 | ||
581 | return l; | |
582 | } | |
583 | ||
584 | TList* AliEMCALRecPointsQaESDSelector::DefineHistsOfKineVsRP(const char *name, Double_t p, Int_t keyOpt) | |
585 | { | |
7227086e | 586 | // |
587 | // Define histogramms for comparing a initial kinematics with rec.points | |
588 | // | |
589 | printf("<I> DefineHistsOfKineVsRP :%s : p %f : keyOpt %i \n", name, p, keyOpt); | |
0fc11500 | 590 | |
591 | gROOT->cd(); | |
592 | TH1::AddDirectory(1); | |
593 | new TH1F("00_hVx",Form("Vx of primary vertex"), 100, -5., +5.); // 00 | |
594 | new TH1F("01_hVy",Form("Vy of primary vertex"), 100, -5., +5.); // 01 | |
595 | new TH1F("02_hVz",Form("Vz of primary vertex"), 100, -50., +50.); // 02 | |
596 | ||
7227086e | 597 | // Double_t adcChannelEC = 0.0153; // ~15mev per adc count |
0fc11500 | 598 | Double_t xma = p*1.4, xmi=0.0, sig=0.15*TMath::Sqrt(p); |
599 | // Double_t step=0.0, xmic=xmi, xmac = xma; | |
600 | if(xma<0) xma = 20.; | |
601 | //Int_t nmax=1000; | |
602 | // scale=4, nmaxc = nmax; | |
603 | ||
604 | new TH1F("03_hGidPrimar", "Geant Id of primary particle ", 101, 0.5, 100.5); // 03 | |
605 | new TH1F("04_hPmomPrim","momentum of primary particle", 100, xmi, xma); // 04 | |
606 | new TH1F("05_hEtaPrim","#eta of primary particle ", 200, -1., 1.); // 05 | |
607 | new TH1F("06_hPhiPrim","#phi of primary particle ", 63*2, 0.0,TMath::Pi()*2.); // 06 | |
608 | new TH1F("07_hThetaPrim","#theta of primary particle", 63, 0.0,TMath::Pi()); // 07 | |
609 | new TH1F("08_hPhiPrimInDegree","#phi of primary particle in degree", 120, 75.0, 195.0); // 08 | |
610 | new TH1F("09_hThetaPrimInDegree","#theta of primary particle in degree", 90, 45., 135.); // 09 | |
611 | ||
612 | // Particle vs cluster | |
613 | new TH1F("10_hE(P)-E(RP)"," E(p) - E(RP) ", 100, -10.*sig, 10.*sig); // 10 | |
614 | ||
615 | new TH1F("11_hPvsRpAngleInDegree","angle between P and RP (in degree)", 110, 0.0, 1.0); // 11 | |
616 | double dphi=0.5; // for fitting | |
617 | new TH1F("12_hPvsRpDPhiInDegree","dif(#phi) between P and RP (in degree)", 100, -dphi, dphi); // 12 | |
618 | new TH1F("13_hPvsRpDThetaInDegree","dif(#theta) between P and RP (in degree)", 100, -0.5, 0.5); // 13 | |
619 | ||
620 | new TH1F("14_hPvsRpDPhiInDegree","dif(#phi) between P and RP (in degree) right part of SM", 100, -dphi, +dphi); // 14 | |
621 | new TH1F("15_hPvsRpDPhiInDegree","dif(#phi) between P and RP (in degree) left part of SM", 100, -dphi, dphi); // 15 | |
622 | ||
623 | new TH1F("16_hPvsRpDThetaInDegree","dif(#theta) between P and RP (even index)", 100, -0.5, 0.5); // 16 | |
624 | new TH1F("17_hPvsRpDThetaInDegree","dif(#theta) between P and RP (odd index)", 100, -0.5, 0.5); // 17 | |
625 | ||
626 | TString st = Form("ListOfHists%s_P=%5.1f",name,p); | |
627 | st.ReplaceAll(" ",""); | |
628 | TList *l = u::MoveHistsToList(st.Data(), kFALSE); | |
629 | st = Form("%s_P=%5.1f",name,p); | |
630 | st.ReplaceAll(" ",""); | |
631 | u::AddToNameAndTitleToList(l, st.Data(), st.Data()); | |
632 | return l; | |
633 | } | |
634 | ||
635 | TList *AliEMCALRecPointsQaESDSelector::DefineHistsForShowerProfile(const char *name, Double_t p) | |
636 | { | |
637 | // Aug 1, 2007 - shower profile business as in testbeam analysis | |
638 | // Phi direction here is Y direction in testbeam | |
639 | printf("<I> DefineHistsForShowerProfile: %s : p %f \n", | |
640 | name, p); | |
641 | ||
642 | gROOT->cd(); | |
643 | TH1::AddDirectory(1); | |
644 | ||
645 | // Cell unit | |
646 | new TH1F("00_hPHiMean"," mean in #phi direction ", 24*10, 0.0, 24.); | |
647 | new TH1F("01_hPHiLog"," mean with log in #phi direction ", 24*10, 0.0, 24.); | |
648 | new TH2F("02_XmeanVsXlog", "xmean vs xlog", 240,0.0, 24.,240,0.0, 24.); | |
649 | new TH2F("03_XmeanVsXlog", "xmean vs xlog (system of cell with max energy, first half on #eta)", | |
650 | 50,-0.5,+0.5, 100,-1.,+1.); | |
651 | new TH2F("04_XmeanVsXlog", "xmean vs xlog (system of cell with max energy, second half on #eta)", | |
652 | 50,-0.5,+0.5, 100,-1.,+1.); | |
653 | ||
654 | new TH2F("05_PhiShowerProfile", " #phi shower profile - cumulative distribution", | |
655 | 6*25,-3.,3., 201, -0.0025, 1.0025); // 00; x direction in cell unit | |
656 | ||
657 | TString st = Form("L%s_P=%5.1f",name,p); | |
658 | st.ReplaceAll(" ",""); | |
659 | TList *l = u::MoveHistsToList(st.Data(), kFALSE); | |
660 | st = Form("%s_P=%5.1f",name,p); | |
661 | st.ReplaceAll(" ",""); | |
662 | u::AddToNameAndTitleToList(l, st.Data(), st.Data()); | |
16d3c94d | 663 | |
664 | return l; | |
665 | } | |
666 | ||
7227086e | 667 | void AliEMCALRecPointsQaESDSelector::FillHistsOfKineVsRP(TList *l, AliRunLoader* rl, TClonesArray &lvM) |
0fc11500 | 668 | { |
669 | // | |
670 | // lvM - array of TLorentzVector's which was cretaef from AliESDCaloCluster's | |
671 | // | |
672 | ||
7227086e | 673 | if(l==0 || rl==0) return; |
0fc11500 | 674 | |
675 | // TNtuple for qucik analysis | |
676 | static TNtuple *nt=0; | |
677 | if(nt==0) { | |
678 | gROOT->cd(); | |
679 | Int_t bsize = int(1.e+7); | |
680 | nt = new TNtuple("angle","angle ntuple for quick analysis", | |
681 | "dPhi:dTheta:phiP:thetaP", bsize); | |
682 | gROOT->GetListOfBrowsables()->Add(nt); | |
683 | } | |
684 | static AliStack* st=0; | |
685 | static TParticle *p=0; | |
686 | static Int_t gid=0, ic=0, pdg=0, i=0; | |
687 | gid = ic = pdg = 0; | |
688 | ||
7227086e | 689 | st = rl->Stack(); |
0fc11500 | 690 | if(st == 0) return; |
691 | // first primary particle | |
692 | p = st->Particle(0); | |
693 | if(p == 0) return; | |
694 | ||
695 | u::FillH1(l, ic++, p->Vx()); | |
696 | u::FillH1(l, ic++, p->Vy()); | |
697 | u::FillH1(l, ic++, p->Vz()); | |
698 | ||
699 | pdg = p->GetPdgCode(); | |
700 | //gid = gMC->IdFromPDG(pdg); // gMc should be defined | |
701 | AliEMCALJetMicroDst::Sgpdge(pdg,gid); // temporary | |
702 | ||
703 | u::FillH1(l, ic++, Double_t(gid)); | |
704 | u::FillH1(l, ic++, p->P()); | |
705 | u::FillH1(l, ic++, p->Eta()); | |
706 | u::FillH1(l, ic++, TVector2::Phi_0_2pi(p->Phi()) ); | |
707 | u::FillH1(l, ic++, p->Theta()); | |
708 | // In degree | |
709 | u::FillH1(l, ic++, TVector2::Phi_0_2pi(p->Phi())*TMath::RadToDeg()); | |
710 | u::FillH1(l, ic++, p->Theta()*TMath::RadToDeg()); // 09 | |
711 | ||
712 | if(lvM.GetEntriesFast() == 0) return; | |
713 | // | |
714 | // Initial kinematics vs Calo clusters | |
715 | // | |
716 | static TLorentzVector *lv = 0, lvp; | |
717 | lvp.SetPxPyPzE(p->Px(),p->Py(),p->Pz(),p->Energy()); // Particle | |
718 | ||
719 | Double_t angle = 0.0, angleMin = 180.0, eDiff=0.0, dPhi=0., dTheta=0., phiP=0.0, thetaP=0.0; | |
720 | Int_t indMin = 0; | |
721 | phiP = lvp.Phi() * TMath::RadToDeg(); | |
722 | if (phiP<81. || phiP>99.) return; // cut phi boundaries | |
723 | thetaP = lvp.Theta() * TMath::RadToDeg(); | |
724 | if (thetaP<56. || thetaP>89.) return; // cut theta boundaries | |
725 | ||
726 | for(i=0; i<lvM.GetEntriesFast(); i++) { | |
727 | lv = (TLorentzVector*)lvM.At(i); | |
728 | angle = lv->Angle(lvp.Vect())*TMath::RadToDeg(); | |
729 | if(angleMin > angle) { | |
730 | angleMin = angle; | |
731 | indMin = i; | |
732 | } | |
733 | } | |
734 | lv = (TLorentzVector*)lvM.At(indMin); | |
735 | eDiff = lvp.E() - lv->E(); | |
736 | u::FillH1(l, ic++, eDiff); | |
737 | ||
738 | dPhi = TVector2::Phi_mpi_pi(lvp.Phi()-lv->Phi())*TMath::RadToDeg(); | |
739 | dTheta = TVector2::Phi_mpi_pi(lvp.Theta()-lv->Theta())*TMath::RadToDeg(); | |
740 | u::FillH1(l, ic++, angleMin); | |
741 | u::FillH1(l, ic++, dPhi); | |
742 | u::FillH1(l, ic++, dTheta); | |
743 | ||
744 | if (phiP>=81. && phiP<=90.) { | |
745 | u::FillH1(l, 14, dPhi); | |
746 | } else if(phiP> 90. && phiP<=99.) { | |
747 | u::FillH1(l, 15, dPhi); | |
748 | } | |
749 | // Unfinished - have to get absid of digit with max energy | |
750 | u::FillH1(l, 16, dTheta); | |
751 | u::FillH1(l, 17, dTheta); | |
752 | if(nt) { | |
753 | nt->Fill(dPhi,dTheta,phiP,thetaP); | |
754 | /* | |
755 | tv__tree = (TTree *) gROOT->FindObject("angle"); | |
756 | tv__tree->Draw("dPhi:phiP","abs(dPhi)<0.5","", 9182, 0); | |
757 | tv__tree->Draw("dTheta:thetaP","abs(dTheta)<0.5","", 9182, 0); | |
758 | */ | |
759 | } | |
760 | } | |
761 | ||
762 | void AliEMCALRecPointsQaESDSelector::FillHistsForShowerProfile | |
763 | (TList *l, AliEMCALRecPoint *rp, AliEMCALCellInfo * t) | |
764 | { | |
765 | // Aug 1, 2007 | |
766 | if(l==0 || rp==0 || t==0) return; | |
767 | // -- | |
768 | static Double_t xmean=0., xlog=0.; | |
769 | static cellInfo rMax; | |
770 | static Int_t phiSize; | |
771 | ||
772 | if(rp->GetPointEnergy() < 1.0) return; | |
773 | //if(rp->GetPointEnergy() > 8.0) return; // discard merged clusters for pi0 case | |
774 | ||
775 | EvalLocalPhiPosition(1., rp, t, xmean, phiSize, rMax); | |
776 | if(phiSize == 0) return; // just one row in cell directions | |
777 | ||
778 | EvalLocalPhiPosition(5.5, rp, t, xlog, phiSize, rMax); | |
779 | if(rMax.iPhi>1.5&&rMax.iPhi<21.5 && rMax.iEta>1.5&&rMax.iEta<46.5) { | |
780 | u::FillH1(l, 0, xmean); | |
781 | u::FillH1(l, 1, xlog); | |
782 | u::FillH2(l, 2, xlog, xmean); | |
783 | // Select two central modules | |
784 | if((rMax.iPhim==5 || rMax.iPhim==6)){ | |
785 | // Transition to system of cell with max energy | |
786 | xmean -= (double(rMax.iPhi)+0.5); | |
787 | xlog -= (double(rMax.iPhi)+0.5); | |
788 | if(rMax.iEtam>=2 && rMax.iEtam<=12){ // approximatively first half on eta | |
789 | u::FillH2(l, 3, xlog, xmean); | |
790 | } else {// approximatively second half on eta | |
791 | u::FillH2(l, 4, xlog, xmean); | |
792 | } | |
793 | } | |
794 | } | |
795 | } | |
796 | ||
797 | void AliEMCALRecPointsQaESDSelector::EvalLocalPhiPosition(const Double_t wlog, const AliEMCALRecPoint *rp, const AliEMCALCellInfo* t, Double_t &xcog, Int_t &phiSize, cellInfo &rMax) | |
798 | { | |
799 | // wlog = 1 - usual center of gravity; >1 - with logarithmic weight. | |
800 | // digits - array of digits | |
801 | // t - | |
802 | //== | |
803 | // xcog - position of center of gravity in cell unit | |
804 | if(wlog<1.0 || rp==0 || t==0) return; | |
805 | xcog = 0; | |
806 | ||
807 | static Double_t wtot=0., w=0., edigi=0., e=0., edigiMax=0.; | |
808 | static Int_t absid = 0, phiMin=0, phiMax=0; | |
809 | static cellInfo* r=0; | |
810 | ||
811 | e = rp->GetPointEnergy(); | |
812 | wtot = 0.0; | |
813 | edigiMax=0.; | |
814 | ||
815 | phiMin = 23; phiMax = 0; | |
816 | for(Int_t iDigit=0; iDigit<rp->GetMultiplicity(); iDigit++) { | |
817 | absid = rp->GetAbsId()[iDigit]; | |
818 | edigi = rp->GetEnergiesList()[iDigit]; | |
819 | if(wlog > 1.0) w = TMath::Max( 0., wlog + TMath::Log(edigi/e)); | |
820 | else w = edigi; // just energy | |
821 | ||
822 | r = t->GetTable(absid); | |
823 | xcog += w*(Double_t(r->iPhi) + 0.5); | |
824 | wtot += w; | |
825 | if(edigi > edigiMax) { | |
826 | edigiMax = edigi; | |
827 | rMax = (*r); | |
828 | } | |
829 | if(phiMin > r->iPhi) phiMin = r->iPhi; | |
830 | if(phiMax < r->iPhi) phiMax = r->iPhi; | |
831 | } | |
832 | xcog /= wtot; | |
833 | phiSize = phiMax - phiMin; | |
834 | // printf("phiSize %i \n", phiSize); | |
835 | } | |
16d3c94d | 836 | /* unused now |
837 | TList *AliEMCALRecPointsQaESDSelector::DefineHistsOfTowers(const char *name) | |
838 | { | |
839 | // | |
840 | // ESD: towers information was saved to pseudo clusters | |
841 | // | |
842 | gROOT->cd(); | |
843 | TH1::AddDirectory(1); | |
844 | new TH1F("00_EmcalMultiplicity", "multiplicity of EMCAL ", 201, -0.5, 200.5); // number of pseudo RP | |
845 | ||
846 | new TH1F("01_EnergyOf", "energy of ", 1000, 0.0, 100.); | |
847 | ||
848 | TList *l = u::MoveHistsToList(Form("ListOfHists%s",name, " - ESD"), kFALSE); | |
849 | u::AddToNameAndTitleToList(l, name, name); | |
850 | ||
851 | return l; | |
852 | } | |
853 | */ | |
854 | ||
855 | void AliEMCALRecPointsQaESDSelector::FitEffMassHist() | |
856 | { | |
857 | TH1* h = (TH1*)fLofHistsRP->At(8); | |
858 | AliEMCALCell::FitHist(h, GetName(), "draw"); | |
859 | } | |
860 | ||
861 | void AliEMCALRecPointsQaESDSelector::PrintInfo() | |
862 | { | |
863 | // Service routine | |
0fc11500 | 864 | printf("\n %i Entrie(s) | Option(s) |%s| \n", GetOptsArray().GetEntries(), fRunOpts.Data()); |
7227086e | 865 | for(int i=0; i<fgNanaOpt; i++) { |
866 | if(GetKeyOptsValue(i)) printf(" %i |%s| \n", i, fgAnaOpt[i]); | |
0fc11500 | 867 | } |
868 | ||
16d3c94d | 869 | TList *l[2] = {fLofHistsPC, fLofHistsRP}; |
870 | printf("\n"); | |
871 | for(int i=0; i<2; i++){ | |
872 | TH1F *h = (TH1F*)l[i]->At(2); | |
873 | printf(" %s \t: %i \n", h->GetTitle(), int(h->GetEntries())); | |
874 | } | |
7227086e | 875 | printf(" fgDistEff %f fgW0 %f fgSlopePhiShift %f \n", fgDistEff, fgW0, fgSlopePhiShift); |
0fc11500 | 876 | } |
877 | ||
878 | void AliEMCALRecPointsQaESDSelector::SetMomentum(Double_t p) | |
879 | { // Jul 9, 2007 | |
880 | fPmom = p; | |
881 | // SetName(Form("%s_p_%f5.1", GetName(), p)); | |
16d3c94d | 882 | } |
883 | ||
0fc11500 | 884 | |
16d3c94d | 885 | AliEMCALFolder* AliEMCALRecPointsQaESDSelector::CreateEmcalFolder(const Int_t it) |
886 | { | |
7227086e | 887 | // |
888 | // Create emcal folder for iteration number it | |
889 | // | |
16d3c94d | 890 | AliEMCALFolder* newFolder = new AliEMCALFolder(it); // folder for iteration #it |
891 | if(it>1) { | |
7227086e | 892 | fgEMCALOld = fgEMCAL; |
893 | AliEMCALCalibCoefs* tabOldOut = fgEMCALOld->GetCCOut(); | |
16d3c94d | 894 | AliEMCALCalibCoefs* tabNewIn = new AliEMCALCalibCoefs(*tabOldOut); |
895 | tabNewIn->SetName(AliEMCALFolder::fgkCCinName.Data()); | |
896 | newFolder->Add(tabNewIn); | |
897 | } | |
898 | fEmcalPool->Add(newFolder); | |
7227086e | 899 | fgEMCAL = newFolder; |
16d3c94d | 900 | |
7227086e | 901 | return fgEMCAL; |
16d3c94d | 902 | } |
903 | ||
904 | AliEMCALFolder* AliEMCALRecPointsQaESDSelector::GetEmcalOldFolder(const Int_t nsm) | |
905 | { | |
7227086e | 906 | // Return emcal folder with number nsm |
16d3c94d | 907 | AliEMCALFolder* folder=0; |
0fc11500 | 908 | if(fEmcalPool) folder = (AliEMCALFolder*)fEmcalPool->FindObject(Form("EMCAL_%2.2i",nsm)); |
16d3c94d | 909 | return folder; |
910 | } | |
911 | ||
912 | ||
913 | void AliEMCALRecPointsQaESDSelector::SetEmcalFolder(AliEMCALFolder* folder) | |
914 | { | |
7227086e | 915 | fgEMCAL = folder; |
916 | fEmcalPool->Add(fgEMCAL); | |
16d3c94d | 917 | } |
918 | ||
919 | void AliEMCALRecPointsQaESDSelector::SetEmcalOldFolder(AliEMCALFolder* folder) | |
920 | { | |
7227086e | 921 | fgEMCALOld = folder; |
922 | fEmcalPool->Add(fgEMCALOld); | |
16d3c94d | 923 | } |
924 | ||
925 | void AliEMCALRecPointsQaESDSelector::Browse(TBrowser* b) | |
926 | { | |
7227086e | 927 | // What we see at browser |
16d3c94d | 928 | if(fESD) b->Add(fESD); |
16d3c94d | 929 | if(fChain) b->Add(fChain); |
930 | if(fEmcalPool) b->Add(fEmcalPool); | |
7227086e | 931 | if(fgEmcalGeo) b->Add(fgEmcalGeo); |
0fc11500 | 932 | if(fCellsInfo) b->Add(fCellsInfo); |
933 | // | |
934 | if(fLofHistsPC) b->Add(fLofHistsPC); | |
935 | if(fLofHistsRP) b->Add(fLofHistsRP); | |
936 | if(fLKineVsRP) b->Add(fLKineVsRP); | |
937 | if(fLShowerProfile) b->Add(fLShowerProfile); | |
16d3c94d | 938 | // if(u) b->Add(u); |
939 | } | |
940 | ||
941 | Bool_t AliEMCALRecPointsQaESDSelector::IsFolder() const | |
942 | { | |
943 | if(fESD || fLofHistsRP || fEmcalPool) return kTRUE; | |
944 | return kFALSE; | |
945 | } | |
946 | ||
0fc11500 | 947 | void AliEMCALRecPointsQaESDSelector::Save(Int_t ver, const char *optIO) |
7227086e | 948 | { |
949 | // Aug 3, 2007 | |
950 | // Save selector to file | |
0fc11500 | 951 | TString dir("/home/pavlinov/ALICE/SHISHKEBAB/RF/CALIB/"); // Root directory for saving |
952 | TString nf=dir; | |
953 | if(GetKeyOptsValue(kPROF)) { | |
954 | nf += "PROF/PROFILE_"; | |
955 | nf += ver; | |
956 | nf += ".root"; | |
957 | TFile f(nf.Data(), optIO); | |
958 | if(f.IsOpen()) { | |
959 | this->Write(); | |
960 | f.Close(); | |
961 | printf("<I> Save selectort to file |%s| : optIO %s \n",nf.Data(), optIO); | |
962 | } else { | |
963 | printf("<W> File %s exits ! Increase version : ver %i !\n", nf.Data(), ver); | |
964 | } | |
965 | } else { | |
966 | printf("No PROF option -> no saving now !\n"); | |
967 | } | |
968 | } | |
969 | ||
970 | AliEMCALRecPointsQaESDSelector* AliEMCALRecPointsQaESDSelector::ReadSelector(const char* nf) | |
971 | { | |
7227086e | 972 | // Read selector to file |
0fc11500 | 973 | AliEMCALRecPointsQaESDSelector* selector=0; |
974 | ||
975 | TH1::AddDirectory(0); | |
976 | TFile f(nf,"READ"); | |
977 | if(f.IsOpen()) { | |
978 | TObject *o = f.Get("AliEMCALRecPointsQaESDSelector"); | |
979 | if(o) selector = dynamic_cast<AliEMCALRecPointsQaESDSelector *>(o); | |
980 | } | |
7227086e | 981 | // printf("<I> read selector %p : file |%s| \n", selector, nf); |
0fc11500 | 982 | return selector; |
983 | } | |
984 | ||
16d3c94d | 985 | void AliEMCALRecPointsQaESDSelector::ReadAllEmcalFolders() |
986 | { | |
7227086e | 987 | // Oct 14, 2007 |
16d3c94d | 988 | if(fEmcalPool==0) { |
0fc11500 | 989 | fEmcalPool = new TFolder("PoolOfEMCAL",""); |
16d3c94d | 990 | for(Int_t it=1; it<=10; it++){ |
9e02e8c6 | 991 | // AliEMCALFolder* fold = AliEMCALFolder::ReadFolder(Form("EMCALFOLDER_It%i_fit.root",it), "READ"); |
992 | AliEMCALFolder* fold = AliEMCALFolder::Read(Form("EMCALFOLDER_It%i_fit.root",it), "READ"); | |
16d3c94d | 993 | if(fold) fEmcalPool->Add(fold); |
994 | } | |
995 | } | |
996 | } | |
997 | ||
998 | void AliEMCALRecPointsQaESDSelector::PictVsIterNumber(const Int_t ind, const Int_t nsm) | |
999 | { | |
1000 | // Jun 27, 2007 - unfinished; which picture is the best | |
1001 | if(ind<0 || ind>5) return; | |
1002 | gROOT->cd(); | |
1003 | TH1::AddDirectory(1); | |
1004 | ||
1005 | Int_t itMax = 10, it=0; | |
1006 | map <int, char*> indName; | |
1007 | indName[0] = "eff.mass"; | |
1008 | indName[3] = "mass of #pi_{0}"; | |
1009 | indName[4] = "resolution of #pi_{0}"; | |
1010 | indName[5] = "chi^{2}/ndf"; | |
1011 | ||
1012 | TH1F *hout = new TH1F(indName[ind], indName[ind], itMax, 0.5, double(itMax)+0.5); | |
1013 | ||
1014 | TH1::AddDirectory(0); | |
1015 | Double_t content, error; | |
0fc11500 | 1016 | TList* col = (TList*)fEmcalPool->GetListOfFolders(); |
1017 | for(Int_t i=0; i<col->GetSize(); i++) { // cycle on EMCAL folders | |
1018 | AliEMCALFolder* folder = static_cast<AliEMCALFolder*>(col->At(i)); | |
16d3c94d | 1019 | if(folder==0) continue; |
1020 | it = folder->GetIterationNumber(); | |
1021 | ||
1022 | AliEMCALSuperModule* sm = folder->GetSuperModule(nsm); | |
1023 | if(sm==0) continue; | |
1024 | ||
1025 | TList* l = sm->GetHists(); | |
1026 | if(l==0) continue; | |
1027 | ||
1028 | TH1F *hin = (TH1F*)l->At(ind); | |
1029 | if(hin==0) continue; | |
1030 | ||
1031 | if(ind !=0 ) { | |
1032 | content = hin->GetMean(); | |
1033 | error = hin->GetRMS(); | |
1034 | } else { | |
1035 | sm->FitEffMassHist(); | |
1036 | TF1 *f = (TF1*)hin->GetListOfFunctions()->At(0); | |
1037 | content = error = -1.; | |
1038 | if(f) { | |
1039 | // content = f->GetParameter(1); | |
1040 | //error = f->GetParameter(2); | |
1041 | content = f->GetParameter(2); | |
1042 | error = f->GetParError(2); | |
1043 | } | |
1044 | } | |
1045 | ||
1046 | if(content > 0.0) { | |
1047 | hout->SetBinContent(it, content); | |
1048 | hout->SetBinError(it, error); | |
1049 | printf(" it %i content %f +/- %f \n", it, content, error); | |
1050 | } | |
1051 | } | |
1052 | ||
1053 | u::DrawHist(hout,2); | |
1054 | hout->SetMinimum(0.0); | |
1055 | ||
1056 | } | |
0fc11500 | 1057 | |
1058 | TH1F* AliEMCALRecPointsQaESDSelector::FitHistOfRecPointEnergy(const char *opt) | |
1059 | { | |
7227086e | 1060 | // Fit hist of rec.point energy |
0fc11500 | 1061 | TH1::AddDirectory(0); |
1062 | ||
7227086e | 1063 | TString sopt(opt); |
1064 | sopt.ToUpper(); | |
0fc11500 | 1065 | |
1066 | Int_t ind = 4, ind2 = 16; | |
1067 | if(GetKeyOptsValue(kIDEAL)) { | |
1068 | ind = 16; // Jul 12, 2007 | |
1069 | ind2 = 4; | |
1070 | } else if(GetKeyOptsValue(kCORR1)) { | |
1071 | ind = 18; | |
1072 | ind2 = 4; | |
1073 | } | |
1074 | TH1F *hold = (TH1F*)fLofHistsRP->At(ind), *h=0; | |
1075 | if(hold == 0) return 0; | |
1076 | if(hold->GetEntries() <10.) return hold; | |
1077 | ||
7227086e | 1078 | if(sopt.Contains("CLONE")) { |
0fc11500 | 1079 | TString newName(Form("C_%s",hold->GetName())); |
1080 | h = (TH1F*)hold->Clone(newName.Data()); | |
1081 | printf(" Clone hist %s -> |%s|%s| \n",hold->GetName(),h->GetName(),h->GetTitle()); | |
1082 | } else { | |
1083 | h = hold; | |
1084 | } | |
1085 | TH1F* h2 = (TH1F*)fLofHistsRP->At(ind2); | |
1086 | ||
1087 | Double_t xmax = h->GetXaxis()->GetXmax(), xmin = 0.4*xmax;; | |
1088 | TF1 *g = u::Gausi("fRecPointE", xmin, xmax, h); | |
1089 | g->SetLineColor(kRed); | |
1090 | gStyle->SetOptFit(111); | |
1091 | ||
1092 | h->Fit(g,"N","", xmin, xmax); | |
1093 | printf(" (1) xmin %f : xmax %f \n", xmin, xmax); | |
1094 | ||
1095 | xmin = g->GetParameter(1) - 4.*g->GetParameter(2); | |
1096 | xmax = g->GetParameter(1) + 4.*g->GetParameter(2); | |
1097 | h->Fit(g,"Q+","", xmin, xmax); | |
1098 | u::DrawHist(h2,1, 1, "same",2); | |
1099 | printf(" (2) xmin %f : xmax %f \n", xmin, xmax); | |
1100 | ||
1101 | return h; | |
1102 | } | |
1103 | ||
1104 | TCanvas *AliEMCALRecPointsQaESDSelector::Linearity(TList *l, int ifun) | |
7227086e | 1105 | { |
1106 | // Jul 10, 2007 | |
1107 | // Draw picture of EMCal linearity | |
0fc11500 | 1108 | if(l==0) { |
1109 | printf("<E> AliEMCALRecPointsQaESDSelector::Linearity :TList is zero ! Bye ! \n"); | |
1110 | return 0; | |
1111 | } | |
1112 | Double_t p[9]={0.5, 1., 3., 5., 10., 20., 30., 50., 100.}, ep[9]; | |
1113 | // see macro rHits.C ->defineSampleFraction | |
1114 | TH1F* hErecOverEin = new TH1F("hErecOverEin","Ratio E_{rec}/E_{#gamma} vs E_{#gamma}", 101,0.5,101.5); | |
1115 | // Fill hist | |
1116 | TArrayD invRat(9), eInvRat(9), erec(9),derec(9), residual(9); | |
1117 | TArrayD res(9), eres(9); // resolution | |
1118 | Int_t np=9; | |
1119 | for(Int_t var=0; var<9; var++){ | |
1120 | TH1F *h = (TH1F*)l->At(var); | |
1121 | TF1 *f = (TF1*)h->GetListOfFunctions()->At(0); | |
1122 | Double_t mean = f->GetParameter(1); | |
1123 | Double_t emean = f->GetParError(1); | |
1124 | ||
1125 | Int_t bin = hErecOverEin->FindBin(p[var]); | |
1126 | hErecOverEin->SetBinContent(bin, mean/p[var]); | |
1127 | hErecOverEin->SetBinError(bin, emean/p[var]); | |
1128 | // | |
1129 | invRat[var] = p[var]/mean; | |
1130 | eInvRat[var] = emean/p[var]*invRat[var]; | |
1131 | erec[var] = mean; | |
1132 | derec[var] = emean; | |
1133 | // Resolution in % | |
1134 | res[var] = 100.*f->GetParameter(2)/p[var]; | |
1135 | eres[var] = 100.*f->GetParError(2)/p[var]; | |
1136 | ep[var] = 0.0; | |
1137 | } | |
1138 | ||
1139 | TCanvas *c = new TCanvas("Linearity","Linearity", 20,20, 700, 500); | |
1140 | gStyle->SetOptStat(0); | |
1141 | if(0) { // E(rec) / E(gamma) | |
1142 | u::DrawHist(hErecOverEin,2); | |
1143 | hErecOverEin->SetMinimum(0.984); | |
1144 | hErecOverEin->SetMaximum(1.001); | |
1145 | } | |
1146 | Int_t markerColor=1; | |
1147 | char *fun="", *optFit=""; | |
1148 | TF1 *f = 0; | |
1149 | if(0) { | |
1150 | if(ifun==-5) { | |
1151 | fun = "fun5"; optFit="R+"; | |
1152 | f = new TF1(fun,"([0]*(x-7.5)*(x-7.5))*exp([1]+[2]*x+[3]*x*x)+1.", 0.0, 100.); | |
1153 | f->FixParameter(0, 1.95380e-05); | |
1154 | // f->SetParameter(0, 1.95380e-05); | |
1155 | // f->SetParameter(1, 1.0); | |
1156 | } else if(ifun==-4) { | |
1157 | fun = "fun4"; optFit="R+"; | |
1158 | f = new TF1(fun,"([0]*(x-7.5)*(x-7.5))*([1]+[2]*abs(x)+[3]*(x-[4])*(x-[4]))+1.", 0.0, 100.); | |
1159 | f->FixParameter(0, 1.95380e-05); | |
1160 | f->SetParameter(4, 50.); | |
1161 | // f = new TF1(fun,"exp(([0]+[1]*x)*(x-[2])*(x-[3]))", 0.0, 100.); | |
1162 | //f = new TF1(fun,"([0]+[1]*x)*(x-[2])*(x-[3])", 0.0, 100.); | |
1163 | //f->SetParameter(0, 1.); | |
1164 | //f->SetParameter(1, 1.); | |
1165 | ||
1166 | // f->SetParameter(2, 5.); | |
1167 | //f->SetParLimits(2, 3.,8.); | |
1168 | //f->SetParameter(3, 10.); | |
1169 | //f->SetParLimits(3, 9.,15.); | |
1170 | //f->SetParameter(2, 2.e-4); | |
1171 | } else if(ifun==-3) { | |
1172 | fun = "fun3"; optFit="R+"; | |
1173 | f = new TF1(fun,"[0]+[1]*x+[2]*x*x+[3]*x*x*x", 0.0, 11.); | |
1174 | } else if(ifun==-2) { | |
1175 | fun = "fun2"; optFit="R+"; | |
1176 | ||
1177 | /* | |
1178 | f = new TF1(fun,"[0]*(x-7.5)+[1]*(x-7.5)*(x-7.5)+[2]", 0.0, 10.1); | |
1179 | f->SetParameter(0, 5.98727e-04); | |
1180 | f->SetParameter(1, 2.12045e-04); | |
1181 | f->SetParameter(2, 1.); | |
1182 | */ | |
1183 | f = new TF1(fun,"[0]+[1]*x+[2]*x*x", 9.0, 100.1); | |
1184 | } else if(ifun==-1) { | |
1185 | fun = "fun0"; optFit="R+"; | |
1186 | f = new TF1(fun,"[0]", 0.0, 100.1); | |
1187 | } else if(ifun>=2) { | |
1188 | fun = Form("pol%i",ifun); | |
1189 | optFit="+"; | |
1190 | } | |
1191 | TGraphErrors *gr = u::DrawGraphErrors(np, erec.GetArray(),invRat.GetArray(),derec.GetArray(),eInvRat.GetArray(), | |
1192 | // markerColor,21+markerColor,"AP", " Ratio E_{#gamma}/E_{Rec} ", "E_{Rec} "," E_{#gamma}/E_{Rec}", | |
1193 | markerColor,21+markerColor,"AP", " Ratio E_{#gamma}/E_{Rec}^{corr} ", "E_{Rec}^{corr} "," E_{#gamma}/E_{Rec}^{corr}", | |
1194 | ifun, optFit, fun); | |
1195 | gr->GetHistogram()->SetAxisRange(0.0,100.); | |
1196 | // double xmi=0.999, xma=1.017; | |
1197 | double xmi=0.995, xma=1.005; | |
1198 | gr->GetHistogram()->SetMaximum(xma); | |
1199 | gr->GetHistogram()->SetMinimum(xmi); | |
1200 | gr->GetHistogram()->SetTitleOffset(1.4,"y"); | |
1201 | if(ifun==0) { | |
1202 | f = new TF1("fres", "AliEMCALHistoUtilities::EnergyCorrectionForGamma_1(x)", 0., 101.); | |
1203 | f->Draw("same"); | |
1204 | } | |
1205 | } | |
1206 | TLine *line = new TLine(0.0,1.0, 100.,1.0); | |
1207 | line->Draw(); | |
1208 | ||
1209 | if(0) { | |
1210 | c->Clear(); | |
1211 | for(int i=0; i<9; i++) { | |
1212 | residual[i] = 100.*(invRat[i] - u::GetCorrectionCoefficientForGamma_1(erec[i])); // in percent | |
1213 | printf(" erec %f : residual %5.3f \n", erec[i], residual[i]); | |
1214 | } | |
1215 | markerColor = 2; | |
1216 | TGraphErrors *gr2=u::DrawGraphErrors(np, erec.GetArray(),residual.GetArray(),derec.GetArray(),eInvRat.GetArray(), | |
1217 | markerColor,21+markerColor,"AP"," residual in %, rec.point level", "E_{Rec} "," residual in %", | |
1218 | -1, "", 0); | |
1219 | gr2->GetHistogram()->SetAxisRange(0.0,100.); | |
1220 | gr2->GetHistogram()->SetMaximum(0.2); | |
1221 | gr2->GetHistogram()->SetMinimum(-0.1); | |
1222 | line = new TLine(0.0,0.0, 101.,0.0); | |
1223 | line->Draw(); | |
1224 | TLatex *lat = u::Lat("linearity better 0.2% after correction",20., 0.15, 12, 0.06, 1); | |
1225 | if(lat); | |
1226 | } | |
1227 | if(1) { | |
1228 | TString latexName; | |
1229 | c->Clear(); | |
1230 | gStyle->SetOptFit(111); | |
1231 | markerColor = 1; | |
1232 | ifun = -11; | |
1233 | f = u::GetResolutionFunction("FRES2", latexName); | |
1234 | f->SetNpx(10000); | |
1235 | f->SetLineColor(kBlack); | |
1236 | ||
1237 | TGraphErrors *gr3=u::DrawGraphErrors(np, p,res.GetArray(), ep, eres.GetArray(), | |
1238 | markerColor,21+markerColor,"AP"," resolution in %, rec.point level","E_{#gamma} "," resolution in %", | |
1239 | ifun, "+", f->GetName()); | |
1240 | gr3->GetHistogram()->SetAxisRange(0.0,101.); | |
1241 | gr3->GetHistogram()->SetMaximum(14.); | |
1242 | gr3->GetHistogram()->SetMinimum(0.0); | |
1243 | gr3->SetMarkerSize(1.5); | |
1244 | ||
1245 | TLatex *lat = u::Lat(latexName.Data(),82., 11., 12, 0.06, 1); | |
1246 | if(lat); | |
1247 | // Exp. data | |
1248 | TF1 *fexp = new TF1(*f); | |
1249 | fexp->SetName("fexp"); | |
1250 | fexp->SetParameter(0, 2.168); | |
1251 | fexp->SetParameter(1, 8.818); | |
1252 | fexp->SetLineWidth(1); | |
1253 | fexp->SetLineColor(kRed); | |
1254 | fexp->SetLineStyle(1); | |
1255 | fexp->Draw("same"); | |
1256 | ||
1257 | TLegend *leg = new TLegend(0.21,0.36, 0.68,0.82); | |
1258 | leg->AddEntry(gr3, "MC data", "P"); | |
1259 | leg->AddEntry(f, "fit of MC data", "L"); | |
1260 | TLegendEntry *ent3 = leg->AddEntry(fexp, "#splitline{fit of exp.data}{FNAL, Nov 2005}", "L"); | |
1261 | ent3->SetTextColor(fexp->GetLineColor()); | |
1262 | leg->Draw(); | |
1263 | } | |
1264 | c->Update(); | |
1265 | ||
1266 | return c; | |
1267 | } | |
1268 | ||
1269 | TCanvas *AliEMCALRecPointsQaESDSelector::DrawKineVsRP(TList *l) | |
7227086e | 1270 | { |
1271 | //Jul 25, 2007 | |
0fc11500 | 1272 | if(l==0) { |
1273 | printf("<W> AliEMCALRecPointsQaESDSelector::DrawKineVsRP : TList is zero ! \n"); | |
1274 | return 0; | |
1275 | } | |
1276 | TCanvas *c = new TCanvas("KineVsRP","KineVsRP", 20,20, 700, 500); | |
1277 | gStyle->SetOptStat(1110); | |
1278 | c->Divide(2,2); | |
1279 | ||
1280 | c->cd(1); | |
1281 | TH1F* h1 = (TH1F*)l->At(10); | |
1282 | u::DrawHist(h1,2); | |
1283 | ||
1284 | c->cd(2); | |
1285 | TH1F* h2 = (TH1F*)l->At(11); | |
1286 | u::DrawHist(h2,2); | |
1287 | ||
1288 | c->cd(3); | |
1289 | TH1F* h3 = (TH1F*)l->At(12); | |
1290 | u::DrawHist(h3,2); | |
1291 | u::DrawHist((TH1F*)l->At(14), 1,kRed,"same"); | |
1292 | u::DrawHist((TH1F*)l->At(15), 1,kGreen,"same"); | |
1293 | ||
1294 | c->cd(4); | |
1295 | TH1F* h4 = (TH1F*)l->At(13); | |
1296 | u::DrawHist(h4, 2); | |
1297 | u::DrawHist((TH1F*)l->At(16), 1,kRed,"same"); | |
1298 | u::DrawHist((TH1F*)l->At(17), 1,kGreen,"same"); | |
1299 | ||
1300 | /* | |
1301 | TH1F* h2 = (TH1F*)l->At(11); | |
1302 | u::DrawHist(h2,2); | |
1303 | */ | |
1304 | ||
1305 | c->Update(); | |
1306 | return c; | |
1307 | } | |
1308 | ||
1309 | TCanvas* AliEMCALRecPointsQaESDSelector::DrawMeanVsLog(TH2F *h2) | |
1310 | { | |
1311 | // h - input histogramm : mean vds log coordinates | |
1312 | if(h2==0) return 0; | |
1313 | ||
1314 | TCanvas *c = new TCanvas("KineVsRP","KineVsRP", 20,20, 700, 500); | |
1315 | ||
1316 | TH1F *hid1 = new TH1F("h1","h1 title ", h2->GetNbinsX(), | |
1317 | h2->GetXaxis()->GetXmin(), h2->GetXaxis()->GetXmax()); | |
1318 | ||
1319 | gROOT->cd(); | |
1320 | TH1::AddDirectory(1); | |
1321 | TString newName; | |
1322 | for(int ix=1; ix<=h2->GetNbinsX();ix++) { | |
1323 | newName = "hd_"; newName += ix; | |
1324 | TH1D *hd = h2->ProjectionY(newName.Data(),ix,ix); | |
1325 | if(hd->Integral()>=4.) { | |
1326 | // lhd->Add(hd); | |
1327 | hid1->SetBinContent(ix, hd->GetMean()); | |
1328 | hid1->SetBinError(ix, hd->GetRMS()); | |
1329 | } | |
1330 | } | |
1331 | TF1 *f1 = new TF1("fcg", "0.5*TMath::SinH(x/[0])/TMath::SinH(0.5/[0])", -0.5, 0.5); | |
1332 | f1->SetParameter(0,0.13); | |
1333 | f1->SetLineColor(kRed); | |
1334 | f1->SetLineWidth(1); | |
1335 | ||
1336 | gStyle->SetOptStat(0); | |
1337 | gStyle->SetOptFit(111); | |
1338 | hid1->Fit(f1,"R+"); | |
1339 | ||
1340 | u::DrawHist(hid1,2); | |
1341 | ||
1342 | //u::DrawHist(h2,2); | |
1343 | ||
1344 | c->Update(); | |
1345 | return c; | |
1346 | } | |
1347 | ||
1348 | TCanvas* AliEMCALRecPointsQaESDSelector::DrawPhiEtaAnglesDistribution(const char* gn) | |
1349 | { | |
1350 | // Aug 6, 2007 | |
1351 | // Proper geometry should be defined already | |
1352 | // dTheta distibution has two peaks which coresponding different cells inside module ! | |
1353 | ||
1354 | TCanvas *c = new TCanvas("Geometry","Geometry", 20,20, 700, 500); | |
1355 | c->Divide(2,2); | |
1356 | ||
7227086e | 1357 | if(fgEmcalGeo==0) fgEmcalGeo = AliEMCALGeometry::GetInstance(gn); |
0fc11500 | 1358 | |
1359 | gROOT->cd(); | |
1360 | TH1::AddDirectory(1); | |
1361 | TH1F *hDtheta = new TH1F("hDtheta","#Delta#theta in one SM", 60, -2.0, +1.0); // in degree | |
1362 | TH2F *hDtheta2 = new TH2F("hDtheta2","#Delta#theta vs iEta of cell", 48, -0.5, 47.5, 60,-2.0,+1.0); | |
1363 | ||
1364 | TH1F *hDphi = new TH1F("hDphi","#Delta#ph in one SM", 2000, -10.0, +10.0); // in degree | |
1365 | ||
1366 | TVector3 vg3; | |
1367 | AliEMCALCellInfo* t = GetCellsInfo(); | |
1368 | Double_t thetaCell=0., thetaModule=0.; | |
1369 | Double_t phiCell=0., dphi=0.; | |
1370 | ||
1371 | for(int absid=0; absid<12*24*4; absid++){ | |
1372 | cellInfo *r = t->GetTable(absid); | |
7227086e | 1373 | fgEmcalGeo->GetGlobal(absid, vg3); |
0fc11500 | 1374 | |
1375 | thetaCell = vg3.Theta()*TMath::RadToDeg(); | |
1376 | thetaModule = 90. - 1.5*r->iEtam; | |
1377 | hDtheta->Fill(thetaCell - thetaModule); | |
1378 | hDtheta2->Fill(double(r->iEta), thetaCell - thetaModule); | |
1379 | ||
1380 | phiCell = vg3.Phi()*TMath::RadToDeg(); | |
1381 | dphi = phiCell - 90.; | |
1382 | hDphi->Fill(dphi); | |
1383 | } | |
1384 | ||
1385 | c->cd(1); | |
1386 | u::DrawHist(hDtheta,2); | |
1387 | c->cd(2); | |
1388 | u::DrawHist(hDtheta2,2); | |
1389 | c->cd(3); | |
1390 | u::DrawHist(hDphi,2); | |
1391 | ||
1392 | c->Update(); | |
1393 | return c; | |
1394 | } | |
1395 | ||
1396 | TCanvas* AliEMCALRecPointsQaESDSelector::DrawDeffVsEnergy() | |
1397 | { | |
1398 | // Aug 31, 2007 - obsolete | |
1399 | Double_t p[]={0.5, 1.0, 3., 5., 10., 20.,30.,50.,100.}; | |
1400 | Double_t ep[]={0., 0., 0., 0., 0., 0., 0., 0., 0.}; | |
1401 | // 2 pars | |
1402 | Double_t deff[]={9.07515, 10.0835, 11.2032, 11.4229, 12.3578, 13.0332, 13.3281, 13.7910, 14.3319}; | |
1403 | Double_t edeff[]={2.69645e-03, 3.52180e-03, 4.19236e-02, 1.21201e-01, 1.58886e-01, 3.96680e-01, 3.29985e-02, 1.17113e-01, 5.22763e-01}; | |
1404 | // | |
1405 | Double_t w0[]={3.44679e+00, 3.82714e+00, 4.15035e+0, 4.36650e+00, 4.51511e+00, 4.65590, 4.63289e+00, 4.66568, 4.68125}; | |
1406 | Double_t ew0[]={7.58982e-01, 1.26420e-02, 2.36129e-10, 1.21201e-01, 2.12999e-01, 7.95650e-02, 6.15307e-03, 1.88803e-01, 5.18022e-05}; | |
1407 | int np=sizeof(p)/sizeof(Double_t); | |
1408 | printf("<I> AliEMCALRecPointsQaESDSelector::DrawDeffVsEnergy() | np %i \n", np); | |
1409 | ||
1410 | TCanvas *c = new TCanvas("Deff","Deff", 20,20, 700, 500); | |
1411 | c->Divide(2,1); | |
1412 | ||
1413 | Int_t markerColor=1; | |
1414 | c->cd(1); | |
1415 | TF1 *fdeff= new TF1("fdeff","[0]+[1]*log(x)",0.4, 100.4); | |
1416 | if(fdeff); | |
1417 | TGraphErrors *gr = u::DrawGraphErrors(np, p,deff, ep, edeff, | |
1418 | markerColor,21+markerColor,"AP"," D_{eff} vs E_{#gamma} ","E_{#gamma} "," D_{eff} in cm ", | |
1419 | -1, "", 0); | |
1420 | // -1, "+", fdeff->GetName()); | |
1421 | gr->GetHistogram()->SetMaximum(15.); | |
1422 | gPad->SetLogx(1); | |
1423 | ||
1424 | c->cd(2); | |
1425 | TGraphErrors *gr2 = u::DrawGraphErrors(np, p,w0, ep, ew0, | |
1426 | markerColor,21+markerColor,"AP"," w_{0} vs E_{#gamma} ","E_{#gamma} "," w_{0} ", | |
1427 | -1, "", 0); | |
1428 | ||
1429 | gr2->GetHistogram()->SetMaximum(5.); | |
1430 | gPad->SetLogx(1); | |
1431 | ||
1432 | c->Update(); | |
1433 | return c; | |
1434 | } | |
1435 | ||
1436 | TCanvas* AliEMCALRecPointsQaESDSelector::DrawDeffVsEnergy2(const char *opt) | |
1437 | { | |
1438 | // Aug 28, 2008 - read pars and pars errors from files | |
1439 | Double_t p[]={0.5, 1.0, 3., 5., 10., 20.,30.,50.,100.}; | |
1440 | Double_t ep[]={0., 0., 0., 0., 0., 0., 0., 0., 0.}; | |
1441 | // 2 pars | |
1442 | Double_t deff[9], edeff[9], w0[9], ew0[9]; // max size now | |
7227086e | 1443 | TString sopt(opt); |
0fc11500 | 1444 | |
1445 | int np = sizeof(p)/sizeof(Double_t); | |
1446 | printf("<I> AliEMCALRecPointsQaESDSelector::DrawDeffVsEnergy2() | np %i \n", np); | |
1447 | ReadParsDeffAndW0("/data/r22b/ALICE/CALIB/FIT/", deff, edeff, w0, ew0, 1); | |
1448 | ||
1449 | TCanvas *c = new TCanvas("Deff","Deff", 20,20, 700, 500); | |
1450 | c->Divide(2,1); | |
1451 | ||
1452 | TF1 *fdeff = 0, *fw0 = 0; | |
1453 | TString optFit(""), funName(""); | |
7227086e | 1454 | if(sopt.Contains("fit1")) { |
0fc11500 | 1455 | fdeff= new TF1("fdeff","[0]+[1]*log(x)",0.1, 101.); |
1456 | fdeff->SetLineColor(kRed); | |
1457 | fdeff->SetLineWidth(1); | |
1458 | ||
1459 | /* good description - "[0]/(1.+exp([1]*x))" | |
1460 | 1 p0 4.82208e+00 9.93617e-04 -0.00000e+00 7.16648e-06 | |
1461 | 2 p1 -7.79655e-01 4.07500e-03 -0.00000e+00 2.01009e-03 | |
1462 | better description - "[0]/(1.+exp([1]*(x-[2])))" (like the Woods-Saxon potential) | |
1463 | 1 p0 4.83713e+00 1.00437e-03 -6.98984e-10 4.90371e-07 | |
1464 | 2 p1 -2.77970e-01 3.35587e-03 -1.79239e-09 2.67312e-07 | |
1465 | 3 p2 4.41116e+00 8.72191e-02 1.82791e-04 1.55643e-05 | |
1466 | */ | |
1467 | fw0= new TF1("fw0","[0]/(1.+exp([1]*(x+[2])))",0.1, 101.); | |
1468 | fw0->SetLineColor(kRed); | |
1469 | fw0->SetLineWidth(1); | |
1470 | fw0->SetParameter(0, 4.8); | |
1471 | fw0->SetParameter(1, -2.77970e-01); | |
1472 | fw0->SetParameter(2, 4.41116); | |
1473 | optFit = "+"; | |
1474 | } | |
1475 | if(fdeff) funName = fdeff->GetName(); | |
1476 | ||
1477 | Int_t markerColor=1; | |
1478 | c->cd(1); | |
1479 | gStyle->SetOptFit(111); | |
1480 | TGraphErrors *gr = u::DrawGraphErrors(np, p,deff, ep, edeff, | |
1481 | markerColor,21+markerColor,"AP"," D_{eff} vs E_{#gamma} ","E_{#gamma} "," D_{eff} in cm ", | |
1482 | -1, optFit.Data(), funName.Data()); | |
1483 | gr->GetHistogram()->SetMaximum(15.); | |
1484 | gPad->SetLogx(1); | |
1485 | TLegend *leg1 = new TLegend(0.12,0.76, 0.70,0.90); | |
1486 | TLegendEntry *le1 = leg1->AddEntry(fdeff, Form("%s",fdeff->GetTitle()), "lp"); | |
1487 | //TLegendEntry *le1 = leg1->AddEntry(fdeff, Form("%4.2f+%4.2f*log(E_{#gamma})", | |
1488 | //fdeff->GetParameter(0),fdeff->GetParameter(1)), "lp"); | |
1489 | le1->SetTextColor(fdeff->GetLineColor()); | |
1490 | leg1->Draw(); | |
1491 | ||
1492 | c->cd(2); | |
1493 | gStyle->SetOptFit(111); | |
1494 | if(fw0) funName = fw0->GetName(); | |
1495 | TGraphErrors *gr2 = u::DrawGraphErrors(np, p,w0, ep, ew0, | |
1496 | markerColor,21+markerColor,"AP"," w_{0} vs E_{#gamma} ","E_{#gamma} "," w_{0} ", | |
1497 | -1, optFit.Data(), funName.Data()); | |
1498 | ||
1499 | gr2->GetHistogram()->SetMaximum(5.); | |
1500 | ||
1501 | TLegend *leg2 = new TLegend(0.17,0.6, 0.99,0.72); | |
1502 | TLegendEntry *le2 = leg2->AddEntry(fw0, Form("%s",fw0->GetTitle()), "lp"); | |
1503 | //TLegendEntry *le2 = leg2->AddEntry(fw0, Form("#frac{%4.2f}{1.+exp(%4.2f*(x+%4.2f)}", | |
1504 | //fw0->GetParameter(0),fw0->GetParameter(1),fw0->GetParameter(2)), "lp"); | |
1505 | le2->SetTextColor(fw0->GetLineColor()); | |
1506 | leg2->Draw(); | |
1507 | //gPad->SetLogx(1); | |
1508 | ||
1509 | c->Update(); | |
1510 | return c; | |
1511 | } | |
1512 | ||
1513 | void AliEMCALRecPointsQaESDSelector::ReadParsDeffAndW0 | |
1514 | (const char *dirName, double *deff, double *edeff, double *w0, double *ew0, const Int_t pri) | |
1515 | { | |
7227086e | 1516 | // read pars and W0 |
0fc11500 | 1517 | int strategy = 0, itmp=0; |
1518 | char line[100]; | |
1519 | for(int var=11; var<=19; var++){ | |
1520 | int ind = var -11; | |
1521 | ifstream fin; | |
1522 | TString fname = Form("%s/fitVar%iStrategy%i.txt", dirName, var, strategy); | |
1523 | //printf(" open file %s \n", fname.Data()); | |
1524 | fin.open(fname.Data()); | |
1525 | ||
1526 | for(int i=1; i<=2; i++) { // skip to lines | |
1527 | fin.getline(line,100).eof(); | |
1528 | if(pri>=2) printf("%s \n", line); | |
1529 | } | |
1530 | ||
1531 | fin >> itmp >> deff[ind] >> edeff[ind]; | |
1532 | fin >> itmp >> w0[ind] >> ew0[ind]; | |
1533 | if(pri>=1) | |
1534 | printf(" %i def %f+/-%f : def %f+/-%f\n", ind, deff[ind],edeff[ind],w0[ind],ew0[ind]); | |
1535 | fin.getline(line,100).eof(); // skip last line | |
1536 | fin.close(); | |
1537 | } | |
1538 | } | |
1539 | ||
1540 | TCanvas* AliEMCALRecPointsQaESDSelector::DrawSpaceResolution() | |
1541 | { | |
1542 | // Sep 4, 2007; | |
1543 | // Space resolution vs optimised space resolution | |
1544 | Double_t p[]={0.5, 1.0, 3., 5., 10., 20.,30.,50.,100.}; | |
1545 | Double_t ep[]={0., 0., 0., 0., 0., 0., 0., 0., 0.}; | |
1546 | Double_t spAng[]={0.1877, 0.1351, 0.08144, 0.06331, 0.05384, 0.04876, 0.04706, 0.04656, 0.04726}; | |
1547 | Double_t rmsSpAng[]={0.1033, 0.07685, 0.05235, 0.03992, 0.04012, 0.04257, 0.03472, 0.02814, 0.02784}; | |
1548 | Double_t spAngOpt[]={0.1733, 0.1311, 0.07961, 0.06401, 0.05347, 0.04618, 0.04288, 0.04, 0.03802}; | |
1549 | Double_t rmsSpAngOpt[]={0.09476, 0.07472, 0.05011, 0.04242, 0.04075, 0.04304, 0.03545, 0.02744, 0.02593}; | |
1550 | ||
1551 | int np=sizeof(p)/sizeof(Double_t); | |
1552 | printf("<I> AliEMCALRecPointsQaESDSelector::DrawSpaceResolution() | np %i \n", np); | |
1553 | ||
1554 | Double_t* eSpAng = new Double_t[np]; | |
1555 | Double_t* eSpAngOpt = new Double_t[np]; | |
7227086e | 1556 | Double_t cc=TMath::Sqrt(8000.), cc2 = 1000.*TMath::DegToRad(); |
0fc11500 | 1557 | for(int i=0; i<np; i++){ |
7227086e | 1558 | spAng[i] *= cc2; |
1559 | rmsSpAng[i] *= cc2; | |
1560 | spAngOpt[i] *= cc2; | |
1561 | rmsSpAngOpt[i] *= cc2; | |
0fc11500 | 1562 | |
7227086e | 1563 | eSpAng[i] = spAng[i]/cc; |
1564 | eSpAngOpt[i] = spAngOpt[i]/cc; | |
0fc11500 | 1565 | } |
1566 | ||
1567 | TCanvas *c = new TCanvas("Deff","Deff", 20,20, 700, 500); | |
1568 | //c->Divide(2,1); | |
1569 | ||
1570 | c->cd(1); | |
1571 | gStyle->SetOptFit(111); | |
1572 | ||
1573 | TGraphErrors *gr = u::DrawGraphErrors(np, p,spAng, ep, eSpAng, | |
1574 | kBlack, 21,"AP","Angle resolution (mrad) vs E_{#gamma} ","E_{#gamma} "," anlgle resolution (mrad) ", | |
1575 | -1, "", 0); | |
1576 | gr->GetHistogram()->SetMaximum(4.); | |
1577 | gr->GetHistogram()->SetMinimum(0.6); | |
1578 | gPad->SetLogx(1); | |
1579 | gPad->SetLogy(1); | |
1580 | ||
1581 | TF1 *fang = new TF1("fang","[0]+[1]/sqrt(x)",0.1, 101.); | |
1582 | fang->SetLineColor(kRed); | |
1583 | fang->SetLineWidth(1); | |
1584 | ||
1585 | TGraphErrors *gr2 = u::DrawGraphErrors(np, p,spAngOpt, ep, eSpAngOpt, | |
1586 | kRed,22,"P"," space vs E_{#gamma} ","E_{#gamma} "," anlgle resolution (mrad) ", | |
1587 | -1, "+", fang->GetName()); | |
1588 | TLegend *leg1 = new TLegend(0.40,0.57, 0.92,0.87); | |
1589 | TLegendEntry *le1 = leg1->AddEntry(gr, "Initial angle resolution", "p"); | |
1590 | le1->SetTextColor(gr->GetLineColor()); | |
1591 | ||
1592 | TLegendEntry *le2 = leg1->AddEntry(gr2, "Optimized angle resolution", "p"); | |
1593 | le2->SetTextColor(gr2->GetLineColor()); | |
1594 | ||
1595 | TLegendEntry *le3 = leg1->AddEntry(fang, | |
1596 | Form("%3.2f+#frac{%4.2f}{#sqrt{E}}",fang->GetParameter(0),fang->GetParameter(1)), "lp"); | |
1597 | le3->SetTextColor(fang->GetLineColor()); | |
1598 | ||
1599 | leg1->Draw(); | |
1600 | ||
1601 | c->Update(); | |
1602 | ||
1603 | return c; | |
1604 | } | |
1605 | ||
1606 | void AliEMCALRecPointsQaESDSelector::ResetAllListOfHists() | |
1607 | { | |
7227086e | 1608 | // Reset all list of hits |
0fc11500 | 1609 | u::ResetListOfHists(fLofHistsPC); |
1610 | u::ResetListOfHists(fLofHistsRP); | |
1611 | u::ResetListOfHists(fLKineVsRP); | |
1612 | u::ResetListOfHists(fLShowerProfile); | |
1613 | } | |
1614 | ||
1615 | void AliEMCALRecPointsQaESDSelector::ReloadChain(Long64_t entry) | |
7227086e | 1616 | { |
1617 | // Oct 14, 2007 - unused now | |
0fc11500 | 1618 | if(fChain) { |
1619 | fChain->LoadTree(entry); | |
1620 | } | |
1621 | } | |
1622 | ||
1623 | void AliEMCALRecPointsQaESDSelector::GetInitialParsForFit(const Int_t var, Double_t &deff, Double_t &w0, Double_t &phislope, const int phiCase) | |
1624 | { | |
1625 | // int phiCase=0; // 0 or 1 | |
1626 | phislope = 0.001; | |
1627 | if(var==11) { // stay here | |
1628 | deff = 9.07515; | |
1629 | w0 = 3.44679; | |
1630 | } else if(var==12) { | |
1631 | deff = 1.00835e+01; | |
1632 | w0 = 3.82714e+00; | |
1633 | } else if(var==13) { | |
1634 | deff = 1.12032e+01; | |
1635 | w0 = 4.15035e+00; | |
1636 | } else if(var==14) { | |
1637 | deff = 1.14229e+01; | |
1638 | w0 = 4.36650; | |
1639 | } else if(var==15) { | |
1640 | deff = 1.21361e+01; | |
1641 | w0 = 4.72875; | |
1642 | } else if(var==16) { | |
1643 | deff = 1.28096e+01; | |
1644 | w0 = 4.81753e+00; | |
1645 | } else if(var==17) { | |
1646 | deff = 1.33281e+01; | |
1647 | w0 = 4.63289e+00; | |
1648 | } else if(var==18) { | |
1649 | deff = 1.37910e+01; | |
1650 | w0 = 4.66568; | |
1651 | } else if(var==19) {// Aug 15, 2007 | |
1652 | switch (phiCase) { | |
1653 | case 0: // phislope was defined than deff and w0 were fixed | |
1654 | deff = 1.43319e+01; | |
1655 | w0 = 4.69279; | |
1656 | phislope = 2.41419e-04; | |
1657 | break; | |
1658 | case 1: // all parameters free | |
1659 | deff = 1.46327e+01; | |
1660 | w0 = 4.68125; | |
1661 | phislope = 8.95559e-04; | |
1662 | break; | |
1663 | } | |
1664 | } else { | |
1665 | printf("<E> var % i -> no definition ! \n", var); | |
1666 | assert(0); | |
1667 | } | |
1668 | printf("<I> AliEMCALRecPointsQaESDSelector::GetInitialParForFit()\n deff %f w0 %f phislope %f \n", | |
1669 | deff,w0, phislope); | |
1670 | } |