StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
FcsDYFilter.cxx
1 #include "FcsDYFilter.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 + 1.5*5.542;
14 static const float XFCSMax = 16.69 + 22.0 * 5.542 - 1.5*5.542;
15 static const float YFCS = 34.0/2.0 * 5.542 - 1.5*5.542;
16 static const float ETCUT = 1.0;
17 static const float MASSCUT = 4.0;//2.5;
18 
19 static int ntot=0;
20 static int ngood=0;
21 
22 using namespace std;
23 //_______________________________________________________________
24 FcsDYFilter::FcsDYFilter():StarFilterMaker("fcsDYFilter"){
25  cout<<"FCS DY 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  // apply DY conditions for events
37  TIter Iterator = event.IterAll();
38  StarGenParticle *p = 0;
39  vector<StarGenParticle*> forwardParticles;
40  while( ( p = (StarGenParticle*)Iterator.Next() ) ){
41  if(p->GetStatus() != 1)continue;
42  int pid = abs(p->GetId());
43  if(pid!=11) continue; // e+ & e- only
44  if(p->GetPz()<0.0) continue; // +z direction only
45  if(p->pt()<ETCUT) continue;
46  //simple box cut around FCS (vertex here is in [mm])
47  float x = fabs (p->GetVx()/10.0 + p->GetPx() / p->GetPz() * (ZFCS - p->GetVz()/10.0));
48  if(x<XFCSMin || x>XFCSMax) continue;
49  float y = fabs (p->GetVy()/10.0 + p->GetPy() / p->GetPz() * (ZFCS - p->GetVz()/10.0));
50  if(y>YFCS) continue;
51  forwardParticles.push_back(p);
52  }
53  unsigned int size=forwardParticles.size();
54  if(size<2) return StarGenEvent::kReject;
55  for(unsigned int i=0; i<size-1; i++){
56  StarGenParticle *p1=forwardParticles.at(i);
57  float x1 = (p1->GetVx()/10.0 + p1->GetPx() / p1->GetPz() * (ZFCS - p1->GetVz()/10.0));
58  for(unsigned int j=i + 1; j<size; j++){
59  StarGenParticle *p2=forwardParticles.at(j);
60  TLorentzVector pair = p1->momentum() + p2->momentum();
61  float x2 = (p2->GetVx()/10.0 + p2->GetPx() / p2->GetPz() * (ZFCS - p2->GetVz()/10.0));
62  float xx_ep = x1*x2;//(p1->momentum().X())*(p2->momentum.X());
63  if(pair.M()>MASSCUT && xx_ep < 0) {
64  ngood++;
65  cout << Form("FcsDYFilter : N_Genearted=%6d N_Accepted=%6d R=%6.4f x1=%.3f x2=%.3f xx=%.3f",
66  ntot,ngood,float(ngood)/float(ntot), x1, x2, xx_ep) <<endl;
67  return (StarGenEvent::kAccept | 0x08);
68  }
69  }
70  }
71  return StarGenEvent::kReject;
72 }
Float_t GetVz()
Get the z-component of the start vertex.
Int_t GetNumberOfParticles()
Obtain the number of particles in the event record.
Definition: StarGenEvent.h:187
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.
Float_t GetPz()
Get the z-component of the momentum.
Int_t Filter(StarGenEvent *mEvent)
destructor
Definition: FcsDYFilter.cxx:28
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.
TLorentzVector momentum()
Return the 4-momentum of the particle.
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