CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
ClusterFP420 Class Reference

#include <ClusterFP420.h>

Public Types

typedef std::vector< HDigiFP420 >::const_iterator HDigiFP420Iter
 
typedef std::pair< HDigiFP420Iter, HDigiFP420IterHDigiFP420Range
 

Public Member Functions

const std::vector< short > & amplitudes () const
 
float barycenter () const
 
float barycenterW () const
 
float barycerror () const
 
float barycerrorW () const
 
 ClusterFP420 ()
 
 ClusterFP420 (unsigned int, unsigned int, const HDigiFP420Range &, float &, float &)
 
short firstStrip () const
 
unsigned int globalId () const
 

Private Attributes

std::vector< short > amplitudes_
 
float barycenter_
 
float barycenterW_
 
float barycerror_
 
float barycerrorW_
 
unsigned int detId_
 
short firstStrip_
 

Detailed Description

Definition at line 7 of file ClusterFP420.h.

Member Typedef Documentation

◆ HDigiFP420Iter

typedef std::vector<HDigiFP420>::const_iterator ClusterFP420::HDigiFP420Iter

Definition at line 9 of file ClusterFP420.h.

◆ HDigiFP420Range

Definition at line 10 of file ClusterFP420.h.

Constructor & Destructor Documentation

◆ ClusterFP420() [1/2]

ClusterFP420::ClusterFP420 ( )
inline

Definition at line 13 of file ClusterFP420.h.

13 : detId_(0) {}

◆ ClusterFP420() [2/2]

ClusterFP420::ClusterFP420 ( unsigned int  detid,
unsigned int  xytype,
const HDigiFP420Range range,
float &  cog,
float &  err 
)

The barycenter of the cluster, not corrected for Lorentz shift; it can means that should not be used as position estimate for tracking.

Definition at line 25 of file ClusterFP420.cc.

