StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StRichPid.cxx
1 /***************************************************************************
2  *
3  * $Id: StRichPid.cxx,v 2.6 2001/04/05 04:00:53 ullrich Exp $
4  *
5  * Author: Matt Horsley, Sep 2000
6  ***************************************************************************
7  *
8  * Description: Definition of PID object
9  *
10  ***************************************************************************
11  *
12  * $Log: StRichPid.cxx,v $
13  * Revision 2.6 2001/04/05 04:00:53 ullrich
14  * Replaced all (U)Long_t by (U)Int_t and all redundant ROOT typedefs.
15  *
16  * Revision 2.5 2000/12/08 03:50:31 ullrich
17  * Removed compiler warning (signed/unsigned comparison).
18  *
19  * Revision 2.4 2000/11/25 11:51:49 lasiuk
20  * remove D vector and replace with a container of StRichPhotonInfo
21  *
22  * Revision 2.3 2000/11/21 19:47:33 lasiuk
23  * add the d information for each hit
24  * use the TArrayF
25  *
26  * Revision 2.2 2000/11/01 16:45:43 lasiuk
27  * Keep the pointers to the hits that are associated with the track
28  * in order to use the bit flag information. These are kept
29  * in an StPtrVec (does not own the hits) The PDG encoded number
30  * is kept as a data member now
31  *
32  * Revision 2.1 2000/09/28 10:53:56 ullrich
33  * Initial Revision.
34  *
35  ***************************************************************************/
36 #include "StRichPid.h"
37 
38 static const char rcsid[] = "$Id: StRichPid.cxx,v 2.6 2001/04/05 04:00:53 ullrich Exp $";
39 
40 ClassImp(StRichPid)
41 
43  : mParticleNumber(0),
44  mTotalAzimuth(0), mTotalArea(0), mTotalHits(0), mTotalDensity(0),
45  mTruncatedAzimuth(0), mTruncatedArea(0), mTruncatedHits(0), mTruncatedDensity(0) {/* noop */}
46 
47 StRichPid::StRichPid(StParticleDefinition* type, StThreeVectorD resid, float totAzim,
48  float totArea, unsigned short totHits, float trunAzim, float trunArea,
49  unsigned short trunHits)
50  : mMipResidual(resid), mTotalAzimuth(totAzim), mTotalArea(totArea),
51  mTotalHits(totHits), mTruncatedAzimuth(trunAzim), mTruncatedArea(trunArea),
52  mTruncatedHits(trunHits) {
53 
54  mParticleNumber = type->pdgEncoding();
55 
56  if (mTotalArea>0) {mTotalDensity=mTotalHits/mTotalArea;}
57  else mTotalDensity=0;
58 
59  if (mTruncatedArea>0) {mTruncatedDensity=mTruncatedHits/mTruncatedArea;}
60  else mTruncatedDensity=0;
61 }
62 
63 StRichPid::~StRichPid() {/* noop */}
64 
65 void StRichPid::setRingType(StParticleDefinition* t) {
66  mParticleType=t;
67  mParticleNumber = t->pdgEncoding();
68 }
69 
70 const StSPtrVecRichPhotonInfo& StRichPid::getPhotonInfo() {return mPhotonInfo;}
71 
72 StRichPhotonInfo* StRichPid::getPhotonInfo(int i)
73 {
74  if(static_cast<unsigned int>(i) > mPhotonInfo.size())
75  return 0;
76  else
77  return mPhotonInfo[i];
78 }
79 
80 
81 void StRichPid::addPhotonInfo(StRichPhotonInfo* i)
82 {
83  mPhotonInfo.push_back(i);
84 }
85 
86 int
87 StRichPid::operator==(const StRichPid& pid) const {
88  return ( mParticleNumber == pid.getParticleNumber() &&
89  mMipResidual == pid.getMipResidual() &&
90  mTotalAzimuth == pid.getTotalAzimuth() &&
91  mTotalArea == pid.getTotalArea() &&
92  mTotalHits == pid.getTotalHits() &&
93  mTotalDensity == pid.getTotalDensity() &&
94  mTruncatedAzimuth == pid.getTruncatedAzimuth() &&
95  mTruncatedArea == pid.getTruncatedArea() &&
96  mTruncatedHits == pid.getTruncatedHits() &&
97  mTruncatedDensity == pid.getTruncatedDensity() );
98 }