o updates to fix the 11a pass4 problem of T0 (Alla)
[u/mrichter/AliRoot.git] / ANALYSIS / TenderSupplies / AddTaskTender.C
CommitLineData
de05232c 1AliAnalysisTask *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,
98e8eede 7 Bool_t useT0=kTRUE,
8 Bool_t useEmc=kFALSE)
9{
10 if (!(useV0 | useTPC | useTOF | useTRD | usePID | useVTX | useEmc)) {
de05232c 11 ::Error("AddTaskTender", "No supply added to tender, so tender not created");
12 return 0;
13 }
e75408ba 14 //get the current analysis manager
2d28db9f 15 Bool_t checkEvtSelection = useV0;
e75408ba 16 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
17 if (!mgr) {
de05232c 18 ::Error("AddTaskTender", "No analysis manager found.");
e75408ba 19 return 0;
20 }
21 // currently don't accept AOD input
de05232c 22 if (!mgr->GetInputEventHandler()->InheritsFrom(AliESDInputHandler::Class())) {
23 ::Error("AddTask_tender_Tender","The analysis tender only works with ESD input!");
e75408ba 24 return 0;
25 }
e75408ba 26
27 //========= Add tender to the ANALYSIS manager and set default storage =====
28 AliTender *tender=new AliTender("AnalysisTender");
aaf2d706 29 tender->SetCheckEventSelection(checkEvtSelection);
351c53ea 30 tender->SetDefaultCDBStorage("raw://");
f930b7bf 31 mgr->AddTask(tender);
aaf2d706 32 if (checkEvtSelection) {
5dea385b 33 if (mgr->GetTasks()->First() != (TObject*)tender ) {
34 TString firstName(mgr->GetTasks()->First()->GetName());
35 Bool_t isSecond=(mgr->GetTasks()->At(1) == (TObject*)tender);
36 if (! (firstName=="PIDResponseTask" && isSecond )){
f930b7bf 37 Fatal("AddTaskTender","When setting the tender to check the event selection, it has to be the first wagon, or the first after the PID Response!");
aaf2d706 38 return NULL;
5dea385b 39 }
40 }
41 }
e75408ba 42
9259172d 43 //========= Attach VZERO supply ======
6d163207 44
2d28db9f 45 if (useV0) {
46 AliVZEROTenderSupply *vzeroSupply=new AliVZEROTenderSupply("VZEROtender");
47 vzeroSupply->SetDebug(kFALSE);
48 tender->AddSupply(vzeroSupply);
49 }
5ff9ab50 50
6d163207 51
e75408ba 52 //========= Attach TPC supply ======
de05232c 53 if (useTPC) {
54 AliTPCTenderSupply *tpcSupply=new AliTPCTenderSupply("TPCtender");
55 tpcSupply->SetDebugLevel(2);
56 //tpcSupply->SetMip(50.);
57 tender->AddSupply(tpcSupply);
58 }
c9a7f36c 59
60 //========= Attach T0 supply ======
de05232c 61 if (useT0) {
62 AliT0TenderSupply *t0Tender = new AliT0TenderSupply("T0tender");
1f671b29 63 t0Tender ->SetPass4LHC11aCorrection(kTRUE);
de05232c 64 tender->AddSupply(t0Tender);
65 }
c9a7f36c 66
e75408ba 67 //========= Attach TOF supply ======
de05232c 68 if (useTOF) {
69 AliTOFTenderSupply *tofTender = new AliTOFTenderSupply("TOFtender");
70 tender->AddSupply(tofTender);
71 }
5ff9ab50 72
e75408ba 73 //========= Attach TRD supply ======
de05232c 74 if (useTRD) {
75 AliTRDTenderSupply *trdSupply=new AliTRDTenderSupply("TRDtender");
76 trdSupply->SetLoadReferencesFromCDB();
77 // Mask Bad chambers
78 trdSupply->AddBadChamber(265); // low drift
79 trdSupply->AddBadChamber(50);
80 trdSupply->AddBadChamber(524); // low drift
81 trdSupply->AddBadChamber(32); // intermediate gain
82 trdSupply->AddBadChamber(15);
83 trdSupply->AddBadChamber(231); // low gain
84 trdSupply->AddBadChamber(273); // intermediate gain
85 trdSupply->AddBadChamber(532);
86 trdSupply->AddBadChamber(5); // low drift
87 trdSupply->AddBadChamber(227);
88 trdSupply->AddBadChamber(287); // low drift
89 trdSupply->AddBadChamber(212); // intermediate gain
90 trdSupply->AddBadChamber(228); // low gain
91 trdSupply->AddBadChamber(52); // low gain
92 trdSupply->AddBadChamber(169); // low drift
93 trdSupply->AddBadChamber(236); // low drift
51a0ce25 94
de05232c 95 trdSupply->SetPIDmethod(AliTRDTenderSupply::k1DLQpid);
96 trdSupply->SetNormalizationFactor(1./7.603);
97 tender->AddSupply(trdSupply);
98 }
e75408ba 99
100 //========= Attach PID supply ======
de05232c 101 if (usePID) {
102 tender->AddSupply(new AliPIDTenderSupply("PIDtender"));
103 }
e75408ba 104
105 //========= Attach Primary Vertex supply ======
de05232c 106 if (useVTX) {
107 tender->AddSupply(new AliVtxTenderSupply("PriVtxtender"));
108 }
6d163207 109
98e8eede 110 //========= Attach EMCAL supply ======
111 if (useEmc) {
112 AliEMCALTenderSupply *emcSupply = new AliEMCALTenderSupply("EmcTender");
113 emcSupply->SetDefaults();
114 tender->AddSupply(emcSupply);
115 }
116
e75408ba 117 //================================================
118 // data containers
119 //================================================
120
121 // define output containers, please use 'username'_'somename'
122 AliAnalysisDataContainer *coutput1 =
123 mgr->CreateContainer("tender_event", AliESDEvent::Class(),
124 AliAnalysisManager::kExchangeContainer,"default_tender");
125
126 // connect containers
127 mgr->ConnectInput (tender, 0, mgr->GetCommonInputContainer() );
aa269eb9 128 mgr->ConnectOutput (tender, 1, coutput1);
e75408ba 129
130 return tender;
131}