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