--- /dev/null
+/**************************************************************************
+ * 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. *
+ **************************************************************************/
+
+
+////////////////////////////////////////////////
+// Class to handle pairs of tracks
+// Useful for resonance analysis
+// Derives from AliVParticle =>
+// usable in Correction Framework
+////////////////////////////////////////////////
+// author : renaud.vernet@cern.ch
+////////////////////////////////////////////////
+
+#include "AliCFPair.h"
+#include "AliESDtrack.h"
+#include "AliESDv0.h"
+#include "AliESDEvent.h"
+#include "TMath.h"
+
+ClassImp(AliCFPair)
+
+AliCFPair::AliCFPair(AliESDtrack*t1, AliESDtrack*t2) :
+ AliVParticle(),
+ fIsV0(0),
+ fTrackNeg(t1),
+ fTrackPos(t2),
+ fV0(0x0)
+{
+ //
+ // 2-track ctor
+ //
+}
+AliCFPair::AliCFPair(AliESDv0* v0, AliESDEvent* esd) :
+ AliVParticle(),
+ fIsV0(1),
+ fTrackNeg(esd->GetTrack(v0->GetNindex())),
+ fTrackPos(esd->GetTrack(v0->GetPindex())),
+ fV0(v0)
+{
+ //
+ // V0 ctor
+ //
+}
+AliCFPair::AliCFPair(const AliCFPair& c) :
+ AliVParticle(c),
+ fIsV0(c.fIsV0),
+ fTrackNeg(c.fTrackNeg),
+ fTrackPos(c.fTrackPos),
+ fV0(c.fV0)
+{
+ //
+ // Copy constructor.
+ //
+}
+AliCFPair& AliCFPair::operator=(const AliCFPair& c) {
+ //
+ // assignment operator.
+ //
+
+ if (this!=&c) {
+ AliVParticle::operator=(c);
+ fIsV0 = c.fIsV0;
+ fTrackNeg = c.fTrackNeg ;
+ fTrackPos = c.fTrackPos ;
+ fV0 = c.fV0 ;
+ }
+ return *this;
+}
+Bool_t AliCFPair::PxPyPz(Double_t p[3]) const {
+ //
+ // sets pair total momentum in vector p
+ //
+ if (fIsV0)
+ fV0->GetPxPyPz(p[0],p[1],p[2]);
+ else {
+ Double32_t p1[3], p2[3];
+ fTrackNeg->PxPyPz(p1);
+ fTrackPos->PxPyPz(p2);
+ p[0]=p1[0]+p2[0];
+ p[1]=p1[1]+p2[1];
+ p[2]=p1[2]+p2[2];
+ }
+ return kTRUE;
+}
+
+Double32_t AliCFPair::P() const {
+ //
+ // returns pair total momentum norm
+ //
+ Double32_t mom[3];
+ PxPyPz(mom);
+ return TMath::Sqrt(mom[0]*mom[0]+mom[1]*mom[1]+mom[2]*mom[2]);
+}
+
+Double32_t AliCFPair::Px() const {
+ //
+ // returns pair X-projected momentum
+ //
+ Double32_t mom[3];
+ PxPyPz(mom);
+ return mom[0];
+}
+Double32_t AliCFPair::Py() const {
+ //
+ // returns pair Y-projected momentum
+ //
+ Double32_t mom[3];
+ PxPyPz(mom);
+ return mom[1];
+}
+Double32_t AliCFPair::Pz() const {
+ //
+ // returns pair Z-projected momentum
+ //
+ Double32_t mom[3];
+ PxPyPz(mom);
+ return mom[2];
+}
+Double32_t AliCFPair::Pt() const {
+ //
+ // returns pair transverse (XY) momentum
+ //
+ Double32_t mom[3];
+ PxPyPz(mom);
+ return sqrt(mom[0]*mom[0]+mom[1]*mom[1]);
+}
+Double32_t AliCFPair::E() const {
+ //
+ // returns pair total energy according to ESD-calculated mass
+ //
+ Double32_t mom[3];
+ PxPyPz(mom);
+ Double32_t mass=M() ;
+ return TMath::Sqrt(mass*mass + mom[0]*mom[0]+ mom[1]*mom[1]+ mom[2]*mom[2]);
+}
+Bool_t AliCFPair::XvYvZv(Double_t x[3]) const {
+ //
+ // sets pair position to x
+ // since this class is designed for resonances, the assumed pair position
+ // should be the same for both tracks. neg track position is kept here
+ //
+
+ if (fIsV0)
+ fV0->GetXYZ(x[0],x[1],x[2]);
+ else {
+ Double32_t x1[3];
+ fTrackNeg->PxPyPz(x1);
+ x[0]=x1[0];
+ x[1]=x1[1];
+ x[2]=x1[2];
+ }
+ return kTRUE;
+}
+Double32_t AliCFPair::Xv() const {
+ //
+ // returns pair X-projected position
+ //
+ Double32_t pos[3];
+ XvYvZv(pos);
+ return pos[0];
+}
+Double32_t AliCFPair::Yv() const {
+ //
+ // returns pair Y-projected position
+ //
+ Double32_t pos[3];
+ XvYvZv(pos);
+ return pos[1];
+}
+Double32_t AliCFPair::Zv() const {
+ //
+ // returns pair Z-projected position
+ //
+ Double32_t pos[3];
+ XvYvZv(pos);
+ return pos[2];
+}
+Double32_t AliCFPair::Phi() const {
+ //
+ // returns pair phi angle (in transverse plane)
+ //
+ return TMath::Pi()+TMath::ATan2(-Py(),-Px());
+}
+Double32_t AliCFPair::Theta() const {
+ //
+ // returns pair theta angle (in YZ plane)
+ //
+ return (Pz()==0)?TMath::PiOver2():TMath::ACos(Pz()/P());
+}
+Double32_t AliCFPair::Eta() const {
+ //
+ // returns pair pseudo-rapidity
+ //
+ Double32_t pmom = P();
+ Double32_t pz = Pz();
+ if (pmom != TMath::Abs(pz)) return 0.5*TMath::Log((pmom+pz)/(pmom-pz));
+ else return 999;
+}
+Double32_t AliCFPair::Y() const {
+ //
+ // returns pair rapidity
+ //
+ Double32_t e = E();
+ Double32_t pz = Pz();
+
+ if (e == pz || e == -pz) {
+ printf("GetRapidity : ERROR : rapidity for 4-vector with E = Pz -- infinite result");
+ return 999;
+ }
+ if (e < pz) {
+ printf("GetRapidity : ERROR : rapidity for 4-vector with E = Pz -- infinite result");
+ return 999;
+ }
+ Double32_t y = 0.5 * log((e + pz) / (e - pz));
+ return y;
+}
+Double32_t AliCFPair::M() const {
+ //
+ // returns pair invariant mass
+ // in case of a V0, returns the current mass hypothesis
+ // otherwise returns ESD-calculated mass
+ //
+
+ Double32_t minv ;
+
+ if (fIsV0) minv = (Double32_t)fV0->GetEffMass();
+ else {
+ Double32_t p = P() ;
+ Double32_t e = fTrackNeg->E() + fTrackPos->E() ;
+ minv = TMath::Sqrt(e*e-p*p);
+ }
+ return minv ;
+}
--- /dev/null
+/**************************************************************************
+ * 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. *
+ **************************************************************************/
+
+
+/////////////////////////////////////////////////////
+// Class to handle pairs of tracks of opposite charge
+// Useful for resonance analysis
+// Derives from AliVParticle =>
+// usable in Correction Framework
+/////////////////////////////////////////////////////
+// author : renaud.vernet@cern.ch
+/////////////////////////////////////////////////////
+
+
+#ifndef ALICFPAIR_H
+#define ALICFPAIR_H
+
+#include "AliVParticle.h"
+
+class AliESDtrack ;
+class AliESDv0;
+class AliESDEvent;
+
+class AliCFPair : public AliVParticle {
+
+ public:
+ AliCFPair(AliESDtrack* t1, AliESDtrack* t2);
+ AliCFPair(AliESDv0* v0, AliESDEvent* esd);
+ AliCFPair(const AliCFPair& c);
+ AliCFPair& operator=(const AliCFPair& c);
+ virtual ~AliCFPair(){};
+
+ AliESDtrack* GetNeg() const {return fTrackNeg;}
+ AliESDtrack* GetPos() const {return fTrackPos;}
+ AliESDv0* GetV0() const {return fV0;}
+ virtual Bool_t PxPyPz(Double_t p[3]) const ;
+ virtual Double32_t P() const ;
+ virtual Double32_t Pt() const ;
+ virtual Double32_t Px() const ;
+ virtual Double32_t Py() const ;
+ virtual Double32_t Pz() const ;
+ virtual Double32_t E () const ;
+ virtual Double32_t Xv() const ;
+ virtual Double32_t Yv() const ;
+ virtual Double32_t Zv() const ;
+ virtual Bool_t XvYvZv(Double_t x[3]) const ;
+
+ virtual Double32_t OneOverPt() const {return 1/Pt();}
+ virtual Double32_t Phi() const ;
+ virtual Double32_t Theta() const ;
+ virtual Double32_t M() const ;
+ virtual Double32_t Eta() const ;
+ virtual Double32_t Y() const ;
+ virtual Short_t Charge() const {return 0;} // returns 0 because opposite charge tracks... maybe to extend to all kinds of pairs
+
+ // PID
+ virtual const Double_t *PID() const {return 0;} // return PID object (to be defined, still)
+
+
+ private:
+ Bool_t fIsV0; //! true if V0 passed to the constructor
+ AliESDtrack* fTrackNeg; //! pointer to the negative track
+ AliESDtrack* fTrackPos; //! pointer to the positive track
+ AliESDv0* fV0; //! pointer to the V0 if V0 is passed to the constructor
+
+ ClassDef(AliCFPair,0);
+};
+
+#endif
--- /dev/null
+/**************************************************************************
+ * 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. *
+ **************************************************************************/
+
+///////////////////////////////////////////////////////////////////////////
+// ---- CORRECTION FRAMEWORK ----
+// Class to cut on the number of AliTrackReference's
+// for each detector. Applies on pair of tracks (AliCFPair)
+///////////////////////////////////////////////////////////////////////////
+// author : R. Vernet (renaud.vernet@cern.ch)
+///////////////////////////////////////////////////////////////////////////
+
+#include "AliMCParticle.h"
+#include "AliCFPairAcceptanceCuts.h"
+#include "AliMCEventHandler.h"
+#include "AliMCEvent.h"
+
+ClassImp(AliCFPairAcceptanceCuts)
+
+//______________________________
+AliCFPairAcceptanceCuts::AliCFPairAcceptanceCuts() :
+ AliCFCutBase()
+{
+ //
+ //ctor
+ //
+ fCutNeg = new AliCFAcceptanceCuts();
+ fCutPos = new AliCFAcceptanceCuts();
+}
+
+//______________________________
+AliCFPairAcceptanceCuts::AliCFPairAcceptanceCuts(const Char_t* name, const Char_t* title) :
+ AliCFCutBase(name,title)
+{
+ //
+ //ctor
+ //
+ fCutNeg = new AliCFAcceptanceCuts(name,title);
+ fCutPos = new AliCFAcceptanceCuts(name,title);
+}
+
+//______________________________
+AliCFPairAcceptanceCuts::AliCFPairAcceptanceCuts(const AliCFPairAcceptanceCuts& c) :
+ AliCFCutBase(c),
+ fCutNeg(c.fCutNeg),
+ fCutPos(c.fCutPos)
+{
+ //
+ //copy ctor
+ //
+}
+
+//______________________________
+AliCFPairAcceptanceCuts& AliCFPairAcceptanceCuts::operator=(const AliCFPairAcceptanceCuts& c)
+{
+ //
+ // Assignment operator
+ //
+ if (this != &c) {
+ AliCFCutBase::operator=(c) ;
+ fCutNeg = c.fCutNeg ;
+ fCutPos = c.fCutPos ;
+ }
+ return *this ;
+}
+
+//______________________________
+Bool_t AliCFPairAcceptanceCuts::IsSelected(TObject* obj) {
+ //
+ // checks the number of track references associated to 'obj'
+ // 'obj' must be an AliMCParticle
+ //
+
+ if (!obj) return kFALSE ;
+ TString className(obj->ClassName());
+ if (className.CompareTo("AliMCParticle") != 0) {
+ Error("IsSelected","obj must point to a AliMCParticle !");
+ return kFALSE ;
+ }
+
+ TParticle* part = ((AliMCParticle*)obj)->Particle() ;
+ if (!part || part->GetNDaughters()!=2) return kFALSE ;
+ Int_t lab0 = part->GetDaughter(0);
+ Int_t lab1 = part->GetDaughter(1);
+
+ AliMCParticle* negDaughter = fMCInfo->MCEvent()->GetTrack(lab0) ;
+ AliMCParticle* posDaughter = fMCInfo->MCEvent()->GetTrack(lab1) ;
+
+ if (!fCutNeg->IsSelected(negDaughter)) return kFALSE;
+ if (!fCutPos->IsSelected(posDaughter)) return kFALSE;
+
+ return kTRUE ;
+}
+
+//______________________________
+void AliCFPairAcceptanceCuts::SetEvtInfo(TObject* mcInfo) {
+ //
+ // Sets pointer to MC event information (AliMCEventHandler)
+ //
+
+ if (!mcInfo) {
+ Error("SetEvtInfo","Pointer to MC Event Handler is null !");
+ return;
+ }
+
+ TString className(mcInfo->ClassName());
+ if (className.CompareTo("AliMCEventHandler") != 0) {
+ Error("SetEvtInfo","argument must point to an AliMCEventHandler !");
+ return ;
+ }
+
+ fMCInfo = (AliMCEventHandler*) mcInfo ;
+}
--- /dev/null
+/**************************************************************************
+ * 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. *
+ **************************************************************************/
+
+
+///////////////////////////////////////////////////////////////////////////
+// ---- CORRECTION FRAMEWORK ----
+// Class to cut on the number of AliTrackReference's
+// for each detector. Applies on pair of tracks (AliCFPair)
+///////////////////////////////////////////////////////////////////////////
+// author : R. Vernet (renaud.vernet@cern.ch)
+///////////////////////////////////////////////////////////////////////////
+
+
+#ifndef ALICFPAIRACCEPTANCECUTS_H
+#define ALICFPAIRACCEPTANCECUTS_H
+
+#include "AliCFAcceptanceCuts.h"
+#include "AliCFCutBase.h"
+
+class AliMCEventHandler;
+
+class AliCFPairAcceptanceCuts : public AliCFCutBase
+{
+ public :
+ AliCFPairAcceptanceCuts() ;
+ AliCFPairAcceptanceCuts(const Char_t* name, const Char_t* title) ;
+ AliCFPairAcceptanceCuts(const AliCFPairAcceptanceCuts& c) ;
+ AliCFPairAcceptanceCuts& operator=(const AliCFPairAcceptanceCuts& c) ;
+ virtual ~AliCFPairAcceptanceCuts() {delete fCutNeg; delete fCutPos; }
+ virtual Bool_t IsSelected(TObject* obj) ;
+ virtual void SetEvtInfo(TObject *mcInfo) ;
+ virtual void SetMinNHitITS (Int_t nHitNeg, Int_t nHitPos) {fCutNeg->SetMinNHitITS (nHitNeg); fCutPos->SetMinNHitITS (nHitPos);}
+ virtual void SetMinNHitTPC (Int_t nHitNeg, Int_t nHitPos) {fCutNeg->SetMinNHitTPC (nHitNeg); fCutPos->SetMinNHitTPC (nHitPos);}
+ virtual void SetMinNHitTRD (Int_t nHitNeg, Int_t nHitPos) {fCutNeg->SetMinNHitTRD (nHitNeg); fCutPos->SetMinNHitTRD (nHitPos);}
+ virtual void SetMinNHitTOF (Int_t nHitNeg, Int_t nHitPos) {fCutNeg->SetMinNHitTOF (nHitNeg); fCutPos->SetMinNHitTOF (nHitPos);}
+ virtual void SetMinNHitMUON (Int_t nHitNeg, Int_t nHitPos) {fCutNeg->SetMinNHitMUON(nHitNeg); fCutPos->SetMinNHitMUON(nHitPos);}
+
+ protected:
+ AliMCEventHandler *fMCInfo ; // global event information
+ AliCFAcceptanceCuts *fCutNeg ; // acceptance cut on negative daughter
+ AliCFAcceptanceCuts *fCutPos ; // acceptance cut on positive daughter
+
+ ClassDef(AliCFPairAcceptanceCuts,1);
+};
+
+#endif
--- /dev/null
+/**************************************************************************
+ * 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. *
+ **************************************************************************/
+
+
+///////////////////////////////////////////////////////
+// Class to handle primariness criteria in track pairs
+// The track pair object to use is AliCFPair
+// author : renaud.vernet@cern.ch
+///////////////////////////////////////////////////////
+
+
+#include "AliCFPairIsPrimaryCuts.h"
+#include "AliCFPair.h"
+
+ClassImp(AliCFPairIsPrimaryCuts)
+
+//__________________________________________________________________________________
+AliCFPairIsPrimaryCuts::AliCFPairIsPrimaryCuts() :
+ AliCFCutBase()
+{
+ //
+ // Default constructor
+ //
+ fCutNeg = new AliCFTrackIsPrimaryCuts();
+ fCutPos = new AliCFTrackIsPrimaryCuts();
+}
+//__________________________________________________________________________________
+AliCFPairIsPrimaryCuts::AliCFPairIsPrimaryCuts(Char_t* name, Char_t* title) :
+ AliCFCutBase(name,title)
+{
+ //
+ // Constructor
+ //
+ fCutNeg = new AliCFTrackIsPrimaryCuts(name,title);
+ fCutPos = new AliCFTrackIsPrimaryCuts(name,title);
+}
+//__________________________________________________________________________________
+AliCFPairIsPrimaryCuts::AliCFPairIsPrimaryCuts(const AliCFPairIsPrimaryCuts& c) :
+ AliCFCutBase(c),
+ fCutNeg(c.fCutNeg),
+ fCutPos(c.fCutPos)
+{
+ //
+ // copy constructor
+ //
+}
+//__________________________________________________________________________________
+AliCFPairIsPrimaryCuts& AliCFPairIsPrimaryCuts::operator=(const AliCFPairIsPrimaryCuts& c)
+{
+ //
+ // Assignment operator
+ //
+ if (this != &c) {
+ AliCFCutBase::operator=(c) ;
+ fCutNeg = c.fCutNeg ;
+ fCutPos = c.fCutPos ;
+ }
+ return *this;
+}
+
+//__________________________________________________________________________________
+Bool_t AliCFPairIsPrimaryCuts::IsSelected(TObject* obj) {
+ //
+ // loops over decisions of single cuts and returns if the track is accepted
+ //
+
+ if (!obj) return kFALSE ;
+ TString className(obj->ClassName());
+ if (className.CompareTo("AliCFPair") != 0) {
+ Error("IsSelected","obj must point to a AliCFPair !");
+ return kFALSE ;
+ }
+
+ AliCFPair* pair = dynamic_cast<AliCFPair*>(obj);
+
+ AliESDtrack* tneg = pair->GetNeg();
+ AliESDtrack* tpos = pair->GetPos();
+ if (!tneg || !tpos) return kFALSE ;
+
+ if ( ! fCutNeg->IsSelected((TObject*)tneg) || ! fCutPos->IsSelected((TObject*)tpos) ) return kFALSE ;
+
+ return kTRUE ;
+}
--- /dev/null
+/**************************************************************************
+ * 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. *
+ **************************************************************************/
+
+///////////////////////////////////////////////////////
+// Class to handle primariness criteria in track pairs
+// The track pair object to use is AliCFPair
+// author : renaud.vernet@cern.ch
+///////////////////////////////////////////////////////
+
+#ifndef ALICFPAIRISPRIMARYCUTS_H
+#define ALICFPAIRISPRIMARYCUTS_H
+
+#include "AliCFCutBase.h"
+#include "AliCFTrackIsPrimaryCuts.h"
+
+class AliESDEvent;
+
+class AliCFPairIsPrimaryCuts : public AliCFCutBase
+{
+ public :
+ AliCFPairIsPrimaryCuts() ;
+ AliCFPairIsPrimaryCuts(Char_t* name, Char_t* title) ;
+ AliCFPairIsPrimaryCuts(const AliCFPairIsPrimaryCuts& c) ;
+ AliCFPairIsPrimaryCuts& operator=(const AliCFPairIsPrimaryCuts& c) ;
+ virtual ~AliCFPairIsPrimaryCuts() {delete fCutNeg; delete fCutPos; }
+
+ virtual Bool_t IsSelected(TObject* obj) ;
+ virtual void SetMaxNSigmaToVertex(Double32_t neg, Double32_t pos)
+ {fCutNeg->SetMaxNSigmaToVertex(neg); fCutPos->SetMaxNSigmaToVertex(pos);}
+ void SetRequireSigmaToVertex(Bool_t b1, Bool_t b2)
+ {fCutNeg->SetRequireSigmaToVertex(b1); fCutPos->SetRequireSigmaToVertex(b2);}
+
+ ClassDef(AliCFPairIsPrimaryCuts,1);
+
+ private :
+ AliCFTrackIsPrimaryCuts *fCutNeg ; //! isprimary cut on negative daughter
+ AliCFTrackIsPrimaryCuts *fCutPos ; //! isprimary cut on positive daughter
+
+};
+
+#endif
--- /dev/null
+/**************************************************************************
+ * 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. *
+ **************************************************************************/
+
+////////////////////////////////////////////////
+// Class to define PID cuts on a pair of tracks
+// The track pair object to use is AliCFPair
+// author : renaud.vernet@cern.ch
+////////////////////////////////////////////////
+
+#include "AliCFPairPidCut.h"
+#include "AliCFPair.h"
+
+ClassImp(AliCFPairPidCut)
+
+//__________________________________________________________________________________
+AliCFPairPidCut::AliCFPairPidCut() :
+ AliCFCutBase()
+{
+ //
+ // Default constructor
+ //
+ fCutNeg = new AliCFTrackCutPid();
+ fCutPos = new AliCFTrackCutPid();
+}
+//__________________________________________________________________________________
+AliCFPairPidCut::AliCFPairPidCut(const Char_t* name, const Char_t* title) :
+ AliCFCutBase(name,title)
+{
+ //
+ // Constructor
+ //
+ fCutNeg = new AliCFTrackCutPid(name,title);
+ fCutPos = new AliCFTrackCutPid(name,title);
+}
+//__________________________________________________________________________________
+AliCFPairPidCut::AliCFPairPidCut(const AliCFPairPidCut& c) :
+ AliCFCutBase(c),
+ fCutNeg(c.fCutNeg),
+ fCutPos(c.fCutPos)
+{
+ //
+ // copy constructor
+ //
+}
+//__________________________________________________________________________________
+AliCFPairPidCut& AliCFPairPidCut::operator=(const AliCFPairPidCut& c)
+{
+ //
+ // Assignment operator
+ //
+ if (this != &c) {
+ AliCFCutBase::operator=(c) ;
+ fCutNeg = c.fCutNeg ;
+ fCutPos = c.fCutPos ;
+ }
+ return *this;
+}
+
+//__________________________________________________________________________________
+Bool_t AliCFPairPidCut::IsSelected(TObject* obj) {
+ //
+ // loops over decisions of single cuts and returns if the track is accepted
+ //
+
+ if (!obj) return kFALSE ;
+ TString className(obj->ClassName());
+ if (className.CompareTo("AliCFPair") != 0) {
+ Error("IsSelected","obj must point to a AliCFPair !");
+ return kFALSE ;
+ }
+
+ AliCFPair* pair = dynamic_cast<AliCFPair*>(obj);
+
+ AliESDtrack* tneg = pair->GetNeg();
+ AliESDtrack* tpos = pair->GetPos();
+
+ if (!tneg || !tpos) return kFALSE ;
+ if ( ! fCutNeg->IsSelected(tneg) || ! fCutPos->IsSelected(tpos) ) return kFALSE ;
+ return kTRUE ;
+}
--- /dev/null
+/**************************************************************************
+ * 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. *
+ **************************************************************************/
+
+
+////////////////////////////////////////////////
+// Class to define PID cuts on a pair of tracks
+// The track pair object to use is AliCFPair
+//
+// author : renaud.vernet@cern.ch
+////////////////////////////////////////////////
+
+#ifndef ALICFPAIRPIDCUT_H
+#define ALICFPAIRPIDCUT_H
+
+#include "AliCFCutBase.h"
+#include "AliCFTrackCutPid.h"
+
+//__________________________________________________________________________________
+// CUT ON TRACK PID FOR V0 DAUGHTERS
+//__________________________________________________________________________________
+
+class AliCFPairPidCut : public AliCFCutBase
+{
+ public :
+ AliCFPairPidCut() ;
+ AliCFPairPidCut(const Char_t* name, const Char_t* title) ;
+ AliCFPairPidCut(const AliCFPairPidCut& c) ;
+ AliCFPairPidCut& operator=(const AliCFPairPidCut& c) ;
+ virtual ~AliCFPairPidCut() {delete fCutNeg; delete fCutPos; };
+
+ void SetDetectors(TString detsNeg, TString detsPos)
+ {fCutNeg->SetDetectors(detsNeg); fCutPos->SetDetectors(detsPos);} //sets the chosen detectors
+ void SetPriors(Double_t r[AliPID::kSPECIES])
+ {fCutNeg->SetPriors(r); fCutPos->SetPriors(r);} //sets the a priori concentrations
+ void SetProbabilityCut(Double32_t cut1, Double32_t cut2)
+ {fCutNeg->SetProbabilityCut(cut1); fCutPos->SetProbabilityCut(cut2);} //sets the prob cut
+ void SetParticleType(Int_t iType1, Bool_t tocombine1, Int_t iType2, Bool_t tocombine2) //sets the particle to be identified and the mode
+ {fCutNeg->SetParticleType(iType1,tocombine1); fCutPos->SetParticleType(iType2,tocombine2);} // (single detector kFALSE/ combined kTRUE)
+ void SetMinDiffResp(Bool_t check1, Double_t mindiff1, Bool_t check2, Double_t mindiff2)
+ {fCutNeg->SetMinDiffResp(check1,mindiff1); fCutPos->SetMinDiffResp(check2,mindiff2);} //set checking at det. response level
+ void SetMinDiffProb(Bool_t check1, Double_t mindiff1, Bool_t check2, Double_t mindiff2)
+ {fCutNeg->SetMinDiffProb(check1,mindiff1); fCutPos->SetMinDiffProb(check2,mindiff2);} //set checking at probability level
+
+ virtual Bool_t IsSelected(TObject *obj); //boolena for detectors
+
+ private:
+ AliCFTrackCutPid* fCutNeg; //! PID cut on negative daughter
+ AliCFTrackCutPid* fCutPos; //! PID cut on positive daughter
+
+ ClassDef(AliCFPairPidCut,1);
+};
+#endif
+
--- /dev/null
+/**************************************************************************
+ * 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. *
+ **************************************************************************/
+
+
+///////////////////////////////////////////////
+// Class to handle track quality in track pairs
+// The track pair object to use is AliCFPair
+// author : renaud.vernet@cern.ch
+///////////////////////////////////////////////
+
+#include "AliCFPairQualityCuts.h"
+#include "AliCFPair.h"
+
+ClassImp(AliCFPairQualityCuts)
+
+//__________________________________________________________________________________
+AliCFPairQualityCuts::AliCFPairQualityCuts() :
+ AliCFCutBase()
+{
+ //
+ // Default constructor
+ //
+ fCutNeg = new AliCFTrackQualityCuts();
+ fCutPos = new AliCFTrackQualityCuts();
+}
+//__________________________________________________________________________________
+AliCFPairQualityCuts::AliCFPairQualityCuts(Char_t* name, Char_t* title) :
+ AliCFCutBase(name,title)
+{
+ //
+ // Constructor
+ //
+ fCutNeg = new AliCFTrackQualityCuts(name,title);
+ fCutPos = new AliCFTrackQualityCuts(name,title);
+}
+//__________________________________________________________________________________
+AliCFPairQualityCuts::AliCFPairQualityCuts(const AliCFPairQualityCuts& c) :
+ AliCFCutBase(c),
+ fCutNeg(c.fCutNeg),
+ fCutPos(c.fCutPos)
+{
+ //
+ // copy constructor
+ //
+}
+//__________________________________________________________________________________
+AliCFPairQualityCuts& AliCFPairQualityCuts::operator=(const AliCFPairQualityCuts& c)
+{
+ //
+ // Assignment operator
+ //
+ if (this != &c) {
+ AliCFCutBase::operator=(c) ;
+ fCutNeg = c.fCutNeg ;
+ fCutPos = c.fCutPos ;
+ }
+ return *this;
+}
+
+//__________________________________________________________________________________
+Bool_t AliCFPairQualityCuts::IsSelected(TObject* obj) {
+ //
+ // loops over decisions of single cuts and returns if the track is accepted
+ //
+
+ if (!obj) return kFALSE ;
+ TString className(obj->ClassName());
+ if (className.CompareTo("AliCFPair") != 0) {
+ Error("IsSelected","obj must point to a AliCFPair !");
+ return kFALSE ;
+ }
+
+ AliCFPair* pair = dynamic_cast<AliCFPair*>(obj);
+
+ AliESDtrack* tneg = pair->GetNeg();
+ AliESDtrack* tpos = pair->GetPos();
+ if (!tneg || !tpos) return kFALSE ;
+
+ if ( ! fCutNeg->IsSelected((TObject*)tneg) || ! fCutPos->IsSelected((TObject*)tpos) ) return kFALSE ;
+
+ return kTRUE ;
+}
--- /dev/null
+/**************************************************************************
+ * 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. *
+ **************************************************************************/
+
+///////////////////////////////////////////////
+// Class to handle track quality in track pairs
+// The track pair object to use is AliCFPair
+// author : renaud.vernet@cern.ch
+///////////////////////////////////////////////
+
+
+
+#ifndef ALICFPAIRQUALITYCUTS_H
+#define ALICFPAIRQUALITYCUTS_H
+
+#include "AliCFCutBase.h"
+#include "AliCFTrackQualityCuts.h"
+
+class AliESDEvent;
+
+class AliCFPairQualityCuts : public AliCFCutBase
+{
+ public :
+ AliCFPairQualityCuts() ;
+ AliCFPairQualityCuts(Char_t* name, Char_t* title) ;
+ AliCFPairQualityCuts(const AliCFPairQualityCuts& c) ;
+ AliCFPairQualityCuts& operator=(const AliCFPairQualityCuts& c) ;
+ virtual ~AliCFPairQualityCuts() {delete fCutNeg; delete fCutPos; }
+
+ virtual Bool_t IsSelected(TObject* obj) ;
+
+ virtual void SetMinNClusterTPC (UInt_t nClusNeg, UInt_t nClusPos)
+ {fCutNeg->SetMinNClusterTPC(nClusNeg); fCutPos->SetMinNClusterTPC(nClusPos);}
+ virtual void SetMinNClusterITS (UInt_t nClusNeg, UInt_t nClusPos)
+ {fCutNeg->SetMinNClusterITS(nClusNeg); fCutPos->SetMinNClusterITS(nClusPos);}
+ virtual void SetMaxChi2PerClusterTPC(Double32_t chi2Neg, Double32_t chi2Pos)
+ {fCutNeg->SetMaxChi2PerClusterTPC(chi2Neg); fCutPos->SetMaxChi2PerClusterTPC(chi2Pos);}
+ virtual void SetMaxChi2PerClusterITS(Double32_t chi2Neg, Double32_t chi2Pos)
+ {fCutNeg->SetMaxChi2PerClusterITS(chi2Neg); fCutPos->SetMaxChi2PerClusterITS(chi2Pos);}
+ virtual void SetRequireTPCRefit(Bool_t neg, Bool_t pos)
+ {fCutNeg->SetRequireTPCRefit(neg); fCutPos->SetRequireTPCRefit(pos);}
+ virtual void SetRequireITSRefit(Bool_t neg, Bool_t pos)
+ {fCutNeg->SetRequireITSRefit(neg); fCutPos->SetRequireITSRefit(pos);}
+ virtual void SetMaxCovDiagonalElements(Double32_t* neg/*[5]*/, Double32_t* pos/*[5]*/) {
+ fCutNeg->SetMaxCovDiagonalElements(neg[0],neg[1],neg[2],neg[3],neg[4]);
+ fCutPos->SetMaxCovDiagonalElements(pos[0],pos[1],pos[2],pos[3],pos[4]); }
+
+
+
+ ClassDef(AliCFPairQualityCuts,1);
+
+ private :
+ AliCFTrackQualityCuts *fCutNeg ; // quality cut on negative daughter
+ AliCFTrackQualityCuts *fCutPos ; // quality cut on positive daughter
+
+};
+
+#endif
#include "AliCFCutBase.h"
-class TH2 ;
+class TH2F ;
+class TH1F ;
class TBits;
class AliESDtrack ;
--- /dev/null
+/**************************************************************************
+ * 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. *
+ **************************************************************************/
+
+
+///////////////////////////////////////////////////////////////////////////
+// ---- CORRECTION FRAMEWORK ----
+// Class to cut on V0 topology
+// -> support for :
+// DCA between V0 daughters
+// V0 daughter impact parameters wrt primary vertex
+// cosine of V0 pointing angle
+//
+///////////////////////////////////////////////////////////////////////////
+// author : R. Vernet (renaud.vernet@cern.ch)
+///////////////////////////////////////////////////////////////////////////
+
+#include "AliCFV0TopoCuts.h"
+#include "AliESDv0.h"
+#include "AliESDtrack.h"
+#include "AliCFPair.h"
+
+ClassImp(AliCFV0TopoCuts)
+
+//______________________________________________________________
+AliCFV0TopoCuts::AliCFV0TopoCuts() :
+ AliCFCutBase(),
+ fMaxDcaDaughters(1.e99),
+ fMinDcaNeg(0),
+ fMinDcaPos(0),
+ fMinCosP(0)
+{
+ //
+ //default constructor
+ //
+}
+
+//______________________________________________________________
+AliCFV0TopoCuts::AliCFV0TopoCuts(const Char_t* name, const Char_t* title) :
+ AliCFCutBase(name,title),
+ fMaxDcaDaughters(1.e99),
+ fMinDcaNeg(0),
+ fMinDcaPos(0),
+ fMinCosP(0)
+{
+ //
+}
+
+//______________________________________________________________
+AliCFV0TopoCuts::AliCFV0TopoCuts(const AliCFV0TopoCuts& c) :
+ AliCFCutBase(c),
+ fMaxDcaDaughters(c.fMaxDcaDaughters),
+ fMinDcaNeg(c.fMinDcaNeg),
+ fMinDcaPos(c.fMinDcaPos),
+ fMinCosP(c.fMinCosP)
+{
+ //
+ // copy constructor
+ //
+}
+
+//______________________________________________________________
+AliCFV0TopoCuts& AliCFV0TopoCuts::operator=(const AliCFV0TopoCuts& c)
+{
+ //
+ // assignment operator
+ //
+
+ if (this != &c) {
+ AliCFCutBase::operator=(c) ;
+ fMaxDcaDaughters = c.fMaxDcaDaughters ;
+ fMinDcaNeg = c.fMinDcaNeg ;
+ fMinDcaPos = c.fMinDcaPos ;
+ fMinCosP = c.fMinCosP ;
+ }
+ return *this ;
+}
+
+//______________________________________________________________
+Bool_t AliCFV0TopoCuts::IsSelected(TObject *obj) {
+ //
+ // computes V0 topological variables to cut on and return true
+ // in case the V0 is accepted
+ //
+
+ if (!obj) return kFALSE ;
+
+ TString className(obj->ClassName());
+ if (className.CompareTo("AliCFPair") != 0) {
+ Error("IsSelected","obj must point to an AliCFPair !");
+ return kFALSE ;
+ }
+
+ AliCFPair * pair = dynamic_cast<AliCFPair*>(obj);
+ AliESDv0 * v0 = pair->GetV0();
+ AliESDtrack * negDaughter = pair->GetNeg();
+ AliESDtrack * posDaughter = pair->GetPos();
+
+ if (v0->GetDcaV0Daughters() > fMaxDcaDaughters) return kFALSE ;
+ if (v0->GetV0CosineOfPointingAngle() < fMinCosP) return kFALSE ;
+
+
+ Float_t tDca[2];
+ if (negDaughter) negDaughter->GetImpactParameters(tDca[0],tDca[1]);
+ else { tDca[0]=1.e99; tDca[1]=1.e99;}
+ Double32_t negDca = TMath::Sqrt(tDca[0]*tDca[0]+tDca[1]*tDca[1]);
+ if (posDaughter) posDaughter->GetImpactParameters(tDca[0],tDca[1]);
+ else { tDca[0]=1.e99; tDca[1]=1.e99;}
+ Double32_t posDca = TMath::Sqrt(tDca[0]*tDca[0]+tDca[1]*tDca[1]);
+
+ if (negDca < fMinDcaNeg) return kFALSE ;
+ if (posDca < fMinDcaPos) return kFALSE ;
+
+ return kTRUE ;
+}
+
--- /dev/null
+/**************************************************************************
+ * 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. *
+ **************************************************************************/
+
+
+///////////////////////////////////////////////////////////////////////////
+// ---- CORRECTION FRAMEWORK ----
+// Class to cut on V0 topology
+// -> support for :
+// DCA between V0 daughters
+// V0 daughter impact parameters wrt primary vertex
+// cosine of V0 pointing angle
+//
+///////////////////////////////////////////////////////////////////////////
+// author : R. Vernet (renaud.vernet@cern.ch)
+///////////////////////////////////////////////////////////////////////////
+
+#ifndef ALICFV0TOPOCUTS_H
+#define ALICFV0TOPOCUTS_H
+
+#include "AliCFCutBase.h"
+
+class TObject;
+
+class AliCFV0TopoCuts : public AliCFCutBase
+{
+ public :
+ AliCFV0TopoCuts () ;
+ AliCFV0TopoCuts (const Char_t* name, const Char_t* title) ;
+ AliCFV0TopoCuts (const AliCFV0TopoCuts& c) ;
+ AliCFV0TopoCuts& operator=(const AliCFV0TopoCuts& c) ;
+ virtual ~AliCFV0TopoCuts() { } ;
+ virtual Bool_t IsSelected(TObject* v0) ;
+
+ void SetMaxDcaDaughters (Double32_t dca) {fMaxDcaDaughters = dca;}
+ void SetMinDcaNeg (Double32_t dca) {fMinDcaNeg = dca;}
+ void SetMinDcaPos (Double32_t dca) {fMinDcaPos = dca;}
+ void SetMinCosPointAngle(Double32_t cos) {fMinCosP = cos;}
+
+ private :
+ Double32_t fMaxDcaDaughters ; // max. dca between V0 daughters
+ Double32_t fMinDcaNeg ; // min impact parameter (aka dca to prim. vertex) of neg. daughter
+ Double32_t fMinDcaPos ; // min impact parameter (aka dca to prim. vertex) of pos. daughter
+ Double32_t fMinCosP ; // min cosine of pointing angle
+
+ ClassDef(AliCFV0TopoCuts,0);
+};
+
+#endif
#pragma link C++ class AliCFTrackQualityCuts+;
#pragma link C++ class AliCFTrackIsPrimaryCuts+;
#pragma link C++ class AliCFTrackCutPid+;
+#pragma link C++ class AliCFPair+;
+#pragma link C++ class AliCFPairAcceptanceCuts+;
+#pragma link C++ class AliCFPairQualityCuts+;
+#pragma link C++ class AliCFPairIsPrimaryCuts+;
+#pragma link C++ class AliCFPairPidCut+;
+#pragma link C++ class AliCFV0TopoCuts+;
#endif
AliCFTrackQualityCuts.cxx \
AliCFTrackIsPrimaryCuts.cxx \
AliCFTrackCutPid.cxx \
+ AliCFPair.cxx \
+ AliCFPairAcceptanceCuts.cxx \
+ AliCFPairQualityCuts.cxx \
+ AliCFPairIsPrimaryCuts.cxx \
+ AliCFPairPidCut.cxx \
+ AliCFV0TopoCuts.cxx
CHECKALIEN = $(shell root-config --has-alien)
ifeq (yes,$(CHECKALIEN))
--- /dev/null
+//DEFINITION OF A FEW CONSTANTS
+const Double_t ymin = -1.0 ;
+const Double_t ymax = 1.0 ;
+const Double_t ptmin = 0.0 ;
+const Double_t ptmax = 8.0 ;
+const Int_t mintrackrefsTPC = 2 ;
+const Int_t mintrackrefsITS = 3 ;
+const Int_t charge = 0 ;
+const Int_t PDG = 313;
+const Int_t minclustersTPC = 50 ;
+const Double32_t nsigmavtx = 3. ; //max track sigma to PVertex
+//----------------------------------------------------
+
+Bool_t AliCFRsnTask(
+ const Bool_t useGrid = 1,
+ const char * kTagXMLFile="wn.xml", // XML file containing tags
+ )
+{
+
+ TBenchmark benchmark;
+ benchmark.Start("AliRsnTask");
+
+ AliLog::SetGlobalDebugLevel(0);
+
+ Load(useGrid) ; //load the required libraries
+
+ TChain * analysisChain ;
+
+ if (useGrid) { //data located on AliEn
+ TGrid::Connect("alien://") ; // Create an AliRunTagCuts and an AliEventTagCuts Object and impose some selection criteria
+ AliRunTagCuts *runCuts = new AliRunTagCuts();
+ AliEventTagCuts *eventCuts = new AliEventTagCuts();
+ AliLHCTagCuts *lhcCuts = new AliLHCTagCuts();
+ AliDetectorTagCuts *detCuts = new AliDetectorTagCuts();
+ eventCuts->SetMultiplicityRange(0,20000);
+ // Create an AliTagAnalysis Object and chain the tags
+ AliTagAnalysis *tagAna = new AliTagAnalysis();
+ tagAna->SetType("ESD"); //for aliroot > v4-05
+ TAlienCollection *coll = TAlienCollection::Open(kTagXMLFile);
+ TGridResult *tagResult = coll->GetGridResult("",0,0);
+ tagResult->Print();
+ tagAna->ChainGridTags(tagResult);
+ // Create a new esd chain and assign the chain that is returned by querying the tags
+ analysisChain = tagAna->QueryTags(runCuts,lhcCuts,detCuts,eventCuts);
+ }
+ else {// local data
+ analysisChain = new TChain("esdTree");
+ //here put your input data path
+ analysisChain->Add("AliESDs.root");
+ }
+
+
+ Info("AliCFRsnTask",Form("CHAIN HAS %d ENTRIES",(Int_t)analysisChain->GetEntries()));
+
+ //CONTAINER DEFINITION
+ Info("AliCFRsnTask","SETUP CONTAINER");
+ //the sensitive variables (2 in this example), their indices
+ Int_t ipt = 0;
+ Int_t iy = 1;
+ //Setting up the container grid...
+ Int_t nstep = 4 ; //number of selection steps MC
+ const Int_t nvar = 2 ; //number of variables on the grid:pt,y
+ const Int_t nbin1 = 8 ; //bins in pt
+ const Int_t nbin2 = 8 ; //bins in y
+ //arrays for the number of bins in each dimension
+ const Int_t iBin[nvar] ={nbin1,nbin2};
+ //arrays for lower bounds :
+ Double_t binLim1[nbin1+1];
+ Double_t binLim2[nbin2+1];
+ //values for bin lower bounds
+ for(Int_t i=0; i<=nbin1; i++) binLim1[i]=(Double_t)ptmin + (ptmax-ptmin)/nbin1*(Double_t)i ;
+ for(Int_t i=0; i<=nbin2; i++) binLim2[i]=(Double_t)ymin + (ymax-ymin) /nbin2*(Double_t)i ;
+ //one "container" for MC
+ AliCFContainer* container = new AliCFContainer("container","container for tracks",nstep,nvar,iBin);
+ //setting the bin limits
+ container -> SetBinLimits(ipt,binLim1);
+ container -> SetBinLimits(iy,binLim2);
+
+
+ //CREATE THE CUTS -----------------------------------------------
+ //Particle-Level cuts:
+
+ // Gen-Level kinematic cuts
+ AliCFTrackKineCuts *mcKineCuts = new AliCFTrackKineCuts("mcKineCuts","MC-level kinematic cuts");
+ mcKineCuts->SetPtRange(ptmin,ptmax);
+ mcKineCuts->SetRapidityRange(ymin,ymax);
+ mcKineCuts->SetChargeMC(charge);
+
+ AliCFParticleGenCuts* mcGenCuts = new AliCFParticleGenCuts("mcGenCuts","MC particle generation cuts");
+ // mcGenCuts->SetRequireIsPrimary();
+ mcGenCuts->SetRequirePdgCode(PDG);
+
+ //Acceptance Cuts
+ AliCFPairAcceptanceCuts *mcAccCuts = new AliCFPairAcceptanceCuts("mcAccCuts","MC acceptance cuts");
+ mcAccCuts->SetMinNHitITS(mintrackrefsITS,mintrackrefsITS);
+ mcAccCuts->SetMinNHitTPC(mintrackrefsTPC,mintrackrefsTPC);
+
+ // Rec-Level kinematic cuts
+ AliCFTrackKineCuts *recKineCuts = new AliCFTrackKineCuts("recKineCuts","rec-level kine cuts");
+// AliCFPairKineCuts *recKineCuts = new AliCFPairKineCuts("recKineCuts","rec-level kine cuts");
+ recKineCuts->SetPtRange(ptmin,ptmax);
+ recKineCuts->SetRapidityRange(ymin,ymax);
+ recKineCuts->SetChargeRec(charge);
+
+ AliCFPairQualityCuts *recQualityCuts = new AliCFPairQualityCuts("recQualityCuts","rec-level quality cuts");
+ recQualityCuts->SetMinNClusterTPC(minclustersTPC,minclustersTPC);
+ recQualityCuts->SetRequireITSRefit(kTRUE,kTRUE);
+
+ AliCFPairIsPrimaryCuts *recIsPrimaryCuts = new AliCFPairIsPrimaryCuts("recIsPrimaryCuts","rec-level isPrimary cuts");
+ recIsPrimaryCuts->SetMaxNSigmaToVertex(nsigmavtx,nsigmavtx);
+
+ AliCFPairPidCut* cutPID = new AliCFPairPidCut("cutPID","ESD_PID") ;
+ Double_t prior_pp[AliPID::kSPECIES] = {0.0244519,
+ 0.0143988,
+ 0.805747 ,
+ 0.0928785,
+ 0.0625243 };
+
+ Double_t prior_pbpb[AliPID::kSPECIES] = {0.0609,
+ 0.1064,
+ 0.7152 ,
+ 0.0442,
+ 0.0733 };
+
+
+ cutPID->SetPriors(prior_pbpb);
+ cutPID->SetProbabilityCut(0.,0.);
+ cutPID->SetDetectors("TPC ITS TOF TRD","TPC ITS TOF TRD");
+ switch(PDG) {
+ case -313 : cutPID->SetParticleType(AliPID::kKaon,kTRUE,AliPID::kPion,kTRUE); break;
+ case 313 : cutPID->SetParticleType(AliPID::kPion,kTRUE,AliPID::kKaon,kTRUE); break;
+ case 333 : cutPID->SetParticleType(AliPID::kKaon,kTRUE,AliPID::kKaon,kTRUE); break;
+ case 3124 : cutPID->SetParticleType(AliPID::kPion,kTRUE,AliPID::kKaon,kTRUE); break;
+ case -3124 : cutPID->SetParticleType(AliPID::kPion,kTRUE,AliPID::kKaon,kTRUE); break;
+ default : printf("UNDEFINED PID\n"); break;
+ }
+// cutPID->SetQAOn(kTRUE);
+
+ Info("AliCFRsnTask","CREATE MC KINE CUTS");
+ TObjArray* mcList = new TObjArray(0) ;
+ mcList->AddLast(mcKineCuts);
+ mcList->AddLast(mcGenCuts);
+
+ Info("AliCFRsnTask","CREATE ACCEPTANCE CUTS");
+ TObjArray* accList = new TObjArray(0) ;
+ accList->AddLast(mcAccCuts);
+
+ Info("AliCFRsnTask","CREATE RECONSTRUCTION CUTS");
+ TObjArray* recList = new TObjArray(0) ;
+ recList->AddLast(recKineCuts);
+ recList->AddLast(recQualityCuts);
+ recList->AddLast(recIsPrimaryCuts);
+
+ Info("AliCFRsnTask","CREATE PID CUTS");
+ TObjArray* fPIDCutList = new TObjArray(0) ;
+ fPIDCutList->AddLast(cutPID);
+
+
+ //CREATE THE INTERFACE TO CORRECTION FRAMEWORK USED IN THE TASK
+ Info("AliCFRsnTask","CREATE INTERFACE AND CUTS");
+ AliCFManager* man = new AliCFManager() ;
+ man->SetParticleContainer (container);
+ man->SetParticleCutsList(AliCFManager::kPartGenCuts,mcList);
+ man->SetParticleCutsList(AliCFManager::kPartAccCuts,accList);
+ man->SetParticleCutsList(AliCFManager::kPartRecCuts,recList);
+ man->SetParticleCutsList(AliCFManager::kPartSelCuts,fPIDCutList);
+
+
+ //CREATE THE TASK
+ Info("AliCFRsnTask","CREATE TASK");
+ // create the task
+ AliCFRsnTask *task = new AliCFRsnTask("AliRsnTask");
+ task->SetCFManager(man); //here is set the CF manager
+
+
+ //SETUP THE ANALYSIS MANAGER TO READ INPUT CHAIN AND WRITE DESIRED OUTPUTS
+ Info("AliCFRsnTask","CREATE ANALYSIS MANAGER");
+ // Make the analysis manager
+ AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
+
+ // Create and connect containers for input/output
+
+ //input data
+ AliAnalysisDataContainer *cinput0 = mgr->CreateContainer("cchain0",TChain::Class(),AliAnalysisManager::kInputContainer);
+ // output histo (number of events processed)
+ AliAnalysisDataContainer *coutput0 = mgr->CreateContainer("chist0", TH1I::Class(),AliAnalysisManager::kOutputContainer,"output_rsn.root");
+ // output Correction Framework Container (for acceptance & efficiency calculations)
+ AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("ccontainer0", AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,"output_rsn.root");
+ // output QA histograms
+
+ mgr->AddTask(task);
+ mgr->ConnectInput(task,0,cinput0);
+ mgr->ConnectOutput(task,0,coutput0);
+ mgr->ConnectOutput(task,1,coutput1);
+ cinput0->SetData(analysisChain);
+
+ //NEW INTERFACE TO MC INFORMATION
+ AliMCEventHandler* mcHandler = new AliMCEventHandler();
+ mgr->SetMCtruthEventHandler(mcHandler);
+
+ Info("AliCFRsnTask","READY TO RUN");
+ //RUN !!!
+ if (mgr->InitAnalysis()) {
+ mgr->PrintStatus();
+ mgr->StartAnalysis("local",analysisChain);
+ }
+
+ benchmark.Stop("AliRsnTask");
+ benchmark.Show("AliRsnTask");
+
+ return kTRUE ;
+}
+
+void Load(Bool_t useGrid) {
+ //remove this file which can cause problems
+ if (!useGrid)
+ gSystem->Exec("rm $ALICE_ROOT/ANALYSIS/AliAnalysisSelector_cxx.so");
+
+ //load the required aliroot libraries
+ gSystem->Load("libANALYSIS") ;
+
+ gSystem->SetIncludePath("-I. -I$ALICE_ROOT/include -I$ROOTSYS/include -I$ALICE_ROOT/PWG2/RESONANCES -I$ALICE_ROOT/CORRFW");
+
+ if (!useGrid) {
+ //load local CF library
+ gSystem->Load("libCORRFW");
+ //load PWG2 library
+ gSystem->Load("libPWG2resonances");
+ }
+ else {
+ //compile online the task class
+ gSystem->Exec("cp $ALICE_ROOT/PWG2/RESONANCES/AliRsnDaughter.cxx .");
+ gROOT->LoadMacro("./AliRsnDaughter.cxx+");
+ gSystem->Exec("tar zxvf cf_classes.tgz");
+ gROOT->LoadMacro("./AliCFFrame.cxx+");
+ gROOT->LoadMacro("./AliCFVGrid.cxx+");
+ gROOT->LoadMacro("./AliCFGrid.cxx+");
+ gROOT->LoadMacro("./AliCFGridSparse.cxx+");
+ gROOT->LoadMacro("./AliCFContainer.cxx+");
+ gROOT->LoadMacro("./AliCFCutBase.cxx+");
+ gROOT->LoadMacro("./AliCFTrackKineCuts.cxx+");
+ gROOT->LoadMacro("./AliCFTrackIsPrimaryCuts.cxx+");
+ gROOT->LoadMacro("./AliCFTrackQualityCuts.cxx+");
+ gROOT->LoadMacro("./AliCFParticleGenCuts.cxx+");
+ gROOT->LoadMacro("./AliCFAcceptanceCuts.cxx+");
+ gROOT->LoadMacro("./AliCFTrackCutPid.cxx+");
+ gROOT->LoadMacro("./AliCFManager.cxx+");
+ gSystem->Exec("tar zxvf cf_rsn.tgz");
+ gROOT->LoadMacro("./AliCFPair.cxx+");
+ gROOT->LoadMacro("./AliCFPairAcceptanceCuts.cxx+");
+ gROOT->LoadMacro("./AliCFPairQualityCuts.cxx+");
+ gROOT->LoadMacro("./AliCFPairIsPrimaryCuts.cxx+");
+ gROOT->LoadMacro("./AliCFPairPidCut.cxx+");
+ }
+ gROOT->LoadMacro("./AliCFRsnTask.cxx+");
+}
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+//-----------------------------------------------------------------------
+// Author : R. Vernet, Consorzio Cometa - Catania (it)
+//-----------------------------------------------------------------------
+
+
+#include <TROOT.h>
+#include <TInterpreter.h>
+
+#include "AliCFRsnTask.h"
+#include "TCanvas.h"
+#include "AliStack.h"
+#include "TParticle.h"
+#include "TH1I.h"
+#include "TChain.h"
+#include "AliMCEventHandler.h"
+#include "AliMCEvent.h"
+#include "AliAnalysisManager.h"
+#include "AliESDEvent.h"
+#include "AliCFManager.h"
+#include "AliCFCutBase.h"
+#include "AliCFContainer.h"
+#include "TChain.h"
+#include "AliESDtrack.h"
+#include "AliLog.h"
+#include "AliRsnDaughter.h"
+#include "AliCFPair.h"
+#include <memory>
+
+//__________________________________________________________________________
+AliCFRsnTask::AliCFRsnTask() :
+ fRsnPDG(313),
+ fChain(0x0),
+ fESD(0x0),
+ fCFManager(0x0),
+ fHistEventsProcessed(0x0)
+{
+ //Defual ctor
+}
+//___________________________________________________________________________
+AliCFRsnTask::AliCFRsnTask(const Char_t* name) :
+ AliAnalysisTask(name,"AliCFRsnTask"),
+ fRsnPDG(313),
+ fChain(0x0),
+ fESD(0x0),
+ fCFManager(0x0),
+ fHistEventsProcessed(0x0)
+{
+ //
+ // Constructor. Initialization of Inputs and Outputs
+ //
+ Info("AliCFRsnTask","Calling Constructor");
+ DefineInput (0,TChain::Class());
+ DefineOutput(0,TH1I::Class());
+ DefineOutput(1,AliCFContainer::Class());
+ // DefineOutput(2,TList::Class());
+}
+
+//___________________________________________________________________________
+AliCFRsnTask& AliCFRsnTask::operator=(const AliCFRsnTask& c)
+{
+ //
+ // Assignment operator
+ //
+ if (this!=&c) {
+ AliAnalysisTask::operator=(c) ;
+ fRsnPDG = c.fRsnPDG;
+ fChain = c.fChain;
+ fESD = c.fESD;
+ fCFManager = c.fCFManager;
+ fHistEventsProcessed = c.fHistEventsProcessed;
+ }
+ return *this;
+}
+
+//___________________________________________________________________________
+AliCFRsnTask::AliCFRsnTask(const AliCFRsnTask& c) :
+ AliAnalysisTask(c),
+ fRsnPDG(c.fRsnPDG),
+ fChain(c.fChain),
+ fESD(c.fESD),
+ fCFManager(c.fCFManager),
+ fHistEventsProcessed(c.fHistEventsProcessed)
+{
+ //
+ // Copy Constructor
+ //
+}
+
+//___________________________________________________________________________
+AliCFRsnTask::~AliCFRsnTask() {
+ //
+ //destructor
+ //
+ Info("~AliCFRsnTask","Calling Destructor");
+ if (fChain) delete fChain ;
+ if (fESD) delete fESD ;
+ if (fCFManager) delete fCFManager ;
+ if (fHistEventsProcessed) delete fHistEventsProcessed ;
+}
+
+//___________________________________________________________________________
+
+void AliCFRsnTask::Init()
+{
+
+}
+//_________________________________________________
+void AliCFRsnTask::Exec(Option_t *)
+{
+ //
+ // Main loop function
+ //
+ Info("Exec","") ;
+ // Get the mc truth
+ AliMCEventHandler* mcTruth = (AliMCEventHandler*)((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
+
+ if (!mcTruth) Error("Exec","NO MC INFO FOUND... EXITING");
+
+ // transform possible old AliESD into AliESDEvent
+
+ if (fESD->GetAliESDOld()) fESD->CopyFromOldESD(); //transition to new ESD format
+
+ //pass the MC evt handler to the cuts that need it
+
+ fCFManager->SetEventInfo(mcTruth);
+
+ // Get the MC event
+ AliMCEvent* mcEvent = mcTruth->MCEvent();
+ AliStack* stack = mcEvent->Stack();
+
+ // MC-event selection
+ Double_t containerInput[2] ;
+
+ //loop on the MC event
+ Info("Exec","Looping on MC event");
+ for (Int_t ipart=0; ipart<stack->GetNprimary(); ipart++) {
+ AliMCParticle *mcPart = mcEvent->GetTrack(ipart);
+
+ //check the MC-level cuts
+ if (!fCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,mcPart)) continue;
+ containerInput[0] = mcPart->Pt();
+ containerInput[1] = mcPart->Eta() ;
+ //fill the container for Gen-level selection
+ fCFManager->GetParticleContainer()->Fill(containerInput,kStepGenerated);
+
+ //check the Acceptance-level cuts
+ if (!fCFManager->CheckParticleCuts(AliCFManager::kPartAccCuts,mcPart)) continue;
+ //fill the container for Acceptance-level selection
+ fCFManager->GetParticleContainer()->Fill(containerInput,kStepReconstructible);
+ }
+
+
+ //Now go to rec level
+ Info("Exec","Looping on ESD event");
+
+ //SET THE ESD AS EVENT INFO IN RECONSTRUCTION CUTS
+ TObjArray* fCutsReco = fCFManager->GetParticleCutsList(AliCFManager::kPartRecCuts);
+ TObjArray* fCutsPID = fCFManager->GetParticleCutsList(AliCFManager::kPartSelCuts);
+ TObjArrayIter iter1(fCutsReco);
+ TObjArrayIter iter2(fCutsPID);
+ AliCFCutBase *cut = 0;
+ while ( (cut = (AliCFCutBase*)iter1.Next()) ) {
+ cut->SetEvtInfo(fESD);
+ }
+ while ( (cut = (AliCFCutBase*)iter2.Next()) ) {
+ cut->SetEvtInfo(fESD);
+ }
+
+ for (Int_t iTrack1 = 0; iTrack1<fESD->GetNumberOfTracks(); iTrack1++) {
+ AliESDtrack* esdTrack1 = fESD->GetTrack(iTrack1);
+ //track1 is negative
+ if (esdTrack1->Charge()>=0) continue;
+ Int_t esdLabel1 = esdTrack1->GetLabel();
+ if (esdLabel1<0) continue;
+
+ for (Int_t iTrack2 = 0; iTrack2<fESD->GetNumberOfTracks(); iTrack2++) {
+ AliESDtrack* esdTrack2 = fESD->GetTrack(iTrack2);
+ //track2 is positive
+ if (esdTrack2->Charge()<=0) continue;
+ Int_t esdLabel2 = esdTrack2->GetLabel();
+ if (esdLabel2<0) continue;
+
+ // copy ESDtrack data into RsnDaughter (and make Bayesian PID)
+ //if problem with copy constructor, use the following special command to destroy the pointer when exiting scope
+ //std::auto_ptr<AliRsnDaughter> track1(AliRsnDaughter::Adopt(esdTrack1,iTrack1));
+
+ AliRsnDaughter* tmp1=AliRsnDaughter::Adopt(esdTrack1,iTrack1);
+ AliRsnDaughter* tmp2=AliRsnDaughter::Adopt(esdTrack2,iTrack2);
+ AliRsnDaughter track1(*tmp1);
+ AliRsnDaughter track2(*tmp2);
+ delete tmp1;
+ delete tmp2;
+
+ TParticle *part1 = stack->Particle(esdLabel1);
+ track1.SetTruePDG(part1->GetPdgCode());
+ Int_t mother1 = part1->GetFirstMother();
+ track1.SetMother(mother1);
+ if (mother1 >= 0) {
+ TParticle *mum = stack->Particle(mother1);
+ track1.SetMotherPDG(mum->GetPdgCode());
+ }
+
+ TParticle *part2 = stack->Particle(esdLabel2);
+ track2.SetTruePDG(part2->GetPdgCode());
+ Int_t mother2 = part2->GetFirstMother();
+ track2.SetMother(mother2);
+ if (mother2 >= 0) {
+ TParticle *mum = stack->Particle(mother2);
+ track2.SetMotherPDG(mum->GetPdgCode());
+ }
+
+ //make a mother resonance from the 2 candidate daughters
+ AliRsnDaughter rsn = AliRsnDaughter::Sum(track1,track2) ;
+ AliCFPair pair(esdTrack1,esdTrack2);
+
+ //check if true resonance
+ if (rsn.GetMotherPDG() != fRsnPDG) continue;
+ if (!fCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,&pair)) continue;
+
+ //check if associated MC resonance passes the cuts
+ Int_t motherLabel=rsn.GetLabel();
+ if (motherLabel<0) continue ;
+ AliMCParticle* mcRsn = mcEvent->GetTrack(motherLabel);
+ if (!mcRsn) continue;
+ if (!fCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,mcRsn)) continue;
+
+ //fill the container
+ containerInput[0] = rsn.GetPt() ;
+ containerInput[1] = GetRapidity(rsn.GetEnergy(),rsn.GetPz());
+ fCFManager->GetParticleContainer()->Fill(containerInput,kStepReconstructed) ;
+
+ if (!fCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,&pair)) continue ;
+ fCFManager->GetParticleContainer()->Fill(containerInput,kStepSelected);
+ }
+ }
+
+ fHistEventsProcessed->Fill(0);
+ PostData(0,fHistEventsProcessed) ;
+ PostData(1,fCFManager->GetParticleContainer()) ;
+
+ // TList * list = new TList();
+ // fCFManager->AddQAHistosToList(list);
+ // PostData(2,list) ;
+}
+
+
+//___________________________________________________________________________
+void AliCFRsnTask::Terminate(Option_t*)
+{
+ // The Terminate() function is the last function to be called during
+ // a query. It always runs on the client, it can be used to present
+ // the results graphically or save the results to file.
+
+ Info("Terminate","");
+ AliAnalysisTask::Terminate();
+
+
+ Double_t max1 = fCFManager->GetParticleContainer()->ShowProjection(0,0)->GetMaximum();
+ Double_t max2 = fCFManager->GetParticleContainer()->ShowProjection(1,0)->GetMaximum();
+
+ fCFManager->GetParticleContainer()->ShowProjection(0,0)->GetYaxis()->SetRangeUser(0,max1*1.2);
+ fCFManager->GetParticleContainer()->ShowProjection(0,1)->GetYaxis()->SetRangeUser(0,max1*1.2);
+ fCFManager->GetParticleContainer()->ShowProjection(0,2)->GetYaxis()->SetRangeUser(0,max1*1.2);
+ fCFManager->GetParticleContainer()->ShowProjection(0,3)->GetYaxis()->SetRangeUser(0,max1*1.2);
+
+ fCFManager->GetParticleContainer()->ShowProjection(1,0)->GetYaxis()->SetRangeUser(0,max2*1.2);
+ fCFManager->GetParticleContainer()->ShowProjection(1,1)->GetYaxis()->SetRangeUser(0,max2*1.2);
+ fCFManager->GetParticleContainer()->ShowProjection(1,2)->GetYaxis()->SetRangeUser(0,max2*1.2);
+ fCFManager->GetParticleContainer()->ShowProjection(1,3)->GetYaxis()->SetRangeUser(0,max2*1.2);
+
+ fCFManager->GetParticleContainer()->ShowProjection(0,0)->SetMarkerStyle(23) ;
+ fCFManager->GetParticleContainer()->ShowProjection(0,1)->SetMarkerStyle(24) ;
+ fCFManager->GetParticleContainer()->ShowProjection(0,2)->SetMarkerStyle(25) ;
+ fCFManager->GetParticleContainer()->ShowProjection(0,3)->SetMarkerStyle(26) ;
+
+ fCFManager->GetParticleContainer()->ShowProjection(1,0)->SetMarkerStyle(23) ;
+ fCFManager->GetParticleContainer()->ShowProjection(1,1)->SetMarkerStyle(24) ;
+ fCFManager->GetParticleContainer()->ShowProjection(1,2)->SetMarkerStyle(25) ;
+ fCFManager->GetParticleContainer()->ShowProjection(1,3)->SetMarkerStyle(26) ;
+
+ TCanvas * c =new TCanvas("c","",1400,800);
+ c->Divide(4,2);
+
+ c->cd(1);
+ fCFManager->GetParticleContainer()->ShowProjection(0,0)->Draw("p");
+ c->cd(2);
+ fCFManager->GetParticleContainer()->ShowProjection(0,1)->Draw("p");
+ c->cd(3);
+ fCFManager->GetParticleContainer()->ShowProjection(0,2)->Draw("p");
+ c->cd(4);
+ fCFManager->GetParticleContainer()->ShowProjection(0,3)->Draw("p");
+ c->cd(5);
+ fCFManager->GetParticleContainer()->ShowProjection(1,0)->Draw("p");
+ c->cd(6);
+ fCFManager->GetParticleContainer()->ShowProjection(1,1)->Draw("p");
+ c->cd(7);
+ fCFManager->GetParticleContainer()->ShowProjection(1,2)->Draw("p");
+ c->cd(8);
+ fCFManager->GetParticleContainer()->ShowProjection(1,3)->Draw("p");
+
+ c->SaveAs("plots.eps");
+
+ delete fHistEventsProcessed ;
+}
+
+//___________________________________________________________________________
+void AliCFRsnTask::ConnectInputData(Option_t *) {
+ //
+ // Initialize branches.
+ //
+ Info("ConnectInputData","ConnectInputData of task %s\n",GetName());
+
+ fChain = (TChain*)GetInputData(0);
+ fChain->SetBranchStatus("*FMD*",0);
+ fChain->SetBranchStatus("*CaloClusters*",0);
+ fESD = new AliESDEvent();
+ fESD->ReadFromTree(fChain);
+}
+
+//___________________________________________________________________________
+void AliCFRsnTask::CreateOutputObjects() {
+ //HERE ONE CAN CREATE OUTPUT OBJECTS, IN PARTICULAR IF THE OBJECT PARAMETERS DON'T NEED
+ //TO BE SET BEFORE THE EXECUTION OF THE TASK
+ //
+ Info("CreateOutputObjects","CreateOutputObjects of task %s\n", GetName());
+
+ //slot #0
+ fHistEventsProcessed = new TH1I("fHistEventsProcessed","",1,0,1) ;
+}
+
+//___________________________________________________________________________
+Double_t AliCFRsnTask::GetRapidity(Double_t energy, Double_t pz) {
+ if (energy == pz || energy == -pz) {
+ printf("GetRapidity : ERROR : rapidity for 4-vector with E = Pz -- infinite result");
+ return 999;
+ }
+ if (energy < pz) {
+ printf("GetRapidity : ERROR : rapidity for 4-vector with E = Pz -- infinite result");
+ return 999;
+ }
+ Double_t y = 0.5 * log((energy + pz) / (energy - pz));
+ return y;
+}
+
+
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+//-----------------------------------------------------------------------
+// Author : R. Vernet, Consorzio Cometa - Catania (it)
+//-----------------------------------------------------------------------
+
+#ifndef ALICFRSNTASK_H
+#define ALICFRSNTASK_H
+
+#include "AliAnalysisTask.h"
+
+class TH1I;
+class TParticle ;
+class TFile ;
+class AliMCEventHandler;
+class AliESDEvent;
+class AliStack ;
+class AliCFManager;
+class TChain;
+class AliRsnDaughter;
+
+class AliCFRsnTask : public AliAnalysisTask {
+ public:
+
+ enum {
+ kStepGenerated = 0,
+ kStepReconstructible = 1,
+ kStepReconstructed = 2,
+ kStepSelected = 3
+ };
+
+ AliCFRsnTask();
+ AliCFRsnTask(const Char_t* name);
+ AliCFRsnTask& operator= (const AliCFRsnTask& c);
+ AliCFRsnTask(const AliCFRsnTask& c);
+ virtual ~AliCFRsnTask();
+
+ // ANALYSIS FRAMEWORK STUFF to loop on data and fill output objects
+ void ConnectInputData(Option_t *option="");
+ void CreateOutputObjects();
+ void Exec(Option_t *option);
+ void Init(); //loads the CF manager
+ void LocalInit() {Init();} //needed for the slaves
+ void Terminate(Option_t *);
+
+ // CORRECTION FRAMEWORK RELATED FUNCTIONS
+ void SetCFManager(AliCFManager* io) {fCFManager = io;} // global correction manager
+ AliCFManager * GetCFManager() {return fCFManager;} // get corr manager
+
+ void SetRsnPDG(Int_t code) {fRsnPDG = code; } // defines the PDG code of searched resonance
+ static Double_t GetRapidity(Double_t, Double_t) ; // returns the rapidity of the Resonance (assuming PDG code)
+
+
+ protected:
+
+ Int_t fRsnPDG; // PDG code of searched resonance
+ TChain *fChain ; // chained files
+ AliESDEvent *fESD ; // pointer to the ESD event read
+ AliCFManager *fCFManager ; // pointer to the CF manager
+
+ // Histograms
+ //Number of events
+ TH1I *fHistEventsProcessed; //! simple histo for monitoring the number of events processed
+
+ ClassDef(AliCFRsnTask,1);
+};
+
+#endif
--- /dev/null
+//DEFINITION OF A FEW CONSTANTS
+const Double_t ymin = -2.0 ;
+const Double_t ymax = 2.0 ;
+const Double_t ptmin = 0.0 ;
+const Double_t ptmax = 8.0 ;
+const Double_t phimin = 0 ;
+const Double_t phimax = 360 ;
+const Int_t mintrackrefsTPC = 2 ;
+const Int_t mintrackrefsITS = 3 ;
+const Int_t PDG = 3122;
+const Int_t minclustersTPC = 10 ;
+const Int_t chargeV0 = 0 ;
+//----------------------------------------------------
+
+Bool_t AliCFV0Task(
+ const Bool_t useGrid = 1,
+ const char * kTagXMLFile="wn.xml", // XML file containing tags
+ )
+{
+
+ TBenchmark benchmark;
+ benchmark.Start("AliSingleTrackTask");
+
+ AliLog::SetGlobalDebugLevel(0);
+
+ Load(useGrid) ; //load the required libraries
+
+ AliLog::SetGlobalDebugLevel(0);
+
+ TChain * analysisChain ;
+
+ if (useGrid) { //data located on AliEn
+ TGrid::Connect("alien://") ;
+ // Create an AliRunTagCuts and an AliEventTagCuts Object and impose some selection criteria
+ AliRunTagCuts *runCuts = new AliRunTagCuts();
+ AliEventTagCuts *eventCuts = new AliEventTagCuts();
+ AliLHCTagCuts *lhcCuts = new AliLHCTagCuts();
+ AliDetectorTagCuts *detCuts = new AliDetectorTagCuts();
+ eventCuts->SetMultiplicityRange(0,20000);
+ // Create an AliTagAnalysis Object and chain the tags
+ AliTagAnalysis *tagAna = new AliTagAnalysis();
+ tagAna->SetType("ESD"); //for aliroot > v4-05
+ TAlienCollection *coll = TAlienCollection::Open(kTagXMLFile);
+ TGridResult *tagResult = coll->GetGridResult("",0,0);
+ tagResult->Print();
+ tagAna->ChainGridTags(tagResult);
+ // Create a new esd chain and assign the chain that is returned by querying the tags
+ analysisChain = tagAna->QueryTags(runCuts,lhcCuts,detCuts,eventCuts);
+ }
+ else {// local data
+ analysisChain = new TChain("esdTree");
+ //here put your input data path
+ analysisChain->Add("AliESDs.root");
+ }
+
+
+ Info("AliCFV0Task",Form("CHAIN HAS %d ENTRIES",(Int_t)analysisChain->GetEntries()));
+
+ //CONTAINER DEFINITION
+ Info("AliCFV0Task","SETUP CONTAINER");
+ //the sensitive variables, their indices
+ Int_t ipt = 0;
+ Int_t iy = 1;
+ //Setting up the container grid...
+ Int_t nstep = 4 ; //number of selection steps MC
+ const Int_t nvar = 2 ; //number of variables on the grid:pt,y,phi,vtx
+ const Int_t nbin1 = 8 ; //bins in pt
+ const Int_t nbin2 = 8 ; //bins in y
+ //arrays for the number of bins in each dimension
+ const Int_t iBin[nvar] ={nbin1,nbin2};
+ //arrays for lower bounds :
+ Double_t binLim1[nbin1+1];
+ Double_t binLim2[nbin2+1];
+ //values for bin lower bounds
+ for(Int_t i=0; i<=nbin1; i++) binLim1[i]=ptmin + (ptmax-ptmin)/nbin1*(Double_t)i ;
+ for(Int_t i=0; i<=nbin2; i++) binLim2[i]=ymin + (ymax-ymin) /nbin2*(Double_t)i ;
+ //one "container" for MC
+ AliCFContainer* container = new AliCFContainer("container","container for V0s",nstep,nvar,iBin);
+ //setting the bin limits
+ container -> SetBinLimits(ipt,binLim1);
+ container -> SetBinLimits(iy,binLim2);
+
+
+ //CREATE THE CUTS -----------------------------------------------
+
+ // Gen-Level kinematic cuts
+ AliCFTrackKineCuts *mcKineCuts = new AliCFTrackKineCuts("mcKineCuts","MC-level kinematic cuts");
+ mcKineCuts->SetPtRange(ptmin,ptmax);
+ mcKineCuts->SetRapidityRange(ymin,ymax);
+ mcKineCuts->SetChargeMC(0);
+
+ AliCFParticleGenCuts* mcGenCuts = new AliCFParticleGenCuts("mcGenCuts","MC particle generation cuts");
+ mcGenCuts->SetRequireIsPrimary();
+ mcGenCuts->SetRequirePdgCode(PDG);
+
+ //Acceptance Cuts
+ AliCFPairAcceptanceCuts *mcAccCuts = new AliCFPairAcceptanceCuts("mcAccCuts","MC acceptance cuts for V0");
+ mcAccCuts->SetMinNHitITS(mintrackrefsITS,mintrackrefsITS);
+ mcAccCuts->SetMinNHitTPC(mintrackrefsTPC,mintrackrefsTPC);
+
+ // Rec-Level kinematic cuts
+ AliCFTrackKineCuts *recKineCuts = new AliCFTrackKineCuts("recKineCuts","V0 rec-level kine cuts");
+ recKineCuts->SetPtRange(ptmin,ptmax);
+ recKineCuts->SetRapidityRange(ymin,ymax);
+
+ AliCFPairQualityCuts *recQualityCuts = new AliCFPairQualityCuts("recQualityCuts","V0 rec-level quality cuts");
+ recQualityCuts->SetMinNClusterTPC(minclustersTPC,minclustersTPC);
+
+ AliCFV0TopoCuts *recTopoCuts = new AliCFV0TopoCuts("recTopoCuts","V0 Topological Cuts");
+ recTopoCuts->SetMaxDcaDaughters(0.1);
+ recTopoCuts->SetMinCosPointAngle(0.995);
+ recTopoCuts->SetMinDcaNeg(0.1);
+ recTopoCuts->SetMinDcaPos(0.1);
+
+
+ AliCFPairPidCut* cutPID = new AliCFPairPidCut("cutPID","ESD_PID") ;
+ Double_t prior_pp[AliPID::kSPECIES] = {0.0244519,
+ 0.0143988,
+ 0.805747 ,
+ 0.0928785,
+ 0.0625243 };
+
+ Double_t prior_pbpb[AliPID::kSPECIES] = {0.0609,
+ 0.1064,
+ 0.7152 ,
+ 0.0442,
+ 0.0733 };
+ cutPID->SetPriors(prior_pbpb);
+ cutPID->SetDetectors("ITS TPC TRD","ITS TPC TRD");
+ cutPID->SetProbabilityCut(0,0);
+ switch(TMath::Abs(PDG)) {
+ case 310 : cutPID->SetParticleType(AliPID::kPion , kTRUE, AliPID::kPion , kTRUE); break;
+ case 3122 : cutPID->SetParticleType(AliPID::kPion , kTRUE, AliPID::kProton, kTRUE); break;
+ case -3122 : cutPID->SetParticleType(AliPID::kProton, kTRUE, AliPID::kPion , kTRUE); break;
+ default : printf("UNDEFINED PID\n"); break;
+ }
+
+ Info("AliCFV0Task","CREATE MC KINE CUTS");
+ TObjArray* mcList = new TObjArray(0) ;
+ mcList->AddLast(mcKineCuts);
+ mcList->AddLast(mcGenCuts);
+
+ Info("AliCFV0Task","CREATE ACCEPTANCE CUTS");
+ TObjArray* accList = new TObjArray(0) ;
+ accList->AddLast(mcAccCuts);
+
+ Info("AliCFV0Task","CREATE RECONSTRUCTION CUTS");
+ TObjArray* recList = new TObjArray(0) ;
+ recList->AddLast(recKineCuts);
+ recList->AddLast(recQualityCuts);
+ recList->AddLast(recTopoCuts);
+
+ Info("AliCFV0Task","CREATE PID CUTS");
+ TObjArray* fPIDCutList = new TObjArray(0) ;
+ fPIDCutList->AddLast(cutPID);
+
+
+ //CREATE THE INTERFACE TO CORRECTION FRAMEWORK USED IN THE TASK
+ Info("AliCFV0Task","CREATE INTERFACE AND CUTS");
+ AliCFManager* man = new AliCFManager() ;
+ man->SetParticleContainer(container);
+ man->SetParticleCutsList (AliCFManager::kPartGenCuts,mcList);
+ man->SetParticleCutsList (AliCFManager::kPartAccCuts,accList);
+ man->SetParticleCutsList (AliCFManager::kPartRecCuts,recList);
+ man->SetParticleCutsList (AliCFManager::kPartSelCuts,fPIDCutList);
+
+ //CREATE THE TASK
+ Info("AliCFV0Task","CREATE TASK");
+ // create the task
+ AliCFV0Task *task = new AliCFV0Task("AliCFV0Task");
+ task->SetCFManager(man); //here is set the CF manager
+ task->SetRebuildV0s(0);
+ task->SetV0PDG(PDG);
+
+ //SETUP THE ANALYSIS MANAGER TO READ INPUT CHAIN AND WRITE DESIRED OUTPUTS
+ Info("AliCFV0Task","CREATE ANALYSIS MANAGER");
+ // Make the analysis manager
+ AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
+
+ // Create and connect containers for input/output
+
+ //input data
+ AliAnalysisDataContainer *cinput0 = mgr->CreateContainer("cchain0",TChain::Class(),AliAnalysisManager::kInputContainer);
+ // output histo (number of events processed)
+ AliAnalysisDataContainer *coutput0 = mgr->CreateContainer("chist0", TH1I::Class(),AliAnalysisManager::kOutputContainer,"outputV0.root");
+ // output Correction Framework Container (for acceptance & efficiency calculations)
+ AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("ccontainer0", AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,"outputV0.root");
+ // output QA histograms
+// AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("clist0", TList::Class(),AliAnalysisManager::kOutputContainer,"outputV0.root");
+
+ mgr->AddTask(task);
+ mgr->ConnectInput(task,0,cinput0);
+ mgr->ConnectOutput(task,0,coutput0);
+ mgr->ConnectOutput(task,1,coutput1);
+
+ cinput0->SetData(analysisChain);
+
+ //NEW INTERFACE TO MC INFORMATION
+ AliMCEventHandler* mcHandler = new AliMCEventHandler();
+ mgr->SetMCtruthEventHandler(mcHandler);
+
+ Info("AliCFV0Task","READY TO RUN");
+ //RUN !!!
+ if (mgr->InitAnalysis()) {
+ mgr->PrintStatus();
+ mgr->StartAnalysis("local",analysisChain);
+ }
+
+ benchmark.Stop("AliCFV0Task");
+ benchmark.Show("AliCFV0Task");
+
+ return kTRUE ;
+}
+
+void Load(Bool_t useGrid) {
+ //remove this file which can cause problems
+ if (!useGrid)
+ gSystem->Exec("rm $ALICE_ROOT/ANALYSIS/AliAnalysisSelector_cxx.so");
+
+ //load the required aliroot libraries
+ gSystem->Load("libANALYSIS") ;
+
+ gSystem->SetIncludePath("-I. -I$ALICE_ROOT/include -I$ROOTSYS/include -I$ALICE_ROOT/PWG2/RESONANCES -I$ALICE_ROOT/CORRFW");
+
+ if (!useGrid) {
+ //load local CF library
+ gSystem->Load("libCORRFW");
+ }
+ else {
+ //compile online the task class
+ gSystem->Exec("tar zxvf cf_classes.tgz");
+ gROOT->LoadMacro("./AliCFFrame.cxx+");
+ gROOT->LoadMacro("./AliCFVGrid.cxx+");
+ gROOT->LoadMacro("./AliCFGrid.cxx+");
+ gROOT->LoadMacro("./AliCFGridSparse.cxx+");
+ gROOT->LoadMacro("./AliCFContainer.cxx+");
+ gROOT->LoadMacro("./AliCFCutBase.cxx+");
+ gROOT->LoadMacro("./AliCFTrackKineCuts.cxx+");
+ gROOT->LoadMacro("./AliCFTrackQualityCuts.cxx+");
+ gROOT->LoadMacro("./AliCFParticleGenCuts.cxx+");
+ gROOT->LoadMacro("./AliCFAcceptanceCuts.cxx+");
+ gROOT->LoadMacro("./AliCFTrackCutPid.cxx+");
+ gROOT->LoadMacro("./AliCFManager.cxx+");
+ gSystem->Exec("tar zxvf cf_V0.tgz");
+ gROOT->LoadMacro("./AliCFPair.cxx+");
+ gROOT->LoadMacro("./AliCFPairAcceptanceCuts.cxx+");
+ gROOT->LoadMacro("./AliCFPairQualityCuts.cxx+");
+ gROOT->LoadMacro("./AliCFPairPidCut.cxx+");
+ gROOT->LoadMacro("./AliCFV0TopoCuts.cxx+");
+ }
+ gROOT->LoadMacro("./AliCFV0Task.cxx+");
+}
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+//-----------------------------------------------------------------------
+// Example of task running on AliEn (CAF?)
+// which provides standard way of calculating acceptance and efficiency
+// between different steps of the procedure.
+// The ouptut of the task is a AliCFContainer from which the efficiencies
+// can be calculated
+//-----------------------------------------------------------------------
+// Author : R. Vernet, Consorzio Cometa - Catania (it)
+//-----------------------------------------------------------------------
+
+
+#ifndef ALICFV0TASK_CXX
+#define ALICFV0TASK_CXX
+#include <TROOT.h>
+#include <TInterpreter.h>
+
+#include "AliCFV0Task.h"
+#include "TCanvas.h"
+#include "AliStack.h"
+#include "TParticle.h"
+#include "TH1I.h"
+#include "TChain.h"
+#include "AliMCEventHandler.h"
+#include "AliMCEvent.h"
+#include "AliAnalysisManager.h"
+#include "AliESDEvent.h"
+#include "AliCFManager.h"
+#include "AliCFCutBase.h"
+#include "AliCFContainer.h"
+#include "TChain.h"
+#include "AliESDtrack.h"
+#include "AliLog.h"
+#include "AliESDv0.h"
+#include "AliV0vertexer.h"
+#include "AliCFPair.h"
+
+//__________________________________________________________________________
+AliCFV0Task::AliCFV0Task() :
+ fRebuildV0s(0),
+ fV0PDG(310),
+ fChain(0x0),
+ fESD(0x0),
+ fCFManager(0x0),
+ fHistEventsProcessed(0x0)
+{
+//Defual ctor
+}
+//___________________________________________________________________________
+AliCFV0Task::AliCFV0Task(const Char_t* name) :
+ AliAnalysisTask(name,"AliCFV0Task"),
+ fRebuildV0s(0),
+ fV0PDG(310),
+ fChain(0x0),
+ fESD(0x0),
+ fCFManager(0x0),
+ fHistEventsProcessed(0x0)
+{
+ //
+ // Constructor. Initialization of Inputs and Outputs
+ //
+ Info("AliCFV0Task","Calling Constructor");
+ DefineInput (0,TChain::Class());
+ DefineOutput(0,TH1I::Class());
+ DefineOutput(1,AliCFContainer::Class());
+// DefineOutput(2,TList::Class());
+}
+
+//___________________________________________________________________________
+AliCFV0Task& AliCFV0Task::operator=(const AliCFV0Task& c)
+{
+ //
+ // Assignment operator
+ //
+ if (this!=&c) {
+ AliAnalysisTask::operator=(c) ;
+ fRebuildV0s = c.fRebuildV0s;
+ fV0PDG = c.fV0PDG;
+ fChain = c.fChain;
+ fESD = c.fESD;
+ fCFManager = c.fCFManager;
+ fHistEventsProcessed = c.fHistEventsProcessed;
+ }
+ return *this;
+}
+
+//___________________________________________________________________________
+AliCFV0Task::AliCFV0Task(const AliCFV0Task& c) :
+ AliAnalysisTask(c),
+ fRebuildV0s(c.fRebuildV0s),
+ fV0PDG(c.fV0PDG),
+ fChain(c.fChain),
+ fESD(c.fESD),
+ fCFManager(c.fCFManager),
+ fHistEventsProcessed(c.fHistEventsProcessed)
+{
+ //
+ // Copy Constructor
+ //
+}
+
+//___________________________________________________________________________
+AliCFV0Task::~AliCFV0Task() {
+ //
+ //destructor
+ //
+ Info("~AliCFV0Task","Calling Destructor");
+ if (fChain) delete fChain ;
+ if (fESD) delete fESD ;
+ if (fCFManager) delete fCFManager ;
+ if (fHistEventsProcessed) delete fHistEventsProcessed ;
+}
+
+//___________________________________________________________________________
+
+void AliCFV0Task::Init()
+{
+
+}
+//_________________________________________________
+void AliCFV0Task::Exec(Option_t *)
+{
+ //
+ // Main loop function
+ //
+ Info("Exec","") ;
+ // Get the mc truth
+ AliMCEventHandler* mcTruth = (AliMCEventHandler*)((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
+
+ if (!mcTruth) Error("Exec","NO MC INFO FOUND... EXITING");
+
+ // transform possible old AliESD into AliESDEvent
+
+ if (fESD->GetAliESDOld()) fESD->CopyFromOldESD(); //transition to new ESD format
+
+ //pass the MC evt handler to the cuts that need it
+
+ fCFManager->SetEventInfo(mcTruth);
+
+ // Get the MC event
+ AliMCEvent* mcEvent = mcTruth->MCEvent();
+
+ // MC-event selection
+ Double_t containerInput[2] ;
+
+ //loop on the MC event
+ Info("Exec","Looping on MC event");
+ for (Int_t ipart=0; ipart<mcEvent->GetNumberOfTracks(); ipart++) {
+ AliMCParticle *mcPart = mcEvent->GetTrack(ipart);
+
+ //check the MC-level cuts
+ if (!fCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,mcPart)) continue;
+ containerInput[0] = mcPart->Pt();
+ containerInput[1] = mcPart->Eta() ;
+ //fill the container for Gen-level selection
+ fCFManager->GetParticleContainer()->Fill(containerInput,kStepGenerated);
+
+ //check the Acceptance-level cuts
+ if (!fCFManager->CheckParticleCuts(AliCFManager::kPartAccCuts,mcPart)) continue;
+ //fill the container for Acceptance-level selection
+ fCFManager->GetParticleContainer()->Fill(containerInput,kStepReconstructible);
+ }
+
+
+ //Now go to rec level
+ Info("Exec","Looping on ESD event");
+
+ if (fRebuildV0s) RebuildV0s() ;
+ printf("There are %d V0s in event\n",fESD->GetNumberOfV0s());
+ for (Int_t iV0 = 0; iV0<fESD->GetNumberOfV0s(); iV0++) {
+
+ AliESDv0* esdV0 = fESD->GetV0(iV0);
+
+ //check if mother reconstructed V0 can be associated to a MC V0
+ Int_t labMCV0 = IsMcV0(esdV0,fESD,mcEvent->Stack()) ;
+ if (labMCV0 <0) continue;
+
+ esdV0->ChangeMassHypothesis(fV0PDG); //important to do that before entering the cut check
+
+ AliCFPair pair(esdV0,fESD);
+ if (!fCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,&pair)) continue;
+
+ //check if associated MC v0 passes the cuts
+ AliMCParticle* mcV0 = mcEvent->GetTrack(labMCV0);
+ if (!mcV0) continue;
+
+ if (!fCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,mcV0)) continue;
+
+ //fill the container
+ Double_t mom[3];
+ esdV0->GetPxPyPz(mom[0],mom[1],mom[2]);
+ Double_t pt2 = mom[0]*mom[0]+mom[1]*mom[1] ;
+ Double_t pt = TMath::Sqrt(pt2);
+ Double_t energy = TMath::Sqrt(pt2 + mom[2]*mom[2] + TMath::Power(TDatabasePDG::Instance()->GetParticle(fV0PDG)->Mass(),2));
+
+ containerInput[0] = pt ;
+ containerInput[1] = GetRapidity(energy,mom[2]);
+ fCFManager->GetParticleContainer()->Fill(containerInput,kStepReconstructed) ;
+ if (!fCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,&pair)) continue ;
+ fCFManager->GetParticleContainer()->Fill(containerInput,kStepSelected);
+ }
+
+ fHistEventsProcessed->Fill(0);
+ PostData(0,fHistEventsProcessed) ;
+ PostData(1,fCFManager->GetParticleContainer()) ;
+
+// TList * list = new TList();
+// fCFManager->AddQAHistosToList(list);
+// PostData(2,list) ;
+}
+
+
+//___________________________________________________________________________
+void AliCFV0Task::Terminate(Option_t*)
+{
+ // The Terminate() function is the last function to be called during
+ // a query. It always runs on the client, it can be used to present
+ // the results graphically or save the results to file.
+
+ Info("Terminate","");
+ AliAnalysisTask::Terminate();
+
+
+ Double_t max1 = fCFManager->GetParticleContainer()->ShowProjection(0,0)->GetMaximum();
+ Double_t max2 = fCFManager->GetParticleContainer()->ShowProjection(1,0)->GetMaximum();
+
+ fCFManager->GetParticleContainer()->ShowProjection(0,0)->GetYaxis()->SetRangeUser(0,max1*1.2);
+ fCFManager->GetParticleContainer()->ShowProjection(0,1)->GetYaxis()->SetRangeUser(0,max1*1.2);
+ fCFManager->GetParticleContainer()->ShowProjection(0,2)->GetYaxis()->SetRangeUser(0,max1*1.2);
+ fCFManager->GetParticleContainer()->ShowProjection(0,3)->GetYaxis()->SetRangeUser(0,max1*1.2);
+
+ fCFManager->GetParticleContainer()->ShowProjection(1,0)->GetYaxis()->SetRangeUser(0,max2*1.2);
+ fCFManager->GetParticleContainer()->ShowProjection(1,1)->GetYaxis()->SetRangeUser(0,max2*1.2);
+ fCFManager->GetParticleContainer()->ShowProjection(1,2)->GetYaxis()->SetRangeUser(0,max2*1.2);
+ fCFManager->GetParticleContainer()->ShowProjection(1,3)->GetYaxis()->SetRangeUser(0,max2*1.2);
+
+ fCFManager->GetParticleContainer()->ShowProjection(0,0)->SetMarkerStyle(23) ;
+ fCFManager->GetParticleContainer()->ShowProjection(0,1)->SetMarkerStyle(24) ;
+ fCFManager->GetParticleContainer()->ShowProjection(0,2)->SetMarkerStyle(25) ;
+ fCFManager->GetParticleContainer()->ShowProjection(0,3)->SetMarkerStyle(26) ;
+
+ fCFManager->GetParticleContainer()->ShowProjection(1,0)->SetMarkerStyle(23) ;
+ fCFManager->GetParticleContainer()->ShowProjection(1,1)->SetMarkerStyle(24) ;
+ fCFManager->GetParticleContainer()->ShowProjection(1,2)->SetMarkerStyle(25) ;
+ fCFManager->GetParticleContainer()->ShowProjection(1,3)->SetMarkerStyle(26) ;
+
+ TCanvas * c =new TCanvas("c","",1400,800);
+ c->Divide(4,2);
+
+ c->cd(1);
+ fCFManager->GetParticleContainer()->ShowProjection(0,0)->Draw("p");
+ c->cd(2);
+ fCFManager->GetParticleContainer()->ShowProjection(0,1)->Draw("p");
+ c->cd(3);
+ fCFManager->GetParticleContainer()->ShowProjection(0,2)->Draw("p");
+ c->cd(4);
+ fCFManager->GetParticleContainer()->ShowProjection(0,3)->Draw("p");
+ c->cd(5);
+ fCFManager->GetParticleContainer()->ShowProjection(1,0)->Draw("p");
+ c->cd(6);
+ fCFManager->GetParticleContainer()->ShowProjection(1,1)->Draw("p");
+ c->cd(7);
+ fCFManager->GetParticleContainer()->ShowProjection(1,2)->Draw("p");
+ c->cd(8);
+ fCFManager->GetParticleContainer()->ShowProjection(1,3)->Draw("p");
+
+ c->SaveAs("plots.eps");
+
+ delete fHistEventsProcessed ;
+}
+
+//___________________________________________________________________________
+void AliCFV0Task::ConnectInputData(Option_t *) {
+ //
+ // Initialize branches.
+ //
+ Info("ConnectInputData","ConnectInputData of task %s\n",GetName());
+
+ fChain = (TChain*)GetInputData(0);
+ fChain->SetBranchStatus("*FMD*",0);
+ fChain->SetBranchStatus("*CaloClusters*",0);
+ fESD = new AliESDEvent();
+ fESD->ReadFromTree(fChain);
+}
+
+//___________________________________________________________________________
+void AliCFV0Task::CreateOutputObjects() {
+ //HERE ONE CAN CREATE OUTPUT OBJECTS, IN PARTICULAR IF THE OBJECT PARAMETERS DON'T NEED
+ //TO BE SET BEFORE THE EXECUTION OF THE TASK
+ //
+ Info("CreateOutputObjects","CreateOutputObjects of task %s\n", GetName());
+
+ //slot #0
+ fHistEventsProcessed = new TH1I("fHistEventsProcessed","",1,0,1) ;
+}
+
+//___________________________________________________________________________
+Int_t AliCFV0Task::GetV0Label(UInt_t lab1, UInt_t lab2, AliStack* stack) const {
+ //
+ // returns the label of the V0, given the labels of the 2 daughter tracks
+ // returns -1 if the V0 is fake
+ //
+
+ TParticle* part1 = stack->Particle(lab1) ;
+ TParticle* part2 = stack->Particle(lab2) ;
+
+ Int_t part1MotherLab=part1->GetFirstMother();
+ Int_t part2MotherLab=part2->GetFirstMother();
+
+ if (part1MotherLab==-1 || part2MotherLab==-1) return -1 ;
+ if (part1MotherLab != part2MotherLab ) return -1 ;
+ if (stack->Particle(part1MotherLab)->GetPdgCode() != fV0PDG ) return -1 ;
+
+ switch (fV0PDG) {
+ case kK0Short :
+ if ( (part1->GetPdgCode()== -211 && part2->GetPdgCode()== 211) ||
+ (part1->GetPdgCode()== 211 && part2->GetPdgCode()== -211) ) return part1MotherLab ;
+ break ;
+ case kLambda0 :
+ if ( (part1->GetPdgCode()== -211 && part2->GetPdgCode()== 2212) ||
+ (part1->GetPdgCode()== 2212 && part2->GetPdgCode()== -211) ) return part1MotherLab ;
+ break ;
+ case kLambda0Bar :
+ if ( (part1->GetPdgCode()== 211 && part2->GetPdgCode()== -2212) ||
+ (part1->GetPdgCode()== -2212 && part2->GetPdgCode()== 211) ) return part1MotherLab ;
+ break ;
+ default :
+ return -1;
+ break ;
+ }
+
+ return -1 ;
+}
+
+//___________________________________________________________________________
+Double_t AliCFV0Task::GetRapidity(Double_t energy, Double_t pz) {
+ if (energy == pz || energy == -pz) {
+ printf("GetRapidity : ERROR : rapidity for 4-vector with E = Pz -- infinite result");
+ return 999;
+ }
+ if (energy < pz) {
+ printf("GetRapidity : ERROR : rapidity for 4-vector with E = Pz -- infinite result");
+ return 999;
+ }
+ Double_t y = 0.5 * log((energy + pz) / (energy - pz));
+ return y;
+}
+
+//___________________________________________________________________________
+Int_t AliCFV0Task::IsMcV0(AliESDv0* v0, AliESDEvent* esd, AliStack* stack) const {
+ Int_t nindex = v0->GetNindex();
+ Int_t pindex = v0->GetPindex();
+ AliESDtrack *nTrack = esd->GetTrack(nindex) ;
+ AliESDtrack *pTrack = esd->GetTrack(pindex) ;
+
+ if (!nTrack || !pTrack) return -1 ;
+
+ Int_t nlab = nTrack->GetLabel() ;
+ Int_t plab = pTrack->GetLabel() ;
+
+ if (nlab <0 || plab <0) return -1 ;
+
+ Int_t v0Label = GetV0Label((UInt_t)nlab,(UInt_t)plab,stack) ;
+ return v0Label ;
+}
+
+
+//___________________________________________________________________________
+void AliCFV0Task::RebuildV0s() {
+
+ fESD->ResetV0s();
+
+ //These are pp cuts : to change if Pb+Pb !
+ Double_t cuts[]={33, // max. allowed chi2
+ 0.1,// min. allowed negative daughter's impact parameter
+ 0.1,// min. allowed positive daughter's impact parameter
+ 0.1,// max. allowed DCA between the daughter tracks
+ 0.999,// max. allowed cosine of V0's pointing angle
+ 0.9, // min. radius of the fiducial volume
+ 100. // max. radius of the fiducial volume
+ };
+ // AliV0vertexer* v0Vertexer = new AliV0vertexer(cuts);
+ // v0Vertexer->SetVertex(primVertexPos);
+ AliV0vertexer* v0Vertexer = new AliV0vertexer();
+ v0Vertexer->SetCuts(cuts) ;
+ v0Vertexer->Tracks2V0vertices(fESD);
+ delete v0Vertexer ;
+}
+
+#endif
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+//-----------------------------------------------------------------------
+// Author : R. Vernet, Consorzio Cometa - Catania (it)
+//-----------------------------------------------------------------------
+
+#ifndef ALICFV0TASK_H
+#define ALICFV0TASK_H
+
+#include "AliAnalysisTask.h"
+
+class TH1I;
+class TParticle ;
+class TFile ;
+class AliMCEventHandler;
+class AliESDEvent;
+class AliStack ;
+class AliCFManager;
+class TChain;
+class AliESDv0;
+
+class AliCFV0Task : public AliAnalysisTask {
+ public:
+
+ enum {
+ kStepGenerated = 0,
+ kStepReconstructible = 1,
+ kStepReconstructed = 2,
+ kStepSelected = 3
+ };
+
+ AliCFV0Task();
+ AliCFV0Task(const Char_t* name);
+ AliCFV0Task& operator= (const AliCFV0Task& c);
+ AliCFV0Task(const AliCFV0Task& c);
+ virtual ~AliCFV0Task();
+
+ // ANALYSIS FRAMEWORK STUFF to loop on data and fill output objects
+ void ConnectInputData(Option_t *option="");
+ void CreateOutputObjects();
+ void Exec(Option_t *option);
+ void Init(); //loads the CF manager
+ void LocalInit() {Init();} //needed for the slaves
+ void Terminate(Option_t *);
+
+ // CORRECTION FRAMEWORK RELATED FUNCTIONS
+ void SetCFManager(AliCFManager* io) {fCFManager = io;} // global correction manager
+ AliCFManager * GetCFManager() {return fCFManager;} // get corr manager
+
+ void SetRebuildV0s(Bool_t flag) {fRebuildV0s = flag;} // setter for V0 on-the-fly reconstruction
+ void SetV0PDG(Int_t code) {fV0PDG = code; } // defines the PDG code of searched V0's
+ Int_t IsMcV0(AliESDv0*, AliESDEvent*, AliStack*) const ; // checks if the AliESDv0 can be associated, returns mother label
+ Int_t GetV0Label(UInt_t, UInt_t, AliStack*) const ; // returns label of V0 given 2 daughter labels
+ static Double_t GetRapidity(Double_t, Double_t) ; // returns the rapidity of the V0 (assuming PDG code)
+
+
+ protected:
+ void RebuildV0s() ; // reconstructs V0's on-fly
+
+ Bool_t fRebuildV0s; // flag for on-the-fly V0 reconstruction
+ Int_t fV0PDG; // PDG code of searched V0's
+ TChain *fChain ; // chained files
+ AliESDEvent *fESD ; // pointer to the ESD event read
+ AliCFManager *fCFManager ; // pointer to the CF manager
+
+ // Histograms
+ //Number of events
+ TH1I *fHistEventsProcessed; //! simple histo for monitoring the number of events processed
+
+ ClassDef(AliCFV0Task,1);
+};
+
+#endif