Include 1/pt fixing supply to the train (but switched off)
[u/mrichter/AliRoot.git] / ANALYSIS / TenderSupplies / AddTaskTender.C
index ee7e3c7..688a1ae 100644 (file)
@@ -1,16 +1,29 @@
-AliAnalysisTask *AddTaskTender(Bool_t checkEvtSelection=kFALSE){
+AliAnalysisTask *AddTaskTender(Bool_t useV0=kFALSE, 
+                               Bool_t useTPC=kTRUE,
+                               Bool_t useTOF=kTRUE,
+                               Bool_t useTRD=kTRUE,
+                               Bool_t usePID=kTRUE,
+                               Bool_t useVTX=kTRUE,
+                               Bool_t useT0=kTRUE,
+                               Bool_t useEmc=kFALSE,
+                              Bool_t usePtFix=kFALSE)
+{
+  if (!(useV0 | useTPC | useTOF | useTRD | usePID | useVTX | useEmc)) {
+     ::Error("AddTaskTender", "No supply added to tender, so tender not created");
+     return 0;
+  }   
   //get the current analysis manager
+  Bool_t checkEvtSelection = useV0;
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) {
-    Error("AddTask_tender_Tender", "No analysis manager found.");
+    ::Error("AddTaskTender", "No analysis manager found.");
     return 0;
   }
   // currently don't accept AOD input
   if (!mgr->GetInputEventHandler()->InheritsFrom(AliESDInputHandler::Class())) {
-    Error("AddTask_tender_Tender","The analysis tender only works with ESD input!");
+    ::Error("AddTask_tender_Tender","The analysis tender only works with ESD input!");
     return 0;
   }
-
   
   //========= Add tender to the ANALYSIS manager and set default storage =====
   AliTender *tender=new AliTender("AnalysisTender");
@@ -18,32 +31,97 @@ AliAnalysisTask *AddTaskTender(Bool_t checkEvtSelection=kFALSE){
   tender->SetDefaultCDBStorage("raw://");
   mgr->AddTask(tender);
   if (checkEvtSelection) {
-     if (mgr->GetTasks()->First() != (TObject*)tender) {
-        ::Error("When setting the tender to check the event selection, it has to be the first wagon ! Aborting.");
+    if (mgr->GetTasks()->First() != (TObject*)tender ) {
+      TString firstName(mgr->GetTasks()->First()->GetName());
+      Bool_t isSecond=(mgr->GetTasks()->At(1) == (TObject*)tender);
+      if (! (firstName=="PIDResponseTask" && isSecond )){
+        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!");
         return NULL;
-     }
-  }   
+      }
+    }
+  }
   
+  //========= Attach VZERO supply ======
+
+  if (useV0) {
+     AliVZEROTenderSupply *vzeroSupply=new AliVZEROTenderSupply("VZEROtender");
+     vzeroSupply->SetDebug(kFALSE);
+     tender->AddSupply(vzeroSupply);
+  }   
+
   //========= Attach TPC supply ======
-  AliTPCTenderSupply *tpcSupply=new AliTPCTenderSupply("TPCtender");
-  tpcSupply->SetDebugLevel(2);
-  tpcSupply->SetMip(50.);
-  tender->AddSupply(tpcSupply);
+  if (useTPC) {
+     AliTPCTenderSupply *tpcSupply=new AliTPCTenderSupply("TPCtender");
+     tpcSupply->SetDebugLevel(2);
+     //tpcSupply->SetMip(50.);
+     tender->AddSupply(tpcSupply);
+  }   
+
+  //========= Attach track 1/pt correction supply ======
+  if (usePtFix) {
+     AliTrackFixTenderSupply *trfixSupply=new AliTrackFixTenderSupply("PTInvFix");
+     //trfixSupply->SetDebugLevel(2);
+     tender->AddSupply(trfixSupply);
+  }   
+
+  //========= Attach T0 supply ======
+  if (useT0) {
+    AliT0TenderSupply *t0Tender = new AliT0TenderSupply("T0tender");
+    t0Tender ->SetPass4LHC11aCorrection(kTRUE);
+    tender->AddSupply(t0Tender);
+  }   
 
   //========= Attach TOF supply ======
-  AliTOFTenderSupply *TOFtender = new AliTOFTenderSupply("TOFtender");
-  tender->AddSupply(TOFtender);
-  
+  if (useTOF) {
+    AliTOFTenderSupply *tofTender = new AliTOFTenderSupply("TOFtender");
+    tender->AddSupply(tofTender);
+ }   
+
   //========= Attach TRD supply ======
-  AliTRDTenderSupply *trdSupply=new AliTRDTenderSupply("TRDtender");
-  tender->AddSupply(trdSupply);
+  if (useTRD) {
+    AliTRDTenderSupply *trdSupply=new AliTRDTenderSupply("TRDtender");
+    trdSupply->SetLoadReferencesFromCDB();
+    // Mask Bad chambers
+    trdSupply->AddBadChamber(265);      // low drift
+    trdSupply->AddBadChamber(50);
+    trdSupply->AddBadChamber(524);      // low drift
+    trdSupply->AddBadChamber(32);       // intermediate gain
+    trdSupply->AddBadChamber(15);
+    trdSupply->AddBadChamber(231);      // low gain
+    trdSupply->AddBadChamber(273);      // intermediate gain
+    trdSupply->AddBadChamber(532);
+    trdSupply->AddBadChamber(5);        // low drift
+    trdSupply->AddBadChamber(227);
+    trdSupply->AddBadChamber(287);      // low drift
+    trdSupply->AddBadChamber(212);      // intermediate gain
+    trdSupply->AddBadChamber(228);      // low gain
+    trdSupply->AddBadChamber(52);       // low gain
+    trdSupply->AddBadChamber(169);      // low drift
+    trdSupply->AddBadChamber(236);      // low drift
+
+    trdSupply->SetPIDmethod(AliTRDTenderSupply::k1DLQpid);
+    trdSupply->SetNormalizationFactor(1./7.603);
+    tender->AddSupply(trdSupply);
+  }  
 
   //========= Attach PID supply ======
-  tender->AddSupply(new AliPIDTenderSupply("PIDtender"));
+  if (usePID) {
+    tender->AddSupply(new AliPIDTenderSupply("PIDtender"));
+  }  
 
   //========= Attach Primary Vertex supply ======
-  tender->AddSupply(new AliVtxTenderSupply("PriVtxtender"));
-  
+  if (useVTX) {
+    tender->AddSupply(new AliVtxTenderSupply("PriVtxtender"));
+  }  
+
+  //========= Attach EMCAL supply ======
+  if (useEmc) {
+    AliEMCALTenderSupply *emcSupply = new AliEMCALTenderSupply("EmcTender");
+    emcSupply->SetDefaults();
+    tender->AddSupply(emcSupply);
+  }  
+
   //================================================
   //              data containers
   //================================================