New version of Add task tender allowing to customize the components
authoragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 10 Apr 2012 08:16:23 +0000 (08:16 +0000)
committeragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 10 Apr 2012 08:16:23 +0000 (08:16 +0000)
ANALYSIS/TenderSupplies/AddTaskTender.C

index 3397b9a749d693d03f18af327ec2032c87d5a0e3..052da92e3248acc44c27a892a5ee47a69d88cd5b 100644 (file)
@@ -1,14 +1,24 @@
-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){
+  if (!(useV0 | useTPC | useTOF | useTRD | usePID | useVTX)) {
+     ::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;
   }
 
@@ -39,49 +49,61 @@ 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 T0 supply ======
-//  AliT0TenderSupply *t0Tender = new AliT0TenderSupply("T0tender");
-//  tender->AddSupply(t0Tender);
+  if (useT0) {
+    AliT0TenderSupply *t0Tender = new AliT0TenderSupply("T0tender");
+    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"));
+  }  
 
   //================================================
   //              data containers