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