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]; }
131 if(sd.compare(
"HB")==0) SD=1;
132 if(sd.compare(
"HE")==0) SD=2;
133 if(sd.compare(
"HO")==0) SD=3;
134 if(sd.compare(
"HF")==0) SD=4;
136 if(eta>0)
ETA=1;
else ETA=-1;
137 if(phi==71 ||phi==72 || phi==1 || phi==2)
PHI=71;
else PHI=((phi-3)/4)*4+3;
141 if(phi==71 ||phi==72 || phi==1 || phi==2 || phi==3 || phi==4)
PHI=71;
else PHI=((phi-5)/6)*6+5;
146 if(phi==71 ||phi==72 || (phi>=1 && phi<=10))
PHI=71;
else PHI=((phi-11)/12)*12+11;
149 if(eta>0)
ETA=1;
else ETA=-1;
150 if(phi>=1 && phi<=18)
PHI=1;
151 if(phi>=19 && phi<=36)
PHI=19;
152 if(phi>=37 && phi<=54)
PHI=37;
153 if(phi>=55 && phi<=72)
PHI=55;
224 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,
225 13.5,15.,17.,19.,21.,23.,25.,27.,29.5,32.5,35.5,38.5,42.,46.,50.,54.5,59.5,
226 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,
227 124.5,129.5,137.,147.,157.,167.,177.,187.,197.,209.5,224.5,239.5,254.5,272.,
228 292.,312.,334.5,359.5,384.5,359.5,384.5,409.5,434.5,459.5,484.5,509.5,534.5,
229 559.5,584.5,609.5,634.5,659.5,684.5,709.5,747.,797.,847.,897.,947.,997.,
230 1047.,1109.5,1184.5,1259.5,1334.5,1422.,1522.,1622.,1734.5,1859.5,1984.5,
231 1859.5,1984.5,2109.5,2234.5,2359.5,2484.5,2609.5,2734.5,2859.5,2984.5,
232 3109.5,3234.5,3359.5,3484.5,3609.5,3797.,4047.,4297.,4547.,4797.,5047.,
233 5297.,5609.5,5984.5,6359.5,6734.5,7172.,7672.,8172.,8734.5,9359.5,9984.5};
250 if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!=
"/")
251 prefixME_.append(
"/");
285 if (
debug_>1)
std::cout <<
"HcalDetDiagLEDMonitor::beginRun"<<std::endl;
297 for (std::vector<DetId>::const_iterator
i = mydetids.begin();
i!=mydetids.end();++
i){
324 name=
"HBHEHO LED Energy Distribution";
Energy =
dbe_->
book1D(name,name,200,0,3000);
325 name=
"HBHEHO LED Timing Distribution";
Time =
dbe_->
book1D(name,name,200,0,10);
326 name=
"HBHEHO LED Energy RMS_div_Energy Distribution";
EnergyRMS =
dbe_->
book1D(name,name,200,0,0.2);
327 name=
"HBHEHO LED Timing RMS Distribution";
TimeRMS =
dbe_->
book1D(name,name,200,0,0.4);
329 name=
"HF LED Timing Distribution";
TimeHF =
dbe_->
book1D(name,name,200,0,10);
338 name=
"HBP Average over HPD LED Ref";
HBPphi =
dbe_->
book2D(name,name,180,1,73,400,0,2);
339 name=
"HBM Average over HPD LED Ref";
HBMphi =
dbe_->
book2D(name,name,180,1,73,400,0,2);
340 name=
"HEP Average over HPD LED Ref";
HEPphi =
dbe_->
book2D(name,name,180,1,73,400,0,2);
341 name=
"HEM Average over HPD LED Ref";
HEMphi =
dbe_->
book2D(name,name,180,1,73,400,0,2);
342 name=
"HFP Average over RM LED Ref";
HFPphi =
dbe_->
book2D(name,name,180,1,37,400,0,2);
343 name=
"HFM Average over RM LED Ref";
HFMphi =
dbe_->
book2D(name,name,180,1,37,400,0,2);
344 name=
"HO0 Average over HPD LED Ref";
HO0phi =
dbe_->
book2D(name,name,180,1,49,400,0,2);
345 name=
"HO1P Average over HPD LED Ref";
HO1Pphi=
dbe_->
book2D(name,name,180,1,49,400,0,2);
346 name=
"HO2P Average over HPD LED Ref";
HO2Pphi=
dbe_->
book2D(name,name,180,1,49,400,0,2);
347 name=
"HO1M Average over HPD LED Ref";
HO1Mphi=
dbe_->
book2D(name,name,180,1,49,400,0,2);
348 name=
"HO2M Average over HPD LED Ref";
HO2Mphi=
dbe_->
book2D(name,name,180,1,49,400,0,2);
387 if(trigger_data->triggerWord()==6){ LEDEvent=
true;LocalRun=
true;}
389 if(!LocalRun)
return;
390 if(!LEDEvent)
return;
402 eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
404 for(
int i=0;
i<nTS;
i++) data[
i]=
adc2fC[digi->sample(
i).adc()&0xff]-2.5;
408 for(
int i=0;
i<nTS;
i++) data[
i]=
adc2fC[digi->sample(
i).adc()&0xff]-2.5;
416 eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
417 for(
int i=0;
i<nTS;
i++) data[
i]=
adc2fC[digi->sample(
i).adc()&0xff]-2.5;
424 eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
425 for(
int i=0;
i<nTS;
i++) data[
i]=
adc2fC[digi->sample(
i).adc()&0xff]-2.5;
432 if(digi->id().cboxChannel()!=0 || digi->id().hcalSubdet()==0)
continue;
435 for(
int i=0;
i<nTS;
i++){ data[
i]=
adc2fC[digi->sample(
i).adc()&0xff]; e+=data[
i];}
439 if(((
ievt_)%500)==0){
448 std::string subdet[4]={
"HB",
"HE",
"HO",
"HF"};
476 double T=0,nT=0,E=0,nE=0;
477 for(
int depth=1;depth<=2;depth++){
489 T+=
time; nT++; E+=ave; nE++;
503 double T=0,nT=0,E=0,nE=0;
504 for(
int depth=1;depth<=3;depth++){
515 T+=
time; nT++; E+=ave; nE++;
531 double T=0,nT=0,E=0,nE=0;
532 for(
int depth=1;depth<=2;depth++){
543 T+=
time; nT++; E+=ave; nE++;
559 double T=0,nT=0,E=0,nE=0;
561 for(
int depth=4;depth<=4;depth++){
572 T+=
time; nT++; E+=ave; nE++;
586 double ave=0.,
rms=0.,ave_calib=0.,rms_calib=0.;
588 for(
int eta=-16;
eta<=16;
eta++)
for(
int phi=1;
phi<=72;
phi++)
for(
int depth=1;depth<=2;depth++){
594 for(
int eta=-29;
eta<=29;
eta++)
for(
int phi=1;
phi<=72;
phi++)
for(
int depth=1;depth<=3;depth++){
600 for(
int eta=-10;
eta<=15;
eta++)
for(
int phi=1;
phi<=72;
phi++)
for(
int depth=4;depth<=4;depth++){
607 for(
int eta=-42;
eta<=42;
eta++)
for(
int phi=1;
phi<=72;
phi++)
for(
int depth=1;depth<=2;depth++){
614 double hbp[18][4],nhbp[18][4],hbm[18][4],nhbm[18][4];
615 double hep[18][4],nhep[18][4],hem[18][4],nhem[18][4];
616 double hfp[18][4],nhfp[18][4],hfm[18][4],nhfm[18][4];
617 double ho0[18][4],nho0[18][4];
618 double ho1p[18][4],nho1p[18][4];
619 double ho2p[18][4],nho2p[18][4];
620 double ho1m[18][4],nho1m[18][4];
621 double ho2m[18][4],nho2m[18][4];
622 for(
int i=0;
i<18;
i++)
for(
int j=0;
j<4;
j++)
623 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;
624 for(
int i=0;
i<18;
i++)
for(
int j=0;
j<4;
j++)
625 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;
628 for(std::vector <HcalElectronicsId>::iterator eid = AllElIds.begin(); eid != AllElIds.end(); eid++){
632 if(!(!(gid.null()) &&
654 if(sd==0 || sd==1 || sd==3){
655 sscanf(&(lmap_entry.
rbx().c_str())[3],
"%d",&rbx);
657 if(
abs(
eta)<5) sscanf(&(lmap_entry.
rbx().c_str())[3],
"%d",&rbx);
658 if(
abs(
eta)>=5) sscanf(&(lmap_entry.
rbx().c_str())[4],
"%d",&rbx);
661 if(sd==0 &&
eta>0){ hbp[rbx-1][lmap_entry.
rm()-1]+=ave/ref; nhbp[rbx-1][lmap_entry.
rm()-1]++; }
662 if(sd==0 &&
eta<0){ hbm[rbx-1][lmap_entry.
rm()-1]+=ave/ref; nhbm[rbx-1][lmap_entry.
rm()-1]++; }
663 if(sd==1 &&
eta>0){ hep[rbx-1][lmap_entry.
rm()-1]+=ave/ref; nhep[rbx-1][lmap_entry.
rm()-1]++; }
664 if(sd==1 &&
eta<0){ hem[rbx-1][lmap_entry.
rm()-1]+=ave/ref; nhem[rbx-1][lmap_entry.
rm()-1]++; }
665 if(sd==3 &&
eta>0){ hfp[rbx-1][lmap_entry.
rm()-1]+=ave/ref; nhfp[rbx-1][lmap_entry.
rm()-1]++; }
666 if(sd==3 &&
eta<0){ hfm[rbx-1][lmap_entry.
rm()-1]+=ave/ref; nhfm[rbx-1][lmap_entry.
rm()-1]++; }
667 if(sd==2 &&
abs(
eta)<5){ ho0[rbx-1][lmap_entry.
rm()-1]+=ave/ref; nho0[rbx-1][lmap_entry.
rm()-1]++; }
668 if(sd==2 &&
eta>=5 &&
eta<=10){ ho1p[rbx-1][lmap_entry.
rm()-1]+=ave/ref; nho1p[rbx-1][lmap_entry.
rm()-1]++; }
669 if(sd==2 &&
eta>=11 &&
eta<=15){ ho2p[rbx-1][lmap_entry.
rm()-1]+=ave/ref; nho2p[rbx-1][lmap_entry.
rm()-1]++; }
670 if(sd==2 &&
eta>=-10 &&
eta<=-5){ ho1m[rbx-1][lmap_entry.
rm()-1]+=ave/ref; nho1m[rbx-1][lmap_entry.
rm()-1]++; }
671 if(sd==2 &&
eta>=-15 &&
eta<=-11){ ho2m[rbx-1][lmap_entry.
rm()-1]+=ave/ref; nho2m[rbx-1][lmap_entry.
rm()-1]++; }
674 for(
int i=0;
i<18;
i++)
for(
int j=0;
j<4;
j++){
681 for(
int i=0;
i<12;
i++)
for(
int j=0;
j<3;
j++){
686 for(
int i=0;
i<12;
i++)
for(
int j=0;
j<4;
j++){
699 char Subdet[10],str[500];
701 TFile *
theFile =
new TFile(str,
"RECREATE");
702 if(!theFile->IsOpen())
return;
704 sprintf(str,
"%d",
run_number); TObjString
run(str); run.Write(
"run number");
705 sprintf(str,
"%d",
ievt_); TObjString
events(str); events.Write(
"Total events processed");
707 TTree *
tree =
new TTree(
"HCAL LED data",
"HCAL LED data");
709 tree->Branch(
"Subdet", &Subdet,
"Subdet/C");
710 tree->Branch(
"eta", &Eta,
"Eta/I");
711 tree->Branch(
"phi", &Phi,
"Phi/I");
712 tree->Branch(
"depth", &Depth,
"Depth/I");
713 tree->Branch(
"statistic",&Statistic,
"Statistic/I");
714 tree->Branch(
"status", &Status,
"Status/I");
715 tree->Branch(
"led", &led,
"led/D");
716 tree->Branch(
"rms", &rms,
"rms/D");
717 tree->Branch(
"time", &Time,
"time/D");
718 tree->Branch(
"time_rms", &time_rms,
"time_rms/D");
719 sprintf(Subdet,
"HB");
720 for(
int eta=-16;
eta<=16;
eta++)
for(
int phi=1;
phi<=72;
phi++)
for(
int depth=1;depth<=2;depth++){
721 if((Statistic=
hb_data[
eta+42][
phi-1][depth-1].get_statistics())>100){
722 Eta=
eta; Phi=
phi; Depth=depth;
729 sprintf(Subdet,
"HE");
730 for(
int eta=-29;
eta<=29;
eta++)
for(
int phi=1;
phi<=72;
phi++)
for(
int depth=1;depth<=3;depth++){
731 if((Statistic=
he_data[
eta+42][
phi-1][depth-1].get_statistics())>100){
732 Eta=
eta; Phi=
phi; Depth=depth;
739 sprintf(Subdet,
"HO");
740 for(
int eta=-15;
eta<=15;
eta++)
for(
int phi=1;
phi<=72;
phi++)
for(
int depth=4;depth<=4;depth++){
741 if((Statistic=
ho_data[
eta+42][
phi-1][depth-1].get_statistics())>100){
742 Eta=
eta; Phi=
phi; Depth=depth;
749 sprintf(Subdet,
"HF");
750 for(
int eta=-42;
eta<=42;
eta++)
for(
int phi=1;
phi<=72;
phi++)
for(
int depth=1;depth<=2;depth++){
751 if((Statistic=
hf_data[
eta+42][
phi-1][depth-1].get_statistics())>100){
752 Eta=
eta; Phi=
phi; Depth=depth;
759 sprintf(Subdet,
"CALIB_HB");
762 Eta=
eta; Phi=
phi; Depth=0;
769 sprintf(Subdet,
"CALIB_HE");
772 Eta=
eta; Phi=
phi; Depth=0;
779 sprintf(Subdet,
"CALIB_HO");
782 Eta=
eta; Phi=
phi; Depth=0;
789 sprintf(Subdet,
"CALIB_HF");
792 Eta=
eta; Phi=
phi; Depth=0;
806 Long_t
t; t=
time(0); strftime(TIME,30,
"%F %T",localtime(&t));
809 std::string xmlName=str;
811 xmlFile.open(xmlName.c_str());
813 xmlFile<<
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
815 xmlFile<<
" <HEADER>\n";
816 xmlFile<<
" <HINTS mode='only-det-root'/>\n";
817 xmlFile<<
" <TYPE>\n";
818 xmlFile<<
" <EXTENSION_TABLE_NAME>HCAL_DETMON_LED_LASER_V1</EXTENSION_TABLE_NAME>\n";
819 xmlFile<<
" <NAME>HCAL LED [local]</NAME>\n";
820 xmlFile<<
" </TYPE>\n";
821 xmlFile<<
" <!-- run details -->\n";
823 xmlFile<<
" <RUN_TYPE>LOCAL-RUN</RUN_TYPE>\n";
824 xmlFile<<
" <RUN_NUMBER>"<<
run_number<<
"</RUN_NUMBER>\n";
825 xmlFile<<
" <RUN_BEGIN_TIMESTAMP>2009-01-01 00:00:00</RUN_BEGIN_TIMESTAMP>\n";
826 xmlFile<<
" <COMMENT_DESCRIPTION>hcal LED data</COMMENT_DESCRIPTION>\n";
827 xmlFile<<
" <LOCATION>P5</LOCATION>\n";
828 xmlFile<<
" <INITIATED_BY_USER>dma</INITIATED_BY_USER>\n";
829 xmlFile<<
" </RUN>\n";
830 xmlFile<<
" </HEADER>\n";
831 xmlFile<<
" <DATA_SET>\n";
832 xmlFile<<
" <!-- optional dataset metadata -->\n\n";
834 xmlFile<<
" <SET_BEGIN_TIMESTAMP>2009-01-01 00:00:00</SET_BEGIN_TIMESTAMP>\n";
835 xmlFile<<
" <SET_END_TIMESTAMP>2009-01-01 00:00:00</SET_END_TIMESTAMP>\n";
836 xmlFile<<
" <NUMBER_OF_EVENTS_IN_SET>"<<
ievt_<<
"</NUMBER_OF_EVENTS_IN_SET>\n";
837 xmlFile<<
" <COMMENT_DESCRIPTION>Automatic DQM output</COMMENT_DESCRIPTION>\n";
838 xmlFile<<
" <DATA_FILE_NAME>"<< xmlName <<
"</DATA_FILE_NAME>\n";
839 xmlFile<<
" <IMAGE_FILE_NAME>data plot url or file path</IMAGE_FILE_NAME>\n";
840 xmlFile<<
" <!-- who and when created this dataset-->\n\n";
841 xmlFile<<
" <CREATE_TIMESTAMP>"<<TIME<<
"</CREATE_TIMESTAMP>\n";
842 xmlFile<<
" <CREATED_BY_USER>dma</CREATED_BY_USER>\n";
843 xmlFile<<
" <!-- version (string) and subversion (number) -->\n";
844 xmlFile<<
" <!-- fields are used to read data back from the database -->\n\n";
845 xmlFile<<
" <VERSION>"<<run_number<<dataset_seq_number<<
"</VERSION>\n";
846 xmlFile<<
" <SUBVERSION>1</SUBVERSION>\n";
847 xmlFile<<
" <!-- Assign predefined dataset attributes -->\n\n";
848 xmlFile<<
" <PREDEFINED_ATTRIBUTES>\n";
849 xmlFile<<
" <ATTRIBUTE>\n";
850 xmlFile<<
" <NAME>HCAL Dataset Status</NAME>\n";
851 xmlFile<<
" <VALUE>VALID</VALUE>\n";
852 xmlFile<<
" </ATTRIBUTE>\n";
853 xmlFile<<
" </PREDEFINED_ATTRIBUTES>\n";
854 xmlFile<<
" <!-- multiple data block records -->\n\n";
857 for(std::vector <HcalElectronicsId>::iterator eid = AllElIds.begin(); eid != AllElIds.end(); eid++){
861 if(!(!(gid.null()) &&
867 std::string subdet=
"";
873 double e=0,e_rms=0,t=0,t_rms=0;
899 xmlFile<<
" <DATA>\n";
900 xmlFile<<
" <NUMBER_OF_EVENTS_USED>"<<Statistic<<
"</NUMBER_OF_EVENTS_USED>\n";
901 xmlFile<<
" <SIGNAL_MEAN>"<<e<<
"</SIGNAL_MEAN>\n";
902 xmlFile<<
" <SIGNAL_RMS>"<<e_rms<<
"</SIGNAL_RMS>\n";
903 xmlFile<<
" <TIME_MEAN>"<<t<<
"</TIME_MEAN>\n";
904 xmlFile<<
" <TIME_RMS>"<<t_rms<<
"</TIME_RMS>\n";
905 xmlFile<<
" <CHANNEL_STATUS_WORD>"<<Status<<
"</CHANNEL_STATUS_WORD>\n";
906 xmlFile<<
" <CHANNEL_OBJECTNAME>HcalDetId</CHANNEL_OBJECTNAME>\n";
907 xmlFile<<
" <SUBDET>"<<subdet<<
"</SUBDET>\n";
908 xmlFile<<
" <IETA>"<<eta<<
"</IETA>\n";
909 xmlFile<<
" <IPHI>"<<phi<<
"</IPHI>\n";
910 xmlFile<<
" <DEPTH>"<<depth<<
"</DEPTH>\n";
911 xmlFile<<
" <TYPE>0</TYPE>\n";
912 xmlFile<<
" </DATA>\n";
915 xmlFile<<
" </DATA_SET>\n";
916 xmlFile<<
"</ROOT>\n";
920 sprintf(str,
"HcalDetDiagLEDCalib_%i_%i.xml",run_number,dataset_seq_number);
921 std::string xmlNameCalib=str;
922 ofstream xmlFileCalib;
923 xmlFileCalib.open(xmlNameCalib.c_str());
925 xmlFileCalib<<
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
926 xmlFileCalib<<
"<ROOT>\n";
927 xmlFileCalib<<
" <HEADER>\n";
928 xmlFileCalib<<
" <HINTS mode='only-det-root'/>\n";
929 xmlFileCalib<<
" <TYPE>\n";
930 xmlFileCalib<<
" <EXTENSION_TABLE_NAME>HCAL_DETMON_LED_LASER_V1</EXTENSION_TABLE_NAME>\n";
931 xmlFileCalib<<
" <NAME>HCAL LED CALIB [local]</NAME>\n";
932 xmlFileCalib<<
" </TYPE>\n";
933 xmlFileCalib<<
" <!-- run details -->\n";
934 xmlFileCalib<<
" <RUN>\n";
935 xmlFileCalib<<
" <RUN_TYPE>LOCAL-RUN</RUN_TYPE>\n";
936 xmlFileCalib<<
" <RUN_NUMBER>"<<run_number<<
"</RUN_NUMBER>\n";
937 xmlFileCalib<<
" <RUN_BEGIN_TIMESTAMP>2009-01-01 00:00:00</RUN_BEGIN_TIMESTAMP>\n";
938 xmlFileCalib<<
" <COMMENT_DESCRIPTION>hcal LED CALIB data</COMMENT_DESCRIPTION>\n";
939 xmlFileCalib<<
" <LOCATION>P5</LOCATION>\n";
940 xmlFileCalib<<
" <INITIATED_BY_USER>dma</INITIATED_BY_USER>\n";
941 xmlFileCalib<<
" </RUN>\n";
942 xmlFileCalib<<
" </HEADER>\n";
943 xmlFileCalib<<
" <DATA_SET>\n";
944 xmlFileCalib<<
" <!-- optional dataset metadata -->\n\n";
945 xmlFileCalib<<
" <SET_NUMBER>"<<dataset_seq_number<<
"</SET_NUMBER>\n";
946 xmlFileCalib<<
" <SET_BEGIN_TIMESTAMP>2009-01-01 00:00:00</SET_BEGIN_TIMESTAMP>\n";
947 xmlFileCalib<<
" <SET_END_TIMESTAMP>2009-01-01 00:00:00</SET_END_TIMESTAMP>\n";
948 xmlFileCalib<<
" <NUMBER_OF_EVENTS_IN_SET>"<<ievt_<<
"</NUMBER_OF_EVENTS_IN_SET>\n";
949 xmlFileCalib<<
" <COMMENT_DESCRIPTION>Automatic DQM output</COMMENT_DESCRIPTION>\n";
950 xmlFileCalib<<
" <DATA_FILE_NAME>"<< xmlNameCalib <<
"</DATA_FILE_NAME>\n";
951 xmlFileCalib<<
" <IMAGE_FILE_NAME>data plot url or file path</IMAGE_FILE_NAME>\n";
952 xmlFileCalib<<
" <!-- who and when created this dataset-->\n\n";
953 xmlFileCalib<<
" <CREATE_TIMESTAMP>"<<TIME<<
"</CREATE_TIMESTAMP>\n";
954 xmlFileCalib<<
" <CREATED_BY_USER>dma</CREATED_BY_USER>\n";
955 xmlFileCalib<<
" <!-- version (string) and subversion (number) -->\n";
956 xmlFileCalib<<
" <!-- fields are used to read data back from the database -->\n\n";
957 xmlFileCalib<<
" <VERSION>"<<run_number<<dataset_seq_number<<
"</VERSION>\n";
958 xmlFileCalib<<
" <SUBVERSION>1</SUBVERSION>\n";
959 xmlFileCalib<<
" <!-- Assign predefined dataset attributes -->\n\n";
960 xmlFileCalib<<
" <PREDEFINED_ATTRIBUTES>\n";
961 xmlFileCalib<<
" <ATTRIBUTE>\n";
962 xmlFileCalib<<
" <NAME>HCAL Dataset Status</NAME>\n";
963 xmlFileCalib<<
" <VALUE>VALID</VALUE>\n";
964 xmlFileCalib<<
" </ATTRIBUTE>\n";
965 xmlFileCalib<<
" </PREDEFINED_ATTRIBUTES>\n";
966 xmlFileCalib<<
" <!-- multiple data block records -->\n\n";
969 std::string subdet=
"";
970 if(
sd==1) subdet=
"HB";
971 if(
sd==2) subdet=
"HE";
972 if(
sd==3) subdet=
"HO";
973 if(
sd==4) subdet=
"HF";
975 double e=0,e_rms=0,t=0,t_rms=0;
980 xmlFileCalib<<
" <DATA>\n";
981 xmlFileCalib<<
" <NUMBER_OF_EVENTS_USED>"<<Statistic<<
"</NUMBER_OF_EVENTS_USED>\n";
982 xmlFileCalib<<
" <SIGNAL_MEAN>"<<e<<
"</SIGNAL_MEAN>\n";
983 xmlFileCalib<<
" <SIGNAL_RMS>"<<e_rms<<
"</SIGNAL_RMS>\n";
984 xmlFileCalib<<
" <TIME_MEAN>"<<t<<
"</TIME_MEAN>\n";
985 xmlFileCalib<<
" <TIME_RMS>"<<t_rms<<
"</TIME_RMS>\n";
986 xmlFileCalib<<
" <CHANNEL_STATUS_WORD>"<<Status<<
"</CHANNEL_STATUS_WORD>\n";
987 xmlFileCalib<<
" <CHANNEL_OBJECTNAME>HcalDetId</CHANNEL_OBJECTNAME>\n";
988 xmlFileCalib<<
" <SUBDET>"<<subdet<<
"</SUBDET>\n";
989 xmlFileCalib<<
" <IETA>"<<
eta<<
"</IETA>\n";
990 xmlFileCalib<<
" <IPHI>"<<
phi<<
"</IPHI>\n";
991 xmlFileCalib<<
" <DEPTH>"<<0<<
"</DEPTH>\n";
992 xmlFileCalib<<
" <TYPE>0</TYPE>\n";
993 xmlFileCalib<<
" </DATA>\n";
997 xmlFileCalib<<
" </DATA_SET>\n";
998 xmlFileCalib<<
"</ROOT>\n";
999 xmlFileCalib.close();
1001 sprintf(str,
"zip %s.zip %s %s",xmlName.c_str(),xmlName.c_str(),xmlNameCalib.c_str());
1003 sprintf(str,
"rm -f %s %s",xmlName.c_str(),xmlNameCalib.c_str());
1005 sprintf(str,
"mv -f %s.zip %s",xmlName.c_str(),
XmlFilePath.c_str());
1020 if(!f->IsOpen())
return ;
1021 TObjString *STR=(TObjString *)f->Get(
"run number");
1023 TTree*
t=(TTree*)f->Get(
"HCAL LED data");
1025 t->SetBranchAddress(
"Subdet", subdet);
1026 t->SetBranchAddress(
"eta", &Eta);
1027 t->SetBranchAddress(
"phi", &Phi);
1028 t->SetBranchAddress(
"depth", &Depth);
1029 t->SetBranchAddress(
"led", &led);
1030 t->SetBranchAddress(
"rms", &rms);
1031 for(
int ievt=0;ievt<t->GetEntries();ievt++){
1047 for(
int i=0;
i<4;
i++){
1058 for (std::vector <HcalElectronicsId>::iterator eid = AllElIds.begin(); eid != AllElIds.end(); eid++) {
1062 if(!(!(gid.null()) &&
1083 if(stat>0 && stat!=(
ievt_)){
1087 if(
hb_data[eta+42][
phi-1][depth-1].get_statistics()>100){
1091 if((AVE_TIME-ave)>0.75 || (AVE_TIME-ave)<-0.75){
1109 if(stat>0 && stat!=(
ievt_)){
1113 if(
he_data[eta+42][
phi-1][depth-1].get_statistics()>100){
1117 if((AVE_TIME-ave)>0.75 || (AVE_TIME-ave)<-0.75){
1135 if(stat>0 && stat!=(
ievt_)){
1139 if(
ho_data[eta+42][
phi-1][depth-1].get_statistics()>100){
1143 if((AVE_TIME-ave)>0.75 || (AVE_TIME-ave)<-0.75){
1162 if(stat>0 && stat!=(
ievt_)){
1166 if(
hf_data[eta+42][
phi-1][depth-1].get_statistics()>100){
1170 if((AVE_TIME-ave)>0.75 || (AVE_TIME-ave)<-0.75){
1185 if (subdet.compare(
"HB")==0) subdetval=(
int)
HcalBarrel;
1186 else if (subdet.compare(
"HE")==0) subdetval=(
int)
HcalEndcap;
1187 else if (subdet.compare(
"HO")==0) subdetval=(
int)
HcalOuter;
1188 else if (subdet.compare(
"HF")==0) subdetval=(
int)
HcalForward;
1191 int ietabin=
CalcEtaBin(subdetval, eta, depth)+1;
1198 if (subdet.compare(
"HB")==0) subdetval=(
int)
HcalBarrel;
1199 else if (subdet.compare(
"HE")==0) subdetval=(
int)
HcalEndcap;
1200 else if (subdet.compare(
"HO")==0) subdetval=(
int)
HcalOuter;
1201 else if (subdet.compare(
"HF")==0) subdetval=(
int)
HcalForward;
1204 int ietabin=
CalcEtaBin(subdetval, eta, depth)+1;
1212 if (subdet.compare(
"HB")==0) subdetval=(
int)
HcalBarrel;
1213 else if (subdet.compare(
"HE")==0) subdetval=(
int)
HcalEndcap;
1214 else if (subdet.compare(
"HO")==0) subdetval=(
int)
HcalOuter;
1215 else if (subdet.compare(
"HF")==0) subdetval=(
int)
HcalForward;
1217 int ietabin=
CalcEtaBin(subdetval, eta, depth)+1;
EtaPhiHists * ChannelStatusMissingChannels
MonitorElement * Time2Dhbhehf
MonitorElement * Time2Dho
T getUntrackedParameter(std::string const &, T const &) const
edm::Ref< Container > Ref
MonitorElement * EnergyRMS
std::string OutputFilePath
HcalLogicalMapGenerator * gen
std::vector< HcalElectronicsId > allElectronicsIdPrecision() const
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.
void endRun(const edm::Run &run, const edm::EventSetup &c)
EtaPhiHists ChannelsLEDEnergyRef
EtaPhiHists * ChannelStatusTimeMean
#define DEFINE_FWK_MODULE(type)
HcalLogicalMap createMap(unsigned int mapIOV=5)
bool get_average_led(double *ave, double *rms)
std::vector< int > AllowedCalibTypes_
EtaPhiHists ChannelStatusTimeRMS
std::vector< T >::const_iterator const_iterator
void setup(DQMStore *&m_dbe, std::string Name, std::string Units="")
HcalDetDiagLEDData * calib_data[5][5][72]
bool getByType(Handle< PROD > &result) const
EtaPhiHists * ChannelStatusLEDMean
double GetEnergy(double *data, int n)
void fill_channel_status(std::string subdet, int eta, int phi, int depth, int type, double status)
EtaPhiHists * ChannelStatusTimeRMS
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
double GetTime(double *data, int n=10)
HcalDetDiagLEDData * GetCalib(std::string sd, int eta, int phi)
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
HcalDetDiagLEDData * hb_data[85][72][4]
HcalElectronicsMap generateHcalElectronicsMap()
std::vector< MonitorElement * > depth
virtual void beginRun(const edm::Run &run, const edm::EventSetup &c)
void removeContents(void)
erase all monitoring elements in current directory (not including subfolders);
edm::InputTag calibDigiLabel_
EtaPhiHists ChannelStatusMissingChannels
MonitorElement * bookString(const char *name, const char *value)
Book string.
std::vector< DetId > getAllChannels() const
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup)
int ieta() const
get the cell ieta
EtaPhiHists * ChannelStatusUnstableLEDsignal
HcalDetDiagLEDMonitor(const edm::ParameterSet &ps)
HcalDetDiagLEDData * hf_data[85][72][4]
void add_statistics(double *data, int nTS)
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)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
static const float adc2fC[128]
bool get_average_time(double *ave, double *rms)
const HcalFrontEndId getHcalFrontEndId(const DetId &)
int iphi() const
get the cell iphi
EtaPhiHists ChannelStatusUnstableLEDsignal
T const * product() const
MonitorElement * EnergyHF
MonitorElement * Energy2Dho
EtaPhiHists ChannelStatusTimeMean
EtaPhiHists ChannelStatusLEDRMS
bool xmlFile(const std::string fParam)
int CalcEtaBin(int subdet, int ieta, int depth)
MonitorElement * Energy2Dhbhehf
void fill_energy(std::string subdet, int eta, int phi, int depth, double e, int type)
MonitorElement * EnergyRMSHF
MonitorElement * TimeRMSHF
char data[epos_bytes_allocation]
EtaPhiHists ChannelStatusUnstableChannels
MonitorElement * EnergyCorr
EtaPhiHists * ChannelStatusLEDRMS
HcalDetDiagLEDData * ho_data[85][72][4]
EtaPhiHists ChannelStatusLEDMean
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.
const Item * getValues(DetId fId) const
Detector det() const
get the detector field from this detid
EtaPhiHists * ChannelsLEDEnergy
void Reset(void)
reset ME (ie. contents, errors, etc)
EtaPhiHists ChannelsLEDEnergy
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
void setCurrentFolder(const std::string &fullpath)
HcalDetDiagLEDData * he_data[85][72][4]
void set_reference(float val, float rms)