// M. Vala (email: martin.vala@cern.ch)
//
-#include <Riostream.h>
#include <TList.h>
#include "AliLog.h"
#include "AliRsnMother.h"
-#include "AliRsnEvent.h"
-#include "AliRsnFunction.h"
#include "AliRsnCutSet.h"
-#include "AliRsnCutStd.h"
-#include "AliRsnValue.h"
-#include "AliRsnCutManager.h"
#include "AliRsnPair.h"
//_____________________________________________________________________________
AliRsnPair::AliRsnPair(const char *name, AliRsnPairDef *def) :
- TNamed(name, ""),
- fOnlyTrue(kFALSE),
- fIsMixed(kFALSE),
- fPairDef(def),
- fCutManager(),
- fMother(),
- fEvent(0x0)
+ TNamed(name, ""),
+ fOnlyTrue(kFALSE),
+ fCheckDecay(kFALSE),
+ fIsMixed(kFALSE),
+ fCount(0),
+ fPairDef(def),
+ fCutManager(Form("cutMgr_%s", name)),
+ fMother()
{
//
// Default constructor
//
-
- AliDebug(AliLog::kDebug+2,"<-");
- AliDebug(AliLog::kDebug+2,"->");
}
//_____________________________________________________________________________
AliRsnPair::AliRsnPair(const AliRsnPair& copy) :
- TNamed(copy),
- fOnlyTrue(copy.fOnlyTrue),
- fIsMixed(copy.fIsMixed),
- fPairDef(copy.fPairDef),
- fCutManager(copy.fCutManager),
- fMother(copy.fMother),
- fEvent(0x0)
+ TNamed(copy),
+ fOnlyTrue(copy.fOnlyTrue),
+ fCheckDecay(copy.fCheckDecay),
+ fIsMixed(copy.fIsMixed),
+ fCount(copy.fCount),
+ fPairDef(copy.fPairDef),
+ fCutManager(copy.fCutManager),
+ fMother(copy.fMother)
{
//
// Default constructor
//
-
- AliDebug(AliLog::kDebug+2,"<-");
- AliDebug(AliLog::kDebug+2,"->");
}
//_____________________________________________________________________________
AliRsnPair& AliRsnPair::operator=(const AliRsnPair& copy)
{
- fOnlyTrue = copy.fOnlyTrue;
- fIsMixed = copy.fIsMixed;
- fPairDef = copy.fPairDef;
- fMother = copy.fMother;
- fCutManager = copy.fCutManager;
- fEvent = 0x0;
-
- return (*this);
+ fOnlyTrue = copy.fOnlyTrue;
+ fCheckDecay = copy.fCheckDecay;
+ fIsMixed = copy.fIsMixed;
+ fCount = copy.fCount;
+ fPairDef = copy.fPairDef;
+ fMother = copy.fMother;
+ fCutManager = copy.fCutManager;
+
+ return (*this);
}
//_____________________________________________________________________________
//
// Destructor
//
-
- AliDebug(AliLog::kDebug+2,"<-");
- AliDebug(AliLog::kDebug+2,"->");
}
//_____________________________________________________________________________
//
// Prints info about pair
//
-
- AliDebug(AliLog::kDebug+2,"<-");
- AliInfo(Form("PDG %d %d", AliPID::ParticleCode(fPairDef->GetPID(0)), AliPID::ParticleCode(fPairDef->GetPID(1))));
- AliInfo(Form("Masses %f %f", fPairDef->GetMass(0), fPairDef->GetMass(1)));
-
- AliDebug(AliLog::kDebug+2,"->");
}
//_____________________________________________________________________________
Bool_t AliRsnPair::Fill
-(AliRsnDaughter *daughter0, AliRsnDaughter *daughter1, AliRsnEvent *ev0, AliRsnEvent *ev1)
+(AliRsnDaughter *daughter1, AliRsnDaughter *daughter2, Bool_t refFirst)
{
//
-// Sets the two passed daughters to the AliRsnMother data member of this object
-// which is used to perform all computations to fill the value list.
-// This operation is done successfully only when the first passed object matches
-// the required object type (track/V0) and the required charge for first element in pair def,
-// and the second passed object does the same w.r. to the second element in pair def.
-// Moreover, all cuts are checked and the operation fails if a cut check is unsuccessful.
-// Finally, if a true pair is required, this is checked at the end.
-//
-
- AliDebug(AliLog::kDebug+2,"<-");
-
- // check for correct type-charge match for first element
- if (daughter0->RefType() != fPairDef->GetDaughterType(0)) return kFALSE;
- if (daughter0->ChargeChar() != fPairDef->GetCharge(0)) return kFALSE;
-
- // check for correct type-charge match for second element
- if (daughter1->RefType() != fPairDef->GetDaughterType(1)) return kFALSE;
- if (daughter1->ChargeChar() != fPairDef->GetCharge(1)) return kFALSE;
-
- // cuts on track #1 & common
- fCutManager.SetEvent(ev0);
- if (!fCutManager.PassDaughter1Cuts(daughter0)) return kFALSE;
- if (!fCutManager.PassCommonDaughterCuts(daughter0)) return kFALSE;
-
- // cuts on track #2 & common
- fCutManager.SetEvent(ev1);
- if (!fCutManager.PassDaughter2Cuts(daughter1)) return kFALSE;
- if (!fCutManager.PassCommonDaughterCuts(daughter1)) return kFALSE;
-
- // point to first event as reference
- fEvent = ev0;
-
- // define pair & check
- fMother.SetDaughters(daughter0, fPairDef->GetMass(0), daughter1, fPairDef->GetMass(1));
- fCutManager.SetEvent(fEvent);
- if (!fCutManager.PassMotherCuts(&fMother)) return kFALSE;
-
- // if required a true pair, check this here and eventually return a fail message
- if (fOnlyTrue)
- {
- // are we in a MonteCarlo?
- if (!daughter0->GetParticle() || !daughter1->GetParticle()) return kFALSE;
-
- // are the daughters really secondaries (in MC)?
- Int_t m0 = daughter0->GetParticle()->GetFirstMother();
- Int_t m1 = daughter1->GetParticle()->GetFirstMother();
- if (m0 < 0 || m1 < 0) return kFALSE;
-
- // if they are, do they come from the same mother?
- if (m0 != m1) return kFALSE;
-
- // if they do, is this mother the correct type?
- if (daughter0->GetMotherPDG() != fPairDef->GetMotherPDG()) return kFALSE;
- if (daughter1->GetMotherPDG() != fPairDef->GetMotherPDG()) return kFALSE;
-
- // do they match the expected decay channel (that is, are they the expected types)?
- Int_t pdg0 = TMath::Abs(daughter0->GetParticle()->GetPdgCode());
- Int_t pdg1 = TMath::Abs(daughter1->GetParticle()->GetPdgCode());
- if (AliPID::ParticleCode(fPairDef->GetPID(0)) != pdg0) return kFALSE;
- if (AliPID::ParticleCode(fPairDef->GetPID(1)) != pdg1) return kFALSE;
-
- // ok... if we arrive here that must really be a true pair! :-)
- }
-
- AliDebug(AliLog::kDebug+2,"->");
-
- return kTRUE;
+// Checks that first argument matches definitions for first daughter
+// and the same for second argument, where the order is defined by
+// the AliRsnPairDef data member.
+// If the matching is successful, the AliRsnMother data member is
+// initialized using the mass hypotheses defined here and the momenta
+// in the passed daughters.
+// The third argument is necessary to choose which one of the possible two
+// events owning the two daughter will be used as reference.
+//
+
+ // check matching and exit if one of them fails
+ // if true pair is required, this is taken into account:
+ // if both true pairs and correct decay tree is required,
+ // then we must be sure that also the true PID of daughters matches,
+ // instead if correct decay tree is not required this additional check is not done
+ if (!fPairDef->GetDef1()->MatchesDaughter(daughter1, fOnlyTrue && fCheckDecay)) return kFALSE;
+ if (!fPairDef->GetDef2()->MatchesDaughter(daughter2, fOnlyTrue && fCheckDecay)) return kFALSE;
+
+ // if matching is successful
+ // compute 4-momenta of daughters and mother
+ fMother.SetDaughter(0, daughter1);
+ fMother.SetDaughter(1, daughter2);
+ fMother.ComputeSum(fPairDef->GetMass1(), fPairDef->GetMass2());
+
+ // assign reference event
+ if (refFirst) fMother.SetRefEvent(daughter1->GetOwnerEvent()); else fMother.SetRefEvent(daughter2->GetOwnerEvent());
+
+ // if required a true pair, check this here and eventually return a fail message
+ // this is done using the method AliRsnMother::CommonMother with 2 arguments
+ // passed by reference, where the real GEANT label of the particle is stored
+ // and one can check if these tracks are both really secondaries (ID >= 0)
+ if (fOnlyTrue) {
+ Int_t m0, m1, common;
+ common = fMother.CommonMother(m0, m1);
+ if (m0 < 0 || m1 < 0) return kFALSE;
+ if (common != fPairDef->GetMotherPDG()) return kFALSE;
+ }
+
+ // point to first event as reference
+ // and checks the pair cuts,
+ // (done first because it is more likely
+ // that it is not passed and execution is faster)
+ if (!fCutManager.PassMotherCuts(&fMother)) return kFALSE;
+
+ // cuts on track #1 & common
+ if (!fCutManager.PassDaughter1Cuts(daughter1)) {
+ AliDebug(AliLog::kDebug + 2, "Specific cuts for track #1 not passed");
+ return kFALSE;
+ }
+ if (!fCutManager.PassCommonDaughterCuts(daughter1)) {
+ AliDebug(AliLog::kDebug + 2, "Common cuts for track #1 not passed");
+ return kFALSE;
+ }
+
+ // cuts on track #2 & common
+ if (!fCutManager.PassDaughter2Cuts(daughter2)) {
+ AliDebug(AliLog::kDebug + 2, "Specific cuts for track #2 not passed");
+ return kFALSE;
+ }
+ if (!fCutManager.PassCommonDaughterCuts(daughter2)) {
+ AliDebug(AliLog::kDebug + 2, "Common cuts for track #2 not passed");
+ return kFALSE;
+ }
+
+ // if pair is accepted, increment counter
+ ++fCount;
+
+ return kTRUE;
}
//_____________________________________________________________________________
// Virtual method to compute pair quantities of interest
//
- AliWarning("Implement this method in derived classes");
+ AliWarning("Implement this method in derived classes");
}
//_____________________________________________________________________________
// Virtual method to compute pair quantities of interest
//
- AliWarning("Implement this method in derived classes");
+ AliWarning("Implement this method in derived classes");
}