1 AliAnalysisTaskParticleCorrelation *AddTaskCalorimeterQA(TString data, Bool_t kUseKinematics = kFALSE, Bool_t kPrintSettings = kFALSE)
3 // Creates a PartCorr task for calorimeters performance studies, configures it and adds it to the analysis manager.
5 // Get the pointer to the existing analysis manager via the static access method.
6 //==============================================================================
7 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
9 ::Error("AddTaskPartCorr", "No analysis manager to connect to.");
13 // Check the analysis type using the event handlers connected to the analysis manager.
14 //==============================================================================
15 if (!mgr->GetInputEventHandler()) {
16 ::Error("AddTaskPartCorr", "This task requires an input event handler");
19 TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
22 //===========================================================================
25 //For this particular analysis few things done by the reader.
26 //Nothing else needs to be set.
27 AliCaloTrackReader * reader = 0x0;
28 if(data=="AOD") reader = new AliCaloTrackAODReader();
29 else if(data=="ESD") reader = new AliCaloTrackESDReader();
30 //reader->SetDebug(10);//10 for lots of messages
31 if(kPrintSettings) reader->Print("");
34 if(inputDataType == "ESD"){
35 reader->SwitchOnStack();
36 reader->SwitchOffAODMCParticles();
38 else if(inputDataType == "AOD"){
39 reader->SwitchOffStack();
40 reader->SwitchOnAODMCParticles();
44 reader->SetDeltaAODFileName(""); //Do not create deltaAOD file, this analysis do not create branches.
47 // ##### Analysis algorithm settings ####
49 AliFidutialCut * fidCut = new AliFidutialCut();
50 fidCut->DoCTSFidutialCut(kFALSE) ;
51 fidCut->DoEMCALFidutialCut(kTRUE) ;
52 fidCut->DoPHOSFidutialCut(kTRUE) ;
54 AliAnaCalorimeterQA *emcalQA = new AliAnaCalorimeterQA();
55 //emcalQA->SetDebug(2); //10 for lots of messages
56 emcalQA->SetCalorimeter("EMCAL");
57 if(kUseKinematics) emcalQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
58 else emcalQA->SwitchOffDataMC() ;
59 emcalQA->AddToHistogramsName("EMCAL_"); //Begining of histograms name
60 emcalQA->SetFidutialCut(fidCut);
61 emcalQA->SwitchOnFidutialCut();
62 if(kPrintSettings) emcalQA->Print("");
63 //emcalQA->GetMCAnalysisUtils()->SetDebug(10);
65 AliAnaCalorimeterQA *phosQA = new AliAnaCalorimeterQA();
66 //phosQA->SetDebug(2); //10 for lots of messages
67 phosQA->SetCalorimeter("PHOS");
68 if(kUseKinematics) phosQA->SwitchOnDataMC() ;//Access MC stack and fill more histograms, AOD MC not implemented yet.
69 else phosQA->SwitchOffDataMC() ;
70 phosQA->AddToHistogramsName("PHOS_");//Begining of histograms name
71 phosQA->SetFidutialCut(fidCut);
72 phosQA->SwitchOnFidutialCut();
73 if(kPrintSettings)phosQA->Print("");
74 //phosQA->GetMCAnalysisUtils()->SetDebug(10);
77 // #### Configure Maker ####
78 AliAnaPartCorrMaker * maker = new AliAnaPartCorrMaker();
79 maker->SetReader(reader);//pointer to reader
80 maker->AddAnalysis(emcalQA,0);
81 maker->AddAnalysis(phosQA,1);
82 maker->SetAnaDebug(-1) ;
83 maker->SwitchOnHistogramsMaker() ;
84 maker->SwitchOnAODsMaker() ;
85 if(kPrintSettings) maker->Print("");
87 printf("======================== \n");
88 printf(" End Configuration of Calorimeter QA \n");
89 printf("======================== \n");
92 //===========================================================================
93 AliAnalysisTaskParticleCorrelation * task = new AliAnalysisTaskParticleCorrelation ("CalorimeterPerformance");
94 task->SetConfigFileName(""); //Don't configure the analysis via configuration file.
95 task->SetDebugLevel(0);
96 task->SetAnalysisMaker(maker);
99 AliAnalysisDataContainer *cout_pc = mgr->CreateContainer("Calo.Performance",TList::Class(),
100 AliAnalysisManager::kOutputContainer, "Calo.Performance.root");
102 // Create ONLY the output containers for the data produced by the task.
103 // Get and connect other common input/output containers via the manager as below
104 //==============================================================================
105 mgr->ConnectInput (task, 0, mgr->GetCommonInputContainer());
106 // AOD output slot will be used in a different way in future
107 //mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer());
108 mgr->ConnectOutput (task, 1, cout_pc);