26  : detId_(detid),
27  firstStrip_(range.first->strip())
28 // detId_(detid), xytype_(xytype), firstStrip_(range.first->strip())
29 {
30  // For the range of strips in cluster assign adc(,its numbers i->strip()) calculate cog...
31  // strip :
32 #ifdef mydigidebug11
33  std::cout << "===================================== firstStrip = " << firstStrip_ << std::endl;
34  std::cout << "==range.first->strip() = " << range.first->strip() << std::endl;
35  std::cout << "==range.second->strip() = " << range.second->strip() << std::endl;
36 #endif
37 
38  amplitudes_.reserve(range.second - range.first);
39 
40  int striprange = 0;
41  float sumx = 0.;
42  float sumxx = 0.;
43  float sumy = 0.;
44  float sumyy = 0.;
45  int suma = 0;
46 
47  // int lastStrip = -1;
48  for (HDigiFP420Iter i = range.first; i != range.second; i++) {
49  striprange++;
50 #ifdef mydigidebug11
51  std::cout << " current striprange = " << striprange << std::endl;
52 #endif
53  /*
55  if (i!=ibeg && (difNarr(xytype,i,i-1) > 1 || difWide(xytype,i,i-1) > 1) ){
56  if (lastStrip>0 && i->strip() != lastStrip + 1) {
57  for (int j=0; j < i->strip()-(lastStrip+1); j++) {
58  amplitudes_.push_back( 0);
59  }
60  }
61  lastStrip = i->strip();
62 */
63  short amp = i->adc(); // FIXME: gain correction here
64 
65 #ifdef mydigidebug11
66  std::cout << " current strip = " << i->strip() << " amp = " << amp << std::endl;
67 #endif
68 
69  amplitudes_.push_back(amp);
70  if (xytype == 1) {
71  sumx += i->stripH() * amp;
72  sumy += i->stripHW() * amp;
73  suma += amp;
74  sumxx += (i->stripH()) * (i->stripH()) * amp;
75  sumyy += (i->stripHW()) * (i->stripHW()) * amp;
76  } else if (xytype == 2) {
77  sumx += i->stripV() * amp;
78  sumy += i->stripVW() * amp;
79  suma += amp;
80  sumxx += (i->stripV()) * (i->stripV()) * amp;
81  sumyy += (i->stripVW()) * (i->stripVW()) * amp;
82  } else {
83  std::cout << " ClusterFP420: wrong xytype = " << xytype << std::endl;
84  }
85 
86 #ifdef mydigidebug11
87  std::cout << " current sumx = " << sumx << std::endl;
88  std::cout << " current sumy = " << sumy << std::endl;
89  std::cout << " current suma = " << suma << std::endl;
90  std::cout << " current barycenter = " << (sumx / static_cast<float>(suma)) << std::endl;
91  std::cout << " current barycenterW= " << (sumy / static_cast<float>(suma)) << std::endl;
92 #endif
93  } //for i
94 
95  if (suma != 0) {
96  barycenter_ = sumx / static_cast<float>(suma);
97  barycerror_ = sumxx / static_cast<float>(suma);
99 #ifdef mydigidebug11
100  std::cout << "barycerror_ = " << barycerror_ << "barycenter_ = " << barycenter_ << std::endl;
101 #endif
102  barycenterW_ = sumy / static_cast<float>(suma);
103  barycerrorW_ = sumyy / static_cast<float>(suma);
105 #ifdef mydigidebug11
106  std::cout << "barycerrorW_ = " << barycerrorW_ << "barycenterW_ = " << barycenterW_ << std::endl;
107 #endif
108  } else {
109  barycenter_ = 1000000.;
110  barycerror_ = 1000000.;
111  barycenterW_ = 1000000.;
112  barycerrorW_ = 1000000.;
113  }
114 
118  cog = barycenter_; // cog for Narrow pixels only
119 
120 #ifdef mydigidebug11
121  std::cout << "AT end: barycenter_ = " << barycenter_ << std::endl;
122  std::cout << "AT end: striprange = " << striprange << std::endl;
123 #endif
124 
125  /*
126 
127  float sumx0 = 0.;
128  float sumxx = 0.;
129  lastStrip = -1;
130  for (HDigiFP420Iter i=range.first; i!=range.second; i++) {
131 #ifdef mydigidebug11
132  std::cout << " current striprange = " << striprange << std::endl;
133 #endif
135  if (lastStrip>0 && i->strip() != lastStrip + 1) {
136  for (int j=0; j < i->strip()-(lastStrip+1); j++) {
137  amplitudes_.push_back( 0);
138  }
139  }
140  lastStrip = i->strip();
141 
142  short amp = i->adc(); // FIXME: gain correction here
143 
144 #ifdef mydigidebug11
145  std::cout << " current strip = " << i->strip() << " amp = " << amp << std::endl;
146 #endif
147 
148  sumx0 += (i->strip()-cog)*amp;
149  sumxx += (i->strip()-cog) * (i->strip()-cog) * amp;
150 
151 
152 #ifdef mydigidebug11
153  std::cout << " 2 current sumx0 = " << sumx0 << std::endl;
154  std::cout << " 2 current sumxx = " << sumxx << std::endl;
155 #endif
156  } //for
157 
158 
159  if(suma != 0) {
160  sumx0 = sumx0 / static_cast<float>(suma) ;
161  sumxx = sumxx / static_cast<float>(suma);
162 
163  //barycerror_ = fabs(sumxx - sumx0*sumx0) ;
164 
165  //barycerror_ = (sumxx - sumx0*sumx0) ;
166  //barycerror_ *= barycerror_ ;
167 
168  barycerror_ = sumxx ;
169 
170  }
171  else{
172  barycerror_ = 1000000. ;
173  }
174 
175 */
176 
177 #ifdef mydigidebug10
178  std::cout << "pitchcommon = " << const_ps1s2[0] << " sigma1= " << const_ps1s2[1] << " sigma2= " << const_ps1s2[2]
179  << std::endl;
180 #endif
181 
182  //
183  if (barycerror_ == 0.0) {
184  barycerror_ = const_ps1s2[1] / const_ps1s2[0]; //
185  } else {
186  barycerror_ = const_ps1s2[2] / const_ps1s2[0]; //
187  }
189  //
190  if (barycerrorW_ == 0.0) {
192  } else {
194  }
196  //
197 
198 #ifdef mydigidebug11
199  std::cout << "barycerror_ = " << barycerror_ << "barycerrorW_ = " << barycerrorW_ << std::endl;
200 #endif
201 
202  // change by hands:
203 
204  // number of station
205  int mysn0 = 2;
206 
207  // number of planes
208  int mypn0 = 5; // number of superplanes
209 
210  // number of station
211  int myrn0 = 6; // 6 possible sensors in superlayer
212 
213  // comment: detID = theFP420NumberingScheme->FP420NumberingScheme::packMYIndex(rn0, pn0, sn0, det, zside, sector, zmodule);
214  // unpack from detId_:
215 
216  int sScale = myrn0 * mypn0, dScale = myrn0 * mypn0 * mysn0;
217 
218  int det = (detId_ - 1) / dScale + 1;
219  int sector = (detId_ - 1 - dScale * (det - 1)) / sScale + 1;
220 
221 #ifdef mydigidebug11
222  std::cout << "sector = " << sector << " det= " << det << std::endl;
223 #endif
224 
225  // unpack from detId_ (OLD):
226  // int sScale = 2*mypn0;
227  //int sector = (detId_-1)/sScale + 1 ;
228 
229  float a = 0.00001;
230 
232  if (mysn0 == 2) {
233  if (sector == 2) {
234  a = 0.0026 + ((0.0075 - 0.0026) / 7.) * (mypn0 - 2); // at 8 m in mm
235  }
236  }
238  else if (mysn0 == 3) {
239  if (sector == 2) {
240  a = 0.0011 + ((0.0030 - 0.0011) / 7.) * (mypn0 - 2); // at 4 m in mm
241  } else if (sector == 3) {
242  a = 0.0022 + ((0.0068 - 0.0022) / 7.) * (mypn0 - 2); // at 8 m in mm
243  }
244  } else if (mysn0 == 4) {
245  if (sector == 2) {
246  a = 0.0009 + ((0.0024 - 0.0009) / 7.) * (mypn0 - 2); // at 2.7 m in mm
247  } else if (sector == 3) {
248  a = 0.0018 + ((0.0050 - 0.0018) / 7.) * (mypn0 - 2); // at 5.4 m in mm
249  } else if (sector == 4) {
250  a = 0.0026 + ((0.0075 - 0.0026) / 7.) * (mypn0 - 2); // at 8.1 m in mm
251  }
252  }
253 
254  // barycerror_+=a*a;
255  // barycerrorW_+=a*a;
256  barycerror_ += a * a / const_ps1s2[0] / const_ps1s2[0];
257  barycerrorW_ += a * a / constW_ps1s2[0] / constW_ps1s2[0];
258 
259  /*
260 
261  if(detId_ < 21) {
262  float a = 0.0001*(int((detId_-1)/2.)+1)/pitchall;
263  barycerror_+=a*a;
264  }
265  else if(detId_ < 41) {
266  float a = 0.0001*(int((detId_-21)/2.)+1)/pitchall;
267  a +=0.0036; // 2.5 m
268  // a +=0.0052; // 4 m
269  // a +=0.0131;// 8. m
270  barycerror_+=a*a;
271  }
272  else if(detId_ < 61) {
273  float a = 0.0001*(int((detId_-41)/2.)+1)/pitchall;
274  a +=0.0069;// 5 m 0.0059
275  // a +=0.0101;// 8. m
276  // a +=0.0241;// 16. m
277  barycerror_+=a*a;
278  }
279  else if(detId_ < 81) {
280  float a = 0.0001*(int((detId_-61)/2.)+1)/pitchall;
281  a +=0.0131;// 7.5 m 0.0111
282  // a +=0.0151;// 12. m
283  // a +=0.0301;// 24. m
284  barycerror_+=a*a;
285  }
286 */
287 #ifdef mydigidebug11
288  std::cout << "AT end: barycerror_ = " << barycerror_ << std::endl;
289 #endif
290 
292  err = barycerror_;
293 
295 
296 #ifdef mydigidebug11
297  std::cout << "AT end: err = " << err << " detId_= " << detId_ << std::endl;
298 #endif
299 }

