From: gconesab Date: Mon, 19 May 2008 09:35:05 +0000 (+0000) Subject: New more general analysis implemention for particle identification and correlation... X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=d92b41ad81eddc6f02cae9d00d98d9029d7c544c New more general analysis implemention for particle identification and correlation studies, in calorimeters and tracking system --- diff --git a/PWG4/AliAODParticleCorrelation.cxx b/PWG4/AliAODParticleCorrelation.cxx new file mode 100644 index 00000000000..e1ef4b6d7af --- /dev/null +++ b/PWG4/AliAODParticleCorrelation.cxx @@ -0,0 +1,162 @@ +/************************************************************************** + * Copyright(c) 1998-2007, 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. * + **************************************************************************/ + +/* $Id: $ */ + +//------------------------------------------------------------------------- +// AOD class for photon and other particles storage and +// correlation studies +// Author: Yves Schutz, CERN +//------------------------------------------------------------------------- + +#include +#include "AliAODJet.h" +#include "AliAODParticleCorrelation.h" + +ClassImp(AliAODParticleCorrelation) + + +//______________________________________________________________________________ +AliAODParticleCorrelation::AliAODParticleCorrelation() : + AliVParticle(), + fMomentum(0),fPdg(-1), fTag(-1),fLabel(-1),fDetector(""),fR(0), + fRefTracks(new TRefArray()), fRefClusters(new TRefArray()), + fRefIsolationConeTracks(new TRefArray()), fRefIsolationConeClusters(new TRefArray()), + fRefBackgroundTracks(new TRefArray()), fRefBackgroundClusters(new TRefArray()), + fLeadingDetector(""), fLeading(0), fCorrJet(0), fRefJet(0) +{ + // constructor +} + +//______________________________________________________________________________ +AliAODParticleCorrelation::AliAODParticleCorrelation(Double_t px, Double_t py, Double_t pz, Double_t e): + AliVParticle(), + fMomentum(0),fPdg(-1), fTag(-1),fLabel(-1),fDetector(""),fR(0), + fRefTracks(new TRefArray()), fRefClusters(new TRefArray()), + fRefIsolationConeTracks(new TRefArray()), fRefIsolationConeClusters(new TRefArray()), + fRefBackgroundTracks(new TRefArray()), fRefBackgroundClusters(new TRefArray()), + fLeadingDetector(""), fLeading(new TLorentzVector), fCorrJet(new TLorentzVector), fRefJet(0) +{ + // constructor + fMomentum = new TLorentzVector(px, py, pz, e); +} + +//______________________________________________________________________________ +AliAODParticleCorrelation::AliAODParticleCorrelation(TLorentzVector & p): + AliVParticle(), + fMomentum(0),fPdg(-1), fTag(-1),fLabel(-1),fDetector(""),fR(0), + fRefTracks(new TRefArray()), fRefClusters(new TRefArray()), + fRefIsolationConeTracks(new TRefArray()), fRefIsolationConeClusters(new TRefArray()), + fRefBackgroundTracks(new TRefArray()), fRefBackgroundClusters(new TRefArray()), + fLeadingDetector(""), fLeading(new TLorentzVector), fCorrJet(new TLorentzVector), fRefJet(0) +{ + // constructor + fMomentum = new TLorentzVector(p); +} + + +//______________________________________________________________________________ +AliAODParticleCorrelation::~AliAODParticleCorrelation() +{ + // destructor + delete fMomentum; + delete fRefTracks; + delete fRefClusters; + delete fRefIsolationConeTracks; + delete fRefIsolationConeClusters; + delete fRefBackgroundTracks; + delete fRefBackgroundClusters; + delete fLeading; + delete fCorrJet; +} + +//______________________________________________________________________________ +AliAODParticleCorrelation::AliAODParticleCorrelation(const AliAODParticleCorrelation& part) : + AliVParticle(part), + fMomentum(0) ,fPdg(part.fPdg), fTag(part.fTag),fLabel(part.fLabel), + fDetector(part.fDetector), + fR(part.fR), + fRefTracks(), fRefClusters(), + fRefIsolationConeTracks(), fRefIsolationConeClusters(), + fRefBackgroundTracks(), fRefBackgroundClusters(), + fLeadingDetector(part.fLeadingDetector), fLeading(0), + fCorrJet(0), fRefJet(part.fRefJet) +{ + // Copy constructor + fMomentum = new TLorentzVector(*part.fMomentum); + fLeading = new TLorentzVector(*part.fLeading); + fCorrJet = new TLorentzVector(*part.fCorrJet); + fRefTracks = new TRefArray(*part.fRefTracks); + fRefClusters = new TRefArray(*part.fRefClusters); + fRefIsolationConeTracks = new TRefArray(*part.fRefIsolationConeTracks); + fRefIsolationConeClusters = new TRefArray(*part.fRefIsolationConeClusters); + fRefBackgroundTracks = new TRefArray(*part.fRefBackgroundTracks); + fRefBackgroundClusters = new TRefArray(*part.fRefBackgroundClusters); +} + +//______________________________________________________________________________ +AliAODParticleCorrelation& AliAODParticleCorrelation::operator=(const AliAODParticleCorrelation& part) +{ + // Assignment operator + if(this!=&part) { + } + + fPdg = part.fPdg; + fTag = part.fTag; + fLabel = part.fLabel; + fR = part.fR; + fRefJet = part.fRefJet ; + fDetector =part.fDetector; + fLeadingDetector =part.fLeadingDetector; + + if (fMomentum ) delete fMomentum; + if (fLeading ) delete fLeading; + if (fCorrJet ) delete fCorrJet; + if( fRefTracks ) delete fRefTracks ; + if( fRefClusters) delete fRefClusters ; + if( fRefIsolationConeTracks ) delete fRefIsolationConeTracks ; + if( fRefIsolationConeClusters) delete fRefIsolationConeClusters ; + if( fRefBackgroundTracks ) delete fRefBackgroundTracks ; + if( fRefBackgroundClusters ) delete fRefBackgroundClusters ; + + fMomentum = new TLorentzVector(*part.fMomentum); + fLeading = new TLorentzVector(*part.fLeading); + fCorrJet = new TLorentzVector(*part.fCorrJet); + fRefTracks = new TRefArray(*part.fRefTracks); + fRefClusters = new TRefArray(*part.fRefClusters); + fRefIsolationConeTracks = new TRefArray(*part.fRefIsolationConeTracks); + fRefIsolationConeClusters = new TRefArray(*part.fRefIsolationConeClusters); + fRefBackgroundTracks = new TRefArray(*part.fRefBackgroundTracks); + fRefBackgroundClusters = new TRefArray(*part.fRefBackgroundClusters); + + return *this; +} + +void AliAODParticleCorrelation::Print(Option_t* /*option*/) const +{ + // Print information of all data members + printf("Particle 4-vector:\n"); + printf(" E = %13.3f\n", E() ); + printf(" Px = %13.3f\n", Px()); + printf(" Py = %13.3f\n", Py()); + printf(" Pz = %13.3f\n", Pz()); + printf("pdg : %d\n",fPdg); + printf("tag : %d\n",fTag); + printf("R : %2.2f\n",fR); + printf("Detector : %s\n",fDetector.Data()); + + // if(fRefJet) fRefJet.Print(); + +} diff --git a/PWG4/AliAODParticleCorrelation.h b/PWG4/AliAODParticleCorrelation.h new file mode 100644 index 00000000000..dc41246300d --- /dev/null +++ b/PWG4/AliAODParticleCorrelation.h @@ -0,0 +1,138 @@ +#ifndef AliAODParticleCorrelation_H +#define AliAODParticleCorrelation_H +/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id: AliAODParticleCorrelation.h 20609 2007-08-31 11:17:02Z morsch $ */ + +//------------------------------------------------------------------------- +// Copy of AOD photon class +// Author: Yves Schutz, CERN, Gustavo Conesa, INFN +//------------------------------------------------------------------------- + +#include "TLorentzVector.h" +#include "AliVParticle.h" +//#include "AliAODVertex.h" +#include "AliAODJet.h" +#include "TString.h" + +class AliAODParticleCorrelation : public AliVParticle { + + public: + AliAODParticleCorrelation(); + AliAODParticleCorrelation(Double_t px, Double_t py, Double_t pz, Double_t e); + AliAODParticleCorrelation(TLorentzVector & p); + virtual ~AliAODParticleCorrelation(); + AliAODParticleCorrelation(const AliAODParticleCorrelation& photon); + AliAODParticleCorrelation& operator=(const AliAODParticleCorrelation& photon); + + // AliVParticle methods + virtual Double_t Px() const { return fMomentum->Px(); } + virtual Double_t Py() const { return fMomentum->Py(); } + virtual Double_t Pz() const { return fMomentum->Pz(); } + virtual Double_t Pt() const { return fMomentum->Pt(); } + virtual Double_t P() const { return fMomentum->P(); } + virtual Bool_t PxPyPz(Double_t p[3]) const { p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE; } + virtual Double_t OneOverPt() const { return 1. / fMomentum->Pt(); } + virtual Double_t Phi() const; + virtual Double_t Theta() const { return fMomentum->Theta(); } + virtual Double_t E() const { return fMomentum->E(); } + virtual Double_t M() const { return fMomentum->M(); } + virtual Double_t Eta() const { return fMomentum->Eta(); } + virtual Double_t Y() const { return fMomentum->Rapidity();} + virtual Double_t Xv() const {return -999.;} // put reasonable values here + virtual Double_t Yv() const {return -999.;} // + virtual Double_t Zv() const {return -999.;} // + virtual Bool_t XvYvZv(Double_t x[3]) const { x[0] = Xv(); x[1] = Yv(); x[2] = Zv(); return kTRUE; } + virtual void Print(Option_t* /*option*/) const; + + // + //Dummy + virtual Short_t Charge() const { return 0;} + virtual const Double_t* PID() const { return NULL;} + // + + virtual Float_t GetR() const {return fR ; } + virtual Int_t GetPdg() const {return fPdg ; } + virtual Int_t GetTag() const {return fTag ; } + virtual Int_t GetLabel() const {return fLabel ; } + virtual TString GetDetector() const {return fDetector ; } + + virtual void SetR(Float_t r) {fR = r ; } + virtual void SetPdg(Int_t pdg) {fPdg = pdg ; } + virtual void SetTag(Int_t tag) {fTag = tag ; } + virtual void SetLabel(Int_t l) {fLabel = l ; } + virtual void SetDetector(TString d) {fDetector = d ; } + + virtual TRefArray* GetRefTracks() const { return fRefTracks;} + virtual void AddTrack(TObject *tr) {fRefTracks->Add(tr);} + TObject* GetTrack(Int_t i) {return fRefTracks->At(i);} + + virtual TRefArray* GetRefClusters() const { return fRefClusters;} + virtual void AddCluster(TObject *tr) {fRefClusters->Add(tr);} + TObject* GetCluster(Int_t i) {return fRefClusters->At(i);} + + virtual TRefArray* GetRefIsolationConeTracks() const { return fRefIsolationConeTracks;} + virtual void AddIsolationConeTrack(TObject *tr) {fRefIsolationConeTracks->Add(tr);} + TObject* GetIsolationConeTrack(Int_t i) {return fRefIsolationConeTracks->At(i);} + + virtual TRefArray* GetRefIsolationConeClusters() const { return fRefIsolationConeClusters;} + virtual void AddIsolationConeCluster(TObject *tr) {fRefIsolationConeClusters->Add(tr);} + TObject* GetIsolationConeCluster(Int_t i) {return fRefIsolationConeClusters->At(i);} + + virtual TRefArray* GetRefBackgroundTracks() const { return fRefBackgroundTracks;} + virtual void AddBackgroundTrack(TObject *tr) {fRefBackgroundTracks->Add(tr);} + TObject* GetBackgroundTrack(Int_t i) {return fRefBackgroundTracks->At(i);} + + virtual TRefArray* GetRefBackgroundClusters() const { return fRefBackgroundClusters;} + virtual void AddBackgroundCluster(TObject *tr) {fRefBackgroundClusters->Add(tr);} + TObject* GetBackgroundCluster(Int_t i) {return fRefBackgroundClusters->At(i);} + + virtual void SetLeadingDetector(TString d) {fLeadingDetector = d ; } + virtual TString GetLeadingDetector() const {return fLeadingDetector ; } + + virtual TLorentzVector * GetLeading() const { return fLeading;} + virtual void SetLeading(TLorentzVector *lead) {fLeading = lead;} + + virtual TLorentzVector * GetCorrelatedJet() const { return fCorrJet;} + virtual void SetCorrelatedJet(TLorentzVector *jet) {fCorrJet = jet;} + + void SetRefJet(AliAODJet* jet) { fRefJet = jet;} + //AliAODJet* GetJet() {return ((AliAODJet*) fRefJet);} + TRef GetRefJet() {return fRefJet;} + + private: + TLorentzVector* fMomentum; // Photon 4-momentum vector + Int_t fPdg; // id of particle + Int_t fTag; // tag of particle (decay, fragment, prompt photon) + Int_t fLabel; // MC label + TString fDetector; // Detector where particle was measured. + Float_t fR ; // Isolation cone size + TRefArray* fRefTracks; // array of references to the tracks belonging to the jet / all selected hadrons + TRefArray* fRefClusters; // array of references to the clusters belonging to the jet / all selected hadrons + + TRefArray* fRefIsolationConeTracks; // array of references to the tracks belonging to the cone around direct particle candidate + TRefArray* fRefIsolationConeClusters; // array of references to the clusters belonging to the cone around direct particle candidate + + TRefArray* fRefBackgroundTracks; // array of references to the tracks for background stimation + TRefArray* fRefBackgroundClusters; // array of references to the clusters for background stimation + + TString fLeadingDetector; // Detector where leading particle was measured. + TLorentzVector* fLeading; // Leading Particle 4-momentum vector + + TLorentzVector* fCorrJet; // Jet 4-momentum vector + + TRef fRefJet; // Rerence to jet found with JETAN and correlated with particle + + ClassDef(AliAODParticleCorrelation,1); +}; + +inline Double_t AliAODParticleCorrelation::Phi() const +{ + // Return phi + Double_t phi = fMomentum->Phi(); + if (phi < 0.) phi += 2. * TMath::Pi(); + return phi; +} + +#endif diff --git a/PWG4/AliAnaBaseClass.cxx b/PWG4/AliAnaBaseClass.cxx new file mode 100644 index 00000000000..d3295836938 --- /dev/null +++ b/PWG4/AliAnaBaseClass.cxx @@ -0,0 +1,264 @@ +/************************************************************************** + * 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. * + **************************************************************************/ +/* $Id: $ */ + +/* History of cvs commits: + * + * $Log$ + * + */ +//_________________________________________________________________________ +// Base class for analysis algorithms +//-- Author: Gustavo Conesa (LNF-INFN) +//_________________________________________________________________________ + + +// --- ROOT system --- +#include +#include + +//---- AliRoot system ---- +#include "AliAODParticleCorrelation.h" +#include "AliAODCaloCluster.h" +#include "AliAODCaloCells.h" +#include "AliAODTrack.h" +#include "AliAnaBaseClass.h" +#include "AliCaloTrackReader.h" +#include "AliFidutialCut.h" +#include "AliIsolationCut.h" +#include "AliNeutralMesonSelection.h" +#include "AliLog.h" +// #include "AliStack.h" +// #include "AliHeader.h" +// #include "AliGenEventHeader.h" + +ClassImp(AliAnaBaseClass) + + +//_______________________________________________ + AliAnaBaseClass::AliAnaBaseClass() : + TObject(), fDataMC(0), fDebug(0), fCheckFidCut(0), + fCheckCaloPID(0), fRecalculateCaloPID(0), fReader(0x0), + fAODBranch(0x0), fAODCaloClusters(0x0), fAODCaloCells(0x0), + fCaloPID(0x0), fFidCut(0x0), fIC(0x0),fNMS(0x0) +{ + //Default Ctor + + fReader = new AliCaloTrackReader(); + fCaloPID = new AliCaloPID(); + fFidCut = new AliFidutialCut(); + fIC = new AliIsolationCut(); + + //Initialize parameters + InitParameters(); +} + +//___________________________________________________________ +AliAnaBaseClass::AliAnaBaseClass(const AliAnaBaseClass & abc) : + TObject(), fDataMC(abc.fDataMC), fDebug(abc.fDebug), + fCheckFidCut(abc.fCheckFidCut), fCheckCaloPID(abc. fCheckCaloPID), + fRecalculateCaloPID(abc.fRecalculateCaloPID),fReader(abc.fReader), + fAODBranch(new TClonesArray(*abc.fAODBranch)), + fAODCaloClusters(new TClonesArray(*abc.fAODCaloClusters)), + fAODCaloCells(new AliAODCaloCells(*abc.fAODCaloCells)), + fCaloPID(abc.fCaloPID), fFidCut(abc.fFidCut), fIC(abc.fIC),fNMS(abc.fNMS) +{ + // cpy ctor + +} + +//_________________________________________________________________________ +AliAnaBaseClass & AliAnaBaseClass::operator = (const AliAnaBaseClass & abc) +{ + // assignment operator + + if(this == &abc) return *this; + ((TObject *)this)->operator=(abc); + + fDataMC = abc.fDataMC; + fDebug = abc.fDebug ; + fRecalculateCaloPID = abc.fRecalculateCaloPID ; + fCheckCaloPID = abc. fCheckCaloPID ; + fCheckFidCut = abc.fCheckFidCut ; + + fReader = abc.fReader ; + + fAODBranch = new TClonesArray(*abc.fAODBranch) ; + fAODCaloClusters = new TClonesArray(*abc.fAODCaloClusters) ; + fAODCaloCells = new AliAODCaloCells(*abc.fAODCaloCells) ; + + fCaloPID = abc.fCaloPID; + fFidCut = abc.fFidCut; + fIC = abc.fIC; + fNMS = abc.fNMS; + + return *this; + +} + +//____________________________________________________________________________ +AliAnaBaseClass::~AliAnaBaseClass() +{ + // Remove all pointers except analysis output pointers. + + if(fAODBranch){ + fAODBranch->Clear() ; + delete fAODBranch ; + } + + if(fAODCaloClusters){ + fAODCaloClusters->Clear() ; + delete fAODCaloClusters ; + } + + if(fAODCaloCells){ + fAODCaloCells->Clear() ; + delete fAODCaloCells ; + } + + if(fReader) delete fReader ; + if(fCaloPID) delete fCaloPID ; + if(fFidCut) delete fFidCut ; + if(fIC) delete fIC ; + if(fNMS) delete fNMS ; + +} + +//____________________________________________________________________________ +void AliAnaBaseClass::AddAODCaloCluster(AliAODCaloCluster calo) { + //Put AOD calo cluster in the CaloClusters array + + Int_t i = fAODCaloClusters->GetEntries(); + new((*fAODCaloClusters)[i]) AliAODCaloCluster(calo); + +} + +//____________________________________________________________________________ +void AliAnaBaseClass::AddAODParticleCorrelation(AliAODParticleCorrelation pc) { + //Put AOD calo cluster in the AODParticleCorrelation array + + Int_t i = fAODBranch->GetEntries(); + new((*fAODBranch)[i]) AliAODParticleCorrelation(pc); + +} + +//___________________________________________________ +void AliAnaBaseClass::ConnectAODCaloClusters() { + //Recover the list of AODCaloClusters + + fAODCaloClusters = fReader->GetAOD()->GetCaloClusters(); + +} + +//___________________________________________________ +void AliAnaBaseClass::ConnectAODPHOSCells() { + //Recover the list of PHOS AODCaloCells + + fAODCaloCells = fReader->GetAOD()->GetPHOSCells(); + +} + +//___________________________________________________ +void AliAnaBaseClass::ConnectAODEMCALCells() { + //Recover the list of EMCAL AODCaloCells + + fAODCaloCells = fReader->GetAOD()->GetEMCALCells(); + +} + +//__________________________________________________ +TClonesArray * AliAnaBaseClass::GetAODCTS() const { + //Get list of tracks from reader + + return fReader->GetAODCTS(); + +} + +//__________________________________________________ +TClonesArray * AliAnaBaseClass::GetAODPHOS() const { + //Get list of PHOS calo clusters from reader + + return fReader->GetAODPHOS(); + +} + + +//__________________________________________________ +TClonesArray * AliAnaBaseClass::GetAODEMCAL() const { + //Get list of emcal caloclusters from reader + + return fReader->GetAODEMCAL(); + +} + +//__________________________________________________ +TNamed * AliAnaBaseClass::GetPHOSCells() const { + //Get list of PHOS calo cells (ESD or AOD) from reader + + return fReader->GetPHOSCells(); + +} + + +//__________________________________________________ +TNamed * AliAnaBaseClass::GetEMCALCells() const { + //Get list of emcal calo cells (ESD or AOD) from reader + + return fReader->GetEMCALCells(); + +} + +//__________________________________________________ +AliStack * AliAnaBaseClass::GetMCStack() const { + //Get stack pointer from reader + + return fReader->GetStack(); + +} +//__________________________________________________ +AliHeader * AliAnaBaseClass::GetMCHeader() const { + //Get header pointer from reader + + return fReader->GetHeader(); + +} + +//__________________________________________________ +AliGenEventHeader * AliAnaBaseClass::GetMCGenEventHeader() const { + //Get GenEventHeader pointer from reader + + return fReader->GetGenEventHeader(); + +} + + +void AliAnaBaseClass::InitParameters() +{ + //Initialize the parameters of the analysis. + fDataMC = kFALSE; + fDebug = -1; + fCheckCaloPID = kTRUE ; + fCheckFidCut = kFALSE ; + fRecalculateCaloPID = kFALSE ; + fMinPt = 2. ; //Min pt in particle analysis + fMaxPt = 300. ; //Max pt in particle analysis + + fCaloPID = new AliCaloPID ; + fFidCut = new AliFidutialCut; + fIC = new AliIsolationCut; + fNMS = new AliNeutralMesonSelection; + +} + diff --git a/PWG4/AliAnaBaseClass.h b/PWG4/AliAnaBaseClass.h new file mode 100644 index 00000000000..c0a4bdafa7d --- /dev/null +++ b/PWG4/AliAnaBaseClass.h @@ -0,0 +1,150 @@ +#ifndef AliAnaBaseClass_H +#define AliAnaBaseClass_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +/* History of cvs commits: + * + * $Log$ + + * + */ + +//_________________________________________________________________________ +// Base class for analysis algorithms +//-- Author: Gustavo Conesa (INFN-LNF) + +//ROOT +class TClonesArray ; +#include +#include + +//Analysis +class AliAODCaloCluster; +class AliAODCaloCells; +#include "AliAODParticleCorrelation.h" +class AliCaloTrackReader ; +#include "AliCaloPID.h" +class AliFidutialCut ; +class AliIsolationCut ; +class AliNeutralMesonSelection ; +/* class AliStack ; */ +/* class AliHeader ; */ +/* class AliGenEventHeader ; */ +#include "AliStack.h" +#include "AliHeader.h" +#include "AliGenEventHeader.h" + +class AliAnaBaseClass : public TObject { + + public: + + AliAnaBaseClass() ; // default ctor + AliAnaBaseClass(const AliAnaBaseClass & g) ; // cpy ctor + AliAnaBaseClass & operator = (const AliAnaBaseClass & g) ;//cpy assignment + virtual ~AliAnaBaseClass() ; //virtual dtor + + virtual void AddAODCaloCluster(AliAODCaloCluster calo) ; + virtual void AddAODParticleCorrelation(AliAODParticleCorrelation pc) ; + + virtual void ConnectAODCaloClusters(); + virtual void ConnectAODPHOSCells(); + virtual void ConnectAODEMCALCells(); + + virtual TList * GetCreateOutputObjects(){ return (new TList) ;} + + virtual void Print(const Option_t * opt) const {;} + + virtual void MakeAnalysisFillAOD() {;} + + virtual void MakeAnalysisFillHistograms() {;} + + virtual Int_t GetDebug() const { return fDebug ; } + virtual void SetDebug(Int_t d) { fDebug = d ; } + + virtual AliCaloTrackReader * GetReader() const {return fReader ; } + virtual void SetReader(AliCaloTrackReader * reader) { fReader = reader ; } + + virtual TClonesArray* GetAODBranch() const {return fAODBranch ;} + virtual TClonesArray* GetAODCaloClusters() const {return fAODCaloClusters ;} + virtual AliAODCaloCells* GetAODCaloCells() const {return fAODCaloCells ;} + + virtual TClonesArray* GetAODCTS() const ; + virtual TClonesArray* GetAODEMCAL() const ; + virtual TClonesArray* GetAODPHOS() const ; + + virtual TNamed * GetEMCALCells() const ; + virtual TNamed * GetPHOSCells() const ; + + virtual AliStack * GetMCStack() const ; + virtual AliHeader* GetMCHeader() const ; + virtual AliGenEventHeader* GetMCGenEventHeader() const ; + + virtual void SetAODBranch(TClonesArray * tca) { fAODBranch = tca ; } + + virtual AliCaloPID * GetCaloPID() const {return fCaloPID ;} + virtual void SetCaloPID(AliCaloPID * pid) { fCaloPID = pid ;} + + virtual AliFidutialCut * GetFidutialCut() const {return fFidCut ;} + virtual void SetFidutialCut(AliFidutialCut * fc) { fFidCut = fc ;} + + virtual AliIsolationCut * GetIsolationCut() const {return fIC ;} + virtual void SetIsolationCut(AliIsolationCut * fc) { fIC = fc ;} + + virtual AliNeutralMesonSelection * GetNeutralMesonSelection() const {return fNMS ;} + virtual void SetNeutralMesonSelection(AliNeutralMesonSelection * nms) { fNMS = nms ;} + + virtual Bool_t IsDataMC() const {return fDataMC ; } + virtual void SwitchOnDataMC() {fDataMC = kTRUE ; } + virtual void SwitchOffDataMC() {fDataMC = kFALSE ; } + + virtual Bool_t IsFidutialCutOn() {return fCheckFidCut ; } + virtual void SwitchOnFidutialCut() { fCheckFidCut = kTRUE;} + virtual void SwitchOffFidutialCut() { fCheckFidCut = kFALSE;} + + virtual Bool_t IsCaloPIDOn() {return fCheckCaloPID ; } + virtual void SwitchOnCaloPID() { fCheckCaloPID = kTRUE;} + virtual void SwitchOffCaloPID() { fCheckCaloPID = kFALSE;} + + virtual Bool_t IsCaloPIDRecalculationOn() {return fRecalculateCaloPID ; } + virtual void SwitchOnCaloPIDRecalculation() { fRecalculateCaloPID = kTRUE;} + virtual void SwitchOffCaloPIDRecalculation() { fRecalculateCaloPID = kFALSE;} + + virtual Float_t GetMaxPt() const {return fMaxPt ; } + virtual Float_t GetMinPt() const {return fMinPt ; } + virtual void SetMaxPt(Float_t pt) {fMaxPt = pt ; } + virtual void SetMinPt(Float_t pt) {fMinPt = pt ; } + void SetPtCutRange(Double_t ptmin, Double_t ptmax) + { fMaxPt=ptmax; fMinPt=ptmin;} + + virtual void InitParameters() ; + + private: + + Bool_t fDataMC ; //Flag to access MC data when using ESD or AOD + Int_t fDebug ; // Debug level + Bool_t fCheckFidCut ; // Do analysis for clusters in defined region + Bool_t fCheckCaloPID ; // Do analysis for calorimeters + Bool_t fRecalculateCaloPID ; //Recalculate PID or use PID weights in calorimeters + Float_t fMinPt ; //Maximum pt of (trigger) particles in the analysis + Float_t fMaxPt ; //Minimum pt of (trigger) particles in the analysis + + AliCaloTrackReader * fReader; //Acces to ESD/AOD/MC data + + TClonesArray* fAODBranch ; //! selected particles branch + TClonesArray* fAODCaloClusters ; //! selected PHOS/EMCAL CaloClusters + AliAODCaloCells * fAODCaloCells ; //! selected PHOS/EMCAL CaloCells + AliCaloPID * fCaloPID; // PID calculation + AliFidutialCut * fFidCut; //Acceptance cuts + AliIsolationCut * fIC; // Isolation cut + AliNeutralMesonSelection * fNMS; // Neutral Meson Selection + + ClassDef(AliAnaBaseClass,1) + } ; + + +#endif //AliAnaBaseClass_H + + + diff --git a/PWG4/AliAnaExample.cxx b/PWG4/AliAnaExample.cxx new file mode 100644 index 00000000000..659171a52ec --- /dev/null +++ b/PWG4/AliAnaExample.cxx @@ -0,0 +1,355 @@ +/************************************************************************** + * 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. * + **************************************************************************/ +/* $Id: $ */ + +/* History of cvs commits: + * + * $Log$ + * + */ + +//_________________________________________________________________________ +// Example class on how to read AODCaloClusters, ESDCaloCells and AODTracks and how +// fill AODs with PWG4PartCorr analysis frame +// Select the type of detector information that you want to analyze, CTS (tracking), PHOS or EMCAL +// Select the PID custer type of the calorimeters +// Set min momentum of the cluster/tracks +// Fill few histograms +// +//-- Author: Gustavo Conesa (INFN-LNF) +//-- Author: Gustavo Conesa (LNF-INFN) +//_________________________________________________________________________ + + +// --- ROOT system --- +#include "Riostream.h" +#include "TClonesArray.h" +#include "TH2F.h" +#include "TParticle.h" + +//---- AliRoot system ---- +#include "AliAnaExample.h" +#include "AliCaloTrackReader.h" +#include "AliLog.h" +#include "AliAODParticleCorrelation.h" +#include "AliESDCaloCells.h" + +ClassImp(AliAnaExample) + +//____________________________________________________________________________ + AliAnaExample::AliAnaExample() : + AliAnaBaseClass(),fPdg(0), fDetector(""), fhPt(0),fhPhi(0),fhEta(0), fh2Pt(0),fh2Phi(0),fh2Eta(0), + fhNCells(0), fhAmplitude(0) +{ + //Default Ctor + + //Initialize parameters + InitParameters(); +} + +//____________________________________________________________________________ +AliAnaExample::AliAnaExample(const AliAnaExample & ex) : + AliAnaBaseClass(ex), fPdg(ex.fPdg), fDetector(ex.fDetector), fhPt(ex.fhPt), fhPhi(ex.fhPhi),fhEta(ex.fhEta), + fh2Pt(ex.fh2Pt), fh2Phi(ex.fh2Phi),fh2Eta(ex.fh2Eta), fhNCells(ex.fhNCells), fhAmplitude(ex.fhAmplitude) +{ + // cpy ctor + +} + +//_________________________________________________________________________ +AliAnaExample & AliAnaExample::operator = (const AliAnaExample & ex) +{ + // assignment operator + + if(this == &ex)return *this; + ((AliAnaBaseClass *)this)->operator=(ex); + + fPdg = ex.fPdg; + fDetector = ex.fDetector; + fhPt = ex.fhPt; + fhPhi = ex.fhPhi; + fhEta = ex.fhEta; + fh2Pt = ex.fh2Pt; + fh2Phi = ex.fh2Phi; + fh2Eta = ex.fh2Eta; + fhNCells = ex.fhNCells; + fhAmplitude = ex.fhAmplitude; + + return *this; + +} + +// //____________________________________________________________________________ +// AliAnaExample::~AliAnaExample() +// { +// // Remove all pointers except analysis output pointers. + +// ; +// } + + +//________________________________________________________________________ +TList * AliAnaExample::GetCreateOutputObjects() +{ + // Create histograms to be saved in output file and + // store them in fOutputContainer + + AliDebug(1,"Init parton histograms"); + + TList * outputContainer = new TList() ; + outputContainer->SetName("ExampleHistos") ; + + fhPt = new TH1F ("hPt","p_T distribution", 100,0,100); + fhPt->SetXTitle("p_{T} (GeV/c)"); + outputContainer->Add(fhPt); + + fhPhi = new TH1F ("hPhi","#phi distribution", 100,0,TMath::TwoPi()); + fhPhi->SetXTitle("#phi (rad)"); + outputContainer->Add(fhPhi); + + fhEta = new TH1F ("hEta","#eta distribution", 100,-2,2); + fhEta->SetXTitle("#eta "); + outputContainer->Add(fhEta); + + //Calo cells + fhNCells = new TH1F ("hNCells","# cells per event", 100,0,1000); + fhNCells->SetXTitle("n cells"); + outputContainer->Add(fhNCells); + + fhAmplitude = new TH1F ("hAmplitude","#eta distribution", 100,0,1000); + fhAmplitude->SetXTitle("Amplitude "); + outputContainer->Add(fhAmplitude); + + if(IsDataMC()){ + fh2Pt = new TH2F ("h2Pt","p_T distribution, reconstructed vs generated", 100,0,100,100,0,100); + fh2Pt->SetXTitle("p_{T,rec} (GeV/c)"); + fh2Pt->SetYTitle("p_{T,gen} (GeV/c)"); + outputContainer->Add(fh2Pt); + + fh2Phi = new TH2F ("h2Phi","#phi distribution, reconstructed vs generated", 100,0,TMath::TwoPi(), 100,0,TMath::TwoPi()); + fh2Phi->SetXTitle("#phi_{rec} (rad)"); + fh2Phi->SetYTitle("#phi_{gen} (rad)"); + outputContainer->Add(fh2Phi); + + fh2Eta = new TH2F ("h2Eta","#eta distribution, reconstructed vs generated", 100,-1,1,100,-1,1); + fh2Eta->SetXTitle("#eta_{rec} "); + fh2Eta->SetYTitle("#eta_{gen} "); + outputContainer->Add(fh2Eta); + } + return outputContainer; +} + + //__________________________________________________ +void AliAnaExample::InitParameters() +{ + //Initialize the parameters of the analysis. + + fPdg = 22; //Keep photons + fDetector = "PHOS"; + +} + +//__________________________________________________________________ +void AliAnaExample::Print(const Option_t * opt) const +{ + //Print some relevant parameters set for the analysis + if(! opt) + return; + + printf("Min Pt = %3.2f\n", GetMinPt()); + printf("Max Pt = %3.2f\n", GetMaxPt()); + printf("Select clusters with pdg %d \n",fPdg); + printf("Select detector %s \n",fDetector.Data()); + +} + +//__________________________________________________________________ +void AliAnaExample::MakeAnalysisFillAOD() +{ + //Do analysis and fill aods + + //Some prints + if(GetDebug() > 0){ + if(fDetector == "EMCAL" && GetAODEMCAL())printf("Example : in emcal aod entries %d\n", GetAODEMCAL()->GetEntries()); + if(fDetector == "CTS" && GetAODCTS())printf("Example : in CTS aod entries %d\n", GetAODCTS()->GetEntries()); + if(fDetector == "PHOS" && GetAODPHOS())printf("Example : in PHOS aod entries %d\n", GetAODPHOS()->GetEntries()); + } + + //Get List with tracks or clusters + TClonesArray * partList = new TClonesArray; + if(fDetector == "CTS") partList = GetAODCTS(); + else if(fDetector == "EMCAL") partList = GetAODEMCAL(); + else if(fDetector == "PHOS") partList = GetAODPHOS(); + + if(!partList || partList->GetEntries() == 0) return ; + + //Fill AODCaloClusters and AODParticleCorrelation with PHOS/EMCAL aods + if(fDetector == "EMCAL" || fDetector == "PHOS"){ + + //WORK WITH CALOCLUSTERS + ConnectAODCaloClusters(); //Do Only when filling AODCaloClusters + if(GetDebug() > 0) printf("Example: in calo clusters aod entries %d\n", GetAODCaloClusters()->GetEntries()); + + //Get vertex for photon momentum calculation + Double_t v[3] ; //vertex ; + GetReader()->GetVertex(v); + + TLorentzVector mom ; + for(Int_t i = 0; i < partList->GetEntries(); i++){ + + AliAODCaloCluster * calo = dynamic_cast (partList->At(i)); + + //Fill AODCaloClusters + AddAODCaloCluster(AliAODCaloCluster(*(calo))); + + //Fill AODParticleCorrelation after some selection + calo->GetMomentum(mom,v); + Int_t pdg = 0; + if(IsCaloPIDOn()){ + Double_t pid[13]; + calo->GetPID(pid); + pdg = GetCaloPID()->GetPdg(fDetector,pid,mom.E()); + //pdg = GetCaloPID()->GetPdg(fDetector,mom, + // calo->GetM02(), calo->GetM02(), + // calo->GetDispersion(), 0, 0); + } + + //Acceptance selection + Bool_t in = kTRUE; + if(IsFidutialCutOn()) + in = GetFidutialCut()->IsInFidutialCut(mom,fDetector) ; + + if(GetDebug() > 1) printf("cluster pt %2.2f, phi %2.2f, pdg %d, in fidutial cut %d \n",mom.Pt(), mom.Phi(), pdg, in); + + //Select cluster if momentum, pdg and acceptance are good + if(mom.Pt() > GetMinPt() && pdg ==fPdg && in) { + AliAODParticleCorrelation ph = AliAODParticleCorrelation(mom); + //AddAODParticleCorrelation(AliAODParticleCorrelation(mom)); + ph.SetLabel(calo->GetLabel(0)); + ph.SetPdg(pdg); + ph.SetDetector(fDetector); + AddAODParticleCorrelation(ph); + }//selection + }//loop + + //WORK WITH ESDCALOCELLS + //Don't connect in the same analysis PHOS and EMCAL cells. + AliESDCaloCells * esdCell = new AliESDCaloCells ; + if(fDetector == "PHOS") { + ConnectAODPHOSCells(); //Do Only when filling AODCaloCells + esdCell = (AliESDCaloCells *) GetPHOSCells(); + } + else { + ConnectAODEMCALCells(); //Do Only when filling AODCaloCells + esdCell = (AliESDCaloCells *) GetEMCALCells(); + } + //Some prints + if(GetDebug() > 0 && esdCell ) + printf("Example : in ESD %s cell entries %d\n", fDetector.Data(), esdCell->GetNumberOfCells()); + + //Fill AODCells in file + Int_t ncells = esdCell->GetNumberOfCells() ; + GetAODCaloCells()->CreateContainer(ncells); + + GetAODCaloCells()->SetType((AliAODCaloCells::AODCells_t) esdCell->GetType()); + + for (Int_t iCell = 0; iCell < ncells; iCell++) { + if(GetDebug() > 2) printf("cell : amp %f, absId %d, time %f\n", esdCell->GetAmplitude(iCell), esdCell->GetCellNumber(iCell), esdCell->GetTime(iCell)); + + GetAODCaloCells()->SetCell(iCell,esdCell->GetCellNumber(iCell),esdCell->GetAmplitude(iCell)); + } + GetAODCaloCells()->Sort(); + + }//cluster-cell analysis + else if(fDetector == "CTS"){ //Track analysis + //Fill AODParticleCorrelation with CTS aods + TVector3 p3; + for(Int_t i = 0; i < GetAODCTS()->GetEntries(); i++){ + + AliAODTrack * track = dynamic_cast (GetAODCTS()->At(i)); + + //Fill AODParticleCorrelation after some selection + Double_t mom[3] = {track->Px(),track->Py(),track->Pz()}; + p3.SetXYZ(mom[0],mom[1],mom[2]); + + //Acceptance selection + Bool_t in = GetFidutialCut()->IsInFidutialCut(mom,"CTS") ; + if(GetDebug() > 1) printf("track pt %2.2f, phi %2.2f, in fidutial cut %d\n",p3.Pt(), p3.Phi(), in); + if(p3.Pt() > GetMinPt() && in) { + AliAODParticleCorrelation tr = AliAODParticleCorrelation(mom[0],mom[1],mom[2],0); + //AddAODParticleCorrelation(AliAODParticleCorrelation(mom)); + tr.SetDetector("CTS"); + AddAODParticleCorrelation(tr); + + }//selection + }//loop + }//CTS analysis + + if(GetDebug() > 0) { + printf("Example: final aod calocluster entries %d\n", GetAODCaloClusters()->GetEntries()); + printf("Example: final aod branch entries %d\n", GetAODBranch()->GetEntries()); + printf("Example: final aod cell entries %d\n", GetAODCaloCells()->GetNumberOfCells()); + } +} + +//__________________________________________________________________ +void AliAnaExample::MakeAnalysisFillHistograms() +{ + //Do analysis and fill histograms + + //Loop on stored AODParticles + Int_t naod = GetAODBranch()->GetEntriesFast(); + if(GetDebug() > 0) printf("histo aod branch entries %d\n", naod); + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODParticleCorrelation* ph = dynamic_cast (GetAODBranch()->At(iaod)); + + fhPt->Fill(ph->Pt()); + fhPhi->Fill(ph->Phi()); + fhEta->Fill(ph->Eta()); + + if(IsDataMC()){ + //Play with the MC stack if available + AliStack * stack = GetMCStack() ; + + if(ph->GetLabel() < 0 || !stack) { + printf("*** bad label or no stack ***: label %d \n", ph->GetLabel()); + continue; + } + + if(ph->GetLabel() >= stack->GetNtrack()) { + printf("*** large label ***: label %d, n tracks %d \n", ph->GetLabel(), stack->GetNtrack()); + continue ; + } + + TParticle * mom = GetMCStack()->Particle(ph->GetLabel()); + + fh2Pt->Fill(ph->Pt(), mom->Pt()); + fh2Phi->Fill(ph->Phi(), mom->Phi()); + fh2Eta->Fill(ph->Eta(), mom->Eta()); + }//Work with stack also + }// aod branch loop + + // CaloCells histograms + if(GetAODCaloCells()){ + + Int_t ncells = GetAODCaloCells()->GetNumberOfCells(); + fhNCells->Fill(ncells) ; + + for (Int_t iCell = 0; iCell < ncells; iCell++) { + if(GetDebug() > 2) printf("cell : amp %f, absId %d \n", GetAODCaloCells()->GetAmplitude(iCell), GetAODCaloCells()->GetCellNumber(iCell)); + fhAmplitude->Fill(GetAODCaloCells()->GetAmplitude(iCell)); + } + }//calo cells container exist +} diff --git a/PWG4/AliAnaExample.h b/PWG4/AliAnaExample.h new file mode 100644 index 00000000000..668756ae567 --- /dev/null +++ b/PWG4/AliAnaExample.h @@ -0,0 +1,75 @@ +#ifndef ALIANAEXAMPLE_H +#define ALIANAEXAMPLE_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +/* History of cvs commits: + * + * $Log$ + + * + */ + +//_________________________________________________________________________ +// Example class on how to read AODCaloClusters, ESDCaloCells and AODTracks and how +// fill AODs with PWG4PartCorr analysis frame +// Select the type of detector information that you want to analyze, CTS (tracking), PHOS or EMCAL +// Select the PID custer type of the calorimeters +// Set min momentum of the cluster/tracks +// Fill few histograms +// +//-- Author: Gustavo Conesa (INFN-LNF) + +class TH1F ; + +#include "AliAnaBaseClass.h" + +class AliAnaExample : public AliAnaBaseClass { + + public: + + AliAnaExample() ; // default ctor + AliAnaExample(const AliAnaExample & g) ; // cpy ctor + AliAnaExample & operator = (const AliAnaExample & g) ;//cpy assignment + virtual ~AliAnaExample() {;} //virtual dtor + + TList * GetCreateOutputObjects(); + + void InitParameters(); + + void Print(const Option_t * opt) const; + + void MakeAnalysisFillAOD() ; + + void MakeAnalysisFillHistograms() ; + + Int_t GetPdg() const {return fPdg ;} + void SetPdg( Int_t pdg ) {fPdg = pdg; } + + TString GetDetector() const {return fDetector ;} + void SetDetector( TString calo ) {fDetector = calo; } + + private: + + Int_t fPdg ; //identified particle id + TString fDetector ; //detector selection + //Histograms + //CaloClusters + TH1F * fhPt; //pT distribution + TH1F * fhPhi; //phi distribution + TH1F * fhEta; //phi distribution + TH2F * fh2Pt; //pT distribution, reconstructed vs generated + TH2F * fh2Phi; //phi distribution, reconstructed vs generated + TH2F * fh2Eta; //phi distribution, reconstructed vs generated + //Calo Cells + TH1F * fhNCells; //Number of towers/crystals with signal + TH1F * fhAmplitude; //Amplitude measured in towers/crystals + ClassDef(AliAnaExample,1) + } ; + + +#endif //ALIANAEXAMPLE_H + + + diff --git a/PWG4/AliAnaMaker.cxx b/PWG4/AliAnaMaker.cxx new file mode 100644 index 00000000000..ad2dc21c9fc --- /dev/null +++ b/PWG4/AliAnaMaker.cxx @@ -0,0 +1,215 @@ +/************************************************************************** + * 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. * + **************************************************************************/ +/* $Id: $ */ + +/* History of cvs commits: + * + * $Log$ + * + * + */ + +//_________________________________________________________________________ +// Base class for particle (gamma, hadron) identification and correlation analysis +// It is called by the task class AliAnalysisGammaTask and it connects the input +// (ESD/AOD/MonteCarlo) +// got with AliCaloTrackReader (produces TClonesArrays of TParticles), with the +// analysis classes that derive from AliAnaBaseClass +// +//*-- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- + + //#include + //#include + +//---- AliRoot system ---- +#include "AliAnaBaseClass.h" +#include "AliAnaMaker.h" +#include "AliCaloTrackReader.h" +// #include "AliAODCaloCluster.h" +// #include "AliAODTrack.h" +// #include "AliAODEvent.h" +#include "Riostream.h" +#include "AliLog.h" + +ClassImp(AliAnaMaker) + + +//____________________________________________________________________________ + AliAnaMaker::AliAnaMaker() : + TObject(), + fOutputContainer(new TList ), fAnalysisContainer(new TList ), + fMakeHisto(0), fMakeAOD(0), fAnaDebug(0), + fReader(0x0), fAODBranch(0x0), fAODBranchName("") +{ + //Default Ctor + if(fAnaDebug > 1 ) printf("*** Analysis Maker Constructor *** \n"); + + //Initialize parameters, pointers and histograms + if(!fReader) + fReader = new AliCaloTrackReader(); + + InitParameters(); +} + +//____________________________________________________________________________ +AliAnaMaker::AliAnaMaker(const AliAnaMaker & g) : + TObject(), + fOutputContainer(g. fOutputContainer), fAnalysisContainer(g.fAnalysisContainer), + fMakeHisto(g.fMakeHisto), fMakeAOD(fMakeAOD), fAnaDebug(g. fAnaDebug), + fReader(g.fReader), fAODBranch(g.fAODBranch), + fAODBranchName(g.fAODBranchName) +{ + // cpy ctor + +} + +//_________________________________________________________________________ +AliAnaMaker & AliAnaMaker::operator = (const AliAnaMaker & source) +{ + // assignment operator + + if(this == &source)return *this; + ((TObject *)this)->operator=(source); + + fOutputContainer = source.fOutputContainer ; + fAnalysisContainer = source.fAnalysisContainer ; + fAnaDebug = source.fAnaDebug; + fMakeHisto = source.fMakeHisto; + fMakeAOD = source.fMakeAOD; + + fAODBranchName = source.fAODBranchName; + fAODBranch = source.fAODBranch; + + fReader = source.fReader ; + + return *this; + +} + +//____________________________________________________________________________ +AliAnaMaker::~AliAnaMaker() +{ + // Remove all pointers. + + // Protection added in case of NULL pointers (MG) + if (fOutputContainer) { + fOutputContainer->Clear(); + delete fOutputContainer ; + } + + if (fAnalysisContainer) { + fAnalysisContainer->Clear(); + delete fAnalysisContainer ; + } + + if (fReader) delete fReader ; + + if (fAODBranch) { + fAODBranch->Clear(); + delete fAODBranch ; + } + +} + +//________________________________________________________________________ +void AliAnaMaker::Init() +{ + //Init container histograms and other common variables + + if(fMakeHisto){// Analysis with histograms as output on + + //Fill container with appropriate histograms + + if(!fAnalysisContainer || fAnalysisContainer->GetEntries()==0) + AliFatal("Analysis job list not initailized"); + + for(Int_t iana = 0; iana < fAnalysisContainer->GetEntries(); iana++){ + TList * templist = ((AliAnaBaseClass *) fAnalysisContainer->At(iana)) -> GetCreateOutputObjects(); + + for(Int_t i = 0; i < templist->GetEntries(); i++) + fOutputContainer->Add(templist->At(i)) ; + + } + }// Analysis with histograms as output on +} + +//____________________________________________________________________________ +void AliAnaMaker::InitParameters() +{ + + //Init data members + fMakeHisto = kTRUE; + fMakeAOD = kTRUE; + fAnaDebug = 0; // No debugging info displayed by default + fAODBranchName = "Photons" ; + +} + +//__________________________________________________________________ +void AliAnaMaker::Print(const Option_t * opt) const +{ + + //Print some relevant parameters set for the analysis + if(! opt) + return; + + printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ; + printf("Debug level = %d\n", fAnaDebug) ; + printf("New AOD branch = %s\n", fAODBranchName.Data()) ; + printf("Produce Histo = %d\n", fMakeHisto) ; + printf("Produce AOD = %d\n", fMakeAOD) ; + +} + + +//____________________________________________________________________________ +Bool_t AliAnaMaker::ProcessEvent(Int_t iEntry){ + //Process analysis for this event + + if(fMakeHisto && !fOutputContainer) + AliFatal("Histograms not initialized"); + + if(fAnaDebug >= 0 ) printf("*** Event %d *** \n",iEntry); + + //Each event needs an empty branch + fAODBranch->Delete(); + + //Tell the reader to fill the data in the 3 detector lists + fReader->FillInputEvent(); + + //Loop on analysis algorithms + Int_t nana = fAnalysisContainer->GetEntries() ; + for(Int_t iana = 0; iana < nana; iana++){ + + AliAnaBaseClass * ana = ((AliAnaBaseClass *) fAnalysisContainer->At(iana)) ; + + //Set reader and aod branch for each analysis + ana->SetReader(fReader); + ana->SetAODBranch(fAODBranch); + + //Make analysis, create aods in aod branch or AODCaloClusters + if(fMakeAOD) ana->MakeAnalysisFillAOD() ; + //Make further analysis with aod branch and fill histograms + if(fMakeHisto) ana->MakeAnalysisFillHistograms() ; + + } + + fReader->ResetLists(); + + return kTRUE ; + +} diff --git a/PWG4/AliAnaMaker.h b/PWG4/AliAnaMaker.h new file mode 100644 index 00000000000..5a7bbb27186 --- /dev/null +++ b/PWG4/AliAnaMaker.h @@ -0,0 +1,103 @@ +#ifndef ALIANAMAKER_H +#define ALIANAMAKER_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +/* History of cvs commits: + * + * $Log$ + * + */ + +//_________________________________________________________________________ +// Base class for gamma and particle correlation analysis +// It is called by the task class AliAnalysisGammaTask and it connects the input (ESD/AOD/MonteCarlo) +// got with AliCaloTrackReader (produces TClonesArrays of TParticles), with the analysis classes +// that derive from AliAnaBaseClass +// +//*-- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- +/* #include */ +#include +#include +/* #include */ +#include +/* #include */ +#include + +// --- AliRoot system --- +#include +#include "AliAnaBaseClass.h" +/* #include "AliAODCaloCluster.h" */ +/* #include "AliAODTrack.h" */ +/* #include "AliAODPhoton.h" */ + +class AliCaloTrackReader ; + +// --- AliRoot +class AliAnaMaker : public TObject { + +public: + + AliAnaMaker() ; // default ctor + AliAnaMaker(const AliAnaMaker & g) ; // cpy ctor + AliAnaMaker & operator = (const AliAnaMaker & g) ;//cpy assignment + virtual ~AliAnaMaker() ; //virtual dtor + + //Setter and getters + TList * GetOutputContainer() const {return fOutputContainer ; } + + Int_t GetAnaDebug() const { return fAnaDebug ; } + void SetAnaDebug(Int_t d) { fAnaDebug = d ; } + + Bool_t AreHistogramsMade() const { return fMakeHisto ; } + void SwitchOnHistogramsMaker() { fMakeHisto = kTRUE ; } + void SwitchOffHistogramsMaker() { fMakeHisto = kFALSE ; } + + Bool_t AreAODsMade() const { return fMakeAOD ; } + void SwitchOnAODsMaker() { fMakeAOD = kTRUE ; } + void SwitchOffAODsMaker() { fMakeAOD = kFALSE ; } + + void SetAODBranch(TClonesArray* aodbranch) {fAODBranch = aodbranch;} + + void AddAnalysis(TObject* ana, Int_t n) {if ( fAnalysisContainer) fAnalysisContainer->AddAt(ana,n); + else AliFatal("AnalysisContainer not initialized");} + + TString GetAODBranchName() const {return fAODBranchName;} + void SetAODBranchName(TString name) {fAODBranchName = name ;} + + AliCaloTrackReader * GetReader() const {return fReader ; } + void SetReader(AliCaloTrackReader * reader) { fReader = reader ; } + + //Others + void Init(); + void InitParameters(); + + void Print(const Option_t * opt) const; + + Bool_t ProcessEvent(Int_t iEntry) ; + + private: + + //General Data members + + TList * fOutputContainer ; // output histograms container + TList * fAnalysisContainer ; // List with analysis pointers + Bool_t fMakeHisto ; // If true makes final analysis with histograms as output + Bool_t fMakeAOD ; // If true makes analysis generating AODs + Int_t fAnaDebug; // Debugging info. + + AliCaloTrackReader * fReader ; // Pointer to reader + TClonesArray* fAODBranch ; //! selected particles branch + TString fAODBranchName; // New AOD branch name + + ClassDef(AliAnaMaker,1) +} ; + + +#endif //ALIANAMAKER_H + + + diff --git a/PWG4/AliAnaParticleHadronCorrelation.cxx b/PWG4/AliAnaParticleHadronCorrelation.cxx new file mode 100644 index 00000000000..41775e7e460 --- /dev/null +++ b/PWG4/AliAnaParticleHadronCorrelation.cxx @@ -0,0 +1,531 @@ +/************************************************************************** + * 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. * + **************************************************************************/ +/* $Id: $ */ + +/* History of cvs commits: + * + * $Log$ + * + * + */ + +//_________________________________________________________________________ +// Class for the analysis of particle - hadron correlations +// Particle (for example direct gamma) must be found in a previous analysis +//-- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- +#include "Riostream.h" +#include "TH2F.h" + +//---- ANALYSIS system ---- +#include "AliLog.h" +#include "AliNeutralMesonSelection.h" +#include "AliAnaParticleHadronCorrelation.h" +#include "AliCaloTrackReader.h" + +ClassImp(AliAnaParticleHadronCorrelation) + + +//____________________________________________________________________________ + AliAnaParticleHadronCorrelation::AliAnaParticleHadronCorrelation() : + AliAnaBaseClass(), + fDeltaPhiMaxCut(0.), fDeltaPhiMinCut(0.), + fhPhiCharged(0), fhPhiNeutral(0), fhEtaCharged(0), fhEtaNeutral(0), + fhDeltaPhiCharged(0), fhDeltaPhiNeutral(0), + fhDeltaEtaCharged(0), fhDeltaEtaNeutral(0), + fhDeltaPhiChargedPt(0), fhDeltaPhiNeutralPt(0), + fhPtImbalanceNeutral(0), fhPtImbalanceCharged(0) +{ + //Default Ctor + + //Initialize parameters + InitParameters(); +} + +//____________________________________________________________________________ +AliAnaParticleHadronCorrelation::AliAnaParticleHadronCorrelation(const AliAnaParticleHadronCorrelation & g) : + AliAnaBaseClass(g), + fDeltaPhiMaxCut(g.fDeltaPhiMaxCut), fDeltaPhiMinCut(g.fDeltaPhiMinCut), + fhPhiCharged(g.fhPhiCharged), fhPhiNeutral(g.fhPhiNeutral), + fhEtaCharged(g.fhEtaCharged), fhEtaNeutral(g.fhEtaNeutral), + fhDeltaPhiCharged(g.fhDeltaPhiCharged), + fhDeltaPhiNeutral(g.fhDeltaPhiNeutral), + fhDeltaEtaCharged(g.fhDeltaEtaCharged), + fhDeltaEtaNeutral(g.fhDeltaEtaNeutral), + fhDeltaPhiChargedPt(g.fhDeltaPhiChargedPt), + fhDeltaPhiNeutralPt(g.fhDeltaPhiNeutralPt), + fhPtImbalanceNeutral(g.fhPtImbalanceNeutral), + fhPtImbalanceCharged(g.fhPtImbalanceCharged) +{ + // cpy ctor + +} + +//_________________________________________________________________________ +AliAnaParticleHadronCorrelation & AliAnaParticleHadronCorrelation::operator = (const AliAnaParticleHadronCorrelation & source) +{ + // assignment operator + + if(this == &source)return *this; + ((AliAnaBaseClass *)this)->operator=(source); + + fDeltaPhiMaxCut = source.fDeltaPhiMaxCut ; + fDeltaPhiMinCut = source.fDeltaPhiMinCut ; + + fhPhiCharged = source.fhPhiCharged ; fhPhiNeutral = source.fhPhiNeutral ; + fhEtaCharged = source.fhEtaCharged ; fhEtaNeutral = source.fhEtaNeutral ; + fhDeltaPhiCharged = source.fhDeltaPhiCharged ; + fhDeltaPhiNeutral = source.fhDeltaPhiNeutral ; + fhDeltaPhiNeutralPt = source.fhDeltaPhiNeutralPt ; + fhDeltaEtaCharged = source.fhDeltaEtaCharged ; + fhDeltaEtaNeutral = source.fhDeltaEtaNeutral ; + fhDeltaPhiChargedPt = source.fhDeltaPhiChargedPt ; + + fhPtImbalanceNeutral = source.fhPtImbalanceNeutral ; + fhPtImbalanceCharged = source.fhPtImbalanceCharged ; + + return *this; + +} + +//________________________________________________________________________ +TList * AliAnaParticleHadronCorrelation::GetCreateOutputObjects() +{ + + // Create histograms to be saved in output file and + // store them in fOutputContainer + TList * outputContainer = new TList() ; + outputContainer->SetName("CorrelationHistos") ; + + //Correlation with charged hadrons + if(GetReader()->IsCTSSwitchedOn()) { + fhPhiCharged = new TH2F + ("PhiCharged","#phi_{h^{#pm}} vs p_{T trigger}", + 120,0,120,120,0,7); + fhPhiCharged->SetYTitle("#phi_{h^{#pm}} (rad)"); + fhPhiCharged->SetXTitle("p_{T trigger} (GeV/c)"); + + fhEtaCharged = new TH2F + ("EtaCharged","#eta_{h^{#pm}} vs p_{T trigger}", + 120,0,120,120,-1,1); + fhEtaCharged->SetYTitle("#eta_{h^{#pm}} (rad)"); + fhEtaCharged->SetXTitle("p_{T trigger} (GeV/c)"); + + fhDeltaPhiCharged = new TH2F + ("DeltaPhiCharged","#phi_{trigger} - #phi_{h^{#pm}} vs p_{T trigger}", + 200,0,120,200,0,6.4); + fhDeltaPhiCharged->SetYTitle("#Delta #phi"); + fhDeltaPhiCharged->SetXTitle("p_{T trigger} (GeV/c)"); + + fhDeltaPhiChargedPt = new TH2F + ("DeltaPhiChargedPt","#phi_{trigger} - #phi_{#p^{#pm}i} vs p_{T h^{#pm}}", + 200,0,120,200,0,6.4); + fhDeltaPhiChargedPt->SetYTitle("#Delta #phi"); + fhDeltaPhiChargedPt->SetXTitle("p_{T h^{#pm}} (GeV/c)"); + + fhDeltaEtaCharged = new TH2F + ("DeltaEtaCharged","#eta_{trigger} - #eta_{h^{#pm}} vs p_{T trigger}", + 200,0,120,200,-2,2); + fhDeltaEtaCharged->SetYTitle("#Delta #eta"); + fhDeltaEtaCharged->SetXTitle("p_{T trigger} (GeV/c)"); + + fhPtImbalanceCharged = + new TH2F("CorrelationCharged","z_{trigger h^{#pm}} = p_{T h^{#pm}} / p_{T trigger}", + 240,0.,120.,1000,0.,1.2); + fhPtImbalanceCharged->SetYTitle("z_{trigger h^{#pm}}"); + fhPtImbalanceCharged->SetXTitle("p_{T trigger}"); + + outputContainer->Add(fhPhiCharged) ; + outputContainer->Add(fhEtaCharged) ; + outputContainer->Add(fhDeltaPhiCharged) ; + outputContainer->Add(fhDeltaEtaCharged) ; + outputContainer->Add(fhPtImbalanceCharged) ; + outputContainer->Add(fhDeltaPhiChargedPt) ; + } //Correlation with charged hadrons + + //Correlation with neutral hadrons + if(GetReader()->IsEMCALSwitchedOn() || GetReader()->IsPHOSSwitchedOn()){ + + fhPhiNeutral = new TH2F + ("PhiNeutral","#phi_{#pi^{0}} vs p_{T trigger}", + 120,0,120,120,0,7); + fhPhiNeutral->SetYTitle("#phi_{#pi^{0}} (rad)"); + fhPhiNeutral->SetXTitle("p_{T trigger} (GeV/c)"); + + fhEtaNeutral = new TH2F + ("EtaNeutral","#eta_{#pi^{0}} vs p_{T trigger}", + 120,0,120,120,-1,1); + fhEtaNeutral->SetYTitle("#eta_{#pi^{0}} (rad)"); + fhEtaNeutral->SetXTitle("p_{T trigger} (GeV/c)"); + + fhDeltaPhiNeutral = new TH2F + ("DeltaPhiNeutral","#phi_{trigger} - #phi_{#pi^{0}} vs p_{T trigger}", + 200,0,120,200,0,6.4); + fhDeltaPhiNeutral->SetYTitle("#Delta #phi"); + fhDeltaPhiNeutral->SetXTitle("p_{T trigger} (GeV/c)"); + + fhDeltaPhiNeutralPt = new TH2F + ("DeltaPhiNeutralPt","#phi_{trigger} - #phi_{#pi^{0}} vs p_{T #pi^{0}}}", + 200,0,120,200,0,6.4); + fhDeltaPhiNeutralPt->SetYTitle("#Delta #phi"); + fhDeltaPhiNeutralPt->SetXTitle("p_{T trigger} (GeV/c)"); + + fhDeltaEtaNeutral = new TH2F + ("DeltaEtaNeutral","#eta_{trigger} - #eta_{#pi^{0}} vs p_{T trigger}", + 200,0,120,200,-2,2); + fhDeltaEtaNeutral->SetYTitle("#Delta #eta"); + fhDeltaEtaNeutral->SetXTitle("p_{T trigger} (GeV/c)"); + + fhPtImbalanceNeutral = + new TH2F("CorrelationNeutral","z_{trigger #pi} = p_{T #pi^{0}} / p_{T trigger}", + 240,0.,120.,1000,0.,1.2); + fhPtImbalanceNeutral->SetYTitle("z_{trigger #pi^{0}}"); + fhPtImbalanceNeutral->SetXTitle("p_{T trigger}"); + + outputContainer->Add(fhPhiNeutral) ; + outputContainer->Add(fhEtaNeutral) ; + outputContainer->Add(fhDeltaPhiNeutral) ; + outputContainer->Add(fhDeltaEtaNeutral) ; + outputContainer->Add(fhPtImbalanceNeutral) ; + + + //Keep neutral meson selection histograms if requiered + //Setting done in AliNeutralMesonSelection + if(GetNeutralMesonSelection()){ + TList * nmsHistos = GetNeutralMesonSelection()->GetCreateOutputObjects() ; + cout<<"NMSHistos "<< nmsHistos<AreNeutralMesonSelectionHistosKept()) + for(Int_t i = 0; i < nmsHistos->GetEntries(); i++) outputContainer->Add(nmsHistos->At(i)) ; + } + + }//Correlation with neutral hadrons + + return outputContainer; +} + + //____________________________________________________________________________ +void AliAnaParticleHadronCorrelation::InitParameters() +{ + + //Initialize the parameters of the analysis. + + SetPtCutRange(2,300); + fDeltaPhiMinCut = 1.5 ; + fDeltaPhiMaxCut = 4.5 ; + +} + +//__________________________________________________________________ +void AliAnaParticleHadronCorrelation::Print(const Option_t * opt) const +{ + + //Print some relevant parameters set for the analysis + if(! opt) + return; + + Info("*** Print *** ", "%s %s", GetName(), GetTitle() ) ; + printf("pT Hadron > %2.2f\n", GetMinPt()) ; + printf("pT Hadron < %2.2f\n", GetMaxPt()) ; + printf("Phi trigger particle-Hadron < %3.2f\n", fDeltaPhiMaxCut) ; + printf("Phi trigger particle-Hadron > %3.2f\n", fDeltaPhiMinCut) ; + + +} + +//____________________________________________________________________________ +void AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() +{ + //Particle-Hadron Correlation Analysis, fill AODs + if(GetDebug() > 1){ + printf("Begin hadron correlation analysis, fill AODs \n"); + printf("In particle branch aod entries %d\n", GetAODBranch()->GetEntries()); + printf("In CTS aod entries %d\n", GetAODCTS()->GetEntries()); + printf("In EMCAL aod entries %d\n", GetAODEMCAL()->GetEntries()); + printf("In PHOS aod entries %d\n", GetAODPHOS()->GetEntries()); + } + + //Loop on stored AOD particles, trigger + Int_t naod = GetAODBranch()->GetEntriesFast(); + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODParticleCorrelation* particle = dynamic_cast (GetAODBranch()->At(iaod)); + //Make correlation with charged hadrons + if(GetReader()->IsCTSSwitchedOn() ) + MakeChargedCorrelation(particle, (TSeqCollection*)GetAODCTS(),kFALSE); + + //Make correlation with neutral pions + //Trigger particle in PHOS, correlation with EMCAL + if(particle->GetDetector()=="PHOS" && GetReader()->IsEMCALSwitchedOn() && GetAODEMCAL()->GetEntries() > 0) + MakeNeutralCorrelation(particle,(TSeqCollection*)GetAODEMCAL(),kFALSE); + //Trigger particle in EMCAL, correlation with PHOS + else if(particle->GetDetector()=="EMCAL" && GetReader()->IsPHOSSwitchedOn() && GetAODPHOS()->GetEntries() > 0) + MakeNeutralCorrelation(particle,(TSeqCollection*)GetAODPHOS(),kFALSE); + //Trigger particle in CTS, correlation with PHOS, EMCAL and CTS + else if(particle->GetDetector()=="CTS" ){ + if(GetReader()->IsPHOSSwitchedOn() && GetAODPHOS()->GetEntries() > 0) + MakeNeutralCorrelation(particle,(TSeqCollection*)GetAODPHOS(),kFALSE); + if(GetReader()->IsEMCALSwitchedOn() && GetAODEMCAL()->GetEntries() > 0) + MakeNeutralCorrelation(particle,(TSeqCollection*)GetAODEMCAL(),kFALSE); + } + + }//Aod branch loop + + if(GetDebug() > 1) printf("End hadron correlation analysis, fill AODs \n"); + +} + +//____________________________________________________________________________ +void AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() +{ + //Particle-Hadron Correlation Analysis, fill AODs + if(GetDebug() > 1){ + printf("Begin hadron correlation analysis, fill histograms \n"); + printf("In particle branch aod entries %d\n", GetAODBranch()->GetEntries()); + } + + //Loop on stored AOD particles + Int_t naod = GetAODBranch()->GetEntriesFast(); + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODParticleCorrelation* particle = dynamic_cast (GetAODBranch()->At(iaod)); + + if(GetDebug() > 1){ + printf("Particle %d, In Track Refs entries %d\n", iaod, (particle->GetRefTracks())->GetEntries()); + printf("Particle %d, In Cluster Refs entries %d\n",iaod, (particle->GetRefClusters())->GetEntries()); + } + + //Make correlation with charged hadrons + if((particle->GetRefTracks())->GetEntries() > 0) + MakeChargedCorrelation(particle, (TSeqCollection*) (particle->GetRefTracks()),kTRUE); + + //Make correlation with neutral pions + if((particle->GetRefClusters())->GetEntries() > 0) + MakeNeutralCorrelation(particle, (TSeqCollection*) (particle->GetRefClusters()), kTRUE); + + }//Aod branch loop + + if(GetDebug() > 1) printf("End hadron correlation analysis, fill histograms \n"); + +} + +//____________________________________________________________________________ +void AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODParticleCorrelation *aodParticle, TSeqCollection* pl, const Bool_t bFillHisto) +{ + // Charged Hadron Correlation Analysis + if(GetDebug() > 1)printf("Make trigger particle - charged hadron correlation \n"); + + Double_t ptTrig = aodParticle->Pt(); + Double_t phiTrig = aodParticle->Phi(); + Double_t pt = -100.; + Double_t rat = -100.; + Double_t phi = -100. ; + Double_t eta = -100. ; + Double_t p[3]; + + //Track loop, select tracks with good pt, phi and fill AODs or histograms + for(Int_t ipr = 0;ipr < pl->GetEntries() ; ipr ++ ){ + AliAODTrack * track = dynamic_cast(pl->At(ipr)) ; + track->GetPxPyPz(p) ; + TLorentzVector mom(p[0],p[1],p[2],0); + pt = mom.Pt(); + eta = mom.Eta(); + phi = mom.Phi() ; + if(phi<0) phi+=TMath::TwoPi(); + rat = pt/ptTrig ; + + if(IsFidutialCutOn()){ + Bool_t in = GetFidutialCut()->IsInFidutialCut(mom,"CTS") ; + if(! in ) continue ; + } + + //Select only hadrons in pt range + if(pt < GetMinPt() || pt > GetMaxPt()) continue ; + + if(GetDebug() > 2) + printf("charged hadron: pt %f, phi %f, phi trigger %f. Cuts: delta phi min %2.2f, max%2.2f, pT min %2.2f \n", + pt,phi,phiTrig,fDeltaPhiMinCut, fDeltaPhiMaxCut, GetMinPt()); + + if(bFillHisto){ + // Fill Histograms + fhEtaCharged->Fill(ptTrig,eta); + fhPhiCharged->Fill(ptTrig,phi); + fhDeltaEtaCharged->Fill(ptTrig,aodParticle->Eta()-eta); + fhDeltaPhiCharged->Fill(ptTrig,phiTrig-phi); + fhDeltaPhiChargedPt->Fill(pt,phiTrig-phi); + //Selection within angular range + if(((phiTrig-phi)> fDeltaPhiMinCut) && ((phiTrig-phi) 2 ) printf("Selected charge for momentum imbalance: pt %2.2f, phi %2.2f, eta %2.2f ",pt,phi,eta); + fhPtImbalanceCharged->Fill(ptTrig,rat); + } + } + else{ + //Fill AODs + aodParticle->AddTrack(track); + + }//aod particle loop + }// track loop + +} +//____________________________________________________________________________ +void AliAnaParticleHadronCorrelation::MakeNeutralCorrelation(AliAODParticleCorrelation * aodParticle,TSeqCollection* pl, const Bool_t bFillHisto) +{ + // Neutral Pion Correlation Analysis + if(GetDebug() > 1) printf("Make trigger particle - neutral hadron correlation \n"); + + Double_t pt = -100.; + Double_t rat = -100.; + Double_t phi = -100. ; + Double_t eta = -100. ; + Double_t ptTrig = aodParticle->Pt(); + Double_t phiTrig = aodParticle->Phi(); + Double_t etaTrig = aodParticle->Eta(); + + TLorentzVector gammai; + TLorentzVector gammaj; + + Double_t vertex[] = {0,0,0}; + + if(!GetReader()->GetDataType()== AliCaloTrackReader::kMC) GetReader()->GetVertex(vertex); + + //Cluster loop, select pairs with good pt, phi and fill AODs or histograms + for(Int_t iclus = 0;iclus < pl->GetEntries() ; iclus ++ ){ + AliAODCaloCluster * calo = dynamic_cast< AliAODCaloCluster *>(pl->At(iclus)) ; + if(!bFillHisto){ + + //Cluster selection, not charged, with photon or pi0 id and in fidutial cut + Int_t pdg=0; + if(!SelectCluster(calo, vertex, gammai, pdg)) continue ; + + if(GetDebug() > 2) + printf("neutral cluster: pt %f, phi %f, phi trigger %f. Cuts: delta phi min %2.2f, max%2.2f, pT min %2.2f \n", + gammai.Pt(),gammai.Phi(),phiTrig,fDeltaPhiMinCut, fDeltaPhiMaxCut, GetMinPt()); + + //2 gamma overlapped, found with PID + if(pdg == AliCaloPID::kPi0){ + + //Select only hadrons in pt range + if(gammai.Pt() < GetMinPt() || gammai.Pt() > GetMaxPt()) continue ; + + aodParticle->AddCluster(calo); + if(GetDebug() > 2) printf("Correlated with selected pi0 (pid): pt %f, phi %f",gammai.Pt(),gammai.Phi()); + + }// pdg = 111 + + //Make invariant mass analysis + else if(pdg == AliCaloPID::kPhoton){ + //Search the photon companion in case it comes from a Pi0 decay + //Apply several cuts to select the good pair; + for(Int_t jclus = iclus+1; jclus < pl->GetEntries() ; jclus ++ ){ + AliAODCaloCluster * calo2 = dynamic_cast< AliAODCaloCluster *>(pl->At(jclus)) ; + + //Cluster selection, not charged with photon or pi0 id and in fidutial cut + Int_t pdgj=0; + if(!SelectCluster(calo2,vertex, gammaj, pdgj)) continue ; + + if(pdgj == AliCaloPID::kPhoton ){ + + if((gammai+gammaj).Pt() < GetMinPt() || (gammai+gammaj).Pt() > GetMaxPt()) continue ; + + //Select good pair (aperture and invariant mass) + if(GetNeutralMesonSelection()->SelectPair(gammai, gammaj)){ + + if(GetDebug() > 2 ) printf("Neutral Hadron Correlation: AOD Selected gamma pair: pt %2.2f, phi %2.2f, eta %2.2f, M %2.3f", + (gammai+gammaj).Pt(),(gammai+gammaj).Phi(),(gammai+gammaj).Eta(), (gammai+gammaj).M()); + Int_t labels[]={calo->GetLabel(0),calo2->GetLabel(0)}; + Float_t pid[]={0,0,0,0,0,0,1,0,0,0,0,0,0};//Pi0 weight 1 + Float_t pos[]={(gammai+gammaj).X(), (gammai+gammaj).Y(), (gammai+gammaj).Z()}; + + AliAODCaloCluster *caloCluster = new AliAODCaloCluster(0,2,labels,(gammai+gammaj).E(), pos, pid,calo->GetType(),0); + aodParticle->AddCluster(caloCluster); + }//Pair selected + }//if pair of gammas + }//2nd loop + }// if pdg = 22 + }// Fill AODs + else{ //Fill histograms + + calo->GetMomentum(gammai,vertex);//Assume that come from vertex in straight line + pt = gammai.Pt(); + + if(pt < GetMinPt() || pt > GetMaxPt()) continue ; + + rat = pt/ptTrig ; + phi = gammai.Phi() ; + eta = gammai.Eta() ; + + if(GetDebug() > 2 ) printf("Neutral Hadron Correlation: Histograms selected gamma pair: pt %2.2f, phi %2.2f, eta %2.2f",pt,phi,eta); + + fhEtaNeutral->Fill(ptTrig,eta); + fhPhiNeutral->Fill(ptTrig,phi); + fhDeltaEtaNeutral->Fill(ptTrig,etaTrig-eta); + fhDeltaPhiNeutral->Fill(ptTrig,phiTrig-phi); + fhDeltaPhiNeutralPt->Fill(pt,phiTrig-phi); + //Selection within angular range + if(((phiTrig-phi)> fDeltaPhiMinCut) && ((phiTrig-phi) 2 ) printf("Selected neutral for momentum imbalance: pt %2.2f, phi %2.2f, eta %2.2f ",pt,phi,eta); + fhPtImbalanceNeutral->Fill(ptTrig,rat); + } + }//Fill histograms + }//1st loop + +} + +//____________________________________________________________________________ +Bool_t AliAnaParticleHadronCorrelation::SelectCluster(AliAODCaloCluster * calo, Double_t *vertex, TLorentzVector & mom, Int_t & pdg){ + //Select cluster depending on its pid and acceptance selections + + //Skip matched clusters with tracks + if(calo->GetNTracksMatched() > 0) { + return kFALSE;} + + //Check PID + calo->GetMomentum(mom,vertex);//Assume that come from vertex in straight line + pdg = AliCaloPID::kPhoton; + if(IsCaloPIDOn()){ + //Get most probable PID, 2 options check PID weights (in MC this option is mandatory) + //or redo PID, recommended option for EMCal. + TString detector = ""; + if(calo->IsPHOSCluster()) detector= "PHOS"; + else if(calo->IsEMCALCluster()) detector= "EMCAL"; + + if(!IsCaloPIDRecalculationOn() || GetReader()->GetDataType() == AliCaloTrackReader::kMC ) + pdg = GetCaloPID()->GetPdg(detector,calo->PID(),mom.E());//PID with weights + else + pdg = GetCaloPID()->GetPdg(detector,mom,calo->GetM02(),0,0,0,0);//PID recalculated + + if(GetDebug() > 1) printf("PDG of identified particle %d\n",pdg); + + //If it does not pass pid, skip + if(pdg != AliCaloPID::kPhoton || pdg != AliCaloPID::kPi0) { + return kFALSE ; + } + } + + //Check acceptance selection + if(IsFidutialCutOn()){ + Bool_t in = kFALSE; + if(calo->IsPHOSCluster()) + in = GetFidutialCut()->IsInFidutialCut(mom,"PHOS") ; + else if(calo->IsEMCALCluster()) + in = GetFidutialCut()->IsInFidutialCut(mom,"EMCAL") ; + if(! in ) { return kFALSE ;} + } + + if(GetDebug() > 1) printf("Correlation photon selection cuts passed: pT %3.2f, pdg %d\n",mom.Pt(), pdg); + + return kTRUE; + + } diff --git a/PWG4/AliAnaParticleHadronCorrelation.h b/PWG4/AliAnaParticleHadronCorrelation.h new file mode 100644 index 00000000000..28a0b75d4fc --- /dev/null +++ b/PWG4/AliAnaParticleHadronCorrelation.h @@ -0,0 +1,81 @@ +#ifndef AliAnaParticleHadronCorrelation_H +#define AliAnaParticleHadronCorrelation_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +/* History of cvs commits: + * + * $Log$ + * + * + */ + +//_________________________________________________________________________ +// Class that contains the algorithm for the analysis of particle - hadron correlations +// Particle (for example direct gamma) must be found in a previous analysis +//-- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- +class TH2F; + +// --- Analysis system --- +#include "AliAnaBaseClass.h" + +class AliAnaParticleHadronCorrelation : public AliAnaBaseClass { + +public: + + AliAnaParticleHadronCorrelation() ; // default ctor + AliAnaParticleHadronCorrelation(const AliAnaParticleHadronCorrelation & ph) ; // cpy ctor + AliAnaParticleHadronCorrelation & operator = (const AliAnaParticleHadronCorrelation & ph) ;//cpy assignment + virtual ~AliAnaParticleHadronCorrelation() {;} //virtual dtor + + TList * GetCreateOutputObjects(); + + Double_t GetDeltaPhiMaxCut() const {return fDeltaPhiMaxCut ; } + Double_t GetDeltaPhiMinCut() const {return fDeltaPhiMinCut ; } + void SetDeltaPhiCutRange(Double_t phimin, Double_t phimax) + {fDeltaPhiMaxCut =phimax; fDeltaPhiMinCut =phimin;} + + void InitParameters(); + + void Print(const Option_t * opt) const; + + void MakeChargedCorrelation(AliAODParticleCorrelation * aodParticle,TSeqCollection* pl, const Bool_t bFillHisto) ; + void MakeNeutralCorrelation(AliAODParticleCorrelation * aodParticle,TSeqCollection* pl, const Bool_t bFillHisto) ; + + void MakeAnalysisFillAOD() ; + + void MakeAnalysisFillHistograms() ; + + Bool_t SelectCluster(AliAODCaloCluster * calo, Double_t *vertex, TLorentzVector & mom, Int_t & pdg); + + private: + + Double_t fDeltaPhiMaxCut ; // Minimum Delta Phi Gamma-Hadron + Double_t fDeltaPhiMinCut ; // Maximum Delta Phi Gamma-Hadron + + //Histograms + TH2F * fhPhiCharged ; //Phi distribution of selected charged particles + TH2F * fhPhiNeutral ; //Phi distribution of selected neutral particles + TH2F * fhEtaCharged ; //Eta distribution of selected charged particles + TH2F * fhEtaNeutral ; //Eta distribution of selected neutral particles + TH2F * fhDeltaPhiCharged ; //Difference of charged particle phi and trigger particle phi as function of trigger particle pT + TH2F * fhDeltaPhiNeutral ; //Difference of neutral particle phi and trigger particle phi as function of trigger particle pT + TH2F * fhDeltaEtaCharged ; //Difference of charged particle eta and trigger particle eta as function of trigger particle pT + TH2F * fhDeltaEtaNeutral ; //Difference of neutral particle eta and trigger particle eta as function of trigger particle pT + TH2F * fhDeltaPhiChargedPt ; //Difference of charged particle phi and trigger particle phi as function of charged particle pT + TH2F * fhDeltaPhiNeutralPt ; //Difference of neutral particle phi and trigger particle phi as function of neutral particle particle pT + + TH2F * fhPtImbalanceNeutral ; //Trigger particle - neutral hadron momentum imbalance histogram + TH2F * fhPtImbalanceCharged ; //Trigger particle -charged hadron momentim imbalance histogram + + ClassDef(AliAnaParticleHadronCorrelation,1) +} ; + + +#endif //AliAnaParticleHadronCorrelation_H + + + diff --git a/PWG4/AliAnaParticleJetFinderCorrelation.cxx b/PWG4/AliAnaParticleJetFinderCorrelation.cxx new file mode 100644 index 00000000000..007cfe10f49 --- /dev/null +++ b/PWG4/AliAnaParticleJetFinderCorrelation.cxx @@ -0,0 +1,167 @@ +/************************************************************************** + * 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. * + **************************************************************************/ +/* $Id: AliAnaGammaJetFinder.cxx 22232 2007-11-17 16:39:49Z gustavo $ */ + +/* History of cvs commits: + * + * $Log$ + * Revision 1.3 2007/10/29 13:48:42 gustavo + * Corrected coding violations + * + * Revision 1.2 2007/08/17 12:40:04 schutz + * New analysis classes by Gustavo Conesa + * + * Revision 1.1.2.1 2007/07/26 10:32:09 schutz + * new analysis classes in the the new analysis framework + * + * + */ + +//_________________________________________________________________________ +// Class for the analysis of gamma-jet (standard jet finder) correlations +//*-- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- +#include "Riostream.h" + +//---- AliRoot system ---- +#include "AliAnaGammaJetFinder.h" +#include "AliLog.h" + + ClassImp(AliAnaGammaJetFinder) + + +//____________________________________________________________________________ + AliAnaGammaJetFinder::AliAnaGammaJetFinder() : + AliAnaGammaCorrelation(), + fhDeltaEtaJet(0), fhDeltaPhiJet(0), + fhDeltaPtJet(0), fhPtRatJet(0) +{ + //Default Ctor + + SetCorrelationType(kJetFinder); + //Initialize parameters + InitParameters(); +} + +//____________________________________________________________________________ +AliAnaGammaJetFinder::AliAnaGammaJetFinder(const AliAnaGammaJetFinder & g) : + AliAnaGammaCorrelation(g), + fhDeltaEtaJet(g.fhDeltaEtaJet), fhDeltaPhiJet(g.fhDeltaPhiJet), + fhDeltaPtJet(g.fhDeltaPtJet), fhPtRatJet(g.fhPtRatJet) +{ + // cpy ctor + +} + +//_________________________________________________________________________ +AliAnaGammaJetFinder & AliAnaGammaJetFinder::operator = (const AliAnaGammaJetFinder & source) +{ + // assignment operator + + if(this == &source)return *this; + ((AliAnaGammaCorrelation *)this)->operator=(source); + fhDeltaEtaJet = source.fhDeltaEtaJet; + fhDeltaPhiJet = source.fhDeltaPhiJet; + fhDeltaPtJet = source.fhDeltaPtJet; + fhPtRatJet = source.fhPtRatJet; + + return *this; + +} + +//____________________________________________________________________________ +AliAnaGammaJetFinder::~AliAnaGammaJetFinder() +{ + // Remove all pointers except analysis output pointers. + +} + + +//________________________________________________________________________ +TList * AliAnaGammaJetFinder::GetCreateOutputObjects() +{ + // Create histograms to be saved in output file and + // store them in fOutputContainer + + AliDebug(1,"Init jet histograms"); + + TList * outputContainer = new TList() ; + outputContainer->SetName("GammaJetHistos") ; + + //---kJet--- + fhDeltaPhiJet = new TH2F + ("DeltaPhiJet","#phi_{#gamma} - #phi_{jet} vs p_{T #gamma}", + 200,0,120,200,0,6.4); + fhDeltaPhiJet->SetYTitle("#Delta #phi"); + fhDeltaPhiJet->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhDeltaPhiJet); + + fhDeltaEtaJet = new TH2F + ("DeltaEtaJet","#eta_{#gamma} - #eta_{jet} vs p_{T #gamma}", + 200,0,120,200,-2,2); + fhDeltaEtaJet->SetYTitle("#Delta #eta"); + fhDeltaEtaJet->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhDeltaEtaJet); + + fhDeltaPtJet = new TH2F + ("DeltaPtJet","#p_{T #gamma} - #p_{T jet} vs p_{T #gamma}", + 200,0,120,100,-10,10); + fhDeltaPtJet->SetYTitle("#Delta #p_{T}"); + fhDeltaPtJet->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhDeltaPtJet); + + fhPtRatJet = new TH2F + ("PtRatJet","#p_{T jet} / #p_{T #gamma} vs p_{T #gamma}", + 200,0,120,200,0,5); + fhPtRatJet->SetYTitle("ratio"); + fhPtRatJet->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhPtRatJet); + + SetOutputContainer(outputContainer); + + return outputContainer; +} + + //____________________________________________________________________________ +void AliAnaGammaJetFinder::InitParameters() +{ + + //Initialize the parameters of the analysis. + + ; + +} + +//__________________________________________________________________ +void AliAnaGammaJetFinder::Print(const Option_t * opt) const +{ + + //Print some relevant parameters set for the analysis + if(! opt) + return; + +} + +//__________________________________________________________________ +void AliAnaGammaJetFinder::MakeGammaCorrelation(TParticle * pGamma, TClonesArray *pl, TClonesArray *) +{ + //Gamma -Jet Correlation Analysis + AliDebug(2, "Begin jet analysis"); + cout<operator=(source); + + fSeveralConeAndPtCuts = source.fSeveralConeAndPtCuts ; + fPbPb = source.fPbPb ; + fJetCTSRatioMaxCut = source.fJetCTSRatioMaxCut ; + fJetCTSRatioMinCut = source.fJetCTSRatioMinCut ; fJetRatioMaxCut = source.fJetRatioMaxCut ; + fJetRatioMinCut = source.fJetRatioMinCut ; fJetNCone = source.fJetNCone ; + fJetNPt = source.fJetNPt ; fJetCone = source.fJetCone ; + fJetPtThreshold = source.fJetPtThreshold ; + fJetPtThresPbPb = source.fJetPtThresPbPb ; + fPtJetSelectionCut = source.fPtJetSelectionCut ; + fSelect = source.fSelect ; fhChargedRatio = source.fhChargedRatio ; fhNeutralRatio = source.fhNeutralRatio ; + + fhPhiCharged = source.fhPhiCharged ; fhPhiNeutral = source.fhPhiNeutral ; + fhEtaCharged = source.fhEtaCharged ; fhEtaNeutral = source.fhEtaNeutral ; + fhDeltaPhiGammaCharged = source.fhDeltaPhiGammaCharged ; + fhDeltaPhiGammaNeutral = source.fhDeltaPhiGammaNeutral ; + fhDeltaEtaGammaCharged = source.fhDeltaEtaGammaCharged ; + fhDeltaEtaGammaNeutral = source.fhDeltaEtaGammaNeutral ; + + fhAnglePairLeading = source.fhAnglePairLeading ; + fhInvMassPairLeading = source.fhInvMassPairLeading ; + fhNBkg = source. fhNBkg ; fhNLeading = source. fhNLeading ; + fhNJet = source.fhNJet ; fhJetRatio = source.fhJetRatio ; fhJetPt = source.fhJetPt ; + fhBkgRatio = source.fhBkgRatio ; fhBkgPt = source.fhBkgPt ; + fhJetFragment = source.fhJetFragment ; fhBkgFragment = source.fhBkgFragment ; + fhJetPtDist = source.fhJetPtDist ; fhBkgPtDist = source.fhBkgPtDist ; + + + for(Int_t i = 0; i<10; i++){ + fJetCones[i] = source.fJetCones[i] ; + fJetNameCones[i] = source.fJetNameCones[i] ; + fJetPtThres[i] = source.fJetPtThres[i] ; + fJetNamePtThres[i] = source.fJetNamePtThres[i] ; + if( i < 6 ){ + fJetXMin1[i] = source.fJetXMin1[i] ; + fJetXMin2[i] = source.fJetXMin2[i] ; + fJetXMax1[i] = source.fJetXMax1[i] ; + fJetXMax2[i] = source.fJetXMax2[i] ; + fBkgMean[i] = source.fBkgMean[i] ; + fBkgRMS[i] = source.fBkgRMS[i] ; + if( i < 2 ){ + fJetE1[i] = source.fJetE1[i] ; + fJetE2[i] = source.fJetE2[i] ; + fJetSigma1[i] = source.fJetSigma1[i] ; + fJetSigma2[i] = source.fJetSigma2[i] ; + + } + } + } + + return *this; + +} + +//____________________________________________________________________________ +AliAnaParticleJetLeadingCone::~AliAnaParticleJetLeadingCone() +{ + // Remove all pointers except analysis output pointers. + delete [] fJetE1; + delete [] fJetE2; + delete [] fJetSigma1; + delete [] fJetSigma2; + delete [] fBkgMean; + delete [] fBkgRMS; + delete [] fJetXMin1; + delete [] fJetXMin2; + delete [] fJetXMax1; + delete [] fJetXMax2; + delete [] fJetCones; + delete [] fJetNameCones; + delete [] fJetPtThres; + delete [] fJetNamePtThres; +} + + + +//________________________________________________________________________ +TList * AliAnaParticleJetLeadingCone::GetCreateOutputObjects() +{ + // Create histograms to be saved in output file and + // store them in fOutputContainer + + AliDebug(1,"Init jet in leading cone histograms"); + + TList * outputContainer = new TList() ; + outputContainer->SetName("GammaJetCorrelationHistos") ; + + fhChargedRatio = new TH2F + ("ChargedRatio","p_{T leading charge} /p_{T #gamma} vs p_{T #gamma}", + 120,0,120,120,0,1); + fhChargedRatio->SetYTitle("p_{T lead charge} /p_{T #gamma}"); + fhChargedRatio->SetXTitle("p_{T #gamma} (GeV/c)"); + + fhPhiCharged = new TH2F + ("PhiCharged","#phi_{#pi^{#pm}} vs p_{T #gamma}", + 120,0,120,120,0,7); + fhPhiCharged->SetYTitle("#phi_{#pi^{#pm}} (rad)"); + fhPhiCharged->SetXTitle("p_{T #gamma} (GeV/c)"); + + fhEtaCharged = new TH2F + ("EtaCharged","#eta_{#pi^{#pm}} vs p_{T #gamma}", + 120,0,120,120,-1,1); + fhEtaCharged->SetYTitle("#eta_{#pi^{#pm}} (rad)"); + fhEtaCharged->SetXTitle("p_{T #gamma} (GeV/c)"); + + fhDeltaPhiGammaCharged = new TH2F + ("DeltaPhiGammaCharged","#phi_{#gamma} - #phi_{charged #pi} vs p_{T #gamma}", + 200,0,120,200,0,6.4); + fhDeltaPhiGammaCharged->SetYTitle("#Delta #phi"); + fhDeltaPhiGammaCharged->SetXTitle("p_{T #gamma} (GeV/c)"); + + fhDeltaEtaGammaCharged = new TH2F + ("DeltaEtaGammaCharged","#eta_{#gamma} - #eta_{#pi^{#pm}} vs p_{T #gamma}", + 200,0,120,200,-2,2); + fhDeltaEtaGammaCharged->SetYTitle("#Delta #eta"); + fhDeltaEtaGammaCharged->SetXTitle("p_{T #gamma} (GeV/c)"); + + outputContainer->Add(fhPhiCharged) ; + outputContainer->Add(fhEtaCharged) ; + outputContainer->Add(fhChargedRatio) ; + outputContainer->Add(fhDeltaPhiGammaCharged) ; + outputContainer->Add(fhDeltaEtaGammaCharged) ; + + if(!AreJetsOnlyInCTS()){ + + fhNeutralRatio = new TH2F + ("NeutralRatio","p_{T leading #pi^{0}} /p_{T #gamma} vs p_{T #gamma}", + 120,0,120,120,0,1); + fhNeutralRatio->SetYTitle("p_{T lead #pi^{0}} /p_{T #gamma}"); + fhNeutralRatio->SetXTitle("p_{T #gamma} (GeV/c)"); + + // + fhAnglePairLeading = new TH2F + ("AnglePairLeading", + "Angle between all #gamma pair finally selected vs p_{T #pi^{0}}", + 200,0,50,200,0,0.2); + fhAnglePairLeading->SetYTitle("Angle (rad)"); + fhAnglePairLeading->SetXTitle("E_{ #pi^{0}} (GeV/c)"); + + fhInvMassPairLeading = new TH2F + ("InvMassPairLeading", + "Invariant Mass of #gamma pair selected vs p_{T #gamma}", + 120,0,120,360,0,0.5); + fhInvMassPairLeading->SetYTitle("Invariant Mass (GeV/c^{2})"); + fhInvMassPairLeading->SetXTitle("p_{T #gamma} (GeV/c)"); + + fhPhiNeutral = new TH2F + ("PhiNeutral","#phi_{#pi^{0}} vs p_{T #gamma}", + 120,0,120,120,0,7); + fhPhiNeutral->SetYTitle("#phi_{#pi^{0}} (rad)"); + fhPhiNeutral->SetXTitle("p_{T #gamma} (GeV/c)"); + + fhEtaNeutral = new TH2F + ("EtaNeutral","#eta_{#pi^{0}} vs p_{T #gamma}", + 120,0,120,120,-1,1); + fhEtaNeutral->SetYTitle("#eta_{#pi^{0}} (rad)"); + fhEtaNeutral->SetXTitle("p_{T #gamma} (GeV/c)"); + + fhDeltaPhiGammaNeutral = new TH2F + ("DeltaPhiGammaNeutral","#phi_{#gamma} - #phi_{#pi^{0}} vs p_{T #gamma}", + 200,0,120,200,0,6.4); + fhDeltaPhiGammaNeutral->SetYTitle("#Delta #phi"); + fhDeltaPhiGammaNeutral->SetXTitle("p_{T #gamma} (GeV/c)"); + + fhDeltaEtaGammaNeutral = new TH2F + ("DeltaEtaGammaNeutral","#eta_{#gamma} - #eta_{#pi^{#pm}} vs p_{T #gamma}", + 200,0,120,200,-2,2); + fhDeltaEtaGammaNeutral->SetYTitle("#Delta #eta"); + fhDeltaEtaGammaNeutral->SetXTitle("p_{T #gamma} (GeV/c)"); + + outputContainer->Add(fhPhiNeutral) ; + outputContainer->Add(fhEtaNeutral) ; + outputContainer->Add(fhNeutralRatio) ; + outputContainer->Add(fhDeltaPhiGammaNeutral) ; + outputContainer->Add(fhDeltaEtaGammaNeutral) ; + + outputContainer->Add(fhInvMassPairLeading) ; + outputContainer->Add(fhAnglePairLeading) ; + } + + if(!fSeveralConeAndPtCuts){// not several cones + + //Count + fhNBkg = new TH1F("NBkg","bkg multiplicity",9000,0,9000); + fhNBkg->SetYTitle("counts"); + fhNBkg->SetXTitle("N"); + outputContainer->Add(fhNBkg) ; + + fhNLeading = new TH2F + ("NLeading","Accepted Jet Leading", 240,0,120,240,0,120); + fhNLeading->SetYTitle("p_{T charge} (GeV/c)"); + fhNLeading->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhNLeading) ; + + fhNJet = new TH1F("NJet","Accepted jets",240,0,120); + fhNJet->SetYTitle("N"); + fhNJet->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhNJet) ; + + //Ratios and Pt dist of reconstructed (not selected) jets + //Jet + fhJetRatio = new TH2F + ("JetRatio","p_{T jet lead}/p_{T #gamma} vs p_{T #gamma}", + 240,0,120,200,0,10); + fhJetRatio->SetYTitle("p_{T jet lead #pi^{0}}/p_{T #gamma}"); + fhJetRatio->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhJetRatio) ; + + fhJetPt = new TH2F + ("JetPt", "p_{T jet lead} vs p_{T #gamma}",240,0,120,400,0,200); + fhJetPt->SetYTitle("p_{T jet}"); + fhJetPt->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhJetPt) ; + + //Bkg + + fhBkgRatio = new TH2F + ("BkgRatio","p_{T bkg lead}/p_{T #gamma} vs p_{T #gamma}", + 240,0,120,200,0,10); + fhBkgRatio->SetYTitle("p_{T bkg lead charge}/p_{T #gamma}"); + fhBkgRatio->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhBkgRatio) ; + + fhBkgPt = new TH2F + ("BkgPt","p_{T jet lead} vs p_{T #gamma}",240,0,120,400,0,200); + fhBkgPt->SetYTitle("p_{T jet lead charge}/p_{T #gamma}"); + fhBkgPt->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhBkgPt) ; + + //Jet Distributions + + fhJetFragment = + new TH2F("JetFragment","x = p_{T i charged}/p_{T #gamma}", + 240,0.,120.,1000,0.,1.2); + fhJetFragment->SetYTitle("x_{T}"); + fhJetFragment->SetXTitle("p_{T #gamma}"); + outputContainer->Add(fhJetFragment) ; + + fhBkgFragment = new TH2F + ("BkgFragment","x = p_{T i charged}/p_{T #gamma}", + 240,0.,120.,1000,0.,1.2); + fhBkgFragment->SetYTitle("x_{T}"); + fhBkgFragment->SetXTitle("p_{T #gamma}"); + outputContainer->Add(fhBkgFragment) ; + + fhJetPtDist = + new TH2F("JetPtDist","x = p_{T i charged}",240,0.,120.,400,0.,200.); + fhJetPtDist->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhJetPtDist) ; + + fhBkgPtDist = new TH2F + ("BkgPtDist","x = p_{T i charged}",240,0.,120.,400,0.,200.); + fhBkgPtDist->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhBkgPtDist) ; + + }//not several cones + else{ //If we want to study the jet for different cones and pt + for(Int_t icone = 0; icone" +fJetNamePtThres[ipt]+" GeV/c", + 240,0,120,200,0,10); + fhJetRatios[icone][ipt]-> + SetYTitle("p_{T jet lead #pi^{0}}/p_{T #gamma}"); + fhJetRatios[icone][ipt]->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhJetRatios[icone][ipt]) ; + + + fhJetPts[icone][ipt] = new TH2F + ("JetPtCone"+fJetNameCones[icone]+"Pt"+fJetNamePtThres[ipt], + "p_{T jet lead #pi^{0}}/p_{T #gamma} vs p_{T #gamma}, cone =" + +fJetNameCones[icone]+", pt>" +fJetNamePtThres[ipt]+" GeV/c", + 240,0,120,400,0,200); + fhJetPts[icone][ipt]-> + SetYTitle("p_{T jet lead #pi^{0}}/p_{T #gamma}"); + fhJetPts[icone][ipt]->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhJetPts[icone][ipt]) ; + + //Bkg + fhBkgRatios[icone][ipt] = new TH2F + ("BkgRatioCone"+fJetNameCones[icone]+"Pt"+fJetNamePtThres[ipt], + "p_{T bkg lead #pi^{0}}/p_{T #gamma} vs p_{T #gamma}, cone =" + +fJetNameCones[icone]+", pt>" +fJetNamePtThres[ipt]+" GeV/c", + 240,0,120,200,0,10); + fhBkgRatios[icone][ipt]-> + SetYTitle("p_{T bkg lead #pi^{0}}/p_{T #gamma}"); + fhBkgRatios[icone][ipt]->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhBkgRatios[icone][ipt]) ; + + fhBkgPts[icone][ipt] = new TH2F + ("BkgPtCone"+fJetNameCones[icone]+"Pt"+fJetNamePtThres[ipt], + "p_{T jet lead #pi^{0}}/p_{T #gamma} vs p_{T #gamma}, cone =" + +fJetNameCones[icone]+", pt>" +fJetNamePtThres[ipt]+" GeV/c", + 240,0,120,400,0,200); + fhBkgPts[icone][ipt]-> + SetYTitle("p_{T jet lead #pi^{0}}/p_{T #gamma}"); + fhBkgPts[icone][ipt]->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhBkgPts[icone][ipt]) ; + + //Counts + fhNBkgs[icone][ipt] = new TH1F + ("NBkgCone"+fJetNameCones[icone]+"Pt"+fJetNamePtThres[ipt], + "bkg multiplicity cone ="+fJetNameCones[icone]+", pt>" + +fJetNamePtThres[ipt]+" GeV/c",9000,0,9000); + fhNBkgs[icone][ipt]->SetYTitle("counts"); + fhNBkgs[icone][ipt]->SetXTitle("N"); + outputContainer->Add(fhNBkgs[icone][ipt]) ; + + fhNLeadings[icone][ipt] = new TH2F + ("NLeadingCone"+fJetNameCones[icone]+"Pt"+fJetNamePtThres[ipt], + "p_{T #gamma} vs p_{T #pi^{0}} cone ="+fJetNameCones[icone]+", pt>" + +fJetNamePtThres[ipt]+" GeV/c",120,0,120,120,0,120); + fhNLeadings[icone][ipt]->SetYTitle("p_{T #pi^{0}}(GeV/c)"); + fhNLeadings[icone][ipt]->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhNLeadings[icone][ipt]) ; + + fhNJets[icone][ipt] = new TH1F + ("NJetCone"+fJetNameCones[icone]+"Pt"+fJetNamePtThres[ipt], + "Number of neutral jets, cone ="+fJetNameCones[icone]+", pt>" + +fJetNamePtThres[ipt]+" GeV/c",120,0,120); + fhNJets[icone][ipt]->SetYTitle("N"); + fhNJets[icone][ipt]->SetXTitle("p_{T #gamma}(GeV/c)"); + outputContainer->Add(fhNJets[icone][ipt]) ; + + //Fragmentation Function + fhJetFragments[icone][ipt] = new TH2F + ("JetFragmentCone"+fJetNameCones[icone]+"Pt"+fJetNamePtThres[ipt], + "x_{T} = p_{T i}/p_{T #gamma}, cone ="+fJetNameCones[icone]+", pt>" + +fJetNamePtThres[ipt]+" GeV/c",120,0.,120.,240,0.,1.2); + fhJetFragments[icone][ipt]->SetYTitle("x_{T}"); + fhJetFragments[icone][ipt]->SetXTitle("p_{T #gamma}"); + outputContainer->Add(fhJetFragments[icone][ipt]) ; + + fhBkgFragments[icone][ipt] = new TH2F + ("BkgFragmentCone"+fJetNameCones[icone]+"Pt"+fJetNamePtThres[ipt], + "x_{T} = p_{T i}/p_{T #gamma}, cone ="+fJetNameCones[icone]+", pt>" + +fJetNamePtThres[ipt]+" GeV/c",120,0.,120.,240,0.,1.2); + fhBkgFragments[icone][ipt]->SetYTitle("x_{T}"); + fhBkgFragments[icone][ipt]->SetXTitle("p_{T #gamma}"); + outputContainer->Add(fhBkgFragments[icone][ipt]) ; + + //Jet particle distribution + + fhJetPtDists[icone][ipt] = new TH2F + ("JetPtDistCone"+fJetNameCones[icone]+"Pt"+fJetNamePtThres[ipt], + "p_{T i}, cone ="+fJetNameCones[icone]+", pt>" +fJetNamePtThres[ipt]+ + " GeV/c",120,0.,120.,120,0.,120.); + fhJetPtDists[icone][ipt]->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhJetPtDists[icone][ipt]) ; + + fhBkgPtDists[icone][ipt] = new TH2F + ("BkgPtDistCone"+fJetNameCones[icone]+"Pt"+fJetNamePtThres[ipt], + "p_{T i}, cone ="+fJetNameCones[icone]+", pt>" +fJetNamePtThres[ipt]+ + " GeV/c",120,0.,120.,120,0.,120.); + fhBkgPtDists[icone][ipt]->SetXTitle("p_{T #gamma} (GeV/c)"); + outputContainer->Add(fhBkgPtDists[icone][ipt]) ; + + }//ipt + } //icone + }//If we want to study any cone or pt threshold + + return outputContainer; +} + + //____________________________________________________________________________ + void AliAnaParticleJetLeadingCone::InitParameters() +{ + + //Initialize the parameters of the analysis. + SetJetsOnlyInCTS(kFALSE) ; + fPbPb = kFALSE ; + + SetDeltaPhiCutRange(2.9,3.4) ; + SetRatioCutRange(0.1,1.0) ; + + //Jet selection parameters + //Fixed cut + fJetRatioMaxCut = 1.2 ; + fJetRatioMinCut = 0.3 ; + fJetCTSRatioMaxCut = 1.2 ; + fJetCTSRatioMinCut = 0.3 ; + fSelect = 0 ; + + //Cut depending on gamma energy + + fPtJetSelectionCut = 20.; //For Low pt jets+BKG, another limits applied + //Reconstructed jet energy dependence parameters + //e_jet = a1+e_gamma b2. + //Index 0-> Pt>2 GeV r = 0.3; Index 1-> Pt>0.5 GeV r = 0.3 + fJetE1[0] = -5.75; fJetE1[1] = -4.1; + fJetE2[0] = 1.005; fJetE2[1] = 1.05; + + //Reconstructed sigma of jet energy dependence parameters + //s_jet = a1+e_gamma b2. + //Index 0-> Pt>2 GeV r = 0.3; Index 1-> Pt>0.5 GeV r = 0.3 + fJetSigma1[0] = 2.65; fJetSigma1[1] = 2.75; + fJetSigma2[0] = 0.0018; fJetSigma2[1] = 0.033; + + //Background mean energy and RMS + //Index 0-> No BKG; Index 1-> BKG > 2 GeV; + //Index 2-> (low pt jets)BKG > 0.5 GeV; + //Index > 2, same for CTS conf + fBkgMean[0] = 0.; fBkgMean[1] = 8.8 ; fBkgMean[2] = 69.5; + fBkgMean[3] = 0.; fBkgMean[4] = 6.4; fBkgMean[5] = 48.6; + fBkgRMS[0] = 0.; fBkgRMS[1] = 7.5; fBkgRMS[2] = 22.0; + fBkgRMS[3] = 0.; fBkgRMS[4] = 5.4; fBkgRMS[5] = 13.2; + + //Factor x of min/max = E -+ x * sigma. Obtained after selecting the + //limits for monoenergetic jets. + //Index 0-> No BKG; Index 1-> BKG > 2 GeV; + //Index 2-> (low pt jets) BKG > 0.5 GeV; + //Index > 2, same for CTS conf + + fJetXMin1[0] =-0.69 ; fJetXMin1[1] = 0.39 ; fJetXMin1[2] =-0.88 ; + fJetXMin1[3] =-2.0 ; fJetXMin1[4] =-0.442 ; fJetXMin1[5] =-1.1 ; + fJetXMin2[0] = 0.066; fJetXMin2[1] = 0.038; fJetXMin2[2] = 0.034; + fJetXMin2[3] = 0.25 ; fJetXMin2[4] = 0.113; fJetXMin2[5] = 0.077 ; + fJetXMax1[0] =-3.8 ; fJetXMax1[1] =-0.76 ; fJetXMax1[2] =-3.6 ; + fJetXMax1[3] =-2.7 ; fJetXMax1[4] =-1.21 ; fJetXMax1[5] =-3.7 ; + fJetXMax2[0] =-0.012; fJetXMax2[1] =-0.022; fJetXMax2[2] = 0.016; + fJetXMax2[3] =-0.024; fJetXMax2[4] =-0.008; fJetXMax2[5] = 0.027; + + + //Different cones and pt thresholds to construct the jet + + fJetCone = 0.3 ; + fJetPtThreshold = 0.5 ; + fJetPtThresPbPb = 2. ; + fJetNCone = 4 ; + fJetNPt = 4 ; + fJetCones[0] = 0.2 ; fJetNameCones[0] = "02" ; + fJetCones[1] = 0.3 ; fJetNameCones[1] = "03" ; + fJetCones[2] = 0.4 ; fJetNameCones[2] = "04" ; + fJetCones[2] = 0.5 ; fJetNameCones[2] = "05" ; + + fJetPtThres[0] = 0.0 ; fJetNamePtThres[0] = "00" ; + fJetPtThres[1] = 0.5 ; fJetNamePtThres[1] = "05" ; + fJetPtThres[2] = 1.0 ; fJetNamePtThres[2] = "10" ; + fJetPtThres[3] = 2.0 ; fJetNamePtThres[3] = "20" ; +} + +//__________________________________________________________________ +void AliAnaParticleJetLeadingCone::Print(const Option_t * opt) const +{ + + //Print some relevant parameters set for the analysis + if(! opt) + return; + + Info("Print", "%s %s", GetName(), GetTitle() ) ; + printf("Correlation analysis = %d\n",kJetLeadCone) ; + + + printf("Phi gamma-Leading < %f\n", GetDeltaPhiMaxCut()) ; + printf("Phi gamma-Leading > %f\n", GetDeltaPhiMinCut()) ; + printf("pT Leading / pT Gamma < %f\n", GetRatioMaxCut()) ; + printf("pT Leading / pT Gamma > %f\n", GetRatioMinCut()) ; + + if(fSelect == 2){ + printf("pT Jet / pT Gamma < %f\n", fJetRatioMaxCut) ; + printf("pT Jet / pT Gamma > %f\n", fJetRatioMinCut) ; + printf("pT Jet (Only CTS)/ pT Gamma < %f\n", fJetCTSRatioMaxCut) ; + printf("pT Jet (Only CTS)/ pT Gamma > %f\n", fJetCTSRatioMinCut) ; + } + +} + +//__________________________________________________________________ +void AliAnaParticleJetLeadingCone::MakeAnalysisFillAOD() +{ + + //Particle-Hadron Correlation Analysis, fill AODs + if(GetDebug() > 1){ + printf("Begin jet leading cone correlation analysis, fill AODs \n"); + printf("In particle branch aod entries %d\n", GetAODBranch()->GetEntries()); + printf("In CTS aod entries %d\n", GetAODCTS()->GetEntries()); + printf("In EMCAL aod entries %d\n", GetAODEMCAL()->GetEntries()); + } + + TLorentzVector * pLeading = new TLorentVector; //It will contain the kinematics of the found leading particle + + //Loop on stored AOD particles, trigger + Int_t naod = GetAODBranch()->GetEntriesFast(); + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODParticleCorrelation* particle = dynamic_cast (GetAODBranch()->At(iaod)); + + //Search leading particles in CTS and EMCAL + if(GetLeadingParticle(particle, pLeading)){ + + if(GetDebug() > 1) printf("Leading: pt %f, phi %f, eta %f", pLeading->Pt(),pLeading->Phi(),pLeading->Eta())) ; + + MakeJet(particle, pLeading,"", kFALSE); + + }//Leading + }//AOD trigger particle loop + + if(GetDebug() >1)printf("End of jet leading cone analysis, fill AODs \n"); + +} + +//__________________________________________________________________ +void AliAnaParticleJetLeadingCone::MakeAnalysisFillHistograms() +{ + + //Particle-Hadron Correlation Analysis, fill AODs + if(GetDebug() > 1){ + printf("Begin jet leading cone correlation analysis, fill histograms \n"); + printf("In particle branch aod entries %d\n", GetAODBranch()->GetEntries()); + printf("In CTS aod entries %d\n", GetAODCTS()->GetEntries()); + printf("In EMCAL aod entries %d\n", GetAODEMCAL()->GetEntries()); + } + + TLorentzVector * pLeading = new TLorentzVector; + + //Loop on stored AOD particles, trigger + Int_t naod = GetAODBranch()->GetEntriesFast(); + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODParticleCorrelation* particle = dynamic_cast (GetAODBranch()->At(iaod)); + + Double_t pt = particle->Pt(); + Double_t phi = particle->Phi(); + Double_t eta = particle->Eta(); + + //Get leading particle, fill histograms + pLeading = particle->GetLeading(); + TString det = particle->GetLeadingDetector(); + + if(det!="" && pLeading){ + Double_t ptL = pLeading->Pt(); + Double_t phiL = pLeading->Phi(); + if(phiL < 0 ) phiL+=TMath::TwoPi(); + Double_t etaL = pLeading->Eta(); + + if(GetDebug() > 1) printf("Leading found in %s, with pt %3.2f, phi %2.2f, eta %2.2f",det.Data(), ptL, phiL, etaL); + if(det == "CTS"){ + fhChargedRatio->Fill(pt,ptL/particle->Pt()); + fhEtaCharged->Fill(pt,etaL); + fhPhiCharged->Fill(pt,phiL); + fhDeltaPhiGammaCharged->Fill(pt,phi-phiL); + fhDeltaEtaGammaCharged->Fill(pt,eta-etaL); + } + else if(det== "EMCAL"){ + fhNeutralRatio->Fill(pt,ptL/particle->Pt()); + fhEtaNeutral->Fill(pt,etaL); + fhPhiNeutral->Fill(pt,phiL); + fhDeltaPhiGammaNeutral->Fill(pt,phi-phiL); + fhDeltaEtaGammaNeutral->Fill(pt,eta-etaL); + } + } + + //Search Jet + if(!fSeveralConeAndPtCuts) + MakeJet(particle, pLeading, "", kTRUE); + else{ + for(Int_t icone = 0; icone1)printf("End of jet leading cone analysis, fill histograms \n"); + +} + +//____________________________________________________________________________ +Bool_t AliAnaParticleJetLeadingCone::GetLeadingParticle(AliAODParticleCorrelation *particle, TLorentzVector * pLeading) +{ + //Search Charged or Neutral leading particle, select the highest one. + + TLorentzVector *pLeadingCh = new TLorentzVector; + TLorentzVector *pLeadingPi0 = new TLorentzVector; + + Double_t pt = particle->Pt(); + Double_t phi = particle->Phi(); + Double_t eta = particle->Eta(); + + GetLeadingCharge(particle, pLeadingCh) ; + if(!AreJetsOnlyInCTS()) GetLeadingPi0(particle, pLeadingPi0) ; + + Double_t ptch = pLeadingCh->Pt(); + Double_t phich = pLeadingCh->Phi(); + if(phich < 0 ) phich+=TMath::TwoPi(); + Double_t etach = pLeadingCh->Eta(); + Double_t ptpi = pLeadingPi0->Pt(); + Double_t phipi = pLeadingPi0->Phi(); + if(phipi < 0 ) phipi+=TMath::TwoPi(); + Double_t etapi = pLeadingPi0->Eta(); + + if (ptch > 0 || ptpi > 0){ + if((ptch >= ptpi)){ + if(GetDebug() > 1)printf("Leading found in CTS \n"); + pLeading = pLeadingCh; + particle->SetLeading(pLeading); + return kTRUE; + } + else{ + if(GetDebug() > 1)printf("Leading found in EMCAL \n"); + pLeading = pLeadingPi0; + particle->SetLeading(pLeading); + return kTRUE; + } + + if(GetDebug() > 1)printf ("NO LEADING PARTICLE FOUND \n"); + return kFALSE; + +} + +//____________________________________________________________________________ +void AliAnaParticleJetLeadingCone::GetLeadingCharge(AliAODParticleCorrelation * particle, TLorentzVector * pLeading) +{ + //Search for the charged particle with highest pt and with + //Phi=Phi_trigger-Pi and pT=0.1E_gamma + + if(GetAODCTS()){ + Double_t ptTrig = particle->Pt(); + Double_t phiTrig = particle->Phi(); + Double_t rat = -100 ; + Double_t ptl = -100 ; + Double_t phil = -100 ; + Double_t pt = -100.; + Double_t phi = -100.; + TVector3 p3; + + for(Int_t ipr = 0;ipr < GetAODCTS()->GetEntries() ; ipr ++ ){ + AliAODTrack* track = dynamic_cast(GetAODCTS()->At(ipr)) ; + p3.SetXYZ(track->Px(),track->Py(),track->Pz()); + pt = p3.Pt(); + phi = p3.Phi() ; + if(phi<0) phi+=TMath::TwoPi(); + rat = ptl/particle->Pt() ; + + //Selection within angular and energy limits + if(((phiTrig-phi) > GetDeltaPhiMinCut()) && ((phiTrig-phi) GetRatioMinCut()) && (rat < GetRatioMaxCut()) && (pt > ptl)) { + phil = phi ; + ptl = pt ; + pLeading->SetMomentum(p3.Px(),p3.Py(),p3.Pz(),0); + } + }// track loop + }//CTS list exist + + if(GetDebug() > 1)printf("Leading in CTS: pt %f eta %f phi %f pt/ptTrig %f \n", ptl, pLeading->Eta(), phil,ptl/ptTrig)) ; + +} + +//____________________________________________________________________________ +void AliAnaParticleJetLeadingCone::GetLeadingPi0(AliAODParticleCorrelation * particle, TLorentzVector * pLeading) +{ + //Search for the neutral pion with highest pt and with + //Phi=Phi_trigger-Pi and pT=0.1E_gamma + if(GetAODEMCAL()){ + Double_t ptTrig = particle->Pt(); + Double_t phiTrig = particle->Phi(); + Double_t rat = -100 ; + Double_t ptl = -100 ; + Double_t phil = -100 ; + Double_t pt = -100.; + Double_t phi = -100.; + + TLorentzVector gammai; + TLorentzVector gammaj; + + Double_t vertex[] = {0,0,0}; + + if(!GetReader()->GetDataType()== AliCaloTrackReader::kMC) GetReader()->GetVertex(vertex); + + //Cluster loop, select pairs with good pt, phi and fill AODs or histograms + for(Int_t iclus = 0;iclus < GetAODEMCAL()->GetEntries() ; iclus ++ ){ + AliAODCaloCluster * calo = dynamic_cast< AliAODCaloCluster *>(GetAODEMCAL()->At(iclus)) ; + + //Cluster selection, not charged, with photon or pi0 id and in fidutial cut + Int_t pdg=0; + if(!SelectCluster(calo2,vertex, gammaj, pdgj)) continue ; + + if(GetDebug() > 2) printf("neutral cluster: pt %f, phi %f \n", gammai.Pt(),gammai.Phi()); + + //2 gamma overlapped, found with PID + if(pdg == AliCaloPID::kPi0){ + pt = gammai->Pt(); + rat = pt/ptTrig; + phi = gammai->Phi(); + if(phi<0) phi+=TMath::TwoPi(); + + //Selection within angular and energy limits + if(ptl > pt && rat > GetRatioMinCut() && rat < GetRatioMaxCut() && + (phig-phil) > GetDeltaPhiMinCut() && (phig-phil) < GetDeltaPhiMaxCut() ) + { + phi = phil ; + pt = ptl ; + pLeading->SetMomentum(gammai.Px(),gammai.Py(),gammai.Pz(),gammai.E()); + }// cuts + }// pdg = 111 + //Make invariant mass analysis + else if(pdg == AliCaloPID::kPhoton){ + //Search the photon companion in case it comes from a Pi0 decay + //Apply several cuts to select the good pair; + for(Int_t jclus = iclus+1; jclus < GetAODEMCAL()->GetEntries() ; jclus ++ ){ + AliAODCaloCluster * calo2 = dynamic_cast< AliAODCaloCluster *>(GetAODEMCAL()->At(jclus)) ; + + //Cluster selection, not charged with photon or pi0 id and in fidutial cut + Int_t pdgj=0; + if(!SelectCluster(calo2,vertex, gammaj, pdgj)) continue ; + + if(pdgj == AliCaloPID::kPhoton ){ + + pt = (gammai+gammaj).Pt(); + phi = (gammai+gammaj).Phi(); + rat = pt/ptTrig; + + //Selection within angular and energy limits + if(ptl > pt && rat > GetRatioMinCut() && rat < GetRatioMaxCut() && + (phig-phil) > GetDeltaPhiMinCut() && (phig-phil) < GetDeltaPhiMaxCut() ){ + //Select good pair (aperture and invariant mass) + if(GetNeutralMesonSelection()->SelectPair(gammai, gammaj)){ + phi = phil ; + pt = ptl ; + pLeading->SetMomentum(gammai.Px(),gammai.Py(),gammai.Pz(),gammai.E()); + }//pi0 selection + + if(GetDebug() > 3 ) printf("Neutral Hadron Correlation: Selected gamma pair: pt %2.2f, phi %2.2f, eta %2.2f, M %2.3f", + (gammai+gammaj).Pt(),(gammai+gammaj).Phi(),(gammai+gammaj).Eta(), (gammai+gammaj).M()); + }//Pair selected as leading + }//if pair of gammas + }//2nd loop + }// if pdg = 22 + }// 1st Loop + }//EMCAL list exists + + if(GetDebug()>2) printf("Leading EMCAL: pt %f eta %f phi %f pt/Eg %f \n", pLeading->Pt(), pLeading->Eta(), pLeading->Phi(), pLeading->Pt()/ptTrig) ; + +} + + +//__________________________________________________________________________- +Bool_t AliAnaParticleJetLeadingCone::IsJetSelected(const Double_t ptg, const Double_t ptj){ + //Check if the energy of the reconstructed jet is within an energy window + + Double_t par[6]; + Double_t xmax[2]; + Double_t xmin[2]; + + Int_t iCTS = 0; + if(AreJetsOnlyInCTS()) + iCTS = 3 ; + + if(!fPbPb){ + //Phythia alone, jets with pt_th > 0.2, r = 0.3 + par[0] = fJetE1[0]; par[1] = fJetE2[0]; + //Energy of the jet peak + //e_jet = fJetE1[0]+fJetE2[0]*e_gamma, simulation fit + par[2] = fJetSigma1[0]; par[3] = fJetSigma2[0]; + //Sigma of the jet peak + //sigma_jet = fJetSigma1[0]+fJetSigma2[0]*e_gamma, simulation fit + par[4] = fBkgMean[0 + iCTS]; par[5] = fBkgRMS[0 + iCTS]; + //Parameters reserved for PbPb bkg. + xmax[0] = fJetXMax1[0 + iCTS]; xmax[1] = fJetXMax2[0 + iCTS]; + xmin[0] = fJetXMin1[0 + iCTS]; xmin[1] = fJetXMin2[0 + iCTS]; + //Factor that multiplies sigma to obtain the best limits, + //by observation, of mono jet ratios (ptjet/ptg) + //X_jet = fJetX1[0]+fJetX2[0]*e_gamma + + } + else{ + if(ptg > fPtJetSelectionCut){ + //Phythia +PbPb with pt_th > 2 GeV/c, r = 0.3 + par[0] = fJetE1[0]; par[1] = fJetE2[0]; + //Energy of the jet peak, same as in pp + //e_jet = fJetE1[0]+fJetE2[0]*e_gamma, simulation fit + par[2] = fJetSigma1[0]; par[3] = fJetSigma2[0]; + //Sigma of the jet peak, same as in pp + //sigma_jet = fJetSigma1[0]+fJetSigma2[0]*e_gamma, simulation fit + par[4] = fBkgMean[1 + iCTS]; par[5] = fBkgRMS[1 + iCTS]; + //Mean value and RMS of PbPb Bkg + xmax[0] = fJetXMax1[1 + iCTS]; xmax[1] = fJetXMax2[1 + iCTS]; + xmin[0] = fJetXMin1[1 + iCTS]; xmin[1] = fJetXMin2[1 + iCTS]; + //Factor that multiplies sigma to obtain the best limits, + //by observation, of mono jet ratios (ptjet/ptg) mixed with PbPb Bkg, + //pt_th > 2 GeV, r = 0.3 + //X_jet = fJetX1[0]+fJetX2[0]*e_gamma + + } + else{ + //Phythia + PbPb with pt_th > 0.5 GeV/c, r = 0.3 + par[0] = fJetE1[1]; par[1] = fJetE2[1]; + //Energy of the jet peak, pt_th > 2 GeV/c, r = 0.3 + //e_jet = fJetE1[0]+fJetE2[0]*e_gamma, simulation fit + par[2] = fJetSigma1[1]; par[3] = fJetSigma2[1]; + //Sigma of the jet peak, pt_th > 2 GeV/c, r = 0.3 + //sigma_jet = fJetSigma1[0]+fJetSigma2[0]*e_gamma, simulation fit + par[4] = fBkgMean[2 + iCTS]; par[5] = fBkgRMS[2 + iCTS]; + //Mean value and RMS of PbPb Bkg in a 0.3 cone, pt > 2 GeV. + xmax[0] = fJetXMax1[2 + iCTS]; xmax[1] = fJetXMax2[2 + iCTS]; + xmin[0] = fJetXMin1[2 + iCTS]; xmin[1] = fJetXMin2[2 + iCTS]; + //Factor that multiplies sigma to obtain the best limits, + //by observation, of mono jet ratios (ptjet/ptg) mixed with PbPb Bkg, + //pt_th > 2 GeV, r = 0.3 + //X_jet = fJetX1[0]+fJetX2[0]*e_gamma + + }//If low pt jet in bkg + }//if Bkg + + //Calculate minimum and maximum limits of the jet ratio. + Double_t min = CalculateJetRatioLimit(ptg, par, xmin); + Double_t max = CalculateJetRatioLimit(ptg, par, xmax); + + AliDebug(3,Form("Jet selection? : Limits min %f, max %f, pt_jet %f, pt_gamma %f, pt_jet / pt_gamma %f",min,max,ptj,ptg,ptj/ptg)); + + if(( min < ptj/ptg ) && ( max > ptj/ptg)) + return kTRUE; + else + return kFALSE; + +} + +//____________________________________________________________________________ +void AliAnaParticleJetLeadingCone::MakeJet(AliAODParticleCorrelation *particle, TParticle* pLeading,TString lastname) +{ + //Fill the jet with the particles around the leading particle with + //R=fJetCone and pt_th = fJetPtThres. Calculate the energy of the jet and + //check if we select it. Fill jet histograms + + TClonesArray * jetList = new TClonesArray("TParticle",1000); + TClonesArray * bkgList = new TClonesArray("TParticle",1000); + + TLorentzVector jet (0,0,0,0); + TLorentzVector bkg(0,0,0,0); + TLorentzVector lv (0,0,0,0); + + Double_t ptjet = 0.0; + Double_t ptbkg = 0.0; + Int_t n0 = 0; + Int_t n1 = 0; + Bool_t b1 = kFALSE; + Bool_t b0 = kFALSE; + + Double_t ptg = pGamma->Pt(); + Double_t phig = pGamma->Phi(); + Double_t ptl = pLeading->Pt(); + Double_t phil = pLeading->Phi(); + Double_t etal = pLeading->Eta(); + + Float_t ptcut = fJetPtThreshold; + if(fPbPb && !fSeveralConeAndPtCuts && ptg > fPtJetSelectionCut) ptcut = fJetPtThresPbPb ; + + //Add charged particles to jet + TIter nextch(plCTS) ; + TParticle * particle = 0 ; + while ( (particle = dynamic_cast(nextch())) ) { + + b0 = kFALSE; + b1 = kFALSE; + + //Particles in jet + SetJet(particle, b0, fJetCone, etal, phil) ; + + if(b0){ + new((*jetList)[n0++]) TParticle(*particle) ; + particle->Momentum(lv); + if(particle->Pt() > ptcut ){ + jet+=lv; + ptjet+=particle->Pt(); + } + } + + //Background around (phi_gamma-pi, eta_leading) + SetJet(particle, b1, fJetCone,etal, phig) ; + + if(b1) { + new((*bkgList)[n1++]) TParticle(*particle) ; + particle->Momentum(lv); + if(particle->Pt() > ptcut ){ + bkg+=lv; + ptbkg+=particle->Pt(); + } + } + } + + //Add neutral particles to jet + TIter nextne(plNe) ; + particle = 0 ; + while ( (particle = dynamic_cast(nextne())) ) { + + b0 = kFALSE; + b1 = kFALSE; + + //Particles in jet + SetJet(particle, b0, fJetCone, etal, phil) ; + + if(b0){ + new((*jetList)[n0++]) TParticle(*particle) ; + particle->Momentum(lv); + if(particle->Pt() > ptcut ){ + jet+=lv; + ptjet+=particle->Pt(); + } + } + + //Background around (phi_gamma-pi, eta_leading) + SetJet(particle, b1, fJetCone,etal, phig) ; + + if(b1) { + new((*bkgList)[n1++]) TParticle(*particle) ; + particle->Momentum(lv); + if(particle->Pt() > ptcut ){ + bkg+=lv; + ptbkg+=particle->Pt(); + } + } + } + + ptjet = jet.Pt(); + ptbkg = bkg.Pt(); + + if(ptjet > 0.) { + + AliDebug(2,Form("Gamma pt %f, Jet pt %f, Bkg pt %f",ptg,ptjet,ptbkg)); + + //Fill histograms + + Double_t ratjet = ptjet/ptg ; + Double_t ratbkg = ptbkg/ptg ; + + dynamic_cast + (GetOutputContainer()->FindObject("JetRatio"+lastname)) + ->Fill(ptg,ratjet); + dynamic_cast + (GetOutputContainer()->FindObject("JetPt"+lastname)) + ->Fill(ptg,ptjet); + + dynamic_cast + (GetOutputContainer()->FindObject("BkgRatio"+lastname)) + ->Fill(ptg,ratbkg); + + dynamic_cast + (GetOutputContainer()->FindObject("BkgPt"+lastname)) + ->Fill(ptg,ptbkg); + + //Jet selection + Bool_t kSelect = kFALSE; + if(fSelect == 0) + kSelect = kTRUE; //Accept all jets, no restriction + else if(fSelect == 1){ + //Selection with parametrized cuts + if(IsJetSelected(ptg,ptjet)) kSelect = kTRUE; + } + else if(fSelect == 2){ + //Simple selection + if(!AreJetsOnlyInCTS()){ + if((ratjet < fJetRatioMaxCut) && (ratjet > fJetRatioMinCut )) kSelect = kTRUE; + } + else{ + if((ratjet < fJetCTSRatioMaxCut) && (ratjet > fJetCTSRatioMinCut )) kSelect = kTRUE; + } + } + else + AliError("Jet selection option larger than 2, DON'T SELECT JETS"); + + + if(kSelect){ + AliDebug(1,Form("Jet Selected: pt %f ", ptjet)) ; + + FillJetHistos(jetList, ptg, ptl,"Jet",lastname); + FillJetHistos(bkgList, ptg, ptl, "Bkg",lastname); + } + } //ptjet > 0 + + jetList ->Delete(); + bkgList ->Delete(); + +} + +//___________________________________________________________________ +void AliAnaParticleJetLeadingCone::SetJet(TParticle * part, Bool_t & b, Float_t cone, + Double_t eta, Double_t phi) +{ + + //Check if the particle is inside the cone defined by the leading particle + b = kFALSE; + + if(phi > TMath::TwoPi()) + phi-=TMath::TwoPi(); + if(phi < 0.) + phi+=TMath::TwoPi(); + + Double_t rad = 10000 + cone; + + if(TMath::Abs(part->Phi()-phi) <= (TMath::TwoPi() - cone)) + rad = TMath::Sqrt(TMath::Power(part->Eta()-eta,2)+ + TMath::Power(part->Phi()-phi,2)); + else{ + if(part->Phi()-phi > TMath::TwoPi() - cone) + rad = TMath::Sqrt(TMath::Power(part->Eta()-eta,2)+ + TMath::Power((part->Phi()-TMath::TwoPi())-phi,2)); + if(part->Phi()-phi < -(TMath::TwoPi() - cone)) + rad = TMath::Sqrt(TMath::Power(part->Eta()-eta,2)+ + TMath::Power((part->Phi()+TMath::TwoPi())-phi,2)); + } + + if(rad < cone ) + b = kTRUE; + +} + +//____________________________________________________________________________ +void AliAnaParticleJetLeadingCone::FillJetHistos(TClonesArray * pl, Double_t ptg, Double_t ptl, TString type, TString lastname) +{ + //Fill histograms wth jet fragmentation + //and number of selected jets and leading particles + //and the background multiplicity + TParticle * particle = 0 ; + Int_t ipr = 0; + Float_t charge = 0; + + TIter next(pl) ; + while ( (particle = dynamic_cast(next())) ) { + ipr++ ; + Double_t pt = particle->Pt(); + + charge = TDatabasePDG::Instance() + ->GetParticle(particle->GetPdgCode())->Charge(); + if(charge != 0){//Only jet Charged particles + dynamic_cast + (GetOutputContainer()->FindObject(type+"Fragment"+lastname)) + ->Fill(ptg,pt/ptg); + dynamic_cast + (GetOutputContainer()->FindObject(type+"PtDist"+lastname)) + ->Fill(ptg,pt); + }//charged + + }//while + + if(type == "Bkg") + dynamic_cast + (GetOutputContainer()->FindObject("NBkg"+lastname)) + ->Fill(ipr); + else{ + dynamic_cast + (GetOutputContainer()->FindObject("NJet"+lastname))-> + Fill(ptg); + dynamic_cast + (GetOutputContainer()->FindObject("NLeading"+lastname)) + ->Fill(ptg,ptl); + } + +} + + +//____________________________________________________________________________ +Bool_t AliAnaParticleJetLeadingConeCorrelation::SelectCluster(AliAODCaloCluster * calo, Double_t *vertex, TLorentzVector & mom, Int_t & pdg){ + //Select cluster depending on its pid and acceptance selections + + //Skip matched clusters with tracks + if(calo->GetNTracksMatched() > 0) return kFALSE; + + //Check PID + calo->GetMomentum(mom,vertex);//Assume that come from vertex in straight line + pdg = AliCaloPID::kPhoton; + if(IsCaloPIDOn()){ + //Get most probable PID, 2 options check PID weights (in MC this option is mandatory) + //or redo PID, recommended option for EMCal. + if(!IsCaloPIDRecalculationOn() || GetReader()->GetDataType() == AliCaloTrackReader::kMC ) + pdg = GetCaloPID()->GetPdg("EMCAL",calo->PID(),mom.E());//PID with weights + else + pdg = GetCaloPID()->GetPdg("EMCAL",mom,calo->GetM02(),0,0,0,0);//PID recalculated + + if(GetDebug() > 1) printf("PDG of identified particle %d\n",pdg); + //If it does not pass pid, skip + if(pdg != AliCaloPID::kPhoton || pdg != AliCaloPID::kPi0) { + return kFALSE ; + } + + //Check acceptance selection + if(IsFidutialCutOn()){ + Bool_t in = GetFidutialCut()->IsInFidutialCut(mom,"EMCAL") ; + if(! in ) return kFALSE ; + } + + if(GetDebug() > 1) printf("cluster selection cuts passed: pT %3.2f, pdg %d\n",mom.Pt(), pdg); + + return kTRUE; + + } diff --git a/PWG4/AliAnaParticleJetLeadingConeCorrelation.h b/PWG4/AliAnaParticleJetLeadingConeCorrelation.h new file mode 100644 index 00000000000..034fa3fa549 --- /dev/null +++ b/PWG4/AliAnaParticleJetLeadingConeCorrelation.h @@ -0,0 +1,193 @@ +#ifndef AliAnaParticleJetLeadingCone_H +#define AliAnaParticleJetLeadingCone_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +/* History of cvs commits: + * + * $Log$ + * + * + */ + +//_________________________________________________________________________ +// Class that contains the algorithm for the reconstruction of jet, cone around leading particle +// 1)Take the a trigger particle found stored in AliAODParticleCorrelations, +// 2) Search for the highest pt leading particle opposite to the trigger within a phi, pt window +// 3) Take all particles around leading in a cone R with pt larger than threshold and construct the jet +// +// Class created from old AliPHOSGammaJet +// (see AliRoot versions previous Release 4-09) +//-- Author: Gustavo Conesa (INFN-LNF) + +#include "AliAnaBaseClass.h" + +class AliAnaParticleJetLeadingCone : public AliAnaBaseClass { + +public: + + AliAnaParticleJetLeadingCone() ; // default ctor + AliAnaParticleJetLeadingCone(const AliAnaParticleJetLeadingCone & g) ; // cpy ctor + AliAnaParticleJetLeadingCone & operator = (const AliAnaParticleJetLeadingCone & g) ;//cpy assignment + virtual ~AliAnaParticleJetLeadingCone() ; //virtual dtor + + TList * GetCreateOutputObjects(); + + void InitParameters(); + + void Print(const Option_t * opt) const; + + Bool_t AreSeveralConeAndPtCuts() const {return fSeveralConeAndPtCuts ; } + void SetSeveralConeAndPtCuts(Bool_t several){fSeveralConeAndPtCuts = several ;} + + Bool_t IsPbPb() const {return fPbPb ; } + void SetPbPb(Bool_t opt){fPbPb = opt; } + + Double_t GetPtJetSelectionCut() const {return fPtJetSelectionCut ; } + Double_t GetJetRatioMaxCut() const {return fJetRatioMaxCut ; } + Double_t GetJetRatioMinCut() const {return fJetRatioMinCut ; } + + void SetPtJetSelectionCut(Double_t cut){fPtJetSelectionCut = cut; } + void SetJetSelection(UInt_t select){ fSelect= select ; } + + Int_t GetJetNCones() const {return fJetNCone ; } + Int_t GetJetNPtThres() const {return fJetNPt ; } + Float_t GetJetCone() const {return fJetCone ; } + Float_t GetJetPtThreshold() const {return fJetPtThreshold ; } + Float_t GetJetPtThresPbPb() const {return fJetPtThresPbPb ; } + Float_t GetJetCones(Int_t i) const {return fJetCones[i] ; } + Float_t GetJetPtThreshold(Int_t i) const {return fJetPtThres[i] ; } + TString GetJetConeName(Int_t i) const {return fJetNameCones[i] ; } + TString GetJetPtThresName(Int_t i) const {return fJetNamePtThres[i] ; } + + void SetJetNCones(Int_t n){fJetNCone = n ; } + void SetJetNPtThresholds(Int_t n){fJetNPt = n ; } + void SetJetCones(Int_t i, Float_t cone, TString sc) + {fJetCones[i] = cone ; fJetNameCones[i] = sc; }; + void SetCone(Float_t cone) + {fJetCone = cone; } + void SetJetPtThreshold(Float_t pt){fJetPtThreshold = pt; }; + void SetJetPtThresPbPb(Float_t pt){fJetPtThresPbPb = pt; }; + void SetJetPtThresholds(Int_t i,Float_t pt, TString spt){fJetPtThres[i] = pt ; + fJetNamePtThres[i] = spt; }; + + void SetJetRatioCutRange(Double_t ratiomin, Double_t ratiomax) + {fJetRatioMaxCut =ratiomax; fJetRatioMinCut = ratiomin ; } + void SetJetCTSRatioCutRange(Double_t ratiomin, Double_t ratiomax) + {fJetCTSRatioMaxCut =ratiomax; fJetCTSRatioMinCut = ratiomin ; } + + void MakeAnalysisFillAOD() ; + + void MakeAnalysisFillHistograms() ; + + private: + + Double_t CalculateJetRatioLimit(const Double_t ptg, const Double_t *param, + const Double_t *x); + void FillJetHistos(AliAODParticleCorrelation * particle, Double_t ptg, Double_t ptl,TString type, TString lastname); + + Bool_t IsJetSelected(const Double_t ptg, const Double_t ptjet); + + void MakeJet(AliAODParticleCorrelation * particle, const TLorentzVector pLeading, TString lastname); + + void GetLeadingCharge(AliAODParticleCorrelation *particle, TLorentzVector * pLeading) ; + void GetLeadingPi0 (AliAODParticleCorrelation *particle, TLorentzVector * pLeading) ; + Bool_t GetLeadingParticle(AliAODParticleCorrelation *particle, TLorentzVector * pLeading) ; + + void SetJet(TParticle * part, Bool_t & b, Float_t cone, Double_t eta, + Double_t phi); + + Bool_t SelectCluster(AliAODCaloCluster * calo, Double_t *vertex, TLorentzVector & mom, Int_t & pdg) ; + + private: + + Bool_t fPbPb; // PbPb event + Bool_t fSeveralConeAndPtCuts; // To play with the jet cone size and pt th. + + //Jet selection parameters + //Fixed cuts (old) + Double_t fJetCTSRatioMaxCut ; // Leading particle/gamma Ratio cut maximum + Double_t fJetCTSRatioMinCut ; // Leading particle/gamma Ratio cut minimum + Double_t fJetRatioMaxCut ; // Jet/gamma Ratio cut maximum + Double_t fJetRatioMinCut ; // Jet/gamma Ratio cut minimum + + //Cuts depending on jet pt + Double_t fJetE1[2]; //Rec. jet energy parameters + Double_t fJetE2[2]; //Rec. jet energy parameters + Double_t fJetSigma1[2];//Rec. sigma of jet energy parameters + Double_t fJetSigma2[2];//Rec. sigma of jet energy parameters + Double_t fBkgMean[6]; //Background mean energy + Double_t fBkgRMS[6]; //Background RMS + Double_t fJetXMin1[6]; //X Factor to set jet min limit for pp + Double_t fJetXMin2[6]; //X Factor to set jet min limit for PbPb + Double_t fJetXMax1[6]; //X Factor to set jet max limit for pp + Double_t fJetXMax2[6]; //X Factor to set jet max limit for PbPb + + Int_t fJetNCone ; // Number of jet cones sizes, maximum 5 + Int_t fJetNPt ; // Number of jet particle pT threshold, maximum 5 + Double_t fJetCone ; // Jet cone sizes under study (!fSeveralConeAndPtCuts) + Double_t fJetCones[5]; // Jet cone sizes under study (fSeveralConeAndPtCuts) + TString fJetNameCones[5]; // String name of cone to append to histos + Double_t fJetPtThreshold; // Jet pT threshold under study(!fSeveralConeAndPtCuts) + Double_t fJetPtThresPbPb; // Jet pT threshold under study(!fSeveralConeAndPtCuts) + Double_t fJetPtThres[5]; // Jet pT threshold under study(fSeveralConeAndPtCuts) + TString fJetNamePtThres[5]; // String name of pt th to append to histos + Double_t fPtJetSelectionCut; // Jet pt to change to low pt jets analysis + UInt_t fSelect ; //kTRUE: Selects all jets, no limits. + + //Histograms + //Particle distributions + TH2F * fhPhiCharged ; //Phi distribution of charged particles + TH2F * fhPhiNeutral ; //Phi distribution of neutral particles + TH2F * fhEtaCharged ; //Eta distribution of charged particles + TH2F * fhEtaNeutral ; //Eta distribution of neutral particles + //Leading particle distributions + TH2F * fhDeltaPhiGammaCharged ; //Difference of charged particle phi and prompt gamma phi as function of gamma pT + TH2F * fhDeltaPhiGammaNeutral ; //Difference of neutral particle phi and prompt gamma phi as function of gamma pT + TH2F * fhDeltaEtaGammaCharged ; //Difference of charged particle eta and prompt gamma eta as function of gamma pT + TH2F * fhDeltaEtaGammaNeutral ; //Difference of charged particle eta and prompt gamma eta as function of charged pT + + TH2F * fhAnglePairLeading ; //Aperture angle of decay photons of leading pi0 + TH2F * fhInvMassPairLeading ; //Invariant mass of decay photons of leading pi0 + TH2F * fhChargedRatio ; //Ratio of leading charge and prompt gamma + TH2F * fhNeutralRatio ; //Ratio of leading neutral and prompt gamma + TH1F * fhNBkg ; //Bakground multiplicity + TH2F * fhNLeading ; //Accepted leading particle pt distribution + + //Jet distributions + //Fixed cone and pt threshold + TH1F * fhNJet ; //Accepted reconstructed Jet pt distribution + TH2F * fhJetRatio ; //Ratio of pt jet and pt gamma + TH2F * fhJetPt ; //reconstructed pt jet vs prompt pt gamma + TH2F * fhBkgRatio ; //leading pt bakground / pt gamma + TH2F * fhBkgPt ; //leading pt bakground vs pt gamma + TH2F * fhJetFragment ; //Accepted reconstructed jet fragmentation function + TH2F * fhBkgFragment ; //Background "fragmentation function" + TH2F * fhJetPtDist ; //Jet particle pt distribution + TH2F * fhBkgPtDist ; //Background jet particle pt distribution + + //Variable cone and pt threshold + TH2F * fhJetRatios[5][5]; //Ratio of pt jet and pt gamma + TH2F * fhJetPts[5][5]; //reconstructed pt jet vs prompt pt gamma + TH2F * fhBkgRatios[5][5]; //leading pt bakground / pt gamma + TH2F * fhBkgPts[5][5]; //leading pt bakground vs pt gamma + + TH2F * fhNLeadings[5][5]; //Accepted leading particle pt distribution + TH1F * fhNJets[5][5]; //Accepted reconstructed Jet pt distribution + TH1F * fhNBkgs[5][5]; //Bakground multiplicity + + TH2F * fhJetFragments[5][5];//Accepted reconstructed jet fragmentation function + TH2F * fhBkgFragments[5][5]; //Background "fragmentation function" + TH2F * fhJetPtDists[5][5]; //Jet particle pt distribution + TH2F * fhBkgPtDists[5][5]; //Background jet particle pt distribution + + + ClassDef(AliAnaParticleJetLeadingCone,1) +} ; + + +#endif //AliAnaParticleJetLeadingCone_H + + + diff --git a/PWG4/AliAnaParticlePartonCorrelation.cxx b/PWG4/AliAnaParticlePartonCorrelation.cxx new file mode 100644 index 00000000000..5c3c2d33011 --- /dev/null +++ b/PWG4/AliAnaParticlePartonCorrelation.cxx @@ -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. * + **************************************************************************/ +/* $Id: $ */ + +/* History of cvs commits: + * + * $Log$ + * + * + */ +//_________________________________________________________________________ +// Class for the analysis of particle-parton correlations +// Particle (for example direct gamma) must be found in a previous analysis +// -- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + +// --- ROOT system --- +#include "Riostream.h" +#include "TH2F.h" +#include "TParticle.h" + +//---- ANALYSIS system ---- +#include "AliAnaParticlePartonCorrelation.h" +#include "AliLog.h" +#include "AliStack.h" + + ClassImp(AliAnaParticlePartonCorrelation) + + +//____________________________________________________________________________ + AliAnaParticlePartonCorrelation::AliAnaParticlePartonCorrelation() : + AliAnaBaseClass(), + fhDeltaEtaNearParton(0), fhDeltaPhiNearParton(0), + fhDeltaPtNearParton(0), fhPtRatNearParton(0), + fhDeltaEtaAwayParton(0), fhDeltaPhiAwayParton(0), + fhDeltaPtAwayParton(0), fhPtRatAwayParton(0) +{ + //Default Ctor + + //Initialize parameters + InitParameters(); +} + +//____________________________________________________________________________ +AliAnaParticlePartonCorrelation::AliAnaParticlePartonCorrelation(const AliAnaParticlePartonCorrelation & g) : + AliAnaBaseClass(g), + fhDeltaEtaNearParton(g.fhDeltaEtaNearParton), fhDeltaPhiNearParton(g.fhDeltaPhiNearParton), + fhDeltaPtNearParton(g.fhDeltaPtNearParton), fhPtRatNearParton(g.fhPtRatNearParton), + fhDeltaEtaAwayParton(g.fhDeltaEtaAwayParton), fhDeltaPhiAwayParton(g.fhDeltaPhiAwayParton), + fhDeltaPtAwayParton(g.fhDeltaPtAwayParton), fhPtRatAwayParton(g.fhPtRatAwayParton) +{ + // cpy ctor + +} + +//_________________________________________________________________________ +AliAnaParticlePartonCorrelation & AliAnaParticlePartonCorrelation::operator = (const AliAnaParticlePartonCorrelation & source) +{ + // assignment operator + + if(this == &source)return *this; + ((AliAnaBaseClass *)this)->operator=(source); + + fhDeltaEtaAwayParton = source.fhDeltaEtaAwayParton; + fhDeltaPhiAwayParton = source.fhDeltaPhiAwayParton; + fhDeltaPtAwayParton = source.fhDeltaPtAwayParton; + fhPtRatAwayParton = source.fhPtRatAwayParton; + fhDeltaEtaNearParton = source.fhDeltaEtaNearParton; + fhDeltaPhiNearParton = source.fhDeltaPhiNearParton; + fhDeltaPtNearParton = source.fhDeltaPtNearParton; + fhPtRatNearParton = source.fhPtRatNearParton; + + return *this; + +} + + +//________________________________________________________________________ +TList * AliAnaParticlePartonCorrelation::GetCreateOutputObjects() +{ + // Create histograms to be saved in output file + + AliDebug(1,"Init parton histograms"); + + TList * outputContainer = new TList() ; + outputContainer->SetName("ParticlePartonHistos") ; + + fhDeltaPhiNearParton = new TH2F + ("DeltaPhiNearParton","#phi_{particle} - #phi_{parton} vs p_{T particle}", + 200,0,120,200,0,6.4); + fhDeltaPhiNearParton->SetYTitle("#Delta #phi"); + fhDeltaPhiNearParton->SetXTitle("p_{T particle} (GeV/c)"); + outputContainer->Add(fhDeltaPhiNearParton); + + fhDeltaEtaNearParton = new TH2F + ("DeltaEtaNearParton","#eta_{particle} - #eta_{parton} vs p_{T particle}", + 200,0,120,200,-2,2); + fhDeltaEtaNearParton->SetYTitle("#Delta #eta"); + fhDeltaEtaNearParton->SetXTitle("p_{T particle} (GeV/c)"); + outputContainer->Add(fhDeltaEtaNearParton); + + fhDeltaPtNearParton = new TH2F + ("DeltaPtNearParton","#p_{T particle} - #p_{T parton} vs p_{T particle}", + 200,0,120,100,-10,10); + fhDeltaPtNearParton->SetYTitle("#Delta #p_{T}"); + fhDeltaPtNearParton->SetXTitle("p_{T particle} (GeV/c)"); + outputContainer->Add(fhDeltaPtNearParton); + + fhPtRatNearParton = new TH2F + ("PtRatNearParton","#p_{T parton} / #p_{T particle} vs p_{T particle}", + 200,0,120,200,0,5); + fhPtRatNearParton->SetYTitle("ratio"); + fhPtRatNearParton->SetXTitle("p_{T particle} (GeV/c)"); + outputContainer->Add(fhPtRatNearParton); + + fhDeltaPhiAwayParton = new TH2F + ("DeltaPhiAwayParton","#phi_{particle} - #phi_{parton} vs p_{T particle}", + 200,0,120,200,0,6.4); + fhDeltaPhiAwayParton->SetYTitle("#Delta #phi"); + fhDeltaPhiAwayParton->SetXTitle("p_{T particle} (GeV/c)"); + outputContainer->Add(fhDeltaPhiAwayParton); + + fhDeltaEtaAwayParton = new TH2F + ("DeltaEtaAwayParton","#eta_{particle} - #eta_{parton} vs p_{T particle}", + 200,0,120,200,-2,2); + fhDeltaEtaAwayParton->SetYTitle("#Delta #eta"); + fhDeltaEtaAwayParton->SetXTitle("p_{T particle} (GeV/c)"); + outputContainer->Add(fhDeltaEtaAwayParton); + + fhDeltaPtAwayParton = new TH2F + ("DeltaPtAwayParton","#p_{T particle} - #p_{T parton} vs p_{T particle}", + 200,0,120,100,-10,10); + fhDeltaPtAwayParton->SetYTitle("#Delta #p_{T}"); + fhDeltaPtAwayParton->SetXTitle("p_{T particle} (GeV/c)"); + outputContainer->Add(fhDeltaPtAwayParton); + + fhPtRatAwayParton = new TH2F + ("PtRatAwayParton","#p_{T parton} / #p_{T particle} vs p_{T particle}", + 200,0,120,200,0,5); + fhPtRatAwayParton->SetYTitle("ratio"); + fhPtRatAwayParton->SetXTitle("p_{T particle} (GeV/c)"); + outputContainer->Add(fhPtRatAwayParton); + + return outputContainer; +} + +//____________________________________________________________________________ +void AliAnaParticlePartonCorrelation::InitParameters() +{ + + //Initialize the parameters of the analysis. + ; + +} + +//__________________________________________________________________ +void AliAnaParticlePartonCorrelation::Print(const Option_t * opt) const +{ + + //Print some relevant parameters set for the analysis + if(! opt) + return; + +} + +//__________________________________________________________________ +void AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() +{ + //Particle-Parton Correlation Analysis, create AODs + //Add partons to the reference list of the trigger particle + //Partons are considered those in the first eight possitions in the stack + //being 0, and 1 the 2 protons, and 6 and 7 the outgoing final partons. + + if(GetDebug() > 1){ + printf("Begin parton correlation analysis, fill AODs \n"); + printf("In particle branch aod entries %d\n", GetAODBranch()->GetEntries()); + } + + //Loop on stored AOD particles + Int_t naod = GetAODBranch()->GetEntriesFast(); + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODParticleCorrelation* particle = dynamic_cast (GetAODBranch()->At(iaod)); + + AliStack * stack = GetMCStack() ; + if(!stack) AliFatal("No Stack available, STOP"); + + if(stack->GetNtrack() < 8) { + printf("*** small number of particles, not a PYTHIA simulation? ***: n tracks %d \n", stack->GetNprimary()); + continue ; + } + + //Fill AOD reference only with partons + TParticle * parton = new TParticle ; + + for(Int_t ipr = 0;ipr < 8; ipr ++ ){ + parton = stack->Particle(ipr) ; + particle->AddTrack(parton); + //parton->Print(); + } + + }//Aod branch loop + + if(GetDebug() > 1) printf("End parton correlation analysis, fill AODs \n"); +} + +//__________________________________________________________________ +void AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() +{ + //Particle-Parton Correlation Analysis, fill histograms + if(GetDebug() > 1){ + printf("Begin parton correlation analysis, fill histograms \n"); + printf("In particle branch aod entries %d\n", GetAODBranch()->GetEntries()); + } + + AliStack * stack = GetMCStack() ; + if(!stack) AliFatal("No Stack available, STOP"); + + //Loop on stored AOD particles + Int_t naod = GetAODBranch()->GetEntriesFast(); + TParticle * mom =new TParticle ; + + for(Int_t iaod = 0; iaod < naod ; iaod++){ + AliAODParticleCorrelation* particle = dynamic_cast (GetAODBranch()->At(iaod)); + + Float_t ptTrigg = particle->Pt(); + Float_t phiTrigg = particle->Phi(); + Float_t etaTrigg = particle->Eta(); + Int_t imom = particle->GetLabel(); + Int_t iparent = 2000; + Int_t iawayparent = -1; + + if(!(particle->GetRefTracks()) || (particle->GetRefTracks())->GetEntries() < 7) AliFatal("Reference list with partons not filled, STOP analysis"); + + //Check and get indeces of mother and parton + if(imom < 8 ) iparent = imom ; //mother is already a parton + else if (imom < stack->GetNtrack()) { + mom = stack->Particle(imom); + iparent=mom->GetFirstMother(); + cout<<" iparent "< 7 ){ + mom = stack->Particle(iparent); + imom = iparent ; //Mother label is of the inmediate parton daughter + iparent = mom->GetFirstMother(); + cout<<" while iparent "< 1) printf("N reference partons %d; labels: mother %d, parent %d \n", (particle->GetRefTracks())->GetEntries(), imom, iparent); + + + if(iparent < 0 || iparent > 8) { + if(GetDebug() > 0 ) printf("Failed to find appropriate parton, index %d", iparent); + continue ; + } + + //Near parton is the parton that fragmented and created the mother + TParticle * nearParton = (TParticle*) (particle->GetRefTracks())->At(iparent); + Float_t ptNearParton = nearParton->Pt(); + Float_t phiNearParton = nearParton->Phi() ; + Float_t etaNearParton = nearParton->Eta() ; + + fhDeltaEtaNearParton->Fill(ptTrigg,etaTrigg-etaNearParton); + fhDeltaPhiNearParton->Fill(ptTrigg,phiTrigg-phiNearParton); + fhDeltaPtNearParton->Fill(ptTrigg,ptTrigg-ptNearParton); + fhPtRatNearParton->Fill(ptTrigg,ptNearParton/ptTrigg); + + if(iparent == 7) iawayparent =6; + else if(iparent == 6) iawayparent =7; + else{ + printf("Parent parton is not final state, skip \n"); + continue; + } + + //Away parton is the other final parton. + TParticle * awayParton = (TParticle*) (particle->GetRefTracks())->At(iawayparent); + Float_t ptAwayParton = awayParton->Pt(); + Float_t phiAwayParton = awayParton->Phi() ; + Float_t etaAwayParton = awayParton->Eta() ; + fhDeltaEtaAwayParton->Fill(ptTrigg,etaTrigg-etaAwayParton); + fhDeltaPhiAwayParton->Fill(ptTrigg,phiTrigg-phiAwayParton); + fhDeltaPtAwayParton->Fill(ptTrigg,ptTrigg-ptAwayParton); + fhPtRatAwayParton->Fill(ptTrigg,ptAwayParton/ptTrigg); + + + } + + if(GetDebug() > 1) printf("End parton correlation analysis, fill histograms \n"); + +} diff --git a/PWG4/AliAnaParticlePartonCorrelation.h b/PWG4/AliAnaParticlePartonCorrelation.h new file mode 100644 index 00000000000..1fa873614fe --- /dev/null +++ b/PWG4/AliAnaParticlePartonCorrelation.h @@ -0,0 +1,63 @@ +#ifndef AliAnaParticlePartonCorrelation_H +#define AliAnaParticlePartonCorrelation_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: */ + +/* History of cvs commits: + * + * $Log$ + * + * + */ + +//_________________________________________________________________________ +// Class that contains the algorithm for the analysis of particle-parton correlation +// Particle (for example direct gamma) must be found in a previous analysis +//-- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT --- +class TH2F ; + +// --- ANALYSIS --- +#include "AliAnaBaseClass.h" + +class AliAnaParticlePartonCorrelation : public AliAnaBaseClass { + + public: + + AliAnaParticlePartonCorrelation() ; // default ctor + AliAnaParticlePartonCorrelation(const AliAnaParticlePartonCorrelation & g) ; // cpy ctor + AliAnaParticlePartonCorrelation & operator = (const AliAnaParticlePartonCorrelation & g) ;//cpy assignment + virtual ~AliAnaParticlePartonCorrelation() {;} //virtual dtor + + TList * GetCreateOutputObjects(); + + void InitParameters(); + + void Print(const Option_t * opt) const; + + void MakeAnalysisFillAOD() ; + + void MakeAnalysisFillHistograms() ; + + private: + + TH2F * fhDeltaEtaNearParton; //Difference of parton eta and prompt trigger particle eta + TH2F * fhDeltaPhiNearParton; //Difference of parton phi and prompt trigger particle phi + TH2F * fhDeltaPtNearParton; //Difference of parton pT and prompt trigger particle pT + TH2F * fhPtRatNearParton; //Ratio of parton pT and prompt trigger particle pT + + TH2F * fhDeltaEtaAwayParton; //Difference of parton eta and prompt trigger particle eta + TH2F * fhDeltaPhiAwayParton; //Difference of parton phi and prompt trigger particle phi + TH2F * fhDeltaPtAwayParton; //Difference of parton pT and prompt trigger particle pT + TH2F * fhPtRatAwayParton; //Ratio of parton pT and prompt trigger particle pT + + ClassDef(AliAnaParticlePartonCorrelation,1) + } ; + + +#endif //AliAnaParticlePartonCorrelation_H + + + diff --git a/PWG4/AliAnalysisTaskPHOSExample.cxx b/PWG4/AliAnalysisTaskPHOSExample.cxx new file mode 100644 index 00000000000..e0bc1b6ffef --- /dev/null +++ b/PWG4/AliAnalysisTaskPHOSExample.cxx @@ -0,0 +1,312 @@ +/************************************************************************** + * 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. * + **************************************************************************/ + +/* $Id: */ + +//_________________________________________________________________________ +// A basic analysis task to analyse photon detected by PHOS +// A basic analysis task to analyse photon detected by PHOS +// A basic analysis task to analyse photon detected by PHOS +// Adapted for AliAnalysisTaskSE and AOD production +// by Gustavo Conesa +// +//*-- Yves Schutz +////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include + +#include "AliAnalysisTaskPHOSExample.h" +#include "AliAnalysisManager.h" +#include "AliESDEvent.h" +#include "AliESDCaloCluster.h" +#include "AliAODEvent.h" +#include "AliAODPhoton.h" +#include "AliLog.h" +#include "AliESDVertex.h" + +//______________________________________________________________________________ +AliAnalysisTaskPHOSExample::AliAnalysisTaskPHOSExample() : + fDebug(0), + fAODPhotons(0x0), + fPhotonsInPhos(0), + fPhotonId(1.0), + fOutputList(0x0), + fhPHOSPos(0), + fhPHOS(0), + fhPHOSEnergy(0), + fhPHOSDigits(0), + fhPHOSRecParticles(0), + fhPHOSPhotons(0), + fhPHOSInvariantMass(0), + fhPHOSDigitsEvent(0) +{ + //Default constructor +} +//______________________________________________________________________________ +AliAnalysisTaskPHOSExample::AliAnalysisTaskPHOSExample(const char *name) : + AliAnalysisTaskSE(name), + fDebug(0), + fAODPhotons(0x0), + fPhotonsInPhos(0), + fPhotonId(1.0), + fOutputList(0x0), + fhPHOSPos(0), + fhPHOS(0), + fhPHOSEnergy(0), + fhPHOSDigits(0), + fhPHOSRecParticles(0), + fhPHOSPhotons(0), + fhPHOSInvariantMass(0), + fhPHOSDigitsEvent(0) +{ + // Constructor. + + // Output slots + DefineOutput(1, TList::Class()) ; +} + +//____________________________________________________________________________ +AliAnalysisTaskPHOSExample::AliAnalysisTaskPHOSExample(const AliAnalysisTaskPHOSExample& ap) : + AliAnalysisTaskSE(ap.GetName()), + fDebug(ap.fDebug), + fAODPhotons(ap.fAODPhotons), + fPhotonsInPhos(ap.fPhotonsInPhos), + fPhotonId(ap.fPhotonId), + fOutputList(ap.fOutputList), + fhPHOSPos(ap.fhPHOSPos), + fhPHOS(ap.fhPHOS), + fhPHOSEnergy(ap.fhPHOSEnergy), + fhPHOSDigits(ap.fhPHOSDigits), + fhPHOSRecParticles(ap.fhPHOSRecParticles), + fhPHOSPhotons(ap.fhPHOSPhotons), + fhPHOSInvariantMass(ap.fhPHOSInvariantMass), + fhPHOSDigitsEvent(ap.fhPHOSDigitsEvent) +{ + // cpy ctor +} + +//_____________________________________________________________________________ +AliAnalysisTaskPHOSExample& AliAnalysisTaskPHOSExample::operator = (const AliAnalysisTaskPHOSExample& ap) +{ +// assignment operator + + this->~AliAnalysisTaskPHOSExample(); + new(this) AliAnalysisTaskPHOSExample(ap); + return *this; +} + +//______________________________________________________________________________ +AliAnalysisTaskPHOSExample::~AliAnalysisTaskPHOSExample() +{ + // dtor + if(fOutputList) { + fOutputList->Clear() ; + delete fOutputList ; + } +} + + +//________________________________________________________________________ +void AliAnalysisTaskPHOSExample::UserCreateOutputObjects() +{ + // Create the outputs containers + //AODs + fAODPhotons = new TClonesArray("AliAODPhoton", 0); + fAODPhotons->SetName("Photons"); + AddAODBranch("TClonesArray", fAODPhotons); + + OpenFile(1) ; + + fhPHOSPos = new TNtuple("PHOSPos" , "Position in PHOS" , "x:y:z"); + fhPHOS = new TNtuple("PHOS" , "PHOS" , "event:digits:clusters:photons"); + fhPHOSEnergy = new TH1D("PHOSEnergy" , "PHOSEnergy" , 100, 0., 100. ) ; + fhPHOSDigits = new TH1I("PHOSDigitsCluster" , "PHOSDigits" , 20 , 0 , 20 ) ; + fhPHOSRecParticles = new TH1D("PHOSRecParticles" , "PHOSRecParticles" , 20 , 0., 20. ) ; + fhPHOSPhotons = new TH1I("PHOSPhotons" , "PHOSPhotons" , 20 , 0 , 20 ) ; + fhPHOSInvariantMass = new TH1D("PHOSInvariantMass" , "PHOSInvariantMass" , 400, 0., 400.) ; + fhPHOSDigitsEvent = new TH1I("PHOSDigitsEvent" , "PHOSDigitsEvent" , 30 , 0 , 30 ) ; + + // create output container + + fOutputList = new TList() ; + fOutputList->SetName(GetName()) ; + + fOutputList->AddAt(fhPHOSPos, 0) ; + fOutputList->AddAt(fhPHOS, 1) ; + fOutputList->AddAt(fhPHOSEnergy, 2) ; + fOutputList->AddAt(fhPHOSDigits, 3) ; + fOutputList->AddAt(fhPHOSRecParticles, 4) ; + fOutputList->AddAt(fhPHOSPhotons, 5) ; + fOutputList->AddAt(fhPHOSInvariantMass, 6) ; + fOutputList->AddAt(fhPHOSDigitsEvent, 7) ; +} + +//______________________________________________________________________________ +void AliAnalysisTaskPHOSExample::UserExec(Option_t *) +{ + // Processing of one event + + // if ( !((Entry()-1)%100) ) + AliInfo(Form(" Processing event # %lld", Entry())) ; + AliESDEvent* esd = (AliESDEvent*)InputEvent(); + + //************************ PHOS ************************************* + TRefArray * caloClustersArr = new TRefArray(); + esd->GetPHOSClusters(caloClustersArr); + + const Int_t kNumberOfPhosClusters = caloClustersArr->GetEntries() ; + + TVector3 ** phosVector = new TVector3*[kNumberOfPhosClusters] ; + Float_t * phosPhotonsEnergy = new Float_t[kNumberOfPhosClusters] ; + Int_t phosCluster ; + Int_t numberOfDigitsInPhos = 0 ; + Double_t v[3] ; //vertex ; + esd->GetVertex()->GetXYZ(v) ; + + fPhotonsInPhos = 0 ; + // loop over the PHOS Cluster + for(phosCluster = 0 ; phosCluster < kNumberOfPhosClusters ; phosCluster++) { + AliESDCaloCluster * caloCluster = (AliESDCaloCluster *) caloClustersArr->At(phosCluster) ; + + //AliESDCaloCluster * caloCluster = fESD->GetCaloCluster(phosCluster) ; + if (caloCluster) { + Float_t pos[3] ; + caloCluster->GetPosition( pos ) ; + fhPHOSEnergy->Fill( caloCluster->E() ) ; + fhPHOSPos->Fill( pos[0], pos[1], pos[2] ) ; + fhPHOSDigits->Fill(Entry(), caloCluster->GetNCells() ) ; + numberOfDigitsInPhos += caloCluster->GetNCells() ; + Double_t * pid = caloCluster->GetPid() ; + if(pid[AliPID::kPhoton] > GetPhotonId() ) { + phosVector[fPhotonsInPhos] = new TVector3(pos[0],pos[1],pos[2]) ; + phosPhotonsEnergy[fPhotonsInPhos]=caloCluster->E() ; + TLorentzVector momentum ; + caloCluster->GetMomentum(momentum, v); + new ((*fAODPhotons)[fPhotonsInPhos++]) AliAODPhoton (momentum); + } + } + } //PHOS clusters + + fhPHOSRecParticles->Fill(kNumberOfPhosClusters); + fhPHOSPhotons->Fill(fPhotonsInPhos); + fhPHOSDigitsEvent->Fill(numberOfDigitsInPhos); + fhPHOS->Fill(Entry(), numberOfDigitsInPhos, kNumberOfPhosClusters, fPhotonsInPhos) ; + + // invariant Mass + if (fPhotonsInPhos > 1 ) { + Int_t phosPhoton1, phosPhoton2 ; + for(phosPhoton1 = 0 ; phosPhoton1 < fPhotonsInPhos ; phosPhoton1++) { + for(phosPhoton2 = phosPhoton1 + 1 ; phosPhoton2 < fPhotonsInPhos ; phosPhoton2++) { + Float_t tempMass = TMath::Sqrt( 2 * phosPhotonsEnergy[phosPhoton1] * phosPhotonsEnergy[phosPhoton2] * + ( 1 - TMath::Cos(phosVector[phosPhoton1]->Angle(*phosVector[phosPhoton2])) ) + ); + fhPHOSInvariantMass->Fill(tempMass*1000.); + } + } + } + + PostData(1, fOutputList); + + delete [] phosVector ; + delete [] phosPhotonsEnergy ; + +} + + +//______________________________________________________________________________ +void AliAnalysisTaskPHOSExample::Init() +{ + // Intialisation of parameters + AliInfo("Doing initialisation") ; + SetPhotonId(0.9) ; +} + +//______________________________________________________________________________ +void AliAnalysisTaskPHOSExample::Terminate(Option_t *) +{ + // Processing when the event loop is ended + + Bool_t problem = kFALSE ; + AliInfo(Form(" *** %s Report:", GetName())) ; + printf(" PHOSEnergy Mean : %5.3f , RMS : %5.3f \n", fhPHOSEnergy->GetMean(), fhPHOSEnergy->GetRMS() ) ; + printf(" PHOSDigits Mean : %5.3f , RMS : %5.3f \n", fhPHOSDigits->GetMean(), fhPHOSDigits->GetRMS() ) ; + printf(" PHOSRecParticles Mean : %5.3f , RMS : %5.3f \n", fhPHOSRecParticles->GetMean(), fhPHOSRecParticles->GetRMS() ) ; + printf(" PHOSPhotons Mean : %5.3f , RMS : %5.3f \n", fhPHOSPhotons->GetMean(), fhPHOSPhotons->GetRMS() ) ; + printf(" PHOSInvariantMass Mean : %5.3f , RMS : %5.3f \n", fhPHOSInvariantMass->GetMean(), fhPHOSInvariantMass->GetRMS() ) ; + printf(" PHOSDigitsEvent Mean : %5.3f , RMS : %5.3f \n", fhPHOSDigitsEvent->GetMean(), fhPHOSDigitsEvent->GetRMS() ) ; + + TCanvas * cPHOS = new TCanvas("cPHOS", "PHOS ESD Test", 400, 10, 600, 700) ; + cPHOS->Divide(3, 2); + + cPHOS->cd(1) ; + if ( fhPHOSEnergy->GetMaximum() > 0. ) + gPad->SetLogy(); + fhPHOSEnergy->SetAxisRange(0, 25.); + fhPHOSEnergy->SetLineColor(2); + fhPHOSEnergy->Draw(); + + cPHOS->cd(2) ; + fhPHOSDigits->SetAxisRange(0,25.); + fhPHOSDigits->SetLineColor(2); + fhPHOSDigits->Draw(); + + cPHOS->cd(3) ; + if ( fhPHOSRecParticles->GetMaximum() > 0. ) + gPad->SetLogy(); + fhPHOSRecParticles->SetAxisRange(0, 25.); + fhPHOSRecParticles->SetLineColor(2); + fhPHOSRecParticles->Draw(); + + cPHOS->cd(4) ; + if ( fhPHOSPhotons->GetMaximum() > 0. ) + gPad->SetLogy(); + fhPHOSPhotons->SetAxisRange(0,25.); + fhPHOSPhotons->SetLineColor(2); + fhPHOSPhotons->Draw(); + + cPHOS->cd(5) ; + fhPHOSInvariantMass->SetLineColor(2); + fhPHOSInvariantMass->Draw(); + + cPHOS->cd(6) ; + if ( fhPHOSDigitsEvent->GetMaximum() > 0. ) + gPad->SetLogy(); + fhPHOSDigitsEvent->SetAxisRange(0,40.); + fhPHOSDigitsEvent->SetLineColor(2); + fhPHOSDigitsEvent->Draw(); + + cPHOS->Print("PHOS.eps"); + + char line[1024] ; + sprintf(line, ".!tar -zcf %s.tar.gz *.eps", GetName()) ; + gROOT->ProcessLine(line); + sprintf(line, ".!rm -fR *.eps"); + gROOT->ProcessLine(line); + + AliInfo(Form("!!! All the eps files are in %s.tar.gz !!!", GetName())) ; + + char * report ; + if(problem) + report="Problems found, please check!!!"; + else + report="OK"; + + AliInfo(Form("*** %s Summary Report: %s \n",GetName(), report)) ; +} diff --git a/PWG4/AliAnalysisTaskPHOSExample.h b/PWG4/AliAnalysisTaskPHOSExample.h new file mode 100644 index 00000000000..19f396128ab --- /dev/null +++ b/PWG4/AliAnalysisTaskPHOSExample.h @@ -0,0 +1,62 @@ +#ifndef ALIANALYSISTASKPHOSEXAMPLE_H +#define ALIANALYSISTASKPHOSEXAMPLE_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +//______________________________________________________________________________ +// A basic analysis task to analyse photon detected by PHOS +// A basic analysis task to analyse photon detected by PHOS +// Adapted for AliAnalysisTaskSE and AOD production +// by Gustavo Conesa +// +//*-- Yves Schutz +////////////////////////////////////////////////////////////////////////////// + +#include +#include "AliAnalysisTaskSE.h" + +class AliESDEvent ; +class AliAODEvent ; +class TNtuple ; +class TH1D ; +class TH1I ; + +class AliAnalysisTaskPHOSExample : public AliAnalysisTaskSE { + +public: + AliAnalysisTaskPHOSExample() ; + AliAnalysisTaskPHOSExample(const char *name) ; + AliAnalysisTaskPHOSExample(const AliAnalysisTaskPHOSExample& ap) ; + AliAnalysisTaskPHOSExample& operator = (const AliAnalysisTaskPHOSExample& ap) ; + virtual ~AliAnalysisTaskPHOSExample() ; + + virtual void UserCreateOutputObjects(); + virtual void Init() ; + virtual void LocalInit() { Init() ; } + virtual void UserExec(Option_t * opt = "") ; + const Float_t GetPhotonId() const { return fPhotonId ; } + void SetDebugLevel(Int_t level) { fDebug = level ; } + void SetPhotonId(Float_t threshold) { fPhotonId = threshold ; } + virtual void Terminate(Option_t * opt = "") ; + +private: + // input and output + Int_t fDebug ; // Debug flag + TClonesArray * fAODPhotons ; //! reconstructed photons + Int_t fPhotonsInPhos ; //! number of photons found + // task parameters + Float_t fPhotonId ; // threshold for photon identification + + // Histograms + TList * fOutputList ; //! output data list + TNtuple * fhPHOSPos ; // PHOS (x,y) + TNtuple * fhPHOS ; // all PHOS parameters + TH1D * fhPHOSEnergy ; // PHOS energy + TH1I * fhPHOSDigits ; // PHOS numer of SDigits + TH1D * fhPHOSRecParticles ;// PHOS number of RecParticles + TH1I * fhPHOSPhotons ; // PHOS number of photons + TH1D * fhPHOSInvariantMass ;// PHOS invariant mass + TH1I * fhPHOSDigitsEvent ; //PHOS numbet of Sdigits per event + + ClassDef(AliAnalysisTaskPHOSExample, 1); // a PHOS photon analysis task +}; +#endif // ALIANALYSISTASKPHOSEXAMPLE_H diff --git a/PWG4/AliAnalysisTaskParticleCorrelation.cxx b/PWG4/AliAnalysisTaskParticleCorrelation.cxx new file mode 100644 index 00000000000..a2b4d655c04 --- /dev/null +++ b/PWG4/AliAnalysisTaskParticleCorrelation.cxx @@ -0,0 +1,155 @@ +/************************************************************************** + * 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. * + **************************************************************************/ + +// root +#include +#include +#include +#include +#include +#include + +// analysis +#include "AliAnalysisTaskParticleCorrelation.h" +#include "AliAnalysisManager.h" +#include "AliESDInputHandler.h" +#include "AliMCEventHandler.h" +#include "AliMCEvent.h" +#include "AliAnaMaker.h" +#include "AliCaloTrackReader.h" +#include "AliESDEvent.h" +#include "AliAODEvent.h" +#include "AliAODHandler.h" +#include "AliStack.h" +#include "AliLog.h" + +ClassImp(AliAnalysisTaskParticleCorrelation) + +//////////////////////////////////////////////////////////////////////// + + AliAnalysisTaskParticleCorrelation::AliAnalysisTaskParticleCorrelation(): + AliAnalysisTaskSE(), + fAna(0x0), + fOutputContainer(0x0), + fAODBranch(0x0), + fConfigName(0) +{ + // Default constructor +} + +//_____________________________________________________ +AliAnalysisTaskParticleCorrelation::AliAnalysisTaskParticleCorrelation(const char* name): + AliAnalysisTaskSE(name), + fAna(0x0), + fOutputContainer(0x0), + fAODBranch(0x0), + fConfigName("ConfigAnalysis") +{ + // Default constructor + + DefineOutput(1, TList::Class()); + +} + +//_____________________________________________________ +AliAnalysisTaskParticleCorrelation::~AliAnalysisTaskParticleCorrelation() +{ + // Remove all pointers + + if(fOutputContainer){ + fOutputContainer->Clear() ; + delete fOutputContainer ; + } + +} + +//_____________________________________________________ +void AliAnalysisTaskParticleCorrelation::UserCreateOutputObjects() +{ + // Create the output container + if (fDebug > 1) printf("AnalysisTaskParticleCorrelation::CreateOutputData() \n"); + + //AODs + fAODBranch = new TClonesArray("AliAODParticleCorrelation", 0); + fAODBranch->SetName(fAna->GetAODBranchName()); + AddAODBranch("TClonesArray", fAODBranch); + fAna->SetAODBranch(fAODBranch); + + //Histograms container + OpenFile(1); + fOutputContainer = fAna->GetOutputContainer(); + +} + +//_____________________________________________________ +void AliAnalysisTaskParticleCorrelation::Init() +{ + // Initialization + if (fDebug > 1) printf("AnalysisTaskParticleCorrelation::Init() \n"); + + // Call configuration file + + if(fConfigName == ""){ + fConfigName="ConfigAnalysis"; + } + + AliInfo(Form("### Configuration file is %s.C ###", fConfigName.Data())); + gROOT->LoadMacro(fConfigName+".C"); + fAna = (AliAnaMaker*) gInterpreter->ProcessLine("ConfigAnalysis()"); + + if(!fAna) + AliFatal("Analysis pointer not initialized, abort analysis!"); + + // Initialise analysis + fAna->Init(); + + AliDebug(1,"End"); + +} + + +//_____________________________________________________ +void AliAnalysisTaskParticleCorrelation::UserExec(Option_t */*option*/) +{ + // Execute analysis for current event + // + if (fDebug > 1) printf("AnalysisTaskParticleCorrelation::Exec() \n"); + + //Get the type of data, check if type is correct + Int_t datatype = fAna->GetReader()->GetDataType(); + if(datatype != AliCaloTrackReader::kESD && datatype != AliCaloTrackReader::kAOD && + datatype != AliCaloTrackReader::kMC){ + AliFatal("Wrong type of data"); + return ; + } + + fAna->GetReader()->SetInputEvent(InputEvent(), AODEvent(), MCEvent()); + + //Process event + fAna->ProcessEvent((Int_t) Entry()); + + PostData(1, fOutputContainer); + +} + +//_____________________________________________________ +void AliAnalysisTaskParticleCorrelation::Terminate(Option_t */*option*/) +{ + // Terminate analysis + // + AliDebug(1,"Do nothing in Terminate"); + //fAna->Terminate(); +} + diff --git a/PWG4/AliAnalysisTaskParticleCorrelation.h b/PWG4/AliAnalysisTaskParticleCorrelation.h new file mode 100644 index 00000000000..9edebaa8468 --- /dev/null +++ b/PWG4/AliAnalysisTaskParticleCorrelation.h @@ -0,0 +1,42 @@ +#ifndef AliAnalysisTaskParticleCorrelation_H +#define AliAnalysisTaskParticleCorrelation_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +#include "AliAnalysisTaskSE.h" +class AliAnaMaker; +class AliESDEvent; +class AliAODEvent; +class TList; + +class AliAnalysisTaskParticleCorrelation : public AliAnalysisTaskSE +{ + public: + AliAnalysisTaskParticleCorrelation(); + AliAnalysisTaskParticleCorrelation(const char* name); + virtual ~AliAnalysisTaskParticleCorrelation() ;// virtual dtor + + // Implementation of interface methods + virtual void UserCreateOutputObjects(); + virtual void Init(); + virtual void LocalInit() {Init();} + virtual void UserExec(Option_t *option); + virtual void Terminate(Option_t *option); + + void SetConfigFileName(TString name ) {fConfigName = name ; } + TString GetConfigFileName() const {return fConfigName ; } + + private: + AliAnalysisTaskParticleCorrelation(const AliAnalysisTaskParticleCorrelation&); // Not implemented + AliAnalysisTaskParticleCorrelation& operator=(const AliAnalysisTaskParticleCorrelation&); // Not implemented + + AliAnaMaker* fAna; // Pointer to the jet finder + TList * fOutputContainer ; // Histogram container + TClonesArray * fAODBranch; //AOD branch + TString fConfigName ; //Configuration file name + + ClassDef(AliAnalysisTaskParticleCorrelation, 1); // Analysis task for standard gamma correlation analysis +}; + +#endif //AliAnalysisTaskParticleCorrelation_H diff --git a/PWG4/AliCaloPID.cxx b/PWG4/AliCaloPID.cxx new file mode 100644 index 00000000000..ba80b5a71e6 --- /dev/null +++ b/PWG4/AliCaloPID.cxx @@ -0,0 +1,262 @@ +/************************************************************************** + * 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. * + **************************************************************************/ +/* $Id: AliCaloPID.cxx 21839 2007-10-29 13:49:42Z gustavo $ */ + +/* History of cvs commits: + * + * $Log$ + * + * + */ + +//_________________________________________________________________________ +// Class for track/cluster acceptance selection +// Selection in Central barrel, EMCAL and PHOS +// +//*-- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- +#include +#include +#include +#include + +//---- ANALYSIS system ---- +#include "AliLog.h" +#include "AliCaloPID.h" +#include "AliAODCluster.h" + +ClassImp(AliCaloPID) + + +//________________________________________________ +AliCaloPID::AliCaloPID() : + TObject(), fEMCALPhotonWeight(0.), fEMCALPi0Weight(0.), + fEMCALElectronWeight(0.), fEMCALChargeWeight(0.), + fEMCALNeutralWeight(0.), + fPHOSPhotonWeight(0.), fPHOSPi0Weight(0.), + fPHOSElectronWeight(0.), fPHOSChargeWeight(0.) , + fPHOSNeutralWeight(0.), fPHOSWeightFormula(0), + fPHOSPhotonWeightFormula(0x0), fPHOSPi0WeightFormula(0x0) +{ + //Ctor + + //Initialize parameters + InitParameters(); +} + +//____________________________________________________________________________ +AliCaloPID::AliCaloPID(const AliCaloPID & pid) : + TObject(pid), fEMCALPhotonWeight(pid.fEMCALPhotonWeight), + fEMCALPi0Weight(pid.fEMCALPi0Weight), + fEMCALElectronWeight(pid.fEMCALElectronWeight), + fEMCALChargeWeight(pid.fEMCALChargeWeight), + fEMCALNeutralWeight(pid.fEMCALNeutralWeight), + fPHOSPhotonWeight(pid.fPHOSPhotonWeight), + fPHOSPi0Weight(pid.fPHOSPi0Weight), + fPHOSElectronWeight(pid.fPHOSElectronWeight), + fPHOSChargeWeight(pid.fPHOSChargeWeight), + fPHOSNeutralWeight(pid.fPHOSNeutralWeight), + fPHOSWeightFormula(pid.fPHOSWeightFormula), + fPHOSPhotonWeightFormula(pid.fPHOSPhotonWeightFormula), + fPHOSPi0WeightFormula(pid.fPHOSPi0WeightFormula) + + +{ + // cpy ctor + +} + +//_________________________________________________________________________ +AliCaloPID & AliCaloPID::operator = (const AliCaloPID & pid) +{ + // assignment operator + + if(&pid == this) return *this; + + fEMCALPhotonWeight = pid. fEMCALPhotonWeight ; + fEMCALPi0Weight = pid.fEMCALPi0Weight ; + fEMCALElectronWeight = pid.fEMCALElectronWeight; + fEMCALChargeWeight = pid.fEMCALChargeWeight; + fEMCALNeutralWeight = pid.fEMCALNeutralWeight; + + fPHOSPhotonWeight = pid.fPHOSPhotonWeight ; + fPHOSPi0Weight = pid.fPHOSPi0Weight ; + fPHOSElectronWeight = pid.fPHOSElectronWeight; + fPHOSChargeWeight = pid.fPHOSChargeWeight; + fPHOSNeutralWeight = pid.fPHOSNeutralWeight; + + fPHOSWeightFormula = pid.fPHOSWeightFormula; + fPHOSPhotonWeightFormula = pid.fPHOSPhotonWeightFormula; + fPHOSPi0WeightFormula = pid.fPHOSPi0WeightFormula; + + return *this; + +} + +//_________________________________ +AliCaloPID::~AliCaloPID() { + //Dtor + + if(fPHOSPhotonWeightFormula) delete fPHOSPhotonWeightFormula ; + if(fPHOSPi0WeightFormula) delete fPHOSPi0WeightFormula ; + +} + + +//_______________________________________________________________ +void AliCaloPID::InitParameters() +{ + //Initialize the parameters of the PID. + + fEMCALPhotonWeight = 0.8 ; + fEMCALPi0Weight = 0.5 ; + fEMCALElectronWeight = 0.8 ; + fEMCALChargeWeight = 0.5 ; + fEMCALNeutralWeight = 0.5 ; + + fPHOSPhotonWeight = 0.75 ; + fPHOSPi0Weight = 0.8 ; + fPHOSElectronWeight = 0.5 ; + fPHOSChargeWeight = 0.5 ; + fPHOSNeutralWeight = 0.5 ; + + //Formula to set the PID weight threshold for photon or pi0 + fPHOSWeightFormula = kTRUE; + fPHOSPhotonWeightFormula = + new TFormula("photonWeight","0.98*(x<40)+ 0.68*(x>=100)+(x>=40 && x<100)*(0.98+x*(6e-3)-x*x*(2e-04)+x*x*x*(1.1e-06))"); + fPHOSPi0WeightFormula = + new TFormula("pi0Weight","0.98*(x<65)+ 0.915*(x>=100)+(x>=65 && x-x*(1.95e-3)-x*x*(4.31e-05)+x*x*x*(3.61e-07))"); +} + + +//________________________________________________________________ +void AliCaloPID::Print(const Option_t * opt) const +{ + + //Print some relevant parameters set for the analysis + if(! opt) + return; + + printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ; + + printf("PHOS PID weight , photon %0.2f, pi0 %0.2f, e %0.2f, charge %0.2f, neutral %0.2f \n", + fPHOSPhotonWeight, fPHOSPi0Weight, + fPHOSElectronWeight, fPHOSChargeWeight, fPHOSNeutralWeight) ; + printf("EMCAL PID weight, photon %0.2f, pi0 %0.2f, e %0.2f, charge %0.2f, neutral %0.2f\n", + fEMCALPhotonWeight, fEMCALPi0Weight, + fEMCALElectronWeight, fEMCALChargeWeight, fEMCALNeutralWeight) ; + + printf("PHOS Parametrized weight on? = %d\n", fPHOSWeightFormula) ; +// if(fPHOSWeightFormula){ +// printf(">>>>>>>>>>> Photon weight formula<<<<<<<<<<<<\n"); +// fPHOSPhotonWeightFormula->Print(); +// printf(">>>>>>>>>>> Pi0 weight formula<<<<<<<<<<<<\n"); +// fPHOSPhotonWeightFormula->Print(); +// } + printf(" \n"); + +} + +//_______________________________________________________________ +Int_t AliCaloPID::GetPdg(const TString calo, const Double_t * pid, const Float_t energy) const { + //Return most probable identity of the particle. + + if(!pid) AliFatal("pid pointer not initialized!!!"); + + Float_t wPh = fPHOSPhotonWeight ; + Float_t wPi0 = fPHOSPi0Weight ; + Float_t wE = fPHOSElectronWeight ; + Float_t wCh = fPHOSChargeWeight ; + Float_t wNe = fPHOSNeutralWeight ; + + + if(calo == "PHOS" && fPHOSWeightFormula){ + wPh = fPHOSPhotonWeightFormula->Eval(energy) ; + wPi0 = fPHOSPi0WeightFormula->Eval(energy); + } + + if(calo == "EMCAL"){ + + wPh = fEMCALPhotonWeight ; + wPi0 = fEMCALPi0Weight ; + wE = fEMCALElectronWeight ; + wCh = fEMCALChargeWeight ; + wNe = fEMCALNeutralWeight ; + + } + +// printf("PID: calo %s, ph %0.2f, pi0 %0.2f, el %0.2f, conv el %0.2f, hadrons: pion %0.2f, kaon %0.2f, proton %0.2f , neutron %0.2f, kaon %0.2f \n", +// calo.Data(),pid[AliAODCluster::kPhoton], pid[AliAODCluster::kPi0], +// pid[AliAODCluster::kElectron], pid[AliAODCluster::kEleCon], +// pid[AliAODCluster::kPion], pid[AliAODCluster::kKaon], pid[AliAODCluster::kProton], +// pid[AliAODCluster::kNeutron], pid[AliAODCluster::kKaon0]); + + Int_t pdg = kNeutralUnknown ; + Float_t chargedHadronWeight = pid[AliAODCluster::kProton]+pid[AliAODCluster::kKaon]+ + pid[AliAODCluster::kPion]+pid[AliAODCluster::kMuon]; + Float_t neutralHadronWeight = pid[AliAODCluster::kNeutron]+pid[AliAODCluster::kKaon0]; + Float_t allChargedWeight = pid[AliAODCluster::kElectron]+pid[AliAODCluster::kEleCon]+ chargedHadronWeight; + Float_t allNeutralWeight = pid[AliAODCluster::kPhoton]+pid[AliAODCluster::kPi0]+ neutralHadronWeight; + + //Select most probable ID + if(calo=="PHOS"){ + if(pid[AliAODCluster::kPhoton] > wPh) pdg = kPhoton ; + else if(pid[AliAODCluster::kPi0] > wPi0) pdg = kPi0 ; + else if(pid[AliAODCluster::kElectron] > wE) pdg = kElectron ; + else if(pid[AliAODCluster::kEleCon] > wE) pdg = kEleCon ; + else if(chargedHadronWeight > wCh) pdg = kChargedHadron ; + else if(neutralHadronWeight > wNe) pdg = kNeutralHadron ; + else if(allChargedWeight > allNeutralWeight) + pdg = kChargedUnknown ; + else + pdg = kNeutralUnknown ; + } + else{//EMCAL + //Temporal solution, electrons and photons not differenciated + if(pid[AliAODCluster::kPhoton] + pid[AliAODCluster::kElectron] > wPh) pdg = kPhoton ; + else if(pid[AliAODCluster::kPi0] > wPi0) pdg = kPi0 ; + else if(chargedHadronWeight + neutralHadronWeight > wCh) pdg = kChargedHadron ; + else if(neutralHadronWeight + chargedHadronWeight > wNe) pdg = kNeutralHadron ; + else pdg = kNeutralUnknown ; + + } + + + //printf("Final Pdg: %d \n", pdg); + + + + return pdg ; + +} + +//_______________________________________________________________ +Int_t AliCaloPID::GetPdg(const TString calo, const TLorentzVector mom, const Double_t l0, + const Double_t l1, const Double_t disp, const Double_t tof, + const Double_t distCPV) const { + //Recalculated PID with all parameters + + if(calo == "EMCAL") { + if(l0 < 0.25) return kPhoton ; + else return kNeutralHadron ; + } + + return kNeutralHadron ; + +} + diff --git a/PWG4/AliCaloPID.h b/PWG4/AliCaloPID.h new file mode 100644 index 00000000000..22a61c29565 --- /dev/null +++ b/PWG4/AliCaloPID.h @@ -0,0 +1,124 @@ +#ifndef ALICALOPID_H +#define ALICALOPID_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +/* History of cvs commits: + * + * $Log$ + * + * + */ + +//_________________________________________________________________________ +// Class for track/cluster acceptance selection +// Selection in Central barrel, EMCAL and PHOS +// +//*-- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- +#include +class TString ; +class Riostream ; +class TLorentzVector ; +class TFormula ; + +//--- AliRoot system --- +class AliLog ; + +class AliCaloPID : public TObject { + +public: + + AliCaloPID() ; // ctor + AliCaloPID(const AliCaloPID & g) ; // cpy ctor + AliCaloPID & operator = (const AliCaloPID & g) ;//cpy assignment + virtual ~AliCaloPID() ;//virtual dtor + + enum PidType { + kPhoton = 22, + kPi0 = 111, + kEta = 221, + kElectron = 11, + kEleCon = -11, + kNeutralHadron = 2112, + kChargedHadron = 211, + kNeutralUnknown = 130, + kChargedUnknown=321 + }; + + enum PhotonStatusType { + kPromptPhoton=2, + kFragmentPhoton=3, + kPi0DecayPhoton=4, + kEtaDecayPhoton=5, + kOtherDecayPhoton=6, + kUnknown=7 + }; + + void InitParameters(); + + void Print(const Option_t * opt)const; + + Int_t GetPdg(const TString calo, const Double_t * pid, const Float_t energy) const ; + Int_t GetPdg(const TString calo, const TLorentzVector mom, const Double_t l0, const Double_t l1, const Double_t disp, const Double_t tof, const Double_t distCPV) const ; + + //Weight getters + Float_t GetEMCALPhotonWeight() const { return fEMCALPhotonWeight ; } + Float_t GetEMCALPi0Weight() const { return fEMCALPi0Weight ; } + Float_t GetEMCALElectronWeight() const { return fEMCALElectronWeight ; } + Float_t GetEMCALChargeWeight() const { return fEMCALChargeWeight ; } + Float_t GetEMCALNeutralWeight() const { return fEMCALNeutralWeight ; } + Float_t GetPHOSPhotonWeight() const { return fPHOSPhotonWeight ; } + Float_t GetPHOSPi0Weight() const { return fPHOSPi0Weight ; } + Float_t GetPHOSElectronWeight() const { return fPHOSElectronWeight ; } + Float_t GetPHOSChargeWeight() const { return fPHOSChargeWeight ; } + Float_t GetPHOSNeutralWeight() const { return fPHOSNeutralWeight ; } + + Bool_t IsPHOSPIDWeightFormulaOn() const { return fPHOSWeightFormula ; } + TFormula * GetPHOSPhotonWeightFormula() const { return fPHOSPhotonWeightFormula ; } + TFormula * GetPHOSPi0WeightFormula() const { return fPHOSPi0WeightFormula ; } + + //Weight setters + void SetEMCALPhotonWeight(Float_t w){ fEMCALPhotonWeight = w ; } + void SetEMCALPi0Weight(Float_t w){ fEMCALPi0Weight = w ; } + void SetEMCALElectronWeight(Float_t w){ fEMCALElectronWeight = w ; } + void SetEMCALChargeWeight(Float_t w){ fEMCALChargeWeight = w ; } + void SetEMCALNeutralWeight(Float_t w){ fEMCALNeutralWeight = w ; } + void SetPHOSPhotonWeight(Float_t w){ fPHOSPhotonWeight = w ; } + void SetPHOSPi0Weight(Float_t w){ fPHOSPi0Weight = w ; } + void SetPHOSElectronWeight(Float_t w){ fPHOSElectronWeight = w ; } + void SetPHOSChargeWeight(Float_t w){ fPHOSChargeWeight = w ; } + void SetPHOSNeutralWeight(Float_t w){ fPHOSNeutralWeight = w ; } + + void UsePHOSPIDWeightFormula(Bool_t par) { fPHOSWeightFormula = par; } + void SetPHOSPhotonWeightFormula(TFormula * photon) { fPHOSPhotonWeightFormula = photon; } + void SetPHOSPi0WeightFormula(TFormula * pi0) { fPHOSPi0WeightFormula = pi0; } + + private: + + Float_t fEMCALPhotonWeight; //Bayesian PID weight for photons in EMCAL + Float_t fEMCALPi0Weight; //Bayesian PID weight for pi0 in EMCAL + Float_t fEMCALElectronWeight; //Bayesian PID weight for electrons in EMCAL + Float_t fEMCALChargeWeight; //Bayesian PID weight for charged hadrons in EMCAL + Float_t fEMCALNeutralWeight; //Bayesian PID weight for neutral hadrons in EMCAL + Float_t fPHOSPhotonWeight; //Bayesian PID weight for photons in PHOS + Float_t fPHOSPi0Weight; //Bayesian PID weight for pi0 in PHOS + Float_t fPHOSElectronWeight; //Bayesian PID weight for electrons in PHOS + Float_t fPHOSChargeWeight; //Bayesian PID weight for charged hadrons in PHOS + Float_t fPHOSNeutralWeight; //Bayesian PID weight for neutral hadrons in PHOS + + Bool_t fPHOSWeightFormula ; //Use parametrized weight threshold, function of energy + TFormula * fPHOSPhotonWeightFormula ; //Formula for photon weight + TFormula * fPHOSPi0WeightFormula ; //Formula for pi0 weight + + + ClassDef(AliCaloPID,1) +} ; + + +#endif //ALICALOPID_H + + + diff --git a/PWG4/AliCaloTrackAODReader.cxx b/PWG4/AliCaloTrackAODReader.cxx new file mode 100644 index 00000000000..f7d96f72aaa --- /dev/null +++ b/PWG4/AliCaloTrackAODReader.cxx @@ -0,0 +1,218 @@ + +/************************************************************************** + * 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. * + **************************************************************************/ +/* $Id: $ */ + +/* History of cvs commits: + * + * $Log$ + * + */ + +//_________________________________________________________________________ +// Class for reading data (AODs) in order to do prompt gamma +// or other particle identification and correlations +// +// +//*-- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- + +//---- ANALYSIS system ---- +#include "AliCaloTrackAODReader.h" +#include "AliAODEvent.h" +#include "AliAODVertex.h" +#include "AliAODCaloCluster.h" +#include "AliAODCaloCluster.h" +#include "AliAODTrack.h" +#include "AliMCEvent.h" +#include "AliLog.h" +#include "Riostream.h" + +ClassImp(AliCaloTrackAODReader) + +//____________________________________________________________________________ +AliCaloTrackAODReader::AliCaloTrackAODReader() : + AliCaloTrackReader() +{ + //Default Ctor + + //Initialize parameters + fDataType=kAOD; + +} + +//____________________________________________________________________________ +AliCaloTrackAODReader::AliCaloTrackAODReader(const AliCaloTrackAODReader & g) : + AliCaloTrackReader(g) +{ + // cpy ctor +} + +//_________________________________________________________________________ +AliCaloTrackAODReader & AliCaloTrackAODReader::operator = (const AliCaloTrackAODReader & source) +{ + // assignment operator + + if(&source == this) return *this; + + return *this; + +} + +//____________________________________________________________________________ +void AliCaloTrackAODReader::FillInputCTS() { + //Return array with CTS tracks + fAODCTS = new TClonesArray("AliAODTrack",0); + + Int_t nTracks = fAOD->GetNumberOfTracks() ; + Int_t naod = 0; + Double_t p[3]; + + for (Int_t itrack = 0; itrack < nTracks; itrack++) {////////////// track loop + AliAODTrack * track = fAOD->GetTrack(itrack) ; // retrieve track from esd + + // //We want tracks fitted in the detectors: + // ULong_t status=AliAODTrack::kTPCrefit; + // status|=AliAODTrack::kITSrefit; + + //We want tracks whose PID bit is set: + // ULong_t status =AliAODTrack::kITSpid; + // status|=AliAODTrack::kTPCpid; + + // if ( (track->GetStatus() & status) == status) {//Check if the bits we want are set + + track->GetPxPyPz(p) ; + TLorentzVector momentum(p[0],p[1],p[2],0); + + if(fCTSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"CTS")){ + + if(fDebug > 2 && momentum.Pt() > 0.1)printf("FillInputCTS():: Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + + // AliAODTrack *newtrack = + new((*fAODCTS)[naod++]) AliAODTrack(*track); + + }//Pt and Fidutial cut passed. + //}// track status + }// track loop + if(fDebug > 1) printf("FillInputCTS():: aod entries %d\n", fAODCTS->GetEntries()); +} + +//____________________________________________________________________________ +void AliCaloTrackAODReader::FillInputEMCAL() { + //Return array with EMCAL clusters in aod format + fAODEMCAL = new TClonesArray("AliAODCaloCluster",0); + + TRefArray * caloClusters = new TRefArray(); + fAOD->GetEMCALClusters(caloClusters); + + //Get vertex for momentum calculation + Double_t v[3] ; //vertex ; + GetVertex(v); + + //Loop to select clusters in fidutial cut and fill container with aodClusters + Int_t naod = 0; + + for (Int_t iclus = 0; iclus < caloClusters->GetEntries(); iclus++) { + AliAODCaloCluster * clus = (AliAODCaloCluster *) caloClusters->At(iclus) ; + TLorentzVector momentum ; + clus->GetMomentum(momentum, v); + + if(fEMCALPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"EMCAL")){ + + if(fDebug > 2 && momentum.E() > 0.1)printf("FillInputEMCAL():: Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + + //AliAODCaloCluster *caloCluster = + new((*fAODPHOS)[naod++]) AliAODCaloCluster(*clus); + + }//Pt and Fidutial cut passed. + }//esd cluster loop + + if(fDebug > 1) printf("FillInputEMCAL():: aod entries %d\n", fAODEMCAL->GetEntries()); + +} + +//____________________________________________________________________________ +void AliCaloTrackAODReader::FillInputPHOS() { + //Return array with PHOS clusters in aod format + fAODPHOS = new TClonesArray("AliAODCaloCluster",0); + + TRefArray * caloClusters = new TRefArray(); + fAOD->GetPHOSClusters(caloClusters); + + //Get vertex for momentum calculation + Double_t v[3] ; //vertex ; + GetVertex(v); + + //Loop to select clusters in fidutial cut and fill container with aodClusters + Int_t naod = 0; + + for (Int_t iclus = 0; iclus < caloClusters->GetEntries(); iclus++) { + AliAODCaloCluster * clus = (AliAODCaloCluster *) caloClusters->At(iclus) ; + TLorentzVector momentum ; + clus->GetMomentum(momentum, v); + + if(fPHOSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"PHOS")){ + + if(fDebug > 2 && momentum.E() > 0.1)printf("FillInputPHOS():: Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + + // AliAODCaloCluster *caloCluster = + new((*fAODPHOS)[naod++]) AliAODCaloCluster(*clus); + + }//Pt and Fidutial cut passed. + }//esd cluster loop + + if(fDebug > 1) printf("FillInputPHOS():: aod entries %d\n", fAODPHOS->GetEntries()); + + +} + +//____________________________________________________________________________ +void AliCaloTrackAODReader::FillInputEMCALCells() { + //Return array with EMCAL cells in aod format + + fEMCALCells = (TNamed*) fAOD->GetEMCALCells(); + +} + +//____________________________________________________________________________ +void AliCaloTrackAODReader::FillInputPHOSCells() { + //Return array with PHOS cells in aod format + + fPHOSCells = (TNamed*) fAOD->GetPHOSCells(); + +} + +//____________________________________________________________________________ +void AliCaloTrackAODReader::GetVertex(Double_t v[3]) { + //Return vertex position + + v[0]=fAOD->GetVertex(0)->GetX() ;//CHECK!!! + v[1]=fAOD->GetVertex(0)->GetY() ;//CHECK!!! + v[2]=fAOD->GetVertex(0)->GetZ() ;//CHECK!!! +} + + +//____________________________________________________________________________ +void AliCaloTrackAODReader::SetInputEvent(TObject* aod, TObject* /*aod*/, TObject* mc) { + // Connect the data pointers + SetAOD((AliAODEvent*) aod); + SetMC((AliMCEvent*) mc); +} diff --git a/PWG4/AliCaloTrackAODReader.h b/PWG4/AliCaloTrackAODReader.h new file mode 100644 index 00000000000..68732d785d4 --- /dev/null +++ b/PWG4/AliCaloTrackAODReader.h @@ -0,0 +1,53 @@ +#ifndef AliCaloTrackAODReader_H +#define AliCaloTrackAODReader_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +/* History of cvs commits: + * + * $Log$ + * + */ + +//_________________________________________________________________________ +// Class for reading data (AODs) in order to do prompt gamma or other particle +// identification and correlations +// +// +// -- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- + +// --- AliRoot system --- +#include "AliCaloTrackReader.h" + +class AliCaloTrackAODReader : public AliCaloTrackReader { + + public: + + AliCaloTrackAODReader() ; // ctor + AliCaloTrackAODReader(const AliCaloTrackAODReader & g) ; // cpy ctor + AliCaloTrackAODReader & operator = (const AliCaloTrackAODReader & g) ;//cpy assignment + virtual ~AliCaloTrackAODReader() {;} //virtual dtor + + void FillInputCTS(); + void FillInputEMCAL(); + void FillInputPHOS(); + + void FillInputEMCALCells(); + void FillInputPHOSCells(); + + void GetVertex(Double_t v[3]) ; + + void SetInputEvent(TObject* esd, TObject* aod, TObject* mc) ; + + + ClassDef(AliCaloTrackAODReader,1) + } ; + + +#endif //AliCaloTrackAODReader_H + + + diff --git a/PWG4/AliCaloTrackESDReader.cxx b/PWG4/AliCaloTrackESDReader.cxx new file mode 100644 index 00000000000..6ed8ac0307f --- /dev/null +++ b/PWG4/AliCaloTrackESDReader.cxx @@ -0,0 +1,308 @@ + +/************************************************************************** + * 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. * + **************************************************************************/ +/* $Id: $ */ + +/* History of cvs commits: + * + * $Log$ + * + * + */ + +//_________________________________________________________________________ +// Class for reading data (ESDs) in order to do prompt gamma +// or other particle identification and correlations +// +// +//*-- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- + +//---- ANALYSIS system ---- +#include "AliCaloTrackESDReader.h" +#include "AliESDEvent.h" +#include "AliESDVertex.h" +#include "AliESDCaloCluster.h" +#include "AliAODCaloCluster.h" +#include "AliAODTrack.h" +#include "AliAODEvent.h" +#include "AliMCEvent.h" +#include "AliLog.h" +#include "Riostream.h" + +ClassImp(AliCaloTrackESDReader) + +//____________________________________________________________________________ +AliCaloTrackESDReader::AliCaloTrackESDReader() : + AliCaloTrackReader() +{ + //Default Ctor + + //Initialize parameters + fDataType=kESD; + +} + +//____________________________________________________________________________ +AliCaloTrackESDReader::AliCaloTrackESDReader(const AliCaloTrackESDReader & g) : + AliCaloTrackReader(g) +{ + // cpy ctor +} + +//_________________________________________________________________________ +AliCaloTrackESDReader & AliCaloTrackESDReader::operator = (const AliCaloTrackESDReader & source) +{ + // assignment operator + + if(&source == this) return *this; + + return *this; + +} + +//____________________________________________________________________________ +void AliCaloTrackESDReader::FillInputCTS() { + //Return array with CTS tracks + + fAODCTS = new TClonesArray("AliAODTrack",0); + + Int_t nTracks = fESD->GetNumberOfTracks() ; + Int_t naod = 0; + Double_t pos[3]; + Double_t p[3]; + Double_t covTr[21]; + Double_t pid[10]; + for (Int_t itrack = 0; itrack < nTracks; itrack++) {////////////// track loop + AliESDtrack * track = fESD->GetTrack(itrack) ; // retrieve track from esd + + //We want tracks fitted in the detectors: + ULong_t status=AliESDtrack::kTPCrefit; + status|=AliESDtrack::kITSrefit; + + if ( (track->GetStatus() & status) == status) {//Check if the bits we want are set + + track->GetPxPyPz(p) ; + TLorentzVector momentum(p[0],p[1],p[2],0); + + if(fCTSPtMin < momentum.Pt() &&fFidutialCut->IsInFidutialCut(momentum,"CTS")){ + + if(fDebug > 3 && momentum.Pt() > 0.2)printf("FillInputCTS():: Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + + track->GetXYZ(pos); + track->GetCovarianceXYZPxPyPz(covTr); + track->GetESDpid(pid); + + Float_t impactXY, impactZ; + + track->GetImpactParameters(impactXY,impactZ); + + if (impactXY<3) { + // track inside the beam pipe + + AliAODTrack *aodTrack = new((*fAODCTS)[naod++]) + AliAODTrack(track->GetID(), track->GetLabel(), p, kTRUE, pos, kFALSE,covTr, (Short_t)track->GetSign(), track->GetITSClusterMap(), + pid, + 0x0,//primary, + kTRUE, // check if this is right + kTRUE, // check if this is right + AliAODTrack::kPrimary, + 0); + + aodTrack->SetFlags(track->GetStatus()); + aodTrack->ConvertAliPIDtoAODPID(); + } + else continue; // outside the beam pipe: orphan track + }//Pt and Fidutial cut passed. + }// track status + }// track loop + if(fDebug > 1) printf("FillInputCTS():: aod entries %d\n", fAODCTS->GetEntries()); +} + +//____________________________________________________________________________ +void AliCaloTrackESDReader::FillInputEMCAL() { + //Return array with EMCAL clusters in aod format + + fAODEMCAL = new TClonesArray("AliAODCaloCluster",0); + + TRefArray * caloClusters = new TRefArray(); + fESD->GetEMCALClusters(caloClusters); + + //Get vertex for momentum calculation + Double_t v[3] ; //vertex ; + GetVertex(v); + + //Loop to select clusters in fidutial cut and fill container with aodClusters + Int_t naod = 0; + Float_t pos[3] ; +// Double_t * pid = new Double_t[AliPID::kSPECIESN]; + + for (Int_t iclus = 0; iclus < caloClusters->GetEntries(); iclus++) { + AliESDCaloCluster * clus = (AliESDCaloCluster *) caloClusters->At(iclus) ; + TLorentzVector momentum ; + clus->GetMomentum(momentum, v); + if(fDebug > 3 && momentum.E() > 0.1)printf("FillInputEMCAL():: all clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + if(fEMCALPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"EMCAL")){ + + if(fDebug > 2 && momentum.E() > 0.1)printf("FillInputEMCAL():: Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); +// pid=clus->GetPid(); + clus->GetPosition(pos) ; +// printf("Reader PID ESD: ph %0.2f, pi0 %0.2f, el %0.2f, conv el %0.2f,pi %0.2f, k %0.2f, p %0.2f, k0 %0.2f, n %0.2f, mu %0.2f \n", +// pid[AliPID::kPhoton],pid[AliPID::kPi0], +// pid[AliPID::kElectron],pid[AliPID::kEleCon],pid[AliPID::kPion], +// pid[AliPID::kKaon],pid[AliPID::kProton], pid[AliPID::kKaon0], +// pid[AliPID::kNeutron], pid[AliPID::kMuon]); + Int_t id = clus->GetID(); + Int_t nLabel = clus->GetNLabels(); + Int_t *labels=0x0; + if(clus->GetLabels()) labels = (clus->GetLabels())->GetArray(); + + Float_t energy = clus->E(); + Char_t ttype= AliAODCluster::kEMCALClusterv1; + AliAODCaloCluster *caloCluster = new((*fAODEMCAL)[naod++]) + AliAODCaloCluster(id,nLabel,labels,energy, pos, NULL,ttype,0); + + caloCluster->SetPIDFromESD(clus->GetPid()); + caloCluster->SetCaloCluster(clus->GetDistanceToBadChannel(), clus->GetClusterDisp(), + clus->GetM20(), clus->GetM02(), + clus->GetEmcCpvDistance(), clus->GetNExMax(), clus->GetTOF()) ; + caloCluster->SetNCells(clus->GetNCells()); + caloCluster->SetCellsAbsId(clus->GetCellsAbsId()); + caloCluster->SetCellsAmplitudeFraction(clus->GetCellsAmplitudeFraction()); + + TArrayI* matchedT = clus->GetTracksMatched(); + if (matchedT && clus->GetTrackMatched() > 0) { + for (Int_t im = 0; im < matchedT->GetSize(); im++) { + caloCluster->AddTrackMatched((fESD->GetTrack(im))); + } + } + + }//Pt and Fidutial cut passed. + }//esd cluster loop + + if(fDebug > 1) printf("FillInputEMCAL():: aod entries %d\n", fAODEMCAL->GetEntries()); + +} + +//____________________________________________________________________________ +void AliCaloTrackESDReader::FillInputPHOS() { + //Return array with PHOS clusters in aod format + fAODPHOS = new TClonesArray("AliAODCaloCluster",0); + + TRefArray * caloClusters = new TRefArray(); + fESD->GetPHOSClusters(caloClusters); + + //Get vertex for momentum calculation + Double_t v[3] ; //vertex ; + GetVertex(v); + + //Loop to select clusters in fidutial cut and fill container with aodClusters + Int_t naod = 0; + Float_t pos[3] ; + Double_t * pid = new Double_t[AliPID::kSPECIESN]; + + for (Int_t iclus = 0; iclus < caloClusters->GetEntries(); iclus++) { + AliESDCaloCluster * clus = (AliESDCaloCluster *) caloClusters->At(iclus) ; + TLorentzVector momentum ; + clus->GetMomentum(momentum, v); + if(fDebug > 3 && momentum.E() > 0.1)printf("FillInputPHOS():: all clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + if(fPHOSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"PHOS")){ + + if(fDebug > 2 && momentum.E() > 0.1)printf("FillInputPHOS():: Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + + pid=clus->GetPid(); + // printf("Reader PID ESD: ph %0.2f, pi0 %0.2f, el %0.2f, conv el %0.2f,pi %0.2f, k %0.2f, p %0.2f, k0 %0.2f, n %0.2f, mu %0.2f \n", + // pid[AliPID::kPhoton],pid[AliPID::kPi0], + // pid[AliPID::kElectron],pid[AliPID::kEleCon],pid[AliPID::kPion], + // pid[AliPID::kKaon],pid[AliPID::kProton], pid[AliPID::kKaon0], + // pid[AliPID::kNeutron], pid[AliPID::kMuon]); + + clus->GetPosition(pos) ; + Int_t id = clus->GetID(); + Int_t nLabel = clus->GetNLabels(); + Int_t *labels=0x0; + if(clus->GetLabels()) labels = (clus->GetLabels())->GetArray(); + Float_t energy = clus->E(); + + //Phos cluster type + Char_t ttype= AliAODCluster::kPHOSNeutral; + Float_t wNeutral = pid[AliPID::kNeutron]+ pid[AliPID::kKaon0]+pid[AliPID::kPhoton]+pid[AliPID::kPi0]; + Float_t wCharged = pid[AliPID::kMuon] + pid[AliPID::kElectron] + pid[AliPID::kEleCon]+ + pid[AliPID::kProton]+pid[AliPID::kKaon]+pid[AliPID::kPion]; + if( wCharged > wNeutral) ttype= AliAODCluster::kPHOSCharged; + + AliAODCaloCluster *caloCluster = new((*fAODPHOS)[naod++]) + AliAODCaloCluster(id,nLabel,labels,energy, pos, NULL, ttype, 0); + caloCluster->SetPIDFromESD(clus->GetPid()); + caloCluster->SetCaloCluster(clus->GetDistanceToBadChannel(), clus->GetClusterDisp(), + clus->GetM20(), clus->GetM02(), + clus->GetEmcCpvDistance(), clus->GetNExMax()) ; + caloCluster->SetNCells(clus->GetNCells()); + caloCluster->SetCellsAbsId(clus->GetCellsAbsId()); + caloCluster->SetCellsAmplitudeFraction(clus->GetCellsAmplitudeFraction()); + TArrayI* matchedT = clus->GetTracksMatched(); + if (matchedT) { + for (Int_t im = 0; im < matchedT->GetSize(); im++) { + caloCluster->AddTrackMatched((fESD->GetTrack(im))); + } + } + + }//Pt and Fidutial cut passed. + }//esd cluster loop + if(fDebug > 1) printf("FillInputPHOS():: aod entries %d\n", fAODPHOS->GetEntries()); + + +} + +//____________________________________________________________________________ +void AliCaloTrackESDReader::FillInputEMCALCells() { + //Return array with EMCAL cells in esd format + + fEMCALCells = (TNamed*) fESD->GetEMCALCells(); + +} + +//____________________________________________________________________________ +void AliCaloTrackESDReader::FillInputPHOSCells() { + //Return array with PHOS cells in esd format + + fPHOSCells = (TNamed*) fESD->GetPHOSCells(); + +} + +//____________________________________________________________________________ +void AliCaloTrackESDReader::GetVertex(Double_t v[3]) { + //Return vertex position + + fESD->GetVertex()->GetXYZ(v) ; + +} + + +//____________________________________________________________________________ +void AliCaloTrackESDReader::SetInputEvent(TObject* esd, TObject* aod, TObject* mc) { + // Connect the data pointers + SetESD((AliESDEvent*) esd); + SetAOD ((AliAODEvent*) aod); + SetMC((AliMCEvent*) mc); +} diff --git a/PWG4/AliCaloTrackESDReader.h b/PWG4/AliCaloTrackESDReader.h new file mode 100644 index 00000000000..bf34cce1247 --- /dev/null +++ b/PWG4/AliCaloTrackESDReader.h @@ -0,0 +1,53 @@ +#ifndef AliCaloTrackESDReader_H +#define AliCaloTrackESDReader_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +/* History of cvs commits: + * + * $Log$ + * + * + */ + +//_________________________________________________________________________ +// Class for reading data (ESDs) in order to do prompt gamma +// or other particle identification and correlations +// + +//*-- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- + +// --- AliRoot system --- +#include "AliCaloTrackReader.h" + +class AliCaloTrackESDReader : public AliCaloTrackReader { + + public: + + AliCaloTrackESDReader() ; // ctor + AliCaloTrackESDReader(const AliCaloTrackESDReader & g) ; // cpy ctor + AliCaloTrackESDReader & operator = (const AliCaloTrackESDReader & g) ;//cpy assignment + virtual ~AliCaloTrackESDReader() {;} //virtual dtor + + void FillInputCTS (); + void FillInputEMCAL(); + void FillInputPHOS (); + + void FillInputEMCALCells(); + void FillInputPHOSCells(); + + void GetVertex(Double_t v[3]) ; + + void SetInputEvent(TObject* esd, TObject* aod, TObject* mc) ; + + ClassDef(AliCaloTrackESDReader,1) + } ; + + +#endif //AliCaloTrackESDReader_H + + + diff --git a/PWG4/AliCaloTrackMCReader.cxx b/PWG4/AliCaloTrackMCReader.cxx new file mode 100644 index 00000000000..59148a7a11b --- /dev/null +++ b/PWG4/AliCaloTrackMCReader.cxx @@ -0,0 +1,837 @@ +/************************************************************************** + * 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. * + **************************************************************************/ +/* $Id: $ */ + +/* History of cvs commits: + * + * $Log$ + * + * + */ + +//_________________________________________________________________________ +// Class for reading data (Kinematics) in order to do prompt gamma +// or other particle identification and correlations +// +//*-- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- + +#include +#include +#include +#include +#include + +//---- ANALYSIS system ---- +#include "AliCaloTrackMCReader.h" +#include "Riostream.h" +#include "AliLog.h" +#include "AliGenEventHeader.h" +#include "AliStack.h" +#include "AliAODCaloCluster.h" +#include "AliAODTrack.h" + +ClassImp(AliCaloTrackMCReader) + +//____________________________________________________________________________ +AliCaloTrackMCReader::AliCaloTrackMCReader() : + AliCaloTrackReader(), fDecayPi0(0), + fNeutralParticlesArray(0x0), fChargedParticlesArray(0x0), + fStatusArray(0x0), fKeepAllStatus(0), fClonesArrayType(0) +{ + //Ctor + + //Initialize parameters + InitParameters(); + fDataType = kMC; + +} + +//____________________________________________________________________________ +AliCaloTrackMCReader::AliCaloTrackMCReader(const AliCaloTrackMCReader & g) : + AliCaloTrackReader(g), fDecayPi0(g.fDecayPi0), + fNeutralParticlesArray(g.fNeutralParticlesArray?new TArrayI(*g.fNeutralParticlesArray):0x0), + fChargedParticlesArray(g.fChargedParticlesArray?new TArrayI(*g.fChargedParticlesArray):0x0), + fStatusArray(g.fStatusArray?new TArrayI(*g.fStatusArray):0x0), + fKeepAllStatus(g.fKeepAllStatus), fClonesArrayType(g.fClonesArrayType) +{ + // cpy ctor +} + +//_________________________________________________________________________ +AliCaloTrackMCReader & AliCaloTrackMCReader::operator = (const AliCaloTrackMCReader & source) +{ + // assignment operator + + if(&source == this) return *this; + + fDecayPi0 = source.fDecayPi0; + + delete fChargedParticlesArray; + fChargedParticlesArray = source.fChargedParticlesArray?new TArrayI(*source.fChargedParticlesArray):0x0; + + delete fNeutralParticlesArray; + fNeutralParticlesArray = source.fNeutralParticlesArray?new TArrayI(*source.fNeutralParticlesArray):0x0; + + delete fStatusArray; + fStatusArray = source.fStatusArray?new TArrayI(*source.fStatusArray):0x0; + + fKeepAllStatus = source.fKeepAllStatus ; + fClonesArrayType = source.fClonesArrayType ; + + return *this; + +} + +//_________________________________ +AliCaloTrackMCReader::~AliCaloTrackMCReader() { + //Dtor + + if(fChargedParticlesArray) delete fChargedParticlesArray ; + if(fNeutralParticlesArray) delete fNeutralParticlesArray ; + if(fStatusArray) delete fStatusArray ; + +} + +//____________________________________________________________________________ +void AliCaloTrackMCReader::GetVertex(Double_t v[3]) { + //Return vertex position + + TArrayF pv; + GetGenEventHeader()->PrimaryVertex(pv); + v[0]=pv.At(0); + v[1]=pv.At(1); + v[2]=pv.At(2); + +} + + +//_______________________________________________________________ +void AliCaloTrackMCReader::InitParameters() +{ + + //Initialize the parameters of the analysis. + + fDecayPi0 = kFALSE; + + fChargedParticlesArray = new TArrayI(1); + fChargedParticlesArray->SetAt(11,0); + //Int_t pdgarray[]={12,14,16};// skip neutrinos + //fNeutralParticlesArray = new TArrayI(3, pdgarray); + fNeutralParticlesArray = new TArrayI(3); + fNeutralParticlesArray->SetAt(12,0); fNeutralParticlesArray->SetAt(14,1); fNeutralParticlesArray->SetAt(16,2); + fStatusArray = new TArrayI(1); + fStatusArray->SetAt(1,0); + + fKeepAllStatus = kFALSE; + fClonesArrayType = kAliAOD ; + +} + +//____________________________________________________________________________ +void AliCaloTrackMCReader::FillCalorimeters(const Int_t iParticle, TParticle* particle, TLorentzVector momentum, + Int_t &indexPHOS, Int_t &indexEMCAL){ + //Fill AODCaloClusters or TParticles lists of PHOS or EMCAL + + //In PHOS + if(fFidutialCut->IsInFidutialCut(momentum,"PHOS") && momentum.Pt() > fPHOSPtMin){ + + if(fClonesArrayType == kTParticle) new((*fAODPHOS)[indexPHOS++]) TParticle(*particle) ; + else{ + + Char_t ttype= AliAODCluster::kPHOSNeutral; + Int_t labels[] = {iParticle}; + Float_t x[] = {momentum.X(), momentum.Y(), momentum.Z()}; + AliAODCaloCluster *calo = new((*fAODPHOS)[indexPHOS++]) + AliAODCaloCluster(iParticle,1,labels,momentum.E(), x, NULL, ttype, 0); + SetCaloClusterPID(particle->GetPdgCode(),calo) ; + } + } + //In EMCAL + else if(fFidutialCut->IsInFidutialCut(momentum,"EMCAL") && momentum.Pt() > fEMCALPtMin){ + //cout<<"Reader : E "<GetPdgCode(),calo) ; + } + } +} + +//____________________________________________________________________________ +void AliCaloTrackMCReader::FillInputEvent(Bool_t bCTS, Bool_t bEMCAL, Bool_t bPHOS) +{ + //Create list of particles from EMCAL, PHOS and CTS. + + if(fClonesArrayType == kTParticle){ + fAODCTS = new TClonesArray("TParticle",0); + fAODEMCAL = new TClonesArray("TParticle",0); + fAODPHOS = new TClonesArray("TParticle",0); + } + else if(fClonesArrayType == kAliAOD){ + fAODCTS = new TClonesArray("AliAODTrack",0); + fAODPHOS = new TClonesArray("AliAODCaloCluster",0); + fAODEMCAL = new TClonesArray("AliAODCaloCluster",0); + } + else {AliFatal("Wrong clones type");} + + + Int_t indexCh = 0 ; + Int_t indexEMCAL = 0 ; + Int_t indexPHOS = 0 ; + + Int_t iParticle = 0 ; + Double_t charge = 0.; + + for (iParticle=0 ; iParticle < GetStack()->GetNprimary() ; iParticle++) { + TParticle * particle = GetStack()->Particle(iParticle); + TLorentzVector momentum; + Float_t p[3]; + Float_t x[3]; + Int_t pdg = particle->GetPdgCode(); + + //Keep particles with a given status + if(KeepParticleWithStatus(particle->GetStatusCode()) && (particle->Pt() > 0) ){ + + charge = TDatabasePDG::Instance()->GetParticle(pdg)->Charge(); + particle->Momentum(momentum); + //---------- Charged particles ---------------------- + if((charge != 0) && (momentum.Pt() > fCTSPtMin) && (fFidutialCut->IsInFidutialCut(momentum,"CTS"))){ + //Particles in CTS acceptance + if(fDebug > 3 && momentum.Pt() > 0.2)printf("Fill MC CTS :: Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", + momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); + + if(fClonesArrayType == kTParticle) new((*fAODCTS)[indexCh++]) TParticle(*particle) ; + else{ + x[0] = particle->Vx(); x[1] = particle->Vy(); x[2] = particle->Vz(); + p[0] = particle->Px(); p[1] = particle->Py(); p[2] = particle->Pz(); + AliAODTrack *aodTrack = new((*fAODCTS)[indexCh++]) + AliAODTrack(0, iParticle, p, kTRUE, x, kFALSE,NULL, 0, 0, + NULL, + 0x0,//primary, + kFALSE, // No fit performed + kFALSE, // No fit performed + AliAODTrack::kPrimary, + 0); + SetTrackChargeAndPID(pdg, aodTrack); + } + + //Keep some charged particles in calorimeters lists + if(KeepChargedParticles(pdg)) FillCalorimeters(iParticle, particle, momentum, indexPHOS, indexEMCAL); + + }//Charged + + //-------------Neutral particles ---------------------- + else if(charge == 0){ + + //Skip neutrinos or other neutral particles + if(SkipNeutralParticles(pdg) || particle->IsPrimary()) continue ; // protection added (MG) + + //Fill particle/calocluster arrays + if(!fDecayPi0) FillCalorimeters(iParticle, particle, momentum, indexPHOS, indexEMCAL); + else { + //Sometimes pi0 are stable for the generator, if needed decay it by hand + if(pdg == 111 ){ + if(momentum.Pt() > fPHOSPtMin || momentum.Pt() > fEMCALPtMin){ + TLorentzVector lvGamma1, lvGamma2 ; + //Double_t angle = 0; + + //Decay + MakePi0Decay(momentum,lvGamma1,lvGamma2);//,angle); + + //Check if Pi0 is in the acceptance of the calorimeters, if aperture angle is small, keep it + TParticle * pPhoton1 = new TParticle(22,1,iParticle,0,0,0,lvGamma1.Px(),lvGamma1.Py(), + lvGamma1.Pz(),lvGamma1.E(),0,0,0,0); + TParticle * pPhoton2 = new TParticle(22,1,iParticle,0,0,0,lvGamma2.Px(),lvGamma2.Py(), + lvGamma2.Pz(),lvGamma2.E(),0,0,0,0); + //Fill particle/calocluster arrays + FillCalorimeters(iParticle,pPhoton1,lvGamma1, indexEMCAL,indexPHOS); + FillCalorimeters(iParticle,pPhoton2,lvGamma2, indexEMCAL,indexPHOS); + }//pt cut + }//pi0 + else FillCalorimeters(iParticle,particle, momentum, indexPHOS, indexEMCAL); //Add the rest + } + }//neutral particles + } //particle with correct status + }//particle loop + +} + +//________________________________________________________________ +Bool_t AliCaloTrackMCReader::KeepParticleWithStatus(Int_t status) const { + //Check if status is equal to one of the list + //These particles will be used in analysis. + if(!fKeepAllStatus){ + for(Int_t i= 0; i < fStatusArray->GetSize(); i++) + if(status == fStatusArray->At(i)) return kTRUE ; + + return kFALSE; + + } + else + return kTRUE ; +} + +//________________________________________________________________ +Bool_t AliCaloTrackMCReader::KeepChargedParticles(Int_t pdg) const { + //Check if pdg is equal to one of the charged particles list + //These particles will be added to the calorimeters lists. + + for(Int_t i= 0; i < fChargedParticlesArray->GetSize(); i++) + if(TMath::Abs(pdg) == fChargedParticlesArray->At(i)) return kTRUE ; + + return kFALSE; + +} + +//________________________________________________________________ +void AliCaloTrackMCReader::Print(const Option_t * opt) const +{ + //Print some relevant parameters set for the analysis + if(! opt) + return; + + Info("**** Print **** ", "%s %s", GetName(), GetTitle() ) ; + + printf("Decay Pi0? : %d\n", fDecayPi0) ; + printf("TClonesArray type : %d\n", fClonesArrayType) ; + printf("Keep all status? : %d\n", fKeepAllStatus) ; + + if(!fKeepAllStatus) printf("Keep particles with status : "); + for(Int_t i= 0; i < fStatusArray->GetSize(); i++) + printf(" %d ; ", fStatusArray->At(i)); + printf("\n"); + + printf("Skip neutral particles in calo : "); + for(Int_t i= 0; i < fNeutralParticlesArray->GetSize(); i++) + printf(" %d ; ", fNeutralParticlesArray->At(i)); + printf("\n"); + + printf("Keep charged particles in calo : "); + for(Int_t i= 0; i < fChargedParticlesArray->GetSize(); i++) + printf(" %d ; ", fChargedParticlesArray->At(i)); + printf("\n"); + +} + +//____________________________________________________________________________ +void AliCaloTrackMCReader::MakePi0Decay(TLorentzVector &p0, TLorentzVector &p1, + TLorentzVector &p2){//, Double_t &angle) { + // Perform isotropic decay pi0 -> 2 photons + // p0 is pi0 4-momentum (inut) + // p1 and p2 are photon 4-momenta (output) + // cout<<"Boost vector"<GetParticle(111)->Mass(); + TVector3 b = p0.BoostVector(); + //cout<<"Parameters"<Rndm(); + Double_t cosThe = 2 * gRandom->Rndm() - 1; + Double_t cosPhi = TMath::Cos(phi); + Double_t sinPhi = TMath::Sin(phi); + Double_t sinThe = TMath::Sqrt(1-cosThe*cosThe); + Double_t ePi0 = mPi0/2.; + //cout<<"ePi0 "<GetSize(); i++) + if(TMath::Abs(pdg) == fNeutralParticlesArray->At(i)) return kTRUE ; + + return kFALSE; + +} + + +//____________________________________________________________________ +void AliCaloTrackMCReader::SetTrackChargeAndPID(const Int_t pdgCode, AliAODTrack *track) { + + Float_t PID[10] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0.}; + + switch (pdgCode) { + + case 22: // gamma + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 11: // e- + track->SetCharge(-1); + PID[AliAODTrack::kElectron] = 1.; + track->SetPID(PID); + break; + + case -11: // e+ + track->SetCharge(+1); + PID[AliAODTrack::kElectron] = 1.; + track->SetPID(PID); + break; + + case 13: // mu- + track->SetCharge(-1); + PID[AliAODTrack::kMuon] = 1.; + track->SetPID(PID); + break; + + case -13: // mu+ + track->SetCharge(+1); + PID[AliAODTrack::kMuon] = 1.; + track->SetPID(PID); + break; + + case 111: // pi0 + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 211: // pi+ + track->SetCharge(+1); + PID[AliAODTrack::kPion] = 1.; + track->SetPID(PID); + break; + + case -211: // pi- + track->SetCharge(-1); + PID[AliAODTrack::kPion] = 1.; + track->SetPID(PID); + break; + + case 130: // K0L + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 321: // K+ + track->SetCharge(+1); + PID[AliAODTrack::kKaon] = 1.; + track->SetPID(PID); + break; + + case -321: // K- + track->SetCharge(-1); + PID[AliAODTrack::kKaon] = 1.; + track->SetPID(PID); + break; + + case 2112: // n + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 2212: // p + track->SetCharge(+1); + PID[AliAODTrack::kProton] = 1.; + track->SetPID(PID); + break; + + case -2212: // anti-p + track->SetCharge(-1); + PID[AliAODTrack::kProton] = 1.; + track->SetPID(PID); + break; + + case 310: // K0S + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 311: // K0 + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case -311: // anti-K0 + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 221: // eta + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 3122: // lambda + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 3222: // Sigma+ + track->SetCharge(+1); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 3212: // Sigma0 + track->SetCharge(-1); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 3112: // Sigma- + track->SetCharge(-1); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 3322: // Xi0 + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 3312: // Xi- + track->SetCharge(-1); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 3334: // Omega- + track->SetCharge(-1); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case -2112: // n-bar + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case -3122: // anti-Lambda + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case -3222: // anti-Sigma- + track->SetCharge(-1); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case -3212: // anti-Sigma0 + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case -3112: // anti-Sigma+ + track->SetCharge(+1); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case -3322: // anti-Xi0 + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case -3312: // anti-Xi+ + track->SetCharge(+1); + break; + + case -3334: // anti-Omega+ + track->SetCharge(+1); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 411: // D+ + track->SetCharge(+1); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case -411: // D- + track->SetCharge(-1); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case 421: // D0 + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + case -421: // anti-D0 + track->SetCharge(0); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + break; + + default : // unknown + track->SetCharge(-99); + PID[AliAODTrack::kUnknown] = 1.; + track->SetPID(PID); + } + + return; +} + +//____________________________________________________________________ +void AliCaloTrackMCReader::SetCaloClusterPID(const Int_t pdgCode, AliAODCaloCluster *calo) { + + Float_t PID[9] = {0., 0., 0., 0., 0., 0., 0., 0., 0.}; + + switch (pdgCode) { + + case 22: // gamma + PID[AliAODCaloCluster::kPhoton] = 1.; + calo->SetPID(PID); + break; + + case 11: // e- + PID[AliAODCaloCluster::kElectron] = 1.; + calo->SetPID(PID); + break; + + case -11: // e+ + PID[AliAODCaloCluster::kElectron] = 1.; + calo->SetPID(PID); + break; + + case 13: // mu- + PID[AliAODCaloCluster::kCharged] = 1.; + calo->SetPID(PID); + break; + + case -13: // mu+ + PID[AliAODCaloCluster::kCharged] = 1.; + calo->SetPID(PID); + break; + + case 111: // pi0 + PID[AliAODCaloCluster::kPi0] = 1.; + calo->SetPID(PID); + break; + + case 211: // pi+ + PID[AliAODCaloCluster::kCharged] = 1.; + calo->SetPID(PID); + break; + + case -211: // pi- + PID[AliAODCaloCluster::kCharged] = 1.; + calo->SetPID(PID); + break; + + case 130: // K0L + PID[AliAODCaloCluster::kKaon0] = 1.; + PID[AliAODCaloCluster::kNeutral] = 1; + calo->SetPID(PID); + break; + + case 321: // K+ + PID[AliAODCaloCluster::kCharged] = 1.; + calo->SetPID(PID); + break; + + case -321: // K- + PID[AliAODCaloCluster::kCharged] = 1.; + calo->SetPID(PID); + break; + + case 2112: // n + PID[AliAODCaloCluster::kNeutron] = 1.; + PID[AliAODCaloCluster::kNeutral] = 1.; + calo->SetPID(PID); + break; + + case 2212: // p + PID[AliAODCaloCluster::kCharged] = 1.; + calo->SetPID(PID); + break; + + case -2212: // anti-p + PID[AliAODCaloCluster::kCharged] = 1.; + calo->SetPID(PID); + break; + + case 310: // K0S + PID[AliAODCaloCluster::kKaon0] = 1.; + PID[AliAODCaloCluster::kNeutral] = 1.; + calo->SetPID(PID); + break; + + case 311: // K0 + PID[AliAODCaloCluster::kKaon0] = 1.; + PID[AliAODCaloCluster::kNeutral] = 1.; + calo->SetPID(PID); + break; + + case -311: // anti-K0 + PID[AliAODCaloCluster::kKaon0] = 1.; + PID[AliAODCaloCluster::kNeutral] = 1.; + calo->SetPID(PID); + break; + + case 221: // eta + PID[AliAODCaloCluster::kNeutral] = 1.; + calo->SetPID(PID); + break; + + case 3122: // lambda + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case 3222: // Sigma+ + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case 3212: // Sigma0 + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case 3112: // Sigma- + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case 3322: // Xi0 + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case 3312: // Xi- + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case 3334: // Omega- + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case -2112: // n-bar + PID[AliAODCaloCluster::kNeutron] = 1.; + PID[AliAODCaloCluster::kNeutral] = 1.; + calo->SetPID(PID); + break; + + case -3122: // anti-Lambda + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case -3222: // anti-Sigma- + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case -3212: // anti-Sigma0 + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case -3112: // anti-Sigma+ + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case -3322: // anti-Xi0 + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case -3312: // anti-Xi+ + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case -3334: // anti-Omega+ + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case 411: // D+ + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case -411: // D- + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case 421: // D0 + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + case -421: // anti-D0 + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + break; + + default : // unknown + PID[AliAODCaloCluster::kUnknown] = 1.; + calo->SetPID(PID); + } + + return; +} diff --git a/PWG4/AliCaloTrackMCReader.h b/PWG4/AliCaloTrackMCReader.h new file mode 100644 index 00000000000..50a95c57611 --- /dev/null +++ b/PWG4/AliCaloTrackMCReader.h @@ -0,0 +1,95 @@ +#ifndef AliCaloTrackMCReader_H +#define AliCaloTrackMCReader_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +/* History of cvs commits: + * + * $Log$ + * + */ + +//_________________________________________________________________________ +// Class for reading data (Kinematics) in order to do prompt gamma or other particle correlations +// + +//-- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- + +// --- AliRoot system --- +#include "AliCaloTrackReader.h" +class AliAODCaloCluster ; +class AliAODTrack ; + +class AliCaloTrackMCReader : public AliCaloTrackReader { + + public: + + AliCaloTrackMCReader() ; // ctor + AliCaloTrackMCReader(const AliCaloTrackMCReader & g) ; // cpy ctor + AliCaloTrackMCReader & operator = (const AliCaloTrackMCReader & g) ;//cpy assignment + virtual ~AliCaloTrackMCReader() ;//virtual dtor + + enum clonesType {kTParticle, kAliAOD}; + + void InitParameters(); + + void Print(const Option_t * opt) const; + + void SwitchOnPi0Decay() { fDecayPi0 = kTRUE ; } + void SwitchOffPi0Decay() { fDecayPi0 = kFALSE ; } + Int_t IsPi0DecaySwitchedOn() const { return fDecayPi0 ; } + + void SetClonesArrayType(Int_t type){fClonesArrayType = type ;} + Bool_t GetClonesArrayType() const {return fClonesArrayType ;} + + void AddNeutralParticlesArray(TArrayI & array) + { fNeutralParticlesArray = new TArrayI(array) ; } + TArrayI * GetNeutralParticlesArray() const {return fNeutralParticlesArray;} + Bool_t SkipNeutralParticles(Int_t pdg) const ; + + void AddChargedParticlesArray(TArrayI & array) + { fChargedParticlesArray = new TArrayI(array) ; } + TArrayI * GetChargedParticlesArray() const {return fChargedParticlesArray;} + Bool_t KeepChargedParticles(Int_t pdg) const ; + + void AddStatusArray(TArrayI & array) + { fStatusArray = new TArrayI(array) ; } + TArrayI * GetStatusArray() const {return fStatusArray;} + + void SwitchOnStatusSelection() {fKeepAllStatus = kFALSE;} + void SwitchOffStatusSelection() {fKeepAllStatus = kTRUE;} + Bool_t KeepParticleWithStatus(Int_t status) const ; + + void GetVertex(Double_t v[3]); + + void FillInputEvent(Bool_t bCTS, Bool_t bEMCAL, Bool_t bPHOS); + void SetInputEvent(TObject* esd, TObject* aod, TObject* mc); + + void SetCaloClusterPID(const Int_t pdgCode, AliAODCaloCluster *calo); + void SetTrackChargeAndPID(const Int_t pdgCode, AliAODTrack *track); + + private: + + void MakePi0Decay(TLorentzVector &p0, TLorentzVector &p1, TLorentzVector &p2);//, Double_t &angle); + void FillCalorimeters(const Int_t iParticle, TParticle* particle, TLorentzVector momentum, + Int_t &indexPHOS, Int_t &indexEMCAL); + + private: + Bool_t fDecayPi0; //If not decayed, decay pi0 by hand + TArrayI * fNeutralParticlesArray ; //Do not keep neutral particles of this list in calorimeter. + TArrayI * fChargedParticlesArray ; //Keep charged particles of this list in calorimeter. + TArrayI * fStatusArray ; //Keep particles with status of the list. + Bool_t fKeepAllStatus ; //Do or do not select particles depending on their status code. + Int_t fClonesArrayType; //Analysis with TParticles or AliAODCaloCluster/Track? + + ClassDef(AliCaloTrackMCReader,1) + } ; + + +#endif //AliCaloMCTrackReader_H + + + diff --git a/PWG4/AliCaloTrackReader.cxx b/PWG4/AliCaloTrackReader.cxx new file mode 100644 index 00000000000..ab2843b7e70 --- /dev/null +++ b/PWG4/AliCaloTrackReader.cxx @@ -0,0 +1,253 @@ +/************************************************************************** + * 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. * + **************************************************************************/ +/* $Id: $ */ + +/* History of cvs commits: + * + * $Log$ + * + * + */ + +//_________________________________________________________________________ +// Base class for reading data: MonteCarlo, ESD or AOD, of PHOS EMCAL and +// Central Barrel Tracking detectors (CTS). +// Not all MC particles/tracks/clusters are kept, some kinematical/fidutial restrictions are done. +// Mother class of : AliCaloTrackESDReader: Fills ESD data in 3 TClonesArrays (PHOS, EMCAL, CTS) +// : AliCaloTrackMCReader: Fills Kinematics data in 3 TClonesArrays (PHOS, EMCAL, CTS) +// : AliCaloTrackAODReader: Fills AOD data in 3 TClonesArrays (PHOS, EMCAL, CTS) +// +//-- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- +#include +#include +#include + +//---- ANALYSIS system ---- +#include "AliCaloTrackReader.h" +#include "AliLog.h" +#include "AliStack.h" +#include "AliHeader.h" +#include "AliGenEventHeader.h" + +ClassImp(AliCaloTrackReader) + + +//____________________________________________________________________________ + AliCaloTrackReader::AliCaloTrackReader() : + TObject(), fDataType(0), fDebug(0), fFidutialCut(0x0), + fCTSPtMin(0), fEMCALPtMin(0),fPHOSPtMin(0), + fAODCTS(0x0), fAODEMCAL(0x0), fAODPHOS(0x0), + fEMCALCells(0x0), fPHOSCells(0x0), + fESD(0x0), fAOD(0x0),fMC(0x0), + fFillCTS(0),fFillEMCAL(0),fFillPHOS(0), + fFillEMCALCells(0),fFillPHOSCells(0) +{ + //Ctor + + //Initialize parameters + InitParameters(); +} + +//____________________________________________________________________________ +AliCaloTrackReader::AliCaloTrackReader(const AliCaloTrackReader & g) : + TObject(g), fDataType(g.fDataType), fDebug(g.fDebug),fFidutialCut(g.fFidutialCut), + fCTSPtMin(g.fCTSPtMin), fEMCALPtMin(g.fEMCALPtMin),fPHOSPtMin(g.fPHOSPtMin), + fAODCTS(new TClonesArray(*g.fAODCTS)), + fAODEMCAL(new TClonesArray(*g.fAODEMCAL)), + fAODPHOS(new TClonesArray(*g.fAODPHOS)), + fEMCALCells(new TNamed(*g.fEMCALCells)), + fPHOSCells(new TNamed(*g.fPHOSCells)), + fESD(g.fESD), fAOD(g.fAOD), fMC(g.fMC), + fFillCTS(g.fFillCTS),fFillEMCAL(g.fFillEMCAL),fFillPHOS(g.fFillPHOS), + fFillEMCALCells(g.fFillEMCALCells),fFillPHOSCells(g.fFillPHOSCells) +{ + // cpy ctor + +} + +//_________________________________________________________________________ +AliCaloTrackReader & AliCaloTrackReader::operator = (const AliCaloTrackReader & source) +{ + // assignment operator + + if(&source == this) return *this; + + fDataType = source.fDataType ; + fDebug = source.fDebug ; + + fFidutialCut = source.fFidutialCut; + + fCTSPtMin = source.fCTSPtMin ; + fEMCALPtMin = source.fEMCALPtMin ; + fPHOSPtMin = source.fPHOSPtMin ; + + fAODCTS = new TClonesArray(*source.fAODCTS) ; + fAODEMCAL = new TClonesArray(*source.fAODEMCAL) ; + fAODPHOS = new TClonesArray(*source.fAODPHOS) ; + fEMCALCells = new TNamed(*source.fEMCALCells) ; + fPHOSCells = new TNamed(*source.fPHOSCells) ; + + fESD = source.fESD; + fAOD= source.fAOD; + fMC = source.fMC; + + fFillCTS = source.fFillCTS; + fFillEMCAL = source.fFillEMCAL; + fFillPHOS = source.fFillPHOS; + fFillEMCALCells = source.fFillEMCALCells; + fFillPHOSCells = source.fFillPHOSCells; + + return *this; + +} + +//_________________________________ +AliCaloTrackReader::~AliCaloTrackReader() { + //Dtor + + if(fFidutialCut) delete fFidutialCut ; + + if(fAODCTS){ + fAODCTS->Clear() ; + delete fAODCTS ; + } + + if(fAODEMCAL){ + fAODEMCAL->Clear() ; + delete fAODEMCAL ; + } + + if(fAODPHOS){ + fAODPHOS->Clear() ; + delete fAODPHOS ; + } + + if(fEMCALCells){ + fEMCALCells->Clear() ; + delete fEMCALCells ; + } + + if(fPHOSCells){ + fPHOSCells->Clear() ; + delete fPHOSCells ; + } + + if(fESD) delete fESD ; + if(fAOD) delete fAOD ; + if(fMC) delete fMC ; +} + +//____________________________________________________________________________ +AliStack* AliCaloTrackReader::GetStack() const { + //Return pointer to stack + if(fMC) + return fMC->Stack(); + else{ + printf("stack is not available"); + return 0x0 ; + } +} + +//____________________________________________________________________________ +AliHeader* AliCaloTrackReader::GetHeader() const { + //Return pointer to header + if(fMC) + return fMC->Header(); + else{ + printf("header is not available"); + return 0x0 ; + } +} +//____________________________________________________________________________ +AliGenEventHeader* AliCaloTrackReader::GetGenEventHeader() const { + //Return pointer to Generated event header + if(fMC) + return fMC->GenEventHeader(); + else{ + printf("GenEventHeader is not available"); + return 0x0 ; + } +} + +//_______________________________________________________________ +void AliCaloTrackReader::InitParameters() +{ + + //Initialize the parameters of the analysis. + fDataType = kESD ; + + fCTSPtMin = 0.2 ; + fEMCALPtMin = 0.5 ; + fPHOSPtMin = 0.5 ; + + fFillEMCAL = kTRUE; + fFillPHOS = kTRUE; + fFillCTS = kTRUE; + fFillEMCALCells = kFALSE; + fFillPHOSCells = kFALSE; + + fFidutialCut = new AliFidutialCut(); + +} + + +//________________________________________________________________ +void AliCaloTrackReader::Print(const Option_t * opt) const +{ + + //Print some relevant parameters set for the analysis + if(! opt) + return; + + printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ; + printf("Data type : %d\n", fDataType) ; + printf("CTS Min pT : %2.1f GeV/c\n", fCTSPtMin) ; + printf("EMCAL Min pT : %2.1f GeV/c\n", fEMCALPtMin) ; + printf("PHOS Min pT : %2.1f GeV/c\n", fPHOSPtMin) ; + printf("Use CTS = %d\n", fFillCTS) ; + printf("Use EMCAL = %d\n", fFillEMCAL) ; + printf("Use PHOS = %d\n", fFillPHOS) ; + printf("Use EMCAL Cells = %d\n", fFillEMCALCells) ; + printf("Use PHOS Cells = %d\n", fFillPHOSCells) ; + printf(" \n") ; +} + +//___________________________________________________ +void AliCaloTrackReader::FillInputEvent() { + //Fill the input lists that are needed, called by the analysis maker. + + if(fFillCTS) FillInputCTS(); + if(fFillEMCAL) FillInputEMCAL(); + if(fFillPHOS) FillInputPHOS(); + if(fFillEMCALCells) FillInputEMCALCells(); + if(fFillPHOSCells) FillInputPHOSCells(); + +} + +//__________________________________________________ +void AliCaloTrackReader::ResetLists() { + // Reset lists, called by the analysis maker + + if(fAODCTS) fAODCTS -> Clear(); + if(fAODEMCAL) fAODEMCAL -> Clear(); + if(fAODPHOS) fAODPHOS -> Clear(); + if(fEMCALCells) fEMCALCells -> Clear(); + if(fPHOSCells) fPHOSCells -> Clear(); + +} diff --git a/PWG4/AliCaloTrackReader.h b/PWG4/AliCaloTrackReader.h new file mode 100644 index 00000000000..6c8e5ba3854 --- /dev/null +++ b/PWG4/AliCaloTrackReader.h @@ -0,0 +1,164 @@ +#ifndef AliCaloTrackReader_H +#define AliCaloTrackReader_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +/* History of cvs commits: + * + * $Log$ + * + * + */ + +//_________________________________________________________________________ +// Base class for reading data: MonteCarlo, ESD or AOD, of PHOS EMCAL and +// Central Barrel Tracking detectors. +// Not all MC particles/tracks/clusters are kept, some kinematical restrictions are done. +// Mother class of : AliCaloTrackESDReader: Fills ESD data in 3 TClonesArrays (PHOS, EMCAL, CTS) +// : AliCaloTrackMCReader: Fills Kinematics data in 3 TClonesArrays (PHOS, EMCAL, CTS) +// : AliCaloTrackAODReader: Fills AOD data in 3 TClonesArrays (PHOS, EMCAL, CTS) +// +// -- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- +#include "TObject.h" +class TClonesArray ; +class TLorentzVector ; +class TString ; +#include "TArrayF.h" +class Riostream ; + +//--- ANALYSIS system --- +/* #include "AliStack.h" */ +/* #include "AliHeader.h" */ +/* #include "AliGenEventHeader.h" */ +class AliStack ; +class AliHeader ; +class AliGenEventHeader ; +#include "AliESDEvent.h" +#include "AliAODEvent.h" +#include "AliMCEvent.h" +class AliLog ; +#include "AliFidutialCut.h" + +class AliCaloTrackReader : public TObject { + +public: + + AliCaloTrackReader() ; // ctor + AliCaloTrackReader(const AliCaloTrackReader & g) ; // cpy ctor + AliCaloTrackReader & operator = (const AliCaloTrackReader & g) ;//cpy assignment + virtual ~AliCaloTrackReader() ;//virtual dtor + + enum inputDataType {kESD, kAOD, kMC}; + + void InitParameters(); + + virtual Int_t GetDebug() const { return fDebug ; } + virtual void SetDebug(Int_t d) { fDebug = d ; } + + virtual Int_t GetDataType() const { return fDataType ; } + virtual void SetDataType(Int_t data ){fDataType = data ; } + + virtual void Print(const Option_t * opt)const; + + //Minimum pt setters and getters + virtual Float_t GetEMCALPtMin() const { return fEMCALPtMin ; } + virtual Float_t GetPHOSPtMin() const { return fPHOSPtMin ; } + virtual Float_t GetCTSPtMin() const { return fCTSPtMin ; } + + virtual void SetEMCALPtMin(Float_t pt){ fEMCALPtMin = pt ; } + virtual void SetPHOSPtMin(Float_t pt){ fPHOSPtMin = pt ; } + virtual void SetCTSPtMin(Float_t pt){ fCTSPtMin = pt ; } + + //Input setters and getters + + Bool_t IsCTSSwitchedOn() const { return fFillCTS ; } + void SwitchOnCTS() {fFillCTS = kTRUE ; } + void SwitchOffCTS() {fFillCTS = kFALSE ; } + + Bool_t IsEMCALSwitchedOn() const { return fFillEMCAL ; } + void SwitchOnEMCAL() {fFillEMCAL = kTRUE ; } + void SwitchOffEMCAL() {fFillEMCAL = kFALSE ; } + + Bool_t IsPHOSSwitchedOn() const { return fFillPHOS ; } + void SwitchOnPHOS() {fFillPHOS = kTRUE ; } + void SwitchOffPHOS() {fFillPHOS = kFALSE ; } + + Bool_t IsEMCALCellsSwitchedOn() const { return fFillEMCALCells ; } + void SwitchOnEMCALCells() {fFillEMCALCells = kTRUE ; } + void SwitchOffEMCALCells() {fFillEMCALCells = kFALSE ; } + + Bool_t IsPHOSCellsSwitchedOn() const { return fFillPHOSCells ; } + void SwitchOnPHOSCells() {fFillPHOSCells = kTRUE ; } + void SwitchOffPHOSCells() {fFillPHOSCells = kFALSE ; } + + virtual void FillInputEvent(); + + virtual void FillInputCTS(){;} + virtual void FillInputEMCAL(){;} + virtual void FillInputPHOS(){;} + virtual void FillInputEMCALCells(){;} + virtual void FillInputPHOSCells(){;} + + virtual TClonesArray* GetAODCTS() const {return fAODCTS ;} + virtual TClonesArray* GetAODEMCAL() const {return fAODEMCAL ;} + virtual TClonesArray* GetAODPHOS() const {return fAODPHOS ;} + virtual TNamed* GetEMCALCells() const {return fEMCALCells ;} + virtual TNamed* GetPHOSCells() const {return fPHOSCells ;} + + virtual AliStack* GetStack() const ; + virtual AliHeader* GetHeader() const ; + virtual AliGenEventHeader* GetGenEventHeader() const ; + + virtual void GetVertex(Double_t v[3]) {;} + virtual AliESDEvent* GetESD() const {return fESD;} + virtual AliAODEvent* GetAOD() const {return fAOD;} + virtual AliMCEvent* GetMC() const {return fMC;} + + virtual void SetESD( AliESDEvent* esd) {fESD = esd;} + virtual void SetAOD(AliAODEvent* aod) {fAOD = aod;} + virtual void SetMC(AliMCEvent* mc) {fMC = mc;} + + virtual void ResetLists(); + + virtual AliFidutialCut * GetFidutialCut() const {return fFidutialCut ;} + virtual void SetFidutialCut(AliFidutialCut * fc) { fFidutialCut = fc ;} + + virtual void SetInputEvent(TObject* /*esd*/, TObject* /*aod*/, TObject* /*mc*/) {;} + + protected: + + Int_t fDataType ; //Select MC:Kinematics, Data:ESD/AOD, MCData:Both + Int_t fDebug; //Debugging level + AliFidutialCut * fFidutialCut; //Acceptance cuts + + Float_t fCTSPtMin; // pT Threshold on charged particles + Float_t fEMCALPtMin; //pT Threshold on emcal clusters + Float_t fPHOSPtMin; // pT Threshold on phos clusters + + TClonesArray* fAODCTS ; //! temporal array with tracks + TClonesArray* fAODEMCAL ; //! temporal array with EMCAL CaloClusters + TClonesArray* fAODPHOS ; //! temporal array with PHOS CaloClusters + TNamed * fEMCALCells ; //! temporal array with EMCAL CaloCells, ESD or AOD + TNamed * fPHOSCells ; //! temporal array with PHOS CaloCells, ESD or AOD + + AliESDEvent *fESD; //! pointer to esd + AliAODEvent *fAOD; //! pointer to aod + AliMCEvent *fMC; //! Monte Carlo Event Handler + + Bool_t fFillCTS; //use data from CTS + Bool_t fFillEMCAL; //use data from EMCAL + Bool_t fFillPHOS; //use data from PHOS + Bool_t fFillEMCALCells; //use data from EMCAL + Bool_t fFillPHOSCells; //use data from PHOS + + ClassDef(AliCaloTrackReader,1) +} ; + + +#endif //AliCaloTrackReader_H + + + diff --git a/PWG4/AliFidutialCut.cxx b/PWG4/AliFidutialCut.cxx new file mode 100644 index 00000000000..7e9217d2acb --- /dev/null +++ b/PWG4/AliFidutialCut.cxx @@ -0,0 +1,360 @@ +/************************************************************************** + * 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. * + **************************************************************************/ +/* $Id: AliFidutialCut.cxx 21839 2007-10-29 13:49:42Z gustavo $ */ + +/* History of cvs commits: + * + * $Log$ + * + * + */ + +//_________________________________________________________________________ +// Class for track/cluster acceptance selection +// Selection in Central barrel, EMCAL and PHOS +// +//*-- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- +#include +#include +#include +//#include + +//---- ANALYSIS system ---- +#include "AliLog.h" +#include "AliFidutialCut.h" + +ClassImp(AliFidutialCut) + + +//____________________________________________________________________________ +AliFidutialCut::AliFidutialCut() : + TObject(), + fEMCALFidutialCut(0), fPHOSFidutialCut(0), fCTSFidutialCut(0), + fCTSFidCutMinEta(0x0),fCTSFidCutMinPhi(0x0),fCTSFidCutMaxEta(0x0), fCTSFidCutMaxPhi(0x0), + fEMCALFidCutMinEta(0x0),fEMCALFidCutMinPhi(0x0),fEMCALFidCutMaxEta(0x0), fEMCALFidCutMaxPhi(0x0), + fPHOSFidCutMinEta(0x0),fPHOSFidCutMinPhi(0x0),fPHOSFidCutMaxEta(0x0), fPHOSFidCutMaxPhi(0x0) + +{ + //Ctor + + //Initialize parameters + InitParameters(); +} + +//____________________________________________________________________________ +AliFidutialCut::AliFidutialCut(const AliFidutialCut & g) : + TObject(g), + fEMCALFidutialCut(g.fEMCALFidutialCut), fPHOSFidutialCut(g.fPHOSFidutialCut), fCTSFidutialCut(g. fCTSFidutialCut), + fCTSFidCutMinEta(g.fCTSFidCutMinEta?new TArrayF(*g.fCTSFidCutMinEta):0x0), + fCTSFidCutMinPhi(g.fCTSFidCutMinPhi?new TArrayF(*g.fCTSFidCutMinPhi):0x0), + fCTSFidCutMaxEta(g.fCTSFidCutMaxEta?new TArrayF(*g.fCTSFidCutMaxEta):0x0), + fCTSFidCutMaxPhi(g.fCTSFidCutMaxPhi?new TArrayF(*g.fCTSFidCutMaxPhi):0x0), + fEMCALFidCutMinEta(g.fEMCALFidCutMinEta?new TArrayF(*g.fEMCALFidCutMinEta):0x0), + fEMCALFidCutMinPhi(g.fEMCALFidCutMinPhi?new TArrayF(*g.fEMCALFidCutMinPhi):0x0), + fEMCALFidCutMaxEta(g.fEMCALFidCutMaxEta?new TArrayF(*g.fEMCALFidCutMaxEta):0x0), + fEMCALFidCutMaxPhi(g.fEMCALFidCutMaxPhi?new TArrayF(*g.fEMCALFidCutMaxPhi):0x0), + fPHOSFidCutMinEta(g.fPHOSFidCutMinEta?new TArrayF(*g.fPHOSFidCutMinEta):0x0), + fPHOSFidCutMinPhi(g.fPHOSFidCutMinPhi?new TArrayF(*g.fPHOSFidCutMinPhi):0x0), + fPHOSFidCutMaxEta(g.fPHOSFidCutMaxEta?new TArrayF(*g.fPHOSFidCutMaxEta):0x0), + fPHOSFidCutMaxPhi(g.fPHOSFidCutMaxPhi?new TArrayF(*g.fPHOSFidCutMaxPhi):0x0) + +{ + // cpy ctor + +} + +//_________________________________________________________________________ +AliFidutialCut & AliFidutialCut::operator = (const AliFidutialCut & source) +{ + // assignment operator + + if(&source == this) return *this; + + fEMCALFidutialCut = source.fEMCALFidutialCut; + fPHOSFidutialCut = source.fPHOSFidutialCut; + fCTSFidutialCut = source.fCTSFidutialCut; + + fCTSFidCutMinEta = source.fCTSFidCutMinEta?new TArrayF(*source.fCTSFidCutMinEta):0x0; + fCTSFidCutMinPhi = source.fCTSFidCutMinPhi?new TArrayF(*source.fCTSFidCutMinPhi):0x0; + fCTSFidCutMaxEta = source.fCTSFidCutMaxEta?new TArrayF(*source.fCTSFidCutMaxEta):0x0; + fCTSFidCutMaxPhi = source.fCTSFidCutMaxPhi?new TArrayF(*source.fCTSFidCutMaxPhi):0x0; + fEMCALFidCutMinEta = source.fEMCALFidCutMinEta?new TArrayF(*source.fEMCALFidCutMinEta):0x0; + fEMCALFidCutMinPhi = source.fEMCALFidCutMinPhi?new TArrayF(*source.fEMCALFidCutMinPhi):0x0; + fEMCALFidCutMaxEta = source.fEMCALFidCutMaxEta?new TArrayF(*source.fEMCALFidCutMaxEta):0x0; + fEMCALFidCutMaxPhi = source.fEMCALFidCutMaxPhi?new TArrayF(*source.fEMCALFidCutMaxPhi):0x0; + fPHOSFidCutMinEta = source.fPHOSFidCutMinEta?new TArrayF(*source.fPHOSFidCutMinEta):0x0; + fPHOSFidCutMinPhi = source.fPHOSFidCutMinPhi?new TArrayF(*source.fPHOSFidCutMinPhi):0x0; + fPHOSFidCutMaxEta = source.fPHOSFidCutMaxEta?new TArrayF(*source.fPHOSFidCutMaxEta):0x0; + fPHOSFidCutMaxPhi = source.fPHOSFidCutMaxPhi?new TArrayF(*source.fPHOSFidCutMaxPhi):0x0; + + return *this; + +} + +//_________________________________ +AliFidutialCut::~AliFidutialCut() { + //Dtor + + delete fCTSFidCutMinEta ; + delete fCTSFidCutMinPhi ; + delete fCTSFidCutMaxEta ; + delete fCTSFidCutMaxPhi ; + + delete fEMCALFidCutMinEta ; + delete fEMCALFidCutMinPhi ; + delete fEMCALFidCutMaxEta ; + delete fEMCALFidCutMaxPhi ; + + delete fPHOSFidCutMinEta ; + delete fPHOSFidCutMinPhi ; + delete fPHOSFidCutMaxEta ; + delete fPHOSFidCutMaxPhi ; + +} + + +//_______________________________________________________________ +Bool_t AliFidutialCut::IsInFidutialCut(TLorentzVector momentum, TString det) const +{ + //Selects EMCAL or PHOS cluster or CTS track if it is inside eta-phi defined regions + + Double_t phi = momentum.Phi(); + if(phi<0) phi+=TMath::TwoPi() ; + Double_t eta = momentum.Eta(); + //printf("IsInFidutialCut::Det: %s, phi = %f, eta = %f\n", det.Data(),phi*TMath::RadToDeg(), eta); + + Float_t * maxeta = new Float_t; + Float_t * maxphi = new Float_t; + Float_t * mineta = new Float_t; + Float_t * minphi = new Float_t; + Int_t nphiregions = 0; + Int_t netaregions = 0; + Bool_t selection = kFALSE; + + if(det == "CTS"){ + netaregions = fCTSFidCutMaxEta->GetSize(); + nphiregions = fCTSFidCutMaxPhi->GetSize(); + if(netaregions != fCTSFidCutMinEta->GetSize() || nphiregions != fCTSFidCutMinPhi->GetSize()) + AliFatal(Form("Wrong number of CTS fidutial cut regions: nmaxeta %d != nmineta %d; nmaxphi %d != nminphi %d", + netaregions, fCTSFidCutMinEta->GetSize(), nphiregions, fCTSFidCutMinPhi->GetSize())); + + maxeta = fCTSFidCutMaxEta->GetArray(); + maxphi = fCTSFidCutMaxPhi->GetArray(); + mineta = fCTSFidCutMinEta->GetArray(); + minphi = fCTSFidCutMinPhi->GetArray(); + selection = fCTSFidutialCut ; + } + else if(det == "EMCAL"){ + netaregions = fEMCALFidCutMaxEta->GetSize(); + nphiregions = fEMCALFidCutMaxPhi->GetSize(); + if(netaregions != fEMCALFidCutMinEta->GetSize() || nphiregions != fEMCALFidCutMinPhi->GetSize()) + AliFatal(Form("Wrong number of EMCAL fidutial cut regions: nmaxeta %d != nmineta %d; nmaxphi %d != nminphi %d", + netaregions, fEMCALFidCutMinEta->GetSize(), nphiregions, fEMCALFidCutMinPhi->GetSize())); + + maxeta = fEMCALFidCutMaxEta->GetArray(); + maxphi = fEMCALFidCutMaxPhi->GetArray(); + mineta = fEMCALFidCutMinEta->GetArray(); + minphi = fEMCALFidCutMinPhi->GetArray(); + selection = fEMCALFidutialCut ; + } + else if(det == "PHOS"){ + netaregions = fPHOSFidCutMaxEta->GetSize(); + nphiregions = fPHOSFidCutMaxPhi->GetSize(); + if(netaregions != fPHOSFidCutMinEta->GetSize() || nphiregions != fPHOSFidCutMinPhi->GetSize()) + AliFatal(Form("Wrong number of PHOS fidutial cut regions: nmaxeta %d != nmineta %d; nmaxphi %d != nminphi %d", + netaregions, fPHOSFidCutMinEta->GetSize(), nphiregions, fPHOSFidCutMinPhi->GetSize())); + + maxeta = fPHOSFidCutMaxEta->GetArray(); + maxphi = fPHOSFidCutMaxPhi->GetArray(); + mineta = fPHOSFidCutMinEta->GetArray(); + minphi = fPHOSFidCutMinPhi->GetArray(); + selection = fPHOSFidutialCut ; + } + else + AliFatal(Form("Wrong detector name = %s", det.Data())); + + //printf("IsInFidutialCut::nphiregions = %d, netaregions = %d\n",nphiregions, netaregions); + + if(!selection) return kTRUE; //No cuts applied, all tracks/clusters used + + //Eta fidutial cut + Bool_t bInEtaFidCut = kFALSE; + for(Int_t ieta = 0; ieta < netaregions; ieta++) + if(eta > mineta[ieta] && eta < maxeta[ieta]) bInEtaFidCut = kTRUE; + + if(bInEtaFidCut){ + //printf("Eta cut passed\n"); + //Phi fidutial cut + Bool_t bInPhiFidCut = kFALSE; + for(Int_t iphi = 0; iphi < nphiregions; iphi++) + if(phi > minphi[iphi] *TMath::DegToRad()&& phi < maxphi[iphi]*TMath::DegToRad()) bInPhiFidCut = kTRUE ; + + if(bInPhiFidCut) { + //printf("IsInFidutialCut:: %s cluster/track accepted\n",det.Data()); + return kTRUE; + } + else return kFALSE; + + }//In eta fid cut + else + return kFALSE; + +} + + +//_______________________________________________________________ +void AliFidutialCut::InitParameters() +{ + + //Initialize the parameters of the analysis. + + fEMCALFidutialCut = kTRUE ; + fPHOSFidutialCut = kTRUE ; + fCTSFidutialCut = kTRUE ; + + fCTSFidCutMinEta = new TArrayF(1); + fCTSFidCutMinEta->SetAt(-0.9,0); + fCTSFidCutMaxEta = new TArrayF(1); + fCTSFidCutMaxEta->SetAt(0.9,0); + + fCTSFidCutMinPhi = new TArrayF(1); + fCTSFidCutMinPhi->SetAt(0,0); + fCTSFidCutMaxPhi = new TArrayF(1); + fCTSFidCutMaxPhi->SetAt(360.,0); + + fEMCALFidCutMinEta = new TArrayF(1); + fEMCALFidCutMinEta->SetAt(-0.7,0); + fEMCALFidCutMaxEta = new TArrayF(1); + fEMCALFidCutMaxEta->SetAt(0.7,0); + + fEMCALFidCutMinPhi = new TArrayF(1); + fEMCALFidCutMinPhi->SetAt(80.,0); + fEMCALFidCutMaxPhi = new TArrayF(1); + fEMCALFidCutMaxPhi->SetAt(190.,0); + + fPHOSFidCutMinEta = new TArrayF(1); + fPHOSFidCutMinEta->SetAt(-0.13,0); + fPHOSFidCutMaxEta = new TArrayF(1); + fPHOSFidCutMaxEta->SetAt(0.13,0); + + fPHOSFidCutMinPhi = new TArrayF(1); + fPHOSFidCutMinPhi->SetAt(220.,0); + fPHOSFidCutMaxPhi = new TArrayF(1); + fPHOSFidCutMaxPhi->SetAt(320.,0); + +} + + +//________________________________________________________________ +void AliFidutialCut::Print(const Option_t * opt) const +{ + + //Print some relevant parameters set for the analysis + if(! opt) + return; + + printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ; + + if(fCTSFidutialCut){ + Int_t netaregions = fCTSFidCutMaxEta->GetSize(); + Int_t nphiregions = fCTSFidCutMaxPhi->GetSize(); + printf(">> CTS Fidutial regions : phi %d eta %d\n", netaregions, nphiregions) ; + for(Int_t ieta = 0; ieta < netaregions; ieta++) + printf(" region %d : %3.2f < eta < %3.2f\n", ieta, fCTSFidCutMinEta->GetAt(ieta), fCTSFidCutMaxEta->GetAt(ieta)) ; + for(Int_t iphi = 0; iphi < nphiregions; iphi++) + printf(" region %d : %3.1f < phi < %3.1f\n", iphi, fCTSFidCutMinPhi->GetAt(iphi), fCTSFidCutMaxPhi->GetAt(iphi)) ; + } + else printf(">>No fidutial cuts in CTS\n"); + + if(fEMCALFidutialCut){ + Int_t netaregions = fEMCALFidCutMaxEta->GetSize(); + Int_t nphiregions = fEMCALFidCutMaxPhi->GetSize(); + printf(">>EMCAL Fidutial regions : phi %d eta %d\n", netaregions, nphiregions) ; + for(Int_t ieta = 0; ieta < netaregions; ieta++) + printf(" region %d : %3.2f < eta < %3.2f\n", ieta, fEMCALFidCutMinEta->GetAt(ieta), fEMCALFidCutMaxEta->GetAt(ieta)) ; + for(Int_t iphi = 0; iphi < nphiregions; iphi++) + printf(" region %d : %3.1f < phi < %3.1f\n", iphi, fEMCALFidCutMinPhi->GetAt(iphi), fEMCALFidCutMaxPhi->GetAt(iphi)) ; + } + else printf(">>No fidutial cuts in EMCAL\n"); + + if(fPHOSFidutialCut){ + Int_t netaregions = fPHOSFidCutMaxEta->GetSize(); + Int_t nphiregions = fPHOSFidCutMaxPhi->GetSize(); + printf(">>PHOS Fidutial regions : phi %d eta %d\n", netaregions, nphiregions) ; + for(Int_t ieta = 0; ieta < netaregions; ieta++) + printf(" region %d : %3.2f < eta < %3.2f\n", ieta, fPHOSFidCutMinEta->GetAt(ieta), fPHOSFidCutMaxEta->GetAt(ieta)) ; + for(Int_t iphi = 0; iphi < nphiregions; iphi++) + printf(" region %d : %3.1f < phi < %3.1f\n", iphi, fPHOSFidCutMinPhi->GetAt(iphi), fPHOSFidCutMaxPhi->GetAt(iphi)) ; + } + else printf(">>No fidutial cuts in PHOS\n"); + printf(" \n") ; +} + + +//_______________________________________________________________ +void AliFidutialCut::SetSimpleCTSFidutialCut(const Float_t eta, const Float_t minphi, const Float_t maxphi){ + + //Method to set simple acceptance cut to CTS + fCTSFidCutMinEta->Set(1); + fCTSFidCutMaxEta->Set(1); + fCTSFidCutMinPhi->Set(1); + fCTSFidCutMaxPhi->Set(1); + + fCTSFidCutMinEta->SetAt(-eta,0); + fCTSFidCutMaxEta->SetAt(eta,0); + fCTSFidCutMinPhi->SetAt(minphi,0); + fCTSFidCutMaxPhi->SetAt(maxphi,0); + + +} + + +//_______________________________________________________________ +void AliFidutialCut::SetSimpleEMCALFidutialCut(const Float_t eta, const Float_t minphi, const Float_t maxphi){ + //Method to set simple acceptance cut to EMCAL + + fEMCALFidCutMinEta->Set(1); + fEMCALFidCutMaxEta->Set(1); + fEMCALFidCutMinPhi->Set(1); + fEMCALFidCutMaxPhi->Set(1); + + fEMCALFidCutMinEta->SetAt(-eta,0); + fEMCALFidCutMaxEta->SetAt(eta,0); + fEMCALFidCutMinPhi->SetAt(minphi,0); + fEMCALFidCutMaxPhi->SetAt(maxphi,0); + + +} + +//_______________________________________________________________ +void AliFidutialCut::SetSimplePHOSFidutialCut(const Float_t eta, const Float_t minphi, const Float_t maxphi){ + + //Method to set simple acceptance cut to PHOS + fPHOSFidCutMinEta->Set(1); + fPHOSFidCutMaxEta->Set(1); + fPHOSFidCutMinPhi->Set(1); + fPHOSFidCutMaxPhi->Set(1); + + fPHOSFidCutMinEta->SetAt(-eta,0); + fPHOSFidCutMaxEta->SetAt(eta,0); + fPHOSFidCutMinPhi->SetAt(minphi,0); + fPHOSFidCutMaxPhi->SetAt(maxphi,0); + + +} diff --git a/PWG4/AliFidutialCut.h b/PWG4/AliFidutialCut.h new file mode 100644 index 00000000000..47b72d8a356 --- /dev/null +++ b/PWG4/AliFidutialCut.h @@ -0,0 +1,139 @@ +#ifndef ALIFIDUTIALCUT_H +#define ALIFIDUTIALCUT_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: $ */ + +/* History of cvs commits: + * + * $Log$ + * + * + */ + +//_________________________________________________________________________ +// Class for track/cluster acceptance selection +// Selection in Central barrel, EMCAL and PHOS +// +//*-- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- +#include +#include + + class TString ; +class Riostream ; +class TLorentzVector ; + +//--- AliRoot system --- + +class AliLog ; + +class AliFidutialCut : public TObject { + +public: + + AliFidutialCut() ; // ctor + AliFidutialCut(const AliFidutialCut & g) ; // cpy ctor + AliFidutialCut & operator = (const AliFidutialCut & g) ;//cpy assignment + virtual ~AliFidutialCut() ;//virtual dtor + + void InitParameters(); + + void Print(const Option_t * opt)const; + + Bool_t IsInFidutialCut(TLorentzVector l, TString det) const ; + + void DoCTSFidutialCut(Bool_t b) {fCTSFidutialCut = b; } + void DoEMCALFidutialCut(Bool_t b) {fEMCALFidutialCut = b; } + void DoPHOSFidutialCut(Bool_t b) {fPHOSFidutialCut = b; } + + Bool_t GetCTSFidutialCutStatus() const {return fCTSFidutialCut ; } + Bool_t GetEMCALFidutialCut() const {return fEMCALFidutialCut ; } + Bool_t GetPHOSFidutialCutStatus() const {return fPHOSFidutialCut ; } + + void SetSimpleCTSFidutialCut(const Float_t abseta, const Float_t phimin, const Float_t phimax) ; + void SetSimpleEMCALFidutialCut(const Float_t abseta, const Float_t phimin, const Float_t phimax) ; + void SetSimplePHOSFidutialCut(const Float_t abseta, const Float_t phimin, const Float_t phimax) ; + + void AddCTSFidCutMaxEtaArray(TArrayF & array) + { fCTSFidCutMaxEta = new TArrayF(array) ; } + TArrayF * GetCTSFidCutMaxEtaArray() const {return fCTSFidCutMaxEta;} + + void AddCTSFidCutMaxPhiArray(TArrayF & array) + { fCTSFidCutMaxPhi = new TArrayF(array) ; } + TArrayF * GetCTSFidCutMaxPhiArray() const {return fCTSFidCutMaxPhi;} + + void AddCTSFidCutMinEtaArray(TArrayF & array) + { fCTSFidCutMinEta = new TArrayF(array) ; } + TArrayF * GetCTSFidCutMinEtaArray() const {return fCTSFidCutMinEta;} + + void AddCTSFidCutMinPhiArray(TArrayF & array) + { fCTSFidCutMinPhi = new TArrayF(array) ; } + TArrayF * GetCTSFidCutMinPhiArray() const {return fCTSFidCutMinPhi;} + + void AddEMCALFidCutMaxEtaArray(TArrayF & array) + { fEMCALFidCutMaxEta = new TArrayF(array) ; } + TArrayF * GetEMCALFidCutMaxEtaArray() const {return fEMCALFidCutMaxEta;} + + void AddEMCALFidCutMaxPhiArray(TArrayF & array) + { fEMCALFidCutMaxPhi = new TArrayF(array) ; } + TArrayF * GetEMCALFidCutMaxPhiArray() const {return fEMCALFidCutMaxPhi;} + + void AddEMCALFidCutMinEtaArray(TArrayF & array) + { fEMCALFidCutMinEta = new TArrayF(array) ; } + TArrayF * GetEMCALFidCutMinEtaArray() const {return fEMCALFidCutMinEta;} + + void AddEMCALFidCutMinPhiArray(TArrayF & array) + { fEMCALFidCutMinPhi = new TArrayF(array) ; } + TArrayF * GetEMCALFidCutMinPhiArray() const {return fEMCALFidCutMinPhi;} + + void AddPHOSFidCutMaxEtaArray(TArrayF & array) + { fPHOSFidCutMaxEta = new TArrayF(array) ; } + TArrayF * GetPHOSFidCutMaxEtaArray() const {return fPHOSFidCutMaxEta;} + + void AddPHOSFidCutMaxPhiArray(TArrayF & array) + { fPHOSFidCutMaxPhi = new TArrayF(array) ; } + TArrayF * GetPHOSFidCutMaxPhiArray() const {return fPHOSFidCutMaxPhi;} + + void AddPHOSFidCutMinEtaArray(TArrayF & array) + { fPHOSFidCutMinEta = new TArrayF(array) ; } + TArrayF * GetPHOSFidCutMinEtaArray() const {return fPHOSFidCutMinEta;} + + void AddPHOSFidCutMinPhiArray(TArrayF & array) + { fPHOSFidCutMinPhi = new TArrayF(array) ; } + TArrayF * GetPHOSFidCutMinPhiArray() const {return fPHOSFidCutMinPhi;} + + + + protected: + + //Detector acceptance cuts + Bool_t fEMCALFidutialCut ; // Apply fidutial cuts to EMCAL clusters + Bool_t fPHOSFidutialCut ;// Apply fidutial cuts to PHOS clusters + Bool_t fCTSFidutialCut ;//Apply fidutial cuts to CTS tracks + + TArrayF * fCTSFidCutMinEta ; //Take particles in CTS with eta > fCTSFidCutMinEta + TArrayF * fCTSFidCutMinPhi ; //Take particles in CTS with phi > fCTSFidCutMinPhi + TArrayF * fCTSFidCutMaxEta ; //Take particles in CTS with eta < fCTSFidCutMaxEta + TArrayF * fCTSFidCutMaxPhi ; //Take particles in CTS with phi > fCTSFidCutMaxPhi + + TArrayF * fEMCALFidCutMinEta ; //Take particles in EMCAL with eta > fEMCALFidCutMinEta + TArrayF * fEMCALFidCutMinPhi ; //Take particles in EMCAL with phi > fEMCALFidCutMinPhi + TArrayF * fEMCALFidCutMaxEta ; //Take particles in EMCAL with eta < fEMCALFidCutMaxEta + TArrayF * fEMCALFidCutMaxPhi ; //Take particles in EMCAL with phi > fEMCALFidCutMaxPhi + + TArrayF * fPHOSFidCutMinEta ; //Take particles in PHOS with eta > fPHOSFidCutMinEta + TArrayF * fPHOSFidCutMinPhi ; //Take particles in PHOS with phi > fPHOSFidCutMinPhi + TArrayF * fPHOSFidCutMaxEta ; //Take particles in PHOS with eta < fPHOSFidCutMaxEta + TArrayF * fPHOSFidCutMaxPhi ; //Take particles in PHOS with phi > fPHOSFidCutMaxPhi + + + ClassDef(AliFidutialCut,1) +} ; + + +#endif //ALIFIDUTIALCUT_H + + + diff --git a/PWG4/AliIsolationCut.cxx b/PWG4/AliIsolationCut.cxx new file mode 100644 index 00000000000..5b445794f4e --- /dev/null +++ b/PWG4/AliIsolationCut.cxx @@ -0,0 +1,212 @@ +/************************************************************************** + * 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. * + **************************************************************************/ +/* $Id: $ */ + +/* History of cvs commits: + * + * $Log$ + + * + * + */ + +//_________________________________________________________________________ +// Class containing methods for the isolation cut. +// +// +//*-- Author: Gustavo Conesa (LNF-INFN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- +#include +#include +#include + +// --- AliRoot system --- +#include "AliIsolationCut.h" +#include "AliLog.h" +#include "AliAODParticleCorrelation.h" +#include "AliAODTrack.h" +#include "AliAODCaloCluster.h" + +ClassImp(AliIsolationCut) + +//____________________________________________________________________________ + AliIsolationCut::AliIsolationCut() : + TObject(), + fConeSize(0.),fPtThreshold(0.), fPtFraction(0.), fICMethod(0) + +{ + //default ctor + + //Initialize parameters + InitParameters(); + +} + +//____________________________________________________________________________ +AliIsolationCut::AliIsolationCut(const AliIsolationCut & g) : + TObject(g), + fConeSize(g.fConeSize), + fPtThreshold(g.fPtThreshold), + fPtFraction(g.fPtFraction), + fICMethod(g.fICMethod) +{ + // cpy ctor + +} + +//_________________________________________________________________________ +AliIsolationCut & AliIsolationCut::operator = (const AliIsolationCut & source) +{ + // assignment operator + + if(&source == this) return *this; + + fConeSize = source.fConeSize ; + fPtThreshold = source.fPtThreshold ; + fICMethod = source.fICMethod ; + fPtFraction = source.fPtFraction ; + + return *this; + +} + + + + + //____________________________________________________________________________ +void AliIsolationCut::InitParameters() +{ + //Initialize the parameters of the analysis. + + fConeSize = 0.4 ; + fPtThreshold = 1. ; + fPtFraction = 0.1 ; + + fICMethod = kPtThresIC; // 0 pt threshol method, 1 cone pt sum method + +} + +//__________________________________________________________________ +void AliIsolationCut::MakeIsolationCut(TSeqCollection * plCTS, TSeqCollection * plNe, Double_t * vertex, + const Bool_t fillAOD, AliAODParticleCorrelation *pCandidate, + const Int_t index1, const Int_t index2, + Int_t & n, Int_t & nfrac, Float_t &coneptsum, Bool_t &isolated) +{ + //Search in cone around a candidate particle if it is isolated + Float_t phiC = pCandidate->Phi() ; + Float_t etaC = pCandidate->Eta() ; + Float_t ptC = pCandidate->Pt() ; + Float_t pt = -100. ; + Float_t eta = -100. ; + Float_t phi = -100. ; + Float_t rad = -100 ; + + n = 0 ; + coneptsum = 0.; + isolated = kFALSE; + + //Check charged particles in cone. + if(plCTS){ + TVector3 p3; + for(Int_t ipr = 0;ipr < plCTS->GetEntries() ; ipr ++ ){ + if(ipr == index1 || ipr == index2) continue ;//Do not count the candidate + AliAODTrack* track = dynamic_cast(plCTS->At(ipr)) ; + p3.SetXYZ(track->Px(),track->Py(),track->Pz()); + pt = p3.Pt(); + eta = p3.Eta(); + phi = p3.Phi() ; + if(phi<0) phi+=TMath::TwoPi(); + + //Check if there is any particle inside cone with pt larger than fPtThreshold + rad = TMath::Sqrt((eta-etaC)*(eta-etaC)+ (phi-phiC)*(phi-phiC)); + + if(rad < fConeSize){ + if(fillAOD) pCandidate->AddIsolationConeTrack(track); + //printf("charged in isolation cone pt %f, phi %f, eta %f, R %f \n",pt,phi,eta,rad); + coneptsum+=pt; + if(pt > fPtThreshold ) n++; + if(pt > fPtFraction*ptC ) nfrac++; + } + }// charged particle loop + }//Tracks + + //Check neutral particles in cone. + if(plNe){ + TLorentzVector mom ; + for(Int_t ipr = 0;ipr < plNe->GetEntries() ; ipr ++ ){ + if(ipr == index1 || ipr == index2) continue ;//Do not count the candidate + AliAODCaloCluster * calo = dynamic_cast< AliAODCaloCluster *>(plNe->At(ipr)) ; + + //Skip matched clusters with tracks + if(calo->GetNTracksMatched() > 0) continue ; + + calo->GetMomentum(mom,vertex);//Assume that come from vertex in straight line + pt = mom.Pt(); + eta = mom.Eta(); + phi = mom.Phi() ; + if(phi<0) phi+=TMath::TwoPi(); + + //Check if there is any particle inside cone with pt larger than fPtThreshold + rad = TMath::Sqrt((eta-etaC)*(eta-etaC)+ (phi-phiC)*(phi-phiC)); + if(rad < fConeSize){ + if(fillAOD) pCandidate->AddIsolationConeCluster(calo); + //printf("neutral in isolation cone pt %f, phi %f, eta %f, R %f \n",pt,phi,eta,rad); + coneptsum+=pt; + if(pt > fPtThreshold ) n++; + if(pt > fPtFraction*ptC ) nfrac++; + }//in cone + }// neutral particle loop + }//neutrals + + //printf("Isolation Cut: in cone with: pT>pTthres %d, pT > pTfrac*pTcandidate %d \n",n,nfrac); + + //Check isolation, depending on method. + if( fICMethod == kPtThresIC){ + if(n==0) isolated = kTRUE ; + } + else if( fICMethod == kSumPtIC){ + if(coneptsum < fPtThreshold) + isolated = kTRUE ; + } + else if( fICMethod == kPtFracIC){ + if(nfrac==0) isolated = kTRUE ; + } + else if( fICMethod == kSumPtFracIC){ + if(coneptsum < fPtFraction*ptC) + isolated = kTRUE ; + } +} + +//__________________________________________________________________ +void AliIsolationCut::Print(const Option_t * opt) const +{ + + //Print some relevant parameters set for the analysis + if(! opt) + return; + + printf("**** Print %s %s **** \n", GetName(), GetTitle() ) ; + + printf("IC method = %d\n", fICMethod) ; + printf("Cone Size = %1.2f\n", fConeSize) ; + printf("pT threshold = %2.1f\n", fPtThreshold) ; + printf("pT fraction = %3.1f\n", fPtFraction) ; + + printf(" \n") ; + +} diff --git a/PWG4/AliIsolationCut.h b/PWG4/AliIsolationCut.h new file mode 100644 index 00000000000..b6dd7401e5b --- /dev/null +++ b/PWG4/AliIsolationCut.h @@ -0,0 +1,81 @@ +#ifndef AliIsolationCut_H +#define AliIsolationCut_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ +/* $Id: */ + +/* History of cvs commits: + * + * $Log$ + * + * + */ + +//_________________________________________________________________________ + +// Class containing methods for the isolation cut. +// +// +// + +// -- Author: Gustavo Conesa (INFN-LNF) + +// --- ROOT system --- +#include +//#include +class TSeqCollection ; + +// --- ANALYSIS system --- +//#include +class AliAODParticleCorrelation ; + +class AliIsolationCut : public TObject { + + public: + + AliIsolationCut() ; // default ctor + AliIsolationCut(const AliIsolationCut & g) ; // cpy ctor + AliIsolationCut & operator = (const AliIsolationCut & g) ;//cpy assignment + virtual ~AliIsolationCut() {;} //virtual dtalr + + enum type {kPtThresIC, kSumPtIC, kPtFracIC, kSumPtFracIC}; + + Float_t GetConeSize() const {return fConeSize ; } + Float_t GetPtThreshold() const {return fPtThreshold ; } + Float_t GetPtFraction() const {return fPtFraction ; } + Int_t GetICMethod() const {return fICMethod ; } + + void MakeIsolationCut(TSeqCollection * plCTS, TSeqCollection * plNe, Double_t * vertex, + const Bool_t fillAOD, AliAODParticleCorrelation * pCandidate, + const Int_t index1, const Int_t index2, + Int_t &n, Int_t & nfrac, Float_t &ptsum, Bool_t & isolated) ; + + void Print(const Option_t * opt)const; + + void SetConeSize(Float_t r) {fConeSize = r ; } + void SetPtThreshold(Float_t pt) {fPtThreshold = pt; } + void SetPtFraction(Float_t pt) {fPtFraction = pt; } + void SetICMethod(Int_t i ) {fICMethod = i ; } + + void InitParameters(); + + + private: + + Float_t fConeSize ; //Size of the isolation cone + Float_t fPtThreshold ; //Mimium pt of the particles in the cone or sum in cone + Float_t fPtFraction ; //Fraction of the momentum of particles in cone or sum in cone + Int_t fICMethod ; //Isolation cut method to be used + // kPtIC: Pt threshold method + // kSumPtIC: Cone pt sum method + // kPtFracIC: Pt threshold, fraction of candidate pt, method + // kSumPtFracIC: Cone pt sum , fraction of cone sum, method + + ClassDef(AliIsolationCut,1) +} ; + + +#endif //AliIsolationCut_H + + + diff --git a/PWG4/PWG4PartCorrLinkDef.h b/PWG4/PWG4PartCorrLinkDef.h new file mode 100644 index 00000000000..a383786b961 --- /dev/null +++ b/PWG4/PWG4PartCorrLinkDef.h @@ -0,0 +1,30 @@ +#ifdef __CINT__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class AliAnaCaloTrigger+; +#pragma link C++ class AliAnaCaloTriggerMC+; +#pragma link C++ class AliAODParticleCorrelation+; +#pragma link C++ class AliAnalysisTaskPHOSExample+; +#pragma link C++ class AliAnaScale+; +#pragma link C++ class AliNeutralMesonSelection+; +#pragma link C++ class AliFidutialCut+; +#pragma link C++ class AliCaloPID+; +#pragma link C++ class AliIsolationCut+; +#pragma link C++ class AliAnaMaker+; +#pragma link C++ class AliAnaBaseClass+; +#pragma link C++ class AliAnaExample+; +#pragma link C++ class AliAnaGammaDirect+; +#pragma link C++ class AliAnaParticlePartonCorrelation+; +#pragma link C++ class AliAnaParticleHadronCorrelation+; +//#pragma link C++ class AliAnaParticleJetLeadingConeCorrelation+; +//#pragma link C++ class AliAnaParticleJetFinderCorrelation+; +#pragma link C++ class AliAnalysisTaskParticleCorrelation+; +#pragma link C++ class AliCaloTrackReader+; +#pragma link C++ class AliCaloTrackESDReader+; +#pragma link C++ class AliCaloTrackAODReader+; +#pragma link C++ class AliCaloTrackMCReader+; + +#endif diff --git a/PWG4/libPWG4PartCorr.pkg b/PWG4/libPWG4PartCorr.pkg new file mode 100644 index 00000000000..a6faf4c0878 --- /dev/null +++ b/PWG4/libPWG4PartCorr.pkg @@ -0,0 +1,25 @@ +#-*- Mode: Makefile -*- + +SRCS = AliAnaCaloTrigger.cxx AliAnaCaloTriggerMC.cxx \ + AliAODParticleCorrelation.cxx AliAnalysisTaskPHOSExample.cxx \ + AliNeutralMesonSelection.cxx AliFidutialCut.cxx AliCaloPID.cxx AliIsolationCut.cxx\ + AliAnaScale.cxx AliAnaMaker.cxx \ + AliAnaBaseClass.cxx AliAnaExample.cxx AliAnaGammaDirect.cxx \ + AliAnaParticlePartonCorrelation.cxx AliAnaParticleHadronCorrelation.cxx \ + AliAnalysisTaskParticleCorrelation.cxx \ + AliCaloTrackReader.cxx AliCaloTrackESDReader.cxx \ + AliCaloTrackAODReader.cxx AliCaloTrackMCReader.cxx + + #AliAnaParticleJetLeadingConeCorrelation.cxx AliAnaParticleJetFinderCorrelation.cxx \ + +HDRS:= $(SRCS:.cxx=.h) + +DHDR:= PWG4PartCorrLinkDef.h + +EXPORT:=$(SRCS:.cxx=.h) + +ifeq (win32gcc,$(ALICE_TARGET)) +PACKSOFLAGS:= $(SOFLAGS) -L$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET) -lSTEERBase \ + -lESD -lAOD -lANALYSIS -lANALYSISalice \ + -L$(shell root-config --libdir) -lEG +endif diff --git a/PWG4/macros/ConfigAnalysisESDExample.C b/PWG4/macros/ConfigAnalysisESDExample.C new file mode 100644 index 00000000000..39130de2654 --- /dev/null +++ b/PWG4/macros/ConfigAnalysisESDExample.C @@ -0,0 +1,180 @@ +/* $Id: $ */ +/* $Log$ */ + +//------------------------------------ +// Configuration macro example: +// +// Do prompt photon analysis with ESDs +// +// Author : Gustavo Conesa Balbastre (INFN-LNF) +//------------------------------------ + +AliAnaMaker* ConfigAnalysis() +{ + // + // Configuration goes here + // + printf("======================== \n"); + printf("ConfigAnalysis() \n"); + printf("======================== \n"); + + + //Detector Fidutial Cuts + AliFidutialCut * fidCut = new AliFidutialCut(); + //Select particles depending on acceptance + //kFALSE, open cuts + fidCut->DoCTSFidutialCut(kTRUE) ; + fidCut->DoEMCALFidutialCut(kTRUE) ; + fidCut->DoPHOSFidutialCut(kTRUE) ; + + //Select particles in one region of the detectors + fidCut->SetSimpleCTSFidutialCut(0.9,0.,360.); + fidCut->SetSimpleEMCALFidutialCut(0.7,80.,190.); + fidCut->SetSimplePHOSFidutialCut(0.13,220.,320.); + + //Select particles in N regions of the detectors + // Float_t etamax[]={0.67,0.51,0.16,-0.21,-0.61}; + // TArrayF etamaxarr(5,etamax); + // fidCut->AddEMCALFidCutMaxEtaArray(etamaxarr); + // Float_t etamin[]={0.61,0.21,-0.16,-0.51,-0.67}; + // TArrayF etaminarr(5,etamin); + // fidCut->AddEMCALFidCutMinEtaArray(etaminarr); + // Float_t phimax[]={99.*TMath::DegToRad(), 119.*TMath::DegToRad(), 139.*TMath::DegToRad(), + // 159.*TMath::DegToRad(), 179.*TMath::DegToRad(), 189.*TMath::DegToRad()}; + // TArrayF phimaxarr(6,phimax); + // fidCut->AddEMCALFidCutMaxPhiArray(phimaxarr); + // Float_t phimin[]={81.*TMath::DegToRad(), 101.*TMath::DegToRad(), 121.*TMath::DegToRad(), + // 141.*TMath::DegToRad(), 161.*TMath::DegToRad(), 181.*TMath::DegToRad()}; + // TArrayF phiminarr(6,phimin); + // fidCut->AddEMCALFidCutMinPhiArray(phiminarr); + + // //Fidutial cut PHOS + // TArrayF etamaxarr(1,etamax); + // etamaxarr.SetAt(0.12,0); + // fidCut->AddPHOSFidCutMaxEtaArray(etamaxarr); + // TArrayF etaminarr(1,etamin); + // etaminarr.SetAt(-0.12,0); + // fidCut->AddPHOSFidCutMinEtaArray(etaminarr); + // TArrayF phimaxarr(1,phimax); + // phimaxarr.SetAt(320.*TMath::DegToRad(),0); + // fidCut->AddPHOSFidCutMaxPhiArray(phimaxarr); + // TArrayF phiminarr(1,phimin); + // phiminarr.SetAt(220.*TMath::DegToRad(),0); + // fidCut->AddPHOSFidCutMinPhiArray(phiminarr); + + // //Fidutial cut CTS + // TArrayF etamaxarr(1,etamax); + // etamaxarr.SetAt(0.12,0); + // fidCut->AddCTSFidCutMaxEtaArray(etamaxarr); + // TArrayF etaminarr(1,etamin); + // etaminarr.SetAt(-0.12,0); + // fidCut->AddCTSFidCutMinEtaArray(etaminarr); + // TArrayF phimaxarr(1,phimax); + // phimaxarr.SetAt(320.*TMath::DegToRad(),0); + // fidCut->AddCTSFidCutMaxPhiArray(phimaxarr); + // TArrayF phiminarr(1,phimin); + // phiminarr.SetAt(220.*TMath::DegToRad(),0); + // fidCut->AddCTSFidCutMinPhiArray(phiminarr); + + fidCut->Print(""); + + //----------------------------------------------------------- + // Reader + //----------------------------------------------------------- + AliCaloTrackReader *reader = new AliCaloTrackESDReader(); + reader->SetDebug(-1); + + //Switch on or off the detectors information that you want + //It will fill the corresponding detector arrays + reader->SwitchOnEMCAL(); + reader->SwitchOnCTS(); + reader->SwitchOnPHOS(); + reader->SwitchOnEMCALCells(); + reader->SwitchOnPHOSCells(); + //reader->SwitchOffEMCAL(); + //reader->SwitchOffCTS(); + //reader->SwitchOffPHOS(); + //reader->SwitchOffEMCALCells(); + //reader->SwitchOffPHOSCells(); + + //Min particle pT + //Selections done while filling the detector arrays + reader->SetEMCALPtMin(0.5); + reader->SetPHOSPtMin(0.5); + reader->SetCTSPtMin(0.2); + + reader->SetFidutialCut(fidCut); + + reader->Print(""); + + + //--------------------------------------------------------------------- + // Analysis algorithm + //--------------------------------------------------------------------- + + //Some settings for the analysis + + //Detector Fidutial Cuts for analysis part + //You can define different cuts for your analysis + AliFidutialCut * fidCut2 = new AliFidutialCut(); + fidCut2->DoCTSFidutialCut(kFALSE) ; + fidCut2->DoEMCALFidutialCut(kTRUE) ; + fidCut2->DoPHOSFidutialCut(kTRUE) ; + + fidCut2->SetSimpleCTSFidutialCut(0.9,0.,360.); + fidCut2->SetSimpleEMCALFidutialCut(0.7,80.,160.); + fidCut2->SetSimplePHOSFidutialCut(0.13,220.,280.); + + AliCaloPID * pid = new AliCaloPID(); + // use selection with simple weights + pid->SetPHOSPhotonWeight(0.7); pid->SetPHOSPi0Weight(0.7); + pid->SetEMCALPhotonWeight(0.7); pid->SetEMCALPi0Weight(0.7); + // use more complicated selection, particle weight depending on cluster energy, + // only for PHOS + // pid->UsePHOSPIDWeightFormula(kTRUE); + // TFormula * photonF = new TFormula("photonWeight","0.98*(x<40)+ 0.68*(x>=100)+(x>=40 && x<100)*(0.98+x*(6e-3)-x*x*(2e-04)+x*x*x*(1.1e-06))"); + // TFormula * pi0F = new TFormula("pi0Weight","0.98*(x<65)+ 0.915*(x>=100)+(x>=65 && x-x*(1.95e-3)-x*x*(4.31e-05)+x*x*x*(3.61e-07))"); + // pid->SetPHOSPhotonWeightFormula(photonF); + // pid->SetPHOSPi0WeightFormula(pi0F); + + AliAnaExample *ana = new AliAnaExample(); + ana->SetDebug(-1); + //Do PID selection with settings defined up + ana->SetCaloPID(pid); + ana->SwitchOnCaloPID(); + //Do Acceptance selection with settings defined up + ana->SetFidutialCut(fidCut2); + + ana->SetPdg(AliCaloPID::kPhoton); //plot identified photons + ana->SetDetector("PHOS"); //Detector for the analysis + ana->SetMinPt(2);// Minimum pt of clusters/tracks + + ana->SwitchOnDataMC() ; //Access to the stack and fill + // some histograms with MC information + + ana->Print(""); + + //AliAnaExample *ana2 = new AliAnaExample(); + + //--------------------------------------------------------------------- + // Set analysis algorithm and reader + //--------------------------------------------------------------------- + maker = new AliAnaMaker(); + maker->SetReader(reader);//pointer to reader + maker->AddAnalysis(ana,0); + //maker->AddAnalysis(ana2,1); + maker->SetAODBranchName("Test"); + maker->SetAnaDebug(1) ; + maker->SwitchOnAODsMaker() ; + //maker->SwitchOffAODsMaker() ; + maker->SwitchOnHistogramsMaker() ; + //maker->SwitchOffHistogramsMaker() ; + + + maker->Print(""); + // + printf("======================== \n"); + printf("END ConfigAnalysis() \n"); + printf("======================== \n"); + return maker ; +} diff --git a/PWG4/macros/ConfigAnalysisGammaDirect.C b/PWG4/macros/ConfigAnalysisGammaDirect.C new file mode 100644 index 00000000000..d92b7d26287 --- /dev/null +++ b/PWG4/macros/ConfigAnalysisGammaDirect.C @@ -0,0 +1,140 @@ +/* $Id: $ */ +/* $Log$ */ + +//------------------------------------ +// Configuration macro example: +// +// Do prompt photon analysis with ESDs +// Gamma in PHOS, +// for EMCAL, PHOS by EMCAL where necessary +// +// Author : Gustavo Conesa Balbastre (INFN-LNF) +//------------------------------------ + +AliAnaMaker* ConfigAnalysis() +{ + // + // Configuration goes here + // + printf("======================== \n"); + printf("ConfigAnalysis() \n"); + printf("======================== \n"); + + + //Detector Fidutial Cuts + AliFidutialCut * fidCut = new AliFidutialCut(); + fidCut->DoCTSFidutialCut(kTRUE) ; + //fidCut->DoEMCALFidutialCut(kFALSE) ; + fidCut->DoPHOSFidutialCut(kTRUE) ; + + fidCut->SetSimpleCTSFidutialCut(0.9,0.,360.); + f//idCut->SetSimpleEMCALFidutialCut(0.7,80.,190.); + fidCut->SetSimplePHOSFidutialCut(0.13,220.,320.); + + fidCut->Print(""); + + //----------------------------------------------------------- + // Reader + //----------------------------------------------------------- + AliCaloTrackReader *reader = new AliCaloTrackESDReader(); + reader->SetDebug(-1); + + //Switch on or off the detectors information that you want + reader->SwitchOffEMCAL(); + reader->SwitchOnCTS(); + reader->SwitchOnPHOS(); + + //Min particle pT + //reader->SetEMCALPtMin(0.5); + reader->SetPHOSPtMin(0.5); + reader->SetCTSPtMin(0.2); + + reader->SetFidutialCut(fidCut); + reader->Print(""); + + + //--------------------------------------------------------------------- + // Analysis algorithm + //--------------------------------------------------------------------- + + //Detector Fidutial Cuts for analysis part + AliFidutialCut * fidCut2 = new AliFidutialCut(); + fidCut2->DoCTSFidutialCut(kFALSE) ; + //fidCut2->DoEMCALFidutialCut(kTRUE) ; + fidCut2->DoPHOSFidutialCut(kFALSE) ; + + fidCut2->SetSimpleCTSFidutialCut(0.9,0.,360.); + //fidCut2->SetSimpleEMCALFidutialCut(0.7,80.,190.); + fidCut2->SetSimplePHOSFidutialCut(0.13,220.,320.); + fidCut2->Print(""); + + AliCaloPID * pid = new AliCaloPID(); + // use selection with simple weights + pid->SetPHOSPhotonWeight(0.7); pid->SetPHOSPi0Weight(0.7); + pid->SetEMCALPhotonWeight(0.7); pid->SetEMCALPi0Weight(0.7); + // use more complicated selection, particle weight depending on cluster energy +// pid->UsePHOSPIDWeightFormula(kTRUE); +// TFormula * photonF = new TFormula("photonWeight","0.98*(x<40)+ 0.68*(x>=100)+(x>=40 && x<100)*(0.98+x*(6e-3)-x*x*(2e-04)+x*x*x*(1.1e-06))"); +// TFormula * pi0F = new TFormula("pi0Weight","0.98*(x<65)+ 0.915*(x>=100)+(x>=65 && x-x*(1.95e-3)-x*x*(4.31e-05)+x*x*x*(3.61e-07))"); +// pid->SetPHOSPhotonWeightFormula(photonF); +// pid->SetPHOSPi0WeightFormula(pi0F); + pid->Print(""); + + AliIsolationCut * ic = new AliIsolationCut(); + ic->SetConeSize(0.4); + ic->SetPtThreshold(1.); + ic->SetICMethod(AliIsolationCut::kPtThresIC); + ic->Print(""); + + AliAnaGammaDirect *ana = new AliAnaGammaDirect(); + ana->SetDebug(-1); + ana->SetMinPt(5.); + ana->SetCaloPID(pid); + ana->SetFidutialCut(fidCut2); + ana->SetIsolationCut(ic) ; + ana->SetDetector("PHOS"); + ana->SwitchOnDataMC() ;//Access MC stack and fill more histograms + + ana->SwitchOnCaloPID(); + ana->SwitchOffCaloPIDRecalculation(); //recommended for EMCAL + ana->SwitchOnFidutialCut(); + //Select clusters with no pair, if both clusters with pi0 mass + ana->SwitchOffInvariantMass(); + //Do isolation cut + ana->SwitchOnIsolation(); + + //Do or not do isolation with previously produced AODs. + //No effect if use of SwitchOnSeveralIsolation() + ana->SwitchOffReIsolation(); + + //Multiple IC + ana->SwitchOffSeveralIsolation() ; +// ana->SwitchOnSeveralIsolation() ; +// ana->SetNCones(2) ; +// ana->SetNPtThresFrac(2) ; +// ana->SetConeSizes(0, 0.3) ; ana->SetConeSizes(1, 0.4) ; +// ana->SetPtThresholds(0, 0.5) ; ana->SetPtThresholds(1, 1.) ; +// ana->SetPtFractions(0, 1.) ; ana->SetPtFractions(1, 1.5) ; + + ana->Print(""); + + //--------------------------------------------------------------------- + // Set analysis algorithm and reader + //--------------------------------------------------------------------- + maker = new AliAnaMaker(); + maker->SetReader(reader);//pointer to reader + maker->AddAnalysis(ana,0); + maker->SetAODBranchName("Photon"); + maker->SetAnaDebug(1) ; + maker->SwitchOnHistogramsMaker() ; + //maker->SwitchOffHistogramsMaker() ; + maker->SwitchOnAODsMaker() ; + //maker->SwitchOffAODsMaker() ; + + maker->Print(""); + // + printf("======================== \n"); + printf("END ConfigAnalysis() \n"); + printf("======================== \n"); + return maker ; +} diff --git a/PWG4/macros/ConfigAnalysisGammaHadronCorrelation.C b/PWG4/macros/ConfigAnalysisGammaHadronCorrelation.C new file mode 100644 index 00000000000..4b8c22a7127 --- /dev/null +++ b/PWG4/macros/ConfigAnalysisGammaHadronCorrelation.C @@ -0,0 +1,134 @@ +/* $Id: $ */ +/* $Log$ */ + +//------------------------------------ +// Configuration macro example: +// +// Do prompt photon - hadron correlation analysis with ESDs +// +// Author : Gustavo Conesa Balbastre (INFN-LNF) +//------------------------------------ + +AliAnaMaker* ConfigAnalysis() +{ + // + // Configuration goes here + // + printf("======================== \n"); + printf("ConfigAnalysis() \n"); + printf("======================== \n"); + + + //Detector Fidutial Cuts + AliFidutialCut * fidCut = new AliFidutialCut(); + fidCut->DoCTSFidutialCut(kTRUE) ; + fidCut->DoEMCALFidutialCut(kTRUE) ; + fidCut->DoPHOSFidutialCut(kTRUE) ; + + fidCut->SetSimpleCTSFidutialCut(0.9,0.,360.); + fidCut->SetSimpleEMCALFidutialCut(0.7,80.,190.); + fidCut->SetSimplePHOSFidutialCut(0.13,220.,320.); + + fidCut->Print(""); + + //----------------------------------------------------------- + // Reader + //----------------------------------------------------------- + AliCaloTrackReader *reader = new AliCaloTrackESDReader(); + reader->SetDebug(-1); + + //Switch on or off the detectors information that you want + reader->SwitchOnEMCAL(); + reader->SwitchOnCTS(); + reader->SwitchOnPHOS(); + reader->SwitchOffEMCALCells(); + reader->SwitchOffPHOSCells(); + + + //Min particle pT + reader->SetEMCALPtMin(0.5); + reader->SetPHOSPtMin(0.5); + reader->SetCTSPtMin(0.2); + + reader->SetFidutialCut(fidCut); + reader->Print(""); + + + //--------------------------------------------------------------------- + // Analysis algorithm + //--------------------------------------------------------------------- + + //Detector Fidutial Cuts for analysis part + AliFidutialCut * fidCut2 = new AliFidutialCut(); + fidCut2->DoCTSFidutialCut(kFALSE) ; + fidCut2->DoEMCALFidutialCut(kTRUE) ; + fidCut2->DoPHOSFidutialCut(kFALSE) ; + + fidCut2->SetSimpleCTSFidutialCut(0.9,0.,360.); + fidCut2->SetSimpleEMCALFidutialCut(0.7,80.,190.); + fidCut2->SetSimplePHOSFidutialCut(0.13,220.,320.); + fidCut2->Print(""); + + AliCaloPID * pid = new AliCaloPID(); + // use selection with simple weights + pid->SetPHOSPhotonWeight(0.7); pid->SetPHOSPi0Weight(0.7); + pid->SetEMCALPhotonWeight(0.7); pid->SetEMCALPi0Weight(0.7); + + pid->Print(""); + + AliIsolationCut * ic = new AliIsolationCut(); + ic->SetConeSize(0.4); + ic->SetPtThreshold(1.); + ic->SetICMethod(AliIsolationCut::kPtThresIC); + ic->Print(""); + + //Photon Analysis + AliAnaGammaDirect *ana = new AliAnaGammaDirect(); + ana->SetDebug(-1); + ana->SetMinPt(5.); + ana->SetCaloPID(pid); + ana->SetFidutialCut(fidCut2); + ana->SetIsolationCut(ic) ; + ana->SetDetector("PHOS"); + ana->SwitchOnIsolation(); + ana->SwitchOnCaloPID(); + ana->SwitchOffCaloPIDRecalculation(); //recommended for EMCAL + ana->SwitchOffFidutialCut(); + ana->SwitchOffInvariantMass(); + ana->SwitchOffDataMC() ; + + ana->Print(""); + + //Photon- hadron correlation + AliAnaParticleHadronCorrelation *ana2 = new AliAnaParticleHadronCorrelation(); + ana2->SetDebug(-1); + ana2->SetCaloPID(pid); + ana2->SwitchOnCaloPID(); + ana2->SwitchOnCaloPIDRecalculation(); //recommended for EMCAL + ana2->SwitchOffFidutialCut(); + ana2->SetPtCutRange(1,100); + ana2->SetDeltaPhiCutRange(1.5,4.5); + + ana2->Print(""); + //--------------------------------------------------------------------- + // Set analysis algorithm and reader + //--------------------------------------------------------------------- + maker = new AliAnaMaker(); + maker->SetReader(reader);//pointer to reader + maker->AddAnalysis(ana,0); + maker->AddAnalysis(ana2,1); + maker->SetAODBranchName("PhotonHadronCorrelation"); + maker->SetAnaDebug(-1) ; + maker->SwitchOnHistogramsMaker() ; + //maker->SwitchOffHistogramsMaker() ; + maker->SwitchOnAODsMaker() ; + //maker->SwitchOffAODsMaker() ; + + maker->Print(""); + // + printf("======================== \n"); + printf("END ConfigAnalysis() \n"); + printf("======================== \n"); + return maker ; +} + diff --git a/PWG4/macros/ConfigAnalysisGammaPartonCorrelation.C b/PWG4/macros/ConfigAnalysisGammaPartonCorrelation.C new file mode 100644 index 00000000000..650fa935d4a --- /dev/null +++ b/PWG4/macros/ConfigAnalysisGammaPartonCorrelation.C @@ -0,0 +1,126 @@ +/* $Id: $ */ +/* $Log$ */ + +//------------------------------------ +// Configuration macro example: +// +// Do prompt photon and parton correlation analysis +// +// Author : Gustavo Conesa Balbastre (INFN-LNF) +//------------------------------------ + +AliAnaMaker* ConfigAnalysis() +{ + // + // Configuration goes here + // + printf("======================== \n"); + printf("ConfigAnalysis() \n"); + printf("======================== \n"); + + + //Detector Fidutial Cuts + AliFidutialCut * fidCut = new AliFidutialCut(); + fidCut->DoCTSFidutialCut(kTRUE) ; + fidCut->DoEMCALFidutialCut(kTRUE) ; + fidCut->DoPHOSFidutialCut(kTRUE) ; + + fidCut->SetSimpleCTSFidutialCut(0.9,0.,360.); + fidCut->SetSimpleEMCALFidutialCut(0.7,80.,190.); + fidCut->SetSimplePHOSFidutialCut(0.13,220.,320.); + + fidCut->Print(""); + + //----------------------------------------------------------- + // Reader + //----------------------------------------------------------- + AliCaloTrackReader *reader = new AliCaloTrackESDReader(); + reader->SetDebug(-1); + + //Switch on or off the detectors information that you want + reader->SwitchOnEMCAL(); + reader->SwitchOnCTS(); + reader->SwitchOnPHOS(); + reader->SwitchOffEMCALCells(); + reader->SwitchOffPHOSCells(); + + //Min particle pT + reader->SetEMCALPtMin(0.5); + reader->SetPHOSPtMin(0.5); + reader->SetCTSPtMin(0.2); + + reader->SetFidutialCut(fidCut); + reader->Print(""); + + + //--------------------------------------------------------------------- + // Analysis algorithm + //--------------------------------------------------------------------- + + //Detector Fidutial Cuts for analysis part + AliFidutialCut * fidCut2 = new AliFidutialCut(); + fidCut2->DoCTSFidutialCut(kFALSE) ; + fidCut2->DoEMCALFidutialCut(kTRUE) ; + fidCut2->DoPHOSFidutialCut(kFALSE) ; + + fidCut2->SetSimpleCTSFidutialCut(0.9,0.,360.); + fidCut2->SetSimpleEMCALFidutialCut(0.7,80.,190.); + fidCut2->SetSimplePHOSFidutialCut(0.13,220.,320.); + fidCut2->Print(""); + + AliCaloPID * pid = new AliCaloPID(); + // use selection with simple weights + pid->SetPHOSPhotonWeight(0.7); pid->SetPHOSPi0Weight(0.7); + pid->SetEMCALPhotonWeight(0.7); pid->SetEMCALPi0Weight(0.7); + pid->Print(""); + + AliIsolationCut * ic = new AliIsolationCut(); + ic->SetConeSize(0.4); + ic->SetPtThreshold(1.); + ic->SetICMethod(AliIsolationCut::kPtThresIC); + ic->Print(""); + + //Photon Analysis + AliAnaGammaDirect *ana = new AliAnaGammaDirect(); + ana->SetDebug(-1); + ana->SetMinPt(5.); + ana->SetCaloPID(pid); + ana->SetFidutialCut(fidCut2); + ana->SetIsolationCut(ic) ; + ana->SetDetector("PHOS"); + ana->SwitchOnIsolation(); + //ana->SwitchOffIsolation(); + ana->SwitchOffReIsolation(); //Do not do isolation with previously produced AODs. + ana->SwitchOffCaloPID(); + ana->SwitchOffCaloPIDRecalculation(); //recommended for EMCAL + ana->SwitchOffFidutialCut(); + ana->SwitchOffDataMC() ; + + ana->Print(""); + + //Photon parton correlation + AliAnaParticlePartonCorrelation *ana2 = new AliAnaParticlePartonCorrelation(); + ana2->SetDebug(2); + //ana2->Print(""); + + //--------------------------------------------------------------------- + // Set analysis algorithm and reader + //--------------------------------------------------------------------- + maker = new AliAnaMaker(); + maker->SetReader(reader);//pointer to reader + maker->AddAnalysis(ana,0); + maker->AddAnalysis(ana2,1); + maker->SetAODBranchName("PhotonHadronCorrelation"); + maker->SetAnaDebug(1) ; + maker->SwitchOnHistogramsMaker() ; + //maker->SwitchOffHistogramsMaker() ; + maker->SwitchOnAODsMaker() ; + //maker->SwitchOffAODsMaker() ; + + maker->Print(""); + // + printf("======================== \n"); + printf("END ConfigAnalysis() \n"); + printf("======================== \n"); + return maker ; +} diff --git a/PWG4/macros/ana.C b/PWG4/macros/ana.C new file mode 100644 index 00000000000..94bf134d390 --- /dev/null +++ b/PWG4/macros/ana.C @@ -0,0 +1,445 @@ +/* $Id: $ */ +/* $Log$ +/* */ + +//-------------------------------------------------- +// Example macro to do analysis with the +// analysis classes in PWG4PartCorr +// Can be executed with Root and AliRoot +// +// Pay attention to the options and definitions +// set in the lines below +// +// Author : Gustavo Conesa Balbastre (INFN-LNF) +// +//------------------------------------------------- +enum anaModes {mLocal, mLocalCAF,mPROOF,mGRID}; +//mLocal: Analyze locally files in your computer +//mLocalCAF: Analyze locally CAF files +//mPROOF: Analyze CAF files with PROOF + +//--------------------------------------------------------------------------- +//Settings to read locally several files, only for "mLocal" mode +//The different values are default, they can be set with environmental +//variables: INDIR, PATTERN, NEVENT, respectivelly +char * kInDir = "/home/user/data"; +char * kPattern = ""; // Data are in diles /data/Run0, +// /Data/Run1 ... +Int_t kEvent = 1; // Number of files +//--------------------------------------------------------------------------- +//Collection file for grid analysis +char * kXML = "collection.xml"; +//--------------------------------------------------------------------------- +//Scale histograms from file. Change to kTRUE when xsection file exists +//Put name of file containing xsection +//Put number of events per ESD file +//This is an specific case for normalization of Pythia files. +const Bool_t kGetXSectionFromFileAndScale = kFALSE ; +const char * kXSFileName = "pyxsec.root"; +const Int_t kNumberOfEventsPerFile = 100; +//--------------------------------------------------------------------------- + +const Bool_t kMC = kTRUE; //With real data kMC = kFALSE +const TString kInputData = "ESD"; +void ana(Int_t mode=mLocal, TString configName = "ConfigAnalysisESDExample") +{ + // Main + + //-------------------------------------------------------------------- + // Load analysis libraries + // Look at the method below, + // change whatever you need for your analysis case + // ------------------------------------------------------------------ + LoadLibraries(mode) ; + + //------------------------------------------------------------------------------------------------- + //Create chain from ESD and from cross sections files, look below for options. + //------------------------------------------------------------------------------------------------- + TChain *chain = new TChain("esdTree") ; + TChain * chainxs = new TChain("Xsection") ; + CreateChain(mode, chain, chainxs); + + if(chain){ + AliLog::SetGlobalLogLevel(AliLog::kError);//Minimum prints on screen + + //-------------------------------------- + // Make the analysis manager + //------------------------------------- + AliAnalysisManager *mgr = new AliAnalysisManager("Manager", "Manager"); + // MC handler + if(kMC){ + AliMCEventHandler* mcHandler = new AliMCEventHandler(); + mcHandler->SetReadTR(kFALSE);//Do not search TrackRef file + mgr->SetMCtruthEventHandler(mcHandler); + } + + // AOD output handler + AliAODHandler* aodoutHandler = new AliAODHandler(); + aodoutHandler->SetOutputFileName("aod.root"); + //aodoutHandler->SetCreateNonStandardAOD(); + mgr->SetOutputEventHandler(aodoutHandler); + + //input + if(kInputData == "ESD"){ + // ESD handler + AliESDInputHandler *esdHandler = new AliESDInputHandler(); + mgr->SetInputEventHandler(esdHandler); + } + if(kInputData == "AOD"){ + // AOD handler + AliAODInputHandler *aodHandler = new AliAODInputHandler(); + mgr->SetInputEventHandler(aodHandler); + } + + //mgr->SetDebugLevel(10); // For debugging + + //------------------------------------------------------------------------- + //Define task, put here any other task that you want to use. + //------------------------------------------------------------------------- + AliAnalysisTaskParticleCorrelation * taskpwg4 = new AliAnalysisTaskParticleCorrelation ("Particle"); + taskpwg4->SetConfigFileName(configName); //Default name is ConfigAnalysis + mgr->AddTask(taskpwg4); + + // Create containers for input/output + AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain",TChain::Class(), + AliAnalysisManager::kInputContainer); + AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("tree", TTree::Class(), + AliAnalysisManager::kOutputContainer, "default"); + AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("histos", TList::Class(), + AliAnalysisManager::kOutputContainer, "histos.root"); + + mgr->ConnectInput (taskpwg4, 0, cinput1); + mgr->ConnectOutput (taskpwg4, 0, coutput1 ); + mgr->ConnectOutput (taskpwg4, 1, coutput2 ); + + //------------------------ + //Scaling task + //----------------------- + Int_t nfiles = chainxs->GetEntries(); + if(kGetXSectionFromFileAndScale && nfiles > 0){ + //Get the cross section + Double_t xsection=0; + Float_t ntrials = 0; + GetAverageXsection(chainxs, xsection, ntrials); + + AliAnaScale * scale = new AliAnaScale("scale") ; + scale->Set(xsection/ntrials/kNumberOfEventsPerFile/nfiles) ; + mgr->AddTask(scale); + + AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("histosscaled", TList::Class(), + AliAnalysisManager::kOutputContainer, "histosscaled.root"); + mgr->ConnectInput (scale, 0, coutput2); + mgr->ConnectOutput (scale, 0, coutput3 ); + } + + //----------------------- + // Run the analysis + //----------------------- + TString smode = ""; + if (mode==mLocal || mode == mLocalCAF) + smode = "local"; + else if (mode==mPROOF) + smode = "proof"; + else if (mode==mGRID) + smode = "grid"; + + mgr->InitAnalysis(); + mgr->PrintStatus(); + mgr->StartAnalysis(smode.Data(),chain); + } + else cout << "Chain was not produced ! "<Load("libTree.so"); + gSystem->Load("libGeom.so"); + gSystem->Load("libVMC.so"); + gSystem->Load("libXMLIO.so"); + + //---------------------------------------------------------- + // >>>>>>>>>>> Local mode <<<<<<<<<<<<<< + //---------------------------------------------------------- + if (mode==mLocal || mode == mLocalCAF || mode == mGRID) { + //-------------------------------------------------------- + // If you want to use already compiled libraries + // in the aliroot distribution + //-------------------------------------------------------- + //gSystem->Load("libSTEERBase"); + //gSystem->Load("libESD"); + //gSystem->Load("libAOD"); + //gSystem->Load("libANALYSIS"); + //gSystem->Load("libANALYSISalice"); + //gSystem->Load("libPWG4PartCorr"); + + //-------------------------------------------------------- + //If you want to use root and par files from aliroot + //-------------------------------------------------------- + SetupPar("STEERBase"); + SetupPar("ESD"); + SetupPar("AOD"); + SetupPar("ANALYSIS"); + SetupPar("ANALYSISalice"); + SetupPar("PWG4PartCorr"); + + } + + //--------------------------------------------------------- + // <<<<<<<<<< PROOF mode >>>>>>>>>>>> + //--------------------------------------------------------- + else if (mode==mPROOF) { + // + // Connect to proof + // Put appropriate username here + // TProof::Reset("proof://mgheata@lxb6046.cern.ch"); + TProof::Open("proof://mgheata@lxb6046.cern.ch"); + + // gProof->ClearPackages(); + // gProof->ClearPackage("ESD"); + // gProof->ClearPackage("AOD"); + // gProof->ClearPackage("ANALYSIS"); + // gProof->ClearPackage("PWG4PartCorr"); + + // Enable the STEERBase Package + gProof->UploadPackage("STEERBase.par"); + gProof->EnablePackage("STEERBase"); + // Enable the ESD Package + gProof->UploadPackage("ESD.par"); + gProof->EnablePackage("ESD"); + // Enable the AOD Package + gProof->UploadPackage("AOD.par"); + gProof->EnablePackage("AOD"); + // Enable the Analysis Package + gProof->UploadPackage("ANALYSIS.par"); + gProof->EnablePackage("ANALYSIS"); + // Enable gamma jet analysis + gProof->UploadPackage("PWG4PartCorr.par"); + gProof->EnablePackage("PWG4PartCorr"); + // + gProof->ShowEnabledPackages(); + } + +} + +void SetupPar(char* pararchivename) +{ + //Load par files, create analysis libraries + //For testing, if par file already decompressed and modified + //classes then do not decompress. + + TString cdir(Form("%s", gSystem->WorkingDirectory() )) ; + TString parpar(Form("%s.par", pararchivename)) ; + if ( gSystem->AccessPathName(parpar.Data()) ) { + gSystem->ChangeDirectory(gSystem->Getenv("ALICE_ROOT")) ; + TString processline(Form(".! make %s", parpar.Data())) ; + gROOT->ProcessLine(processline.Data()) ; + gSystem->ChangeDirectory(cdir) ; + processline = Form(".! mv /tmp/%s .", parpar.Data()) ; + gROOT->ProcessLine(processline.Data()) ; + } + if ( gSystem->AccessPathName(pararchivename) ) { + TString processline = Form(".! tar xvzf %s",parpar.Data()) ; + gROOT->ProcessLine(processline.Data()); + } + + TString ocwd = gSystem->WorkingDirectory(); + gSystem->ChangeDirectory(pararchivename); + + // check for BUILD.sh and execute + if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) { + printf("*******************************\n"); + printf("*** Building PAR archive ***\n"); + cout<Exec("PROOF-INF/BUILD.sh")) { + Error("runProcess","Cannot Build the PAR Archive! - Abort!"); + return -1; + } + } + // check for SETUP.C and execute + if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) { + printf("*******************************\n"); + printf("*** Setup PAR archive ***\n"); + cout<Macro("PROOF-INF/SETUP.C"); + } + + gSystem->ChangeDirectory(ocwd.Data()); + printf("Current dir: %s\n", ocwd.Data()); +} + + + +void CreateChain(const anaModes mode, TChain * chain, TChain * chainxs){ + //Fills chain with data + TString ocwd = gSystem->WorkingDirectory(); + + //----------------------------------------------------------- + //Analysis of CAF data locally and with PROOF + //----------------------------------------------------------- + if(mode ==mPROOF || mode ==mLocalCAF){ + // Chain from CAF + gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C"); + // The second parameter is the number of input files in the chain + chain = CreateESDChain("ESD12001.txt", 5); + } + + //--------------------------------------- + //Local files analysis + //--------------------------------------- + else if(mode == mLocal){ + //If you want to add several ESD files sitting in a common directory INDIR + //Specify as environmental variables the directory (INDIR), the number of files + //to analyze (NEVENT) and the pattern name of the directories with files (PATTERN) + + if(gSystem->Getenv("INDIR")) + kInDir = gSystem->Getenv("INDIR") ; + else cout<<"INDIR not set, use default: "<Getenv("PATTERN")) + kPattern = gSystem->Getenv("PATTERN") ; + else cout<<"PATTERN not set, use default: "<Getenv("NEVENT")) + kEvent = atoi(gSystem->Getenv("NEVENT")) ; + else cout<<"NEVENT not set, use default: "<cd(kInDir) ) {//check if ESDs directory exist + printf("%s does not exist\n", kInDir) ; + return ; + } + cout<<"INDIR : "<Get("esdTree") ) { + printf("++++ Adding %s\n", file) ; + chain->AddFile(file); + chainxs->Add(filexs) ; + } + } + else { + printf("---- Skipping %s\n", file) ; + skipped++ ; + } + } + printf("number of entries # %lld, skipped %d\n", chain->GetEntries(), skipped*100) ; + } + else { + TString input = "AliESDs.root" ; + cout<<">>>>>> No list added, take a single file <<<<<<<<< "<AddFile(input); + } + + }// local files analysis + + //------------------------------ + //GRID xml files + //----------------------------- + else if(mode == mGRID){ + //Get colection file. It is specified by the environmental + //variable XML + + if(gSystem->Getenv("XML") ) + kXML = gSystem->Getenv("XML"); + else + sprintf(kXML, "collection.xml") ; + + if (!TFile::Open(kXML)) { + printf("No collection file with name -- %s -- was found\n",kXML); + return ; + } + else cout<<"XML file "<Load("libNetx.so") ; + gSystem->Load("libRAliEn.so"); + TGrid::Connect("alien://") ; + + //Feed Grid with collection file + //TGridCollection * collection = (TGridCollection*)gROOT->ProcessLine(Form("TAlienCollection::Open(\"%s\", 0)", kXML)); + TGridCollection * collection = (TGridCollection*) TAlienCollection::Open(kXML); + if (! collection) { + AliError(Form("%s not found", kXML)) ; + return kFALSE ; + } + TGridResult* result = collection->GetGridResult("",0 ,0); + + // Makes the ESD chain + printf("*** Getting the Chain ***\n"); + for (Int_t index = 0; index < result->GetEntries(); index++) { + TString alienURL = result->GetKey(index, "turl") ; + cout << "================== " << alienURL << endl ; + chain->Add(alienURL) ; + alienURL.ReplaceAll("AliESDs.root",kXSFileName); + chainxs->Add(alienURL) ; + } + }// xml analysis + + gSystem->ChangeDirectory(ocwd.Data()); +} + +//________________________________________________ +void GetAverageXsection(TTree * tree, Double_t & xs, Float_t & ntr) +{ + // Read the PYTHIA statistics from the file pyxsec.root created by + // the function WriteXsection(): + // integrated cross section (xsection) and + // the number of Pyevent() calls (ntrials) + // and calculate the weight per one event xsection/ntrials + // The spectrum calculated by a user should be + // multiplied by this weight, something like this: + // TH1F *userSpectrum ... // book and fill the spectrum + // userSpectrum->Scale(weight) + // + // Yuri Kharlov 19 June 2007 + // Gustavo Conesa 15 April 2008 + Double_t xsection = 0; + UInt_t ntrials = 0; + xs = 0; + ntr = 0; + + Int_t nfiles = tree->GetEntries() ; + if (tree && nfiles > 0) { + tree->SetBranchAddress("xsection",&xsection); + tree->SetBranchAddress("ntrials",&ntrials); + for(Int_t i = 0; i < nfiles; i++){ + tree->GetEntry(i); + xs += xsection ; + ntr += ntrials ; + cout << "xsection " <>>> Empty tree !!!! <<<<< "<SetMCtruthEventHandler(mcHandler); + } + + // AOD output handler + AliAODHandler* aodoutHandler = new AliAODHandler(); + aodoutHandler->SetOutputFileName("aod.root"); + //aodoutHandler->SetCreateNonStandardAOD(); + mgr->SetOutputEventHandler(aodoutHandler); + + //input + if(kInputData == "ESD"){ + // ESD handler + AliESDInputHandler *esdHandler = new AliESDInputHandler(); + mgr->SetInputEventHandler(esdHandler); + } + if(kInputData == "AOD"){ + // AOD handler + AliAODInputHandler *aodHandler = new AliAODInputHandler(); + mgr->SetInputEventHandler(aodHandler); + } + + //mgr->SetDebugLevel(10); // For debugging + + //------------------------------------------------------------------------- + //Define task, put here any other task that you want to use. + //------------------------------------------------------------------------- + AliAnalysisTaskPHOSExample * taskex = new AliAnalysisTaskPHOSExample ("Gamma"); + mgr->AddTask(taskex); + + // Create containers for input/output + AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain",TChain::Class(), + AliAnalysisManager::kInputContainer); + AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("tree", TTree::Class(), + AliAnalysisManager::kOutputContainer, "default"); + AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("histos", TList::Class(), + AliAnalysisManager::kOutputContainer, "histos.root"); + + mgr->ConnectInput (taskex, 0, cinput1); + mgr->ConnectOutput (taskex, 0, coutput1 ); + mgr->ConnectOutput (taskex, 1, coutput2 ); + + //------------------------ + //Scaling task + //----------------------- + Int_t nfiles = chainxs->GetEntries(); + if(kGetXSectionFromFileAndScale && nfiles > 0){ + //Get the cross section + Double_t xsection=0; + Float_t ntrials = 0; + GetAverageXsection(chainxs, xsection, ntrials); + + AliAnaScale * scale = new AliAnaScale("scale") ; + scale->Set(xsection/ntrials/kNumberOfEventsPerFile/nfiles) ; + mgr->AddTask(scale); + + AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("histosscaled", TList::Class(), + AliAnalysisManager::kOutputContainer, "gammahistosscaled.root"); + mgr->ConnectInput (scale, 0, coutput2); + mgr->ConnectOutput (scale, 0, coutput3 ); + } + + //----------------------- + // Run the analysis + //----------------------- + TString smode = ""; + if (mode==mLocal || mode == mLocalCAF) + smode = "local"; + else if (mode==mPROOF) + smode = "proof"; + else if (mode==mGRID) + smode = "grid"; + + mgr->InitAnalysis(); + mgr->PrintStatus(); + mgr->StartAnalysis(smode.Data(),chain); + } + else cout << "Chain was not produced ! "<Load("libTree.so"); + gSystem->Load("libGeom.so"); + gSystem->Load("libVMC.so"); + gSystem->Load("libXMLIO.so"); + + //---------------------------------------------------------- + // >>>>>>>>>>> Local mode <<<<<<<<<<<<<< + //---------------------------------------------------------- + if (mode==mLocal || mode == mLocalCAF || mode == mGRID) { + //-------------------------------------------------------- + // If you want to use already compiled libraries + // in the aliroot distribution + //-------------------------------------------------------- + //gSystem->Load("libSTEERBase"); + //gSystem->Load("libESD"); + //gSystem->Load("libAOD"); + //gSystem->Load("libANALYSIS"); + //gSystem->Load("libANALYSISalice"); + //gSystem->Load("libPWG4PartCorr"); + + //-------------------------------------------------------- + //If you want to use root and par files from aliroot + //-------------------------------------------------------- + SetupPar("STEERBase"); + SetupPar("ESD"); + SetupPar("AOD"); + SetupPar("ANALYSIS"); + SetupPar("ANALYSISalice"); + SetupPar("PWG4PartCorr"); + + } + + //--------------------------------------------------------- + // <<<<<<<<<< PROOF mode >>>>>>>>>>>> + //--------------------------------------------------------- + else if (mode==mPROOF) { + // + // Connect to proof + // Put appropriate username here + // TProof::Reset("proof://mgheata@lxb6046.cern.ch"); + TProof::Open("proof://mgheata@lxb6046.cern.ch"); + + // gProof->ClearPackages(); + // gProof->ClearPackage("ESD"); + // gProof->ClearPackage("AOD"); + // gProof->ClearPackage("ANALYSIS"); + // gProof->ClearPackage("PWG4Gamma"); + + // Enable the STEERBase Package + gProof->UploadPackage("STEERBase.par"); + gProof->EnablePackage("STEERBase"); + // Enable the ESD Package + gProof->UploadPackage("ESD.par"); + gProof->EnablePackage("ESD"); + // Enable the AOD Package + gProof->UploadPackage("AOD.par"); + gProof->EnablePackage("AOD"); + // Enable the Analysis Package + gProof->UploadPackage("ANALYSIS.par"); + gProof->EnablePackage("ANALYSIS"); + // Enable gamma jet analysis + gProof->UploadPackage("PWG4Gamma.par"); + gProof->EnablePackage("PWG4Gamma"); + // + gProof->ShowEnabledPackages(); + } + +} + +void SetupPar(char* pararchivename) +{ + //Load par files, create analysis libraries + //For testing, if par file already decompressed and modified + //classes then do not decompress. + + TString cdir(Form("%s", gSystem->WorkingDirectory() )) ; + TString parpar(Form("%s.par", pararchivename)) ; + if ( gSystem->AccessPathName(parpar.Data()) ) { + gSystem->ChangeDirectory(gSystem->Getenv("ALICE_ROOT")) ; + TString processline(Form(".! make %s", parpar.Data())) ; + gROOT->ProcessLine(processline.Data()) ; + gSystem->ChangeDirectory(cdir) ; + processline = Form(".! mv /tmp/%s .", parpar.Data()) ; + gROOT->ProcessLine(processline.Data()) ; + } + if ( gSystem->AccessPathName(pararchivename) ) { + TString processline = Form(".! tar xvzf %s",parpar.Data()) ; + gROOT->ProcessLine(processline.Data()); + } + + TString ocwd = gSystem->WorkingDirectory(); + gSystem->ChangeDirectory(pararchivename); + + // check for BUILD.sh and execute + if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) { + printf("*******************************\n"); + printf("*** Building PAR archive ***\n"); + cout<Exec("PROOF-INF/BUILD.sh")) { + Error("runProcess","Cannot Build the PAR Archive! - Abort!"); + return -1; + } + } + // check for SETUP.C and execute + if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) { + printf("*******************************\n"); + printf("*** Setup PAR archive ***\n"); + cout<Macro("PROOF-INF/SETUP.C"); + } + + gSystem->ChangeDirectory(ocwd.Data()); + printf("Current dir: %s\n", ocwd.Data()); +} + + + +void CreateChain(const anaModes mode, TChain * chain, TChain * chainxs){ + //Fills chain with data + TString ocwd = gSystem->WorkingDirectory(); + + //----------------------------------------------------------- + //Analysis of CAF data locally and with PROOF + //----------------------------------------------------------- + if(mode ==mPROOF || mode ==mLocalCAF){ + // Chain from CAF + gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C"); + // The second parameter is the number of input files in the chain + chain = CreateESDChain("ESD12001.txt", 5); + } + + //--------------------------------------- + //Local files analysis + //--------------------------------------- + else if(mode == mLocal){ + //If you want to add several ESD files sitting in a common directory INDIR + //Specify as environmental variables the directory (INDIR), the number of files + //to analyze (NEVENT) and the pattern name of the directories with files (PATTERN) + + if(gSystem->Getenv("INDIR")) + kInDir = gSystem->Getenv("INDIR") ; + else cout<<"INDIR not set, use default: "<Getenv("PATTERN")) + kPattern = gSystem->Getenv("PATTERN") ; + else cout<<"PATTERN not set, use default: "<Getenv("NEVENT")) + kEvent = atoi(gSystem->Getenv("NEVENT")) ; + else cout<<"NEVENT not set, use default: "<cd(kInDir) ) {//check if ESDs directory exist + printf("%s does not exist\n", kInDir) ; + return ; + } + cout<<"INDIR : "<Get("esdTree") ) { + printf("++++ Adding %s\n", file) ; + chain->AddFile(file); + chainxs->Add(filexs) ; + } + } + else { + printf("---- Skipping %s\n", file) ; + skipped++ ; + } + } + printf("number of entries # %lld, skipped %d\n", chain->GetEntries(), skipped*100) ; + } + else { + TString input = "AliESDs.root" ; + cout<<">>>>>> No list added, take a single file <<<<<<<<< "<AddFile(input); + } + + }// local files analysis + + //------------------------------ + //GRID xml files + //----------------------------- + else if(mode == mGRID){ + //Get colection file. It is specified by the environmental + //variable XML + + if(gSystem->Getenv("XML") ) + kXML = gSystem->Getenv("XML"); + else + sprintf(kXML, "collection.xml") ; + + if (!TFile::Open(kXML)) { + printf("No collection file with name -- %s -- was found\n",kXML); + return ; + } + else cout<<"XML file "<Load("libNetx.so") ; + gSystem->Load("libRAliEn.so"); + TGrid::Connect("alien://") ; + + //Feed Grid with collection file + //TGridCollection * collection = (TGridCollection*)gROOT->ProcessLine(Form("TAlienCollection::Open(\"%s\", 0)", kXML)); + TGridCollection * collection = (TGridCollection*) TAlienCollection::Open(kXML); + if (! collection) { + AliError(Form("%s not found", kXML)) ; + return kFALSE ; + } + TGridResult* result = collection->GetGridResult("",0 ,0); + + // Makes the ESD chain + printf("*** Getting the Chain ***\n"); + for (Int_t index = 0; index < result->GetEntries(); index++) { + TString alienURL = result->GetKey(index, "turl") ; + cout << "================== " << alienURL << endl ; + chain->Add(alienURL) ; + alienURL.ReplaceAll("AliESDs.root",kXSFileName); + chainxs->Add(alienURL) ; + } + }// xml analysis + + gSystem->ChangeDirectory(ocwd.Data()); +} + +//________________________________________________ +void GetAverageXsection(TTree * tree, Double_t & xs, Float_t & ntr) +{ + // Read the PYTHIA statistics from the file pyxsec.root created by + // the function WriteXsection(): + // integrated cross section (xsection) and + // the number of Pyevent() calls (ntrials) + // and calculate the weight per one event xsection/ntrials + // The spectrum calculated by a user should be + // multiplied by this weight, something like this: + // TH1F *userSpectrum ... // book and fill the spectrum + // userSpectrum->Scale(weight) + // + // Yuri Kharlov 19 June 2007 + // Gustavo Conesa 15 April 2008 + Double_t xsection = 0; + UInt_t ntrials = 0; + xs = 0; + ntr = 0; + + Int_t nfiles = tree->GetEntries() ; + if (tree && nfiles > 0) { + tree->SetBranchAddress("xsection",&xsection); + tree->SetBranchAddress("ntrials",&ntrials); + for(Int_t i = 0; i < nfiles; i++){ + tree->GetEntry(i); + xs += xsection ; + ntr += ntrials ; + cout << "xsection " <>>> Empty tree !!!! <<<<< "<