]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoQAEventCut.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / AliFemtoUser / AliFemtoQAEventCut.cxx
CommitLineData
76ce4b5b 1////////////////////////////////////////////////////////////////////////////////
2// //
3// AliFemtoQAEventCut - the basic cut to check QA for event cuts. //
4// Only cuts on event multiplicity and z-vertex position //
5// //
6////////////////////////////////////////////////////////////////////////////////
7
8#include "AliFemtoQAEventCut.h"
9//#include <cstdio>
10
11#ifdef __ROOT__
12ClassImp(AliFemtoQAEventCut)
13#endif
14
15AliFemtoQAEventCut::AliFemtoQAEventCut() :
16 AliFemtoEventCut(),
17 fEventMult(),
18 fVertZPos(),
19 fAcceptBadVertex(false),
20 fNEventsPassed(0),
21 fNEventsFailed(0),
22 fHighOrLowSwitch(0),
23 fEventMultQASwitch(kFALSE),
24 fEventZPosQASwitch(kFALSE)
25{
26 // Default constructor
27 fEventMult[0] = 0;
28 fEventMult[1] = 100000;
29 fVertZPos[0] = -100.0;
30 fVertZPos[1] = 100.0;
31
32 fHighOrLowSwitch = 1;
33 fEventMultQASwitch = false;
34 fEventZPosQASwitch = false;
35 fEventMultQAExclusionZone[0] = 0;
36 fEventMultQAExclusionZone[1] = 100000;
37 fEventZPosQAExclusionZone[0] = -100.0;
38 fEventZPosQAExclusionZone[1] = 100.0;
39
40}
41//------------------------------
42AliFemtoQAEventCut::~AliFemtoQAEventCut(){
43 // Default destructor
44}
45//------------------------------
46AliFemtoQAEventCut& AliFemtoQAEventCut::operator=(AliFemtoQAEventCut& c)
47{
48 if (this != &c) {
49 fEventMult[0] = c.fEventMult[0];
50 fEventMult[1] = c.fEventMult[1];
51 fVertZPos[0] = c.fVertZPos[0];
52 fVertZPos[1] = c.fVertZPos[1];
53
54 fHighOrLowSwitch = c.fHighOrLowSwitch;
55 fEventMultQASwitch = c.fEventMultQASwitch;
56 fEventZPosQASwitch = c.fEventZPosQASwitch;
57 fEventMultQAExclusionZone[0] = c.fEventMultQAExclusionZone[0];
58 fEventMultQAExclusionZone[1] = c.fEventMultQAExclusionZone[1];
59 fEventZPosQAExclusionZone[0] = c.fEventZPosQAExclusionZone[0];
60 fEventZPosQAExclusionZone[1] = c.fEventZPosQAExclusionZone[1];
61 }
62
63 return *this;
64}
65//------------------------------
66bool AliFemtoQAEventCut::Pass(const AliFemtoEvent* event){
67 // Pass events if they fall within the multiplicity and z-vertex
68 // position range. If QA cutting on quantity, pass if outside
69 // exclusion zone between low and high cut values. Fail otherwise.
70 int mult = event->NumberOfTracks();
71 double vertexZPos = event->PrimVertPos().z();
72 cout << "AliFemtoQAEventCut:: mult: " << fEventMult[0] << " < " << mult << " < " << fEventMult[1] << endl;
73 cout << "AliFemtoQAEventCut:: VertexZPos: " << fVertZPos[0] << " < " << vertexZPos << " < " << fVertZPos[1] << endl;
74
75 bool goodEvent;
76
77 if (fEventMultQASwitch) {
78 goodEvent =
79 ( (((mult < fEventMultQAExclusionZone[0]) && (fHighOrLowSwitch > 0)) ||
80 ((mult > fEventMultQAExclusionZone[1]) && (fHighOrLowSwitch < 0))) &&
81 (mult > fEventMult[0]) &&
82 (mult < fEventMult[1]) &&
83 (vertexZPos > fVertZPos[0]) &&
84 (vertexZPos < fVertZPos[1]) &&
85 (fAcceptBadVertex || (event->PrimVertCov()[4] > -1000.0)));
86 }
87 else if (fEventZPosQASwitch) {
88 goodEvent =
89 ((((vertexZPos < fEventZPosQAExclusionZone[0]) && (fHighOrLowSwitch > 0)) ||
90 ((vertexZPos > fEventZPosQAExclusionZone[1]) && (fHighOrLowSwitch < 0))) &&
91 (mult > fEventMult[0]) &&
92 (mult < fEventMult[1]) &&
93 (vertexZPos > fVertZPos[0]) &&
94 (vertexZPos < fVertZPos[1]) &&
95 (fAcceptBadVertex || (event->PrimVertCov()[4] > -1000.0)));
96 }
97 else {
98 goodEvent =
99 ((mult > fEventMult[0]) &&
100 (mult < fEventMult[1]) &&
101 (vertexZPos > fVertZPos[0]) &&
102 (vertexZPos < fVertZPos[1]) &&
103 (fAcceptBadVertex || (event->PrimVertCov()[4] > -1000.0)));
104 }
105
106 if (goodEvent) fHighOrLowSwitch *= -1;
107 goodEvent ? fNEventsPassed++ : fNEventsFailed++ ;
108 //cout << "AliFemtoQAEventCut:: return : " << goodEvent << endl;
109 return (goodEvent);
110}
111//------------------------------
112AliFemtoString AliFemtoQAEventCut::Report(){
113 // Prepare report
114 string stemp;
115 char ctemp[100];
116 snprintf(ctemp , 100, "\nMultiplicity:\t %d-%d",fEventMult[0],fEventMult[1]);
117 stemp = ctemp;
118 snprintf(ctemp , 100, "\nVertex Z-position:\t %E-%E",fVertZPos[0],fVertZPos[1]);
119 stemp += ctemp;
120 snprintf(ctemp , 100, "\nNumber of events which passed:\t%ld Number which failed:\t%ld",fNEventsPassed,fNEventsFailed);
121 stemp += ctemp;
122 AliFemtoString returnThis = stemp;
123 return returnThis;
124}
125void AliFemtoQAEventCut::SetAcceptBadVertex(bool b)
126{
127 fAcceptBadVertex = b;
128}
129bool AliFemtoQAEventCut::GetAcceptBadVertex()
130{
131 return fAcceptBadVertex;
132}