80 int MaxI=0;
double Energy,MaxE=0;
81 for(
int j=0;
j<
n;++
j)
if(MaxE<data[
j]){ MaxE=data[
j]; MaxI=
j; }
83 if(MaxI>0) Energy+=data[MaxI-1];
84 if(MaxI>1) Energy+=data[MaxI-2];
85 if(MaxI<(n-1)) Energy+=data[MaxI+1];
86 if(MaxI<(n-2)) Energy+=data[MaxI+2];
90 int MaxI=0;
double Time=-9999,SumT=0,MaxT=-10;
91 for(
int j=0;
j<
n;++
j)
if(MaxT<data[
j]){ MaxT=data[
j]; MaxI=
j; }
94 if(MaxI>0){ Time+=(MaxI-1)*data[MaxI-1]; SumT+=data[MaxI-1]; }
95 if(MaxI<(n-1)){ Time+=(MaxI+1)*data[MaxI+1]; SumT+=data[MaxI+1]; }
114 void setup()
override;
117 void reset()
override;
129 if(sd.compare(
"HB")==0) SD=1;
130 if(sd.compare(
"HE")==0) SD=2;
131 if(sd.compare(
"HO")==0) SD=3;
132 if(sd.compare(
"HF")==0) SD=4;
134 if(eta>0)
ETA=1;
else ETA=-1;
135 if(phi==71 ||phi==72 || phi==1 || phi==2)
PHI=71;
else PHI=((phi-3)/4)*4+3;
139 if(phi==71 ||phi==72 || phi==1 || phi==2 || phi==3 || phi==4)
PHI=71;
else PHI=((phi-5)/6)*6+5;
144 if(phi==71 ||phi==72 || (phi>=1 && phi<=10))
PHI=71;
else PHI=((phi-11)/12)*12+11;
147 if(eta>0)
ETA=1;
else ETA=-1;
148 if(phi>=1 && phi<=18)
PHI=1;
149 if(phi>=19 && phi<=36)
PHI=19;
150 if(phi>=37 && phi<=54)
PHI=37;
151 if(phi>=55 && phi<=72)
PHI=55;
227 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,
228 13.5,15.,17.,19.,21.,23.,25.,27.,29.5,32.5,35.5,38.5,42.,46.,50.,54.5,59.5,
229 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,
230 124.5,129.5,137.,147.,157.,167.,177.,187.,197.,209.5,224.5,239.5,254.5,272.,
231 292.,312.,334.5,359.5,384.5,359.5,384.5,409.5,434.5,459.5,484.5,509.5,534.5,
232 559.5,584.5,609.5,634.5,659.5,684.5,709.5,747.,797.,847.,897.,947.,997.,
233 1047.,1109.5,1184.5,1259.5,1334.5,1422.,1522.,1622.,1734.5,1859.5,1984.5,
234 1859.5,1984.5,2109.5,2234.5,2359.5,2484.5,2609.5,2734.5,2859.5,2984.5,
235 3109.5,3234.5,3359.5,3484.5,3609.5,3797.,4047.,4297.,4547.,4797.,5047.,
236 5297.,5609.5,5984.5,6359.5,6734.5,7172.,7672.,8172.,8734.5,9359.5,9984.5};
255 if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!=
"/")
256 prefixME_.append(
"/");
301 if (
debug_>1)
std::cout <<
"HcalDetDiagLEDMonitor::beginRun"<<std::endl;
313 for (std::vector<DetId>::const_iterator
i = mydetids.begin();
i!=mydetids.end();++
i){
340 name=
"HBHEHO LED Energy Distribution";
Energy =
dbe_->
book1D(name,name,200,0,3000);
341 name=
"HBHEHO LED Timing Distribution";
Time =
dbe_->
book1D(name,name,200,0,10);
342 name=
"HBHEHO LED Energy RMS_div_Energy Distribution";
EnergyRMS =
dbe_->
book1D(name,name,200,0,0.2);
343 name=
"HBHEHO LED Timing RMS Distribution";
TimeRMS =
dbe_->
book1D(name,name,200,0,0.4);
345 name=
"HF LED Timing Distribution";
TimeHF =
dbe_->
book1D(name,name,200,0,10);
354 name=
"HBP Average over HPD LED Ref";
HBPphi =
dbe_->
book2D(name,name,180,1,73,400,0,2);
355 name=
"HBM Average over HPD LED Ref";
HBMphi =
dbe_->
book2D(name,name,180,1,73,400,0,2);
356 name=
"HEP Average over HPD LED Ref";
HEPphi =
dbe_->
book2D(name,name,180,1,73,400,0,2);
357 name=
"HEM Average over HPD LED Ref";
HEMphi =
dbe_->
book2D(name,name,180,1,73,400,0,2);
358 name=
"HFP Average over RM LED Ref";
HFPphi =
dbe_->
book2D(name,name,180,1,37,400,0,2);
359 name=
"HFM Average over RM LED Ref";
HFMphi =
dbe_->
book2D(name,name,180,1,37,400,0,2);
360 name=
"HO0 Average over HPD LED Ref";
HO0phi =
dbe_->
book2D(name,name,180,1,49,400,0,2);
361 name=
"HO1P Average over HPD LED Ref";
HO1Pphi=
dbe_->
book2D(name,name,180,1,49,400,0,2);
362 name=
"HO2P Average over HPD LED Ref";
HO2Pphi=
dbe_->
book2D(name,name,180,1,49,400,0,2);
363 name=
"HO1M Average over HPD LED Ref";
HO1Mphi=
dbe_->
book2D(name,name,180,1,49,400,0,2);
364 name=
"HO2M Average over HPD LED Ref";
HO2Mphi=
dbe_->
book2D(name,name,180,1,49,400,0,2);
405 if(trigger_data->triggerWord()==6){ LEDEvent=
true;LocalRun=
true;}
407 if(!LocalRun)
return;
408 if(!LEDEvent)
return;
420 eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
422 for(
int i=0;
i<nTS;
i++) data[
i]=
adc2fC[digi->sample(
i).adc()&0xff]-2.5;
426 for(
int i=0;
i<nTS;
i++) data[
i]=
adc2fC[digi->sample(
i).adc()&0xff]-2.5;
434 eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
435 for(
int i=0;
i<nTS;
i++) data[
i]=
adc2fC[digi->sample(
i).adc()&0xff]-2.5;
442 eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
443 for(
int i=0;
i<nTS;
i++) data[
i]=
adc2fC[digi->sample(
i).adc()&0xff]-2.5;
450 if(digi->id().cboxChannel()!=0 || digi->id().hcalSubdet()==0)
continue;
453 for(
int i=0;
i<nTS;
i++){ data[
i]=
adc2fC[digi->sample(
i).adc()&0xff]; e+=data[
i];}
457 if(((
ievt_)%500)==0){
494 double T=0,nT=0,E=0,nE=0;
495 for(
int depth=1;depth<=2;depth++){
507 T+=
time; nT++; E+=ave; nE++;
521 double T=0,nT=0,E=0,nE=0;
522 for(
int depth=1;depth<=3;depth++){
533 T+=
time; nT++; E+=ave; nE++;
549 double T=0,nT=0,E=0,nE=0;
550 for(
int depth=1;depth<=2;depth++){
561 T+=
time; nT++; E+=ave; nE++;
577 double T=0,nT=0,E=0,nE=0;
579 for(
int depth=4;depth<=4;depth++){
590 T+=
time; nT++; E+=ave; nE++;
604 double ave=0.,
rms=0.,ave_calib=0.,rms_calib=0.;
606 for(
int eta=-16;
eta<=16;
eta++)
for(
int phi=1;
phi<=72;
phi++)
for(
int depth=1;depth<=2;depth++){
612 for(
int eta=-29;
eta<=29;
eta++)
for(
int phi=1;
phi<=72;
phi++)
for(
int depth=1;depth<=3;depth++){
618 for(
int eta=-10;
eta<=15;
eta++)
for(
int phi=1;
phi<=72;
phi++)
for(
int depth=4;depth<=4;depth++){
625 for(
int eta=-42;
eta<=42;
eta++)
for(
int phi=1;
phi<=72;
phi++)
for(
int depth=1;depth<=2;depth++){
632 double hbp[18][4],nhbp[18][4],hbm[18][4],nhbm[18][4];
633 double hep[18][4],nhep[18][4],hem[18][4],nhem[18][4];
634 double hfp[18][4],nhfp[18][4],hfm[18][4],nhfm[18][4];
635 double ho0[18][4],nho0[18][4];
636 double ho1p[18][4],nho1p[18][4];
637 double ho2p[18][4],nho2p[18][4];
638 double ho1m[18][4],nho1m[18][4];
639 double ho2m[18][4],nho2m[18][4];
640 for(
int i=0;
i<18;
i++)
for(
int j=0;
j<4;
j++)
641 hbp[
i][
j]=nhbp[
i][
j]=hbm[
i][
j]=nhbm[
i][
j]=hep[
i][
j]=nhep[
i][
j]=hem[
i][
j]=nhem[
i][
j]=hfp[
i][
j]=nhfp[
i][
j]=hfm[
i][
j]=nhfm[
i][
j]=0;
642 for(
int i=0;
i<18;
i++)
for(
int j=0;
j<4;
j++)
643 ho0[
i][
j]=nho0[
i][
j]=ho1p[
i][
j]=nho1p[
i][
j]=ho2p[
i][
j]=nho2p[
i][
j]=ho1m[
i][
j]=nho1m[
i][
j]=ho2m[
i][
j]=nho2m[
i][
j]=0;
646 for(std::vector <HcalElectronicsId>::iterator eid = AllElIds.begin(); eid != AllElIds.end(); eid++){
650 if(!(!(gid.null()) &&
672 if(sd==0 || sd==1 || sd==3){
673 sscanf(&(lmap_entry.
rbx().c_str())[3],
"%d",&rbx);
675 if(
abs(
eta)<5) sscanf(&(lmap_entry.
rbx().c_str())[3],
"%d",&rbx);
676 if(
abs(
eta)>=5) sscanf(&(lmap_entry.
rbx().c_str())[4],
"%d",&rbx);
679 if(sd==0 &&
eta>0){ hbp[rbx-1][lmap_entry.
rm()-1]+=ave/ref; nhbp[rbx-1][lmap_entry.
rm()-1]++; }
680 if(sd==0 &&
eta<0){ hbm[rbx-1][lmap_entry.
rm()-1]+=ave/ref; nhbm[rbx-1][lmap_entry.
rm()-1]++; }
681 if(sd==1 &&
eta>0){ hep[rbx-1][lmap_entry.
rm()-1]+=ave/ref; nhep[rbx-1][lmap_entry.
rm()-1]++; }
682 if(sd==1 &&
eta<0){ hem[rbx-1][lmap_entry.
rm()-1]+=ave/ref; nhem[rbx-1][lmap_entry.
rm()-1]++; }
683 if(sd==3 &&
eta>0){ hfp[rbx-1][lmap_entry.
rm()-1]+=ave/ref; nhfp[rbx-1][lmap_entry.
rm()-1]++; }
684 if(sd==3 &&
eta<0){ hfm[rbx-1][lmap_entry.
rm()-1]+=ave/ref; nhfm[rbx-1][lmap_entry.
rm()-1]++; }
685 if(sd==2 &&
abs(
eta)<5){ ho0[rbx-1][lmap_entry.
rm()-1]+=ave/ref; nho0[rbx-1][lmap_entry.
rm()-1]++; }
686 if(sd==2 &&
eta>=5 &&
eta<=10){ ho1p[rbx-1][lmap_entry.
rm()-1]+=ave/ref; nho1p[rbx-1][lmap_entry.
rm()-1]++; }
687 if(sd==2 &&
eta>=11 &&
eta<=15){ ho2p[rbx-1][lmap_entry.
rm()-1]+=ave/ref; nho2p[rbx-1][lmap_entry.
rm()-1]++; }
688 if(sd==2 &&
eta>=-10 &&
eta<=-5){ ho1m[rbx-1][lmap_entry.
rm()-1]+=ave/ref; nho1m[rbx-1][lmap_entry.
rm()-1]++; }
689 if(sd==2 &&
eta>=-15 &&
eta<=-11){ ho2m[rbx-1][lmap_entry.
rm()-1]+=ave/ref; nho2m[rbx-1][lmap_entry.
rm()-1]++; }
692 for(
int i=0;
i<18;
i++)
for(
int j=0;
j<4;
j++){
699 for(
int i=0;
i<12;
i++)
for(
int j=0;
j<3;
j++){
704 for(
int i=0;
i<12;
i++)
for(
int j=0;
j<4;
j++){
717 char Subdet[10],str[500];
719 TFile *
theFile =
new TFile(str,
"RECREATE");
720 if(!theFile->IsOpen())
return;
722 sprintf(str,
"%d",
run_number); TObjString
run(str); run.Write(
"run number");
723 sprintf(str,
"%d",
ievt_); TObjString
events(str); events.Write(
"Total events processed");
725 TTree *
tree =
new TTree(
"HCAL LED data",
"HCAL LED data");
727 tree->Branch(
"Subdet", &Subdet,
"Subdet/C");
728 tree->Branch(
"eta", &Eta,
"Eta/I");
729 tree->Branch(
"phi", &Phi,
"Phi/I");
730 tree->Branch(
"depth", &Depth,
"Depth/I");
731 tree->Branch(
"statistic",&Statistic,
"Statistic/I");
732 tree->Branch(
"status", &Status,
"Status/I");
733 tree->Branch(
"led", &led,
"led/D");
734 tree->Branch(
"rms", &rms,
"rms/D");
735 tree->Branch(
"time", &Time,
"time/D");
736 tree->Branch(
"time_rms", &time_rms,
"time_rms/D");
737 sprintf(Subdet,
"HB");
738 for(
int eta=-16;
eta<=16;
eta++)
for(
int phi=1;
phi<=72;
phi++)
for(
int depth=1;depth<=2;depth++){
739 if((Statistic=
hb_data[
eta+42][
phi-1][depth-1].get_statistics())>100){
740 Eta=
eta; Phi=
phi; Depth=depth;
747 sprintf(Subdet,
"HE");
748 for(
int eta=-29;
eta<=29;
eta++)
for(
int phi=1;
phi<=72;
phi++)
for(
int depth=1;depth<=3;depth++){
749 if((Statistic=
he_data[
eta+42][
phi-1][depth-1].get_statistics())>100){
750 Eta=
eta; Phi=
phi; Depth=depth;
757 sprintf(Subdet,
"HO");
758 for(
int eta=-15;
eta<=15;
eta++)
for(
int phi=1;
phi<=72;
phi++)
for(
int depth=4;depth<=4;depth++){
759 if((Statistic=
ho_data[
eta+42][
phi-1][depth-1].get_statistics())>100){
760 Eta=
eta; Phi=
phi; Depth=depth;
767 sprintf(Subdet,
"HF");
768 for(
int eta=-42;
eta<=42;
eta++)
for(
int phi=1;
phi<=72;
phi++)
for(
int depth=1;depth<=2;depth++){
769 if((Statistic=
hf_data[
eta+42][
phi-1][depth-1].get_statistics())>100){
770 Eta=
eta; Phi=
phi; Depth=depth;
777 sprintf(Subdet,
"CALIB_HB");
780 Eta=
eta; Phi=
phi; Depth=0;
787 sprintf(Subdet,
"CALIB_HE");
790 Eta=
eta; Phi=
phi; Depth=0;
797 sprintf(Subdet,
"CALIB_HO");
800 Eta=
eta; Phi=
phi; Depth=0;
807 sprintf(Subdet,
"CALIB_HF");
810 Eta=
eta; Phi=
phi; Depth=0;
824 Long_t
t; t=
time(0); strftime(TIME,30,
"%F %T",localtime(&t));
829 xmlFile.open(xmlName.c_str());
831 xmlFile<<
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
833 xmlFile<<
" <HEADER>\n";
834 xmlFile<<
" <HINTS mode='only-det-root'/>\n";
835 xmlFile<<
" <TYPE>\n";
836 xmlFile<<
" <EXTENSION_TABLE_NAME>HCAL_DETMON_LED_LASER_V1</EXTENSION_TABLE_NAME>\n";
837 xmlFile<<
" <NAME>HCAL LED [local]</NAME>\n";
838 xmlFile<<
" </TYPE>\n";
839 xmlFile<<
" <!-- run details -->\n";
841 xmlFile<<
" <RUN_TYPE>LOCAL-RUN</RUN_TYPE>\n";
842 xmlFile<<
" <RUN_NUMBER>"<<
run_number<<
"</RUN_NUMBER>\n";
843 xmlFile<<
" <RUN_BEGIN_TIMESTAMP>2009-01-01 00:00:00</RUN_BEGIN_TIMESTAMP>\n";
844 xmlFile<<
" <COMMENT_DESCRIPTION>hcal LED data</COMMENT_DESCRIPTION>\n";
845 xmlFile<<
" <LOCATION>P5</LOCATION>\n";
846 xmlFile<<
" <INITIATED_BY_USER>dma</INITIATED_BY_USER>\n";
847 xmlFile<<
" </RUN>\n";
848 xmlFile<<
" </HEADER>\n";
849 xmlFile<<
" <DATA_SET>\n";
850 xmlFile<<
" <!-- optional dataset metadata -->\n\n";
852 xmlFile<<
" <SET_BEGIN_TIMESTAMP>2009-01-01 00:00:00</SET_BEGIN_TIMESTAMP>\n";
853 xmlFile<<
" <SET_END_TIMESTAMP>2009-01-01 00:00:00</SET_END_TIMESTAMP>\n";
854 xmlFile<<
" <NUMBER_OF_EVENTS_IN_SET>"<<
ievt_<<
"</NUMBER_OF_EVENTS_IN_SET>\n";
855 xmlFile<<
" <COMMENT_DESCRIPTION>Automatic DQM output</COMMENT_DESCRIPTION>\n";
856 xmlFile<<
" <DATA_FILE_NAME>"<< xmlName <<
"</DATA_FILE_NAME>\n";
857 xmlFile<<
" <IMAGE_FILE_NAME>data plot url or file path</IMAGE_FILE_NAME>\n";
858 xmlFile<<
" <!-- who and when created this dataset-->\n\n";
859 xmlFile<<
" <CREATE_TIMESTAMP>"<<TIME<<
"</CREATE_TIMESTAMP>\n";
860 xmlFile<<
" <CREATED_BY_USER>dma</CREATED_BY_USER>\n";
861 xmlFile<<
" <!-- version (string) and subversion (number) -->\n";
862 xmlFile<<
" <!-- fields are used to read data back from the database -->\n\n";
863 xmlFile<<
" <VERSION>"<<run_number<<dataset_seq_number<<
"</VERSION>\n";
864 xmlFile<<
" <SUBVERSION>1</SUBVERSION>\n";
865 xmlFile<<
" <!-- Assign predefined dataset attributes -->\n\n";
866 xmlFile<<
" <PREDEFINED_ATTRIBUTES>\n";
867 xmlFile<<
" <ATTRIBUTE>\n";
868 xmlFile<<
" <NAME>HCAL Dataset Status</NAME>\n";
869 xmlFile<<
" <VALUE>VALID</VALUE>\n";
870 xmlFile<<
" </ATTRIBUTE>\n";
871 xmlFile<<
" </PREDEFINED_ATTRIBUTES>\n";
872 xmlFile<<
" <!-- multiple data block records -->\n\n";
875 for(std::vector <HcalElectronicsId>::iterator eid = AllElIds.begin(); eid != AllElIds.end(); eid++){
879 if(!(!(gid.null()) &&
891 double e=0,e_rms=0,t=0,t_rms=0;
917 xmlFile<<
" <DATA>\n";
918 xmlFile<<
" <NUMBER_OF_EVENTS_USED>"<<Statistic<<
"</NUMBER_OF_EVENTS_USED>\n";
919 xmlFile<<
" <SIGNAL_MEAN>"<<e<<
"</SIGNAL_MEAN>\n";
920 xmlFile<<
" <SIGNAL_RMS>"<<e_rms<<
"</SIGNAL_RMS>\n";
921 xmlFile<<
" <TIME_MEAN>"<<t<<
"</TIME_MEAN>\n";
922 xmlFile<<
" <TIME_RMS>"<<t_rms<<
"</TIME_RMS>\n";
923 xmlFile<<
" <CHANNEL_STATUS_WORD>"<<Status<<
"</CHANNEL_STATUS_WORD>\n";
924 xmlFile<<
" <CHANNEL_OBJECTNAME>HcalDetId</CHANNEL_OBJECTNAME>\n";
925 xmlFile<<
" <SUBDET>"<<subdet<<
"</SUBDET>\n";
926 xmlFile<<
" <IETA>"<<eta<<
"</IETA>\n";
927 xmlFile<<
" <IPHI>"<<phi<<
"</IPHI>\n";
928 xmlFile<<
" <DEPTH>"<<depth<<
"</DEPTH>\n";
929 xmlFile<<
" <TYPE>0</TYPE>\n";
930 xmlFile<<
" </DATA>\n";
933 xmlFile<<
" </DATA_SET>\n";
934 xmlFile<<
"</ROOT>\n";
938 sprintf(str,
"HcalDetDiagLEDCalib_%i_%i.xml",run_number,dataset_seq_number);
940 std::ofstream xmlFileCalib;
941 xmlFileCalib.open(xmlNameCalib.c_str());
943 xmlFileCalib<<
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
944 xmlFileCalib<<
"<ROOT>\n";
945 xmlFileCalib<<
" <HEADER>\n";
946 xmlFileCalib<<
" <HINTS mode='only-det-root'/>\n";
947 xmlFileCalib<<
" <TYPE>\n";
948 xmlFileCalib<<
" <EXTENSION_TABLE_NAME>HCAL_DETMON_LED_LASER_V1</EXTENSION_TABLE_NAME>\n";
949 xmlFileCalib<<
" <NAME>HCAL LED CALIB [local]</NAME>\n";
950 xmlFileCalib<<
" </TYPE>\n";
951 xmlFileCalib<<
" <!-- run details -->\n";
952 xmlFileCalib<<
" <RUN>\n";
953 xmlFileCalib<<
" <RUN_TYPE>LOCAL-RUN</RUN_TYPE>\n";
954 xmlFileCalib<<
" <RUN_NUMBER>"<<run_number<<
"</RUN_NUMBER>\n";
955 xmlFileCalib<<
" <RUN_BEGIN_TIMESTAMP>2009-01-01 00:00:00</RUN_BEGIN_TIMESTAMP>\n";
956 xmlFileCalib<<
" <COMMENT_DESCRIPTION>hcal LED CALIB data</COMMENT_DESCRIPTION>\n";
957 xmlFileCalib<<
" <LOCATION>P5</LOCATION>\n";
958 xmlFileCalib<<
" <INITIATED_BY_USER>dma</INITIATED_BY_USER>\n";
959 xmlFileCalib<<
" </RUN>\n";
960 xmlFileCalib<<
" </HEADER>\n";
961 xmlFileCalib<<
" <DATA_SET>\n";
962 xmlFileCalib<<
" <!-- optional dataset metadata -->\n\n";
963 xmlFileCalib<<
" <SET_NUMBER>"<<dataset_seq_number<<
"</SET_NUMBER>\n";
964 xmlFileCalib<<
" <SET_BEGIN_TIMESTAMP>2009-01-01 00:00:00</SET_BEGIN_TIMESTAMP>\n";
965 xmlFileCalib<<
" <SET_END_TIMESTAMP>2009-01-01 00:00:00</SET_END_TIMESTAMP>\n";
966 xmlFileCalib<<
" <NUMBER_OF_EVENTS_IN_SET>"<<ievt_<<
"</NUMBER_OF_EVENTS_IN_SET>\n";
967 xmlFileCalib<<
" <COMMENT_DESCRIPTION>Automatic DQM output</COMMENT_DESCRIPTION>\n";
968 xmlFileCalib<<
" <DATA_FILE_NAME>"<< xmlNameCalib <<
"</DATA_FILE_NAME>\n";
969 xmlFileCalib<<
" <IMAGE_FILE_NAME>data plot url or file path</IMAGE_FILE_NAME>\n";
970 xmlFileCalib<<
" <!-- who and when created this dataset-->\n\n";
971 xmlFileCalib<<
" <CREATE_TIMESTAMP>"<<TIME<<
"</CREATE_TIMESTAMP>\n";
972 xmlFileCalib<<
" <CREATED_BY_USER>dma</CREATED_BY_USER>\n";
973 xmlFileCalib<<
" <!-- version (string) and subversion (number) -->\n";
974 xmlFileCalib<<
" <!-- fields are used to read data back from the database -->\n\n";
975 xmlFileCalib<<
" <VERSION>"<<run_number<<dataset_seq_number<<
"</VERSION>\n";
976 xmlFileCalib<<
" <SUBVERSION>1</SUBVERSION>\n";
977 xmlFileCalib<<
" <!-- Assign predefined dataset attributes -->\n\n";
978 xmlFileCalib<<
" <PREDEFINED_ATTRIBUTES>\n";
979 xmlFileCalib<<
" <ATTRIBUTE>\n";
980 xmlFileCalib<<
" <NAME>HCAL Dataset Status</NAME>\n";
981 xmlFileCalib<<
" <VALUE>VALID</VALUE>\n";
982 xmlFileCalib<<
" </ATTRIBUTE>\n";
983 xmlFileCalib<<
" </PREDEFINED_ATTRIBUTES>\n";
984 xmlFileCalib<<
" <!-- multiple data block records -->\n\n";
988 if(
sd==1) subdet=
"HB";
989 if(
sd==2) subdet=
"HE";
990 if(
sd==3) subdet=
"HO";
991 if(
sd==4) subdet=
"HF";
993 double e=0,e_rms=0,t=0,t_rms=0;
998 xmlFileCalib<<
" <DATA>\n";
999 xmlFileCalib<<
" <NUMBER_OF_EVENTS_USED>"<<Statistic<<
"</NUMBER_OF_EVENTS_USED>\n";
1000 xmlFileCalib<<
" <SIGNAL_MEAN>"<<e<<
"</SIGNAL_MEAN>\n";
1001 xmlFileCalib<<
" <SIGNAL_RMS>"<<e_rms<<
"</SIGNAL_RMS>\n";
1002 xmlFileCalib<<
" <TIME_MEAN>"<<t<<
"</TIME_MEAN>\n";
1003 xmlFileCalib<<
" <TIME_RMS>"<<t_rms<<
"</TIME_RMS>\n";
1004 xmlFileCalib<<
" <CHANNEL_STATUS_WORD>"<<Status<<
"</CHANNEL_STATUS_WORD>\n";
1005 xmlFileCalib<<
" <CHANNEL_OBJECTNAME>HcalDetId</CHANNEL_OBJECTNAME>\n";
1006 xmlFileCalib<<
" <SUBDET>"<<subdet<<
"</SUBDET>\n";
1007 xmlFileCalib<<
" <IETA>"<<
eta<<
"</IETA>\n";
1008 xmlFileCalib<<
" <IPHI>"<<
phi<<
"</IPHI>\n";
1009 xmlFileCalib<<
" <DEPTH>"<<0<<
"</DEPTH>\n";
1010 xmlFileCalib<<
" <TYPE>0</TYPE>\n";
1011 xmlFileCalib<<
" </DATA>\n";
1015 xmlFileCalib<<
" </DATA_SET>\n";
1016 xmlFileCalib<<
"</ROOT>\n";
1017 xmlFileCalib.close();
1019 sprintf(str,
"zip %s.zip %s %s",xmlName.c_str(),xmlName.c_str(),xmlNameCalib.c_str());
1021 sprintf(str,
"rm -f %s %s",xmlName.c_str(),xmlNameCalib.c_str());
1023 sprintf(str,
"mv -f %s.zip %s",xmlName.c_str(),
XmlFilePath.c_str());
1038 if(!f->IsOpen())
return ;
1039 TObjString *STR=(TObjString *)f->Get(
"run number");
1041 TTree*
t=(TTree*)f->Get(
"HCAL LED data");
1043 t->SetBranchAddress(
"Subdet", subdet);
1044 t->SetBranchAddress(
"eta", &Eta);
1045 t->SetBranchAddress(
"phi", &Phi);
1046 t->SetBranchAddress(
"depth", &Depth);
1047 t->SetBranchAddress(
"led", &led);
1048 t->SetBranchAddress(
"rms", &rms);
1049 for(
int ievt=0;ievt<t->GetEntries();ievt++){
1065 for(
int i=0;
i<4;
i++){
1076 for (std::vector <HcalElectronicsId>::iterator eid = AllElIds.begin(); eid != AllElIds.end(); eid++) {
1080 if(!(!(gid.null()) &&
1101 if(stat>0 && stat!=(
ievt_)){
1105 if(
hb_data[eta+42][
phi-1][depth-1].get_statistics()>100){
1109 if((AVE_TIME-ave)>0.75 || (AVE_TIME-ave)<-0.75){
1127 if(stat>0 && stat!=(
ievt_)){
1131 if(
he_data[eta+42][
phi-1][depth-1].get_statistics()>100){
1135 if((AVE_TIME-ave)>0.75 || (AVE_TIME-ave)<-0.75){
1153 if(stat>0 && stat!=(
ievt_)){
1157 if(
ho_data[eta+42][
phi-1][depth-1].get_statistics()>100){
1161 if((AVE_TIME-ave)>0.75 || (AVE_TIME-ave)<-0.75){
1180 if(stat>0 && stat!=(
ievt_)){
1184 if(
hf_data[eta+42][
phi-1][depth-1].get_statistics()>100){
1188 if((AVE_TIME-ave)>0.75 || (AVE_TIME-ave)<-0.75){
1203 if (subdet.compare(
"HB")==0) subdetval=(
int)
HcalBarrel;
1204 else if (subdet.compare(
"HE")==0) subdetval=(
int)
HcalEndcap;
1205 else if (subdet.compare(
"HO")==0) subdetval=(
int)
HcalOuter;
1206 else if (subdet.compare(
"HF")==0) subdetval=(
int)
HcalForward;
1209 int ietabin=
CalcEtaBin(subdetval, eta, depth)+1;
1216 if (subdet.compare(
"HB")==0) subdetval=(
int)
HcalBarrel;
1217 else if (subdet.compare(
"HE")==0) subdetval=(
int)
HcalEndcap;
1218 else if (subdet.compare(
"HO")==0) subdetval=(
int)
HcalOuter;
1219 else if (subdet.compare(
"HF")==0) subdetval=(
int)
HcalForward;
1222 int ietabin=
CalcEtaBin(subdetval, eta, depth)+1;
1230 if (subdet.compare(
"HB")==0) subdetval=(
int)
HcalBarrel;
1231 else if (subdet.compare(
"HE")==0) subdetval=(
int)
HcalEndcap;
1232 else if (subdet.compare(
"HO")==0) subdetval=(
int)
HcalOuter;
1233 else if (subdet.compare(
"HF")==0) subdetval=(
int)
HcalForward;
1235 int ietabin=
CalcEtaBin(subdetval, eta, depth)+1;
EtaPhiHists * ChannelStatusMissingChannels
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< HcalTBTriggerData > tok_tb_
edm::Ref< Container > Ref
std::string OutputFilePath
std::vector< HcalElectronicsId > allElectronicsIdPrecision() const
HcalDetDiagLEDData hb_data[85][72][4]
virtual void analyze(const edm::Event &e, const edm::EventSetup &c)
std::string ReferenceData
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
EtaPhiHists * ChannelStatusTimeMean
#define DEFINE_FWK_MODULE(type)
bool get_average_led(double *ave, double *rms)
std::vector< int > AllowedCalibTypes_
std::vector< HBHEDataFrame >::const_iterator const_iterator
void setup(DQMStore *&m_dbe, std::string Name, std::string Units="")
edm::EDGetTokenT< HcalCalibDigiCollection > tok_calib_
EtaPhiHists * ChannelStatusLEDMean
const Item * getValues(DetId fId, bool throwOnFail=true) const
double GetEnergy(double *data, int n)
void fill_channel_status(std::string subdet, int eta, int phi, int depth, int type, double status)
void getLogicalMap(const edm::EventSetup &c)
EtaPhiHists * ChannelStatusTimeRMS
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
static const float adc2fC[128]
double GetTime(double *data, int n=10)
HcalDetDiagLEDData hf_data[85][72][4]
HcalDetDiagLEDData * GetCalib(std::string sd, int eta, int phi)
MonitorElement * EnergyRMSHF
bool get_reference(double *val, double *rms)
EtaPhiHists * ChannelStatusUnstableChannels
uint32_t rawId() const
get the raw id
EtaPhiHists * ChannelsLEDEnergyRef
bool isSiPM(int ieta, int iphi, int depth)
int depth() const
get the tower depth
MVATrainerComputer * calib
HcalElectronicsMap generateHcalElectronicsMap()
std::vector< MonitorElement * > depth
virtual void beginRun(const edm::Run &run, const edm::EventSetup &c)
edm::EDGetTokenT< HFDigiCollection > tok_hf_
void removeContents(void)
erase all monitoring elements in current directory (not including subfolders);
MonitorElement * EnergyCorr
MonitorElement * bookString(const char *name, const char *value)
Book string.
HcalDetDiagLEDData ho_data[85][72][4]
std::vector< DetId > getAllChannels() const
HcalLogicalMap * logicalMap_
int ieta() const
get the cell ieta
HcalElectronicsMap * emap
Abs< T >::type abs(const T &t)
EtaPhiHists * ChannelStatusUnstableLEDsignal
MonitorElement * EnergyRMS
HcalDetDiagLEDMonitor(const edm::ParameterSet &ps)
void endRun(const edm::Run &run, const edm::EventSetup &c) override
void add_statistics(double *data, int nTS)
MonitorElement * EnergyHF
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
void beginRun(const edm::Run &run, const edm::EventSetup &c) override
MonitorElement * Energy2Dho
bool get_average_time(double *ave, double *rms)
MonitorElement * TimeRMSHF
const HcalFrontEndId getHcalFrontEndId(const DetId &)
MonitorElement * Time2Dhbhehf
int iphi() const
get the cell iphi
T const * product() const
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
MonitorElement * Time2Dho
bool xmlFile(const std::string fParam)
int CalcEtaBin(int subdet, int ieta, int depth)
HcalDetDiagLEDData calib_data[5][5][72]
void fill_energy(std::string subdet, int eta, int phi, int depth, double e, int type)
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
HcalDetDiagLEDData he_data[85][72][4]
char data[epos_bytes_allocation]
EtaPhiHists * ChannelStatusLEDRMS
std::map< unsigned int, int > KnownBadCells_
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
void change_status(int val)
double get_energy(std::string subdet, int eta, int phi, int depth, int type)
MonitorElement * bookInt(const char *name)
Book int.
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Detector det() const
get the detector field from this detid
EtaPhiHists * ChannelsLEDEnergy
MonitorElement * Energy2Dhbhehf
void Reset(void)
reset ME (ie. contents, errors, etc)
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
void setCurrentFolder(const std::string &fullpath)
void set_reference(float val, float rms)
edm::EDGetTokenT< HODigiCollection > tok_ho_