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