]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FEMTOSCOPY/AliFemto/AliFemtoBasicEventCut.cxx
Migration of PWG2/FEMTOSCOPY to PWGCF/FEMTOSCOPY
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / AliFemto / AliFemtoBasicEventCut.cxx
1 ////////////////////////////////////////////////////////////////////////////////
2 //                                                                            //
3 // AliFemtoBasicEventCut - the basic cut for events.                          //
4 // Only cuts on event multiplicity and z-vertex position                      //
5 //                                                                            //
6 ////////////////////////////////////////////////////////////////////////////////
7
8 #include "AliFemtoBasicEventCut.h"
9 //#include <cstdio>
10
11 #ifdef __ROOT__
12 ClassImp(AliFemtoBasicEventCut)
13 #endif
14
15 AliFemtoBasicEventCut::AliFemtoBasicEventCut() :
16   AliFemtoEventCut(),
17   fEventMult(),
18   fVertZPos(),
19   fAcceptBadVertex(false), 
20   fNEventsPassed(0), 
21   fNEventsFailed(0),
22   fAcceptOnlyPhysics(true),
23   fSelectTrigger(0)
24 {
25   // Default constructor
26   fEventMult[0] = 0;
27   fEventMult[1] = 100000;
28   fVertZPos[0] = -100.0;
29   fVertZPos[1] = 100.0;
30
31 //------------------------------
32 AliFemtoBasicEventCut::~AliFemtoBasicEventCut(){
33   // Default destructor
34 }
35 //------------------------------
36 bool AliFemtoBasicEventCut::Pass(const AliFemtoEvent* event){
37   // Pass events if they fall within the multiplicity and z-vertex
38   // position range. Fail otherwise
39   //  int mult =  event->NumberOfTracks();
40   int mult = (int) event->UncorrectedNumberOfPrimaries();
41   double vertexZPos = event->PrimVertPos().z();
42 //   cout << "AliFemtoBasicEventCut:: mult:       " << fEventMult[0] << " < " << mult << " < " << fEventMult[1] << endl;
43 //   cout << "AliFemtoBasicEventCut:: VertexZPos: " << fVertZPos[0] << " < " << vertexZPos << " < " << fVertZPos[1] << endl;
44 //   cout << "AliFemtoBasicEventCut:: VertexZErr: " << event->PrimVertCov()[4] << endl;
45   bool goodEvent =
46     ((mult >= fEventMult[0]) && 
47      (mult <= fEventMult[1]) && 
48      (vertexZPos > fVertZPos[0]) &&
49      (vertexZPos < fVertZPos[1]) &&
50      ((!fAcceptBadVertex) || (event->ZDCParticipants() > 1.0)) &&
51      ((!fAcceptOnlyPhysics) || (event->IsCollisionCandidate())) &&
52      ((!fSelectTrigger) || (event->TriggerCluster() == fSelectTrigger)));
53   goodEvent ? fNEventsPassed++ : fNEventsFailed++ ;
54 //   cout << "AliFemtoBasicEventCut:: return : " << goodEvent << endl;
55 //     (fAcceptBadVertex || (event->PrimVertCov()[4] > -1000.0)) &&
56   return (goodEvent);
57 }
58 //------------------------------
59 AliFemtoString AliFemtoBasicEventCut::Report(){
60   // Prepare report
61   string stemp;
62   char ctemp[100];
63   snprintf(ctemp , 100, "\nMultiplicity:\t %d-%d",fEventMult[0],fEventMult[1]);
64   stemp = ctemp;
65   snprintf(ctemp , 100, "\nVertex Z-position:\t %E-%E",fVertZPos[0],fVertZPos[1]);
66   stemp += ctemp;
67   snprintf(ctemp , 100, "\nNumber of events which passed:\t%ld  Number which failed:\t%ld",fNEventsPassed,fNEventsFailed);
68   stemp += ctemp;
69   AliFemtoString returnThis = stemp;
70   return returnThis;
71 }
72 void AliFemtoBasicEventCut::SetAcceptBadVertex(bool b)
73 {
74   fAcceptBadVertex = b;
75 }
76 bool AliFemtoBasicEventCut::GetAcceptBadVertex()
77 {
78   return fAcceptBadVertex;
79 }
80 void AliFemtoBasicEventCut::SetAcceptOnlyPhysics(bool b)
81 {
82   fAcceptOnlyPhysics = b;
83 }
84 bool AliFemtoBasicEventCut::GetAcceptOnlyPhysics()
85 {
86   return fAcceptOnlyPhysics;
87 }