- Reshuffling of the particle codes in AliPID. Now the light nuclei are between the
[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,
906dab39 9 Bool_t usePtFix=kFALSE)
98e8eede 10{
906dab39 11 if (!(useV0 | useTPC | useTOF | useTRD | usePID | useVTX | | useT0 | useEmc | usePtFix)) {
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);
00a38d07 33
34 Bool_t cachePID=kFALSE;
35
36 //check that that tender is the first task after the pid response
37 TString firstName(mgr->GetTasks()->First()->GetName());
38 Bool_t isSecond=(mgr->GetTasks()->At(1) == (TObject*)tender);
39
40 if (! (firstName=="PIDResponseTask" && isSecond )){
41 Fatal("AddTaskTender","When using the tender the first task needs to be the PIDResponse and the tender the second task!!!");
42 return NULL;
43 }
44
45 AliAnalysisTaskPIDResponse *pidResp=(AliAnalysisTaskPIDResponse*)mgr->GetTasks()->First();
46 if (pidResp->GetCachePID()){
47 usePID=kTRUE;
48 pidResp->SetCachePID(kFALSE);
49 cachePID=kTRUE;
5dea385b 50 }
e75408ba 51
9259172d 52 //========= Attach VZERO supply ======
6d163207 53
2d28db9f 54 if (useV0) {
55 AliVZEROTenderSupply *vzeroSupply=new AliVZEROTenderSupply("VZEROtender");
56 vzeroSupply->SetDebug(kFALSE);
57 tender->AddSupply(vzeroSupply);
58 }
5ff9ab50 59
6d163207 60
e75408ba 61 //========= Attach TPC supply ======
de05232c 62 if (useTPC) {
63 AliTPCTenderSupply *tpcSupply=new AliTPCTenderSupply("TPCtender");
64 tpcSupply->SetDebugLevel(2);
65 //tpcSupply->SetMip(50.);
66 tender->AddSupply(tpcSupply);
67 }
c9a7f36c 68
82fdfe7d 69 //========= Attach track 1/pt correction supply ======
70 if (usePtFix) {
71 AliTrackFixTenderSupply *trfixSupply=new AliTrackFixTenderSupply("PTInvFix");
72 //trfixSupply->SetDebugLevel(2);
73 tender->AddSupply(trfixSupply);
74 }
75
c9a7f36c 76 //========= Attach T0 supply ======
de05232c 77 if (useT0) {
78 AliT0TenderSupply *t0Tender = new AliT0TenderSupply("T0tender");
1f671b29 79 t0Tender ->SetPass4LHC11aCorrection(kTRUE);
de05232c 80 tender->AddSupply(t0Tender);
81 }
c9a7f36c 82
e75408ba 83 //========= Attach TOF supply ======
de05232c 84 if (useTOF) {
85 AliTOFTenderSupply *tofTender = new AliTOFTenderSupply("TOFtender");
86 tender->AddSupply(tofTender);
87 }
5ff9ab50 88
e75408ba 89 //========= Attach TRD supply ======
de05232c 90 if (useTRD) {
91 AliTRDTenderSupply *trdSupply=new AliTRDTenderSupply("TRDtender");
92 trdSupply->SetLoadReferencesFromCDB();
93 // Mask Bad chambers
94 trdSupply->AddBadChamber(265); // low drift
95 trdSupply->AddBadChamber(50);
96 trdSupply->AddBadChamber(524); // low drift
97 trdSupply->AddBadChamber(32); // intermediate gain
98 trdSupply->AddBadChamber(15);
99 trdSupply->AddBadChamber(231); // low gain
100 trdSupply->AddBadChamber(273); // intermediate gain
101 trdSupply->AddBadChamber(532);
102 trdSupply->AddBadChamber(5); // low drift
103 trdSupply->AddBadChamber(227);
104 trdSupply->AddBadChamber(287); // low drift
105 trdSupply->AddBadChamber(212); // intermediate gain
106 trdSupply->AddBadChamber(228); // low gain
107 trdSupply->AddBadChamber(52); // low gain
108 trdSupply->AddBadChamber(169); // low drift
109 trdSupply->AddBadChamber(236); // low drift
51a0ce25 110
de05232c 111 trdSupply->SetPIDmethod(AliTRDTenderSupply::k1DLQpid);
112 trdSupply->SetNormalizationFactor(1./7.603);
113 tender->AddSupply(trdSupply);
114 }
e75408ba 115
e75408ba 116 //========= Attach Primary Vertex supply ======
de05232c 117 if (useVTX) {
118 tender->AddSupply(new AliVtxTenderSupply("PriVtxtender"));
119 }
6d163207 120
98e8eede 121 //========= Attach EMCAL supply ======
122 if (useEmc) {
123 AliEMCALTenderSupply *emcSupply = new AliEMCALTenderSupply("EmcTender");
124 emcSupply->SetDefaults();
125 tender->AddSupply(emcSupply);
126 }
127
00a38d07 128 //========= Attach PID supply ======
129 if (usePID) {
130 AliPIDTenderSupply *pidSupply=new AliPIDTenderSupply("PIDtender");
131 pidSupply->SetCachePID(cachePID);
132 tender->AddSupply(pidSupply);
133 }
134
e75408ba 135 //================================================
136 // data containers
137 //================================================
138
139 // define output containers, please use 'username'_'somename'
140 AliAnalysisDataContainer *coutput1 =
141 mgr->CreateContainer("tender_event", AliESDEvent::Class(),
142 AliAnalysisManager::kExchangeContainer,"default_tender");
143
144 // connect containers
145 mgr->ConnectInput (tender, 0, mgr->GetCommonInputContainer() );
aa269eb9 146 mgr->ConnectOutput (tender, 1, coutput1);
e75408ba 147
148 return tender;
149}