]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/EMCAL/macros/AddTaskEMCALTender.C
consistently figure out track cuts (from Ruediger)
[u/mrichter/AliRoot.git] / PWG / EMCAL / macros / AddTaskEMCALTender.C
1 // $Id$
2
3 AliAnalysisTaskSE *AddTaskEMCALTender(
4   const char*  p       = "lhc11h",
5   Bool_t timeCut       = kFALSE,
6   Bool_t distBC        = kTRUE, 
7   Bool_t recalibClus   = kTRUE, 
8   Bool_t recalibClusPos = kTRUE, 
9   Bool_t nonLinearCorr = kTRUE, 
10   Bool_t remExotic     = kTRUE,
11   Bool_t fidRegion     = kFALSE,
12   Bool_t calibEnergy   = kTRUE,
13   Bool_t calibTime     = kTRUE,
14   Bool_t remBC         = kTRUE,
15   Bool_t reclusterize  = kFALSE,
16   Float_t seedthresh   = 0.1,  // 100 MeV 
17   Float_t cellthresh   = 0.05, // 50 MeV  
18   UInt_t clusterizer   = AliEMCALRecParam::kClusterizerNxN,
19   Bool_t trackMatch    = kFALSE,
20   Bool_t updateCellOnly= kFALSE,
21   const char* pass     = 0)
22 {
23   // Get the pointer to the existing analysis manager via the static access method.
24   //==============================================================================
25   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
26   if (!mgr) {
27     ::Error("AddTaskEMCALTender", "No analysis manager to connect to.");
28     return NULL;
29   }
30
31   AliVEventHandler *evhand = mgr->GetInputEventHandler();
32
33   // Create the task and configure it.
34   //===========================================================================
35
36   AliAnalysisTaskSE *ana = 0;
37   AliAnalysisDataContainer *coutput1 = 0;
38
39   UInt_t nonLinFunct = AliEMCALRecoUtils::kBeamTestCorrected;
40
41   TString period(p);
42   period.ToLower();
43   if (period == "lhc12a15e")
44     nonLinFunct = AliEMCALRecoUtils::kPi0MCv3;
45   else if (period == "lhc12a15a")
46     nonLinFunct = AliEMCALRecoUtils::kPi0MCv2;
47
48   gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/ConfigEmcalTenderSupply.C");
49
50   AliEMCALTenderSupply *EMCALSupply = ConfigEmcalTenderSupply(timeCut, distBC, recalibClus, recalibClusPos, nonLinearCorr, remExotic, 
51                                                               fidRegion, calibEnergy, calibTime, remBC, nonLinFunct, reclusterize, seedthresh, 
52                                                               cellthresh, clusterizer, trackMatch, updateCellOnly);
53   if (pass) 
54     EMCALSupply->SetPass(pass);
55
56   if (evhand->InheritsFrom("AliESDInputHandler")) {
57     AliTender* alitender = new  AliTender("AliTender");
58     alitender->AddSupply(EMCALSupply);
59     alitender->SetDefaultCDBStorage("raw://"); 
60     ana = alitender;
61
62     coutput1 = mgr->CreateContainer("emcal_tender_event", 
63                                     AliESDEvent::Class(), 
64                                     AliAnalysisManager::kExchangeContainer, 
65                                     "default_tender");
66   }
67   else if (evhand->InheritsFrom("AliAODInputHandler")) {
68     AliEmcalTenderTask* emcaltender = new  AliEmcalTenderTask("AliEmcalTenderTask");
69     emcaltender->SetEMCALTenderSupply(EMCALSupply);
70     ana = emcaltender;
71     coutput1 = mgr->CreateContainer("emcal_tender_event", 
72                                     AliAODEvent::Class(), 
73                                     AliAnalysisManager::kExchangeContainer, 
74                                     "default_tender");
75   }
76   else {
77     ::Error("AddTaskEMCALTender", "Input event handler not recognized, AOD/ESD expected. Returning...");
78     return NULL;
79   }
80
81   mgr->AddTask(ana);
82
83   // Create ONLY the output containers for the data produced by the task.
84   // Get and connect other common input/output containers via the manager as below
85   //==============================================================================
86
87   mgr->ConnectInput(ana, 0, mgr->GetCommonInputContainer());
88   mgr->ConnectOutput(ana, 1, coutput1 );
89    
90   return ana;
91 }