Support for HFE analysis added (Matthias)
authorfprino <fprino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 26 Nov 2012 11:44:22 +0000 (11:44 +0000)
committerfprino <fprino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 26 Nov 2012 11:44:22 +0000 (11:44 +0000)
PWGHF/correlationHF/AliHFAssociatedTrackCuts.cxx
PWGHF/correlationHF/AliHFCorrelator.cxx
PWGHF/correlationHF/AliHFCorrelator.h
PWGHF/correlationHF/AliReducedParticle.cxx
PWGHF/correlationHF/AliReducedParticle.h

index c535fba..a08788f 100644 (file)
@@ -473,44 +473,53 @@ void AliHFAssociatedTrackCuts::PrintAll()
 {
        
        printf("\n=================================================");
-       printf("\nCuts for the associated track: \n \n");
-              
-       printf("ITS Refit........................................: %s\n",fESDTrackCuts->GetRequireITSRefit() ? "Yes" : "No");
-       printf("TPC Refit........................................: %s\n",fESDTrackCuts->GetRequireTPCRefit() ? "Yes" : "No");
-       printf("ITS SA...........................................: %s\n",fESDTrackCuts->GetRequireITSStandAlone() ? "Yes" : "No");
-       printf("TPC SA...........................................: %s\n",fESDTrackCuts->GetRequireTPCStandAlone() ? "Yes" : "No");
-       printf("Min number of ITS clusters.......................: %d\n",fESDTrackCuts->GetMinNClustersITS());
-       printf("Min number of TPC clusters.......................: %d\n",fESDTrackCuts->GetMinNClusterTPC());
-       Int_t spd = fESDTrackCuts->GetClusterRequirementITS(AliESDtrackCuts::kSPD);
-       if(spd==0) std::cout <<  "SPD..............................................: kOff"  << std::endl;
-       if(spd==1) std::cout <<  "SPD..............................................: kNone"  << std::endl;
-       if(spd==2) std::cout <<  "SPD..............................................: kAny"  << std::endl;
-       if(spd==3) std::cout <<  "SPD..............................................: kFirst"  << std::endl;
-       if(spd==4) std::cout <<  "SPD..............................................: kOnlyFirst"  << std::endl;
-       if(spd==5) std::cout <<  "SPD..............................................: kSecond"  << std::endl;
-       if(spd==6) std::cout <<  "SPD..............................................: kOnlySecond"  << std::endl;
-       if(spd==7) std::cout <<  "SPD..............................................: kBoth"  << std::endl;
-       
+       if(fESDTrackCuts){
+         printf("\nCuts for the associated track: \n \n");
+         
+         printf("ITS Refit........................................: %s\n",fESDTrackCuts->GetRequireITSRefit() ? "Yes" : "No");
+         printf("TPC Refit........................................: %s\n",fESDTrackCuts->GetRequireTPCRefit() ? "Yes" : "No");
+         printf("ITS SA...........................................: %s\n",fESDTrackCuts->GetRequireITSStandAlone() ? "Yes" : "No");
+         printf("TPC SA...........................................: %s\n",fESDTrackCuts->GetRequireTPCStandAlone() ? "Yes" : "No");
+         printf("Min number of ITS clusters.......................: %d\n",fESDTrackCuts->GetMinNClustersITS());
+         printf("Min number of TPC clusters.......................: %d\n",fESDTrackCuts->GetMinNClusterTPC());
+         Int_t spd = fESDTrackCuts->GetClusterRequirementITS(AliESDtrackCuts::kSPD);
+         if(spd==0) std::cout <<  "SPD..............................................: kOff"  << std::endl;
+         if(spd==1) std::cout <<  "SPD..............................................: kNone"  << std::endl;
+         if(spd==2) std::cout <<  "SPD..............................................: kAny"  << std::endl;
+         if(spd==3) std::cout <<  "SPD..............................................: kFirst"  << std::endl;
+         if(spd==4) std::cout <<  "SPD..............................................: kOnlyFirst"  << std::endl;
+         if(spd==5) std::cout <<  "SPD..............................................: kSecond"  << std::endl;
+         if(spd==6) std::cout <<  "SPD..............................................: kOnlySecond"  << std::endl;
+         if(spd==7) std::cout <<  "SPD..............................................: kBoth"  << std::endl;
+       }
+       else printf("\nNo Cuts for Associated Tracks\n");
        std::cout <<  "Filter Bit.......................................: " << fBit  << std::endl;
        std::cout <<  "Charge...........................................: " << fCharge  << std::endl;
-               
-       for(Int_t j=0;j<fNTrackCuts;j++){
-               std::cout << fTrackCutsNames[j] << fAODTrackCuts[j] << std::endl;
+       
+       if(fAODTrackCuts){
+         for(Int_t j=0;j<fNTrackCuts;j++){
+           std::cout << fTrackCutsNames[j] << fAODTrackCuts[j] << std::endl;
+         }
        }
-       printf("\n");
-       printf("=================================================");
-       printf("\nCuts for the K0 candidates: \n \n");
-       for(Int_t k=0;k<fNvZeroCuts;k++){
-               std::cout << fvZeroCutsNames[k] <<  fAODvZeroCuts[k] << std::endl;
+
+       if(fAODvZeroCuts){
+         printf("\n");
+         printf("=================================================");
+         printf("\nCuts for the K0 candidates: \n \n");
+         for(Int_t k=0;k<fNvZeroCuts;k++){
+           std::cout << fvZeroCutsNames[k] <<  fAODvZeroCuts[k] << std::endl;
+         }
        }
+       else printf("\nNo Cuts for the K0 candidates\n");
        std::cout << " " << std::endl;
        PrintPoolParameters();
        PrintSelectedMCevents();
-
-       printf("=================================================");
-       printf("\nAdditional description\n");
-       std::cout << fDescription << std::endl;
-       printf("\n");
+       if(fDescription){
+         printf("=================================================");
+         printf("\nAdditional description\n");
+         std::cout << fDescription << std::endl;
+         printf("\n");
+       }
 
 }
 
index bb7f3cc..7b28a46 100644 (file)
@@ -64,7 +64,7 @@ fmixing(kFALSE),
 fmontecarlo(kFALSE),
 fsystem(kFALSE),
 fUseReco(kTRUE),
-fselect(0),
+fselect(kUndefined),
 
 fUseImpactParameter(0),
 fPIDmode(0),
@@ -108,7 +108,7 @@ fmixing(kFALSE),
 fmontecarlo(kFALSE),
 fsystem(ppOrPbPb),
 fUseReco(kTRUE),
-fselect(0),
+fselect(kUndefined),
 fUseImpactParameter(0),
 fPIDmode(0),
 
@@ -245,16 +245,20 @@ Bool_t AliHFCorrelator::ProcessEventPool(){
 }
 
 //_____________________________________________________
-Bool_t AliHFCorrelator::ProcessAssociatedTracks(Int_t EventLoopIndex){
-
+Bool_t AliHFCorrelator::ProcessAssociatedTracks(Int_t EventLoopIndex, const TObjArray* associatedTracks){
+  // TODO: memory leak needs to be fixed, for every call, a new array
+  // is allocated, but the pointer immediately lost. The cleanup is
+  // not straightforward as in the case of event mixing the pointer
+  // will be an external array which must not be deleted.
        fAssociatedTracks = new TObjArray();
        
        if(!fmixing){ // analysis on Single Event
                
                
-               if(fselect==1 || fselect ==2)   fAssociatedTracks = AcceptAndReduceTracks(fAODEvent);
-               if(fselect==3) {fAssociatedTracks = AcceptAndReduceKZero(fAODEvent);}   
                
+               if(fselect==kHadron || fselect ==kKaon) fAssociatedTracks = AcceptAndReduceTracks(fAODEvent);
+               if(fselect==kKZero) {fAssociatedTracks = AcceptAndReduceKZero(fAODEvent);}      
+               if(fselect==kElectron && associatedTracks) fAssociatedTracks=new TObjArray(*associatedTracks);
                
        }
        
@@ -293,14 +297,17 @@ Bool_t AliHFCorrelator::Correlate(Int_t loopindex){
 }
                
 //_____________________________________________________
-Bool_t AliHFCorrelator::PoolUpdate(){
+Bool_t AliHFCorrelator::PoolUpdate(const TObjArray* associatedTracks){
 
        if(!fmixing) return kFALSE;
        if(!fPool) return kFALSE;
        if(fmixing) { // update the pool for Event Mixing
                TObjArray* objArr = NULL;
-               if(fselect==1 || fselect==2) objArr = (TObjArray*)AcceptAndReduceTracks(fAODEvent);
-               else if(fselect==3) objArr = (TObjArray*)AcceptAndReduceKZero(fAODEvent);
+               if(fselect==kHadron || fselect==kKaon) objArr = (TObjArray*)AcceptAndReduceTracks(fAODEvent);
+               else if(fselect==kKZero) objArr = (TObjArray*)AcceptAndReduceKZero(fAODEvent);
+               else if(fselect==kElectron && associatedTracks){
+                 objArr = new TObjArray(*associatedTracks);
+               }
                else return kFALSE;
                if(objArr->GetEntriesFast()>0) fPool->UpdatePool(objArr); // updating the pool only if there are entries in the array
        }
@@ -360,7 +367,7 @@ TObjArray*  AliHFCorrelator::AcceptAndReduceTracks(AliAODEvent* inputEvent){
                        if(fD0cand) rejectsoftpi = fhadcuts->InvMassDstarRejection(fD0cand,track,fhypD0);
                
                        
-                       if(fselect ==2){        
+                       if(fselect ==kKaon){    
                                if(!fhadcuts->CheckKaonCompatibility(track,fmontecarlo,fmcArray,fPIDmode)) continue; // check if it is a Kaon - data and MC
                        }
                
index 4457c24..3c2b64d 100644 (file)
@@ -45,6 +45,15 @@ class AliHFCorrelator : public TNamed
        AliHFCorrelator(const Char_t* name, AliHFAssociatedTrackCuts *cuts, Bool_t ppOrPbPb);
        virtual ~AliHFCorrelator();
        
+       // enum for setting which associated particle type to work with
+       enum{
+         kUndefined=0,
+         kHadron=1,
+         kKaon,
+         kKZero,
+         kElectron
+       };
+
        //setters
        void SetDeltaPhiInterval (Double_t min, Double_t max){
                fPhiMin = min; fPhiMax = max;
@@ -73,9 +82,9 @@ class AliHFCorrelator : public TNamed
         Bool_t DefineEventPool(); // Definition of the Event pool parameters
        Bool_t Initialize(); // function that initlize everything for the analysis      
        Bool_t ProcessEventPool(); // processes the event pool
-       Bool_t ProcessAssociatedTracks(Int_t EventLoopIndex); //
+       Bool_t ProcessAssociatedTracks(Int_t EventLoopIndex, const TObjArray* associatedTracks=NULL); //
        Bool_t Correlate(Int_t loopindex); // function that computes the correlations between the trigger particle and the track n. loopindex
-       Bool_t PoolUpdate();// updates the event pool
+       Bool_t PoolUpdate(const TObjArray* associatedTracks=NULL);// updates the event pool
        Double_t SetCorrectPhiRange(Double_t phi); // sets all the angles in the correct range
        void SetPidAssociated() {fhadcuts->SetPidAssociated();}
 
index 4a69e15..e31c9f9 100644 (file)
@@ -38,7 +38,10 @@ fMcLabel(mcLabel),
 fid(trackid),
 fImpPar(impPar),
 fCheckSoftPi(checkSoftPi),
-fCharge(0)
+fCharge(0),
+fInvMass(0),
+fPtBin(-1),
+fOriginMother(-1)
 {
        //
        // default constructor
@@ -53,7 +56,10 @@ fMcLabel(mcLabel),
 fid(trackid),
 fImpPar(impPar),
 fCheckSoftPi(checkSoftPi),
-fCharge(charge)
+fCharge(charge),
+fInvMass(0),
+fPtBin(-1),
+fOriginMother(-1)
 {
        //
        // default constructor
@@ -68,13 +74,53 @@ fMcLabel(McLabel),
 fid(0),
 fImpPar(0.),
 fCheckSoftPi(kFALSE),
-fCharge(0)
+fCharge(0),
+fInvMass(0),
+fPtBin(-1),
+fOriginMother(-1)
 {
        //
        // default constructor
        //
 }
 
+AliReducedParticle::AliReducedParticle(Double_t eta, Double_t phi, Double_t pt, int charge, int originmother) : 
+fEta(eta), 
+fPhi(phi), 
+fpT(pt), 
+fMcLabel(0),
+fid(0),
+fImpPar(0.),
+fCheckSoftPi(kFALSE),
+fCharge(charge),
+fInvMass(0),
+fPtBin(-1),
+fOriginMother(originmother)
+{
+       //
+       // default constructor
+       //
+}
+
+AliReducedParticle::AliReducedParticle(Double_t eta, Double_t phi, Double_t pt, Double_t invmass, int ptbin, int originmother) : 
+fEta(eta), 
+fPhi(phi), 
+fpT(pt), 
+fMcLabel(0),
+fid(0),
+fImpPar(0.),
+fCheckSoftPi(kFALSE),
+fCharge(0),
+fInvMass(invmass),
+fPtBin(ptbin),
+fOriginMother(originmother)
+{
+       //
+       // default constructor
+       //
+}
+
+
 AliReducedParticle::~AliReducedParticle() {
 
        //
index 16a855d..ee75649 100644 (file)
 
 
 #include "AliLog.h"
+#include "AliVParticle.h"
 
 // class to get the reduced hadron candidate
 class AliReducedParticle : public AliVParticle
 {
 public:
     AliReducedParticle(Double_t eta, Double_t phi, Double_t pt, Int_t mcLabel, Int_t trackid, Double_t impPar, Bool_t checkSoftPi);
-       AliReducedParticle(Double_t eta, Double_t phi, Double_t pt, Int_t mcLabel, Int_t trackid, Double_t impPar, Bool_t checkSoftPi, Short_t charge);
+    AliReducedParticle(Double_t eta, Double_t phi, Double_t pt, Int_t mcLabel, Int_t trackid, Double_t impPar, Bool_t checkSoftPi, Short_t charge);
     AliReducedParticle(Double_t eta, Double_t phi, Double_t pt, Int_t mcLabel);
+    AliReducedParticle(Double_t eta, Double_t phi, Double_t pt, int charge, int orginmother); 
+    AliReducedParticle(Double_t eta, Double_t phi, Double_t pt, Double_t invmass, int ptbin, int orginmother=0);
 
     ~AliReducedParticle();
     
@@ -55,6 +58,9 @@ public:
     virtual Int_t  GetID()             const{return fid;}
     virtual Double_t GetImpPar() const{return fImpPar;}
     virtual Bool_t CheckSoftPi() const{return fCheckSoftPi;}
+    virtual Double_t GetInvMass() const {return fInvMass;}
+    virtual int GetPtBin() const  {return fPtBin;}
+    virtual int GetOriginMother() const {return fOriginMother;}
        
        // kinematics
     virtual Double_t Px() const { AliFatal("Not implemented"); return 0; }
@@ -89,15 +95,19 @@ public:
        
     
 private:
-    Double_t fEta;      // eta
-    Double_t fPhi;      // phi
-    Double_t fpT;       // pT
-    Int_t fMcLabel; //mclabel
-    Int_t fid; // track ID
-    Double_t fImpPar; // impact parameter
+    Double_t fEta;       // eta
+    Double_t fPhi;       // phi
+    Double_t fpT;        // pT
+    Int_t fMcLabel;      //mclabel
+    Int_t fid;           // track ID
+    Double_t fImpPar;    // impact parameter
     Bool_t fCheckSoftPi; // check if the track is compatible with a softpion from D*
-    Short_t fCharge; // charge of the associated track
+    Short_t fCharge;     // charge of the associated track
+    Double_t fInvMass;   // Invariant mass of Dmeson
+    int fPtBin;          // Ptbin of Dmesons
+    int fOriginMother;   //  Holds the origin motherquark (process)
+
     
-    ClassDef(AliReducedParticle, 3); // class which contains only quantities requires for this analysis to reduce memory consumption for event mixing
+    ClassDef(AliReducedParticle, 4); // class which contains only quantities requires for this analysis to reduce memory consumption for event mixing
 };
 #endif