]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Modification in the analysis code: offline trigger
authorpchrist <pchrist@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 5 Jan 2010 10:36:47 +0000 (10:36 +0000)
committerpchrist <pchrist@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 5 Jan 2010 10:36:47 +0000 (10:36 +0000)
PWG2/SPECTRA/AliAnalysisTaskProtons.cxx
PWG2/SPECTRA/AliProtonAnalysis.cxx
PWG2/SPECTRA/AliProtonAnalysisBase.h
PWG2/SPECTRA/macros/configProtonAnalysis.C
PWG2/SPECTRA/macros/configProtonAnalysisBaseObject.C
PWG2/SPECTRA/macros/drawProtonResults.C
PWG2/SPECTRA/macros/runProtonAnalysis.C

index a7e15752366e56232bef63ef1c219c9c4336486c..8172dd50c78ef89dfe8024d3a3572562d2060a1c 100644 (file)
@@ -100,11 +100,12 @@ void AliAnalysisTaskProtons::ConnectInputData(Option_t *) {
 void AliAnalysisTaskProtons::CreateOutputObjects() {
   // Create output objects
   // Called once
-  char *gCutName[4] = {"Total","Triggered","Vertex","Analyzed"};
+  char *gCutName[5] = {"Total","Triggered","Offline trigger",
+                      "Vertex","Analyzed"};
   fHistEventStats = new TH1F("fHistEventStats",
                             "Event statistics;;N_{events}",
-                            4,0.5,4.5);
-  for(Int_t i = 1; i <= 4; i++) 
+                            5,0.5,5.5);
+  for(Int_t i = 1; i <= 5; i++) 
     fHistEventStats->GetXaxis()->SetBinLabel(i,gCutName[i-1]);
 
   fListAnalysis = new TList();
@@ -134,18 +135,37 @@ void AliAnalysisTaskProtons::Exec(Option_t *) {
     }
     
     fHistEventStats->Fill(1);
+    //online trigger
     if(dynamic_cast<AliProtonAnalysisBase*>(fProtonAnalysis->GetProtonAnalysisBaseObject())->IsEventTriggered(fESD,dynamic_cast<AliProtonAnalysisBase*>(fProtonAnalysis->GetProtonAnalysisBaseObject())->GetTriggerMode())) {
       fHistEventStats->Fill(2);
       AliDebug(1,Form("Fired trigger class: %s",fESD->GetFiredTriggerClasses().Data()));
-      const AliESDVertex *vertex = dynamic_cast<AliProtonAnalysisBase*>(fProtonAnalysis->GetProtonAnalysisBaseObject())->GetVertex(fESD,dynamic_cast<AliProtonAnalysisBase*>(fProtonAnalysis->GetProtonAnalysisBaseObject())->GetAnalysisMode(),dynamic_cast<AliProtonAnalysisBase*>(fProtonAnalysis->GetProtonAnalysisBaseObject())->GetVxMax(),dynamic_cast<AliProtonAnalysisBase*>(fProtonAnalysis->GetProtonAnalysisBaseObject())->GetVyMax(),dynamic_cast<AliProtonAnalysisBase*>(fProtonAnalysis->GetProtonAnalysisBaseObject())->GetVzMax());
-      fHistEventStats->Fill(3);
-      if(vertex) {
-       AliDebug(1,Form("Proton ESD analysis task: There are %d tracks in this event",fESD->GetNumberOfTracks()));
-       //Printf("Proton ESD analysis task: There are %d tracks in this event", fESD->GetNumberOfTracks());
-       fProtonAnalysis->Analyze(fESD,vertex);
+      //offline trigger
+      if(dynamic_cast<AliProtonAnalysisBase*>(fProtonAnalysis->GetProtonAnalysisBaseObject())->IsOfflineTriggerUsed()) {
+       AliPhysicsSelection *gPhysicselection = dynamic_cast<AliPhysicsSelection *>(dynamic_cast<AliProtonAnalysisBase*>(fProtonAnalysis->GetProtonAnalysisBaseObject())->GetPhysicsSelectionObject());
+       if(gPhysicselection->IsCollisionCandidate(fESD)) {
+         fHistEventStats->Fill(3);
+         AliDebug(1,Form("Fired trigger class: %s",fESD->GetFiredTriggerClasses().Data()));
+         //Reconstructed vertex
+         const AliESDVertex *vertex = dynamic_cast<AliProtonAnalysisBase*>(fProtonAnalysis->GetProtonAnalysisBaseObject())->GetVertex(fESD,dynamic_cast<AliProtonAnalysisBase*>(fProtonAnalysis->GetProtonAnalysisBaseObject())->GetAnalysisMode(),dynamic_cast<AliProtonAnalysisBase*>(fProtonAnalysis->GetProtonAnalysisBaseObject())->GetVxMax(),dynamic_cast<AliProtonAnalysisBase*>(fProtonAnalysis->GetProtonAnalysisBaseObject())->GetVyMax(),dynamic_cast<AliProtonAnalysisBase*>(fProtonAnalysis->GetProtonAnalysisBaseObject())->GetVzMax());
+         fHistEventStats->Fill(4);
+         if(vertex) {
+           AliDebug(1,Form("Proton ESD analysis task: There are %d tracks in this event",fESD->GetNumberOfTracks()));
+           fProtonAnalysis->Analyze(fESD,vertex);
+           fHistEventStats->Fill(5);
+         }//reconstructed vertex
+       }//offline trigger
+      }//usage of the offline trigger
+      else {
+       //Reconstructed vertex
+       const AliESDVertex *vertex = dynamic_cast<AliProtonAnalysisBase*>(fProtonAnalysis->GetProtonAnalysisBaseObject())->GetVertex(fESD,dynamic_cast<AliProtonAnalysisBase*>(fProtonAnalysis->GetProtonAnalysisBaseObject())->GetAnalysisMode(),dynamic_cast<AliProtonAnalysisBase*>(fProtonAnalysis->GetProtonAnalysisBaseObject())->GetVxMax(),dynamic_cast<AliProtonAnalysisBase*>(fProtonAnalysis->GetProtonAnalysisBaseObject())->GetVyMax(),dynamic_cast<AliProtonAnalysisBase*>(fProtonAnalysis->GetProtonAnalysisBaseObject())->GetVzMax());
        fHistEventStats->Fill(4);
-      }//reconstructed vertex
-    }//triggered event
+       if(vertex) {
+         AliDebug(1,Form("Proton ESD analysis task: There are %d tracks in this event",fESD->GetNumberOfTracks()));
+         fProtonAnalysis->Analyze(fESD,vertex);
+         fHistEventStats->Fill(5);
+       }//reconstructed vertex
+      }//else
+    }//triggered event - online
   }//ESD analysis              
   
   else if(gAnalysisLevel == "AOD") {
index 8f5bb8e153f65a67d605e9c2aaf539053fa0b11e..07d351ed396c34f8075311004647f84104cc6892 100644 (file)
@@ -53,7 +53,8 @@ AliProtonAnalysis::AliProtonAnalysis() :
   fNBinsY(0), fMinY(0), fMaxY(0),
   fNBinsPt(0), fMinPt(0), fMaxPt(0),
   fProtonContainer(0), fAntiProtonContainer(0),
-  fHistEvents(0), fHistYPtProtons(0), fHistYPtAntiProtons(0), fHistEventStats(0),
+  fHistEvents(0), fHistYPtProtons(0), fHistYPtAntiProtons(0), 
+  fHistEventStats(0),
   fEffGridListProtons(0), fCorrectionListProtons2D(0), 
   fEfficiencyListProtons1D(0), fCorrectionListProtons1D(0),
   fEffGridListAntiProtons(0), fCorrectionListAntiProtons2D(0), 
@@ -87,7 +88,10 @@ AliProtonAnalysis::AliProtonAnalysis(Int_t nbinsY,
   fInitQAFlag(kFALSE) {
   //Default constructor
   if(!fInitQAFlag) InitQA();
-  fHistEvents = new TH1I("fHistEvents","Analyzed events",1,0,1);
+
+  fHistEvents = new TH1I("fHistEvents","Analyzed events",2,0.5,2.5);
+  fHistEvents->GetXaxis()->SetBinLabel(1,"Analyzed events");
+  fHistEvents->GetXaxis()->SetBinLabel(2,"Events with (anti)protons");
 
   fHistYPtProtons = new TH2D("fHistYPtProtons","Protons",
                             fNBinsY,fMinY,fMaxY,
@@ -154,7 +158,10 @@ AliProtonAnalysis::AliProtonAnalysis(Int_t nbinsY, Double_t *gY,
   fInitQAFlag(kFALSE) {
   //Default constructor
   if(!fInitQAFlag) InitQA();
-  fHistEvents = new TH1I("fHistEvents","Analyzed events",1,0,1);
+
+  fHistEvents = new TH1I("fHistEvents","Analyzed events",2,0.5,2.5);
+  fHistEvents->GetXaxis()->SetBinLabel(1,"Analyzed events");
+  fHistEvents->GetXaxis()->SetBinLabel(2,"Events with (anti)protons");
 
   fHistYPtProtons = new TH2D("fHistYPtProtons","Protons",
                             fNBinsY,gY,fNBinsPt,gPt);
@@ -238,7 +245,9 @@ void AliProtonAnalysis::InitAnalysisHistograms(Int_t nbinsY,
   fMinPt = fLowPt;
   fMaxPt = fHighPt;
 
-  fHistEvents = new TH1I("fHistEvents","Analyzed events",1,0,1);
+  fHistEvents = new TH1I("fHistEvents","Analyzed events",2,0.5,2.5);
+  fHistEvents->GetXaxis()->SetBinLabel(1,"Analyzed events");
+  fHistEvents->GetXaxis()->SetBinLabel(2,"Events with (anti)protons");
 
   fHistYPtProtons = new TH2D("fHistYPtProtons","Protons",
                             fNBinsY,fMinY,fMaxY,
@@ -298,7 +307,9 @@ void AliProtonAnalysis::InitAnalysisHistograms(Int_t nbinsY, Double_t *gY,
   fMinPt = gPt[0];
   fMaxPt = gPt[nbinsPt];
 
-  fHistEvents = new TH1I("fHistEvents","Analyzed events",1,0,1);
+  fHistEvents = new TH1I("fHistEvents","Analyzed events",2,0.5,2.5);
+  fHistEvents->GetXaxis()->SetBinLabel(1,"Analyzed events");
+  fHistEvents->GetXaxis()->SetBinLabel(2,"Events with (anti)protons");
 
   fHistYPtProtons = new TH2D("fHistYPtProtons","Protons",
                             fNBinsY,gY,fNBinsPt,gPt);
@@ -387,8 +398,8 @@ TH1D *AliProtonAnalysis::GetProtonYHistogram() {
   //Get the y histogram for protons
   Int_t nAnalyzedEvents = GetNumberOfAnalyzedEvents();
 
-  TH1D *fYProtons = (TH1D *)fHistYPtProtons->ProjectionX("fYProtons",0,fHistYPtProtons->GetYaxis()->GetNbins(),"");
-  //TH1D *fYProtons = fProtonContainer->ShowProjection(0,0); //variable-step
+  //TH1D *fYProtons = (TH1D *)fHistYPtProtons->ProjectionX("fYProtons",0,fHistYPtProtons->GetYaxis()->GetNbins(),"");
+  TH1D *fYProtons = fProtonContainer->ShowProjection(0,2); //variable-step
    
   fYProtons->SetStats(kFALSE);
   fYProtons->GetYaxis()->SetTitle("(1/N_{events})(dN/dy)");
@@ -406,8 +417,8 @@ TH1D *AliProtonAnalysis::GetAntiProtonYHistogram() {
   //Get the y histogram for antiprotons
   Int_t nAnalyzedEvents = GetNumberOfAnalyzedEvents();
   
-  TH1D *fYAntiProtons = (TH1D *)fHistYPtAntiProtons->ProjectionX("fYAntiProtons",0,fHistYPtAntiProtons->GetYaxis()->GetNbins(),"");
-  //TH1D *fYAntiProtons = fAntiProtonContainer->ShowProjection(0,0);//variable-step 
+  //TH1D *fYAntiProtons = (TH1D *)fHistYPtAntiProtons->ProjectionX("fYAntiProtons",0,fHistYPtAntiProtons->GetYaxis()->GetNbins(),"");
+  TH1D *fYAntiProtons = fAntiProtonContainer->ShowProjection(0,2);//variable-step 
  
   fYAntiProtons->SetStats(kFALSE);
   fYAntiProtons->GetYaxis()->SetTitle("(1/N_{events})(dN/dy)");
@@ -425,8 +436,8 @@ TH1D *AliProtonAnalysis::GetProtonPtHistogram() {
   //Get the Pt histogram for protons
   Int_t nAnalyzedEvents = GetNumberOfAnalyzedEvents();
   
-  TH1D *fPtProtons = (TH1D *)fHistYPtProtons->ProjectionY("fPtProtons",0,fHistYPtProtons->GetXaxis()->GetNbins(),""); 
-  //TH1D *fPtProtons = fProtonContainer->ShowProjection(1,0); //variable-step
+  //TH1D *fPtProtons = (TH1D *)fHistYPtProtons->ProjectionY("fPtProtons",0,fHistYPtProtons->GetXaxis()->GetNbins(),""); 
+  TH1D *fPtProtons = fProtonContainer->ShowProjection(1,2); //variable-step
 
   fPtProtons->SetStats(kFALSE);
   fPtProtons->GetYaxis()->SetTitle("(1/N_{events})(dN/dP_{T})");
@@ -444,8 +455,8 @@ TH1D *AliProtonAnalysis::GetAntiProtonPtHistogram() {
   //Get the Pt histogram for antiprotons
   Int_t nAnalyzedEvents = GetNumberOfAnalyzedEvents();
   
-  TH1D *fPtAntiProtons = (TH1D *)fHistYPtAntiProtons->ProjectionY("fPtAntiProtons",0,fHistYPtProtons->GetXaxis()->GetNbins(),""); 
-  //TH1D *fPtAntiProtons = fAntiProtonContainer->ShowProjection(1,0); //variable-step
+  //TH1D *fPtAntiProtons = (TH1D *)fHistYPtAntiProtons->ProjectionY("fPtAntiProtons",0,fHistYPtProtons->GetXaxis()->GetNbins(),""); 
+  TH1D *fPtAntiProtons = fAntiProtonContainer->ShowProjection(1,2); //variable-step
 
   fPtAntiProtons->SetStats(kFALSE);
   fPtAntiProtons->GetYaxis()->SetTitle("(1/N_{events})(dN/dP_{T})");
@@ -674,7 +685,7 @@ void AliProtonAnalysis::Analyze(AliESDEvent* esd,
   Int_t nIdentifiedProtons = 0, nIdentifiedAntiProtons = 0;
   Int_t nSurvivedProtons = 0, nSurvivedAntiProtons = 0;
 
-  fHistEvents->Fill(0); //number of analyzed events
+  fHistEvents->Fill(1); //number of analyzed events
   Double_t containerInput[2] ;
   Double_t gPt = 0.0, gP = 0.0;
   nTracks = esd->GetNumberOfTracks();
@@ -942,6 +953,9 @@ void AliProtonAnalysis::Analyze(AliESDEvent* esd,
     }//combined tracking
   }//track loop 
   
+  if((nIdentifiedProtons > 0)||(nIdentifiedAntiProtons > 0))
+    fHistEvents->Fill(2); //number of analyzed events with at least one (anti)proton
+
   if(fProtonAnalysisBase->GetDebugMode())
     Printf("Initial number of tracks: %d | Identified (anti)protons: %d - %d | Survived (anti)protons: %d - %d",nTracks,nIdentifiedProtons,nIdentifiedAntiProtons,nSurvivedProtons,nSurvivedAntiProtons);
 }
@@ -949,7 +963,7 @@ void AliProtonAnalysis::Analyze(AliESDEvent* esd,
 //____________________________________________________________________//
 void AliProtonAnalysis::Analyze(AliAODEvent* const fAOD) {
   //Main analysis part - AOD
-  fHistEvents->Fill(0); //number of analyzed events
+  fHistEvents->Fill(1); //number of analyzed events
   Int_t nTracks = fAOD->GetNumberOfTracks();
   for(Int_t iTracks = 0; iTracks < nTracks; iTracks++) {
     AliAODTrack* track = fAOD->GetTrack(iTracks);
@@ -978,7 +992,7 @@ void AliProtonAnalysis::Analyze(AliAODEvent* const fAOD) {
 void AliProtonAnalysis::Analyze(AliStack* const stack, 
                                Bool_t iInclusive) {
   //Main analysis part - MC
-  fHistEvents->Fill(0); //number of analyzed events
+  fHistEvents->Fill(1); //number of analyzed events
 
   Int_t nParticles = 0;
   //inclusive protons - 
index 5b62282e7cc9b7c1307ed8bf61387e505288e971..211e58ec7f03ea9918e07b448d143d7b20f4c1c8 100644 (file)
@@ -19,6 +19,7 @@ class TF1;
 class TCanvas;
 class TList;
 
+#include "AliPhysicsSelection.h"
 #include "AliPID.h"
 class AliESDEvent;
 class AliESDtrack;
@@ -72,6 +73,13 @@ class AliProtonAnalysisBase : public TObject {
 
   Bool_t IsEventTriggered(const AliESDEvent *esd,
                          TriggerMode trigger = kMB2);
+  void OfflineTriggerInit(UInt_t runNumber) {
+    kUseOfflineTrigger = kTRUE;
+    fPhysicsSelection = new AliPhysicsSelection();
+    fPhysicsSelection->Initialize(runNumber);
+  }
+  Bool_t IsOfflineTriggerUsed() {return kUseOfflineTrigger;}
+  AliPhysicsSelection *GetPhysicsSelectionObject() {return fPhysicsSelection;}
   Bool_t IsAccepted(AliESDEvent *esd,
                    const AliESDVertex *vertex, 
                    AliESDtrack *track);
@@ -257,6 +265,8 @@ class AliProtonAnalysisBase : public TObject {
   TString fProtonAnalysisLevel;//"ESD", "AOD" or "MC"
   Bool_t fAnalysisMC; //kTRUE if MC analysis while reading the ESDs
   TriggerMode fTriggerMode; //Trigger mode
+  Bool_t kUseOfflineTrigger; //use the offline trigger or not
+  AliPhysicsSelection *fPhysicsSelection; //Trigger selection: offline
   AnalysisMode fProtonAnalysisMode; //Analysis mode: TPC-Hybrid-Global
   PIDMode fProtonPIDMode; //PID mode: Bayesian-dE/dx ratio-Nsigma areas
   Bool_t fAnalysisEtaMode; //run the analysis in eta or y
index 4df6ac85384141e800b0cf78e9f0b02a89a0a2e0..9f0aaa500de9fd9e6cb6b5c65dc268cb13a1c1f0 100644 (file)
@@ -2,12 +2,13 @@
 AliProtonAnalysis *GetProtonAnalysisObject(const char* analysisLevel = "ESD",
                                           Bool_t kAnalyzeMC = kTRUE,
                                           const char* esdAnalysisType = "Hybrid", 
-                                          const char* pidMode = "Bayesian") {
+                                          const char* pidMode = "Bayesian",
+                                          UInt_t runNumberForOfflineTrigger = -1) {
                                           
                                           
   gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/configProtonAnalysisBaseObject.C");  
   //Function to setup the AliProtonAnalysis object and return it
-  AliProtonAnalysisBase *baseAnalysis = GetProtonAnalysisBaseObject(analysisLevel,kAnalyzeMC,esdAnalysisType,pidMode);
+  AliProtonAnalysisBase *baseAnalysis = GetProtonAnalysisBaseObject(analysisLevel,kAnalyzeMC,esdAnalysisType,pidMode,runNumberForOfflineTrigger);
 
   AliProtonAnalysis *analysis = new AliProtonAnalysis();
   analysis->SetBaseAnalysis(baseAnalysis);
index 91931245677f27e4241ccee062e96a608745c25c..0f554552b20ce1c288a468fe937986178897c8e9 100644 (file)
@@ -1,7 +1,8 @@
 AliProtonAnalysisBase *GetProtonAnalysisBaseObject(const char* analysisLevel = "ESD",\r
                                                   Bool_t kAnalyzeMC = kTRUE,\r
                                                   const char* esdAnalysisType = "Hybrid",\r
-                                                  const char* pidMode = "Bayesian") {\r
+                                                  const char* pidMode = "Bayesian",\r
+                                                  UInt_t runNumberForOfflineTrigger = -1) {\r
   \r
   //Function to setup the AliProtonAnalysisBase object and return it\r
   AliProtonAnalysisBase *baseAnalysis = new AliProtonAnalysisBase();\r
@@ -10,6 +11,9 @@ AliProtonAnalysisBase *GetProtonAnalysisBaseObject(const char* analysisLevel = "
   if(analysisLevel == "ESD") {\r
     if(kAnalyzeMC)\r
       baseAnalysis->SetTriggerMode(AliProtonAnalysisBase::kMB2);\r
+    //use the offline trigger\r
+    if(runNumberForOfflineTrigger != -1)\r
+      baseAnalysis->OfflineTriggerInit(runNumberForOfflineTrigger);\r
     baseAnalysis->SetMinTPCClusters(110);\r
     baseAnalysis->SetMaxChi2PerTPCCluster(2.2);\r
     baseAnalysis->SetMaxCov11(0.5);\r
index 2c811b8d8bf1044c4dd41f5defc6bed6f93fee38..aecebb8500e2affbea56f79d959118ce16eb0ddd 100644 (file)
@@ -1,13 +1,17 @@
-void drawProtonResults(const char* esdFileName) {
+void drawProtonResults(const char* analysisOutput = 0x0,
+                      Bool_t kShowResults = kTRUE,
+                      Bool_t kShowQAPlots = kFALSE) {
   //Macro to visualize the proton ratio results
   //It also visualizes the QA plots
   gStyle->SetPalette(1,0);
-  drawResults(esdFileName);
-  drawQAPlots(esdFileName);
+  if(!analysisOutput)
+    Error("drawProtonResults::The analysis output was not defined!!!");
+  if(kShowResults) drawResults(analysisOutput);
+  if(kShowQAPlots) drawQAPlots(analysisOutput);
 }
 
 //___________________________________________________//
-void drawResults(const char* esdFileName) {
+void drawResults(const char* analysisOutput) {
   //Draws the main results from the ratio analysis
   gSystem->Load("libANALYSIS.so");
   gSystem->Load("libANALYSISalice.so");
@@ -15,7 +19,7 @@ void drawResults(const char* esdFileName) {
   gSystem->Load("libPWG2spectra.so");
 
   //Open the input file and get the objects
-  /*TFile *f = TFile::Open(esdFileName);
+  /*TFile *f = TFile::Open(analysisOutput);
   TList *analysisList = dynamic_cast<TList *>(f->Get("outputList"));
   TH2D *gHistYPtProtons = dynamic_cast<TH2D *>(analysisList->At(0));
   TH2D *gHistYPtAntiProtons = dynamic_cast<TH2D *>(analysisList->At(1));
@@ -30,7 +34,7 @@ void drawResults(const char* esdFileName) {
 
   //Create the AliProtonAnalysis object
   AliProtonAnalysis *analysis = new AliProtonAnalysis();
-  analysis->ReadFromFile(esdFileName);
+  analysis->ReadFromFile(analysisOutput);
   TH1F *gHistEventStats = dynamic_cast<TH1F *>(analysis->GetEventStatistics());
   TH2D *gHistYPtProtons = dynamic_cast<TH2D *>(analysis->GetProtonYPtHistogram());
   TH2D *gHistYPtAntiProtons = dynamic_cast<TH2D *>(analysis->GetAntiProtonYPtHistogram());
@@ -96,7 +100,7 @@ void drawResults(const char* esdFileName) {
 }
 
 //___________________________________________________//
-void drawQAPlots(const char* esdFileName) {
+void drawQAPlots(const char* analysisOutput) {
   //Draws the QA plots from the output of the analysis
   //=========================================================//
   //List of cuts
@@ -106,7 +110,7 @@ void drawQAPlots(const char* esdFileName) {
 
   //=========================================================//
   //QA plots
-  TFile *f = TFile::Open(esdFileName);
+  TFile *f = TFile::Open(analysisOutput);
   TList *listQA = dynamic_cast<TList *>(f->Get("outputQAList"));
   TList *gListGlobalQA = dynamic_cast<TList *>(listQA->At(0));
 
index 8f74c3099bd98eb7b24300ed977cfb0789eafc16..6b822ef6ffeb743b144d56db48148a0d23ec58ed 100644 (file)
@@ -1,19 +1,28 @@
 void runProtonAnalysis(Bool_t kAnalyzeMC = kTRUE,
                       const char* esdAnalysisType = "Hybrid",
-                      const char* pidMode = "Bayesian") {
+                      const char* pidMode = "Bayesian",
+                      Int_t runNumberForOfflineTtrigger = -1) {
   //Macro to run the proton analysis tested for local, proof & GRID.
-  //Local: Takes four arguments, the analysis mode, the type of the ESD 
-  //       analysis, the PID mode and the path where the tag and ESD or 
-  //       AOD files reside.
-  //Interactive: Takes four arguments, the analysis mode, the type of the ESD 
-  //             analysis, the PID mode and the name of the collection of tag 
+  //Local: Takes six arguments, the analysis mode, a boolean to define the ESD
+  //       analysis of MC data, the type of the ESD analysis, the PID mode, 
+  //       the run number for the offline trigger in case of real data 
+  //       analysis and the path where the tag and ESD or AOD files reside.
+  //Interactive: Takes six arguments, the analysis mode, a boolean to define 
+  //             the ESD analysis of MC data, the type of the ESD analysis, 
+  //             the PID mode, the run number for the offline trigger in case 
+  //             of real data analysis and the name of the collection of tag 
   //             files.
-  //Batch: Takes four arguments, the analysis mode, the type of the ESD 
-  //       analysis, the PID mode and the name of the collection file with 
+  //Batch: Takes six arguments, the analysis mode, a boolean to define 
+  //       the ESD analysis of MC data, the type of the ESD analysis, 
+  //       the PID mode, the run number for the offline trigger in case 
+  //       of real data analysis and the name of the collection file with 
   //       the event list for each file.
-  //Proof: Takes five arguments, the analysis level, the analysis mode in 
-  //       case of ESD, the PID mode, the number of events and the dataset 
-  //       name and .  
+  //Proof: Takes eight arguments, the analysis mode, a boolean to define 
+  //       the ESD analysis of MC data, the type of the ESD analysis, 
+  //       the PID mode, the run number for the offline trigger in case 
+  //       of real data analysis, the number of events to be analyzed, 
+  //       the event number from where we start the analysis and the dataset 
+  //========================================================================
   //Analysis mode can be: "MC", "ESD", "AOD"
   //ESD analysis type can be one of the three: "TPC", "Hybrid", "Global"
   //PID mode can be one of the four: "Bayesian" (standard Bayesian approach) 
@@ -26,11 +35,12 @@ void runProtonAnalysis(Bool_t kAnalyzeMC = kTRUE,
   runLocal("ESD", 
           kAnalyzeMC,
           esdAnalysisType,
-          pidMode,
+          pidMode, runNumberForOfflineTtrigger,
           "/home/pchrist/ALICE/Baryons/Data/104070");
-  //runInteractive("ESD",kAnalyzeMC, esdAnalysisType,pidMode,"tag.xml");
-  //runBatch("ESD",kAnalyzeMC, esdAnalysisType,pidMode,"wn.xml");  
-  //runProof("ESD",kAnalyzeMC, esdAnalysisType,pidMode,
+  //runInteractive("ESD", kAnalyzeMC, esdAnalysisType, pidMode, runNumberForOfflineTtrigger, "tag.xml");
+  //runBatch("ESD", kAnalyzeMC, esdAnalysisType, pidMode, runNumberForOfflineTtrigger, "wn.xml");  
+  //runProof("ESD", kAnalyzeMC, esdAnalysisType, pidMode,
+  //runNumberForOfflineTtrigger,
   //500000,0,"/COMMON/COMMON/LHC09d1_0.9TeV_0.5T#esdTree");
 
   timer.Stop();
@@ -42,6 +52,7 @@ void runLocal(const char* mode = "ESD",
              Bool_t kAnalyzeMC = kTRUE,
              const char* analysisType = 0x0,
              const char* pidMode = 0x0,
+             UInt_t runNumberForOfflineTtrigger = -1,
              const char* path = "/home/pchrist/ALICE/Alien/Tutorial/November2007/Tags") {
   TString smode = mode;
   TString outputFilename = "Protons."; outputFilename += mode;
@@ -87,7 +98,8 @@ void runLocal(const char* mode = "ESD",
   gROOT->LoadMacro("configProtonAnalysis.C");
   AliProtonAnalysis *analysis = GetProtonAnalysisObject(mode,kAnalyzeMC,
                                                        analysisType,
-                                                       pidMode);
+                                                       pidMode,
+                                                       runNumberForOfflineTtrigger);
   //____________________________________________//
   // Make the analysis manager
   AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManager");
@@ -129,6 +141,7 @@ void runInteractive(const char* mode = "ESD",
                    Bool_t kAnalyzeMC = kTRUE,
                    const char* analysisType = 0x0,
                    const char* pidMode = 0x0,
+                   UInt_t runNumberForOfflineTtrigger = -1,
                    const char* collectionName = "tag.xml") {
   gSystem->Load("libProofPlayer.so");
 
@@ -182,7 +195,8 @@ void runInteractive(const char* mode = "ESD",
   gROOT->LoadMacro("configProtonAnalysis.C");
   AliProtonAnalysis *analysis = GetProtonAnalysisObject(mode,kAnalyzeMC,
                                                        analysisType,
-                                                       pidMode);
+                                                       pidMode,
+                                                       runNumberForOfflineTtrigger);
   //____________________________________________//
   // Make the analysis manager
   AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManager");
@@ -224,6 +238,7 @@ void runBatch(const char* mode = "ESD",
              Bool_t kAnalyzeMC = kTRUE,
              const char* analysisType = 0x0,
              const char* pidMode = 0x0,
+             UInt_t runNumberForOfflineTtrigger = -1,
              const char *collectionfile = "wn.xml") {
   TString smode = mode;
   TString outputFilename = "Protons."; outputFilename += mode;
@@ -267,7 +282,8 @@ void runBatch(const char* mode = "ESD",
   gROOT->LoadMacro("configProtonAnalysis.C");
   AliProtonAnalysis *analysis = GetProtonAnalysisObject(mode,kAnalyzeMC,
                                                        analysisType,
-                                                       pidMode);
+                                                       pidMode,
+                                                       runNumberForOfflineTtrigger);
   //____________________________________________//
   // Make the analysis manager
   AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManager");
@@ -309,6 +325,7 @@ void runProof(const char* mode = "ESD",
              Bool_t kAnalyzeMC = kTRUE,
              const char* analysisType = 0x0,
              const char* pidMode = 0x0,
+             UInt_t runNumberForOfflineTtrigger = -1,
              Int_t stats = 0, Int_t startingPoint = 0,
              const char* dataset = 0x0) {  
   TString smode = mode;
@@ -343,7 +360,8 @@ void runProof(const char* mode = "ESD",
   gROOT->LoadMacro("configProtonAnalysis.C");
   AliProtonAnalysis *analysis = GetProtonAnalysisObject(mode,kAnalyzeMC,
                                                        analysisType,
-                                                       pidMode);
+                                                       pidMode,
+                                                       runNumberForOfflineTtrigger);
   //____________________________________________//
 
   //____________________________________________//