62 static const float adc2fC[128]={-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5, 10.5,11.5,12.5,
63 13.5,15.,17.,19.,21.,23.,25.,27.,29.5,32.5,35.5,38.5,42.,46.,50.,54.5,59.5,
64 64.5,59.5,64.5,69.5,74.5,79.5,84.5,89.5,94.5,99.5,104.5,109.5,114.5,119.5,
65 124.5,129.5,137.,147.,157.,167.,177.,187.,197.,209.5,224.5,239.5,254.5,272.,
66 292.,312.,334.5,359.5,384.5,359.5,384.5,409.5,434.5,459.5,484.5,509.5,534.5,
67 559.5,584.5,609.5,634.5,659.5,684.5,709.5,747.,797.,847.,897.,947.,997.,
68 1047.,1109.5,1184.5,1259.5,1334.5,1422.,1522.,1622.,1734.5,1859.5,1984.5,
69 1859.5,1984.5,2109.5,2234.5,2359.5,2484.5,2609.5,2734.5,2859.5,2984.5,
70 3109.5,3234.5,3359.5,3484.5,3609.5,3797.,4047.,4297.,4547.,4797.,5047.,
71 5297.,5609.5,5984.5,6359.5,6734.5,7172.,7672.,8172.,8734.5,9359.5,9984.5};
79 static const Raddam_ch RADDAM_CH[56]={{-30,35,1},{-30,71,1},{-32,15,1},{-32,51,1},{-34,35,1},{-34,71,1},{-36,15,1},
80 {-36,51,1},{-38,35,1},{-38,71,1},{-40,15,1},{-40,51,1},{-41,35,1},{-41,71,1},
81 {30,21,1}, {30,57,1}, {32,1,1}, {32,37,1}, {34,21,1}, {34,57,1}, {36,1,1 },
82 {36,37,1}, {38,21,1}, {38,57,1}, {40,35,1}, {40,71,1}, {41,19,1}, {41,55,1 },
83 {-30,15,2},{-30,51,2},{-32,35,2},{-32,71,2},{-34,15,2},{-34,51,2},{-36,35,2},
84 {-36,71,2},{-38,15,2},{-38,51,2},{-40,35,2},{-40,71,2},{-41,15,2},{-41,51,2},
85 {30,1,2}, {30,37,2}, {32,21,2}, {32,57,2}, {34,1,2}, {34,37,2}, {36,21,2 },
86 {36,57,2}, {38,1,2}, {38,37,2}, {40,19,2}, {40,55,2}, {41,35,2}, {41,71,2}};
210 int MaxI=0;
double Energy,MaxE=0;
211 for(
int j=0;
j<
n;++
j)
if(MaxE<data[
j]){ MaxE=data[
j]; MaxI=
j; }
213 if(MaxI>0) Energy+=data[MaxI-1];
214 if(MaxI>1) Energy+=data[MaxI-2];
215 if(MaxI<(n-1)) Energy+=data[MaxI+1];
216 if(MaxI<(n-2)) Energy+=data[MaxI+2];
220 int MaxI=-100;
double Time=-9999,SumT=0,MaxT=-10;
221 for(
int j=0;
j<
n;++
j)
if(MaxT<data[
j]){ MaxT=data[
j]; MaxI=
j; }
224 Time=MaxI*data[MaxI];
226 if(MaxI>0){ Time+=(MaxI-1)*data[MaxI-1]; SumT+=data[MaxI-1]; }
227 if(MaxI<(n-1)){ Time+=(MaxI+1)*data[MaxI+1]; SumT+=data[MaxI+1]; }
259 if(sd.compare(
"HB")==0) SD=1;
260 if(sd.compare(
"HE")==0) SD=2;
261 if(sd.compare(
"HO")==0) SD=3;
262 if(sd.compare(
"HF")==0) SD=4;
264 if(eta>0)
ETA=1;
else ETA=-1;
265 if(phi==71 ||phi==72 || phi==1 || phi==2)
PHI=71;
else PHI=((phi-3)/4)*4+3;
269 if(phi==71 ||phi==72 || phi==1 || phi==2 || phi==3 || phi==4)
PHI=71;
else PHI=((phi-5)/6)*6+5;
274 if(phi==71 ||phi==72 || (phi>=1 && phi<=10))
PHI=71;
else PHI=((phi-11)/12)*12+11;
277 if(eta>0)
ETA=1;
else ETA=-1;
278 if(phi>=1 && phi<=18)
PHI=1;
279 if(phi>=19 && phi<=36)
PHI=19;
280 if(phi>=37 && phi<=54)
PHI=37;
281 if(phi>=55 && phi<=72)
PHI=55;
307 bool get_ave_subdet(
int sd,
float *ave_t,
float *ave_e,
float *ave_t_r,
float *ave_e_r);
406 if (prefixME_.size()>0 && prefixME_.substr(prefixME_.size()-1,prefixME_.size())!=
"/")
407 prefixME_.append(
"/");
443 for (std::vector<DetId>::const_iterator
i = mydetids.begin();
i!=mydetids.end();++
i){
454 emap=conditions_->getHcalMapping();
491 name=
"HBHE Laser Energy Distribution";
hbheEnergy = ib.
book1D(name,name,200,0,3000);
492 name=
"HBHE Laser Timing Distribution";
hbheTime = ib.
book1D(name,name,200,0,10);
493 name=
"HBHE Laser Energy RMS_div_Energy Distribution";
hbheEnergyRMS = ib.
book1D(name,name,200,0,0.5);
494 name=
"HBHE Laser Timing RMS Distribution";
hbheTimeRMS = ib.
book1D(name,name,200,0,1);
495 name=
"HO Laser Energy Distribution";
hoEnergy = ib.
book1D(name,name,200,0,3000);
496 name=
"HO Laser Timing Distribution";
hoTime = ib.
book1D(name,name,200,0,10);
497 name=
"HO Laser Energy RMS_div_Energy Distribution";
hoEnergyRMS = ib.
book1D(name,name,200,0,0.5);
498 name=
"HO Laser Timing RMS Distribution";
hoTimeRMS = ib.
book1D(name,name,200,0,1);
499 name=
"HF Laser Energy Distribution";
hfEnergy = ib.
book1D(name,name,200,0,3000);
500 name=
"HF Laser Timing Distribution";
hfTime = ib.
book1D(name,name,200,0,10);
501 name=
"HF Laser Energy RMS_div_Energy Distribution";
hfEnergyRMS = ib.
book1D(name,name,200,0,0.7);
502 name=
"HF Laser Timing RMS Distribution";
hfTimeRMS = ib.
book1D(name,name,200,0,1);
505 name=
"Laser Timing HO";
Time2Dho = ib.
book2D(name,name,33,-16,16,74,0,73);
507 name=
"Laser Energy HO";
Energy2Dho = ib.
book2D(name,name,33,-16,16,74,0,73);
509 name=
"HO Laser (Timing-Ref)+1";
refTime2Dho = ib.
book2D(name,name,33,-16,16,74,0,73);
516 name=
"HF RoBox average Time-Ref";
hf_time_rbx = ib.
book1D(name,name,24,0.5,24.5);
557 for(
int i=0;
i<56;
i++){
558 sprintf(str,
"RADDAM (%i %i)",RADDAM_CH[
i].
eta,RADDAM_CH[
i].
phi);
585 static bool HBHEseq,HOseq,HFseq;
586 static int lastHBHEorbit,lastHOorbit,lastHForbit,nChecksHBHE,nChecksHO,nChecksHF,ievt_hbhe,ievt_ho,ievt_hf;
588 ievt_=0;HBHEseq=HOseq=HFseq=
false; lastHBHEorbit=lastHOorbit=lastHForbit=-1;nChecksHBHE=nChecksHO=nChecksHF=0;
589 ievt_hbhe=0,ievt_ho=0,ievt_hf=0;
592 bool LaserEvent=
false;
593 bool LaserRaddam=
false;
600 if(trigger_data->wasLaserTrigger()) LaserEvent=
true;
604 if(HBHEseq && (orbit-lastHBHEorbit)>(11223*10) && ievt_hbhe>40){
614 if(HOseq && (orbit-lastHOorbit)>(11223*10) && ievt_ho>40){
622 if(HFseq && (orbit-lastHForbit)>(11223*10) && ievt_hf>40){
628 if(nChecksHF==1 || (nChecksHF>1 && ((nChecksHF-1)%12)==0)){
636 if(
LocalRun==
false || LaserEvent==
false){
644 if ( fedData.
size() < 24 )
continue ;
646 if(value==
hc_HBHEHPD){ HBHEseq=
true; HOseq=HFseq=
false; lastHBHEorbit=orbit; ievt_hbhe++; }
647 if(value==
hc_HOHPD){ HOseq=
true; HBHEseq=HFseq=
false; lastHOorbit=orbit; ievt_ho++; }
648 if(value==
hc_HFPMT){ HFseq=
true; HBHEseq=HOseq=
false; lastHForbit=orbit; ievt_hf++; }
651 if(value==
hc_RADDAM){ LaserEvent=
true; LaserRaddam=
true;
break;}
654 if(!LaserEvent)
return;
668 eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth();
670 for(
int i=0;
i<digi->size();
i++) e+=
adc2fC[digi->sample(
i).adc()&0xff]-2.5;
679 eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
681 for(N=0;N<56;N++)
if(eta==RADDAM_CH[N].eta && phi==RADDAM_CH[N].phi && depth==RADDAM_CH[N].depth)
break;
685 for(
int i=0;
i<nTS;
i++){
686 if(max1<
adc2fC[digi->sample(
i).adc()&0xff]){ nmax1=
i; max1=
adc2fC[digi->sample(
i).adc()&0xff]; }
689 for(
int i=0;
i<nTS;
i++){
690 if(
i==nmax1)
continue;
691 if(max2<
adc2fC[digi->sample(
i).adc()&0xff]){ nmax2=
i; max2=
adc2fC[digi->sample(
i).adc()&0xff]; }
695 nmax2=nmax1;nmax1=tmp1;
697 if(nmax1==0 || nmax2==(nTS-1))
continue;
698 if(nmax2!=(nmax1+1))
continue;
702 max1-=2.5; max2-=2.5;
704 float S4=S2+
adc2fC[digi->sample(nmax1-1).adc()&0xff]+
adc2fC[digi->sample(nmax2+1).adc()&0xff]-5.0;
707 Raddam_data[
N].
s1_adc[digi->sample(nmax1).adc()&0xff]++;
708 Raddam_data[
N].
s2_adc[digi->sample(nmax2).adc()&0xff]++;
719 eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
720 double ped=(
adc2fC[digi->sample(0).adc()&0xff]+
adc2fC[digi->sample(1).adc()&0xff])/2.0;
722 for(
int i=0;
i<nTS;
i++) data[
i]=
adc2fC[digi->sample(
i).adc()&0xff]-ped;
726 for(
int i=0;
i<nTS;
i++) data[
i]=
adc2fC[digi->sample(
i).adc()&0xff]-ped;
733 eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
734 double ped=(
adc2fC[digi->sample(0).adc()&0xff]+
adc2fC[digi->sample(1).adc()&0xff])/2.0;
735 if((eta>=11 && eta<=15 && phi>=59 && phi<=70) || (eta>=5 && eta<=10 && phi>=47 && phi<=58)){
736 for(
int i=0;
i<nTS;
i++) data[
i]=
adc2fC[digi->sample(
i).adc()&0xff]-ped;
738 for(
int i=0;
i<nTS;
i++) data[
i]=
adc2fC[digi->sample(
i).adc()&0xff]-ped;
745 eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
746 double ped=
adc2fC[digi->sample(0).adc()&0xff];
747 for(
int i=0;
i<nTS;
i++) data[
i]=
adc2fC[digi->sample(
i).adc()&0xff]-ped;
752 if(digi->id().cboxChannel()!=0 || digi->id().hcalSubdet()==0)
continue;
755 for(
int i=0;
i<nTS;
i++){ data[
i]=
adc2fC[digi->sample(
i).adc()&0xff]; e+=data[
i];}
761 eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
763 for(N=0;N<56;N++)
if(eta==RADDAM_CH[N].eta && phi==RADDAM_CH[N].phi && depth==RADDAM_CH[N].depth)
break;
772 double T=0,nT=0,E=0,nE=0,Tr=0,nTr=0,Er=0,nEr=0;
774 for(
int depth=1;depth<=2;depth++){
776 double ave=0,
rms=0,
time=0,time_rms=0;
779 T+=
time; nT++; E+=ave; nE++;
781 Tr+=
time; nTr++; Er+=ave; nEr++;}
787 for(
int depth=1;depth<=3;depth++){
789 double ave=0;
double rms=0;
double time=0;
double time_rms=0;
792 T+=
time; nT++; E+=ave; nE++;
793 if(
he_data[
eta+42][
phi-1][depth-1].get_reference(&ave,&rms,&time,&time_rms)){
794 Tr+=
time; nTr++; Er+=ave; nEr++;}
800 for(
int depth=1;depth<=2;depth++){
802 double ave=0;
double rms=0;
double time=0;
double time_rms=0;
805 T+=
time; nT++; E+=ave; nE++;
806 if(
hf_data[
eta+42][
phi-1][depth-1].get_reference(&ave,&rms,&time,&time_rms)){
807 Tr+=
time; nTr++; Er+=ave; nEr++;}
813 for(
int depth=4;depth<=4;depth++){
815 double ave=0;
double rms=0;
double time=0;
double time_rms=0;
818 T+=
time; nT++; E+=ave; nE++;
819 if(
ho_data[
eta+42][
phi-1][depth-1].get_reference(&ave,&rms,&time,&time_rms)){
820 Tr+=
time; nTr++; Er+=ave; nEr++;}
824 if(nT<200 || nE<200 || nTr<200 || nEr<200)
return false;
833 float ave_t,ave_e,ave_t_r,ave_e_r;
836 for(
int i=0;
i<4;
i++){
842 for (std::vector <HcalElectronicsId>::iterator eid = AllElIds.begin(); eid != AllElIds.end(); eid++){
846 if(!(!(gid.null()) &&
860 double val=0,
rms=0,
time=0,time_rms=0,VAL=0,
RMS=0,TIME=0,TIME_RMS=0;
861 if(!
hb_data[eta+42][
phi-1][depth-1].get_reference(&val,&
rms,&
time,&time_rms))
continue;
862 if(!
hb_data[eta+42][
phi-1][depth-1].get_average_amp(&VAL,&
RMS))
continue;
863 if(!
hb_data[eta+42][
phi-1][depth-1].get_average_time(&TIME,&TIME_RMS))
continue;
865 float diff_t=(TIME-ave_t)-(
time-ave_t_r);
if(diff_t<0) diff_t=-diff_t;
870 if(VAL!=0 && val!=0 && ave_e!=0 && ave_e_r!=0){
871 float diff_e=((VAL/ave_e))/(val/ave_e_r);
879 double val=0,
rms=0,
time=0,time_rms=0,VAL=0,
RMS=0,TIME=0,TIME_RMS=0;
880 if(!
he_data[eta+42][
phi-1][depth-1].get_reference(&val,&
rms,&
time,&time_rms))
continue;
881 if(!
he_data[eta+42][
phi-1][depth-1].get_average_amp(&VAL,&
RMS))
continue;
882 if(!
he_data[eta+42][
phi-1][depth-1].get_average_time(&TIME,&TIME_RMS))
continue;
884 float diff_t=(TIME-ave_t)-(
time-ave_t_r);
if(diff_t<0) diff_t=-diff_t;
889 if(VAL!=0 && val!=0 && ave_e!=0 && ave_e_r!=0){
890 float diff_e=((VAL/ave_e))/(val/ave_e_r);
898 double val=0,
rms=0,
time=0,time_rms=0,VAL=0,
RMS=0,TIME=0,TIME_RMS=0;
899 if(!
ho_data[eta+42][
phi-1][depth-1].get_reference(&val,&
rms,&
time,&time_rms))
continue;
900 if(!
ho_data[eta+42][
phi-1][depth-1].get_average_amp(&VAL,&
RMS))
continue;
901 if(!
ho_data[eta+42][
phi-1][depth-1].get_average_time(&TIME,&TIME_RMS))
continue;
903 float diff_t=(TIME-ave_t)-(
time-ave_t_r);
if(diff_t<0) diff_t=-diff_t;
908 if(VAL!=0 && val!=0 && ave_e!=0 && ave_e_r!=0){
909 float diff_e=((VAL/ave_e))/(val/ave_e_r);
917 double val=0,
rms=0,
time=0,time_rms=0,VAL=0,
RMS=0,TIME=0,TIME_RMS=0;
918 if(!
hf_data[eta+42][
phi-1][depth-1].get_reference(&val,&
rms,&
time,&time_rms))
continue;
919 if(!
hf_data[eta+42][
phi-1][depth-1].get_average_amp(&VAL,&
RMS))
continue;
920 if(!
hf_data[eta+42][
phi-1][depth-1].get_average_time(&TIME,&TIME_RMS))
continue;
922 float diff_t=(TIME-ave_t)-(
time-ave_t_r);
if(diff_t<0) diff_t=-diff_t;
927 if(VAL!=0 && val!=0 && ave_e!=0 && ave_e_r!=0){
928 float diff_e=((VAL/ave_e))/(val/ave_e_r);
936 for (std::vector <HcalElectronicsId>::iterator eid = AllElIds.begin(); eid != AllElIds.end(); eid++){
940 if(!(!(gid.null()) &&
952 if(
hb_data[eta+42][
phi-1][depth-1].nBadTime>0){
957 if(
hb_data[eta+42][
phi-1][depth-1].nBadEnergy>0){
964 if(
he_data[eta+42][
phi-1][depth-1].nBadTime>0){
969 if(
he_data[eta+42][
phi-1][depth-1].nBadEnergy>0){
976 if(
ho_data[eta+42][
phi-1][depth-1].nBadTime>0){
981 if(
ho_data[eta+42][
phi-1][depth-1].nBadEnergy>0){
988 if(
hf_data[eta+42][
phi-1][depth-1].nBadTime>0){
993 if(
hf_data[eta+42][
phi-1][depth-1].nBadEnergy>0){
1004 int eta_min=0,eta_max=0,
n=0;
1006 if(side>0){eta_min=1; eta_max=29;}
1007 if(side<0){eta_min=-29; eta_max=-1;}
1009 for(
int i=eta_min;
i<=eta_max;
i++)
for(
int j=71;
j<=72;
j++)
for(
int k=1;
k<=3;
k++){
1011 double TIME,TIME_RMS;
1012 if(!
hb_data[
i+42][
j-1][
k-1].get_reference(&val,&rms,&time,&time_rms))
continue;
1013 if(!
hb_data[
i+42][
j-1][
k-1].get_average_time(&TIME,&TIME_RMS))
continue;
1014 xt+=TIME-
time; xxt+=(TIME-
time)*(TIME-time);
n++;
1016 for(
int i=eta_min;
i<=eta_max;
i++)
for(
int j=1;
j<=2;
j++)
for(
int k=1;
k<=3;
k++){
1018 double TIME,TIME_RMS;
1019 if(!
hb_data[
i+42][
j-1][
k-1].get_reference(&val,&rms,&time,&time_rms))
continue;
1020 if(!
hb_data[
i+42][
j-1][
k-1].get_average_time(&TIME,&TIME_RMS))
continue;
1021 xt+=TIME-
time; xxt+=(TIME-
time)*(TIME-time);
n++;
1025 for(
int i=eta_min;
i<=eta_max;
i++)
for(
int j=((rbx-1)*4-1);
j<=((rbx-1)*4+2);
j++)
for(
int k=1;
k<=3;
k++){
1027 double TIME,TIME_RMS;
1028 if(!
hb_data[
i+42][
j-1][
k-1].get_reference(&val,&rms,&time,&time_rms))
continue;
1029 if(!
hb_data[
i+42][
j-1][
k-1].get_average_time(&TIME,&TIME_RMS))
continue;
1030 xt+=TIME-
time; xxt+=(TIME-
time)*(TIME-time);
n++;
1035 if(side>0){eta_min=1; eta_max=29;}
1036 if(side<0){eta_min=-29; eta_max=-1;}
1038 for(
int i=eta_min;
i<=eta_max;
i++)
for(
int j=71;
j<=72;
j++)
for(
int k=1;
k<=3;
k++){
1040 double TIME,TIME_RMS;
1041 if(!
he_data[
i+42][
j-1][
k-1].get_reference(&val,&rms,&time,&time_rms))
continue;
1042 if(!
he_data[
i+42][
j-1][
k-1].get_average_time(&TIME,&TIME_RMS))
continue;
1043 xt+=TIME-
time; xxt+=(TIME-
time)*(TIME-time);
n++;
1045 for(
int i=eta_min;
i<=eta_max;
i++)
for(
int j=1;
j<=2;
j++)
for(
int k=1;
k<=3;
k++){
1047 double TIME,TIME_RMS;
1048 if(!
he_data[
i+42][
j-1][
k-1].get_reference(&val,&rms,&time,&time_rms))
continue;
1049 if(!
he_data[
i+42][
j-1][
k-1].get_average_time(&TIME,&TIME_RMS))
continue;
1050 xt+=TIME-
time; xxt+=(TIME-
time)*(TIME-time);
n++;
1054 for(
int i=eta_min;
i<=eta_max;
i++)
for(
int j=((rbx-1)*4-1);
j<=((rbx-1)*4+2);
j++)
for(
int k=1;
k<=3;
k++){
1056 double TIME,TIME_RMS;
1057 if(!
he_data[
i+42][
j-1][
k-1].get_reference(&val,&rms,&time,&time_rms))
continue;
1058 if(!
he_data[
i+42][
j-1][
k-1].get_average_time(&TIME,&TIME_RMS))
continue;
1059 xt+=TIME-
time; xxt+=(TIME-
time)*(TIME-time);
n++;
1064 if(side>0){eta_min=29; eta_max=40;}
1065 if(side<0){eta_min=-40; eta_max=-29;}
1066 for(
int i=eta_min;
i<=eta_max;
i++)
for(
int j=((rbx-1)*6+1);
j<=((rbx-1)*6+6);
j++)
for(
int k=1;
k<=2;
k++){
1068 double TIME,TIME_RMS;
1069 if(!
hf_data[
i+42][
j-1][
k-1].get_reference(&val,&rms,&time,&time_rms))
continue;
1070 if(!
hf_data[
i+42][
j-1][
k-1].get_average_time(&TIME,&TIME_RMS))
continue;
1071 xt+=TIME-
time; xxt+=(TIME-
time)*(TIME-time);
n++;
1076 eta_min=-4,eta_max=4;
1078 for(
int i=eta_min;
i<=eta_max;
i++)
for(
int j=71;
j<=72;
j++){
1080 double TIME,TIME_RMS;
1081 if(!
ho_data[
i+42][
j-1][4-1].get_reference(&val,&rms,&time,&time_rms))
continue;
1082 if(!
ho_data[
i+42][
j-1][4-1].get_average_time(&TIME,&TIME_RMS))
continue;
1083 xt+=TIME-
time; xxt+=(TIME-
time)*(TIME-time);
n++;
1085 for(
int i=eta_min;
i<=eta_max;
i++)
for(
int j=1;
j<=4;
j++){
1087 double TIME,TIME_RMS;
1088 if(!
ho_data[
i+42][
j-1][4-1].get_reference(&val,&rms,&time,&time_rms))
continue;
1089 if(!
ho_data[
i+42][
j-1][4-1].get_average_time(&TIME,&TIME_RMS))
continue;
1090 xt+=TIME-
time; xxt+=(TIME-
time)*(TIME-time);
n++;
1094 for(
int i=eta_min;
i<=eta_max;
i++)
for(
int j=((rbx-1)*6-1);
j<=((rbx-1)*6+4);
j++){
1096 double TIME,TIME_RMS;
1097 if(!
ho_data[
i+42][
j-1][4-1].get_reference(&val,&rms,&time,&time_rms))
continue;
1098 if(!
ho_data[
i+42][
j-1][4-1].get_average_time(&TIME,&TIME_RMS))
continue;
1099 xt+=TIME-
time; xxt+=(TIME-
time)*(TIME-time);
n++;
1103 if(side==-1){ eta_min=-10,eta_max=-5;}
1104 if(side==-2){ eta_min=-15,eta_max=-11;}
1105 if(side==1) { eta_min=5, eta_max=10;}
1106 if(side==2) { eta_min=11, eta_max=15;}
1109 for(
int i=eta_min;
i<=eta_max;
i++)
for(
int j=71;
j<=72;
j++){
1111 double TIME,TIME_RMS;
1112 if(!
ho_data[
i+42][
j-1][4-1].get_reference(&val,&rms,&time,&time_rms))
continue;
1113 if(!
ho_data[
i+42][
j-1][4-1].get_average_time(&TIME,&TIME_RMS))
continue;
1114 xt+=TIME-
time; xxt+=(TIME-
time)*(TIME-time);
n++;
1116 for(
int i=eta_min;
i<=eta_max;
i++)
for(
int j=1;
j<=10;
j++){
1118 double TIME,TIME_RMS;
1119 if(!
ho_data[
i+42][
j-1][4-1].get_reference(&val,&rms,&time,&time_rms))
continue;
1120 if(!
ho_data[
i+42][
j-1][4-1].get_average_time(&TIME,&TIME_RMS))
continue;
1121 xt+=TIME-
time; xxt+=(TIME-
time)*(TIME-time);
n++;
1125 for(
int i=eta_min;
i<=eta_max;
i++)
for(
int j=((rbx-1)*12-1);
j<=((rbx-1)*12+10);
j++){
1127 double TIME,TIME_RMS;
1128 if(!
ho_data[
i+42][
j-1][4-1].get_reference(&val,&rms,&time,&time_rms))
continue;
1129 if(!
ho_data[
i+42][
j-1][4-1].get_average_time(&TIME,&TIME_RMS))
continue;
1130 xt+=TIME-
time; xxt+=(TIME-
time)*(TIME-time);
n++;
1135 if(
n<10)
return false;
1137 *rms=
sqrt(xxt/
n-(xt*xt)/(
n*
n));
1172 double T=0,nT=0,E=0,nE=0;
1173 for(
int depth=1;depth<=2;depth++){
1185 T+=
time; nT++; E+=ave; nE++;
1192 double T=0,nT=0,E=0,nE=0;
1193 for(
int depth=1;depth<=3;depth++){
1195 double ave=0;
double rms=0;
double time=0;
double time_rms=0;
1202 T+=
time; nT++; E+=ave; nE++;
1212 double T=0,nT=0,E=0,nE=0;
1213 for(
int depth=1;depth<=2;depth++){
1215 double ave=0;
double rms=0;
double time=0;
double time_rms=0;
1221 T+=
time; nT++; E+=ave; nE++;
1233 double T=0,nT=0,E=0,nE=0;
1234 for(
int depth=4;depth<=4;depth++){
1236 double ave=0;
double rms=0;
double time=0;
double time_rms=0;
1242 T+=
time; nT++; E+=ave; nE++;
1253 double T=0,nT=0,E=0,nE=0;
1254 for(
int depth=1;depth<=2;depth++){
1256 double val=0,
rms=0,
time=0,time_rms=0;
1257 double VAL=0,
RMS=0,TIME=0,TIME_RMS=0;
1260 if(!
hb_data[
eta+42][
phi-1][depth-1].get_average_time(&TIME,&TIME_RMS))
continue;
1269 double T=0,nT=0,E=0,nE=0;
1270 for(
int depth=1;depth<=3;depth++){
1272 double val=0,
rms=0,
time=0,time_rms=0;
1273 double VAL=0,
RMS=0,TIME=0,TIME_RMS=0;
1276 if(!
he_data[
eta+42][
phi-1][depth-1].get_average_time(&TIME,&TIME_RMS))
continue;
1289 double T=0,nT=0,E=0,nE=0;
1290 for(
int depth=1;depth<=2;depth++){
1292 double val=0,
rms=0,
time=0,time_rms=0;
1293 double VAL=0,
RMS=0,TIME=0,TIME_RMS=0;
1296 if(!
hf_data[
eta+42][
phi-1][depth-1].get_average_time(&TIME,&TIME_RMS))
continue;
1310 double T=0,nT=0,E=0,nE=0;
1311 for(
int depth=4;depth<=4;depth++){
1313 double val=0,
rms=0,
time=0,time_rms=0;
1314 double VAL=0,
RMS=0,TIME=0,TIME_RMS=0;
1317 if(!
ho_data[
eta+42][
phi-1][depth-1].get_average_time(&TIME,&TIME_RMS))
continue;
1330 for(
int i=1;
i<=18;
i++){
1331 float ave=-10,
rms=-10;
1335 if(ave<min) min=ave;
1336 if(ave>max) max=ave;
1339 for(
int i=1;
i<=18;
i++){
1340 float ave=-10,
rms=-10;
1344 if(ave<min) min=ave;
1345 if(ave>max) max=ave;
1350 for(
int i=1;
i<=18;
i++){
1351 float ave=-10,
rms=-10;
1355 if(ave<min) min=ave;
1356 if(ave>max) max=ave;
1359 for(
int i=1;
i<=18;
i++){
1360 float ave=-10,
rms=-10;
1364 if(ave<min) min=ave;
1365 if(ave>max) max=ave;
1373 for(
int i=1;
i<=6;
i++){
1374 float ave=-10,
rms=-10;
1378 if(ave<min) min=ave;
1379 if(ave>max) max=ave;
1382 for(
int i=1;
i<=6;
i++){
1383 float ave=-10,
rms=-10;
1387 if(ave<min) min=ave;
1388 if(ave>max) max=ave;
1391 for(
int i=1;
i<=12;
i++){
1392 float ave=-10,
rms=-10;
1396 if(ave<min) min=ave;
1397 if(ave>max) max=ave;
1400 for(
int i=1;
i<=6;
i++){
1401 float ave=-10,
rms=-10;
1405 if(ave<min) min=ave;
1406 if(ave>max) max=ave;
1409 for(
int i=1;
i<=6;
i++){
1410 float ave=-10,
rms=-10;
1414 if(ave<min) min=ave;
1415 if(ave>max) max=ave;
1423 for(
int i=1;
i<=12;
i++){
1424 float ave=-10,
rms=-10;
1428 if(ave<min) min=ave;
1429 if(ave>max) max=ave;
1432 for(
int i=1;
i<=12;
i++){
1433 float ave=-10,
rms=-10;
1437 if(ave<min) min=ave;
1438 if(ave>max) max=ave;
1446 double amp,
rms,Time,time_rms;
1448 char Subdet[10],str[500];
1453 sprintf(str,
"%sHcalDetDiagLaserData.root",
OutputFilePath.c_str());
1455 TFile *
theFile =
new TFile(str,
"RECREATE");
1456 if(!theFile->IsOpen())
return;
1458 sprintf(str,
"%d",
run_number); TObjString
run(str); run.Write(
"run number");
1459 sprintf(str,
"%d",
ievt_); TObjString
events(str); events.Write(
"Total events processed");
1460 sprintf(str,
"%d",
dataset_seq_number); TObjString dsnum(str); dsnum.Write(
"Dataset number");
1461 Long_t
t; t=
time(0); strftime(str,30,
"%F %T",localtime(&t)); TObjString tm(str); tm.Write(
"Dataset creation time");
1463 TTree *
tree =
new TTree(
"HCAL Laser data",
"HCAL Laser data");
1465 tree->Branch(
"Subdet", &Subdet,
"Subdet/C");
1466 tree->Branch(
"eta", &Eta,
"Eta/I");
1467 tree->Branch(
"phi", &Phi,
"Phi/I");
1468 tree->Branch(
"depth", &Depth,
"Depth/I");
1469 tree->Branch(
"statistic",&Statistic,
"Statistic/I");
1470 tree->Branch(
"status", &Status,
"Status/I");
1471 tree->Branch(
"amp", &,
"amp/D");
1472 tree->Branch(
"rms", &rms,
"rms/D");
1473 tree->Branch(
"time", &Time,
"time/D");
1474 tree->Branch(
"time_rms", &time_rms,
"time_rms/D");
1475 sprintf(Subdet,
"HB");
1476 for(
int eta=-16;
eta<=16;
eta++)
for(
int phi=1;
phi<=72;
phi++)
for(
int depth=1;depth<=2;depth++){
1477 if((Statistic=
hb_data[
eta+42][
phi-1][depth-1].get_statistics1())>10){
1478 Eta=
eta; Phi=
phi; Depth=depth;
1485 sprintf(Subdet,
"HE");
1486 for(
int eta=-29;
eta<=29;
eta++)
for(
int phi=1;
phi<=72;
phi++)
for(
int depth=1;depth<=3;depth++){
1487 if((Statistic=
he_data[
eta+42][
phi-1][depth-1].get_statistics1())>10){
1488 Eta=
eta; Phi=
phi; Depth=depth;
1495 sprintf(Subdet,
"HO");
1496 for(
int eta=-15;
eta<=15;
eta++)
for(
int phi=1;
phi<=72;
phi++)
for(
int depth=4;depth<=4;depth++){
1497 if((Statistic=
ho_data[
eta+42][
phi-1][depth-1].get_statistics1())>10){
1498 Eta=
eta; Phi=
phi; Depth=depth;
1505 sprintf(Subdet,
"HF");
1506 for(
int eta=-42;
eta<=42;
eta++)
for(
int phi=1;
phi<=72;
phi++)
for(
int depth=1;depth<=2;depth++){
1507 if((Statistic=
hf_data[
eta+42][
phi-1][depth-1].get_statistics1())>10){
1508 Eta=
eta; Phi=
phi; Depth=depth;
1515 sprintf(Subdet,
"CALIB_HB");
1518 Eta=
eta; Phi=
phi; Depth=0;
1525 sprintf(Subdet,
"CALIB_HE");
1528 Eta=
eta; Phi=
phi; Depth=0;
1535 sprintf(Subdet,
"CALIB_HO");
1538 Eta=
eta; Phi=
phi; Depth=0;
1545 sprintf(Subdet,
"CALIB_HF");
1548 Eta=
eta; Phi=
phi; Depth=0;
1561 Long_t
t; t=
time(0); strftime(TIME,30,
"%F %T",localtime(&t));
1566 sprintf(str,
"HcalDetDiagLaser.xml");
1570 xmlFile.open(xmlName.c_str());
1572 xmlFile<<
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
1573 xmlFile<<
"<ROOT>\n";
1574 xmlFile<<
" <HEADER>\n";
1575 xmlFile<<
" <HINTS mode='only-det-root'/>\n";
1576 xmlFile<<
" <TYPE>\n";
1577 xmlFile<<
" <EXTENSION_TABLE_NAME>HCAL_DETMON_LED_LASER_V1</EXTENSION_TABLE_NAME>\n";
1578 xmlFile<<
" <NAME>HCAL Laser HBHE HPD [abort gap global]</NAME>\n";
1579 xmlFile<<
" </TYPE>\n";
1580 xmlFile<<
" <!-- run details -->\n";
1581 xmlFile<<
" <RUN>\n";
1582 xmlFile<<
" <RUN_TYPE>GLOBAL-RUN</RUN_TYPE>\n";
1583 xmlFile<<
" <RUN_NUMBER>"<<
run_number<<
"</RUN_NUMBER>\n";
1584 xmlFile<<
" <RUN_BEGIN_TIMESTAMP>2009-01-01 00:00:00</RUN_BEGIN_TIMESTAMP>\n";
1585 xmlFile<<
" <COMMENT_DESCRIPTION>hcal laser data</COMMENT_DESCRIPTION>\n";
1586 xmlFile<<
" <LOCATION>P5</LOCATION>\n";
1587 xmlFile<<
" <INITIATED_BY_USER>dma</INITIATED_BY_USER>\n";
1588 xmlFile<<
" </RUN>\n";
1589 xmlFile<<
" </HEADER>\n";
1590 xmlFile<<
" <DATA_SET>\n";
1591 xmlFile<<
" <!-- optional dataset metadata -->\n\n";
1593 xmlFile<<
" <SET_BEGIN_TIMESTAMP>2009-01-01 00:00:00</SET_BEGIN_TIMESTAMP>\n";
1594 xmlFile<<
" <SET_END_TIMESTAMP>2009-01-01 00:00:00</SET_END_TIMESTAMP>\n";
1595 xmlFile<<
" <NUMBER_OF_EVENTS_IN_SET>"<<
ievt_<<
"</NUMBER_OF_EVENTS_IN_SET>\n";
1596 xmlFile<<
" <COMMENT_DESCRIPTION>Automatic DQM output</COMMENT_DESCRIPTION>\n";
1597 xmlFile<<
" <DATA_FILE_NAME>"<< xmlName <<
"</DATA_FILE_NAME>\n";
1598 xmlFile<<
" <IMAGE_FILE_NAME>data plot url or file path</IMAGE_FILE_NAME>\n";
1599 xmlFile<<
" <!-- who and when created this dataset-->\n\n";
1600 xmlFile<<
" <CREATE_TIMESTAMP>"<<TIME<<
"</CREATE_TIMESTAMP>\n";
1601 xmlFile<<
" <CREATED_BY_USER>dma</CREATED_BY_USER>\n";
1602 xmlFile<<
" <!-- version (string) and subversion (number) -->\n";
1603 xmlFile<<
" <!-- fields are used to read data back from the database -->\n\n";
1604 xmlFile<<
" <VERSION>"<<run_number<<dataset_seq_number<<
"</VERSION>\n";
1605 xmlFile<<
" <SUBVERSION>1</SUBVERSION>\n";
1606 xmlFile<<
" <!-- Assign predefined dataset attributes -->\n\n";
1607 xmlFile<<
" <PREDEFINED_ATTRIBUTES>\n";
1608 xmlFile<<
" <ATTRIBUTE>\n";
1609 xmlFile<<
" <NAME>HCAL Dataset Status</NAME>\n";
1610 xmlFile<<
" <VALUE>VALID</VALUE>\n";
1611 xmlFile<<
" </ATTRIBUTE>\n";
1612 xmlFile<<
" </PREDEFINED_ATTRIBUTES>\n";
1613 xmlFile<<
" <!-- multiple data block records -->\n\n";
1616 for(std::vector <HcalElectronicsId>::iterator eid = AllElIds.begin(); eid != AllElIds.end(); eid++){
1620 if(!(!(gid.null()) &&
1632 double e=0,e_rms=0,t=0,t_rms=0;
1658 xmlFile<<
" <DATA>\n";
1659 xmlFile<<
" <NUMBER_OF_EVENTS_USED>"<<Statistic<<
"</NUMBER_OF_EVENTS_USED>\n";
1660 xmlFile<<
" <SIGNAL_MEAN>"<<e<<
"</SIGNAL_MEAN>\n";
1661 xmlFile<<
" <SIGNAL_RMS>"<<e_rms<<
"</SIGNAL_RMS>\n";
1662 xmlFile<<
" <TIME_MEAN>"<<t<<
"</TIME_MEAN>\n";
1663 xmlFile<<
" <TIME_RMS>"<<t_rms<<
"</TIME_RMS>\n";
1664 xmlFile<<
" <CHANNEL_STATUS_WORD>"<<Status<<
"</CHANNEL_STATUS_WORD>\n";
1665 xmlFile<<
" <CHANNEL_OBJECTNAME>HcalDetId</CHANNEL_OBJECTNAME>\n";
1666 xmlFile<<
" <SUBDET>"<<subdet<<
"</SUBDET>\n";
1667 xmlFile<<
" <IETA>"<<eta<<
"</IETA>\n";
1668 xmlFile<<
" <IPHI>"<<phi<<
"</IPHI>\n";
1669 xmlFile<<
" <DEPTH>"<<depth<<
"</DEPTH>\n";
1670 xmlFile<<
" <TYPE>0</TYPE>\n";
1671 xmlFile<<
" </DATA>\n";
1674 xmlFile<<
" </DATA_SET>\n";
1675 xmlFile<<
"</ROOT>\n";
1680 sprintf(str,
"HcalDetDiagLaserCalib_%i_%i.xml",run_number,dataset_seq_number);
1682 std::ofstream xmlFileCalib;
1683 xmlFileCalib.open(xmlNameCalib.c_str());
1685 xmlFileCalib<<
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
1686 xmlFileCalib<<
"<ROOT>\n";
1687 xmlFileCalib<<
" <HEADER>\n";
1688 xmlFileCalib<<
" <HINTS mode='only-det-root'/>\n";
1689 xmlFileCalib<<
" <TYPE>\n";
1690 xmlFileCalib<<
" <EXTENSION_TABLE_NAME>HCAL_DETMON_LED_LASER_V1</EXTENSION_TABLE_NAME>\n";
1691 xmlFileCalib<<
" <NAME>HCAL Laser CALIB [abort gap global]</NAME>\n";
1692 xmlFileCalib<<
" </TYPE>\n";
1693 xmlFileCalib<<
" <!-- run details -->\n";
1694 xmlFileCalib<<
" <RUN>\n";
1695 xmlFileCalib<<
" <RUN_TYPE>Global-RUN</RUN_TYPE>\n";
1696 xmlFileCalib<<
" <RUN_NUMBER>"<<run_number<<
"</RUN_NUMBER>\n";
1697 xmlFileCalib<<
" <RUN_BEGIN_TIMESTAMP>2009-01-01 00:00:00</RUN_BEGIN_TIMESTAMP>\n";
1698 xmlFileCalib<<
" <COMMENT_DESCRIPTION>hcal Laser CALIB data</COMMENT_DESCRIPTION>\n";
1699 xmlFileCalib<<
" <LOCATION>P5</LOCATION>\n";
1700 xmlFileCalib<<
" <INITIATED_BY_USER>dma</INITIATED_BY_USER>\n";
1701 xmlFileCalib<<
" </RUN>\n";
1702 xmlFileCalib<<
" </HEADER>\n";
1703 xmlFileCalib<<
" <DATA_SET>\n";
1704 xmlFileCalib<<
" <!-- optional dataset metadata -->\n\n";
1705 xmlFileCalib<<
" <SET_NUMBER>"<<dataset_seq_number<<
"</SET_NUMBER>\n";
1706 xmlFileCalib<<
" <SET_BEGIN_TIMESTAMP>2009-01-01 00:00:00</SET_BEGIN_TIMESTAMP>\n";
1707 xmlFileCalib<<
" <SET_END_TIMESTAMP>2009-01-01 00:00:00</SET_END_TIMESTAMP>\n";
1708 xmlFileCalib<<
" <NUMBER_OF_EVENTS_IN_SET>"<<ievt_<<
"</NUMBER_OF_EVENTS_IN_SET>\n";
1709 xmlFileCalib<<
" <COMMENT_DESCRIPTION>Automatic DQM output</COMMENT_DESCRIPTION>\n";
1710 xmlFileCalib<<
" <DATA_FILE_NAME>"<< xmlNameCalib <<
"</DATA_FILE_NAME>\n";
1711 xmlFileCalib<<
" <IMAGE_FILE_NAME>data plot url or file path</IMAGE_FILE_NAME>\n";
1712 xmlFileCalib<<
" <!-- who and when created this dataset-->\n\n";
1713 xmlFileCalib<<
" <CREATE_TIMESTAMP>"<<TIME<<
"</CREATE_TIMESTAMP>\n";
1714 xmlFileCalib<<
" <CREATED_BY_USER>dma</CREATED_BY_USER>\n";
1715 xmlFileCalib<<
" <!-- version (string) and subversion (number) -->\n";
1716 xmlFileCalib<<
" <!-- fields are used to read data back from the database -->\n\n";
1717 xmlFileCalib<<
" <VERSION>"<<run_number<<dataset_seq_number<<
"</VERSION>\n";
1718 xmlFileCalib<<
" <SUBVERSION>1</SUBVERSION>\n";
1719 xmlFileCalib<<
" <!-- Assign predefined dataset attributes -->\n\n";
1720 xmlFileCalib<<
" <PREDEFINED_ATTRIBUTES>\n";
1721 xmlFileCalib<<
" <ATTRIBUTE>\n";
1722 xmlFileCalib<<
" <NAME>HCAL Dataset Status</NAME>\n";
1723 xmlFileCalib<<
" <VALUE>VALID</VALUE>\n";
1724 xmlFileCalib<<
" </ATTRIBUTE>\n";
1725 xmlFileCalib<<
" </PREDEFINED_ATTRIBUTES>\n";
1726 xmlFileCalib<<
" <!-- multiple data block records -->\n\n";
1730 if(
sd==1) subdet=
"HB";
1731 if(
sd==2) subdet=
"HE";
1732 if(
sd==3) subdet=
"HO";
1733 if(
sd==4) subdet=
"HF";
1735 double e=0,e_rms=0,t=0,t_rms=0;
1740 xmlFileCalib<<
" <DATA>\n";
1741 xmlFileCalib<<
" <NUMBER_OF_EVENTS_USED>"<<Statistic<<
"</NUMBER_OF_EVENTS_USED>\n";
1742 xmlFileCalib<<
" <SIGNAL_MEAN>"<<e<<
"</SIGNAL_MEAN>\n";
1743 xmlFileCalib<<
" <SIGNAL_RMS>"<<e_rms<<
"</SIGNAL_RMS>\n";
1744 xmlFileCalib<<
" <TIME_MEAN>"<<t<<
"</TIME_MEAN>\n";
1745 xmlFileCalib<<
" <TIME_RMS>"<<t_rms<<
"</TIME_RMS>\n";
1746 xmlFileCalib<<
" <CHANNEL_STATUS_WORD>"<<Status<<
"</CHANNEL_STATUS_WORD>\n";
1747 xmlFileCalib<<
" <CHANNEL_OBJECTNAME>HcalDetId</CHANNEL_OBJECTNAME>\n";
1748 xmlFileCalib<<
" <SUBDET>"<<subdet<<
"</SUBDET>\n";
1749 xmlFileCalib<<
" <IETA>"<<
eta<<
"</IETA>\n";
1750 xmlFileCalib<<
" <IPHI>"<<
phi<<
"</IPHI>\n";
1751 xmlFileCalib<<
" <DEPTH>"<<0<<
"</DEPTH>\n";
1752 xmlFileCalib<<
" <TYPE>0</TYPE>\n";
1753 xmlFileCalib<<
" </DATA>\n";
1757 xmlFileCalib<<
" </DATA_SET>\n";
1758 xmlFileCalib<<
"</ROOT>\n";
1759 xmlFileCalib.close();
1761 sprintf(str,
"zip %s.zip %s %s",xmlName.c_str(),xmlName.c_str(),xmlNameCalib.c_str());
1763 sprintf(str,
"rm -f %s %s",xmlName.c_str(),xmlNameCalib.c_str());
1765 sprintf(str,
"mv -f %s.zip %s",xmlName.c_str(),
XmlFilePath.c_str());
1785 if(!f->IsOpen())
return ;
1786 TObjString *STR=(TObjString *)f->Get(
"run number");
1790 TTree*
t=(TTree*)f->Get(
"HCAL Laser data");
1792 t->SetBranchAddress(
"Subdet", subdet);
1793 t->SetBranchAddress(
"eta", &Eta);
1794 t->SetBranchAddress(
"phi", &Phi);
1795 t->SetBranchAddress(
"depth", &Depth);
1796 t->SetBranchAddress(
"amp", &);
1797 t->SetBranchAddress(
"rms", &rms);
1798 t->SetBranchAddress(
"time", &time);
1799 t->SetBranchAddress(
"time_rms", &time_rms);
1800 for(
int ievt=0;ievt<t->GetEntries();ievt++){
1802 if(strcmp(subdet,
"HB")==0)
hb_data[Eta+42][Phi-1][Depth-1].
set_reference(amp,rms,time,time_rms);
1803 if(strcmp(subdet,
"HE")==0)
he_data[Eta+42][Phi-1][Depth-1].
set_reference(amp,rms,time,time_rms);
1804 if(strcmp(subdet,
"HO")==0)
ho_data[Eta+42][Phi-1][Depth-1].
set_reference(amp,rms,time,time_rms);
1805 if(strcmp(subdet,
"HF")==0)
hf_data[Eta+42][Phi-1][Depth-1].
set_reference(amp,rms,time,time_rms);
1822 if(gSystem->AccessPathName(
DatasetName.c_str()))
return;
1825 if(!f->IsOpen())
return ;
1828 t=(TTree*)f->Get(
"HCAL Laser data");
1830 t->SetBranchAddress(
"Subdet", subdet);
1831 t->SetBranchAddress(
"eta", &Eta);
1832 t->SetBranchAddress(
"phi", &Phi);
1833 t->SetBranchAddress(
"depth", &Depth);
1834 t->SetBranchAddress(
"amp", &);
1835 t->SetBranchAddress(
"rms", &rms);
1836 t->SetBranchAddress(
"time", &time);
1837 t->SetBranchAddress(
"time_rms", &time_rms);
1838 t->SetBranchAddress(
"statistic",&Statistic);
1839 for(
int ievt=0;ievt<t->GetEntries();ievt++){
1841 if(strcmp(subdet,
"HB")==0){
nHB++;
1846 if(strcmp(subdet,
"HE")==0){
nHE++;
1851 if(strcmp(subdet,
"HO")==0){
nHO++;
1856 if(strcmp(subdet,
"HF")==0){
nHF++;
1861 if(strcmp(subdet,
"CALIB_HB")==0){
1866 if(strcmp(subdet,
"CALIB_HE")==0){
1871 if(strcmp(subdet,
"CALIB_HO")==0){
1876 if(strcmp(subdet,
"CALIB_HF")==0){
1882 TObjString *STR1=(TObjString *)f->Get(
"run number");
1885 TObjString *STR2=(TObjString *)f->Get(
"Total events processed");
1888 TObjString *STR3=(TObjString *)f->Get(
"Dataset number");
1895 float adc_range[20]={14,28,40,52,67,132,202,262,322,397,722,1072,1372,1672,2047,3672,5422,6922,8422,10297};
1896 int adc_bins[20]={1,2,3,4,5,5,10,15,20,25,25,50,75,100,125,125,250,375,500,625};
1898 TF1 *fitFunc =
new TF1(
"fitFunc",
"gaus");
1899 if(fitFunc==0)
return;
1900 for(
int i=0;
i<56;
i++){
1901 float sum1=0,sum2=0,
n=0;
1903 for(
int j=0;
j<128;
j++){
1913 for(N=1;N<19;N++) if(sum1>adc_range[N-1] && sum1<adc_range[
N])
break;
1915 for(N=1;N<19;N++) if(sum2>adc_range[N-1] && sum2<adc_range[
N])
break;
1917 sprintf(str,
"Raddam(%i,%i,%i) S1",RADDAM_CH[
i].
eta,RADDAM_CH[
i].
phi,RADDAM_CH[
i].depth);
1918 S1[
i]=
new TH1F(str,str,10000/Ws1,0,10000);
1919 sprintf(str,
"Raddam(%i,%i,%i) S2",RADDAM_CH[
i].eta,RADDAM_CH[
i].phi,RADDAM_CH[
i].depth);
1920 S2[
i]=
new TH1F(str,str,10000/Ws1,0,10000);
1921 for(
int j=0;
j<128;
j++){
1923 S2[
i]->Fill(
adc2fC[j]-2.5,Raddam_data[
i].s2_adc[j]);
1926 S1[
i]->Fit(fitFunc);
1927 S1[
i]->GetFunction(
"fitFunc")->GetParameters(parm);
1931 Raddam_data[
i].
S1FITMEANER=
S1[
i]->GetFunction(
"fitFunc")->GetParError(1);
1933 Raddam_data[
i].
S1CHI2=
S1[
i]->GetFunction(
"fitFunc")->GetChisquare();
1934 Raddam_data[
i].
S1NDF=
S1[
i]->GetFunction(
"fitFunc")->GetNDF();
1936 S2[
i]->Fit(fitFunc);
1937 S2[
i]->GetFunction(
"fitFunc")->GetParameters(parm);
1941 Raddam_data[
i].
S2FITMEANER=
S2[
i]->GetFunction(
"fitFunc")->GetParError(1);
1943 Raddam_data[
i].
S2CHI2=
S2[
i]->GetFunction(
"fitFunc")->GetChisquare();
1944 Raddam_data[
i].
S2NDF=
S2[
i]->GetFunction(
"fitFunc")->GetNDF();
1949 Long_t
t; t=
time(0); strftime(TIME,30,
"%F %T",localtime(&t));
1954 sprintf(str,
"HcalDetDiagRaddam.xml");
1958 xmlFile.open(xmlName.c_str());
1959 xmlFile<<
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>\n";
1960 xmlFile<<
"<ROOT>\n";
1961 xmlFile<<
" <HEADER>\n";
1962 xmlFile<<
" <TYPE>\n";
1963 xmlFile<<
" <EXTENSION_TABLE_NAME>HCAL_RADDAM</EXTENSION_TABLE_NAME>\n";
1964 xmlFile<<
" <NAME>HCAL Raddam</NAME>\n";
1965 xmlFile<<
" </TYPE>\n";
1966 xmlFile<<
" <!-- run details -->\n";
1967 xmlFile<<
" <RUN>\n";
1968 xmlFile<<
" <RUN_TYPE>TEST LOCAL-RUN</RUN_TYPE>\n";
1969 xmlFile<<
" <RUN_NUMBER>"<<
run_number<<
"</RUN_NUMBER>\n";
1970 xmlFile<<
" <RUN_BEGIN_TIMESTAMP>"<<TIME<<
"</RUN_BEGIN_TIMESTAMP>\n";
1971 xmlFile<<
" <COMMENT_DESCRIPTION>hcal raddam data</COMMENT_DESCRIPTION>\n";
1972 xmlFile<<
" <LOCATION>P5</LOCATION>\n";
1973 xmlFile<<
" <INITIATED_BY_USER>dma</INITIATED_BY_USER>\n";
1974 xmlFile<<
" </RUN>\n";
1975 xmlFile<<
" </HEADER>\n";
1976 xmlFile<<
" <DATA_SET>\n";
1977 xmlFile<<
" <COMMENT_DESCRIPTION>Test Raddam data</COMMENT_DESCRIPTION>\n";
1978 xmlFile<<
" <CREATE_TIMESTAMP>"<<TIME<<
"</CREATE_TIMESTAMP>\n";
1979 xmlFile<<
" <CREATED_BY_USER>dma</CREATED_BY_USER>\n";
1980 xmlFile<<
" <VERSION>Test_Version_1</VERSION>\n";
1982 for(
int i=0;
i<56;
i++){
1983 xmlFile<<
" <DATA>\n";
1984 xmlFile<<
" <SUBDET>HF</SUBDET>\n";
1985 xmlFile<<
" <IETA>"<<RADDAM_CH[
i].
eta<<
"</IETA>\n";
1986 xmlFile<<
" <IPHI>"<<RADDAM_CH[
i].
phi<<
"</IPHI>\n";
1987 xmlFile<<
" <DEPTH>"<<RADDAM_CH[
i].
depth<<
"</DEPTH>\n";
1989 xmlFile<<
" <TOTEVNT>"<<Raddam_data[
i].
TOTEVNT<<
"</TOTEVNT>\n";
1990 xmlFile<<
" <CUT1EVNT>"<<Raddam_data[
i].
CUT1EVNT<<
"</CUT1EVNT>\n";
1991 xmlFile<<
" <CUT2EVNT>"<<Raddam_data[
i].
CUT2EVNT<<
"</CUT2EVNT>\n";
1993 xmlFile<<
" <S1MEAN>"<<Raddam_data[
i].
S1MEAN <<
"</S1MEAN>\n";
1994 xmlFile<<
" <S1RMS>"<<Raddam_data[
i].
S1RMS <<
"</S1RMS>\n";
1995 xmlFile<<
" <S1FITMEAN>"<<Raddam_data[
i].
S1FITMEAN <<
"</S1FITMEAN>\n";
1996 xmlFile<<
" <S1FITMEANER>"<<Raddam_data[
i].
S1FITMEANER <<
"</S1FITMEANER>\n";
1997 xmlFile<<
" <S1FITSIGMA>"<<Raddam_data[
i].
S1FITSIGMA <<
"</S1FITSIGMA>\n";
1998 xmlFile<<
" <S1CHI2>"<<Raddam_data[
i].
S1CHI2 <<
"</S1CHI2>\n";
1999 xmlFile<<
" <S1NDF>"<<Raddam_data[
i].
S1NDF <<
"</S1NDF>\n";
2000 xmlFile<<
" <S1BINWIDTH>"<<Raddam_data[
i].
S1BINWIDTH <<
"</S1BINWIDTH>\n";
2002 xmlFile<<
" <S2MEAN>"<<Raddam_data[
i].
S2MEAN <<
"</S2MEAN>\n";
2003 xmlFile<<
" <S2RMS>"<<Raddam_data[
i].
S2RMS <<
"</S2RMS>\n";
2004 xmlFile<<
" <S2FITMEAN>"<<Raddam_data[
i].
S2FITMEAN <<
"</S2FITMEAN>\n";
2005 xmlFile<<
" <S2FITMEANER>"<<Raddam_data[
i].
S2FITMEANER <<
"</S2FITMEANER>\n";
2006 xmlFile<<
" <S2FITSIGMA>"<<Raddam_data[
i].
S2FITSIGMA <<
"</S2FITSIGMA>\n";
2007 xmlFile<<
" <S2CHI2>"<<Raddam_data[
i].
S2CHI2 <<
"</S2CHI2>\n";
2008 xmlFile<<
" <S2NDF>"<<Raddam_data[
i].
S2NDF <<
"</S2NDF>\n";
2009 xmlFile<<
" <S2BINWIDTH>"<<Raddam_data[
i].
S2BINWIDTH <<
"</S2BINWIDTH>\n";
2010 xmlFile<<
" </DATA>\n";
2012 xmlFile<<
" </DATA_SET>\n";
2013 xmlFile<<
"</ROOT>\n";
2016 sprintf(str,
"zip %s.zip %s",xmlName.c_str(),xmlName.c_str());
2018 sprintf(str,
"rm -f %s",xmlName.c_str());
2020 sprintf(str,
"mv -f %s.zip %s",xmlName.c_str(),
XmlFilePath.c_str());
2027 sprintf(str,
"%sHcalDetDiagRaddamData.root",
OutputFilePath.c_str());
2029 TFile *
theFile =
new TFile(str,
"RECREATE");
2030 if(!theFile->IsOpen())
return;
2032 for(
int i=0;
i<56;
i++){
2033 if(
S1[
i]!=0)
S1[
i]->Write();
2034 if(
S2[
i]!=0)
S2[
i]->Write();
void analyze(const edm::Event &, const edm::EventSetup &) override
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
void setBinContent(int binx, double content)
set content of bin (1-D)
edm::Ref< Container > Ref
void add_statistics(double *data, int nTS)
void endRun(const edm::Run &run, const edm::EventSetup &c) override
std::vector< HcalElectronicsId > allElectronicsIdPrecision() const
double GetEnergy(double *data, int n)
HcalDetDiagLaserData * GetCalib(std::string sd, int eta, int phi)
virtual void analyze(const edm::Event &e, const edm::EventSetup &c)
void set_reference(float val, float rms, float time, float time_rms)
void setAxisRange(double xmin, double xmax, int axis=1)
set x-, y- or z-axis range (axis=1, 2, 3 respectively)
edm::EDGetTokenT< HcalCalibDigiCollection > tok_calib_
edm::EDGetTokenT< FEDRawDataCollection > tok_raw_
bool get_average_amp(double *ave, double *rms)
MonitorElement * refTime2Dho
bool get_average_amp1(double *ave, double *rms)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * Time2Dhbhehf
MonitorElement * hfEnergy
#define DEFINE_FWK_MODULE(type)
const HcalElectronicsMap * emap
double LaserTimingThreshold
MonitorElement * bookInt(Args &&...args)
std::vector< HFDataFrame >::const_iterator const_iterator
MonitorElement * bookString(Args &&...args)
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * hbheTimeRMS
const Item * getValues(DetId fId, bool throwOnFail=true) const
void set_statistics(int stat)
bool get_ave_subdet(int sd, float *ave_t, float *ave_e, float *ave_t_r, float *ave_e_r)
edm::EDGetTokenT< HFDigiCollection > tok_hf_
HcalRaddamData Raddam_data[56]
MonitorElement * ho_time_rbx
static const Raddam_ch RADDAM_CH[56]
static const float adc2fC[128]
bool get_ave_rbx(int sd, int side, int rbx, float *ave, float *rms)
MonitorElement * Time2Dho
std::string htmlOutputPath
std::string ReferenceData
size_t size() const
Lenght of the data buffer in bytes.
bool get_average_time(double *ave, double *rms)
std::map< unsigned int, int > KnownBadCells_
MonitorElement * refEnergy2Dhbhehf
MonitorElement * hfTimeRMS
uint32_t rawId() const
get the raw id
MonitorElement * Raddam[56]
MonitorElement * refTime2Dhbhehf
bool isSiPM(int ieta, int iphi, int depth)
int depth() const
get the tower depth
MVATrainerComputer * calib
std::vector< MonitorElement * > depth
EtaPhiHists * ProblemCellsByDepth_timing
~HcalDetDiagLaserMonitor()
MonitorElement * hbheTime
void fillProblems(int sd)
MonitorElement * hbheEnergyRMS
MonitorElement * hb_time_rbx
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
MonitorElement * he_time_rbx
std::vector< DetId > getAllChannels() const
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
EtaPhiHists * ProblemCellsByDepth_energy_val
int ieta() const
get the cell ieta
void change_status(int val)
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
MonitorElement * htmlFolder
void setup(DQMStore::IBooker &m_dbe, std::string Name, std::string Units="")
MonitorElement * hoTimeRMS
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
MonitorElement * Energy2Dho
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
void bookHistograms(DQMStore::IBooker &ib, const edm::Run &run, const edm::EventSetup &c) override
edm::EDGetTokenT< HODigiCollection > tok_ho_
int iphi() const
get the cell iphi
HcalDetDiagLaserData hb_data[85][72][4]
HcalDetDiagLaserMonitor(const edm::ParameterSet &)
MonitorElement * refEnergy2Dho
std::string OutputFilePath
bool get_average_time1(double *ave, double *rms)
void setCurrentFolder(const std::string &fullpath)
MonitorElement * Energy2Dhbhehf
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
MonitorElement * book2D(Args &&...args)
MonitorElement * hfEnergyRMS
EtaPhiHists * ProblemCellsByDepth_energy
T const * product() const
bool xmlFile(const std::string fParam)
int CalcEtaBin(int subdet, int ieta, int depth)
double GetTime(double *data, int n=10)
void set_statistics1(int stat)
MonitorElement * hbheEnergy
HcalDetDiagLaserData hf_data[85][72][4]
double LaserEnergyThreshold
char data[epos_bytes_allocation]
EtaPhiHists * ProblemCellsByDepth_timing_val
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
MonitorElement * hoEnergyRMS
bool get_reference(double *val, double *rms, double *time, double *time_rms)
MonitorElement * hf_time_rbx
void set_data(float val, float rms, float time, float time_rms)
HcalDetDiagLaserData he_data[85][72][4]
Detector det() const
get the detector field from this detid
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
std::vector< std::string > problemnames_
void Reset(void)
reset ME (ie. contents, errors, etc)
HcalDetDiagLaserData ho_data[85][72][4]
virtual void setup(DQMStore::IBooker &)
edm::InputTag inputLabelDigi_
edm::EDGetTokenT< HcalTBTriggerData > tok_tb_
HcalDetDiagLaserData calib_data[5][5][72]
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
MonitorElement * hoEnergy