00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "StHbtMaker/Cut/ParityEventCut.h"
00020 #include <cstdio>
00021
00022 #ifdef __ROOT__
00023 ClassImp(ParityEventCut)
00024 #endif
00025
00026 ParityEventCut::ParityEventCut(const char* title, const int& nbins, const float& Lo, const float& Hi){
00027 mNEventsPassed = mNEventsFailed = 0;
00028
00029 RealQuantity = MixedQuantity = 0.0;
00030 nReals = nMixed = 0;
00031
00032 char Tit[100];
00033 sprintf(Tit,"Real Events");
00034 strcat(Tit,title);
00035 mReals = new StHbt1DHisto(Tit,title,nbins,Lo,Hi);
00036 sprintf(Tit,"Mixed Events");
00037 strcat(Tit,title);
00038 mMixed = new StHbt1DHisto(Tit,title,nbins,Lo,Hi);
00039 }
00040
00041 ParityEventCut::~ParityEventCut(){
00042 delete mReals;
00043 delete mMixed;
00044 }
00045
00046 bool ParityEventCut::Pass(const StHbtEvent* event){
00047 if (nReals>0){
00048 double temp = RealQuantity / nReals;
00049 mReals->Fill(temp);
00050 cout << "Real value was " << temp << " with " << nReals << " pairs" << endl;
00051 RealQuantity = 0.0;
00052 nReals = 0;
00053 }
00054 if (nMixed>0){
00055 double temp = MixedQuantity / nMixed;
00056 mMixed->Fill(temp);
00057 cout << "Mixed value was " << temp << " with " << nMixed << " pairs" << endl;
00058 MixedQuantity = 0.0;
00059 nMixed = 0;
00060 }
00061
00062 int mult = event->NumberOfTracks();
00063 double VertexZPos = event->PrimVertPos().z();
00064 cout << "ParityEventCut::Pass -- mult, VertexZPos : " << mult << " " << VertexZPos << endl;
00065 bool goodEvent =
00066 ((mult > mEventMult[0]) &&
00067 (mult < mEventMult[1]) &&
00068 (VertexZPos > mVertZPos[0]) &&
00069 (VertexZPos < mVertZPos[1]));
00070 goodEvent ? mNEventsPassed++ : mNEventsFailed++ ;
00071 return (goodEvent);
00072 }
00073
00074 StHbtString ParityEventCut::Report(){
00075 string Stemp;
00076 char Ctemp[100];
00077 sprintf(Ctemp,"Parity EventCut\nMultiplicity:\t %d-%d\n",mEventMult[0],mEventMult[1]);
00078 Stemp = Ctemp;
00079 sprintf(Ctemp,"Vertex Z-position:\t %E-%E\n",mVertZPos[0],mVertZPos[1]);
00080 Stemp += Ctemp;
00081 sprintf(Ctemp,"Number of events which passed:\t%ld Number which failed:\t%ld\n",mNEventsPassed,mNEventsFailed);
00082 Stemp += Ctemp;
00083 StHbtString returnThis = Stemp;
00084 return returnThis;
00085 }