CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ClusterShapeAlgo.cc
Go to the documentation of this file.
1 #include <iostream>
2 
10 
15 
16 #include "CLHEP/Geometry/Transform3D.h"
17 #include "CLHEP/Units/GlobalSystemOfUnits.h"
18 
20  parameterSet_(par) {}
21 
23  const EcalRecHitCollection *hits,
26 {
27  Calculate_TopEnergy(passedCluster,hits);
28  Calculate_2ndEnergy(passedCluster,hits);
29  Create_Map(hits,topology);
39  Calculate_Covariances(passedCluster,hits,geometry);
40  Calculate_BarrelBasketEnergyFraction(passedCluster,hits, Eta, geometry);
41  Calculate_BarrelBasketEnergyFraction(passedCluster,hits, Phi, geometry);
42  Calculate_EnergyDepTopology (passedCluster,hits,geometry,true) ;
43  Calculate_lat(passedCluster);
44  Calculate_ComplexZernikeMoments(passedCluster);
45 
51 }
52 
54 {
55  double eMax=0;
56  DetId eMaxId(0);
57 
58  std::vector< std::pair<DetId, float> > clusterDetIds = passedCluster.hitsAndFractions();
59  std::vector< std::pair<DetId, float> >::iterator posCurrent;
60 
61  EcalRecHit testEcalRecHit;
62 
63  for(posCurrent = clusterDetIds.begin(); posCurrent != clusterDetIds.end(); posCurrent++)
64  {
65  if (((*posCurrent).first != DetId(0)) && (hits->find((*posCurrent).first) != hits->end()))
66  {
67  EcalRecHitCollection::const_iterator itt = hits->find((*posCurrent).first);
68  testEcalRecHit = *itt;
69 
70  if(testEcalRecHit.energy() * (*posCurrent).second > eMax)
71  {
72  eMax = testEcalRecHit.energy() * (*posCurrent).second;
73  eMaxId = testEcalRecHit.id();
74  }
75  }
76  }
77 
78  eMax_ = eMax;
79  eMaxId_ = eMaxId;
80 }
81 
83 {
84  double e2nd=0;
85  DetId e2ndId(0);
86 
87  std::vector< std::pair<DetId, float> > clusterDetIds = passedCluster.hitsAndFractions();
88  std::vector< std::pair<DetId, float> >::iterator posCurrent;
89 
90  EcalRecHit testEcalRecHit;
91 
92  for(posCurrent = clusterDetIds.begin(); posCurrent != clusterDetIds.end(); posCurrent++)
93  {
94  if (( (*posCurrent).first != DetId(0)) && (hits->find( (*posCurrent).first ) != hits->end()))
95  {
96  EcalRecHitCollection::const_iterator itt = hits->find( (*posCurrent).first );
97  testEcalRecHit = *itt;
98 
99  if(testEcalRecHit.energy() * (*posCurrent).second > e2nd && testEcalRecHit.id() != eMaxId_)
100  {
101  e2nd = testEcalRecHit.energy() * (*posCurrent).second;
102  e2ndId = testEcalRecHit.id();
103  }
104  }
105  }
106 
107  e2nd_ = e2nd;
108  e2ndId_ = e2ndId;
109 }
110 
112 {
113  EcalRecHit tempEcalRecHit;
115 
116  for(int x = 0; x < 5; x++)
117  for(int y = 0; y < 5; y++)
118  {
119  posCurrent.home();
120  posCurrent.offsetBy(-2+x,-2+y);
121 
122  if((*posCurrent != DetId(0)) && (hits->find(*posCurrent) != hits->end()))
123  {
124  EcalRecHitCollection::const_iterator itt = hits->find(*posCurrent);
125  tempEcalRecHit = *itt;
126  energyMap_[y][x] = std::make_pair(tempEcalRecHit.id(),tempEcalRecHit.energy());
127  }
128  else
129  energyMap_[y][x] = std::make_pair(DetId(0), 0);
130  }
131 }
132 
134 {
135  double e2x2Max = 0;
136  double e2x2Test = 0;
137 
138  int deltaX=0, deltaY=0;
139 
140  for(int corner = 0; corner < 4; corner++)
141  {
142  switch(corner)
143  {
144  case 0: deltaX = -1; deltaY = -1; break;
145  case 1: deltaX = -1; deltaY = 1; break;
146  case 2: deltaX = 1; deltaY = -1; break;
147  case 3: deltaX = 1; deltaY = 1; break;
148  }
149 
150  e2x2Test = energyMap_[2][2].second;
151  e2x2Test += energyMap_[2+deltaY][2].second;
152  e2x2Test += energyMap_[2][2+deltaX].second;
153  e2x2Test += energyMap_[2+deltaY][2+deltaX].second;
154 
155  if(e2x2Test > e2x2Max)
156  {
157  e2x2Max = e2x2Test;
158  e2x2_Diagonal_X_ = 2+deltaX;
159  e2x2_Diagonal_Y_ = 2+deltaY;
160  }
161  }
162 
163  e2x2_ = e2x2Max;
164 
165 }
166 
168 {
169  double e3x2 = 0.0;
170  double e3x2Ratio = 0.0, e3x2RatioNumerator = 0.0, e3x2RatioDenominator = 0.0;
171 
172  int e2ndX = 2, e2ndY = 2;
173  int deltaY = 0, deltaX = 0;
174 
175  double nextEnergy = -999;
176  int nextEneryDirection = -1;
177 
178  for(int cardinalDirection = 0; cardinalDirection < 4; cardinalDirection++)
179  {
180  switch(cardinalDirection)
181  {
182  case 0: deltaX = -1; deltaY = 0; break;
183  case 1: deltaX = 1; deltaY = 0; break;
184  case 2: deltaX = 0; deltaY = -1; break;
185  case 3: deltaX = 0; deltaY = 1; break;
186  }
187 
188  if(energyMap_[2+deltaY][2+deltaX].second >= nextEnergy)
189  {
190  nextEnergy = energyMap_[2+deltaY][2+deltaX].second;
191  nextEneryDirection = cardinalDirection;
192 
193  e2ndX = 2+deltaX;
194  e2ndY = 2+deltaY;
195  }
196  }
197 
198  switch(nextEneryDirection)
199  {
200  case 0: ;
201  case 1: deltaX = 0; deltaY = 1; break;
202  case 2: ;
203  case 3: deltaX = 1; deltaY = 0; break;
204  }
205 
206  for(int sign = -1; sign <= 1; sign++)
207  e3x2 += (energyMap_[2+deltaY*sign][2+deltaX*sign].second + energyMap_[e2ndY+deltaY*sign][e2ndX+deltaX*sign].second);
208 
209  e3x2RatioNumerator = energyMap_[e2ndY+deltaY][e2ndX+deltaX].second + energyMap_[e2ndY-deltaY][e2ndX-deltaX].second;
210  e3x2RatioDenominator = 0.5 + energyMap_[2+deltaY][2+deltaX].second + energyMap_[2-deltaY][2-deltaX].second;
211  e3x2Ratio = e3x2RatioNumerator / e3x2RatioDenominator;
212 
213  e3x2_ = e3x2;
214  e3x2Ratio_ = e3x2Ratio;
215 }
216 
218 {
219  double e3x3=0;
220 
221  for(int i = 1; i <= 3; i++)
222  for(int j = 1; j <= 3; j++)
223  e3x3 += energyMap_[j][i].second;
224 
225  e3x3_ = e3x3;
226 
227 }
228 
230 {
231  double e4x4=0;
232 
233  int startX=-1, startY=-1;
234 
235  switch(e2x2_Diagonal_X_)
236  {
237  case 1: startX = 0; break;
238  case 3: startX = 1; break;
239  }
240 
241  switch(e2x2_Diagonal_Y_)
242  {
243  case 1: startY = 0; break;
244  case 3: startY = 1; break;
245  }
246 
247  for(int i = startX; i <= startX+3; i++)
248  for(int j = startY; j <= startY+3; j++)
249  e4x4 += energyMap_[j][i].second;
250 
251  e4x4_ = e4x4;
252 }
253 
255 {
256  double e5x5=0;
257 
258  for(int i = 0; i <= 4; i++)
259  for(int j = 0; j <= 4; j++)
260  e5x5 += energyMap_[j][i].second;
261 
262  e5x5_ = e5x5;
263 
264 }
265 
267 {
268 double e2x5R=0.0;
269  for(int i = 0; i <= 4; i++){
270  for(int j = 0; j <= 4; j++){
271  if(j>2){e2x5R +=energyMap_[i][j].second;}
272  }
273  }
274  e2x5Right_=e2x5R;
275 }
276 
278 {
279 double e2x5L=0.0;
280  for(int i = 0; i <= 4; i++){
281  for(int j = 0; j <= 4; j++){
282  if(j<2){e2x5L +=energyMap_[i][j].second;}
283  }
284  }
285  e2x5Left_=e2x5L;
286 }
287 
289 {
290 double e2x5B=0.0;
291  for(int i = 0; i <= 4; i++){
292  for(int j = 0; j <= 4; j++){
293 
294  if(i>2){e2x5B +=energyMap_[i][j].second;}
295  }
296  }
297  e2x5Bottom_=e2x5B;
298 }
299 
301 {
302 double e2x5T=0.0;
303  for(int i = 0; i <= 4; i++){
304  for(int j = 0; j <= 4; j++){
305 
306  if(i<2){e2x5T +=energyMap_[i][j].second;}
307  }
308  }
309  e2x5Top_=e2x5T;
310 }
311 
314 {
315  if (e5x5_ > 0.)
316  {
317  double w0_ = parameterSet_.getParameter<double>("W0");
318 
319 
320  // first find energy-weighted mean position - doing it when filling the energy map might save time
321  math::XYZVector meanPosition(0.0, 0.0, 0.0);
322  for (int i = 0; i < 5; ++i)
323  {
324  for (int j = 0; j < 5; ++j)
325  {
326  DetId id = energyMap_[i][j].first;
327  if (id != DetId(0))
328  {
329  GlobalPoint positionGP = geometry->getGeometry(id)->getPosition();
330  math::XYZVector position(positionGP.x(),positionGP.y(),positionGP.z());
331  meanPosition = meanPosition + energyMap_[i][j].second * position;
332  }
333  }
334  }
335 
336  meanPosition /= e5x5_;
337 
338  // now we can calculate the covariances
339  double numeratorEtaEta = 0;
340  double numeratorEtaPhi = 0;
341  double numeratorPhiPhi = 0;
342  double denominator = 0;
343 
344  for (int i = 0; i < 5; ++i)
345  {
346  for (int j = 0; j < 5; ++j)
347  {
348  DetId id = energyMap_[i][j].first;
349  if (id != DetId(0))
350  {
351  GlobalPoint position = geometry->getGeometry(id)->getPosition();
352 
353  double dPhi = position.phi() - meanPosition.phi();
354  if (dPhi > + Geom::pi()) { dPhi = Geom::twoPi() - dPhi; }
355  if (dPhi < - Geom::pi()) { dPhi = Geom::twoPi() + dPhi; }
356 
357  double dEta = position.eta() - meanPosition.eta();
358  double w = 0.;
359  if ( energyMap_[i][j].second > 0.)
360  w = std::max(0.0, w0_ + log( energyMap_[i][j].second / e5x5_));
361 
362  denominator += w;
363  numeratorEtaEta += w * dEta * dEta;
364  numeratorEtaPhi += w * dEta * dPhi;
365  numeratorPhiPhi += w * dPhi * dPhi;
366  }
367  }
368  }
369 
370  covEtaEta_ = numeratorEtaEta / denominator;
371  covEtaPhi_ = numeratorEtaPhi / denominator;
372  covPhiPhi_ = numeratorPhiPhi / denominator;
373  }
374  else
375  {
376  // Warn the user if there was no energy in the cells and return zeroes.
377  // std::cout << "\ClusterShapeAlgo::Calculate_Covariances: no energy in supplied cells.\n";
378  covEtaEta_ = 0;
379  covEtaPhi_ = 0;
380  covPhiPhi_ = 0;
381  }
382 }
383 
385  const EcalRecHitCollection *hits,
386  const int EtaPhi,
388 {
389  if( (hits!=0) && ( ((*hits)[0]).id().subdetId() != EcalBarrel ) ) {
390  //std::cout << "No basket correction for endacap!" << std::endl;
391  return;
392  }
393 
394  std::map<int,double> indexedBasketEnergy;
395  std::vector< std::pair<DetId, float> > clusterDetIds = passedCluster.hitsAndFractions();
396  const EcalBarrelGeometry* subDetGeometry = (const EcalBarrelGeometry*) geometry;
397 
398  for(std::vector< std::pair<DetId, float> >::iterator posCurrent = clusterDetIds.begin(); posCurrent != clusterDetIds.end(); posCurrent++)
399  {
400  int basketIndex = 999;
401 
402  if(EtaPhi == Eta) {
403  int unsignedIEta = abs(EBDetId( (*posCurrent).first ).ieta());
404  std::vector<int> etaBasketSize = subDetGeometry->getEtaBaskets();
405 
406  for(unsigned int i = 0; i < etaBasketSize.size(); i++) {
407  unsignedIEta -= etaBasketSize[i];
408  if(unsignedIEta - 1 < 0)
409  {
410  basketIndex = i;
411  break;
412  }
413  }
414  basketIndex = (basketIndex+1)*(EBDetId( (*posCurrent).first ).ieta() > 0 ? 1 : -1);
415 
416  } else if(EtaPhi == Phi) {
417  int halfNumBasketInPhi = (EBDetId::MAX_IPHI - EBDetId::MIN_IPHI + 1)/subDetGeometry->getBasketSizeInPhi()/2;
418 
419  basketIndex = (EBDetId( (*posCurrent).first ).iphi() - 1)/subDetGeometry->getBasketSizeInPhi()
420  - (EBDetId( (clusterDetIds[0]).first ).iphi() - 1)/subDetGeometry->getBasketSizeInPhi();
421 
422  if(basketIndex >= halfNumBasketInPhi) basketIndex -= 2*halfNumBasketInPhi;
423  else if(basketIndex < -1*halfNumBasketInPhi) basketIndex += 2*halfNumBasketInPhi;
424 
425  } else throw(std::runtime_error("\n\nOh No! Calculate_BarrelBasketEnergyFraction called on invalid index.\n\n"));
426 
427  indexedBasketEnergy[basketIndex] += (hits->find( (*posCurrent).first ))->energy();
428  }
429 
430  std::vector<double> energyFraction;
431  for(std::map<int,double>::iterator posCurrent = indexedBasketEnergy.begin(); posCurrent != indexedBasketEnergy.end(); posCurrent++)
432  {
433  energyFraction.push_back(indexedBasketEnergy[posCurrent->first]/passedCluster.energy());
434  }
435 
436  switch(EtaPhi)
437  {
438  case Eta: energyBasketFractionEta_ = energyFraction; break;
439  case Phi: energyBasketFractionPhi_ = energyFraction; break;
440  }
441 
442 }
443 
445 
446  double r,redmoment=0;
447  double phiRedmoment = 0 ;
448  double etaRedmoment = 0 ;
449  int n,n1,n2,tmp;
450  int clusterSize=energyDistribution_.size();
451  if (clusterSize<3) {
452  etaLat_ = 0.0 ;
453  lat_ = 0.0;
454  return;
455  }
456 
457  n1=0; n2=1;
458  if (energyDistribution_[1].deposited_energy >
459  energyDistribution_[0].deposited_energy)
460  {
461  tmp=n2; n2=n1; n1=tmp;
462  }
463  for (int i=2; i<clusterSize; i++) {
464  n=i;
465  if (energyDistribution_[i].deposited_energy >
466  energyDistribution_[n1].deposited_energy)
467  {
468  tmp = n2;
469  n2 = n1; n1 = i; n=tmp;
470  } else {
471  if (energyDistribution_[i].deposited_energy >
472  energyDistribution_[n2].deposited_energy)
473  {
474  tmp=n2; n2=i; n=tmp;
475  }
476  }
477 
478  r = energyDistribution_[n].r;
479  redmoment += r*r* energyDistribution_[n].deposited_energy;
480  double rphi = r * cos (energyDistribution_[n].phi) ;
481  phiRedmoment += rphi * rphi * energyDistribution_[n].deposited_energy;
482  double reta = r * sin (energyDistribution_[n].phi) ;
483  etaRedmoment += reta * reta * energyDistribution_[n].deposited_energy;
484  }
485  double e1 = energyDistribution_[n1].deposited_energy;
486  double e2 = energyDistribution_[n2].deposited_energy;
487 
488  lat_ = redmoment/(redmoment+2.19*2.19*(e1+e2));
489  phiLat_ = phiRedmoment/(phiRedmoment+2.19*2.19*(e1+e2));
490  etaLat_ = etaRedmoment/(etaRedmoment+2.19*2.19*(e1+e2));
491 }
492 
494  // Calculate only the moments which go into the default cluster shape
495  // (moments with m>=2 are the only sensitive to azimuthal shape)
496  A20_ = absZernikeMoment(passedCluster,2,0);
497  A42_ = absZernikeMoment(passedCluster,4,2);
498 }
499 
501  int n, int m, double R0) {
502  // 1. Check if n,m are correctly
503  if ((m>n) || ((n-m)%2 != 0) || (n<0) || (m<0)) return -1;
504 
505  // 2. Check if n,R0 are within validity Range :
506  // n>20 or R0<2.19cm just makes no sense !
507  if ((n>20) || (R0<=2.19)) return -1;
508  if (n<=5) return fast_AbsZernikeMoment(passedCluster,n,m,R0);
509  else return calc_AbsZernikeMoment(passedCluster,n,m,R0);
510 }
511 
512 double ClusterShapeAlgo::f00(double r) { return 1; }
513 
514 double ClusterShapeAlgo::f11(double r) { return r; }
515 
516 double ClusterShapeAlgo::f20(double r) { return 2.0*r*r-1.0; }
517 
518 double ClusterShapeAlgo::f22(double r) { return r*r; }
519 
520 double ClusterShapeAlgo::f31(double r) { return 3.0*r*r*r - 2.0*r; }
521 
522 double ClusterShapeAlgo::f33(double r) { return r*r*r; }
523 
524 double ClusterShapeAlgo::f40(double r) { return 6.0*r*r*r*r-6.0*r*r+1.0; }
525 
526 double ClusterShapeAlgo::f42(double r) { return 4.0*r*r*r*r-3.0*r*r; }
527 
528 double ClusterShapeAlgo::f44(double r) { return r*r*r*r; }
529 
530 double ClusterShapeAlgo::f51(double r) { return 10.0*pow(r,5)-12.0*pow(r,3)+3.0*r; }
531 
532 double ClusterShapeAlgo::f53(double r) { return 5.0*pow(r,5) - 4.0*pow(r,3); }
533 
534 double ClusterShapeAlgo::f55(double r) { return pow(r,5); }
535 
537  int n, int m, double R0) {
538  double r,ph,e,Re=0,Im=0,result;
539  double TotalEnergy = passedCluster.energy();
540  int index = (n/2)*(n/2)+(n/2)+m;
541  int clusterSize=energyDistribution_.size();
542  if(clusterSize<3) return 0.0;
543 
544  for (int i=0; i<clusterSize; i++)
545  {
546  r = energyDistribution_[i].r / R0;
547  if (r<1) {
548  fcn_.clear();
550  ph = (energyDistribution_[i]).phi;
551  e = energyDistribution_[i].deposited_energy;
552  Re = Re + e/TotalEnergy * fcn_[index] * cos( (double) m * ph);
553  Im = Im - e/TotalEnergy * fcn_[index] * sin( (double) m * ph);
554  }
555  }
556  result = sqrt(Re*Re+Im*Im);
557 
558  return result;
559 }
560 
562  int n, int m, double R0) {
563  double r,ph,e,Re=0,Im=0,f_nm,result;
564  double TotalEnergy = passedCluster.energy();
565  std::vector< std::pair<DetId, float> > clusterDetIds = passedCluster.hitsAndFractions();
566  int clusterSize=energyDistribution_.size();
567  if(clusterSize<3) return 0.0;
568 
569  for (int i=0; i<clusterSize; i++)
570  {
571  r = energyDistribution_[i].r / R0;
572  if (r<1) {
573  ph = (energyDistribution_[i]).phi;
574  e = energyDistribution_[i].deposited_energy;
575  f_nm=0;
576  for (int s=0; s<=(n-m)/2; s++) {
577  if (s%2==0)
578  {
579  f_nm = f_nm + factorial(n-s)*pow(r,(double) (n-2*s))/(factorial(s)*factorial((n+m)/2-s)*factorial((n-m)/2-s));
580  }else {
581  f_nm = f_nm - factorial(n-s)*pow(r,(double) (n-2*s))/(factorial(s)*factorial((n+m)/2-s)*factorial((n-m)/2-s));
582  }
583  }
584  Re = Re + e/TotalEnergy * f_nm * cos( (double) m*ph);
585  Im = Im - e/TotalEnergy * f_nm * sin( (double) m*ph);
586  }
587  }
588  result = sqrt(Re*Re+Im*Im);
589 
590  return result;
591 }
592 
594  const EcalRecHitCollection *hits,
596  bool logW) {
597  // resets the energy distribution
598  energyDistribution_.clear();
599 
600  // init a map of the energy deposition centered on the
601  // cluster centroid. This is for momenta calculation only.
602  CLHEP::Hep3Vector clVect(passedCluster.position().x(),
603  passedCluster.position().y(),
604  passedCluster.position().z());
605  CLHEP::Hep3Vector clDir(clVect);
606  clDir*=1.0/clDir.mag();
607  // in the transverse plane, axis perpendicular to clusterDir
608  CLHEP::Hep3Vector theta_axis(clDir.y(),-clDir.x(),0.0);
609  theta_axis *= 1.0/theta_axis.mag();
610  CLHEP::Hep3Vector phi_axis = theta_axis.cross(clDir);
611 
612  std::vector< std::pair<DetId, float> > clusterDetIds = passedCluster.hitsAndFractions();
613 
615  EcalRecHit testEcalRecHit;
616  std::vector< std::pair<DetId, float> >::iterator posCurrent;
617  // loop over crystals
618  for(posCurrent=clusterDetIds.begin(); posCurrent!=clusterDetIds.end(); ++posCurrent) {
619  EcalRecHitCollection::const_iterator itt = hits->find( (*posCurrent).first );
620  testEcalRecHit=*itt;
621 
622  if(( (*posCurrent).first != DetId(0)) && (hits->find( (*posCurrent).first ) != hits->end())) {
623  clEdep.deposited_energy = testEcalRecHit.energy();
624 
625  // if logarithmic weight is requested, apply cut on minimum energy of the recHit
626  if(logW) {
627  double w0_ = parameterSet_.getParameter<double>("W0");
628 
629  if ( clEdep.deposited_energy == 0 ) {
630  LogDebug("ClusterShapeAlgo") << "Crystal has zero energy; skipping... ";
631  continue;
632  }
633  double weight = std::max(0.0, w0_ + log(fabs(clEdep.deposited_energy)/passedCluster.energy()) );
634  if(weight==0) {
635  LogDebug("ClusterShapeAlgo") << "Crystal has insufficient energy: E = "
636  << clEdep.deposited_energy << " GeV; skipping... ";
637  continue;
638  }
639  else LogDebug("ClusterShapeAlgo") << "===> got crystal. Energy = " << clEdep.deposited_energy << " GeV. ";
640  }
641  DetId id_ = (*posCurrent).first;
642  const CaloCellGeometry *this_cell = geometry->getGeometry(id_);
643  GlobalPoint cellPos = this_cell->getPosition();
644  CLHEP::Hep3Vector gblPos (cellPos.x(),cellPos.y(),cellPos.z()); //surface position?
645  // Evaluate the distance from the cluster centroid
646  CLHEP::Hep3Vector diff = gblPos - clVect;
647  // Important: for the moment calculation, only the "lateral distance" is important
648  // "lateral distance" r_i = distance of the digi position from the axis Origin-Cluster Center
649  // ---> subtract the projection on clDir
650  CLHEP::Hep3Vector DigiVect = diff - diff.dot(clDir)*clDir;
651  clEdep.r = DigiVect.mag();
652  LogDebug("ClusterShapeAlgo") << "E = " << clEdep.deposited_energy
653  << "\tdiff = " << diff.mag()
654  << "\tr = " << clEdep.r;
655  clEdep.phi = DigiVect.angle(theta_axis);
656  if(DigiVect.dot(phi_axis)<0) clEdep.phi = 2*M_PI - clEdep.phi;
657  energyDistribution_.push_back(clEdep);
658  }
659  }
660 }
661 
663  fcn_.push_back(f00(rho));
664  fcn_.push_back(f11(rho));
665  fcn_.push_back(f20(rho));
666  fcn_.push_back(f31(rho));
667  fcn_.push_back(f22(rho));
668  fcn_.push_back(f33(rho));
669  fcn_.push_back(f40(rho));
670  fcn_.push_back(f51(rho));
671  fcn_.push_back(f42(rho));
672  fcn_.push_back(f53(rho));
673  fcn_.push_back(f44(rho));
674  fcn_.push_back(f55(rho));
675 }
676 
677 double ClusterShapeAlgo::factorial(int n) const {
678  double res=1.0;
679  for(int i=2; i<=n; i++) res*=(double) i;
680  return res;
681 }
#define LogDebug(id)
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
static const int MIN_IPHI
Definition: EBDetId.h:142
double f20(double r)
void Create_Map(const EcalRecHitCollection *hits, const CaloSubdetectorTopology *topology)
const double w
Definition: UKUtility.cc:23
double fast_AbsZernikeMoment(const reco::BasicCluster &passedCluster, int n, int m, double R0)
std::vector< double > fcn_
CaloTopology const * topology(0)
std::vector< EcalClusterEnergyDeposition > energyDistribution_
edm::ParameterSet parameterSet_
double f00(double r)
double f44(double r)
double sign(double x)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
void Calculate_BarrelBasketEnergyFraction(const reco::BasicCluster &passedCluster, const EcalRecHitCollection *hits, const int EtaPhi, const CaloSubdetectorGeometry *geometry)
std::vector< EcalRecHit >::const_iterator const_iterator
T y() const
Definition: PV3DBase.h:63
double calc_AbsZernikeMoment(const reco::BasicCluster &passedCluster, int n, int m, double R0)
std::pair< DetId, double > energyMap_[5][5]
double factorial(int n) const
double f31(double r)
double absZernikeMoment(const reco::BasicCluster &passedCluster, int n, int m, double R0=6.6)
double f55(double r)
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
int iphi() const
get the crystal iphi
Definition: EBDetId.h:53
U second(std::pair< T, U > const &p)
T offsetBy(int deltaX, int deltaY) const
Free movement of arbitray steps.
Definition: CaloNavigator.h:80
reco::ClusterShape Calculate(const reco::BasicCluster &passedCluster, const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry, const CaloSubdetectorTopology *topology)
list denominator
Definition: cuy.py:484
void Calculate_Covariances(const reco::BasicCluster &passedCluster, const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry)
double f42(double r)
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
T sqrt(T t)
Definition: SSEVec.h:48
T phi() const
Definition: Phi.h:41
T z() const
Definition: PV3DBase.h:64
tuple result
Definition: query.py:137
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
void Calculate_EnergyDepTopology(const reco::BasicCluster &passedCluster, const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry, bool logW=true)
double f40(double r)
double f33(double r)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
float energy() const
Definition: EcalRecHit.h:68
void Calculate_TopEnergy(const reco::BasicCluster &passedCluster, const EcalRecHitCollection *hits)
int ieta() const
get the crystal ieta
Definition: EBDetId.h:51
#define M_PI
const_iterator end() const
void Calculate_Polynomials(double rho)
double f11(double r)
void home() const
move the navigator back to the starting point
Definition: DetId.h:18
double f51(double r)
static const int MAX_IPHI
Definition: EBDetId.h:144
DetId id() const
get the id
Definition: EcalRecHit.h:76
std::vector< double > energyBasketFractionPhi_
void Calculate_ComplexZernikeMoments(const reco::BasicCluster &passedCluster)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
const std::vector< int > & getEtaBaskets() const
int getBasketSizeInPhi() const
double f22(double r)
T eta() const
Definition: PV3DBase.h:76
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void Calculate_lat(const reco::BasicCluster &passedCluster)
ESHandle< TrackerGeometry > geometry
iterator find(key_type k)
double pi()
Definition: Pi.h:31
static int position[264][3]
Definition: ReadPGInfo.cc:509
double twoPi()
Definition: Pi.h:32
std::vector< double > energyBasketFractionEta_
Definition: DDAxes.h:10
int weight
Definition: histoStyle.py:50
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
T x() const
Definition: PV3DBase.h:62
double f53(double r)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void Calculate_2ndEnergy(const reco::BasicCluster &passedCluster, const EcalRecHitCollection *hits)
tuple log
Definition: cmsBatch.py:347
Definition: DDAxes.h:10