Include 1/pt fixing supply to the train (but switched off)
[u/mrichter/AliRoot.git] / ANALYSIS / TenderSupplies / AddTaskTender.C
index 3397b9a..688a1ae 100644 (file)
@@ -1,17 +1,29 @@
-AliAnalysisTask *AddTaskTender(Bool_t useV0=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("AddTaskTender", "No analysis manager found.");
+    ::Error("AddTaskTender", "No analysis manager found.");
     return 0;
   }
   // currently don't accept AOD input
-  if (!mgr->GetInputEventHandler() || !mgr->GetInputEventHandler()->InheritsFrom(AliESDInputHandler::Class())) {
-    Error("AddTaskTender","The analysis tender only works with ESD input!");
+  if (!mgr->GetInputEventHandler()->InheritsFrom(AliESDInputHandler::Class())) {
+    ::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");
@@ -39,49 +51,76 @@ AliAnalysisTask *AddTaskTender(Bool_t useV0=kFALSE){
 
  
   //========= 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 ======
-//  AliT0TenderSupply *t0Tender = new AliT0TenderSupply("T0tender");
-//  tender->AddSupply(t0Tender);
+  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");
-  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
+  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);
+    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