30 #include "StHbtMaker/Cut/rotationEventCut.h"
31 #include "Randomize.h"
32 #include "PhysicalConstants.h"
33 #include "SystemOfUnits.h"
34 #include "StHbtParticle.hh"
35 #include "StHbtPair.hh"
36 #include "StHbtMaker/Infrastructure/StHbtEvent.hh"
44 rotationEventCut::rotationEventCut() : mRotation(false), mRandom(false), mSmear(0), mL3TriggerAlgorithm(0) {
45 mNEventsPassed = mNEventsFailed = 0;
46 mEventRefMult[0] = 0; mEventRefMult[1] = 100000;
47 mEventMult[0] = 0; mEventMult[1] = 100000;
48 mEventMultGood[0] = 0; mEventMultGood[1] = 100000;
49 mNumberOfTracks[0] = 0; mNumberOfTracks[1] = 100000;
50 mNumberOfV0s[0] = 0; mNumberOfV0s[1] = 100000;
51 mReactionPlaneError[0]=-10.; mReactionPlaneError[1]=+10.;
61 bool rotationEventCut::Pass(
const StHbtEvent* event){
62 int refMult,mult,multGood;
66 bool goodEvent =
true;
68 refMult =
event->UncorrectedNumberOfNegativePrimaries();
69 mult =
event->NumberOfTracks();
70 multGood =
event->NumberOfGoodTracks();
75 VertexZPos =
event->PrimVertPos().z();
78 (refMult >= mEventRefMult[0]) &&
79 (refMult <= mEventRefMult[1]) &&
80 (mult >= mEventMult[0]) &&
81 (mult <= mEventMult[1]) &&
82 (multGood >= mEventMultGood[0]) &&
83 (multGood <= mEventMultGood[1]) &&
84 (
event->ReactionPlaneError() >= mReactionPlaneError[0]) &&
85 (event->ReactionPlaneError() <= mReactionPlaneError[1]) &&
86 ((
int)
event->TrackCollection()->size() >= mNumberOfTracks[0]) &&
87 ((
int)
event->TrackCollection()->size() <= mNumberOfTracks[1]) &&
88 ((
int)
event->V0Collection()->size() >= mNumberOfV0s[0]) &&
89 ((
int)
event->V0Collection()->size() <= mNumberOfV0s[1])
92 if (mL3TriggerAlgorithm) goodEvent = goodEvent && (mL3TriggerAlgorithm &
event->L3TriggerAlgorithm(0));
94 if ( mVertZPos[0] < mVertZPos[1])
95 goodEvent = goodEvent && ( (VertexZPos >= mVertZPos[0]) && (VertexZPos <= mVertZPos[1]) );
97 goodEvent = goodEvent && !( (VertexZPos >= mVertZPos[0]) && (VertexZPos <= mVertZPos[1]) );
98 cout <<
" rotationEventCut::Pass(const StHbtEvent* event) : upper limit < lower limit - inverting the cut" << endl;
101 if (goodEvent && mRotation ) {
102 angle = gauss->shoot()*2.*pi;
103 ((
StHbtEvent*)event)->RotateZ(-1.* event->ReactionPlane() + angle);
106 if (goodEvent && mRandom ) {
107 angle = engine->flat()*2.*pi;
111 if (goodEvent && mSmear!=0 ) {
112 smear = gauss->shoot()*mSmear/360.*2*pi;
117 if (event->PrimVertPos().x() ==
event->PrimVertPos().y() ==
event->PrimVertPos().z() ) {
118 for (
int i=0; i<50; i++) cout <<
" rotationEventCut::Pass(...) - flagged bad from embedding " << endl;
125 goodEvent ? mNEventsPassed++ : mNEventsFailed++ ;
132 StHbtString rotationEventCut::Report(){
135 sprintf(Ctemp,
"rotationEventCut: ");
137 sprintf(Ctemp,
"\n Rotation :\t %d",mRotation);
139 sprintf(Ctemp,
"\n Random :\t %d",mRandom);
141 sprintf(Ctemp,
"\n Smear :\t %E",mSmear);
143 sprintf(Ctemp,
"\n Reference Multiplicity:\t %d-%d",mEventRefMult[0],mEventRefMult[1]);
145 sprintf(Ctemp,
"\n Multiplicity:\t %d-%d",mEventMult[0],mEventMult[1]);
147 sprintf(Ctemp,
"\n Multiplicity good tracks:\t %d-%d",mEventMultGood[0],mEventMultGood[1]);
149 sprintf(Ctemp,
"\n NumberOfTracks:\t %d-%d",mNumberOfTracks[0],mNumberOfTracks[1]);
151 sprintf(Ctemp,
"\n NumberOfV0s:\t %d-%d",mNumberOfV0s[0],mNumberOfV0s[1]);
153 sprintf(Ctemp,
"\n Vertex Z-position:\t %E-%E",mVertZPos[0],mVertZPos[1]);
155 sprintf(Ctemp,
"\n Number of events which passed:\t%ld Number which failed:\t%ld",mNEventsPassed,mNEventsFailed);
157 StHbtString returnThis = Stemp;