References a, amplitudes_, barycenter_, barycenterW_, barycerror_, barycerrorW_, const_ps1s2, constW_ps1s2, gather_cfg::cout, detId_, runTheMatrix::err, firstStrip_, mps_fire::i, FastTimerService_cff::range, and mathSSE::sqrt().

Member Function Documentation

◆ amplitudes()

const std::vector<short>& ClusterFP420::amplitudes ( ) const
inline

Definition at line 28 of file ClusterFP420.h.

28 { return amplitudes_; }

References amplitudes_.

Referenced by FP420ClusterMain::run(), and TrackProducerFP420::trackFinderSophisticated().

◆ barycenter()

float ClusterFP420::barycenter ( ) const
inline

Definition at line 30 of file ClusterFP420.h.

30 { return barycenter_; }

References barycenter_.

Referenced by FP420ClusterMain::run(), and TrackProducerFP420::trackFinderSophisticated().

◆ barycenterW()

float ClusterFP420::barycenterW ( ) const
inline

Definition at line 33 of file ClusterFP420.h.

33 { return barycenterW_; }

References barycenterW_.

Referenced by FP420ClusterMain::run(), and TrackProducerFP420::trackFinderSophisticated().

◆ barycerror()

float ClusterFP420::barycerror ( ) const
inline

