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.);
49 if(inputDataType == "ESD"){
50 reader->SwitchOnStack();
51 reader->SwitchOffAODMCParticles();
53 else if(inputDataType == "AOD"){
54 reader->SwitchOffStack();
55 reader->SwitchOnAODMCParticles();
58 //if(!kSimulation) reader->SetFiredTriggerClassName("CINT1B-ABCE-NOPF-ALL");
59 reader->SetDeltaAODFileName(""); //Do not create deltaAOD file, this analysis do not create branches.
60 reader->SwitchOffWriteDeltaAOD() ;
61 if(oldAOD) reader->SwitchOnOldAODs();
62 if(kPrintSettings) reader->Print("");
64 // *** Calorimeters Utils ***
65 AliCalorimeterUtils *cu = new AliCalorimeterUtils;
66 // Remove clusters close to borders, at least max energy cell is 1 cell away
67 cu->SetNumberOfCellsFromEMCALBorder(1);
68 cu->SetNumberOfCellsFromPHOSBorder(2);
70 // Remove EMCAL hottest channels for first LHC10 periods
71 cu->SwitchOnBadChannelsRemoval();
73 cu->SetEMCALChannelStatus(0,3,13); cu->SetEMCALChannelStatus(0,44,1); cu->SetEMCALChannelStatus(0,3,13);
74 cu->SetEMCALChannelStatus(0,20,7); cu->SetEMCALChannelStatus(0,38,2);
76 cu->SetEMCALChannelStatus(1,4,7); cu->SetEMCALChannelStatus(1,4,13); cu->SetEMCALChannelStatus(1,9,20);
77 cu->SetEMCALChannelStatus(1,14,15); cu->SetEMCALChannelStatus(1,23,16); cu->SetEMCALChannelStatus(1,32,23);
78 cu->SetEMCALChannelStatus(1,37,5); cu->SetEMCALChannelStatus(1,40,1); cu->SetEMCALChannelStatus(1,40,2);
79 cu->SetEMCALChannelStatus(1,40,5); cu->SetEMCALChannelStatus(1,41,0); cu->SetEMCALChannelStatus(1,41,1);
80 cu->SetEMCALChannelStatus(1,41,2); cu->SetEMCALChannelStatus(1,41,4);
82 cu->SetEMCALChannelStatus(2,14,15); cu->SetEMCALChannelStatus(2,18,16); cu->SetEMCALChannelStatus(2,18,17);
83 cu->SetEMCALChannelStatus(2,18,18); cu->SetEMCALChannelStatus(2,18,20); cu->SetEMCALChannelStatus(2,18,21);
84 cu->SetEMCALChannelStatus(2,18,23); cu->SetEMCALChannelStatus(2,19,16); cu->SetEMCALChannelStatus(2,19,17);
85 cu->SetEMCALChannelStatus(2,19,19); cu->SetEMCALChannelStatus(2,19,20); cu->SetEMCALChannelStatus(2,19,21);
86 cu->SetEMCALChannelStatus(2,19,22);
88 cu->SetEMCALChannelStatus(3,4,7);
91 //cu->SwitchOnRecalibration();
92 //TFile * f = new TFile("RecalibrationFactors.root","read");
93 //cu->SetEMCALChannelRecalibrationFactors(0,(TH2F*)f->Get("EMCALRecalFactors_SM0"));
94 //cu->SetEMCALChannelRecalibrationFactors(1,(TH2F*)f->Get("EMCALRecalFactors_SM1"));
95 //cu->SetEMCALChannelRecalibrationFactors(2,(TH2F*)f->Get("EMCALRecalFactors_SM2"));
96 //cu->SetEMCALChannelRecalibrationFactors(3,(TH2F*)f->Get("EMCALRecalFactors_SM3"));
99 if(kPrintSettings) cu->Print("");
101 // ##### Analysis algorithm settings ####
102 //AliFiducialCut * fidCut = new AliFiducialCut();
103 //fidCut->DoCTSFiducialCut(kFALSE) ;
104 //fidCut->DoEMCALFiducialCut(kTRUE) ;
105 //fidCut->DoPHOSFiducialCut(kTRUE) ;
107 AliAnaCalorimeterQA *emcalQA = new AliAnaCalorimeterQA();
108 //emcalQA->SetDebug(2); //10 for lots of messages
109 emcalQA->SetCalorimeter("EMCAL");
110 if(kUseKinematics) emcalQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
111 else emcalQA->SwitchOffDataMC() ;
112 emcalQA->AddToHistogramsName("EMCAL_"); //Begining of histograms name
113 //emcalQA->SetFiducialCut(fidCut);
114 emcalQA->SwitchOffFiducialCut();
115 emcalQA->SwitchOffPlotsMaking();
116 emcalQA->SwitchOnCorrelation();
117 if(!kUseKinematics)emcalQA->SetTimeCut(400,850);//Open for the moment
118 //Set Histrograms bins and ranges
119 emcalQA->SetHistoPtRangeAndNBins(0, 5, 50) ;
120 emcalQA->SetHistoFinePtRangeAndNBins(0, 5, 200) ; // bining for fhAmpId
121 emcalQA->SetHistoPhiRangeAndNBins(79*TMath::DegToRad(), 121*TMath::DegToRad(), 100) ;
122 emcalQA->SetHistoEtaRangeAndNBins(-0.71, 0.71, 200) ;
123 emcalQA->SetNumberOfModules(4); //EMCAL first year
124 emcalQA->SetHistoMassRangeAndNBins(0., 0.6, 200) ;
125 emcalQA->SetHistoAsymmetryRangeAndNBins(0., 1. , 10 );
126 emcalQA->SetHistoPOverERangeAndNBins(0,10.,100);
127 emcalQA->SetHistodEdxRangeAndNBins(0.,200.,200);
128 emcalQA->SetHistodRRangeAndNBins(0.,TMath::Pi(),150);
129 emcalQA->SetHistoTimeRangeAndNBins(300.,900,300);
130 emcalQA->SetHistoRatioRangeAndNBins(0.,2.,100);
131 emcalQA->SetHistoVertexDistRangeAndNBins(0.,500.,500);
132 emcalQA->SetHistoNClusterCellRangeAndNBins(0,50,50);
133 emcalQA->SetHistoXRangeAndNBins(-230,90,120);
134 emcalQA->SetHistoYRangeAndNBins(370,450,40);
135 emcalQA->SetHistoZRangeAndNBins(-400,400,200);
136 emcalQA->SetHistoRRangeAndNBins(400,450,25);
137 emcalQA->SetHistoV0SignalRangeAndNBins(0,5000,500);
138 emcalQA->SetHistoV0MultiplicityRangeAndNBins(0,5000,500);
139 emcalQA->SetHistoTrackMultiplicityRangeAndNBins(0,5000,500);
140 //emcalQA->GetMCAnalysisUtils()->SetDebug(10);
142 if(kPrintSettings) emcalQA->Print("");
144 AliAnaCalorimeterQA *phosQA = new AliAnaCalorimeterQA();
145 //phosQA->SetDebug(2); //10 for lots of messages
146 phosQA->SetCalorimeter("PHOS");
147 if(kUseKinematics) phosQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
148 else phosQA->SwitchOffDataMC() ;
149 phosQA->AddToHistogramsName("PHOS_");//Begining of histograms name
150 //phosQA->SetFiducialCut(fidCut);
151 phosQA->SwitchOffFiducialCut();
152 //phosQA->GetMCAnalysisUtils()->SetDebug(10);
153 phosQA->SwitchOffPlotsMaking();
154 //Set Histrograms bins and ranges
155 phosQA->SetHistoPtRangeAndNBins(0, 5, 50) ;
156 phosQA->SetHistoFinePtRangeAndNBins(0, 5, 200) ; // bining for fhAmpId
157 phosQA->SetHistoPhiRangeAndNBins(259*TMath::DegToRad(), 321*TMath::DegToRad(), 130) ;
158 phosQA->SetHistoEtaRangeAndNBins(-0.125, 0.125, 57) ;
159 phosQA->SetNumberOfModules(3); //PHOS first year
160 phosQA->SetHistoMassRangeAndNBins(0., 0.6, 200) ;
161 phosQA->SetHistoAsymmetryRangeAndNBins(0., 1. , 10) ;
162 phosQA->SetHistoPOverERangeAndNBins(0,10.,100);
163 phosQA->SetHistodEdxRangeAndNBins(0.,200.,200);
164 phosQA->SetHistodRRangeAndNBins(0.,TMath::Pi(),150);
165 phosQA->SetHistoTimeRangeAndNBins(0.,300,300);
166 phosQA->SetHistoRatioRangeAndNBins(0.,2.,100);
167 phosQA->SetHistoVertexDistRangeAndNBins(0.,500.,500);
168 phosQA->SetHistoNClusterCellRangeAndNBins(0,50,50);
169 phosQA->SetHistoXRangeAndNBins(-100,400,100);
170 phosQA->SetHistoYRangeAndNBins(-490,-290,100);
171 phosQA->SetHistoZRangeAndNBins(-80,80,100);
172 phosQA->SetHistoRRangeAndNBins(440,480,80);
173 phosQA->SetHistoV0SignalRangeAndNBins(0,5000,500);
174 phosQA->SetHistoV0MultiplicityRangeAndNBins(0,5000,500);
175 phosQA->SetHistoTrackMultiplicityRangeAndNBins(0,5000,500);
177 //if(kPrintSettings)phosQA->Print("");
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);