115 #include "CLHEP/Vector/LorentzVector.h"
137 #include "TProfile.h"
149 using namespace reco;
179 void findHOEtaPhi(
int iphsect,
int& ietaho,
int& iphiho);
182 virtual void endJob()
override ;
236 TH1F* ho_occupency[5];
304 if(m_startTS<0) m_startTS=0;
306 if (m_endTS < m_startTS) m_endTS = m_startTS + 3;
307 if (m_endTS >9) m_endTS=9;
313 tok_muons_ = consumes<reco::TrackCollection>(muonTags_);
322 produces<HOCalibVariableCollection>(
"HOCalibVariableCollection").setBranchAlias(
"HOCalibVariableCollection");
333 for (
int ij=0; ij<=
ntrgp_gm; ij++) {
334 sprintf(title,
"hotime_trgp_%i", ij+1);
336 sprintf(title,
"hopeak_trgp_%i", ij+1);
346 hst_hopedrms = fs->
make<TH1F>(
"hst_hopedrms",
"hst_hopedrms", 100, 0.0, 0.1);
347 for (
int ij=0; ij<=
ntrgp_gm; ij++) {
348 sprintf(title,
"Nhotime_trgp_%i", ij+1);
360 hst_hb1pedrms = fs->
make<TH1F>(
"hst_hb1pedrms",
"hst_hb1pedrms", 100, 0., 0.1);
363 for (
int i=0;
i<5;
i++) {
364 sprintf(title,
"ho_occupency (>%i #sigma)",
i+2);
380 allhotime->Divide(Nallhotime);
381 for (
int ij=0; ij<=
ntrgp_gm; ij++) {
382 hotime[ij]->Divide(Nhotime[ij]);
384 hopedtime->Divide(Nhopedtime);
385 libhoped->Scale(1./
max(1,nRuns));
386 libhoped1->Scale(1./
max(1,nRuns));
388 float xx = hopedpr->GetBinError(
i+1);
389 if (hopedpr->GetBinEntries(
i+1) >0) {
390 hopedrms->Fill(
i, xx);
391 hst_hopedrms->Fill(xx);
394 allhb1->Divide(Nallhb1);
395 allhb2->Divide(Nallhb2);
396 allhb3->Divide(Nallhb3);
398 float xx = hb1pedpr->GetBinError(
i+1);
399 if (hb1pedpr->GetBinEntries(
i+1) >0) {
400 hb1pedrms->Fill(
i, xx);
401 hst_hb1pedrms->Fill(xx);
405 for (
int i=0;
i<5;
i++) {
406 ho_occupency[
i]->Scale(1./
max(1,Noccu));
423 int irun = iEvent.
id().
run();
425 if (irunold !=irun) {
440 if (irunold !=irun) {
444 int tmpeta1 = (
i>0) ?
i -1 : -
i +14;
445 if (tmpeta1 <0 || tmpeta1 >
netamx)
continue;
449 calibped = conditions_->getHcalCalibrations(
id);
458 libhoped->Fill(nphimx*ncidmx*tmpeta1 + ncidmx*
j +
k,
pedestal[tmpeta1][
j][
k]);
461 libhoped1->Fill(nphimx*nchnmx*tmpeta1 + nchnmx*
j +
k,
pedestal[tmpeta1][
j][
min(
k,ncidmx-1)]);
487 if (m_hotime && m_digiInput) {
488 if ((*ho).size()>0) {
491 m_coder = (*conditions_).getHcalCoder(
id);
492 m_shape = (*conditions_).getHcalShape(m_coder);
493 int tmpeta=
id.
ieta();
494 int tmpphi=
id.iphi();
496 int tmpeta1 = (tmpeta>0) ? tmpeta -1 : -tmpeta +14;
497 for (
int i=0;
i<(*j).size() &&
i<
nchnmx;
i++) {
498 tmpdata[
i] = m_coder->charge(*m_shape,(*j).sample(
i).adc(),(*j).sample(
i).capid());
499 allhotime->Fill(
nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) +
i, tmpdata[
i]);
500 Nallhotime->Fill(
nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) + i, 1.);
504 if ((*hbhe).size()>0) {
507 m_coder = (*conditions_).getHcalCoder(
id);
508 m_shape = (*conditions_).getHcalShape(m_coder);
509 int tmpeta=
id.
ieta();
510 int tmpphi=
id.iphi();
511 int tmpdepth =
id.depth();
512 int tmpeta1 = (tmpeta>0) ? tmpeta -15 : -tmpeta + 1;
513 if (tmpdepth==1) tmpeta1 = (tmpeta>0) ? tmpeta -1 : -tmpeta +29;
514 for (
int i=0;
i<(*j).size() &&
i<
nchnmx;
i++) {
515 float signal = m_coder->charge(*m_shape,(*j).sample(
i).adc(),(*j).sample(
i).capid());
517 allhb1->Fill(
nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) +
i, signal);
518 Nallhb1->Fill(
nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) +
i, 1);
519 hb1pedpr->Fill(
nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) +
i, signal);}
521 allhb2->Fill(
nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) +
i, signal);
522 Nallhb2->Fill(
nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) +
i, 1);}
524 allhb3->Fill(
nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) +
i, signal);
525 Nallhb3->Fill(
nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) +
i, 1);}
531 double pival = acos(-1.);
536 if (cosmicmuon->size()>0) {
541 int ntrgpas_gm[
ntrgp_gm]={0,0,0,0,0,0,0,0,0,0};
582 int Noccu_old = Noccu;
584 for(reco::TrackCollection::const_iterator ncosm = cosmicmuon->begin();
585 ncosm != cosmicmuon->end(); ++ncosm) {
587 if ((*ncosm).ndof() < 15)
continue;
588 if ((*ncosm).normalizedChi2() >30.0)
continue;
592 tmpHOCalib.
trig1 = l1trg;
593 tmpHOCalib.
trig2 = hlttr;
595 int charge = ncosm->charge();
597 double innerr = (*ncosm).innerPosition().Perp2();
598 double outerr = (*ncosm).outerPosition().Perp2();
599 int iiner = (innerr <outerr) ? 1 : 0;
610 double posx, posy, posz;
611 double momx, momy, momz;
614 posx = (*ncosm).innerPosition().X();
615 posy = (*ncosm).innerPosition().Y();
616 posz = (*ncosm).innerPosition().Z();
618 momx = (*ncosm).innerMomentum().X();
619 momy = (*ncosm).innerMomentum().Y();
620 momz = (*ncosm).innerMomentum().Z();
623 posx = (*ncosm).outerPosition().X();
624 posy = (*ncosm).outerPosition().Y();
625 posz = (*ncosm).outerPosition().Z();
627 momx = (*ncosm).outerMomentum().X();
628 momy = (*ncosm).outerMomentum().Y();
629 momz = (*ncosm).outerMomentum().Z();
635 CLHEP::Hep3Vector tmpmuon3v(posx, posy, posz);
636 CLHEP::Hep3Vector tmpmuondir(momx, momy, momz);
638 bool samedir = (tmpmuon3v.dot(tmpmuondir) >0) ?
true :
false;
639 for (
int i=0;
i<3;
i++) {tmpHOCalib.
caloen[
i] = 0.0;}
641 for(reco::TrackCollection::const_iterator ncosmcor = cosmicmuon->begin();
642 ncosmcor != cosmicmuon->end(); ++ncosmcor) {
643 if (ncosmcor==ncosm)
continue;
645 CLHEP::Hep3Vector tmpmuon3vcor;
646 CLHEP::Hep3Vector tmpmom3v;
648 tmpmuon3vcor = CLHEP::Hep3Vector((*ncosmcor).innerPosition().X(),(*ncosmcor).innerPosition().Y(),(*ncosmcor).innerPosition().Z());
649 tmpmom3v = CLHEP::Hep3Vector((*ncosmcor).innerMomentum().X(),(*ncosmcor).innerMomentum().Y(),(*ncosmcor).innerMomentum().Z());
651 tmpmuon3vcor = CLHEP::Hep3Vector((*ncosmcor).outerPosition().X(),(*ncosmcor).outerPosition().Y(),(*ncosmcor).outerPosition().Z());
652 tmpmom3v = CLHEP::Hep3Vector((*ncosmcor).outerMomentum().X(),(*ncosmcor).outerMomentum().Y(),(*ncosmcor).outerMomentum().Z());
655 if (tmpmom3v.mag()<0.2 || (*ncosmcor).ndof()<5)
continue;
657 double angle = tmpmuon3v.angle(tmpmuon3vcor);
658 if (angle < 7.5*pival/180.) {inearbymuon=1;}
660 if (muonTags_.label() ==
"cosmicMuons") {
661 if (angle <7.5*pival/180.) { tmpHOCalib.
caloen[0] +=1.;}
662 if (angle <15.0*pival/180.) { tmpHOCalib.
caloen[1] +=1.;}
663 if (angle <35.0*pival/180.) { tmpHOCalib.
caloen[2] +=1.;}
667 localxhor0 = localyhor0 = 20000;
669 if (muonTags_.label() ==
"standAloneMuons") {
675 calt !=calotower->end(); calt++) {
677 double ith = (*calt).momentum().theta();
678 double iph = (*calt).momentum().phi();
680 CLHEP::Hep3Vector calo3v(
sin(ith)*
cos(iph),
sin(ith)*
sin(iph),
cos(ith));
682 double angle = tmpmuon3v.angle(calo3v);
684 if (angle < 7.5*pival/180.) {tmpHOCalib.
caloen[0] += calt->emEnergy()+calt->hadEnergy();}
685 if (angle < 15*pival/180.) {tmpHOCalib.
caloen[1] += calt->emEnergy()+calt->hadEnergy();}
686 if (angle < 35*pival/180.) {tmpHOCalib.
caloen[2] += calt->emEnergy()+calt->hadEnergy();}
691 if (tmpHOCalib.
caloen[0] >10.0)
continue;
695 double mom =
sqrt(momx*momx + momy*momy +momz*momz);
703 tmpHOCalib.
trkdr = (*ncosm).d0();
704 tmpHOCalib.
trkdz = (*ncosm).dz();
706 tmpHOCalib.
nmuon = cosmicmuon->size();
707 tmpHOCalib.
trkvx = glbpt.
x();
708 tmpHOCalib.
trkvy = glbpt.
y();
709 tmpHOCalib.
trkvz = glbpt.
z();
710 tmpHOCalib.
trkmm = mom*charge;
714 tmpHOCalib.
ndof = (inearbymuon ==0) ? (
int)(*ncosm).ndof() : -(int)(*ncosm).ndof();
715 tmpHOCalib.
chisq = (*ncosm).normalizedChi2();
716 tmpHOCalib.
therr = 0.;
717 tmpHOCalib.
pherr = 0.;
721 tmpHOCalib.
therr = innercov(1,1);
722 tmpHOCalib.
pherr = innercov(2,2);
725 tmpHOCalib.
therr = outercov(1,1);
726 tmpHOCalib.
pherr = outercov(2,2);
736 double phiho = trkpos.
phi();
737 if (phiho<0) phiho +=2*pival;
739 int iphisect_dt=int(6*(phiho+pival/18.)/pival);
740 if (iphisect_dt>=12) iphisect_dt=0;
745 for (
int kl = 0; kl<=2; kl++) {
747 int iphisecttmp = (kl<2) ? iphisect_dt + kl : iphisect_dt - 1;
748 if (iphisecttmp <0) iphisecttmp = 11;
749 if (iphisecttmp >=12) iphisecttmp = 0;
751 double phipos = iphisecttmp*pival/6.;
752 double phirot = phipos;
761 FreeTrajectoryState freetrajectorystate_ = getFreeTrajectoryState(*ncosm,&(*theMagField), iiner, samedir);
765 for (
int ik=1; ik>=0; ik--) {
767 double radial = 407.0;
768 if (ik==0) radial = 382.0;
773 auto aPlane2 =
new Plane(pos,rot);
778 if (steppingHelixstateinfo_.
isValid()) {
781 CLHEP::Hep3Vector hotrkdir2(steppingHelixstateinfo_.
momentum().
x(), steppingHelixstateinfo_.
momentum().
y(),steppingHelixstateinfo_.
momentum().
z());
785 double xx = lclvt0.
x();
786 double yy = lclvt0.y();
789 if ((
std::abs(yy) < 130 && xx >-64.7 && xx <138.2)
792 iphisect = iphisecttmp;
796 if (iphisect != iphisecttmp)
continue;
808 tmpHOCalib.
hoang = CLHEP::Hep3Vector(zLocal.
x(),zLocal.
y(),zLocal.
z()).
dot(hotrkdir2.unit());
823 for (
int i=0;
i<9;
i++) {tmpHOCalib.
hosig[
i]=-100.0;}
824 for (
int i=0;
i<18;
i++) {tmpHOCalib.
hocorsig[
i]=-100.0;}
825 for (
int i=0;
i<9;
i++) {tmpHOCalib.
hbhesig[
i]=-100.0;}
826 tmpHOCalib.
hocro = -100;
827 tmpHOCalib.
htime = -1000;
831 findHOEtaPhi(iphisect, ietaho, iphiho);
833 if (ietaho !=0 && iphiho !=0 &&
std::abs(iring)<=2) {
837 if (iphiho<0) isect -=2000000;
838 tmpHOCalib.
isect = isect;
840 tmpHOCalib.
hodx = localxhor1;
841 tmpHOCalib.
hody = localyhor1;
844 tmpHOCalib.
hocorsig[8] = localxhor0;
845 tmpHOCalib.
hocorsig[9] = localyhor0;
850 if (iring==1) {etamn=5; etamx = 10;}
851 if (iring==2) {etamn=11; etamx = 16;}
852 if (iring==-1){etamn=-10; etamx = -5;}
853 if (iring==-2){etamn=-16; etamx = -11;}
858 phimx =2*int((iphiho+1)/2.);
861 phimn = 3*int((iphiho+1)/3.) - 1;
865 if (phimn <1) phimn +=
nphimx;
866 if (phimx >72) phimx -=
nphimx;
868 int sigstr = m_startTS;
869 int sigend = m_endTS;
877 for (
int i=0;
i<9;
i++) {tmpHOCalib.
hbhesig[
i]=-100.0;}
880 if ((*hbhe).size() >0) {
885 m_coder = (*conditions_).getHcalCoder(
id);
886 m_shape = (*conditions_).getHcalShape(m_coder);
887 int tmpeta=
id.
ieta();
888 int tmpphi=
id.iphi();
889 calibped = conditions_->getHcalCalibrations(
id);
891 int deta = tmpeta-ietaho;
892 if (tmpeta==-1 && ietaho== 1) deta = -1;
893 if (tmpeta== 1 && ietaho==-1) deta = 1;
894 int dphi = tmpphi-iphiho;
896 if (dphi==71) dphi=-1;
897 if (dphi==-71) dphi=1;
902 if (ipass2 ==0 )
continue;
905 for (
int i=0;
i<(*j).size() &&
i<
nchnmx;
i++) {
906 tmpdata[
i] = m_coder->charge(*m_shape,(*j).sample(
i).adc(),(*j).sample(
i).capid());
910 for (
int i=1;
i<(*j).size() &&
i<=8;
i++) {
911 signal += tmpdata[
i] - calibped.pedestal((*j).sample(
i).capid());;
915 if (3*(deta+1)+dphi+1<9) tmpHOCalib.
hbhesig[3*(deta+1)+dphi+1] = signal;
926 if ((*hbheht).size()>0) {
927 if(!(*hbheht).size())
throw (
int)(*hbheht).size();
933 int tmpeta=
id.
ieta();
934 int tmpphi=
id.iphi();
936 int deta = tmpeta-ietaho;
937 if (tmpeta==-1 && ietaho== 1) deta = -1;
938 if (tmpeta== 1 && ietaho==-1) deta = 1;
939 int dphi = tmpphi-iphiho;
941 if (dphi==71) dphi=-1;
942 if (dphi==-71) dphi=1;
946 if ( ipass2 ==0 )
continue;
948 float signal = (*j).energy();
950 if (3*(deta+1)+dphi+1<9) tmpHOCalib.
hbhesig[3*(deta+1)+dphi+1] = signal;
959 if ((*ho).size()>0) {
971 m_coder = (*conditions_).getHcalCoder(
id);
972 m_shape = (*conditions_).getHcalShape(m_coder);
973 int tmpeta=
id.
ieta();
974 int tmpphi=
id.iphi();
977 if (tmpeta >=etamn && tmpeta <=etamx) {
979 ipass1 = (tmpphi >=phimn && tmpphi <=phimx ) ? 1 : 0;
981 ipass1 = (tmpphi==71 || tmpphi ==72 || tmpphi==1) ? 1 : 0;
985 int deta = tmpeta-ietaho;
986 if (tmpeta==-1 && ietaho== 1) deta = -1;
987 if (tmpeta== 1 && ietaho==-1) deta = 1;
989 int dphi = tmpphi -iphiho;
991 if (dphi==71) dphi=-1;
992 if (dphi==-71) dphi=1;
997 int tmpeta1 = (tmpeta>0) ? tmpeta -1 : -tmpeta +14;
999 float tmpdata[
nchnmx]={0,0,0,0,0,0,0,0,0,0};
1000 float sigvall[
nsigpk]={0,0,0,0,0,0,0};
1002 for (
int i=0;
i<(*j).size() &&
i<
nchnmx;
i++) {
1003 tmpdata[
i] = m_coder->charge(*m_shape,(*j).sample(
i).adc(),(*j).sample(
i).capid());
1004 if (deta==0 && dphi==0) {
1005 double tmpE = tmpdata[
i] -
pedestal[tmpeta1][tmpphi-1][(*j).sample(
i).capid()];
1013 for (
int ncap=0; ncap<
nsigpk; ncap++) {
1015 sigvall[ncap] +=tmpdata[
i];
1019 if (
i==(*j).size()-1) {
1022 for (
int ij=0; ij<
nsigpk; ij++) {
1023 if (sigvall[ij] > mxled) {mxled = sigvall[ij]; imxled=ij;}
1026 for (
int ij=0; ij<4; ij++) {
1027 pedx +=pedestal[tmpeta1][tmpphi-1][ij];
1029 if (mxled-pedx >2 && mxled-pedx <20 ) {
1030 hopeak[
ntrgp_gm]->Fill(nphimx*tmpeta1 + tmpphi-1, imxled+
nstrbn);
1031 for (
int jk=0; jk<
ntrgp_gm; jk++) {
1032 if (ntrgpas_gm[jk]>0) {
1033 hopeak[jk]->Fill(nphimx*tmpeta1 + tmpphi-1, imxled+
nstrbn);
1036 if (tmpdata[5]+tmpdata[6] >1) {
1037 horatio->Fill(nphimx*tmpeta1 + tmpphi-1, (tmpdata[5]-tmpdata[6])/(tmpdata[5]+tmpdata[6]));
1039 for (
int ij=0; ij<(*j).size() && ij<
nchnmx; ij++) {
1040 hotime[
ntrgp_gm]->Fill(nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) + ij, tmpdata[ij]);
1041 Nhotime[
ntrgp_gm]->Fill(nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) + ij, 1.);
1042 for (
int jk=0; jk<
ntrgp_gm; jk++) {
1043 if (ntrgpas_gm[jk]>0) {
1044 hotime[jk]->Fill(nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) + ij, tmpdata[ij]);
1045 Nhotime[jk]->Fill(nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) + ij, 1.);
1055 if (
std::abs(tmpeta) <=15 && deta==0 && dphi ==0) {
1058 for (
int i =0;
i<nchnmx &&
i< (*j).size();
i++) {
1059 if (
i >=sigstr &&
i<=sigend)
continue;
1060 signal += tmpdata[
i] -
pedestal[tmpeta1][tmpphi-1][(*j).sample(
i).capid()];
1061 if (++icnt >=4)
break;
1063 tmpHOCalib.
hocro = signal;
1067 if (ipass1 ==0 && ipass2 ==0 && cosmicmuon->size()<=2) {
1069 if ((iphiho >=1 && iphiho<=nphimx/2 && tmpphi >=1 && tmpphi <=nphimx/2) ||
1070 (iphiho >nphimx/2 && iphiho<=nphimx && tmpphi >nphimx/2 && tmpphi <=
nphimx)) {
1071 if (isFilled[nphimx*tmpeta1+tmpphi-1]==0) {
1072 isFilled[nphimx*tmpeta1+tmpphi-1]=1;
1073 for (
int i=0;
i<(*j).size() &&
i<
nchnmx;
i++) {
1074 hopedtime->Fill(nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) +
i, tmpdata[
i]);
1075 Nhopedtime->Fill(nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) + i, 1.);
1076 hopedpr->Fill(nphimx*nchnmx*tmpeta1 + nchnmx*(tmpphi-1) + i, tmpdata[i]);
1084 if (ipass1 ==0 && ipass2 ==0 )
continue;
1087 for (
int i=sigstr;
i<(*j).size() &&
i<=sigend;
i++) {
1088 signal += tmpdata[
i] -
pedestal[tmpeta1][tmpphi-1][(*j).sample(
i).capid()];
1090 if (signal <-100 || signal >100000) signal = -100;
1092 if (signal >-100 && Noccu == Noccu_old) {
1093 for (
int i=0;
i<5;
i++) {
1094 if (signal >(
i+2)*m_sigma) {
1095 ho_occupency[
i]->Fill(nphimx*tmpeta1+tmpphi-1);
1101 if (ipass1 ==0 && ipass2 ==0 )
continue;
1104 int tmpdph = tmpphi-phimn;
1105 if (tmpdph<0) tmpdph = 2;
1107 int ilog = 2*(tmpeta-etamn)+tmpdph;
1110 ilog = 3*(tmpeta-etamn)+tmpdph;
1112 ilog = 3*(etamx-tmpeta)+tmpdph;
1115 if (ilog>-1 && ilog<18) {
1116 tmpHOCalib.
hocorsig[ilog] = signal;
1121 if (3*(deta+1)+dphi+1<9) tmpHOCalib.
hosig[3*(deta+1)+dphi+1] = signal;
1155 tmpHOCalib.
htime = sumEt/
max(sumE,1.
e-6);
1162 if ((*hoht).size()>0) {
1167 int tmpeta=
id.
ieta();
1168 int tmpphi=
id.iphi();
1171 if (tmpeta >=etamn && tmpeta <=etamx) {
1172 if (phimn < phimx) {
1173 ipass1 = (tmpphi >=phimn && tmpphi <=phimx ) ? 1 : 0;
1175 ipass1 = (tmpphi==71 || tmpphi ==72 || tmpphi==1) ? 1 : 0;
1179 int deta = tmpeta-ietaho;
1180 if (tmpeta==-1 && ietaho== 1) deta = -1;
1181 if (tmpeta== 1 && ietaho==-1) deta = 1;
1183 int dphi = tmpphi -iphiho;
1185 if (dphi==71) dphi=-1;
1186 if (dphi==-71) dphi=1;
1189 float signal = (*j).energy();
1191 int tmpeta1 = (tmpeta>0) ? tmpeta -1 : -tmpeta +14;
1192 if (signal >-100 && Noccu == Noccu_old) {
1193 for (
int i=0;
i<5;
i++) {
1194 if (signal >(
i+2)*m_sigma) {
1195 ho_occupency[
i]->Fill(
nphimx*tmpeta1+tmpphi-1);
1203 if (ipass1 ==0 && ipass2 ==0 )
continue;
1206 int tmpdph = tmpphi-phimn;
1207 if (tmpdph<0) tmpdph = 2;
1209 int ilog = 2*(tmpeta-etamn)+tmpdph;
1212 ilog = 3*(tmpeta-etamn)+tmpdph;
1214 ilog = 3*(etamx-tmpeta)+tmpdph;
1217 if (ilog>-1 && ilog<18) {
1218 tmpHOCalib.
hocorsig[ilog] = signal;
1224 if (3*(deta+1)+dphi+1<9) {
1225 tmpHOCalib.
hosig[3*(deta+1)+dphi+1] = signal;
1229 if (deta==0 && dphi ==0) {
1230 tmpHOCalib.
htime = (*j).time();
1231 int crphi = tmpphi + 6;
1232 if (crphi >72) crphi -=72;
1237 int etacr= idcr.
ieta();
1238 int phicr= idcr.
iphi();
1239 if (tmpeta==etacr && crphi ==phicr) {
1251 if (Noccu == Noccu_old) Noccu++;
1252 hostore->push_back(tmpHOCalib);
1260 iEvent.
put(hostore,
"HOCalibVariableCollection");
1302 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};
1303 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};
1305 double philow[6]={-76.27, -35.11, 0.35, 35.81, 71.77, 108.93};
1306 double phihgh[6]={-35.81, -0.35, 35.11, 71.07, 108.23, 140.49};
1308 double philow00[6]={-60.27, -32.91, 0.35, 33.61, 67.37, 102.23};
1309 double phihgh00[6]={-33.61, -0.35, 32.91, 66.67, 101.53, 129.49};
1311 double philow01[6]={-64.67, -34.91, 0.35, 35.61, 71.37, 108.33};
1312 double phihgh01[6]={-35.61, -0.35, 34.91, 70.67, 107.63, 138.19};
1319 if (tmpdy >etalow[
i] && tmpdy <etahgh[
i]) {
1321 float tmp1 = fabs(tmpdy-etalow[i]);
1322 float tmp2 = fabs(tmpdy-etahgh[i]);
1324 localyhor1 = (tmp1 < tmp2) ? -tmp1 : tmp2;
1327 if (i>=4 && i<10) iring=1;
1328 if (i>=10 && i<netabin) iring=2;
1337 for (
int i=0;
i<6;
i++) {
1338 if (xhor1 >philow[
i] && xhor1 <phihgh[
i]) {
1340 float tmp1 = fabs(xhor1-philow[i]);
1341 float tmp2 = fabs(xhor1-phihgh[i]);
1342 localxhor1 = (tmp1 < tmp2) ? -tmp1 : tmp2;
1347 for (
int i=0;
i<6;
i++) {
1348 if (xhor1 >philow01[
i] && xhor1 <phihgh01[
i]) {
1350 float tmp1 = fabs(xhor1-philow01[i]);
1351 float tmp2 = fabs(xhor1-phihgh01[i]);
1352 localxhor1 = (tmp1 < tmp2) ? -tmp1 : tmp2;
1357 for (
int i=0;
i<6;
i++) {
1358 if (xhor0 >philow00[
i] && xhor0 <phihgh00[
i]) {
1360 float tmp1 = fabs(xhor0-philow00[i]);
1361 float tmp2 = fabs(xhor0-phihgh00[i]);
1362 localxhor0 = (tmp1 < tmp2) ? -tmp1 : tmp2;
1363 if (tmpphi !=tmpphi0) localxhor0 +=10000.;
1369 for (
int i=0;
i<4;
i++) {
1370 if (tmpdy >etalow[
i] && tmpdy <etahgh[
i]) {
1371 float tmp1 = fabs(tmpdy-etalow[i]);
1372 float tmp2 = fabs(tmpdy-etahgh[i]);
1373 localyhor0 = (tmp1 < tmp2) ? -tmp1 : tmp2;
1374 if (i+1 != ietaho) localyhor0 +=10000.;
1381 iphiho = 6*iphisect -2 + tmpphi;
1382 if (iphiho <=0) iphiho +=
nphimx;
1405 if (dir) gmom *=-1.;
1412 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
edm::EDGetTokenT< edm::TriggerResults > tok_hlt_
const math::XYZPoint & innerPosition() const
position of the innermost hit
const HcalQIECoder * m_coder
void applyRadX0Correction(bool applyRadX0Correction)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
GlobalPoint position() const
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)
void propagate(const SteppingHelixStateInfo &ftsStart, const Surface &sDest, SteppingHelixStateInfo &out) const
Propagate to Plane given a starting point.
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
void setMaterialMode(bool noMaterial)
Switch for material effects mode: no material effects if true.
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)