StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMcTpcPadrowHitCollection.cc
1 /***************************************************************************
2  *
3  * $Id: StMcTpcPadrowHitCollection.cc,v 2.3 2012/03/01 16:48:30 perev Exp $
4  *
5  * Author: Manuel Calderon de la Barca Sanchez, Oct 1999
6  ***************************************************************************
7  *
8  * Description: Monte Carlo Tpc Padrow Hit Collection class
9  *
10  ***************************************************************************
11  *
12  * $Log: StMcTpcPadrowHitCollection.cc,v $
13  * Revision 2.3 2012/03/01 16:48:30 perev
14  * method Browse() added
15  *
16  * Revision 2.2 2005/01/27 23:40:49 calderon
17  * Adding persistency to StMcEvent as a step for Virtual MonteCarlo.
18  *
19  * Revision 2.1 2000/05/11 14:27:23 calderon
20  * use clear() in destructors to reduce size of containers
21  *
22  * Revision 2.0 1999/11/17 02:01:00 calderon
23  * Completely revised for new StEvent
24  *
25  *
26  **************************************************************************/
27 #include "TBrowser.h"
28 #include "StMcTpcPadrowHitCollection.hh"
29 #include "StMcTpcHit.hh"
30 
31 static const char rcsid[] = "$Id: StMcTpcPadrowHitCollection.cc,v 2.3 2012/03/01 16:48:30 perev Exp $";
32 
34 
35 //_____________________________________________________________________________
37 
38 //_____________________________________________________________________________
39 StMcTpcPadrowHitCollection::~StMcTpcPadrowHitCollection()
40 {
41  Clear();
42 }
43 
44 //_____________________________________________________________________________
45 const StSPtrVecMcTpcHit&
46 StMcTpcPadrowHitCollection::hits() const { return mHits; }
47 
48 //_____________________________________________________________________________
49 StSPtrVecMcTpcHit&
50 StMcTpcPadrowHitCollection::hits() { return mHits; }
51 //_____________________________________________________________________________
52 void StMcTpcPadrowHitCollection::Clear(const char*)
53 {
54  for (int i=0; i<(int)mHits.size(); i++)
55  {
56  delete mHits[i]; mHits[i] = 0;
57  }
58  mHits.clear();
59 }
60 //_____________________________________________________________________________
61 void StMcTpcPadrowHitCollection::Browse(TBrowser *b)
62 {
63  // Browse this event (called by TBrowser).
64  for (int i=0; i<(int)mHits.size(); i++) {
65  TObject *obj = mHits[i]; if (!obj) continue;
66  TString ts(obj->GetName()); ts+="#"; ts+=i;
67  b->Add(obj,ts.Data());
68  }
69 }