]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGLF/RESONANCES/AliRsnMiniOutput.cxx
Fix for broken compilation
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / AliRsnMiniOutput.cxx
index 5df3ea5134292bf61753b99db7eee288f693384a..c5bdf3c63c8161c5e1eee974de19a73af6266b13 100644 (file)
@@ -21,6 +21,7 @@
 #include "AliRsnMiniParticle.h"
 #include "AliRsnMiniPair.h"
 #include "AliRsnMiniEvent.h"
+#include "AliAODEvent.h"
 
 #include "AliLog.h"
 #include "AliRsnCutSet.h"
@@ -44,7 +45,15 @@ AliRsnMiniOutput::AliRsnMiniOutput() :
    fPair(),
    fList(0x0),
    fSel1(0),
-   fSel2(0)
+   fSel2(0),
+   fMaxNSisters(-1),
+   fCheckP(kFALSE),
+   fCheckFeedDown(kFALSE),   
+   fOriginDselection(kFALSE),
+   fKeepDfromB(kFALSE),
+   fKeepDfromBOnly(kFALSE),
+   fRejectIfNoQuark(kFALSE),
+   fCheckHistRange(kTRUE)
 {
 //
 // Constructor
@@ -69,7 +78,15 @@ AliRsnMiniOutput::AliRsnMiniOutput(const char *name, EOutputType type, EComputat
    fPair(),
    fList(0x0),
    fSel1(0),
-   fSel2(0)
+   fSel2(0),
+   fMaxNSisters(-1),
+   fCheckP(kFALSE),
+   fCheckFeedDown(kFALSE),   
+   fOriginDselection(kFALSE),
+   fKeepDfromB(kFALSE),
+   fKeepDfromBOnly(kFALSE),
+   fRejectIfNoQuark(kFALSE),
+   fCheckHistRange(kTRUE)
 {
 //
 // Constructor
@@ -94,7 +111,15 @@ AliRsnMiniOutput::AliRsnMiniOutput(const char *name, const char *outType, const
    fPair(),
    fList(0x0),
    fSel1(0),
-   fSel2(0)
+   fSel2(0),
+   fMaxNSisters(-1),
+   fCheckP(kFALSE),
+   fCheckFeedDown(kFALSE),   
+   fOriginDselection(kFALSE),
+   fKeepDfromB(kFALSE),
+   fKeepDfromBOnly(kFALSE),
+   fRejectIfNoQuark(kFALSE),
+   fCheckHistRange(kTRUE)
 {
 //
 // Constructor, with a more user friendly implementation, where
@@ -112,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;
@@ -143,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));
 
@@ -165,7 +193,15 @@ AliRsnMiniOutput::AliRsnMiniOutput(const AliRsnMiniOutput &copy) :
    fPair(),
    fList(copy.fList),
    fSel1(0),
-   fSel2(0)
+   fSel2(0),
+   fMaxNSisters(-1),
+   fCheckP(kFALSE),
+   fCheckFeedDown(kFALSE),   
+   fOriginDselection(kFALSE),
+   fKeepDfromB(kFALSE),
+   fKeepDfromBOnly(kFALSE),
+   fRejectIfNoQuark(kFALSE),
+   fCheckHistRange(copy.fCheckHistRange)
 {
 //
 // Copy constructor
@@ -206,6 +242,14 @@ AliRsnMiniOutput &AliRsnMiniOutput::operator=(const AliRsnMiniOutput &copy)
 
    fSel1.Set(0);
    fSel2.Set(0);
+   fMaxNSisters = copy.fMaxNSisters;
+   fCheckP = copy.fCheckP;
+   fCheckFeedDown = copy.fCheckFeedDown;
+   fOriginDselection = copy.fOriginDselection;
+   fKeepDfromB = copy.fOriginDselection;
+   fKeepDfromBOnly = copy.fKeepDfromBOnly;
+   fRejectIfNoQuark = copy.fRejectIfNoQuark;
+   fCheckHistRange = copy.fCheckHistRange;
 
    return (*this);
 }
@@ -404,6 +448,31 @@ Bool_t AliRsnMiniOutput::FillMother(const AliRsnMiniPair *pair, AliRsnMiniEvent
    return kTRUE;
 }
 
+//________________________________________________________________________________________
+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)
 {
@@ -482,7 +551,7 @@ Int_t AliRsnMiniOutput::FillPair(AliRsnMiniEvent *event1, AliRsnMiniEvent *event
          if (fComputation == kTruePair) {
             if (fPair.Mother() < 0)  {
                continue;
-            } else if (TMath::Abs(fPair.MotherPDG()) != fMotherPDG) {
+            } else if (fPair.MotherPDG() != fMotherPDG) {
                continue;
             }
             Bool_t decayMatch = kFALSE;
@@ -491,6 +560,38 @@ Int_t AliRsnMiniOutput::FillPair(AliRsnMiniEvent *event1, AliRsnMiniEvent *event
             if (p2->PDGAbs() == AliRsnDaughter::SpeciesPDG(fDaughter[0]) && p1->PDGAbs() == AliRsnDaughter::SpeciesPDG(fDaughter[1]))
                decayMatch = kTRUE;
             if (!decayMatch) continue;
+           if ( (fMaxNSisters>0) && (p1->NTotSisters()==p2->NTotSisters()) && (p1->NTotSisters()>fMaxNSisters)) continue;
+           if ( fCheckP &&(TMath::Abs(fPair.PmotherX()-(p1->Px(1)+p2->Px(1)))/(TMath::Abs(fPair.PmotherX())+1.e-13)) > 0.00001 &&        
+                         (TMath::Abs(fPair.PmotherY()-(p1->Py(1)+p2->Py(1)))/(TMath::Abs(fPair.PmotherY())+1.e-13)) > 0.00001 &&
+                         (TMath::Abs(fPair.PmotherZ()-(p1->Pz(1)+p2->Pz(1)))/(TMath::Abs(fPair.PmotherZ())+1.e-13)) > 0.00001 ) continue;
+           if ( fCheckFeedDown ){
+                       Int_t pdgGranma = 0;
+                       Bool_t isFromB=kFALSE;
+                       Bool_t isQuarkFound=kFALSE;
+                       
+                       if(fPair.IsFromB() == kTRUE) isFromB = kTRUE;
+                       if(fPair.IsQuarkFound() == kTRUE) isQuarkFound = kTRUE;
+                       if(fRejectIfNoQuark && !isQuarkFound) pdgGranma = -99999;
+                       if(isFromB){
+                         if (!fKeepDfromB) pdgGranma = -9999; //skip particle if come from a B meson.
+                       }
+                       else{ 
+                         if (fKeepDfromBOnly) pdgGranma = -999;
+                         } 
+                       if (pdgGranma == -99999){
+                               AliDebug(2,"This particle does not have a quark in his genealogy\n");
+                               continue;
+                       }
+                       if (pdgGranma == -9999){
+                               AliDebug(2,"This particle come from a B decay channel but according to the settings of the task, we keep only the prompt charm particles\n");   
+                               continue;
+                       }       
+        
+                       if (pdgGranma == -999){
+                               AliDebug(2,"This particle come from a prompt charm particles but according to the settings of the task, we want only the ones coming from B\n");  
+                               continue;
+                       }       
+                   }
          }
          // check pair against cuts
          if (fPairCuts) {
@@ -506,7 +607,33 @@ Int_t AliRsnMiniOutput::FillPair(AliRsnMiniEvent *event1, AliRsnMiniEvent *event
    AliDebugClass(1, Form("Pairs added in total = %4d", nadded));
    return nadded;
 }
-
+//___________________________________________________________
+void AliRsnMiniOutput::SetDselection(UShort_t originDselection)
+{
+       // setting the way the D0 will be selected
+       // 0 --> only from c quarks
+       // 1 --> only from b quarks
+       // 2 --> from both c quarks and b quarks
+               
+       fOriginDselection = originDselection;
+       
+       if (fOriginDselection == 0) {
+               fKeepDfromB = kFALSE;
+               fKeepDfromBOnly = kFALSE;
+       }
+       
+       if (fOriginDselection == 1) {
+               fKeepDfromB = kTRUE;
+               fKeepDfromBOnly = kTRUE;
+       }
+       
+       if (fOriginDselection == 2) {
+               fKeepDfromB = kTRUE;
+               fKeepDfromBOnly = kFALSE;
+       }
+       
+       return; 
+}
 //________________________________________________________________________________________
 void AliRsnMiniOutput::ComputeValues(AliRsnMiniEvent *event, TClonesArray *valueList)
 {
@@ -566,7 +693,13 @@ void AliRsnMiniOutput::FillHistogram()
    } else if (obj->InheritsFrom(TH3F::Class())) {
       ((TH3F *)obj)->Fill(fComputed[0], fComputed[1], fComputed[2]);
    } else if (obj->InheritsFrom(THnSparseF::Class())) {
-      ((THnSparseF *)obj)->Fill(fComputed.GetArray());
+      THnSparseF *h = (THnSparseF *)obj;
+      if (fCheckHistRange) {
+         for (Int_t iAxis = 0; iAxis<h->GetNdimensions(); iAxis++) {
+            if (fComputed.At(iAxis)>h->GetAxis(iAxis)->GetXmax() || fComputed.At(iAxis)<h->GetAxis(iAxis)->GetXmin()) return;
+         }
+      }
+      h->Fill(fComputed.GetArray());
    } else {
       AliError("No output initialized");
    }