115 #include "CLHEP/Vector/LorentzVector.h"
137 #include "TProfile.h"
149 using namespace reco;
168 static const unsigned int nL1mx=140;
183 void findHOEtaPhi(
int iphsect,
int& ietaho,
int& iphiho);
186 virtual void endJob()
override ;
240 TH1F* ho_occupency[5];
308 if(m_startTS<0) m_startTS=0;
310 if (m_endTS < m_startTS) m_endTS = m_startTS + 3;
311 if (m_endTS >9) m_endTS=9;
317 tok_muons_ = consumes<reco::TrackCollection>(muonTags_);
326 produces<HOCalibVariableCollection>(
"HOCalibVariableCollection").setBranchAlias(
"HOCalibVariableCollection");
337 for (
int ij=0; ij<=
ntrgp_gm; ij++) {
338 sprintf(title,
"hotime_trgp_%i", ij+1);
340 sprintf(title,
"hopeak_trgp_%i", ij+1);
350 hst_hopedrms = fs->
make<TH1F>(
"hst_hopedrms",
"hst_hopedrms", 100, 0.0, 0.1);
351 for (
int ij=0; ij<=
ntrgp_gm; ij++) {
352 sprintf(title,
"Nhotime_trgp_%i", ij+1);
364 hst_hb1pedrms = fs->
make<TH1F>(
"hst_hb1pedrms",
"hst_hb1pedrms", 100, 0., 0.1);
367 for (
int i=0;
i<5;
i++) {
368 sprintf(title,
"ho_occupency (>%i #sigma)",
i+2);
384 allhotime->Divide(Nallhotime);
385 for (
int ij=0; ij<=
ntrgp_gm; ij++) {
386 hotime[ij]->Divide(Nhotime[ij]);
388 hopedtime->Divide(Nhopedtime);
389 libhoped->Scale(1./
max(1,nRuns));
390 libhoped1->Scale(1./
max(1,nRuns));
392 float xx = hopedpr->GetBinError(
i+1);
393 if (hopedpr->GetBinEntries(
i+1) >0) {
394 hopedrms->Fill(
i, xx);
395 hst_hopedrms->Fill(xx);
398 allhb1->Divide(Nallhb1);
399 allhb2->Divide(Nallhb2);
400 allhb3->Divide(Nallhb3);
402 float xx = hb1pedpr->GetBinError(
i+1);
403 if (hb1pedpr->GetBinEntries(
i+1) >0) {
404 hb1pedrms->Fill(
i, xx);
405 hst_hb1pedrms->Fill(xx);
409 for (
int i=0;
i<5;
i++) {
410 ho_occupency[
i]->Scale(1./
max(1,Noccu));
427 int irun = iEvent.
id().
run();
429 if (irunold !=irun) {
435 pedestal[
i][
j][
k]=0.0;
444 if (irunold !=irun) {
448 int tmpeta1 = (
i>0) ?
i -1 : -
i +14;
449 if (tmpeta1 <0 || tmpeta1 >
netamx)
continue;
453 calibped = conditions_->getHcalCalibrations(
id);
456 pedestal[tmpeta1][
j][
k] = calibped.pedestal(
k);
457 pedestal[tmpeta1][
j][ncidmx-1] += (1./(ncidmx-1))*pedestal[tmpeta1][
j][
k];
462 libhoped->Fill(nphimx*ncidmx*tmpeta1 + ncidmx*
j +
k, pedestal[tmpeta1][
j][
k]);
465 libhoped1->Fill(nphimx*nchnmx*tmpeta1 + nchnmx*
j +
k, pedestal[tmpeta1][
j][
min(
k,ncidmx-1)]);
491 if (m_hotime && m_digiInput) {
492 if ((*ho).size()>0) {
495 m_coder = (*conditions_).getHcalCoder(
id);
496 m_shape = (*conditions_).getHcalShape(m_coder);
497 int tmpeta=
id.
ieta();
498 int tmpphi=
id.iphi();
500 int tmpeta1 = (tmpeta>0) ? tmpeta -1 : -tmpeta +14;
501 for (
int i=0;
i<(*j).size() &&
i<
nchnmx;
i++) {
502 tmpdata[
i] = m_coder->charge(*m_shape,(*j).sample(
i).adc(),(*j).sample(
i).capid());
503 allhotime->Fill(
nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) +
i, tmpdata[
i]);
504 Nallhotime->Fill(
nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) + i, 1.);
508 if ((*hbhe).size()>0) {
511 m_coder = (*conditions_).getHcalCoder(
id);
512 m_shape = (*conditions_).getHcalShape(m_coder);
513 int tmpeta=
id.
ieta();
514 int tmpphi=
id.iphi();
515 int tmpdepth =
id.depth();
516 int tmpeta1 = (tmpeta>0) ? tmpeta -15 : -tmpeta + 1;
517 if (tmpdepth==1) tmpeta1 = (tmpeta>0) ? tmpeta -1 : -tmpeta +29;
518 for (
int i=0;
i<(*j).size() &&
i<
nchnmx;
i++) {
519 float signal = m_coder->charge(*m_shape,(*j).sample(
i).adc(),(*j).sample(
i).capid());
521 allhb1->Fill(
nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) +
i, signal);
522 Nallhb1->Fill(
nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) +
i, 1);
523 hb1pedpr->Fill(
nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) +
i, signal);}
525 allhb2->Fill(
nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) +
i, signal);
526 Nallhb2->Fill(
nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) +
i, 1);}
528 allhb3->Fill(
nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) +
i, signal);
529 Nallhb3->Fill(
nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) +
i, 1);}
535 double pival = acos(-1.);
540 if (cosmicmuon->size()>0) {
545 int ntrgpas_gm[
ntrgp_gm]={0,0,0,0,0,0,0,0,0,0};
586 int Noccu_old = Noccu;
588 for(reco::TrackCollection::const_iterator ncosm = cosmicmuon->begin();
589 ncosm != cosmicmuon->end(); ++ncosm) {
591 if ((*ncosm).ndof() < 15)
continue;
592 if ((*ncosm).normalizedChi2() >30.0)
continue;
596 tmpHOCalib.
trig1 = l1trg;
597 tmpHOCalib.
trig2 = hlttr;
599 int charge = ncosm->charge();
601 double innerr = (*ncosm).innerPosition().Perp2();
602 double outerr = (*ncosm).outerPosition().Perp2();
603 int iiner = (innerr <outerr) ? 1 : 0;
614 double posx, posy, posz;
615 double momx, momy, momz;
618 posx = (*ncosm).innerPosition().X();
619 posy = (*ncosm).innerPosition().Y();
620 posz = (*ncosm).innerPosition().Z();
622 momx = (*ncosm).innerMomentum().X();
623 momy = (*ncosm).innerMomentum().Y();
624 momz = (*ncosm).innerMomentum().Z();
627 posx = (*ncosm).outerPosition().X();
628 posy = (*ncosm).outerPosition().Y();
629 posz = (*ncosm).outerPosition().Z();
631 momx = (*ncosm).outerMomentum().X();
632 momy = (*ncosm).outerMomentum().Y();
633 momz = (*ncosm).outerMomentum().Z();
639 CLHEP::Hep3Vector tmpmuon3v(posx, posy, posz);
640 CLHEP::Hep3Vector tmpmuondir(momx, momy, momz);
642 bool samedir = (tmpmuon3v.dot(tmpmuondir) >0) ?
true :
false;
643 for (
int i=0;
i<3;
i++) {tmpHOCalib.
caloen[
i] = 0.0;}
645 for(reco::TrackCollection::const_iterator ncosmcor = cosmicmuon->begin();
646 ncosmcor != cosmicmuon->end(); ++ncosmcor) {
647 if (ncosmcor==ncosm)
continue;
649 CLHEP::Hep3Vector tmpmuon3vcor;
650 CLHEP::Hep3Vector tmpmom3v;
652 tmpmuon3vcor = CLHEP::Hep3Vector((*ncosmcor).innerPosition().X(),(*ncosmcor).innerPosition().Y(),(*ncosmcor).innerPosition().Z());
653 tmpmom3v = CLHEP::Hep3Vector((*ncosmcor).innerMomentum().X(),(*ncosmcor).innerMomentum().Y(),(*ncosmcor).innerMomentum().Z());
655 tmpmuon3vcor = CLHEP::Hep3Vector((*ncosmcor).outerPosition().X(),(*ncosmcor).outerPosition().Y(),(*ncosmcor).outerPosition().Z());
656 tmpmom3v = CLHEP::Hep3Vector((*ncosmcor).outerMomentum().X(),(*ncosmcor).outerMomentum().Y(),(*ncosmcor).outerMomentum().Z());
659 if (tmpmom3v.mag()<0.2 || (*ncosmcor).ndof()<5)
continue;
661 double angle = tmpmuon3v.angle(tmpmuon3vcor);
662 if (angle < 7.5*pival/180.) {inearbymuon=1;}
664 if (muonTags_.label() ==
"cosmicMuons") {
665 if (angle <7.5*pival/180.) { tmpHOCalib.
caloen[0] +=1.;}
666 if (angle <15.0*pival/180.) { tmpHOCalib.
caloen[1] +=1.;}
667 if (angle <35.0*pival/180.) { tmpHOCalib.
caloen[2] +=1.;}
671 localxhor0 = localyhor0 = 20000;
673 if (muonTags_.label() ==
"standAloneMuons") {
679 calt !=calotower->end(); calt++) {
681 double ith = (*calt).momentum().theta();
682 double iph = (*calt).momentum().phi();
684 CLHEP::Hep3Vector calo3v(
sin(ith)*
cos(iph),
sin(ith)*
sin(iph),
cos(ith));
686 double angle = tmpmuon3v.angle(calo3v);
688 if (angle < 7.5*pival/180.) {tmpHOCalib.
caloen[0] += calt->emEnergy()+calt->hadEnergy();}
689 if (angle < 15*pival/180.) {tmpHOCalib.
caloen[1] += calt->emEnergy()+calt->hadEnergy();}
690 if (angle < 35*pival/180.) {tmpHOCalib.
caloen[2] += calt->emEnergy()+calt->hadEnergy();}
695 if (tmpHOCalib.
caloen[0] >10.0)
continue;
699 double mom =
sqrt(momx*momx + momy*momy +momz*momz);
707 tmpHOCalib.
trkdr = (*ncosm).d0();
708 tmpHOCalib.
trkdz = (*ncosm).dz();
710 tmpHOCalib.
nmuon = cosmicmuon->size();
711 tmpHOCalib.
trkvx = glbpt.
x();
712 tmpHOCalib.
trkvy = glbpt.
y();
713 tmpHOCalib.
trkvz = glbpt.
z();
718 tmpHOCalib.
ndof = (inearbymuon ==0) ? (
int)(*ncosm).ndof() : -(int)(*ncosm).ndof();
719 tmpHOCalib.
chisq = (*ncosm).normalizedChi2();
720 tmpHOCalib.
therr = 0.;
721 tmpHOCalib.
pherr = 0.;
725 tmpHOCalib.
therr = innercov(1,1);
726 tmpHOCalib.
pherr = innercov(2,2);
729 tmpHOCalib.
therr = outercov(1,1);
730 tmpHOCalib.
pherr = outercov(2,2);
737 myHelix.setMaterialMode(
false);
738 myHelix.applyRadX0Correction(
true);
740 double phiho = trkpos.
phi();
741 if (phiho<0) phiho +=2*pival;
743 int iphisect_dt=int(6*(phiho+pival/18.)/pival);
744 if (iphisect_dt>=12) iphisect_dt=0;
749 for (
int kl = 0; kl<=2; kl++) {
751 int iphisecttmp = (kl<2) ? iphisect_dt + kl : iphisect_dt - 1;
752 if (iphisecttmp <0) iphisecttmp = 11;
753 if (iphisecttmp >=12) iphisecttmp = 0;
755 double phipos = iphisecttmp*pival/6.;
756 double phirot = phipos;
765 FreeTrajectoryState freetrajectorystate_ = getFreeTrajectoryState(*ncosm,&(*theMagField), iiner, samedir);
769 for (
int ik=1; ik>=0; ik--) {
771 double radial = 407.0;
772 if (ik==0) radial = 382.0;
777 auto aPlane2 =
new Plane(pos,rot);
781 if (steppingHelixstateinfo_.
isValid()) {
784 CLHEP::Hep3Vector hotrkdir2(steppingHelixstateinfo_.
momentum().
x(), steppingHelixstateinfo_.
momentum().
y(),steppingHelixstateinfo_.
momentum().
z());
788 double xx = lclvt0.
x();
789 double yy = lclvt0.y();
792 if ((
std::abs(yy) < 130 && xx >-64.7 && xx <138.2)
795 iphisect = iphisecttmp;
799 if (iphisect != iphisecttmp)
continue;
811 tmpHOCalib.
hoang = CLHEP::Hep3Vector(zLocal.
x(),zLocal.
y(),zLocal.
z()).
dot(hotrkdir2.unit());
826 for (
int i=0;
i<9;
i++) {tmpHOCalib.
hosig[
i]=-100.0;}
827 for (
int i=0;
i<18;
i++) {tmpHOCalib.
hocorsig[
i]=-100.0;}
828 for (
int i=0;
i<9;
i++) {tmpHOCalib.
hbhesig[
i]=-100.0;}
829 tmpHOCalib.
hocro = -100;
830 tmpHOCalib.
htime = -1000;
834 findHOEtaPhi(iphisect, ietaho, iphiho);
836 if (ietaho !=0 && iphiho !=0 &&
std::abs(iring)<=2) {
840 if (iphiho<0) isect -=2000000;
841 tmpHOCalib.
isect = isect;
843 tmpHOCalib.
hodx = localxhor1;
844 tmpHOCalib.
hody = localyhor1;
847 tmpHOCalib.
hocorsig[8] = localxhor0;
848 tmpHOCalib.
hocorsig[9] = localyhor0;
853 if (iring==1) {etamn=5; etamx = 10;}
854 if (iring==2) {etamn=11; etamx = 16;}
855 if (iring==-1){etamn=-10; etamx = -5;}
856 if (iring==-2){etamn=-16; etamx = -11;}
861 phimx =2*int((iphiho+1)/2.);
864 phimn = 3*int((iphiho+1)/3.) - 1;
868 if (phimn <1) phimn +=
nphimx;
869 if (phimx >72) phimx -=
nphimx;
871 int sigstr = m_startTS;
872 int sigend = m_endTS;
880 for (
int i=0;
i<9;
i++) {tmpHOCalib.
hbhesig[
i]=-100.0;}
883 if ((*hbhe).size() >0) {
888 m_coder = (*conditions_).getHcalCoder(
id);
889 m_shape = (*conditions_).getHcalShape(m_coder);
890 int tmpeta=
id.
ieta();
891 int tmpphi=
id.iphi();
892 calibped = conditions_->getHcalCalibrations(
id);
894 int deta = tmpeta-ietaho;
895 if (tmpeta==-1 && ietaho== 1) deta = -1;
896 if (tmpeta== 1 && ietaho==-1) deta = 1;
897 int dphi = tmpphi-iphiho;
899 if (dphi==71) dphi=-1;
900 if (dphi==-71) dphi=1;
905 if (ipass2 ==0 )
continue;
908 for (
int i=0;
i<(*j).size() &&
i<
nchnmx;
i++) {
909 tmpdata[
i] = m_coder->charge(*m_shape,(*j).sample(
i).adc(),(*j).sample(
i).capid());
913 for (
int i=1;
i<(*j).size() &&
i<=8;
i++) {
914 signal += tmpdata[
i] - calibped.pedestal((*j).sample(
i).capid());;
918 if (3*(deta+1)+dphi+1<9) tmpHOCalib.
hbhesig[3*(deta+1)+dphi+1] = signal;
929 if ((*hbheht).size()>0) {
930 if(!(*hbheht).size())
throw (
int)(*hbheht).size();
936 int tmpeta=
id.
ieta();
937 int tmpphi=
id.iphi();
939 int deta = tmpeta-ietaho;
940 if (tmpeta==-1 && ietaho== 1) deta = -1;
941 if (tmpeta== 1 && ietaho==-1) deta = 1;
942 int dphi = tmpphi-iphiho;
944 if (dphi==71) dphi=-1;
945 if (dphi==-71) dphi=1;
949 if ( ipass2 ==0 )
continue;
951 float signal = (*j).energy();
953 if (3*(deta+1)+dphi+1<9) tmpHOCalib.
hbhesig[3*(deta+1)+dphi+1] = signal;
962 if ((*ho).size()>0) {
974 m_coder = (*conditions_).getHcalCoder(
id);
975 m_shape = (*conditions_).getHcalShape(m_coder);
976 int tmpeta=
id.
ieta();
977 int tmpphi=
id.iphi();
980 if (tmpeta >=etamn && tmpeta <=etamx) {
982 ipass1 = (tmpphi >=phimn && tmpphi <=phimx ) ? 1 : 0;
984 ipass1 = (tmpphi==71 || tmpphi ==72 || tmpphi==1) ? 1 : 0;
988 int deta = tmpeta-ietaho;
989 if (tmpeta==-1 && ietaho== 1) deta = -1;
990 if (tmpeta== 1 && ietaho==-1) deta = 1;
992 int dphi = tmpphi -iphiho;
994 if (dphi==71) dphi=-1;
995 if (dphi==-71) dphi=1;
1000 int tmpeta1 = (tmpeta>0) ? tmpeta -1 : -tmpeta +14;
1002 float tmpdata[
nchnmx]={0,0,0,0,0,0,0,0,0,0};
1003 float sigvall[
nsigpk]={0,0,0,0,0,0,0};
1005 for (
int i=0;
i<(*j).size() &&
i<
nchnmx;
i++) {
1006 tmpdata[
i] = m_coder->charge(*m_shape,(*j).sample(
i).adc(),(*j).sample(
i).capid());
1007 if (deta==0 && dphi==0) {
1008 double tmpE = tmpdata[
i] - pedestal[tmpeta1][tmpphi-1][(*j).sample(
i).capid()];
1016 for (
int ncap=0; ncap<
nsigpk; ncap++) {
1018 sigvall[ncap] +=tmpdata[
i];
1022 if (
i==(*j).size()-1) {
1025 for (
int ij=0; ij<
nsigpk; ij++) {
1026 if (sigvall[ij] > mxled) {mxled = sigvall[ij]; imxled=ij;}
1029 for (
int ij=0; ij<4; ij++) {
1030 pedx +=pedestal[tmpeta1][tmpphi-1][ij];
1032 if (mxled-pedx >2 && mxled-pedx <20 ) {
1033 hopeak[
ntrgp_gm]->Fill(nphimx*tmpeta1 + tmpphi-1, imxled+
nstrbn);
1034 for (
int jk=0; jk<
ntrgp_gm; jk++) {
1035 if (ntrgpas_gm[jk]>0) {
1036 hopeak[jk]->Fill(nphimx*tmpeta1 + tmpphi-1, imxled+
nstrbn);
1039 if (tmpdata[5]+tmpdata[6] >1) {
1040 horatio->Fill(nphimx*tmpeta1 + tmpphi-1, (tmpdata[5]-tmpdata[6])/(tmpdata[5]+tmpdata[6]));
1042 for (
int ij=0; ij<(*j).size() && ij<
nchnmx; ij++) {
1043 hotime[
ntrgp_gm]->Fill(nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) + ij, tmpdata[ij]);
1044 Nhotime[
ntrgp_gm]->Fill(nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) + ij, 1.);
1045 for (
int jk=0; jk<
ntrgp_gm; jk++) {
1046 if (ntrgpas_gm[jk]>0) {
1047 hotime[jk]->Fill(nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) + ij, tmpdata[ij]);
1048 Nhotime[jk]->Fill(nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) + ij, 1.);
1058 if (
std::abs(tmpeta) <=15 && deta==0 && dphi ==0) {
1061 for (
int i =0;
i<nchnmx &&
i< (*j).size();
i++) {
1062 if (
i >=sigstr &&
i<=sigend)
continue;
1063 signal += tmpdata[
i] - pedestal[tmpeta1][tmpphi-1][(*j).sample(
i).capid()];
1064 if (++icnt >=4)
break;
1066 tmpHOCalib.
hocro = signal;
1070 if (ipass1 ==0 && ipass2 ==0 && cosmicmuon->size()<=2) {
1072 if ((iphiho >=1 && iphiho<=nphimx/2 && tmpphi >=1 && tmpphi <=nphimx/2) ||
1073 (iphiho >nphimx/2 && iphiho<=nphimx && tmpphi >nphimx/2 && tmpphi <=
nphimx)) {
1074 if (isFilled[nphimx*tmpeta1+tmpphi-1]==0) {
1075 isFilled[nphimx*tmpeta1+tmpphi-1]=1;
1076 for (
int i=0;
i<(*j).size() &&
i<
nchnmx;
i++) {
1077 hopedtime->Fill(nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) +
i, tmpdata[
i]);
1078 Nhopedtime->Fill(nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) + i, 1.);
1079 hopedpr->Fill(nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) + i, tmpdata[i]);
1087 if (ipass1 ==0 && ipass2 ==0 )
continue;
1090 for (
int i=sigstr;
i<(*j).size() &&
i<=sigend;
i++) {
1091 signal += tmpdata[
i] - pedestal[tmpeta1][tmpphi-1][(*j).sample(
i).capid()];
1093 if (signal <-100 || signal >100000) signal = -100;
1095 if (signal >-100 && Noccu == Noccu_old) {
1096 for (
int i=0;
i<5;
i++) {
1097 if (signal >(
i+2)*m_sigma) {
1098 ho_occupency[
i]->Fill(nphimx*tmpeta1+tmpphi-1);
1104 if (ipass1 ==0 && ipass2 ==0 )
continue;
1107 int tmpdph = tmpphi-phimn;
1108 if (tmpdph<0) tmpdph = 2;
1110 int ilog = 2*(tmpeta-etamn)+tmpdph;
1113 ilog = 3*(tmpeta-etamn)+tmpdph;
1115 ilog = 3*(etamx-tmpeta)+tmpdph;
1118 if (ilog>-1 && ilog<18) {
1119 tmpHOCalib.
hocorsig[ilog] = signal;
1124 if (3*(deta+1)+dphi+1<9) tmpHOCalib.
hosig[3*(deta+1)+dphi+1] = signal;
1158 tmpHOCalib.
htime = sumEt/
max(sumE,1.
e-6);
1165 if ((*hoht).size()>0) {
1170 int tmpeta=
id.
ieta();
1171 int tmpphi=
id.iphi();
1174 if (tmpeta >=etamn && tmpeta <=etamx) {
1175 if (phimn < phimx) {
1176 ipass1 = (tmpphi >=phimn && tmpphi <=phimx ) ? 1 : 0;
1178 ipass1 = (tmpphi==71 || tmpphi ==72 || tmpphi==1) ? 1 : 0;
1182 int deta = tmpeta-ietaho;
1183 if (tmpeta==-1 && ietaho== 1) deta = -1;
1184 if (tmpeta== 1 && ietaho==-1) deta = 1;
1186 int dphi = tmpphi -iphiho;
1188 if (dphi==71) dphi=-1;
1189 if (dphi==-71) dphi=1;
1192 float signal = (*j).energy();
1194 int tmpeta1 = (tmpeta>0) ? tmpeta -1 : -tmpeta +14;
1195 if (signal >-100 && Noccu == Noccu_old) {
1196 for (
int i=0;
i<5;
i++) {
1197 if (signal >(
i+2)*m_sigma) {
1198 ho_occupency[
i]->Fill(
nphimx*tmpeta1+tmpphi-1);
1206 if (ipass1 ==0 && ipass2 ==0 )
continue;
1209 int tmpdph = tmpphi-phimn;
1210 if (tmpdph<0) tmpdph = 2;
1212 int ilog = 2*(tmpeta-etamn)+tmpdph;
1215 ilog = 3*(tmpeta-etamn)+tmpdph;
1217 ilog = 3*(etamx-tmpeta)+tmpdph;
1220 if (ilog>-1 && ilog<18) {
1221 tmpHOCalib.
hocorsig[ilog] = signal;
1227 if (3*(deta+1)+dphi+1<9) {
1228 tmpHOCalib.
hosig[3*(deta+1)+dphi+1] = signal;
1232 if (deta==0 && dphi ==0) {
1233 tmpHOCalib.
htime = (*j).time();
1234 int crphi = tmpphi + 6;
1235 if (crphi >72) crphi -=72;
1240 int etacr= idcr.
ieta();
1241 int phicr= idcr.
iphi();
1242 if (tmpeta==etacr && crphi ==phicr) {
1254 if (Noccu == Noccu_old) Noccu++;
1255 hostore->push_back(tmpHOCalib);
1263 iEvent.
put(hostore,
"HOCalibVariableCollection");
1286 pedestal[
i][
j][
k]=0.0;
1305 double etalow[
netabin]={ 0.025, 35.195, 70.625, 106.595, 141.565, 180.765, 220.235, 261.385, 304.525, 349.975, 410.025, 452.085, 506.645, 565.025, 627.725, 660.25};
1306 double etahgh[
netabin]={ 35.145, 70.575, 106.545, 125.505, 180.715, 220.185, 261.335, 304.475, 349.925, 392.575, 452.035, 506.595, 564.975, 627.675, 661.075, 700.25};
1308 double philow[6]={-76.27, -35.11, 0.35, 35.81, 71.77, 108.93};
1309 double phihgh[6]={-35.81, -0.35, 35.11, 71.07, 108.23, 140.49};
1311 double philow00[6]={-60.27, -32.91, 0.35, 33.61, 67.37, 102.23};
1312 double phihgh00[6]={-33.61, -0.35, 32.91, 66.67, 101.53, 129.49};
1314 double philow01[6]={-64.67, -34.91, 0.35, 35.61, 71.37, 108.33};
1315 double phihgh01[6]={-35.61, -0.35, 34.91, 70.67, 107.63, 138.19};
1322 if (tmpdy >etalow[
i] && tmpdy <etahgh[
i]) {
1324 float tmp1 = fabs(tmpdy-etalow[i]);
1325 float tmp2 = fabs(tmpdy-etahgh[i]);
1327 localyhor1 = (tmp1 < tmp2) ? -tmp1 : tmp2;
1330 if (i>=4 && i<10) iring=1;
1331 if (i>=10 && i<netabin) iring=2;
1340 for (
int i=0;
i<6;
i++) {
1341 if (xhor1 >philow[
i] && xhor1 <phihgh[
i]) {
1343 float tmp1 = fabs(xhor1-philow[i]);
1344 float tmp2 = fabs(xhor1-phihgh[i]);
1345 localxhor1 = (tmp1 < tmp2) ? -tmp1 : tmp2;
1350 for (
int i=0;
i<6;
i++) {
1351 if (xhor1 >philow01[
i] && xhor1 <phihgh01[
i]) {
1353 float tmp1 = fabs(xhor1-philow01[i]);
1354 float tmp2 = fabs(xhor1-phihgh01[i]);
1355 localxhor1 = (tmp1 < tmp2) ? -tmp1 : tmp2;
1360 for (
int i=0;
i<6;
i++) {
1361 if (xhor0 >philow00[
i] && xhor0 <phihgh00[
i]) {
1363 float tmp1 = fabs(xhor0-philow00[i]);
1364 float tmp2 = fabs(xhor0-phihgh00[i]);
1365 localxhor0 = (tmp1 < tmp2) ? -tmp1 : tmp2;
1366 if (tmpphi !=tmpphi0) localxhor0 +=10000.;
1372 for (
int i=0;
i<4;
i++) {
1373 if (tmpdy >etalow[
i] && tmpdy <etahgh[
i]) {
1374 float tmp1 = fabs(tmpdy-etalow[i]);
1375 float tmp2 = fabs(tmpdy-etahgh[i]);
1376 localyhor0 = (tmp1 < tmp2) ? -tmp1 : tmp2;
1377 if (i+1 != ietaho) localyhor0 +=10000.;
1384 iphiho = 6*iphisect -2 + tmpphi;
1385 if (iphiho <=0) iphiho +=
nphimx;
1408 if (dir) gmom *=-1.;
1415 if (dir) gmom *=-1.;
T getParameter(std::string const &) const
Basic3DVector< float > DirectionType
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< CaloTowerCollection > tok_tower_
FreeTrajectoryState getFreeTrajectoryState(const reco::Track &tk, const MagneticField *field, int itag, bool dir)
edm::EDGetTokenT< reco::TrackCollection > tok_muons_
double outerPy() const
y coordinate of momentum vector at the outermost hit position
const TrackExtraRef & extra() const
reference to "extra" object
bool getByToken(EDGetToken token, Handle< PROD > &result) const
HcalCalibrations calibped
#define DEFINE_FWK_MODULE(type)
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
ReturnType plane(const PositionType &pos, const RotationType &rot) const
std::vector< HODataFrame >::const_iterator const_iterator
edm::ESHandle< HcalDbService > conditions_
virtual void produce(edm::Event &, const edm::EventSetup &) override
std::map< std::string, bool > fired
T * make(const Args &...args) const
make new ROOT object
Geom::Phi< T > phi() const
const HcalQIEShape * m_shape
virtual void endJob() override
GlobalVector momentum() const
void findHOEtaPhi(int iphsect, int &ietaho, int &iphiho)
double outerZ() const
z coordinate of the outermost hit position
static const unsigned int nL1mx
edm::EDGetTokenT< edm::TriggerResults > tok_hlt_
const math::XYZPoint & innerPosition() const
position of the innermost hit
const HcalQIECoder * m_coder
const T & max(const T &a, const T &b)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
GlobalPoint position() const
static const unsigned int nL1trg
Basic3DVector< float > RotationType
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Cos< T >::type cos(const T &t)
int ieta() const
get the cell ieta
math::Error< 5 >::type CovarianceMatrix
Abs< T >::type abs(const T &t)
virtual void beginJob() override
std::string theRootFileName
Basic3DVector< float > PositionType
double outerX() const
x coordinate of the outermost hit position
double outerPz() const
z coordinate of momentum vector at the outermost hit position
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > tok_l1_
int iphi() const
get the cell iphi
std::vector< HOCalibVariables > HOCalibVariableCollection
collection of HOcalibration variabale
edm::EDGetTokenT< HORecHitCollection > tok_ho_
AlCaHOCalibProducer(const edm::ParameterSet &)
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
double outerY() const
y coordinate of the outermost hit position
HcalCalibrationWidths calibwidth
int charge() const
track electric charge
static const unsigned int nHLTmx
HcalDetId id() const
get the id
double outerPx() const
x coordinate of momentum vector at the outermost hit position
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
T angle(T x1, T y1, T z1, T x2, T y2, T z2)