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

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

Definition at line 10 of file ClusterFP420.h.

Definition at line 11 of file ClusterFP420.h.

Constructor & Destructor Documentation

ClusterFP420::ClusterFP420 ( )
inline

Definition at line 14 of file ClusterFP420.h.

14 : detId_(0) {}
unsigned int detId_
Definition: ClusterFP420.h:39
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 23 of file ClusterFP420.cc.

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

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

Member Function Documentation

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

Definition at line 29 of file ClusterFP420.h.

References amplitudes_.

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

29 {return amplitudes_;}
std::vector< short > amplitudes_
Definition: ClusterFP420.h:42
float ClusterFP420::barycenter ( ) const
inline

Definition at line 31 of file ClusterFP420.h.

References barycenter_.

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

31 {return barycenter_;}
float barycenter_
Definition: ClusterFP420.h:43
float ClusterFP420::barycenterW ( ) const
inline

Definition at line 34 of file ClusterFP420.h.

References barycenterW_.

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

34 {return barycenterW_;}
float barycenterW_
Definition: ClusterFP420.h:45
float ClusterFP420::barycerror ( ) const
inline

Definition at line 32 of file ClusterFP420.h.

References barycerror_.

Referenced by TrackProducerFP420::trackFinderSophisticated().

32 {return barycerror_;}
float barycerror_
Definition: ClusterFP420.h:44
float ClusterFP420::barycerrorW ( ) const
inline

Definition at line 35 of file ClusterFP420.h.

References barycerrorW_.

Referenced by TrackProducerFP420::trackFinderSophisticated().

35 {return barycerrorW_;}
float barycerrorW_
Definition: ClusterFP420.h:46
short ClusterFP420::firstStrip ( ) const
inline

Definition at line 21 of file ClusterFP420.h.

References firstStrip_.

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

21 {return firstStrip_;}
short firstStrip_
Definition: ClusterFP420.h:41
unsigned int ClusterFP420::globalId ( ) const
inline

Definition at line 24 of file ClusterFP420.h.

References detId_.

Referenced by operator<().

24 {return detId_;}
unsigned int detId_
Definition: ClusterFP420.h:39

Member Data Documentation

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

Definition at line 42 of file ClusterFP420.h.

Referenced by amplitudes(), and ClusterFP420().

float ClusterFP420::barycenter_
private

Definition at line 43 of file ClusterFP420.h.

Referenced by barycenter(), and ClusterFP420().

float ClusterFP420::barycenterW_
private

Definition at line 45 of file ClusterFP420.h.

Referenced by barycenterW(), and ClusterFP420().

float ClusterFP420::barycerror_
private

Definition at line 44 of file ClusterFP420.h.

Referenced by barycerror(), and ClusterFP420().

float ClusterFP420::barycerrorW_
private

Definition at line 46 of file ClusterFP420.h.

Referenced by barycerrorW(), and ClusterFP420().

unsigned int ClusterFP420::detId_
private

Definition at line 39 of file ClusterFP420.h.

Referenced by ClusterFP420(), and globalId().

short ClusterFP420::firstStrip_
private

Definition at line 41 of file ClusterFP420.h.

Referenced by ClusterFP420(), and firstStrip().