Definition at line 31 of file ClusterFP420.h.

31 { return barycerror_; }

References barycerror_.

Referenced by TrackProducerFP420::trackFinderSophisticated().

◆ barycerrorW()

float ClusterFP420::barycerrorW ( ) const
inline

Definition at line 34 of file ClusterFP420.h.

34 { return barycerrorW_; }

References barycerrorW_.

Referenced by TrackProducerFP420::trackFinderSophisticated().

◆ firstStrip()

short ClusterFP420::firstStrip ( ) const
inline

Definition at line 20 of file ClusterFP420.h.

20 { return firstStrip_; }

References firstStrip_.

Referenced by operator<(), and FP420ClusterMain::run().

◆ globalId()

unsigned int ClusterFP420::globalId ( ) const
inline

Definition at line 23 of file ClusterFP420.h.

23 { return detId_; }

References detId_.

Referenced by operator<().

Member Data Documentation

◆ amplitudes_

std::vector<short> ClusterFP420::amplitudes_
private

Definition at line 40 of file ClusterFP420.h.

Referenced by amplitudes(), and ClusterFP420().

◆ barycenter_

float ClusterFP420::barycenter_
private

Definition at line 41 of file ClusterFP420.h.

Referenced by barycenter(), and ClusterFP420().

◆ barycenterW_

float ClusterFP420::barycenterW_
private

Definition at line 43 of file ClusterFP420.h.

Referenced by barycenterW(), and ClusterFP420().

◆ barycerror_

float ClusterFP420::barycerror_
private

Definition at line 42 of file ClusterFP420.h.

Referenced by barycerror(), and ClusterFP420().

◆ barycerrorW_

float ClusterFP420::barycerrorW_
private

Definition at line 44 of file ClusterFP420.h.

Referenced by barycerrorW(), and ClusterFP420().

◆ detId_

unsigned int ClusterFP420::detId_
private

Definition at line 37 of file ClusterFP420.h.

Referenced by ClusterFP420(), and globalId().

◆ firstStrip_

short ClusterFP420::firstStrip_
private

Definition at line 39 of file ClusterFP420.h.

Referenced by ClusterFP420(), and firstStrip().

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
mps_fire.i
i
Definition: mps_fire.py:355
ClusterFP420::HDigiFP420Iter
std::vector< HDigiFP420 >::const_iterator HDigiFP420Iter
Definition: ClusterFP420.h:9
gather_cfg.cout
cout
Definition: gather_cfg.py:144
constW_ps1s2
static const float constW_ps1s2[3]
Definition: ClusterFP420.cc:21
ClusterFP420::firstStrip_
short firstStrip_
Definition: ClusterFP420.h:39
ClusterFP420::barycerror_
float barycerror_
Definition: ClusterFP420.h:42
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
ClusterFP420::barycenter_
float barycenter_
Definition: ClusterFP420.h:41
a
double a
Definition: hdecay.h:119
runTheMatrix.err
err
Definition: runTheMatrix.py:288
ClusterFP420::barycenterW_
float barycenterW_
Definition: ClusterFP420.h:43
ClusterFP420::detId_
unsigned int detId_
Definition: ClusterFP420.h:37
ClusterFP420::amplitudes_
std::vector< short > amplitudes_
Definition: ClusterFP420.h:40
ClusterFP420::barycerrorW_
float barycerrorW_
Definition: ClusterFP420.h:44
const_ps1s2
static const float const_ps1s2[3]
Definition: ClusterFP420.cc:19