]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/TRDqaAnalysis/AddTaskTRDmon.C
TOF + macros to each detector folder
[u/mrichter/AliRoot.git] / TRD / TRDqaAnalysis / AddTaskTRDmon.C
1 //////////////////////////////////////////////////////////////
2 // Macro to setup AliAnalysisTaskTRDmon                     //
3 // for TRD monitoring.                                      //
4 // ESD handler must be attached to the AliAnalysisManager   //
5 //                                                          //
6 // Output:                                                  //
7 //  TRDmon.root containing a TObjArray of histograms        //
8 //                                                          //
9 // 25.02.2010 Ionut Arsene i.c.arsene@gsi.de                //
10 //////////////////////////////////////////////////////////////
11
12 AliAnalysisTaskTRDmon* AddTaskTRDmon(const Char_t* triggerName = "",
13                                      Bool_t isCollisionTrigger = kTRUE) 
14 {
15   //
16   // Configures an AliAnalysisTRDmon task and adds it to the analysis train
17   //
18
19   // check the analysis manager
20   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
21   if(!mgr) {
22     Error("AddTaskTRDmon", "The analysis manager is not initialized");
23     return 0x0;
24   }
25
26   // check the ESD input handler
27   TString type = mgr->GetInputEventHandler()->GetDataType();
28   if(!type.Contains("ESD")) {
29     Error("AddTaskTRDmon", "AliAnalysisTaskTRDmon task needs the manager to have an ESD input handler.");
30     return 0x0;
31   }
32
33   // configure task
34   AliAnalysisTaskTRDmon *task = new AliAnalysisTaskTRDmon("TRDmon");
35   task->SetTriggerName(triggerName.Data());
36   task->SetIsCollisionEvent(isCollisionTrigger);
37   mgr->AddTask(task);
38
39   // connect input
40   mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
41
42   // connect output
43   AliAnalysisDataContainer *output = 
44     mgr->CreateContainer("TRDmon", TObjArray::Class(), 
45                          AliAnalysisManager::kOutputContainer, 
46                          Form("%s.root", task->GetName()));
47   mgr->ConnectOutput(task, 0, output);
48
49   return task;
50 }