]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/PHOSTasks/CaloCellQA/macros/AddTaskCaloCellsQA.C
Transition PWG4 --> PWGGA
[u/mrichter/AliRoot.git] / PWGGA / PHOSTasks / CaloCellQA / macros / AddTaskCaloCellsQA.C
CommitLineData
d30ac678 1AliAnalysisTaskCaloCellsQA* AddTaskCaloCellsQA(Int_t nmods = 10, Int_t det = 0,
2 char* fname = "CellsQA.root", char* contname = NULL)
045862db 3{
0d81af58 4 // Task to add EMCAL/PHOS cellsQA/runsQA to your analysis.
045862db 5 //
0d81af58 6 // Usage example for EMCAL:
045862db 7 //
d30ac678 8 // gSystem->Load("libPWG4UserTasks.so");
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
d30ac678 13 // // taskQA->GetCaloCellsQA()->ActivateFullAnalysis(); // more histograms, not usually necessary
f4dd0897 14 // // Int_t badcells[] = {74,103,917};
15 // // taskQA->SetBadCells(badcells, 3); // reject clusters containing any of these cells
045862db 16 //
0d81af58 17 // Usage example for PHOS:
18 //
d30ac678 19 // gSystem->Load("libPWG4UserTasks.so");
0d81af58 20 // gROOT->LoadMacro("$ALICE_ROOT/PWG4/UserTasks/CaloCellQA/macros/AddTaskCaloCellsQA.C");
21 // AliAnalysisTaskCaloCellsQA *taskQA = AddTaskCaloCellsQA(4, 1);
22 // taskQA->SelectCollisionCandidates(AliVEvent::kMB); // if necessary
23 // taskQA->GetCaloCellsQA()->SetClusterEnergyCuts(0.3,0.1); // increase statistics
d30ac678 24 // // taskQA->SetAvoidPileup(kFALSE); // some customization
25 // // taskQA->GetCaloCellsQA()->ActivateFullAnalysis(); // more histograms, not usually necessary
26 // // Int_t badcells[] = {1234};
27 // // taskQA->SetBadCells(badcells, 1); // reject clusters containing any of these cells
045862db 28 //
045862db 29 // nmods -- maximum supermodule number + 1:
30 // use 4 for EMCAL <= 2010;
31 // use 4 for PHOS (PHOS numbers start from 1, not from zero);
32 // use 10 for EMCAL >= 2011;
33 // det -- detector, 0/EMCAL, 1/PHOS;
d30ac678 34 // fname -- output file name;
35 // if NULL, the output will be written into mgr->GetCommonFileName() + container;
4dfe4df7 36 // contname -- TObjArray container name in the output file;
d30ac678 37 // if not NULL (or fname = NULL), the output will be written into output container and
38 // cannot be later merged for different run numbers;
39 // contname must be unique, if you are going to call AddTaskCaloCellsQA() several times.
40 //
41 // Note that if fname = NULL and contname = NULL, the output will be written into
42 // file mgr->GetCommonFileName() with container name CellsQAResults.
045862db 43
44 // get manager instance
45 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
46 if (!mgr) {
47 ::Error("AddTaskCaloCellsQA", "No analysis manager to connect to");
48 return NULL;
49 }
50
51 // check the analysis type using the event handlers connected to the analysis manager
52 if (!mgr->GetInputEventHandler()) {
53 ::Error("AddTaskCaloCellsQA", "This task requires an input event handler");
54 return NULL;
55 }
56
57 // Configure analysis
58 //===========================================================================
59
d30ac678 60 // detector number
61 Int_t det2 = -1;
62 if (det == 0) det2 = AliAnalysisTaskCaloCellsQA::kEMCAL;
63 else if (det == 1) det2 = AliAnalysisTaskCaloCellsQA::kPHOS;
64 else
65 ::Fatal("AddTaskCaloCellsQA", "Wrong detector provided");
66
4dfe4df7 67 AliAnalysisTaskCaloCellsQA* task;
045862db 68
d30ac678 69 if (fname && !contname) task = new AliAnalysisTaskCaloCellsQA("AliAnalysisTaskCaloCellsQA", nmods, det2, fname);
70 else task = new AliAnalysisTaskCaloCellsQA("AliAnalysisTaskCaloCellsQA", nmods, det2);
4dfe4df7 71 mgr->AddTask(task);
045862db 72
045862db 73 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
74
d30ac678 75 // container output into particular file
76 if (fname && contname)
4dfe4df7 77 mgr->ConnectOutput(task, 1, mgr->CreateContainer(contname,
78 TObjArray::Class(), AliAnalysisManager::kOutputContainer, fname));
79
d30ac678 80 // container output into common file
81 if (!fname) {
82 if (!contname) contname = "CellsQAResults";
83 mgr->ConnectOutput(task, 1, mgr->CreateContainer(contname,
84 TObjArray::Class(), AliAnalysisManager::kOutputContainer, mgr->GetCommonFileName()));
85 }
86
045862db 87 return task;
88}