]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/CaloTrackCorrelations/macros/QA/AddTaskCalorimeterQA.C
simplify arguments
[u/mrichter/AliRoot.git] / PWGGA / CaloTrackCorrelations / macros / QA / AddTaskCalorimeterQA.C
CommitLineData
b3c71962 1//
2// Wagon contacts: EMCAL Gustavo.Conesa.Balbastre@cern.ch
e936d777 3//
b3c71962 4//
01986026 5AliAnalysisTaskCaloTrackCorrelation *AddTaskCalorimeterQA(Bool_t kSimulation = kFALSE,
6 const char *suffix="default",
0e06e5b0 7 TString outputFile = "",
01986026 8 Int_t year = 2012,
9 Bool_t kPrintSettings = kFALSE)
a0bb4dc0 10{
11 // Creates a PartCorr task for calorimeters performance studies, configures it and adds it to the analysis manager.
01986026 12
13 if(kSimulation)
14 {
15 printf("AddTaskCalorimeterQA - CAREFUL : Triggered events not checked in simulation!! \n");
16 TString ssuffix = suffix;
17 if(!ssuffix.Contains("default")) return;
18 }
a0bb4dc0 19
20 // Get the pointer to the existing analysis manager via the static access method.
21 //==============================================================================
22 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
23 if (!mgr) {
24 ::Error("AddTaskPartCorr", "No analysis manager to connect to.");
25 return NULL;
26 }
27
28 // Check the analysis type using the event handlers connected to the analysis manager.
29 //==============================================================================
30 if (!mgr->GetInputEventHandler()) {
31 ::Error("AddTaskPartCorr", "This task requires an input event handler");
32 return NULL;
33 }
17708df9 34 TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
a0bb4dc0 35
2f1cfd22 36 Bool_t kUseKinematics = (mgr->GetMCtruthEventHandler())?kTRUE:kFALSE;
e936d777 37
17708df9 38 // Configure analysis
39 //===========================================================================
a0bb4dc0 40
41 //Reader
42 //For this particular analysis few things done by the reader.
43 //Nothing else needs to be set.
e936d777 44
a0bb4dc0 45 AliCaloTrackReader * reader = 0x0;
01986026 46 if (inputDataType.Contains("AOD")) reader = new AliCaloTrackAODReader();
47 else if(inputDataType.Contains("ESD")) reader = new AliCaloTrackESDReader();
a0bb4dc0 48 //reader->SetDebug(10);//10 for lots of messages
e936d777 49
50 reader->SwitchOnEMCALCells();
51 reader->SwitchOnEMCAL();
52 reader->SwitchOnPHOSCells(); // For correlation plots
53 reader->SwitchOnPHOS(); // For correlation plots
54 reader->SetEMCALPtMin(0.);
798a9b04 55 reader->SwitchOnCTS();
17708df9 56 reader->SetCTSPtMin (0.);
0b13c1f9 57 reader->SetZvertexCut(10.);
17708df9 58
531f682d 59 if(kUseKinematics)
60 {
61 if(inputDataType == "ESD")
62 {
1322a8a8 63 reader->SwitchOnStack();
64 reader->SwitchOffAODMCParticles();
65 }
531f682d 66 else if(inputDataType == "AOD")
67 {
1322a8a8 68 reader->SwitchOffStack();
69 reader->SwitchOnAODMCParticles();
70 }
17708df9 71 }
e936d777 72
17708df9 73 reader->SetDeltaAODFileName(""); //Do not create deltaAOD file, this analysis do not create branches.
74 reader->SwitchOffWriteDeltaAOD() ;
531f682d 75 reader->SetImportGeometryFromFile(kFALSE);
76
17708df9 77 if(kPrintSettings) reader->Print("");
1322a8a8 78
fa991e42 79 // *** Calorimeters Utils ***
80 AliCalorimeterUtils *cu = new AliCalorimeterUtils;
81 // Remove clusters close to borders, at least max energy cell is 1 cell away
82 cu->SetNumberOfCellsFromEMCALBorder(1);
531f682d 83
372e67a3 84 AliEMCALRecoUtils* reco = cu->GetEMCALRecoUtils();
85 reco->SwitchOnRejectExoticCell() ; // reject exotic cells, fill different histograms for exotic clusters and good clusters
86 reco->SetExoticCellDiffTimeCut(10000); // Open
87 reco->SetExoticCellFractionCut(0.95); // 1-Ecross/Ecell > 0.95 -> out
88 reco->SetExoticCellMinAmplitudeCut(0.75); // 750 MeV
3748ffb5 89
fa991e42 90 cu->SetDebug(-1);
91 if(kPrintSettings) cu->Print("");
3748ffb5 92
a0bb4dc0 93 // ##### Analysis algorithm settings ####
3748ffb5 94
a0bb4dc0 95 AliAnaCalorimeterQA *emcalQA = new AliAnaCalorimeterQA();
ca2338a4 96 //emcalQA->SetDebug(10); //10 for lots of messages
a0bb4dc0 97 emcalQA->SetCalorimeter("EMCAL");
98 if(kUseKinematics) emcalQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
e936d777 99 else emcalQA->SwitchOffDataMC() ;
a0bb4dc0 100 emcalQA->AddToHistogramsName("EMCAL_"); //Begining of histograms name
a0bb4dc0 101 emcalQA->SwitchOffFiducialCut();
798a9b04 102 emcalQA->SwitchOnCorrelation();
3748ffb5 103 emcalQA->SwitchOffFillAllTH3Histogram();
e936d777 104 emcalQA->SwitchOffFillAllPositionHistogram();
372e67a3 105 emcalQA->SwitchOffFillAllPositionHistogram2();
106 emcalQA->SwitchOnStudyBadClusters();
e936d777 107
a348c43e 108 //Set Histrograms bins and ranges
372e67a3 109 emcalQA->GetHistogramRanges()->SetHistoPtRangeAndNBins(0, 100, 200) ;
110 emcalQA->GetHistogramRanges()->SetHistoFinePtRangeAndNBins(0, 10, 200) ; // bining for fhAmpId
111 emcalQA->GetHistogramRanges()->SetHistoEtaRangeAndNBins(-0.71, 0.71, 200) ;
e936d777 112
372e67a3 113 if (year==2010)
114 {
8ce30fa2 115 emcalQA->SetNumberOfModules(4);
372e67a3 116 emcalQA->GetHistogramRanges()->SetHistoPhiRangeAndNBins(79*TMath::DegToRad(), 121*TMath::DegToRad(), 200) ;
117 emcalQA->GetHistogramRanges()->SetHistoXRangeAndNBins(-230,90,120);
118 emcalQA->GetHistogramRanges()->SetHistoYRangeAndNBins(370,450,40);
8ce30fa2 119 }
372e67a3 120 else if(year==2011)
121 {
8ce30fa2 122 emcalQA->SetNumberOfModules(10);
372e67a3 123 emcalQA->GetHistogramRanges()->SetHistoPhiRangeAndNBins(79*TMath::DegToRad(), 191*TMath::DegToRad(), 200) ;
124 emcalQA->GetHistogramRanges()->SetHistoXRangeAndNBins(-600,90,200);
125 emcalQA->GetHistogramRanges()->SetHistoYRangeAndNBins(100,450,100);
126 }
127 else
128 {
129 emcalQA->SetNumberOfModules(12);
130 emcalQA->GetHistogramRanges()->SetHistoPhiRangeAndNBins(79*TMath::DegToRad(), 181*TMath::DegToRad(), 200) ; // revise
131 emcalQA->GetHistogramRanges()->SetHistoXRangeAndNBins(-700,90,200); // revise
132 emcalQA->GetHistogramRanges()->SetHistoYRangeAndNBins(50,450,100); // revise
8ce30fa2 133 }
134
372e67a3 135 emcalQA->GetHistogramRanges()->SetHistoMassRangeAndNBins(0., 1, 400) ;
136 emcalQA->GetHistogramRanges()->SetHistoAsymmetryRangeAndNBins(0., 1. , 10 );
a87e069d 137 emcalQA->GetHistogramRanges()->SetHistoPOverERangeAndNBins(0,3.,90);
372e67a3 138 emcalQA->GetHistogramRanges()->SetHistodEdxRangeAndNBins(0.,200.,200);
a87e069d 139 emcalQA->GetHistogramRanges()->SetHistodRRangeAndNBins(0.,0.15,150);
372e67a3 140 emcalQA->GetHistogramRanges()->SetHistoTimeRangeAndNBins(300.,900,300);
141 emcalQA->GetHistogramRanges()->SetHistoRatioRangeAndNBins(0.,2.,100);
142 emcalQA->GetHistogramRanges()->SetHistoVertexDistRangeAndNBins(0.,500.,500);
143 emcalQA->GetHistogramRanges()->SetHistoNClusterCellRangeAndNBins(0,500,500);
144 emcalQA->GetHistogramRanges()->SetHistoZRangeAndNBins(-400,400,200);
145 emcalQA->GetHistogramRanges()->SetHistoRRangeAndNBins(400,450,25);
146 emcalQA->GetHistogramRanges()->SetHistoV0SignalRangeAndNBins(0,5000,500);
147 emcalQA->GetHistogramRanges()->SetHistoV0MultiplicityRangeAndNBins(0,5000,500);
148 emcalQA->GetHistogramRanges()->SetHistoTrackMultiplicityRangeAndNBins(0,5000,500);
a0bb4dc0 149
e936d777 150 if(kPrintSettings) emcalQA->Print("");
151
a0bb4dc0 152 // #### Configure Maker ####
372e67a3 153 AliAnaCaloTrackCorrMaker * maker = new AliAnaCaloTrackCorrMaker();
a0bb4dc0 154 maker->SetReader(reader);//pointer to reader
fa991e42 155 maker->SetCaloUtils(cu); //pointer to calorimeter utils
e936d777 156 maker->AddAnalysis(emcalQA,0);
78219bac 157 maker->SetAnaDebug(-1) ; // 0 to at least print the event number
a0bb4dc0 158 maker->SwitchOnHistogramsMaker() ;
159 maker->SwitchOffAODsMaker() ;
160 if(kPrintSettings) maker->Print("");
17708df9 161
a0bb4dc0 162 printf("======================== \n");
163 printf(" End Configuration of Calorimeter QA \n");
164 printf("======================== \n");
165
17708df9 166 // Create task
167 //===========================================================================
0e06e5b0 168 AliAnalysisTaskCaloTrackCorrelation * task = new AliAnalysisTaskCaloTrackCorrelation (Form("CalorimeterPerformance_%s",suffix));
a0bb4dc0 169 task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
3f7a860b 170 //task->SetDebugLevel(-1);
2f1cfd22 171 task->SetAnalysisMaker(maker);
7341cdbb 172 task->SetBranches("ESD:AliESDRun.,AliESDHeader"); //just a trick to get Constantin's analysis to work
a0bb4dc0 173 mgr->AddTask(task);
174
0c1383b5 175 //Create containers
17708df9 176 // AliAnalysisDataContainer *cout_pc = mgr->CreateContainer("Calo.Performance",TList::Class(),
177 // AliAnalysisManager::kOutputContainer, "Calo.Performance.root");
2f1cfd22 178
3748ffb5 179 TString cname;
9748e967 180 if(outputFile.Length()==0)outputFile = AliAnalysisManager::GetCommonFileName();
17708df9 181
182
3748ffb5 183 cname = Form("CaloQA_%s", suffix);
184 AliAnalysisDataContainer *cout_pc = mgr->CreateContainer(cname, TList::Class(),
17708df9 185 AliAnalysisManager::kOutputContainer,
3748ffb5 186 Form("%s:%s",outputFile.Data(),cname.Data()));
a6f26052 187
3748ffb5 188 cname = Form("CaloQACuts_%s", suffix);
189 AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer(cname, TList::Class(),
17708df9 190 AliAnalysisManager::kParamContainer,
3748ffb5 191 Form("%s:%s",outputFile.Data(),cname.Data()));
a87e069d 192
0c1383b5 193 //Form("%s:PartCorrCuts",outputfile.Data()));
a0bb4dc0 194 // Create ONLY the output containers for the data produced by the task.
195 // Get and connect other common input/output containers via the manager as below
196 //==============================================================================
197 mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
a0bb4dc0 198 mgr->ConnectOutput (task, 1, cout_pc);
d55bb5e1 199 mgr->ConnectOutput (task, 2, cout_cuts);
17708df9 200
a0bb4dc0 201 return task;
202}
203
204