StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEmcCollection.cxx
1 /***************************************************************************
2  *
3  * $Id: StEmcCollection.cxx,v 2.6 2004/03/26 21:54:15 ullrich Exp $
4  *
5  * Author: Akio Ogawa, Nov 1999
6  ***************************************************************************
7  *
8  * Description:
9  *
10  ***************************************************************************
11  *
12  * $Log: StEmcCollection.cxx,v $
13  * Revision 2.6 2004/03/26 21:54:15 ullrich
14  * Added StEmcRawData to collection.
15  *
16  * Revision 2.5 2003/09/12 21:54:53 jeromel
17  * Zeroing
18  *
19  * Revision 2.4 2001/04/05 04:00:48 ullrich
20  * Replaced all (U)Long_t by (U)Int_t and all redundant ROOT typedefs.
21  *
22  * Revision 2.3 2000/07/28 19:49:27 akio
23  * Change in Detector Id for Endcap SMD
24  *
25  * Revision 2.2 2000/03/23 22:24:06 akio
26  * Initial version of Emc Point, and Inclusion of track pointers
27  *
28  * Revision 2.1 2000/02/23 17:34:05 ullrich
29  * Initial Revision
30  *
31  **************************************************************************/
32 #include "StEmcCollection.h"
33 #include "StEmcDetector.h"
34 
35 ClassImp(StEmcCollection)
36 
37 static const char rcsid[] = "$Id: StEmcCollection.cxx,v 2.6 2004/03/26 21:54:15 ullrich Exp $";
38 
40  for(int i=0; i<8; i++) mDetector[i] = 0;
41  mBemcRawData =0;
42  mEemcRawData =0;
43 }
44 
45 StEmcCollection::~StEmcCollection(){
46  for(int i=0; i<8; i++)
47  if(mDetector[i])
48  delete mDetector[i];
49  if(mBemcRawData) delete mBemcRawData;
50  if(mEemcRawData) delete mEemcRawData;
51 }
52 
53 const StEmcDetector*
54 StEmcCollection::detector(StDetectorId id) const
55 {
56  if(id >= kBarrelEmcTowerId && id <= kEndcapSmdVStripId)
57  return mDetector[id-kBarrelEmcTowerId];
58  else
59  return 0;
60 }
61 
63 StEmcCollection::detector(StDetectorId id)
64 {
65  if(id >= kBarrelEmcTowerId && id <= kEndcapSmdVStripId)
66  return mDetector[id-kBarrelEmcTowerId];
67  else
68  return 0;
69 }
70 
71 void
72 StEmcCollection::setDetector(StEmcDetector* val)
73 {
74  if (val) {
75  unsigned int id = val->detectorId();
76  if (id >= kBarrelEmcTowerId && id <= kEndcapSmdVStripId) {
77  if (mDetector[id-kBarrelEmcTowerId]) delete mDetector[id-kBarrelEmcTowerId];
78  mDetector[id-kBarrelEmcTowerId] = val;
79  }
80  }
81 }
82 
83 const StSPtrVecEmcPoint&
84 StEmcCollection::barrelPoints() const { return mBarrel; }
85 
86 StSPtrVecEmcPoint&
87 StEmcCollection::barrelPoints() { return mBarrel; }
88 
89 const StSPtrVecEmcPoint&
90 StEmcCollection::endcapPoints() const { return mEndcap; }
91 
92 StSPtrVecEmcPoint&
93 StEmcCollection::endcapPoints() { return mEndcap; }
94 
95 void
96 StEmcCollection::addBarrelPoint(const StEmcPoint* p){mBarrel.push_back(p);}
97 
98 void
99 StEmcCollection::addEndcapPoint(const StEmcPoint* p){mEndcap.push_back(p);}
100 
102 StEmcCollection::bemcRawData() { return mBemcRawData;}
103 
105 StEmcCollection::eemcRawData() { return mEemcRawData;}
106 
107 void StEmcCollection::setBemcRawData(StEmcRawData* data) { mBemcRawData = data;}
108 void StEmcCollection::setEemcRawData(StEmcRawData* data) { mEemcRawData = data;}