adding new QA tasks from Marta
authorkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 20 Nov 2009 10:06:54 +0000 (10:06 +0000)
committerkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 20 Nov 2009 10:06:54 +0000 (10:06 +0000)
PWG4/JetTasks/AliPWG4HighPtQAMC.cxx [new file with mode: 0644]
PWG4/JetTasks/AliPWG4HighPtQAMC.h [new file with mode: 0644]
PWG4/JetTasks/AliPWG4HighPtQATPConly.cxx [new file with mode: 0644]
PWG4/JetTasks/AliPWG4HighPtQATPConly.h [new file with mode: 0644]
PWG4/JetTasks/AliPWG4HighPtSpectra.cxx [new file with mode: 0644]
PWG4/JetTasks/AliPWG4HighPtSpectra.h [new file with mode: 0644]
PWG4/PWG4JetTasksLinkDef.h
PWG4/libPWG4JetTasks.pkg
PWG4/macros/AddTaskPWG4HighPtQAMC.C [new file with mode: 0644]
PWG4/macros/AddTaskPWG4HighPtQATPConly.C [new file with mode: 0644]
PWG4/macros/AddTaskPWG4HighPtSpectra.C [new file with mode: 0644]

diff --git a/PWG4/JetTasks/AliPWG4HighPtQAMC.cxx b/PWG4/JetTasks/AliPWG4HighPtQAMC.cxx
new file mode 100644 (file)
index 0000000..d89e1f4
--- /dev/null
@@ -0,0 +1,445 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+//-----------------------------------------------------------------------
+// This class compares the global reconstruction with the MC information
+// Momentum resolution is stored as function of track cuts and pt.
+// Output: Histograms for different set of cuts
+//-----------------------------------------------------------------------
+// Author : Marta Verweij - UU
+//-----------------------------------------------------------------------
+
+#include "AliPWG4HighPtQAMC.h"
+
+#include "TH1.h"
+#include "TH2.h"
+#include "TH3.h"
+#include "TList.h"
+#include "TChain.h"
+#include "TH3F.h"
+#include "AliAnalysisManager.h"
+#include "AliESDInputHandler.h"
+#include "AliMCEvent.h"
+#include "AliMCEventHandler.h"
+#include "AliStack.h"
+#include "AliESDtrack.h"
+#include "AliESDtrackCuts.h"
+#include "AliExternalTrackParam.h"
+
+
+using namespace std; //required for resolving the 'cout' symbol
+
+ClassImp(AliPWG4HighPtQAMC)
+
+AliPWG4HighPtQAMC::AliPWG4HighPtQAMC(): AliAnalysisTask("AliPWG4HighPtQAMC", ""), 
+  fESD(0), 
+  fTrackCuts(0), 
+  fTrackCutsITS(0),
+  fNEvent(0), // just to avoid warnings, inititialized in InitPointers too
+  fPtAll(0),  //
+  fPtSel(0),  //
+  fPtAllminPtMCvsPtAll(0),
+  fPtAllminPtMCvsPtAllNPointTPC(0),
+  fPtAllminPtMCvsPtAllDCAR(0),
+  fPtAllminPtMCvsPtAllDCAZ(0),
+  fPtAllminPtMCvsPtAllPhi(0),
+  fPtAllminPtMCvsPtAllNPointITS(0),
+  fPtAllminPtMCvsPtAllNSigmaToVertex(0),
+  fPtAllminPtMCvsPtAllChi2C(0),
+  fPtAllminPtMCvsPtAllRel1PtUncertainty(0),
+  fPtAllMC(0),
+  fPtSelMC(0),
+  fPtSelMCITS(0),
+  fHistList(0),
+  fPtSelITS(0),
+  fPtITSminPtMCvsPtITS(0),
+  fPtITSminPtMCvsPtITSNPointTPC(0),
+  fPtITSminPtMCvsPtITSDCAR(0),
+  fPtITSminPtMCvsPtITSDCAZ(0),
+  fPtITSminPtMCvsPtITSPhi(0),
+  fPtITSminPtMCvsPtITSNPointITS(0),
+  fPtITSminPtMCvsPtITSNSigmaToVertex(0),
+  fPtITSminPtMCvsPtITSChi2C(0),
+  fPtITSminPtMCvsPtITSRel1PtUncertainty(0),
+  fHistListITS(0)
+{
+  InitHistPointers();
+}
+//________________________________________________________________________
+AliPWG4HighPtQAMC::AliPWG4HighPtQAMC(const char *name): 
+  AliAnalysisTask(name, ""), 
+  fESD(0),
+  fTrackCuts(),
+  fTrackCutsITS(),
+  fNEvent(0), // just to avoid warnings, inititialized in InitPointers too
+  fPtAll(0),  //
+  fPtSel(0),  //
+  fPtAllminPtMCvsPtAll(0),
+  fPtAllminPtMCvsPtAllNPointTPC(0),
+  fPtAllminPtMCvsPtAllDCAR(0),
+  fPtAllminPtMCvsPtAllDCAZ(0),
+  fPtAllminPtMCvsPtAllPhi(0),
+  fPtAllminPtMCvsPtAllNPointITS(0),
+  fPtAllminPtMCvsPtAllNSigmaToVertex(0),
+  fPtAllminPtMCvsPtAllChi2C(0),
+  fPtAllminPtMCvsPtAllRel1PtUncertainty(0),
+  fPtAllMC(0),
+  fPtSelMC(0),
+  fPtSelMCITS(0),
+  fHistList(0),
+  fPtSelITS(0),
+  fPtITSminPtMCvsPtITS(0),
+  fPtITSminPtMCvsPtITSNPointTPC(0),
+  fPtITSminPtMCvsPtITSDCAR(0),
+  fPtITSminPtMCvsPtITSDCAZ(0),
+  fPtITSminPtMCvsPtITSPhi(0),
+  fPtITSminPtMCvsPtITSNPointITS(0),
+  fPtITSminPtMCvsPtITSNSigmaToVertex(0),
+  fPtITSminPtMCvsPtITSChi2C(0),
+  fPtITSminPtMCvsPtITSRel1PtUncertainty(0),
+  fHistListITS(0)
+{
+  //
+  // Constructor. Initialization of Inputs and Outputs
+  //
+  Info("AliPWG4HighPtQAMC","Calling Constructor");
+  // Input slot #0 works with a TChain ESD
+  DefineInput(0, TChain::Class());
+  // Output slot #0 writes into a TList
+  DefineOutput(0, TList::Class());
+  // Output slot #1 writes into a TList
+  DefineOutput(1, TList::Class());
+  // Output slot #2 writes into a TList
+  DefineOutput(2, TList::Class());
+  InitHistPointers();
+  //  TH1::AddDirectory(kFALSE);
+  //  TH2::AddDirectory(kFALSE);
+  // TH3::AddDirectory(kFALSE);
+  }
+
+//________________________________________________________________________
+void AliPWG4HighPtQAMC::ConnectInputData(Option_t *) 
+{
+  // Connect ESD here
+  // Called once
+  printf(">> AliPWG4HighPtQATPConly::ConnectInputData \n");
+  TTree* tree = dynamic_cast<TTree*> (GetInputData(0));
+  if (!tree) {
+    Printf("ERROR: Could not read chain from input slot 0");
+  } else {
+    
+    AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+    
+    if (!esdH) {
+      Printf("ERROR: Could not get ESDInputHandler");
+    } else
+      fESD = esdH->GetEvent();
+  }
+}
+
+//________________________________________________________________________
+void AliPWG4HighPtQAMC::InitHistPointers() {
+  //Initialize histograms
+  fNEvent = 0;
+  fPtAll = 0;
+  fPtSel = 0;
+  //Global tracking compared to MC pt
+  fPtAllMC = 0;
+  fPtSelMC = 0;
+  fPtAllminPtMCvsPtAll = 0;
+  fPtAllminPtMCvsPtAllNPointTPC = 0;
+  fPtAllminPtMCvsPtAllDCAR = 0;
+  fPtAllminPtMCvsPtAllDCAZ = 0;
+  fPtAllminPtMCvsPtAllPhi = 0;
+  fPtAllminPtMCvsPtAllNPointITS = 0;
+  fPtAllminPtMCvsPtAllNSigmaToVertex = 0;
+  fPtAllminPtMCvsPtAllChi2C = 0;
+  fPtAllminPtMCvsPtAllRel1PtUncertainty = 0;
+  //ITSrefit histos compared to MC pt
+  fPtSelITS = 0;
+  fPtITSminPtMCvsPtITS = 0;
+  fPtITSminPtMCvsPtITSNPointTPC = 0;
+  fPtITSminPtMCvsPtITSDCAR = 0;
+  fPtITSminPtMCvsPtITSDCAZ = 0;
+  fPtITSminPtMCvsPtITSPhi = 0;
+  fPtITSminPtMCvsPtITSNPointITS = 0;
+  fPtITSminPtMCvsPtITSNSigmaToVertex = 0;
+  fPtITSminPtMCvsPtITSChi2C = 0;
+  fPtITSminPtMCvsPtITSRel1PtUncertainty = 0;
+}
+//________________________________________________________________________
+void AliPWG4HighPtQAMC::CreateOutputObjects() {
+  //Create output objects
+  printf(">> AliPWG4HighPtQATPConly::CreateOutputObjects \n");
+  OpenFile(0);
+  fHistList = new TList();
+  OpenFile(1);
+  fHistListITS = new TList();
+
+  Int_t fgkNPhiBins=18;
+  Float_t kMinPhi = 0.;
+  Float_t kMaxPhi = 2.*TMath::Pi();
+  
+  Int_t fgkNPtBins=98;
+  Float_t fgkPtMin=2.;
+  Float_t fgkPtMax=100.;
+  Int_t fgkResPtBins=40;
+
+  fNEvent = new TH1F("fNEvent","NEvent",1,-0.5,0.5);
+  fHistList->Add(fNEvent);
+  fPtAll = new TH1F("fPtAll","PtAll",fgkNPtBins, fgkPtMin, fgkPtMax);
+  fHistList->Add(fPtAll);
+  fPtSel = new TH1F("fPtSel","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax);
+  fHistList->Add(fPtSel);
+  
+  fPtAllminPtMCvsPtAll = new TH2F("fPtAllminPtMCvsPtAll","PtAllminPtMCvsPtAll",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.);
+  fPtAllminPtMCvsPtAll->SetXTitle("p_{t}^{MC}");
+  fPtAllminPtMCvsPtAll->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{MC})/(1/p_{t}^{MC})");
+  fHistList->Add(fPtAllminPtMCvsPtAll);
+  
+  fPtAllminPtMCvsPtAllNPointTPC = new TH3F("fPtAllminPtMCvsPtAllNPointTPC","PtAllminPtMCvsPtAllNPointTPC",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,160,0.5,160.5);
+  fPtAllminPtMCvsPtAllNPointTPC->SetXTitle("p_{t}^{MC}");
+  fPtAllminPtMCvsPtAllNPointTPC->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{MC})/(1/p_{t}^{MC})");
+  fPtAllminPtMCvsPtAllNPointTPC->SetZTitle("N_{point,TPC}");
+  fHistList->Add(fPtAllminPtMCvsPtAllNPointTPC);
+
+  fPtAllminPtMCvsPtAllDCAR = new TH3F("fPtAllminPtMCvsPtAllDCAR","PtAllminPtMCvsPtAllDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,20,-1.,1.);
+  fPtAllminPtMCvsPtAllDCAR->SetXTitle("p_{t}^{MC}");
+  fPtAllminPtMCvsPtAllDCAR->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{MC})/(1/p_{t}^{MC})");
+  fPtAllminPtMCvsPtAllDCAR->SetZTitle("DCA_{R}");
+  fHistList->Add(fPtAllminPtMCvsPtAllDCAR);
+
+  fPtAllminPtMCvsPtAllDCAZ = new TH3F("fPtAllminPtMCvsPtAllDCAZ","PtAllminPtMCvsPtAllDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,40,-2.,2.);
+  fPtAllminPtMCvsPtAllDCAZ->SetXTitle("p_{t}^{MC}");
+  fPtAllminPtMCvsPtAllDCAZ->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{MC})/(1/p_{t}^{MC})");
+  fPtAllminPtMCvsPtAllDCAZ->SetZTitle("DCA_{Z}");
+  fHistList->Add(fPtAllminPtMCvsPtAllDCAZ);
+
+  fPtAllminPtMCvsPtAllPhi = new TH3F("fPtAllminPtMCvsPtAllPhi","PtAllminPtMCvsPtAllPhi",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkNPhiBins,kMinPhi,kMaxPhi);
+  fPtAllminPtMCvsPtAllPhi->SetXTitle("p_{t}^{MC}");
+  fPtAllminPtMCvsPtAllPhi->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{MC})/(1/p_{t}^{MC})");
+  fPtAllminPtMCvsPtAllPhi->SetZTitle("#phi");
+  fHistList->Add(fPtAllminPtMCvsPtAllPhi);
+
+  fPtAllminPtMCvsPtAllNPointITS = new TH3F("fPtAllminPtMCvsPtAllNPointITS","PtAllminPtMCvsPtAllNPointITS",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,9,-0.5,8.5);
+  fPtAllminPtMCvsPtAllNPointITS->SetXTitle("p_{t}^{MC}");
+  fPtAllminPtMCvsPtAllNPointITS->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{MC})/(1/p_{t}^{MC})");
+  fPtAllminPtMCvsPtAllNPointITS->SetZTitle("N_{point,ITS}}");
+  fHistList->Add(fPtAllminPtMCvsPtAllNPointITS);
+  
+  fPtAllminPtMCvsPtAllNSigmaToVertex = new TH3F("fPtAllminPtMCvsPtAllNSigmaToVertex","PtAllminPtMCvsPtAllNSigmaToVertex",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,40,0.,8.);
+  fPtAllminPtMCvsPtAllNSigmaToVertex->SetXTitle("p_{t}^{MC}");
+  fPtAllminPtMCvsPtAllNSigmaToVertex->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{MC})/(1/p_{t}^{MC})");
+  fPtAllminPtMCvsPtAllNSigmaToVertex->SetZTitle("N#sigma to vertex");
+  fHistList->Add(fPtAllminPtMCvsPtAllNSigmaToVertex);
+
+  fPtAllminPtMCvsPtAllChi2C = new TH3F("fPtAllminPtMCvsPtAllChi2C","PtAllminPtMCvsPtAllChi2C",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,20,0.,10.);
+  fPtAllminPtMCvsPtAllChi2C->SetXTitle("p_{t}^{MC}");
+  fPtAllminPtMCvsPtAllChi2C->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{MC})/(1/p_{t}^{MC})");
+  fPtAllminPtMCvsPtAllChi2C->SetZTitle("Constrained #chi^{2}");
+  fHistList->Add(fPtAllminPtMCvsPtAllChi2C);
+
+  fPtAllminPtMCvsPtAllRel1PtUncertainty = new TH3F("fPtAllminPtMCvsPtAllRel1PtUncertainty","PtAllminPtMCvsPtAllRel1PtUncertainty",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,30,0.,0.3);
+  fPtAllminPtMCvsPtAllRel1PtUncertainty->SetXTitle("p_{t}^{MC}");
+  fPtAllminPtMCvsPtAllRel1PtUncertainty->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{MC})/(1/p_{t}^{MC})");
+  fPtAllminPtMCvsPtAllRel1PtUncertainty->SetZTitle("Rel1PtUncertainty");
+  fHistList->Add(fPtAllminPtMCvsPtAllRel1PtUncertainty);
+
+  //ITSrefit
+  fPtSelITS = new TH1F("fPtSelITSrefit","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax);
+  fHistListITS->Add(fPtSelITS);
+  
+  fPtITSminPtMCvsPtITS = new TH2F("fPtITSminPtMCvsPtITS","PtITSminPtMCvsPtITS",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.);
+  fPtITSminPtMCvsPtITS->SetXTitle("p_{t}^{MC}");
+  fPtITSminPtMCvsPtITS->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{MC})/(1/p_{t}^{MC})");
+  fHistListITS->Add(fPtITSminPtMCvsPtITS);
+  
+  fPtITSminPtMCvsPtITSNPointTPC = new TH3F("fPtITSminPtMCvsPtITSNPointTPC","PtITSminPtMCvsPtITSNPointTPC",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,160,0.5,160.5);
+  fPtITSminPtMCvsPtITSNPointTPC->SetXTitle("p_{t}^{MC}");
+  fPtITSminPtMCvsPtITSNPointTPC->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{MC})/(1/p_{t}^{MC})");
+  fPtITSminPtMCvsPtITSNPointTPC->SetZTitle("N_{point,TPC}");
+  fHistListITS->Add(fPtITSminPtMCvsPtITSNPointTPC);
+    
+  fPtITSminPtMCvsPtITSDCAR = new TH3F("fPtITSminPtMCvsPtITSDCAR","PtITSminPtMCvsPtITSDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,20,-1.,1.);
+  fPtITSminPtMCvsPtITSDCAR->SetXTitle("p_{t}^{MC}");
+  fPtITSminPtMCvsPtITSDCAR->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{MC})/(1/p_{t}^{MC})");
+  fPtITSminPtMCvsPtITSDCAR->SetZTitle("DCA_{R}");
+  fHistListITS->Add(fPtITSminPtMCvsPtITSDCAR);
+  
+  fPtITSminPtMCvsPtITSDCAZ = new TH3F("fPtITSminPtMCvsPtITSDCAZ","PtITSminPtMCvsPtITSDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,40,-2.,2.);
+  fPtITSminPtMCvsPtITSDCAZ->SetXTitle("p_{t}^{MC}");
+  fPtITSminPtMCvsPtITSDCAZ->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{MC})/(1/p_{t}^{MC})");
+  fPtITSminPtMCvsPtITSDCAZ->SetZTitle("DCA_{Z}");
+  fHistListITS->Add(fPtITSminPtMCvsPtITSDCAZ);
+  
+  fPtITSminPtMCvsPtITSPhi = new TH3F("fPtITSminPtMCvsPtITSPhi","PtITSminPtMCvsPtITSPhi",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkNPhiBins,kMinPhi,kMaxPhi);
+  fPtITSminPtMCvsPtITSPhi->SetXTitle("p_{t}^{MC}");
+  fPtITSminPtMCvsPtITSPhi->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{MC})/(1/p_{t}^{MC})");
+  fPtITSminPtMCvsPtITSPhi->SetZTitle("#phi");
+  fHistListITS->Add(fPtITSminPtMCvsPtITSPhi);
+  
+  fPtITSminPtMCvsPtITSNPointITS = new TH3F("fPtITSminPtMCvsPtITSNPointITS","PtITSminPtMCvsPtITSNPointITS",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,9,-0.5,8.5);
+  fPtITSminPtMCvsPtITSNPointITS->SetXTitle("p_{t}^{MC}");
+  fPtITSminPtMCvsPtITSNPointITS->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{MC})/(1/p_{t}^{MC})}");
+  fPtITSminPtMCvsPtITSNPointITS->SetZTitle("N_{point,ITS}}");
+  fHistListITS->Add(fPtITSminPtMCvsPtITSNPointITS); 
+  
+  fPtITSminPtMCvsPtITSNSigmaToVertex = new TH3F("fPtITSminPtMCvsPtITSNSigmaToVertex","PtITSminPtMCvsPtITSNSigmaToVertex",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,40,0.,8.);
+  fPtITSminPtMCvsPtITSNSigmaToVertex->SetXTitle("p_{t}^{MC}");
+  fPtITSminPtMCvsPtITSNSigmaToVertex->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{MC})/(1/p_{t}^{MC})");
+  fPtITSminPtMCvsPtITSNSigmaToVertex->SetZTitle("N#sigma to vertex");
+  fHistListITS->Add(fPtITSminPtMCvsPtITSNSigmaToVertex);
+
+  fPtITSminPtMCvsPtITSChi2C = new TH3F("fPtITSminPtMCvsPtITSChi2C","PtITSminPtMCvsPtITSChi2C",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,20,0.,10.);
+  fPtITSminPtMCvsPtITSChi2C->SetXTitle("p_{t}^{MC}");
+  fPtITSminPtMCvsPtITSChi2C->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{MC})/(1/p_{t}^{MC})");
+  fPtITSminPtMCvsPtITSChi2C->SetZTitle("Constrained #chi^{2}");
+  fHistListITS->Add(fPtITSminPtMCvsPtITSChi2C);
+
+  fPtITSminPtMCvsPtITSRel1PtUncertainty = new TH3F("fPtITSminPtMCvsPtITSRel1PtUncertainty","PtITSminPtMCvsPtITSRel1PtUncertainty",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,30,0.,0.3);
+  fPtITSminPtMCvsPtITSRel1PtUncertainty->SetXTitle("p_{t}^{MC}");
+  fPtITSminPtMCvsPtITSRel1PtUncertainty->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{MC})/(1/p_{t}^{MC})");
+  fPtITSminPtMCvsPtITSRel1PtUncertainty->SetZTitle("Rel1PtUncertainty");
+  fHistListITS->Add(fPtITSminPtMCvsPtITSRel1PtUncertainty);
+
+  fPtAllMC = new TH1F("fPtAllMC","PtAll",fgkNPtBins, fgkPtMin, fgkPtMax);
+  fHistList->Add(fPtAllMC);
+  fPtSelMC = new TH1F("fPtSelMC","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax);
+  fHistList->Add(fPtSelMC);
+  fPtSelMCITS = new TH1F("fPtSelMCITS","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax);
+  fHistList->Add(fPtSelMCITS);
+  
+}
+//________________________________________________________________________
+void AliPWG4HighPtQAMC::Exec(Option_t *) {  
+  // Main loop
+  // Called for each event
+  printf(">> AliPWG4HighPtQATPConly::Exec \n");  
+  
+  if (!fESD) {
+    Printf("ERROR: fESD not available");
+    return;
+  }
+
+ AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
+  if (!eventHandler) {
+    Printf("ERROR: Could not retrieve MC event handler");
+    return;
+  }
+
+  AliMCEvent* mcEvent = eventHandler->MCEvent();
+  if (!mcEvent) {
+    Printf("ERROR: Could not retrieve MC event");
+    return;
+  }
+
+  Printf("MC particles: %d", mcEvent->GetNumberOfTracks());
+
+  if (!fESD) {
+    Printf("ERROR: fESD not available");
+    return;
+  }
+
+  AliStack* stack = mcEvent->Stack();                //Particles Stack
+
+  Printf("MC particles stack: %d", stack->GetNtrack());
+
+  const AliESDVertex *vtx = fESD->GetPrimaryVertex();
+
+  // Need vertex cut
+  if (vtx->GetNContributors() < 2)
+    return;
+
+  printf("Vertex title %s, status %d, nCont %d\n",vtx->GetTitle(), vtx->GetStatus(), vtx->GetNContributors());
+  // Need to keep track of evts without vertex
+  fNEvent->Fill(0.);
+
+  if(!fESD->GetNumberOfTracks() || fESD->GetNumberOfTracks()<2) return;
+  Int_t nTracks = fESD->GetNumberOfTracks();
+  printf("nTracks %d\n", nTracks);
+  
+  for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
+    
+    AliESDtrack *track = fESD->GetTrack(iTrack);
+    if(!track) continue;
+    Int_t label = TMath::Abs(track->GetLabel());
+    TParticle *particle = stack->Particle(label) ;
+    if(!particle) continue;
+
+    Float_t pt = track->Pt();
+    Float_t ptMC = particle->Pt();
+    Float_t phi = track->Phi();
+    Float_t dca2D, dcaZ;
+    track->GetImpactParameters(dca2D,dcaZ);
+    UChar_t itsMap = track->GetITSClusterMap();
+    Int_t nPointITS = 0;
+    for (Int_t i=0; i < 6; i++) {
+      if (itsMap & (1 << i))
+       nPointITS ++;
+    }
+    Float_t nSigmaToVertex = fTrackCuts->GetSigmaToVertex(track);// Calculates the number of sigma to the vertex for a track.
+    Float_t chi2C = track->GetConstrainedChi2();
+    Float_t relUncertainty1Pt = TMath::Sqrt(track->GetSigma1Pt2())*pt;
+
+    fPtAll->Fill(pt);
+    fPtAllMC->Fill(ptMC);
+    
+    if (fTrackCuts->AcceptTrack(track)) {
+
+      fPtSel->Fill(pt);
+      
+      fPtSelMC->Fill(ptMC);
+      fPtAllminPtMCvsPtAll->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC) );
+      fPtAllminPtMCvsPtAllNPointTPC->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),track->GetTPCNcls());
+      fPtAllminPtMCvsPtAllDCAR->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),dca2D);
+      fPtAllminPtMCvsPtAllDCAZ->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),dcaZ);
+      fPtAllminPtMCvsPtAllPhi->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),phi);
+      fPtAllminPtMCvsPtAllNPointITS->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),nPointITS);
+      fPtAllminPtMCvsPtAllNSigmaToVertex->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),nSigmaToVertex);
+      fPtAllminPtMCvsPtAllChi2C->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),chi2C);
+      fPtAllminPtMCvsPtAllRel1PtUncertainty->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),relUncertainty1Pt);
+    }//fTrackCuts selection
+    
+    
+    //ITSrefit selection
+    if (fTrackCutsITS->AcceptTrack(track)) {
+      
+      fPtSelITS->Fill(pt);
+      fPtSelMCITS->Fill(ptMC);
+      fPtITSminPtMCvsPtITS->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC) );
+      fPtITSminPtMCvsPtITSNPointTPC->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),track->GetTPCNcls());
+      fPtITSminPtMCvsPtITSDCAR->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),dca2D);
+      fPtITSminPtMCvsPtITSDCAZ->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),dcaZ);
+      fPtITSminPtMCvsPtITSPhi->Fill(ptMC,(pt-ptMC)/(pt),phi);
+      fPtITSminPtMCvsPtITSNPointITS->Fill(ptMC,(pt-ptMC)/(pt),nPointITS);
+      fPtITSminPtMCvsPtITSNSigmaToVertex->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),nSigmaToVertex);
+      fPtITSminPtMCvsPtITSChi2C->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),chi2C);
+      fPtITSminPtMCvsPtITSRel1PtUncertainty->Fill(ptMC,(1./pt-1./ptMC)/(1./ptMC),relUncertainty1Pt);
+    }//fTrackCutsITS loop
+      
+  }//ESD track loop
+   
+  // Post output data
+  PostData(0, fHistList);
+  PostData(1, fHistListITS);
+
+}
+//________________________________________________________________________
+void AliPWG4HighPtQAMC::Terminate(Option_t *)
+{
+  printf("->AliPWG4HighPtQATPConly::Terminate \n");
+
+  printf("-<AliPWG4HighPtQATPConly::Terminate \n");
+}
diff --git a/PWG4/JetTasks/AliPWG4HighPtQAMC.h b/PWG4/JetTasks/AliPWG4HighPtQAMC.h
new file mode 100644 (file)
index 0000000..7e2e65c
--- /dev/null
@@ -0,0 +1,97 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+//-----------------------------------------------------------------------
+// This class compares the global reconstruction with the MC information
+// Author : Marta Verweij - UU
+//-----------------------------------------------------------------------
+
+#ifndef ALIPWG4HIGHPTQAMC_H
+#define ALIPWG4HIGHPTQAMC_H
+
+#include "AliAnalysisTask.h"
+
+class TH1F;
+class TH2F;
+class TH3F;
+class TList;
+class AliESDEvent;
+class AliESDtrackCuts;
+
+class AliPWG4HighPtQAMC: public AliAnalysisTask {
+
+ public:
+  AliPWG4HighPtQAMC();
+  AliPWG4HighPtQAMC(const char *name);
+  ~AliPWG4HighPtQAMC() {;}
+
+  virtual void   ConnectInputData(Option_t *);
+  virtual void   CreateOutputObjects();
+  virtual void   Exec(Option_t *option);
+  virtual void   Terminate(Option_t *);
+
+  void SetCuts(AliESDtrackCuts* trackCuts) {fTrackCuts = trackCuts;}
+  void SetCutsITS(AliESDtrackCuts* trackCutsITS) {fTrackCutsITS = trackCutsITS;}
+
+ protected:
+
+ private:
+
+  void InitHistPointers();
+  AliPWG4HighPtQAMC(const AliPWG4HighPtQAMC&);
+  AliPWG4HighPtQAMC& operator=(const AliPWG4HighPtQAMC&);
+
+  AliESDEvent *fESD;              //! ESD object
+  AliESDtrackCuts *fTrackCuts;    // TrackCuts for global reconstructed vs MC comparison
+  AliESDtrackCuts *fTrackCutsITS; // TrackCuts including ITSrefit
+
+  
+  TH1F *fNEvent;                               //! Event counter
+  TH1F *fPtAll;                                //! Pt spectrum all charged particles
+  TH1F *fPtSel;                                //! Pt spectrum all selected charged particles by fTrackCuts
+  TH2F *fPtAllminPtMCvsPtAll;                  //! Momentum resolution (global vs MC)
+  TH3F *fPtAllminPtMCvsPtAllNPointTPC;         //! Momentum resolution vs NPointTPC
+  TH3F *fPtAllminPtMCvsPtAllDCAR;              //! Momentum resolution vs DCAR
+  TH3F *fPtAllminPtMCvsPtAllDCAZ;              //! Momentum resolution vs DCAZ
+  TH3F *fPtAllminPtMCvsPtAllPhi;               //! Momentum resolution vs Phi
+  TH3F *fPtAllminPtMCvsPtAllNPointITS;         //! Momentum resolution vs NPointITS
+  TH3F *fPtAllminPtMCvsPtAllNSigmaToVertex;    //! Momentum resolution vs NSigmaToVertes
+  TH3F *fPtAllminPtMCvsPtAllChi2C;             //! Momentum resolution vs Chi2Constrained
+  TH3F *fPtAllminPtMCvsPtAllRel1PtUncertainty; //! Momentum resolution vs relUncertainty1Pt
+
+  TH1F *fPtAllMC;     //! Pt spectrum all charged particles
+  TH1F *fPtSelMC;     //! Pt spectrum all selected charged particles by fTrackCuts
+  TH1F *fPtSelMCITS;  //! Pt spectrum all selected charged particles by fTrackCutsITS
+
+  TList *fHistList; //! List of Histograms
+  
+  TH1F *fPtSelITS;                              //! Pt spectrum all selected charged particles by fTrackCutsITS
+  TH2F *fPtITSminPtMCvsPtITS;                  //! Momentum resolution (global with ITSrefit vs MC)
+  TH3F *fPtITSminPtMCvsPtITSNPointTPC;         //! Momentum resolution vs NPointTPC 
+  TH3F *fPtITSminPtMCvsPtITSDCAR;              //! Momentum resolution vs DCAR
+  TH3F *fPtITSminPtMCvsPtITSDCAZ;              //! Momentum resolution vs DCAZ
+  TH3F *fPtITSminPtMCvsPtITSPhi;               //! Momentum resolution vs Phi
+  TH3F *fPtITSminPtMCvsPtITSNPointITS;         //! Momentum resolution vs NPointITS
+  TH3F *fPtITSminPtMCvsPtITSNSigmaToVertex;    //! Momentum resolution vs NSigmaToVertex
+  TH3F *fPtITSminPtMCvsPtITSChi2C;             //! Momentum resolution vs Chi2Constrained
+  TH3F *fPtITSminPtMCvsPtITSRel1PtUncertainty; //! Momentum resolution vs relUncertainty1Pt
+
+  TList *fHistListITS; //! List of Histograms
+
+  ClassDef(AliPWG4HighPtQAMC,1) 
+  
+};
+#endif
diff --git a/PWG4/JetTasks/AliPWG4HighPtQATPConly.cxx b/PWG4/JetTasks/AliPWG4HighPtQATPConly.cxx
new file mode 100644 (file)
index 0000000..d7dba74
--- /dev/null
@@ -0,0 +1,426 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+//-----------------------------------------------------------------------
+// This class compares the global reconstruction with the TPConly 
+// reconstruction
+// Momentum resolution is stored as function of track cuts and pt.
+// Output: Histograms for different set of cuts
+//-----------------------------------------------------------------------
+// Author : Marta Verweij - UU
+//-----------------------------------------------------------------------
+
+#include "AliPWG4HighPtQATPConly.h"
+
+#include "TH1.h"
+#include "TH2.h"
+#include "TH3.h"
+#include "TList.h"
+#include "TChain.h"
+#include "TH3F.h"
+#include "AliAnalysisManager.h"
+#include "AliESDInputHandler.h"
+#include "AliESDtrack.h"
+#include "AliESDtrackCuts.h"
+#include "AliExternalTrackParam.h"
+
+using namespace std; //required for resolving the 'cout' symbol
+
+ClassImp(AliPWG4HighPtQATPConly)
+
+AliPWG4HighPtQATPConly::AliPWG4HighPtQATPConly(): AliAnalysisTask("AliPWG4HighPtQATPConly", ""), 
+  fESD(0), 
+  fTrackCuts(0), 
+  fTrackCutsITS(0),
+  fNEvent(0), // just to avoid warnings, inititialized in InitPointers too
+  fPtAll(0),  //
+  fPtSel(0),  //
+  fPtAllminPtTPCvsPtAll(0),
+  fPtAllminPtTPCvsPtAllNPointTPC(0),
+  fPtAllminPtTPCvsPtAllDCAR(0),
+  fPtAllminPtTPCvsPtAllDCAZ(0),
+  fPtAllminPtTPCvsPtAllPhi(0),
+  fPtAllminPtTPCvsPtAllNPointITS(0),
+  fPtAllminPtTPCvsPtAllNSigmaToVertex(0),
+  fPtAllminPtTPCvsPtAllChi2C(0),
+  fPtAllminPtTPCvsPtAllRel1PtUncertainty(0),
+  fHistList(0),
+  fPtAllTPC(0),
+  fPtSelTPC(0),
+  fPtSelTPCITS(0),
+  fHistListTPC(0),
+  fPtSelITS(0),
+  fPtITSminPtTPCvsPtITS(0),
+  fPtITSminPtTPCvsPtITSNPointTPC(0),
+  fPtITSminPtTPCvsPtITSDCAR(0),
+  fPtITSminPtTPCvsPtITSDCAZ(0),
+  fPtITSminPtTPCvsPtITSPhi(0),
+  fPtITSminPtTPCvsPtITSNPointITS(0),
+  fPtITSminPtTPCvsPtITSNSigmaToVertex(0),
+  fPtITSminPtTPCvsPtITSChi2C(0),
+  fPtITSminPtTPCvsPtITSRel1PtUncertainty(0),
+  fHistListITS(0)
+{
+  InitHistPointers();
+}
+//________________________________________________________________________
+AliPWG4HighPtQATPConly::AliPWG4HighPtQATPConly(const char *name): 
+  AliAnalysisTask(name, ""), 
+  fESD(0),
+  fTrackCuts(),
+  fTrackCutsITS(),
+  fNEvent(0), // just to avoid warnings, inititialized in InitPointers too
+  fPtAll(0),  //
+  fPtSel(0),  // 
+  fPtAllminPtTPCvsPtAll(0),
+  fPtAllminPtTPCvsPtAllNPointTPC(0),
+  fPtAllminPtTPCvsPtAllDCAR(0),
+  fPtAllminPtTPCvsPtAllDCAZ(0),
+  fPtAllminPtTPCvsPtAllPhi(0),
+  fPtAllminPtTPCvsPtAllNPointITS(0),
+  fPtAllminPtTPCvsPtAllNSigmaToVertex(0),
+  fPtAllminPtTPCvsPtAllChi2C(0),
+  fPtAllminPtTPCvsPtAllRel1PtUncertainty(0),
+  fHistList(0),
+  fPtAllTPC(0),
+  fPtSelTPC(0),
+  fPtSelTPCITS(0),
+  fHistListTPC(0),
+  fPtSelITS(0),
+  fPtITSminPtTPCvsPtITS(0),
+  fPtITSminPtTPCvsPtITSNPointTPC(0),
+  fPtITSminPtTPCvsPtITSDCAR(0),
+  fPtITSminPtTPCvsPtITSDCAZ(0),
+  fPtITSminPtTPCvsPtITSPhi(0),
+  fPtITSminPtTPCvsPtITSNPointITS(0),
+  fPtITSminPtTPCvsPtITSNSigmaToVertex(0),
+  fPtITSminPtTPCvsPtITSChi2C(0),
+  fPtITSminPtTPCvsPtITSRel1PtUncertainty(0),
+  fHistListITS(0)
+{
+  //
+  // Constructor. Initialization of Inputs and Outputs
+  //
+  Info("AliPWG4HighPtQATPConly","Calling Constructor");
+  // Input slot #0 works with a TChain ESD
+  DefineInput(0, TChain::Class());
+  // Output slot #0 writes into a TList
+  DefineOutput(0, TList::Class());
+  // Output slot #1 writes into a TList
+  DefineOutput(1, TList::Class());
+  // Output slot #2 writes into a TList
+  DefineOutput(2, TList::Class());
+  InitHistPointers();
+  //  TH1::AddDirectory(kFALSE);
+  //  TH2::AddDirectory(kFALSE);
+  //  TH3::AddDirectory(kFALSE);
+  }
+
+//________________________________________________________________________
+void AliPWG4HighPtQATPConly::ConnectInputData(Option_t *) 
+{
+  // Connect ESD here
+  // Called once
+  printf(">> AliPWG4HighPtQATPConly::ConnectInputData \n");
+  TTree* tree = dynamic_cast<TTree*> (GetInputData(0));
+  if (!tree) {
+    Printf("ERROR: Could not read chain from input slot 0");
+  } else {
+    
+    AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+    
+    if (!esdH) {
+      Printf("ERROR: Could not get ESDInputHandler");
+    } else
+      fESD = esdH->GetEvent();
+  }
+}
+
+//________________________________________________________________________
+void AliPWG4HighPtQATPConly::InitHistPointers() {
+  //Initialize histograms
+  fNEvent = 0;
+  fPtAll = 0;
+  fPtSel = 0;
+  //TPC only histos compared to global tracking
+  fPtAllTPC = 0;
+  fPtSelTPC = 0;
+  fPtAllminPtTPCvsPtAll = 0;
+  fPtAllminPtTPCvsPtAllNPointTPC = 0;
+  fPtAllminPtTPCvsPtAllDCAR = 0;
+  fPtAllminPtTPCvsPtAllDCAZ = 0;
+  fPtAllminPtTPCvsPtAllPhi = 0;
+  fPtAllminPtTPCvsPtAllNPointITS = 0;
+  fPtAllminPtTPCvsPtAllNSigmaToVertex = 0;
+  fPtAllminPtTPCvsPtAllChi2C = 0;
+  fPtAllminPtTPCvsPtAllRel1PtUncertainty = 0;
+  //ITSrefit histos compared to TPConly tracks
+  fPtSelITS = 0;
+  fPtITSminPtTPCvsPtITS = 0;
+  fPtITSminPtTPCvsPtITSNPointTPC = 0;
+  fPtITSminPtTPCvsPtITSDCAR = 0;
+  fPtITSminPtTPCvsPtITSDCAZ = 0;
+  fPtITSminPtTPCvsPtITSPhi = 0;
+  fPtITSminPtTPCvsPtITSNPointITS = 0;
+  fPtITSminPtTPCvsPtITSNSigmaToVertex = 0;
+  fPtITSminPtTPCvsPtITSChi2C = 0;
+  fPtITSminPtTPCvsPtITSRel1PtUncertainty = 0;
+}
+//________________________________________________________________________
+void AliPWG4HighPtQATPConly::CreateOutputObjects() {
+  //Create output objects
+  printf(">> AliPWG4HighPtQATPConly::CreateOutputObjects \n");
+  OpenFile(0);
+  fHistList = new TList();
+  OpenFile(1);
+  fHistListTPC = new TList();
+  OpenFile(2);
+  fHistListITS = new TList();
+
+  Int_t fgkNPhiBins=18;
+  Float_t kMinPhi = 0.;
+  Float_t kMaxPhi = 2.*TMath::Pi();
+  
+  Int_t fgkNPtBins=98;
+  Float_t fgkPtMin=2.;
+  Float_t fgkPtMax=100.;
+  Int_t fgkResPtBins=40;
+
+  fNEvent = new TH1F("fNEvent","NEvent",1,-0.5,0.5);
+  fHistList->Add(fNEvent);
+  fPtAll = new TH1F("fPtAll","PtAll",fgkNPtBins, fgkPtMin, fgkPtMax);
+  fHistList->Add(fPtAll);
+  fPtSel = new TH1F("fPtSel","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax);
+  fHistList->Add(fPtSel);
+  
+  fPtAllminPtTPCvsPtAll = new TH2F("fPtAllminPtTPCvsPtAll","PtAllminPtTPCvsPtAll",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.);
+  fPtAllminPtTPCvsPtAll->SetXTitle("p_{t}^{All}");
+  fPtAllminPtTPCvsPtAll->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{TPC})/(1/p_{t}^{All})");
+  fHistList->Add(fPtAllminPtTPCvsPtAll);
+  
+  fPtAllminPtTPCvsPtAllNPointTPC = new TH3F("fPtAllminPtTPCvsPtAllNPointTPC","PtAllminPtTPCvsPtAllNPointTPC",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,160,0.5,160.5);
+  fPtAllminPtTPCvsPtAllNPointTPC->SetXTitle("p_{t}^{All}");
+  fPtAllminPtTPCvsPtAllNPointTPC->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{TPC})/(1/p_{t}^{All})");
+  fPtAllminPtTPCvsPtAllNPointTPC->SetZTitle("N_{point,TPC}");
+  fHistList->Add(fPtAllminPtTPCvsPtAllNPointTPC);
+
+  fPtAllminPtTPCvsPtAllDCAR = new TH3F("fPtAllminPtTPCvsPtAllDCAR","PtAllminPtTPCvsPtAllDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,20,-1.,1.);
+  fPtAllminPtTPCvsPtAllDCAR->SetXTitle("p_{t}^{All}");
+  fPtAllminPtTPCvsPtAllDCAR->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{TPC})/(1/p_{t}^{All})");
+  fPtAllminPtTPCvsPtAllDCAR->SetZTitle("DCA_{R}");
+  fHistList->Add(fPtAllminPtTPCvsPtAllDCAR);
+
+  fPtAllminPtTPCvsPtAllDCAZ = new TH3F("fPtAllminPtTPCvsPtAllDCAZ","PtAllminPtTPCvsPtAllDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,40,-2.,2.);
+  fPtAllminPtTPCvsPtAllDCAZ->SetXTitle("p_{t}^{All}");
+  fPtAllminPtTPCvsPtAllDCAZ->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{TPC})/(1/p_{t}^{All})");
+  fPtAllminPtTPCvsPtAllDCAZ->SetZTitle("DCA_{Z}");
+  fHistList->Add(fPtAllminPtTPCvsPtAllDCAZ);
+
+  fPtAllminPtTPCvsPtAllPhi = new TH3F("fPtAllminPtTPCvsPtAllPhi","PtAllminPtTPCvsPtAllPhi",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkNPhiBins,kMinPhi,kMaxPhi);
+  fPtAllminPtTPCvsPtAllPhi->SetXTitle("p_{t}^{All}");
+  fPtAllminPtTPCvsPtAllPhi->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{TPC})/(1/p_{t}^{All})");
+  fPtAllminPtTPCvsPtAllPhi->SetZTitle("#phi");
+  fHistList->Add(fPtAllminPtTPCvsPtAllPhi);
+
+  fPtAllminPtTPCvsPtAllNPointITS = new TH3F("fPtAllminPtTPCvsPtAllNPointITS","PtAllminPtTPCvsPtAllNPointITS",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,9,-0.5,8.5);
+  fPtAllminPtTPCvsPtAllNPointITS->SetXTitle("p_{t}^{All}");
+  fPtAllminPtTPCvsPtAllNPointITS->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{TPC})/(1/p_{t}^{All})");
+  fPtAllminPtTPCvsPtAllNPointITS->SetZTitle("N_{point,ITS}}");
+  fHistList->Add(fPtAllminPtTPCvsPtAllNPointITS);
+  
+  fPtAllminPtTPCvsPtAllNSigmaToVertex = new TH3F("fPtAllminPtTPCvsPtAllNSigmaToVertex","PtAllminPtTPCvsPtAllNSigmaToVertex",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,40,0.,8.);
+  fPtAllminPtTPCvsPtAllNSigmaToVertex->SetXTitle("p_{t}^{All}");
+  fPtAllminPtTPCvsPtAllNSigmaToVertex->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{TPC})/(1/p_{t}^{All})");
+  fPtAllminPtTPCvsPtAllNSigmaToVertex->SetZTitle("N#sigma to vertex");
+  fHistList->Add(fPtAllminPtTPCvsPtAllNSigmaToVertex);
+
+  fPtAllminPtTPCvsPtAllChi2C = new TH3F("fPtAllminPtTPCvsPtAllChi2C","PtAllminPtTPCvsPtAllChi2C",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,20,0.,10.);
+  fPtAllminPtTPCvsPtAllChi2C->SetXTitle("p_{t}^{All}");
+  fPtAllminPtTPCvsPtAllChi2C->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{TPC})/(1/p_{t}^{All})");
+  fPtAllminPtTPCvsPtAllChi2C->SetZTitle("Constrained #chi^{2}");
+  fHistList->Add(fPtAllminPtTPCvsPtAllChi2C);
+
+  fPtAllminPtTPCvsPtAllRel1PtUncertainty = new TH3F("fPtAllminPtTPCvsPtAllRel1PtUncertainty","PtAllminPtTPCvsPtAllRel1PtUncertainty",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,30,0.,0.3);
+  fPtAllminPtTPCvsPtAllRel1PtUncertainty->SetXTitle("p_{t}^{All}");
+  fPtAllminPtTPCvsPtAllRel1PtUncertainty->SetYTitle("(1/p_{t}^{All}-1/p_{t}^{TPC})/(1/p_{t}^{All})");
+  fPtAllminPtTPCvsPtAllRel1PtUncertainty->SetZTitle("Rel1PtUncertainty");
+  fHistList->Add(fPtAllminPtTPCvsPtAllRel1PtUncertainty);
+
+  //ITSrefit
+  fPtSelITS = new TH1F("fPtSelITSrefit","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax);
+  fHistListITS->Add(fPtSelITS);
+  
+  fPtITSminPtTPCvsPtITS = new TH2F("fPtITSminPtTPCvsPtITS","PtITSminPtTPCvsPtITS",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.);
+  fPtITSminPtTPCvsPtITS->SetXTitle("p_{t}^{ITS}");
+  fPtITSminPtTPCvsPtITS->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{TPC})/(1/p_{t}^{ITS})");
+  fHistListITS->Add(fPtITSminPtTPCvsPtITS);
+  
+  fPtITSminPtTPCvsPtITSNPointTPC = new TH3F("fPtITSminPtTPCvsPtITSNPointTPC","PtITSminPtTPCvsPtITSNPointTPC",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,160,0.5,160.5);
+  fPtITSminPtTPCvsPtITSNPointTPC->SetXTitle("p_{t}^{ITSrefit}");
+  fPtITSminPtTPCvsPtITSNPointTPC->SetYTitle("(1/p_{t}^{ITSrefit}-1/p_{t}^{TPC})/(1/p_{t}^{ITSrefit})");
+  fPtITSminPtTPCvsPtITSNPointTPC->SetZTitle("N_{point,TPC}");
+  fHistListITS->Add(fPtITSminPtTPCvsPtITSNPointTPC);
+    
+  fPtITSminPtTPCvsPtITSDCAR = new TH3F("fPtITSminPtTPCvsPtITSDCAR","PtITSminPtTPCvsPtITSDCAR",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,20,-1.,1.);
+  fPtITSminPtTPCvsPtITSDCAR->SetXTitle("p_{t}^{ITSrefit}");
+  fPtITSminPtTPCvsPtITSDCAR->SetYTitle("(1/p_{t}^{ITSrefit}-1/p_{t}^{TPC})/(1/p_{t}^{ITSrefit})");
+  fPtITSminPtTPCvsPtITSDCAR->SetZTitle("DCA_{R}");
+  fHistListITS->Add(fPtITSminPtTPCvsPtITSDCAR);
+  
+  fPtITSminPtTPCvsPtITSDCAZ = new TH3F("fPtITSminPtTPCvsPtITSDCAZ","PtITSminPtTPCvsPtITSDCAZ",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,40,-2.,2.);
+  fPtITSminPtTPCvsPtITSDCAZ->SetXTitle("p_{t}^{ITSrefit}");
+  fPtITSminPtTPCvsPtITSDCAZ->SetYTitle("(1/p_{t}^{ITSrefit}-1/p_{t}^{TPC})/(1/p_{t}^{ITSrefit})");
+  fPtITSminPtTPCvsPtITSDCAZ->SetZTitle("DCA_{Z}");
+  fHistListITS->Add(fPtITSminPtTPCvsPtITSDCAZ);
+  
+  fPtITSminPtTPCvsPtITSPhi = new TH3F("fPtITSminPtTPCvsPtITSPhi","PtITSminPtTPCvsPtITSPhi",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,fgkNPhiBins,kMinPhi,kMaxPhi);
+  fPtITSminPtTPCvsPtITSPhi->SetXTitle("p_{t}^{ITSrefit}");
+  fPtITSminPtTPCvsPtITSPhi->SetYTitle("(1/p_{t}^{ITSrefit}-1/p_{t}^{TPC})/(1/p_{t}^{ITSrefit})");
+  fPtITSminPtTPCvsPtITSPhi->SetZTitle("#phi");
+  fHistListITS->Add(fPtITSminPtTPCvsPtITSPhi);
+  
+  fPtITSminPtTPCvsPtITSNPointITS = new TH3F("fPtITSminPtTPCvsPtITSNPointITS","PtITSminPtTPCvsPtITSNPointITS",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,9,-0.5,8.5);
+  fPtITSminPtTPCvsPtITSNPointITS->SetXTitle("p_{t}^{ITSrefit}");
+  fPtITSminPtTPCvsPtITSNPointITS->SetYTitle("(1/p_{t}^{ITSrefit}-1/p_{t}^{TPC})/(1/p_{t}^{ITSrefit})");
+  fPtITSminPtTPCvsPtITSNPointITS->SetZTitle("N_{point,ITS}}");
+  fHistListITS->Add(fPtITSminPtTPCvsPtITSNPointITS); 
+  
+  fPtITSminPtTPCvsPtITSNSigmaToVertex = new TH3F("fPtITSminPtTPCvsPtITSNSigmaToVertex","PtITSminPtTPCvsPtITSNSigmaToVertex",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,40,0.,8.);
+  fPtITSminPtTPCvsPtITSNSigmaToVertex->SetXTitle("p_{t}^{ITS}");
+  fPtITSminPtTPCvsPtITSNSigmaToVertex->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{TPC})/(1/p_{t}^{ITS})");
+  fPtITSminPtTPCvsPtITSNSigmaToVertex->SetZTitle("N#sigma to vertex");
+  fHistListITS->Add(fPtITSminPtTPCvsPtITSNSigmaToVertex);
+
+  fPtITSminPtTPCvsPtITSChi2C = new TH3F("fPtITSminPtTPCvsPtITSChi2C","PtITSminPtTPCvsPtITSChi2C",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,20,0.,10.);
+  fPtITSminPtTPCvsPtITSChi2C->SetXTitle("p_{t}^{ITS}");
+  fPtITSminPtTPCvsPtITSChi2C->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{TPC})/(1/p_{t}^{ITS})");
+  fPtITSminPtTPCvsPtITSChi2C->SetZTitle("Constrained #chi^{2}");
+  fHistListITS->Add(fPtITSminPtTPCvsPtITSChi2C);
+
+  fPtITSminPtTPCvsPtITSRel1PtUncertainty = new TH3F("fPtITSminPtTPCvsPtITSRel1PtUncertainty","PtITSminPtTPCvsPtITSRel1PtUncertainty",fgkNPtBins, fgkPtMin,fgkPtMax,fgkResPtBins,-1.,1.,30,0.,0.3);
+  fPtITSminPtTPCvsPtITSRel1PtUncertainty->SetXTitle("p_{t}^{ITS}");
+  fPtITSminPtTPCvsPtITSRel1PtUncertainty->SetYTitle("(1/p_{t}^{ITS}-1/p_{t}^{TPC})/(1/p_{t}^{ITS})");
+  fPtITSminPtTPCvsPtITSRel1PtUncertainty->SetZTitle("Rel1PtUncertainty");
+  fHistListITS->Add(fPtITSminPtTPCvsPtITSRel1PtUncertainty);
+
+  fPtAllTPC = new TH1F("fPtAllTPC","PtAll",fgkNPtBins, fgkPtMin, fgkPtMax);
+  fHistListTPC->Add(fPtAllTPC);
+  fPtSelTPC = new TH1F("fPtSelTPC","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax);
+  fHistListTPC->Add(fPtSelTPC);
+  fPtSelTPCITS = new TH1F("fPtSelTPCITS","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax);
+  fHistListTPC->Add(fPtSelTPCITS);
+  
+}
+//________________________________________________________________________
+void AliPWG4HighPtQATPConly::Exec(Option_t *) {  
+  // Main loop
+  // Called for each event
+  printf(">> AliPWG4HighPtQATPConly::Exec \n");
+  
+ if (!fESD) {
+    Printf("ERROR: fESD not available");
+    return;
+  }
+
+  const AliESDVertex *vtx = fESD->GetPrimaryVertex();
+
+  // Need vertex cut
+  if (vtx->GetNContributors() < 2)
+    return;
+
+  printf("Vertex title %s, status %d, nCont %d\n",vtx->GetTitle(), vtx->GetStatus(), vtx->GetNContributors());
+  // Need to keep track of evts without vertex
+  fNEvent->Fill(0.);
+
+  if(!fESD->GetNumberOfTracks() || fESD->GetNumberOfTracks()<2) return;
+  Int_t nTracks = fESD->GetNumberOfTracks();
+  printf("nTracks %d\n", nTracks);
+  
+  for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
+    
+    AliESDtrack *track = fESD->GetTrack(iTrack);
+    AliExternalTrackParam *trackTPC = (AliExternalTrackParam *)track->GetTPCInnerParam();
+    AliESDtrack *trackTPConly = fTrackCuts->GetTPCOnlyTrack(fESD,iTrack); 
+    if(!track || !trackTPC || !trackTPConly) continue;
+
+    Float_t pt = track->Pt();
+    Float_t ptTPC = trackTPC->Pt();
+    Float_t phi = track->Phi();
+    Float_t dca2D, dcaZ;
+    track->GetImpactParameters(dca2D,dcaZ);
+    // Float_t dca2DTPC, dcaZTPC;
+    //track->GetImpactParametersTPC(dca2DTPC,dcaZTPC);
+    UChar_t itsMap = track->GetITSClusterMap();
+    Int_t nPointITS = 0;
+    for (Int_t i=0; i < 6; i++) {
+      if (itsMap & (1 << i))
+       nPointITS ++;
+    }
+    Float_t nSigmaToVertex = fTrackCuts->GetSigmaToVertex(track);// Calculates the number of sigma to the vertex for a track.
+    Float_t chi2C = track->GetConstrainedChi2();
+    // Float_t relUncertainty1Pt = TMath::Sqrt(extCov[14])*pt;
+    Float_t relUncertainty1Pt = TMath::Sqrt(track->GetSigma1Pt2())*pt;
+
+    fPtAll->Fill(pt);
+    fPtAllTPC->Fill(ptTPC);
+    
+    if (fTrackCuts->AcceptTrack(track)) {
+
+      fPtSel->Fill(pt);
+      
+      fPtSelTPC->Fill(ptTPC);
+      fPtAllminPtTPCvsPtAll->Fill(pt,(1./pt-1./ptTPC)/(1./pt) );
+      fPtAllminPtTPCvsPtAllNPointTPC->Fill(pt,(1./pt-1./ptTPC)/(1./pt),track->GetTPCNcls());
+      fPtAllminPtTPCvsPtAllDCAR->Fill(pt,(1./pt-1./ptTPC)/(1./pt),dca2D);
+      fPtAllminPtTPCvsPtAllDCAZ->Fill(pt,(1./pt-1./ptTPC)/(1./pt),dcaZ);
+      fPtAllminPtTPCvsPtAllPhi->Fill(pt,(1./pt-1./ptTPC)/(1./pt),phi);
+      fPtAllminPtTPCvsPtAllNPointITS->Fill(pt,(1./pt-1./ptTPC)/(1./pt),nPointITS);
+      fPtAllminPtTPCvsPtAllNSigmaToVertex->Fill(pt,(1./pt-1./ptTPC)/(1./pt),nSigmaToVertex);
+      fPtAllminPtTPCvsPtAllChi2C->Fill(pt,(1./pt-1./ptTPC)/(1./pt),chi2C);
+      fPtAllminPtTPCvsPtAllRel1PtUncertainty->Fill(pt,(1./pt-1./ptTPC)/(1./pt),relUncertainty1Pt);
+    }//fTrackCuts selection
+    
+    
+    //ITSrefit selection
+    if (fTrackCutsITS->AcceptTrack(track)) {
+      
+      fPtSelITS->Fill(pt);
+      fPtSelTPCITS->Fill(ptTPC);
+      fPtITSminPtTPCvsPtITS->Fill(pt,(1./pt-1./ptTPC)/(1./pt) );
+      fPtITSminPtTPCvsPtITSNPointTPC->Fill(pt,(1./pt-1./ptTPC)/(1./pt),track->GetTPCNcls());
+      fPtITSminPtTPCvsPtITSDCAR->Fill(pt,(1./pt-1./ptTPC)/(1./pt),dca2D);
+      fPtITSminPtTPCvsPtITSDCAZ->Fill(pt,(1./pt-1./ptTPC)/(1./pt),dcaZ);
+      fPtITSminPtTPCvsPtITSPhi->Fill(pt,(pt-ptTPC)/(pt),phi);
+      fPtITSminPtTPCvsPtITSNPointITS->Fill(pt,(pt-ptTPC)/(pt),nPointITS);
+      fPtITSminPtTPCvsPtITSNSigmaToVertex->Fill(pt,(1./pt-1./ptTPC)/(1./pt),nSigmaToVertex);
+      fPtITSminPtTPCvsPtITSChi2C->Fill(pt,(1./pt-1./ptTPC)/(1./pt),chi2C);
+      fPtITSminPtTPCvsPtITSRel1PtUncertainty->Fill(pt,(1./pt-1./ptTPC)/(1./pt),relUncertainty1Pt);
+    }//fTrackCutsITS loop
+      
+  }//ESD track loop
+   
+  // Post output data
+  PostData(0, fHistList);
+  PostData(1, fHistListTPC);
+  PostData(2, fHistListITS);
+
+}
+//________________________________________________________________________
+void AliPWG4HighPtQATPConly::Terminate(Option_t *)
+{
+  printf("->AliPWG4HighPtQATPConly::Terminate \n");
+
+  printf("-<AliPWG4HighPtQATPConly::Terminate \n");
+}
diff --git a/PWG4/JetTasks/AliPWG4HighPtQATPConly.h b/PWG4/JetTasks/AliPWG4HighPtQATPConly.h
new file mode 100644 (file)
index 0000000..0d441d6
--- /dev/null
@@ -0,0 +1,98 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+//-----------------------------------------------------------------------
+// This class compares the global reconstruction with the TPConly reconstruction
+// Author : Marta Verweij - UU
+//-----------------------------------------------------------------------
+
+#ifndef ALIPWG4HIGHPTQATPCONLY_H
+#define ALIPWG4HIGHPTQATPCONLY_H
+
+#include "AliAnalysisTask.h"
+
+class TH1F;
+class TH2F;
+class TH3F;
+class TList;
+class AliESDEvent;
+class AliESDtrackCuts;
+
+class AliPWG4HighPtQATPConly: public AliAnalysisTask {
+
+ public:
+  AliPWG4HighPtQATPConly();
+  AliPWG4HighPtQATPConly(const char *name);
+  ~AliPWG4HighPtQATPConly() {;}
+
+  virtual void   ConnectInputData(Option_t *);
+  virtual void   CreateOutputObjects();
+  virtual void   Exec(Option_t *option);
+  virtual void   Terminate(Option_t *);
+
+  void SetCuts(AliESDtrackCuts* trackCuts) {fTrackCuts = trackCuts;}
+  void SetCutsITS(AliESDtrackCuts* trackCutsITS) {fTrackCutsITS = trackCutsITS;}
+
+ protected:
+
+ private:
+
+  void InitHistPointers();
+  AliPWG4HighPtQATPConly(const AliPWG4HighPtQATPConly&);
+  AliPWG4HighPtQATPConly& operator=(const AliPWG4HighPtQATPConly&);
+
+  AliESDEvent *fESD;              //! ESD object
+  AliESDtrackCuts *fTrackCuts;    // TrackCuts for global vs TPConly comparison
+  AliESDtrackCuts *fTrackCutsITS; // TrackCuts including ITSrefit
+
+  
+  TH1F *fNEvent;                                //! Event counter
+  TH1F *fPtAll;                                 //! Pt spectrum all charged particles
+  TH1F *fPtSel;                                 //! Pt spectrum all selected charged particles by fTrackCuts
+  TH2F *fPtAllminPtTPCvsPtAll;                  //! Momentum resolution (global vs TPConly)
+  TH3F *fPtAllminPtTPCvsPtAllNPointTPC;         //! Momentum resolution vs NPointTPC
+  TH3F *fPtAllminPtTPCvsPtAllDCAR;              //! Momentum resolution vs DCAR
+  TH3F *fPtAllminPtTPCvsPtAllDCAZ;              //! Momentum resolution vs DCAZ
+  TH3F *fPtAllminPtTPCvsPtAllPhi;               //! Momentum resolution vs Phi
+  TH3F *fPtAllminPtTPCvsPtAllNPointITS;         //! Momentum resolution vs NPointITS
+  TH3F *fPtAllminPtTPCvsPtAllNSigmaToVertex;    //! Momentum resolution vs NSigmaToVertes
+  TH3F *fPtAllminPtTPCvsPtAllChi2C;             //! Momentum resolution vs Chi2Constrained
+  TH3F *fPtAllminPtTPCvsPtAllRel1PtUncertainty; //! Momentum resolution vs relUncertainty1Pt
+
+  TList *fHistList; //! List of Histograms
+  
+  TH1F *fPtAllTPC;     //! Pt spectrum all charged particles
+  TH1F *fPtSelTPC;     //! Pt spectrum all selected charged particles by fTrackCuts
+  TH1F *fPtSelTPCITS;  //! Pt spectrum all selected charged particles by fTrackCutsITS
+  TList *fHistListTPC; //! List of Histograms
+  
+  TH1F *fPtSelITS;                              //! Pt spectrum all selected charged particles by fTrackCutsITS
+  TH2F *fPtITSminPtTPCvsPtITS;                  //! Momentum resolution (global with ITSrefit vs TPConly)
+  TH3F *fPtITSminPtTPCvsPtITSNPointTPC;         //! Momentum resolution vs NPointTPC 
+  TH3F *fPtITSminPtTPCvsPtITSDCAR;              //! Momentum resolution vs DCAR
+  TH3F *fPtITSminPtTPCvsPtITSDCAZ;              //! Momentum resolution vs DCAZ
+  TH3F *fPtITSminPtTPCvsPtITSPhi;               //! Momentum resolution vs Phi
+  TH3F *fPtITSminPtTPCvsPtITSNPointITS;         //! Momentum resolution vs NPointITS
+  TH3F *fPtITSminPtTPCvsPtITSNSigmaToVertex;    //! Momentum resolution vs NSigmaToVertex
+  TH3F *fPtITSminPtTPCvsPtITSChi2C;             //! Momentum resolution vs Chi2Constrained
+  TH3F *fPtITSminPtTPCvsPtITSRel1PtUncertainty; //! Momentum resolution vs relUncertainty1Pt
+
+  TList *fHistListITS; //! List of Histograms
+
+  ClassDef(AliPWG4HighPtQATPConly,1) 
+  
+};
+#endif
diff --git a/PWG4/JetTasks/AliPWG4HighPtSpectra.cxx b/PWG4/JetTasks/AliPWG4HighPtSpectra.cxx
new file mode 100644 (file)
index 0000000..3773363
--- /dev/null
@@ -0,0 +1,301 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+//-----------------------------------------------------------------------
+// Example of task (running locally, on AliEn and CAF),
+// which provides standard way of calculating acceptance and efficiency
+// between different steps of the procedure.
+// The ouptut of the task is a AliCFContainer from which the efficiencies
+// can be calculated
+//-----------------------------------------------------------------------
+// Author : Marta Verweij - UU
+//-----------------------------------------------------------------------
+
+
+#ifndef ALIPWG4HighPtSpectra_CXX
+#define ALIPWG4HighPtSpectra_CXX
+
+#include "AliPWG4HighPtSpectra.h"
+
+#include "AliStack.h"
+#include "TParticle.h"
+#include "TH1I.h"
+#include "AliMCEvent.h"
+#include "AliMCEventHandler.h"
+#include "AliAnalysisManager.h"
+#include "AliCFContainer.h"
+#include "TChain.h"
+#include "AliESDtrack.h"
+#include "AliESDtrackCuts.h"
+#include "AliExternalTrackParam.h"
+#include "AliESDInputHandler.h"
+
+using namespace std; //required for resolving the 'cout' symbol
+
+ClassImp(AliPWG4HighPtSpectra)
+
+//__________________________________________________________________________
+AliPWG4HighPtSpectra::AliPWG4HighPtSpectra() : AliAnalysisTask("AliPWG4HighPtSpectra", ""), 
+  fReadAODData(0),
+  fCFManager(0x0),
+  fESD(0),
+  fTrackCuts(0),
+  fHistList(0),
+  fHistEventsProcessed(0x0)
+{
+  //
+  //Default ctor
+  //
+}
+//___________________________________________________________________________
+AliPWG4HighPtSpectra::AliPWG4HighPtSpectra(const Char_t* name) :
+  AliAnalysisTask(name,""),
+  fReadAODData(0),
+  fCFManager(0x0),
+  fESD(0),
+  fTrackCuts(new AliESDtrackCuts),
+  fHistList(0),
+  fHistEventsProcessed(0x0)
+{
+  //
+  // Constructor. Initialization of Inputs and Outputs
+  //
+  Info("AliPWG4HighPtSpectra","Calling Constructor");
+  // Input slot #0 works with a TChain ESD
+  DefineInput(0, TChain::Class());
+  DefineOutput(0,TList::Class());
+  DefineOutput(1,AliCFContainer::Class());
+}
+
+//___________________________________________________________________________
+AliPWG4HighPtSpectra& AliPWG4HighPtSpectra::operator=(const AliPWG4HighPtSpectra& c) 
+{
+  //
+  // Assignment operator
+  //
+  if (this!=&c) {
+    AliAnalysisTask::operator=(c) ;
+    fReadAODData = c.fReadAODData ;
+    fCFManager  = c.fCFManager;
+    fHistList = c.fHistList;
+    fHistEventsProcessed = c.fHistEventsProcessed;
+  }
+  return *this;
+}
+
+//___________________________________________________________________________
+AliPWG4HighPtSpectra::AliPWG4HighPtSpectra(const AliPWG4HighPtSpectra& c) :
+  AliAnalysisTask(c),
+  fReadAODData(c.fReadAODData),
+  fCFManager(c.fCFManager),
+  fESD(c.fESD),
+  fTrackCuts(c.fTrackCuts),
+  fHistList(c.fHistList),
+  fHistEventsProcessed(c.fHistEventsProcessed)
+{
+  //
+  // Copy Constructor
+  //
+}
+
+//___________________________________________________________________________
+AliPWG4HighPtSpectra::~AliPWG4HighPtSpectra() {
+  //
+  //destructor
+  //
+  Info("~AliPWG4HighPtSpectra","Calling Destructor");
+  if (fCFManager)           delete fCFManager ;
+  if (fHistEventsProcessed) delete fHistEventsProcessed ;
+}
+//________________________________________________________________________
+void AliPWG4HighPtSpectra::ConnectInputData(Option_t *) 
+{
+  // Connect ESD here
+  // Called once
+  printf(">> AliPWG4HighPtSpectra::ConnectInputData \n");
+
+  TTree* tree = dynamic_cast<TTree*> (GetInputData(0));
+  if (!tree) {
+    Printf("ERROR: Could not read chain from input slot 0");
+  } else {
+    
+    AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+    
+    if (!esdH) {
+      Printf("ERROR: Could not get ESDInputHandler");
+    } else
+      fESD = esdH->GetEvent();
+  }
+}
+//_________________________________________________
+void AliPWG4HighPtSpectra::Exec(Option_t *)//UserExec(Option_t *)
+{
+  //
+  // Main loop function
+  //
+  Info("Exec","") ;
+
+  if (!fESD) {
+    Printf("ERROR: fESD not available");
+    return;
+  }
+
+  // Process MC truth, therefore we receive the AliAnalysisManager and ask it for the AliMCEventHandler
+  // This handler can return the current MC event
+
+  AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
+  if (!eventHandler) {
+    Printf("ERROR: Could not retrieve MC event handler");
+    return;
+  }
+
+  AliMCEvent* mcEvent = eventHandler->MCEvent();
+  if (!mcEvent) {
+    Printf("ERROR: Could not retrieve MC event");
+    return;
+  }
+
+  Printf("MC particles: %d", mcEvent->GetNumberOfTracks());
+
+  if (!fESD) {
+    Printf("ERROR: fESD not available");
+    return;
+  }
+
+  AliStack* stack = mcEvent->Stack();                //Particles Stack
+
+  Printf("MC particles stack: %d", stack->GetNtrack());
+
+  const AliESDVertex *vtx = fESD->GetPrimaryVertex();
+
+  // Need vertex cut
+  if (vtx->GetNContributors() < 2) return;
+  double pvtx[3];
+  vtx->GetXYZ(pvtx);
+  if(TMath::Abs(pvtx[2])>10.) return;
+
+  printf("Vertex title %s, status %d, nCont %d\n",vtx->GetTitle(), vtx->GetStatus(), vtx->GetNContributors());
+  // Need to keep track of evts without vertex
+
+  Int_t nTracks = fESD->GetNumberOfTracks();
+  AliDebug(2,Form("nTracks %d", nTracks));
+  printf("nTracks %d\n", nTracks);
+
+  // AliVEvent*    fEvent = fInputEvent ;
+  
+//   if (!fEvent) {
+//     Error("UserExec","NO EVENT FOUND!");
+//     return;
+//   }
+
+//   //pass the MC evt handler to the cuts that need it 
+//   fCFManager->SetEventInfo(fMCEvent);
+
+  Double_t containerInputRec[1] ;
+  Double_t containerInputTPConly[1] ;
+  Double_t containerInputMC[1] ;
+  //Now go to rec level
+  for (Int_t iTrack = 0; iTrack<nTracks; iTrack++) 
+    {   
+      if(!fESD->GetTrack(iTrack) ) continue;
+      AliESDtrack* track = fESD->GetTrack(iTrack);
+      if(!(AliExternalTrackParam *)track->GetTPCInnerParam()) continue;
+      AliExternalTrackParam *trackTPC = (AliExternalTrackParam *)track->GetTPCInnerParam();
+      if(!track || !trackTPC) continue;
+
+      Int_t label = TMath::Abs(track->GetLabel());
+      TParticle *particle = stack->Particle(label) ;
+      if(!particle) continue;
+
+      
+      //fill the container
+      containerInputRec[0] = track->Pt();
+      containerInputTPConly[0] = trackTPC->Pt();
+      containerInputMC[0] = particle->Pt();
+      
+      if (fTrackCuts->AcceptTrack(track)) {
+       fCFManager->GetParticleContainer()->Fill(containerInputRec,kStepReconstructed);
+       fCFManager->GetParticleContainer()->Fill(containerInputTPConly,kStepReconstructedTPCOnly);
+       fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepReconstructedMC);
+      }
+      //      if (!fCFManager->CheckParticleCuts(1,track)) continue ;
+      if ( fTrackCuts->AcceptTrack(track) && !stack->IsPhysicalPrimary(label) ) {
+       fCFManager->GetParticleContainer()->Fill(containerInputRec,kStepSecondaries);
+       //      int label_mom = TMath::Abs(particle->GetFirstMother());
+       //      TParticle *mother = stack->Particle(label_mom);
+       //      if(!mother) continue;
+       //      cout << "#Daughters mom: " << mother->GetNDaughters() << "\tPDGmom: " << mother->GetPdgCode() << "\tPDGdaughter: " << particle->GetPdgCode() << endl;
+      }
+      
+    }
+
+  for(int iPart = 1; iPart<(mcEvent->GetNumberOfTracks()); iPart++)//stack->GetNprimary();
+     {
+       //       TParticle *part = stack->Particle(iPart);
+       AliMCParticle *mcPart  = (AliMCParticle*)mcEvent->GetTrack(iPart);
+       if(!mcPart) continue;
+
+       //fill the container
+       containerInputMC[0] = mcPart->Pt();
+       if (!fCFManager->CheckParticleCuts(3,mcPart)) continue ;
+       int counter;
+       Float_t trackLengthTPC = mcPart->GetTPCTrackLength(fESD->GetMagneticField(),0.1,counter,3.0);
+       //       printf("TPCTrackLength %f \t %f  \n", TPCTrackLength,fESD->GetMagneticField());
+
+       if(trackLengthTPC>80.) fCFManager->GetParticleContainer()->Fill(containerInputMC,kStepMCtrackable) ;
+
+     }
+
+   fHistEventsProcessed->Fill(0);
+   PostData(0,fHistList);
+   PostData(1,fCFManager->GetParticleContainer());
+
+}
+
+
+//___________________________________________________________________________
+void AliPWG4HighPtSpectra::Terminate(Option_t*)
+{
+  // The Terminate() function is the last function to be called during
+  // a query. It always runs on the client, it can be used to present
+  // the results graphically or save the results to file.
+
+  Info("Terminate","");
+//   AliAnalysisTaskSE::Terminate();
+
+}
+
+
+//___________________________________________________________________________
+void AliPWG4HighPtSpectra::CreateOutputObjects() {
+  //HERE ONE CAN CREATE OUTPUT OBJECTS, IN PARTICULAR IF THE OBJECT PARAMETERS DON'T NEED
+  //TO BE SET BEFORE THE EXECUTION OF THE TASK
+  //
+  Info("CreateOutputObjects","CreateOutputObjects of task %s", GetName());
+
+  OpenFile(0);
+  fHistList = new TList();
+  //slot #1
+  //  OpenFile(0);
+  fHistEventsProcessed = new TH1I("fHistEventsProcessed","",1,0,1) ;
+  fHistList->Add(fHistEventsProcessed);
+
+}
+
+#endif
diff --git a/PWG4/JetTasks/AliPWG4HighPtSpectra.h b/PWG4/JetTasks/AliPWG4HighPtSpectra.h
new file mode 100644 (file)
index 0000000..edef5f5
--- /dev/null
@@ -0,0 +1,85 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+//-----------------------------------------------------------------------
+// Author : Marta Verweij - UU
+//-----------------------------------------------------------------------
+
+#ifndef ALIPWG4HIGHPTSPECTRA_H
+#define ALIPWG4HIGHPTSPECTRA_H
+
+#include "AliAnalysisTask.h"
+#include "AliCFManager.h"
+
+class TH1I;
+class TH1D;
+class TFile ;
+class AliCFManager;
+class AliESDtrackCuts;
+class AliESDEvent;
+
+class AliPWG4HighPtSpectra : public AliAnalysisTask {
+  public:
+
+  enum {
+    kStepReconstructed    = 0,
+    kStepReconstructedTPCOnly = 1,
+    kStepSecondaries      = 2,
+    kStepMCtrackable      = 3,
+    kStepReconstructedMC    = 4
+  };
+
+  AliPWG4HighPtSpectra();
+  AliPWG4HighPtSpectra(const Char_t* name);
+  AliPWG4HighPtSpectra& operator= (const AliPWG4HighPtSpectra& c);
+  AliPWG4HighPtSpectra(const AliPWG4HighPtSpectra& c);
+  virtual ~AliPWG4HighPtSpectra();
+
+  // ANALYSIS FRAMEWORK STUFF to loop on data and fill output objects
+  virtual void   ConnectInputData(Option_t *);
+  virtual void   CreateOutputObjects();
+  virtual void   Exec(Option_t *option);
+  virtual void   Terminate(Option_t *);
+
+  // CORRECTION FRAMEWORK RELATED FUNCTIONS
+  void     SetCFManager(const AliCFManager* io) {fCFManager = io;}   // global correction manager
+  const AliCFManager * GetCFManager() const {return fCFManager;}           // get corr manager
+
+  //AliESDtrackCuts setters
+  void SetCuts(AliESDtrackCuts* trackCuts) {fTrackCuts = trackCuts;}
+
+  // Data types
+  Bool_t IsReadAODData()   const {return fReadAODData;}
+  void   SetReadAODData   (Bool_t flag=kTRUE) {fReadAODData=flag;}
+
+ protected:
+  Bool_t          fReadAODData ;   // flag for AOD/ESD input files
+  const AliCFManager   *fCFManager    ;  // pointer to the CF manager
+
+  AliESDEvent *fESD;    //! ESD object
+  //AliESDtrackCuts options. Must be setted in AliCFPWG4Task.C. They correspond with different steps in container.
+  AliESDtrackCuts *fTrackCuts; // trackCuts applied
+
+ private:
+
+  // Histograms
+  //Number of events
+  TList *fHistList;            // List of output histograms
+  TH1I  *fHistEventsProcessed; // simple histo for monitoring the number of events processed
+  
+  ClassDef(AliPWG4HighPtSpectra,1);
+};
+
+#endif
index d16c7f6..28068d3 100644 (file)
@@ -12,6 +12,9 @@
 #pragma link C++ class AliAnalysisTaskJetCorrections+;
 #pragma link C++ class AliAnalysisTaskThreeJets+;
 #pragma link C++ class AliAnaESDSpectraQA+;
