StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StuRefMult.hh
1 /***************************************************************************
2  *
3  * $Id: StuRefMult.hh,v 1.8 2018/06/29 17:21:24 perev Exp $
4  *
5  * Author: Manuel Calderon de la Barca Sanchez Aug 2000
6  ***************************************************************************
7  *
8  * Description:
9  * Function to give a standard reference multiplicity for
10  * an event, uncorrected of course. The agreed upon cuts are:
11  * primary tracks only
12  * flag > 0
13  * charge < 0 or charge > 0 depending on the name,
14  * fit points >= 10
15  * abs(eta) < 0.5
16  * dca < 3 cm
17  ***************************************************************************
18  *
19  * $Log: StuRefMult.hh,v $
20  * Revision 1.8 2018/06/29 17:21:24 perev
21  * Irakli_Jun29
22  *
23  * Revision 1.7 2005/08/19 03:50:58 perev
24  * Marco request
25  *
26  * Revision 1.6 2005/02/05 01:02:10 perev
27  * test for zero momentum added
28  *
29  * Revision 1.5 2001/11/14 19:47:08 calderon
30  * replace
31  * StPrimaryVertex* -> const StPrimaryVertex*
32  * everywhere for constistency
33  *
34  * Revision 1.4 2001/11/14 19:28:18 calderon
35  * Made the functions take as argument a const StEvent&, as per Mike's request.
36  * It is actually better to do this, as the function does not change the StEvent
37  * object, and now the language reflects this.
38  *
39  * Revision 1.3 2000/09/05 18:53:22 calderon
40  * Added the functions:
41  * 1) uncorrectedNumberOfPositivePrimaries
42  * 2) uncorrectedNumberOfPrimaries
43  * The first applies the same cuts as before but looks at positive particles
44  * and the second returns the sum of the 2. (Not the fastest way, but anyway...)
45  *
46  * Revision 1.2 2000/08/28 21:25:28 calderon
47  * changed the name of the function to
48  * uncorrectedNumberOfNegativePrimaries as per Frank's request
49  *
50  * Revision 1.1 2000/08/24 17:53:57 calderon
51  * Function to obtain a reference (uncorrected) multiplicity
52  * from StEvent. This counts track that satisfy the so called "Cut Set 1"
53  * described in the header and also in the README file.
54  *
55  *
56  **************************************************************************/
57 #ifndef StuRefMult_hh
58 #define StuRefMult_hh
59 
60 #include "StEventTypes.h"
61 
62 inline unsigned int
63 uncorrectedNumberOfNegativePrimaries(const StPrimaryVertex*& primVtx) {
64  const StSPtrVecPrimaryTrack& tracks = primVtx->daughters();
65  size_t countedTracks = 0;
66  for (StSPtrVecPrimaryTrackConstIterator iter = tracks.begin(); iter != tracks.end(); iter++) {
67  StTrack* track = (StTrack*) (*iter);
68  // these first 3 checks are easy, save time
69  if (track->flag()<0 || track->geometry()->charge()>0 || track->fitTraits().numberOfFitPoints()<10 ) continue;
70  // check eta, a bit more elaborate
71  if (fabs(track->geometry()->momentum().mag())<1.e-10) continue;
72  if (fabs(track->geometry()->momentum().pseudoRapidity())>0.5) continue;
73  // finally, check dca, if a track satisfies gets inside the if, count it.
74  if (track->geometry()->helix().distance(primVtx->position())<3) ++countedTracks;
75  }
76  return countedTracks;
77 }
78 
79 inline unsigned int
80 uncorrectedNumberOfNegativePrimaries(const StEvent& evt, int vtx_id = 0)
81 {
82  const StPrimaryVertex* primVtx = evt.primaryVertex(vtx_id);
83 
84  if (!primVtx) return 0;
85  return uncorrectedNumberOfNegativePrimaries(primVtx);
86 }
87 
88 inline unsigned int
89 uncorrectedNumberOfPositivePrimaries(const StPrimaryVertex*& primVtx) {
90  const StSPtrVecPrimaryTrack& tracks = primVtx->daughters();
91  size_t countedTracks = 0;
92  for (StSPtrVecPrimaryTrackConstIterator iter = tracks.begin(); iter != tracks.end(); iter++) {
93  StTrack* track = (StTrack* )(*iter);
94  // these first 3 checks are easy, save time
95  if (track->flag()<0 || track->geometry()->charge()<0 || track->fitTraits().numberOfFitPoints()<10 ) continue;
96  // check eta, a bit more elaborate
97  if (fabs(track->geometry()->momentum().mag())<=1.e-10) continue;
98  if (fabs(track->geometry()->momentum().pseudoRapidity())>0.5) continue;
99  // finally, check dca, if a track satisfies gets inside the if, count it.
100  if (track->geometry()->helix().distance(primVtx->position())<3) ++countedTracks;
101  }
102  return countedTracks;
103 }
104 
105 inline unsigned int
106 uncorrectedNumberOfPositivePrimaries(const StEvent& evt, int vtx_id = 0)
107 {
108  const StPrimaryVertex* primVtx = evt.primaryVertex(vtx_id);
109 
110  if (!primVtx) return 0;
111 
112  return uncorrectedNumberOfPositivePrimaries(primVtx);
113 }
114 
115 inline unsigned int
116 uncorrectedNumberOfPrimaries(const StEvent& evt, int vtx_id = 0)
117 {
118  const StPrimaryVertex* primVtx = evt.primaryVertex(vtx_id);
119 
120  if (!primVtx) return 0;
121 
122  return uncorrectedNumberOfPositivePrimaries(primVtx) + uncorrectedNumberOfNegativePrimaries(primVtx);
123 }
124 #endif
double distance(const StThreeVector< double > &p, bool scanPeriods=true) const
minimal distance between point and helix
Definition: StHelix.cc:240