- Several setters added in prder to run on LEGO train
authorlmilano <lmilano@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 15 Jun 2012 16:04:25 +0000 (16:04 +0000)
committerlmilano <lmilano@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 15 Jun 2012 16:04:25 +0000 (16:04 +0000)
12 files changed:
PWGLF/SPECTRA/PiKaPr/TestAOD/AddTaskSpectraAOD.C
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraAODEventCuts.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraAODEventCuts.h
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraAODHistoManager.h
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraAODTrackCuts.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraAODTrackCuts.h
PWGLF/SPECTRA/PiKaPr/TestAOD/HistogramNames.h
PWGLF/SPECTRA/PiKaPr/TestAOD/MainAnalysis.C
PWGLF/SPECTRA/PiKaPr/TestAOD/QAPlots.C
PWGLF/SPECTRA/PiKaPr/TestAOD/createNames.py
PWGLF/SPECTRA/PiKaPr/TestAOD/runAODProof.C
PWGLF/SPECTRA/PiKaPr/TestAOD/runGrid.C

index dab181f..3b17dba 100644 (file)
-AliAnalysisTaskSpectraAOD * AddTaskSpectraAOD(const char * outfilename)
-{
-  // TODO: add some parameters to set the centrality for this task, and maybe the name of the task
-  // TODO: shall I use the same file and different dirs for the different centralities?
-
-  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
-  if (!mgr) {
-    ::Error("AddTaskSpectraAOD", "No analysis manager to connect to.");
-    return NULL;
-  }  
-  
-  // Check the analysis type using the event handlers connected to the analysis manager.
-  //==============================================================================
-  if (!mgr->GetInputEventHandler()) {
-    ::Error("AddTaskSpectraAOD", "This task requires an input event handler");
-    return NULL;
-  }
-  TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
-  
-  if (inputDataType != "AOD") {
-    Printf("ERROR! This task can only run on AODs!");
-  }
-
-  // Configure analysis
-  //===========================================================================
-    
-   
-  // Set I/O
-  AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();
-  AliAnalysisTaskSpectraAOD *task = new AliAnalysisTaskSpectraAOD("TaskAODSpectra");
-  mgr->AddTask(task);
-  // Set the cuts
-  AliSpectraAODVertexCuts * vcuts = new AliSpectraAODVertexCuts("VertexCuts");
-  AliSpectraAODTrackCuts  * tcuts = new AliSpectraAODTrackCuts ("TracksCuts");
-  tcuts->SetTrackType(6);
-  tcuts->SetEta(1.);
-  task->SetVertexCuts(vcuts);
-  task->SetTrackCuts (tcuts);
-
-
-  AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
-  AliAnalysisDataContainer *coutputpt1 = mgr->CreateContainer("chistpt", AliSpectraAODHistoManager::Class(),  AliAnalysisManager::kOutputContainer, outfilename);
-  AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer("cvcutpt", AliSpectraAODVertexCuts::Class(),    AliAnalysisManager::kOutputContainer, outfilename);
-  AliAnalysisDataContainer *coutputpt3 = mgr->CreateContainer("ctcutpt", AliSpectraAODTrackCuts::Class(),     AliAnalysisManager::kOutputContainer, outfilename);
-
-  mgr->ConnectInput(task, 0, cinput);
-  mgr->ConnectOutput(task, 1, coutputpt1);
-  mgr->ConnectOutput(task, 2, coutputpt2);
-  mgr->ConnectOutput(task, 3, coutputpt3);
-
-  return task;
-}   
+AliAnalysisTaskSpectraAOD* AddTaskSpectraAOD(int mc=0,\r
+                                            Double_t CentCutMin=0,\r
+                                            Double_t CentCutMax=100,\r
+                                            Double_t QvecPosCutMin=0,\r
+                                            Double_t QvecPosCutMax=100,\r
+                                            Double_t QvecNegCutMin=0,\r
+                                            Double_t QvecNegCutMax=100,\r
+                                            Double_t EtaMin=-0.8,\r
+                                            Double_t EtaMax=0.8,\r
+                                            Double_t Nsigmapid=3.,\r
+                                            Double_t pt=5.,\r
+                                            Double_t p=5.,\r
+                                            Double_t y=5.,\r
+                                            Double_t ptTofMatch=.6,\r
+                                            UInt_t trkbit=1,\r
+                                            UInt_t trkbitQVector=1,\r
+                                            Bool_t UseCentPatchAOD049=kFALSE,\r
+                                            Double_t DCA=100000,\r
+                                            UInt_t minNclsTPC=70,\r
+                                            )\r
+{\r
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
+  if (!mgr) \r
+    {\r
+      ::Error("AddAliAnalysisTaskSpectraAOD", "No analysis manager to connect to.");\r
+      return NULL;\r
+    }   \r
+  \r
+  // Check the analysis type using the event handlers connected to the analysis manager.\r
+  //==============================================================================\r
+  if (!mgr->GetInputEventHandler()) \r
+    {\r
+      ::Error("AddTaskITSsaTracks", "This task requires an input event handler");\r
+      return NULL;\r
+    }   \r
+  \r
+  TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"\r
+  if(type.Contains("ESD"))\r
+    {\r
+      ::Error("AddTaskITSsaTracks", "This task requires to run on AOD");\r
+      return NULL;\r
+    }\r
+  \r
+  using namespace AliSpectraNameSpace;\r
+  \r
+  AliSpectraAODPID *pid = new AliSpectraAODPID(kNSigmaTPCTOF); \r
+  pid->SetNSigmaCut(Nsigmapid);\r
+  \r
+  AliSpectraAODTrackCuts  * trcuts = new AliSpectraAODTrackCuts("Track Cuts");  \r
+  trcuts->SetDCA(DCA);\r
+  trcuts->SetTrackBits(trkbit);\r
+  trcuts->SetPt(pt);\r
+  trcuts->SetP(p);\r
+  trcuts->SetY(y);\r
+  trcuts->SetPtTOFMatching(ptTofMatch);   \r
+  trcuts->SetEta(EtaMin,EtaMax);\r
+  trcuts->SetMinTPCcls(minNclsTPC);\r
+  trcuts->PrintCuts();\r
+  \r
+  AliSpectraAODEventCuts * evcuts = new AliSpectraAODEventCuts("Event Cuts");\r
+  evcuts->SetQVectorPosCut(QvecPosCutMin,QvecPosCutMax);\r
+  evcuts->SetQVectorNegCut(QvecNegCutMin,QvecNegCutMax);\r
+  evcuts->SetCentralityCutMax(CentCutMax);  \r
+  evcuts->SetCentralityCutMin(CentCutMin);\r
+  evcuts->SetTrackBits(trkbitQVector);\r
+  if(mc==1)evcuts->SetIsMC(kTRUE);\r
+  evcuts->PrintCuts();\r
+  \r
+  AliAnalysisTaskSpectraAOD *task = new AliAnalysisTaskSpectraAOD(Form("TaskAODSpectraCent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f",       \r
+                                                                      CentCutMin,\r
+                                                                      CentCutMax,\r
+                                                                      QvecPosCutMin,\r
+                                                                      QvecPosCutMax,\r
+                                                                      QvecNegCutMin,\r
+                                                                      QvecNegCutMax,\r
+                                                                      EtaMin,\r
+                                                                      EtaMax));\r
+  task->SetPID(pid);  \r
+  task->SetEventCuts(evcuts);\r
+  task->SetTrackCuts(trcuts);\r
+  if(mc==1)task->SetIsMC(kTRUE);\r
+  \r
+  TString outputFileName = AliAnalysisManager::GetCommonFileName();\r
+  \r
+  TString typeofdata=mc?"MC":"Data";\r
+  \r
+  outputFileName += Form(":OutputAODSpectraTask_%s_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",typeofdata.Data(),evcuts->GetCentralityMin(),evcuts->GetCentralityMax(),\r
+                        evcuts->GetQVectorPosCutMin(), evcuts->GetQVectorPosCutMax(),evcuts->GetQVectorNegCutMin(), evcuts->GetQVectorNegCutMax(),trcuts->GetEtaMin(),trcuts->GetEtaMax());\r
+  \r
+  cout<<outputFileName<<endl;\r
+  AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();      \r
+  AliAnalysisDataContainer *coutputpt1 = mgr->CreateContainer("chistpt", AliSpectraAODHistoManager::Class(),  AliAnalysisManager::kOutputContainer,outputFileName);\r
+  AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer("cvcutpt", AliSpectraAODEventCuts::Class(),    AliAnalysisManager::kOutputContainer,outputFileName);\r
+  AliAnalysisDataContainer *coutputpt3 = mgr->CreateContainer("ctcutpt%d", AliSpectraAODTrackCuts::Class(),     AliAnalysisManager::kOutputContainer, outputFileName);\r
+  AliAnalysisDataContainer *coutputpt4 = mgr->CreateContainer("cpidpt%d",  AliSpectraAODPID::Class(),     AliAnalysisManager::kOutputContainer,outputFileName);\r
+  \r
+  mgr->ConnectInput(task, 0, cinput);\r
+  mgr->ConnectOutput(task, 1, coutputpt1);\r
+  mgr->ConnectOutput(task, 2, coutputpt2);\r
+  mgr->ConnectOutput(task, 3, coutputpt3);\r
+  mgr->ConnectOutput(task, 4, coutputpt4);\r
+  return task;\r
+  \r
+  \r
+  \r
+  \r
+  \r
+  \r
+  \r
+  mgr->AddTask(task);\r
+  return task;\r
+}\r
index 0fd7845..35ae021 100644 (file)
@@ -22,6 +22,7 @@
 #include "TTree.h"
 #include "TLegend.h"
 #include "TH1F.h"
