o small fix
[u/mrichter/AliRoot.git] / ANALYSIS / TenderSupplies / AddTaskTender.C
1 AliAnalysisTask *AddTaskTender(Bool_t useV0=kFALSE){
2   //get the current analysis manager
3   Bool_t checkEvtSelection = useV0;
4   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
5   if (!mgr) {
6     Error("AddTaskTender", "No analysis manager found.");
7     return 0;
8   }
9   // currently don't accept AOD input
10   if (!mgr->GetInputEventHandler() || !mgr->GetInputEventHandler()->InheritsFrom(AliESDInputHandler::Class())) {
11     Error("AddTaskTender","The analysis tender only works with ESD input!");
12     return 0;
13   }
14
15   
16   //========= Add tender to the ANALYSIS manager and set default storage =====
17   AliTender *tender=new AliTender("AnalysisTender");
18   tender->SetCheckEventSelection(checkEvtSelection);
19   tender->SetDefaultCDBStorage("raw://");
20   mgr->AddTask(tender);
21   if (checkEvtSelection) {
22     if (mgr->GetTasks()->First() != (TObject*)tender ) {
23       TString firstName(mgr->GetTasks()->First()->GetName());
24       Bool_t isSecond=(mgr->GetTasks()->At(1) == (TObject*)tender);
25       if (! (firstName=="PIDResponseTask" && isSecond )){
26         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!");
27         return NULL;
28       }
29     }
30   }
31   
32   //========= Attach VZERO supply ======
33
34   if (useV0) {
35      AliVZEROTenderSupply *vzeroSupply=new AliVZEROTenderSupply("VZEROtender");
36      vzeroSupply->SetDebug(kFALSE);
37      tender->AddSupply(vzeroSupply);
38   }   
39
40  
41   //========= Attach TPC supply ======
42   AliTPCTenderSupply *tpcSupply=new AliTPCTenderSupply("TPCtender");
43   tpcSupply->SetDebugLevel(2);
44   //tpcSupply->SetMip(50.);
45   tender->AddSupply(tpcSupply);
46
47   //========= Attach T0 supply ======
48 //  AliT0TenderSupply *t0Tender = new AliT0TenderSupply("T0tender");
49 //  tender->AddSupply(t0Tender);
50
51   //========= Attach TOF supply ======
52   AliTOFTenderSupply *tofTender = new AliTOFTenderSupply("TOFtender");
53   tender->AddSupply(tofTender);
54
55   //========= Attach TRD supply ======
56   AliTRDTenderSupply *trdSupply=new AliTRDTenderSupply("TRDtender");
57   trdSupply->SetLoadReferencesFromCDB();
58   // Mask Bad chambers
59   trdSupply->AddBadChamber(265);      // low drift
60   trdSupply->AddBadChamber(50);
61   trdSupply->AddBadChamber(524);      // low drift
62   trdSupply->AddBadChamber(32);       // intermediate gain
63   trdSupply->AddBadChamber(15);
64   trdSupply->AddBadChamber(231);      // low gain
65   trdSupply->AddBadChamber(273);      // intermediate gain
66   trdSupply->AddBadChamber(532);
67   trdSupply->AddBadChamber(5);        // low drift
68   trdSupply->AddBadChamber(227);
69   trdSupply->AddBadChamber(287);      // low drift
70   trdSupply->AddBadChamber(212);      // intermediate gain
71   trdSupply->AddBadChamber(228);      // low gain
72   trdSupply->AddBadChamber(52);       // low gain
73   trdSupply->AddBadChamber(169);      // low drift
74   trdSupply->AddBadChamber(236);      // low drift
75
76   trdSupply->SetPIDmethod(AliTRDTenderSupply::k1DLQpid);
77   trdSupply->SetNormalizationFactor(1./7.603);
78   tender->AddSupply(trdSupply);
79
80   //========= Attach PID supply ======
81   tender->AddSupply(new AliPIDTenderSupply("PIDtender"));
82
83   //========= Attach Primary Vertex supply ======
84   tender->AddSupply(new AliVtxTenderSupply("PriVtxtender"));
85
86   //================================================
87   //              data containers
88   //================================================
89
90     //            define output containers, please use 'username'_'somename'
91   AliAnalysisDataContainer *coutput1 =
92       mgr->CreateContainer("tender_event", AliESDEvent::Class(),
93                            AliAnalysisManager::kExchangeContainer,"default_tender");
94  
95   //           connect containers
96   mgr->ConnectInput  (tender,  0, mgr->GetCommonInputContainer() );
97   mgr->ConnectOutput (tender,  1, coutput1);
98  
99   return tender;
100 }