o TPC tender updates:
[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("AddTask_tender_Tender", "No analysis manager found.");
7     return 0;
8   }
9   // currently don't accept AOD input
10   if (!mgr->GetInputEventHandler()->InheritsFrom(AliESDInputHandler::Class())) {
11     Error("AddTask_tender_Tender","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   if (checkEvtSelection) {
21     if (mgr->GetTasks()->First() != (TObject*)tender ) {
22       TString firstName(mgr->GetTasks()->First()->GetName());
23       Bool_t isSecond=(mgr->GetTasks()->At(1) == (TObject*)tender);
24       if (! (firstName=="PIDResponseTask" && isSecond )){
25         ::Error("When setting the tender to check the event selection, it has to be the first wagon, or the first after the Physics selection ! Aborting.");
26         return NULL;
27       }
28     }
29   }
30   mgr->AddTask(tender);
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   //========= Attach TOF supply ======
47   AliTOFTenderSupply *tofTender = new AliTOFTenderSupply("TOFtender");
48   tender->AddSupply(tofTender);
49
50   //========= Attach TRD supply ======
51   AliTRDTenderSupply *trdSupply=new AliTRDTenderSupply("TRDtender");
52   trdSupply->SetLoadReferencesFromCDB();
53   // Mask Bad chambers
54   trdSupply->AddBadChamber(265);      // low drift
55   trdSupply->AddBadChamber(50);
56   trdSupply->AddBadChamber(524);      // low drift
57   trdSupply->AddBadChamber(32);       // intermediate gain
58   trdSupply->AddBadChamber(15);
59   trdSupply->AddBadChamber(231);      // low gain
60   trdSupply->AddBadChamber(273);      // intermediate gain
61   trdSupply->AddBadChamber(532);
62   trdSupply->AddBadChamber(5);        // low drift
63   trdSupply->AddBadChamber(227);
64   trdSupply->AddBadChamber(287);      // low drift
65   trdSupply->AddBadChamber(212);      // intermediate gain
66   trdSupply->AddBadChamber(228);      // low gain
67   trdSupply->AddBadChamber(52);       // low gain
68   trdSupply->AddBadChamber(169);      // low drift
69   trdSupply->AddBadChamber(236);      // low drift
70
71   trdSupply->SetPIDmethod(AliTRDTenderSupply::k1DLQpid);
72   trdSupply->SetNormalizationFactor(1./7.603);
73   tender->AddSupply(trdSupply);
74
75   //========= Attach PID supply ======
76   tender->AddSupply(new AliPIDTenderSupply("PIDtender"));
77
78   //========= Attach Primary Vertex supply ======
79   tender->AddSupply(new AliVtxTenderSupply("PriVtxtender"));
80
81   //================================================
82   //              data containers
83   //================================================
84
85     //            define output containers, please use 'username'_'somename'
86   AliAnalysisDataContainer *coutput1 =
87       mgr->CreateContainer("tender_event", AliESDEvent::Class(),
88                            AliAnalysisManager::kExchangeContainer,"default_tender");
89  
90   //           connect containers
91   mgr->ConnectInput  (tender,  0, mgr->GetCommonInputContainer() );
92   mgr->ConnectOutput (tender,  1, coutput1);
93  
94   return tender;
95 }