+#pragma link C++ class AliPWG4HighPtQATPConly+;
+#pragma link C++ class AliPWG4HighPtQAMC+;
+#pragma link C++ class AliPWG4HighPtSpectra+;
 #pragma link C++ class AliAnalysisTaskPWG4PidDetEx+;
 #pragma link C++ class AliJetSpectrumUnfolding+;
 
index b83ce4a..9fb673f 100644 (file)
@@ -1,6 +1,6 @@
 #-*- Mode: Makefile -*-
 
-SRCS = JetTasks/AliAnalysisTaskUE.cxx  JetTasks/AliAnalysisTaskJetSpectrum.cxx JetTasks/AliAnalysisTaskJetSpectrum2.cxx JetTasks/AliAnalysisHelperJetTasks.cxx JetTasks/AliAnaESDSpectraQA.cxx JetTasks/AliAnalysisTaskPWG4PidDetEx.cxx JetTasks/AliJetSpectrumUnfolding.cxx JetTasks/AliAnalysisTaskJFSystematics.cxx JetTasks/AliAnalysisTaskJetCorrections.cxx JetTasks/AliAnalysisTaskThreeJets.cxx
+SRCS = JetTasks/AliAnalysisTaskUE.cxx  JetTasks/AliAnalysisTaskJetSpectrum.cxx JetTasks/AliAnalysisTaskJetSpectrum2.cxx JetTasks/AliAnalysisHelperJetTasks.cxx JetTasks/AliAnaESDSpectraQA.cxx JetTasks/AliAnalysisTaskPWG4PidDetEx.cxx JetTasks/AliJetSpectrumUnfolding.cxx JetTasks/AliAnalysisTaskJFSystematics.cxx JetTasks/AliAnalysisTaskJetCorrections.cxx JetTasks/AliAnalysisTaskThreeJets.cxx JetTasks/AliPWG4HighPtQATPConly.cxx JetTasks/AliPWG4HighPtQAMC.cxx JetTasks/AliPWG4HighPtSpectra.cxx 
 
 HDRS:= $(SRCS:.cxx=.h) 
 
