StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMcSsdWaferHitCollection.cc
1 /***************************************************************************
2  *
3  * $Id: StMcSsdWaferHitCollection.cc,v 2.2 2012/03/01 16:48:29 perev Exp $
4  *
5  * Author: Manuel Calderon de la Barca Sanchez, Oct 1999
6  ***************************************************************************
7  *
8  * Description: Monte Carlo Ssd Wafer Hit Collection class
9  *
10  ***************************************************************************
11  *
12  * $Log: StMcSsdWaferHitCollection.cc,v $
13  * Revision 2.2 2012/03/01 16:48:29 perev
14  * method Browse() added
15  *
16  * Revision 2.1 2005/11/22 21:44:52 fisyak
17  * Add compress Print for McEvent, add Ssd collections
18  *
19  * Revision 2.4 2005/01/27 23:40:48 calderon
20  * Adding persistency to StMcEvent as a step for Virtual MonteCarlo.
21  *
22  * Revision 2.3 2003/02/19 03:16:05 calderon
23  * Introduction of Ctb Hit Class and Ctb Hit Collection class, modified
24  * StMcTrack, and StMcEvent accordingly. Clearing of hits in StMcSsdWaferHitCollection.
25  *
26  * Revision 2.2 2000/03/06 18:05:23 calderon
27  * 1) Modified SSD Hits storage scheme from layer-ladder-wafer to
28  * barrel-ladder-wafer.
29  * 2) Added Rich Hit class and collection, and links to them in other
30  * classes.
31  *
32  * Revision 2.1 1999/11/19 19:06:33 calderon
33  * Recommit after redoing the files.
34  *
35  * Revision 2.0 1999/11/17 02:01:00 calderon
36  * Completely revised for new StEvent
37  *
38  *
39  **************************************************************************/
40 #include "TBrowser.h"
41 #include "StMcSsdWaferHitCollection.hh"
42 #include "StMcSsdHit.hh"
43 
44 static const char rcsid[] = "$Id: StMcSsdWaferHitCollection.cc,v 2.2 2012/03/01 16:48:29 perev Exp $";
46 //_____________________________________________________________________________
47 StMcSsdWaferHitCollection::StMcSsdWaferHitCollection() { /* noop */ }
48 
49 //_____________________________________________________________________________
50 StMcSsdWaferHitCollection::~StMcSsdWaferHitCollection()
51 {
52  // StMcSsdHit provides its own new/delete operator, and
53  // mHits is a polymorphic container, so we need to do this.
54  Clear();
55 }
56 //_____________________________________________________________________________
57 const StSPtrVecMcSsdHit& StMcSsdWaferHitCollection::hits() const { return mHits; }
58 
59 //_____________________________________________________________________________
60 StSPtrVecMcSsdHit& StMcSsdWaferHitCollection::hits() { return mHits; }
61 //_____________________________________________________________________________
62 void StMcSsdWaferHitCollection::Clear(const char*)
63 {
64  for (int i=0; i<(int)mHits.size(); i++)
65  {
66  delete mHits[i]; mHits[i] = 0;
67  }
68  mHits.clear();
69 }
70 //_____________________________________________________________________________
71 void StMcSsdWaferHitCollection::Browse(TBrowser *b)
72 {
73  // Browse this event (called by TBrowser).
74  for (int i=0; i<(int)mHits.size(); i++) {
75  TObject *obj = mHits[i]; if (!obj) continue;
76  TString ts(obj->GetName()); ts+="#"; ts+=i;
77  b->Add(obj,ts.Data());
78  }
79 }