StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StPmdCollection.cxx
1  /**********************************************
2  *
3  * $Id: StPmdCollection.cxx,v 1.5 2010/08/27 16:54:07 perev Exp $
4  *
5  * Author: Subhasis Chattopadhyay, July 2002.
6  ***********************************************
7  *
8  * Description: Base class for PMD collection
9  *
10  ***********************************************
11  * $Log: StPmdCollection.cxx,v $
12  * Revision 1.5 2010/08/27 16:54:07 perev
13  * WarnOff
14  *
15  * Revision 1.4 2004/11/15 23:27:16 subhasis
16  * if() removed in ctor to stop valgrind error
17  *
18  * Revision 1.3 2003/10/14 10:16:31 subhasis
19  * zeroed before delete
20  *
21  * Revision 1.2 2003/05/12 12:07:13 subhasis
22  * Mapping added
23  *
24  ***********************************************/
25 #include "StPmdCollection.h"
26 #include "StPmdDetector.h"
27 
28 ClassImp(StPmdCollection)
29 
30 StPmdCollection::StPmdCollection(const Char_t * name):TDataSet(name) {
31  for(int i=0; i<2; i++){
32  mDetector[i]=0;
33  StPmdDetector * det = new StPmdDetector(i,12);
34  this->setDetector(det,i);
35  }
36 }
37 
39  for(int i=0; i<2; i++){
40  if(mDetector[i]) delete mDetector[i];
41  }
42 }
43 
46 {
47  if(id >= 0 && id <= 1)
48  return mDetector[id];
49  else
50  return 0;
51 }
52 
53 void
55 {
56  if (val) {
57  if (id >= 0 && id <= 1) {
58 
59  if (mDetector[id]) mDetector[id]=0;
60  if (mDetector[id]) delete mDetector[id];
61  mDetector[id] = val;
62  }
63  }
64 }
65 
66 
67 
StPmdDetector * detector(Int_t)
destructor
void setDetector(StPmdDetector *, Int_t)
detector id
~StPmdCollection()
constructor keeps the information for bothCPV/PMD