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