]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/EMCAL/macros/AddTaskEMCALTender.C
create general emcal task lib
[u/mrichter/AliRoot.git] / PWG / EMCAL / macros / AddTaskEMCALTender.C
1 // $Id$
2
3 AliAnalysisTaskSE *AddTaskEMCALTender()
4 {
5   // Get the pointer to the existing analysis manager via the static access method.
6   //==============================================================================
7   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
8   if (!mgr) {
9     ::Error("AddTaskEMCALTender", "No analysis manager to connect to.");
10     return NULL;
11   }
12
13   AliVEventHandler *evhand = mgr->GetInputEventHandler();
14
15   // Create the task and configure it.
16   //===========================================================================
17
18   AliAnalysisTaskSE *ana = 0;
19   AliEMCALTenderSupply *EMCALSupply = 0;
20
21   gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/ConfigEmcalTenderSupply.C");
22
23   if (evhand->InheritsFrom("AliESDInputHandler")) {
24     EMCALSupply = ConfigEmcalTenderSupply(kTRUE);
25
26     AliTender* alitender = new  AliTender("AliTender");
27     alitender->AddSupply(EMCALSupply);
28     alitender->SetDefaultCDBStorage("raw://"); 
29     ana = alitender;
30   }
31   else if (evhand->InheritsFrom("AliAODInputHandler")) {
32     EMCALSupply = ConfigEmcalTenderSupply(kFALSE);
33
34     AliEmcalTenderTask* emcaltender = new  AliEmcalTenderTask("AliEmcalTenderTask");
35     emcaltender->SetEMCALTenderSupply(EMCALSupply);
36     ana = emcaltender;
37   }
38   else {
39     ::Error("AddTaskEMCALTender", "Input event handler not recognized, AOD/ESD expected. Returning...");
40     return NULL;
41   }
42
43   mgr->AddTask(ana);
44
45   // Create ONLY the output containers for the data produced by the task.
46   // Get and connect other common input/output containers via the manager as below
47   //==============================================================================
48
49   mgr->ConnectInput  (ana, 0, mgr->GetCommonInputContainer());
50
51   AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("emcal_tender_event", 
52                                                             AliAODEvent::Class(), 
53                                                             AliAnalysisManager::kExchangeContainer, 
54                                                             "default_tender");
55   mgr->ConnectOutput (ana, 1, coutput1 );
56    
57   return ana;
58 }