]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/TenderSupplies/AddTaskTender.C
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / ANALYSIS / TenderSupplies / AddTaskTender.C
1 AliAnalysisTask *AddTaskTender(Bool_t useV0=kFALSE, 
2                                Bool_t useTPC=kTRUE,
3                                Bool_t useTOF=kTRUE,
4                                Bool_t useTRD=kTRUE,
5                                Bool_t usePID=kTRUE,
6                                Bool_t useVTX=kTRUE,
7                                Bool_t useT0=kTRUE,
8                                Bool_t useEmc=kFALSE,
9                                Bool_t usePtFix=kFALSE)
10 {
11   if (!(useV0 | useTPC | useTOF | useTRD | usePID | useVTX | | useT0 | useEmc | usePtFix)) {
12      ::Error("AddTaskTender", "No supply added to tender, so tender not created");
13      return 0;
14   }   
15   //get the current analysis manager
16   Bool_t checkEvtSelection = useV0;
17   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
18   if (!mgr) {
19     ::Error("AddTaskTender", "No analysis manager found.");
20     return 0;
21   }
22   // currently don't accept AOD input
23   if (!mgr->GetInputEventHandler()->InheritsFrom(AliESDInputHandler::Class())) {
24     ::Error("AddTask_tender_Tender","The analysis tender only works with ESD input!");
25     return 0;
26   }
27   
28   //========= Add tender to the ANALYSIS manager and set default storage =====
29   AliTender *tender=new AliTender("AnalysisTender");
30   tender->SetCheckEventSelection(checkEvtSelection);
31   tender->SetDefaultCDBStorage("raw://");
32   mgr->AddTask(tender);
33   
34   //check that that tender is the first task after the pid response
35   TString firstName(mgr->GetTasks()->First()->GetName());
36   Bool_t isSecond=(mgr->GetTasks()->At(1) == (TObject*)tender);
37
38   if (! (firstName=="PIDResponseTask" && isSecond )){
39     Fatal("AddTaskTender","When using the tender the first task needs to be the PIDResponse and the tender the second task!!!");
40     return NULL;
41   }
42   
43   //========= Attach VZERO supply ======
44   if (useV0) {
45      AliVZEROTenderSupply *vzeroSupply=new AliVZEROTenderSupply("VZEROtender");
46      vzeroSupply->SetDebug(kFALSE);
47      tender->AddSupply(vzeroSupply);
48   }   
49
50  
51   //========= Attach TPC supply ======
52   if (useTPC) {
53      AliTPCTenderSupply *tpcSupply=new AliTPCTenderSupply("TPCtender");
54      tpcSupply->SetDebugLevel(2);
55      //tpcSupply->SetMip(50.);
56      tender->AddSupply(tpcSupply);
57   }   
58
59   //========= Attach track 1/pt correction supply ======
60   if (usePtFix) {
61      AliTrackFixTenderSupply *trfixSupply=new AliTrackFixTenderSupply("PTInvFix");
62      //trfixSupply->SetDebugLevel(2);
63      tender->AddSupply(trfixSupply);
64   }   
65
66   //========= Attach T0 supply ======
67   if (useT0) {
68     AliT0TenderSupply *t0Tender = new AliT0TenderSupply("T0tender");
69     t0Tender ->SetPass4LHC11aCorrection(kTRUE);
70     tender->AddSupply(t0Tender);
71   }   
72
73   //========= Attach TOF supply ======
74   if (useTOF) {
75     AliTOFTenderSupply *tofTender = new AliTOFTenderSupply("TOFtender");
76     tender->AddSupply(tofTender);
77  }   
78
79   //========= Attach TRD supply ======
80   if (useTRD) {
81     AliTRDTenderSupply *trdSupply=new AliTRDTenderSupply("TRDtender");
82
83     trdSupply->SetLoadDeadChambersFromCDB();                    // Mask Bad chambers
84     trdSupply->SetPIDmethod(AliTRDTenderSupply::k1DLQpid);
85     trdSupply->SwitchOffGainCorrection();                       // Correction only on pass 1
86     trdSupply->SetNormalizationFactor(0.12697,114737,130850);   // 1 otherwise
87     trdSupply->SetRedoTRDMatching(kTRUE);
88     tender->AddSupply(trdSupply);
89   }  
90
91   //========= Attach Primary Vertex supply ======
92   if (useVTX) {
93     tender->AddSupply(new AliVtxTenderSupply("PriVtxtender"));
94   }  
95
96   //========= Attach EMCAL supply ======
97   if (useEmc) {
98     AliEMCALTenderSupply *emcSupply = new AliEMCALTenderSupply("EmcTender");
99     emcSupply->SetDefaults();
100     tender->AddSupply(emcSupply);
101   }  
102
103   //========= Attach PID supply ======
104   if (usePID) {
105     AliPIDTenderSupply *pidSupply=new AliPIDTenderSupply("PIDtender");
106     tender->AddSupply(pidSupply);
107   }
108
109   //================================================
110   //              data containers
111   //================================================
112
113     //            define output containers, please use 'username'_'somename'
114   AliAnalysisDataContainer *coutput1 =
115       mgr->CreateContainer("tender_event", AliESDEvent::Class(),
116                            AliAnalysisManager::kExchangeContainer,"default_tender");
117  
118   //           connect containers
119   mgr->ConnectInput  (tender,  0, mgr->GetCommonInputContainer() );
120   mgr->ConnectOutput (tender,  1, coutput1);
121  
122   return tender;
123 }