StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMuL3Filter.cxx
1 /***************************************************************************
2  *
3  * $Id: StMuL3Filter.cxx,v 1.5 2003/10/20 19:50:13 perev Exp $
4  * Author: Frank Laue, BNL, laue@bnl.gov
5  *
6  ***************************************************************************/
7 
8 #include "StMuL3Filter.h"
9 #include "StMuDebug.h"
10 #include "StMuException.hh"
11 #include "StEvent/StTrack.h"
12 #include "StEvent/StTrackGeometry.h"
13 #include "StEvent/StTrackDetectorInfo.h"
14 #include "StEvent/StContainers.h"
15 #include "StEvent/StDedxPidTraits.h"
16 
17 
18 #include "StarClassLibrary/BetheBloch.h"
19 
20 ClassImp(StMuL3Filter)
21 
22 bool StMuL3Filter::accept( const StEvent* e) { cout << "StMuL3Filter::accept( const StEvent* e) not overwritten, returning true" << endl; return true;}
23 bool StMuL3Filter::accept( const StV0Vertex* v) { cout << "StMuL3Filter::accept(const StV0Vertex* v) not overwritten, returning true" << endl; return true;}
24 bool StMuL3Filter::accept( const StXiVertex* x) { cout << "StMuL3Filter::accept(const StXiVertex* x) not overwritten, returning true" << endl; return true;}
25 bool StMuL3Filter::accept( const StKinkVertex* k) { cout << "StMuL3Filter::accept(const StKinkVertex* k) not overwritten, returning true" << endl; return true;}
26 bool StMuL3Filter::accept( const StV0MuDst* v) { cout << "StMuL3Filter::accept(const StV0MuDst* v) not overwritten, returning true" << endl; return true;}
27 bool StMuL3Filter::accept( const StXiMuDst* x) { cout << "StMuL3Filter::accept(const StXiMuDst* x) not overwritten, returning true" << endl; return true;}
28 bool StMuL3Filter::accept( const StKinkMuDst* k) { cout << "StMuL3Filter::accept(const StKinkMuDst* k) not overwritten, returning true" << endl; return true;}
29 
30 
31 StMuL3Filter::StMuL3Filter() {
32  DEBUGMESSAGE3("");
33  cerr << "StMuL3Filter::StMuL3Filter(): called. Next BetheBloch instance is made." << endl;
34  mBB = new BetheBloch();
35  cerr << "StMuL3Filter::StMuL3Filter(): did you see the BetheBloch warning?" << endl;
36 }
37 
38 StMuL3Filter::~StMuL3Filter() {
39  delete mBB; mBB = 0;
40 }
41 
43 
44  float pCutHigh = 2.0; // high momentum cut for RICH/Upsilon candidates
45  int nHitsCutHighP = 10; // nHits cut for all tracks
46 
47  // following cuts apply only for tracks with pCutLow < p <pHigh
48  float pCutLow = 0.2; // low momentum cut
49  int nHitsCutLowP = 15;
50  int chargeForLowP = -1; // charge for tracks with pCutLow < p < pCutHigh, set to 0 for all tracks
51  float dEdxMassCutHigh = 0.939; // cut below BetheBloch(p/dEdxMassCutHigh), e.g. proton-band
52  float dEdxFractionCutHigh = 0.6; // cut fraction of dEdx-band, i.e. dEdxFractionCut * BetheBloch(p/dEdxMassCut)
53  float dEdxMassCutLow = 0.494; // cut above BetheBloch(p/dEdxMassCutLow), e.g. kaon-band
54  float dEdxFractionCutLow = 1.1;
55 
56  int iret = 0;
57 
58  // next: take all tracks above pCutHigh
59  if (track->geometry()->momentum().magnitude() > pCutHigh
60  && track->detectorInfo()->numberOfPoints() >= nHitsCutHighP)
61  iret = 1;
62 
63  // otherwise: take only neg. tracks in a certain dEdx-range
64  else {
65  if (track->detectorInfo()->numberOfPoints() >= nHitsCutLowP
66  && track->geometry()->momentum().magnitude() > pCutLow) {
67 
68  int chargeOK = 0;
69  int dedxOK = 0;
70 
71  // check charge
72  if (chargeForLowP==0)
73  chargeOK = 1;
74  else if (track->geometry()->charge() == chargeForLowP)
75  chargeOK = 1;
76 
77  // check dEdx
78  // if (mBB==0) mBB = new BetheBloch();
79  float p = track->geometry()->momentum().magnitude();
80  float dedxHigh = dEdxFractionCutHigh * mBB->Sirrf(p/dEdxMassCutHigh);
81  float dedxLow = dEdxFractionCutLow * mBB->Sirrf(p/dEdxMassCutLow);
82 
83  float dedx = 0;
84  // get track dEdx
85  const StSPtrVecTrackPidTraits& traits = track->pidTraits();
86  StDedxPidTraits* dedxPidTr;
87  for (unsigned int itrait = 0; itrait < traits.size(); itrait++){
88  dedxPidTr = 0;
89  if (traits[itrait]->detector() == kTpcId) {
90  StTrackPidTraits* thisTrait = traits[itrait];
91  dedxPidTr = dynamic_cast<StDedxPidTraits*>(thisTrait);
92  if (dedxPidTr && dedxPidTr->method() == kTruncatedMeanId) {
93  // adjust L3 dE/dx by a factor of 2 to match offline
94  dedx = 2 * dedxPidTr->mean();
95  }
96  }
97  }
98  if (dedx > dedxHigh && dedx > dedxLow)
99  dedxOK = 1;
100 
101  // final answer
102  iret = chargeOK * dedxOK;
103  } // if (pCutLow && nHitsCutLowP)
104 
105  }
106 
107  return (bool)iret;
108 }
109 
110 
111 /***************************************************************************
112  *
113  * $Log: StMuL3Filter.cxx,v $
114  * Revision 1.5 2003/10/20 19:50:13 perev
115  * workaround added for TClonesArray::Delete + some cleanup of MuEmc
116  *
117  * Revision 1.4 2003/01/23 21:59:50 laue
118  * Modification to compile on Solaris.
119  *
120  * Revision 1.3 2002/05/04 23:56:30 laue
121  * some documentation added
122  *
123  * Revision 1.2 2002/03/20 16:04:12 laue
124  * minor changes, mostly added access functions
125  *
126  * Revision 1.1 2002/03/08 17:04:18 laue
127  * initial revision
128  *
129  *
130  **************************************************************************/
bool accept(const StEvent *)
abstract cut function, has to be overwritten by derived class