+#include "TH1I.h"
 #include "TH2F.h"
 #include "TCanvas.h"
 #include "AliAnalysisTask.h"
 #include "AliAnalysisDataContainer.h"
 #include "AliSpectraAODEventCuts.h"
 #include "AliSpectraAODTrackCuts.h"
-#include "AliSpectraAODHistoManager.h"
+//#include "AliSpectraAODHistoManager.h"
 #include <iostream>
 
 using namespace std;
 
 ClassImp(AliSpectraAODEventCuts)
 
-AliSpectraAODEventCuts::AliSpectraAODEventCuts(const char *name) : TNamed(name, "AOD Event Cuts"), fAOD(0),fIsMC(0), fIsSelected(0), fCentralityCutMin(0), fCentralityCutMax(0), fQVectorPosCutMin(0), fQVectorPosCutMax(0), fQVectorNegCutMin(0), fQVectorNegCutMax(0), fHistoCuts(0),fHistoVtxBefSel(0),fHistoVtxAftSel(0),fHistoEtaBefSel(0),fHistoEtaAftSel(0),fHistoNChAftSel(0),fHistoQVectorPos(0),fHistoQVectorNeg(0)
+AliSpectraAODEventCuts::AliSpectraAODEventCuts(const char *name) : TNamed(name, "AOD Event Cuts"), fAOD(0), fTrackBits(0),fIsMC(0), fIsSelected(0), fCentralityCutMin(0), fCentralityCutMax(0), fQVectorPosCutMin(0), fQVectorPosCutMax(0), fQVectorNegCutMin(0), fQVectorNegCutMax(0), fHistoCuts(0),fHistoVtxBefSel(0),fHistoVtxAftSel(0),fHistoEtaBefSel(0),fHistoEtaAftSel(0),fHistoNChAftSel(0),fHistoQVectorPos(0),fHistoQVectorNeg(0)
 {
   // Constructor
   fHistoCuts = new TH1I("fEventCuts", "Event Cuts", kNVtxCuts, -0.5, kNVtxCuts - 0.5);
@@ -58,6 +59,7 @@ AliSpectraAODEventCuts::AliSpectraAODEventCuts(const char *name) : TNamed(name,
   fQVectorPosCutMax=10000.0;
   fQVectorNegCutMin=0.0;
   fQVectorNegCutMax=10000.0;
+  fTrackBits=1;
 }
 
 //______________________________________________________
@@ -139,7 +141,7 @@ Bool_t AliSpectraAODEventCuts::CheckQVectorCut()
   Int_t multNeg = 0;
   for(Int_t iT = 0; iT < fAOD->GetNumberOfTracks(); iT++) {
     AliAODTrack* aodTrack = fAOD->GetTrack(iT);
-    if (!aodTrack->TestFilterBit(1)) continue; //FilterBit 1 is the standard TPC track
+    if (!aodTrack->TestFilterBit(fTrackBits)) continue;
     if (aodTrack->Eta() >= 0){
       multPos++;
       Qx2EtaPos += TMath::Cos(2*aodTrack->Phi()); 
@@ -164,7 +166,6 @@ Bool_t AliSpectraAODEventCuts::CheckQVectorCut()
   fHistoQVectorPos->Fill(qPos);
   fHistoQVectorNeg->Fill(qNeg);
   return kTRUE;
-
 }
 
 //______________________________________________________
@@ -179,6 +180,10 @@ void AliSpectraAODEventCuts::PrintCuts()
   cout << " > Events cut by centrality: " << fHistoCuts->GetBinContent(kVtxCentral + 1) << endl;
   cout << " > Events without vertex: " << fHistoCuts->GetBinContent(kVtxNoEvent + 1) << endl;
   cout << " > QVector cut: " << fHistoCuts->GetBinContent(kQVector + 1) << endl;
+  cout << " > Track type used for the QVector calculation: " << fTrackBits << endl;
+  cout << " > QPosRange: [" << fQVectorPosCutMin <<"," <<fQVectorPosCutMax<<"]"<< endl;
+  cout << " > QNegRange: [" << fQVectorNegCutMin <<"," <<fQVectorNegCutMax<<"]"<< endl;
+  cout << " > Centrality: [" << fCentralityCutMin <<"," <<fCentralityCutMax<<"]"<< endl;
 }
 //______________________________________________________
 
index 05dc6fe..77b8e51 100644 (file)
@@ -14,8 +14,9 @@
 
 class AliAODEvent;
 class AliSpectraAODTrackCuts;
-class AliSpectraAODHistoManager;
+//class AliSpectraAODHistoManager;
 
+#include "TH1I.h"
 #include "TNamed.h"
 
 class AliSpectraAODEventCuts : public TNamed
@@ -24,7 +25,7 @@ class AliSpectraAODEventCuts : public TNamed
   enum {  kProcessedEvents = 0,kPhysSelEvents,kAcceptedEvents, kVtxRange, kVtxCentral, kVtxNoEvent, kQVector, kNVtxCuts};
 
   // Constructors
- AliSpectraAODEventCuts() : TNamed(), fAOD(0), fIsMC(0), fUseCentPatchAOD049(0), fIsSelected(0), fCentralityCutMin(0), fCentralityCutMax(0), fQVectorPosCutMin(0), fQVectorPosCutMax(0), fQVectorNegCutMin(0), fQVectorNegCutMax(0), fHistoCuts(0),fHistoVtxBefSel(0),fHistoVtxAftSel(0),fHistoEtaBefSel(0),fHistoEtaAftSel(0),fHistoNChAftSel(0),fHistoQVectorPos(0),fHistoQVectorNeg(0) {}
+ AliSpectraAODEventCuts() : TNamed(), fAOD(0), fTrackBits(0), fIsMC(0), fUseCentPatchAOD049(0), fIsSelected(0), fCentralityCutMin(0), fCentralityCutMax(0), fQVectorPosCutMin(0), fQVectorPosCutMax(0), fQVectorNegCutMin(0), fQVectorNegCutMax(0), fHistoCuts(0),fHistoVtxBefSel(0),fHistoVtxAftSel(0),fHistoEtaBefSel(0),fHistoEtaAftSel(0),fHistoNChAftSel(0),fHistoQVectorPos(0),fHistoQVectorNeg(0) {}
   AliSpectraAODEventCuts(const char *name);
   virtual  ~AliSpectraAODEventCuts() {}
   
@@ -43,8 +44,10 @@ class AliSpectraAODEventCuts : public TNamed
   void  SetCentralityCutMax(Float_t cut)  { fCentralityCutMax = cut; }
   void  SetQVectorPosCut(Float_t min,Float_t max)  { fQVectorPosCutMin = min; fQVectorPosCutMax = max; }
   void  SetQVectorNegCut(Float_t min,Float_t max)  { fQVectorNegCutMin = min; fQVectorNegCutMax = max; }
+  void SetTrackBits(UInt_t TrackBits) {fTrackBits=TrackBits;}
 
-   
+
+  UInt_t GetTrackType()  const    { return fTrackBits;}
   TH1I * GetHistoCuts()         {  return fHistoCuts; }
   TH1F * GetHistoVtxBefSel()         {  return fHistoVtxBefSel; }
   TH1F * GetHistoVtxAftSel()         {  return fHistoVtxAftSel; }
@@ -72,6 +75,7 @@ class AliSpectraAODEventCuts : public TNamed
  private:
   
   AliAODEvent     *fAOD;              //! AOD event
+  UInt_t           fTrackBits;       // Type of track to be used in the Qvector calculation
   Bool_t          fIsMC;// true if processing MC
   Bool_t          fUseCentPatchAOD049;// Patch for centrality selection on AOD049
   AliSpectraAODTrackCuts     *fTrackCuts;              //! track cuts
index c7e3939..680712e 100644 (file)
@@ -22,6 +22,7 @@
 #include "TTree.h"
 #include "TLegend.h"
 #include "TH1F.h"
+#include "TH1I.h"
 #include "TH2F.h"
 #include "TCanvas.h"
 #include "AliAnalysisTask.h"
@@ -34,7 +35,7 @@
 #include "AliAnalysisTaskESDfilter.h"
 #include "AliAnalysisDataContainer.h"
 #include "AliSpectraAODTrackCuts.h"
-#include "AliSpectraAODHistoManager.h"
+//#include "AliSpectraAODHistoManager.h"
 #include <iostream>
 
 using namespace std;
@@ -42,7 +43,7 @@ using namespace std;
 ClassImp(AliSpectraAODTrackCuts)
 
 
-AliSpectraAODTrackCuts::AliSpectraAODTrackCuts(const char *name) : TNamed(name, "AOD Track Cuts"), fIsSelected(0), fTrackBits(0), fEtaCutMin(0), fEtaCutMax(0), fDCACut(0), fPCut(0), fPtCut(0), fYCut(0),
+AliSpectraAODTrackCuts::AliSpectraAODTrackCuts(const char *name) : TNamed(name, "AOD Track Cuts"), fIsSelected(0), fTrackBits(0), fMinTPCcls(0), fEtaCutMin(0), fEtaCutMax(0), fDCACut(0), fPCut(0), fPtCut(0), fYCut(0),
   fPtCutTOFMatching(0), fHistoCuts(0), fHistoNSelectedPos(0), fHistoNSelectedNeg(0), fHistoNMatchedPos(0), fHistoNMatchedNeg(0), fHistoEtaPhiHighPt(0), fTrack(0)
   
 {
@@ -72,7 +73,7 @@ AliSpectraAODTrackCuts::AliSpectraAODTrackCuts(const char *name) : TNamed(name,
   fPtCut = 100000.0; // default value of pt cut ~ no cut 
   fPtCutTOFMatching=0.6; //default value fot matching with TOF
   fYCut       = 100000.0; // default value of y cut ~ no cut 
-  
+  fMinTPCcls=70; // ncls in TPC
 }
 
 //_______________________________________________________
@@ -133,7 +134,7 @@ Bool_t AliSpectraAODTrackCuts::CheckTrackCuts()
   // Check additional track Cuts
   Bool_t PassTrackCuts=kTRUE;
   if (!fTrack->HasPointOnITSLayer(0) && !fTrack->HasPointOnITSLayer(1))PassTrackCuts=kFALSE; //FIXME 1 SPD for the moment
-  if (fTrack->GetTPCNcls()<70)PassTrackCuts=kFALSE;
+  if (fTrack->GetTPCNcls()<fMinTPCcls)PassTrackCuts=kFALSE;
   return PassTrackCuts;
 }
 //________________________________________________________
@@ -158,7 +159,7 @@ Bool_t AliSpectraAODTrackCuts::CheckYCut(AODParticleSpecies_t species)
 Bool_t AliSpectraAODTrackCuts::CheckDCACut()
 {
    // Check DCA cut
-  if (TMath::Abs(fTrack->DCA()) < fDCACut) return kTRUE;
+  if (TMath::Abs(fTrack->DCA()) < fDCACut) return kTRUE; //FIXME for newest AOD fTrack->DCA() always gives -999
    return kFALSE;
 }
 //________________________________________________________
@@ -222,6 +223,7 @@ void AliSpectraAODTrackCuts::PrintCuts() const
     cout << " > DCA cut\t" << fDCACut << endl;
     cout << " > P cut\t" << fPCut << endl;
     cout << " > Pt cut \t" << fPtCut << endl;
+    cout << " > TPC cls \t" << fMinTPCcls << endl;
 }
 //_______________________________________________________
 void AliSpectraAODTrackCuts::SetTrackType(UInt_t bit)
