StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMcIstLayerHitCollection.cc
1 /***************************************************************************
2  *
3  * $Id: StMcIstLayerHitCollection.cc,v 2.3 2012/03/01 16:48:29 perev Exp $
4  *
5  * Author: Fabrice Retiere/Kai Schweda, Aug 2003
6  ***************************************************************************
7  *
8  * Description: Monte Carlo Ist Layer Hit Collection class
9  *
10  ***************************************************************************
11  *
12  * $Log: StMcIstLayerHitCollection.cc,v $
13  * Revision 2.3 2012/03/01 16:48:29 perev
14  * method Browse() added
15  *
16  * Revision 2.2 2005/05/11 20:54:29 calderon
17  * Added persistency: ClassImp, ClassDef and inheritance from StObject.
18  *
19  * Revision 2.1 2004/09/14 05:00:29 calderon
20  * Added support for Ist, Ssd and changes to Pixel, from "El Kai".
21  *
22  * Revision 2.1 2003/08/20 18:50:21 calderon
23  * Addition of Tof classes and Ist classes. Modified track, event, and
24  * container code to reflect this.
25  * Fix bug in StMcVertex and in clearing of some hit collections.
26  *
27  *
28  *
29  **************************************************************************/
30 #include "TBrowser.h"
31 #include "StMcIstLayerHitCollection.hh"
32 #include "StMcIstHit.hh"
33 static const char rcsid[] = "$Id: StMcIstLayerHitCollection.cc,v 2.3 2012/03/01 16:48:29 perev Exp $";
34 
36 
37 //_____________________________________________________________________________
39 //_____________________________________________________________________________
40 StMcIstLayerHitCollection::~StMcIstLayerHitCollection(){ Clear(); }
41 //_____________________________________________________________________________
42 void StMcIstLayerHitCollection::Clear(const char*)
43 {
44  for (int i=0; i<(int)mHits.size(); i++)
45  {
46  delete mHits[i]; mHits[i] = 0;
47  }
48  mHits.clear();
49 }
50 //_____________________________________________________________________________
51 void StMcIstLayerHitCollection::Browse(TBrowser *b)
52 {
53  // Browse this event (called by TBrowser).
54  for (int i=0; i<(int)mHits.size(); i++) {
55  TObject *obj = mHits[i]; if (!obj) continue;
56  TString ts(obj->GetName()); ts+="#"; ts+=i;
57  b->Add(obj,ts.Data());
58  }
59 }
60 
61 
62 //_____________________________________________________________________________
63 const StSPtrVecMcIstHit& StMcIstLayerHitCollection::hits() const { return mHits; }
64 
65 //_____________________________________________________________________________
66 StSPtrVecMcIstHit& StMcIstLayerHitCollection::hits() { return mHits; }
67 
68 //_____________________________________________________________________________
69 unsigned long StMcIstLayerHitCollection::numberOfHits() const
70 {
71  return mHits.size();
72 }