CbmRoot
CbmMvdPixelCharge.cxx
Go to the documentation of this file.
1 // -----------------------------------------------------------------------
2 // ----- CbmMvdDigi source file -----
3 // ----- Created 17/04/08 by C. Dritsa -----
4 // -----------------------------------------------------------------------
5 
6 #include "CbmMvdPixelCharge.h"
7 #include <iostream>
8 
9 
10 using std::cout;
11 using std::endl;
12 
13 // ----- Default constructor -------------------------------------------
15  : TObject()
16  , fFrame(-1)
17  , fCharge(-1.)
18  , fMaxChargeContribution(0.)
19  , fDominatingPointX(-1.)
20  , fDominatingPointY(-1.)
21  , fContributors(0.)
22  , fChannelNrX(0.)
23  , fChannelNrY(0.)
24  , fTrackCharge(0.)
25  , fDominatorTrackId(-1.)
26  , fDominatorPointId(-1.)
27  , fTrackId()
28  , fPointId()
29  , fPointWeight()
30  , fPointX()
31  , fPointY()
32  , fDominatorIndex(0)
33  , fPixelTime(-1.) {
34  for (Int_t i = 0; i < 5; i++) {
35  fTrackId[i] = -1;
36  fPointId[i] = -1;
37  fPointX[i] = 0;
38  fPointY[i] = 0;
39  }
40 }
41 // -------------------------------------------------------------------------
42 Bool_t CbmMvdPixelCharge::TestXY(Int_t channelNrX, Int_t channelNrY) {
43 
44  if ((channelNrX == fChannelNrX) && (channelNrY == fChannelNrY)) {
45  return 1;
46  } else {
47  return 0;
48  };
49 }
50 
51 // ----- Constructor with parameters -----------------------------------
53  Int_t channelNrX,
54  Int_t channelNrY,
55  Int_t pointId,
56  Int_t trackId,
57  Float_t pointPosX,
58  Float_t pointPosY,
59  Float_t time,
60  Int_t frame)
61  : TObject()
62  , fFrame(frame)
63  , fCharge(0.)
64  , fMaxChargeContribution(0.)
65  , fDominatingPointX(-1.)
66  , fDominatingPointY(-1.)
67  , fContributors(0.)
68  , fChannelNrX(channelNrX)
69  , fChannelNrY(channelNrY)
70  , fTrackCharge(charge)
71  , fDominatorTrackId(-1.)
72  , fDominatorPointId(-1.)
73  , fTrackId()
74  , fPointId()
75  , fPointWeight()
76  , fPointX()
77  , fPointY()
78  , fDominatorIndex(0)
79  , fPixelTime(time) {
80  for (Int_t i = 0; i < 5; i++) {
81  fTrackId[i] = -1;
82  fPointId[i] = -1;
83  fPointX[i] = 0;
84  fPointY[i] = 0;
85  fPointWeight[i] = 0;
86  }
87 
88  fTrackId[0] = trackId;
89  fPointId[0] = pointId;
90  fPointX[0] = pointPosX;
91  fPointY[0] = pointPosY;
92  fPointWeight[0] = charge;
93 }
94 
95 // ------- DigestCharge ----------------------------------------------------#
96 
97 // Sums up the charge stored in track charge (assuming this is the summed charge from
98 // all segments of a track). Checks if a new track contributed charge to the pixel
99 // Checks if the new track is dominant
100 
102  Float_t pointY,
103  Int_t pointId,
104  Int_t trackId) {
105  Float_t chargeContr = fTrackCharge;
106 
107  for (Int_t i = 0; i < fContributors; i++) {
108  chargeContr -= fPointWeight[i];
109  }
110 
111  if (chargeContr > 0) {
112  if (chargeContr > fMaxChargeContribution) {
114  fMaxChargeContribution = chargeContr;
115  }
116 
117  if (fContributors < 5) {
119  fTrackId[fContributors] = trackId;
120  fPointId[fContributors] = pointId;
121  fPointX[fContributors] = pointX;
122  fPointY[fContributors] = pointY;
123  fPointWeight[fContributors] = chargeContr;
125  } else {
126  // cout << "-W- " << GetName() << " Nr of Digi Contributors is bigger than 5!!!" << endl;
127  }
128  }
129 
130  // if (fTrackCharge>0)
131  // {
132  // if (fTrackCharge>fMaxChargeContribution)
133  // {
134  // fDominatorIndex = fContributors;
135  // fMaxChargeContribution = fTrackCharge;
136  // }
137  //
138  // fCharge = fCharge+fTrackCharge; // Add charge of the track
139  // fTrackCharge = 0;
140  // fTrackId[fContributors]=trackId;
141  // fPointId[fContributors]=pointId;
142  // fPointX [fContributors]=pointX;
143  // fPointY [fContributors]=pointY;
144  // fPointWeight[fContributors]=fTrackCharge;
145  // fContributors = fContributors+1;
146  //
147  // }
148 }
149 
150 // ----- Destructor ----------------------------------------------------
152 // -------------------------------------------------------------------------
153 
CbmMvdPixelCharge::fChannelNrX
Int_t fChannelNrX
Definition: CbmMvdPixelCharge.h:66
CbmMvdPixelCharge::fPointWeight
Float_t fPointWeight[5]
Definition: CbmMvdPixelCharge.h:73
CbmMvdPixelCharge::fDominatorIndex
Short_t fDominatorIndex
Definition: CbmMvdPixelCharge.h:76
CbmMvdPixelCharge::fContributors
Short_t fContributors
Definition: CbmMvdPixelCharge.h:65
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmMvdPixelCharge::fPointId
Int_t fPointId[5]
Definition: CbmMvdPixelCharge.h:72
CbmMvdPixelCharge::TestXY
Bool_t TestXY(Int_t channelNrX, Int_t channelNrY)
Definition: CbmMvdPixelCharge.cxx:42
CbmMvdPixelCharge::fTrackId
Int_t fTrackId[5]
Definition: CbmMvdPixelCharge.h:71
CbmMvdPixelCharge::fMaxChargeContribution
Float_t fMaxChargeContribution
Definition: CbmMvdPixelCharge.h:62
CbmMvdPixelCharge.h
CbmMvdPixelCharge
Definition: CbmMvdPixelCharge.h:14
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmMvdPixelCharge::fPointX
Float_t fPointX[5]
Definition: CbmMvdPixelCharge.h:74
CbmMvdPixelCharge::fPointY
Float_t fPointY[5]
Definition: CbmMvdPixelCharge.h:75
CbmMvdPixelCharge::fCharge
Float_t fCharge
Definition: CbmMvdPixelCharge.h:61
CbmMvdPixelCharge::fTrackCharge
Float_t fTrackCharge
Definition: CbmMvdPixelCharge.h:68
CbmMvdPixelCharge::fChannelNrY
Int_t fChannelNrY
Definition: CbmMvdPixelCharge.h:67
CbmMvdPixelCharge::DigestCharge
void DigestCharge(Float_t pointX, Float_t pointY, Int_t PointId, Int_t trackId)
Definition: CbmMvdPixelCharge.cxx:101
CbmMvdPixelCharge::CbmMvdPixelCharge
CbmMvdPixelCharge()
Definition: CbmMvdPixelCharge.cxx:14
CbmMvdPixelCharge::~CbmMvdPixelCharge
virtual ~CbmMvdPixelCharge()
Definition: CbmMvdPixelCharge.cxx:151