index c4f5e2b..ee04974 100644 (file)
 //-------------------------------------------------------------------------
 
 class AliAODEvent;
-class AliSpectraAODHistoManager;
-#include "AliAODMCParticle.h"
+//class AliSpectraAODHistoManager;
+class TH1I;
+class AliAODMCParticle;
+class AliAODTrack;
+
 #include "AliSpectraAODHistoManager.h"
 #include "TNamed.h"
-
-using namespace AliSpectraNameSpace;
  
+using namespace AliSpectraNameSpace;
+
 const char * kBinLabel[] ={"TrkBit",
                           "TrkCuts",
                           "TrkEta",
@@ -40,7 +43,7 @@ class AliSpectraAODTrackCuts : public TNamed
   enum { kTrkBit = 0, kTrkCuts, kTrkEta, kTrkDCA, kTrkP, kTrkPt,kTrkPtTOF,kTOFMatching,kTrTOFout,kTrTIME,kTrTOFpid,kAccepted,kNTrkCuts};
   
   
- AliSpectraAODTrackCuts() : TNamed(), fIsSelected(0), fTrackBits(0), fEtaCutMin(0), fEtaCutMax(0), fPCut(0), fPtCut(0), fPtCutTOFMatching(0), fHistoCuts(0), fHistoNSelectedPos(0), fHistoNSelectedNeg(0), fHistoNMatchedPos(0), fHistoNMatchedNeg(0), fHistoEtaPhiHighPt(0), fTrack(0) {}
+ AliSpectraAODTrackCuts() : TNamed(), fIsSelected(0), fTrackBits(0), fMinTPCcls(0), fEtaCutMin(0), fEtaCutMax(0), fPCut(0), fPtCut(0), fPtCutTOFMatching(0), fHistoCuts(0), fHistoNSelectedPos(0), fHistoNSelectedNeg(0), fHistoNMatchedPos(0), fHistoNMatchedNeg(0), fHistoEtaPhiHighPt(0), fTrack(0) {}
   
   AliSpectraAODTrackCuts(const char *name);
   virtual  ~AliSpectraAODTrackCuts() {} // To be implemented
@@ -58,7 +61,7 @@ class AliSpectraAODTrackCuts : public TNamed
   Bool_t CheckTOFMatching(Bool_t FillHistStat);
   void PrintCuts() const;
   
-   UInt_t GetTrackType()  const    { return fTrackBits; }
+   UInt_t GetTrackType()  const    { return fTrackBits;}
    TH1I * GetHistoCuts()      { return fHistoCuts; }
    TH1F * GetHistoNSelectedPos()      { return fHistoNSelectedPos; } 
    TH1F * GetHistoNSelectedNeg()      { return fHistoNSelectedNeg; }
@@ -72,6 +75,7 @@ class AliSpectraAODTrackCuts : public TNamed
    void SetY(Float_t y) { fYCut = y;}
    void SetPtTOFMatching(Float_t pt)     { fPtCutTOFMatching = pt; }
    void SetTrackBits(UInt_t TrackBits) {fTrackBits=TrackBits;}
+   void SetMinTPCcls(UInt_t MinTPCcls) {fMinTPCcls=MinTPCcls;}
    Float_t GetEtaMin()       const    { return fEtaCutMin; }
    Float_t GetEtaMax()       const    { return fEtaCutMax; }
    Float_t GetY()         const    { return fYCut; }
@@ -87,6 +91,7 @@ class AliSpectraAODTrackCuts : public TNamed
    
    Bool_t           fIsSelected;      // True if cuts are selected
    UInt_t           fTrackBits;       // Type of track to be used
+   UInt_t           fMinTPCcls;       // min number of clusters in the TPC
    Float_t          fEtaCutMin;          // Allowed absolute maximum value of Eta
    Float_t          fEtaCutMax;          // Allowed absolute maximum value of Eta
    Float_t          fDCACut;          // Maximum value of DCA
index 69bc392..6f9c548 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef HISTOGRAMNAMES_H
+#define HISTOGRAMNAMES_H
+
 //This file was generated automatically, please do not edit!!
 
 namespace AliSpectraNameSpace
@@ -90,3 +93,5 @@ namespace AliSpectraNameSpace
      "hNHist",
    };
 }
