Added computation of mothers in acceptance (Massimo) + macros for D0 analysis updated
authorfbellini <fbellini@cern.ch>
Fri, 19 Sep 2014 17:53:29 +0000 (19:53 +0200)
committerfbellini <fbellini@cern.ch>
Fri, 19 Sep 2014 17:53:29 +0000 (19:53 +0200)
PWGLF/RESONANCES/AliRsnMiniAnalysisTask.cxx
PWGLF/RESONANCES/AliRsnMiniAnalysisTask.h
PWGLF/RESONANCES/AliRsnMiniOutput.cxx
PWGLF/RESONANCES/AliRsnMiniOutput.h
PWGLF/RESONANCES/macros/mini/AddAnalysisTaskD0.C
PWGLF/RESONANCES/macros/mini/ConfigD0.C

index a80ed5c..4caaf37 100644 (file)
@@ -80,7 +80,10 @@ AliRsnMiniAnalysisTask::AliRsnMiniAnalysisTask() :
    fOriginDselection(kFALSE),
    fKeepDfromB(kFALSE),
    fKeepDfromBOnly(kFALSE),
-   fRejectIfNoQuark(kFALSE)
+   fRejectIfNoQuark(kFALSE),
+   fMotherAcceptanceCutMinPt(0.0),
+   fMotherAcceptanceCutMaxEta(0.9),
+   fKeepMotherInAcceptance(kFALSE) 
 {
 //
 // Dummy constructor ALWAYS needed for I/O.
@@ -126,7 +129,10 @@ AliRsnMiniAnalysisTask::AliRsnMiniAnalysisTask(const char *name, Bool_t useMC) :
    fOriginDselection(kFALSE),
    fKeepDfromB(kFALSE),
    fKeepDfromBOnly(kFALSE),
-   fRejectIfNoQuark(kFALSE)
+   fRejectIfNoQuark(kFALSE),
+   fMotherAcceptanceCutMinPt(0.0),
+   fMotherAcceptanceCutMaxEta(0.9),
+   fKeepMotherInAcceptance(kFALSE)
 {
 //
 // Default constructor.
@@ -177,7 +183,10 @@ AliRsnMiniAnalysisTask::AliRsnMiniAnalysisTask(const AliRsnMiniAnalysisTask &cop
    fOriginDselection(copy.fOriginDselection),
    fKeepDfromB(copy.fOriginDselection),
    fKeepDfromBOnly(copy.fKeepDfromBOnly),
-   fRejectIfNoQuark(copy.fRejectIfNoQuark)
+   fRejectIfNoQuark(copy.fRejectIfNoQuark),
+   fMotherAcceptanceCutMinPt(copy.fMotherAcceptanceCutMinPt),
+   fMotherAcceptanceCutMaxEta(copy.fMotherAcceptanceCutMaxEta),
+   fKeepMotherInAcceptance(copy.fKeepMotherInAcceptance)
 {
 //
 // Copy constructor.
@@ -231,6 +240,9 @@ AliRsnMiniAnalysisTask &AliRsnMiniAnalysisTask::operator=(const AliRsnMiniAnalys
    fKeepDfromB = copy.fOriginDselection;
    fKeepDfromBOnly = copy.fKeepDfromBOnly;
    fRejectIfNoQuark = copy.fRejectIfNoQuark;
+   fMotherAcceptanceCutMinPt = copy.fMotherAcceptanceCutMinPt;
+   fMotherAcceptanceCutMaxEta = copy.fMotherAcceptanceCutMaxEta;
+   fKeepMotherInAcceptance = copy.fKeepMotherInAcceptance;
    return (*this);
 }
 
@@ -983,7 +995,7 @@ void AliRsnMiniAnalysisTask::FillTrueMotherESD(AliRsnMiniEvent *miniEvent)
    for (id = 0; id < ndef; id++) {
       def = (AliRsnMiniOutput *)fHistograms[id];
       if (!def) continue;
-      if (!def->IsMother()) continue;
+      if (!def->IsMother() && !def->IsMotherInAcc()) continue;
       for (ip = 0; ip < npart; ip++) {
          AliMCParticle *part = (AliMCParticle *)fMCEvent->GetTrack(ip);
          //get mother pdg code
@@ -1063,6 +1075,12 @@ void AliRsnMiniAnalysisTask::FillTrueMotherESD(AliRsnMiniEvent *miniEvent)
          miniPair.FillRef(def->GetMotherMass());
          // do computations
          def->FillMother(&miniPair, miniEvent, &fValues);
+        if(fKeepMotherInAcceptance){
+             if(daughter1->Pt()<fMotherAcceptanceCutMinPt || daughter2->Pt()<fMotherAcceptanceCutMinPt || TMath::Abs(daughter1->Eta())>fMotherAcceptanceCutMaxEta ||  TMath::Abs(daughter2->Eta())>fMotherAcceptanceCutMaxEta) continue;
+             def->FillMotherInAcceptance(&miniPair, miniEvent, &fValues);
+        }       
+        
+        
       }
    }
 }
@@ -1086,7 +1104,7 @@ void AliRsnMiniAnalysisTask::FillTrueMotherAOD(AliRsnMiniEvent *miniEvent)
    for (id = 0; id < ndef; id++) {
       def = (AliRsnMiniOutput *)fHistograms[id];
       if (!def) continue;
-      if (!def->IsMother()) continue;
+      if (!def->IsMother() && !def->IsMotherInAcc()) continue;
       for (ip = 0; ip < npart; ip++) {
          AliAODMCParticle *part = (AliAODMCParticle *)list->At(ip);
          if (part->GetPdgCode() != def->GetMotherPDG()) continue;
@@ -1164,6 +1182,10 @@ void AliRsnMiniAnalysisTask::FillTrueMotherAOD(AliRsnMiniEvent *miniEvent)
          miniPair.FillRef(def->GetMotherMass());
          // do computations
          def->FillMother(&miniPair, miniEvent, &fValues);
+        if(fKeepMotherInAcceptance){
+             if(daughter1->Pt()<fMotherAcceptanceCutMinPt || daughter2->Pt()<fMotherAcceptanceCutMinPt || TMath::Abs(daughter1->Eta())>fMotherAcceptanceCutMaxEta ||  TMath::Abs(daughter2->Eta())>fMotherAcceptanceCutMaxEta) continue;
+             def->FillMotherInAcceptance(&miniPair, miniEvent, &fValues);
+        }
       }
    }
 }
index 6b12298..9181d79 100644 (file)
@@ -54,6 +54,9 @@ public:
    void                SetCheckFeedDown(Bool_t checkFeedDown)      {fCheckFeedDown = checkFeedDown;}
    void                SetDselection(UShort_t originDselection);
    void               SetRejectCandidateIfNotFromQuark(Bool_t opt){fRejectIfNoQuark=opt;}
+   void                SetMotherAcceptanceCutMinPt(Float_t minPt)  {fMotherAcceptanceCutMinPt = minPt;}
+   void                SetMotherAcceptanceCutMaxEta(Float_t maxEta){fMotherAcceptanceCutMaxEta = maxEta;}
+   void                KeepMotherInAcceptance(Bool_t keepMotherInAcceptance) {fKeepMotherInAcceptance = keepMotherInAcceptance;}
    Int_t               AddTrackCuts(AliRsnCutSet *cuts);
    TClonesArray       *Outputs()                          {return &fHistograms;}
    TClonesArray       *Values()                           {return &fValues;}
@@ -127,8 +130,11 @@ private:
    Bool_t              fKeepDfromB;         // flag for the feed down from b quark decay (specific for D meson analysis)                       
    Bool_t              fKeepDfromBOnly;     // flag to keep only the charm particles that comes from beauty decays (specific for D meson analysis)
    Bool_t              fRejectIfNoQuark;    // flag to remove events not generated with PYTHIA
+   Float_t              fMotherAcceptanceCutMinPt;              // cut value to apply when selecting the mothers inside a defined acceptance
+   Float_t              fMotherAcceptanceCutMaxEta;             // cut value to apply when selecting the mothers inside a defined acceptance
+   Bool_t               fKeepMotherInAcceptance;                // flag to keep also mothers in acceptance
 
-   ClassDef(AliRsnMiniAnalysisTask, 10);   // AliRsnMiniAnalysisTask
+   ClassDef(AliRsnMiniAnalysisTask, 11);   // AliRsnMiniAnalysisTask
 };
 
 
index d6bfe5c..c5bdf3c 100644 (file)
@@ -137,6 +137,7 @@ AliRsnMiniOutput::AliRsnMiniOutput(const char *name, const char *outType, const
 //    -- "ROTATE2" --> rotated background (rotate second track)
 //    -- "TRUE"    --> true pairs (like track pair, but checking that come from same mother)
 //    -- "MOTHER"  --> mother (loop on MC directly for mothers --> denominator of efficiency)
+//    -- "MOTHER_IN_ACC"  --> mother (loop on MC directly for mothers (in a defined acceptance interval)--> needed for efficiency calcutation using  an enriched sample)
 //
 
    TString input;
@@ -168,6 +169,8 @@ AliRsnMiniOutput::AliRsnMiniOutput(const char *name, const char *outType, const
       fComputation = kTruePair;
    else if (!input.CompareTo("MOTHER"))
       fComputation = kMother;
+    else if (!input.CompareTo("MOTHER_IN_ACC"))
+      fComputation = kMotherInAcc;   
    else
       AliWarning(Form("String '%s' does not define a meaningful computation type", compType));
 
@@ -446,6 +449,31 @@ Bool_t AliRsnMiniOutput::FillMother(const AliRsnMiniPair *pair, AliRsnMiniEvent
 }
 
 //________________________________________________________________________________________
+Bool_t AliRsnMiniOutput::FillMotherInAcceptance(const AliRsnMiniPair *pair, AliRsnMiniEvent *event, TClonesArray *valueList)
+{
+//
+// Compute values for mother-based computations
+//
+
+   // check computation type
+   if (fComputation != kMotherInAcc) {
+      AliError("This method can be called only for mother-based computations");
+      return kFALSE;
+   }
+
+   // copy passed pair info
+   fPair = (*pair);
+
+   // check pair against cuts
+   if (fPairCuts) if (!fPairCuts->IsSelected(&fPair)) return kFALSE;
+
+   // compute & fill
+   ComputeValues(event, valueList);
+   FillHistogram();
+   return kTRUE;
+}
+
+//________________________________________________________________________________________
 Int_t AliRsnMiniOutput::FillPair(AliRsnMiniEvent *event1, AliRsnMiniEvent *event2, TClonesArray *valueList, Bool_t refFirst)
 {
 //
index 3046746..d95a4a4 100644 (file)
@@ -43,6 +43,7 @@ public:
       kTrackPairRotated2,
       kTruePair,
       kMother,
+      kMotherInAcc,
       kComputations
    };
 
@@ -57,6 +58,7 @@ public:
    Bool_t          IsTrackPairMix()     const {return (fComputation == kTrackPairMix);}
    Bool_t          IsTruePair()         const {return (fComputation == kTruePair);}
    Bool_t          IsMother()           const {return (fComputation == kMother);}
+   Bool_t          IsMotherInAcc()      const {return (fComputation == kMotherInAcc);}
    Bool_t          IsDefined()          const {return (IsEventOnly() || IsTrackPair() || IsTrackPairMix() || IsTruePair() || IsMother());}
    Bool_t          IsLikeSign()         const {return (fCharge[0] == fCharge[1]);}
    Bool_t          IsSameCut()          const {return (fCutID[0] == fCutID[1]);}
@@ -100,6 +102,7 @@ public:
    AliRsnMiniPair &Pair() {return fPair;}
    Bool_t          Init(const char *prefix, TList *list);
    Bool_t          FillMother(const AliRsnMiniPair *pair, AliRsnMiniEvent *event, TClonesArray *valueList);
+   Bool_t          FillMotherInAcceptance(const AliRsnMiniPair *pair, AliRsnMiniEvent *event, TClonesArray *valueList);
    Bool_t          FillEvent(AliRsnMiniEvent *event, TClonesArray *valueList);
    Int_t           FillPair(AliRsnMiniEvent *event1, AliRsnMiniEvent *event2, TClonesArray *valueList, Bool_t refFirst = kTRUE);
 
index 3929e9f..d141b87 100644 (file)
@@ -102,13 +102,17 @@ AliRsnMiniAnalysisTask * AddAnalysisTaskD0
    task->SetCheckFeedDown(checkFeedDown);
    task->SetRejectCandidateIfNotFromQuark(checkQuark);
    task->SetDselection(originDselection);
+   task->KeepMotherInAcceptance(kTRUE);
+   task->SetMotherAcceptanceCutMinPt(minpt);
+   task->SetMotherAcceptanceCutMaxEta(maxeta);
    
       
    ::Info("AddAnalysisTaskD0", Form("Maximum numbers of daughters allowed (-1 means cut not applied): %i",maxSisters));
    ::Info("AddAnalysisTaskD0", Form("Are we checking the momentum conservation? %s", checkP? "yes" : "no"));
-   ::Info("AddAnalysisTaskD0", Form("Are we checking the feedown? %s", checkFeedDown? "yes" : "no"));
+   ::Info("AddAnalysisTaskD0", Form("Are we checking the feeddown? %s", checkFeedDown? "yes" : "no"));
    ::Info("AddAnalysisTaskD0", Form("Are we rejecting the Hijing generated? %s", checkQuark? "yes" : "no"));
    ::Info("AddAnalysisTaskD0", Form("Which D0 are we keeping? %s", (originDselection==0? "only from c quark" : originDselection==1? "only from b quark" : "both from c and b quark") ));
+   ::Info("AddAnalysisTaskD0", Form("Selecting Mother in Acceptance: Min pT %.1f, Eta Range %.1f - %.1f", minpt, mineta, maxeta));
 
 
    if (isPP) 
index 9a48f65..93c7bc3 100644 (file)
@@ -74,10 +74,9 @@ Bool_t ConfigD0
    else cutQuality->SetDCARPtFormula(formula);
    if(minDCAcutFixed) cutQuality->SetDCARmin(trackDCAcutMin);
    else cutQuality->SetDCARPtFormulaMin(formulaMin);
-   cutQuality->SetTPCminNClusters(NTPCcluster); 
-   //if(!isPP)cutQuality->SetTPCminNClusters(NTPCcluster);
-   //if(isPP)cutQuality->SetMinNCrossedRowsTPC(NTPCcluster,kTRUE);
-   //if(isPP)cutQuality->SetMinNCrossedRowsOverFindableClsTPC(NTPCcrratio,kTRUE);
+   if(!isPP)cutQuality->SetTPCminNClusters(NTPCcluster);
+   if(isPP)cutQuality->SetMinNCrossedRowsTPC(NTPCcluster,kTRUE);
+   if(isPP)cutQuality->SetMinNCrossedRowsOverFindableClsTPC(NTPCcrratio,kTRUE);
    cutQuality->SetPtRange(minpt,1E20);
    cutQuality->SetEtaRange(mineta, maxeta);
    cutQuality->SetDCAZmax(trackDCAZcutMax);
@@ -112,10 +111,9 @@ Bool_t ConfigD0
    else cutQuality->SetDCARPtFormula(formula);
    if(minDCAcutFixed) cutQuality->SetDCARmin(trackDCAcutMin);
    else cutQuality->SetDCARPtFormulaMin(formulaMin);
-   cutQuality->SetTPCminNClusters(NTPCcluster);
-   //if(!isPP)cutQuality->SetTPCminNClusters(NTPCcluster);
-   //if(isPP)cutQuality->SetMinNCrossedRowsTPC(NTPCcluster,kTRUE);
-   //if(isPP)cutQuality->SetMinNCrossedRowsOverFindableClsTPC(NTPCcrratio,kTRUE);
+   if(!isPP)cutQuality->SetTPCminNClusters(NTPCcluster);
+   if(isPP)cutQuality->SetMinNCrossedRowsTPC(NTPCcluster,kTRUE);
+   if(isPP)cutQuality->SetMinNCrossedRowsOverFindableClsTPC(NTPCcrratio,kTRUE);
    cutQuality->SetPtRange(minpt,1E20);
    cutQuality->SetEtaRange(mineta, maxeta);
    cutQuality->SetDCAZmax(trackDCAZcutMax);
@@ -137,81 +135,6 @@ Bool_t ConfigD0
    
    
    
-   
-   
-   ////////////////////////////////////////////////////////////////////////////////////////////////
-   // Cut set for mothers -- To be used only for the efficiency evaluation when using the charm enriched sample
-   /*
-   AliRsnCutDaughterD0 *cutPi_mother = new AliRsnCutDaughterD0("cutPionForD0_MC", AliPID::kPion);
-   cutPi_mother->SetIsCheckOnMother(kTRUE);
-   cutPi_mother->SetNoPID(kTRUE);
-   cutPi_mother->SetTPCPionPIDCut(1E20);
-   cutPi_mother->SetTOFPionPIDCut(1E20);
-   cutPi_mother->SetPtDependentPIDCut(kFALSE);
-   AliRsnCutTrackQuality *cutQuality = (AliRsnCutTrackQuality*) cutPi_mother->CutQuality();
-   cutQuality->SetCheckOnlyFilterBit(kFALSE);
-   cutQuality->SetAODTestFilterBit(-1);
-   if(maxDCAcutFixed)cutQuality->SetDCARmax(1E20);              
-   else cutQuality->SetDCARPtFormula("");
-   if(minDCAcutFixed) cutQuality->SetDCARmin(0);
-   else cutQuality->SetDCARPtFormulaMin(""); 
-   if(!isPP)cutQuality->SetTPCminNClusters(0);
-   if(isPP)cutQuality->SetMinNCrossedRowsTPC(0,kTRUE);
-   if(isPP)cutQuality->SetMinNCrossedRowsOverFindableClsTPC(0,kTRUE);
-   cutQuality->SetPtRange(0,1E20);
-   cutQuality->SetEtaRange(-1E20, 1E20);
-   cutQuality->SetDCAZmax(1E20);
-   cutQuality->SetSPDminNClusters(0);
-   cutQuality->SetITSminNClusters(0);
-   cutQuality->SetITSmaxChi2(1E20);
-   cutQuality->SetTPCmaxChi2(1E20);
-   cutQuality->SetRejectKinkDaughters();
-   cutQuality->Print();
-   
-   
-   // cut set
-   AliRsnCutSet *cutSetPi_mother = new AliRsnCutSet("setPionD0_mother", AliRsnTarget::kDaughter);
-   cutSetPi_mother->AddCut(cutPi_mother);
-   cutSetPi_mother->SetCutScheme(cutPi_mother->GetName());
-   // add to task
-   Int_t iCutPi_mother = task->AddTrackCuts(cutSetPi_mother);
-   
-   
-   AliRsnCutDaughterD0 *cutK_mother = new AliRsnCutDaughterD0("cutKaonForD0_MC", AliPID::kKaon);
-   cutK_mother->SetIsCheckOnMother(kTRUE);
-   cutK_mother->SetNoPID(kTRUE);
-   cutK_mother->SetTPCKaonPIDCut(1E20);
-   cutK_mother->SetTOFKaonPIDCut(1E20);
-   cutK_mother->SetPtDependentPIDCut(kFALSE);  
-   AliRsnCutTrackQuality *cutQuality = (AliRsnCutTrackQuality*) cutK_mother->CutQuality();
-   cutQuality->SetCheckOnlyFilterBit(kFALSE);
-   cutQuality->SetAODTestFilterBit(-1);
-   if(maxDCAcutFixed)cutQuality->SetDCARmax(1E20);              
-   else cutQuality->SetDCARPtFormula("");
-   if(minDCAcutFixed) cutQuality->SetDCARmin(0);
-   else cutQuality->SetDCARPtFormulaMin("");
-   if(!isPP)cutQuality->SetTPCminNClusters(0);
-   if(isPP)cutQuality->SetMinNCrossedRowsTPC(0,kTRUE);
-   if(isPP)cutQuality->SetMinNCrossedRowsOverFindableClsTPC(0,kTRUE);
-   cutQuality->SetPtRange(0,1E20);
-   cutQuality->SetEtaRange(-1E20, 1E20);
-   cutQuality->SetDCAZmax(1E20);
-   cutQuality->SetSPDminNClusters(0);
-   cutQuality->SetITSminNClusters(0);
-   cutQuality->SetITSmaxChi2(1E20);
-   cutQuality->SetTPCmaxChi2(1E20);
-   cutQuality->SetRejectKinkDaughters();
-   cutQuality->Print();
-   
-   
-   // cut set
-   AliRsnCutSet *cutSetK_mother = new AliRsnCutSet("setKaonD0_mother", AliRsnTarget::kDaughter);
-   cutSetK_mother->AddCut(cutK_mother);
-   cutSetK_mother->SetCutScheme(cutK_mother->GetName());
-   // add to task
-   Int_t iCutK_mother = task->AddTrackCuts(cutSetK_mother);
-   */
-   
    ////////////////////////////////////////////////////////////////////////////////////////////////
   
   // -- Values ------------------------------------------------------------------------------------
@@ -416,27 +339,18 @@ Bool_t ConfigD0
    
    
    // GENERATED MOTHERS IN THE ACCEPTANCE
-   /*
+   
    TString mode = "SPARSE";
    
    // create output
-   AliRsnMiniOutput *out = task->CreateOutput("D0_TrueMC1_Acc", mode.Data(), "TRUE");
+   AliRsnMiniOutput *out = task->CreateOutput("D0_TrueMC_InAcc1", mode.Data(), "MOTHER_IN_ACC");
    // selection settings
-   out->SetCutID(0, iCutK_mother);
-   out->SetCutID(1, iCutPi_mother);
    out->SetDaughter(0, AliRsnDaughter::kKaon);
    out->SetDaughter(1, AliRsnDaughter::kPion);
-   out->SetCharge(0, '-');
-   out->SetCharge(1, '+');
    out->SetMotherPDG(421);
    out->SetMotherMass(1.86486);
    // pair cuts
    out->SetPairCuts(cutsPairY);
-   out->SetMaxNSisters(maxSisters);
-   out->SetCheckMomentumConservation(checkP);
-   out->SetCheckFeedDown(checkFeedDown);
-   out->SetRejectCandidateIfNotFromQuark(checkQuark);
-   out->SetDselection(originDselection);
    // binnings
    out->AddAxis(imID, bins, min_inv_mass, max_inv_mass);
    out->AddAxis(ptID, 200, 0.0, 20.0);
@@ -446,23 +360,14 @@ Bool_t ConfigD0
    else out->AddAxis(centID, 400, 0.0, 400.0);
    
    // create output
-   AliRsnMiniOutput *out = task->CreateOutput("D0_TrueMC2_Acc", mode.Data(), "TRUE");
+   AliRsnMiniOutput *out = task->CreateOutput("D0_TrueMC_InAcc2", mode.Data(), "MOTHER_IN_ACC");
    // selection settings
-   out->SetCutID(0, iCutK_mother);
-   out->SetCutID(1, iCutPi_mother);
    out->SetDaughter(0, AliRsnDaughter::kKaon);
    out->SetDaughter(1, AliRsnDaughter::kPion);
-   out->SetCharge(0, '+');
-   out->SetCharge(1, '-');
    out->SetMotherPDG(-421);
    out->SetMotherMass(1.86486);
    // pair cuts
    out->SetPairCuts(cutsPairY);
-   out->SetMaxNSisters(maxSisters);
-   out->SetCheckMomentumConservation(checkP);
-   out->SetCheckFeedDown(checkFeedDown);
-   out->SetRejectCandidateIfNotFromQuark(checkQuark);
-   out->SetDselection(originDselection);
    // binnings
    out->AddAxis(imID, bins, min_inv_mass, max_inv_mass);
    out->AddAxis(ptID, 200, 0.0, 20.0);
@@ -473,7 +378,7 @@ Bool_t ConfigD0
    
    
    }
-   */
+
 
    return kTRUE;
 }