New method to get a sort of combined event id in a form of 64-bit integer.
[u/mrichter/AliRoot.git] / PWG4 / macros / QA / AddTaskCalorimeterQA.C
CommitLineData
b3c71962 1//
2// Wagon contacts: EMCAL Gustavo.Conesa.Balbastre@cern.ch
3// PHOS Yuri.Kharlov@cern.ch
4//
5
2f1cfd22 6AliAnalysisTaskParticleCorrelation *AddTaskCalorimeterQA(TString data, Bool_t kPrintSettings = kFALSE,Bool_t kSimulation = kFALSE)
a0bb4dc0 7{
8 // Creates a PartCorr task for calorimeters performance studies, configures it and adds it to the analysis manager.
9
10 // Get the pointer to the existing analysis manager via the static access method.
11 //==============================================================================
12 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
13 if (!mgr) {
14 ::Error("AddTaskPartCorr", "No analysis manager to connect to.");
15 return NULL;
16 }
17
18 // Check the analysis type using the event handlers connected to the analysis manager.
19 //==============================================================================
20 if (!mgr->GetInputEventHandler()) {
21 ::Error("AddTaskPartCorr", "This task requires an input event handler");
22 return NULL;
23 }
24 TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
25
2f1cfd22 26 Bool_t kUseKinematics = (mgr->GetMCtruthEventHandler())?kTRUE:kFALSE;
27
28 cout<<"********* ACCESS KINE? "<<kUseKinematics<<endl;
29
a0bb4dc0 30 // Configure analysis
31 //===========================================================================
32
33 //Reader
34 //For this particular analysis few things done by the reader.
35 //Nothing else needs to be set.
36 AliCaloTrackReader * reader = 0x0;
37 if(data=="AOD") reader = new AliCaloTrackAODReader();
38 else if(data=="ESD") reader = new AliCaloTrackESDReader();
39 //reader->SetDebug(10);//10 for lots of messages
2f1cfd22 40 reader->SwitchOffEMCAL();
41 reader->SwitchOffPHOS();
42 reader->SwitchOffCTS();
43
a0bb4dc0 44 if(kUseKinematics){
45 if(inputDataType == "ESD"){
46 reader->SwitchOnStack();
47 reader->SwitchOffAODMCParticles();
48 }
49 else if(inputDataType == "AOD"){
50 reader->SwitchOffStack();
51 reader->SwitchOnAODMCParticles();
52 }
53 }
2f1cfd22 54 //if(!kSimulation) reader->SetFiredTriggerClassName("CINT1B-ABCE-NOPF-ALL");
a0bb4dc0 55 reader->SetDeltaAODFileName(""); //Do not create deltaAOD file, this analysis do not create branches.
5a2dbc3c 56 if(kPrintSettings) reader->Print("");
a0bb4dc0 57
58 // ##### Analysis algorithm settings ####
59 //Only needed now for MC data
60 //AliFiducialCut * fidCut = new AliFiducialCut();
61 //fidCut->DoCTSFiducialCut(kFALSE) ;
62 //fidCut->DoEMCALFiducialCut(kTRUE) ;
63 //fidCut->DoPHOSFiducialCut(kTRUE) ;
64
65 AliAnaCalorimeterQA *emcalQA = new AliAnaCalorimeterQA();
66 //emcalQA->SetDebug(2); //10 for lots of messages
67 emcalQA->SetCalorimeter("EMCAL");
68 if(kUseKinematics) emcalQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
69 else emcalQA->SwitchOffDataMC() ;
70 emcalQA->AddToHistogramsName("EMCAL_"); //Begining of histograms name
71 //emcalQA->SetFiducialCut(fidCut);
72 emcalQA->SwitchOffFiducialCut();
5a2dbc3c 73 emcalQA->SwitchOffPlotsMaking();
a0bb4dc0 74 emcalQA->SwitchOnCalorimetersCorrelation();
57eb7f00 75 emcalQA->SetTimeCut(550,750);
a348c43e 76 //Set Histrograms bins and ranges
12db0c2a 77 emcalQA->SetHistoPtRangeAndNBins(0, 10, 100) ;
78 emcalQA->SetHistoPhiRangeAndNBins(75*TMath::DegToRad(), 125*TMath::DegToRad(), 100) ;
79 emcalQA->SetHistoEtaRangeAndNBins(-0.8, 0.8, 80) ;
a5fafd85 80 emcalQA->SetNumberOfModules(4); //EMCAL first year
12db0c2a 81 emcalQA->SetHistoMassRangeAndNBins(0., 0.6, 200) ;
4df35693 82 emcalQA->SetHistoAsymmetryRangeAndNBins(0., 1. , 10) ;
5a2dbc3c 83 emcalQA->SetHistoPOverERangeAndNBins(0,10.,100);
84 emcalQA->SetHistodEdxRangeAndNBins(0.,400.,200);
4df35693 85 emcalQA->SetHistodRRangeAndNBins(0.,TMath::Pi(),150);
86 emcalQA->SetHistoTimeRangeAndNBins(400.,800,200);
5a2dbc3c 87 emcalQA->SetHistoRatioRangeAndNBins(0.,2.,100);
88 emcalQA->SetHistoVertexDistRangeAndNBins(0.,500.,100);
89 emcalQA->SetHistoNClusterCellRangeAndNBins(0,300,300);
12db0c2a 90 emcalQA->SetHistoXRangeAndNBins(-230,90,160);
91 emcalQA->SetHistoYRangeAndNBins(370,450,35);
4df35693 92 emcalQA->SetHistoZRangeAndNBins(-400,400,100);
12db0c2a 93 emcalQA->SetHistoRRangeAndNBins(400,450,25);
255b904d 94
a0bb4dc0 95 //emcalQA->GetMCAnalysisUtils()->SetDebug(10);
96
5a2dbc3c 97 if(kPrintSettings) emcalQA->Print("");
98
a0bb4dc0 99 AliAnaCalorimeterQA *phosQA = new AliAnaCalorimeterQA();
100 //phosQA->SetDebug(2); //10 for lots of messages
101 phosQA->SetCalorimeter("PHOS");
102 if(kUseKinematics) phosQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
103 else phosQA->SwitchOffDataMC() ;
104 phosQA->AddToHistogramsName("PHOS_");//Begining of histograms name
105 //phosQA->SetFiducialCut(fidCut);
106 phosQA->SwitchOffFiducialCut();
a0bb4dc0 107 //phosQA->GetMCAnalysisUtils()->SetDebug(10);
5a2dbc3c 108 phosQA->SwitchOffPlotsMaking();
109 //Set Histrograms bins and ranges
12db0c2a 110 phosQA->SetHistoPtRangeAndNBins(0, 10, 100) ;
111 phosQA->SetHistoPhiRangeAndNBins(255*TMath::DegToRad(), 325*TMath::DegToRad(), 100) ;
112 phosQA->SetHistoEtaRangeAndNBins(-0.13, 0.13, 80) ;
5a2dbc3c 113 phosQA->SetNumberOfModules(3); //PHOS first year
12db0c2a 114 phosQA->SetHistoMassRangeAndNBins(0., 0.6, 200) ;
2f1cfd22 115 phosQA->SetHistoAsymmetryRangeAndNBins(0., 1. , 25) ;
5a2dbc3c 116 phosQA->SetHistoPOverERangeAndNBins(0,10.,100);
117 phosQA->SetHistodEdxRangeAndNBins(0.,400.,200);
4df35693 118 phosQA->SetHistodRRangeAndNBins(0.,TMath::Pi(),150);
119 phosQA->SetHistoTimeRangeAndNBins(0.,400,200);
5a2dbc3c 120 phosQA->SetHistoRatioRangeAndNBins(0.,2.,100);
121 phosQA->SetHistoVertexDistRangeAndNBins(0.,500.,100);
122 phosQA->SetHistoNClusterCellRangeAndNBins(0,300,300);
4df35693 123 phosQA->SetHistoXRangeAndNBins(-100,400,150);
12db0c2a 124 phosQA->SetHistoYRangeAndNBins(-490,-290,100);
125 phosQA->SetHistoZRangeAndNBins(-80,80,80);
126 phosQA->SetHistoRRangeAndNBins(440,480,40);
255b904d 127
128 //if(kPrintSettings)phosQA->Print("");
5a2dbc3c 129
a0bb4dc0 130 // #### Configure Maker ####
131 AliAnaPartCorrMaker * maker = new AliAnaPartCorrMaker();
132 maker->SetReader(reader);//pointer to reader
133 maker->AddAnalysis(emcalQA,0);
134 maker->AddAnalysis(phosQA,1);
255b904d 135 maker->SetAnaDebug(-1) ; // 0 to at least print the event number
a0bb4dc0 136 maker->SwitchOnHistogramsMaker() ;
137 maker->SwitchOffAODsMaker() ;
138 if(kPrintSettings) maker->Print("");
139
140
141 printf("======================== \n");
142 printf(" End Configuration of Calorimeter QA \n");
143 printf("======================== \n");
144
145 // Create task
146 //===========================================================================
147 AliAnalysisTaskParticleCorrelation * task = new AliAnalysisTaskParticleCorrelation ("CalorimeterPerformance");
148 task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
3f7a860b 149 //task->SetDebugLevel(-1);
150 task->SelectCollisionCandidates();
2f1cfd22 151 task->SetAnalysisMaker(maker);
a0bb4dc0 152 mgr->AddTask(task);
153
2f1cfd22 154// AliAnalysisDataContainer *cout_pc = mgr->CreateContainer("Calo.Performance",TList::Class(),
155// AliAnalysisManager::kOutputContainer, "Calo.Performance.root");
156
157
158 TString outputfile = AliAnalysisManager::GetCommonFileName();
159 AliAnalysisDataContainer *cout_pc = mgr->CreateContainer("CaloQA", TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:CaloQA",outputfile.Data()));
160
161
a0bb4dc0 162 // Create ONLY the output containers for the data produced by the task.
163 // Get and connect other common input/output containers via the manager as below
164 //==============================================================================
165 mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
a0bb4dc0 166 mgr->ConnectOutput (task, 1, cout_pc);
167
168 return task;
169}
170
171