StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
FcsDYBGFilterSingle.cxx
1 #include "FcsDYBGFilterSingle.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 = 0;//2.5; //cm
17 static const float ETCUT = 0.8;
18 static const float DRCUT = 40.0;
19 static const float DYETCUT = 1.0;
20 static const float DYMASSCUT= 2.5;
21 
22 
23 static int ntot=0;
24 static int ngood=0;
25 
26 using namespace std;
27 //_______________________________________________________________
28 FcsDYBGFilterSingle::FcsDYBGFilterSingle():StarFilterMaker("fcsDYBGFilterSingle") {
29  cout<<"FCS DYBG filter is used!!!"<<endl;
30  cout<<"FCS DYBG filter swap particles="<<mSwap<<endl;
31 }
32 
33 FcsDYBGFilterSingle::FcsDYBGFilterSingle(int dy, int check, int swap):StarFilterMaker("fcsDYBGFilterSingle"), mDYmode(dy), mCheckmode(check), mSwap(swap){
34  cout<<"FCS DYBG filter is used!!!"<<endl;
35  cout<<"FCS DYBG filter DYMode="<<mDYmode<<endl;
36  cout<<"FCS DYBG filter Checkmode="<<mCheckmode<<endl;
37  cout<<"FCS DYBG filter swap particles="<<mSwap<<endl;
38 }
39 //_______________________________________________________________
41  ntot++;
42  // Get a reference to the current event
43  StarGenEvent& event = *mEvent;
44 
45  //event.Print();
46  int np=event.GetNumberOfParticles();
47  if(np <= 0) {return kError;}
48 
49  // apply DYBG conditions for events
50  TIter Iterator = event.IterAll();
51  StarGenParticle *p = 0;
52  vector<StarGenParticle*> forwardParticles;
53  while( ( p = (StarGenParticle*)Iterator.Next() ) ){
54  int pid = abs(p->GetId());
55 // if(p->GetStatus()!=1 || pid==111) continue;
56  if(p->GetStatus()!=1) continue;
57  if(p->GetPz()<0.0) continue; // +z direction only
58  if(p->pt()<ETCUT) continue;
59  forwardParticles.push_back(p);
60  }
61  unsigned int size=forwardParticles.size();
62  if(size<1) return StarGenEvent::kReject;
63  UInt_t res = 0x10;
64  bool isInSouth=0;
65  for(unsigned int i=0; i<size; i++){
66  StarGenParticle *p=forwardParticles.at(i);
67  float x = p->GetVx()/10.0 + p->GetPx() / p->GetPz() * (ZFCS - p->GetVz()/10.0);
68  float y = fabs (p->GetVy()/10.0 + p->GetPy() / p->GetPz() * (ZFCS - p->GetVz()/10.0));
69  if(x > XFCSMin && x < XFCSMax && y<YFCS) isInSouth=1;
70  }
71 
72  bool isInNorth=0;
73  for(unsigned int i=0; i<size; i++){
74  StarGenParticle *p=forwardParticles.at(i);
75  float x = p->GetVx()/10.0 + p->GetPx() / p->GetPz() * (ZFCS - p->GetVz()/10.0);
76  float xabs = fabs(x);
77  float y = fabs (p->GetVy()/10.0 + p->GetPy() / p->GetPz() * (ZFCS - p->GetVz()/10.0));
78  if(x > 0) continue;
79  if(xabs > XFCSMin && xabs < XFCSMax && y<YFCS) isInNorth=1;
80  }
81 
82  if(isInSouth && !isInNorth) {
83  ngood++;
84  cout << Form("FcsDYBGFilterSingle : N_Genearted=%6d N_Accepted=%6d R=%6.4f",
85  ntot,ngood,float(ngood)/float(ntot)) <<endl;
86  return (StarGenEvent::kAccept);
87  }
88  return StarGenEvent::kReject;
89 }
Float_t GetVz()
Get the z-component of the start vertex.
Float_t pt()
Returns the transverse momentum of the particle.
Yet another particle class.
Int_t GetStatus()
Get the status code of the particle according to the HEPEVT standard.
Int_t Filter(StarGenEvent *mEvent)
destructor
Float_t GetPz()
Get the z-component of the momentum.
Int_t GetId()
Get the id code of the particle according to the PDG standard.
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.