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 
260 #ifndef ST_NO_NAMESPACES
261 using std::swap;
262 #endif
263 
264 TString StEvent::mCvsTag = "$Id: StEvent.cxx,v 2.61 2021/02/27 17:07:50 ullrich Exp $";
265 static const char rcsid[] = "$Id: StEvent.cxx,v 2.61 2021/02/27 17:07:50 ullrich Exp $";
266 
267 ClassImp(StEvent)
268 
269 //______________________________________________________________________________
270 template<class T> void _lookup(T*& val, StSPtrVecObject &vec)
271 {
272  val = 0;
273  for (unsigned int i=0; i<vec.size(); i++)
274  if (vec[i] && typeid(*vec[i]) == typeid(T)) {
275  val = static_cast<T*>(vec[i]);
276  break;
277  }
278 }
279 
280 //______________________________________________________________________________
281 template<class T> void _lookupOrCreate(T*& val, StSPtrVecObject &vec)
282 {
283  T* t = 0;
284  _lookup(t, vec);
285  if (!t) {
286  t = new T;
287  vec.push_back(t);
288  }
289  val = t;
290 }
291 
292 //______________________________________________________________________________
293 template<class T> void _lookupAndSet(T* val, StSPtrVecObject &vec)
294 {
295  for (unsigned int i=0; i<vec.size(); i++)
296  if (vec[i] && typeid(*vec[i]) == typeid(T)) {
297  delete vec[i];
298  vec[i] = val;
299  return;
300  }
301  if (!val) return;
302  vec.push_back(val);
303 }
304 
305 //______________________________________________________________________________
306 template<class T> void _lookupDynamic(T*& val, StSPtrVecObject &vec)
307 {
308  val = 0;
309  for (unsigned int i=0; i<vec.size(); i++)
310  if (vec[i]) {
311  val = dynamic_cast<T*>(vec[i]);
312  if (val) break;
313  }
314 }
315 
316 //______________________________________________________________________________
317 template<class T> void _lookupDynamicAndSet(T* val, StSPtrVecObject &vec)
318 {
319  T *test;
320  for (unsigned int i=0; i<vec.size(); i++) {
321  if (vec[i]) {
322  test = dynamic_cast<T*>(vec[i]);
323  if (test) {
324  delete vec[i];
325  vec[i] = val;
326  return;
327  }
328  }
329  }
330  if (!val) return;
331  vec.push_back(val);
332 }
333 
334 //______________________________________________________________________________
335 void StEvent::initToZero() { /* noop */ }
336 
337 //______________________________________________________________________________
338 StEvent::StEvent() : StXRefMain("StEvent")
339 {
340  GenUUId(); //Generate Universally Unique IDentifier
341  initToZero();
342 }
343 
344 //______________________________________________________________________________
345 StEvent::~StEvent()
346 { /* noop */ }
347 
348 TString
349 StEvent::type() const
350 {
351  StEventInfo* info = 0;
352  _lookup(info, mContent);
353  return info ? info->type() : TString();
354 }
355 
356 int
357 StEvent::id() const
358 {
359  StEventInfo* info = 0;
360  _lookup(info, mContent);
361  return info ? info->id() : 0;
362 }
363 
364 int
365 StEvent::runId() const
366 {
367  StEventInfo* info = 0;
368  _lookup(info, mContent);
369  return info ? info->runId() : 0;
370 }
371 
372 int
373 StEvent::time() const
374 {
375  StEventInfo* info = 0;
376  _lookup(info, mContent);
377  return info ? info->time() : 0;
378 }
379 
380 unsigned int
381 StEvent::triggerMask() const
382 {
383  StEventInfo* info = 0;
384  _lookup(info, mContent);
385  return info ? info->triggerMask() : 0;
386 }
387 
388 unsigned int
389 StEvent::bunchCrossingNumber(unsigned int i) const
390 {
391  StEventInfo* info = 0;
392  _lookup(info, mContent);
393  return info ? info->bunchCrossingNumber(i) : 0;
394 }
395 
397 StEvent::info()
398 {
399  StEventInfo* info = 0;
400  _lookup(info, mContent);
401  return info;
402 }
403 
404 const StEventInfo*
405 StEvent::info() const
406 {
407  StEventInfo* info = 0;
408  _lookup(info, mContent);
409  return info;
410 }
411 
412 StRunInfo*
413 StEvent::runInfo()
414 {
415  StRunInfo* info = 0;
416  _lookup(info, mContent);
417  return info;
418 }
419 
420 const StRunInfo*
421 StEvent::runInfo() const
422 {
423  StRunInfo* info = 0;
424  _lookup(info, mContent);
425  return info;
426 }
427 
429 StEvent::summary()
430 {
431  StEventSummary* summary = 0;
432  _lookup(summary, mContent);
433  return summary;
434 }
435 
436 const StEventSummary*
437 StEvent::summary() const
438 {
439  StEventSummary* summary = 0;
440  _lookup(summary, mContent);
441  return summary;
442 }
443 
444 const TString&
445 StEvent::cvsTag() { return mCvsTag; }
446 
447 //______________________________________________________________________________
448 StTpcHitCollection* StEvent::tpcHitCollection()
449 {
450  StTpcHitCollection *hits = 0;
451  _lookup(hits, mContent);
452  return hits;
453 }
454 
455 //______________________________________________________________________________
456 const StTpcHitCollection*
457 StEvent::tpcHitCollection() const
458 {
459  StTpcHitCollection *hits = 0;
460  _lookup(hits, mContent);
461  return hits;
462 }
463 
464 //______________________________________________________________________________
465 StRnDHitCollection* StEvent::rndHitCollection()
466 {
467  StRnDHitCollection *hits = 0;
468  _lookup(hits, mContent);
469  return hits;
470 }
471 
472 //______________________________________________________________________________
473 const StRnDHitCollection* StEvent::rndHitCollection() const
474 {
475  StRnDHitCollection *hits = 0;
476  _lookup(hits, mContent);
477  return hits;
478 }
479 
480 //______________________________________________________________________________
481 const StEtrHitCollection* StEvent::etrHitCollection() const
482 {
483  StEtrHitCollection *hits = 0;
484  _lookup(hits, mContent);
485  return hits;
486 }
487 
488 //______________________________________________________________________________
489  StEtrHitCollection* StEvent::etrHitCollection()
490 {
491  StEtrHitCollection *hits = 0;
492  _lookup(hits, mContent);
493  return hits;
494 }
495 //______________________________________________________________________________
496 StFtpcHitCollection* StEvent::ftpcHitCollection()
497 {
498  StFtpcHitCollection *hits = 0;
499  _lookup(hits, mContent);
500  return hits;
501 }
502 
503 const StFtpcHitCollection*
504 StEvent::ftpcHitCollection() const
505 {
506  StFtpcHitCollection *hits = 0;
507  _lookup(hits, mContent);
508  return hits;
509 }
510 
512 StEvent::svtHitCollection()
513 {
514  StSvtHitCollection *hits = 0;
515  _lookup(hits, mContent);
516  return hits;
517 }
518 
519 const StSvtHitCollection*
520 StEvent::svtHitCollection() const
521 {
522  StSvtHitCollection *hits = 0;
523  _lookup(hits, mContent);
524  return hits;
525 }
526 
528 StEvent::ssdHitCollection()
529 {
530  StSsdHitCollection *hits = 0;
531  _lookup(hits, mContent);
532  return hits;
533 }
534 
535 const StSsdHitCollection*
536 StEvent::ssdHitCollection() const
537 {
538  StSsdHitCollection *hits = 0;
539  _lookup(hits, mContent);
540  return hits;
541 }
542 
544 StEvent::sstHitCollection()
545 {
546  StSstHitCollection *hits = 0;
547  _lookup(hits, mContent);
548  return hits;
549 }
550 
551 const StSstHitCollection*
552 StEvent::sstHitCollection() const
553 {
554  StSstHitCollection *hits = 0;
555  _lookup(hits, mContent);
556  return hits;
557 }
558 
560 StEvent::emcCollection()
561 {
562  StEmcCollection *emc = 0;
563  _lookup(emc, mContent);
564  return emc;
565 }
566 
567 const StEmcCollection*
568 StEvent::emcCollection() const
569 {
570  StEmcCollection *emc = 0;
571  _lookup(emc, mContent);
572  return emc;
573 }
574 
576 StEvent::fcsCollection()
577 {
578  StFcsCollection *fcs = 0;
579  _lookup(fcs, mContent);
580  return fcs;
581 }
582 
583 const StFcsCollection*
584 StEvent::fcsCollection() const
585 {
586  StFcsCollection *fcs = 0;
587  _lookup(fcs, mContent);
588  return fcs;
589 }
590 
592 StEvent::fttCollection()
593 {
594  StFttCollection *ftt = 0;
595  _lookup(ftt, mContent);
596  return ftt;
597 }
598 
599 const StFttCollection*
600 StEvent::fttCollection() const
601 {
602  StFttCollection *ftt = 0;
603  _lookup(ftt, mContent);
604  return ftt;
605 }
606 
608 StEvent::fmsCollection()
609 {
610  StFmsCollection *fms = 0;
611  _lookup(fms, mContent);
612  return fms;
613 }
614 
615 const StFmsCollection*
616 StEvent::fmsCollection() const
617 {
618  StFmsCollection *fms = 0;
619  _lookup(fms, mContent);
620  return fms;
621 }
622 
624 StEvent::rhicfCollection()
625 {
626  StRHICfCollection *rhicf = 0;
627  _lookup(rhicf, mContent);
628  return rhicf;
629 }
630 
631 const StRHICfCollection*
632 StEvent::rhicfCollection() const
633 {
634  StRHICfCollection *rhicf = 0;
635  _lookup(rhicf, mContent);
636  return rhicf;
637 }
638 
640 StEvent::richCollection()
641 {
642  StRichCollection *rich = 0;
643  _lookup(rich, mContent);
644  return rich;
645 }
646 
647 const StRichCollection*
648 StEvent::richCollection() const
649 {
650  StRichCollection *rich = 0;
651  _lookup(rich, mContent);
652  return rich;
653 }
654 
656 StEvent::rpsCollection()
657 {
658  StRpsCollection *rps = 0;
659  _lookup(rps, mContent);
660  return rps;
661 }
662 
663 const StRpsCollection*
664 StEvent::rpsCollection() const
665 {
666  StRpsCollection *rps = 0;
667  _lookup(rps, mContent);
668  return rps;
669 }
670 
672 StEvent::tofCollection()
673 {
674  StTofCollection *tof = 0;
675  _lookup(tof, mContent);
676  return tof;
677 }
678 
679 const StTofCollection*
680 StEvent::tofCollection() const
681 {
682  StTofCollection *tof = 0;
683  _lookup(tof, mContent);
684  return tof;
685 }
686 
688 StEvent::btofCollection()
689 {
690  StBTofCollection *btof = 0;
691  _lookup(btof, mContent);
692  return btof;
693 }
694 
695 const StBTofCollection*
696 StEvent::btofCollection() const
697 {
698  StBTofCollection *btof = 0;
699  _lookup(btof, mContent);
700  return btof;
701 }
702 
704 StEvent::etofCollection()
705 {
706  StETofCollection *etof = 0;
707  _lookup(etof, mContent);
708  return etof;
709 }
710 
711 const StETofCollection*
712 StEvent::etofCollection() const
713 {
714  StETofCollection *etof = 0;
715  _lookup(etof, mContent);
716  return etof;
717 }
718 
720 StEvent::epdCollection()
721 {
722  StEpdCollection *epd = 0;
723  _lookup(epd, mContent);
724  return epd;
725 }
726 
727 const StEpdCollection*
728 StEvent::epdCollection() const
729 {
730  StEpdCollection *epd = 0;
731  _lookup(epd, mContent);
732  return epd;
733 }
734 
736 StEvent::mtdCollection()
737 {
738  StMtdCollection *mtd = 0;
739  _lookup(mtd, mContent);
740  return mtd;
741 }
742 
743 const StMtdCollection*
744 StEvent::mtdCollection() const
745 {
746  StMtdCollection *mtd = 0;
747  _lookup(mtd, mContent);
748  return mtd;
749 }
750 
752 StEvent::fpdCollection()
753 {
754  StFpdCollection *fpd = 0;
755  _lookup(fpd, mContent);
756  return fpd;
757 }
758 
759 const StFpdCollection*
760 StEvent::fpdCollection() const
761 {
762  StFpdCollection *fpd = 0;
763  _lookup(fpd, mContent);
764  return fpd;
765 }
766 
768 StEvent::phmdCollection()
769 {
770  StPhmdCollection *phmd = 0;
771  _lookup(phmd, mContent);
772  return phmd;
773 }
774 
775 const StPhmdCollection*
776 StEvent::phmdCollection() const
777 {
778  StPhmdCollection *phmd = 0;
779  _lookup(phmd, mContent);
780  return phmd;
781 }
782 
784 StEvent::triggerDetectorCollection()
785 {
787  _lookup(trg, mContent);
788  return trg;
789 }
790 
792 StEvent::triggerDetectorCollection() const
793 {
795  _lookup(trg, mContent);
796  return trg;
797 }
798 
800 StEvent::triggerIdCollection()
801 {
802  StTriggerIdCollection *trg = 0;
803  _lookup(trg, mContent);
804  return trg;
805 }
806 
808 StEvent::triggerIdCollection() const
809 {
810  StTriggerIdCollection *trg = 0;
811  _lookup(trg, mContent);
812  return trg;
813 }
814 
816 StEvent::triggerData()
817 {
818  StTriggerData *trg = 0;
819  _lookupDynamic(trg, mContent);
820  return trg;
821 }
822 
823 const StTriggerData*
824 StEvent::triggerData() const
825 {
826  StTriggerData *trg = 0;
827  _lookupDynamic(trg, mContent);
828  return trg;
829 }
830 
832 StEvent::l0Trigger()
833 {
834  StL0Trigger *trg = 0;
835  _lookup(trg, mContent);
836  return trg;
837 }
838 
839 const StL0Trigger*
840 StEvent::l0Trigger() const
841 {
842  StL0Trigger *trg = 0;
843  _lookup(trg, mContent);
844  return trg;
845 }
846 
848 StEvent::l1Trigger()
849 {
850  StL1Trigger *trg = 0;
851  _lookup(trg, mContent);
852  return trg;
853 }
854 
855 const StL1Trigger*
856 StEvent::l1Trigger() const
857 {
858  StL1Trigger *trg = 0;
859  _lookup(trg, mContent);
860  return trg;
861 }
862 
864 StEvent::l3Trigger()
865 {
866  StL3Trigger *trg = 0;
867  _lookup(trg, mContent);
868  return trg;
869 }
870 
871 const StL3Trigger*
872 StEvent::l3Trigger() const
873 {
874  StL3Trigger *trg = 0;
875  _lookup(trg, mContent);
876  return trg;
877 }
878 
879 StHltEvent*
880 StEvent::hltEvent()
881 {
882  StHltEvent *hlt = 0;
883  _lookup(hlt, mContent);
884  return hlt;
885 }
886 
887 const StHltEvent*
888 StEvent::hltEvent() const
889 {
890  StHltEvent *hlt = 0;
891  _lookup(hlt, mContent);
892  return hlt;
893 }
894 
896 StEvent::fgtCollection()
897 {
898  StFgtCollection *fgtCollection = 0;
899  _lookup(fgtCollection, mContent);
900  return fgtCollection;
901 }
902 
903 const StFgtCollection*
904 StEvent::fgtCollection() const
905 {
906  StFgtCollection *fgtCollection = 0;
907  _lookup(fgtCollection, mContent);
908  return fgtCollection;
909 }
910 
912 StEvent::istHitCollection()
913 {
914  StIstHitCollection *istHitCollection = 0;
915  _lookup(istHitCollection, mContent);
916  return istHitCollection;
917 }
918 
919 const StIstHitCollection*
920 StEvent::istHitCollection() const
921 {
922  StIstHitCollection *istHitCollection = 0;
923  _lookup(istHitCollection, mContent);
924  return istHitCollection;
925 }
926 
928 StEvent::fstEvtCollection()
929 {
930  StFstEvtCollection *fstEvtCollection = 0;
931  _lookup(fstEvtCollection, mContent);
932  return fstEvtCollection;
933 }
934 
935 const StFstEvtCollection*
936 StEvent::fstEvtCollection() const
937 {
938  StFstEvtCollection *fstEvtCollection = 0;
939  _lookup(fstEvtCollection, mContent);
940  return fstEvtCollection;
941 }
942 
944 StEvent::fstHitCollection()
945 {
946  StFstHitCollection *fstHitCollection = 0;
947  _lookup(fstHitCollection, mContent);
948  return fstHitCollection;
949 }
950 
951 const StFstHitCollection*
952 StEvent::fstHitCollection() const
953 {
954  StFstHitCollection *fstHitCollection = 0;
955  _lookup(fstHitCollection, mContent);
956  return fstHitCollection;
957 }
958 
960 StEvent::pxlHitCollection()
961 {
962  StPxlHitCollection *pxlHitCollection = 0;
963  _lookup(pxlHitCollection, mContent);
964  return pxlHitCollection;
965 }
966 
967 const StPxlHitCollection*
968 StEvent::pxlHitCollection() const
969 {
970  StPxlHitCollection *pxlHitCollection = 0;
971  _lookup(pxlHitCollection, mContent);
972  return pxlHitCollection;
973 }
974 
975 StSPtrVecTrackDetectorInfo&
976 StEvent::trackDetectorInfo()
977 {
978  StSPtrVecTrackDetectorInfo *info = 0;
979  _lookupOrCreate(info, mContent);
980  return *info;
981 }
982 
983 const StSPtrVecTrackDetectorInfo&
984 StEvent::trackDetectorInfo() const
985 {
986  StSPtrVecTrackDetectorInfo *info = 0;
987  _lookupOrCreate(info, mContent);
988  return *info;
989 }
990 
992 StEvent::fwdTrackCollection()
993 {
994  StFwdTrackCollection *fwdTracks = 0;
995  _lookup(fwdTracks, mContent);
996  return fwdTracks;
997 }
998 
1000 StEvent::fwdTrackCollection() const
1001 {
1002  StFwdTrackCollection *fwdTrack = 0;
1003  _lookup(fwdTrack, mContent);
1004  return fwdTrack;
1005 }
1006 
1007 StSPtrVecTrackNode&
1008 StEvent::trackNodes()
1009 {
1010  StSPtrVecTrackNode *nodes = 0;
1011  _lookupOrCreate(nodes, mContent);
1012  return *nodes;
1013 }
1014 
1015 const StSPtrVecTrackNode&
1016 StEvent::trackNodes() const
1017 {
1018  StSPtrVecTrackNode *nodes = 0;
1019  _lookupOrCreate(nodes, mContent);
1020  return *nodes;
1021 }
1022 
1023 unsigned int
1024 StEvent::numberOfPrimaryVertices() const
1025 {
1026  StSPtrVecPrimaryVertex *vertices = 0;
1027  _lookupOrCreate(vertices, mContent);
1028  return vertices ? vertices->size() : 0;
1029 }
1030 
1032 StEvent::primaryVertex(unsigned int i)
1033 {
1034  StSPtrVecPrimaryVertex *vertices = 0;
1035  _lookup(vertices, mContent);
1036  if (vertices && i < vertices->size())
1037  return (*vertices)[i];
1038  else
1039  return 0;
1040 }
1041 
1042 const StPrimaryVertex*
1043 StEvent::primaryVertex(unsigned int i) const
1044 {
1045  StSPtrVecPrimaryVertex *vertices = 0;
1046  _lookup(vertices, mContent);
1047  if (vertices && i < vertices->size())
1048  return (*vertices)[i];
1049  else
1050  return 0;
1051 }
1052 
1053 unsigned int
1054 StEvent::numberOfCalibrationVertices() const
1055 {
1056  StSPtrVecCalibrationVertex *vertices = 0;
1057  _lookupOrCreate(vertices, mContent);
1058  return vertices ? vertices->size() : 0;
1059 }
1060 
1062 StEvent::calibrationVertex(unsigned int i)
1063 {
1064  StSPtrVecCalibrationVertex *vertices = 0;
1065  _lookup(vertices, mContent);
1066  if (vertices && i < vertices->size())
1067  return (*vertices)[i];
1068  else
1069  return 0;
1070 }
1071 
1072 const StCalibrationVertex*
1073 StEvent::calibrationVertex(unsigned int i) const
1074 {
1075  StSPtrVecCalibrationVertex *vertices = 0;
1076  _lookup(vertices, mContent);
1077  if (vertices && i < vertices->size())
1078  return (*vertices)[i];
1079  else
1080  return 0;
1081 }
1082 
1083 StSPtrVecV0Vertex&
1084 StEvent::v0Vertices()
1085 {
1086  StSPtrVecV0Vertex *vertices = 0;
1087  _lookupOrCreate(vertices, mContent);
1088  return *vertices;
1089 }
1090 
1091 const StSPtrVecV0Vertex&
1092 StEvent::v0Vertices() const
1093 {
1094  StSPtrVecV0Vertex *vertices = 0;
1095  _lookupOrCreate(vertices, mContent);
1096  return *vertices;
1097 }
1098 
1099 StSPtrVecXiVertex&
1100 StEvent::xiVertices()
1101 {
1102  StSPtrVecXiVertex *vertices = 0;
1103  _lookupOrCreate(vertices, mContent);
1104  return *vertices;
1105 }
1106 
1107 const StSPtrVecXiVertex&
1108 StEvent::xiVertices() const
1109 {
1110  StSPtrVecXiVertex *vertices = 0;
1111  _lookupOrCreate(vertices, mContent);
1112  return *vertices;
1113 }
1114 
1115 StSPtrVecKinkVertex&
1116 StEvent::kinkVertices()
1117 {
1118  StSPtrVecKinkVertex *vertices = 0;
1119  _lookupOrCreate(vertices, mContent);
1120  return *vertices;
1121 }
1122 
1123 const StSPtrVecKinkVertex&
1124 StEvent::kinkVertices() const
1125 {
1126  StSPtrVecKinkVertex *vertices = 0;
1127  _lookupOrCreate(vertices, mContent);
1128  return *vertices;
1129 }
1130 
1132 StEvent::detectorState(StDetectorId det)
1133 {
1134  StSPtrVecDetectorState *states = 0;
1135  _lookup(states, mContent);
1136  if (states)
1137  for (unsigned int i=0; i<states->size(); i++)
1138  if ((*states)[i]->detector() == det) return (*states)[i];
1139  return 0;
1140 }
1141 
1142 const StDetectorState*
1143 StEvent::detectorState(StDetectorId det) const
1144 {
1145  StSPtrVecDetectorState *states = 0;
1146  _lookup(states, mContent);
1147  if (states)
1148  for (unsigned int i=0; i<states->size(); i++)
1149  if ((*states)[i]->detector() == det) return (*states)[i];
1150  return 0;
1151 }
1152 
1153 StPsd*
1154 StEvent::psd(StPwg p, int i)
1155 {
1156  StPsd *thePsd = 0;
1157  for (unsigned int k=0; k<mContent.size(); k++) {
1158  thePsd = dynamic_cast<StPsd*>(mContent[k]);
1159  if (thePsd && thePsd->pwg() == p && thePsd->id() == i)
1160  return thePsd;
1161  }
1162  return 0;
1163 }
1164 
1165 const StPsd*
1166 StEvent::psd(StPwg p, int i) const
1167 {
1168  const StPsd *thePsd = 0;
1169  for (unsigned int k=0; k<mContent.size(); k++) {
1170  thePsd = dynamic_cast<StPsd*>(mContent[k]);
1171  if (thePsd && thePsd->pwg() == p && thePsd->id() == i)
1172  return thePsd;
1173  }
1174  return 0;
1175 }
1176 
1177 unsigned int
1178 StEvent::numberOfPsds() const
1179 {
1180  int nPsds = 0;
1181  for (unsigned int i=0; i<mContent.size(); i++)
1182  if (dynamic_cast<StPsd*>(mContent[i])) nPsds++;
1183  return nPsds;
1184 }
1185 
1186 unsigned int
1187 StEvent::numberOfPsds(StPwg p) const
1188 {
1189  StPsd* thePsd;
1190  int nPsds = 0;
1191  for (unsigned int i=0; i<mContent.size(); i++) {
1192  thePsd = dynamic_cast<StPsd*>(mContent[i]);
1193  if (thePsd && thePsd->pwg() == p) nPsds++;
1194  }
1195  return nPsds;
1196 }
1197 
1198 StSPtrVecObject&
1199 StEvent::content() { return mContent; }
1200 
1202 StEvent::clusteringHints() const
1203 {
1204  StEventClusteringHints *hints = 0;
1205  _lookupOrCreate(hints, mContent);
1206  return hints;
1207 }
1208 
1210 StEvent::clusteringHints()
1211 {
1212  StEventClusteringHints *hints = 0;
1213  _lookupOrCreate(hints, mContent);
1214  hints->SetParent(this);
1215  return hints;
1216 }
1217 
1218 void
1219 StEvent::setType(const char* val)
1220 {
1221  StEventInfo* info = 0;
1222  _lookupOrCreate(info, mContent);
1223  info->setType(val);
1224 }
1225 
1226 void
1227 StEvent::setRunId(int val)
1228 {
1229  StEventInfo* info = 0;
1230  _lookupOrCreate(info, mContent);
1231  info->setRunId(val);
1232 }
1233 
1234 void
1235 StEvent::setId(int val)
1236 {
1237  StEventInfo* info = 0;
1238  _lookupOrCreate(info, mContent);
1239  info->setId(val);
1240 }
1241 
1242 void
1243 StEvent::setTime(int val)
1244 {
1245  StEventInfo* info = 0;
1246  _lookupOrCreate(info, mContent);
1247  info->setTime(val);
1248 }
1249 
1250 void
1251 StEvent::setTriggerMask(unsigned int val)
1252 {
1253  StEventInfo* info = 0;
1254  _lookupOrCreate(info, mContent);
1255  info->setTriggerMask(val);
1256 }
1257 
1258 void
1259 StEvent::setBunchCrossingNumber(unsigned int val, unsigned int i)
1260 {
1261  StEventInfo* info = 0;
1262  _lookupOrCreate(info, mContent);
1263  info->setBunchCrossingNumber(val, i);
1264 }
1265 
1266 void
1267 StEvent::setInfo(StEventInfo* val)
1268 {
1269  _lookupAndSet(val, mContent);
1270 }
1271 
1272 void
1273 StEvent::setRunInfo(StRunInfo* val)
1274 {
1275  _lookupAndSet(val, mContent);
1276 }
1277 
1278 void
1279 StEvent::setSummary(StEventSummary* val)
1280 {
1281  _lookupAndSet(val, mContent);
1282 }
1283 
1284 void
1285 StEvent::setTpcHitCollection(StTpcHitCollection* val)
1286 {
1287  _lookupAndSet(val, mContent);
1288 }
1289 
1290 void
1291 StEvent::setRnDHitCollection(StRnDHitCollection* val)
1292 {
1293  _lookupAndSet(val, mContent);
1294 }
1295 
1296 void
1297 StEvent::setFtpcHitCollection(StFtpcHitCollection* val)
1298 {
1299  _lookupAndSet(val, mContent);
1300 }
1301 
1302 void
1303 StEvent::setSvtHitCollection(StSvtHitCollection* val)
1304 {
1305  _lookupAndSet(val, mContent);
1306 }
1307 
1308 void
1309 StEvent::setSsdHitCollection(StSsdHitCollection* val)
1310 {
1311  _lookupAndSet(val, mContent);
1312 }
1313 
1314 void
1315 StEvent::setSstHitCollection(StSstHitCollection* val)
1316 {
1317  _lookupAndSet(val, mContent);
1318 }
1319 
1320 void
1321 StEvent::setEmcCollection(StEmcCollection* val)
1322 {
1323  _lookupAndSet(val, mContent);
1324 }
1325 
1326 void
1327 StEvent::setFmsCollection(StFmsCollection* val)
1328 {
1329  _lookupAndSet(val, mContent);
1330 }
1331 
1332 void
1333 StEvent::setFcsCollection(StFcsCollection* val)
1334 {
1335  _lookupAndSet(val, mContent);
1336 }
1337 
1338 void
1339 StEvent::setFttCollection(StFttCollection* val)
1340 {
1341  _lookupAndSet(val, mContent);
1342 }
1343 
1344 void
1345 StEvent::setRHICfCollection(StRHICfCollection* val)
1346 {
1347  _lookupAndSet(val, mContent);
1348 }
1349 
1350 void
1351 StEvent::setRichCollection(StRichCollection* val)
1352 {
1353  _lookupAndSet(val, mContent);
1354 }
1355 
1356 void
1357 StEvent::setRpsCollection(StRpsCollection* val)
1358 {
1359  _lookupAndSet(val, mContent);
1360 }
1361 
1362 void
1363 StEvent::setTofCollection(StTofCollection* val)
1364 {
1365  _lookupAndSet(val, mContent);
1366 }
1367 
1368 void
1369 StEvent::setBTofCollection(StBTofCollection* val)
1370 {
1371  _lookupAndSet(val, mContent);
1372 }
1373 
1374 void
1375 StEvent::setETofCollection(StETofCollection* val)
1376 {
1377  _lookupAndSet(val, mContent);
1378 }
1379 
1380 
1381 void
1382 StEvent::setEpdCollection(StEpdCollection* val)
1383 {
1384  _lookupAndSet(val, mContent);
1385 }
1386 
1387 void
1388 StEvent::setMtdCollection(StMtdCollection* val)
1389 {
1390  _lookupAndSet(val, mContent);
1391 }
1392 
1393 void
1394 StEvent::setFpdCollection(StFpdCollection* val)
1395 {
1396  _lookupAndSet(val, mContent);
1397 }
1398 
1399 void
1400 StEvent::setPhmdCollection(StPhmdCollection* val)
1401 {
1402  _lookupAndSet(val, mContent);
1403 }
1404 
1405 void
1406 StEvent::setTriggerDetectorCollection(StTriggerDetectorCollection* val)
1407 {
1408  _lookupAndSet(val, mContent);
1409 }
1410 
1411 void
1412 StEvent::setTriggerIdCollection(StTriggerIdCollection* val)
1413 {
1414  _lookupAndSet(val, mContent);
1415 }
1416 
1417 void
1418 StEvent::setTriggerData(StTriggerData* val)
1419 {
1420  _lookupDynamicAndSet(val, mContent);
1421 }
1422 
1423 void
1424 StEvent::setL0Trigger(StL0Trigger* val)
1425 {
1426  _lookupAndSet(val, mContent);
1427 }
1428 
1429 void
1430 StEvent::setL1Trigger(StL1Trigger* val)
1431 {
1432  _lookupAndSet(val, mContent);
1433 }
1434 
1435 void
1436 StEvent::setL3Trigger(StL3Trigger* val)
1437 {
1438  _lookupAndSet(val, mContent);
1439 }
1440 
1441 void
1442 StEvent::setEtrHitCollection(StEtrHitCollection* val)
1443 {
1444  _lookupAndSet(val, mContent);
1445 }
1446 
1447 void
1448 StEvent::setHltEvent(StHltEvent* val)
1449 {
1450  _lookupAndSet(val, mContent);
1451 }
1452 
1453 void
1454 StEvent::setFgtCollection(StFgtCollection* val)
1455 {
1456  _lookupAndSet(val, mContent);
1457 }
1458 
1459 void
1460 StEvent::setIstHitCollection(StIstHitCollection* val)
1461 {
1462  _lookupAndSet(val, mContent);
1463 }
1464 
1465 void
1466 StEvent::setFstEvtCollection(StFstEvtCollection* val)
1467 {
1468  _lookupAndSet(val, mContent);
1469 }
1470 
1471 void
1472 StEvent::setFstHitCollection(StFstHitCollection* val)
1473 {
1474  _lookupAndSet(val, mContent);
1475 }
1476 
1477 void
1478 StEvent::setFwdTrackCollection(StFwdTrackCollection* val)
1479 {
1480  _lookupAndSet(val, mContent);
1481 }
1482 
1483 void
1484 StEvent::setPxlHitCollection(StPxlHitCollection* val)
1485 {
1486  _lookupAndSet(val, mContent);
1487 }
1488 
1489 void
1490 StEvent::addPrimaryVertex(StPrimaryVertex* vertex, StPrimaryVertexOrder order)
1491 {
1492  if (!vertex) return; // not a valid vertex, do nothing
1493 
1494  //
1495  // Add the vertex
1496  //
1497  StSPtrVecPrimaryVertex* vertexVector = 0;
1498  _lookupOrCreate(vertexVector, mContent);
1499  vertexVector->push_back(vertex);
1500 
1501  //
1502  // Sort vertices.
1503  // New vertex is last entry. We simply toggle through
1504  // the container starting at the back until the new entry
1505  // sits in place. Sorting strategy is given by
1506  // enumeration StPrimaryVertexOrder.
1507  //
1508  int i;
1509  switch (order) {
1510  case(orderByNumberOfDaughters):
1511  for (i=vertexVector->size()-1; i>0; i--) {
1512  if ((*vertexVector)[i]->numberOfDaughters() > (*vertexVector)[i-1]->numberOfDaughters())
1513  swap((*vertexVector)[i], (*vertexVector)[i-1]);
1514  else
1515  break;
1516  }
1517  break;
1518 
1519  case(orderByRanking):
1520  default:
1521  for (i=vertexVector->size()-1; i>0; i--) {
1522  if ((*vertexVector)[i]->ranking() > (*vertexVector)[i-1]->ranking())
1523  swap((*vertexVector)[i], (*vertexVector)[i-1]);
1524  else
1525  break;
1526  }
1527  break;
1528  }
1529 }
1530 
1531 void
1532 StEvent::addCalibrationVertex(StCalibrationVertex* vertex)
1533 {
1534  if (vertex) {
1535  StSPtrVecCalibrationVertex* vertexVector = 0;
1536  _lookupOrCreate(vertexVector, mContent);
1537  vertexVector->push_back(vertex);
1538  }
1539 }
1540 
1541 void
1542 StEvent::addDetectorState(StDetectorState *state)
1543 {
1544  if (state) {
1545  StSPtrVecDetectorState* stateVector = 0;
1546  _lookupOrCreate(stateVector, mContent);
1547  stateVector->push_back(state);
1548  }
1549 }
1550 
1551 void
1552 StEvent::addPsd(StPsd* p)
1553 {
1554  if (p) {
1555  if (psd(p->pwg(), p->id()))
1556  cerr << "StEvent::addPsd(): Error, PSD with same identifiers already exist. Nothing added." << endl;
1557  else
1558  mContent.push_back(p);
1559  }
1560 }
1561 
1562 void StEvent::removePsd(StPsd* p)
1563 {
1564  StSPtrVecObjectIterator iter;
1565  if (p) {
1566  for (iter = mContent.begin(); iter != mContent.end(); iter++)
1567  if (*iter == p)
1568  mContent.erase(iter);
1569  }
1570 }
1571 
1572 void StEvent::statistics()
1573 {
1574  cout << "Statistics and information for event " << id() << endl;
1575  cout << "\tthis: " << static_cast<void*>(this) << endl;
1576 // cout << "\tcvsTag: " << cvsTag() << endl;
1577  cout << "\ttype: " << type() << endl;
1578  cout << "\tid: " << id() << endl;
1579  cout << "\trunId: " << runId() << endl;
1580  cout << "\ttime: " << time() << endl;
1581  cout << "\ttriggerMask: " << triggerMask() << endl;
1582  cout << "\tbunchCrossingNumber(0): " << bunchCrossingNumber(0) << endl;
1583  cout << "\tbunchCrossingNumber(1): " << bunchCrossingNumber(1) << endl;
1584  cout << "\tStEventSummary: " << static_cast<void*>(summary()) << endl;
1585  cout << "\tStTpcHitCollection: " << static_cast<void*>(tpcHitCollection()) << endl;
1586  cout << "\tStRnDHitCollection: " << static_cast<void*>(rndHitCollection()) << endl;
1587  cout << "\tStFtpcHitCollection: " << static_cast<void*>(ftpcHitCollection()) << endl;
1588  cout << "\tStSvtHitCollection: " << static_cast<void*>(svtHitCollection()) << endl;
1589  cout << "\tStSsdHitCollection: " << static_cast<void*>(ssdHitCollection()) << endl;
1590  cout << "\tStSstHitCollection: " << static_cast<void*>(sstHitCollection()) << endl;
1591  cout << "\tStIstHitCollection: " << static_cast<void*>(istHitCollection()) << endl;
1592  cout << "\tStFstEvtCollection: " << static_cast<void*>(fstEvtCollection()) << endl;
1593  cout << "\tStFstHitCollection: " << static_cast<void*>(fstHitCollection()) << endl;
1594  cout << "\tStPxlHitCollection: " << static_cast<void*>(pxlHitCollection()) << endl;
1595  cout << "\tStEmcCollection: " << static_cast<void*>(emcCollection()) << endl;
1596  cout << "\tStFmsCollection: " << static_cast<void*>(fmsCollection()) << endl;
1597  cout << "\tStRHICfCollection: " << static_cast<void*>(rhicfCollection()) << endl;
1598  cout << "\tStRichCollection: " << static_cast<void*>(richCollection()) << endl;
1599  cout << "\tStRpsCollection: " << static_cast<void*>(rpsCollection()) << endl;
1600  cout << "\tStTofCollection: " << static_cast<void*>(tofCollection()) << endl;
1601  cout << "\tStBTofCollection: " << static_cast<void*>(btofCollection()) << endl;
1602  cout << "\tStETofCollection: " << static_cast<void*>(etofCollection()) << endl;
1603  cout << "\tStEpdCollection: " << static_cast<void*>(epdCollection()) << endl;
1604  cout << "\tStMtdCollection: " << static_cast<void*>(mtdCollection()) << endl;
1605  cout << "\tStFpdCollection: " << static_cast<void*>(fpdCollection()) << endl;
1606  cout << "\tStPhmdCollection: " << static_cast<void*>(phmdCollection()) << endl;
1607  cout << "\tStL0Trigger: " << static_cast<void*>(l0Trigger()) << endl;
1608  cout << "\tStL1Trigger: " << static_cast<void*>(l0Trigger()) << endl;
1609  cout << "\tStL3Trigger: " << static_cast<void*>(l3Trigger()) << endl;
1610  cout << "\tStHltEvent: " << static_cast<void*>(hltEvent()) << endl;
1611  cout << "\tStTriggerDetectorCollection: " << static_cast<void*>(triggerDetectorCollection()) << endl;
1612  cout << "\tStTriggerIdCollection: " << static_cast<void*>(triggerIdCollection()) << endl;
1613  cout << "\tStTriggerData: " << static_cast<void*>(triggerData()) << endl;
1614  cout << "\tStPrimaryVertex: " << static_cast<void*>(primaryVertex(0)) << endl;
1615  cout << "\tnumberOfPrimaryVertices: " << numberOfPrimaryVertices() << endl;
1616  cout << "\tStCalibrationVertex: " << static_cast<void*>(calibrationVertex(0));
1617  cout << "\tnumberOfCalibrationVertices: " << numberOfCalibrationVertices() << endl;
1618  cout << "\t# of TPC hits: " << (tpcHitCollection() ? tpcHitCollection()->numberOfHits() : 0) << endl;
1619  cout << "\t# of FTPC hits: " << (ftpcHitCollection() ? ftpcHitCollection()->numberOfHits() : 0) << endl;
1620  cout << "\t# of SVT hits: " << (svtHitCollection() ? svtHitCollection()->numberOfHits() : 0) << endl;
1621  cout << "\t# of SSD hits: " << (ssdHitCollection() ? ssdHitCollection()->numberOfHits() : 0) << endl;
1622  cout << "\t# of IST hits: " << (istHitCollection() ? istHitCollection()->numberOfHits() : 0) << endl;
1623  cout << "\t# of PXL hits: " << (pxlHitCollection() ? pxlHitCollection()->numberOfHits() : 0) << endl;
1624  cout << "\t# of track nodes: " << trackNodes().size() << endl;
1625  cout << "\t# of primary tracks: " << (primaryVertex(0) ? primaryVertex(0)->numberOfDaughters() : 0) << endl;
1626  cout << "\t# of V0s: " << v0Vertices().size() << endl;
1627  cout << "\t# of Xis: " << xiVertices().size() << endl;
1628  cout << "\t# of Kinks: " << kinkVertices().size() << endl;
1629  cout << "\t# of hits in EMC: " << (emcCollection() ? emcCollection()->barrelPoints().size() : 0) << endl;
1630  cout << "\t# of hits in EEMC: " << (emcCollection() ? emcCollection()->endcapPoints().size() : 0) << endl;
1631  cout << "\t# of hits in FGT: " << (fgtCollection() ? fgtCollection()->getNumHits() : 0) << endl;
1632  cout << "\t# of hits in RICH: " << (richCollection() ? richCollection()->getRichHits().size() : 0) << endl;
1633  cout << "\t# of PSDs: " << numberOfPsds() << endl;
1634 }
1635 
1636 void StEvent::Split()
1637 {
1638  StEventClusteringHints *clu = clusteringHints();
1639  assert(clu);
1640  TDataSetIter next(this);
1641  TDataSet *ds;
1642 // Delete all the old EventBranches
1643  while ((ds=next())) {
1644  if (ds->IsA()!=StEventBranch::Class()) continue;
1645  Remove(ds); delete ds;
1646  }
1647 
1648  vector<string> brs = clu->listOfBranches(); // list of all branches for given mode (miniDST or DST)
1649  int nbrs = brs.size();
1650  for (int ibr =0; ibr < nbrs; ibr++) { //loop over branches
1651  string sbr = brs[ibr];
1652  if(sbr.size()==0) continue;
1653  const char *brName = sbr.c_str();
1654  assert(strncmp(brName,"evt_",4)==0 || strcmp(brName,"event")==0);
1655 
1656  UInt_t tally = ((clu->branchId(brName)) << 22) | 1 ;
1657 
1658  StEventBranch *obr = new StEventBranch(brName,this,tally);
1659  vector<string> cls = clu->listOfClasses(sbr.c_str());
1660  int ncls = cls.size();
1661  for (int icl =0; icl < ncls; icl++) { //loop over clases
1662  string scl = cls[icl];
1663  if(scl.size()==0) continue;
1664  obr->AddKlass(scl.c_str());
1665  } //end clases
1666  } //end branches
1667 }
1668 
1669 Bool_t StEvent::Notify() {Split();return 0;}
1670 
1671 void StEvent::Streamer(TBuffer &R__b)
1672 {
1673  // Stream an object of class StEvent.
1674 
1675  UInt_t R__s, R__c;
1676  if (R__b.IsReading()) {
1677 
1678  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1679  if (R__v == 1) {
1680  TDataSet::Streamer(R__b);
1681  mContent.Streamer(R__b);
1682  R__b.CheckByteCount(R__s, R__c, Class());
1683  Split();
1684  return;
1685  }
1686  else { // version >=2
1687  StXRefMain::Streamer(R__b);
1688  R__b.CheckByteCount(R__s, R__c, Class());
1689  }
1690 
1691  }
1692  else /*writing*/ {
1693 
1694  TDataSetIter next(this);
1695  TDataSet *ds;
1696  while ((ds=next())) {
1697  if (ds->IsA()==StEventBranch::Class()) break;
1698  }
1699  if (!ds) {//Not splited yet
1700  Split();}
1701 
1702  R__c = R__b.WriteVersion(Class(), kTRUE);
1703  StXRefMain::Streamer(R__b);
1704  R__b.SetByteCount(R__c, kTRUE);
1705  }
1706 }
1707 //________________________________________________________________________________
1708 StSPtrVecHit* StEvent::hitCollection(const Char_t *name) {
1709  StSPtrVecHit *theHitCollection = 0;
1710  TObjectSet *set = (TObjectSet *) FindByName(name);
1711  if (set) theHitCollection = (StSPtrVecHit *) set->GetObject();
1712  return theHitCollection;
1713 }
1714 //________________________________________________________________________________
1715 void StEvent::addHitCollection(StSPtrVecHit* p, const Char_t *name) {
1716  if (p) {
1717  TObjectSet *set = (TObjectSet *) FindByName(name);
1718  if (set)
1719  cerr << "StEvent::addHitCollection(): Error, HitCollection with "
1720  << name << " already exist. Nothing added." << endl;
1721  else {
1722  set = new TObjectSet(name,p,kTRUE);
1723  Add(set);
1724  }
1725  }
1726 }
1727 //________________________________________________________________________________
1728 void StEvent::removeHitCollection(const Char_t *name) {
1729  TObjectSet *set = (TObjectSet *) FindByName(name);
1730  if (set) set->Delete();
1731 }
1732 //________________________________________________________________________________
1733 void StEvent::setIdTruth() {
1734  StSPtrVecTrackNode& trackNode = trackNodes();
1735  UInt_t nTracks = trackNode.size();
1736  StTrackNode *node=0;
1737  for (UInt_t i = 0; i < nTracks; i++) {
1738  node = trackNode[i];
1739  if (!node) continue;
1740  UInt_t notr = node->entries();
1741  for (UInt_t t = 0; t < notr; t++) {
1742  StTrack *track = node->track(t);
1743  track->setIdTruth();
1744  }
1745  }
1746  // loop over all type of vertices
1747  Int_t noOfPrimaryVertices = numberOfPrimaryVertices();
1748  for (Int_t i = 0; i < noOfPrimaryVertices; i++) primaryVertex(i)->setIdTruth();
1749  Int_t noOfCalibrationVertices = numberOfCalibrationVertices();
1750  for (Int_t i = 0; i < noOfCalibrationVertices; i++) calibrationVertex(i)->setIdTruth();
1751  Int_t noOfv0Vertices = v0Vertices().size();
1752  for (Int_t i = 0; i < noOfv0Vertices; i++) ((StVertex *) v0Vertices()[i])->setIdTruth();
1753  Int_t noOfxiVertices = xiVertices().size();
1754  for (Int_t i = 0; i < noOfxiVertices; i++) ((StVertex *) xiVertices()[i])->setIdTruth();
1755  Int_t noOfkinkVertices = kinkVertices().size();
1756  for (Int_t i = 0; i < noOfkinkVertices; i++) ((StVertex *) kinkVertices()[i])->setIdTruth();
1757 }
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
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