- added the option to select which THnSparse object have to be filled, in order to...
authorkkanaki <kkanaki@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 9 Mar 2011 16:20:35 +0000 (16:20 +0000)
committerkkanaki <kkanaki@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 9 Mar 2011 16:20:35 +0000 (16:20 +0000)
- updated argument list and documentation
- removed option to run all QA tasks

HLT/QA/tasks/AliAnalysisTaskHLTCentralBarrel.cxx
HLT/QA/tasks/AliAnalysisTaskHLTCentralBarrel.h
HLT/QA/tasks/macros/compare-HLT-offline-local.C

index 2d3dcb3..556864e 100644 (file)
@@ -54,6 +54,7 @@ AliAnalysisTaskHLTCentralBarrel::AliAnalysisTaskHLTCentralBarrel()
   ,fEventHLT(0)
   ,fTrackOFF(0) 
   ,fTrackHLT(0)
+  ,fOptions()
   ,fTextBox(0)
 {
   // Constructor
@@ -75,6 +76,7 @@ AliAnalysisTaskHLTCentralBarrel::AliAnalysisTaskHLTCentralBarrel(const char *nam
   ,fEventHLT(0)
   ,fTrackOFF(0) 
   ,fTrackHLT(0) 
+  ,fOptions()
   ,fTextBox(0)
 {
   // Constructor
@@ -97,9 +99,7 @@ void AliAnalysisTaskHLTCentralBarrel::UserCreateOutputObjects(){
   fOutputList = new TList();
   fOutputList->SetOwner();
   fOutputList->SetName(GetName());
-  
-  
+    
   static const int sizeEvent = 6;
  
   int    binsEvent[sizeEvent] = {  50,  50, 250,   100,   100, 2 };
@@ -131,11 +131,11 @@ void AliAnalysisTaskHLTCentralBarrel::UserCreateOutputObjects(){
   }
   
   fTextBox = new TText();  
-  
+
   fOutputList->Add(fEventOFF);
   fOutputList->Add(fEventHLT);
   fOutputList->Add(fTrackOFF);
-  fOutputList->Add(fTrackHLT);
+  fOutputList->Add(fTrackHLT);  
   fOutputList->Add(fTextBox);
   
   PostData(1, fOutputList);
@@ -170,12 +170,6 @@ void AliAnalysisTaskHLTCentralBarrel::UserExec(Option_t *){
   }
       
   // if(fUseHLTTrigger && !((AliHLTGlobalTriggerDecision*)esdHLT->GetHLTTriggerDecision())->Result()) return;  
-   //Int_t centbin = -1;
-   //if(fUseCentrality){
-     //centbin = CalculateCentrality(esdOFF);
-     //printf("Centrality bin = %d", centbin);
-   //} 
-
   
   //============================ OFFLINE =============================//
 
@@ -187,10 +181,7 @@ void AliAnalysisTaskHLTCentralBarrel::UserExec(Option_t *){
   if(esdOFF->GetEventSpecie()==16) return;
 
   AliCentrality *cent = esdOFF->GetCentrality();
-  //printf("centrality V0: %f\n", cent->GetCentralityPercentile("V0M"));
-  //printf("centrality V0: %f\n",cent->GetCentralityPercentileUnchecked("V0M"));
-  //printf("centrality SPD: %f\n",cent->GetCentralityPercentile("CL1"));
-  
+    
   for(Int_t i=0; i<esdOFF->GetNumberOfTracks(); i++){
       AliESDtrack *esdTrackOFF = esdOFF->GetTrack(i);
       if (!esdTrackOFF) continue;
@@ -224,30 +215,50 @@ void AliAnalysisTaskHLTCentralBarrel::UserExec(Option_t *){
       //else ?????? why doesn't it work with pp????
       esdTrackOFF->GetImpactParametersTPC(dca,cov);
 
-      Float_t DCAr =-99, DCAz = -99.;   
-      Double_t trackOFF[] = {
-                               TMath::Abs(esdTrackOFF->Pt()) 
-                              ,esdTrackOFF->GetTPCNcls()      
-                              ,esdTrackOFF->Theta()           
-                              ,esdTrackOFF->Eta()             
-                              ,esdTrackOFF->Phi()             
-                              ,dca[0]                         
-                              ,dca[1]                         
-                              ,esdTrackOFF->Charge() 
-                              ,DCAr                           
-                              ,DCAz                           
-                              ,esdTrackOFF->GetNcls(0)
-                              ,nr_tracksOFF
-                              ,vertOFF->GetStatus()
-                              ,vertOFF->GetZ()
-                              //,centbin
-                              ,cent->GetCentralityPercentile("V0M")
-                           };
-      fTrackOFF->Fill(trackOFF);
-    }
+      Float_t DCAr =-99, DCAz = -99.;  
+
+      if(fBeamType.Contains("Pb")){       
+         Double_t trackOFF[] = {
+                                  TMath::Abs(esdTrackOFF->Pt()) 
+                                 ,esdTrackOFF->GetTPCNcls()      
+                                 ,esdTrackOFF->Theta()           
+                                 ,esdTrackOFF->Eta()             
+                                 ,esdTrackOFF->Phi()             
+                                 ,dca[0]                         
+                                 ,dca[1]                         
+                                 ,esdTrackOFF->Charge() 
+                                 ,DCAr                           
+                                 ,DCAz                           
+                                 ,esdTrackOFF->GetNcls(0)
+                                 ,nr_tracksOFF
+                                 ,vertOFF->GetStatus()
+                                 ,vertOFF->GetZ()
+                                 ,cent->GetCentralityPercentile("V0M")
+                              };                                                     
+        if(fOptions.Contains("track-off")) fTrackOFF->Fill(trackOFF);
+      } else {
+        Double_t trackOFF[] = {
+                                  TMath::Abs(esdTrackOFF->Pt()) 
+                                 ,esdTrackOFF->GetTPCNcls()      
+                                 ,esdTrackOFF->Theta()           
+                                 ,esdTrackOFF->Eta()             
+                                 ,esdTrackOFF->Phi()             
+                                 ,dca[0]                         
+                                 ,dca[1]                         
+                                 ,esdTrackOFF->Charge() 
+                                 ,DCAr                           
+                                 ,DCAz                           
+                                 ,esdTrackOFF->GetNcls(0)
+                                 ,nr_tracksOFF
+                                 ,vertOFF->GetStatus()
+                                 ,vertOFF->GetZ()                                
+                             };
+        if(fOptions.Contains("track-off")) fTrackOFF->Fill(trackOFF);
+      }
+  } // end of track loop
     
-    Double_t eventOFF[] = { vertOFF->GetX(), vertOFF->GetY(), vertOFF->GetZ(), vertOFF->GetNContributors(), nr_tracksOFF, vertOFF->GetStatus()};
-    fEventOFF->Fill(eventOFF);  
+  Double_t eventOFF[] = { vertOFF->GetX(), vertOFF->GetY(), vertOFF->GetZ(), vertOFF->GetNContributors(), nr_tracksOFF, vertOFF->GetStatus()};
+  if(fOptions.Contains("event-off")) fEventOFF->Fill(eventOFF);  
     
   
   
@@ -265,7 +276,7 @@ void AliAnalysisTaskHLTCentralBarrel::UserExec(Option_t *){
   }
   
   Double_t eventHLT[] = { vertHLT->GetX(), vertHLT->GetY(), vertHLT->GetZ(), vertHLT->GetNContributors(), nr_tracksHLT, vertHLT->GetStatus()};
-  fEventHLT->Fill(eventHLT);  
+  if(fOptions.Contains("event-hlt")) fEventHLT->Fill(eventHLT);  
 
   for(Int_t i=0; i<esdHLT->GetNumberOfTracks(); i++){
       
@@ -288,29 +299,45 @@ void AliAnalysisTaskHLTCentralBarrel::UserExec(Option_t *){
        esdTrackHLT->GetImpactParametersTPC(DCAr,DCAz);
       }
       
-      Int_t dummycl[10];
-
-      Double_t trackHLT[] = {
-                              TMath::Abs(esdTrackHLT->Pt())
-                             ,esdTrackHLT->GetTPCNcls()    
-                             ,esdTrackHLT->Theta()
-                             ,esdTrackHLT->Eta()           
-                             ,esdTrackHLT->Phi()
-                             ,dca[0]                       
-                             ,dca[1]                       
-                             ,esdTrackHLT->Charge()        
-                             ,DCAr                         
-                             ,DCAz                         
-                             //,esdTrackHLT->GetNcls(0)
-                             ,esdTrackHLT->GetITSclusters(dummycl)
-                             ,nr_tracksHLT
-                             ,vertHLT->GetStatus()
-                             ,vertHLT->GetZ()
-                             //,centbin
-                             ,cent->GetCentralityPercentile("V0M")
-                           };
-      fTrackHLT->Fill(trackHLT);      
-  }               
+      if(fBeamType.Contains("Pb")){
+         Double_t trackHLT[] = {
+                                TMath::Abs(esdTrackHLT->Pt())
+                               ,esdTrackHLT->GetTPCNcls()    
+                               ,esdTrackHLT->Theta()
+                               ,esdTrackHLT->Eta()           
+                               ,esdTrackHLT->Phi()
+                               ,dca[0]                       
+                               ,dca[1]                       
+                               ,esdTrackHLT->Charge()        
+                               ,DCAr                         
+                               ,DCAz                         
+                               ,esdTrackHLT->GetNcls(0)
+                               ,nr_tracksHLT
+                               ,vertHLT->GetStatus()
+                               ,vertHLT->GetZ()
+                               ,cent->GetCentralityPercentile("V0M")
+                              };
+        if(fOptions.Contains("track-hlt")) fTrackHLT->Fill(trackHLT);   
+      } else {
+         Double_t trackHLT[] = {
+                                TMath::Abs(esdTrackHLT->Pt())
+                               ,esdTrackHLT->GetTPCNcls()    
+                               ,esdTrackHLT->Theta()
+                               ,esdTrackHLT->Eta()           
+                               ,esdTrackHLT->Phi()
+                               ,dca[0]                       
+                               ,dca[1]                       
+                               ,esdTrackHLT->Charge()        
+                               ,DCAr                         
+                               ,DCAz                         
+                               ,esdTrackHLT->GetNcls(0)
+                               ,nr_tracksHLT
+                               ,vertHLT->GetStatus()
+                               ,vertHLT->GetZ()                       
+                              };
+        if(fOptions.Contains("track-hlt")) fTrackHLT->Fill(trackHLT);
+      }   
+  }  // end of track loop             
   // Post output data.
   PostData(1, fOutputList);
 }
@@ -319,32 +346,6 @@ void AliAnalysisTaskHLTCentralBarrel::Terminate(Option_t *){
   // see header file of AliAnalysisTask for documentation 
 }
 
-// Int_t AliAnalysisTaskHLTCentralBarrel::CalculateCentrality(AliESDEvent* esd){
-// //see header for documentation
-// 
-//   Int_t centrality = -1;
-// 
-//   AliESDVZERO* esdV0 = esd->GetVZEROData();
-//   //AliESDZDC* esdZDC = esd->GetZDCData();
-//   //Int_t partZDC = esdZDC->GetZDCParticipants();
-// 
-//   Float_t multV0 = esdV0->GetMTotV0A() + esdV0->GetMTotV0C();
-//     
-//   if (      multV0 >=    0.  && multV0 <=   124.5 ) centrality = 90;
-//   else if ( multV0 >   124.5 && multV0 <=   274.5 ) centrality = 80;
-//   else if ( multV0 >   274.5 && multV0 <=   574.5 ) centrality = 70;
-//   else if ( multV0 >   574.5 && multV0 <=  1224.5 ) centrality = 60;
-//   else if ( multV0 >  1224.5 && multV0 <=  2174.5 ) centrality = 50;
-//   else if ( multV0 >  2174.5 && multV0 <=  3624.5 ) centrality = 40;
-//   else if ( multV0 >  3624.5 && multV0 <=  5574.5 ) centrality = 30;
-//   else if ( multV0 >  5574.5 && multV0 <=  8274.5 ) centrality = 20;
-//   else if ( multV0 >  8274.5 && multV0 <= 12024.5 ) centrality = 10;
-//   else if ( multV0 > 12024.5 && multV0 <= 14674.5 ) centrality = 5;
-//   else if ( multV0 > 14674.5 && multV0 <= 19449.5 ) centrality = 0;
-// 
-//   return centrality;
-// }
-
 THnSparseF* AliAnalysisTaskHLTCentralBarrel::CreateEventTHnSparse(const char* name, Int_t size, const Int_t* bins, Double_t* min, Double_t* max){
 //see header for documentation                     
   
@@ -373,7 +374,6 @@ THnSparseF* AliAnalysisTaskHLTCentralBarrel::CreateTrackTHnSparse(const char* na
   thn->GetAxis(8)->SetTitle("DCArSG");
   thn->GetAxis(9)->SetTitle("DCAzSG");
   thn->GetAxis(10)->SetTitle("ITS clusters/track");  
-  thn->GetAxis(12)->SetTitle("V0 centrality");  
   return thn;
 }
 
index eeee2dd..e96d8d1 100644 (file)
@@ -40,11 +40,13 @@ class AliAnalysisTaskHLTCentralBarrel : public AliAnalysisTaskSE {
     // function to select centrality
     void SetUseCentrality(Bool_t useCentrality = kFALSE)  { fUseCentrality = useCentrality; }    
     // function to set the beam type
-    void SetBeamType(TString beamType) {  fBeamType = beamType; }
+    void SetBeamType(TString beamType) {  fBeamType = beamType; }    
     // function to create the THnSparse and name the axis
     THnSparseF* CreateEventTHnSparse(const char* name, Int_t size, const int* bins, double* min, double* max);
     // function to create the THnSparse and name the axis
     THnSparseF* CreateTrackTHnSparse(const char* name, Int_t size, const int* bins, double* min, double* max);
+    // options for filling HLT or OFF properties, or event and track properties
+    void SetOptions(TString options) { fOptions = options; }
     //function to fill the THnSparse
     //void Fill(AliESDevent *esd, THnSparseF* thn);
     
@@ -54,9 +56,7 @@ class AliAnalysisTaskHLTCentralBarrel : public AliAnalysisTaskSE {
     AliAnalysisTaskHLTCentralBarrel(const AliAnalysisTaskHLTCentralBarrel&); 
     /** assignment operator */
     AliAnalysisTaskHLTCentralBarrel& operator=(const AliAnalysisTaskHLTCentralBarrel&); 
-             
-    //Int_t CalculateCentrality(AliESDEvent* esd);
-   
+                
     Bool_t fUseHLTTrigger;  // Use HLT Trigger Decision
     Bool_t fUseCentrality;  // Include centrality
     TString fBeamType;      // beam type, p-p, Pb-Pb, No beam
@@ -68,6 +68,8 @@ class AliAnalysisTaskHLTCentralBarrel : public AliAnalysisTaskSE {
 
     THnSparse *fTrackOFF; //! offline track properties
     THnSparse *fTrackHLT; //! HLT track properties
+    
+    TString fOptions; //!
 
     TText *fTextBox; //! TText box
     
index de8b397..ca8ca78 100644 (file)
@@ -7,15 +7,20 @@
  * analysis task. There is one output file per detector.
  *
  * Run without arguments to get a few examples how to use the macro.
- *
- * Usage:
- * <pre>
- *   aliroot -b -l -q compare-HLT-offline-local.C'("/home/blabla/AliESDs.root","global","./",kTRUE,10)' 2>&1 | tee task.log
- *   aliroot -b -l -q compare-HLT-offline-local.C'("/home/blabla/AliESDs.root","phos global cb","./",kTRUE,100)' 2>&1 | tee task.log
- *   aliroot -b -l -q compare-HLT-offline-local.C'("alien:///alice/data/2010/LHC10b/000115322/ESDs/pass1/10000115322040.20/AliESDs.root","global")' 2>&1 | tee log
- * </pre>
  * 
- * If alien:// is contained in the name of the file, then the macro connects to the grid to access the file.
+ * The arguments are:
+ * - the input file or txt file containing a list of ESDs to be processed (CreateESDChain takes 20 files as a default argument)
+ * - the task you want to use
+ * - the path of the task location
+ * - the beam type, "p-p" or "Pb-Pb", this is relevant ONLY for the central barrel task at the moment and is 
+ *   used to select proper binning and axes ranges for the THnSparse objects that it fills
+ * - options to make the central barrel task more flexible and lightweight; you can select if you want to 
+ *   fill the THnSparse object with only event or track properties or only HLT data or only OFF
+ *   possible options are: event-off event-hlt track-off track-hlt, all are turned on by default
+ * - boolean variable for selecting events which contain an HLT trigger
+ * - number of events to be analyzed
+ *
+ * If alien:// is placed before the input filename, then the macro connects to the grid to access the file.
  * 
  * In case you want to run over many ESD files, then prepare a list of them in a .txt file and they will be chained for the analysis.
  * The .txt file takes the place of the first argument in that case.
  * @author Kalliopi.Kanaki@ift.uib.no, Hege.Erdal@student.uib.no
  */
 
-void compare_HLT_offline_local(TString file, 
-                               const char* detectorTask="global",
-                              TString taskFolder="$ALICE_ROOT/HLT/QA/tasks/", 
-                              TString beamType="p-p",
-                              bool fUseHLTTrigger=kFALSE, 
-                              Long64_t nEvents=1234567890
+void compare_HLT_offline_local( TString file
+                               ,const char* detectorTask="global"
+                              ,TString taskFolder="$ALICE_ROOT/HLT/QA/tasks/"
+                              ,TString beamType="p-p"
+                              ,TString options="event-off event-hlt track-off track-hlt"
+                              ,bool fUseHLTTrigger=kFALSE
+                              ,Long64_t nEvents=1234567890
                              )
 {
 
@@ -98,14 +104,6 @@ void compare_HLT_offline_local(TString file,
        bCB = kTRUE;
        continue;
       } 
-      if(argument.CompareTo("all",TString::kIgnoreCase)==0){
-       bPHOS   = kTRUE;
-       bEMCAL  = kTRUE;
-       bGLOBAL = kTRUE; 
-       bD0     = kTRUE;  
-       bCB     = kTRUE; 
-       continue;
-      }
       else break;
     }
   }
@@ -173,7 +171,7 @@ void compare_HLT_offline_local(TString file,
   }
 
   if(!chain){
-    Printf("Chain is empty");
+    Printf("Chain is empty.\n");
     return;
   }
    
@@ -258,7 +256,8 @@ void compare_HLT_offline_local(TString file,
      if(beamType.Contains("Pb-Pb")){
         gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
         AliCentralitySelectionTask *taskCentrality = AddTaskCentrality(); 
-     }   
+     }        
+     taskCB->SetOptions(options);
      AliAnalysisDataContainer *coutputCB =  mgr->CreateContainer("esd_thnsparse", TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-CentralBarrel-comparison.root");  
      mgr->ConnectInput(taskCB,0,mgr->GetCommonInputContainer());
      mgr->ConnectOutput(taskCB,1,coutputCB);
@@ -275,11 +274,10 @@ void compare_HLT_offline_local(TString file,
 void compare_HLT_offline_local(){
   cout << " " << endl;
   cout << " Usage examples:" << endl;
-  cout << "    compare-HLT-offline-local.C'(file, taskOption, taskFolder, fUseHLTTrigger, nEvents)' 2>&1 | tee log" << endl;
+  cout << "    compare-HLT-offline-local.C'(file, taskOption, taskFolder, beamType, fUseHLTTrigger, nEvents)' 2>&1 | tee log" << endl;
   cout << "    compare-HLT-offline-local.C'(\"AliESDs.root\",\"global\")' 2>&1 | tee log" << endl;
-  cout << "    compare-HLT-offline-local.C'(\"AliESDs.root\",\"global\",\"./\",kFALSE,nEvents)' 2>&1 | tee log" << endl;
-  cout << "    compare-HLT-offline-local.C'(\"AliESDs.root\",\"global phos cb D0\", \"./\", kTRUE, nEvents)' 2>&1 | tee log" << endl;
-  cout << "    compare-HLT-offline-local.C'(\"files.txt\",\"all\")' 2>&1 | tee log" << endl;
+  cout << "    compare-HLT-offline-local.C'(\"AliESDs.root\",\"global\",\"./\", \"p-p\", kFALSE,nEvents)' 2>&1 | tee log" << endl;
+  cout << "    compare-HLT-offline-local.C'(\"AliESDs.root\",\"global phos cb D0\", \"./\", \"Pb-Pb\", kTRUE, nEvents)' 2>&1 | tee log" << endl;
   cout << "    compare-HLT-offline-local.C'(\"alien:///alice/data/2010/LHC10b/000115322/ESDs/pass1/10000115322040.20/AliESDs.root\",\"global\")' 2>&1 | tee log" << endl;
   cout << " " << endl;
 }