StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEmcMicroCollection.cxx
1 //###########################################################
2 // EMC Micro Event
3 // Author: Alexandre A. P. Suaide
4 // initial version 08/2001
5 //
6 // See README for details
7 //###########################################################
8 #include "StEmcMicroCollection.h"
9 
10 ClassImp(StEmcMicroCollection)
11 
13 {
14  mEmcPoints=new TObjArray();
15  for(Int_t i=0;i<4;i++)
16  {
17  mEmcHits[i]=new TObjArray();
18  mEmcClusters[i]=new TObjArray();
19  }
20 }
21 StEmcMicroCollection::~StEmcMicroCollection()
22 {
23  clear();
24  for(Int_t i=0;i<4;i++)
25  {
26  delete mEmcHits[i]; mEmcHits[i]=NULL;
27  delete mEmcClusters[i]; mEmcClusters[i]=NULL;
28  }
29  delete mEmcPoints;
30 }
31 void StEmcMicroCollection::clear(Option_t *option)
32 {
33  // deleting points ...
34  for(Int_t i=0;i<getNPoints();i++)
35  {
36  StEmcMicroPoint *point = getPoint(i);
37  if(point) delete point;
38  }
39  // deleting clusters and hits
40  for(Int_t d=0;d<4;d++)
41  {
42  Int_t EmcDet=d+1;
43  for(Int_t i=0; i<getNClusters(EmcDet);i++)
44  {
45  StEmcMicroCluster* cluster = getCluster(EmcDet,i);
46  if(cluster) delete cluster;
47  }
48  for(Int_t i=0; i<getNHits(EmcDet);i++)
49  {
50  StEmcMicroHit* hit = getHit(EmcDet,i);
51  if(hit) delete hit;
52  }
53  }
54 
55  for(Int_t i=0;i<4;i++) { mEmcHits[i]->Clear(); mEmcClusters[i]->Clear();}
56  mEmcPoints->Clear();
57  return;
58 }
StEmcMicroHit * getHit(Int_t EmcDet, Int_t HitId)
Return Hit for a given EMC sub detector.
Int_t getNPoints()
Return Number of Points for a given EMC sub detector.
Int_t getNClusters(Int_t EmcDet)
Return Number of Cluster for a given EMC sub detector.
Int_t getNHits(Int_t EmcDet)
Return Number of Hits for a given EMC sub detector.
StEmcMicroPoint * getPoint(Int_t PtId)
Return Point for a given EMC sub detector.
StEmcMicroCluster * getCluster(Int_t EmcDet, Int_t ClId)
Return Cluster for a given EMC sub detector.