StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMuDstVtxSeedMaker.cxx
1 // //
3 // StMuDstVtxSeedMaker class //
4 // Author: G. Van Buren, BNL //
5 // Description: calculates mean primary vertex positions from //
6 // suitable events to use as seeds in finding better //
7 // primary vertex positions (helpful for low //
8 // multiplicity events like pp collisions) //
9 // using MuDst //
10 // //
12 
13 #include "StMuDstVtxSeedMaker.h"
14 #include "StMuDSTMaker/COMMON/StMuDstMaker.h"
15 #include "StMuDSTMaker/COMMON/StMuDst.h"
16 #include "StMuDSTMaker/COMMON/StMuEvent.h"
17 #include "StMuDSTMaker/COMMON/StMuPrimaryVertex.h"
18 #include "StMuDSTMaker/COMMON/StMuTrack.h"
19 #include "StBTofHeader.h"
20 #include "StMessMgr.h"
21 
22 
23 ClassImp(StMuDstVtxSeedMaker)
24 //_____________________________________________________________________________
25 StMuDstVtxSeedMaker::StMuDstVtxSeedMaker(const char *name):
26  StVertexSeedMaker(name), mudst(0), event(0) {
27 }
28 //_____________________________________________________________________________
30  StMuDstMaker* mudstMaker = (StMuDstMaker*) GetMaker("MuDst");
31  if (!mudstMaker) {
32  gMessMgr->Error("StMuDstVtxSeedMaker: No StMuDstMaker(\"MuDst\") found!");
33  return kStErr;
34  }
35  mudst = mudstMaker->muDst();
36  if (!mudst) {
37  gMessMgr->Error("StMuDstVtxSeedMaker: No MuDst found!");
38  return kStErr;
39  }
40  event = mudst->event();
41  if (!event) {
42  gMessMgr->Error("StMuDstVtxSeedMaker: No MuEvent found!");
43  return kStErr;
44  }
45 
46  int result = kStOk;
47  for (pvn=0; pvn<mudst->numberOfPrimaryVertices(); pvn++) {
48  result = StVertexSeedMaker::Make();
49  if (result != kStOk) break;
50  }
51 
52  return result;
53 }
54 //_____________________________________________________________________________
55 bool StMuDstVtxSeedMaker::CheckTriggers() {
56  bool notTrig = kTRUE;
57 
58  // Check trigger ids
59  StMuTriggerIdCollection& trigIdColl = event->triggerIdCollection();
60  const StTriggerId& tr = trigIdColl.nominal();
61  vector<unsigned int> idVec = tr.triggerIds();
62  for (unsigned int iTrg = 0;
63  (notTrig) && (iTrg < idVec.size()) ; iTrg++) {
64  if (ValidTrigger(idVec[iTrg])) notTrig = kFALSE;
65  }
66  return notTrig;
67 }
68 //_____________________________________________________________________________
69 int StMuDstVtxSeedMaker::GetEventData() {
70  // Get primary vertex from MuEvent
71  StMuPrimaryVertex* primVtx = mudst->primaryVertex(pvn);
72  if (!primVtx) {
73  gMessMgr->Error("StMuDstVtxSeedMaker: No primary vertex from StMuDst!");
74  return kStErr;
75  }
76  StRunInfo& runInfo = event->runInfo();
77  zdc = (float) (runInfo.zdcCoincidenceRate());
78  fill = (int) (runInfo.beamFillNumber(blue));
79  run = runInfo.runId();
80  timeEvent = event->eventInfo().time();
81 
82  StThreeVectorF pvert = primVtx->position();
83  StThreeVectorF epvert = primVtx->posError();
84  zvertex = pvert.z();
85  yvertex = pvert.y();
86  xvertex = pvert.x();
87  eyvertex = epvert.y();
88  exvertex = epvert.x();
89 
90  StBTofHeader* btofHeader = mudst->btofHeader();
91  vpd_zvertex = (btofHeader ? btofHeader->vpdVz() : -999);
92 
93  mudst->setVertexIndex(pvn);
94  rank = primVtx->ranking();
95 
96  // Number of good primary tracks for this vertex
97  mult = mudst->numberOfPrimaryTracks();
98 
99  // primary vertex class doesn't store track count with HFT hits...
100  // ...find it ourselves
101  hmatch = 0;
102  for (int trkn=0; trkn<mult; trkn++) {
103  StMuTrack* primTrk = mudst->primaryTracks(trkn);
104  if (primTrk->nHitsFit(kPxlId) +
105  primTrk->nHitsFit(kIstId) +
106  primTrk->nHitsFit(kSsdId))
107  hmatch++;
108  }
109 
110  // hits not saved in MuDst
111  itpc = 0; otpc = 0;
112 
113  //detmap will store number of matches in other detectors
114  detmap = 0;
115 
116  // cap at 7 in detmap (bits 0,1,2)
117  Packer( 0,3,bmatch,primVtx->nBEMCMatch());
118 
119  // cap at 7 in detmap (bits 3,4,5)
120  Packer( 3,3,ematch,primVtx->nEEMCMatch());
121 
122  // cap at 7 in detmap (bits 6,7,8)
123  Packer( 6,3,tmatch,primVtx->nBTOFMatch());
124 
125  // cap at 3 in detmap (bits 9,10)
126  Packer( 9,2,cmatch,primVtx->nCrossCentralMembrane());
127 
128  // cap at 7 in detmap (bits 11,12,13)
129  Packer(11,3,hmatch,hmatch);
130 
131  // cap at 3 in detmap (bits 14,15)
132  Packer(14,2,pmatch,primVtx->nPromptTracks());
133 
134  // cap at 3 in detmap (bits 16,17,18)
135  Packer(16,3,pct ,primVtx->nPostXtracks());
136 
137  return kStOk;
138 }
139 //_____________________________________________________________________________
140 void StMuDstVtxSeedMaker::PrintInfo() {
141  LOG_INFO << "\n**************************************************************"
142  << "\n* $Id: StMuDstVtxSeedMaker.cxx,v 1.15 2016/08/02 21:17:17 genevb Exp $"
143  << "\n**************************************************************" << endm;
144 
145  if (Debug()) StVertexSeedMaker::PrintInfo();
146 }
147 //_____________________________________________________________________________
148 // $Id: StMuDstVtxSeedMaker.cxx,v 1.15 2016/08/02 21:17:17 genevb Exp $
149 // $Log: StMuDstVtxSeedMaker.cxx,v $
150 // Revision 1.15 2016/08/02 21:17:17 genevb
151 // Added tDay,tFill to resNtuple, and improved C++11 compliance
152 //
153 // Revision 1.14 2015/05/18 21:25:47 genevb
154 // Use HFT hits
155 //
156 // Revision 1.13 2015/05/15 05:38:21 genevb
157 // Include prompt hits and post-crossing tracks, simplify detmap packing, update doxygen documentation
158 //
159 // Revision 1.12 2015/05/14 20:29:25 genevb
160 // Add z of VPD vertex
161 //
162 // Revision 1.11 2013/08/14 21:42:48 genevb
163 // Introduce time offsets, noclobber toggle, more matched-tracks controls
164 //
165 // Revision 1.10 2012/08/15 00:08:09 genevb
166 // ZDC sum rate -> ZDC coincidence rate
167 //
168 // Revision 1.9 2012/08/14 23:56:06 genevb
169 // detmap now includes BEMC+EEMC+BTOF+CM, added mean zdc to log output
170 //
171 // Revision 1.8 2009/06/12 17:09:17 genevb
172 // Match mult for MuDst and StEvent
173 //
174 // Revision 1.7 2009/05/22 23:50:50 genevb
175 // Code mods for BEMC matches, BeamWidth
176 //
177 // Revision 1.6 2008/05/21 17:48:39 genevb
178 // Use vertex errors for weighting
179 //
180 // Revision 1.5 2007/05/16 02:59:25 genevb
181 // printf => LOG_INFO
182 //
183 // Revision 1.4 2006/09/01 22:27:16 genevb
184 // More detailed info in ntuple
185 //
186 // Revision 1.3 2005/07/01 21:46:59 genevb
187 // Remove extraneous print statement
188 //
189 // Revision 1.2 2005/07/01 21:46:01 genevb
190 // Specify output directory
191 //
192 // Revision 1.1 2005/06/14 18:52:20 genevb
193 // Introduction of code to use MuDst for beamline constraint
194 //
195 //
static StMuPrimaryVertex * primaryVertex()
return pointer to current primary vertex
Definition: StMuDst.h:322
StMuDst * muDst()
Definition: StMuDstMaker.h:425
virtual Int_t Make()
UShort_t nHitsFit() const
Return total number of hits used in fit.
Definition: StMuTrack.h:239
static TObjArray * primaryTracks()
returns pointer to a list of tracks belonging to the selected primary vertex
Definition: StMuDst.h:301
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
Definition: StMuDst.h:320
static StBTofHeader * btofHeader()
returns pointer to the btofHeader - dongx
Definition: StMuDst.h:423
BeamLine Constraint calibration base class.
Definition: Stypes.h:44
static void setVertexIndex(Int_t vtx_id)
Set the index number of the current primary vertex (used by both primaryTracks() functions and for St...
Definition: StMuDst.cxx:273
Collection of trigger ids as stored in MuDst.
Definition: Stypes.h:41