StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEvent.cxx
1 /***************************************************************************
2  *
3  * $Id: StEvent.cxx,v 2.61 2021/02/27 17:07:50 ullrich Exp $
4  *
5  * Author: Thomas Ullrich, Sep 1999
6  ***************************************************************************
7  *
8  * Description:
9  *
10  * Do not touch anything here unless you REALLY know what you are doing.
11  *
12  ***************************************************************************
13  *
14  * $Log: StEvent.cxx,v $
15  * Revision 2.61 2021/02/27 17:07:50 ullrich
16  * Added setFcsCollection method (Akio)
17  *
18  * Revision 2.60 2021/01/11 20:27:40 ullrich
19  * Updated to add FCS elements (Akio).
20  *
21  * Revision 2.59 2018/12/11 19:53:10 ullrich
22  * Added RICHf.
23  *
24  * Revision 2.58 2018/07/09 16:50:31 ullrich
25  * Added EToF hooks.
26  *
27  * Revision 2.57 2018/02/08 17:36:26 ullrich
28  * Changed for new EPD classes.
29  *
30  * Revision 2.56 2015/10/09 17:46:15 ullrich
31  * Changed type of mIdTruth from ushort to int.
32  *
33  * Revision 2.55 2015/05/13 17:06:13 ullrich
34  * Added hooks and interfaces to Sst detector (part of HFT).
35  *
36  * Revision 2.54 2014/04/10 16:00:12 jeromel
37  * Changes to inlcude Ist structure (Thomas OK-ed / may revisit some comments)
38  *
39  * Revision 2.53 2013/03/05 14:49:44 ullrich
40  * Added PxlHits to statistics().
41  *
42  * Revision 2.52 2013/03/05 14:42:45 ullrich
43  * Added StPxl hits and Containers.
44  *
45  * Revision 2.51 2012/04/16 20:22:16 ullrich
46  * Changes necessary to add Fgt package.
47  *
48  * Revision 2.50 2012/01/24 03:01:38 perev
49  * Etr detector added
50  *
51  * Revision 2.49 2011/10/17 00:13:49 fisyak
52  * Add handles for IdTruth info
53  *
54  * Revision 2.48 2011/10/13 17:52:22 perev
55  * Comment++
56  *
57  * Revision 2.47 2011/04/25 21:25:09 ullrich
58  * Modifications to hold MTD data.
59  *
60  * Revision 2.46 2011/04/01 19:43:19 perev
61  * Allow zero pointer for TBrowser. debug
62  *
63  * Revision 2.45 2011/02/01 19:47:36 ullrich
64  * Added HLT branch and hooks.
65  *
66  * Revision 2.44 2010/08/31 19:53:37 fisyak
67  * Remove SoftwareMonitors
68  *
69  * Revision 2.43 2010/01/08 22:43:44 ullrich
70  * Updates needed to add StFmsCollection and related classes.
71  *
72  * Revision 2.42 2009/11/23 22:22:25 ullrich
73  * Minor cleanup performed and hooks for RPS added.
74  *
75  * Revision 2.41 2009/11/23 16:34:06 fisyak
76  * Cleanup, remove dependence on dst tables, clean up software monitors
77  *
78  * Revision 2.40 2008/12/22 20:36:53 ullrich
79  * Added hooks for new ToF (BTof)
80  *
81  * Revision 2.39 2006/04/25 23:21:25 ullrich
82  * Modified addPrimaryVertex(). New 2nd arg: StPrimaryVertexOrder.
83  *
84  * Revision 2.38 2006/01/19 21:48:21 ullrich
85  * Add RnD collection.
86  *
87  * Revision 2.37 2005/06/15 21:58:16 ullrich
88  * Change sorting of primary tracks for PPV.
89  *
90  * Revision 2.36 2003/04/16 17:48:32 ullrich
91  * Added StTriggerData and inherited classe(s).
92  *
93  * Revision 2.35 2003/01/30 18:36:31 ullrich
94  * Added hooks for StTriggerIdCollection.
95  *
96  * Revision 2.34 2002/12/20 22:41:30 ullrich
97  * Added PMD.
98  *
99  * Revision 2.33 2002/01/17 01:34:07 ullrich
100  * Fixed the fix in psd() methods.
101  *
102  * Revision 2.32 2002/01/17 01:29:10 ullrich
103  * Fixed bug in psd() methods.
104  *
105  * Revision 2.31 2002/01/03 20:59:33 ullrich
106  * Added BBC and FPD.
107  *
108  * Revision 2.30 2001/12/01 15:40:47 ullrich
109  * Added StDetectorState access function.
110  *
111  * Revision 2.29 2001/11/10 23:53:23 ullrich
112  * Added calibration vertices.
113  *
114  * Revision 2.28 2001/11/07 21:19:42 ullrich
115  * Added L1 trigger.
116  *
117  * Revision 2.27 2001/09/18 00:15:25 ullrich
118  * Added StRunInfo and access functions.
119  *
120  * Revision 2.26 2001/06/05 21:59:56 perev
121  * Split in Streamer added
122  *
123  * Revision 2.25 2001/05/30 17:45:53 perev
124  * StEvent branching
125  *
126  * Revision 2.24 2001/05/17 22:56:18 ullrich
127  * Removed all usage of dst_summary_param.
128  *
129  * Revision 2.23 2001/04/25 17:42:28 perev
130  * HPcorrs
131  *
132  * Revision 2.22 2001/04/23 19:28:13 ullrich
133  * Added StClusteringHints and methods to access it.
134  *
135  * Revision 2.21 2001/04/05 04:00:49 ullrich
136  * Replaced all (U)Long_t by (U)Int_t and all redundant ROOT typedefs.
137  *
138  * Revision 2.20 2001/03/14 02:35:43 ullrich
139  * Added container and methods to handle PSDs.
140  *
141  * Revision 2.19 2001/03/09 05:23:53 ullrich
142  * Added new method statistics().
143  *
144  * Revision 2.18 2000/12/08 03:53:40 ullrich
145  * Prepared hooks for ToF.
146  *
147  * Revision 2.17 2000/09/25 14:47:25 ullrich
148  * Fixed problem in _lookup() and _lookupOrCreate().
149  *
150  * Revision 2.16 2000/09/25 14:21:27 ullrich
151  * Removed enums for content vector. Replaced by lookup function.
152  *
153  * Revision 2.15 2000/09/06 22:34:12 ullrich
154  * Changed mBunchCrossingNumber from scalar to array to hold all 64 bits.
155  *
156  * Revision 2.14 2000/06/19 01:32:15 perev
157  * Thomas StEvent branches added
158  *
159  * Revision 2.13 2000/05/24 15:46:05 ullrich
160  * Added setSummary() method.
161  *
162  * Revision 2.12 2000/05/22 21:47:12 ullrich
163  * Added RICH collection and related methods.
164  *
165  * Revision 2.11 2000/05/15 18:35:38 ullrich
166  * All data member related to collections and containers are now
167  * kept by pointer. The interface (public methods) stays the same.
168  * Those methods which returns references were modified to create
169  * an empty collection in case the pointer is null.
170  *
171  * Revision 2.10 2000/04/26 20:33:24 ullrich
172  * Removed redundant virtual keywords.
173  *
174  * Revision 2.9 2000/04/20 14:27:29 perev
175  * Add Dataset browser to StEvent browser
176  *
177  * Revision 2.8 2000/04/18 17:31:28 perev
178  * StEvent::Browse overload of TDataSet:;One
179  *
180  * Revision 2.7 2000/03/29 16:54:11 ullrich
181  * Added L3 trigger.
182  *
183  * Revision 2.6 2000/02/23 17:35:59 ullrich
184  * Changes due to the addition of the EMC to StEvent
185  *
186  * Revision 2.5 2000/02/11 16:14:00 ullrich
187  * Primary vertices automatically sorted in addPrimaryVertex().
188  *
189  * Revision 2.4 2000/01/13 21:06:22 lasiuk
190  * add rich pixel info/containers
191  *
192  * Revision 2.3 2000/01/05 16:02:25 ullrich
193  * SSD hits added to StEvent.
194  *
195  * Revision 2.2 1999/11/04 13:30:40 ullrich
196  * Added constructor without summary table
197  *
198  * Revision 2.1 1999/10/28 22:25:07 ullrich
199  * Adapted new StArray version. First version to compile on Linux and Sun.
200  *
201  * Revision 2.0 1999/10/12 18:41:53 ullrich
202  * Completely Revised for New Version
203  *
204  **************************************************************************/
205 #include <typeinfo>
206 #include <algorithm>
207 #include "TClass.h"
208 #include "TDataSetIter.h"
209 #include "TObjectSet.h"
210 #include "TBrowser.h"
211 #include "StCalibrationVertex.h"
212 #include "StDetectorState.h"
213 #include "StEvent.h"
214 #include "StEventClusteringHints.h"
215 #include "StEventInfo.h"
216 #include "StEventSummary.h"
217 #include "StTpcHitCollection.h"
218 #include "StRnDHitCollection.h"
219 #include "StEtrHitCollection.h"
220 #include "StSvtHitCollection.h"
221 #include "StSsdHitCollection.h"
222 #include "StSstHitCollection.h"
223 #include "StFtpcHitCollection.h"
224 #include "StEmcCollection.h"
225 #include "StEpdCollection.h"
226 #include "StFcsCollection.h"
227 #include "StFttCollection.h"
228 #include "StFmsCollection.h"
229 #include "StRHICfCollection.h"
230 #include "StRichCollection.h"
231 #include "StRpsCollection.h"
232 #include "StRunInfo.h"
233 #include "StTofCollection.h"
234 #include "StBTofCollection.h"
235 #include "StETofCollection.h"
236 #include "StMtdCollection.h"
237 #include "StFpdCollection.h"
238 #include "StPhmdCollection.h"
239 #include "StTrackDetectorInfo.h"
240 #include "StTriggerData.h"
241 #include "StTriggerDetectorCollection.h"
242 #include "StTriggerIdCollection.h"
243 #include "StPrimaryVertex.h"
244 #include "StL0Trigger.h"
245 #include "StL1Trigger.h"
246 #include "StL3Trigger.h"
247 #include "StPsd.h"
248 #include "event_header.h"
249 #include "StEventBranch.h"
250 #include "StHltEvent.h"
251 #include "StFgtCollection.h"
252 #include "StPxlHitCollection.h"
253 #include "StIstHitCollection.h"
254 #include "StFstEvtCollection.h"
255 #include "StFstHitCollection.h"
256 #include "StTrackNode.h"
257 #include "StTrack.h"
258 #include "StFwdTrackCollection.h"
259 #include "StGmtCollection.h"
260 
261 #ifndef ST_NO_NAMESPACES
262 using std::swap;
263 #endif
264 
265 TString StEvent::mCvsTag = "$Id: StEvent.cxx,v 2.61 2021/02/27 17:07:50 ullrich Exp $";
266 static const char rcsid[] = "$Id: StEvent.cxx,v 2.61 2021/02/27 17:07:50 ullrich Exp $";
267 
268 ClassImp(StEvent)
269 
270 //______________________________________________________________________________
271 template<class T> void _lookup(T*& val, StSPtrVecObject &vec)
272 {
273  val = 0;
274  for (unsigned int i=0; i<vec.size(); i++)
275  if (vec[i] && typeid(*vec[i]) == typeid(T)) {
276  val = static_cast<T*>(vec[i]);
277  break;
278  }
279 }
280 
281 //______________________________________________________________________________
282 template<class T> void _lookupOrCreate(T*& val, StSPtrVecObject &vec)
283 {
284  T* t = 0;
285  _lookup(t, vec);
286  if (!t) {
287  t = new T;
288  vec.push_back(t);
289  }
290  val = t;
291 }
292 
293 //______________________________________________________________________________
294 template<class T> void _lookupAndSet(T* val, StSPtrVecObject &vec)
295 {
296  for (unsigned int i=0; i<vec.size(); i++)
297  if (vec[i] && typeid(*vec[i]) == typeid(T)) {
298  delete vec[i];
299  vec[i] = val;
300  return;
301  }
302  if (!val) return;
303  vec.push_back(val);
304 }
305 
306 //______________________________________________________________________________
307 template<class T> void _lookupDynamic(T*& val, StSPtrVecObject &vec)
308 {
309  val = 0;
310  for (unsigned int i=0; i<vec.size(); i++)
311  if (vec[i]) {
312  val = dynamic_cast<T*>(vec[i]);
313  if (val) break;
314  }
315 }
316 
317 //______________________________________________________________________________
318 template<class T> void _lookupDynamicAndSet(T* val, StSPtrVecObject &vec)
319 {
320  T *test;
321  for (unsigned int i=0; i<vec.size(); i++) {
322  if (vec[i]) {
323  test = dynamic_cast<T*>(vec[i]);
324  if (test) {
325  delete vec[i];
326  vec[i] = val;
327  return;
328  }
329  }
330  }
331  if (!val) return;
332  vec.push_back(val);
333 }
334 
335 //______________________________________________________________________________
336 void StEvent::initToZero() { /* noop */ }
337 
338 //______________________________________________________________________________
339 StEvent::StEvent() : StXRefMain("StEvent")
340 {
341  GenUUId(); //Generate Universally Unique IDentifier
342  initToZero();
343 }
344 
345 //______________________________________________________________________________
346 StEvent::~StEvent()
347 { /* noop */ }
348 
349 TString
350 StEvent::type() const
351 {
352  StEventInfo* info = 0;
353  _lookup(info, mContent);
354  return info ? info->type() : TString();
355 }
356 
357 int
358 StEvent::id() const
359 {
360  StEventInfo* info = 0;
361  _lookup(info, mContent);
362  return info ? info->id() : 0;
363 }
364 
365 int
366 StEvent::runId() const
367 {
368  StEventInfo* info = 0;
369  _lookup(info, mContent);
370  return info ? info->runId() : 0;
371 }
372 
373 int
374 StEvent::time() const
375 {
376  StEventInfo* info = 0;
377  _lookup(info, mContent);
378  return info ? info->time() : 0;
379 }
380 
381 unsigned int
382 StEvent::triggerMask() const
383 {
384  StEventInfo* info = 0;
385  _lookup(info, mContent);
386  return info ? info->triggerMask() : 0;
387 }
388 
389 unsigned int
390 StEvent::bunchCrossingNumber(unsigned int i) const
391 {
392  StEventInfo* info = 0;
393  _lookup(info, mContent);
394  return info ? info->bunchCrossingNumber(i) : 0;
395 }
396 
398 StEvent::info()
399 {
400  StEventInfo* info = 0;
401  _lookup(info, mContent);
402  return info;
403 }
404 
405 const StEventInfo*
406 StEvent::info() const
407 {
408  StEventInfo* info = 0;
409  _lookup(info, mContent);
410  return info;
411 }
412 
413 StRunInfo*
414 StEvent::runInfo()
415 {
416  StRunInfo* info = 0;
417  _lookup(info, mContent);
418  return info;
419 }
420 
421 const StRunInfo*
422 StEvent::runInfo() const
423 {
424  StRunInfo* info = 0;
425  _lookup(info, mContent);
426  return info;
427 }
428 
430 StEvent::summary()
431 {
432  StEventSummary* summary = 0;
433  _lookup(summary, mContent);
434  return summary;
435 }
436 
437 const StEventSummary*
438 StEvent::summary() const
439 {
440  StEventSummary* summary = 0;
441  _lookup(summary, mContent);
442  return summary;
443 }
444 
445 const TString&
446 StEvent::cvsTag() { return mCvsTag; }
447 
448 //______________________________________________________________________________
449 StTpcHitCollection* StEvent::tpcHitCollection()
450 {
451  StTpcHitCollection *hits = 0;
452  _lookup(hits, mContent);
453  return hits;
454 }
455 
456 //______________________________________________________________________________
457 const StTpcHitCollection*
458 StEvent::tpcHitCollection() const
459 {
460  StTpcHitCollection *hits = 0;
461  _lookup(hits, mContent);
462  return hits;
463 }
464 
465 //______________________________________________________________________________
466 StRnDHitCollection* StEvent::rndHitCollection()
467 {
468  StRnDHitCollection *hits = 0;
469  _lookup(hits, mContent);
470  return hits;
471 }
472 
473 //______________________________________________________________________________
474 const StRnDHitCollection* StEvent::rndHitCollection() const
475 {
476  StRnDHitCollection *hits = 0;
477  _lookup(hits, mContent);
478  return hits;
479 }
480 
481 //______________________________________________________________________________
482 const StEtrHitCollection* StEvent::etrHitCollection() const
483 {
484  StEtrHitCollection *hits = 0;
485  _lookup(hits, mContent);
486  return hits;
487 }
488 
489 //______________________________________________________________________________
490  StEtrHitCollection* StEvent::etrHitCollection()
491 {
492  StEtrHitCollection *hits = 0;
493  _lookup(hits, mContent);
494  return hits;
495 }
496 //______________________________________________________________________________
497 StFtpcHitCollection* StEvent::ftpcHitCollection()
498 {
499  StFtpcHitCollection *hits = 0;
500  _lookup(hits, mContent);
501  return hits;
502 }
503 
504 const StFtpcHitCollection*
505 StEvent::ftpcHitCollection() const
506 {
507  StFtpcHitCollection *hits = 0;
508  _lookup(hits, mContent);
509  return hits;
510 }
511 
513 StEvent::svtHitCollection()
514 {
515  StSvtHitCollection *hits = 0;
516  _lookup(hits, mContent);
517  return hits;
518 }
519 
520 const StSvtHitCollection*
521 StEvent::svtHitCollection() const
522 {
523  StSvtHitCollection *hits = 0;
524  _lookup(hits, mContent);
525  return hits;
526 }
527 
529 StEvent::ssdHitCollection()
530 {
531  StSsdHitCollection *hits = 0;
532  _lookup(hits, mContent);
533  return hits;
534 }
535 
536 const StSsdHitCollection*
537 StEvent::ssdHitCollection() const
538 {
539  StSsdHitCollection *hits = 0;
540  _lookup(hits, mContent);
541  return hits;
542 }
543 
545 StEvent::sstHitCollection()
546 {
547  StSstHitCollection *hits = 0;
548  _lookup(hits, mContent);
549  return hits;
550 }
551 
552 const StSstHitCollection*
553 StEvent::sstHitCollection() const
554 {
555  StSstHitCollection *hits = 0;
556  _lookup(hits, mContent);
557  return hits;
558 }
559 
561 StEvent::emcCollection()
562 {
563  StEmcCollection *emc = 0;
564  _lookup(emc, mContent);
565  return emc;
566 }
567 
568 const StEmcCollection*
569 StEvent::emcCollection() const
570 {
571  StEmcCollection *emc = 0;
572  _lookup(emc, mContent);
573  return emc;
574 }
575 
577 StEvent::fcsCollection()
578 {
579  StFcsCollection *fcs = 0;
580  _lookup(fcs, mContent);
581  return fcs;
582 }
583 
584 const StFcsCollection*
585 StEvent::fcsCollection() const
586 {
587  StFcsCollection *fcs = 0;
588  _lookup(fcs, mContent);
589  return fcs;
590 }
591 
593 StEvent::fttCollection()
594 {
595  StFttCollection *ftt = 0;
596  _lookup(ftt, mContent);
597  return ftt;
598 }
599 
600 const StFttCollection*
601 StEvent::fttCollection() const
602 {
603  StFttCollection *ftt = 0;
604  _lookup(ftt, mContent);
605  return ftt;
606 }
607 
609 StEvent::fmsCollection()
610 {
611  StFmsCollection *fms = 0;
612  _lookup(fms, mContent);
613  return fms;
614 }
615 
616 const StFmsCollection*
617 StEvent::fmsCollection() const
618 {
619  StFmsCollection *fms = 0;
620  _lookup(fms, mContent);
621  return fms;
622 }
623 
625 StEvent::rhicfCollection()
626 {
627  StRHICfCollection *rhicf = 0;
628  _lookup(rhicf, mContent);
629  return rhicf;
630 }
631 
632 const StRHICfCollection*
633 StEvent::rhicfCollection() const
634 {
635  StRHICfCollection *rhicf = 0;
636  _lookup(rhicf, mContent);
637  return rhicf;
638 }
639 
641 StEvent::richCollection()
642 {
643  StRichCollection *rich = 0;
644  _lookup(rich, mContent);
645  return rich;
646 }
647 
648 const StRichCollection*
649 StEvent::richCollection() const
650 {
651  StRichCollection *rich = 0;
652  _lookup(rich, mContent);
653  return rich;
654 }
655 
657 StEvent::rpsCollection()
658 {
659  StRpsCollection *rps = 0;
660  _lookup(rps, mContent);
661  return rps;
662 }
663 
664 const StRpsCollection*
665 StEvent::rpsCollection() const
666 {
667  StRpsCollection *rps = 0;
668  _lookup(rps, mContent);
669  return rps;
670 }
671 
673 StEvent::tofCollection()
674 {
675  StTofCollection *tof = 0;
676  _lookup(tof, mContent);
677  return tof;
678 }
679 
680 const StTofCollection*
681 StEvent::tofCollection() const
682 {
683  StTofCollection *tof = 0;
684  _lookup(tof, mContent);
685  return tof;
686 }
687 
689 StEvent::btofCollection()
690 {
691  StBTofCollection *btof = 0;
692  _lookup(btof, mContent);
693  return btof;
694 }
695 
696 const StBTofCollection*
697 StEvent::btofCollection() const
698 {
699  StBTofCollection *btof = 0;
700  _lookup(btof, mContent);
701  return btof;
702 }
703 
705 StEvent::etofCollection()
706 {
707  StETofCollection *etof = 0;
708  _lookup(etof, mContent);
709  return etof;
710 }
711 
712 const StETofCollection*
713 StEvent::etofCollection() const
714 {
715  StETofCollection *etof = 0;
716  _lookup(etof, mContent);
717  return etof;
718 }
719 
721 StEvent::epdCollection()
722 {
723  StEpdCollection *epd = 0;
724  _lookup(epd, mContent);
725  return epd;
726 }
727 
728 const StEpdCollection*
729 StEvent::epdCollection() const
730 {
731  StEpdCollection *epd = 0;
732  _lookup(epd, mContent);
733  return epd;
734 }
735 
737 StEvent::mtdCollection()
738 {
739  StMtdCollection *mtd = 0;
740  _lookup(mtd, mContent);
741  return mtd;
742 }
743 
744 const StMtdCollection*
745 StEvent::mtdCollection() const
746 {
747  StMtdCollection *mtd = 0;
748  _lookup(mtd, mContent);
749  return mtd;
750 }
751 
753 StEvent::fpdCollection()
754 {
755  StFpdCollection *fpd = 0;
756  _lookup(fpd, mContent);
757  return fpd;
758 }
759 
760 const StFpdCollection*
761 StEvent::fpdCollection() const
762 {
763  StFpdCollection *fpd = 0;
764  _lookup(fpd, mContent);
765  return fpd;
766 }
767 
769 StEvent::phmdCollection()
770 {
771  StPhmdCollection *phmd = 0;
772  _lookup(phmd, mContent);
773  return phmd;
774 }
775 
776 const StPhmdCollection*
777 StEvent::phmdCollection() const
778 {
779  StPhmdCollection *phmd = 0;
780  _lookup(phmd, mContent);
781  return phmd;
782 }
783 
785 StEvent::triggerDetectorCollection()
786 {
788  _lookup(trg, mContent);
789  return trg;
790 }
791 
793 StEvent::triggerDetectorCollection() const
794 {
796  _lookup(trg, mContent);
797  return trg;
798 }
799 
801 StEvent::triggerIdCollection()
802 {
803  StTriggerIdCollection *trg = 0;
804  _lookup(trg, mContent);
805  return trg;
806 }
807 
809 StEvent::triggerIdCollection() const
810 {
811  StTriggerIdCollection *trg = 0;
812  _lookup(trg, mContent);
813  return trg;
814 }
815 
817 StEvent::triggerData()
818 {
819  StTriggerData *trg = 0;
820  _lookupDynamic(trg, mContent);
821  return trg;
822 }
823 
824 const StTriggerData*
825 StEvent::triggerData() const
826 {
827  StTriggerData *trg = 0;
828  _lookupDynamic(trg, mContent);
829  return trg;
830 }
831 
833 StEvent::l0Trigger()
834 {
835  StL0Trigger *trg = 0;
836  _lookup(trg, mContent);
837  return trg;
838 }
839 
840 const StL0Trigger*
841 StEvent::l0Trigger() const
842 {
843  StL0Trigger *trg = 0;
844  _lookup(trg, mContent);
845  return trg;
846 }
847 
849 StEvent::l1Trigger()
850 {
851  StL1Trigger *trg = 0;
852  _lookup(trg, mContent);
853  return trg;
854 }
855 
856 const StL1Trigger*
857 StEvent::l1Trigger() const
858 {
859  StL1Trigger *trg = 0;
860  _lookup(trg, mContent);
861  return trg;
862 }
863 
865 StEvent::l3Trigger()
866 {
867  StL3Trigger *trg = 0;
868  _lookup(trg, mContent);
869  return trg;
870 }
871 
872 const StL3Trigger*
873 StEvent::l3Trigger() const
874 {
875  StL3Trigger *trg = 0;
876  _lookup(trg, mContent);
877  return trg;
878 }
879 
880 StHltEvent*
881 StEvent::hltEvent()
882 {
883  StHltEvent *hlt = 0;
884  _lookup(hlt, mContent);
885  return hlt;
886 }
887 
888 const StHltEvent*
889 StEvent::hltEvent() const
890 {
891  StHltEvent *hlt = 0;
892  _lookup(hlt, mContent);
893  return hlt;
894 }
895 
897 StEvent::fgtCollection()
898 {
899  StFgtCollection *fgtCollection = 0;
900  _lookup(fgtCollection, mContent);
901  return fgtCollection;
902 }
903 
904 const StFgtCollection*
905 StEvent::fgtCollection() const
906 {
907  StFgtCollection *fgtCollection = 0;
908  _lookup(fgtCollection, mContent);
909  return fgtCollection;
910 }
911 
913 StEvent::gmtCollection()
914 {
915  StGmtCollection *gmtCollection = 0;
916  _lookup(gmtCollection, mContent);
917  return gmtCollection;
918 }
919 
920 const StGmtCollection*
921 StEvent::gmtCollection() const
922 {
923  StGmtCollection *gmtCollection = 0;
924  _lookup(gmtCollection, mContent);
925  return gmtCollection;
926 }
927 
928 
930 StEvent::istHitCollection()
931 {
932  StIstHitCollection *istHitCollection = 0;
933  _lookup(istHitCollection, mContent);
934  return istHitCollection;
935 }
936 
937 const StIstHitCollection*
938 StEvent::istHitCollection() const
939 {
940  StIstHitCollection *istHitCollection = 0;
941  _lookup(istHitCollection, mContent);
942  return istHitCollection;
943 }
944 
946 StEvent::fstEvtCollection()
947 {
948  StFstEvtCollection *fstEvtCollection = 0;
949  _lookup(fstEvtCollection, mContent);
950  return fstEvtCollection;
951 }
952 
953 const StFstEvtCollection*
954 StEvent::fstEvtCollection() const
955 {
956  StFstEvtCollection *fstEvtCollection = 0;
957  _lookup(fstEvtCollection, mContent);
958  return fstEvtCollection;
959 }
960 
962 StEvent::fstHitCollection()
963 {
964  StFstHitCollection *fstHitCollection = 0;
965  _lookup(fstHitCollection, mContent);
966  return fstHitCollection;
967 }
968 
969 const StFstHitCollection*
970 StEvent::fstHitCollection() const
971 {
972  StFstHitCollection *fstHitCollection = 0;
973  _lookup(fstHitCollection, mContent);
974  return fstHitCollection;
975 }
976 
978 StEvent::pxlHitCollection()
979 {
980  StPxlHitCollection *pxlHitCollection = 0;
981  _lookup(pxlHitCollection, mContent);
982  return pxlHitCollection;
983 }
984 
985 const StPxlHitCollection*
986 StEvent::pxlHitCollection() const
987 {
988  StPxlHitCollection *pxlHitCollection = 0;
989  _lookup(pxlHitCollection, mContent);
990  return pxlHitCollection;
991 }
992 
993 StSPtrVecTrackDetectorInfo&
994 StEvent::trackDetectorInfo()
995 {
996  StSPtrVecTrackDetectorInfo *info = 0;
997  _lookupOrCreate(info, mContent);
998  return *info;
999 }
1000 
1001 const StSPtrVecTrackDetectorInfo&
1002 StEvent::trackDetectorInfo() const
1003 {
1004  StSPtrVecTrackDetectorInfo *info = 0;
1005  _lookupOrCreate(info, mContent);
1006  return *info;
1007 }
1008 
1010 StEvent::fwdTrackCollection()
1011 {
1012  StFwdTrackCollection *fwdTracks = 0;
1013  _lookup(fwdTracks, mContent);
1014  return fwdTracks;
1015 }
1016 
1017 const StFwdTrackCollection*
1018 StEvent::fwdTrackCollection() const
1019 {
1020  StFwdTrackCollection *fwdTrack = 0;
1021  _lookup(fwdTrack, mContent);
1022  return fwdTrack;
1023 }
1024 
1025 StSPtrVecTrackNode&
1026 StEvent::trackNodes()
1027 {
1028  StSPtrVecTrackNode *nodes = 0;
1029  _lookupOrCreate(nodes, mContent);
1030  return *nodes;
1031 }
1032 
1033 const StSPtrVecTrackNode&
1034 StEvent::trackNodes() const
1035 {
1036  StSPtrVecTrackNode *nodes = 0;
1037  _lookupOrCreate(nodes, mContent);
1038  return *nodes;
1039 }
1040 
1041 unsigned int
1042 StEvent::numberOfPrimaryVertices() const
1043 {
1044  StSPtrVecPrimaryVertex *vertices = 0;
1045  _lookupOrCreate(vertices, mContent);
1046  return vertices ? vertices->size() : 0;
1047 }
1048 
1050 StEvent::primaryVertex(unsigned int i)
1051 {
1052  StSPtrVecPrimaryVertex *vertices = 0;
1053  _lookup(vertices, mContent);
1054  if (vertices && i < vertices->size())
1055  return (*vertices)[i];
1056  else
1057  return 0;
1058 }
1059 
1060 const StPrimaryVertex*
1061 StEvent::primaryVertex(unsigned int i) const
1062 {
1063  StSPtrVecPrimaryVertex *vertices = 0;
1064  _lookup(vertices, mContent);
1065  if (vertices && i < vertices->size())
1066  return (*vertices)[i];
1067  else
1068  return 0;
1069 }
1070 
1071 unsigned int
1072 StEvent::numberOfCalibrationVertices() const
1073 {
1074  StSPtrVecCalibrationVertex *vertices = 0;
1075  _lookupOrCreate(vertices, mContent);
1076  return vertices ? vertices->size() : 0;
1077 }
1078 
1080 StEvent::calibrationVertex(unsigned int i)
1081 {
1082  StSPtrVecCalibrationVertex *vertices = 0;
1083  _lookup(vertices, mContent);
1084  if (vertices && i < vertices->size())
1085  return (*vertices)[i];
1086  else
1087  return 0;
1088 }
1089 
1090 const StCalibrationVertex*
1091 StEvent::calibrationVertex(unsigned int i) const
1092 {
1093  StSPtrVecCalibrationVertex *vertices = 0;
1094  _lookup(vertices, mContent);
1095  if (vertices && i < vertices->size())
1096  return (*vertices)[i];
1097  else
1098  return 0;
1099 }
1100 
1101 StSPtrVecV0Vertex&
1102 StEvent::v0Vertices()
1103 {
1104  StSPtrVecV0Vertex *vertices = 0;
1105  _lookupOrCreate(vertices, mContent);
1106  return *vertices;
1107 }
1108 
1109 const StSPtrVecV0Vertex&
1110 StEvent::v0Vertices() const
1111 {
1112  StSPtrVecV0Vertex *vertices = 0;
1113  _lookupOrCreate(vertices, mContent);
1114  return *vertices;
1115 }
1116 
1117 StSPtrVecXiVertex&
1118 StEvent::xiVertices()
1119 {
1120  StSPtrVecXiVertex *vertices = 0;
1121  _lookupOrCreate(vertices, mContent);
1122  return *vertices;
1123 }
1124 
1125 const StSPtrVecXiVertex&
1126 StEvent::xiVertices() const
1127 {
1128  StSPtrVecXiVertex *vertices = 0;
1129  _lookupOrCreate(vertices, mContent);
1130  return *vertices;
1131 }
1132 
1133 StSPtrVecKinkVertex&
1134 StEvent::kinkVertices()
1135 {
1136  StSPtrVecKinkVertex *vertices = 0;
1137  _lookupOrCreate(vertices, mContent);
1138  return *vertices;
1139 }
1140 
1141 const StSPtrVecKinkVertex&
1142 StEvent::kinkVertices() const
1143 {
1144  StSPtrVecKinkVertex *vertices = 0;
1145  _lookupOrCreate(vertices, mContent);
1146  return *vertices;
1147 }
1148 
1150 StEvent::detectorState(StDetectorId det)
1151 {
1152  StSPtrVecDetectorState *states = 0;
1153  _lookup(states, mContent);
1154  if (states)
1155  for (unsigned int i=0; i<states->size(); i++)
1156  if ((*states)[i]->detector() == det) return (*states)[i];
1157  return 0;
1158 }
1159 
1160 const StDetectorState*
1161 StEvent::detectorState(StDetectorId det) const
1162 {
1163  StSPtrVecDetectorState *states = 0;
1164  _lookup(states, mContent);
1165  if (states)
1166  for (unsigned int i=0; i<states->size(); i++)
1167  if ((*states)[i]->detector() == det) return (*states)[i];
1168  return 0;
1169 }
1170 
1171 StPsd*
1172 StEvent::psd(StPwg p, int i)
1173 {
1174  StPsd *thePsd = 0;
1175  for (unsigned int k=0; k<mContent.size(); k++) {
1176  thePsd = dynamic_cast<StPsd*>(mContent[k]);
1177  if (thePsd && thePsd->pwg() == p && thePsd->id() == i)
1178  return thePsd;
1179  }
1180  return 0;
1181 }
1182 
1183 const StPsd*
1184 StEvent::psd(StPwg p, int i) const
1185 {
1186  const StPsd *thePsd = 0;
1187  for (unsigned int k=0; k<mContent.size(); k++) {
1188  thePsd = dynamic_cast<StPsd*>(mContent[k]);
1189  if (thePsd && thePsd->pwg() == p && thePsd->id() == i)
1190  return thePsd;
1191  }
1192  return 0;
1193 }
1194 
1195 unsigned int
1196 StEvent::numberOfPsds() const
1197 {
1198  int nPsds = 0;
1199  for (unsigned int i=0; i<mContent.size(); i++)
1200  if (dynamic_cast<StPsd*>(mContent[i])) nPsds++;
1201  return nPsds;
1202 }
1203 
1204 unsigned int
1205 StEvent::numberOfPsds(StPwg p) const
1206 {
1207  StPsd* thePsd;
1208  int nPsds = 0;
1209  for (unsigned int i=0; i<mContent.size(); i++) {
1210  thePsd = dynamic_cast<StPsd*>(mContent[i]);
1211  if (thePsd && thePsd->pwg() == p) nPsds++;
1212  }
1213  return nPsds;
1214 }
1215 
1216 StSPtrVecObject&
1217 StEvent::content() { return mContent; }
1218 
1220 StEvent::clusteringHints() const
1221 {
1222  StEventClusteringHints *hints = 0;
1223  _lookupOrCreate(hints, mContent);
1224  return hints;
1225 }
1226 
1228 StEvent::clusteringHints()
1229 {
1230  StEventClusteringHints *hints = 0;
1231  _lookupOrCreate(hints, mContent);
1232  hints->SetParent(this);
1233  return hints;
1234 }
1235 
1236 void
1237 StEvent::setType(const char* val)
1238 {
1239  StEventInfo* info = 0;
1240  _lookupOrCreate(info, mContent);
1241  info->setType(val);
1242 }
1243 
1244 void
1245 StEvent::setRunId(int val)
1246 {
1247  StEventInfo* info = 0;
1248  _lookupOrCreate(info, mContent);
1249  info->setRunId(val);
1250 }
1251 
1252 void
1253 StEvent::setId(int val)
1254 {
1255  StEventInfo* info = 0;
1256  _lookupOrCreate(info, mContent);
1257  info->setId(val);
1258 }
1259 
1260 void
1261 StEvent::setTime(int val)
1262 {
1263  StEventInfo* info = 0;
1264  _lookupOrCreate(info, mContent);
1265  info->setTime(val);
1266 }
1267 
1268 void
1269 StEvent::setTriggerMask(unsigned int val)
1270 {
1271  StEventInfo* info = 0;
1272  _lookupOrCreate(info, mContent);
1273  info->setTriggerMask(val);
1274 }
1275 
1276 void
1277 StEvent::setBunchCrossingNumber(unsigned int val, unsigned int i)
1278 {
1279  StEventInfo* info = 0;
1280  _lookupOrCreate(info, mContent);
1281  info->setBunchCrossingNumber(val, i);
1282 }
1283 
1284 void
1285 StEvent::setInfo(StEventInfo* val)
1286 {
1287  _lookupAndSet(val, mContent);
1288 }
1289 
1290 void
1291 StEvent::setRunInfo(StRunInfo* val)
1292 {
1293  _lookupAndSet(val, mContent);
1294 }
1295 
1296 void
1297 StEvent::setSummary(StEventSummary* val)
1298 {
1299  _lookupAndSet(val, mContent);
1300 }
1301 
1302 void
1303 StEvent::setTpcHitCollection(StTpcHitCollection* val)
1304 {
1305  _lookupAndSet(val, mContent);
1306 }
1307 
1308 void
1309 StEvent::setRnDHitCollection(StRnDHitCollection* val)
1310 {
1311  _lookupAndSet(val, mContent);
1312 }
1313 
1314 void
1315 StEvent::setFtpcHitCollection(StFtpcHitCollection* val)
1316 {
1317  _lookupAndSet(val, mContent);
1318 }
1319 
1320 void
1321 StEvent::setSvtHitCollection(StSvtHitCollection* val)
1322 {
1323  _lookupAndSet(val, mContent);
1324 }
1325 
1326 void
1327 StEvent::setSsdHitCollection(StSsdHitCollection* val)
1328 {
1329  _lookupAndSet(val, mContent);
1330 }
1331 
1332 void
1333 StEvent::setSstHitCollection(StSstHitCollection* val)
1334 {
1335  _lookupAndSet(val, mContent);
1336 }
1337 
1338 void
1339 StEvent::setEmcCollection(StEmcCollection* val)
1340 {
1341  _lookupAndSet(val, mContent);
1342 }
1343 
1344 void
1345 StEvent::setFmsCollection(StFmsCollection* val)
1346 {
1347  _lookupAndSet(val, mContent);
1348 }
1349 
1350 void
1351 StEvent::setFcsCollection(StFcsCollection* val)
1352 {
1353  _lookupAndSet(val, mContent);
1354 }
1355 
1356 void
1357 StEvent::setFttCollection(StFttCollection* val)
1358 {
1359  _lookupAndSet(val, mContent);
1360 }
1361 
1362 void
1363 StEvent::setRHICfCollection(StRHICfCollection* val)
1364 {
1365  _lookupAndSet(val, mContent);
1366 }
1367 
1368 void
1369 StEvent::setRichCollection(StRichCollection* val)
1370 {
1371  _lookupAndSet(val, mContent);
1372 }
1373 
1374 void
1375 StEvent::setRpsCollection(StRpsCollection* val)
1376 {
1377  _lookupAndSet(val, mContent);
1378 }
1379 
1380 void
1381 StEvent::setTofCollection(StTofCollection* val)
1382 {
1383  _lookupAndSet(val, mContent);
1384 }
1385 
1386 void
1387 StEvent::setBTofCollection(StBTofCollection* val)
1388 {
1389  _lookupAndSet(val, mContent);
1390 }
1391 
1392 void
1393 StEvent::setETofCollection(StETofCollection* val)
1394 {
1395  _lookupAndSet(val, mContent);
1396 }
1397 
1398 
1399 void
1400 StEvent::setEpdCollection(StEpdCollection* val)
1401 {
1402  _lookupAndSet(val, mContent);
1403 }
1404 
1405 void
1406 StEvent::setMtdCollection(StMtdCollection* val)
1407 {
1408  _lookupAndSet(val, mContent);
1409 }
1410 
1411 void
1412 StEvent::setFpdCollection(StFpdCollection* val)
1413 {
1414  _lookupAndSet(val, mContent);
1415 }
1416 
1417 void
1418 StEvent::setPhmdCollection(StPhmdCollection* val)
1419 {
1420  _lookupAndSet(val, mContent);
1421 }
1422 
1423 void
1424 StEvent::setTriggerDetectorCollection(StTriggerDetectorCollection* val)
1425 {
1426  _lookupAndSet(val, mContent);
1427 }
1428 
1429 void
1430 StEvent::setTriggerIdCollection(StTriggerIdCollection* val)
1431 {
1432  _lookupAndSet(val, mContent);
1433 }
1434 
1435 void
1436 StEvent::setTriggerData(StTriggerData* val)
1437 {
1438  _lookupDynamicAndSet(val, mContent);
1439 }
1440 
1441 void
1442 StEvent::setL0Trigger(StL0Trigger* val)
1443 {
1444  _lookupAndSet(val, mContent);
1445 }
1446 
1447 void
1448 StEvent::setL1Trigger(StL1Trigger* val)
1449 {
1450  _lookupAndSet(val, mContent);
1451 }
1452 
1453 void
1454 StEvent::setL3Trigger(StL3Trigger* val)
1455 {
1456  _lookupAndSet(val, mContent);
1457 }
1458 
1459 void
1460 StEvent::setEtrHitCollection(StEtrHitCollection* val)
1461 {
1462  _lookupAndSet(val, mContent);
1463 }
1464 
1465 void
1466 StEvent::setHltEvent(StHltEvent* val)
1467 {
1468  _lookupAndSet(val, mContent);
1469 }
1470 
1471 void
1472 StEvent::setFgtCollection(StFgtCollection* val)
1473 {
1474  _lookupAndSet(val, mContent);
1475 }
1476 
1477 void
1478 StEvent::setGmtCollection(StGmtCollection* val)
1479 {
1480  _lookupAndSet(val, mContent);
1481 }
1482 
1483 void
1484 StEvent::setIstHitCollection(StIstHitCollection* val)
1485 {
1486  _lookupAndSet(val, mContent);
1487 }
1488 
1489 void
1490 StEvent::setFstEvtCollection(StFstEvtCollection* val)
1491 {
1492  _lookupAndSet(val, mContent);
1493 }
1494 
1495 void
1496 StEvent::setFstHitCollection(StFstHitCollection* val)
1497 {
1498  _lookupAndSet(val, mContent);
1499 }
1500 
1501 void
1502 StEvent::setFwdTrackCollection(StFwdTrackCollection* val)
1503 {
1504  _lookupAndSet(val, mContent);
1505 }
1506 
1507 void
1508 StEvent::setPxlHitCollection(StPxlHitCollection* val)
1509 {
1510  _lookupAndSet(val, mContent);
1511 }
1512 
1513 void
1514 StEvent::addPrimaryVertex(StPrimaryVertex* vertex, StPrimaryVertexOrder order)
1515 {
1516  if (!vertex) return; // not a valid vertex, do nothing
1517 
1518  //
1519  // Add the vertex
1520  //
1521  StSPtrVecPrimaryVertex* vertexVector = 0;
1522  _lookupOrCreate(vertexVector, mContent);
1523  vertexVector->push_back(vertex);
1524 
1525  //
1526  // Sort vertices.
1527  // New vertex is last entry. We simply toggle through
1528  // the container starting at the back until the new entry
1529  // sits in place. Sorting strategy is given by
1530  // enumeration StPrimaryVertexOrder.
1531  //
1532  int i;
1533  switch (order) {
1534  case(orderByNumberOfDaughters):
1535  for (i=vertexVector->size()-1; i>0; i--) {
1536  if ((*vertexVector)[i]->numberOfDaughters() > (*vertexVector)[i-1]->numberOfDaughters())
1537  swap((*vertexVector)[i], (*vertexVector)[i-1]);
1538  else
1539  break;
1540  }
1541  break;
1542 
1543  case(orderByRanking):
1544  default:
1545  for (i=vertexVector->size()-1; i>0; i--) {
1546  if ((*vertexVector)[i]->ranking() > (*vertexVector)[i-1]->ranking())
1547  swap((*vertexVector)[i], (*vertexVector)[i-1]);
1548  else
1549  break;
1550  }
1551  break;
1552  }
1553 }
1554 
1555 void
1556 StEvent::addCalibrationVertex(StCalibrationVertex* vertex)
1557 {
1558  if (vertex) {
1559  StSPtrVecCalibrationVertex* vertexVector = 0;
1560  _lookupOrCreate(vertexVector, mContent);
1561  vertexVector->push_back(vertex);
1562  }
1563 }
1564 
1565 void
1566 StEvent::addDetectorState(StDetectorState *state)
1567 {
1568  if (state) {
1569  StSPtrVecDetectorState* stateVector = 0;
1570  _lookupOrCreate(stateVector, mContent);
1571  stateVector->push_back(state);
1572  }
1573 }
1574 
1575 void
1576 StEvent::addPsd(StPsd* p)
1577 {
1578  if (p) {
1579  if (psd(p->pwg(), p->id()))
1580  cerr << "StEvent::addPsd(): Error, PSD with same identifiers already exist. Nothing added." << endl;
1581  else
1582  mContent.push_back(p);
1583  }
1584 }
1585 
1586 void StEvent::removePsd(StPsd* p)
1587 {
1588  StSPtrVecObjectIterator iter;
1589  if (p) {
1590  for (iter = mContent.begin(); iter != mContent.end(); iter++)
1591  if (*iter == p)
1592  mContent.erase(iter);
1593  }
1594 }
1595 
1596 void StEvent::statistics()
1597 {
1598  cout << "Statistics and information for event " << id() << endl;
1599  cout << "\tthis: " << static_cast<void*>(this) << endl;
1600 // cout << "\tcvsTag: " << cvsTag() << endl;
1601  cout << "\ttype: " << type() << endl;
1602  cout << "\tid: " << id() << endl;
1603  cout << "\trunId: " << runId() << endl;
1604  cout << "\ttime: " << time() << endl;
1605  cout << "\ttriggerMask: " << triggerMask() << endl;
1606  cout << "\tbunchCrossingNumber(0): " << bunchCrossingNumber(0) << endl;
1607  cout << "\tbunchCrossingNumber(1): " << bunchCrossingNumber(1) << endl;
1608  cout << "\tStEventSummary: " << static_cast<void*>(summary()) << endl;
1609  cout << "\tStTpcHitCollection: " << static_cast<void*>(tpcHitCollection()) << endl;
1610  cout << "\tStRnDHitCollection: " << static_cast<void*>(rndHitCollection()) << endl;
1611  cout << "\tStFtpcHitCollection: " << static_cast<void*>(ftpcHitCollection()) << endl;
1612  cout << "\tStSvtHitCollection: " << static_cast<void*>(svtHitCollection()) << endl;
1613  cout << "\tStSsdHitCollection: " << static_cast<void*>(ssdHitCollection()) << endl;
1614  cout << "\tStSstHitCollection: " << static_cast<void*>(sstHitCollection()) << endl;
1615  cout << "\tStIstHitCollection: " << static_cast<void*>(istHitCollection()) << endl;
1616  cout << "\tStFstEvtCollection: " << static_cast<void*>(fstEvtCollection()) << endl;
1617  cout << "\tStFstHitCollection: " << static_cast<void*>(fstHitCollection()) << endl;
1618  cout << "\tStPxlHitCollection: " << static_cast<void*>(pxlHitCollection()) << endl;
1619  cout << "\tStEmcCollection: " << static_cast<void*>(emcCollection()) << endl;
1620  cout << "\tStFmsCollection: " << static_cast<void*>(fmsCollection()) << endl;
1621  cout << "\tStRHICfCollection: " << static_cast<void*>(rhicfCollection()) << endl;
1622  cout << "\tStRichCollection: " << static_cast<void*>(richCollection()) << endl;
1623  cout << "\tStRpsCollection: " << static_cast<void*>(rpsCollection()) << endl;
1624  cout << "\tStTofCollection: " << static_cast<void*>(tofCollection()) << endl;
1625  cout << "\tStBTofCollection: " << static_cast<void*>(btofCollection()) << endl;
1626  cout << "\tStETofCollection: " << static_cast<void*>(etofCollection()) << endl;
1627  cout << "\tStEpdCollection: " << static_cast<void*>(epdCollection()) << endl;
1628  cout << "\tStMtdCollection: " << static_cast<void*>(mtdCollection()) << endl;
1629  cout << "\tStFpdCollection: " << static_cast<void*>(fpdCollection()) << endl;
1630  cout << "\tStPhmdCollection: " << static_cast<void*>(phmdCollection()) << endl;
1631  cout << "\tStL0Trigger: " << static_cast<void*>(l0Trigger()) << endl;
1632  cout << "\tStL1Trigger: " << static_cast<void*>(l0Trigger()) << endl;
1633  cout << "\tStL3Trigger: " << static_cast<void*>(l3Trigger()) << endl;
1634  cout << "\tStHltEvent: " << static_cast<void*>(hltEvent()) << endl;
1635  cout << "\tStTriggerDetectorCollection: " << static_cast<void*>(triggerDetectorCollection()) << endl;
1636  cout << "\tStTriggerIdCollection: " << static_cast<void*>(triggerIdCollection()) << endl;
1637  cout << "\tStTriggerData: " << static_cast<void*>(triggerData()) << endl;
1638  cout << "\tStPrimaryVertex: " << static_cast<void*>(primaryVertex(0)) << endl;
1639  cout << "\tnumberOfPrimaryVertices: " << numberOfPrimaryVertices() << endl;
1640  cout << "\tStCalibrationVertex: " << static_cast<void*>(calibrationVertex(0));
1641  cout << "\tnumberOfCalibrationVertices: " << numberOfCalibrationVertices() << endl;
1642  cout << "\t# of TPC hits: " << (tpcHitCollection() ? tpcHitCollection()->numberOfHits() : 0) << endl;
1643  cout << "\t# of FTPC hits: " << (ftpcHitCollection() ? ftpcHitCollection()->numberOfHits() : 0) << endl;
1644  cout << "\t# of SVT hits: " << (svtHitCollection() ? svtHitCollection()->numberOfHits() : 0) << endl;
1645  cout << "\t# of SSD hits: " << (ssdHitCollection() ? ssdHitCollection()->numberOfHits() : 0) << endl;
1646  cout << "\t# of IST hits: " << (istHitCollection() ? istHitCollection()->numberOfHits() : 0) << endl;
1647  cout << "\t# of PXL hits: " << (pxlHitCollection() ? pxlHitCollection()->numberOfHits() : 0) << endl;
1648  cout << "\t# of track nodes: " << trackNodes().size() << endl;
1649  cout << "\t# of primary tracks: " << (primaryVertex(0) ? primaryVertex(0)->numberOfDaughters() : 0) << endl;
1650  cout << "\t# of V0s: " << v0Vertices().size() << endl;
1651  cout << "\t# of Xis: " << xiVertices().size() << endl;
1652  cout << "\t# of Kinks: " << kinkVertices().size() << endl;
1653  cout << "\t# of hits in EMC: " << (emcCollection() ? emcCollection()->barrelPoints().size() : 0) << endl;
1654  cout << "\t# of hits in EEMC: " << (emcCollection() ? emcCollection()->endcapPoints().size() : 0) << endl;
1655  cout << "\t# of hits in FGT: " << (fgtCollection() ? fgtCollection()->getNumHits() : 0) << endl;
1656  cout << "\t# of hits in GMT: " << (gmtCollection() ? gmtCollection()->getNumHits() : 0) << endl;
1657  cout << "\t# of hits in RICH: " << (richCollection() ? richCollection()->getRichHits().size() : 0) << endl;
1658  cout << "\t# of PSDs: " << numberOfPsds() << endl;
1659 }
1660 
1661 void StEvent::Split()
1662 {
1663  StEventClusteringHints *clu = clusteringHints();
1664  assert(clu);
1665  TDataSetIter next(this);
1666  TDataSet *ds;
1667 // Delete all the old EventBranches
1668  while ((ds=next())) {
1669  if (ds->IsA()!=StEventBranch::Class()) continue;
1670  Remove(ds); delete ds;
1671  }
1672 
1673  vector<string> brs = clu->listOfBranches(); // list of all branches for given mode (miniDST or DST)
1674  int nbrs = brs.size();
1675  for (int ibr =0; ibr < nbrs; ibr++) { //loop over branches
1676  string sbr = brs[ibr];
1677  if(sbr.size()==0) continue;
1678  const char *brName = sbr.c_str();
1679  assert(strncmp(brName,"evt_",4)==0 || strcmp(brName,"event")==0);
1680 
1681  UInt_t tally = ((clu->branchId(brName)) << 22) | 1 ;
1682 
1683  StEventBranch *obr = new StEventBranch(brName,this,tally);
1684  vector<string> cls = clu->listOfClasses(sbr.c_str());
1685  int ncls = cls.size();
1686  for (int icl =0; icl < ncls; icl++) { //loop over clases
1687  string scl = cls[icl];
1688  if(scl.size()==0) continue;
1689  obr->AddKlass(scl.c_str());
1690  } //end clases
1691  } //end branches
1692 }
1693 
1694 Bool_t StEvent::Notify() {Split();return 0;}
1695 
1696 void StEvent::Streamer(TBuffer &R__b)
1697 {
1698  // Stream an object of class StEvent.
1699 
1700  UInt_t R__s, R__c;
1701  if (R__b.IsReading()) {
1702 
1703  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1704  if (R__v == 1) {
1705  TDataSet::Streamer(R__b);
1706  mContent.Streamer(R__b);
1707  R__b.CheckByteCount(R__s, R__c, Class());
1708  Split();
1709  return;
1710  }
1711  else { // version >=2
1712  StXRefMain::Streamer(R__b);
1713  R__b.CheckByteCount(R__s, R__c, Class());
1714  }
1715 
1716  }
1717  else /*writing*/ {
1718 
1719  TDataSetIter next(this);
1720  TDataSet *ds;
1721  while ((ds=next())) {
1722  if (ds->IsA()==StEventBranch::Class()) break;
1723  }
1724  if (!ds) {//Not splited yet
1725  Split();}
1726 
1727  R__c = R__b.WriteVersion(Class(), kTRUE);
1728  StXRefMain::Streamer(R__b);
1729  R__b.SetByteCount(R__c, kTRUE);
1730  }
1731 }
1732 //________________________________________________________________________________
1733 StSPtrVecHit* StEvent::hitCollection(const Char_t *name) {
1734  StSPtrVecHit *theHitCollection = 0;
1735  TObjectSet *set = (TObjectSet *) FindByName(name);
1736  if (set) theHitCollection = (StSPtrVecHit *) set->GetObject();
1737  return theHitCollection;
1738 }
1739 //________________________________________________________________________________
1740 void StEvent::addHitCollection(StSPtrVecHit* p, const Char_t *name) {
1741  if (p) {
1742  TObjectSet *set = (TObjectSet *) FindByName(name);
1743  if (set)
1744  cerr << "StEvent::addHitCollection(): Error, HitCollection with "
1745  << name << " already exist. Nothing added." << endl;
1746  else {
1747  set = new TObjectSet(name,p,kTRUE);
1748  Add(set);
1749  }
1750  }
1751 }
1752 //________________________________________________________________________________
1753 void StEvent::removeHitCollection(const Char_t *name) {
1754  TObjectSet *set = (TObjectSet *) FindByName(name);
1755  if (set) set->Delete();
1756 }
1757 //________________________________________________________________________________
1758 void StEvent::setIdTruth() {
1759  StSPtrVecTrackNode& trackNode = trackNodes();
1760  UInt_t nTracks = trackNode.size();
1761  StTrackNode *node=0;
1762  for (UInt_t i = 0; i < nTracks; i++) {
1763  node = trackNode[i];
1764  if (!node) continue;
1765  UInt_t notr = node->entries();
1766  for (UInt_t t = 0; t < notr; t++) {
1767  StTrack *track = node->track(t);
1768  track->setIdTruth();
1769  }
1770  }
1771  // loop over all type of vertices
1772  Int_t noOfPrimaryVertices = numberOfPrimaryVertices();
1773  for (Int_t i = 0; i < noOfPrimaryVertices; i++) primaryVertex(i)->setIdTruth();
1774  Int_t noOfCalibrationVertices = numberOfCalibrationVertices();
1775  for (Int_t i = 0; i < noOfCalibrationVertices; i++) calibrationVertex(i)->setIdTruth();
1776  Int_t noOfv0Vertices = v0Vertices().size();
1777  for (Int_t i = 0; i < noOfv0Vertices; i++) ((StVertex *) v0Vertices()[i])->setIdTruth();
1778  Int_t noOfxiVertices = xiVertices().size();
1779  for (Int_t i = 0; i < noOfxiVertices; i++) ((StVertex *) xiVertices()[i])->setIdTruth();
1780  Int_t noOfkinkVertices = kinkVertices().size();
1781  for (Int_t i = 0; i < noOfkinkVertices; i++) ((StVertex *) kinkVertices()[i])->setIdTruth();
1782 }
Holds collections of GMT data.
virtual void Remove(TDataSet *set)
Remiove the &quot;set&quot; from this TDataSet.
Definition: TDataSet.cxx:641
Definition: tof.h:15
StPrimaryVertexOrder
StPwg
Definition: StPsd.h:39
virtual void Delete(Option_t *opt="")
to be documented
Definition: TObjectSet.cxx:74
size_t getNumHits() const
Number total number of hits.
Collection of trigger ids as stored in StEvent.
virtual TDataSet * FindByName(const char *name, const char *path="", Option_t *opt="") const
Definition: TDataSet.cxx:378
virtual TObject * GetObject() const
The depricated method (left here for the sake of the backward compatibility)
Definition: TObjectSet.h:56