StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMcAnalysisMaker.cxx
1 /*************************************************
2  *
3  * $Id: StMcAnalysisMaker.cxx,v 1.41 2016/06/21 20:39:03 jwebb Exp $
4  * $Log: StMcAnalysisMaker.cxx,v $
5  * Revision 1.41 2016/06/21 20:39:03 jwebb
6  * Init members. Protected against div by zero.
7  *
8  * Revision 1.40 2015/03/13 18:44:50 perev
9  * Roll back
10  *
11  * Revision 1.38 2011/04/03 16:02:40 fisyak
12  * Fix effect of constness in StAssociationMaker
13  *
14  * Revision 1.37 2010/06/22 16:23:25 fine
15  * introduce the correct const StMcTarck * pointer cast
16  *
17  * Revision 1.36 2010/05/10 17:15:34 fine
18  * RT # 1932 Remove the redundant correction. Restore 1.34 rev
19  *
20  * Revision 1.35 2010/05/07 20:17:18 fine
21  * Add CPP macro to separate McTracks
22  *
23  * Revision 1.34 2010/01/28 18:11:46 perev
24  * WarnOff
25  *
26  * Revision 1.33 2007/04/17 05:08:36 perev
27  * GetTFile()==>StMaker. Jerome request
28  *
29  * Revision 1.32 2007/03/21 17:14:36 fisyak
30  * Add keys for switch off Tpc, Svt and Ssd NTuples
31  *
32  * Revision 1.31 2006/06/20 02:39:38 calderon
33  * Fixed several changes from the last version which made this package not
34  * executable using the default StAssociator.C macro.
35  * Removed dependence on StBFChain, so the default StAssociator.C macro can work.
36  * Removed #if 0 commands which had taken out the track ntuple.
37  * Added back the missing code to produce the first 8 entries of the ntuple.
38  * Reverted to the file handling as was done before so that StAssociator.C can work.
39  * Kept the ntuples added by Yuri (but did not check them).
40  *
41  * Revision 1.30 2005/11/22 21:51:53 fisyak
42  * Add NTuple for svt and ssd hit
43  *
44  * Revision 1.29 2005/09/28 22:52:52 calderon
45  * Changed access to StMcEvent to use GetDataSet to be consistent with persistent StMcEvent.
46  *
47  * Revision 1.28 2005/07/19 22:04:49 perev
48  * MultiVertex
49  *
50  * Revision 1.27 2004/03/30 03:11:18 calderon
51  * Added information about the matching into the track Ntuple:
52  * - Dominatrack... (track with most common IdTruth, a.k.a. dominant contributor
53  * - nHitsIdTruth (should be very similar to commonTpcHits, but the distance cut
54  * option might make them different)
55  * - n MC hits for the dominatrack
56  * - n Fit points for the reconstructed track
57  * - n Points (from StDetectorInfo).
58  * - "quality" = average hit quality of the reco hits belonging to the dominatrack.
59  *
60  * Revision 1.26 2004/02/08 00:13:05 calderon
61  * Check that the size of the map is non-zero to get the first track.
62  *
63  * Revision 1.25 2004/02/08 00:10:58 calderon
64  * Histogram of rc hits is now not restricted to TPC only. Histogram of mc hits is
65  * done looping over tpc and svt hits.
66  * If the first entry of the track nodes is not associated, use the first entry of
67  * the map.
68  *
69  * Revision 1.24 2004/01/24 04:35:53 calderon
70  * The last commits using BFChain broke StAssociator. The histograms were
71  * not found and nothing was plotted. Revert back to the usual mode (this
72  * code is not meant to run in bfc anyway, it's meant as a collection of
73  * examples).
74  *
75  * Revision 1.23 2004/01/17 19:12:28 fisyak
76  * Add protection when StMcAnalysisMaker is not running within StBFChain and/or TFile is not coming from StBFChain parameters
77  *
78  * Revision 1.22 2004/01/13 21:06:04 fisyak
79  * Add TpcHitNtuple usind IdTruth info
80  *
81  * Revision 1.21 2003/09/02 17:58:41 perev
82  * gcc 3.2 updates + WarnOff
83  *
84  * Revision 1.20 2000/05/11 21:57:34 calderon
85  * Book the histograms before creating the file so that Kathy's macros
86  * can pick them up.
87  *
88  * Revision 1.19 2000/05/11 16:21:26 calderon
89  * Write only one V0 matched pair to supress the screen output.
90  *
91  * Revision 1.18 2000/04/20 21:31:52 calderon
92  * More checks for the cases where a track has no partner, Thanks Janet.
93  *
94  * Revision 1.17 2000/04/20 16:59:47 calderon
95  * Pick up the makers with the new names
96  * Change the name from "McAnalysis" to "StMcAnalysisMaker"
97  * No longer use the helix, use the primary track momentum when available
98  * (also avoids dependency on StEventSummary)
99  * Denominator for mom. resolution histograms is now simulated momentum.
100  *
101  * Revision 1.16 2000/04/12 21:33:57 calderon
102  * check case where no multimaps are found
103  *
104  * Revision 1.15 2000/04/04 23:18:12 calderon
105  * B -> B * kilogauss
106  *
107  * Revision 1.14 2000/03/28 02:28:04 calderon
108  * Return to calculating momentum at the origin, instead of taking the
109  * momentum from the first point.
110  *
111  * Revision 1.13 2000/03/06 21:47:56 calderon
112  * Add Lee's V0 example
113  *
114  * Revision 1.12 2000/02/07 16:43:37 calderon
115  * Find the first hit wherever it may be, instead of assuming a sector and padrow.
116  *
117  * Revision 1.11 2000/01/24 22:22:24 calderon
118  * use delete [] for the array of floats
119  *
120  * Revision 1.10 1999/12/14 07:08:48 calderon
121  * First version to work with new StEvent, StMcEvent & StAssociationMaker.
122  * Need to add more examples of all the new maps.
123  *
124  * Revision 1.9 1999/10/01 14:11:15 calderon
125  * Chech to see whether StEvent has primary vertex
126  * before trying to use it. If no primary vertex is
127  * found, assume its position is (0,0,0).
128  *
129  * Revision 1.8 1999/09/28 15:03:29 didenko
130  * Cleanup dependencies on non existing h-files
131  *
132  * Revision 1.7 1999/09/23 21:25:48 calderon
133  * Added Log & Id
134  * Modified includes according to Yuri
135  *
136  * Revision 1.6 1999/09/10 19:11:15 calderon
137  * Write the Ntuple in StMcAnalysisMaker into a file.
138  * This way it can be accessed after the macro finishes,
139  * otherwise it gets deleted.
140  *
141  * Revision 1.5 1999/09/09 23:59:37 calderon
142  * Made the following changes:
143  *
144  * -book histograms and ntuple in Init()
145  * -do not delete the histograms, they are supposed to be
146  * deleted automatically by the chain
147  * -don't create the canvas here, now done in the macro
148  *
149  * Revision 1.4 1999/07/30 16:19:19 calderon
150  * Use value_type typedef for inserting pairs in multimaps, Victor corrected iterators on HP in SL99h, Improved use of const for HP compilation
151  *
152  * Revision 1.3 1999/07/29 15:08:33 calderon
153  * Include Mom. Resolution example (Histograms & Ntuple)
154  *
155  * Revision 1.2 1999/07/28 20:27:30 calderon
156  * Version with SL99f libraries
157  *
158  *
159  * Examples that use the structures of
160  * StMcEvent and StAssociationMaker
161  *
162  *************************************************/
163 #include <assert.h>
164 #include <Stiostream.h>
165 #include <stdlib.h>
166 #include <string>
167 #include <vector>
168 #include <set>
169 #include <map>
170 #include <cmath>
171 
172 #include "TStyle.h"
173 #include "TCanvas.h"
174 #include "TH1.h"
175 #include "TH2.h"
176 #include "TNtuple.h"
177 #include "TFile.h"
178 
179 #include "StMcAnalysisMaker.h"
180 #include "PhysicalConstants.h"
181 #include "SystemOfUnits.h"
182 
183 #include "StMessMgr.h"
184 
185 #include "StAssociationMaker/StAssociationMaker.h"
186 #include "StAssociationMaker/StTrackPairInfo.hh"
187 
188 #include "StThreeVectorF.hh"
189 
190 #include "StEventTypes.h"
191 
192 #include "StMcEventTypes.hh"
193 
194 #include "StMcEvent.hh"
195 
196 // Define data Members for the histograms
197 const Int_t StMcAnalysisMaker::mNumDeltaX = 50;
198 const Int_t StMcAnalysisMaker::mNumDeltaZ = 50;
199 const Float_t StMcAnalysisMaker::mMinDeltaX = -0.52;
200 const Float_t StMcAnalysisMaker::mMaxDeltaX = 0.52;
201 const Float_t StMcAnalysisMaker::mMinDeltaZ = -0.52;
202 const Float_t StMcAnalysisMaker::mMaxDeltaZ = 0.52;
204  Float_t sector, row, isDet,
205  xM, yM, zM, pxM, pyM, pzM, dEM, dSM, nM,
206  xR, yR, zR, dER, IdM, IdR, qR, nR;
207 };
208 static const Char_t *vTpcHitMRPair = "sector:row:isDet:xM:yM:zM:pxM:pyM:pzM:dEM:dSM:nM:xR:yR:zR:dER:IdM:IdR:qR:nR";
209 static TpcHitMRPair_t TpcHitMRPair;
211  Float_t barrel, layer, ladder, wafer, hybrid, index,
212  xM, yM, zM, pxM, pyM, pzM, dEM, dSM, nM,
213  xR, yR, zR, dER, IdM, IdR, qR, nR;
214 };
215 static const Char_t *vSvtHitMRPair = "barrel:layer:ladder:wafer:hybrid:index:xM:yM:zM:pxM:pyM:pzM:dEM:dSM:nM:xR:yR:zR:dER:IdM:IdR:qR:nR";
216 static SvtHitMRPair_t SvtHitMRPair;
218  Float_t ladder, wafer,
219  xM, yM, zM, pxM, pyM, pzM, dEM, dSM, nM,
220  xR, yR, zR, dER, IdM, IdR, qR, nR;
221 };
222 static const Char_t *vSsdHitMRPair = "ladder:wafer:xM:yM:zM:pxM:pyM:pzM:dEM:dSM:nM:xR:yR:zR:dER:IdM:IdR:qR:nR";
223 static SsdHitMRPair_t SsdHitMRPair;
224 ClassImp(StMcAnalysisMaker)
225 
226 //_________________________________________________
227 StMcAnalysisMaker::StMcAnalysisMaker(const char *name, const char *title):
228  StMaker(name,title),
229  currentChain(0),
230  mMomResolution(0),
231  mHitResolution(0),
232  mSvtHitResolution(0),
233  mSsdHitResolution(0),
234  coordRec(0),
235  coordMcPartner(0),
236  mNtupleFile(0),
237  mTrackNtuple(0),
238  mTpcHitNtuple(0),
239  mSvtHitNtuple(0),
240  mSsdHitNtuple(0),
241  mAssociationCanvas(0),
242  mPadColumns(0),
243  mPadRows(0),
244  drawinit(0)
245 {
246  // StMcAnalysisMaker Constructor
247  // - zero all pointers defined in the header file
248  mAssociationCanvas = 0;
249  mMomResolution = 0;
250  mHitResolution = 0;
251  mSvtHitResolution = 0;
252  mSsdHitResolution = 0;
253  coordRec = 0;
254  coordMcPartner = 0;
255  mTrackNtuple = 0;
256  mTpcHitNtuple = 0;
257  mSvtHitNtuple = 0;
258  mSsdHitNtuple = 0;
259 }
260 
261 //_________________________________________________
262 StMcAnalysisMaker::~StMcAnalysisMaker()
263 {
264  // StMcAnalysisMaker Destructor
265  // delete the histograms
266  cout << "Inside StMcAnalysisMaker Destructor" << endl;
267  SafeDelete(mAssociationCanvas);
268 // SafeDelete(mMomResolution);
269 // SafeDelete(mHitResolution);
270 // SafeDelete(coordRec);
271 // SafeDelete(coordMcPartner);
272 // SafeDelete(mTrackNtuple);
273 }
274 
275 //_____________________________________________________________________________
276 
277 void StMcAnalysisMaker::Clear(const char*)
278 {
279  // StMcAnalysisMaker - Clear,
280  // Don't delete the canvas, so that it stays if needed
281 
282  StMaker::Clear();
283 }
284 
285 //_________________________________________________
287 {
288  if (mNtupleFile) {
289  mNtupleFile->Write();
290  mNtupleFile->Close();
291  }
292  return StMaker::Finish();
293 }
294 
295 
296 //_________________________________________________
297 Int_t StMcAnalysisMaker::Init()
298 {
299  // StMcAnalysisMaker - Init
300  SetZones(); // This is my method to set the zones for the canvas.
301 
302  mNtupleFile = GetTFile();
303  if (mNtupleFile) {mNtupleFile->cd(); mNtupleFile = 0;}
304  else {mNtupleFile = new TFile("TrackMapNtuple.root","RECREATE","Track Ntuple");}
305  // Book Histograms Here so they can be found and deleted by Victor's chain (I hope).
306  mHitResolution = new TH2F("hitRes","Delta Z Vs Delta X for Hits",
307  mNumDeltaX,mMinDeltaX,mMaxDeltaX,mNumDeltaZ,mMinDeltaZ,mMaxDeltaZ);
308  mHitResolution->SetXTitle("Delta X (cm)");
309  mHitResolution->SetYTitle("Delta Z (cm)");
310  mSvtHitResolution = new TH2F("SvtHitRes","Delta Z Vs Delta X for SvtHits",
311  mNumDeltaX,mMinDeltaX,mMaxDeltaX,mNumDeltaZ,mMinDeltaZ,mMaxDeltaZ);
312  mSvtHitResolution->SetXTitle("Delta X (cm)");
313  mSvtHitResolution->SetYTitle("Delta Z (cm)");
314 
315  mSsdHitResolution = new TH2F("SsdHitRes","Delta Z Vs Delta X for SsdHits",
316  mNumDeltaX,mMinDeltaX,mMaxDeltaX,mNumDeltaZ,mMinDeltaZ,mMaxDeltaZ);
317  mSsdHitResolution->SetXTitle("Delta X (cm)");
318  mSsdHitResolution->SetYTitle("Delta Z (cm)");
319 
320  mMomResolution = new TH1F("momRes","(|p| - |pmc|)/|pmc|",100,-1.,1.);
321  mMomResolution->SetXTitle("Resolution (%)");
322 
323  coordRec = new TH2F("coordRc","X vs Y pos. of Hits", 100, -200, 200, 100, -200, 200);
324  coordRec->SetXTitle("X (cm)");
325  coordRec->SetYTitle("Y (cm)");
326 
327  coordMcPartner = new TH2F("coordMc","X vs Y pos. of Hits", 100, -200, 200, 100, -200, 200);
328  coordMcPartner->SetXTitle("X (cm)");
329  coordMcPartner->SetYTitle("Y (cm)");
330 
331  // Define the file for the Ntuple, otherwise it won't be available later.
332  // one must define the file _after_ the histograms are booked, otherwise they are
333  // not owned by the maker, but are stored in the file, breaking the code in StAssociator.
334 
335  mNtupleFile = new TFile("TrackMapNtuple.root","RECREATE","Track Ntuple");
336 
337  const char* vars = "px:py:pz:p:pxrec:pyrec:pzrec:prec:commTpcHits:hitDiffX:hitDiffY:hitDiffZ:mcTrkId:mostCommIdTruth:nHitsIdTruth:nMcHits:nFitPts:nDetPts:quality";
338  mTrackNtuple = new TNtuple("TrackNtuple","Track Pair Info",vars);
339  mTrackNtuple->SetAutoSave(100000000);
340  if (! m_Mode || m_Mode & 0x1) {
341  mTpcHitNtuple = new TNtuple("TpcHitNtuple","the TPC hit pairs Info",vTpcHitMRPair);
342  mTpcHitNtuple->SetAutoSave(100000000);
343  }
344  if (! m_Mode || m_Mode & 0x2) {
345  mSvtHitNtuple = new TNtuple("SvtHitNtuple","the SVT hit pairs Info",vSvtHitMRPair);
346  mSvtHitNtuple->SetAutoSave(100000000);
347  }
348  if (! m_Mode || m_Mode & 0x4) {
349  mSsdHitNtuple = new TNtuple("SsdHitNtuple","the SSD hit pairs Info",vSsdHitMRPair);
350  mSsdHitNtuple->SetAutoSave(100000000);
351  }
352  return StMaker::Init();
353 }
354 //_________________________________________________
356 {
357  // Get the pointers we need, we have to use the titles we gave them in the
358  // macro. I just used the defaults.
359 
360  // StEvent
361  StEvent* rEvent = (StEvent*) GetInputDS("StEvent");
362  const StMcTrack *mTrack = 0;
363 
364  // StMcEvent
365  StMcEvent* mEvent = (StMcEvent*) GetDataSet("StMcEvent");
366 
367  // StAssociationMaker
368  StAssociationMaker* assoc = 0;
369  assoc = (StAssociationMaker*) GetMaker("StAssociationMaker");
370 
371  // the Multimaps...
372  rcTpcHitMapType* theHitMap = assoc->rcTpcHitMap();
373  mcTpcHitMapType* theMcHitMap = assoc->mcTpcHitMap();
374  rcSvtHitMapType* svtHitMap = assoc->rcSvtHitMap();
375  mcSvtHitMapType* svtMcHitMap = assoc->mcSvtHitMap();
376  rcSsdHitMapType* ssdHitMap = assoc->rcSsdHitMap();
377  mcSsdHitMapType* ssdMcHitMap = assoc->mcSsdHitMap();
378  rcTrackMapType* theTrackMap = assoc->rcTrackMap();
379  mcV0MapType* theMcV0Map = assoc->mcV0Map();
380 
381  if (!theHitMap) {
382  gMessMgr->Warning() << "----------WARNING----------\n"
383  << "No Hit Map found for this event!" << endm;
384  return kStWarn;
385  }
386  // Example: look at the position of the primary vertex
387  // Map is not needed for this, but it's a good check,
388  // tracking will not be good if primary vertex was not well placed.
389 
390  // First check whether the Primary Vertex is there at all.
391  StThreeVectorD VertexPos(0,0,0);
392  if (rEvent->primaryVertex()) {
393  VertexPos = rEvent->primaryVertex()->position();
394  cout << "Position of Primary Vertex from StEvent:" << endl;
395  cout << VertexPos << endl;
396  }
397  else {
398  cout << "----------- WARNING ------------" << endl;
399  cout << "No primary vertex from StEvent!!" << endl;
400  cout << "Assume it is at (0,0,0) " << endl;
401 
402  }
403  cout << "Position of Primary Vertex from StMcEvent:" << endl;
404  cout << mEvent->primaryVertex()->position() << endl;
405 
406  // Example: look at hits associated with 1st REC hit in Tpc Hit collection.
407 
408  StTpcHit* firstHit;
409  Bool_t gotOneHit;
410  StTpcHitCollection* tpcColl = rEvent->tpcHitCollection();
411  unsigned int j,k, nhits;
412  nhits = tpcColl->numberOfHits();
413  if (tpcColl && nhits) {
414  gotOneHit = kFALSE;
415  memset (&TpcHitMRPair, 0, sizeof(TpcHitMRPair_t));
416  for (k=0; !gotOneHit && k<tpcColl->numberOfSectors(); k++)
417  for (j=0; !gotOneHit && j<tpcColl->sector(k)->numberOfPadrows(); j++)
418  if (tpcColl->sector(k)->padrow(j)->hits().size()) {
419 
420  firstHit = tpcColl->sector(k)->padrow(j)->hits()[0];
421  cout << "First Hit Found in Sector "
422  << firstHit->sector() << " Padrow "
423  << firstHit->padrow() << endl;
424  gotOneHit = kTRUE;
425  }
426  cout << "This hit has " << theHitMap->count(firstHit) << " MC Hits associated with it."<< endl;
427  // To get the associated hits of the first hit we use equal_range(key), which returns
428  // 2 iterators, the lower bound and upper bound, so that then we can loop over them.
429 
430  cout << "Position of First Rec. Hit and Associated (if any) MC Hit:" << endl;
431  pair<rcTpcHitMapIter,rcTpcHitMapIter> hitBounds = theHitMap->equal_range(firstHit);
432  for (rcTpcHitMapIter it=hitBounds.first; it!=hitBounds.second; ++it)
433  cout << "[" << (*it).first->position() << ", " << (*it).second->position() << "]" << endl;
434  }
435  else {
436  cout << "There are no reconstructed TPC Hits in this event" << endl;
437  }
438  // Example: Make a histogram using the Hit Map.
439  // Fill histogram from map
440 
441  float DeltaX;
442  float DeltaZ;
443  if (theHitMap && mTpcHitNtuple) {// TPC
444  StTpcHitCollection* recHits = rEvent->tpcHitCollection();
445  StMcTpcHitCollection* mcHits = mEvent->tpcHitCollection();
446  assert (recHits || mcHits);
447  cout << "Making Hit Resolution Histogram..." << endl;
448  // Loop over Rec Hits
449 
450  for (unsigned int iSector=0; iSector< recHits->numberOfSectors(); iSector++) {
451  for (unsigned int iPadrow=0; iPadrow<recHits->sector(iSector)->numberOfPadrows();
452  iPadrow++) {
453  for (StTpcHitIterator iter = recHits->sector(iSector)->padrow(iPadrow)->hits().begin();
454  iter != recHits->sector(iSector)->padrow(iPadrow)->hits().end();
455  iter++) {
456  const StTpcHit *rhit = dynamic_cast<const StTpcHit *> (*iter);
457  assert(rhit);
458  if (rhit->TestBit(StMcHit::kMatched))
459  {
460  pair<rcTpcHitMapIter,rcTpcHitMapIter>
461  recBounds = theHitMap->equal_range(rhit);
462 
463  for (rcTpcHitMapIter it2=recBounds.first; it2!=recBounds.second; ++it2){
464 
465  const StMcTpcHit *mhit = dynamic_cast<const StMcTpcHit *> ((*it2).second);
466  assert ( mhit);
467  DeltaX = rhit->position().x() - mhit->position().x();
468  DeltaZ = rhit->position().z() - mhit->position().z();
469 
470  mHitResolution->Fill(DeltaX,DeltaZ);
471 
472  memset (&TpcHitMRPair, 0, sizeof(TpcHitMRPair));
473  TpcHitMRPair.sector = rhit->sector();
474  TpcHitMRPair.row = rhit->padrow();
475  TpcHitMRPair.xR = rhit->position().x();
476  TpcHitMRPair.yR = rhit->position().y();
477  TpcHitMRPair.zR = rhit->position().z();
478  TpcHitMRPair.dER = rhit->charge();
479  TpcHitMRPair.IdR = rhit->idTruth();
480  TpcHitMRPair.qR = rhit->qaTruth();
481  TpcHitMRPair.nR = theHitMap->count(rhit);
482  TpcHitMRPair.isDet = mhit->isDet();
483  TpcHitMRPair.xM = mhit->position().x();
484  TpcHitMRPair.yM = mhit->position().y();
485  TpcHitMRPair.zM = mhit->position().z();
486  TpcHitMRPair.pxM = mhit->localMomentum().x();
487  TpcHitMRPair.pyM = mhit->localMomentum().y();
488  TpcHitMRPair.pzM = mhit->localMomentum().z();
489  TpcHitMRPair.dEM = mhit->dE();
490  TpcHitMRPair.dSM = mhit->dS();
491  mTrack = mhit->parentTrack();
492  if (mTrack) TpcHitMRPair.IdM = mTrack->key();
493  else TpcHitMRPair.IdM = 0;
494  TpcHitMRPair.nM = theMcHitMap->count(mhit);
495  mTpcHitNtuple->Fill(&TpcHitMRPair.sector);
496  }
497  }
498  else {
499  memset (&TpcHitMRPair, 0, sizeof(TpcHitMRPair));
500  TpcHitMRPair.sector = rhit->sector();
501  TpcHitMRPair.row = rhit->padrow();
502  TpcHitMRPair.xR = rhit->position().x();
503  TpcHitMRPair.yR = rhit->position().y();
504  TpcHitMRPair.zR = rhit->position().z();
505  TpcHitMRPair.dER = rhit->charge();
506  TpcHitMRPair.IdR = rhit->idTruth();
507  TpcHitMRPair.qR = rhit->qaTruth();
508  TpcHitMRPair.nR = theHitMap->count(rhit);
509  mTpcHitNtuple->Fill(&TpcHitMRPair.sector);
510  }
511  }
512  }
513  }
514  for (unsigned int iSector=0;
515  iSector<mcHits->numberOfSectors(); iSector++) {
516 
517  if (Debug()) {cout << iSector + 1 << " "; flush(cout);}
518  StMcTpcSectorHitCollection* tpcSectHitColl = mcHits->sector(iSector);
519  for (unsigned int iPadrow=0;
520  iPadrow<tpcSectHitColl->numberOfPadrows();
521  iPadrow++) {
522  StMcTpcPadrowHitCollection* tpcPadRowHitColl = tpcSectHitColl->padrow(iPadrow);
523  for (unsigned int iHit=0;
524  iHit<tpcPadRowHitColl->hits().size();
525  iHit++){
526  const StMcTpcHit *mhit = dynamic_cast<const StMcTpcHit *> (tpcPadRowHitColl->hits()[iHit]);
527  assert (mhit);
528  if (mhit->TestBit(StMcHit::kMatched)) continue;
529  memset (&TpcHitMRPair, 0, sizeof(TpcHitMRPair));
530  TpcHitMRPair.sector = mhit->sector();
531  TpcHitMRPair.row = mhit->padrow();
532  TpcHitMRPair.isDet = mhit->isDet();
533  TpcHitMRPair.xM = mhit->position().x();
534  TpcHitMRPair.yM = mhit->position().y();
535  TpcHitMRPair.zM = mhit->position().z();
536  TpcHitMRPair.pxM = mhit->localMomentum().x();
537  TpcHitMRPair.pyM = mhit->localMomentum().y();
538  TpcHitMRPair.pzM = mhit->localMomentum().z();
539  TpcHitMRPair.dEM = mhit->dE();
540  TpcHitMRPair.dSM = mhit->dS();
541  mTrack = mhit->parentTrack();
542  if (mTrack) TpcHitMRPair.IdM = mTrack->key();
543  else TpcHitMRPair.IdM = 0;
544  mTpcHitNtuple->Fill(&TpcHitMRPair.sector);
545  }
546  }
547  }
548  }
549  if (svtHitMap && svtMcHitMap && mSvtHitNtuple) { // svt hits
550  StSvtHitCollection* recHits = rEvent->svtHitCollection();
551  StMcSvtHitCollection* mcHits = mEvent->svtHitCollection();
552  if (recHits && mcHits) {
553  for (unsigned int iBarrel=0; iBarrel< recHits->numberOfBarrels(); iBarrel++) {
554  for (unsigned int iLadder=0; iLadder<recHits->barrel(iBarrel)->numberOfLadders(); iLadder++) {
555  for (unsigned int iWafer = 0; iWafer < recHits->barrel(iBarrel)->ladder(iLadder)->numberOfWafers(); iWafer++) {
556  for (StSvtHitIterator iter = recHits->barrel(iBarrel)->ladder(iLadder)->wafer(iWafer)->hits().begin();
557  iter != recHits->barrel(iBarrel)->ladder(iLadder)->wafer(iWafer)->hits().end();
558  iter++) {
559  const StSvtHit *rhit = dynamic_cast<const StSvtHit *> (*iter);
560  assert(rhit);
561  if (rhit->TestBit(StMcHit::kMatched))
562  {
563  pair<rcSvtHitMapIter,rcSvtHitMapIter> recBounds = svtHitMap->equal_range(rhit);
564  for (rcSvtHitMapIter it2=recBounds.first; it2!=recBounds.second; ++it2){
565  const StMcSvtHit *mhit = dynamic_cast<const StMcSvtHit *> ((*it2).second);
566  assert ( mhit);
567  DeltaX = rhit->position().x() - mhit->position().x();
568  DeltaZ = rhit->position().z() - mhit->position().z();
569  mSvtHitResolution->Fill(DeltaX,DeltaZ);
570  memset (&SvtHitMRPair, 0, sizeof(SvtHitMRPair));
571  SvtHitMRPair.barrel = rhit->barrel();
572  SvtHitMRPair.ladder = rhit->ladder();
573  SvtHitMRPair.layer = rhit->layer();
574  SvtHitMRPair.wafer = rhit->wafer();
575  SvtHitMRPair.hybrid = rhit->hybrid();
576  SvtHitMRPair.index = rhit->index();
577  SvtHitMRPair.xR = rhit->position().x();
578  SvtHitMRPair.yR = rhit->position().y();
579  SvtHitMRPair.zR = rhit->position().z();
580  SvtHitMRPair.dER = rhit->charge();
581  SvtHitMRPair.IdR = rhit->idTruth();
582  SvtHitMRPair.qR = rhit->qaTruth();
583  SvtHitMRPair.nR = svtHitMap->count(rhit);
584  SvtHitMRPair.xM = mhit->position().x();
585  SvtHitMRPair.yM = mhit->position().y();
586  SvtHitMRPair.zM = mhit->position().z();
587  SvtHitMRPair.pxM = mhit->localMomentum().x();
588  SvtHitMRPair.pyM = mhit->localMomentum().y();
589  SvtHitMRPair.pzM = mhit->localMomentum().z();
590  SvtHitMRPair.dEM = mhit->dE();
591  SvtHitMRPair.dSM = mhit->dS();
592  mTrack = mhit->parentTrack();
593  if (mTrack) SvtHitMRPair.IdM = mTrack->key();
594  else SvtHitMRPair.IdM = 0;
595  SvtHitMRPair.nM = svtMcHitMap->count(mhit);
596  mSvtHitNtuple->Fill(&SvtHitMRPair.barrel);
597  }
598  }
599  else {
600  memset (&SvtHitMRPair, 0, sizeof(SvtHitMRPair));
601  SvtHitMRPair.barrel = rhit->barrel();
602  SvtHitMRPair.ladder = rhit->ladder();
603  SvtHitMRPair.layer = rhit->layer();
604  SvtHitMRPair.wafer = rhit->wafer();
605  SvtHitMRPair.hybrid = rhit->hybrid();
606  SvtHitMRPair.index = rhit->index();
607  SvtHitMRPair.xR = rhit->position().x();
608  SvtHitMRPair.yR = rhit->position().y();
609  SvtHitMRPair.zR = rhit->position().z();
610  SvtHitMRPair.dER = rhit->charge();
611  SvtHitMRPair.IdR = rhit->idTruth();
612  SvtHitMRPair.qR = rhit->qaTruth();
613  SvtHitMRPair.nR = svtHitMap->count(rhit);
614  mSvtHitNtuple->Fill(&SvtHitMRPair.barrel);
615  }
616  }
617  }
618  }
619  }
620  for (unsigned int iBarrel=0; iBarrel< mcHits->numberOfBarrels(); iBarrel++) {
621  for (unsigned int iLadder=0; iLadder<mcHits->barrel(iBarrel)->numberOfLadders(); iLadder++) {
622  for (unsigned int iWafer = 0; iWafer < mcHits->barrel(iBarrel)->ladder(iLadder)->numberOfWafers(); iWafer++) {
623  for (StMcSvtHitIterator iter = mcHits->barrel(iBarrel)->ladder(iLadder)->wafer(iWafer)->hits().begin();
624  iter != mcHits->barrel(iBarrel)->ladder(iLadder)->wafer(iWafer)->hits().end();
625  iter++) {
626  const StMcSvtHit *mhit = dynamic_cast<const StMcSvtHit *> (*iter);
627  assert (mhit);
628  if (mhit->TestBit(StMcHit::kMatched)) continue;
629  memset (&SvtHitMRPair, 0, sizeof(SvtHitMRPair));
630  SvtHitMRPair.barrel = mhit->barrel();
631  SvtHitMRPair.ladder = mhit->ladder();
632  SvtHitMRPair.layer = mhit->layer();
633  SvtHitMRPair.wafer = mhit->wafer();
634  SvtHitMRPair.hybrid = mhit->hybrid();
635  SvtHitMRPair.index = -1;
636  SvtHitMRPair.barrel = mhit->barrel();
637  SvtHitMRPair.ladder = mhit->ladder();
638  SvtHitMRPair.xM = mhit->position().x();
639  SvtHitMRPair.yM = mhit->position().y();
640  SvtHitMRPair.zM = mhit->position().z();
641  SvtHitMRPair.pxM = mhit->localMomentum().x();
642  SvtHitMRPair.pyM = mhit->localMomentum().y();
643  SvtHitMRPair.pzM = mhit->localMomentum().z();
644  SvtHitMRPair.dEM = mhit->dE();
645  SvtHitMRPair.dSM = mhit->dS();
646  mTrack = mhit->parentTrack();
647  if (mTrack) SvtHitMRPair.IdM = mTrack->key();
648  else SvtHitMRPair.IdM = 0;
649  mSvtHitNtuple->Fill(&SvtHitMRPair.barrel);
650  }
651  }
652  }
653  }
654  }
655  }
656  if (ssdHitMap && ssdMcHitMap && mSsdHitNtuple) { // ssd hits
657  StSsdHitCollection* recHits = rEvent->ssdHitCollection();
658  StMcSsdHitCollection* mcHits = mEvent->ssdHitCollection();
659  if (recHits && mcHits) {
660  for (unsigned int iLadder=0; iLadder<recHits->numberOfLadders(); iLadder++) {
661  for (unsigned int iWafer = 0; iWafer < recHits->ladder(iLadder)->numberOfWafers(); iWafer++) {
662  for (StSsdHitIterator iter = recHits->ladder(iLadder)->wafer(iWafer)->hits().begin();
663  iter != recHits->ladder(iLadder)->wafer(iWafer)->hits().end();
664  iter++) {
665  const StSsdHit *rhit = dynamic_cast<const StSsdHit *> (*iter);
666  assert(rhit);
667  if (rhit->TestBit(StMcHit::kMatched))
668  {
669  pair<rcSsdHitMapIter,rcSsdHitMapIter> recBounds = ssdHitMap->equal_range(rhit);
670  for (rcSsdHitMapIter it2=recBounds.first; it2!=recBounds.second; ++it2){
671  const StMcSsdHit *mhit = dynamic_cast<const StMcSsdHit *> ((*it2).second);
672  assert ( mhit);
673  DeltaX = rhit->position().x() - mhit->position().x();
674  DeltaZ = rhit->position().z() - mhit->position().z();
675  mSsdHitResolution->Fill(DeltaX,DeltaZ);
676  memset (&SsdHitMRPair, 0, sizeof(SsdHitMRPair));
677  SsdHitMRPair.ladder = rhit->ladder();
678  SsdHitMRPair.wafer = rhit->wafer();
679  SsdHitMRPair.xR = rhit->position().x();
680  SsdHitMRPair.yR = rhit->position().y();
681  SsdHitMRPair.zR = rhit->position().z();
682  SsdHitMRPair.dER = rhit->charge();
683  SsdHitMRPair.IdR = rhit->idTruth();
684  SsdHitMRPair.qR = rhit->qaTruth();
685  SsdHitMRPair.nR = ssdHitMap->count(rhit);
686  SsdHitMRPair.xM = mhit->position().x();
687  SsdHitMRPair.yM = mhit->position().y();
688  SsdHitMRPair.zM = mhit->position().z();
689  SsdHitMRPair.pxM = mhit->localMomentum().x();
690  SsdHitMRPair.pyM = mhit->localMomentum().y();
691  SsdHitMRPair.pzM = mhit->localMomentum().z();
692  SsdHitMRPair.dEM = mhit->dE();
693  SsdHitMRPair.dSM = mhit->dS();
694  mTrack = mhit->parentTrack();
695  if (mTrack) SsdHitMRPair.IdM = mTrack->key();
696  else SsdHitMRPair.IdM = 0;
697  SsdHitMRPair.nM = ssdMcHitMap->count(mhit);
698  mSsdHitNtuple->Fill(&SsdHitMRPair.ladder);
699  }
700  }
701  else {
702  memset (&SsdHitMRPair, 0, sizeof(SsdHitMRPair));
703  SsdHitMRPair.ladder = rhit->ladder();
704  SsdHitMRPair.wafer = rhit->wafer();
705  SsdHitMRPair.xR = rhit->position().x();
706  SsdHitMRPair.yR = rhit->position().y();
707  SsdHitMRPair.zR = rhit->position().z();
708  SsdHitMRPair.dER = rhit->charge();
709  SsdHitMRPair.IdR = rhit->idTruth();
710  SsdHitMRPair.qR = rhit->qaTruth();
711  SsdHitMRPair.nR = ssdHitMap->count(rhit);
712  mSsdHitNtuple->Fill(&SsdHitMRPair.ladder);
713  }
714  }
715  }
716  }
717  for (unsigned int iLadder=0; iLadder<mcHits->numberOfLadders(); iLadder++) {
718  for (unsigned int iWafer = 0; iWafer < mcHits->ladder(iLadder)->numberOfWafers(); iWafer++) {
719  for (StMcSsdHitIterator iter = mcHits->ladder(iLadder)->wafer(iWafer)->hits().begin();
720  iter != mcHits->ladder(iLadder)->wafer(iWafer)->hits().end();
721  iter++) {
722  const StMcSsdHit *mhit = dynamic_cast<const StMcSsdHit *> (*iter);
723  assert (mhit);
724  if (mhit->TestBit(StMcHit::kMatched)) continue;
725  memset (&SsdHitMRPair, 0, sizeof(SsdHitMRPair));
726  SsdHitMRPair.ladder = mhit->ladder();
727  SsdHitMRPair.wafer = mhit->wafer();
728  SsdHitMRPair.ladder = mhit->ladder();
729  SsdHitMRPair.xM = mhit->position().x();
730  SsdHitMRPair.yM = mhit->position().y();
731  SsdHitMRPair.zM = mhit->position().z();
732  SsdHitMRPair.pxM = mhit->localMomentum().x();
733  SsdHitMRPair.pyM = mhit->localMomentum().y();
734  SsdHitMRPair.pzM = mhit->localMomentum().z();
735  SsdHitMRPair.dEM = mhit->dE();
736  SsdHitMRPair.dSM = mhit->dS();
737  mTrack = mhit->parentTrack();
738  if (mTrack) SsdHitMRPair.IdM = mTrack->key();
739  else SsdHitMRPair.IdM = 0;
740  mSsdHitNtuple->Fill(&SsdHitMRPair.ladder);
741  }
742  }
743  }
744  }
745  }
746  cout << "Finished Making Histogram." << endl;
747 
748  if (!theTrackMap) {
749  gMessMgr->Warning() << "----------WARNING----------\n"
750  << "No Track Map found for this event!" << endm;
751  return kStWarn;
752  }
753  // Example: look at the magnitude of the momentum of
754  // the MC track associated with first track in track Collection
755 
756  StSPtrVecTrackNode& rcTrackNodes = rEvent->trackNodes();
757  StTrackNode* firstTrackNode = 0;
758  const StGlobalTrack* firstTrack = 0;
759  if (! rcTrackNodes.size()) {
760  cout << "Track Nodes List is empty!" << endl;
761  return kStWarn;
762  }
763  firstTrackNode = *(rcTrackNodes.begin());
764  if (! firstTrackNode) {
765  cout << "No tracks in Track Nodes List!" << endl;
766  return kStWarn;
767  }
768  firstTrack = dynamic_cast<const StGlobalTrack*>(firstTrackNode->track(global));
769  if (! firstTrack) {
770  cout << "GlobalTrack for first Track Nodehas not been found!" << endl;
771  return kStWarn;
772  }
773  cout << "MC Tracks associated with first Track in collection: " << theTrackMap->count(firstTrack) << endl;
774  if (!theTrackMap->count(firstTrack) && theTrackMap->size()) {
775  cout << "First track in track node container was not associated. Pick first track in map." << endl;
776  firstTrack = theTrackMap->begin()->first; //first entry in the map is a pair, and first entry of pair is the global track
777  }
778  pair<rcTrackMapIter,rcTrackMapIter> trackBounds = theTrackMap->equal_range(firstTrack);
779  cout << "Momentum of First Track and of Associated Tracks (if there are any):" << endl;
780  // Get the momentum of the track and compare it to MC Track.
781  // Use primary track if available
782  const StPrimaryTrack* pTrk = dynamic_cast<const StPrimaryTrack*>(firstTrack->node()->track(primary));
783  StThreeVectorD recMom(0,0,0);
784  if (pTrk)
785  recMom = pTrk->geometry()->momentum();
786  else
787  recMom = firstTrack->geometry()->momentum();
788  for (rcTrackMapIter trkIt=trackBounds.first; trkIt!=trackBounds.second; ++trkIt) {
789  const StMcTrack* origTrk = (*trkIt).second->partnerMcTrack();
790  cout << "[" << abs(recMom) << ", ";
791  cout << abs((*trkIt).second->partnerMcTrack()->momentum()) << "]" << endl;
792  cout << "These tracks have : \n";
793  cout << (*trkIt).second->commonTpcHits() << " TPC hits in common, out of " << origTrk->tpcHits().size() << endl;
794  cout << (*trkIt).second->commonSvtHits() << " SVT hits in common, out of " << origTrk->svtHits().size() << endl;
795  cout << (*trkIt).second->commonFtpcHits() <<" FTPC hits in common, out of " << origTrk->ftpcHits().size() << endl;
796  }
797  // Example: Make a histogram of the momentum resolution of the event
798  // Make an Ntuple with rec & monte carlo mom, mean hit difference, and # of common hits
799  const StGlobalTrack* recTrack;
800  const StPrimaryTrack* primTrk;
801  const StMcTrack* mcTrack;
802  StThreeVectorD p(0,0,0);
803  StThreeVectorD pmc(0,0,0);
804  float diff =0;
805 
806  float* values = new float[19];
807 
808  for (rcTrackMapIter tIter=theTrackMap->begin();
809  tIter!=theTrackMap->end(); ++tIter){
810 
811  recTrack = (*tIter).first;
812  //yf if ((*tIter).second->commonTpcHits()<10) continue;
813  mcTrack = (*tIter).second->partnerMcTrack();
814  pmc = mcTrack->momentum();
815  for (int k=0; k<3; k++) values[k] = pmc[k];
816  values[3]=pmc.mag();
817 
818  primTrk = dynamic_cast<const StPrimaryTrack*>(recTrack->node()->track(primary));
819  if (primTrk)
820  p = primTrk->geometry()->momentum();
821  else
822  p = recTrack->geometry()->momentum();
823 
824  for (int j=0; j<3; j++) values[j+4] = p[j];
825  values[7]=p.mag();
826  values[8]=(*tIter).second->commonTpcHits();
827  // Fill 1d Mom. resolution Histogram
828 
829  diff = (p.mag() - pmc.mag())/pmc.mag();
830  mMomResolution->Fill(diff,1.);
831  // Loop to get Mean hit position diff.
832  StThreeVectorF rHitPos(0,0,0);
833  StThreeVectorF mHitPos(0,0,0);
834 
835  StPtrVecHit recTpcHits = recTrack->detectorInfo()->hits(kTpcId);
836  multimap<int,float> idTruths;
837  set<int> uniqueIdTruths;
838  for (StHitIterator hi=recTpcHits.begin();
839  hi!=recTpcHits.end(); hi++) {
840  StHit* hit = *hi;
841  StTpcHit* rHit = dynamic_cast<StTpcHit*>(hit);
842  if (!rHit) { cout << "This Hit is not a TPC Hit"<< endl; continue;}
843  idTruths.insert( multimap<int,float>::value_type(rHit->idTruth(),rHit->qaTruth()));
844  uniqueIdTruths.insert(static_cast<int>(rHit->idTruth()));
845  pair<rcTpcHitMapIter,rcTpcHitMapIter> rBounds = theHitMap->equal_range(rHit);
846  for (rcTpcHitMapIter hIter=rBounds.first; hIter!=rBounds.second; hIter++) {
847  const StMcTpcHit* mHit = (*hIter).second;
848  if (mHit->parentTrack() != mcTrack) continue;
849  rHitPos += rHit->position();
850  mHitPos += mHit->position();
851  }// Associated Hits Loop.
852 
853  } // Hits of rec. Track Loop
854 
855  rHitPos /=(float) (*tIter).second->commonTpcHits();
856  mHitPos /=(float) (*tIter).second->commonTpcHits();
857  for (int jj=0; jj<3; jj++) values[9+jj] = rHitPos[jj] - mHitPos[jj];
858  values[12] = mcTrack->key();
859  // Figure out the most common IdTruth; the dominatrix track!
860  int mostCommonIdTruth = -9;
861  int cachedNHitsIdTruth = 0;
862  for (set<int>::iterator si=uniqueIdTruths.begin(); si!=uniqueIdTruths.end(); ++si) {
863  int currentNHitsIdTruth = idTruths.count(static_cast<int>(*si));
864  if (currentNHitsIdTruth>cachedNHitsIdTruth) {
865  mostCommonIdTruth = *si;
866  cachedNHitsIdTruth = currentNHitsIdTruth;
867  }
868  }
869  // at this point we know the most common IdTruth,
870  // now calculate the track "quality" for this track, averaging
871  // the hit qualities
872  float idQuality = 0;
873 
874  pair<multimap<int,float>::iterator,multimap<int,float>::iterator> mostCommRange = idTruths.equal_range(mostCommonIdTruth);
875  for (multimap<int,float>::iterator mi=mostCommRange.first; mi!=mostCommRange.second; ++mi) {
876  idQuality+=mi->second;
877  }
878  if (cachedNHitsIdTruth) { idQuality/=cachedNHitsIdTruth; }
879 
880  values[13] = mostCommonIdTruth;
881  values[14] = cachedNHitsIdTruth;
882  values[15] = mcTrack->tpcHits().size();
883  values[16] = recTrack->fitTraits().numberOfFitPoints(kTpcId);
884  values[17] = recTpcHits.size();
885  values[18] = idQuality;
886  mTrackNtuple->Fill(values);
887  } // Tracks in Map Loop
888  cout << "Finished Track Loop, Made Ntuple" << endl;
889  //delete vars;
890  delete [] values;
891  //mNtupleFile->Write(); // Write the Ntuple to the File in Finish(), not here
892 
893  // Example: Make 2 Histograms
894  // - x and y positions of the hits from the reconstructed track.
895  // - x and y positions of the hits from the Monte Carlo track.
896 
897  unsigned int maxCommonTpcHits = 0;
898  const StMcTrack* partner = 0;
899  trackBounds = theTrackMap->equal_range(firstTrack);
900  for (rcTrackMapIter rcIt = trackBounds.first;
901  rcIt != trackBounds.second;
902  ++rcIt) {
903  if ((*rcIt).second->commonTpcHits() > maxCommonTpcHits) {
904  partner = (*rcIt).second->partnerMcTrack();
905  maxCommonTpcHits = (*rcIt).second->commonTpcHits();
906  }
907  }
908  StHitIterator rcHitIt;
909  StMcTpcHitIterator mcHitIt;
910  StMcSvtHitIterator mcSitIt;
911  StPtrVecHit theHits = firstTrack->detectorInfo()->hits();
912  for (rcHitIt = theHits.begin();
913  rcHitIt != theHits.end();
914  rcHitIt++) coordRec->Fill((*rcHitIt)->position().x(),(*rcHitIt)->position().y());
915  if (partner) {
916  for (mcHitIt = ((std::vector<StMcTpcHit*> *)&partner->tpcHits() )->begin();
917  mcHitIt != partner->tpcHits().end();
918  mcHitIt++) coordMcPartner->Fill((*mcHitIt)->position().x(),(*mcHitIt)->position().y());
919  for (mcSitIt = ((std::vector<StMcSvtHit*> *)&partner->svtHits())->begin();
920  mcSitIt != partner->svtHits().end();
921  mcSitIt++) coordMcPartner->Fill((*mcSitIt)->position().x(),(*mcSitIt)->position().y());
922 
923  }
924  if (!theMcV0Map) {
925  gMessMgr->Warning() << "----------WARNING----------\n"
926  << "No V0 Map found for this event!" << endm;
927  return kStWarn;
928  }
929  //Example: Print out position of V0 vertices that have been associated.
930  // (LSB)
931  StSPtrVecMcVertex& mcVertices = mEvent->vertices();
932  const StV0Vertex* rcV0Partner;
933  StMcVertexIterator mcVertexIt;
934 
935  //Loop over all MC vertices
936  bool foundV0Pair = false;
937  for (mcVertexIt = mcVertices.begin(); mcVertexIt != mcVertices.end();
938  mcVertexIt++){
939  // Get the upper and lower bounds.
940  pair<mcV0MapIter,mcV0MapIter> mcV0Bounds = theMcV0Map->equal_range(*mcVertexIt);
941 
942  // Print out MC vertex position if there is an associated V0.
943 
944  if (mcV0Bounds.first != mcV0Bounds.second) {
945  cout << "Printing Position of a V0 pair:\n";
946  cout << "Position of MC V0 vertex: " << (*mcVertexIt)->position() << endl;
947  foundV0Pair = true;
948  }
949  //Now loop over the bounds
950  for(mcV0MapIter mcV0MapIt = mcV0Bounds.first;
951  mcV0MapIt != mcV0Bounds.second; ++mcV0MapIt){
952  rcV0Partner = (*mcV0MapIt).second;
953  cout << "Position of rc V0 vertex: " << rcV0Partner->position() << endl;
954 
955  }
956  if (foundV0Pair) break; // Only print the information of 1 reconstructed vertex, to avoid a lot of output.
957  }
958 
959 
960 
961  //mAssociationCanvas = new TCanvas("mAssociationCanvas", "Histograms",200,10,900,500);
962 
963  return kStOK;
964 }
Int_t m_Mode
counters
Definition: StMaker.h:81
TH2F * coordRec
Diff. between x and z coordinates of the hits.
TNtuple * mTpcHitNtuple
Miscellaneous info of the track pairs.
virtual Int_t Make()
Definition: StHit.h:125
virtual Int_t Finish()
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StMaker.cxx:634
TCanvas * mAssociationCanvas
Miscellaneous info of the TPC hit pairs.
TNtuple * mTrackNtuple
File to contain the mTrackNtuple, otherwise it is deleted!
Monte Carlo Track class All information on a simulated track is stored in this class: kinematics...
Definition: StMcTrack.hh:144
TH2F * mSvtHitResolution
Diff. between x and z coordinates of the hits.
TFile * mNtupleFile
X and Y coord of MC Track.
TNtuple * mSsdHitNtuple
Miscellaneous info of the TPC hit pairs.
Definition: Stypes.h:42
Definition: Stypes.h:40
TH2F * coordMcPartner
X and Y coord of rec. Track.
virtual Int_t Finish()
Definition: StMaker.cxx:776
TH2F * mHitResolution
Diff. between p of rec. &amp; Monte Carlo, in %.
rcTpcHitMapType * rcTpcHitMap()
Diff btw global r and phi coords of FTPC hits.
TH2F * mSsdHitResolution
Diff. between x and z coordinates of the hits.
Event data structure to hold all information from a Monte Carlo simulation. This class is the interfa...
Definition: StMcEvent.hh:169
TNtuple * mSvtHitNtuple
Miscellaneous info of the TPC hit pairs.