StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
FcsJetFilter.cxx
1 #include "FcsJetFilter.h"
2 
3 #include "StarGenerator/EVENT/StarGenParticle.h"
4 #include "StarGenerator/EVENT/StarGenEvent.h"
5 #include <string>
6 #include <iostream>
7 #include <fstream>
8 #include <cmath>
9 #include <vector>
10 #include <algorithm>
11 
12 static const float ZFCS = 710.16 + 13.9 + 15.0;
13 static const float XFCSMin = 16.69;
14 static const float XFCSMax = 16.69 + 22.0*5.542;
15 static const float YFCS = 34.0/2.0 * 5.542;
16 static const float FVCUT = 20.0; //cm
17 static const float ETHR = 50.0;
18 
19 static int NTOT=0;
20 static int NGOOD=0;
21 
22 //_______________________________________________________________
23 FcsJetFilter::FcsJetFilter():StarFilterMaker("fcsJetFilter")
24 {
25  cout<<"FCS JET filter is used!!!"<<endl;
26 }
27 //_______________________________________________________________
29  NTOT++;
30  // Get a reference to the current event
31  StarGenEvent& event = *mEvent;
32 
33  //event.Print();
34  if(event.GetNumberOfParticles() <= 0) {return kError;}
35 
36  TIter Iterator = event.IterAll();
37  StarGenParticle *p = 0;
38 
39  float etot[2]={0.0,0.0};
40  while( ( p = (StarGenParticle*)Iterator.Next() ) ){
41  if(p->GetStatus() != 1)continue;
42  if(p->GetPz() < 0.0) continue;
43  //simple box cut
44  float x = p->GetVx()/10.0 + p->GetPx() / p->GetPz() * (ZFCS - p->GetVz()/10.0);
45  float absx=fabs(x);
46  if(absx<XFCSMin+FVCUT || absx>XFCSMax-FVCUT) continue;
47  float y = fabs (p->GetVy()/10.0 + p->GetPy() / p->GetPz() * (ZFCS - p->GetVz()/10.0));
48  if(y>YFCS-FVCUT) continue;
49  //it is hitting FCS
50  if(x>0.0) {etot[1]+=p->GetEnergy();} //south
51  else if(x<=0.0) {etot[0]+=p->GetEnergy();} //north
52  }
53  if(etot[0] > ETHR || etot[1] > ETHR){
54  NGOOD++;
55  cout << Form("FcsJetFilter : N_Genearted=%6d N_Accepted=%6d R=%6.4f",
56  NTOT,NGOOD,float(NGOOD)/float(NTOT) ) << endl;
57  return StarGenEvent::kAccept;
58  }
59  return StarGenEvent::kReject;
60 }
Float_t GetVz()
Get the z-component of the start vertex.
Int_t Filter(StarGenEvent *mEvent)
destructor
Int_t GetNumberOfParticles()
Obtain the number of particles in the event record.
Definition: StarGenEvent.h:187
Yet another particle class.
Int_t GetStatus()
Get the status code of the particle according to the HEPEVT standard.
Float_t GetPz()
Get the z-component of the momentum.
Float_t GetEnergy()
Get the energy.
Main filter class. Goes anywhere in the chain, filters StarGenEvent objects.
Float_t GetPx()
Get the x-component of the momentum.
Float_t GetVy()
Get the y-component of the start vertex.
Float_t GetPy()
Get the y-component of the momentum.
Base class for event records.
Definition: StarGenEvent.h:81
Float_t GetVx()
Get the x-component of the start vertex.
TIter IterAll(Bool_t dir=kIterForward)
Definition: StarGenEvent.h:173