2 // Wagon contacts: EMCAL Gustavo.Conesa.Balbastre@cern.ch
3 // PHOS Yuri.Kharlov@cern.ch
5 AliAnalysisTaskParticleCorrelation *AddTaskCalorimeterQA(TString data, Bool_t kPrintSettings = kFALSE,Bool_t kSimulation = kFALSE,TString outputFile = "", Bool_t oldAOD=kFALSE)
7 // Creates a PartCorr task for calorimeters performance studies, configures it and adds it to the analysis manager.
9 // Get the pointer to the existing analysis manager via the static access method.
10 //==============================================================================
11 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
13 ::Error("AddTaskPartCorr", "No analysis manager to connect to.");
17 // Check the analysis type using the event handlers connected to the analysis manager.
18 //==============================================================================
19 if (!mgr->GetInputEventHandler()) {
20 ::Error("AddTaskPartCorr", "This task requires an input event handler");
23 TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
25 Bool_t kUseKinematics = (mgr->GetMCtruthEventHandler())?kTRUE:kFALSE;
27 cout<<"********* ACCESS KINE? "<<kUseKinematics<<endl;
30 //===========================================================================
33 //For this particular analysis few things done by the reader.
34 //Nothing else needs to be set.
35 AliCaloTrackReader * reader = 0x0;
36 if (data=="AOD") reader = new AliCaloTrackAODReader();
37 else if(data=="ESD") reader = new AliCaloTrackESDReader();
38 //reader->SetDebug(10);//10 for lots of messages
39 reader->SwitchOnEMCALCells();
40 reader->SwitchOnPHOSCells();
41 reader->SwitchOnEMCAL();
42 reader->SwitchOnPHOS();
43 reader->SwitchOnCTS();
44 reader->SetEMCALPtMin(0.);
45 reader->SetPHOSPtMin (0.);
46 reader->SetCTSPtMin (0.);
47 reader->SetZvertexCut(10.);
50 if(inputDataType == "ESD"){
51 reader->SwitchOnStack();
52 reader->SwitchOffAODMCParticles();
54 else if(inputDataType == "AOD"){
55 reader->SwitchOffStack();
56 reader->SwitchOnAODMCParticles();
59 //if(!kSimulation) reader->SetFiredTriggerClassName("CINT1B-ABCE-NOPF-ALL");
60 reader->SetDeltaAODFileName(""); //Do not create deltaAOD file, this analysis do not create branches.
61 reader->SwitchOffWriteDeltaAOD() ;
62 if(oldAOD) reader->SwitchOnOldAODs();
63 if(kPrintSettings) reader->Print("");
65 // *** Calorimeters Utils ***
66 AliCalorimeterUtils *cu = new AliCalorimeterUtils;
67 // Remove clusters close to borders, at least max energy cell is 1 cell away
68 cu->SetNumberOfCellsFromEMCALBorder(1);
69 cu->SetNumberOfCellsFromPHOSBorder(2);
70 cu->SetEMCALGeometryName("EMCAL_COMPLETEV1");
71 // Remove EMCAL hottest channels for first LHC10 periods
72 //cu->SwitchOnBadChannelsRemoval();
74 //cu->SetEMCALChannelStatus(0,3,13); cu->SetEMCALChannelStatus(0,44,1); cu->SetEMCALChannelStatus(0,3,13);
75 //cu->SetEMCALChannelStatus(0,20,7); cu->SetEMCALChannelStatus(0,38,2);
77 //cu->SetEMCALChannelStatus(1,4,7); cu->SetEMCALChannelStatus(1,4,13); cu->SetEMCALChannelStatus(1,9,20);
78 //cu->SetEMCALChannelStatus(1,14,15); cu->SetEMCALChannelStatus(1,23,16); cu->SetEMCALChannelStatus(1,32,23);
79 //cu->SetEMCALChannelStatus(1,37,5); cu->SetEMCALChannelStatus(1,40,1); cu->SetEMCALChannelStatus(1,40,2);
80 //cu->SetEMCALChannelStatus(1,40,5); cu->SetEMCALChannelStatus(1,41,0); cu->SetEMCALChannelStatus(1,41,1);
81 //cu->SetEMCALChannelStatus(1,41,2); cu->SetEMCALChannelStatus(1,41,4);
83 //cu->SetEMCALChannelStatus(2,14,15); cu->SetEMCALChannelStatus(2,18,16); cu->SetEMCALChannelStatus(2,18,17);
84 //cu->SetEMCALChannelStatus(2,18,18); cu->SetEMCALChannelStatus(2,18,20); cu->SetEMCALChannelStatus(2,18,21);
85 //cu->SetEMCALChannelStatus(2,18,23); cu->SetEMCALChannelStatus(2,19,16); cu->SetEMCALChannelStatus(2,19,17);
86 //cu->SetEMCALChannelStatus(2,19,19); cu->SetEMCALChannelStatus(2,19,20); cu->SetEMCALChannelStatus(2,19,21);
87 //cu->SetEMCALChannelStatus(2,19,22);
89 //cu->SetEMCALChannelStatus(3,4,7);
92 //cu->SwitchOnRecalibration();
93 //TFile * f = new TFile("RecalibrationFactors.root","read");
94 //cu->SetEMCALChannelRecalibrationFactors(0,(TH2F*)f->Get("EMCALRecalFactors_SM0"));
95 //cu->SetEMCALChannelRecalibrationFactors(1,(TH2F*)f->Get("EMCALRecalFactors_SM1"));
96 //cu->SetEMCALChannelRecalibrationFactors(2,(TH2F*)f->Get("EMCALRecalFactors_SM2"));
97 //cu->SetEMCALChannelRecalibrationFactors(3,(TH2F*)f->Get("EMCALRecalFactors_SM3"));
100 if(kPrintSettings) cu->Print("");
102 // ##### Analysis algorithm settings ####
103 //AliFiducialCut * fidCut = new AliFiducialCut();
104 //fidCut->DoCTSFiducialCut(kFALSE) ;
105 //fidCut->DoEMCALFiducialCut(kTRUE) ;
106 //fidCut->DoPHOSFiducialCut(kTRUE) ;
108 AliAnaCalorimeterQA *emcalQA = new AliAnaCalorimeterQA();
109 //emcalQA->SetDebug(2); //10 for lots of messages
110 emcalQA->SetCalorimeter("EMCAL");
111 if(kUseKinematics) emcalQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
112 else emcalQA->SwitchOffDataMC() ;
113 emcalQA->AddToHistogramsName("EMCAL_"); //Begining of histograms name
114 //emcalQA->SetFiducialCut(fidCut);
115 emcalQA->SwitchOffFiducialCut();
116 emcalQA->SwitchOffPlotsMaking();
117 emcalQA->SwitchOnCorrelation();
118 if(!kUseKinematics)emcalQA->SetTimeCut(400,850);//Open for the moment
119 //Set Histrograms bins and ranges
120 emcalQA->SetHistoPtRangeAndNBins(0, 50, 200) ;
121 emcalQA->SetHistoFinePtRangeAndNBins(0, 10, 200) ; // bining for fhAmpId
122 emcalQA->SetHistoPhiRangeAndNBins(79*TMath::DegToRad(), 181*TMath::DegToRad(), 200) ;
123 emcalQA->SetHistoEtaRangeAndNBins(-0.71, 0.71, 200) ;
124 emcalQA->SetNumberOfModules(10);
125 emcalQA->SetHistoMassRangeAndNBins(0., 1, 400) ;
126 emcalQA->SetHistoAsymmetryRangeAndNBins(0., 1. , 10 );
127 emcalQA->SetHistoPOverERangeAndNBins(0,10.,100);
128 emcalQA->SetHistodEdxRangeAndNBins(0.,200.,200);
129 emcalQA->SetHistodRRangeAndNBins(0.,TMath::Pi(),150);
130 emcalQA->SetHistoTimeRangeAndNBins(300.,900,300);
131 emcalQA->SetHistoRatioRangeAndNBins(0.,2.,100);
132 emcalQA->SetHistoVertexDistRangeAndNBins(0.,500.,500);
133 emcalQA->SetHistoNClusterCellRangeAndNBins(0,500,500);
134 emcalQA->SetHistoXRangeAndNBins(-230,90,120);
135 emcalQA->SetHistoYRangeAndNBins(370,450,40);
136 emcalQA->SetHistoZRangeAndNBins(-400,400,200);
137 emcalQA->SetHistoRRangeAndNBins(400,450,25);
138 emcalQA->SetHistoV0SignalRangeAndNBins(0,5000,500);
139 emcalQA->SetHistoV0MultiplicityRangeAndNBins(0,5000,500);
140 emcalQA->SetHistoTrackMultiplicityRangeAndNBins(0,5000,500);
141 //emcalQA->GetMCAnalysisUtils()->SetDebug(10);
143 if(kPrintSettings) emcalQA->Print("");
145 AliAnaCalorimeterQA *phosQA = new AliAnaCalorimeterQA();
146 //phosQA->SetDebug(2); //10 for lots of messages
147 phosQA->SetCalorimeter("PHOS");
148 if(kUseKinematics) phosQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
149 else phosQA->SwitchOffDataMC() ;
150 phosQA->AddToHistogramsName("PHOS_");//Begining of histograms name
151 //phosQA->SetFiducialCut(fidCut);
152 phosQA->SwitchOffFiducialCut();
153 //phosQA->GetMCAnalysisUtils()->SetDebug(10);
154 phosQA->SwitchOffPlotsMaking();
155 //Set Histrograms bins and ranges
156 phosQA->SetHistoPtRangeAndNBins(0, 50, 200) ;
157 phosQA->SetHistoFinePtRangeAndNBins(0, 10, 200) ; // bining for fhAmpId
158 phosQA->SetHistoPhiRangeAndNBins(259*TMath::DegToRad(), 321*TMath::DegToRad(), 130) ;
159 phosQA->SetHistoEtaRangeAndNBins(-0.125, 0.125, 57) ;
160 phosQA->SetNumberOfModules(3); //PHOS first year
161 phosQA->SetHistoMassRangeAndNBins(0., 1., 400) ;
162 phosQA->SetHistoAsymmetryRangeAndNBins(0., 1. , 10) ;
163 phosQA->SetHistoPOverERangeAndNBins(0,10.,100);
164 phosQA->SetHistodEdxRangeAndNBins(0.,200.,200);
165 phosQA->SetHistodRRangeAndNBins(0.,TMath::Pi(),150);
166 phosQA->SetHistoTimeRangeAndNBins(0.,300,300);
167 phosQA->SetHistoRatioRangeAndNBins(0.,2.,100);
168 phosQA->SetHistoVertexDistRangeAndNBins(0.,500.,500);
169 phosQA->SetHistoNClusterCellRangeAndNBins(0,500,500);
170 phosQA->SetHistoXRangeAndNBins(-100,400,100);
171 phosQA->SetHistoYRangeAndNBins(-490,-290,100);
172 phosQA->SetHistoZRangeAndNBins(-80,80,100);
173 phosQA->SetHistoRRangeAndNBins(440,480,80);
174 phosQA->SetHistoV0SignalRangeAndNBins(0,5000,500);
175 phosQA->SetHistoV0MultiplicityRangeAndNBins(0,5000,500);
176 phosQA->SetHistoTrackMultiplicityRangeAndNBins(0,5000,500);
179 // #### Configure Maker ####
180 AliAnaPartCorrMaker * maker = new AliAnaPartCorrMaker();
181 maker->SetReader(reader);//pointer to reader
182 maker->SetCaloUtils(cu); //pointer to calorimeter utils
183 maker->AddAnalysis(emcalQA,0);
184 maker->AddAnalysis(phosQA,1);
185 maker->SetAnaDebug(-1) ; // 0 to at least print the event number
186 maker->SwitchOnHistogramsMaker() ;
187 maker->SwitchOffAODsMaker() ;
188 if(kPrintSettings) maker->Print("");
191 printf("======================== \n");
192 printf(" End Configuration of Calorimeter QA \n");
193 printf("======================== \n");
196 //===========================================================================
197 AliAnalysisTaskParticleCorrelation * task = new AliAnalysisTaskParticleCorrelation ("CalorimeterPerformance");
198 task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
199 //task->SetDebugLevel(-1);
200 task->SelectCollisionCandidates();
201 task->SetAnalysisMaker(maker);
205 // AliAnalysisDataContainer *cout_pc = mgr->CreateContainer("Calo.Performance",TList::Class(),
206 // AliAnalysisManager::kOutputContainer, "Calo.Performance.root");
209 if(outputFile.Length()==0)outputFile = AliAnalysisManager::GetCommonFileName();
212 AliAnalysisDataContainer *cout_pc = mgr->CreateContainer("CaloQA", TList::Class(),
213 AliAnalysisManager::kOutputContainer,
214 Form("%s:CaloQA",outputFile.Data()));
216 AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer("CaloQACuts", TList::Class(),
217 AliAnalysisManager::kParamContainer,
218 Form("%s:CaloQACuts",outputFile.Data()));
219 //Form("%s:PartCorrCuts",outputfile.Data()));
220 // Create ONLY the output containers for the data produced by the task.
221 // Get and connect other common input/output containers via the manager as below
222 //==============================================================================
223 mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
224 mgr->ConnectOutput (task, 1, cout_pc);
225 mgr->ConnectOutput (task, 2, cout_cuts);