- moving code to new base class
authorodjuvsla <odjuvsla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 7 Dec 2010 11:55:29 +0000 (11:55 +0000)
committerodjuvsla <odjuvsla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 7 Dec 2010 11:55:29 +0000 (11:55 +0000)
- adding use of physics selection and centrality

PWG4/totEt/AliAnalysisTaskHadEt.cxx
PWG4/totEt/AliAnalysisTaskHadEt.h
PWG4/totEt/AliAnalysisTaskTotEt.cxx
PWG4/totEt/AliAnalysisTaskTotEt.h

index c7fae3d..a478af5 100644 (file)
@@ -33,29 +33,24 @@ ClassImp(AliAnalysisTaskHadEt)
 
 
 //________________________________________________________________________
-AliAnalysisTaskHadEt::AliAnalysisTaskHadEt(const char *name) :
-        AliAnalysisTaskSE(name)
-       ,fHadMCConfigFile("ConfigHadEtMonteCarlo.C")
-       ,fHadRecoConfigFile("ConfigHadEtReconstructed.C")
-        ,fOutputList(0)
-        ,fRecAnalysis(0)
-        ,fMCAnalysis(0)
-        ,fHistEtRecvsEtMC(0)
-        ,fEsdtrackCutsITSTPC(0)
-        ,fEsdtrackCutsTPC(0)
-        ,fEsdtrackCutsITS(0)
+AliAnalysisTaskHadEt::AliAnalysisTaskHadEt(const char *name, Bool_t isMc) :
+        AliAnalysisTaskTransverseEnergy(name, isMc)
+       ,fRecAnalysis(0)
+       ,fMCAnalysis(0)
 {
     // Constructor
-
-  if (fHadMCConfigFile.Length()) {
+  fMCConfigFile = "ConfigHadEtMonteCarlo.C";
+  fRecoConfigFile = "ConfigHadEtReconstructed.C";
+  
+  if (fMCConfigFile.Length()) {
     cout<<"Rereading AliAnalysisHadEtMonteCarlo configuration file..."<<endl;
-    gROOT->LoadMacro(fHadMCConfigFile);
+    gROOT->LoadMacro(fMCConfigFile);
     fMCAnalysis = (AliAnalysisHadEtMonteCarlo *) gInterpreter->ProcessLine("ConfigHadEtMonteCarlo()");
   }
 
-  if (fHadRecoConfigFile.Length()) {
+  if (fRecoConfigFile.Length()) {
     cout<<"Rereading AliAnalysisHadEtReconstructed configuration file..."<<endl;
-    gROOT->LoadMacro(fHadRecoConfigFile);
+    gROOT->LoadMacro(fRecoConfigFile);
     fRecAnalysis = (AliAnalysisHadEtReconstructed *) gInterpreter->ProcessLine("ConfigHadEtReconstructed()");
   }
 
@@ -67,13 +62,8 @@ AliAnalysisTaskHadEt::AliAnalysisTaskHadEt(const char *name) :
     DefineOutput(1, TList::Class());
 }
 AliAnalysisTaskHadEt::~AliAnalysisTaskHadEt(){//Destructor
-  fOutputList->Clear();
-  delete fOutputList;
   delete fRecAnalysis;
   delete fMCAnalysis;
-  delete fEsdtrackCutsITSTPC;
-  delete fEsdtrackCutsTPC;
-  delete fEsdtrackCutsITS;
 }
 
 
@@ -136,60 +126,66 @@ void AliAnalysisTaskHadEt::UserCreateOutputObjects()
 //________________________________________________________________________
 void AliAnalysisTaskHadEt::UserExec(Option_t *)
 { // execute method
-  AliESDEvent *event = dynamic_cast<AliESDEvent*>(InputEvent());
-if (!event) {
+  fESDEvent = dynamic_cast<AliESDEvent*>(InputEvent());
+if (!fESDEvent) {
   Printf("ERROR: Could not retrieve event");
   return;
  }
 //cout<<"AliAnalysisHadEtReconstructed 90"<<endl;
 
-fRecAnalysis->AnalyseEvent(event);
+Int_t res = CheckPhysicsSelection(fESDEvent->GetRunNumber()); // Check if the physics selection is valid for this run
+
+AliESDCentrality *cent = GetCentralityObject();
 
-AliMCEvent* mcEvent = MCEvent();
+if(res == 0 && cent){
+  
+  
+  fRecAnalysis->AnalyseEvent(fESDEvent);
+
+  AliMCEvent* mcEvent = MCEvent();
 // if (!mcEvent) {
 //   Printf("ERROR: Could not retrieve MC event");
 //  }
-if (mcEvent && event)
-  {
-    ((AliAnalysisHadEtMonteCarlo*)fMCAnalysis)->AnalyseEvent((AliVEvent*)mcEvent,(AliVEvent*)event);
-    if(fMCAnalysis->Full()){
-      fMCAnalysis->FillSimTotEtMinusRecoTotEtFullAcceptanceTPC( fRecAnalysis->GetCorrectedTotEtFullAcceptanceTPC() );
-      fMCAnalysis->FillSimTotEtMinusRecoTotEtFullAcceptanceITS( fRecAnalysis->GetCorrectedTotEtFullAcceptanceITS() );
-      fMCAnalysis->FillSimTotEtMinusRecoTotEtFullAcceptanceTPCNoPID( fRecAnalysis->GetCorrectedTotEtFullAcceptanceTPCNoPID() );
-      fMCAnalysis->FillSimTotEtMinusRecoTotEtFullAcceptanceITSNoPID( fRecAnalysis->GetCorrectedTotEtFullAcceptanceITSNoPID() );
-      fMCAnalysis->FillSimHadEtMinusRecoHadEtFullAcceptanceTPC( fRecAnalysis->GetCorrectedHadEtFullAcceptanceTPC() );
-      fMCAnalysis->FillSimHadEtMinusRecoHadEtFullAcceptanceITS( fRecAnalysis->GetCorrectedHadEtFullAcceptanceITS() );
-      fMCAnalysis->FillSimHadEtMinusRecoHadEtFullAcceptanceTPCNoPID( fRecAnalysis->GetCorrectedHadEtFullAcceptanceTPCNoPID() );
-      fMCAnalysis->FillSimHadEtMinusRecoHadEtFullAcceptanceITSNoPID( fRecAnalysis->GetCorrectedHadEtFullAcceptanceITSNoPID() );
-    }
-    if(fMCAnalysis->EMCAL()){
-      fMCAnalysis->FillSimTotEtMinusRecoTotEtEMCALAcceptanceTPC( fRecAnalysis->GetCorrectedTotEtEMCALAcceptanceTPC() );
-      fMCAnalysis->FillSimTotEtMinusRecoTotEtEMCALAcceptanceITS( fRecAnalysis->GetCorrectedTotEtEMCALAcceptanceITS() );
-      fMCAnalysis->FillSimTotEtMinusRecoTotEtEMCALAcceptanceTPCNoPID( fRecAnalysis->GetCorrectedTotEtEMCALAcceptanceTPCNoPID() );
-      fMCAnalysis->FillSimTotEtMinusRecoTotEtEMCALAcceptanceITSNoPID( fRecAnalysis->GetCorrectedTotEtEMCALAcceptanceITSNoPID() );
-      fMCAnalysis->FillSimHadEtMinusRecoHadEtEMCALAcceptanceTPC( fRecAnalysis->GetCorrectedHadEtEMCALAcceptanceTPC() );
-      fMCAnalysis->FillSimHadEtMinusRecoHadEtEMCALAcceptanceITS( fRecAnalysis->GetCorrectedHadEtEMCALAcceptanceITS() );
-      fMCAnalysis->FillSimHadEtMinusRecoHadEtEMCALAcceptanceTPCNoPID( fRecAnalysis->GetCorrectedHadEtEMCALAcceptanceTPCNoPID() );
-      fMCAnalysis->FillSimHadEtMinusRecoHadEtEMCALAcceptanceITSNoPID( fRecAnalysis->GetCorrectedHadEtEMCALAcceptanceITSNoPID() );
-    }
-    if(fMCAnalysis->PHOS()){
-      fMCAnalysis->FillSimTotEtMinusRecoTotEtPHOSAcceptanceTPC( fRecAnalysis->GetCorrectedTotEtPHOSAcceptanceTPC() );
-      fMCAnalysis->FillSimTotEtMinusRecoTotEtPHOSAcceptanceITS( fRecAnalysis->GetCorrectedTotEtPHOSAcceptanceITS() );
-      fMCAnalysis->FillSimTotEtMinusRecoTotEtPHOSAcceptanceTPCNoPID( fRecAnalysis->GetCorrectedTotEtPHOSAcceptanceTPCNoPID() );
-      fMCAnalysis->FillSimTotEtMinusRecoTotEtPHOSAcceptanceITSNoPID( fRecAnalysis->GetCorrectedTotEtPHOSAcceptanceITSNoPID() );
-      fMCAnalysis->FillSimHadEtMinusRecoHadEtPHOSAcceptanceTPC( fRecAnalysis->GetCorrectedHadEtPHOSAcceptanceTPC() );
-      fMCAnalysis->FillSimHadEtMinusRecoHadEtPHOSAcceptanceITS( fRecAnalysis->GetCorrectedHadEtPHOSAcceptanceITS() );
-      fMCAnalysis->FillSimHadEtMinusRecoHadEtPHOSAcceptanceTPCNoPID( fRecAnalysis->GetCorrectedHadEtPHOSAcceptanceTPCNoPID() );
-      fMCAnalysis->FillSimHadEtMinusRecoHadEtPHOSAcceptanceITSNoPID( fRecAnalysis->GetCorrectedHadEtPHOSAcceptanceITSNoPID() );
-    }
-    if(fMCAnalysis->PiKP() && fMCAnalysis->Full()){
-      fMCAnalysis->FillSimPiKPMinusRecoPiKPFullAcceptanceTPC(fRecAnalysis->GetCorrectedPiKPEtFullAcceptanceTPC());
-      fMCAnalysis->FillSimPiKPMinusRecoPiKPFullAcceptanceITS(fRecAnalysis->GetCorrectedPiKPEtFullAcceptanceITS());
-      fMCAnalysis->FillSimPiKPMinusRecoPiKPFullAcceptanceTPCNoPID(fRecAnalysis->GetCorrectedPiKPEtFullAcceptanceTPCNoPID());
-      fMCAnalysis->FillSimPiKPMinusRecoPiKPFullAcceptanceITSNoPID(fRecAnalysis->GetCorrectedPiKPEtFullAcceptanceITSNoPID());
+  if (mcEvent && fESDEvent){
+      ((AliAnalysisHadEtMonteCarlo*)fMCAnalysis)->AnalyseEvent((AliVEvent*)mcEvent,(AliVEvent*)fESDEvent);
+      if(fMCAnalysis->Full()){
+       fMCAnalysis->FillSimTotEtMinusRecoTotEtFullAcceptanceTPC( fRecAnalysis->GetCorrectedTotEtFullAcceptanceTPC() );
+       fMCAnalysis->FillSimTotEtMinusRecoTotEtFullAcceptanceITS( fRecAnalysis->GetCorrectedTotEtFullAcceptanceITS() );
+       fMCAnalysis->FillSimTotEtMinusRecoTotEtFullAcceptanceTPCNoPID( fRecAnalysis->GetCorrectedTotEtFullAcceptanceTPCNoPID() );
+       fMCAnalysis->FillSimTotEtMinusRecoTotEtFullAcceptanceITSNoPID( fRecAnalysis->GetCorrectedTotEtFullAcceptanceITSNoPID() );
+       fMCAnalysis->FillSimHadEtMinusRecoHadEtFullAcceptanceTPC( fRecAnalysis->GetCorrectedHadEtFullAcceptanceTPC() );
+       fMCAnalysis->FillSimHadEtMinusRecoHadEtFullAcceptanceITS( fRecAnalysis->GetCorrectedHadEtFullAcceptanceITS() );
+       fMCAnalysis->FillSimHadEtMinusRecoHadEtFullAcceptanceTPCNoPID( fRecAnalysis->GetCorrectedHadEtFullAcceptanceTPCNoPID() );
+       fMCAnalysis->FillSimHadEtMinusRecoHadEtFullAcceptanceITSNoPID( fRecAnalysis->GetCorrectedHadEtFullAcceptanceITSNoPID() );
+      }
+      if(fMCAnalysis->EMCAL()){
+       fMCAnalysis->FillSimTotEtMinusRecoTotEtEMCALAcceptanceTPC( fRecAnalysis->GetCorrectedTotEtEMCALAcceptanceTPC() );
+       fMCAnalysis->FillSimTotEtMinusRecoTotEtEMCALAcceptanceITS( fRecAnalysis->GetCorrectedTotEtEMCALAcceptanceITS() );
+       fMCAnalysis->FillSimTotEtMinusRecoTotEtEMCALAcceptanceTPCNoPID( fRecAnalysis->GetCorrectedTotEtEMCALAcceptanceTPCNoPID() );
+       fMCAnalysis->FillSimTotEtMinusRecoTotEtEMCALAcceptanceITSNoPID( fRecAnalysis->GetCorrectedTotEtEMCALAcceptanceITSNoPID() );
+       fMCAnalysis->FillSimHadEtMinusRecoHadEtEMCALAcceptanceTPC( fRecAnalysis->GetCorrectedHadEtEMCALAcceptanceTPC() );
+       fMCAnalysis->FillSimHadEtMinusRecoHadEtEMCALAcceptanceITS( fRecAnalysis->GetCorrectedHadEtEMCALAcceptanceITS() );
+       fMCAnalysis->FillSimHadEtMinusRecoHadEtEMCALAcceptanceTPCNoPID( fRecAnalysis->GetCorrectedHadEtEMCALAcceptanceTPCNoPID() );
+       fMCAnalysis->FillSimHadEtMinusRecoHadEtEMCALAcceptanceITSNoPID( fRecAnalysis->GetCorrectedHadEtEMCALAcceptanceITSNoPID() );
+      }
+      if(fMCAnalysis->PHOS()){
+       fMCAnalysis->FillSimTotEtMinusRecoTotEtPHOSAcceptanceTPC( fRecAnalysis->GetCorrectedTotEtPHOSAcceptanceTPC() );
+       fMCAnalysis->FillSimTotEtMinusRecoTotEtPHOSAcceptanceITS( fRecAnalysis->GetCorrectedTotEtPHOSAcceptanceITS() );
+       fMCAnalysis->FillSimTotEtMinusRecoTotEtPHOSAcceptanceTPCNoPID( fRecAnalysis->GetCorrectedTotEtPHOSAcceptanceTPCNoPID() );
+       fMCAnalysis->FillSimTotEtMinusRecoTotEtPHOSAcceptanceITSNoPID( fRecAnalysis->GetCorrectedTotEtPHOSAcceptanceITSNoPID() );
+       fMCAnalysis->FillSimHadEtMinusRecoHadEtPHOSAcceptanceTPC( fRecAnalysis->GetCorrectedHadEtPHOSAcceptanceTPC() );
+       fMCAnalysis->FillSimHadEtMinusRecoHadEtPHOSAcceptanceITS( fRecAnalysis->GetCorrectedHadEtPHOSAcceptanceITS() );
+       fMCAnalysis->FillSimHadEtMinusRecoHadEtPHOSAcceptanceTPCNoPID( fRecAnalysis->GetCorrectedHadEtPHOSAcceptanceTPCNoPID() );
+       fMCAnalysis->FillSimHadEtMinusRecoHadEtPHOSAcceptanceITSNoPID( fRecAnalysis->GetCorrectedHadEtPHOSAcceptanceITSNoPID() );
+      }
+      if(fMCAnalysis->PiKP() && fMCAnalysis->Full()){
+       fMCAnalysis->FillSimPiKPMinusRecoPiKPFullAcceptanceTPC(fRecAnalysis->GetCorrectedPiKPEtFullAcceptanceTPC());
+       fMCAnalysis->FillSimPiKPMinusRecoPiKPFullAcceptanceITS(fRecAnalysis->GetCorrectedPiKPEtFullAcceptanceITS());
+       fMCAnalysis->FillSimPiKPMinusRecoPiKPFullAcceptanceTPCNoPID(fRecAnalysis->GetCorrectedPiKPEtFullAcceptanceTPCNoPID());
+       fMCAnalysis->FillSimPiKPMinusRecoPiKPFullAcceptanceITSNoPID(fRecAnalysis->GetCorrectedPiKPEtFullAcceptanceITSNoPID());
+      }
     }
   }
-
 // Post output data.
 PostData(1, fOutputList);
 }
index 856e62b..205a6cf 100644 (file)
@@ -15,12 +15,12 @@ class AliESDtrackCuts;
 class TH2F;\r
 class TList;\r
 \r
-#include "AliAnalysisTaskSE.h"\r
+#include "AliAnalysisTaskTransverseEnergy.h"\r
 \r
 \r
-class AliAnalysisTaskHadEt : public AliAnalysisTaskSE {\r
+class AliAnalysisTaskHadEt : public AliAnalysisTaskTransverseEnergy {\r
 public:\r
-    AliAnalysisTaskHadEt(const char *name = "AliAnalysisTaskHadEt");\r
+    AliAnalysisTaskHadEt(const char *name = "AliAnalysisTaskHadEt", Bool_t isMc = false);\r
     virtual ~AliAnalysisTaskHadEt();\r
 \r
     //  virtual void   ConnectInputData(Option_t *);\r
@@ -28,30 +28,16 @@ public:
     virtual void   UserExec(Option_t *option);\r
     virtual void   Terminate(Option_t *);\r
 \r
-    AliESDtrackCuts* GetTPCITSTrackCuts(){return (AliESDtrackCuts*) fOutputList->FindObject("fEsdTrackCuts");}\r
-    AliESDtrackCuts* GetTPCOnlyTrackCuts(){return (AliESDtrackCuts*) fOutputList->FindObject("fEsdTrackCutsTPCOnly");}\r
-    AliESDtrackCuts* GetITSTrackCuts(){return (AliESDtrackCuts*) fOutputList->FindObject("fEsdTrackCutsITS");}\r
-\r
 private:\r
-    TString       fHadMCConfigFile;        // the name of the ConfigFile\r
-    TString       fHadRecoConfigFile;        // the name of the ConfigFile\r
 \r
   //Declare it private to avoid compilation warning\r
     AliAnalysisTaskHadEt & operator = (const AliAnalysisTaskHadEt & g) ;//cpy assignment\r
     AliAnalysisTaskHadEt(const AliAnalysisTaskHadEt & g) ; // cpy ctor\r
 \r
-    TList *fOutputList; //output list\r
-\r
     AliAnalysisHadEtReconstructed *fRecAnalysis; // Rec\r
     AliAnalysisHadEtMonteCarlo *fMCAnalysis; // MC\r
 \r
-    TH2F *fHistEtRecvsEtMC; // Rec vs MC histo \r
-    \r
-    AliESDtrackCuts* fEsdtrackCutsITSTPC; // track cuts ITS&TPC\r
-    AliESDtrackCuts* fEsdtrackCutsTPC; // track cuts TPC\r
-    AliESDtrackCuts* fEsdtrackCutsITS; // track cuts ITS\r
-    \r
-    ClassDef(AliAnalysisTaskHadEt, 1); // example of analysis\r
+    ClassDef(AliAnalysisTaskHadEt, 2); // example of analysis\r
 };\r
 \r
 #endif\r
index 3b52c27..07a3407 100644 (file)
@@ -32,17 +32,10 @@ using namespace std;
 ClassImp(AliAnalysisTaskTotEt)
 
 //________________________________________________________________________
-AliAnalysisTaskTotEt::AliAnalysisTaskTotEt(const char *name) :
-        AliAnalysisTaskSE(name)
-       ,fMCConfigFile("ConfigEtMonteCarlo.C")
-       ,fRecoConfigFile("ConfigEtReconstructed.C")
-        ,fOutputList(0)
+AliAnalysisTaskTotEt::AliAnalysisTaskTotEt(const char *name, Bool_t isMc) :
+        AliAnalysisTaskTransverseEnergy(name, isMc)
         ,fRecAnalysis(0)
         ,fMCAnalysis(0)
-        ,fHistEtRecvsEtMC(0)
-        ,fEsdtrackCutsITSTPC(0)
-        ,fEsdtrackCutsTPC(0)
-        ,fEsdtrackCutsITS(0)
 {
     // Constructor
 
@@ -51,30 +44,30 @@ AliAnalysisTaskTotEt::AliAnalysisTaskTotEt(const char *name) :
     TString t(name);
     t.ToUpper();
     if (t.Contains("EMC")) {
-      if (fMCConfigFile.Length()) {
-       cout<<"Rereading AliAnalysisEtMonteCarloEmcal configuration file..."<<endl;
-       gROOT->LoadMacro(fMCConfigFile);
-       fMCAnalysis = (AliAnalysisEtMonteCarloEmcal *) gInterpreter->ProcessLine("ConfigEtMonteCarlo()");
-      }
-
-      if (fRecoConfigFile.Length()) {
-       cout<<"Rereading AliAnalysisEtReconstructedEmcal configuration file..."<<endl;
-       gROOT->LoadMacro(fRecoConfigFile);
-       fRecAnalysis = (AliAnalysisEtReconstructedEmcal *) gInterpreter->ProcessLine("ConfigEtReconstructed()");
-      }
+        if (fMCConfigFile.Length()) {
+            cout<<"Rereading AliAnalysisEtMonteCarloEmcal configuration file..."<<endl;
+            gROOT->LoadMacro(fMCConfigFile);
+            fMCAnalysis = (AliAnalysisEtMonteCarloEmcal *) gInterpreter->ProcessLine("ConfigEtMonteCarlo()");
+        }
+
+        if (fRecoConfigFile.Length()) {
+            cout<<"Rereading AliAnalysisEtReconstructedEmcal configuration file..."<<endl;
+            gROOT->LoadMacro(fRecoConfigFile);
+            fRecAnalysis = (AliAnalysisEtReconstructedEmcal *) gInterpreter->ProcessLine("ConfigEtReconstructed()");
+        }
     }
-    else{
-      if (fMCConfigFile.Length()) {
-       cout<<"Rereading AliAnalysisEtMonteCarloPhos configuration file..."<<endl;
-       gROOT->LoadMacro(fMCConfigFile);
-       fMCAnalysis = (AliAnalysisEtMonteCarloPhos *) gInterpreter->ProcessLine("ConfigEtMonteCarlo()");
-      }
-
-      if (fRecoConfigFile.Length()) {
-       cout<<"Rereading AliAnalysisEtReconstructedPhos configuration file..."<<endl;
-       gROOT->LoadMacro(fRecoConfigFile);
-       fRecAnalysis = (AliAnalysisEtReconstructedPhos *) gInterpreter->ProcessLine("ConfigEtReconstructed()");
-      }
+    else {
+        if (fMCConfigFile.Length()) {
+            cout<<"Rereading AliAnalysisEtMonteCarloPhos configuration file..."<<endl;
+            gROOT->LoadMacro(fMCConfigFile);
+            fMCAnalysis = (AliAnalysisEtMonteCarloPhos *) gInterpreter->ProcessLine("ConfigEtMonteCarlo()");
+        }
+
+        if (fRecoConfigFile.Length()) {
+            cout<<"Rereading AliAnalysisEtReconstructedPhos configuration file..."<<endl;
+            gROOT->LoadMacro(fRecoConfigFile);
+            fRecAnalysis = (AliAnalysisEtReconstructedPhos *) gInterpreter->ProcessLine("ConfigEtReconstructed()");
+        }
     }
     // Define input and output slots here
     // Input slot #0 works with a TChain
@@ -84,14 +77,10 @@ AliAnalysisTaskTotEt::AliAnalysisTaskTotEt(const char *name) :
     DefineOutput(1, TList::Class());
 
 }
-AliAnalysisTaskTotEt::~AliAnalysisTaskTotEt(){//Destructor
-  fOutputList->Clear();
-  delete fOutputList;
-  delete fRecAnalysis;
-  delete fMCAnalysis;
-  delete fEsdtrackCutsITSTPC;
-  delete fEsdtrackCutsTPC;
-  delete fEsdtrackCutsITS;
+AliAnalysisTaskTotEt::~AliAnalysisTaskTotEt() {//Destructor
+    fOutputList->Clear();
+    delete fRecAnalysis;
+    delete fMCAnalysis;
 }
 
 //________________________________________________________________________
@@ -108,69 +97,79 @@ void AliAnalysisTaskTotEt::UserCreateOutputObjects()
     fHistEtRecvsEtMC = new TH2F("fHistEtRecvsEtMC", "Reconstructed E_{t} vs MC E_{t}", 1000, 0.000, 100, 1000, 0.0001, 100);
     fOutputList->Add(fHistEtRecvsEtMC);
 
-  Bool_t selectPrimaries=kTRUE;
-  if(fRecAnalysis->DataSet()==2009){
-    cout<<"Setting track cuts for the 2009 p+p collisions at 900 GeV"<<endl;
-    fEsdtrackCutsITSTPC = AliESDtrackCuts::GetStandardITSTPCTrackCuts2009(selectPrimaries);
-    fEsdtrackCutsITSTPC->SetName("fEsdTrackCuts");
-    fEsdtrackCutsTPC = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
-    fEsdtrackCutsTPC->SetName("fEsdTrackCutsTPCOnly");
-    //ITS stand alone cuts - similar to 2009 cuts but with only ITS hits required
-    fEsdtrackCutsITS =  AliESDtrackCuts::GetStandardITSPureSATrackCuts2009(kTRUE,kFALSE);//we do want primaries but we do not want to require PID info
-    fEsdtrackCutsITS->SetName("fEsdTrackCutsITS");
-  }
-  if(fRecAnalysis->DataSet()==2010){
-    //cout<<"Setting track cuts for the 2010 p+p collisions at 7 GeV"<<endl;
-    cout<<"Warning:  Have not set 2010 track cuts yet!!"<<endl;
-    fEsdtrackCutsITSTPC = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
-    fEsdtrackCutsITSTPC->SetName("fEsdTrackCuts");
-    fEsdtrackCutsTPC = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
-    fEsdtrackCutsTPC->SetName("fEsdTrackCutsTPCOnly");
-    //ITS stand alone cuts - similar to 2009 cuts but with only ITS hits required
-    fEsdtrackCutsITS =  AliESDtrackCuts::GetStandardITSPureSATrackCuts2009(kTRUE,kFALSE);//we do want primaries but we do not want to require PID info
-    fEsdtrackCutsITS->SetName("fEsdTrackCutsITS");
-  }
-
-  fOutputList->Add(fEsdtrackCutsITSTPC);
-  fOutputList->Add(fEsdtrackCutsTPC);
-  fOutputList->Add(fEsdtrackCutsITS);
-  if(fEsdtrackCutsITSTPC && fEsdtrackCutsTPC){
-    fRecAnalysis->SetITSTrackCuts( GetITSTrackCuts());
-    fMCAnalysis->SetITSTrackCuts( GetITSTrackCuts());
-    fRecAnalysis->SetTPCITSTrackCuts( GetTPCITSTrackCuts());
-    fMCAnalysis->SetTPCITSTrackCuts( GetTPCITSTrackCuts());
-    fRecAnalysis->SetTPCOnlyTrackCuts( GetTPCOnlyTrackCuts());
-    fMCAnalysis->SetTPCOnlyTrackCuts( GetTPCOnlyTrackCuts());
-    //add ITS stuff!
-  }
-  else{
-    Printf("Error: no track cuts!");
-  }
+    Bool_t selectPrimaries=kTRUE;
+    if (fRecAnalysis->DataSet()==2009) {
+        cout<<"Setting track cuts for the 2009 p+p collisions at 900 GeV"<<endl;
+        fEsdtrackCutsITSTPC = AliESDtrackCuts::GetStandardITSTPCTrackCuts2009(selectPrimaries);
+        fEsdtrackCutsITSTPC->SetName("fEsdTrackCuts");
+        fEsdtrackCutsTPC = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
+        fEsdtrackCutsTPC->SetName("fEsdTrackCutsTPCOnly");
+        //ITS stand alone cuts - similar to 2009 cuts but with only ITS hits required
+        fEsdtrackCutsITS =  AliESDtrackCuts::GetStandardITSPureSATrackCuts2009(kTRUE,kFALSE);//we do want primaries but we do not want to require PID info
+        fEsdtrackCutsITS->SetName("fEsdTrackCutsITS");
+    }
+    if (fRecAnalysis->DataSet()==2010) {
+        //cout<<"Setting track cuts for the 2010 p+p collisions at 7 GeV"<<endl;
+        cout<<"Warning:  Have not set 2010 track cuts yet!!"<<endl;
+        fEsdtrackCutsITSTPC = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
+        fEsdtrackCutsITSTPC->SetName("fEsdTrackCuts");
+        fEsdtrackCutsTPC = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
+        fEsdtrackCutsTPC->SetName("fEsdTrackCutsTPCOnly");
+        //ITS stand alone cuts - similar to 2009 cuts but with only ITS hits required
+        fEsdtrackCutsITS =  AliESDtrackCuts::GetStandardITSPureSATrackCuts2009(kTRUE,kFALSE);//we do want primaries but we do not want to require PID info
+        fEsdtrackCutsITS->SetName("fEsdTrackCutsITS");
+    }
+
+    fOutputList->Add(fEsdtrackCutsITSTPC);
+    fOutputList->Add(fEsdtrackCutsTPC);
+    fOutputList->Add(fEsdtrackCutsITS);
+    if (fEsdtrackCutsITSTPC && fEsdtrackCutsTPC) {
+        fRecAnalysis->SetITSTrackCuts( GetITSTrackCuts());
+        fMCAnalysis->SetITSTrackCuts( GetITSTrackCuts());
+        fRecAnalysis->SetTPCITSTrackCuts( GetTPCITSTrackCuts());
+        fMCAnalysis->SetTPCITSTrackCuts( GetTPCITSTrackCuts());
+        fRecAnalysis->SetTPCOnlyTrackCuts( GetTPCOnlyTrackCuts());
+        fMCAnalysis->SetTPCOnlyTrackCuts( GetTPCOnlyTrackCuts());
+        //add ITS stuff!
+    }
+    else {
+        Printf("Error: no track cuts!");
+    }
 
 }
 
 //________________________________________________________________________
 void AliAnalysisTaskTotEt::UserExec(Option_t *)
 { // execute method
-  AliESDEvent *event = dynamic_cast<AliESDEvent*>(InputEvent());
-    if (!event) {
+
+    fESDEvent = dynamic_cast<AliESDEvent*>(InputEvent());
+    if (!fESDEvent)
+    {
         Printf("ERROR: Could not retrieve event");
         return;
     }
 
-    fRecAnalysis->AnalyseEvent(event);
+    Int_t res = CheckPhysicsSelection(fESDEvent->GetRunNumber());
+
+    AliESDCentrality *cent = GetCentralityObject();
 
-    AliMCEvent* mcEvent = MCEvent();
-    if (mcEvent)
+    if (res == 0 && cent)
     {
-        fMCAnalysis->AnalyseEvent(mcEvent);
+        if (IsPhysicsSelected())
+        {
+            fRecAnalysis->SetCentralityObject(cent);
+            fRecAnalysis->AnalyseEvent(fESDEvent);
+
+            AliMCEvent* mcEvent = MCEvent();
+            if (mcEvent)
+            {
+                fMCAnalysis->AnalyseEvent(mcEvent);
+            }
+            fHistEtRecvsEtMC->Fill(fRecAnalysis->GetTotEtAcc(), fMCAnalysis->GetTotEt());
+        }
     }
-
-    fHistEtRecvsEtMC->Fill(fRecAnalysis->GetTotEtAcc(), fMCAnalysis->GetTotEt());
-
-// Post output data.
+    // Post output data.
     PostData(1, fOutputList);
-
 }
 
 //________________________________________________________________________
index 38f7380..33dc38e 100644 (file)
@@ -14,47 +14,29 @@ class AliESDtrackCuts;
 class TH2F;\r
 class TList;\r
 \r
-#include "AliAnalysisTaskSE.h"\r
+#include "AliAnalysisTaskTransverseEnergy.h"\r
 \r
-class AliAnalysisTaskTotEt : public AliAnalysisTaskSE {\r
+class AliAnalysisTaskTotEt : public AliAnalysisTaskTransverseEnergy {\r
   \r
 public:\r
-  AliAnalysisTaskTotEt(const char *name = "AliAnalysisTaskTotEt");\r
+  AliAnalysisTaskTotEt(const char *name = "AliAnalysisTaskTotEt", Bool_t isMc = false);\r
   virtual ~AliAnalysisTaskTotEt();\r
   \r
-public:\r
-  \r
   //  virtual void   ConnectInputData(Option_t *);\r
   virtual void   UserCreateOutputObjects();\r
   virtual void   UserExec(Option_t *option);\r
   virtual void   Terminate(Option_t *);\r
     \r
-\r
-  AliESDtrackCuts* GetTPCITSTrackCuts(){return (AliESDtrackCuts*) fOutputList->FindObject("fEsdTrackCuts");}\r
-  AliESDtrackCuts* GetTPCOnlyTrackCuts(){return (AliESDtrackCuts*) fOutputList->FindObject("fEsdTrackCutsTPCOnly");}\r
-  AliESDtrackCuts* GetITSTrackCuts(){return (AliESDtrackCuts*) fOutputList->FindObject("fEsdTrackCutsITS");}\r
-\r
 private:\r
   \r
   //Declare private to avoid compilation warning\r
   AliAnalysisTaskTotEt & operator = (const AliAnalysisTaskTotEt & g) ;//copy assignment\r
   AliAnalysisTaskTotEt(const AliAnalysisTaskTotEt & g) ; // copy ctor\r
 \r
-  TString       fMCConfigFile;        // the name of the ConfigFile\r
-  TString       fRecoConfigFile;        // the name of the ConfigFile\r
-\r
-  TList *fOutputList; //output list\r
-  \r
   AliAnalysisEtReconstructed *fRecAnalysis; // Rec \r
   AliAnalysisEtMonteCarlo *fMCAnalysis; // MC\r
   \r
-  TH2F *fHistEtRecvsEtMC; // Rec vs MC histo\r
-\r
-  AliESDtrackCuts* fEsdtrackCutsITSTPC; // track cuts ITS&TPC\r
-  AliESDtrackCuts* fEsdtrackCutsTPC; // track cuts TPC\r
-  AliESDtrackCuts* fEsdtrackCutsITS; // track cuts ITS\r
-  \r
-  ClassDef(AliAnalysisTaskTotEt, 1); // example of analysis\r
+  ClassDef(AliAnalysisTaskTotEt, 2) \r
 };\r
 \r
 #endif\r