StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ParityEventCut.cxx
1 /***************************************************************************
2  *
3  * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
4  ***************************************************************************
5  *
6  * Description: part of STAR HBT Framework: StHbtMaker package
7  * This cut is for the Parity Violation studies.
8  * It is different from the other Event Cuts in that it interacts with
9  * the correlation function. In the parity violation study, we want a
10  * number associated with EVENTS, not PAIRS. Thus, this cut has a pair of
11  * histograms associated with it, one for real and one for mixed events.
12  * The AddRealPair() and AddMixedPair() methods of the correlation function
13  * have access to two data members of this EventCut class.
14  *
15  ***************************************************************************
16  *
17  **************************************************************************/
18 
19 #include "StHbtMaker/Cut/ParityEventCut.h"
20 #include <cstdio>
21 
22 #ifdef __ROOT__
23 ClassImp(ParityEventCut)
24 #endif
25 
26 ParityEventCut::ParityEventCut(const char* title, const int& nbins, const float& Lo, const float& Hi){
27  mNEventsPassed = mNEventsFailed = 0;
28 
29  RealQuantity = MixedQuantity = 0.0;
30  nReals = nMixed = 0;
31 
32  char Tit[100];
33  sprintf(Tit,"Real Events");
34  strcat(Tit,title);
35  mReals = new StHbt1DHisto(Tit,title,nbins,Lo,Hi);
36  sprintf(Tit,"Mixed Events");
37  strcat(Tit,title);
38  mMixed = new StHbt1DHisto(Tit,title,nbins,Lo,Hi);
39 }
40 //------------------------------
41 ParityEventCut::~ParityEventCut(){
42  delete mReals;
43  delete mMixed;
44 }
45 //------------------------------
46 bool ParityEventCut::Pass(const StHbtEvent* event){
47  if (nReals>0){ // fill the Reals histo
48  double temp = RealQuantity / nReals;
49  mReals->Fill(temp);
50  cout << "Real value was " << temp << " with " << nReals << " pairs" << endl;
51  RealQuantity = 0.0;
52  nReals = 0;
53  }
54  if (nMixed>0){ // fill the Mixed histo
55  double temp = MixedQuantity / nMixed;
56  mMixed->Fill(temp);
57  cout << "Mixed value was " << temp << " with " << nMixed << " pairs" << endl;
58  MixedQuantity = 0.0;
59  nMixed = 0;
60  }
61 
62  int mult = event->NumberOfTracks();
63  double VertexZPos = event->PrimVertPos().z();
64  cout << "ParityEventCut::Pass -- mult, VertexZPos : " << mult << " " << VertexZPos << endl;
65  bool goodEvent =
66  ((mult > mEventMult[0]) &&
67  (mult < mEventMult[1]) &&
68  (VertexZPos > mVertZPos[0]) &&
69  (VertexZPos < mVertZPos[1]));
70  goodEvent ? mNEventsPassed++ : mNEventsFailed++ ;
71  return (goodEvent);
72 }
73 //------------------------------
74 StHbtString ParityEventCut::Report(){
75  string Stemp;
76  char Ctemp[100];
77  sprintf(Ctemp,"Parity EventCut\nMultiplicity:\t %d-%d\n",mEventMult[0],mEventMult[1]);
78  Stemp = Ctemp;
79  sprintf(Ctemp,"Vertex Z-position:\t %E-%E\n",mVertZPos[0],mVertZPos[1]);
80  Stemp += Ctemp;
81  sprintf(Ctemp,"Number of events which passed:\t%ld Number which failed:\t%ld\n",mNEventsPassed,mNEventsFailed);
82  Stemp += Ctemp;
83  StHbtString returnThis = Stemp;
84  return returnThis;
85 }