#include "AliRsnMiniParticle.h"
#include "AliRsnMiniPair.h"
#include "AliRsnMiniEvent.h"
+#include "AliAODEvent.h"
#include "AliLog.h"
#include "AliRsnCutSet.h"
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
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
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
// -- "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;
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));
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
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);
}
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)
{
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;
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) {
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)
{
} 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");
}