1) static variable were replaced by local variables and data members
[u/mrichter/AliRoot.git] / PWG4 / UserTasks / CaloCellQA / macros / AddTaskCaloCellsQA.C
CommitLineData
0d81af58 1AliAnalysisTaskCaloCellsQA* AddTaskCaloCellsQA(Int_t nmods = 10, Int_t det = 0, char* fname = "CellsQA.root",
2 Bool_t initGeom = kFALSE, Bool_t kFullAnalysis = kFALSE)
045862db 3{
0d81af58 4 // Task to add EMCAL/PHOS cellsQA/runsQA to your analysis.
5 // Do not forget to initialize geometry!
045862db 6 //
0d81af58 7 // Usage example for EMCAL:
045862db 8 //
0d81af58 9 // gROOT->LoadMacro("$ALICE_ROOT/PWG4/UserTasks/CaloCellQA/macros/AddTaskCaloCellsQA.C");
10 // AliAnalysisTaskCaloCellsQA *taskQA = AddTaskCaloCellsQA(10); // 10 supermodules
045862db 11 // taskQA->SelectCollisionCandidates(AliVEvent::kMB); // if necessary
0d81af58 12 // // taskQA->SetAvoidPileup(kFALSE); // some customization
f4dd0897 13 // // Int_t badcells[] = {74,103,917};
14 // // taskQA->SetBadCells(badcells, 3); // reject clusters containing any of these cells
045862db 15 //
0d81af58 16 // Usage example for PHOS:
17 //
18 // gROOT->LoadMacro("$ALICE_ROOT/PWG4/UserTasks/CaloCellQA/macros/AddTaskCaloCellsQA.C");
19 // AliAnalysisTaskCaloCellsQA *taskQA = AddTaskCaloCellsQA(4, 1);
20 // taskQA->SelectCollisionCandidates(AliVEvent::kMB); // if necessary
21 // taskQA->GetCaloCellsQA()->SetClusterEnergyCuts(0.3,0.1); // increase statistics
045862db 22 //
23 // fname -- output file name;
24 // nmods -- maximum supermodule number + 1:
25 // use 4 for EMCAL <= 2010;
26 // use 4 for PHOS (PHOS numbers start from 1, not from zero);
27 // use 10 for EMCAL >= 2011;
28 // det -- detector, 0/EMCAL, 1/PHOS;
29 // initGeom -- if true, initialize geometry for you;
30 // kFullAnalysis -- if true, initialize the analysis to fill more histograms
31 // (necessary for the completeness in searching of problematic cells).
32
33 // get manager instance
34 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
35 if (!mgr) {
36 ::Error("AddTaskCaloCellsQA", "No analysis manager to connect to");
37 return NULL;
38 }
39
40 // check the analysis type using the event handlers connected to the analysis manager
41 if (!mgr->GetInputEventHandler()) {
42 ::Error("AddTaskCaloCellsQA", "This task requires an input event handler");
43 return NULL;
44 }
45
46 // Configure analysis
47 //===========================================================================
48
49 AliAnalysisTaskCaloCellsQA* task = new AliAnalysisTaskCaloCellsQA();
50 mgr->AddTask(task);
51
52 // initialize geometry
53 if (initGeom) {
54 if (det == 0) AliEMCALGeometry::GetInstance("EMCAL_COMPLETEV1");
0d81af58 55 else if (det == 1) AliPHOSGeometry::GetInstance("IHEP");
045862db 56 }
57
58 // initialize analysis instance
59 if (det == 0)// EMCAL
60 task->InitCaloCellsQA(fname, nmods, AliAnalysisTaskCaloCellsQA::kEMCAL);
61 else if (det == 1)// PHOS
62 task->InitCaloCellsQA(fname, nmods, AliAnalysisTaskCaloCellsQA::kPHOS);
63 else
64 ::Fatal("AddTaskCaloCellsQA", "Wrong detector provided");
65
66 // activate filling of all the histograms
67 if (kFullAnalysis)
68 task->GetCaloCellsQA()->ActivateFullAnalysis();
69
70 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
71
72 return task;
73}