@@ -8,10 +8,10 @@ DHDR:= PWG4JetTasksLinkDef.h
 
 EXPORT:=$(SRCS:.cxx=.h)
 
-EINCLUDE=JETAN PWG4/JetTasks
+EINCLUDE=JETAN CORRFW PWG4/JetTasks
 
 ifeq (win32gcc,$(ALICE_TARGET))
 PACKSOFLAGS:= $(SOFLAGS) -L$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET) -lSTEERBase \
-                         -lESD -lAOD -lANALYSIS -lANALYSISalice -lJETAN \
+                         -lESD -lAOD -lANALYSIS -lANALYSISalice -lJETAN -lCORRFW \
                          -L$(ROOTLIBDIR) -lEG
 endif
diff --git a/PWG4/macros/AddTaskPWG4HighPtQAMC.C b/PWG4/macros/AddTaskPWG4HighPtQAMC.C
new file mode 100644 (file)
index 0000000..249a968
--- /dev/null
@@ -0,0 +1,83 @@
+//DEFINITION OF A FEW CONSTANTS
+
+AliPWG4HighPtQAMC* AddTaskPWG4HighPtQAMC()//<some_parameters>)
+{
+  // Creates a proton analysis task and adds it to the analysis manager.
+  
+  // A. Get the pointer to the existing analysis manager via the static access method.
+  //==============================================================================
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+    Error("AddTaskPWG4HighPtQMC", "No analysis manager to connect to.");
+    return NULL;
+  }  
+
+  // B. Check the analysis type using the event handlers connected to the analysis
+  //    manager. The availability of MC handler can also be checked here.
+  //==============================================================================
+  if (!mgr->GetInputEventHandler()) {
+    ::Error("AddPWG4TaskHighPtQAMC", "This task requires an input event handler");
+    return NULL;
+  }  
+  TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
+  const char *analysisType = "ESD";//"TPC"
+
+  // C. Create the task, add it to manager.
+  //===========================================================================
+  //CREATE THE  CUTS -----------------------------------------------
+  //Use AliESDtrackCuts
+  AliESDtrackCuts *trackCuts = new AliESDtrackCuts("AliESDtrackCuts","Standard Cuts");
+  //Standard Cuts
+  trackCuts->SetAcceptKinkDaughters(kFALSE);//
+  trackCuts->SetRequireTPCRefit(kTRUE);//
+  trackCuts->SetEtaRange(-0.9,0.9);//-0.5,0.5);//
+  trackCuts->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);//
+  trackCuts->SetPtRange(0.15, 1e10);//
+  trackCuts->SetMinNClustersTPC(50);//
+  trackCuts->SetMaxChi2PerClusterTPC(3.5);//
+  //trackCuts->SetRequireITSRefit(kTRUE);
+  trackCuts->SetMaxDCAToVertexXY(2.4);
+  trackCuts->SetMaxDCAToVertexZ(3.2);
+  trackCuts->SetDCAToVertex2D(kTRUE);
+  
+  AliESDtrackCuts *trackCutsITS = new AliESDtrackCuts("AliESDtrackCuts","Standard Cuts with ITSrefit");
+  trackCutsITS->SetAcceptKinkDaughters(kFALSE);//
+  trackCutsITS->SetRequireTPCRefit(kTRUE);//
+  trackCutsITS->SetEtaRange(-0.9,0.9);//-0.5,0.5);//
+  trackCutsITS->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);//
+  trackCutsITS->SetPtRange(0.15, 1e10);//
+  trackCutsITS->SetMinNClustersTPC(50);//
+  trackCutsITS->SetMaxChi2PerClusterTPC(3.5);//
+  trackCutsITS->SetRequireITSRefit(kTRUE);
+  trackCutsITS->SetMaxDCAToVertexXY(2.4);
+  trackCutsITS->SetMaxDCAToVertexZ(3.2);
+  trackCutsITS->SetDCAToVertex2D(kTRUE); 
+
+  //Create the task
+  AliPWG4HighPtQAMC *taskPWG4QAMC = new AliPWG4HighPtQAMC("AliPWG4HighPtQAMC");
+  taskPWG4QAMC->SetCuts(trackCuts);
+  taskPWG4QAMC->SetCutsITS(trackCutsITS);
+  
+  // E. Create ONLY the output containers for the data produced by the task.
+  // Get and connect other common input/output containers via the manager as below
+  //==============================================================================
+
+  //------ input data ------
+  //  AliAnalysisDataContainer *cinput0  = mgr->GetCommonInputContainer();
+  printf("Create output containers \n");
+  TString outputfile = AliAnalysisManager::GetCommonFileName();
+  outputfile += ":PWG4_HighPtQAMC"; 
+  //char *outputfile = "outputAliPWG4HighPtQAMCTestTrain.root";
+  AliAnalysisDataContainer *cout_hist0 = mgr->CreateContainer("qa_histsMC", TList::Class(), AliAnalysisManager::kOutputContainer,outputfile);
+  AliAnalysisDataContainer *cout_hist2 = mgr->CreateContainer("qa_histsMCITS", TList::Class(), AliAnalysisManager::kOutputContainer,outputfile);  
+
+  mgr->AddTask(taskPWG4QAMC);
+  mgr->ConnectInput(taskPWG4QAMC,0,mgr->GetCommonInputContainer());
+  mgr->ConnectOutput(taskPWG4QAMC,0,cout_hist0);
+  mgr->ConnectOutput(taskPWG4QAMC,1,cout_hist2);
+
+  // Return task pointer at the end
+  return taskPWG4QAMC;
+}
diff --git a/PWG4/macros/AddTaskPWG4HighPtQATPConly.C b/PWG4/macros/AddTaskPWG4HighPtQATPConly.C
new file mode 100644 (file)
index 0000000..fd82c5a
--- /dev/null
@@ -0,0 +1,86 @@
+//DEFINITION OF A FEW CONSTANTS
+
+AliPWG4HighPtQATPConly* AddTaskPWG4HighPtQATPConly()//<some_parameters>)
+{
+  // Creates a proton analysis task and adds it to the analysis manager.
+  
+  // A. Get the pointer to the existing analysis manager via the static access method.
+  //==============================================================================
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+    Error("AddTaskPWG4HighPtSpectra", "No analysis manager to connect to.");
+    return NULL;
+  }  
+
+  // B. Check the analysis type using the event handlers connected to the analysis
+  //    manager. The availability of MC handler can also be checked here.
+  //==============================================================================
+  if (!mgr->GetInputEventHandler()) {
+    ::Error("AddTaskPWG4HighPtTPConly", "This task requires an input event handler");
+    return NULL;
+  }  
+  TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
+  const char *analysisType = "ESD";//"TPC"
+
+  // C. Create the task, add it to manager.
+  //===========================================================================
+  //CREATE THE  CUTS -----------------------------------------------
+  //Use AliESDtrackCuts
+  AliESDtrackCuts *trackCuts = new AliESDtrackCuts("AliESDtrackCuts","Standard Cuts");
+  //Standard Cuts
+  trackCuts->SetAcceptKinkDaughters(kFALSE);//
+  trackCuts->SetRequireTPCRefit(kTRUE);//
+  trackCuts->SetEtaRange(-0.9,0.9);//-0.5,0.5);//
+  trackCuts->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);//
+  trackCuts->SetPtRange(0.15, 1e10);//
+  trackCuts->SetMinNClustersTPC(50);//
+  trackCuts->SetMaxChi2PerClusterTPC(3.5);//
+  //trackCuts->SetRequireITSRefit(kTRUE);
+  trackCuts->SetMaxDCAToVertexXY(2.4);
+  trackCuts->SetMaxDCAToVertexZ(3.2);
+  trackCuts->SetDCAToVertex2D(kTRUE);
+  
+  AliESDtrackCuts *trackCutsITS = new AliESDtrackCuts("AliESDtrackCuts","Standard Cuts with ITSrefit");
+  trackCutsITS->SetAcceptKinkDaughters(kFALSE);//
+  trackCutsITS->SetRequireTPCRefit(kTRUE);//
+  trackCutsITS->SetEtaRange(-0.9,0.9);//-0.5,0.5);//
+  trackCutsITS->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);//
+  trackCutsITS->SetPtRange(0.15, 1e10);//
+  trackCutsITS->SetMinNClustersTPC(50);//
+  trackCutsITS->SetMaxChi2PerClusterTPC(3.5);//
+  trackCutsITS->SetRequireITSRefit(kTRUE);
+  trackCutsITS->SetMaxDCAToVertexXY(2.4);
+  trackCutsITS->SetMaxDCAToVertexZ(3.2);
+  trackCutsITS->SetDCAToVertex2D(kTRUE); 
+
+  //Create the task
+  AliPWG4HighPtQATPConly *taskPWG4QA = new AliPWG4HighPtQATPConly("AliPWG4HighPtQATPConly");
+  taskPWG4QA->SetCuts(trackCuts);
+  taskPWG4QA->SetCutsITS(trackCutsITS);
+  
+  // E. Create ONLY the output containers for the data produced by the task.
+  // Get and connect other common input/output containers via the manager as below
+  //==============================================================================
+
+  //------ input data ------
+  //  AliAnalysisDataContainer *cinput0  = mgr->GetCommonInputContainer();
+  TString outputfile = AliAnalysisManager::GetCommonFileName();
+  outputfile += ":PWG4_HighPtQATPConly"; 
+  //char *outputfile = "outputAliPWG4HighPtQATPConlyTestTrain.root";
+  AliAnalysisDataContainer *cout_hist0 = mgr->CreateContainer("qa_hists", TList::Class(), AliAnalysisManager::kOutputContainer,outputfile);
+  AliAnalysisDataContainer *cout_hist1 = mgr->CreateContainer("qa_histsTPC", TList::Class(), AliAnalysisManager::kOutputContainer,outputfile);
+  AliAnalysisDataContainer *cout_hist2 = mgr->CreateContainer("qa_histsITS", TList::Class(), AliAnalysisManager::kOutputContainer,outputfile);  
+
+  mgr->AddTask(taskPWG4QA);
+
+  mgr->ConnectInput(taskPWG4QA,0,mgr->GetCommonInputContainer());
+  mgr->ConnectOutput(taskPWG4QA,0,cout_hist0);
+  mgr->ConnectOutput(taskPWG4QA,1,cout_hist1);
+  mgr->ConnectOutput(taskPWG4QA,2,cout_hist2);
+
+  // Return task pointer at the end
+  return taskPWG4QA;
+}
diff --git a/PWG4/macros/AddTaskPWG4HighPtSpectra.C b/PWG4/macros/AddTaskPWG4HighPtSpectra.C
new file mode 100644 (file)
index 0000000..c1a2695
--- /dev/null
@@ -0,0 +1,135 @@
+//DEFINITION OF A FEW CONSTANTS
+const Double_t ptmin =  2.0 ;
+const Double_t ptmax =  100.0 ;
+
+const Int_t    mintrackrefsTPC = 1;
+const Int_t    mintrackrefsITS = 1;
+const Int_t    charge  = 1 ;
+
+AliPWG4HighPtSpectra* AddTaskPWG4HighPtSpectra()//<some_parameters>)
+{
+  // Creates a proton analysis task and adds it to the analysis manager.
+  
+  // A. Get the pointer to the existing analysis manager via the static access method.
+  //==============================================================================
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+    Error("AddTaskPWG4HighPtSpectra", "No analysis manager to connect to.");
+    return NULL;
+  }  
+
+  // B. Check the analysis type using the event handlers connected to the analysis
+  //    manager. The availability of MC handler can also be checked here.
+  //==============================================================================
+  if (!mgr->GetInputEventHandler()) {
+    ::Error("AddTaskHighPtSpectra", "This task requires an input event handler");
+    return NULL;
+  }  
+  TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
+  const char *analysisType = "ESD";//"TPC"
+
+  // C. Create the task, add it to manager.
+  //===========================================================================
+  //CONTAINER DEFINITION
+  Info("AliPWG4HighPtSpectra","SETUP CONTAINER");
+  //the sensitive variables, their indices
+  UInt_t ipt = 0;
+  //Setting up the container grid... 
+  UInt_t nstep = 5 ; //Steps/Modes for containers
+  Int_t kStepReconstructed = 0;
+  Int_t kStepReconstructedTPCOnly = 1;
+  Int_t kStepSecondaries = 2;
+  Int_t kStepMCtrackable = 3;
+  Int_t kStepReconstructedMC = 4;
+
+  const Int_t nvar   = 1; //number of variables on the grid:pt
+  const Int_t nbin1  = 98; //bins in pt 98 
+  //arrays for the number of bins in each dimension
+  Int_t iBin[nvar];
+  iBin[0]=nbin1;
+
+  //arrays for lower bounds :
+  Double_t *binLim1=new Double_t[nbin1+1];
+
+  //values for bin lower bounds
+  for(Int_t i=0; i<=nbin1; i++) binLim1[i]=(Double_t)ptmin + (ptmax-ptmin)/nbin1*(Double_t)i ; 
+  //one "container" for MC
+  AliCFContainer* container = new AliCFContainer("container","container for tracks",nstep,nvar,iBin);
+  //setting the bin limits
+  container -> SetBinLimits(ipt,binLim1);
+  //CREATE THE  CUTS -----------------------------------------------
+  //Use AliESDtrackCuts
+  AliESDtrackCuts *trackCuts = new AliESDtrackCuts("AliESDtrackCuts","Standard Cuts");
+  //Standard Cuts
+  trackCuts->SetAcceptKinkDaughters(kFALSE);//
+  trackCuts->SetRequireTPCRefit(kTRUE);//
+  trackCuts->SetEtaRange(-0.9,0.9);//-0.5,0.5);//
+  trackCuts->SetMaxCovDiagonalElements(2,2,0.5,0.5,2);//
+  trackCuts->SetPtRange(0.15, 1e10);//
+  trackCuts->SetMinNClustersTPC(50);//
+  trackCuts->SetMaxChi2PerClusterTPC(3.5);//
+  trackCuts->SetRequireITSRefit(kTRUE);
+  trackCuts->SetMaxDCAToVertexXY(2.4);
+  trackCuts->SetMaxDCAToVertexZ(3.2);
+  trackCuts->SetDCAToVertex2D(kTRUE);
+  // Gen-Level kinematic cuts
+  AliCFTrackKineCuts *mcKineCuts = new AliCFTrackKineCuts("mcKineCuts","MC-level kinematic cuts");
+  mcKineCuts->SetPtRange(0.15,1e10); 
+  mcKineCuts->SetRapidityRange(-0.9,0.9);//-0.5,0.5);
+  mcKineCuts->SetRequireIsCharged(kTRUE);
+
+  //Acceptance Cuts
+  AliCFAcceptanceCuts *mcAccCuts = new AliCFAcceptanceCuts("mcAccCuts","MC acceptance cuts");
+  // mcAccCuts->SetMinNHitITS(mintrackrefsITS);
+  mcAccCuts->SetMinNHitTPC(mintrackrefsTPC);
+
+  TObjArray* recList = new TObjArray(0);
+  TObjArray* recMCList = new TObjArray(0);
+  TObjArray* recTPConlyList = new TObjArray(0);
+  TObjArray* secList = new TObjArray(0) ;
+
+  printf("CREATE MC KINE CUTS\n");
+  TObjArray* mcList = new TObjArray(0) ;
+  mcList->AddLast(mcKineCuts);
+  mcList->AddLast(mcAccCuts);
+
+  //CREATE THE INTERFACE TO CORRECTION FRAMEWORK USED IN THE TASK
+  printf("CREATE INTERFACE AND CUTS\n");
+  AliCFManager* man = new AliCFManager() ;
+  man->SetParticleContainer(container);
+  man->SetParticleCutsList(0,recList);
+  man->SetParticleCutsList(1,recTPConlyList);
+  man->SetParticleCutsList(2,secList);
+  man->SetParticleCutsList(3,mcList);
+  man->SetParticleCutsList(4,recMCList);
+
+
+  AliPWG4HighPtSpectra *taskPWG4HighPtSpectra = new AliPWG4HighPtSpectra("taskPWG4HighPtSpectra");
+  taskPWG4HighPtSpectra->SetCuts(trackCuts);
+  taskPWG4HighPtSpectra->SetCFManager(man); //here is set the CF manager
+  // E. Create ONLY the output containers for the data produced by the task.
+  // Get and connect other common input/output containers via the manager as below
+  //==============================================================================
+
+  //------ input data ------
+  //  AliAnalysisDataContainer *cinput0  = mgr->GetCommonInputContainer();
+//  char *outputfile = "outputAliPWG4HighPtSpectraTestTrain.root";
+  TString outputfile = AliAnalysisManager::GetCommonFileName();
+  outputfile += ":PWG4_HighPtSpectra"; 
+  AliAnalysisDataContainer *coutput0 = mgr->CreateContainer("chist0", TList::Class(),AliAnalysisManager::kOutputContainer,outputfile);
+  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("ccontainer0", AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,outputfile);
+  mgr->AddTask(taskPWG4HighPtSpectra);
+
+  mgr->ConnectInput(taskPWG4HighPtSpectra,0,mgr->GetCommonInputContainer());
+  mgr->ConnectOutput(taskPWG4HighPtSpectra,0,coutput0);
+  mgr->ConnectOutput(taskPWG4HighPtSpectra,1,coutput1);
+
+  // Return task pointer at the end
+  return taskPWG4HighPtSpectra;
+}