StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEvtVtxSeedMaker.cxx
1 // //
3 // StEvtVtxSeedMaker 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 StEvent //
10 // //
12 
13 #include "StEvtVtxSeedMaker.h"
14 #include "StEventTypes.h"
15 #include "StMessMgr.h"
16 #include "StDetectorDbMaker/St_tpcPadConfigC.h"
17 
18 
19 ClassImp(StEvtVtxSeedMaker)
20 //_____________________________________________________________________________
21 StEvtVtxSeedMaker::StEvtVtxSeedMaker(const char *name):
22  StVertexSeedMaker(name), event(0) {
23 }
24 //_____________________________________________________________________________
26  event = static_cast<StEvent*>(GetInputDS("StEvent"));
27  if (!event) {
28  gMessMgr->Error("StEvtVtxSeedMaker: No StEvent found!");
29  return kStErr;
30  }
31 
32  int result = kStOk;
33  for (pvn=0; pvn<event->numberOfPrimaryVertices(); pvn++) {
34  result = StVertexSeedMaker::Make();
35  if (result != kStOk) break;
36  }
37 
38  return result;
39 }
40 //_____________________________________________________________________________
41 bool StEvtVtxSeedMaker::CheckTriggers() {
42  bool notTrig = kTRUE;
43 
44  // Check trigger ids
45  StTriggerIdCollection* trigIdColl = event->triggerIdCollection();
46  if (trigIdColl) {
47  const StTriggerId* tr = trigIdColl->nominal();
48  if (tr) {
49  vector<unsigned int> idVec = tr->triggerIds();
50  for (unsigned int iTrg = 0;
51  (notTrig) && (iTrg < idVec.size()) ; iTrg++) {
52  if (ValidTrigger(idVec[iTrg])) notTrig = kFALSE;
53  }
54  }
55  }
56  return notTrig;
57 }
58 //_____________________________________________________________________________
59 int StEvtVtxSeedMaker::GetEventData() {
60  // Get primary vertex from StEvent
61  StPrimaryVertex* primVtx = event->primaryVertex(pvn);
62  if (!primVtx) {
63  gMessMgr->Error("StEvtVtxSeedMaker: No primary vertex from StEvent!");
64  return kStErr;
65  }
66  StRunInfo* runInfo = event->runInfo();
67  if (runInfo) {
68  zdc = (float) (runInfo->zdcCoincidenceRate());
69  fill = (int) (runInfo->beamFillNumber(blue));
70  run = runInfo->runId();
71  }
72  timeEvent = event->time();
73 
74  StThreeVectorF pvert = primVtx->position();
75  StThreeVectorF epvert = primVtx->positionError();
76  zvertex = pvert.z();
77  yvertex = pvert.y();
78  xvertex = pvert.x();
79  eyvertex = epvert.y();
80  exvertex = epvert.x();
81 
82  rank = primVtx->ranking();
83  mult = 0;
84  hmatch = 0;
85  itpc = 0; otpc = 0;
86  for (unsigned int trkn=0; trkn<primVtx->numberOfDaughters(); trkn++) {
87  StTrack* primTrk = primVtx->daughter(trkn);
88  if (!(primTrk->bad())) {
89  // Number of good primary tracks for this vertex
90  mult++;
91  // primary vertex class doesn't store track count with HFT hits...
92  // ...find it ourselves
93  const StTrackFitTraits& fitTraits = primTrk->fitTraits();
94  if (fitTraits.numberOfFitPoints(kPxlId) +
95  fitTraits.numberOfFitPoints(kIstId) +
96  fitTraits.numberOfFitPoints(kSsdId))
97  hmatch++;
98  }
99  // Determine TPC sub-sectors of tracks associated with this vertex
100  // pack into bits 0..23
101  StPtrVecHit hits = primTrk->detectorInfo()->hits(kTpcId);
102  for (unsigned int hitn=0; hitn<hits.size(); hitn++) {
103  StTpcHit* hit = (StTpcHit*) (hits[hitn]);
104  // TPC padrow and sector indices use 1..n
105  int mask = 1<<(hit->sector()-1);
106  if (hit->padrow() <= St_tpcPadConfigC::instance()->innerPadRows(hit->sector())) itpc |= mask;
107  else otpc |= mask;
108  }
109  }
110 
111  const StBTofCollection* btofColl = event->btofCollection();
112  const StBTofHeader* btofHeader = (btofColl ? btofColl->tofHeader() : 0);
113  vpd_zvertex = (btofHeader ? btofHeader->vpdVz() : -999);
114 
115  //detmap will store number of matches in other detectors
116  detmap = 0;
117 
118  // cap at 7 in detmap (bits 0,1,2)
119  Packer( 0,3,bmatch,primVtx->numMatchesWithBEMC());
120 
121  // cap at 7 in detmap (bits 3,4,5)
122  Packer( 3,3,ematch,primVtx->numMatchesWithEEMC());
123 
124  // cap at 7 in detmap (bits 6,7,8)
125  Packer( 6,3,tmatch,primVtx->numMatchesWithBTOF());
126 
127  // cap at 3 in detmap (bits 9,10)
128  Packer( 9,2,cmatch,primVtx->numTracksCrossingCentralMembrane());
129 
130  // cap at 7 in detmap (bits 11,12,13)
131  Packer(11,3,hmatch,hmatch);
132 
133  // cap at 3 in detmap (bits 14,15)
134  Packer(14,2,pmatch,primVtx->numTracksWithPromptHit());
135 
136  // cap at 3 in detmap (bits 16,17,18)
137  Packer(16,3,pct ,primVtx->numPostXTracks());
138 
139  return kStOk;
140 }
141 //_____________________________________________________________________________
142 void StEvtVtxSeedMaker::PrintInfo() {
143  LOG_INFO << "\n**************************************************************"
144  << "\n* $Id: StEvtVtxSeedMaker.cxx,v 1.15 2018/04/11 02:43:21 smirnovd Exp $"
145  << "\n**************************************************************" << endm;
146 
147  if (Debug()) StVertexSeedMaker::PrintInfo();
148 }
149 //_____________________________________________________________________________
150 // $Id: StEvtVtxSeedMaker.cxx,v 1.15 2018/04/11 02:43:21 smirnovd Exp $
151 // $Log: StEvtVtxSeedMaker.cxx,v $
152 // Revision 1.15 2018/04/11 02:43:21 smirnovd
153 // Enable TPC/iTPC switch via St_tpcPadConfig
154 //
155 // This is accomplished by substituting St_tpcPadPlanes with St_tpcPadConfig.
156 // A sector ID is passed to St_tpcPadConfig in order to extract parameters for
157 // either TPC or iTPC
158 //
159 // Revision 1.14 2016/08/02 21:17:16 genevb
160 // Added tDay,tFill to resNtuple, and improved C++11 compliance
161 //
162 // Revision 1.13 2015/05/19 19:36:09 genevb
163 // Code cleanup in preparation for C++11
164 //
165 // Revision 1.12 2015/05/18 21:25:31 genevb
166 // Use HFT hits, some streamlining of for-loops
167 //
168 // Revision 1.11 2015/05/15 05:38:21 genevb
169 // Include prompt hits and post-crossing tracks, simplify detmap packing, update doxygen documentation
170 //
171 // Revision 1.10 2015/05/14 20:29:25 genevb
172 // Add z of VPD vertex
173 //
174 // Revision 1.9 2013/08/14 21:42:48 genevb
175 // Introduce time offsets, noclobber toggle, more matched-tracks controls
176 //
177 // Revision 1.8 2012/08/15 00:08:09 genevb
178 // ZDC sum rate -> ZDC coincidence rate
179 //
180 // Revision 1.7 2012/08/14 23:56:06 genevb
181 // detmap now includes BEMC+EEMC+BTOF+CM, added mean zdc to log output
182 //
183 // Revision 1.6 2009/06/12 17:09:17 genevb
184 // Match mult for MuDst and StEvent
185 //
186 // Revision 1.5 2009/05/22 23:50:50 genevb
187 // Code mods for BEMC matches, BeamWidth
188 //
189 // Revision 1.4 2008/05/21 17:48:38 genevb
190 // Use vertex errors for weighting
191 //
192 // Revision 1.3 2007/05/16 02:59:25 genevb
193 // printf => LOG_INFO
194 //
195 // Revision 1.2 2006/09/01 22:27:16 genevb
196 // More detailed info in ntuple
197 //
198 // Revision 1.1 2005/06/14 18:52:04 genevb
199 // Introduction of code to use StEvent for beamline constraint
200 //
201 //
virtual Int_t Make()
virtual Int_t Make()
Collection of trigger ids as stored in StEvent.
BeamLine Constraint calibration base class.
Definition: Stypes.h:44
Definition: Stypes.h:41