StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMcFgtLayerHitCollection.cc
1 /***************************************************************************
2  *
3  * $Id: StMcFgtLayerHitCollection.cc,v 2.2 2012/03/01 16:48:29 perev Exp $
4  *
5  * Author: Fabrice Retiere/Kai Schweda, Aug 2003
6  ***************************************************************************
7  *
8  * Description: Monte Carlo Fgt Layer Hit Collection class
9  *
10  ***************************************************************************
11  *
12  * $Log: StMcFgtLayerHitCollection.cc,v $
13  * Revision 2.2 2012/03/01 16:48:29 perev
14  * method Browse() added
15  *
16  * Revision 2.1 2005/04/18 20:11:33 calderon
17  * Addition of Fgt and Fst files. Modified other files to accomodate changes.
18  *
19  *
20  *
21  **************************************************************************/
22 #include "TBrowser.h"
23 #include "StMcFgtLayerHitCollection.hh"
24 #include "StMcFgtHit.hh"
25 static const char rcsid[] = "$Id: StMcFgtLayerHitCollection.cc,v 2.2 2012/03/01 16:48:29 perev Exp $";
26 
28 
29 //_____________________________________________________________________________
31 
32 //_____________________________________________________________________________
33 StMcFgtLayerHitCollection::~StMcFgtLayerHitCollection()
34 {
35  // If the hit provides its own new/delete operator.
36  Clear();
37 }
38 
39 //_____________________________________________________________________________
40 const StSPtrVecMcFgtHit& StMcFgtLayerHitCollection::hits() const { return mHits; }
41 
42 //_____________________________________________________________________________
43 StSPtrVecMcFgtHit& StMcFgtLayerHitCollection::hits() { return mHits; }
44 
45 //_____________________________________________________________________________
46 unsigned long StMcFgtLayerHitCollection::numberOfHits() const
47 {
48  return mHits.size();
49 }
50 //_____________________________________________________________________________
51 void StMcFgtLayerHitCollection::Clear(const char*)
52 {
53  for (int i=0; i<(int)mHits.size(); i++)
54  {
55  delete mHits[i]; mHits[i] = 0;
56  }
57  mHits.clear();
58 }
59 //_____________________________________________________________________________
60 void StMcFgtLayerHitCollection::Browse(TBrowser *b)
61 {
62  // Browse this event (called by TBrowser).
63  for (int i=0; i<(int)mHits.size(); i++) {
64  TObject *obj = mHits[i]; if (!obj) continue;
65  TString ts(obj->GetName()); ts+="#"; ts+=i;
66  b->Add(obj,ts.Data());
67  }
68 }