7 #include "../interface/PhotonFix.h" 10 _e(e), _eta(eta), _phi(phi), _r9(r9) {
31 for(
unsigned i(0);
i<169;
i++) {
32 for(
unsigned j(0);j<360;j++) {
35 double r2(de*de+df*df);
51 for(
unsigned i(0);
i<33;
i++) {
52 for(
unsigned j(0);j<180;j++) {
55 double r2(de*de+df*df);
71 for(
unsigned i(0);
i<7;
i++) {
72 for(
unsigned j(0);j<18;j++) {
75 double r2(de*de+df*df);
91 unsigned iz(
_eta>=0.0?0:1);
92 double r[2]={
xZ(),
yZ()};
95 for(
unsigned i(0);
i<7080;
i++) {
98 double r2(dx*dx+dy*dy);
102 if(r[0]>0.0)
_aC= dx;
104 if(r[1]>0.0)
_bC= dy;
110 for(
unsigned i(0);
i<264;
i++) {
113 double r2(dx*dx+dy*dy);
117 if(r[0]>0.0)
_aS= dx;
119 if(r[1]>0.0)
_bS= dy;
125 for(
unsigned i(0);
i<1;
i++) {
128 double r2(dx*dx+dy*dy);
132 if(iz==0) {
_aM= dx;
_bM= dy;}
352 std::cout <<
"PhotonFix: e,eta,phi,r9 = " <<
_e <<
", " <<
_eta <<
", " <<
_phi <<
", " <<
_r9 <<
", gaps " 353 <<
_aC <<
", " <<
_aS <<
", " <<
_aM <<
", " 354 <<
_bC <<
", " <<
_bS <<
", " <<
_bM << std::endl;
358 for(
unsigned i(0);
i<4;
i++) {
384 for(
unsigned i(0);
i<4;
i++) {
410 for(
unsigned be(0);be<2;be++) {
411 for(
unsigned hl(0);hl<2;hl++) {
412 for(
unsigned i(0);
i<4;
i++) {
413 o <<
" _meanScale[" << be <<
"][" << hl <<
"][" <<
i <<
"]=" <<
_meanScale[be][hl][
i] <<
";" << std::endl;
415 for(
unsigned i(0);
i<4;
i++) {
416 o <<
" _meanAT[" << be <<
"][" << hl <<
"][" <<
i <<
"]=" <<
_meanAT[be][hl][
i] <<
";" << std::endl;
418 for(
unsigned i(0);
i<4;
i++) {
419 o <<
" _meanAC[" << be <<
"][" << hl <<
"][" <<
i <<
"]=" <<
_meanAC[be][hl][
i] <<
";" << std::endl;
421 for(
unsigned i(0);
i<4;
i++) {
422 o <<
" _meanAS[" << be <<
"][" << hl <<
"][" <<
i <<
"]=" <<
_meanAS[be][hl][
i] <<
";" << std::endl;
424 for(
unsigned i(0);
i<4;
i++) {
425 o <<
" _meanAM[" << be <<
"][" << hl <<
"][" <<
i <<
"]=" <<
_meanAM[be][hl][
i] <<
";" << std::endl;
427 for(
unsigned i(0);
i<4;
i++) {
428 o <<
" _meanBT[" << be <<
"][" << hl <<
"][" <<
i <<
"]=" <<
_meanBT[be][hl][
i] <<
";" << std::endl;
430 for(
unsigned i(0);
i<4;
i++) {
431 o <<
" _meanBC[" << be <<
"][" << hl <<
"][" <<
i <<
"]=" <<
_meanBC[be][hl][
i] <<
";" << std::endl;
433 for(
unsigned i(0);
i<4;
i++) {
434 o <<
" _meanBS[" << be <<
"][" << hl <<
"][" <<
i <<
"]=" <<
_meanBS[be][hl][
i] <<
";" << std::endl;
436 for(
unsigned i(0);
i<4;
i++) {
437 o <<
" _meanBM[" << be <<
"][" << hl <<
"][" <<
i <<
"]=" <<
_meanBM[be][hl][
i] <<
";" << std::endl;
439 for(
unsigned i(0);
i<4;
i++) {
440 o <<
" _meanR9[" << be <<
"][" << hl <<
"][" <<
i <<
"]=" <<
_meanR9[be][hl][
i] <<
";" << std::endl;
444 for(
unsigned i(0);
i<4;
i++) {
445 o <<
" _sigmaScale[" << be <<
"][" << hl <<
"][" <<
i <<
"]=" <<
_sigmaScale[be][hl][
i] <<
";" << std::endl;
447 for(
unsigned i(0);
i<4;
i++) {
448 o <<
" _sigmaAT[" << be <<
"][" << hl <<
"][" <<
i <<
"]=" <<
_sigmaAT[be][hl][
i] <<
";" << std::endl;
450 for(
unsigned i(0);
i<4;
i++) {
451 o <<
" _sigmaAC[" << be <<
"][" << hl <<
"][" <<
i <<
"]=" <<
_sigmaAC[be][hl][
i] <<
";" << std::endl;
453 for(
unsigned i(0);
i<4;
i++) {
454 o <<
" _sigmaAS[" << be <<
"][" << hl <<
"][" <<
i <<
"]=" <<
_sigmaAS[be][hl][
i] <<
";" << std::endl;
456 for(
unsigned i(0);
i<4;
i++) {
457 o <<
" _sigmaAM[" << be <<
"][" << hl <<
"][" <<
i <<
"]=" <<
_sigmaAM[be][hl][
i] <<
";" << std::endl;
459 for(
unsigned i(0);
i<4;
i++) {
460 o <<
" _sigmaBT[" << be <<
"][" << hl <<
"][" <<
i <<
"]=" <<
_sigmaBT[be][hl][
i] <<
";" << std::endl;
462 for(
unsigned i(0);
i<4;
i++) {
463 o <<
" _sigmaBC[" << be <<
"][" << hl <<
"][" <<
i <<
"]=" <<
_sigmaBC[be][hl][
i] <<
";" << std::endl;
465 for(
unsigned i(0);
i<4;
i++) {
466 o <<
" _sigmaBS[" << be <<
"][" << hl <<
"][" <<
i <<
"]=" <<
_sigmaBS[be][hl][
i] <<
";" << std::endl;
468 for(
unsigned i(0);
i<4;
i++) {
469 o <<
" _sigmaBM[" << be <<
"][" << hl <<
"][" <<
i <<
"]=" <<
_sigmaBM[be][hl][
i] <<
";" << std::endl;
471 for(
unsigned i(0);
i<4;
i++) {
472 o <<
" _sigmaR9[" << be <<
"][" << hl <<
"][" <<
i <<
"]=" <<
_sigmaR9[be][hl][
i] <<
";" << std::endl;
480 o <<
"PhotonFix::printParameters()" << std::endl;
482 for(
unsigned be(0);be<2;be++) {
483 for(
unsigned hl(0);hl<2;hl++) {
484 o <<
" Parameters for " << (be==0?
"barrel":
"endcap")
485 <<
", " << (hl==0?
"high":
"low") <<
" R9" << std::endl;
487 o <<
" Mean scaling ";
488 for(
unsigned i(0);
i<4;
i++) o << std::setw(14) <<
_meanScale[be][hl][
i];
490 o <<
" Mean " << (be==0?
"Eta ":
"ZetaX") <<
" total ";
491 for(
unsigned i(0);
i<4;
i++) o << std::setw(14) <<
_meanAT[be][hl][
i];
493 o <<
" Mean " << (be==0?
"Eta ":
"ZetaX") <<
" crystal ";
494 for(
unsigned i(0);
i<4;
i++) o << std::setw(14) <<
_meanAC[be][hl][
i];
496 o <<
" Mean " << (be==0?
"Eta ":
"ZetaX") <<
" submodule";
497 for(
unsigned i(0);
i<4;
i++) o << std::setw(14) <<
_meanAS[be][hl][
i];
499 o <<
" Mean " << (be==0?
"Eta ":
"ZetaX") <<
" module ";
500 for(
unsigned i(0);
i<4;
i++) o << std::setw(14) <<
_meanAM[be][hl][
i];
502 o <<
" Mean " << (be==0?
"Eta zero ":
"ZetaY total ");
503 for(
unsigned i(0);
i<4;
i++) o << std::setw(14) <<
_meanBT[be][hl][
i];
505 o <<
" Mean " << (be==0?
"Phi ":
"ZetaY") <<
" crystal ";
506 for(
unsigned i(0);
i<4;
i++) o << std::setw(14) <<
_meanBC[be][hl][
i];
508 o <<
" Mean " << (be==0?
"Phi ":
"ZetaY") <<
" submodule";
509 for(
unsigned i(0);
i<4;
i++) o << std::setw(14) <<
_meanBS[be][hl][
i];
511 o <<
" Mean " << (be==0?
"Phi ":
"ZetaY") <<
" module ";
512 for(
unsigned i(0);
i<4;
i++) o << std::setw(14) <<
_meanBM[be][hl][
i];
515 for(
unsigned i(0);
i<4;
i++) o << std::setw(14) <<
_meanR9[be][hl][
i];
518 o <<
" Sigma scaling ";
519 for(
unsigned i(0);
i<4;
i++) o << std::setw(14) <<
_sigmaScale[be][hl][
i];
521 o <<
" Sigma " << (be==0?
"Eta ":
"ZetaX") <<
" total ";
522 for(
unsigned i(0);
i<4;
i++) o << std::setw(14) <<
_sigmaAT[be][hl][
i];
524 o <<
" Sigma " << (be==0?
"Eta ":
"ZetaX") <<
" crystal ";
525 for(
unsigned i(0);
i<4;
i++) o << std::setw(14) <<
_sigmaAC[be][hl][
i];
527 o <<
" Sigma " << (be==0?
"Eta ":
"ZetaX") <<
" submodule";
528 for(
unsigned i(0);
i<4;
i++) o << std::setw(14) <<
_sigmaAS[be][hl][
i];
530 o <<
" Sigma " << (be==0?
"Eta ":
"ZetaX") <<
" module ";
531 for(
unsigned i(0);
i<4;
i++) o << std::setw(14) <<
_sigmaAM[be][hl][
i];
533 o <<
" Sigma " << (be==0?
"Eta ":
"ZetaY") <<
" total ";
534 for(
unsigned i(0);
i<4;
i++) o << std::setw(14) <<
_sigmaBT[be][hl][
i];
536 o <<
" Sigma " << (be==0?
"Eta ":
"ZetaY") <<
" crystal ";
537 for(
unsigned i(0);
i<4;
i++) o << std::setw(14) <<
_sigmaBC[be][hl][
i];
539 o <<
" Sigma " << (be==0?
"Phi ":
"ZetaY") <<
" submodule";
540 for(
unsigned i(0);
i<4;
i++) o << std::setw(14) <<
_sigmaBS[be][hl][
i];
542 o <<
" Sigma " << (be==0?
"Phi ":
"ZetaY") <<
" module ";
543 for(
unsigned i(0);
i<4;
i++) o << std::setw(14) <<
_sigmaBM[be][hl][
i];
546 for(
unsigned i(0);
i<4;
i++) o << std::setw(14) <<
_sigmaR9[be][hl][
i];
553 if(s>=0.0)
return log(
sqrt(s*s+1.0)+s);
554 else return -
log(
sqrt(s*s+1.0)-s);
558 o << std::setprecision(15);
560 for(
unsigned i(0);
i<169;
i++) {
561 for(
unsigned j(0);j<360;j++) {
562 for(
unsigned k(0);
k<2;
k++) {
568 for(
unsigned i(0);
i<33;
i++) {
569 for(
unsigned j(0);j<180;j++) {
570 for(
unsigned k(0);
k<2;
k++) {
576 for(
unsigned i(0);
i<7;
i++) {
577 for(
unsigned j(0);j<18;j++) {
578 for(
unsigned k(0);
k<2;
k++) {
584 for(
unsigned i(0);
i<100;
i++) {
585 for(
unsigned j(0);j<100;j++) {
587 else o << 1 << std::endl;
591 for(
unsigned i(0);
i<2;
i++) {
592 for(
unsigned j(0);j<7080;j++) {
593 for(
unsigned k(0);
k<2;
k++) {
599 for(
unsigned i(0);
i<2;
i++) {
600 for(
unsigned j(0);j<264;j++) {
601 for(
unsigned k(0);
k<2;
k++) {
607 for(
unsigned i(0);
i<2;
i++) {
608 for(
unsigned j(0);j<1;j++) {
609 for(
unsigned k(0);
k<2;
k++) {
624 double af(0.5*(f0+f1));
637 if(p[1]==0.0 || p[2]==0.0 || p[3]==0.0)
return 0.0;
640 if(b>=0.0)
return p[1]*
exp(-fabs(p[2])*b);
641 else return p[1]*
exp( fabs(p[3])*b);
645 if(p[1]==0.0 || p[2]==0.0 || p[3]==0.0)
return 0.0;
648 if(b>=0.0)
return p[1]*
exp(-0.5*p[2]*p[2]*b*b);
649 else return p[1]*
exp(-0.5*p[3]*p[3]*b*b);
667 for(
unsigned be(0);be<2;be++) {
668 for(
unsigned hl(0);hl<2;hl++) {
669 for(
unsigned i(0);
i<4;
i++) {
1154 _meanBS[0][1][2]=-8.88573e-27;
1214 _meanAC[1][0][0]=-0.000177563;
1218 _meanAS[1][0][0]=-0.000533039;
1230 _meanBC[1][0][0]=-0.000518186;
1234 _meanBS[1][0][0]=-0.000750734;
1320 _meanBM[1][1][0]=-0.000404987;
1546 _meanAC[1][0][0]=-0.000310485;
1562 _meanBC[1][0][0]=-0.000356413;
1648 _meanBS[1][1][0]=-0.000620577;
1722 _meanAM[0][0][0]=-0.000876726;
1804 _meanAM[0][1][0]=-0.000991417;
1820 _meanBM[0][1][0]=-0.000153536;
1878 _meanAC[1][0][0]=-0.000985244;
1882 _meanAS[1][0][0]=-0.000571197;
1894 _meanBC[1][0][0]=-0.000675969;
1898 _meanBS[1][0][0]=-0.000254569;
1980 _meanBS[1][1][0]=-0.000517633;
1986 _meanBM[1][1][2]=-7.17525e+06;
2044 std::ifstream
fin(
"../test/PhotonFix.dat");
2047 std::cout <<
"Reading in here" << std::endl;
2048 for(
unsigned i(0);
i<169;
i++) {
2049 for(
unsigned j(0);j<360;j++) {
2050 for(
unsigned k(0);
k<2;
k++) {
2056 for(
unsigned i(0);
i<33;
i++) {
2057 for(
unsigned j(0);j<180;j++) {
2058 for(
unsigned k(0);
k<2;
k++) {
2064 for(
unsigned i(0);
i<7;
i++) {
2065 for(
unsigned j(0);j<18;j++) {
2066 for(
unsigned k(0);
k<2;
k++) {
2071 for(
unsigned i(0);
i<100;
i++) {
2072 for(
unsigned j(0);j<100;j++) {
2079 for(
unsigned i(0);
i<2;
i++) {
2080 for(
unsigned j(0);j<7080;j++) {
2081 for(
unsigned k(0);
k<2;
k++) {
2087 for(
unsigned i(0);
i<2;
i++) {
2088 for(
unsigned j(0);j<264;j++) {
2089 for(
unsigned k(0);
k<2;
k++) {
2095 for(
unsigned i(0);
i<2;
i++) {
2096 for(
unsigned j(0);j<1;j++) {
2097 for(
unsigned k(0);
k<2;
k++) {
static void getParameters(unsigned be, unsigned hl, double *p)
static double _meanScale[2][2][4]
static double _meanAS[2][2][4]
static double _meanBM[2][2][4]
static double _endcapCGap[2][7080][2]
static void dumpGaps(std::ostream &o)
double fixedEnergy() const
PhotonFix(double e, double eta, double phi, double r9)
static bool _endcapCrystal[100][100]
static bool initialised()
static double expCorrection(double a, const double *p)
static double _sigmaAS[2][2][4]
static double _barrelSGap[33][180][2]
static double _meanBC[2][2][4]
static double aPhi(double f0, double f1)
static double _sigmaAM[2][2][4]
Sin< T >::type sin(const T &t)
static double _meanR9[2][2][4]
static double _meanAC[2][2][4]
static double gausCorrection(double a, const double *p)
static double _sigmaBS[2][2][4]
static double _sigmaR9[2][2][4]
static double _barrelCGap[169][360][2]
static bool initialiseGeometry(const std::string &s)
static void endcapSGap(unsigned i, unsigned j, unsigned k, double c)
static bool initialise(const std::string &s="Nominal")
static double asinh(double s)
static double _sigmaScale[2][2][4]
static void barrelMGap(unsigned i, unsigned j, unsigned k, double c)
static double _meanBS[2][2][4]
static void printParameters(std::ostream &o)
static void barrelCGap(unsigned i, unsigned j, unsigned k, double c)
static void endcapMGap(unsigned i, unsigned j, unsigned k, double c)
static double _endcapSGap[2][264][2]
static double _meanAT[2][2][4]
static void barrelSGap(unsigned i, unsigned j, unsigned k, double c)
static double _endcapMGap[2][1][2]
static const double _onePi
static void endcapCGap(unsigned i, unsigned j, unsigned k, double c)
Cos< T >::type cos(const T &t)
static void endcapCrystal(unsigned i, unsigned j, bool c)
static double _meanAM[2][2][4]
static void setParameters(unsigned be, unsigned hl, const double *p)
static double _sigmaBC[2][2][4]
double sigmaEnergy() const
static bool initialiseParameters(const std::string &s)
static double _sigmaAT[2][2][4]
static double _meanBT[2][2][4]
static double _sigmaBT[2][2][4]
static const double _twoPi
static double _sigmaBM[2][2][4]
static double dPhi(double f0, double f1)
static void dumpParameters(std::ostream &o)
static double _barrelMGap[7][18][2]
static double _sigmaAC[2][2][4]
static double GetaPhi(double f0, double f1)