]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/macros/AddTaskTaggedPhotons.C
Changes to QA TPC, extra task for cosmics, Added utility classes for UE analysis
[u/mrichter/AliRoot.git] / PWG4 / macros / AddTaskTaggedPhotons.C
1 AliAnalysisTaskTaggedPhotons* AddTaskTaggedPhotons(Bool_t bPHOS = kFALSE)
2 {
3   // Creates an tagged photons task, 
4   // configures it and adds it to the analysis manager.
5
6   // Get the pointer to the existing analysis manager via the static access method.
7   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
8   if (!mgr) {
9     ::Error("AddTaskTaggedPhotons", "No analysis manager to connect to.");
10     return NULL;
11   }  
12
13   // Check the analysis type using the event handlers connected to the analysis manager.
14   if (!mgr->GetInputEventHandler()) {
15     ::Error("AddTaskTaggedPhotons", "This task requires an input event handler");
16     return NULL;
17   }
18   
19   // Add task
20   
21   TString det;
22   if(bPHOS)det = "PHOS";
23   else det = "EMCAL";
24   
25   AliAnalysisTaskTaggedPhotons * task = new AliAnalysisTaskTaggedPhotons(Form("Tagged%s",det.Data()));
26   task->SetPHOS(bPHOS);
27   mgr->AddTask(task);
28
29
30
31   TString outputfile = AliAnalysisManager::GetCommonFileName();                                                              
32   AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(Form("tagged%s",det.Data()), TList::Class(),
33                                                             AliAnalysisManager::kOutputContainer, Form("%s:PWG4_tagged%s",outputfile.Data(),det.Data()));
34   mgr->ConnectInput  (task, 0, mgr->GetCommonInputContainer());
35   mgr->ConnectOutput (task, 0, mgr->GetCommonOutputContainer());
36
37   mgr->ConnectOutput (task,    1, coutput2 );
38   
39   return task;
40 }
41
42