Introduced a common base class for cuts and values, which allows to generalize the evaluation methods, and select the target "a posteriori".
Generalized the AliRsnValue computation with the addition of a generic cut support object which can be any TObject (this copes with the need
to have an AliRsnPair in some cuts related to the mother, and AliESDtrackCuts for multiplicity computation.
In processInfo adjusted some indentation and adapted also to PROOF.
Adapted some header comments and removed some useless methods.
#pragma link C++ class AliRsnDaughter+;
#pragma link C++ class AliRsnMother+;
+#pragma link C++ class AliRsnPairDef+;
#pragma link C++ class AliRsnEvent+;
+#pragma link C++ class AliRsnTarget+;
#pragma link C++ class AliRsnValue+;
-#pragma link C++ class AliRsnFunction+;
-
-#pragma link C++ class AliRsnExpression+;
-#pragma link C++ class AliRsnVariableExpression+;
#pragma link C++ class AliRsnCut+;
-#pragma link C++ class AliRsnCutStd+;
+
+#pragma link C++ class AliRsnCutValue+;
#pragma link C++ class AliRsnCutPID+;
#pragma link C++ class AliRsnCutBetheBloch+;
-#pragma link C++ class AliRsnCutESDPrimary+;
-#pragma link C++ class AliRsnCutESDCutMultiplicity+;
#pragma link C++ class AliRsnCutPrimaryVertex+;
+#pragma link C++ class AliRsnCutESDPrimary+;
#pragma link C++ class AliRsnCutDaughterType+;
#pragma link C++ class AliRsnCutESD2010+;
#pragma link C++ class AliRsnCutAOD2010+;
-#pragma link C++ class AliRsnCutValue+;
#pragma link C++ class AliRsnCutSet+;
+#pragma link C++ class AliRsnExpression+;
+#pragma link C++ class AliRsnVariableExpression+;
#pragma link C++ class AliRsnCutManager+;
-#pragma link C++ class AliRsnPairDef+;
+#pragma link C++ class AliRsnFunction+;
#pragma link C++ class AliRsnPair+;
#pragma link C++ class AliRsnPairFunctions+;
#pragma link C++ class AliRsnPairNtuple+;
#pragma link C++ class AliRsnMonitorTrack+;
#pragma link C++ class AliRsnAnalysisMonitorTask+;
-#pragma link C++ class AliRsnAnalysisMonitorPairTask+;
-//#pragma link C++ class AliRsnFitResult+;
#endif
// Fill the containers
//
- Int_t iaxis, nAxes = fAxisList.GetEntries();
- Int_t istep, nSteps = stepList->GetEntries();
+ Int_t iaxis, nAxes = fAxisList.GetEntries();
+ Int_t istep, nSteps = stepList->GetEntries();
+ Bool_t computeOK;
// set daughters to pair
fPair.SetDaughters(&fDaughter[0], pd->GetMass(0), &fDaughter[1], pd->GetMass(1));
{
AliRsnValue *fcnAxis = (AliRsnValue*)fAxisList.At(iaxis);
fVar[iaxis] = -1E10;
- if (fcnAxis->Eval(&fPair, pd, &fRsnEvent)) fVar[iaxis] = (Float_t)fcnAxis->GetValue();
+ switch (fcnAxis->GetTargetType())
+ {
+ case AliRsnTarget::kMother:
+ fcnAxis->SetSupportObject(pd);
+ computeOK = fcnAxis->Eval(&fPair);
+ break;
+ case AliRsnTarget::kEvent:
+ computeOK = fcnAxis->Eval(&fRsnEvent);
+ break;
+ default:
+ AliError(Form("Allowed targets are mothers and events; cannot use axis '%s' which has target '%s'", fcnAxis->GetName(), fcnAxis->GetTargetTypeName()));
+ computeOK = kFALSE;
+ }
+ if (computeOK) fVar[iaxis] = ((Float_t)fcnAxis->GetComputedValue());
}
// fill all steps
// revised by : A. Pulvirenti [alberto.pulvirenti@ct.infn.it]
//
-#include <Riostream.h>
#include <TROOT.h>
#include "AliLog.h"
#include "AliVEvent.h"
#include "AliMCEvent.h"
#include "AliRsnEvent.h"
-#include "AliRsnPair.h"
+#include "AliRsnPairFunctions.h"
+#include "AliRsnPairNtuple.h"
#include "AliRsnAnalysisManager.h"
//_____________________________________________________________________________
AliRsnAnalysisManager::AliRsnAnalysisManager(const char*name) :
TNamed(name, ""),
- fPairs(0)
+ fPairs(0),
+ fGlobalTrackCuts()
{
//
// Default constructor
//
-
- AliDebug(AliLog::kDebug+2, "<-");
- AliDebug(AliLog::kDebug+2, "->");
}
//_____________________________________________________________________________
AliDebug(AliLog::kDebug+2,"<-");
- if (!pair) {
+ if (!pair)
+ {
AliWarning(Form("AliRsnPairManager is %p. Skipping ...", pair));
return;
}
AliDebug(AliLog::kDebug+1, Form("Adding %s [%d]...", pair->GetName(), fPairs.GetEntries()));
- fPairs.Add((AliRsnPair*)pair);
+ fPairs.Add(pair);
AliDebug(AliLog::kDebug+2,"->");
}
if (!ev1) ev1 = ev0;
- Int_t nTracks[2], nV0[2], nTot[2];
- nTracks[0] = ev0->GetRef()->GetNumberOfTracks();
- nV0[0] = ev0->GetRef()->GetNumberOfV0s();
- nTracks[1] = ev1->GetRef()->GetNumberOfTracks();
- nV0[1] = ev1->GetRef()->GetNumberOfV0s();
- nTot[0] = nTracks[0] + nV0[0];
- nTot[1] = nTracks[1] + nV0[1];
+ Int_t nTot[2];
+ nTot[0] = ev0->GetAbsoluteSum();
+ nTot[1] = ev1->GetAbsoluteSum();;
// external loop
// joins the loop on tracks and v0s, by looping the indexes from 0
// to the sum of them, and checking what to take depending of its value
- Int_t i0, i1, i;
+ // in this step, the global cuts are checked
+ Int_t i0, i1, i, realIndex;
AliRsnDaughter daughter0, daughter1;
AliRsnPair *pair = 0x0;
TObjArrayIter next(&fPairs);
+ AliRsnDaughter::ERefType type;
for (i0 = 0; i0 < nTot[0]; i0++)
{
// assign first track
- if (i0 < nTracks[0]) ev0->SetDaughter(daughter0, i0, AliRsnDaughter::kTrack);
- else ev0->SetDaughter(daughter0, i0 - nTracks[0], AliRsnDaughter::kV0);
+ if (!ev0->ConvertAbsoluteIndex(i0, realIndex, type)) continue;
+ ev0->SetDaughter(daughter0, realIndex, type);
+
+ // check global cuts
+ if (!fGlobalTrackCuts.IsSelected(&daughter0)) continue;
// internal loop (same criterion)
for (i1 = 0; i1 < nTot[1]; i1++)
if (ev0 == ev1 && i0 == i1) continue;
// assign second track
- if (i1 < nTracks[1]) ev1->SetDaughter(daughter1, i1, AliRsnDaughter::kTrack);
- else ev1->SetDaughter(daughter1, i1 - nTracks[1], AliRsnDaughter::kV0);
+ if (!ev1->ConvertAbsoluteIndex(i1, realIndex, type)) continue;
+ ev1->SetDaughter(daughter1, realIndex, type);
+
+ // check global cuts
+ if (!fGlobalTrackCuts.IsSelected(&daughter1)) continue;
// loop over all pairs and make computations
next.Reset();
#ifndef ALIRSNANALYSISMANAGER_H
#define ALIRSNANALYSISMANAGER_H
-class TROOT;
+#include <TObjArray.h>
+
+#include "AliRsnCutSet.h"
class AliRsnEvent;
class AliRsnPair;
public:
AliRsnAnalysisManager(const char*name = "defaultAnalysisMgr");
- virtual ~AliRsnAnalysisManager() {;};
+ virtual ~AliRsnAnalysisManager() { }
virtual void Add(AliRsnPair *pair);
virtual void PrintArray() const;
void InitAllPairs(TList*list);
void ProcessAllPairs(AliRsnEvent *ev0, AliRsnEvent *ev1);
void ProcessAllPairsMC(AliRsnEvent *ev0, AliRsnEvent *ev1);
+ AliRsnCutSet* GetGlobalTrackCuts() {return &fGlobalTrackCuts;}
private:
- TObjArray fPairs;
+ TObjArray fPairs; // collection of pair objects for the different outputs
+ AliRsnCutSet fGlobalTrackCuts; // a set of cuts which are applied to all tracks for all analysis, in order to put only once
ClassDef(AliRsnAnalysisManager, 1)
};
//
// Copy constructor.
//
-
- AliDebug(AliLog::kDebug+2,"<-");
- AliDebug(AliLog::kDebug+2,"->");
}
-// //_____________________________________________________________________________
-// AliRsnAnalysisSE::~AliRsnAnalysisSE()
-// {
-// //
-// // Destructor
-// //
-//
-// fOutList->Clear();
-//
-// }
+//_____________________________________________________________________________
+AliRsnAnalysisSE& AliRsnAnalysisSE::operator=(const AliRsnAnalysisSE& copy)
+{
+//
+// Copy constructor.
+//
+
+ AliRsnVAnalysisTaskSE::operator=(copy);
+
+ fRsnAnalysisManager = copy.fRsnAnalysisManager;
+ fEventCuts = copy.fEventCuts;
+ if (fOutList) fOutList->Clear();
+ fZeroEventPercentWarning = copy.fZeroEventPercentWarning;
+ fUseZeroEventWarning = copy.fUseZeroEventWarning;
+
+ return (*this);
+}
//_____________________________________________________________________________
void AliRsnAnalysisSE::RsnUserCreateOutputObjects()
AliDebug(AliLog::kDebug+2,"<-");
+ if (fOutList) fOutList->Clear();
fOutList = new TList;
fRsnAnalysisManager.InitAllPairs(fOutList);
class AliRsnAnalysisSE : public AliRsnVAnalysisTaskSE
{
-
public:
+
AliRsnAnalysisSE(const char *name = "AliRsnAnalysisSE", Bool_t useKine = kFALSE);
AliRsnAnalysisSE(const AliRsnAnalysisSE& copy);
-// virtual ~AliRsnAnalysisSE();
-
- // Implement this
- virtual void RsnUserCreateOutputObjects();
- virtual void RsnUserExec(Option_t*);
- virtual void RsnTerminate(Option_t*);
+ AliRsnAnalysisSE& operator=(const AliRsnAnalysisSE& copy);
+ virtual ~AliRsnAnalysisSE() {}
- AliRsnAnalysisManager *GetAnalysisManager() {return &fRsnAnalysisManager;}
- void SetAnalysisManagerName(const char *name) {fRsnAnalysisManager.SetName(name);}
+ virtual void RsnUserCreateOutputObjects();
+ virtual void RsnUserExec(Option_t*);
+ virtual void RsnTerminate(Option_t*);
- AliRsnCutSet* GetEventCuts() {return &fEventCuts;}
-// void SetEventCuts(AliRsnCutSet *const cuts) {fEventCuts = cuts;}
+ AliRsnCutSet* GetEventCuts() {return &fEventCuts;}
+ AliRsnAnalysisManager* GetAnalysisManager() {return &fRsnAnalysisManager;}
+ void SetAnalysisManagerName(const char *name) {fRsnAnalysisManager.SetName(name);}
- Double_t GetZeroEventPercentWarning() const {return fZeroEventPercentWarning;}
- void SetZeroEventPercentWarning(Double_t val = 50) {fZeroEventPercentWarning = val;}
- void UseZeroEventWarning(Bool_t b = true) {fUseZeroEventWarning = b;}
+ Double_t GetZeroEventPercentWarning() const {return fZeroEventPercentWarning;}
+ void SetZeroEventPercentWarning(Double_t val = 50) {fZeroEventPercentWarning = val;}
+ void UseZeroEventWarning(Bool_t b = true) {fUseZeroEventWarning = b;}
private:
- AliRsnAnalysisSE& operator=(const AliRsnAnalysisSE& /*copy*/) {return *this;}
-
- AliRsnAnalysisManager fRsnAnalysisManager; // analysis main engine
- AliRsnCutSet fEventCuts; // event cuts
- TList *fOutList; // list of output events
+ AliRsnAnalysisManager fRsnAnalysisManager; // analysis main engine
+ AliRsnCutSet fEventCuts; // event cuts
+ TList *fOutList; // list of output events
Double_t fZeroEventPercentWarning; // Percent Number for Zero Event Warning
Bool_t fUseZeroEventWarning; // flag if Zero Event Warning is used (default is true)
//
-// Class AliRsnCut
+// *** Class AliRsnCut ***
//
-// General implementation of a single cut strategy, which can be:
-// - a value contained in a given interval [--> IsBetween() ]
-// - a value equal to a given reference [--> MatchesValue()]
+// Cut base class: all other cuts inherit from it.
+// The 'core' of the class is the method "IsSelected()" which
+// must be overloaded by any specific cut implementation.
//
-// In all cases, the reference value(s) is (are) given as data members
-// and each kind of cut requires a given value type (Int, UInt, Double),
-// but the cut check procedure is then automatized and chosen thanks to
-// an enumeration of the implemented cut types.
-// At the end, the user (or any other point which uses this object) has
-// to use the method IsSelected() to check if this cut has been passed.
+// This class provides some default instruments to check values
+// agains a reference or an allowed range, in order to permit
+// a unique way to execute such kind of checks.
//
-// authors: Martin Vala (martin.vala@cern.ch)
-// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
+// authors: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
+// Martin Vala (martin.vala@cern.ch)
//
-#include "AliLog.h"
#include "AliRsnDaughter.h"
#include "AliRsnMother.h"
ClassImp(AliRsnCut)
-//_________________________________________________________________________________________________
-AliRsnCut::AliRsnCut(ETarget target) :
- TNamed(),
- fVarType(kInt),
- fTarget(target),
+//______________________________________________________________________________
+AliRsnCut::AliRsnCut(const char *name, RSNTARGET target) :
+ AliRsnTarget(name, target),
fMinI(0),
fMaxI(0),
- fMinD(0.0),
- fMaxD(0.0),
+ fMinD(0.),
+ fMaxD(0.),
fCutValueI(0),
fCutValueD(0.0),
fCutResult(kTRUE),
//
}
-//_________________________________________________________________________________________________
-AliRsnCut::AliRsnCut(const AliRsnCut& copy) :
- TNamed(copy),
- fVarType(copy.fVarType),
- fTarget(copy.fTarget),
- fMinI(copy.fMinI),
- fMaxI(copy.fMaxI),
- fMinD(copy.fMinD),
- fMaxD(copy.fMaxD),
- fCutValueI(copy.fCutValueI),
- fCutValueD(copy.fCutValueD),
- fCutResult(copy.fCutResult),
- fEvent(copy.fEvent)
-{
-//
-// Copy constructor.
-//
-}
-
-//_________________________________________________________________________________________________
+//______________________________________________________________________________
AliRsnCut::AliRsnCut
-(const char *name, ETarget target, Int_t min, Int_t max) :
- TNamed(name, ""),
- fVarType(kInt),
- fTarget(target),
- fMinI(min),
- fMaxI(max),
- fMinD(0.0),
- fMaxD(0.0),
+(const char *name, RSNTARGET target, Int_t imin, Int_t imax, Double_t dmin, Double_t dmax) :
+ AliRsnTarget(name, target),
+ fMinI(imin),
+ fMaxI(imax),
+ fMinD(dmin),
+ fMaxD(dmax),
fCutValueI(0),
fCutValueD(0.0),
fCutResult(kTRUE),
fEvent(0x0)
{
//
-// Constructor with integer values.
-// If the cut must check values inside a range,
-// both 'value' arguments must be used, and they are, in the order,
-// the minimum and maximum of the allowed range.
-// If the cut must check a value, the second 'value' argument will never be used.
+// Constructor with arguments.
+// This is provided to allow a quick setting of all data members.
//
}
-//_________________________________________________________________________________________________
+//______________________________________________________________________________
AliRsnCut::AliRsnCut
-(const char *name, ETarget target, Double_t min, Double_t max) :
- TNamed(name, ""),
- fVarType(kDouble),
- fTarget(target),
- fMinI(0),
- fMaxI(0),
- fMinD(min),
- fMaxD(max),
+(const char *name, RSNTARGET target, Double_t dmin, Double_t dmax, Int_t imin, Int_t imax) :
+ AliRsnTarget(name, target),
+ fMinI(imin),
+ fMaxI(imax),
+ fMinD(dmin),
+ fMaxD(dmax),
fCutValueI(0),
fCutValueD(0.0),
fCutResult(kTRUE),
fEvent(0x0)
{
//
-// Constructor with double values.
-// If the cut must check values inside a range,
-// both 'value' arguments must be used, and they are, in the order,
-// the minimum and maximum of the allowed range.
-// If the cut must check a value, the second 'value' argument will never be used.
+// Constructor with arguments.
+// This is provided to allow a quick setting of all data members.
//
}
-//_________________________________________________________________________________________________
+//______________________________________________________________________________
+AliRsnCut::AliRsnCut(const AliRsnCut& copy) :
+ AliRsnTarget(copy),
+ fMinI(copy.fMinI),
+ fMaxI(copy.fMaxI),
+ fMinD(copy.fMinD),
+ fMaxD(copy.fMaxD),
+ fCutValueI(copy.fCutValueI),
+ fCutValueD(copy.fCutValueD),
+ fCutResult(copy.fCutResult),
+ fEvent(copy.fEvent)
+{
+//
+// Copy constructor.
+// Don't duplicate memory occupancy for pointer
+//
+}
+
+//______________________________________________________________________________
AliRsnCut& AliRsnCut::operator=(const AliRsnCut& copy)
{
//
-// Assignment operator
-// don't duplicate memory occupancy for pointer
+// Assignment operator.
+// Don't duplicate memory occupancy for pointer
//
- fVarType = copy.fVarType;
- fTarget = copy.fTarget;
+ AliRsnTarget::operator=(copy);
+
fMinI = copy.fMinI;
fMaxI = copy.fMaxI;
fMinD = copy.fMinD;
return (*this);
}
-//_________________________________________________________________________________________________
-Bool_t AliRsnCut::TargetOK(TObject *obj1, TObject *obj2)
+//______________________________________________________________________________
+Bool_t AliRsnCut::IsSelected(TObject* /*object*/)
{
//
-// This method checks if the expected target and the passed object match.
+// Virtual cut-checking method.
+// In this implementation, it does nothing, and all classes
+// inheriting from this, should provide a proper implementation
+// which must return kTRUE if the cut is passed, and kFALSE otherwise.
//
- if (!obj1)
- {
- AliError("Cannot cut on a NULL object!");
- return kFALSE;
- }
-
- switch (fTarget)
- {
- case kDaughter:
- if (dynamic_cast<AliRsnDaughter*>(obj1) == 0x0)
- {
- AliError(Form("[%s] Target mismatch (obj #1): expected 'AliRsnDaughter', passed '%s'", GetName(), obj1->ClassName()));
- Print();
- return kFALSE;
- }
- break;
- case kMother:
- if (dynamic_cast<AliRsnMother*>(obj1) == 0x0)
- {
- AliError(Form("[%s] Target mismatch (obj #1): expected 'AliRsnMother', passed '%s'", GetName(), obj1->ClassName()));
- Print();
- return kFALSE;
- }
- break;
- case kEvent:
- if (dynamic_cast<AliRsnEvent*>(obj1) == 0x0)
- {
- AliError(Form("[%s] Target mismatch (obj #1): expected 'AliRsnEvent', passed '%s'", GetName(), obj1->ClassName()));
- Print();
- return kFALSE;
- }
- break;
- case kMixEvent:
- if (dynamic_cast<AliRsnEvent*>(obj1) == 0x0)
- {
- AliError(Form("[%s] Target mismatch (obj #1): expected 'AliRsnEvent', passed '%s' an", GetName(), obj1->ClassName()));
- Print();
- return kFALSE;
- }
- if (obj2)
- {
- if (dynamic_cast<AliRsnEvent*>(obj2) == 0x0)
- {
- AliError(Form("[%s] Target mismatch (obj #2): expected 'AliRsnEvent', passed '%s' an", GetName(), obj2->ClassName()));
- Print();
- return kFALSE;
- }
- }
- else
- {
- AliError("Mix-event cuts require 2 not NULL objects");
- Print();
- return kFALSE;
- }
- break;
- default:
- return kTRUE;
- }
-
+ AliWarning("This virtual function must be implemented properly");
return kTRUE;
}
-//_________________________________________________________________________________________________
-Bool_t AliRsnCut::IsSelected(TObject* /*obj1*/, TObject* /*obj2*/)
-{
-//
-// Virtual cut-checking method for event mixing.
-// This method checks only that the target is the oner for mixing.
-//
-
- AliWarning("Single-object cuts are not implemented here.");
- return kTRUE;
-}
-
-//_________________________________________________________________________________________________
-Bool_t AliRsnCut::OkValue()
-{
-//
-// This method is used when the cut consists in comparing the cut value
-// with a reference value to which it must be equal (in case of doubles, 'almost' equal).
-// Then, the cut result is kTRUE if the cut value is equal to this reference value.
-//
-
- switch (fVarType)
- {
- case kInt:
- return OkValueI();
- case kDouble:
- return OkValueD();
- default:
- AliError(Form("fVarType = %d --> not allowed", fVarType));
- return kFALSE;
- }
-}
-
-//_________________________________________________________________________________________________
-Bool_t AliRsnCut::OkRange()
-{
-//
-// This method is used when the cut consists in an allowed range
-// where the cut value must be included to pass the cut.
-// Then, the cut result is kTRUE if the cut value is inside this range.
-//
-
- switch (fVarType)
- {
- case kInt:
- return OkRangeI();
- case kDouble:
- return OkRangeD();
- default:
- AliError(Form("fVarType = %d --> not allowed", fVarType));
- return kFALSE;
- }
-}
-
-//_________________________________________________________________________________________________
+//______________________________________________________________________________
Bool_t AliRsnCut::OkValueI()
{
//
return fCutResult;
}
-//_________________________________________________________________________________________________
+//______________________________________________________________________________
Bool_t AliRsnCut::OkValueD()
{
//
return fCutResult;
}
-//_________________________________________________________________________________________________
+//______________________________________________________________________________
Bool_t AliRsnCut::OkRangeI()
{
//
//
// eval result
- fCutResult = ((fCutValueI >= fMinI) && (fCutValueI <= fMaxI));
+ fCutResult = ((fCutValueI >= fMinI) && (fCutValueI < fMaxI));
// print debug message
AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ====================================");
return fCutResult;
}
-//_________________________________________________________________________________________________
+//______________________________________________________________________________
Bool_t AliRsnCut::OkRangeD()
{
//
//
// eval result
- fCutResult = ((fCutValueD >= fMinD) && (fCutValueD <= fMaxD));
+ fCutResult = ((fCutValueD >= fMinD) && (fCutValueD < fMaxD));
// print debug message
AliDebug(AliLog::kDebug + 2, "=== CUT DEBUG ====================================");
return fCutResult;
}
-//_________________________________________________________________________________________________
+//______________________________________________________________________________
void AliRsnCut::Print(Option_t*) const
{
//
-// Override TObject::Print() method
+// Override TObject::Print() method,
+// and print some useful info about the cut general parameters.
//
- Char_t target[100];
- switch (fTarget)
- {
- case kDaughter: snprintf(target, strlen("DAUGHTER") , "DAUGHTER") ; break;
- case kMother : snprintf(target, strlen("MOTHER") , "MOTHER") ; break;
- case kEvent : snprintf(target, strlen("EVENT") , "EVENT") ; break;
- case kMixEvent: snprintf(target, strlen("MIX EVENT"), "MIX EVENT"); break;
- default : snprintf(target, strlen("UNDEFINED"), "UNDEFINED"); break;
- }
-
AliInfo("=== CUT DETAILS ====================================");
AliInfo(Form("Cut name : [%s]", GetName()));
- AliInfo(Form("Cut target : [%s]", target));
+ AliInfo(Form("Cut target : [%s]", GetTargetTypeName()));
AliInfo(Form("Cut edges [D]: [%f - %f]", fMinD, fMaxD));
AliInfo(Form("Cut edges [I]: [%d - %d]", fMinI, fMaxI));
AliInfo("====================================================");
}
-//_________________________________________________________________________________________________
+//______________________________________________________________________________
void AliRsnCut::SetEvent(AliRsnEvent *event)
{
//
-// Sets the reference event
+// Sets the reference event.
+// When this requires some additional operation, this function
+// should be overloaded by the specific cut implementation.
+// For an example, see AliRsnCutESD2010 class.
//
fEvent = event;
//
-// Class AliRsnCut
+// *** Class AliRsnCut ***
//
-// General implementation of a single cut strategy, which can be:
-// - a value contained in a given interval [--> IsBetween()]
-// - a value equal to a given reference [--> IsEqual() ]
-// In all cases, the reference value(s) is (are) given as data members
-// and each kind of cut requires a given value type (Int, UInt, Double),
-// but the cut check procedure is then automatized and chosen thanks to
-// an enumeration of the implemented cut types.
-// At the end, the user (or any other point which uses this object) has
-// to use the method IsSelected() to check if this cut has been passed.
+// Cut base class: all other cuts inherit from it.
+// The 'core' of the class is the method "IsSelected()" which
+// must be overloaded by any specific cut implementation.
//
-// authors: Martin Vala (martin.vala@cern.ch)
-// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
+// This class provides some default instruments to check values
+// agains a reference or an allowed range, in order to permit
+// a unique way to execute such kind of checks.
+//
+// authors: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
+// Martin Vala (martin.vala@cern.ch)
//
#ifndef ALIRSNCUT_H
#define ALIRSNCUT_H
-#include "TNamed.h"
+#include "AliRsnTarget.h"
class AliRsnEvent;
-class AliRsnCut : public TNamed
+class AliRsnCut : public AliRsnTarget
{
public:
- // possible targets for a cut
- enum ETarget
- {
- kDaughter = 0,
- kMother,
- kEvent,
- kMixEvent,
- kLastCutTarget
- };
-
- // data type for check
- enum EVarType
- {
- kNoVar = 0,
- kInt,
- kDouble
- };
-
- AliRsnCut(ETarget target = kLastCutTarget);
+ AliRsnCut(const char *name = "dummy", RSNTARGET target = AliRsnTarget::kTargetTypes);
+ AliRsnCut(const char *name, RSNTARGET target, Int_t imin, Int_t imax=0 , Double_t dmin=0., Double_t dmax=0.);
+ AliRsnCut(const char *name, RSNTARGET target, Double_t dmin, Double_t dmax=0., Int_t imin=0 , Int_t imax=0 );
AliRsnCut(const AliRsnCut& copy);
AliRsnCut& operator=(const AliRsnCut& copy);
- AliRsnCut(const char *name, ETarget target, Int_t min, Int_t max = 0 );
- AliRsnCut(const char *name, ETarget target, Double_t min, Double_t max = 0.);
- virtual ~AliRsnCut() { /*nothing*/ };
+ virtual ~AliRsnCut() { fEvent = 0x0; };
- EVarType GetVarTypeEnum() {return fVarType;}
- Char_t GetVarTypeChar() {if (fVarType == kInt) return 'I'; else if (fVarType == kDouble) return 'D'; else return 'X';}
- ETarget GetTargetEnum() {return fTarget;}
- Char_t GetTargetChar() {if (fTarget == kDaughter) return 'D'; else if (fTarget == kMother) return 'M'; else if (fTarget == kEvent) return 'E'; else return 'X';}
- Bool_t IsTarget(ETarget target) {return (fTarget == target);}
- Bool_t TargetOK(TObject *obj1, TObject *obj2 = 0x0);
- Int_t GetMinI() {return fMinI;}
- Int_t GetMaxI() {return fMaxI;}
- Double_t GetMinD() {return fMinD;}
- Double_t GetMaxD() {return fMaxD;}
- Int_t GetCutValueI() {return fCutValueI;}
- Double_t GetCutValueD() {return fCutValueD;}
- Bool_t GetCutResult() {return fCutResult;}
+ Int_t GetMinI() {return fMinI;}
+ Int_t GetMaxI() {return fMaxI;}
+ Double_t GetMinD() {return fMinD;}
+ Double_t GetMaxD() {return fMaxD;}
+ Int_t GetCutValueI() {return fCutValueI;}
+ Double_t GetCutValueD() {return fCutValueD;}
+ Bool_t GetCutResult() {return fCutResult;}
- void SetRange(Int_t min, Int_t max) {fMinI = min; fMaxI = max; fVarType = kInt;}
- void SetRange(Double_t min, Double_t max) {fMinD = min; fMaxD = max; fVarType = kDouble;}
+ void SetRangeI(Int_t min, Int_t max) {fMinI = min; fMaxI = max;}
+ void SetRangeD(Double_t min, Double_t max) {fMinD = min; fMaxD = max;}
+
+ void SetValueI(Int_t value) {fMinI = value;}
+ void SetValueD(Double_t value) {fMinD = value;}
- void SetValue(Int_t value) {fMinI = value; fVarType = kInt;}
- void SetValue(Double_t value) {fMinD = value; fVarType = kDouble;}
-
- Bool_t OkValue();
- Bool_t OkRange();
Bool_t OkValueI();
Bool_t OkRangeI();
Bool_t OkValueD();
virtual void SetEvent(AliRsnEvent *event);
AliRsnEvent* GetEvent() {return fEvent;}
- virtual Bool_t IsSelected(TObject *obj1, TObject *obj2 = 0x0);
+ virtual Bool_t IsSelected(TObject *object);
virtual void Print(Option_t *opt = "") const;
protected:
- EVarType fVarType; // type of checked variable
- ETarget fTarget; // type of object on which the cut is checked
-
- Int_t fMinI; // lower edge of INT range or ref. value for INT CUT
- Int_t fMaxI; // upper edge of INT range (not used for value cuts)
- Double_t fMinD; // lower edge of DOUBLE range or ref. value for INT CUT
- Double_t fMaxD; // upper edge of DOUBLE range (not used for value cuts)
+ Int_t fMinI; // lower edge of INT range or ref. value for INT CUT
+ Int_t fMaxI; // upper edge of INT range (not used for value cuts)
+ Double_t fMinD; // lower edge of DOUBLE range or ref. value for DOUBLE CUT
+ Double_t fMaxD; // upper edge of DOUBLE range (not used for value cuts)
- Int_t fCutValueI; // cut value INT
- Double_t fCutValueD; // cut value DOUBLE
+ Int_t fCutValueI; // cut value INT
+ Double_t fCutValueD; // cut value DOUBLE
- Bool_t fCutResult; // tells if the cut is passed or not
+ Bool_t fCutResult; // tells if the cut is passed or not
AliRsnEvent *fEvent; //! pointer to current event (can be needed sometimes, but never streamed)
}
//_________________________________________________________________________________________________
-Bool_t AliRsnCutAOD2010::IsSelected(TObject *obj1, TObject* /*obj2*/)
+Bool_t AliRsnCutAOD2010::IsSelected(TObject *object)
{
//
// Cut checker.
//
// coherence check: require an AOD track
- AliRsnDaughter *daughter = dynamic_cast<AliRsnDaughter*>(obj1);
+ AliRsnDaughter *daughter = dynamic_cast<AliRsnDaughter*>(object);
if (!daughter) return kFALSE;
AliAODTrack *track = daughter->GetRefAODtrack();
if (!track) return kFALSE;
AliRsnCutAOD2010(const AliRsnCutAOD2010& copy);
virtual ~AliRsnCutAOD2010() {;};
- virtual Bool_t IsSelected(TObject *obj1, TObject *obj2 = 0x0);
+ virtual Bool_t IsSelected(TObject *object);
void SetMC (Bool_t yn = kTRUE);
void SetCheckITS (Bool_t yn = kTRUE) {fCheckITS = yn;}
//_________________________________________________________________________________________________
AliRsnCutBetheBloch::AliRsnCutBetheBloch() :
- AliRsnCut(AliRsnCut::kDaughter),
+ AliRsnCut("dummyBBCut", AliRsnTarget::kDaughter),
fCorrect(kTRUE),
fMIP(50.0),
fType(AliPID::kUnknown)
}
//_________________________________________________________________________________________________
-Bool_t AliRsnCutBetheBloch::IsSelected(TObject *obj1, TObject* /*obj2*/)
+Bool_t AliRsnCutBetheBloch::IsSelected(TObject *object)
{
//
// Cut checker.
//
// dynamic cast the object into AliRsnDaughter
- AliRsnDaughter *track = dynamic_cast<AliRsnDaughter*>(obj1);
- if (!track)
- {
- AliError(Form("[%s]: this cut works only with AliRsnDaughter objects", GetName()));
- return kTRUE;
- }
+ if (!TargetOK(object)) return kFALSE;
// retrieve the TPC signal
- AliESDtrack *esd = track->GetRefESDtrack();
+ AliRsnDaughter *track = dynamic_cast<AliRsnDaughter*>(object);
+ AliESDtrack *esd = track->GetRefESDtrack();
if (!esd) {
AliError("ESD information unavailable");
return kTRUE;
fCutValueD = RelDiff(track);
// then, this cut is checked inside the range
- return OkRange();
+ return OkRangeD();
}
Double_t BetheBloch(AliRsnDaughter*const track);
Double_t RelDiff(AliRsnDaughter *track);
- virtual Bool_t IsSelected(TObject *obj1, TObject *obj2 = 0x0);
+ virtual Bool_t IsSelected(TObject *object);
protected:
//_________________________________________________________________________________________________
AliRsnCutDaughterType::AliRsnCutDaughterType() :
- AliRsnCut(AliRsnCut::kDaughter),
+ AliRsnCut(),
fRefType(kTypes)
{
//
// Default constructor.
//
+
+ SetTargetType(AliRsnTarget::kDaughter);
}
//_________________________________________________________________________________________________
}
//_________________________________________________________________________________________________
-Bool_t AliRsnCutDaughterType::IsSelected(TObject *obj1, TObject* /*obj2*/)
+Bool_t AliRsnCutDaughterType::IsSelected(TObject *object)
{
//
// Cut checker.
//
// coherence check
- AliRsnDaughter *daughter = dynamic_cast<AliRsnDaughter*>(obj1);
- if (!daughter) return kFALSE;
+ if (!TargetOK(object)) return kFALSE;
// check the daughter according to the selected type
// in some cases this means to retrieve the track status
+ AliRsnDaughter *daughter = dynamic_cast<AliRsnDaughter*>(object);
AliVTrack *track = dynamic_cast<AliVTrack*>(daughter->GetRef());
AliESDtrack *esdT = dynamic_cast<AliESDtrack*>(daughter->GetRef());
ULong_t status = 0x0;
AliRsnCutDaughterType(const char *name, EType type);
virtual ~AliRsnCutDaughterType() {;};
- virtual Bool_t IsSelected(TObject *obj1, TObject *obj2 = 0x0);
+ virtual Bool_t IsSelected(TObject *object);
protected:
ClassImp(AliRsnCutESD2010)
+Int_t AliRsnCutESD2010::fgLastRun = -1;
+
//_________________________________________________________________________________________________
AliRsnCutESD2010::AliRsnCutESD2010
(const char *name, Bool_t isMC) :
fCheckITS(kTRUE),
fCheckTPC(kTRUE),
fCheckTOF(kTRUE),
- fUseGlobal(kTRUE),
+ fUseITSTPC(kTRUE),
fUseITSSA(kTRUE),
fPID(AliPID::kKaon),
- fMaxEta(1E6),
+ fMaxITSPIDmom(0.0),
fMaxITSband(3.0),
fTPCpLimit(0.35),
fMinTPCband(3.0),
fMaxTPCband(5.0),
+ fESDpid(0x0),
fESDtrackCutsTPC(),
fESDtrackCutsITS(),
- fESDpid(0x0),
fTOFmaker(0x0),
fTOFcalib(0x0),
fTOFcalibrateESD(!isMC),
fTOFtuneMC(isMC),
fTOFresolution(100.0),
fMinTOF(-2.5),
- fMaxTOF( 3.5),
- fLastRun(-1)
+ fMaxTOF( 3.5)
{
//
// Main constructor.
//
SetMC(isMC);
-
- // set default quality cuts for TPC+ITS tracks
- // TPC
- fESDtrackCutsTPC.SetRequireTPCStandAlone(kTRUE); // to get chi2 and ncls of kTPCin
- fESDtrackCutsTPC.SetMinNClustersTPC(70);
- fESDtrackCutsTPC.SetMaxChi2PerClusterTPC(4);
- fESDtrackCutsTPC.SetAcceptKinkDaughters(kFALSE);
- fESDtrackCutsTPC.SetRequireTPCRefit(kTRUE);
- // ITS
- fESDtrackCutsTPC.SetRequireITSRefit(kTRUE);
- fESDtrackCutsTPC.SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
- fESDtrackCutsTPC.SetMaxDCAToVertexXYPtDep("0.0350+0.0490/pt^1.0");
- fESDtrackCutsTPC.SetMaxDCAToVertexZ(1.e6);
- fESDtrackCutsTPC.SetDCAToVertex2D(kFALSE);
- fESDtrackCutsTPC.SetRequireSigmaToVertex(kFALSE);
- fESDtrackCutsTPC.SetEtaRange(-fMaxEta, fMaxEta);
-
- // set default quality cuts for ITS standalone tracks
- fESDtrackCutsITS.SetRequireITSStandAlone(kTRUE);
- fESDtrackCutsITS.SetRequireITSPureStandAlone(kFALSE);
- fESDtrackCutsITS.SetRequireITSRefit(kTRUE);
- fESDtrackCutsITS.SetMinNClustersITS(4);
- fESDtrackCutsITS.SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
- fESDtrackCutsITS.SetMaxChi2PerClusterITS(2.5);
- fESDtrackCutsITS.SetMaxDCAToVertexXYPtDep("0.0595+0.0182/pt^1.55");
- fESDtrackCutsITS.SetEtaRange(-fMaxEta, fMaxEta);
}
//_________________________________________________________________________________________________
fCheckITS(copy.fCheckITS),
fCheckTPC(copy.fCheckTPC),
fCheckTOF(copy.fCheckTOF),
- fUseGlobal(copy.fUseGlobal),
+ fUseITSTPC(copy.fUseITSTPC),
fUseITSSA(copy.fUseITSSA),
fPID(copy.fPID),
- fMaxEta(copy.fMaxEta),
+ fMaxITSPIDmom(copy.fMaxITSPIDmom),
fMaxITSband(copy.fMaxITSband),
fTPCpLimit(copy.fTPCpLimit),
fMinTPCband(copy.fMinTPCband),
fMaxTPCband(copy.fMaxTPCband),
+ fESDpid(0x0),
fESDtrackCutsTPC(copy.fESDtrackCutsTPC),
fESDtrackCutsITS(copy.fESDtrackCutsITS),
- fESDpid(0x0),
fTOFmaker(0x0),
fTOFcalib(0x0),
fTOFcalibrateESD(copy.fTOFcalibrateESD),
fTOFtuneMC(copy.fTOFtuneMC),
fTOFresolution(copy.fTOFresolution),
fMinTOF(copy.fMinTOF),
- fMaxTOF(copy.fMaxTOF),
- fLastRun(-1)
+ fMaxTOF(copy.fMaxTOF)
{
//
// Copy constructor.
Int_t i = 0;
for (i = 0; i < 5; i++) fTPCpar[i] = copy.fTPCpar[i];
-
- copy.GetCutsTPC()->Copy(fESDtrackCutsTPC);
- copy.GetCutsITS()->Copy(fESDtrackCutsITS);
}
//_________________________________________________________________________________________________
fCheckITS = copy.fCheckITS;
fCheckTPC = copy.fCheckTPC;
fCheckTOF = copy.fCheckTOF;
- fUseGlobal = copy.fUseGlobal;
+ fUseITSTPC = copy.fUseITSTPC;
fUseITSSA = copy.fUseITSSA;
fPID = copy.fPID;
- fMaxEta = copy.fMaxEta;
+ fMaxITSPIDmom = copy.fMaxITSPIDmom;
fMaxITSband = copy.fMaxITSband;
fTPCpLimit = copy.fTPCpLimit;
fMinTPCband = copy.fMinTPCband;
fTOFresolution = copy.fTOFresolution;
fMinTOF = copy.fMinTOF;
fMaxTOF = copy.fMaxTOF;
- fLastRun = copy.fLastRun;
Int_t i = 0;
for (i = 0; i < 5; i++) fTPCpar[i] = copy.fTPCpar[i];
+ delete fESDpid;
+ fESDpid = 0x0;
+
copy.GetCutsTPC()->Copy(fESDtrackCutsTPC);
copy.GetCutsITS()->Copy(fESDtrackCutsITS);
{
fEvent = event;
}
-
- // if absent, initialize ESD pid responst
- if (!fESDpid)
- {
- fESDpid = new AliESDpid;
- fESDpid->GetTPCResponse().SetBetheBlochParameters(fTPCpar[0],fTPCpar[1],fTPCpar[2],fTPCpar[3],fTPCpar[4]);
- }
-
- // initialize DB to current run
+
+ // if the run number has changed,
+ // reset the CDB in order to point to the correct one
Int_t run = esd->GetRunNumber();
- if (run != fLastRun)
+ if (run != fgLastRun)
{
- cout << "Run = " << run << " -- LAST = " << fLastRun << endl;
- fLastRun = run;
-
- // setup TOF maker & calibration
- if (!fTOFcalib) fTOFcalib = new AliTOFcalib;
- fTOFcalib->SetCorrectTExp(fTOFcorrectTExp);
- if (!fTOFmaker) fTOFmaker = new AliTOFT0maker(fESDpid, fTOFcalib);
- fTOFmaker->SetTimeResolution(fTOFresolution);
+ AliInfo("============================================================================================");
+ AliInfo(Form("*** CHANGING RUN NUMBER: PREVIOUS = %d --> CURRENT = %d ***", fgLastRun, run));
+ AliInfo("============================================================================================");
+ fgLastRun = run;
AliCDBManager *cdb = AliCDBManager::Instance();
cdb->ClearCache(); // suggestion by Annalisa
cdb->Clear(); // suggestion by Annalisa
cdb->SetDefaultStorage("raw://");
cdb->SetRun(run);
-
- fTOFcalib->SetCorrectTExp(fTOFcorrectTExp);
- fTOFcalib->Init();
}
+
+ // if absent, initialize ESD pid response
+ if (!fESDpid)
+ {
+ AliITSPIDResponse itsresponse(fIsMC);
+
+ fESDpid = new AliESDpid;
+ fESDpid->GetTPCResponse().SetBetheBlochParameters(fTPCpar[0],fTPCpar[1],fTPCpar[2],fTPCpar[3],fTPCpar[4]);
+ fESDpid->GetITSResponse() = itsresponse;
+ }
+
+ // if absent, initialize TOF objects for calibration
+ if (!fTOFcalib) fTOFcalib = new AliTOFcalib;
+ fTOFcalib->SetCorrectTExp(fTOFcorrectTExp);
+ fTOFcalib->Init();
+ if (!fTOFmaker) fTOFmaker = new AliTOFT0maker(fESDpid, fTOFcalib);
+ fTOFmaker->SetTimeResolution(fTOFresolution);
// if required, calibrate the TOF t0 maker with current event
if (fTOFcalibrateESD) fTOFcalib->CalibrateESD(esd);
}
//_________________________________________________________________________________________________
-Bool_t AliRsnCutESD2010::IsSelected(TObject *obj1, TObject* /*obj2*/)
+Bool_t AliRsnCutESD2010::IsSelected(TObject *object)
{
//
// Cut checker.
//
// coherence check: require an ESD track
- AliRsnDaughter *daughter = dynamic_cast<AliRsnDaughter*>(obj1);
+ AliRsnDaughter *daughter = dynamic_cast<AliRsnDaughter*>(object);
if (!daughter) return kFALSE;
AliESDtrack *track = daughter->GetRefESDtrack();
if (!track) return kFALSE;
// if no reference event, skip
if (!fEvent) return kFALSE;
- // ITS: create the response function
- AliITSPIDResponse itsrsp(fIsMC);
-
- // TOF: define fixed function for compatibility range
- //Double_t a1 = 0.01, a2 = -0.03;
- //Double_t b1 = 0.25, b2 = 0.25;
- //Double_t c1 = 0.05, c2 = -0.03;
- //Double_t ymax, ymin;
-
- ULong_t status;
- Int_t k, nITS;
- Double_t times[10], tpcNSigma, tpcMaxNSigma, itsSignal, itsNSigma, mom, tofTime, tofSigma, tofRef, tofRel;
- Bool_t okQuality, okTOF, okTPC, okITS, isTPC, isITSSA, isTOF;
- UChar_t itsCluMap;
-
- // get commonly used variables
- status = (ULong_t)track->GetStatus();
- mom = track->P();
- isTPC = ((status & AliESDtrack::kTPCin) != 0);
- isITSSA = (((status & AliESDtrack::kTPCin) == 0) && ((status & AliESDtrack::kITSrefit) != 0) && ((status & AliESDtrack::kITSpureSA) == 0) && ((status & AliESDtrack::kITSpid) != 0));
- isTOF = (((status & AliESDtrack::kTOFout) != 0) && ((status & AliESDtrack::kTIME) != 0) /* && mom > TMath::Max(b1, b2)*/);
-
- // check if the track type matches what is required
- if (!isTPC && !isITSSA)
- {
- AliDebug(AliLog::kDebug + 2, "Track is not either a TPC track or a ITS standalone. Rejected");
- return kFALSE;
- }
- else if (isTPC && !fUseGlobal)
- {
- AliDebug(AliLog::kDebug + 2, "Global tracks not used. Rejected");
- return kFALSE;
- }
- else if (isITSSA && !fUseITSSA)
+ // check quality and track type and reject tracks not passing this step
+ if (!OkQuality(track))
{
- AliDebug(AliLog::kDebug + 2, "ITS standalone not used. Rejected");
+ AliDebug(AliLog::kDebug+2, "Failed quality cut");
return kFALSE;
}
- // does a preliminary check on TOF values, if necessary
- // then, if the reference time or TOF signal are meaningless
- // even if the 'isTOF' flag is true, switch it to false
- if (isTOF)
- {
- track->GetIntegratedTimes(times);
- tofTime = (Double_t)track->GetTOFsignal();
- tofSigma = fTOFmaker->GetExpectedSigma(mom, times[(Int_t)fPID], AliPID::ParticleMass((Int_t)fPID));
- tofRef = times[(Int_t)fPID];
- if (tofRef <= 0.0 && tofSigma <= 0.0) isTOF = kFALSE;
- }
+ // ITS PID can be checked always
+ // if PID is not required, the flag is sed as
+ // if the cut was alsways passed
+ Bool_t okITSpid = OkITSPID(track);
+ if (!fCheckITS) okITSpid = kTRUE;
+
+ // TPC PID can be checked only for TPC+ITS tracks
+ // if PID is not required, the flag is sed as
+ // if the cut was alsways passed
+ Bool_t okTPCpid = kFALSE;
+ if (IsITSTPC(track)) okTPCpid = OkTPCPID(track);
+ if (!fCheckTPC) okTPCpid = kTRUE;
- // check quality (eta range must be adapted)
- AliESDtrackCuts *cuts = 0x0;
- if (isTPC) cuts = &fESDtrackCutsTPC;
- if (isITSSA) cuts = &fESDtrackCutsITS;
- if (!cuts) return kFALSE;
- cuts->SetEtaRange(-fMaxEta, fMaxEta);
- okQuality = cuts->IsSelected(track);
- AliDebug(AliLog::kDebug + 2, Form("Global quality cut = %s", (okQuality ? "GOOD" : "BAD")));
- if (!okQuality) return kFALSE;
+ // TOF PID can be checked only if TOF is matched
+ // if PID is not required, the flag is sed as
+ // if the cut was alsways passed
+ Bool_t okTOFpid = kFALSE;
+ if (IsITSTPC(track) && MatchTOF(track)) okTOFpid = OkTOFPID(track);
+ if (!fCheckTOF) okTOFpid = kTRUE;
- if (isTPC) // this branch is entered by all global tracks
+ // now combine all outcomes according to the different possibilities:
+ // -- ITS standalone:
+ // --> only ITS PID, always
+ // -- ITS + TPC:
+ // --> ITS PID, only for momenta lower than 'fMaxITSPIDmom' and when the ITSpid flag is active
+ // --> TPC PID, always --> MASTER (first to be checked, if fails, track is rejected)
+ // --> TOF PID, only if matched
+ if (IsITSSA(track))
{
- // check TPC dE/dx:
- if (fCheckTPC)
+ if (!okITSpid)
{
- tpcNSigma = TMath::Abs(fESDpid->NumberOfSigmasTPC(track, fPID));
- if (track->GetInnerParam()->P() > fTPCpLimit) tpcMaxNSigma = fMinTPCband; else tpcMaxNSigma = fMaxTPCband;
- okTPC = (tpcNSigma <= tpcMaxNSigma);
- AliDebug(AliLog::kDebug + 2, Form("TPC nsigma = %f -- max = %f -- cut %s", tpcNSigma, tpcMaxNSigma, (okTPC ? "passed" : "failed")));
+ AliDebug(AliLog::kDebug+2, "ITS standalone track --> ITS PID failed");
+ return kFALSE;
}
- else
+ }
+ else // checking IsITSTPC() is redundant due to OkQuality() cut check
+ {
+ if (!okTPCpid)
{
- // if TPC is not checked, it is as if all tracks do pass the cut
- okTPC = kTRUE;
- AliDebug(AliLog::kDebug + 2, "TPC not checked, track accepted");
+ AliDebug(AliLog::kDebug+2, "ITS+TPC track --> TPC PID failed");
+ return kFALSE;
}
-
- // check TOF (only if flags are OK)
- if (fCheckTOF)
+ else if (MatchTOF(track) && !okTOFpid)
{
- if (isTOF)
- {
- // TOF can be checked only when track is matched there
- track->GetIntegratedTimes(times);
- tofTime = (Double_t)track->GetTOFsignal();
- tofSigma = fTOFmaker->GetExpectedSigma(mom, times[(Int_t)fPID], AliPID::ParticleMass((Int_t)fPID));
- tofRef = times[(Int_t)fPID];
- /*
- tofRel = (tofTime - tofRef) / tofRef;
- ymax = a1 / (mom - b1) + c1;
- ymin = a2 / (mom - b2) + c2;
- okTOF = (tofRel >= ymin && tofRel <= ymax);
- */
- tofRel = (tofTime - tofRef) / tofSigma;
- okTOF = (tofRel >= fMinTOF && tofRel <= fMaxTOF);
- AliDebug(AliLog::kDebug + 2, Form("TOF nsigma = %f -- range = %f %f -- cut %s", tofRel, fMinTOF, fMaxTOF, (okTOF ? "passed" : "failed")));
- }
- else
- {
- // if TOF is not matched, the answer depends on TPC:
- // - if TPC is required, track is checked only there and TOF simply ignored
- // - if TPC is not required, track is rejected when TOF does not match it, if TOF check is required
- if (fCheckTPC) okTOF = kTRUE; else okTOF = kFALSE;
- }
+ AliDebug(AliLog::kDebug+2, "ITS+TPC track --> TOF matched but TOF PID failed");
+ return kFALSE;
}
- else
+ else if (track->IsOn(AliESDtrack::kITSpid) && track->P() <= fMaxITSPIDmom && !okITSpid)
{
- okTOF = kTRUE;
+ AliDebug(AliLog::kDebug+2, Form("ITS+TPC track --> Momentum lower than limit (%.2f) and ITS PID failed", fMaxITSPIDmom));
+ return kFALSE;
}
-
- // properly combine the outcome of TPC and TOF cuts
- return okTPC && okTOF;
}
- else if (isITSSA) // this branch is entered by all ITS standalone tracks
- {
- // check dE/dx only if this is required, otherwise ITS standalone are just added but not checked for PID
- if (fCheckITS)
- {
- itsSignal = track->GetITSsignal();
- itsCluMap = track->GetITSClusterMap();
- nITS = 0;
- for(k = 2; k < 6; k++) if(itsCluMap & (1 << k)) ++nITS;
- if (nITS < 3) return kFALSE;
- itsNSigma = itsrsp.GetNumberOfSigmas(mom, itsSignal, fPID, nITS, kTRUE);
- okITS = (TMath::Abs(itsNSigma) <= fMaxITSband);
- AliDebug(AliLog::kDebug + 2, Form("ITS nsigma = %f -- max = %f -- cut %s", itsNSigma, fMaxITSband, (okITS ? "passed" : "failed")));
- }
- else
- {
- okITS = kTRUE;
- }
+
+ // arriving here, the track has survived all checks
+ return kTRUE;
+}
+
+//______________________________________________________________________________
+Bool_t AliRsnCutESD2010::OkQuality(AliESDtrack *track)
+{
+//
+// Check track quality parameters.
+// Rejects all tracks which are not either TPC+ITS nor ITS standalone.
+// If tracks of any type are not flagged to be used, they are rejected anyway.
+//
+
+ if (IsITSTPC(track)) return (fUseITSTPC && fESDtrackCutsTPC.IsSelected(track));
+ if (IsITSSA (track)) return (fUseITSSA && fESDtrackCutsITS.IsSelected(track));
+
+ return kFALSE;
+}
- return okITS;
+//______________________________________________________________________________
+Bool_t AliRsnCutESD2010::OkITSPID (AliESDtrack *track)
+{
+//
+// Check ITS particle identification with 3sigma cut
+//
+
+ // count PID layers and reject if they are too few
+ Int_t k, nITSpidLayers = 0;
+ UChar_t itsCluMap = track->GetITSClusterMap();
+ for(k = 2; k < 6; k++) if(itsCluMap & (1 << k)) ++nITSpidLayers;
+ if (nITSpidLayers < 3)
+ {
+ AliDebug(AliLog::kDebug+2, "Rejecting track with too few ITS pid layers");
+ return kFALSE;
}
+
+ // check the track type (ITS+TPC or ITS standalone)
+ // and reject it if it is of none of the allowed types
+ Bool_t isSA = kFALSE;
+ if (IsITSTPC(track)) isSA = kFALSE;
+ else if (IsITSSA(track)) isSA = kTRUE;
else
{
- // if we are here, the track is surely bad
+ AliWarning("Track is neither ITS+TPC nor ITS standalone");
return kFALSE;
}
+
+ // create the PID response object and compute nsigma
+ AliITSPIDResponse &itsrsp = fESDpid->GetITSResponse();
+ Double_t mom = track->P();
+ Double_t nSigma = itsrsp.GetNumberOfSigmas(mom, track->GetITSsignal(), fPID, nITSpidLayers, isSA);
+
+ // evaluate the cut
+ Bool_t ok = (TMath::Abs(nSigma) <= fMaxITSband);
+
+ // debug message
+ AliDebug(AliLog::kDebug + 2, Form("ITS nsigma = %f -- max = %f -- cut %s", nSigma, fMaxITSband, (ok ? "passed" : "failed")));
+
+ // outcome
+ return ok;
+}
+
+//______________________________________________________________________________
+Bool_t AliRsnCutESD2010::OkTPCPID (AliESDtrack *track)
+{
+//
+// Check TPC particle identification with {3|5}sigmacut,
+// depending on the track total momentum.
+//
+
+ // setup TPC PID response
+ AliTPCPIDResponse &tpcrsp = fESDpid->GetTPCResponse();
+ tpcrsp.SetBetheBlochParameters(fTPCpar[0],fTPCpar[1],fTPCpar[2],fTPCpar[3],fTPCpar[4]);
+
+ // get momentum and number of sigmas and choose the reference band
+ Double_t mom = track->GetInnerParam()->P();
+ Double_t nSigma = tpcrsp.GetNumberOfSigmas(mom, track->GetTPCsignal(), track->GetTPCsignalN(), fPID);
+ Double_t maxNSigma = fMaxTPCband;
+ if (mom < fTPCpLimit) maxNSigma = fMinTPCband;
+
+ // evaluate the cut
+ Bool_t ok = (TMath::Abs(nSigma) <= maxNSigma);
+
+ // debug message
+ AliDebug(AliLog::kDebug + 2, Form("TPC nsigma = %f -- max = %f -- cut %s", nSigma, maxNSigma, (ok ? "passed" : "failed")));
+
+ // outcome
+ return ok;
+}
+
+//______________________________________________________________________________
+Bool_t AliRsnCutESD2010::OkTOFPID (AliESDtrack *track)
+{
+//
+// Check TOF particle identification if matched there.
+//
+
+ // check integrated length
+ if (track->GetIntegratedLength() < 350.) return kFALSE;
+
+ // setup TOF PID response
+ AliTOFPIDResponse &tofrsp = fESDpid->GetTOFResponse();
+
+ // get info for computation
+ Double_t momentum = track->P();
+ Double_t time = track->GetTOFsignal();
+ Double_t timeint[AliPID::kSPECIES];
+ tofrsp.GetStartTime(momentum);
+ track->GetIntegratedTimes(timeint);
+
+ // check the cut
+ Double_t timeDiff = time - timeint[(Int_t)fPID];
+ Double_t sigmaRef = tofrsp.GetExpectedSigma(momentum, timeint[(Int_t)fPID], AliPID::ParticleMass(fPID));
+ Double_t nSigma = timeDiff / sigmaRef;
+
+ // evaluate the cut
+ Bool_t ok = (nSigma >= fMinTOF && nSigma <= fMaxTOF);
+
+ // debug message
+ AliDebug(AliLog::kDebug + 2, Form("TOF nsigma = %f -- range = %f - %f -- cut %s", nSigma, fMinTOF, fMaxTOF, (ok ? "passed" : "failed")));
+
+ // outcome
+ return ok;
}
//
-// Class AliRsnCutRange
+// *** Class AliRsnCutESD2010 ***
//
-// General implementation of cuts which check a value inside a range.
-// This range can be defined by two integers or two doubles.
-// A user-friendly enumeration allows to define what is checked.
+// This class implements all cuts which have to be used for the 2010 runs
+// for phi and generic resonance analysis.
+// It contains an AliESDtrackCuts object for track quality selection
+// and some criteria for particle identification with ITS, TPC and TOF.
//
// authors: Martin Vala (martin.vala@cern.ch)
// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
#define ALIRSNCUTESD2010_H
#include "AliPID.h"
+#include "AliESDtrack.h"
#include "AliESDtrackCuts.h"
#include "AliRsnCut.h"
const AliESDtrackCuts* GetCutsTPC() const {return &fESDtrackCutsTPC;}
const AliESDtrackCuts* GetCutsITS() const {return &fESDtrackCutsITS;}
- virtual Bool_t IsSelected(TObject *obj1, TObject *obj2 = 0x0);
+ virtual Bool_t IsSelected(TObject *object);
void SetMC (Bool_t yn = kTRUE);
void SetCheckITS (Bool_t yn = kTRUE) {fCheckITS = yn;}
void SetCheckTPC (Bool_t yn = kTRUE) {fCheckTPC = yn;}
void SetCheckTOF (Bool_t yn = kTRUE) {fCheckTOF = yn;}
- void SetUseGlobal(Bool_t yn = kTRUE) {fUseGlobal = yn;}
+ void SetUseITSTPC(Bool_t yn = kTRUE) {fUseITSTPC = yn;}
void SetUseITSSA (Bool_t yn = kTRUE) {fUseITSSA = yn;}
- void SetMaxEta (Double_t v) {fMaxEta = v;}
void SetPID (AliPID::EParticleType t) {fPID = t;}
- void SetITSband(Double_t v) {fMaxITSband = v;}
+ void SetMaxITSPIDmom(Double_t v) {fMaxITSPIDmom = v;}
+ void SetITSband(Double_t v) {fMaxITSband = v;}
void SetTPCpLimit(Double_t v) {fTPCpLimit = v;}
void SetTPCrange(Double_t min, Double_t max) {fMinTPCband = min; fMaxTPCband = max;}
protected:
+ Bool_t OkQuality(AliESDtrack *d); // check track quality parameters and DCA
+ Bool_t OkITSPID (AliESDtrack *d); // check ITS PID
+ Bool_t OkTPCPID (AliESDtrack *d); // check TPC PID
+ Bool_t OkTOFPID (AliESDtrack *d); // check TOF PID
+ Bool_t IsITSTPC (AliESDtrack *d); // check that the track is TPC+ITS
+ Bool_t IsITSSA (AliESDtrack *d); // check that the track is ITS standalone
+ Bool_t MatchTOF (AliESDtrack *d); // check that the track matches the TOF
+
Bool_t fIsMC; // switch for MC analysis
Bool_t fCheckITS; // switch for ITS dE/dx check
Bool_t fCheckTPC; // switch for TPC dE/dx check
Bool_t fCheckTOF; // switch for TOF time check
- Bool_t fUseGlobal; // switch to use TPC global tracks
+ Bool_t fUseITSTPC; // switch to use TPC global tracks
Bool_t fUseITSSA; // switch to use ITS standalone tracks
AliPID::EParticleType fPID; // PID reference type used for checks
- Double_t fMaxEta; // cut in eta
-
+ Double_t fMaxITSPIDmom; // maximum momentum where ITS PID is used for TPC+ITS tracks
Double_t fMaxITSband; // range for ITS de/dx band
Double_t fTPCpLimit; // limit to choose what band to apply
Double_t fMinTPCband; // range for TPC de/dx band - min
Double_t fMaxTPCband; // range for TPC de/dx band - max
+ AliESDpid *fESDpid; // ESD PID object
AliESDtrackCuts fESDtrackCutsTPC; // ESD standard defined track cuts for TPC tracks
AliESDtrackCuts fESDtrackCutsITS; // ESD standard defined track cuts for ITS-SA tracks
- AliESDpid *fESDpid; //! PID manager
- AliTOFT0maker *fTOFmaker; //! TOF time0 computator
- AliTOFcalib *fTOFcalib; //! TOF calibration
+ AliTOFT0maker *fTOFmaker; //! TOF time0 computator
+ AliTOFcalib *fTOFcalib; //! TOF calibration
Bool_t fTOFcalibrateESD; // TOF settings
Bool_t fTOFcorrectTExp; // TOF settings
Bool_t fTOFuseT0; // TOF settings
Double_t fTOFresolution; // TOF settings
Double_t fMinTOF; // range for TOF PID (min)
Double_t fMaxTOF; // range for TOF PID (max)
- Int_t fLastRun; // last run number
+
+ static Int_t fgLastRun; //! last run number
ClassDef(AliRsnCutESD2010, 1)
};
+inline Bool_t AliRsnCutESD2010::IsITSTPC(AliESDtrack *vtrack)
+{
+//
+// Checks if the track has the status flags required for a global track
+//
+
+ if (!vtrack)
+ {
+ AliWarning("NULL argument: impossible to check status");
+ return kFALSE;
+ }
+
+ ULong_t status = (ULong_t)vtrack->GetStatus();
+ ULong_t sTPCin = status & AliESDtrack::kTPCin;
+
+ if (sTPCin == 0) return kFALSE;
+
+ return kTRUE;
+}
+
+inline Bool_t AliRsnCutESD2010::IsITSSA(AliESDtrack *vtrack)
+{
+//
+// Checks if the track has the status flags required for an ITS standalone track
+//
+
+ if (!vtrack)
+ {
+ AliWarning("NULL argument: impossible to check status");
+ return kFALSE;
+ }
+
+ ULong_t status = (ULong_t)vtrack->GetStatus();
+ ULong_t sTPCin = status & AliESDtrack::kTPCin;
+ ULong_t sITSrefit = status & AliESDtrack::kITSrefit;
+ ULong_t sITSpureSA = status & AliESDtrack::kITSpureSA;
+ ULong_t sITSpid = status & AliESDtrack::kITSpid;
+
+ if (sTPCin != 0) return kFALSE;
+ if (sITSrefit == 0) return kFALSE;
+ if (sITSpureSA != 0) return kFALSE;
+ if (sITSpid == 0) return kFALSE;
+
+ return kTRUE;
+}
+
+
+inline Bool_t AliRsnCutESD2010::MatchTOF(AliESDtrack *vtrack)
+{
+//
+// Checks if the track has matched the TOF detector
+//
+
+ if (!vtrack)
+ {
+ AliWarning("NULL argument: impossible to check status");
+ return kFALSE;
+ }
+
+ ULong_t status = (ULong_t)vtrack->GetStatus();
+ ULong_t sTOFout = status & AliESDtrack::kTOFout;
+ ULong_t sTIME = status & AliESDtrack::kTIME;
+
+ if (sTOFout == 0) return kFALSE;
+ if (sTIME == 0) return kFALSE;
+
+ return kTRUE;
+}
+
#endif
virtual ~AliRsnCutESDCutMultiplicity() {;};
const AliESDtrackCuts* GetCuts() const {return &fCuts;}
- virtual Bool_t IsSelected(TObject *obj1, TObject *obj2 = 0x0);
+ virtual Bool_t IsSelected(TObject *object);
protected:
//_________________________________________________________________________________________________
AliRsnCutESDPrimary::AliRsnCutESDPrimary() :
- AliRsnCut(AliRsnCut::kDaughter),
+ AliRsnCut(),
fCuts()
{
//
// Default constructor.
//
+
+ SetTargetType(AliRsnTarget::kDaughter);
}
//_________________________________________________________________________________________________
}
//_________________________________________________________________________________________________
-Bool_t AliRsnCutESDPrimary::IsSelected(TObject *obj1, TObject* /*obj2*/)
+Bool_t AliRsnCutESDPrimary::IsSelected(TObject *object)
{
//
// Cut checker.
//
// coherence check
- AliRsnDaughter *daughter = dynamic_cast<AliRsnDaughter*>(obj1);
- if (!daughter) return kFALSE;
+ if (!TargetOK(object)) return kFALSE;
// retrieve the TPC signal
+ AliRsnDaughter *daughter = dynamic_cast<AliRsnDaughter*>(object);
AliESDtrack *esdTrack = daughter->GetRefESDtrack();
if (!esdTrack)
{
virtual ~AliRsnCutESDPrimary() {;};
AliESDtrackCuts* GetCuts() {return &fCuts;}
- virtual Bool_t IsSelected(TObject *obj1, TObject *obj2 = 0x0);
+ virtual Bool_t IsSelected(TObject *object);
protected:
//
-// Class AliRsnCutManager
-//
-// The cut manager: contains a complete set of cut definitions
-// to be applied to all possible targets (one for each target),
-// in order to ease the set-up procedure of cuts and allow to
-// pass them at once to each object which must use them
-//
-// author: Martin Vala (martin.vala@cern.ch)
+// *** Class AliRsnCutManager ***
+//
+// This class is used both in normal analysis and efficiency computation
+// as a collection of all cuts which could be needed in a single job.
+// It allocates an AliRsnCutSet for each possible target:
+// - one with all cuts common to all tracks
+// - one with all cuts for first candidate daughter (definition #1 in pairDef)
+// - one with all cuts for second candidate daughter (definition #2 in pairDef)
+// - one with all cuts on the pair
+// -----
+// This object is used to define a step in efficiency CORRFW container
+// and also is contained in all AliRsnPair objects to decide if two candidates
+// can be accepted or not.
+//
+// authors: Martin Vala (martin.vala@cern.ch)
+// Alberto Pulvirenti (alberto.pulvirenti@cern.ch)
//
#include "AliLog.h"
+#include "AliRsnCut.h"
#include "AliRsnCutManager.h"
ClassImp(AliRsnCutManager)
//_____________________________________________________________________________
AliRsnCutManager::AliRsnCutManager() :
TNamed("defaultName", "defaultTitle"),
- fDaughterCutsCommon(0x0),
- fDaughterCuts1(0x0),
- fDaughterCuts2(0x0),
- fMotherCuts(0x0)
+ fDaughterCutsCommon("defaultCommon", AliRsnTarget::kDaughter),
+ fDaughterCuts1("defaultD1", AliRsnTarget::kDaughter),
+ fDaughterCuts2("defaultD2", AliRsnTarget::kDaughter),
+ fMotherCuts("defaultPair", AliRsnTarget::kMother)
{
//
// Constructor without arguments.
//_____________________________________________________________________________
AliRsnCutManager::AliRsnCutManager(const char *name, const char *title) :
TNamed(name, title),
- fDaughterCutsCommon(0x0),
- fDaughterCuts1(0x0),
- fDaughterCuts2(0x0),
- fMotherCuts(0x0)
+ fDaughterCutsCommon(Form("common_%s", name), AliRsnTarget::kDaughter),
+ fDaughterCuts1(Form("d1_%s", name), AliRsnTarget::kDaughter),
+ fDaughterCuts2(Form("d2_%s", name), AliRsnTarget::kDaughter),
+ fMotherCuts(Form("pair_%s", name), AliRsnTarget::kMother)
{
//
// Constructor with name and title.
//
}
+//_____________________________________________________________________________
AliRsnCutManager& AliRsnCutManager::operator=(const AliRsnCutManager &cut)
{
//
SetName(cut.GetName());
SetTitle(cut.GetTitle());
- fDaughterCuts2 = cut.fDaughterCuts2;
- fDaughterCuts1 = cut.fDaughterCuts1;
+ fDaughterCuts2 = cut.fDaughterCuts2;
+ fDaughterCuts1 = cut.fDaughterCuts1;
fDaughterCutsCommon = cut.fDaughterCutsCommon;
- fMotherCuts = cut.fMotherCuts;
+ fMotherCuts = cut.fMotherCuts;
return (*this);
}
{
//
// Destructor.
-// Deletes all cut definitions.
+// Does nothing.
//
-
- delete fDaughterCuts2;
- delete fDaughterCuts1;
- delete fDaughterCutsCommon;
- delete fMotherCuts;
}
//_____________________________________________________________________________
// Sets reference event in all cut sets
//
- if (fDaughterCuts2 ) fDaughterCuts2 ->SetEvent(event);
- if (fDaughterCuts1 ) fDaughterCuts1 ->SetEvent(event);
- if (fDaughterCutsCommon) fDaughterCutsCommon ->SetEvent(event);
- if (fMotherCuts ) fMotherCuts ->SetEvent(event);
+ fDaughterCuts2.SetEvent(event);
+ fDaughterCuts1.SetEvent(event);
+ fDaughterCutsCommon.SetEvent(event);
+ fMotherCuts.SetEvent(event);
}
//
-// Class AliRsnCutManager
+// *** Class AliRsnCutManager ***
//
-// The cut manager: contains a complete set of cut definitions
-// to be applied to all possible targets (one for each target),
-// in order to ease the set-up procedure of cuts and allow to
-// pass them at once to each object which must use them
+// This class is used both in normal analysis and efficiency computation
+// as a collection of all cuts which could be needed in a single job.
+// It allocates an AliRsnCutSet for each possible target:
+// - one with all cuts common to all tracks
+// - one with all cuts for first candidate daughter (definition #1 in pairDef)
+// - one with all cuts for second candidate daughter (definition #2 in pairDef)
+// - one with all cuts on the pair
+// -----
+// This object is used to define a step in efficiency CORRFW container
+// and also is contained in all AliRsnPair objects to decide if two candidates
+// can be accepted or not.
//
-// author: Martin Vala (martin.vala@cern.ch)
+// authors: Martin Vala (martin.vala@cern.ch)
+// Alberto Pulvirenti (alberto.pulvirenti@cern.ch)
//
#ifndef ALIRSNCUTMANAGER_H
#include <TNamed.h>
-#include "AliRsnCut.h"
#include "AliRsnDaughter.h"
#include "AliRsnMother.h"
#include "AliRsnCutSet.h"
+class AliRsnCut;
+
class AliRsnCutManager : public TNamed
{
public:
AliRsnCutManager& operator=(const AliRsnCutManager& cut);
~AliRsnCutManager();
- AliRsnCutSet* GetCommonDaughterCuts() {return fDaughterCutsCommon;}
- AliRsnCutSet* GetDaughter1Cuts() {return fDaughterCuts1;}
- AliRsnCutSet* GetDaughter2Cuts() {return fDaughterCuts2;}
- AliRsnCutSet* GetMotherCuts() {return fMotherCuts;}
-
- void SetCommonDaughterCuts(AliRsnCutSet *cuts) {fDaughterCutsCommon = cuts;}
- void SetDaughter1Cuts(AliRsnCutSet *cuts) {fDaughterCuts1 = cuts;}
- void SetDaughter2Cuts(AliRsnCutSet *cuts) {fDaughterCuts2 = cuts;}
- void SetMotherCuts(AliRsnCutSet *cuts) {fMotherCuts = cuts;}
- void SetEvent(AliRsnEvent *event);
+ void SetEvent(AliRsnEvent *event);
+
+ AliRsnCutSet* GetCommonDaughterCuts() {return &fDaughterCutsCommon;}
+ AliRsnCutSet* GetDaughter1Cuts() {return &fDaughterCuts1;}
+ AliRsnCutSet* GetDaughter2Cuts() {return &fDaughterCuts2;}
+ AliRsnCutSet* GetMotherCuts() {return &fMotherCuts;}
- Bool_t PassCommonDaughterCuts(AliRsnDaughter *daughter) const {if (fDaughterCutsCommon) return fDaughterCutsCommon->IsSelected(daughter); return kTRUE;}
- Bool_t PassDaughter1Cuts(AliRsnDaughter *daughter) const {if (fDaughterCuts1) return fDaughterCuts2->IsSelected(daughter); return kTRUE;}
- Bool_t PassDaughter2Cuts(AliRsnDaughter *daughter) const {if (fDaughterCuts2) return fDaughterCuts2->IsSelected(daughter); return kTRUE;}
- Bool_t PassMotherCuts(AliRsnMother *mother) {if (fMotherCuts) return fMotherCuts->IsSelected(mother); return kTRUE;}
+ Bool_t PassCommonDaughterCuts(AliRsnDaughter *daughter) {return fDaughterCutsCommon.IsSelected(daughter);}
+ Bool_t PassDaughter1Cuts(AliRsnDaughter *daughter) {return fDaughterCuts2.IsSelected(daughter);}
+ Bool_t PassDaughter2Cuts(AliRsnDaughter *daughter) {return fDaughterCuts2.IsSelected(daughter);}
+ Bool_t PassMotherCuts(AliRsnMother *mother) {return fMotherCuts.IsSelected(mother);}
private:
- AliRsnCutSet *fDaughterCutsCommon; // single-track cuts common to both daughters
- AliRsnCutSet *fDaughterCuts1; // single-track cuts for only first daughter
- AliRsnCutSet *fDaughterCuts2; // single-track cuts for only second daughter
- AliRsnCutSet *fMotherCuts; // mother cuts (on relations between daughters)
+ AliRsnCutSet fDaughterCutsCommon; // single-track cuts common to both daughters
+ AliRsnCutSet fDaughterCuts1; // single-track cuts for only first daughter
+ AliRsnCutSet fDaughterCuts2; // single-track cuts for only second daughter
+ AliRsnCutSet fMotherCuts; // mother cuts (on relations between daughters)
- ClassDef(AliRsnCutManager, 1) // dictionary
+ ClassDef(AliRsnCutManager, 2) // dictionary
};
#endif
//_________________________________________________________________________________________________
AliRsnCutPID::AliRsnCutPID() :
- AliRsnCut(AliRsnCut::kDaughter),
+ AliRsnCut(),
fPerfect(kFALSE),
fUseDefault(kTRUE)
{
fWeight[i] = 0.0;
fPrior[i] = 1.0;
}
+
+ SetTargetType(AliRsnTarget::kDaughter);
}
//_________________________________________________________________________________________________
fMinD = probMin;
fMaxD = 1.000001;
+
+ SetTargetType(AliRsnTarget::kDaughter);
}
//_____________________________________________________________________________
}
//_________________________________________________________________________________________________
-Bool_t AliRsnCutPID::IsSelected(TObject *obj1, TObject* /*obj2*/)
+Bool_t AliRsnCutPID::IsSelected(TObject *object)
{
//
// Cut checker.
//
// convert the object into the unique correct type
- AliRsnDaughter *daughter = dynamic_cast<AliRsnDaughter*>(obj1);
- if (!daughter)
+
+ if (!TargetOK(object))
{
AliError(Form("[%s]: this cut works only with AliRsnDaughter objects", GetName()));
return kTRUE;
}
+ // if target is OK, do a dynamic cast
+ AliRsnDaughter *daughter = dynamic_cast<AliRsnDaughter*>(object);
+
// depending on the PID type, recalls the appropriate method:
// in case of perfect PID, checks only if the PID type is
// corresponding to the request in the cut (fMinI)
Int_t PerfectPID(AliRsnDaughter * const daughter);
Double_t GetWeight(Int_t i) {if (i>=0&&i<AliPID::kSPECIES) return fWeight[i]; return 0.0;}
- virtual Bool_t IsSelected(TObject *obj1, TObject *obj2 = 0x0);
+ virtual Bool_t IsSelected(TObject *object);
protected:
ClassImp(AliRsnCutPrimaryVertex)
-//_________________________________________________________________________________________________
-AliRsnCutPrimaryVertex::AliRsnCutPrimaryVertex() :
- AliRsnCut(AliRsnCut::kEvent),
- fAcceptTPC(kFALSE)
-{
-//
-// Default constructor.
-//
-}
-
//_________________________________________________________________________________________________
AliRsnCutPrimaryVertex::AliRsnCutPrimaryVertex
(const char *name, Double_t maxVz, Int_t nContributors, Bool_t acceptTPC) :
- AliRsnCut(name, AliRsnCut::kEvent, 0, nContributors - 1),
+ AliRsnCut(name, AliRsnCut::kEvent, 0, nContributors - 1, 0.0, maxVz),
fAcceptTPC(acceptTPC)
{
//
}
//_________________________________________________________________________________________________
-Bool_t AliRsnCutPrimaryVertex::IsSelected(TObject *obj1, TObject* /*obj2*/)
+Bool_t AliRsnCutPrimaryVertex::IsSelected(TObject *object)
{
//
// Cut checker
evNum++;
// retrieve ESD event
- AliRsnEvent *rsn = dynamic_cast<AliRsnEvent*>(obj1);
+ AliRsnEvent *rsn = dynamic_cast<AliRsnEvent*>(object);
if (!rsn) return kFALSE;
AliESDEvent *esd = rsn->GetRefESD();
AliAODEvent *aod = rsn->GetRefAOD();
AliAODVertex *prim = (AliAODVertex*)aod->GetPrimaryVertex();
if (!prim) return kFALSE;
- //fCutValueI = prim->GetNContributors();
+ fCutValueI = prim->GetNContributors();
fCutValueD = prim->GetZ();
}
else
Bool_t result = ((!OkRangeI()) && OkRangeD());
return result;
}
-
{
public:
- AliRsnCutPrimaryVertex();
- AliRsnCutPrimaryVertex(const char *name, Double_t maxVz, Int_t minContributors = 1, Bool_t acceptTPC = kFALSE);
+ AliRsnCutPrimaryVertex(const char *name = "cutPrimVert", Double_t maxVz = 10.0, Int_t minContributors = 1, Bool_t acceptTPC = kFALSE);
virtual ~AliRsnCutPrimaryVertex() {;};
- virtual Bool_t IsSelected(TObject *obj1, TObject *obj2 = 0x0);
+ virtual Bool_t IsSelected(TObject *object);
protected:
ClassImp(AliRsnCutSet)
//_____________________________________________________________________________
-AliRsnCutSet::AliRsnCutSet(AliRsnCut::ETarget target) :
- TNamed(),
- fTarget(target),
+AliRsnCutSet::AliRsnCutSet() :
+ AliRsnTarget(),
fCuts(0),
fNumOfCuts(0),
fCutScheme(""),
}
//_____________________________________________________________________________
-AliRsnCutSet::AliRsnCutSet(TString name, AliRsnCut::ETarget target) :
- TNamed(name, name),
- fTarget(target),
+AliRsnCutSet::AliRsnCutSet(const char *name, RSNTARGET target) :
+ AliRsnTarget(name, target),
fCuts(0),
fNumOfCuts(0),
fCutScheme(""),
//_____________________________________________________________________________
AliRsnCutSet::AliRsnCutSet(const AliRsnCutSet & copy) :
- TNamed((TNamed) copy),
- fTarget(copy.fTarget),
+ AliRsnTarget(copy),
fCuts(copy.fCuts),
fNumOfCuts(copy.fNumOfCuts),
fCutScheme(copy.fCutScheme),
// Copy constructor
//
+ Int_t i;
+ fBoolValues = new Bool_t[fNumOfCuts];
+ for (i = 0; i < fNumOfCuts; ++i)
+ {
+ fBoolValues[i] = copy.fBoolValues[i];
+ }
+
+ AliRsnExpression::fgCutSet = this;
+}
+
+//_____________________________________________________________________________
+AliRsnCutSet& AliRsnCutSet::operator=(const AliRsnCutSet & copy)
+{
+//
+// Assignment operator.
+//
+
+ AliRsnTarget::operator=(copy);
+
+ fCuts = copy.fCuts;
+ fNumOfCuts = copy.fNumOfCuts;
+ fCutScheme = copy.fCutScheme;
+ fCutSchemeIndexed = copy.fCutSchemeIndexed;
+ fIsScheme = copy.fIsScheme;
+ fExpression = copy.fExpression;
+
+ if (fBoolValues) delete [] fBoolValues;
+
+ Int_t i;
+ fBoolValues = new Bool_t[fNumOfCuts];
+ for (i = 0; i < fNumOfCuts; ++i)
+ {
+ fBoolValues[i] = copy.fBoolValues[i];
+ }
+
AliRsnExpression::fgCutSet = this;
+
+ return (*this);
}
//_____________________________________________________________________________
// the cut is not added.
//
- if (!cut->IsTarget(fTarget))
+ if (!cut->IsTarget(GetTargetType()))
{
- AliError("Cut target does not match the cut-set target. Not added.");
+ AliError(Form("Cannot add this cut (cut set name,target = [%s],[%s] --- cut name,target = [%s],[%s]", GetName(), GetTargetTypeName(), cut->GetName(), cut->GetTargetTypeName()));
return;
}
}
//_____________________________________________________________________________
-Bool_t AliRsnCutSet::IsSelected(TObject *obj1, TObject *obj2)
+Bool_t AliRsnCutSet::IsSelected(TObject *object)
{
//
// Checks an object according to the cut expression defined here.
AliRsnCut *cut;
for (i = 0; i < fNumOfCuts; i++) {
cut = (AliRsnCut*)fCuts.At(i);
- fBoolValues[i] = cut->IsSelected(obj1, obj2);
+ fBoolValues[i] = cut->IsSelected(object);
}
if (fIsScheme) boolReturn = Passed();
// and gives a global response to the cut check
//
+ AliInfo(Form("Name: %s", GetName()));
+
AliRsnExpression::fgCutSet = this;
- if (!fExpression) {
+ if (!fExpression)
+ {
fExpression = new AliRsnExpression(fCutSchemeIndexed);
AliDebug(AliLog::kDebug,"fExpression was created.");
}
+ if (fCuts.IsEmpty()) return kTRUE;
+
return fExpression->Value(*GetCuts());
}
#include <TNamed.h>
#include <TObjArray.h>
+#include "AliRsnTarget.h"
#include "AliRsnCut.h"
class AliRsnDaughter;
class AliRsnPairParticle;
class AliRsnEvent;
-class AliRsnCutSet : public TNamed
+class AliRsnCutSet : public AliRsnTarget
{
public:
- AliRsnCutSet(AliRsnCut::ETarget target = AliRsnCut::kLastCutTarget);
- AliRsnCutSet(TString name, AliRsnCut::ETarget target);
+ AliRsnCutSet();
+ AliRsnCutSet(const char *name, RSNTARGET target);
AliRsnCutSet(const AliRsnCutSet ©);
- AliRsnCutSet& operator=(const AliRsnCutSet& /*copy*/) {return (*this);}
+ AliRsnCutSet& operator=(const AliRsnCutSet& copy);
~AliRsnCutSet();
void AddCut(AliRsnCut* cut);
Int_t TestExpression(TString opt="short");
void PrintSetInfo();
- Bool_t IsSelected(TObject *obj1, TObject *obj2 = 0x0);
+ Bool_t IsSelected(TObject *object);
void SetBoolValue(Bool_t theValue,Int_t index) { fBoolValues[index] = theValue; }
Bool_t GetBoolValue(Int_t index) const { return fBoolValues[index]; }
private:
- AliRsnCut::ETarget fTarget; // cut target
TObjArray fCuts; // array of cuts
Int_t fNumOfCuts; // number of cuts
TString fCutScheme; // cut scheme
//
-// Class AliRsnCutValue
+// *** Class AliRsnCutValue ***
//
-// General implementation of a single cut strategy, which can be:
-// - a value contained in a given interval [--> IsBetween() ]
-// - a value equal to a given reference [--> MatchesValue()]
+// This cut implementation can be used to cut generically on
+// any value which can be computed from AliRsnValue class.
+// Since that value is implemented always as a Double_t one,
+// then this cut operates only with the Double_t data members
+// of the AliRsnCut base class.
+// It allows to cusomize the reference AliRsnValue object by
+// means of a getter that returns a pointer to it.
+// This cut can apply to any kind of object, but the type of
+// target must be one of those for which the chosen value type
+// makes sense to be computed
//
-// In all cases, the reference value(s) is (are) given as data members
-// and each kind of cut requires a given value type (Int, UInt, Double),
-// but the cut check procedure is then automatized and chosen thanks to
-// an enumeration of the implemented cut types.
-// At the end, the user (or any other point which uses this object) has
-// to use the method IsSelected() to check if this cut has been passed.
+// author: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
//
-// authors: Martin Vala (martin.vala@cern.ch)
-// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
-//
-
-#include <TMath.h>
-#include <TLorentzVector.h>
-#include "AliStack.h"
-#include "AliMCEvent.h"
#include "AliRsnDaughter.h"
#include "AliRsnMother.h"
#include "AliRsnEvent.h"
-#include "AliRsnValue.h"
+#include "AliRsnPairDef.h"
#include "AliRsnCutValue.h"
//
// Default constructor.
//
+
+ SetTargetType(fValue.GetTargetType());
}
//_________________________________________________________________________________________________
AliRsnCutValue::AliRsnCutValue
-(const char *name, ETarget target, Double_t min, Double_t max, AliRsnPairDef *pd) :
- AliRsnCut(name, target, min, max),
- fValue(Form("val_%s", name), AliRsnValue::kValueTypes),
+(const char *name, AliRsnValue::EValueType type, Double_t min, Double_t max, AliRsnPairDef *pd) :
+ AliRsnCut(name, AliRsnTarget::kTargetTypes, min, max),
+ fValue(Form("val_%s", name), type),
fPairDef(pd)
{
//
// Main constructor.
+// Recalls the setter for the value type of the AliRsnValue data member,
+// which determines also the type of target to be expected
//
+
+ SetTargetType(fValue.GetTargetType());
}
//_________________________________________________________________________________________________
fPairDef(copy.fPairDef)
{
//
-// Copy constructor
+// Copy constructor.
+// Does not duplicate memory allocation.
//
+
+ SetTargetType(fValue.GetTargetType());
}
//_________________________________________________________________________________________________
AliRsnCutValue& AliRsnCutValue::operator=(const AliRsnCutValue& copy)
{
//
-// Assignment operator
+// Assignment operator.
+// Does not duplicate memory allocation.
//
- (*this) = copy;
+ AliRsnCut::operator=(copy);
+
fValue = copy.fValue;
fPairDef = copy.fPairDef;
+ SetTargetType(fValue.GetTargetType());
return (*this);
}
//_________________________________________________________________________________________________
-Bool_t AliRsnCutValue::IsSelected(TObject *obj1, TObject * /*obj2*/)
+Bool_t AliRsnCutValue::IsSelected(TObject *object)
{
//
// Checks the cut.
-// Calls the appropriate AliRsnValue::Eval() method
-// depending on the type of passed object.
-// It is up to the user to be sure that the association is meaningful
+// Calls the AliRsnValue::Eval() method and then checks its output.
//
- AliRsnDaughter *daughter = dynamic_cast<AliRsnDaughter*>(obj1);
- AliRsnMother *mother = dynamic_cast<AliRsnMother*>(obj1);
-
- if (daughter)
+ // make sure that target of this object matches that
+ // of the inserted value object
+ SetTargetType(fValue.GetTargetType());
+
+ // check target coherence
+ if (!TargetOK(object))
{
- if (!fValue.Eval(daughter, fEvent)) return kFALSE;
- fCutValueD = fValue.GetValue();
+ AliWarning("Returning kFALSE");
+ return kFALSE;
}
- else if (mother)
+
+ // try to compute values
+ Bool_t success = fValue.Eval(object);
+
+ // check success
+ if (!success)
{
- if (!fValue.Eval(mother, fPairDef, fEvent)) return kFALSE;
- fCutValueD = fValue.GetValue();
+ AliWarning(Form("[%s] Failed to compute value", GetName()));
+ return kFALSE;
}
+ // check in range
+ fCutValueD = fValue.GetComputedValue();
return OkRangeD();
}
//
-// Class AliRsnCutRange
+// *** Class AliRsnCutValue ***
//
-// General implementation of cuts which check a value inside a range.
-// This range can be defined by two integers or two doubles.
-// A user-friendly enumeration allows to define what is checked.
+// This cut implementation can be used to cut generically on
+// any value which can be computed from AliRsnValue class.
+// Since that value is implemented always as a Double_t one,
+// then this cut operates only with the Double_t data members
+// of the AliRsnCut base class.
+// It allows to cusomize the reference AliRsnValue object by
+// means of a getter that returns a pointer to it.
+// This cut can apply to any kind of object, but the type of
+// target must be one of those for which the chosen value type
+// makes sense to be computed
//
-// authors: Martin Vala (martin.vala@cern.ch)
-// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
+// author: Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
//
#ifndef ALIRSNCUTVALUE_H
#define ALIRSNCUTVALUE_H
#include "AliRsnCut.h"
+#include "AliRsnValue.h"
-class AliRsnDaughter;
-class AliRsnMother;
-class AliRsnEvent;
+class AliRsnPairDef;
class AliRsnCutValue : public AliRsnCut
{
public:
AliRsnCutValue();
- AliRsnCutValue(const char *name, ETarget target, Double_t min, Double_t max, AliRsnPairDef *pd = 0x0);
+ AliRsnCutValue(const char *name, AliRsnValue::EValueType type, Double_t min, Double_t max, AliRsnPairDef *pd = 0x0);
AliRsnCutValue(const AliRsnCutValue& copy);
AliRsnCutValue& operator=(const AliRsnCutValue& copy);
virtual ~AliRsnCutValue() { }
void SetPairDef(AliRsnPairDef *pd) {fPairDef = pd;}
- AliRsnValue* GetRsnValue() {return &fValue;}
- Double_t GetCutValue() {return fValue.GetValue();}
- virtual Bool_t IsSelected(TObject *obj1, TObject *obj2 = 0x0);
+ AliRsnPairDef* GetPairDef() {return fPairDef;}
+ Double_t GetValue() {return fValue.GetComputedValue();}
+ AliRsnValue* GetValueObj() {return &fValue;}
+
+ virtual Bool_t IsSelected(TObject *object);
protected:
return kTRUE;
}
+
+//_____________________________________________________________________________
+Bool_t AliRsnDaughter::IsKinkDaughter()
+{
+//
+// Checks if this track is a kink daughter.
+// this information is important for some cuts, in some cases
+// and it is retrieved differently from ESDs and AODs, so
+// this is done here in order to have a unique outcome.
+//
+
+ AliESDtrack *etrack = GetRefESDtrack();
+ AliAODTrack *atrack = GetRefAODtrack();
+
+ if (etrack)
+ {
+ return (etrack->GetKinkIndex(0) > 0);
+ }
+ else if (atrack)
+ {
+ AliAODVertex *vertex = atrack->GetProdVertex();
+ if (vertex) if (vertex->GetType() == AliAODVertex::kKink) return kTRUE;
+ }
+
+ return kFALSE;
+}
#include "AliESDtrack.h"
#include "AliESDv0.h"
+#include "AliESDcascade.h"
#include "AliMCParticle.h"
#include "AliAODTrack.h"
#include "AliAODv0.h"
+#include "AliAODcascade.h"
#include "AliAODMCParticle.h"
typedef AliPID::EParticleType EPARTYPE;
{
kTrack = 0,
kV0,
+ kCascade,
kNoType
};
virtual ~AliRsnDaughter() { /*nothing*/ }
// basic getters (for data members)
- Bool_t IsOK() const {return fOK;}
- Int_t GetLabel() const {return fLabel;}
- Int_t GetMotherPDG() const {return fMotherPDG;}
- TLorentzVector& Prec() {return fPrec;}
- TLorentzVector& Psim() {return fPsim;}
- TLorentzVector& P(Bool_t mc = kFALSE) {return (mc ? fPsim : fPrec);}
- AliVParticle* GetRef() {return fRef;}
- AliVParticle* GetRefMC() {return fRefMC;}
+ Bool_t IsOK() const {return fOK;}
+ Int_t GetLabel() const {return fLabel;}
+ Int_t GetMotherPDG() const {return fMotherPDG;}
+ TLorentzVector& Prec() {return fPrec;}
+ TLorentzVector& Psim() {return fPsim;}
+ TLorentzVector& P(Bool_t mc = kFALSE) {return (mc ? fPsim : fPrec);}
+ AliVParticle* GetRef() {return fRef;}
+ AliVParticle* GetRefMC() {return fRefMC;}
// basic setters (for data members)
- void SetBad() {fOK = kFALSE;}
- void SetGood() {fOK = kTRUE;}
- void SetLabel(Int_t label) {fLabel = label;}
- void SetMotherPDG(Int_t value) {fMotherPDG = value;}
- void SetRef(AliVParticle *p) {fRef = p;}
- void SetRefMC(AliVParticle *p = 0x0) {fRefMC = p;}
+ void SetBad() {fOK = kFALSE;}
+ void SetGood() {fOK = kTRUE;}
+ void SetLabel(Int_t label) {fLabel = label;}
+ void SetMotherPDG(Int_t value) {fMotherPDG = value;}
+ void SetRef(AliVParticle *p) {fRef = p;}
+ void SetRefMC(AliVParticle *p = 0x0) {fRefMC = p;}
// charge checkers
Bool_t IsPos() const {return (fRef->Charge() > 0);}
Char_t ChargeChar() const {if (IsPos()) return '+'; else if (IsNeg()) return '-'; else return '0';}
// utilities
- void Reset();
- Int_t GetPDG(Bool_t abs = kTRUE);
- Int_t GetID();
- Bool_t HasFlag(ULong_t flag);
- Bool_t SetMass(Double_t mass);
+ void Reset();
+ Int_t GetPDG(Bool_t abs = kTRUE);
+ Int_t GetID();
+ Bool_t HasFlag(ULong_t flag);
+ Bool_t SetMass(Double_t mass);
+ Bool_t IsKinkDaughter();
// getters which automatically convert refs into allowed types
- AliMCParticle* GetRefMCtrack() {return dynamic_cast<AliMCParticle*>(fRef);}
- AliESDtrack* GetRefESDtrack() {return dynamic_cast<AliESDtrack*>(fRef);}
- AliAODTrack* GetRefAODtrack() {return dynamic_cast<AliAODTrack*>(fRef);}
- AliESDv0* GetRefESDv0() {return dynamic_cast<AliESDv0*>(fRef);}
- AliAODv0* GetRefAODv0() {return dynamic_cast<AliAODv0*>(fRef);}
- AliMCParticle* GetRefMCESD() {return dynamic_cast<AliMCParticle*>(fRefMC);}
- AliAODMCParticle* GetRefMCAOD() {return dynamic_cast<AliAODMCParticle*>(fRefMC);}
- Bool_t IsMC() {if (GetRefMCtrack()) return kTRUE; return kFALSE;}
- Bool_t IsAOD() {if (GetRefAODtrack() || GetRefAODv0()) return kTRUE; return kFALSE;}
- Bool_t IsESD() {if (GetRefESDtrack() || GetRefESDv0()) return kTRUE; return kFALSE;}
- Bool_t IsTrack() {if (GetRefESDtrack() || GetRefAODtrack() || GetRefMCtrack()) return kTRUE; return kFALSE;}
- Bool_t IsV0() {if (GetRefESDv0() || GetRefAODv0()) return kTRUE; return kFALSE;}
- ERefType RefType() {if (IsTrack()) return kTrack; if (IsV0()) return kV0; return kNoType;}
+ AliESDtrack* GetRefESDtrack() {return dynamic_cast<AliESDtrack*>(fRef);}
+ AliESDv0* GetRefESDv0() {return dynamic_cast<AliESDv0*>(fRef);}
+ AliESDcascade* GetRefESDcascade() {return dynamic_cast<AliESDcascade*>(fRef);}
+ AliAODTrack* GetRefAODtrack() {return dynamic_cast<AliAODTrack*>(fRef);}
+ AliAODv0* GetRefAODv0() {return dynamic_cast<AliAODv0*>(fRef);}
+ AliAODcascade* GetRefAODcascade() {return dynamic_cast<AliAODcascade*>(fRef);}
+ AliMCParticle* GetRefMCtrack() {return dynamic_cast<AliMCParticle*>(fRef);}
+ AliMCParticle* GetRefMCESD() {return dynamic_cast<AliMCParticle*>(fRefMC);}
+ AliAODMCParticle* GetRefMCAOD() {return dynamic_cast<AliAODMCParticle*>(fRefMC);}
+
+ // check the input type
+ Bool_t IsMC() {if (GetRefMCtrack()) return kTRUE; return kFALSE;}
+ Bool_t IsAOD() {if (GetRefAODtrack() || GetRefAODv0()) return kTRUE; return kFALSE;}
+ Bool_t IsESD() {if (GetRefESDtrack() || GetRefESDv0()) return kTRUE; return kFALSE;}
+ Bool_t IsTrack() {if (GetRefESDtrack() || GetRefAODtrack() || GetRefMCtrack()) return kTRUE; return kFALSE;}
+ Bool_t IsV0() {if (GetRefESDv0() || GetRefAODv0()) return kTRUE; return kFALSE;}
+ Bool_t IsCascade() {if (GetRefESDcascade() || GetRefAODcascade()) return kTRUE; return kFALSE;}
+ ERefType RefType() {if (IsTrack()) return kTrack; if (IsV0()) return kV0; if (IsCascade()) return kCascade; return kNoType;}
private:
Bool_t fOK; // internal utility flag which is kFALSE when this object should not be used
- Int_t fLabel; // GEANT label of corresponding MC (not trivial for V0s)
+ Int_t fLabel; // GEANT label of corresponding MC
Int_t fMotherPDG; // PDG code of mother (makes sense only if fRefMC is defined)
TLorentzVector fPrec; // 4-vector filled with track info from default ref (if present)
// of the V0 point to the same mother.
// Returns kFALSE whenever the operation fails (out of range, NULL references).
//
-
- Int_t result = 0;
- if (IsESD() && type == AliRsnDaughter::kTrack) result = SetDaughterESDtrack(out, i);
- if (IsAOD() && type == AliRsnDaughter::kTrack) result = SetDaughterAODtrack(out, i);
- if (IsESD() && type == AliRsnDaughter::kV0 ) result = SetDaughterESDv0 (out, i);
- if (IsAOD() && type == AliRsnDaughter::kV0 ) result = SetDaughterAODv0 (out, i);
+ if (IsESD() && type == AliRsnDaughter::kTrack ) return SetDaughterESDtrack (out, i);
+ if (IsAOD() && type == AliRsnDaughter::kTrack ) return SetDaughterAODtrack (out, i);
+ if (IsESD() && type == AliRsnDaughter::kV0 ) return SetDaughterESDv0 (out, i);
+ if (IsAOD() && type == AliRsnDaughter::kV0 ) return SetDaughterAODv0 (out, i);
+ if (IsESD() && type == AliRsnDaughter::kCascade) return SetDaughterESDcascade(out, i);
+ if (IsAOD() && type == AliRsnDaughter::kCascade) return SetDaughterAODcascade(out, i);
- return (result == 0);
+ return kFALSE;
}
//_____________________________________________________________________________
return d;
}
+//_____________________________________________________________________________
+Int_t AliRsnEvent::GetAbsoluteSum()
+{
+//
+// Utility method that returns the sum of all daughter-like objects:
+// tracks, V0s and cascades
+//
+
+ Int_t total = 0;
+
+ total += fRef->GetNumberOfTracks();
+ total += fRef->GetNumberOfV0s();
+ total += fRef->GetNumberOfCascades();
+
+ return total;
+}
+
+//_____________________________________________________________________________
+Bool_t AliRsnEvent::ConvertAbsoluteIndex(Int_t index, Int_t &realIndex, AliRsnDaughter::ERefType &type)
+{
+//
+// Using the phylosophy of the absolute index, which loops over
+// all tracks, V0s and cascades, returns the result of a check
+// on it (first argument) based on this criterion:
+// 1) if the absolute ID is smaller than number of tracks,
+// return itself and the type 'track'
+// 2) if the absolute ID is larger than number of tracks, subtract it
+// and if the result is smaller than number of V0s,
+// return the corresponding V0 index and type
+// 3) if the absolute ID is larger than number of tracks + V0s, subtract them
+// and if the result is smaller than number of cascades,
+// return the corresponding cascade index and type
+// The results of this check are stored in the reference arguments, while the outcome of
+// the function is kTRUE if one of these checks was successful, otherwise it is kFALSE,
+// meaning that the absolute index reached the end.
+//
+
+ Int_t nTracks = fRef->GetNumberOfTracks();
+ Int_t nV0s = fRef->GetNumberOfV0s();
+ Int_t nCascades = fRef->GetNumberOfCascades();
+
+ if (index < nTracks)
+ {
+ realIndex = index;
+ type = AliRsnDaughter::kTrack;
+ return kTRUE;
+ }
+ else if (index >= nTracks && index < nTracks + nV0s)
+ {
+ realIndex = index - nTracks;
+ type = AliRsnDaughter::kV0;
+ return kTRUE;
+ }
+ else if (index >= nTracks + nV0s && index < nTracks + nV0s + nCascades)
+ {
+ realIndex = index - nTracks - nV0s;
+ type = AliRsnDaughter::kCascade;
+ return kTRUE;
+ }
+
+ realIndex = -1;
+ type = AliRsnDaughter::kNoType;
+ return kFALSE;
+}
+
//_____________________________________________________________________________
Int_t AliRsnEvent::GetMultiplicity(AliESDtrackCuts *cuts)
{
}
//_____________________________________________________________________________
-Int_t AliRsnEvent::SetDaughterESDtrack(AliRsnDaughter &out, Int_t i)
+Bool_t AliRsnEvent::SetDaughterESDtrack(AliRsnDaughter &out, Int_t i)
{
//
// Setup the first argument to the track identified by the index.
if (i < 0 || i >= fRef->GetNumberOfTracks())
{
out.SetBad();
- return 1;
+ return kFALSE;
}
// check 2: not NULL object
if (!track)
{
out.SetBad();
- return 2;
+ return kFALSE;
}
// assign references of reconstructed track
out.SetLabel(label);
out.SetGood();
- // search for MC track, if available
- AliMCEvent *mc = GetRefMCESD();
- if (!mc) return 0;
-
- // loop on particles using the track label as reference
- // and then assign also the mother type, if found
- AliStack *stack = mc->Stack();
- if (label >= 0 && label < stack->GetNtrack())
- {
- TParticle *part = stack->Particle(label);
- if (part)
- {
- Int_t imum = part->GetFirstMother();
- if (imum >= 0 && imum <= stack->GetNtrack())
- {
- TParticle *mum = stack->Particle(imum);
- if (mum) out.SetMotherPDG(TMath::Abs(mum->GetPdgCode()));
- }
- }
- else
- {
- return 3;
- }
- }
-
- return 0;
+ // assign MC info, if available
+ return SetMCInfoESD(out);
}
//_____________________________________________________________________________
-Int_t AliRsnEvent::SetDaughterAODtrack(AliRsnDaughter &out, Int_t i)
+Bool_t AliRsnEvent::SetDaughterAODtrack(AliRsnDaughter &out, Int_t i)
{
//
// Setup the first argument to the track identified by the index.
if (i < 0 || i >= fRef->GetNumberOfTracks())
{
out.SetBad();
- return 1;
+ return kFALSE;
}
// check 2: not NULL object
if (!track)
{
out.SetBad();
- return 2;
+ return kFALSE;
}
// assign references of reconstructed track
out.SetLabel(label);
out.SetGood();
- // search for MC track, if available
- AliAODEvent *mc = GetRefMCAOD();
- if (!mc) return 0;
-
- // loop on particles using the track label as reference
- // and then assign also the mother type, if found
- TClonesArray *mcArray = (TClonesArray*)mc->GetList()->FindObject(AliAODMCParticle::StdBranchName());
- if(!mcArray) return 0;
- TObjArrayIter next(mcArray);
- AliAODMCParticle *part = 0x0;
- while ( (part = (AliAODMCParticle*)next()) )
- {
- if (TMath::Abs(part->GetLabel()) == label)
- {
- out.SetRefMC(part);
- Int_t imum = part->GetMother();
- if (imum >= 0 && imum <= mcArray->GetEntriesFast())
- {
- AliAODMCParticle *mum = (AliAODMCParticle*)mcArray->At(imum);
- if (mum) out.SetMotherPDG(TMath::Abs(mum->GetPdgCode()));
- }
- break;
- }
- }
-
- return 0;
+ // assign MC info, if available
+ return SetMCInfoAOD(out);
}
//_____________________________________________________________________________
-Int_t AliRsnEvent::SetDaughterESDv0(AliRsnDaughter &out, Int_t i)
+Bool_t AliRsnEvent::SetDaughterESDv0(AliRsnDaughter &out, Int_t i)
{
//
// Setup the first argument to the track identified by the index.
if (pp->GetFirstMother() == pn->GetFirstMother()) out.SetLabel(pp->GetFirstMother());
}
- return 0;
+ // assign MC info, if available
+ return SetMCInfoESD(out);
}
//_____________________________________________________________________________
-Int_t AliRsnEvent::SetDaughterAODv0(AliRsnDaughter &out, Int_t i)
+Bool_t AliRsnEvent::SetDaughterAODv0(AliRsnDaughter &out, Int_t i)
{
//
// Setup the first argument to the track identified by the index.
if (i > fRef->GetNumberOfV0s())
{
out.SetBad();
- return 1;
+ return kFALSE;
}
// check 2: not NULL object
if (!v0)
{
out.SetBad();
- return 2;
+ return kFALSE;
}
// assign references of reconstructed track
if (TMath::Abs(part->GetLabel()) == ln) pn = (AliAODMCParticle*)mcArray->IndexOf(part);
}
// assign a MC reference and a label only to true V0s
- if (pp->GetMother() == pn->GetMother())
+ if (pp->GetMother() == pn->GetMother()) out.SetLabel(pp->GetMother());
+ }
+
+ // assign MC info, if available
+ return SetMCInfoAOD(out);
+}
+
+//_____________________________________________________________________________
+Bool_t AliRsnEvent::SetDaughterESDcascade(AliRsnDaughter &out, Int_t i)
+{
+//
+// Setup the first argument to the track identified by the index.
+// When available, adds the MC information and references.
+// ---
+// Version #3: ESD cascade
+//
+
+ return kTRUE;
+}
+
+//_____________________________________________________________________________
+Bool_t AliRsnEvent::SetDaughterAODcascade(AliRsnDaughter &out, Int_t i)
+{
+//
+// Setup the first argument to the track identified by the index.
+// When available, adds the MC information and references.
+// ---
+// Version #4: AOD cascade
+//
+
+ return kTRUE;
+}
+
+//_____________________________________________________________________________
+Bool_t AliRsnEvent::SetMCInfoESD(AliRsnDaughter &out)
+{
+//
+// Using the label assigned to the daughter, searches for the MC informations:
+// -- MC reference
+// -- mother
+//
+
+ Int_t label = out.GetLabel();
+ if (label < 0) return kFALSE;
+
+ // if no MC reference is available, exit here (successfully)
+ AliMCEvent *mc = GetRefMCESD();
+ if (!mc) return kTRUE;
+ Int_t nMC = mc->GetNumberOfTracks();
+
+ // assign MC reference, being aware of eventual
+ // overflows in the array (sometimes happened)
+ if (label < 0 || label >= nMC)
+ {
+ AliWarning(Form("Stack overflow: track label = %d -- stack maximum = %d", label, nMC));
+ return kFALSE;
+ }
+ AliMCParticle *mcPart = (AliMCParticle*)mc->GetTrack(label);
+ if (!mcPart)
+ {
+ AliWarning(Form("Stack discontinuity: label %d refers to a NULL object", label));
+ return kFALSE;
+ }
+ out.SetRefMC(mcPart);
+
+ // if this is a primary track, exit here (successfully)
+ Int_t imum = mcPart->Particle()->GetFirstMother();
+ if (imum < 0) return kTRUE;
+
+ // if didn't stop there, search for the mother
+ if (imum >= nMC)
+ {
+ AliWarning(Form("Stack overflow: track mother label = %d -- stack maximum = %d", label, nMC));
+ return kFALSE;
+ }
+ AliMCParticle *mcMother = (AliMCParticle*)mc->GetTrack(imum);
+ if (!mcMother)
+ {
+ AliWarning(Form("Stack discontinuity: label %d refers to a NULL object", imum));
+ return kFALSE;
+ }
+ out.SetMotherPDG(TMath::Abs(mcMother->Particle()->GetPdgCode()));
+
+ return kTRUE;
+}
+
+//_____________________________________________________________________________
+Bool_t AliRsnEvent::SetMCInfoAOD(AliRsnDaughter &out)
+{
+//
+// Using the label assigned to the daughter, searches for the MC informations:
+// -- MC reference
+// -- mother
+//
+
+ Int_t label = out.GetLabel();
+ if (label < 0) return kFALSE;
+
+ // if no MC reference is available, exit here (successfully)
+ AliAODEvent *mc = GetRefMCAOD();
+ if (!mc) return kTRUE;
+
+ // loop on particles using the track label as reference
+ // and then assign also the mother type, if found
+ TClonesArray *mcArray = (TClonesArray*)mc->GetList()->FindObject(AliAODMCParticle::StdBranchName());
+ if(!mcArray) return kFALSE;
+ TObjArrayIter next(mcArray);
+ AliAODMCParticle *part = 0x0;
+ while ( (part = (AliAODMCParticle*)next()) )
+ {
+ if (TMath::Abs(part->GetLabel()) == label)
{
- AliAODMCParticle *mcv0 = (AliAODMCParticle*)mcArray->At(pp->GetMother());
- out.SetRefMC(mcv0);
- out.SetLabel(pp->GetMother());
- Int_t imum = mcv0->GetMother();
+ out.SetRefMC(part);
+ Int_t imum = part->GetMother();
if (imum >= 0 && imum <= mcArray->GetEntriesFast())
{
AliAODMCParticle *mum = (AliAODMCParticle*)mcArray->At(imum);
if (mum) out.SetMotherPDG(TMath::Abs(mum->GetPdgCode()));
}
+ else
+ {
+ AliWarning(Form("Array overflow: track mother label = %d -- stack maximum = %d", imum, mcArray->GetEntriesFast()));
+ return kFALSE;
+ }
+
+ // if a MC reference is found, there is no need to go on with the loop
+ break;
}
}
- return 0;
+ return kTRUE;
}
virtual ~AliRsnEvent() { /*nothing*/ }
// basic setters/getters
- void SetRef(AliVEvent *ref) {fRef = ref;}
- void SetRefMC(AliVEvent *refmc) {fRefMC = refmc;}
- void SetLeadingIndex(Int_t i) {fLeading = i;}
- AliVEvent* GetRef() {return fRef;}
- AliVEvent* GetRefMC() {return fRefMC;}
- Int_t GetLeadingIndex() const {return fLeading;}
+ void SetRef (AliVEvent *ref) {fRef = ref;}
+ void SetRefMC(AliVEvent *refmc) {fRefMC = refmc;}
+ void SetLeadingIndex(Int_t i) {fLeading = i;}
+ AliVEvent* GetRef() {return fRef;}
+ AliVEvent* GetRefMC() {return fRefMC;}
+ Int_t GetLeadingIndex() const {return fLeading;}
+ Int_t GetLeadingParticleID() const {return fLeading;}
// getters which convert into allowed input types
AliESDEvent* GetRefESD() {return dynamic_cast<AliESDEvent*>(fRef);}
AliAODEvent* GetRefAOD() {return dynamic_cast<AliAODEvent*>(fRef);}
- AliMCEvent* GetRefMCESD() {return dynamic_cast<AliMCEvent*>(fRefMC);}
+ AliMCEvent* GetRefMCESD() {return dynamic_cast<AliMCEvent*> (fRefMC);}
AliAODEvent* GetRefMCAOD() {return dynamic_cast<AliAODEvent*>(fRefMC);}
Bool_t IsESD() {return (GetRefESD() != 0x0);}
Bool_t IsAOD() {return (GetRefAOD() != 0x0);}
Int_t GetMultiplicity(AliESDtrackCuts *cuts = 0x0);
// setters for a daughter
- Bool_t SetDaughter(AliRsnDaughter &daughter, Int_t index, AliRsnDaughter::ERefType type = AliRsnDaughter::kTrack);
+ Bool_t SetDaughter (AliRsnDaughter &daughter, Int_t index, AliRsnDaughter::ERefType type = AliRsnDaughter::kTrack);
Bool_t SetDaughterMC(AliRsnDaughter &daughter, Int_t index);
- AliRsnDaughter GetDaughter(Int_t i, AliRsnDaughter::ERefType type = AliRsnDaughter::kTrack);
+ AliRsnDaughter GetDaughter (Int_t i, AliRsnDaughter::ERefType type = AliRsnDaughter::kTrack);
AliRsnDaughter GetDaughterMC(Int_t i);
+ Int_t GetAbsoluteSum();
+ Bool_t ConvertAbsoluteIndex(Int_t index, Int_t &realIndex, AliRsnDaughter::ERefType &type);
// leading particle stuff
- Int_t SelectLeadingParticle(Double_t ptMin = 0.0, AliRsnCutPID *cutPID = 0x0);
- Int_t GetLeadingParticleID() {return fLeading;}
void SetLeadingParticle(AliRsnDaughter &leading) {if (fLeading >= 0) SetDaughter(leading, fLeading);}
+ Int_t SelectLeadingParticle(Double_t ptMin = 0.0, AliRsnCutPID *cutPID = 0x0);
Double_t GetAverageMomentum(Int_t &count, AliRsnCutPID *cutPID = 0x0);
Bool_t GetAngleDistr(Double_t &angleMean, Double_t &angleRMS, AliRsnDaughter reference);
private:
- Int_t SetDaughterESDtrack(AliRsnDaughter &target, Int_t index);
- Int_t SetDaughterAODtrack(AliRsnDaughter &target, Int_t index);
- Int_t SetDaughterESDv0 (AliRsnDaughter &target, Int_t index);
- Int_t SetDaughterAODv0 (AliRsnDaughter &target, Int_t index);
+ Bool_t SetDaughterESDtrack (AliRsnDaughter &target, Int_t index);
+ Bool_t SetDaughterAODtrack (AliRsnDaughter &target, Int_t index);
+ Bool_t SetDaughterESDv0 (AliRsnDaughter &target, Int_t index);
+ Bool_t SetDaughterAODv0 (AliRsnDaughter &target, Int_t index);
+ Bool_t SetDaughterESDcascade(AliRsnDaughter &target, Int_t index);
+ Bool_t SetDaughterAODcascade(AliRsnDaughter &target, Int_t index);
+ Bool_t SetMCInfoESD (AliRsnDaughter &target);
+ Bool_t SetMCInfoAOD (AliRsnDaughter &target);
AliVEvent *fRef; // pointer to input event
AliVEvent *fRefMC; // pointer to reference MC event (if any)
//________________________________________________________________________________________
AliRsnFunction::AliRsnFunction(Bool_t useTH1) :
- TObject(),
- fPairDef(0x0),
- fAxisList("AliRsnValue", 0),
- fPair(0x0),
- fEvent(0x0),
- fUseTH1(useTH1),
- fSize(0),
- fH1(0x0),
- fHSparse(0x0)
+ TObject(),
+ fPairDef(0x0),
+ fAxisList("AliRsnValue", 0),
+ fPair(0x0),
+ fEvent(0x0),
+ fUseTH1(useTH1),
+ fSize(0),
+ fH1(0x0),
+ fHSparse(0x0)
{
//
// Constructor.
//________________________________________________________________________________________
AliRsnFunction::AliRsnFunction(const AliRsnFunction ©) :
- TObject(copy),
- fPairDef(copy.fPairDef),
- fAxisList(copy.fAxisList),
- fPair(copy.fPair),
- fEvent(copy.fEvent),
- fUseTH1(copy.fUseTH1),
- fSize(copy.fSize),
- fH1(0x0),
- fHSparse(0x0)
+ TObject(copy),
+ fPairDef(copy.fPairDef),
+ fAxisList(copy.fAxisList),
+ fPair(copy.fPair),
+ fEvent(copy.fEvent),
+ fUseTH1(copy.fUseTH1),
+ fSize(copy.fSize),
+ fH1(0x0),
+ fHSparse(0x0)
{
//
// Copy constructor.
// Assignment operator.
//
- //SetName(copy.GetName());
- //SetTitle(copy.GetTitle());
-
fPairDef = copy.fPairDef;
fPair = copy.fPair;
fEvent = copy.fEvent;
TObjArrayIter next(&fAxisList);
AliRsnValue *axis = 0;
- while ((axis = (AliRsnValue*)next())) {
+ while ((axis = (AliRsnValue*)next()))
+ {
if (name.Length() > 1) name += '_';
name += axis->GetName();
}
}
//________________________________________________________________________________________
-void AliRsnFunction::AddAxis(AliRsnValue *const axis)
+Bool_t AliRsnFunction::AddAxis(AliRsnValue *const axis)
{
- AliDebug(AliLog::kDebug+2,"<-");
+//
+// Try to add a new axis to this function.
+// The operation succeeds only if the related value object
+// has a target amon those allowed here (AliRsnMother, AliRsnEvent),
+// otherwise the axis is not added.
+//
+// If more than 3 axes are added, switch to THnSparseF output.
+// NOTE: this can cause large files and high memory occupancy.
+//
+
+ RSNTARGET target = axis->GetTargetType();
+ if (target != AliRsnTarget::kMother && target != AliRsnTarget::kEvent)
+ {
+ AliError(Form("Allowed targets are mothers and events; cannot use axis '%s' which has target '%s'", axis->GetName(), axis->GetTargetTypeName()));
+ return kFALSE;
+ }
+
Int_t size = fAxisList.GetEntries();
- new(fAxisList[size]) AliRsnValue(*axis);
- AliDebug(AliLog::kDebug+2,"->");
+ new (fAxisList[size]) AliRsnValue(*axis);
if (fAxisList.GetEntries() > 3)
{
- AliWarning("A TH1-type output cannot add more than 3 axes: switching to THnSparse -- THIS COULD CAUSE VERY LARGE FILES!!!");
+ AliWarning("Adding more than 3 axes will produce a THnSparseD output.");
fUseTH1 = kFALSE;
}
+
+ return kTRUE;
}
//________________________________________________________________________________________
//
fSize = fAxisList.GetEntries();
- if (!fSize) {
+ if (!fSize)
+ {
AliError("No axes defined");
return 0x0;
}
- else if (fSize < 1 || fSize > 3)
+ else if (fSize > 3)
{
- AliError("Too few or too many axes defined");
+ AliError("Too many axes defined for a TH1 object");
return 0x0;
}
//
fSize = fAxisList.GetEntries();
- if (!fSize) {
+ if (!fSize)
+ {
AliError("No axes defined");
return 0x0;
}
Int_t i;
Double_t *values = new Double_t[fSize];
+ Bool_t computeOK = kFALSE;
AliRsnValue *fcnAxis = 0;
- for (i = 0; i < fSize; i++) {
+ for (i = 0; i < fSize; i++)
+ {
+ values[i] = 0.0;
fcnAxis = (AliRsnValue*)fAxisList.At(i);
- if (!fcnAxis)
+ if (!fcnAxis) continue;
+ switch (fcnAxis->GetTargetType())
{
- values[i] = 0.0;
- continue;
+ case AliRsnTarget::kMother:
+ fcnAxis->SetSupportObject(fPairDef);
+ computeOK = fcnAxis->Eval(fPair);
+ break;
+ case AliRsnTarget::kEvent:
+ computeOK = fcnAxis->Eval(fEvent);
+ break;
+ default:
+ AliError(Form("Allowed targets are mothers and events; cannot use axis '%s' which has target '%s'", fcnAxis->GetName(), fcnAxis->GetTargetTypeName()));
+ computeOK = kFALSE;
}
- if (fcnAxis->Eval(fPair, fPairDef, fEvent)) values[i] = (Double_t)((Float_t)fcnAxis->GetValue());
+ if (computeOK) values[i] = ((Float_t)fcnAxis->GetComputedValue());
}
// fill histogram
if (fUseTH1)
{
// check presence of output histogram
- if (!fH1) {
+ if (!fH1)
+ {
AliError("Required a TH1 which is not initialized");
delete [] values;
return kFALSE;
else
{
// check presence of output histogram
- if (!fHSparse) {
+ if (!fHSparse)
+ {
AliError("Required a THnSparseF which is not initialized");
delete [] values;
return kFALSE;
Bool_t IsUsingTH1() {return fUseTH1;}
void UseTH1() {fUseTH1 = kTRUE;}
void UseSparse() {fUseTH1 = kFALSE;}
- void AddAxis(AliRsnValue* const axis);
+ Bool_t AddAxis(AliRsnValue* const axis);
Int_t GetNumberOfAxes() {return fAxisList.GetEntries();}
TH1* CreateHistogram(const char *histoName, const char *histoTitle);
THnSparseF* CreateHistogramSparse(const char *histoName, const char *histoTitle);
//_____________________________________________________________________________
AliRsnMother::AliRsnMother() :
fUseMC(kFALSE),
- fDefaultMass(0.0),
fSum(),
- fSumMC(),
- fRef(),
- fRefMC()
+ fSumMC()
{
//
// Constructor.
AliRsnMother::AliRsnMother(const AliRsnMother &obj) :
TObject(obj),
fUseMC(obj.fUseMC),
- fDefaultMass(obj.fDefaultMass),
fSum(obj.fSum),
- fSumMC(obj.fSumMC),
- fRef(obj.fRef),
- fRefMC(obj.fRefMC)
+ fSumMC(obj.fSumMC)
{
//
// Copy constructor.
Int_t i;
- fDefaultMass = obj.fDefaultMass;
fSum = obj.fSum;
- fRef = obj.fRef;
fSumMC = obj.fSumMC;
- fRefMC = obj.fRefMC;
for (i = 0; i < 2; i++) fDaughter[i] = obj.fDaughter[i];
fSum = fDaughter[0]->P(kFALSE) + fDaughter[1]->P(kFALSE);
fSumMC = fDaughter[0]->P(kTRUE) + fDaughter[1]->P(kTRUE);
-
- fRef .SetXYZM(fSum .X(), fSum .Y(), fSum .Z(), fDefaultMass);
- fRefMC.SetXYZM(fSumMC.X(), fSumMC.Y(), fSumMC.Z(), fDefaultMass);
}
//_____________________________________________________________________________
for (i = 0; i < 2; i++) fDaughter[i] = 0x0;
fSum .SetXYZM(0.0, 0.0, 0.0, 0.0);
- fRef .SetXYZM(0.0, 0.0, 0.0, 0.0);
fSumMC.SetXYZM(0.0, 0.0, 0.0, 0.0);
- fRefMC.SetXYZM(0.0, 0.0, 0.0, 0.0);
}
//_____________________________________________________________________________
TLorentzVector daughter0 = (first ? fDaughter[0]->P() : fDaughter[1]->P());
TLorentzVector daughter1 = (first ? fDaughter[1]->P() : fDaughter[0]->P());
TVector3 momentumM (mother.Vect());
- //cout << mother.Vect().X() << ' ' << mother.Vect().Y() << ' ' << mother.Vect().Z() << endl;
TVector3 normal (mother.Y()/momentumM.Mag(), -mother.X()/momentumM.Mag(), 0.0);
- //cout << momentumM.Mag() << ' ' << normal.X() << ' ' << normal.Y() << ' ' << normal.Z() << endl;
-
-// Computes first the invariant mass of the mother
+ // Computes first the invariant mass of the mother
Double_t mass0 = fDaughter[0]->P().M();
Double_t mass1 = fDaughter[1]->P().M();
Double_t p0 = daughter0.Vect().Mag();
Double_t MotherMass = TMath::Sqrt((E0+E1)*(E0+E1)-(p0*p0+2.0*daughter0.Vect().Dot(daughter1.Vect())+p1*p1));
MotherMass = fSum.M();
-// Computes components of beta
-
- Double_t betaX = -mother.X()/mother.E(); //TMath::Sqrt(momentumM.Mag()*momentumM.Mag()+MotherMass*MotherMass);
- Double_t betaY = -mother.Y()/mother.E(); //TMath::Sqrt(momentumM.Mag()*momentumM.Mag()+MotherMass*MotherMass);
- Double_t betaZ = -mother.Z()/mother.E(); //TMath::Sqrt(momentumM.Mag()*momentumM.Mag()+MotherMass*MotherMass);
-
-// Computes Lorentz transformation of the momentum of the first daughter
-// into the rest frame of the mother and theta*
- //cout << "Beta = " << betaX << ' ' << betaY << ' ' << betaZ << endl;
+ // Computes components of beta
+ Double_t betaX = -mother.X()/mother.E();
+ Double_t betaY = -mother.Y()/mother.E();
+ Double_t betaZ = -mother.Z()/mother.E();
+ // Computes Lorentz transformation of the momentum of the first daughter
+ // into the rest frame of the mother and theta*
daughter0.Boost(betaX,betaY,betaZ);
TVector3 momentumD = daughter0.Vect();
Double_t cosThetaStar = normal.Dot(momentumD)/momentumD.Mag();
return cosThetaStar;
-
}
//_____________________________________________________________________________
AliRsnMother& operator=(const AliRsnMother &obj);
virtual ~AliRsnMother();
- void SetDefaultMass(Double_t mass) {fDefaultMass = mass; fRef.SetXYZM(fSum.X(),fSum.Y(),fSum.Z(),mass); fRefMC.SetXYZM(fSumMC.X(),fSumMC.Y(),fSumMC.Z(),mass);}
TLorentzVector& Sum() {return fSum;}
- TLorentzVector& Ref() {return fRef;}
TLorentzVector& SumMC() {return fSumMC;}
- TLorentzVector& RefMC() {return fRefMC;}
- Double_t OpeningAngle(Bool_t mc = kFALSE) const {if (fDaughter[0] && fDaughter[1]) return fDaughter[0]->P(mc).Angle(fDaughter[1]->P(mc).Vect()); return 1E6;}
Double_t AngleTo(AliRsnDaughter track, Bool_t mc = kFALSE) const {return fSum.Angle(track.P(mc).Vect());}
Double_t CosThetaStar(Bool_t first = kTRUE, Bool_t useMC = kFALSE);
private:
Bool_t fUseMC; // choose if momenta are taken from ESD/AOD or MC
- Double_t fDefaultMass; // nominal resonance mass
AliRsnDaughter *fDaughter[2]; // elements of the pair
TLorentzVector fSum; // sum computed from the two daughters
TLorentzVector fSumMC; // sum computed from the two daughters
- TLorentzVector fRef; // a 4-vector with same momentum as the sum but the nominal mass of mother
- TLorentzVector fRefMC; // a 4-vector with same momentum as the sum but the nominal mass of mother
ClassDef(AliRsnMother,1)
};
// M. Vala (email: martin.vala@cern.ch)
//
-#include <Riostream.h>
#include <TList.h>
#include "AliLog.h"
#include "AliRsnEvent.h"
#include "AliRsnFunction.h"
#include "AliRsnCutSet.h"
-#include "AliRsnCutStd.h"
#include "AliRsnValue.h"
#include "AliRsnCutManager.h"
//
// Default constructor
//
-
- AliDebug(AliLog::kDebug+2,"<-");
- AliDebug(AliLog::kDebug+2,"->");
}
//_____________________________________________________________________________
//
// Default constructor
//
-
- AliDebug(AliLog::kDebug+2,"<-");
- AliDebug(AliLog::kDebug+2,"->");
}
//_____________________________________________________________________________
//
// 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("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,"->");
}
//_____________________________________________________________________________
if (!fMother.CommonMother(m0, m1)) return kFALSE;
if (m0 < 0 || m1 < 0) return kFALSE;
- //cout << "Checking a true pair..." << endl;
+ AliDebug(AliLog::kDebug+2, "Checking a true pair...");
// if they do, is this mother the correct type?
Int_t mpdg0 = TMath::Abs(daughter0->GetMotherPDG());
Int_t mpdg1 = TMath::Abs(daughter1->GetMotherPDG());
Int_t mpdg = TMath::Abs(fPairDef->GetMotherPDG());
- if (mpdg0 != mpdg) return kFALSE; //{cout << "Mother of d0 is " << mpdg0 << " instead of " << mpdg << endl; return kFALSE;}
- if (mpdg1 != mpdg) return kFALSE; //{cout << "Mother of d1 is " << mpdg1 << " instead of " << mpdg << endl; return kFALSE;}
+ if (mpdg0 != mpdg)
+ {
+ AliDebug(AliLog::kDebug+2, Form("Mother of d0 is %d instead of %d", mpdg0, mpdg));
+ return kFALSE;
+ }
+ if (mpdg1 != mpdg)
+ {
+ AliDebug(AliLog::kDebug+2, Form("Mother of d1 is %d instead of %d", mpdg1, mpdg));
+ return kFALSE;
+ }
// do they match the expected decay channel (that is, are they the expected types)?
if (fCheckDecay)
{
- //cout << "Checking decay tree..." << endl;
+ AliDebug(AliLog::kDebug, "Checking decay tree...");
Int_t pdg0 = TMath::Abs(daughter0->GetPDG());
Int_t pdg1 = TMath::Abs(daughter1->GetPDG());
- if (AliPID::ParticleCode(fPairDef->GetPID(0)) != pdg0) return kFALSE; // {cout << "PDG0 is " << pdg0 << " instead of " << fPairDef->GetPID(0) << endl; return kFALSE;};
- if (AliPID::ParticleCode(fPairDef->GetPID(1)) != pdg1) return kFALSE; // {cout << "PDG1 is " << pdg1 << " instead of " << fPairDef->GetPID(1) << endl; return kFALSE;};
- //cout << "Decay tree accepted!" << endl;
+ if (AliPID::ParticleCode(fPairDef->GetPID(0)) != pdg0)
+ {
+ AliDebug(AliLog::kDebug+2, Form("PDG0 is %d instead of %d", pdg0, fPairDef->GetPID(0)));
+ return kFALSE;
+ }
+ if (AliPID::ParticleCode(fPairDef->GetPID(1)) != pdg1)
+ {
+ AliDebug(AliLog::kDebug+2, Form("PDG1 is %d instead of %d", pdg1, fPairDef->GetPID(1)));
+ return kFALSE;
+ }
+ AliDebug(AliLog::kDebug, "Decay tree accepted");
}
// ok... if we arrive here that must really be a true pair! :-)
- //cout << "Pair accepted!" << endl;
+ AliDebug(AliLog::kDebug+2, "Pair accepted");
}
AliDebug(AliLog::kDebug+2,"->");
AliRsnMother* GetMother() {return &fMother;}
AliRsnPairDef* GetPairDef() {return fPairDef;}
Bool_t Fill(AliRsnDaughter *d0, AliRsnDaughter *d1, AliRsnEvent *ev1, AliRsnEvent *ev2);
+
virtual void Compute();
virtual void Init(const char *prefix, TList *list);
#include "AliRsnEvent.h"
#include "AliRsnFunction.h"
#include "AliRsnCutSet.h"
-#include "AliRsnCutStd.h"
#include "AliRsnValue.h"
#include "AliRsnPairFunctions.h"
#include "AliRsnEvent.h"
#include "AliRsnFunction.h"
#include "AliRsnCutSet.h"
-#include "AliRsnCutStd.h"
#include "AliRsnValue.h"
#include "AliRsnPairNtuple.h"
Int_t i, n = fValues.GetEntries();
TArrayF values(n);
AliRsnValue *value = 0x0;
+ Bool_t computeOK = kFALSE;
for (i = 0; i < n; i++)
{
values[i] = -1E10;
value = (AliRsnValue*)fValues[i];
- if (value->Eval(&fMother, fPairDef, fEvent)) values[i] = (Float_t)value->GetValue();
+ switch (value->GetTargetType())
+ {
+ case AliRsnTarget::kMother:
+ value->SetSupportObject(fPairDef);
+ computeOK = value->Eval(&fMother);
+ break;
+ case AliRsnTarget::kEvent:
+ computeOK = value->Eval(fEvent);
+ break;
+ default:
+ AliError(Form("Allowed targets are mothers and events; cannot use axis '%s' which has target '%s'", value->GetName(), value->GetTargetTypeName()));
+ computeOK = kFALSE;
+ }
+ if (computeOK) values[i] = ((Float_t)value->GetComputedValue());
}
fNtuple->Fill(values.GetArray());
}
//_____________________________________________________________________________
-void AliRsnPairNtuple::AddValue(AliRsnValue *const val)
+Bool_t AliRsnPairNtuple::AddValue(AliRsnValue *const val)
{
//
-// Adds a new computing function
+// Adds a new computing function.
//
- AliDebug(AliLog::kDebug+2,"<-");
+ RSNTARGET target = val->GetTargetType();
+ if (target != AliRsnTarget::kMother && target != AliRsnTarget::kEvent)
+ {
+ AliError(Form("Allowed targets are mothers and events; cannot use axis '%s' which has target '%s'", val->GetName(), val->GetTargetTypeName()));
+ return kFALSE;
+ }
+
Int_t size = fValues.GetEntries();
- new(fValues[size]) AliRsnValue(*val);
- AliDebug(AliLog::kDebug+2,"->");
+ new (fValues[size]) AliRsnValue(*val);
+
+ return kTRUE;
}
AliRsnPairNtuple& operator=(const AliRsnPairNtuple&);
~AliRsnPairNtuple();
- void AddValue(AliRsnValue*const val);
+ Bool_t AddValue(AliRsnValue*const val);
void GenerateNtuple(const char *prefix = "", TList *list = 0);
virtual void Compute();
virtual void Init(const char *prefix, TList *list);
//
// *** Class AliRsnVATProcessInfo ***
//
-// TODO
-// TODO
+// Virtual class which makes computations at the event level,
+// in order to return a list of histograms useful to have a look
+// of the characteristics of used events.
+// If can be inherited and customized for the needs of the analysis.
//
// authors: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
// M. Vala (email: martin.vala@cern.ch)
ClassImp(AliRsnVATProcessInfo)
-//_____________________________________________________________________________
+//______________________________________________________________________________
AliRsnVATProcessInfo::AliRsnVATProcessInfo(const char *name) :
- TNamed(name,name),
- fHistUsedEvents(0x0),
- fEventUsed(kFALSE),
- fPrintInfoNumber(1000)
+ TNamed(name,name),
+ fHistUsedEvents(0x0),
+ fEventUsed(kFALSE),
+ fPrintInfoNumber(1000)
{
//
// Constructor.
+// Does nothing more than initialization of data members.
//
- AliDebug(AliLog::kDebug+2,"<-");
- AliDebug(AliLog::kDebug+2,"->");
+ AliDebug(AliLog::kDebug+2, "Entering");
+ AliDebug(AliLog::kDebug+2, "Exiting");
}
-//_____________________________________________________________________________
+//______________________________________________________________________________
AliRsnVATProcessInfo::AliRsnVATProcessInfo(const AliRsnVATProcessInfo& copy) :
- TNamed(copy),
- fHistUsedEvents(copy.fHistUsedEvents),
- fEventUsed(copy.fEventUsed),
- fPrintInfoNumber(copy.fPrintInfoNumber)
+ TNamed(copy),
+ fHistUsedEvents(0x0),
+ fEventUsed(copy.fEventUsed),
+ fPrintInfoNumber(copy.fPrintInfoNumber)
{
//
// Copy constructor.
+// Clones the histogram and copies the values of other data members
//
- AliDebug(AliLog::kDebug+2,"<-");
- AliDebug(AliLog::kDebug+2,"->");
+ AliDebug(AliLog::kDebug+2, "Entering");
+
+ fHistUsedEvents = (TH1I*)copy.fHistUsedEvents->Clone();
+
+ AliDebug(AliLog::kDebug+2, "Exiting");
}
-//_____________________________________________________________________________
-AliRsnVATProcessInfo::~AliRsnVATProcessInfo()
+//______________________________________________________________________________
+AliRsnVATProcessInfo& AliRsnVATProcessInfo::operator=
+(const AliRsnVATProcessInfo& copy)
{
//
-// Destructor.
+// Assignment operator.
+// Clones the histogram and copies the values of other data members.
//
- AliDebug(AliLog::kDebug+2,"<-");
- AliDebug(AliLog::kDebug+2,"->");
+ AliDebug(AliLog::kDebug+2, "Entering");
+
+ fHistUsedEvents = (TH1I*)copy.fHistUsedEvents->Clone();
+ fEventUsed = copy.fEventUsed;
+ fPrintInfoNumber = copy.fPrintInfoNumber;
+
+ AliDebug(AliLog::kDebug+2, "Exiting");
+
+ return (*this);
}
-//_____________________________________________________________________________
+//______________________________________________________________________________
+AliRsnVATProcessInfo::~AliRsnVATProcessInfo()
+{
+//
+// Destructor.
+// Does nothing, since the histogram it creates is usually owned
+// by another object (TList output of AnalysisTask's), but sets
+// the data member pointers to NULL.
+//
+
+ AliDebug(AliLog::kDebug+2, "Entering");
+
+ fHistUsedEvents = 0x0;
+ fEventUsed = 0;
+ fPrintInfoNumber = 0;
+
+ AliDebug(AliLog::kDebug+2, "Exiting");
+}
+
+//______________________________________________________________________________
void AliRsnVATProcessInfo::GenerateInfoList(TList *list)
{
//
-// Creates a TList containing all objects created in this class.
-// This list will be passe to the AnalysisTask object and will generate
-// a separate directory in the output file, with these informations.
-// This TList will have the same name of this object and will own its content.
+// Allocate in memory the histograms created in this class and store them
+// inside the TList object passed as argument, which usually belongs to
+// an AnalysisTask object, and represents one of its outputs.
+// If the histogram was already initialized, it is deleted and recreated.
//
- AliDebug(AliLog::kDebug+2,"<-");
-
- // create list
- AliDebug(AliLog::kWarning,"Doing new TList(), so make sure you delete this list ... ");
-// TList* list = new TList();
-// list->SetName(GetName());
-// list->SetOwner();
+ AliDebug(AliLog::kDebug+2, "Entering");
- // initialize contained objects
+ // delete existing allocation of stored objects
+ if (fHistUsedEvents) delete fHistUsedEvents;
+
+ // create stored objects
fHistUsedEvents = new TH1I(GetEventHistogramName(), "Skipped/used events", 2, 0, 2);
// ad objects to list
list->Add(fHistUsedEvents);
- AliDebug(AliLog::kDebug+2,"->");
+ AliDebug(AliLog::kDebug+2, "Exiting");
}
-//_____________________________________________________________________________
+//______________________________________________________________________________
void AliRsnVATProcessInfo::FillInfo()
{
//
// This method defines how the information histograms must be filled.
-// The structure of this class is auto-consistend, but in case of inheritance
+// The structure of this class is auto-consistent, but in case of inheritance
// this method must be modified accordingly.
// Current implementation uses the 'fEventUsed' flag to choose if the event
-// has been used or not, and increments the corrisponding bin in the related
+// has been used or not, and increments the corresponding bin in the related
// histogram (bin '0' = skipped, bin '1' = used).
//
fHistUsedEvents->Fill(0);
}
-//_____________________________________________________________________________
+//______________________________________________________________________________
void AliRsnVATProcessInfo::PrintInfo(const Long64_t &num)
{
//
// to inform about number of events processed
//
- if ((num+1) % fPrintInfoNumber == 0) AliInfo(Form("Events processed %lld",num+1));
+ if ((num+1) % fPrintInfoNumber == 0) AliInfo(Form("Events processed %lld", num+1));
}
-
+//______________________________________________________________________________
Long64_t AliRsnVATProcessInfo::GetNumerOfEventsProcessed()
{
//
// returns number of events from histogram
//
- if (fHistUsedEvents)
- return fHistUsedEvents->Integral();
+
+ if (fHistUsedEvents) return fHistUsedEvents->Integral();
return 0;
}
-
//
// *** Class AliRsnVATProcessInfo ***
//
-// TODO
+// Virtual class which makes computations at the event level,
+// in order to return a list of histograms useful to have a look
+// of the characteristics of used events.
+// If can be inherited and customized for the needs of the analysis.
//
// authors: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
// M. Vala (email: martin.vala@cern.ch)
#define ALIRSNVATPROCESSINFO_H
#include <TNamed.h>
+
class TH1I;
class AliRsnVATProcessInfo : public TNamed
{
public:
- AliRsnVATProcessInfo(const char*name = "AT_RSNInfo");
+ AliRsnVATProcessInfo(const char *name = "RSNInfo");
AliRsnVATProcessInfo(const AliRsnVATProcessInfo& copy);
- AliRsnVATProcessInfo& operator= (const AliRsnVATProcessInfo& /*copy*/) {return *this;}
+ AliRsnVATProcessInfo& operator= (const AliRsnVATProcessInfo& copy);
~AliRsnVATProcessInfo();
- void GenerateInfoList(TList* list);
- virtual void FillInfo();
- virtual void PrintInfo(const Long64_t &num);
+ void GenerateInfoList(TList* list);
+ virtual void FillInfo();
+ virtual void PrintInfo(const Long64_t &num);
- const char* GetEventHistogramName() { return Form("hEventsUsed_%s",GetName()); };
- Long64_t GetNumerOfEventsProcessed();
- void SetEventUsed(Bool_t isUsed = kTRUE) { fEventUsed = isUsed; }
- Bool_t IsEventUsed() const { return fEventUsed; };
+ const char* GetEventHistogramName() { return Form("hEventsUsed_%s",GetName()); };
+ Long64_t GetNumerOfEventsProcessed();
+ void SetEventUsed(Bool_t isUsed = kTRUE) { fEventUsed = isUsed; }
+ Bool_t IsEventUsed() const { return fEventUsed; };
- void SetPrintInfoNumber(const Long64_t &num=1) { fPrintInfoNumber = num; }
+ void SetPrintInfoNumber(const Long64_t &num=1) { fPrintInfoNumber = num; }
private:
//
#include <Riostream.h>
+#include "AliESDtrackCuts.h"
#include "AliRsnEvent.h"
#include "AliRsnDaughter.h"
#include "AliRsnMother.h"
//_____________________________________________________________________________
AliRsnValue::AliRsnValue() :
- TNamed(),
- fValue(0.0),
- fType(kValueTypes),
- fArray(0),
- fESDCuts()
+ AliRsnTarget(),
+ fComputedValue(0),
+ fValueType(kValueTypes),
+ fBinArray(0),
+ fSupportObject(0x0)
{
//
-// Main constructor (version 1)
-// This can also be created without any argument.
+// Default constructor without arguments.
+// Initialize data members to meaningless values.
+// This method is provided for ROOT streaming,
+// but should never be used directly by a user.
//
+
+ AssignTarget();
}
//_____________________________________________________________________________
AliRsnValue::AliRsnValue
(const char *name, EValueType type, Int_t nbins, Double_t min, Double_t max) :
- TNamed(name, ""),
- fValue(0.0),
- fType(type),
- fArray(0),
- fESDCuts()
+ AliRsnTarget(name, AliRsnTarget::kTargetTypes),
+ fComputedValue(0.0),
+ fValueType(type),
+ fBinArray(0),
+ fSupportObject(0x0)
{
//
-// Main constructor (version 1)
-// This can also be created without any argument.
+// Main constructor (version 1).
+// This constructor defines in meaningful way all data members,
+// and defined a fixed binnings, subdividing the specified interval
+// into that many bins as specified in the integer argument.
+// ---
+// This method is also the entry point for all instances
+// of this class which don't need to do binning (e.g.: TNtuple inputs),
+// since arguments 3 to 5 have default values which don't create any
+// binning array, in order not to allocate memory when this is useless.
//
+ AssignTarget();
SetBins(nbins, min, max);
}
//_____________________________________________________________________________
AliRsnValue::AliRsnValue
(const char *name, EValueType type, Double_t min, Double_t max, Double_t step) :
- TNamed(name, ""),
- fValue(0.0),
- fType(type),
- fArray(0),
- fESDCuts()
+ AliRsnTarget(name, AliRsnTarget::kTargetTypes),
+ fComputedValue(0.0),
+ fValueType(type),
+ fBinArray(0),
+ fSupportObject(0x0)
{
//
-// Main constructor (version 2)
+// Main constructor (version 2).
+// This constructor defines in meaningful way all data members
+// and creates enough equal bins of the specified size to cover
+// the required interval.
//
+ AssignTarget();
SetBins(min, max, step);
}
//_____________________________________________________________________________
AliRsnValue::AliRsnValue
(const char *name, EValueType type, Int_t nbins, Double_t *array) :
- TNamed(name, ""),
- fValue(0.0),
- fType(type),
- fArray(0),
- fESDCuts()
+ AliRsnTarget(name, AliRsnTarget::kTargetTypes),
+ fComputedValue(0.0),
+ fValueType(type),
+ fBinArray(0),
+ fSupportObject(0x0)
{
//
-// Main constructor (version 2)
+// Main constructor (version 3).
+// This constructor defines in meaningful way all data members
+// and creates a set of variable bins delimited by the passed array.
//
+ AssignTarget();
SetBins(nbins, array);
}
//_____________________________________________________________________________
AliRsnValue::AliRsnValue(const AliRsnValue& copy) :
- TNamed(copy),
- fValue(copy.fValue),
- fType(copy.fType),
- fArray(copy.fArray),
- fESDCuts(copy.fESDCuts)
+ AliRsnTarget(copy),
+ fComputedValue(copy.fComputedValue),
+ fValueType(copy.fValueType),
+ fBinArray(copy.fBinArray),
+ fSupportObject(copy.fSupportObject)
{
//
-// Copy constructor
+// Copy constructor.
+// Duplicates the binning array and copies all settings.
+// Calls also the function that assigns properly the
+// expected target, depending on the computation type.
//
+
+ AssignTarget();
}
//_____________________________________________________________________________
AliRsnValue& AliRsnValue::operator=(const AliRsnValue& copy)
{
//
-// Assignment operator
+// Assignment operator.
+// Works like copy constructor.
//
- SetName(copy.GetName());
+ AliRsnTarget::operator=(copy);
+
+ fComputedValue = copy.fComputedValue;
+ fBinArray = copy.fBinArray;
+ fSupportObject = copy.fSupportObject;
- fType = copy.fType;
- fValue = copy.fValue;
- fArray = copy.fArray;
- fESDCuts = copy.fESDCuts;
+ AssignTarget();
return (*this);
}
// where the number of bins, minimum and maximum are given.
//
- fArray.Set(nbins + 1);
+ if (!nbins)
+ {
+ fBinArray.Set(0);
+ return;
+ }
+
+ fBinArray.Set(nbins + 1);
Double_t mymax = TMath::Max(min, max);
Double_t mymin = TMath::Min(min, max);
Int_t k = 0;
Double_t binSize = (mymax - mymin) / ((Double_t)nbins);
- fArray[0] = mymin;
- for (k = 1; k <= nbins; k++) fArray[k] = fArray[k-1] + binSize;
- for (k = 0; k < fArray.GetSize() - 1; k++) AliDebug(AliLog::kDebug + 3, Form("Bin #%d: %f - %f", k, fArray[k], fArray[k+1]));
+ fBinArray[0] = mymin;
+ for (k = 1; k <= nbins; k++) fBinArray[k] = fBinArray[k-1] + binSize;
}
//_____________________________________________________________________________
// using the same way it is done in TAxis
//
- fArray.Adopt(nbins, array);
- for (Int_t k = 0; k < fArray.GetSize() - 1; k++) AliDebug(AliLog::kDebug + 3, Form("Bin #%d: %f - %f", k, fArray[k], fArray[k+1]));
+ if (!nbins)
+ {
+ fBinArray.Set(0);
+ return;
+ }
+
+ fBinArray.Adopt(nbins, array);
+}
+
+//_____________________________________________________________________________
+const char* AliRsnValue::GetValueTypeName() const
+{
+//
+// This method returns a string to give a name to each possible
+// computation value.
+//
+
+ switch (fValueType)
+ {
+ case kTrackP: return "SingleTrackPtot";
+ case kTrackPt: return "SingleTrackPt";
+ case kTrackEta: return "SingleTrackEta";
+ case kPairP1: return "PairPtotDaughter1";
+ case kPairP2: return "PairPtotDaughter2";
+ case kPairP1t: return "PairPtDaughter1";
+ case kPairP2t: return "PairPtDaughter2";
+ case kPairP1z: return "PairPzDaughter1";
+ case kPairP2z: return "PairPzDaughter2";
+ case kPairInvMass: return "PairInvMass";
+ case kPairInvMassMC: return "PairInvMassMC";
+ case kPairInvMassRes: return "PairInvMassResolution";
+ case kPairPt: return "PairPt";
+ case kPairPz: return "PairPz";
+ case kPairEta: return "PairEta";
+ case kPairMt: return "PairMt";
+ case kPairY: return "PairY";
+ case kPairPhi: return "PairPhi";
+ case kPairPhiMC: return "PairPhiMC";
+ case kPairPtRatio: return "PairPtRatio";
+ case kPairDipAngle: return "PairDipAngle";
+ case kPairCosThetaStar: return "PairCosThetaStar";
+ case kPairQInv: return "PairQInv";
+ case kPairAngleToLeading: return "PairAngleToLeading";
+ case kEventLeadingPt: return "EventLeadingPt";
+ case kEventMult: return "EventMult";
+ case kEventMultESDCuts: return "EventMultESDCuts";
+ default: return "Undefined";
+ }
+}
+
+//_____________________________________________________________________________
+void AliRsnValue::AssignTarget()
+{
+//
+// This method assigns the target to be expected by this object
+// in the computation, depending on its type chosen in the enum.
+//
+
+ switch (fValueType)
+ {
+ // track related values
+ case kTrackP:
+ case kTrackPt:
+ case kTrackEta:
+ SetTargetType(AliRsnTarget::kDaughter); // end of track-related values
+ break;
+ // pair related values
+ case kPairP1:
+ case kPairP2:
+ case kPairP1t:
+ case kPairP2t:
+ case kPairP1z:
+ case kPairP2z:
+ case kPairInvMass:
+ case kPairInvMassMC:
+ case kPairInvMassRes:
+ case kPairPt:
+ case kPairPz:
+ case kPairEta:
+ case kPairMt:
+ case kPairY:
+ case kPairPhi:
+ case kPairPhiMC:
+ case kPairPtRatio:
+ case kPairDipAngle:
+ case kPairCosThetaStar:
+ case kPairQInv:
+ case kPairAngleToLeading:
+ SetTargetType(AliRsnTarget::kMother); // end of pair-related values
+ break;
+ // event related values
+ case kEventLeadingPt:
+ case kEventMult:
+ case kEventMultESDCuts:
+ SetTargetType(AliRsnTarget::kEvent); // end of event-related values
+ break;
+ // undefined value
+ default:
+ SetTargetType(AliRsnTarget::kTargetTypes); // undefined targets
+ }
}
//_____________________________________________________________________________
-Bool_t AliRsnValue::Eval(AliRsnMother *mother, AliRsnPairDef *pairDef, AliRsnEvent *event)
+Bool_t AliRsnValue::Eval(TObject *object, Bool_t useMC)
{
//
// Evaluation of the required value.
// Checks that the passed object is of the right type
-// and if this check is successful, returns the required value.
-// The output of the function tells if it was successful,
+// and if this check is successful, computes the required value.
+// The output of the function tells if computing was successful,
// and the values must be taken with GetValue().
//
- // avoid segfaults
- if (!mother) return kFALSE;
- if (!pairDef) return kFALSE;
+ // cast the input to the allowed types
+ AliRsnDaughter *daughter = dynamic_cast<AliRsnDaughter*>(object);
+ AliRsnMother *mother = dynamic_cast<AliRsnMother*>(object);
+ AliRsnEvent *event = dynamic_cast<AliRsnEvent*>(object);
+
+ // check that the input object is the correct class type
+ switch (fTargetType)
+ {
+ case AliRsnTarget::kDaughter:
+ if (!daughter)
+ {
+ AliError(Form("[%s] expected: AliRsnDaughter, passed: [%s]", GetName(), object->ClassName()));
+ return kFALSE;
+ }
+ break;
+ case AliRsnTarget::kMother:
+ if (!mother)
+ {
+ AliError(Form("[%s] expected: AliRsnMother, passed: [%s]", GetName(), object->ClassName()));
+ return kFALSE;
+ }
+ break;
+ case AliRsnTarget::kEvent:
+ if (!event)
+ {
+ AliError(Form("[%s] expected: AliRsnEvent, passed: [%s]", GetName(), object->ClassName()));
+ return kFALSE;
+ }
+ break;
+ default:
+ AliError(Form("[%s] Wrong type", GetName()));
+ return kFALSE;
+ }
- Double_t mass = pairDef->GetMotherMass();
+ // cast the support object to the types which could be needed
+ AliESDtrackCuts *esdCuts = dynamic_cast<AliESDtrackCuts*>(fSupportObject);
+ AliRsnPairDef *pairDef = dynamic_cast<AliRsnPairDef*>(fSupportObject);
- switch (fType)
+ // common variables
+ TLorentzVector pRec; // 4-momentum for single track or pair sum (reco)
+ TLorentzVector pSim; // 4-momentum for single track or pair sum (MC)
+ TLorentzVector pRec0; // 4-momentum of first daughter (reco)
+ TLorentzVector pSim0; // 4-momentum of first daughter (MC)
+ TLorentzVector pRec1; // 4-momentum of second daughter (reco)
+ TLorentzVector pSim1; // 4-momentum of second daughter (MC)
+ if (daughter)
{
- case kTrack1P:
- fValue = mother->GetDaughter(0)->P().Mag();
- break;
- case kTrack2P:
- fValue = mother->GetDaughter(1)->P().Mag();
+ pRec = daughter->Psim();
+ pSim = daughter->Prec();
+ }
+ if (mother)
+ {
+ pRec = mother->Sum();
+ pSim = mother->SumMC();
+ pRec0 = mother->GetDaughter(0)->Prec();
+ pRec1 = mother->GetDaughter(1)->Prec();
+ pSim0 = mother->GetDaughter(0)->Psim();
+ pSim1 = mother->GetDaughter(1)->Psim();
+ }
+
+ // compute value depending on type
+ switch (fValueType)
+ {
+ case kTrackP:
+ fComputedValue = useMC ? pSim.Mag() : pRec.Mag();
break;
- case kTrack1Pt:
- fValue = mother->GetDaughter(0)->P().Perp();
+ case kTrackPt:
+ fComputedValue = useMC ? pSim.Perp() : pRec.Perp();
break;
- case kTrack2Pt:
- fValue = mother->GetDaughter(1)->P().Perp();
+ case kTrackEta:
+ fComputedValue = useMC ? pSim.Eta() : pRec.Eta();
break;
- case kTrack1Px:
- fValue = mother->GetDaughter(0)->P().X();
+ case kPairP1:
+ fComputedValue = useMC ? pSim0.Mag() : pRec0.Mag();
break;
- case kTrack1Py:
- fValue = mother->GetDaughter(0)->P().Y();
+ case kPairP2:
+ fComputedValue = useMC ? pSim1.Mag() : pRec1.Mag();
break;
- case kTrack1Pz:
- fValue = mother->GetDaughter(0)->P().Z();
+ case kPairP1t:
+ fComputedValue = useMC ? pSim0.Perp() : pRec0.Perp();
break;
- case kTrack2Px:
- fValue = mother->GetDaughter(1)->P().X();
+ case kPairP2t:
+ fComputedValue = useMC ? pSim1.Perp() : pRec1.Perp();
break;
- case kTrack2Py:
- fValue = mother->GetDaughter(1)->P().Y();
+ case kPairP1z:
+ fComputedValue = useMC ? pSim0.Z() : pRec0.Z();
break;
- case kTrack2Pz:
- fValue = mother->GetDaughter(1)->P().Z();
+ case kPairP2z:
+ fComputedValue = useMC ? pSim1.Z() : pRec1.Z();
break;
case kPairInvMass:
- fValue = mother->Sum().M();
- break;
- case kPairInvMassMC:
- fValue = mother->SumMC().M();
+ fComputedValue = useMC ? pSim.M() : pRec.M();
break;
case kPairInvMassRes:
- fValue = (mother->SumMC().M() - mother->Sum().M()) / mother->SumMC().M();
+ fComputedValue = (pSim.M() - pRec.M()) / pSim.M();
break;
case kPairPt:
- fValue = mother->Sum().Perp();
+ fComputedValue = useMC ? pSim.Perp() : pRec.Perp();
break;
case kPairEta:
- fValue = mother->Sum().Eta();
+ fComputedValue = useMC ? pSim.Eta() : pRec.Eta();
break;
case kPairMt:
- if (TMath::Abs(mass) < 1E-5) AliWarning(Form("Suspicious mass value specified: %f", mass));
- fValue = (TMath::Sqrt(mother->Sum().Perp2() + mass*mass) - mass);
+ // for this computation, replace the computed mass with the default mass
+ // for doing this, an initialized pairDef is required to get the mass
+ if (!pairDef)
+ {
+ AliError(Form("[%s] Required a correctly initialized PairDef to compute this value", GetName()));
+ fComputedValue = 1E+10;
+ return kFALSE;
+ }
+ else
+ {
+ pRec.SetXYZM(pRec.X(), pRec.Y(), pRec.Z(), pairDef->GetMotherMass());
+ pSim.SetXYZM(pSim.X(), pSim.Y(), pSim.Z(), pairDef->GetMotherMass());
+ fComputedValue = useMC ? pSim.Mt() : pRec.Mt();
+ }
break;
case kPairY:
- if (TMath::Abs(mass) < 1E-5) AliWarning(Form("Suspicious mass value specified: %f", mass));
- mother->SetDefaultMass(mass);
- fValue = mother->Ref().Rapidity();
+ // for this computation, replace the computed mass with the default mass
+ // for doing this, an initialized pairDef is required to get the mass
+ if (!pairDef)
+ {
+ AliError(Form("[%s] Required a correctly initialized PairDef to compute this value", GetName()));
+ fComputedValue = 1E+10;
+ return kFALSE;
+ }
+ else
+ {
+ pRec.SetXYZM(pRec.X(), pRec.Y(), pRec.Z(), pairDef->GetMotherMass());
+ pSim.SetXYZM(pSim.X(), pSim.Y(), pSim.Z(), pairDef->GetMotherMass());
+ fComputedValue = useMC ? pSim.Rapidity() : pRec.Rapidity();
+ }
break;
case kPairPhi:
- fValue = mother->Sum().Phi();
- break;
- case kPairPhiMC:
- fValue = mother->SumMC().Phi();
+ fComputedValue = useMC ? pSim.Phi() : pRec.Phi();
break;
case kPairPtRatio:
- fValue = TMath::Abs(mother->GetDaughter(0)->P().Perp() - mother->GetDaughter(1)->P().Perp());
- fValue /= TMath::Abs(mother->GetDaughter(0)->P().Perp() + mother->GetDaughter(1)->P().Perp());
+ if (useMC)
+ {
+ fComputedValue = TMath::Abs(pSim0.Perp() - pSim1.Perp());
+ fComputedValue /= TMath::Abs(pSim0.Perp() + pSim1.Perp());
+ }
+ else
+ {
+ fComputedValue = TMath::Abs(pRec0.Perp() - pRec1.Perp());
+ fComputedValue /= TMath::Abs(pRec0.Perp() + pRec1.Perp());
+ }
break;
case kPairDipAngle:
- fValue = mother->GetDaughter(0)->P().Angle(mother->GetDaughter(1)->P().Vect());
- fValue = TMath::Abs(TMath::ACos(fValue));
+ fComputedValue = useMC ? pSim0.Angle(pSim1.Vect()) : pRec0.Angle(pRec1.Vect());
+ fComputedValue = TMath::Abs(TMath::ACos(fComputedValue));
break;
case kPairCosThetaStar:
- fValue = mother->CosThetaStar();
+ fComputedValue = mother->CosThetaStar(useMC);
break;
- case kAngleToLeading:
+ case kPairQInv:
+ pSim0 -= pSim1;
+ pRec0 -= pRec1;
+ fComputedValue = useMC ? pSim0.M() : pRec0.M();
+ break;
+ case kPairAngleToLeading:
{
int ID1 = (mother->GetDaughter(0))->GetID();
int ID2 = (mother->GetDaughter(1))->GetID();
int leadingID = event->SelectLeadingParticle(0);
- if(leadingID == ID1 || leadingID == ID2) return kFALSE;
+ if (leadingID == ID1 || leadingID == ID2) return kFALSE;
AliRsnDaughter leadingPart = event->GetDaughter(leadingID);
AliVParticle *ref = leadingPart.GetRef();
-
- fValue = ref->Phi() - mother->Sum().Phi();
+ fComputedValue = ref->Phi() - mother->Sum().Phi();
//return angle w.r.t. leading particle in the range -pi/2, 3/2pi
- while(fValue >= TMath::Pi()) fValue -= 2*TMath::Pi();
- while(fValue < -0.5*TMath::Pi()) fValue += 2*TMath::Pi();
- //Printf("%g", fValue);
+ while(fComputedValue >= TMath::Pi()) fComputedValue -= 2*TMath::Pi();
+ while(fComputedValue < -0.5*TMath::Pi()) fComputedValue += 2*TMath::Pi();
+ //Printf("%g", fComputedValue);
}
break;
case kEventMult:
- if (!event)
- {
- fValue = 0.0;
- return kFALSE;
- }
- else fValue = (Double_t)event->GetMultiplicity(0x0);
+ fComputedValue = (Double_t)event->GetMultiplicity(0x0);
break;
case kEventMultESDCuts:
- if (!event)
+ // this value requires an initialized ESDtrackCuts
+ if (!esdCuts)
{
- fValue = 0.0;
+ AliError(Form("[%s] Required a correctly initialized ESDtrackCuts to compute this value", GetName()));
+ fComputedValue = 1E+10;
return kFALSE;
}
- else fValue = (Double_t)event->GetMultiplicity(&fESDCuts);
+ fComputedValue = (Double_t)event->GetMultiplicity(esdCuts);
break;
- case kLeadingPt:
- if (!event)
- {
- fValue = 0.0;
- return kFALSE;
- }
- else
+ case kEventLeadingPt:
{
int leadingID = event->SelectLeadingParticle(0);
if(leadingID >= 0) {
AliRsnDaughter leadingPart = event->GetDaughter(leadingID);
AliVParticle *ref = leadingPart.GetRef();
- fValue = ref->Pt();
+ fComputedValue = ref->Pt();
}
- else fValue = 0;
- }
- break;
- case kQInv:
- {
- TLorentzVector diff = mother->GetDaughter(0)->P() - mother->GetDaughter(1)->P();
- fValue = diff.M();
+ else fComputedValue = 0;
}
break;
default:
- AliWarning("Invalid value type");
+ AliError(Form("[%s] Invalid value type for this computation", GetName()));
return kFALSE;
}
}
//_____________________________________________________________________________
-Bool_t AliRsnValue::Eval(AliRsnDaughter * const daughter, AliRsnEvent * const event)
+void AliRsnValue::Print(Option_t * /*option */) const
{
//
-// Evaluation of the required value.
-// Checks that the passed object is of the right type
-// and if this check is successful, returns the required value.
-// The output of the function tells if it was successful,
-// and the values must be taken with GetValue().
+// Print informations about this object
//
- // avoid segfaults
- if (!daughter) return kFALSE;
-
- switch (fType)
+ AliInfo("=== VALUE INFO =================================================");
+ AliInfo(Form(" Name : %s", GetName()));
+ AliInfo(Form(" Type : %s", GetValueTypeName()));
+ AliInfo(Form(" Current computed value: %f", fComputedValue));
+ Int_t i;
+ for (i = 0; i < fBinArray.GetSize(); i++)
{
- case kEventMult:
- if (!event)
- {
- fValue = 0.0;
- return kFALSE;
- }
- else fValue = (Double_t)event->GetMultiplicity();
- break;
- case kEventMultESDCuts:
- if (!event)
- {
- fValue = 0.0;
- return kFALSE;
- }
- else fValue = (Double_t)event->GetMultiplicity(&fESDCuts);
- break;
- case kLeadingPt:
- if (!event)
- {
- fValue = 0.0;
- return kFALSE;
- }
- else
- {
- int leadingID = event->SelectLeadingParticle(0);
- if(leadingID >= 0) {
- AliRsnDaughter leadingPart = event->GetDaughter(leadingID);
- AliVParticle *ref = leadingPart.GetRef();
- fValue = ref->Pt();
- }
- else fValue = 0;
- }
- break;
- default:
- AliWarning("Invalid value type");
- return kFALSE;
+ AliInfo(Form(" Bin limit #%d = %f", i, fBinArray[i]));
}
-
- return kTRUE;
-}
-
-//_____________________________________________________________________________
-void AliRsnValue::Print(Option_t *) const
-{
-//
-// Print all bins
-//
-
- Int_t i, n = fArray.GetSize();
- TString msg("Array values: ");
-
- for (i = 0; i < n; i++) msg += Form("%f, ", fArray[i]);
-
- AliInfo(Form("Axis name: %s", GetName()));
- AliInfo(msg.Data());
+ AliInfo(Form(" Support object : %s", (fSupportObject ? fSupportObject->ClassName() : " NO SUPPORT")));
+ AliInfo("=== END VALUE INFO =============================================");
}
//
// Class AliRsnValue
//
-// Definition of a single value which can be computed
-// from any of the defined input objects implemented
-// in the resonance package.
+// This class implements all the computations which could be useful
+// during the analysis, both for cuts and for output histograms.
+//
+// It inherits from the AliRsnTarget base class since it can operate
+// on tracks, pairs and events, and the kind of expected object to
+// be processed depends on the kind of requested computation.
+//
+// Since this class is used to produce the outputs, it contains the
+// facilities to define a binning in an output histogram.
//
#ifndef ALIRSNVALUE_H
#define ALIRSNVALUE_H
-#include "TNamed.h"
#include "TArrayD.h"
-#include "AliESDtrackCuts.h"
-
-class AliRsnPairDef;
-class AliRsnMother;
+#include "AliRsnTarget.h"
-class AliRsnValue : public TNamed
+class AliRsnValue : public AliRsnTarget
{
public:
-
+
+ // this enumeration lists all available computations
+ // any user feedback proposing new ones is welcome
enum EValueType
{
- kTrack1P,
- kTrack2P,
- kTrack1Pt,
- kTrack2Pt,
- kTrack1Px,
- kTrack1Py,
- kTrack1Pz,
- kTrack2Px,
- kTrack2Py,
- kTrack2Pz,
- kPairInvMass,
- kPairInvMassMC,
- kPairInvMassRes,
- kPairPt,
- kPairEta,
- kPairMt,
- kPairY,
- kPairPhi,
- kPairPhiMC,
- kPairPtRatio,
- kPairDipAngle,
- kPairCosThetaStar,
- kAngleToLeading,
- kLeadingPt,
- kQInv,
- kEventMult,
- kEventMultESDCuts,
- kValueTypes
+ kTrackP, // single track total momentum
+ kTrackPt, // single track transverse momentum
+ kTrackEta, // single track pseudo-rapidity
+ kPairP1, // total momentum of 1st daughter of a pair
+ kPairP2, // total momentum of 2nd daughter of a pair
+ kPairP1t, // total momentum of 1st daughter of a pair
+ kPairP2t, // total momentum of 2nd daughter of a pair
+ kPairP1z, // total momentum of 1st daughter of a pair
+ kPairP2z, // total momentum of 2nd daughter of a pair
+ kPairInvMass, // pair invariant mass (with reconstructed momenta)
+ kPairInvMassMC, // pair invariant mass (with MC momenta)
+ kPairInvMassRes, // pair invariant mass resolution
+ kPairPt, // pair transverse momentum
+ kPairPz, // pair longitudinal momentum
+ kPairEta, // pair pseudo-rapidity
+ kPairMt, // pair transverse mass (need a reference mass)
+ kPairY, // pair rapidity (need a reference mass)
+ kPairPhi, // pair azimuthal angle (with reconstructed momenta)
+ kPairPhiMC, // pair azimuthal angle (with MC momenta)
+ kPairPtRatio, // ratio |pt1 - pt2|/(pt1 + pt2) of daughter transverse momenta
+ kPairDipAngle, // inverse cosine of the angle between daughter vector momenta
+ kPairCosThetaStar, // polarization angle
+ kPairQInv, // invariant relative momentum of the two daughters
+ kPairAngleToLeading, // angle between the pair momentum and that of the event leading particle
+ kEventLeadingPt, // transverse momentum of the event leading particle
+ kEventMult, // multiplicity computed as the number of tracks
+ kEventMultESDCuts, // multiplicity computed as the number of track passing an ESD quality cut (need this cut defined)
+
+ kValueTypes // last value is used to have a meaningless enum value for initializations
};
AliRsnValue();
- AliRsnValue(const char *name, EValueType type, Int_t n = 0, Double_t min = 0.0, Double_t max = 0.0);
+ AliRsnValue(const char *name, EValueType type, Int_t nbins = 0, Double_t min = 0.0, Double_t max = 0.0);
AliRsnValue(const char *name, EValueType type, Double_t min, Double_t max, Double_t step);
- AliRsnValue(const char *name, EValueType type, Int_t n, Double_t *array);
+ AliRsnValue(const char *name, EValueType type, Int_t nbins, Double_t *array);
AliRsnValue(const AliRsnValue& copy);
AliRsnValue& operator=(const AliRsnValue& copy);
- virtual ~AliRsnValue() { }
+ virtual ~AliRsnValue() { /*does nothing, since pointers are not owned by this object*/ }
+
+ TArrayD GetArray() const {return fBinArray;}
+ Double_t GetComputedValue() const {return fComputedValue;}
+ EValueType GetValueType() const {return fValueType;}
+ const char* GetValueTypeName() const;
+ TObject* GetSupportObject() {return fSupportObject;}
+ void SetSupportObject(TObject *obj) {fSupportObject = obj;}
+ void SetValueType(EValueType type) {fValueType = type;}
+ void AssignTarget();
- TArrayD GetArray() const {return fArray;}
- Double_t GetValue() const {return fValue;}
- EValueType GetValueType() const {return fType;}
- const AliESDtrackCuts* GetCuts() const {return &fESDCuts;}
-
- void SetValueType(EValueType type) {fType = type;}
void SetBins(Int_t n, Double_t min, Double_t max);
- void SetBins(Double_t min, Double_t max, Double_t step);
void SetBins(Int_t n, Double_t *array);
- void Set(EValueType type, Int_t n = 0, Double_t min = 0.0, Double_t max = 0.0) {fType = type; SetBins(n, min, max);}
- void Set(EValueType type, Double_t min, Double_t max, Double_t step) {fType = type; SetBins(min, max, step);}
- void Set(EValueType type, Int_t n, Double_t *array) {fType = type; SetBins(n, array);}
+ void SetBins(Double_t min, Double_t max, Double_t step);
+
+ void Set(EValueType type, Int_t n, Double_t min, Double_t max) {fValueType = type; AssignTarget(); SetBins(n, min, max);}
+ void Set(EValueType type, Int_t n, Double_t *array) {fValueType = type; AssignTarget(); SetBins(n, array);}
+ void Set(EValueType type, Double_t min, Double_t max, Double_t step) {fValueType = type; AssignTarget(); SetBins(min, max, step);}
+
- virtual Bool_t Eval(AliRsnMother *mother, AliRsnPairDef *pairDef, AliRsnEvent *event);
- virtual Bool_t Eval(AliRsnDaughter *daughter, AliRsnEvent *event);
+ virtual Bool_t Eval(TObject *object, Bool_t useMC = kFALSE);
virtual void Print(Option_t *option = "") const;
protected:
- Double_t fValue; // computed value
- EValueType fType; // value type
- TArrayD fArray; // array of bins (when necessary)
- AliESDtrackCuts fESDCuts; // ESD track cuts used for a way to compute multiplicity
+ Double_t fComputedValue; // computed value
+ EValueType fValueType; // value type
+ TArrayD fBinArray; // array of bins (when used for a histogram axis)
+ TObject *fSupportObject; // support object needed for computing some of the values
// ROOT dictionary
- ClassDef(AliRsnValue, 1)
+ ClassDef(AliRsnValue, 2)
};
#endif
// retrieve analysis manager
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
- // interpret config string
- TString strDataLabel(options);
- Bool_t isSim = strDataLabel.Contains("sim");
- Bool_t isMC = strDataLabel.Contains("MC");
-
// initialize task with all available slots, even if not all of them will be used:
AliRsnAnalysisSE *task = new AliRsnAnalysisSE("RsnAnalysis");
task->SetZeroEventPercentWarning(100.0);
task->SelectCollisionCandidates();
- if (isMC) task->SetMCOnly(kTRUE);
- // if not MC kinematics, set cuts for events : primary vertex range and type
- if (!isMC)
- {
- gROOT->LoadMacro("$(ALICE_ROOT)/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/ConfigESDCutsTPC.C");
- AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
- AliRsnCutESDCutMultiplicity *cutMult = new AliRsnCutESDCutMultiplicity("cutMult", 0, 10);
-
- ConfigESDCutsTPC(cutMult->GetCuts());
-
- task->GetEventCuts()->AddCut(cutVertex);
- //task->GetEventCuts()->AddCut(cutMult);
- //task->GetEventCuts()->SetCutScheme("cutVertex&cutMult");
- task->GetEventCuts()->SetCutScheme("cutVertex");
- }
+ // set cuts for events : primary vertex range and type
+ gROOT->LoadMacro("$(ALICE_ROOT)/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi/ConfigESDCutsTPC.C");
+ AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
+ task->GetEventCuts()->AddCut(cutVertex);
+ task->GetEventCuts()->SetCutScheme(cutVertex->GetName());
// add the task to manager
mgr->AddTask(task);
Bool_t AddRsnAnalysisMult
(
const char *options,
- const char *configs = "RsnConfigNoSA.C RsnConfigSA.C",
+ const char *configs = "RsnConfigNoSA.C RsnConfigSA.C RsnConfigDipNoSA.C RsnConfigDipSA.C",
const char *path = "$(ALICE_ROOT)/PWG2/RESONANCES/macros/train/LHC2010-7TeV-phi"
)
{
// 1) transverse momentum
// 2) rapidity
// 3) multiplicity
- Double_t pt [] = {0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.5, 5.0, 5.5, 6.0, 7.0, 8.0, 9.0, 10.0};
- Double_t y [] = {-1.0, -0.9, -0.8, -0.7, -0.6, -0.5, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0};
- Double_t mult[] = {0.0, 5.0, 9.0, 14.0, 22.0, 100000.0};
- Int_t npt = sizeof(pt ) / sizeof(pt [0]);
- Int_t ny = sizeof(y ) / sizeof(y [0]);
+ Double_t mult[] = {0., 6., 10., 15., 23., 1E6};
Int_t nmult = sizeof(mult) / sizeof(mult[0]);
- AliRsnValue *axisIM = new AliRsnValue("IM" , AliRsnValue::kPairInvMass , 500 , 0.9, 1.4);
- //AliRsnValue *axisPt = new AliRsnValue("PT" , AliRsnValue::kPairPt , npt , pt);
- //AliRsnValue *axisY = new AliRsnValue("Y" , AliRsnValue::kPairY , ny , y);
- //AliRsnValue *axisMult = new AliRsnValue("Mult", AliRsnValue::kEventMultESDcuts, nmult, mult);
- AliRsnValue *axisPt = new AliRsnValue("PT" , AliRsnValue::kPairPt , 100, 0.0, 10.0);
- AliRsnValue *axisY = new AliRsnValue("Y" , AliRsnValue::kPairY , 20, -1.0, 1.0);
- ConfigESDCutsTPC(axisMult->GetCuts());
+ AliRsnValue *axisIM = new AliRsnValue("IM" , AliRsnValue::kPairInvMass , 0.9, 1.4, 0.001);
+ AliRsnValue *axisPt = new AliRsnValue("PT" , AliRsnValue::kPairPt , 0.0, 10.0, 0.100);
+ AliRsnValue *axisY = new AliRsnValue("Y" , AliRsnValue::kPairY ,-1.2, 1.2, 0.100);
+ AliRsnValue *axisMult = new AliRsnValue("Mult", AliRsnValue::kEventMultESDCuts, nmult, mult);
+
+ // add the support cut to the value which computes the multiplicity
+ AliESDtrackCuts *cuts = new AliESDtrackCuts;
+ ConfigESDCutsTPC(cuts);
+ axisMult->SetSupportObject(cuts);
// define cuts for event selection:
// this will determine the filling of bins in the "info" histograms
// and should be computed as additional correction factor in efficiency
- AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
+ AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 1, kFALSE);
// define standard 2010 track quality/PID cuts:
// - first index: [0] = no PID, [1] = PID
cuts2010[ipid][iits]->SetMC(kTRUE);
// all use global tracks
- cuts2010[ipid][iits]->SetUseGlobal(kTRUE);
+ cuts2010[ipid][iits]->SetUseITSTPC(kTRUE);
// other flags, depend on indexes
cuts2010[ipid][iits]->SetUseITSSA((Bool_t)iits);
}
// define cut on dip angle:
- AliRsnCutStd *cutDip = new AliRsnCutStd("cutDip", AliRsnCut::kMother, AliRsnCutStd::kDipAngle, 0.0, 0.04);
+ AliRsnCutValue *cutDip = new AliRsnCutValue("cutDip", AliRsnValue::kPairDipAngle, 0.02, 1.01);
// define a common path for the output file
Char_t commonPath[500];
// add the cut only when working on ESD, not on MC only
task[itask]->GetEventCuts()->AddCut(cutVertex);
- task[itask]->GetEventCuts()->SetCutScheme("cutVertex");
+ task[itask]->GetEventCuts()->SetCutScheme(cutVertex->GetName());
//
// *** STEP 0 - All resonances which decay in the specified pair
// its requirement is automatically checked during execution,
// but to avoid segfaults, it is better to initialize a cut manager.
//
- AliRsnCutManager *mgr_step1 = new AliRsnCutManager("reco_step0", "");
+ AliRsnCutManager *mgr_step1 = new AliRsnCutManager("esd_step0", "");
//
// *** STEP 2 - Reconstruction & track quality
//
-
- AliRsnCutSet *set_step2 = new AliRsnCutSet("cuts_step2", AliRsnCut::kDaughter);
+ // Define a cut on track quality, disabling the PID cuts (first index = [0])
+ //
AliRsnCutManager *mgr_step2 = new AliRsnCutManager("esd_step2", "");
+ AliRsnCutSet *set_step2 = mgr_step2->GetCommonDaughterCuts();
set_step2->AddCut(cuts2010[0][itask]);
set_step2->SetCutScheme(cuts2010[0][itask]->GetName());
- mgr_step2->SetCommonDaughterCuts(set_step2);
//
// *** STEP 3 - PID
//
-
- AliRsnCutSet *set_step3 = new AliRsnCutSet("cuts_step3", AliRsnCut::kDaughter);
+ // Define a cut on track quality, enabling the PID cuts (first index = [1])
+ //
AliRsnCutManager *mgr_step3 = new AliRsnCutManager("esd_step3", "");
+ AliRsnCutSet *set_step3 = mgr_step3->GetCommonDaughterCuts();
set_step3->AddCut(cuts2010[1][itask]);
set_step3->SetCutScheme(cuts2010[1][itask]->GetName());
- mgr_step3->SetCommonDaughterCuts(set_step3);
//
// *** STEP 4 - Dip angle
//
-
- AliRsnCutSet *set_step4 = new AliRsnCutSet("cuts_step4", AliRsnCut::kMother);
+ // Add a cut on the pair dip angle
+ //
AliRsnCutManager *mgr_step4 = new AliRsnCutManager("esd_step4", "");
+ AliRsnCutSet *set_step4 = mgr_step4->GetMotherCuts();
set_step4->AddCut(cutDip);
- set_step4->SetCutScheme(Form("!%s", cutDip->GetName()));
- mgr_step4->SetMotherCuts(set_step4);
+ set_step4->SetCutScheme(Form("%s", cutDip->GetName()));
- // add all steps to the task
+ // add all steps to the task:
+ // - first step computed on MC
+ // - all other steps computed on reconstruction
task[itask]->AddStepMC (mgr_step0);
task[itask]->AddStepESD(mgr_step1);
task[itask]->AddStepESD(mgr_step2);
void ConfigESDCutsITS(AliESDtrackCuts * &cuts)
{
// general acceptance/pt cuts
- cuts->SetPtRange(0.15, 10.0);
- cuts->SetEtaRange(-0.8, 0.8);
+ cuts->SetPtRange ( 0.15, 10.00);
+ cuts->SetEtaRange(-0.80, 0.80);
// DCA cuts
cuts->SetMaxDCAToVertexXYPtDep("0.0595+0.0182/pt^1.55");
void ConfigESDCutsTPC(AliESDtrackCuts * &cuts)
{
// general acceptance/pt cuts
- cuts->SetPtRange(0.15, 10.0);
- cuts->SetEtaRange(-0.8, 0.8);
+ cuts->SetPtRange ( 0.15, 1.0e+10);
+ cuts->SetEtaRange(-0.8 , 0.8);
// DCA cuts
- cuts->SetMaxDCAToVertexXYPtDep("0.0182+0.0224/pt^1.78");
+ cuts->SetMaxDCAToVertexXYPtDep("0.0182+0.0350/pt^1.01");
cuts->SetMaxDCAToVertexZ(2.0);
cuts->SetDCAToVertex2D(kFALSE);
cuts->SetRequireSigmaToVertex(kFALSE);
cuts->SetRequireITSRefit(kTRUE);
cuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
}
-
cuts2010_esd->SetMC(isSim);
cuts2010_aod->SetMC(isSim);
// ----> include or not the ITS standalone (TPC is always in)
- cuts2010_esd->SetUseGlobal(kTRUE);
+ cuts2010_esd->SetUseITSTPC(kTRUE);
cuts2010_esd->SetUseITSSA (addITSSA);
- cuts2010_aod->SetUseGlobal(kTRUE);
- cuts2010_aod->SetUseITSSA (addITSSA);
+ //cuts2010_aod->SetUseITSTPC(kTRUE);
+ //cuts2010_aod->SetUseITSSA (addITSSA);
// ----> require to check PID or not, depending on the label
if (realPID)
{
// pair cut ----------------------
// --> dip angle between daughters
- AliRsnCutStd *cutDip = new AliRsnCutStd("cutDip", AliRsnCut::kMother, AliRsnCutStd::kDipAngle, 0.02, 1.1);
+ AliRsnCutValue *cutDip = new AliRsnCutValue("cutDip", AliRsnValue::kPairDipAngle, 0.03, 1.01);
// cut set for tracks------------------------
// --> only common cuts for tracks are needed
// --> standard 2010 cuts are applied always
- TString cutSchemeTrack;
- AliRsnCutSet *cutSetDaughterCommon = new AliRsnCutSet("commonDaughterCuts", AliRsnCut::kDaughter);
+ TString cutSchemeTrack;
if (isESD)
{
- cutSetDaughterCommon->AddCut(cuts2010_esd);
+ pairPM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cuts2010_esd);
+ truePM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cuts2010_esd);
+ pairPP->GetCutManager()->GetCommonDaughterCuts()->AddCut(cuts2010_esd);
+ pairMM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cuts2010_esd);
+
cutSchemeTrack += cuts2010_esd->GetName();
}
else if (isAOD)
{
- cutSetDaughterCommon->AddCut(cuts2010_aod);
+ pairPM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cuts2010_aod);
+ truePM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cuts2010_aod);
+ pairPP->GetCutManager()->GetCommonDaughterCuts()->AddCut(cuts2010_aod);
+ pairMM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cuts2010_aod);
+
cutSchemeTrack += cuts2010_aod->GetName();
}
else
}
if (perfPID)
{
- cutSetDaughterCommon->AddCut(cutPID);
+ pairPM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cutPID);
+ truePM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cutPID);
+ pairPP->GetCutManager()->GetCommonDaughterCuts()->AddCut(cutPID);
+ pairMM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cutPID);
+
cutSchemeTrack += "&cutPID";
}
- cutSetDaughterCommon->SetCutScheme(cutSchemeTrack.Data());
+ pairPM->GetCutManager()->GetCommonDaughterCuts()->SetCutScheme(cutSchemeTrack.Data());
+ truePM->GetCutManager()->GetCommonDaughterCuts()->SetCutScheme(cutSchemeTrack.Data());
+ pairPP->GetCutManager()->GetCommonDaughterCuts()->SetCutScheme(cutSchemeTrack.Data());
+ pairMM->GetCutManager()->GetCommonDaughterCuts()->SetCutScheme(cutSchemeTrack.Data());
// cut set for pairs---------------------------------------
// --> add dip angle cut (but then include only if required)
AliRsnCutSet *cutSetPair = new AliRsnCutSet("cutsPair", AliRsnCut::kMother);
cutSetPair->AddCut(cutDip);
cutSetPair->SetCutScheme(cutDip->GetName());
-
- // configure cut managers -------------------
- // --> track cuts are always defined, so add them by default
- pairPM->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
- truePM->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
- pairPP->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
- pairMM->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
- // --> pair cut is added only when dip angle cut is required
if (dipAngleCut)
{
- pairPM->GetCutManager()->SetMotherCuts(cutSetPair);
- truePM->GetCutManager()->SetMotherCuts(cutSetPair);
- pairPP->GetCutManager()->SetMotherCuts(cutSetPair);
- pairMM->GetCutManager()->SetMotherCuts(cutSetPair);
+ pairPM->GetCutManager()->GetMotherCuts()->AddCut(cutDip);
+ truePM->GetCutManager()->GetMotherCuts()->AddCut(cutDip);
+ pairPP->GetCutManager()->GetMotherCuts()->AddCut(cutDip);
+ pairMM->GetCutManager()->GetMotherCuts()->AddCut(cutDip);
+
+ pairPM->GetCutManager()->GetMotherCuts()->SetCutScheme(cutDip->GetName());
+ truePM->GetCutManager()->GetMotherCuts()->SetCutScheme(cutDip->GetName());
+ pairPP->GetCutManager()->GetMotherCuts()->SetCutScheme(cutDip->GetName());
+ pairMM->GetCutManager()->GetMotherCuts()->SetCutScheme(cutDip->GetName());
}
// set additional option for true pairs when needed
// -- Setup functions -----------------------------------------------------------------------------
//
- // function axes
- Double_t pt [] = {0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.5, 5.0, 5.5, 6.0, 7.0, 8.0, 9.0, 10.0};
- Double_t y [] = {-0.8, -0.7, -0.6, 0.6, 0.7, 0.8};
- Double_t mult[] = {0.0, 5.0, 9.0, 14.0, 22.0, 1000.0};
- Int_t npt = sizeof(pt ) / sizeof(pt [0]);
- Int_t ny = sizeof(y ) / sizeof(y [0]);
+ // axis definition
+ // 0) invariant mass
+ // 1) transverse momentum
+ // 2) rapidity
+ // 3) multiplicity
+ Double_t mult[] = {0., 6., 10., 15., 23., 1E6};
Int_t nmult = sizeof(mult) / sizeof(mult[0]);
- AliRsnValue *axisIM = new AliRsnValue("IM" , AliRsnValue::kPairInvMass , 500 , 0.9, 1.4);
- AliRsnValue *axisPt = new AliRsnValue("PT" , AliRsnValue::kPairPt , npt , pt);
- AliRsnValue *axisY = new AliRsnValue("Y" , AliRsnValue::kPairY , ny , y);
+ AliRsnValue *axisIM = new AliRsnValue("IM" , AliRsnValue::kPairInvMass , 0.9, 1.4, 0.001);
+ AliRsnValue *axisPt = new AliRsnValue("PT" , AliRsnValue::kPairPt , 0.0, 10.0, 0.100);
+ AliRsnValue *axisY = new AliRsnValue("Y" , AliRsnValue::kPairY ,-1.2, 1.2, 0.100);
AliRsnValue *axisMult = new AliRsnValue("Mult", AliRsnValue::kEventMultESDCuts, nmult, mult);
- ConfigESDCutsTPC(axisMult->GetCuts());
+
+ // add the support cut to the value which computes the multiplicity
+ AliESDtrackCuts *cuts = new AliESDtrackCuts;
+ ConfigESDCutsTPC(cuts);
+ axisMult->SetSupportObject(cuts);
// create function and add axes
AliRsnFunction *fcnImPtY = new AliRsnFunction;
- fcnImPtY->AddAxis(axisIM);
- fcnImPtY->AddAxis(axisPt);
- fcnImPtY->AddAxis(axisY);
- fcnImPtY->AddAxis(axisMult);
+ if ( !fcnImPtY->AddAxis(axisIM ) ) return kFALSE;
+ if ( !fcnImPtY->AddAxis(axisPt ) ) return kFALSE;
+ if ( !fcnImPtY->AddAxis(axisY ) ) return kFALSE;
+ if ( !fcnImPtY->AddAxis(axisMult) ) return kFALSE;
// add functions to pairs
pairPM->AddFunction(fcnImPtY);
task->GetAnalysisManager()->Add(pairPM);
task->GetAnalysisManager()->Add(pairPP);
task->GetAnalysisManager()->Add(pairMM);
- //if (isSim) task->GetAnalysisManager()->Add(truePM);
+ if (isSim) task->GetAnalysisManager()->Add(truePM);
return kTRUE;
}
SRCS= RESONANCES/AliRsnDaughter.cxx \
RESONANCES/AliRsnMother.cxx \
+ RESONANCES/AliRsnPairDef.cxx \
RESONANCES/AliRsnEvent.cxx \
+ RESONANCES/AliRsnTarget.cxx \
RESONANCES/AliRsnValue.cxx \
- RESONANCES/AliRsnFunction.cxx \
- RESONANCES/AliRsnExpression.cxx \
- RESONANCES/AliRsnVariableExpression.cxx \
RESONANCES/AliRsnCut.cxx \
- RESONANCES/AliRsnCutStd.cxx \
+ RESONANCES/AliRsnCutValue.cxx \
RESONANCES/AliRsnCutPID.cxx \
RESONANCES/AliRsnCutBetheBloch.cxx \
RESONANCES/AliRsnCutPrimaryVertex.cxx \
RESONANCES/AliRsnCutESDPrimary.cxx \
- RESONANCES/AliRsnCutESDCutMultiplicity.cxx \
RESONANCES/AliRsnCutDaughterType.cxx \
RESONANCES/AliRsnCutESD2010.cxx \
RESONANCES/AliRsnCutAOD2010.cxx \
RESONANCES/AliRsnCutSet.cxx \
- RESONANCES/AliRsnCutValue.cxx \
+ RESONANCES/AliRsnExpression.cxx \
+ RESONANCES/AliRsnVariableExpression.cxx \
RESONANCES/AliRsnCutManager.cxx \
- RESONANCES/AliRsnPairDef.cxx \
+ RESONANCES/AliRsnFunction.cxx \
RESONANCES/AliRsnPair.cxx \
RESONANCES/AliRsnPairFunctions.cxx \
RESONANCES/AliRsnPairNtuple.cxx \
RESONANCES/AliRsnAnalysisPhi7TeVNoPID.cxx \
RESONANCES/AliRsnMonitorTrack.cxx \
RESONANCES/AliRsnAnalysisMonitorTask.cxx \
- RESONANCES/AliRsnAnalysisMonitorPairTask.cxx \
-# RESONANCES/AliRsnFitResult.cxx \
HDRS= $(SRCS:.cxx=.h)