]> git.uio.no Git - u/mrichter/AliRoot.git/blob - prod/acrcaf/qa_pp/AddTaskCalorimeterQA.C
QA for pp data
[u/mrichter/AliRoot.git] / prod / acrcaf / qa_pp / AddTaskCalorimeterQA.C
1 AliAnalysisTaskParticleCorrelation *AddTaskCalorimeterQA(TString data, Bool_t kUseKinematics = kFALSE, Bool_t kPrintSettings = kFALSE)\r
2 {\r
3   // Creates a PartCorr task for calorimeters performance studies, configures it and adds it to the analysis manager.\r
4   \r
5   // Get the pointer to the existing analysis manager via the static access method.\r
6   //==============================================================================\r
7   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
8   if (!mgr) {\r
9     ::Error("AddTaskPartCorr", "No analysis manager to connect to.");\r
10     return NULL;\r
11   }  \r
12   \r
13   // Check the analysis type using the event handlers connected to the analysis manager.\r
14   //==============================================================================\r
15   if (!mgr->GetInputEventHandler()) {\r
16     ::Error("AddTaskPartCorr", "This task requires an input event handler");\r
17     return NULL;\r
18   }\r
19    TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"\r
20   \r
21    // Configure analysis\r
22    //===========================================================================\r
23   \r
24   //Reader\r
25   //For this particular analysis few things done by the reader.\r
26   //Nothing else needs to be set.\r
27   AliCaloTrackReader * reader = 0x0;\r
28   if(data=="AOD")      reader = new AliCaloTrackAODReader();\r
29   else if(data=="ESD") reader = new AliCaloTrackESDReader();\r
30   //reader->SetDebug(10);//10 for lots of messages\r
31    if(kPrintSettings) reader->Print("");\r
32   \r
33   if(kUseKinematics){\r
34                 if(inputDataType == "ESD"){\r
35                         reader->SwitchOnStack();          \r
36                         reader->SwitchOffAODMCParticles(); \r
37                 }\r
38                 else if(inputDataType == "AOD"){\r
39                         reader->SwitchOffStack();          \r
40                         reader->SwitchOnAODMCParticles(); \r
41                 }\r
42    }\r
43         \r
44    reader->SetDeltaAODFileName(""); //Do not create deltaAOD file, this analysis do not create branches.\r
45 \r
46         \r
47   // ##### Analysis algorithm settings ####\r
48    //Only needed now for MC data\r
49    //AliFiducialCut * fidCut = new AliFiducialCut();\r
50    //fidCut->DoCTSFiducialCut(kFALSE) ;\r
51    //fidCut->DoEMCALFiducialCut(kTRUE) ;\r
52    //fidCut->DoPHOSFiducialCut(kTRUE) ;\r
53                 \r
54   AliAnaCalorimeterQA *emcalQA = new AliAnaCalorimeterQA();\r
55   //emcalQA->SetDebug(2); //10 for lots of messages\r
56   emcalQA->SetCalorimeter("EMCAL");\r
57   if(kUseKinematics) emcalQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.\r
58   else  emcalQA->SwitchOffDataMC() ;\r
59   emcalQA->AddToHistogramsName("EMCAL_"); //Begining of histograms name\r
60   //emcalQA->SetFiducialCut(fidCut);\r
61   emcalQA->SwitchOffFidutialCut();\r
62   if(kPrintSettings) emcalQA->Print("");        \r
63   //emcalQA->SwithOnPlotsMaking();\r
64   //emcalQA->GetMCAnalysisUtils()->SetDebug(10);\r
65         \r
66    AliAnaCalorimeterQA *phosQA = new AliAnaCalorimeterQA();\r
67    //phosQA->SetDebug(2); //10 for lots of messages\r
68    phosQA->SetCalorimeter("PHOS");\r
69    if(kUseKinematics) phosQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.\r
70    else  phosQA->SwitchOffDataMC() ;  \r
71    phosQA->AddToHistogramsName("PHOS_");//Begining of histograms name\r
72    //phosQA->SetFiducialCut(fidCut);\r
73    phosQA->SwitchOffFidutialCut();\r
74    if(kPrintSettings)phosQA->Print(""); \r
75    //phosQA->GetMCAnalysisUtils()->SetDebug(10);\r
76    //phosQA->SwithOnPlotsMaking();\r
77   \r
78   // #### Configure Maker ####\r
79   AliAnaPartCorrMaker * maker = new AliAnaPartCorrMaker();\r
80   maker->SetReader(reader);//pointer to reader\r
81   maker->AddAnalysis(emcalQA,0);\r
82   maker->AddAnalysis(phosQA,1);\r
83   maker->SetAnaDebug(0)  ;\r
84   maker->SwitchOnHistogramsMaker()  ;\r
85   maker->SwitchOffAODsMaker()  ;\r
86   if(kPrintSettings) maker->Print("");\r
87  \r
88 \r
89   printf("======================== \n");\r
90   printf(" End Configuration of Calorimeter QA \n");\r
91   printf("======================== \n");\r
92   \r
93    // Create task\r
94    //===========================================================================\r
95   AliAnalysisTaskParticleCorrelation * task = new AliAnalysisTaskParticleCorrelation ("CalorimeterPerformance");\r
96   task->SetConfigFileName(""); //Don't configure the analysis via configuration file.\r
97   task->SetDebugLevel(0);\r
98   task->SetAnalysisMaker(maker);                                \r
99   mgr->AddTask(task);\r
100   \r
101   AliAnalysisDataContainer *cout_pc = mgr->CreateContainer("Calo.Performance",TList::Class(),\r
102                                                            AliAnalysisManager::kOutputContainer, "Calo.Performance.root");\r
103   \r
104   // Create ONLY the output containers for the data produced by the task.\r
105   // Get and connect other common input/output containers via the manager as below\r
106   //==============================================================================\r
107   mgr->ConnectInput  (task, 0, mgr->GetCommonInputContainer());\r
108   mgr->ConnectOutput (task, 1, cout_pc);\r
109   \r
110   return task;\r
111 }\r
112 \r
113 \r