]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TENDER/TenderSupplies/AddTaskTender.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / TENDER / 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
00a38d07 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
9259172d 43 //========= Attach VZERO supply ======
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
82fdfe7d 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
c9a7f36c 66 //========= Attach T0 supply ======
de05232c 67 if (useT0) {
68 AliT0TenderSupply *t0Tender = new AliT0TenderSupply("T0tender");
1f671b29 69 t0Tender ->SetPass4LHC11aCorrection(kTRUE);
de05232c 70 tender->AddSupply(t0Tender);
71 }
c9a7f36c 72
e75408ba 73 //========= Attach TOF supply ======
de05232c 74 if (useTOF) {
75 AliTOFTenderSupply *tofTender = new AliTOFTenderSupply("TOFtender");
76 tender->AddSupply(tofTender);
77 }
5ff9ab50 78
e75408ba 79 //========= Attach TRD supply ======
de05232c 80 if (useTRD) {
81 AliTRDTenderSupply *trdSupply=new AliTRDTenderSupply("TRDtender");
51a0ce25 82
c508f6bd 83 trdSupply->SetLoadDeadChambersFromCDB(); // Mask Bad chambers
de05232c 84 trdSupply->SetPIDmethod(AliTRDTenderSupply::k1DLQpid);
c508f6bd 85 trdSupply->SwitchOffGainCorrection(); // Correction only on pass 1
86 trdSupply->SetNormalizationFactor(0.12697,114737,130850); // 1 otherwise
87 trdSupply->SetRedoTRDMatching(kTRUE);
de05232c 88 tender->AddSupply(trdSupply);
89 }
e75408ba 90
e75408ba 91 //========= Attach Primary Vertex supply ======
de05232c 92 if (useVTX) {
93 tender->AddSupply(new AliVtxTenderSupply("PriVtxtender"));
94 }
6d163207 95
98e8eede 96 //========= Attach EMCAL supply ======
97 if (useEmc) {
98 AliEMCALTenderSupply *emcSupply = new AliEMCALTenderSupply("EmcTender");
99 emcSupply->SetDefaults();
100 tender->AddSupply(emcSupply);
101 }
102
00a38d07 103 //========= Attach PID supply ======
104 if (usePID) {
105 AliPIDTenderSupply *pidSupply=new AliPIDTenderSupply("PIDtender");
00a38d07 106 tender->AddSupply(pidSupply);
107 }
108
e75408ba 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() );
aa269eb9 120 mgr->ConnectOutput (tender, 1, coutput1);
e75408ba 121
122 return tender;
123}