//
// Class AliRsnCutPrimaryVertex
//
-// 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()]
-//
-// 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 cut implementation checks the quality of event primary vertex.
+// It currently works only with ESD events (not AOD).
//
// authors: Martin Vala (martin.vala@cern.ch)
// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
//
-// #include "AliLog.h"
-// #include "AliESDEvent.h"
-// #include "AliESDVertex.h"
-//
-// #include "AliRsnEvent.h"
-// #include "AliRsnCutPrimaryVertex.h"
-
-// #include "Riostream.h"
-// #include "TMath.h"
-//
-// #include "AliLog.h"
-// #include "AliESDEvent.h"
-// #include "AliESDVertex.h"
-//
-// #include "AliRsnEvent.h"
#include "AliRsnCutPrimaryVertex.h"
ClassImp(AliRsnCutPrimaryVertex)
//_________________________________________________________________________________________________
AliRsnCutPrimaryVertex::AliRsnCutPrimaryVertex() :
- AliRsnCut()
+ AliRsnCut(),
+ fAcceptTPC(kFALSE)
{
//
// Default constructor.
//_________________________________________________________________________________________________
AliRsnCutPrimaryVertex::AliRsnCutPrimaryVertex
-(const char *name, Int_t nContributors) :
- AliRsnCut(name, 0, nContributors)
+(const char *name, Int_t nContributors, Bool_t acceptTPC) :
+ AliRsnCut(name, 0, nContributors - 1),
+ fAcceptTPC(acceptTPC)
{
//
// Main constructor.
-// the cut range is outside the interval 0 - min number of contributors.
+// Defines the cut range between 0 and
+// the minimum required number of contributors.
+// The cut will be passed when if the event has a
+// primary vertex with number of contributors outside this interval.
+// ---
+// If the 'acceptTPC' argument is true, events with TPC
+// primary vertex will be checked, otherwise they will be
+// rejected by default.
+// ---
+// Since the range check uses the '>=' and '<=', the high edge
+// must be decreased by 1 to get the right behaviour, since this is integer.
//
}
//
// Cut checker.
//
+
AliWarning("Cannot apply this cut to particles");
return kTRUE;
}
AliESDEvent *esd = dynamic_cast<AliESDEvent*>(event->GetRef());
if (!esd) {
AliDebug(AliLog::kDebug+2, "NO ESD");
- return kTRUE;
+ return kFALSE;
}
- // check primary vertex and eventually fill step 1
- // if a vertex with tracks was successfully reconstructed,
- // it is used for computing DCA;
- // otherwise, the one computed with SPD is used.
- // This is known from the "Status" parameter of the vertex itself.
- const AliESDVertex *v = esd->GetPrimaryVertex();
- if (!v->GetStatus()) v = esd->GetPrimaryVertexSPD();
- if (!v->GetStatus()) {
- AliDebug(AliLog::kDebug+2, "Bad vertex status");
+ // get the three possible primary vertexes of the event:
+ // 0 = default one
+ // 1 = SPD
+ // 2 = TPC
+ // then, if the default vertex is TPC, the event is rejected,
+ // otherwise, the event is rejected only if its vertex status is 'false'
+ // get primary vertexes
+ const AliESDVertex *vert[3];
+ vert[0] = esd->GetPrimaryVertex();
+ vert[1] = esd->GetPrimaryVertexSPD();
+ vert[2] = esd->GetPrimaryVertexTPC();
+
+ // if TPC vertexes are rejected by default do this now
+ if (!fAcceptTPC && (vert[0] == vert[2])) {
+ AliDebug(AliLog::kDebug+2, "Rejecting TPC vertex");
return kFALSE;
}
- fCutValueI = v->GetNContributors();
+ // if we are here, vert[0] contains the default primary vertex
+ // in case it is with tracks or SPD, its status must be OK
+ // because otherwise the ESD event returns the lower level vertex
+ // then, we can check just the first element in the array
+ if (!vert[0]->GetStatus()) {
+ AliDebug(AliLog::kDebug+2, "Bad vertex status");
+ return kFALSE;
+ }
- return !OkRange();
+ // if we are here, the status of default vertex is OK
+ // and then we check the number of contributors:
+ // it must be *outside* the 'allowed' range
+ fCutValueI = vert[0]->GetNContributors();
+ return /*there is a NOT operator */!/*here*/OkRange();
}
//_________________________________________________________________________________________________
//
-// Class AliRsnCutRange
+// Class AliRsnCutPrimaryVertex
//
-// 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 checks the quality of event primary vertex.
+// It currently works only with ESD events (not AOD).
//
// authors: Martin Vala (martin.vala@cern.ch)
// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
public:
AliRsnCutPrimaryVertex();
- AliRsnCutPrimaryVertex(const char *name, Int_t minContributors);
+ AliRsnCutPrimaryVertex(const char *name, Int_t minContributors, Bool_t acceptTPC = kFALSE);
virtual ~AliRsnCutPrimaryVertex() {;};
virtual Bool_t IsSelected(AliRsnCut::ETarget tgt, AliRsnDaughter *daughter);
protected:
+ Bool_t fAcceptTPC; // if kTRUE, the TPC primary vertexes are accepted
+
ClassDef(AliRsnCutPrimaryVertex, 1)
};