+
+#endif
index 6a45742..1ad0b87 100644 (file)
@@ -48,29 +48,30 @@ void MainAnalysis()  {
   TString fold="3SigmaPID_AOD086-090_FilterBit1";
   
   //LOOP OVER SELECTION
-  Double_t CentCutMin[6]= {   0 , 20, 20, 20, 20, 20};
-  Double_t CentCutMax[6]= {   5 , 40, 40, 40, 40, 40};
-  Double_t QvecPosCutMin[6]= {0 ,  0,  0,  3,  0,  0};
-  Double_t QvecPosCutMax[6]={100,100,  2,100,100,100};
-  Double_t QvecNegCutMin[6]={0  ,  0,  0,  0,  0,  3};
-  Double_t QvecNegCutMax[6]={100,100,100,100,  2,100};
-  Double_t EtaMin[6]={-0.8,-0.8,-0.8,-0.8,0,0};
-  Double_t EtaMax[6]={0.8,0.8,0,0,0.8,0.8};
+  //                            0    1    2    3    4    5
+  Double_t CentCutMin[6]= {     0,  20,  20,  20,  20,  20};
+  Double_t CentCutMax[6]= {     5,  50,  50,  50,  50,  50};
+  Double_t QvecPosCutMin[6]= {  0,   0,   0,   4,   0,   4};
+  Double_t QvecPosCutMax[6]={ 100, 100,   2, 100,   2, 100};
+  Double_t QvecNegCutMin[6]={   0,   0,   0,   0,   0,   0};
+  Double_t QvecNegCutMax[6]={ 100, 100, 100, 100, 100, 100};
+  Double_t EtaMin[6]={       -0.8,-0.8,-0.8,-0.8,   0,   0};
+  Double_t EtaMax[6]={        0.8, 0.8,   0,   0, 0.8, 0.8};
   
-  Int_t icut=2;
+  Int_t icut=5;
   
   Int_t ibinToCompare=0;
   
-  TString sname=Form("Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f",CentCutMin[icut],CentCutMax[icut],QvecPosCutMin[icut],QvecPosCutMax[icut],QvecNegCutMin[icut],QvecNegCutMax[icut],EtaMin[icut],EtaMax[icut]);
+  TString sname_data=Form("Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f",CentCutMin[icut],CentCutMax[icut],QvecPosCutMin[icut],QvecPosCutMax[icut],QvecNegCutMin[icut],QvecNegCutMax[icut],EtaMin[icut],EtaMax[icut]);
+  //TString sname_mc=Form("Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f",CentCutMin[icut],CentCutMax[icut],QvecPosCutMin[icut],QvecPosCutMax[icut],QvecNegCutMin[icut],QvecNegCutMax[icut],EtaMin[icut],EtaMax[icut]);
+  //For MC we always take the output without cut on q vector (more stat and the eff is not dependent on q)
+  TString sname_mc=Form("Cent%.0fto%.0f_QVecPos0.0to100.0_QVecNeg0.0to100.0_Eta%.1fto%.1f",CentCutMin[icut],CentCutMax[icut],EtaMin[icut],EtaMax[icut]);
   
-  TString dataFile = Form("output/%s/OutputAODSpectraTask_data_%s.root",fold.Data(),sname.Data());
-  TString mcFile = Form("output/%s/OutputAODSpectraTask_mc_%s.root",fold.Data(),sname.Data());
+  TString dataFile = Form("output/%s/OutputAODSpectraTask_data_%s.root",fold.Data(),sname_data.Data());
+  TString mcFile = Form("output/%s/OutputAODSpectraTask_mc_%s.root",fold.Data(),sname_mc.Data());
   
-
-
-
-  Printf("\n\n-> Creating Output file Out_%s_%s.root",sname.Data(),fold.Data());
-  TFile * fout=new TFile(Form("results/Out_%s_%s.root",sname.Data(),fold.Data()),"RECREATE");
+  Printf("\n\n-> Creating Output file Out_%s_%s.root",sname_data.Data(),fold.Data());
+  TFile * fout=new TFile(Form("results/Out_%s_%s.root",sname_data.Data(),fold.Data()),"RECREATE");
  
   gStyle->SetPalette(1);
   // Open root MC file and get classes
@@ -469,7 +470,7 @@ void MainAnalysis()  {
   hsum->SetMaximum(1.2);
   hsum->SetMinimum(.8);
   hsum->DrawClone("");
-  
+
   //saving spectra
   fout->cd();
   for(Int_t icharge=0;icharge<2;icharge++){
@@ -491,8 +492,8 @@ void MainAnalysis()  {
   cFitChargHad->Write();
   cChargHadComp->Write();
   
-  fout->Close();
-  delete fout;
+  //fout->Close();
+  //delete fout;
   
 }
 
index 7501aad..dd95e7e 100644 (file)
@@ -85,10 +85,10 @@ void QAPlots( AliSpectraAODHistoManager* hman_data, AliSpectraAODHistoManager* h
   cQVector->cd(1);
   gPad->SetGridy();
   gPad->SetGridx();
-  TH1F *hQVector_data=ecuts_data->GetHistoQVectorPos();
+  TH1F *hQVector_data=(TH1F*)ecuts_data->GetHistoQVectorPos()->Clone();
   hQVector_data->Scale(1./hQVector_data->GetEntries());
   hQVector_data->SetTitle(Form("%s - data",hQVector_data->GetTitle()));
-  TH1F *hQVector_mc=ecuts_mc->GetHistoQVectorPos();
+  TH1F *hQVector_mc=(TH1F*)ecuts_mc->GetHistoQVectorPos()->Clone();
   hQVector_mc->Scale(1./hQVector_mc->GetEntries());
   hQVector_mc->SetTitle(Form("%s - mc",hQVector_mc->GetTitle()));
   hQVector_mc->SetLineColor(2);
@@ -98,10 +98,10 @@ void QAPlots( AliSpectraAODHistoManager* hman_data, AliSpectraAODHistoManager* h
   cQVector->cd(2);
   gPad->SetGridy();
   gPad->SetGridx();
-  TH1F *hQVector_data=ecuts_data->GetHistoQVectorNeg();
+  TH1F *hQVector_data=(TH1F*)ecuts_data->GetHistoQVectorNeg()->Clone();
   hQVector_data->Scale(1./hQVector_data->GetEntries());
   hQVector_data->SetTitle(Form("%s - data",hQVector_data->GetTitle()));
-  TH1F *hQVector_mc=ecuts_mc->GetHistoQVectorNeg();
+  TH1F *hQVector_mc=(TH1F*)ecuts_mc->GetHistoQVectorNeg()->Clone();
   hQVector_mc->Scale(1./hQVector_mc->GetEntries());
   hQVector_mc->SetTitle(Form("%s - mc",hQVector_mc->GetTitle()));
   hQVector_mc->SetLineColor(2);
@@ -109,6 +109,56 @@ void QAPlots( AliSpectraAODHistoManager* hman_data, AliSpectraAODHistoManager* h
   hQVector_mc->DrawClone("lhistsame");
   gPad->BuildLegend()->SetFillColor(0);
   
+  //Nch distr in data and MC before and after event selection
+  TCanvas *cQVectorIntegral=new TCanvas("QVectorIntegraldistr","QVectorIntegraldistr",700,500);
+  cQVectorIntegral->Divide(1,2);
+  cQVectorIntegral->cd(1);
+  gPad->SetGridy();
+  gPad->SetGridx();
+  TH1F *hQVectorIntegral_data=(TH1F*)ecuts_data->GetHistoQVectorPos()->Clone();
+  hQVectorIntegral_data->Scale(1./hQVectorIntegral_data->GetEntries());
+  Float_t count=0;
+  for(Int_t ibin=1;ibin<hQVectorIntegral_data->GetNbinsX();ibin++){
+    count+=hQVectorIntegral_data->GetBinContent(ibin);
+    hQVectorIntegral_data->SetBinContent(ibin,count);
+  }
+  hQVectorIntegral_data->SetTitle(Form("%s - data",hQVectorIntegral_data->GetTitle()));
+  TH1F *hQVectorIntegral_mc=(TH1F*)ecuts_mc->GetHistoQVectorPos()->Clone();
+  hQVectorIntegral_mc->Scale(1./hQVectorIntegral_mc->GetEntries());
+  count=0;
+  for(Int_t ibin=1;ibin<hQVectorIntegral_mc->GetNbinsX();ibin++){
+    count+=hQVectorIntegral_mc->GetBinContent(ibin);
+    hQVectorIntegral_mc->SetBinContent(ibin,count);
+  }
+  hQVectorIntegral_mc->SetTitle(Form("%s - mc",hQVectorIntegral_mc->GetTitle()));
+  hQVectorIntegral_mc->SetLineColor(2);
+  hQVectorIntegral_data->DrawClone("lhist");
+  hQVectorIntegral_mc->DrawClone("lhistsame");
+  gPad->BuildLegend()->SetFillColor(0);
+  cQVectorIntegral->cd(2);
+  gPad->SetGridy();
+  gPad->SetGridx();
+  TH1F *hQVectorIntegral_data=(TH1F*)ecuts_data->GetHistoQVectorNeg()->Clone();
+  hQVectorIntegral_data->Scale(1./hQVectorIntegral_data->GetEntries());
+  count=0;
+  for(Int_t ibin=1;ibin<hQVectorIntegral_data->GetNbinsX();ibin++){
+    count+=hQVectorIntegral_data->GetBinContent(ibin);
+    hQVectorIntegral_data->SetBinContent(ibin,count);
+  }
+  hQVectorIntegral_data->SetTitle(Form("%s - data",hQVectorIntegral_data->GetTitle()));
+  TH1F *hQVectorIntegral_mc=(TH1F*)ecuts_mc->GetHistoQVectorNeg()->Clone();
+  hQVectorIntegral_mc->Scale(1./hQVectorIntegral_mc->GetEntries());
+  count=0;
+  for(Int_t ibin=1;ibin<hQVectorIntegral_mc->GetNbinsX();ibin++){
+    count+=hQVectorIntegral_mc->GetBinContent(ibin);
+    hQVectorIntegral_mc->SetBinContent(ibin,count);
+  }
+  hQVectorIntegral_mc->SetTitle(Form("%s - mc",hQVectorIntegral_mc->GetTitle()));
+  hQVectorIntegral_mc->SetLineColor(2);
+  hQVectorIntegral_data->DrawClone("lhist");
+  hQVectorIntegral_mc->DrawClone("lhistsame");
+  gPad->BuildLegend()->SetFillColor(0);
+  
   
   
   //Eta Phi at high Pt in data and Monte Carlo
@@ -415,7 +465,7 @@ void QAPlots( AliSpectraAODHistoManager* hman_data, AliSpectraAODHistoManager* h
   
   //Muon over Pion Ratio
   Printf("\n\n-> Muon Over Pion");
-  TCanvas *cMu=new TCanvas("cMu","cMu");
+  TCanvas *cMu=new TCanvas("cMu","cMu",700,500);
   TH1F *hMuOverPi[2];
   TH1F *hMuOverPi_bis[2];
   for(Int_t icharge=0;icharge<2;icharge++){
@@ -595,6 +645,7 @@ void QAPlots( AliSpectraAODHistoManager* hman_data, AliSpectraAODHistoManager* h
   cEta->Write();
   cNCh->Write();
   cQVector->Write();
+  cQVectorIntegral->Write();
   cEtaPhi->Write();
   cRatioEtaPhi->Write();
   cTrackCuts->Write();
index e685e1a..d612424 100755 (executable)
@@ -26,8 +26,11 @@ def main():
 
     # write file
     outfile = open("HistogramNames.h", "w")
+    outfile.write("#ifndef HISTOGRAMNAMES_H\n");
+    outfile.write("#define HISTOGRAMNAMES_H\n\n");
     outfile.write("//This file was generated automatically, please do not edit!!\n\n");
     outfile.writelines(output)
+    outfile.write("\n#endif\n");
     outfile.close()
 
 
index 3931ff7..3568041 100644 (file)
@@ -26,7 +26,7 @@ void runAODProof(Int_t c=3, const char * proofMode = "full")
   //handler->SetAliROOTVersion("v5-03-11-AN");
   handler->SetAliROOTVersion("v5-04-25-AN");
    
-  //handler->SetNproofWorkers(1);
+  //handler->SetNproofWorkers(80);
   //handler->SetNproofWorkersPerSlave(4);
   handler->SetProofCluster(Form("%s@alice-caf.cern.ch", gSystem->Getenv("CAFUSER")));
   //handler->SetProofCluster(Form("%s@skaf.saske.sk",gSystem->Getenv("CAFUSER")));
@@ -74,93 +74,105 @@ void runAODProof(Int_t c=3, const char * proofMode = "full")
   //AddTaskPIDqa();
    
   //LOOP OVER SELECTION
-  Double_t CentCutMin[6]= {   0 , 20, 20, 20, 20, 20};
-  Double_t CentCutMax[6]= {   5 , 40, 40, 40, 40, 40};
-  Double_t QvecPosCutMin[6]= {0 ,  0,  0,  3,  0,  0};
-  Double_t QvecPosCutMax[6]={100,100,  2,100,100,100};
-  Double_t QvecNegCutMin[6]={0  ,  0,  0,  0,  0,  3};
-  Double_t QvecNegCutMax[6]={100,100,100,100,  2,100};
-  Double_t EtaMin[6]={-0.8,-0.8,-0.8,-0.8,0,0};
-  Double_t EtaMax[6]={0.8,0.8,0,0,0.8,0.8};
+  //                            0    1    2    3    4    5
+  Double_t CentCutMin[6]= {     0,  20,  20,  20,  20,  20};
+  Double_t CentCutMax[6]= {     5,  50,  50,  50,  50,  50};
+  Double_t QvecPosCutMin[6]= {  0,   0,   0,   4,   0,   4};
+  Double_t QvecPosCutMax[6]={ 100, 100,   2, 100,   2, 100};
+  Double_t QvecNegCutMin[6]={   0,   0,   0,   0,   0,   0};
+  Double_t QvecNegCutMax[6]={ 100, 100, 100, 100, 100, 100};
+  Double_t EtaMin[6]={       -0.8,-0.8,-0.8,-0.8,   0,   0};
+  Double_t EtaMax[6]={        0.8, 0.8,   0,   0, 0.8, 0.8};
+  if(c==2 || c==4){//for the MC the efficiency doesn't depend on q, we increase the stat
+    for(Int_t i=0;i<6;i++){
+      QvecPosCutMin[i]=0;
+      QvecPosCutMax[i]=100;
+      QvecNegCutMin[i]=0;
+      QvecNegCutMax[i]=100;
+    }
+  }
+  
   using namespace AliSpectraNameSpace;
   AliSpectraAODPID *pid = new AliSpectraAODPID(kNSigmaTPCTOF); 
   pid->SetNSigmaCut(3.);
-   
+  
   for(Int_t iCut=0;iCut<6;iCut++){
-    //Int_t iCut=0;
-  AliAnalysisTaskSpectraAOD *task = new AliAnalysisTaskSpectraAOD("TaskAODExercise");
-  mgr->AddTask(task);
-  //physics selection
-  task->SelectCollisionCandidates();     
-  // set pid object
-  task->SetPID(pid);
-  // Set the cuts
-  AliSpectraAODEventCuts * vcuts = new AliSpectraAODEventCuts("Event Cuts");
-  AliSpectraAODTrackCuts  * tcuts = new AliSpectraAODTrackCuts("Track Cuts");
-  //if(c==1 || c==2)tcuts->SetTrackType(5); //AOD 046 & 047. Standard Cut with loose DCA
-  //if(c==1 || c==2)tcuts->SetTrackType(6); //AOD 046 & 047. Standard Cut with tight DCA
-  //if(c==3 || c==4)tcuts->SetTrackType(10); //AOD 086 & 090. Standard Raa cut
-  //if(c==3 || c==4)tcuts->SetTrackType(4); //AOD 086 & 090. Jet analysis
-  //if(c==3 || c==4)tcuts->SetTrackType(7); //AOD 086 & 090. TPC Only
-  tcuts->SetTrackBits(1);
-  Printf("\n-------------------- tcuts->GetTrackType() %d \n",tcuts->GetTrackType());
-  //tcuts->SetDCA(.1);
-  tcuts->SetPt(5);
-  tcuts->SetY(.5);
-  tcuts->SetPtTOFMatching(.6);   
-  //cut on qvector and eta
-  vcuts->SetQVectorPosCut(QvecPosCutMin[iCut],QvecPosCutMax[iCut]);
-  vcuts->SetQVectorNegCut(QvecNegCutMin[iCut],QvecNegCutMax[iCut]);
-  tcuts->SetEta(EtaMin[iCut],EtaMax[iCut]);
-  if(c==1)vcuts->SetUseCentPatchAOD049(kTRUE);
-  vcuts->SetCentralityCutMax(CentCutMax[iCut]);  
-  vcuts->SetCentralityCutMin(CentCutMin[iCut]);
-  task->SetEventCuts(vcuts);
-  task->SetTrackCuts(tcuts);
-  vcuts->PrintCuts();
-  tcuts->PrintCuts();
+    //mc we need 1 & 2||3 & 4||5
+    //data we need all
+    if(iCut!=5)continue; //uncomemnt if you want to run only on 1 subsample
+    AliAnalysisTaskSpectraAOD *task = new AliAnalysisTaskSpectraAOD("TaskAODExercise");
+    mgr->AddTask(task);
+    //physics selection
+    task->SelectCollisionCandidates();     
+    // set pid object
+    task->SetPID(pid);
+    // Set the cuts
+    AliSpectraAODEventCuts * vcuts = new AliSpectraAODEventCuts("Event Cuts");
+    AliSpectraAODTrackCuts  * tcuts = new AliSpectraAODTrackCuts("Track Cuts");
+    //if(c==1 || c==2)tcuts->SetTrackType(5); //AOD 046 & 047. Standard Cut with loose DCA
+    //if(c==1 || c==2)tcuts->SetTrackType(6); //AOD 046 & 047. Standard Cut with tight DCA
+    //if(c==3 || c==4)tcuts->SetTrackType(10); //AOD 086 & 090. Standard Raa cut
+    //if(c==3 || c==4)tcuts->SetTrackType(4); //AOD 086 & 090. Jet analysis
+    //if(c==3 || c==4)tcuts->SetTrackType(7); //AOD 086 & 090. TPC Only
+    tcuts->SetTrackBits(1);
+    Printf("\n-------------------- tcuts->GetTrackType() %d \n",tcuts->GetTrackType());
+    //tcuts->SetDCA(.1);
+    tcuts->SetPt(5);
+    tcuts->SetY(.5);
+    tcuts->SetPtTOFMatching(.6);   
+    //cut on qvector and eta
+    vcuts->SetQVectorPosCut(QvecPosCutMin[iCut],QvecPosCutMax[iCut]);
+    vcuts->SetQVectorNegCut(QvecNegCutMin[iCut],QvecNegCutMax[iCut]);
+    tcuts->SetEta(EtaMin[iCut],EtaMax[iCut]);
+    if(c==1)vcuts->SetUseCentPatchAOD049(kTRUE);
+    vcuts->SetCentralityCutMax(CentCutMax[iCut]);  
+    vcuts->SetCentralityCutMin(CentCutMin[iCut]);
+    task->SetEventCuts(vcuts);
+    task->SetTrackCuts(tcuts);
+    vcuts->PrintCuts();
+    tcuts->PrintCuts();
     
-  // check for MC or real data
-  if (c == 2 || c == 4)
-    {
-      task->SetIsMC(kTRUE);
-      vcuts->SetIsMC(kTRUE);
-      AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
-      AliAnalysisDataContainer *coutputpt1 = mgr->CreateContainer(Form("chistpt%d",iCut), AliSpectraAODHistoManager::Class(),  AliAnalysisManager::kOutputContainer, 
-                                                                 Form("OutputAODSpectraTask_mc_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
-                                                                      vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
-      AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer(Form("cvcutpt%d",iCut), AliSpectraAODEventCuts::Class(),    AliAnalysisManager::kOutputContainer, 
-                                                                 Form("OutputAODSpectraTask_mc_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
-                                                                      vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
-      AliAnalysisDataContainer *coutputpt3 = mgr->CreateContainer(Form("ctcutpt%d",iCut), AliSpectraAODTrackCuts::Class(),     AliAnalysisManager::kOutputContainer, 
-                                                                 Form("OutputAODSpectraTask_mc_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
-                                                                      vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
-      AliAnalysisDataContainer *coutputpt4 = mgr->CreateContainer(Form("cpidpt%d",iCut),  AliSpectraAODPID::Class(),     AliAnalysisManager::kOutputContainer, 
-                                                                 Form("OutputAODSpectraTask_mc_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
-                                                                      vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
-    }
-  if (c == 1 || c==3)
-    {
-      AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
-      AliAnalysisDataContainer *coutputpt1 = mgr->CreateContainer(Form("chistpt%d",iCut), AliSpectraAODHistoManager::Class(),  AliAnalysisManager::kOutputContainer, 
-                                                                 Form("OutputAODSpectraTask_data_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
-                                                                      vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
-      AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer(Form("cvcutpt%d",iCut), AliSpectraAODEventCuts::Class(),    AliAnalysisManager::kOutputContainer, 
-                                                                 Form("OutputAODSpectraTask_data_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
-                                                                      vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
-      AliAnalysisDataContainer *coutputpt3 = mgr->CreateContainer(Form("ctcutpt%d",iCut), AliSpectraAODTrackCuts::Class(),     AliAnalysisManager::kOutputContainer, 
-                                                                 Form("OutputAODSpectraTask_data_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
-                                                                      vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
-      AliAnalysisDataContainer *coutputpt4 = mgr->CreateContainer(Form("cpidpt%d",iCut),  AliSpectraAODPID::Class(),     AliAnalysisManager::kOutputContainer, 
-                                                                 Form("OutputAODSpectraTask_data_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
-                                                                      vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
+    // check for MC or real data
+    if (c == 2 || c == 4)
+      {
+       task->SetIsMC(kTRUE);
+       vcuts->SetIsMC(kTRUE);
+       AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
+       AliAnalysisDataContainer *coutputpt1 = mgr->CreateContainer(Form("chistpt%d",iCut), AliSpectraAODHistoManager::Class(),  AliAnalysisManager::kOutputContainer, 
+                                                                   Form("OutputAODSpectraTask_mc_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
+                                                                        vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
+       AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer(Form("cvcutpt%d",iCut), AliSpectraAODEventCuts::Class(),    AliAnalysisManager::kOutputContainer, 
+                                                                   Form("OutputAODSpectraTask_mc_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
+                                                                        vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
+       AliAnalysisDataContainer *coutputpt3 = mgr->CreateContainer(Form("ctcutpt%d",iCut), AliSpectraAODTrackCuts::Class(),     AliAnalysisManager::kOutputContainer, 
+                                                                   Form("OutputAODSpectraTask_mc_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
+                                                                        vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
+       AliAnalysisDataContainer *coutputpt4 = mgr->CreateContainer(Form("cpidpt%d",iCut),  AliSpectraAODPID::Class(),     AliAnalysisManager::kOutputContainer, 
+                                                                   Form("OutputAODSpectraTask_mc_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
+                                                                        vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
+      }
+    if (c == 1 || c==3)
+      {
+       AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
+       AliAnalysisDataContainer *coutputpt1 = mgr->CreateContainer(Form("chistpt%d",iCut), AliSpectraAODHistoManager::Class(),  AliAnalysisManager::kOutputContainer, 
+                                                                   Form("OutputAODSpectraTask_data_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
+                                                                        vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
+       AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer(Form("cvcutpt%d",iCut), AliSpectraAODEventCuts::Class(),    AliAnalysisManager::kOutputContainer, 
+                                                                   Form("OutputAODSpectraTask_data_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
+                                                                        vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
+       AliAnalysisDataContainer *coutputpt3 = mgr->CreateContainer(Form("ctcutpt%d",iCut), AliSpectraAODTrackCuts::Class(),     AliAnalysisManager::kOutputContainer, 
+                                                                   Form("OutputAODSpectraTask_data_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
+                                                                        vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
+       AliAnalysisDataContainer *coutputpt4 = mgr->CreateContainer(Form("cpidpt%d",iCut),  AliSpectraAODPID::Class(),     AliAnalysisManager::kOutputContainer, 
+                                                                   Form("OutputAODSpectraTask_data_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
+                                                                        vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
         
-    }
-  mgr->ConnectInput(task, 0, cinput);
-  mgr->ConnectOutput(task, 1, coutputpt1);
-  mgr->ConnectOutput(task, 2, coutputpt2);
-  mgr->ConnectOutput(task, 3, coutputpt3);
-  mgr->ConnectOutput(task, 4, coutputpt4);
+      }
+    mgr->ConnectInput(task, 0, cinput);
+    mgr->ConnectOutput(task, 1, coutputpt1);
+    mgr->ConnectOutput(task, 2, coutputpt2);
+    mgr->ConnectOutput(task, 3, coutputpt3);
+    mgr->ConnectOutput(task, 4, coutputpt4);
   }
   mgr->SetDebugLevel(2);
    
index 8c09de3..9ea6b59 100644 (file)
@@ -1,7 +1,7 @@
 class  AliAnalysisManager;
 class  AliAnalysisAlien;
 
-void runGrid(TString mode="full",Int_t mc=1,Int_t sub=0,Int_t hi=1,TString fname="AODAnalysis_13June2012") 
+void runGrid(TString mode="test",Int_t mc=1,Int_t day=15,Int_t month=6, Int_t year=2012) 
 {
   //0 is AOD048-049 in this case you can choos FilterBit5 (loose DCA) or 6 (tight DCA)!!!!!!!!!
   //1 is AOD086-090
@@ -20,12 +20,6 @@ void runGrid(TString mode="full",Int_t mc=1,Int_t sub=0,Int_t hi=1,TString fname
   gSystem->Load("libOADB.so");
   gSystem->Load("libANALYSISalice.so");
   gSystem->AddIncludePath("-I$ALICE_ROOT/include");
-
-  // gROOT->LoadMacro("$ALICE_ROOT/SPECTRA/PiKaPr/TestAOD/AliSpectraAODTrackCuts.cxx+g");
-  // gROOT->LoadMacro("$ALICE_ROOT/SPECTRA/PiKaPr/TestAOD/AliSpectraAODEventCuts.cxx+g");
-  // gROOT->LoadMacro("$ALICE_ROOT/SPECTRA/PiKaPr/TestAOD/AliSpectraAODHistoManager.cxx+g");
-  // gROOT->LoadMacro("$ALICE_ROOT/SPECTRA/PiKaPr/TestAOD/AliSpectraAODPID.cxx+g");
-  // gROOT->LoadMacro("$ALICE_ROOT/SPECTRA/PiKaPr/TestAOD/AliAnalysisTaskSpectraAOD.cxx+g");
   gROOT->LoadMacro("AliSpectraAODTrackCuts.cxx+g");
   gROOT->LoadMacro("AliSpectraAODEventCuts.cxx+g");
   gROOT->LoadMacro("AliSpectraAODHistoManager.cxx+g");
@@ -33,8 +27,7 @@ void runGrid(TString mode="full",Int_t mc=1,Int_t sub=0,Int_t hi=1,TString fname
   gROOT->LoadMacro("AliAnalysisTaskSpectraAOD.cxx+g");
   // Use AliRoot includes to compile our task
   // Create and configure the alien handler plugin
-  
-  AliAnalysisGrid *alienHandler = CreateAlienHandler(mode,mc,sub,fname);  
+  AliAnalysisGrid *alienHandler = CreateAlienHandler(mode,mc,day,month,year);  
   if (!alienHandler) return;
   // Create the analysis manager
   AliAnalysisManager *mgr = new AliAnalysisManager("testAnalysis");
@@ -46,98 +39,12 @@ void runGrid(TString mode="full",Int_t mc=1,Int_t sub=0,Int_t hi=1,TString fname
   // Add PID task
   gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
   AliAnalysisTask * taskPID = AddTaskPIDResponse(mc);
-  //mgr->AddTask(taskPID);
  
-  //LOOP OVER SELECTION
-  Double_t CentCutMin[6]= {   0 , 20, 20, 20, 20, 20};
-  Double_t CentCutMax[6]= {   5 , 40, 40, 40, 40, 40};
-  Double_t QvecPosCutMin[6]= {0 ,  0,  0,  3,  0,  0};
-  Double_t QvecPosCutMax[6]={100,100,  2,100,100,100};
-  Double_t QvecNegCutMin[6]={0  ,  0,  0,  0,  0,  3};
-  Double_t QvecNegCutMax[6]={100,100,100,100,  2,100};
-  Double_t EtaMin[6]={-0.8,-0.8,-0.8,-0.8,0,0};
-  Double_t EtaMax[6]={0.8,0.8,0,0,0.8,0.8};
+  gROOT->LoadMacro("AddTaskSpectraAOD.C");
+  AliAnalysisTaskSpectraAOD* taskAOD=AddTaskSpectraAOD();
   
-  using namespace AliSpectraNameSpace;
-  AliSpectraAODPID *pid = new AliSpectraAODPID(kNSigmaTPCTOF); 
-  pid->SetNSigmaCut(3.);
-   
-  for(Int_t iCut=0;iCut<6;iCut++){
-    AliAnalysisTaskSpectraAOD *task = new AliAnalysisTaskSpectraAOD("TaskAODExercise");
-    mgr->AddTask(task);
-    //physics selection
-    task->SelectCollisionCandidates();     
-    // set pid object
-    task->SetPID(pid);
-    // Set the cuts
-    AliSpectraAODEventCuts * vcuts = new AliSpectraAODEventCuts("Event Cuts");
-    AliSpectraAODTrackCuts  * tcuts = new AliSpectraAODTrackCuts("Track Cuts");
-    //if(c==1 || c==2)tcuts->SetTrackType(5); //AOD 046 & 047. Standard Cut with loose DCA
-    //if(c==1 || c==2)tcuts->SetTrackType(6); //AOD 046 & 047. Standard Cut with tight DCA
-    //if(c==3 || c==4)tcuts->SetTrackType(10); //AOD 086 & 090. Standard Raa cut
-    //if(c==3 || c==4)tcuts->SetTrackType(4); //AOD 086 & 090. Jet analysis
-    //if(c==3 || c==4)tcuts->SetTrackType(7); //AOD 086 & 090. TPC Only
-    tcuts->SetTrackBits(1);
-    Printf("\n\n\n\n\n\n\n-------------------- tcuts->GetTrackType() %d \n\n\n\n\n\n\n",tcuts->GetTrackType());
-    //tcuts->SetDCA(.1);
-    tcuts->SetPt(5);
-    tcuts->SetY(.5);
-    tcuts->SetPtTOFMatching(.6);   
-    //cut on qvector and eta
-    vcuts->SetQVectorPosCut(QvecPosCutMin[iCut],QvecPosCutMax[iCut]);
-    vcuts->SetQVectorNegCut(QvecNegCutMin[iCut],QvecNegCutMax[iCut]);
-    tcuts->SetEta(EtaMin[iCut],EtaMax[iCut]);
-    if(sub==0 && mc==0)vcuts->SetUseCentPatchAOD049(kTRUE);
-    vcuts->SetCentralityCutMax(CentCutMax[iCut]);  
-    vcuts->SetCentralityCutMin(CentCutMin[iCut]);
-    task->SetEventCuts(vcuts);
-    task->SetTrackCuts(tcuts);
-    vcuts->PrintCuts();
-    tcuts->PrintCuts();
-    
-    // check for MC or real data
-    if (mc)
-      {
-       task->SetIsMC(kTRUE);
-       vcuts->SetIsMC(kTRUE);
-       AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
-       AliAnalysisDataContainer *coutputpt1 = mgr->CreateContainer(Form("chistpt%d",iCut), AliSpectraAODHistoManager::Class(),  AliAnalysisManager::kOutputContainer, 
-                                                                   Form("OutputAODSpectraTask_mc_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
-                                                                        vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
-       AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer(Form("cvcutpt%d",iCut), AliSpectraAODEventCuts::Class(),    AliAnalysisManager::kOutputContainer, 
-                                                                   Form("OutputAODSpectraTask_mc_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
-                                                                        vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
-       AliAnalysisDataContainer *coutputpt3 = mgr->CreateContainer(Form("ctcutpt%d",iCut), AliSpectraAODTrackCuts::Class(),     AliAnalysisManager::kOutputContainer, 
-                                                                   Form("OutputAODSpectraTask_mc_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
-                                                                        vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
-       AliAnalysisDataContainer *coutputpt4 = mgr->CreateContainer(Form("cpidpt%d",iCut),  AliSpectraAODPID::Class(),     AliAnalysisManager::kOutputContainer, 
-                                                                   Form("OutputAODSpectraTask_mc_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
-                                                                        vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
-      }
-    else  {
-      AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
-      AliAnalysisDataContainer *coutputpt1 = mgr->CreateContainer(Form("chistpt%d",iCut), AliSpectraAODHistoManager::Class(),  AliAnalysisManager::kOutputContainer, 
-                                                                 Form("OutputAODSpectraTask_data_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
-                                                                      vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
-      AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer(Form("cvcutpt%d",iCut), AliSpectraAODEventCuts::Class(),    AliAnalysisManager::kOutputContainer, 
-                                                                 Form("OutputAODSpectraTask_data_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
-                                                                      vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
-      AliAnalysisDataContainer *coutputpt3 = mgr->CreateContainer(Form("ctcutpt%d",iCut), AliSpectraAODTrackCuts::Class(),     AliAnalysisManager::kOutputContainer, 
-                                                                 Form("OutputAODSpectraTask_data_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
-                                                                      vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
-      AliAnalysisDataContainer *coutputpt4 = mgr->CreateContainer(Form("cpidpt%d",iCut),  AliSpectraAODPID::Class(),     AliAnalysisManager::kOutputContainer, 
-                                                                 Form("OutputAODSpectraTask_data_Cent%.0fto%.0f_QVecPos%.1fto%.1f_QVecNeg%.1fto%.1f_Eta%.1fto%.1f.root",vcuts->GetCentralityMin(),vcuts->GetCentralityMax(),
-                                                                      vcuts->GetQVectorPosCutMin(), vcuts->GetQVectorPosCutMax(),vcuts->GetQVectorNegCutMin(), vcuts->GetQVectorNegCutMax(),tcuts->GetEtaMin(),tcuts->GetEtaMax()));
-        
-    }
-    mgr->ConnectInput(task, 0, cinput);
-    mgr->ConnectOutput(task, 1, coutputpt1);
-    mgr->ConnectOutput(task, 2, coutputpt2);
-    mgr->ConnectOutput(task, 3, coutputpt3);
-    mgr->ConnectOutput(task, 4, coutputpt4);
-  }
   mgr->SetDebugLevel(2);
+  
   //mgr->Init();
   if (!mgr->InitAnalysis())return;
   mgr->PrintStatus();
@@ -146,8 +53,8 @@ void runGrid(TString mode="full",Int_t mc=1,Int_t sub=0,Int_t hi=1,TString fname
 }
 
 
-AliAnalysisGrid* CreateAlienHandler(TString mode="test",Int_t mc=1,Int_t sub=0,TString fname){
-  
+AliAnalysisGrid* CreateAlienHandler(TString mode="test",Int_t mc=1,Int_t day=0,Int_t month=0, Int_t year=2012)
+{
   
   
   AliAnalysisAlien *plugin = new AliAnalysisAlien();
@@ -161,71 +68,43 @@ AliAnalysisGrid* CreateAlienHandler(TString mode="test",Int_t mc=1,Int_t sub=0,T
   //Set versions of used packages
   plugin->SetAPIVersion("V1.1x");
   plugin->SetROOTVersion("v5-33-02b");
-  plugin->SetAliROOTVersion("v5-04-25-AN");
+  plugin->SetAliROOTVersion("v5-03-28-AN");
   // Declare input data to be processed.
-  if(sub==0){
-    if(mc)
-      {
-       plugin->SetGridDataDir("/alice/sim/LHC11a10a_bis");
-       plugin->SetDataPattern("AOD048/*AliAOD.root");
-       plugin->SetRunPrefix(""); 
-       plugin->SetAnalysisMacro(Form("TaskAOD046PbPbMC%d.C",sub));
-       plugin->SetExecutable(Form("TaskAOD046PbPbMC%d.sh",sub));
-       plugin->SetJDLName(Form("TaskAOD046PbPbMC%d.jdl",sub));
-       plugin->SetSplitMaxInputFileNumber(500);
-       plugin->SetGridWorkingDir(Form("%s/AOD048-049Filter5/mc%d/",fname.Data(),sub));
-      }  
-    else
-      {
-       plugin->SetGridDataDir("/alice/data/2010/LHC10h");
-       plugin->SetDataPattern("ESDs/pass2/AOD049/*AliAOD.root");
-       plugin->SetRunPrefix("000"); 
-       plugin->SetAnalysisMacro(Form("TaskAOD046PbPbdata%d.C",sub));
-       plugin->SetExecutable(Form("TaskAOD046PbPbdata%d.sh",sub));
-       plugin->SetJDLName(Form("TaskAOD046PbPbdata%d.jdl",sub));
-       plugin->SetSplitMaxInputFileNumber(500);
-       plugin->SetGridWorkingDir(Form("%s/AOD048-049Filter5/data%d/",fname.Data(),sub));
-      }  
-    FILE* listruns=fopen("HalfRunListGrid-AOD086.txt","r");
-    //FILE* listruns=fopen("RunListGrid-AOD046.txt","r");
-  }
-  if(sub==1){
-    if(mc)
-      {
-       plugin->SetGridDataDir("/alice/sim/LHC11a10a_bis");
-       plugin->SetDataPattern("AOD090/*AliAOD.root");
-       plugin->SetRunPrefix(""); 
-       plugin->SetAnalysisMacro(Form("TaskAOD086PbPbMC%d.C",sub));
-       plugin->SetExecutable(Form("TaskAOD086PbPbMC%d.sh",sub));
-       plugin->SetJDLName(Form("TaskAOD086PbPbMC%d.jdl",sub));
-       plugin->SetSplitMaxInputFileNumber(200);
-       plugin->SetGridWorkingDir(Form("%s/AOD086-090Filter10/mc%d/",fname.Data(),sub));
-      }  
-    else
-      {
-       plugin->SetGridDataDir("/alice/data/2010/LHC10h");
-       plugin->SetDataPattern("ESDs/pass2/AOD086/*AliAOD.root");
-       plugin->SetRunPrefix("000"); 
-       plugin->SetAnalysisMacro(Form("TaskAOD086PbPbdata%d.C",sub));
-       plugin->SetExecutable(Form("TaskAOD086PbPbdata%d.sh",sub));
-       plugin->SetJDLName(Form("TaskAOD086PbPbdata%d.jdl",sub));
-       plugin->SetSplitMaxInputFileNumber(200);
-       plugin->SetGridWorkingDir(Form("%s/AOD086-090Filter10/data%d/",fname.Data(),sub));
-      }  
-    FILE* listruns=fopen("HalfRunListGrid-AOD086.txt","r");
-    //FILE* listruns=fopen("RunListGrid-AOD086.txt","r");
-  }
+  
+  if(mc)
+    {
+      plugin->SetGridDataDir("/alice/sim/LHC11a10a_bis");
+      plugin->SetDataPattern("AOD090/*AliAOD.root");
+      plugin->SetRunPrefix(""); 
+      plugin->SetAnalysisMacro("TaskAODPbPbMC.C");
+      plugin->SetExecutable("TaskAODPbPbMC.sh");
+      plugin->SetJDLName("TaskAODPbPbMC.jdl");
+      plugin->SetGridWorkingDir(Form("/AODPbPb%d%d%d/mc/",day,month,year));
+    }  
+  else
+    {
+      plugin->SetGridDataDir("/alice/data/2010/LHC10h");
+      plugin->SetDataPattern("ESDs/pass2/AOD086/*AliAOD.root");
+      plugin->SetRunPrefix("000"); 
+      plugin->SetAnalysisMacro("TaskAODPbPbdata.C");
+      plugin->SetExecutable("TaskAODPbPbdata.sh");
+      plugin->SetJDLName("TaskAODPbPbdata.jdl");
+      //plugin->SetSplitMaxInputFileNumber(500);
+      plugin->SetGridWorkingDir(Form("/AODPbPb%d%d%d/data/",day,month,year));
+    }   
+  FILE* listruns=fopen("RunListGrid-AOD086.txt","r");
+  
   Int_t irun;
-  while(!feof(listruns)){
-    fscanf(listruns,"%d\n",&irun);
-    plugin->AddRunNumber(irun);
-  }
+  while(!feof(listruns))
+    {
+      fscanf(listruns,"%d\n",&irun);
+      plugin->AddRunNumber(irun);
+    }
   // Declare alien output directory. Relative to working directory.
   //plugin->SetGridOutputDir("/alice/cern.ch/user/l/lmilano/AODAnalysis/AOD086TrackBit10/mc1/output/000/Stage_1"); // In this case will be $HOME/work/output
   plugin->SetGridOutputDir("output"); // In this case will be $HOME/work/output
-  plugin->SetNrunsPerMaster(90); // 
+  //plugin->SetNrunsPerMaster(3); // 
   
-
   // Declare the output file names separated by blancs.
   // (can be like: file.root or file.root@ALICE::Niham::File)
   //plugin->SetDefaultOutputs(0);
@@ -243,5 +122,4 @@ AliAnalysisGrid* CreateAlienHandler(TString mode="test",Int_t mc=1,Int_t sub=0,T
   //plugin->SetSplitMaxInputFileNumber();
   plugin->SetSplitMode("se");
   return plugin;
-  delete runs;
 }