13 if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!=
"/")
14 prefixME_.append(
"/");
66 for (
int s=0;
s<15;
s++) {
121 uint32_t itsspigot =0;
122 uint32_t itshtrchan=0;
125 for (std::vector <HcalElectronicsId>::iterator eid = AllElIds.begin();
126 eid != AllElIds.end();
132 if (!detid_.
null()) {
133 if (detid_.
det()!=4)
continue;
139 itsdcc =(uint32_t) eid->dccid();
140 itsspigot =(uint32_t) eid->spigot();
141 itshtrchan=(uint32_t) eid->htrChanId();
158 std::cout <<
"<HcalRawDataMonitor::setup> No DQMStore instance available. Bailing out."<<std::endl;
163 std::cout <<
"<HcalRawDataMonitor::beginRun> Setting up histograms"<<std::endl;
186 type =
"01 Common Data Format violations";
199 type =
"02 DCC Event Format violation";
209 type =
"04 HTR BCN when OrN Diff";
214 type =
"03 OrN NonZero Difference HTR - DCC";
218 type =
"03 OrN Inconsistent - HTR vs DCC";
223 type =
"05 BCN NonZero Difference HTR - DCC";
227 type =
"05 BCN Inconsistent - HTR vs DCC";
232 type =
"06 EvN NonZero Difference HTR - DCC";
236 type =
"06 EvN Inconsistent - HTR vs DCC";
246 type=
"07 LRB Data Corruption Indicators";
258 type=
"08 Half-HTR Data Corruption Indicators";
269 type =
"09 Channel Integrity Summarized by Spigot";
279 snprintf(label, 256,
"FED %03d Channel Integrity",
f+700);
288 type=
"DCC Event Counts";
291 type =
"BCN from DCCs";
296 type =
"BCN from HTRs";
301 type =
"DCC Data Block Size Distribution";
306 type =
"DCC Data Block Size Profile";
308 type =
"DCC Data Block Size Each FED";
318 type =
"01 Data Flow Indicators";
327 type =
"DCC Firmware Version";
331 type =
"HTR Status Word HBHE";
335 type =
"HTR Status Word HF";
339 type =
"HTR Status Word HO";
344 type =
"HTR Status Word by Crate";
349 type =
"Unpacking - HcalHTRData check failures";
354 type =
"HTR Fiber Orbit Message BCN";
358 type =
"HTR Status Word - Crate 0";
363 type =
"HTR Status Word - Crate 1";
368 type =
"HTR Status Word - Crate 2";
373 type =
"HTR Status Word - Crate 3";
378 type =
"HTR Status Word - Crate 4";
383 type =
"HTR Status Word - Crate 5";
388 type =
"HTR Status Word - Crate 6";
393 type =
"HTR Status Word - Crate 7";
398 type =
"HTR Status Word - Crate 9";
403 type =
"HTR Status Word - Crate 10";
408 type =
"HTR Status Word - Crate 11";
413 type =
"HTR Status Word - Crate 12";
418 type =
"HTR Status Word - Crate 13";
423 type =
"HTR Status Word - Crate 14";
428 type =
"HTR Status Word - Crate 15";
433 type =
"HTR Status Word - Crate 17";
438 type =
"HTR UnSuppressed Event Fractions";
441 snprintf(label, 256,
"FED 7%02d",
f);
444 snprintf(label, 256,
"sp%02d",
s);
448 type =
"HTR Firmware Version";
455 type =
"HTR Fiber 1 Orbit Message BCNs";
457 type =
"HTR Fiber 2 Orbit Message BCNs";
459 type =
"HTR Fiber 3 Orbit Message BCNs";
461 type =
"HTR Fiber 4 Orbit Message BCNs";
463 type =
"HTR Fiber 5 Orbit Message BCNs";
465 type =
"HTR Fiber 6 Orbit Message BCNs";
467 type =
"HTR Fiber 7 Orbit Message BCNs";
469 type =
"HTR Fiber 8 Orbit Message BCNs";
496 if (
debug_>1)
std::cout <<
"\t<HcalRawDataMonitor::analyze> Processing good event! event # = "<<
ievt_<<std::endl;
506 if (ieta==-9999)
continue;
527 if (d==1 && (
abs(ieta)==33 ||
abs(ieta)==34))
529 else if (d==2 && (
abs(ieta)==35 ||
abs(ieta)==36))
544 printf(
"HcalRawDataMonitor::processEvent DQMStore not instantiated!\n");
558 if (fed.
size()<12)
continue;
578 if(!dccHeader)
return;
579 unsigned char* trailer_ptr = (
unsigned char*) (raw.
data()+raw.
size()-
sizeof(
uint64_t));
589 int dcc_fw = ( ((*dccfw)>>(6*8))&0x00000000000000FF );
594 int EvFragLength = (int) (*lastDataWord>>(4*8)) & 0x0000000000FFFFFF ;
603 unsigned int dccOrN = (
unsigned int) (dccHeader->
getOrbitNumber() & 0x0000001F);
607 bool CDFProbThisDCC =
false;
614 CDFProbThisDCC =
true;
625 CDFProbThisDCC =
true;
630 CDFProbThisDCC =
true;
635 CDFProbThisDCC =
true;
651 CDFProbThisDCC =
true;
656 CDFProbThisDCC =
true;
663 CDFProbThisDCC =
true;
666 if (!trailer.
check()) {
668 CDFProbThisDCC =
true;
670 if (CDFProbThisDCC) {
678 CDFProbThisDCC =
false;
691 char TTS_state = (char)trailer.
ttsBits();
694 if (TTS_state==L1AtimeTTS_state) ;
726 int nHTR32BitWords=0;
731 if (( nHTR32BitWords % 2) == 1) {
733 if ((*lastDataWord>>32) != 0x00000000){
740 unsigned char HTRErrorList=0;
746 const int fed3offset = 1 + (4*dcc_);
747 const int fed2offset = 1 + (3*dcc_);
756 int WholeErrorList=0;
761 const int spg3offset = 1 + (4*spigot);
769 if (WholeErrorList!=0) {
770 if ((WholeErrorList>>0)&0x01)
772 if (((WholeErrorList>>1)&0x01)!=0) {
776 if (((WholeErrorList>>2)&0x01)!=0) {
780 if (((WholeErrorList>>3)&0x01)!=0) {
784 if (((WholeErrorList>>4)&0x01)!=0) {
788 if (((WholeErrorList>>5)&0x01)!=0) {
792 if (((WholeErrorList>>6)&0x01)!=0) {
805 if (
debug_>0)
std::cout <<
"HTR Problem: Spigot Data Truncated"<<std::endl;
815 if (
debug_>0)
std::cout <<
"HTR Problem: Spigot Data Length too small"<<std::endl;
822 const int spg3offset = 1 + (4*spigot);
823 const int spg2offset = 1 + (3*spigot);
829 const unsigned short* HTRraw = htr.
getRawData();
845 if ( ! ((HTRwdcount != 8) ||
846 (HTRwdcount != 12 + NTP + NDAQ) ||
847 (HTRwdcount != 20 + NTP + NDAQ) )) {
850 if (
debug_>0)
std::cout <<
"HTR Problem: NTP+NDAQ size consistency check fails"<<std::endl;
855 if (HTRwdcount != 8) {
863 if (( CM && ( (HTRwdcount-NDAQ-NTP) != 12) )
865 (!CM && ( (HTRwdcount-NDAQ-NTP) != 20) ) ) {
878 if (( (htrOrN == dccOrN ) &&
879 (htrBCN == (
unsigned int) dccBCN) )
885 if ( (htrEvtN == dccEvtNum) !=
898 int EvtNdiff = htrEvtN - dccEvtNum;
903 if (
debug_ == 1)
std::cout <<
"++++ Evt # out of sync, ref, this HTR: "<< dccEvtNum <<
" "<<htrEvtN <<std::endl;
907 int BCNdiff = htrBCN-dccBCN;
915 if (
debug_==1)
std::cout <<
"++++ BCN # out of sync, ref, this HTR: "<< dccBCN <<
" "<<htrBCN <<std::endl;
919 int OrNdiff = htrOrN-dccOrN;
925 if (
debug_==1)
std::cout <<
"++++ OrN # out of sync, ref, this HTR: "<< dccOrN <<
" "<<htrOrN <<std::endl;
928 bool htrUnSuppressed=(HTRraw[6]>>15 & 0x0001);
929 if (htrUnSuppressed) {
931 int here=1+(HcalDCCHeader::SPIGOT_COUNT*(dcc_))+spigot;
957 != (errWord&0x00FF) ){
960 if (
debug_>0)
std::cout <<
"DCC spigot summary error or HTR error word"<<std::endl;
964 for(
int i=0;
i<16;
i++){
965 int errbit = errWord&(0x01<<
i);
967 if (
i==15) errbit = errbit - 0x8000;
1038 const short unsigned int* daq_first, *daq_last, *tp_first, *tp_last;
1042 htr.
dataPointers(&daq_first,&daq_last,&tp_first,&tp_last);
1050 int samplecounter=-1;
1057 for (qie_work=qie_begin; qie_work!=qie_end; qie_work++) {
1058 if (qie_work->
raw()==0xFFFF)
1061 if (( 1 + ( 3* (qie_work->
fiber()-1) ) + qie_work->
fiberChan() ) != htrchan) {
1064 chn2offset = (htrchan*3)+1;
1067 if (samplecounter !=-1) {
1069 if (((samplecounter != NTS) &&
1070 (samplecounter != 1) )
1078 if (
debug_)
std::cout <<
"mapChannelProblem: Wrong Digi Size"<<std::endl;
1082 lastcapid=qie_work->
capid();
1085 int hope = lastcapid +1;
1086 if (hope==4) hope = 0;
1087 if (qie_work->
capid() != hope){
1093 lastcapid=qie_work->
capid();
1096 if (!(qie_work->
dv())){
1100 if (qie_work->
er()) {
1109 if ((samplecounter != NTS) &&
1110 (samplecounter != 1) &&
1111 (samplecounter !=-1) ) {
1115 if (
debug_)
std::cout <<
"mapChannelProblem: Wrong Digi Size (last digi)"<<std::endl;
1180 snprintf(label, 32,
"Spgt %02d", spig);
1189 snprintf(label, 32,
"Ch %02d", ch+1);
1197 for (
int thfed=0; thfed<
NUMDCCS; thfed++) {
1198 snprintf(label, 32,
"%03d", thfed+700);
1205 if (axisType !=1 && axisType != 2)
return;
1207 mePlot -> setBinLabel(1,
"Overflow Warn",axisType);
1208 mePlot -> setBinLabel(2,
"Buffer Busy",axisType);
1209 mePlot -> setBinLabel(3,
"Empty Event",axisType);
1210 mePlot -> setBinLabel(4,
"Rejected L1A",axisType);
1211 mePlot -> setBinLabel(5,
"Invalid Stream",axisType);
1212 mePlot -> setBinLabel(6,
"Latency Warn",axisType);
1213 mePlot -> setBinLabel(7,
"OptDat Err",axisType);
1214 mePlot -> setBinLabel(8,
"Clock Err",axisType);
1215 mePlot -> setBinLabel(9,
"Bunch Err",axisType);
1216 mePlot -> setBinLabel(10,
"b9",axisType);
1217 mePlot -> setBinLabel(11,
"b10",axisType);
1218 mePlot -> setBinLabel(12,
"b11",axisType);
1219 mePlot -> setBinLabel(13,
"Test Mode",axisType);
1220 mePlot -> setBinLabel(14,
"Histo Mode",axisType);
1221 mePlot -> setBinLabel(15,
"Calib Trig",axisType);
1222 mePlot -> setBinLabel(16,
"Bit15 Err",axisType);
1244 else if (prtlvl == 2){
1247 printf(
"Crate, Slot:%3i %4.1f \n", cratenum,slotnum);
1251 else if (prtlvl == 3){
1254 printf(
"Crate, Slot:%3i %4.1f", cratenum,slotnum);
1339 mydepth = HDI.
depth();
1345 if (myeta>=0 && myeta<85 &&
1346 (myphi-1)>=0 && (myphi-1)<72 &&
1347 (mydepth-1)>=0 && (mydepth-1)<4){
1366 for (
int i=
hashup(dcc,spigot);
1373 mydepth = HDI.
depth();
1379 if (myeta>=0 && myeta<85 &&
1380 (myphi-1)>=0 && (myphi-1)<72 &&
1381 (mydepth-1)>=0 && (mydepth-1)<4){
1402 int i=
hashup(dcc,spigot,htrchan);
1407 mydepth = HDI.
depth();
1413 if (myeta>=0 && myeta<85 &&
1414 (myphi-1)>=0 && (myphi-1)<72 &&
1415 (mydepth-1)>=0 && (mydepth-1)<4){
MonitorElement * meCh_DataIntegrityFED04_
bool isHO(int etabin, int depth)
MonitorElement * meCh_DataIntegrityFED27_
T getParameter(std::string const &) const
float ChannSumm_DataIntegrityCheck_[TWO___FED][TWO__SPGT]
unsigned int getFib6OrbMsgBCN() const
static const HcalDetId Undefined
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * meUSFractSpigs_
MonitorElement * meCh_DataIntegrityFED23_
bool LumiInOrder(int lumisec)
MonitorElement * meCDFErrorFound_
int getNDD() const
Get the number of daq data samples per channel when not zero-suppressed.
unsigned int getFib1OrbMsgBCN() const
Get the BCN of the Fiber Orbit Messages.
MonitorElement * meCrate7HTRStatus_
void label_xFEDs(MonitorElement *me_ptr, int xbins)
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * meCrate4HTRStatus_
MonitorElement * ProblemsCurrentLB
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
MonitorElement * meCh_DataIntegrityFED25_
MonitorElement * meCh_DataIntegrityFED13_
std::vector< HcalElectronicsId > allElectronicsIdPrecision() const
void whosebad(int subdet)
uint16_t raw() const
get the raw word
HcalSubdetector subdet() const
get the subdetector
bool check() const
Check for a good event Requires a minimum length, matching wordcount and length, not an empty event...
virtual void analyze(const edm::Event &e, const edm::EventSetup &c)
MonitorElement * meEvtNumberSynch_
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
MonitorElement * meCrate3HTRStatus_
unsigned int htrTopBottom() const
HcalElectronicsId-style HTR top/bottom (1=top/0=bottom)
void mapDCCproblem(int dcc)
MonitorElement * meCh_DataIntegrityFED02_
MonitorElement * meCh_DataIntegrityFED05_
MonitorElement * meFib5OrbMsgBCN_
MonitorElement * meCh_DataIntegrityFED09_
int fiberChan() const
get the fiber channel number
#define DEFINE_FWK_MODULE(type)
MonitorElement * meBCNCheck_
std::vector< int > AllowedCalibTypes_
MonitorElement * meCrate17HTRStatus_
MonitorElement * meChannSumm_DataIntegrityCheck_
void stashHDI(int thehash, HcalDetId thehcaldetid)
virtual void cleanup(void)
void processEvent(const FEDRawDataCollection &rawraw, const HcalUnpackerReport &report)
MonitorElement * meCrate13HTRStatus_
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)
bool dv() const
is the Data Valid bit set?
edm::LuminosityBlockNumber_t luminosityBlock() const
std::map< int, short > CDFversionNumber_list
MonitorElement * meOrNCheck_
HcalDetId hashedHcalDetId_[NUMDCCS *NUMSPIGS *HTRCHANMAX]
unsigned int getExtHdr6() const
unsigned int getFib8OrbMsgBCN() const
MonitorElement * meCrate2HTRStatus_
std::map< int, short > CDFReservedBits_list
void label_xChanns(MonitorElement *me_ptr, int xbins)
void update(void)
Mark the object updated.
MonitorElement * meBCNSynch_
bool isHE(int etabin, int depth)
static const int CHANNELS_PER_SPIGOT
uint64_t problemcount[ETABINS][PHIBINS][DEPTHBINS]
MonitorElement * meCrate14HTRStatus_
MonitorElement * meCh_DataIntegrityFED03_
void analyze(const edm::Event &e, const edm::EventSetup &c)
unsigned int getOrbitNumber() const
Get the HTR orbit number.
void labelHTRBits(MonitorElement *mePlot, unsigned int axisType)
size_t size() const
Lenght of the data buffer in bytes.
MonitorElement * meCrate15HTRStatus_
void beginRun(const edm::Run &run, const edm::EventSetup &c)
MonitorElement * meDataFlowInd_
MonitorElement * meCh_DataIntegrityFED14_
std::map< int, short >::iterator CDFReservedBits_it
float LRBDataCorruptionIndicators_[THREE_FED][THREE_SPG]
bool isSiPM(int ieta, int iphi, int depth)
unsigned int htrSlot() const
HcalElectronicsId-style HTR slot.
int depth() const
get the tower depth
MonitorElement * meCrate6HTRStatus_
virtual void beginRun(const edm::Run &run, const edm::EventSetup &c)
MonitorElement * meTevtHist_
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
edm::InputTag FEDRawDataCollection_
MonitorElement * meCh_DataIntegrityFED24_
std::map< int, short >::iterator DCCEvtFormat_it
bool IsAllowedCalibType()
MonitorElement * meCh_DataIntegrityFED06_
const T & max(const T &a, const T &b)
unsigned int getFib7OrbMsgBCN() const
const HcalElectronicsMap * readoutMap_
MonitorElement * HTR_StatusWd_HO
MonitorElement * meCrate5HTRStatus_
void unpack(const FEDRawData &raw)
MonitorElement * meCrate0HTRStatus_
MonitorElement * meChann_DataIntegrityCheck_[NUMDCCS]
const int getRawLength() const
Get the length of the raw data.
int ieta() const
get the cell ieta
MonitorElement * meOrNSynch_
void endRun(const edm::Run &run, const edm::EventSetup &c)
bool problemfound[ETABINS][PHIBINS][DEPTHBINS]
void label_ySpigots(MonitorElement *me_ptr, int ybins)
int fiber() const
get the fiber number
MonitorElement * meCh_DataIntegrityFED11_
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
MonitorElement * meCrate12HTRStatus_
std::map< int, short >::iterator CDFvers_it
MonitorElement * meCh_DataIntegrityFED17_
bool isHB(int etabin, int depth)
MonitorElement * meFibBCN_
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
MonitorElement * meDCCEventFormatError_
MonitorElement * meCh_DataIntegrityFED30_
MonitorElement * medccBCN_
MonitorElement * meCh_DataIntegrityFED12_
int CalcIeta(int subdet, int eta, int depth)
unsigned int getFib3OrbMsgBCN() const
MonitorElement * HTR_StatusWd_HBHE
MonitorElement * meCh_DataIntegrityFED10_
MonitorElement * meFib4OrbMsgBCN_
int ttsBits()
Current value of the Trigger Throttling System bitsAQ).
MonitorElement * meInvHTRData_
MonitorElement * meCh_DataIntegrityFED19_
int iphi() const
get the cell iphi
void mapHTRproblem(int dcc, int spigot)
MonitorElement * meEvtNCheck_
MonitorElement * meBCNwhenOrNDiff_
bool isHF(int etabin, int depth)
MonitorElement * meFib1OrbMsgBCN_
void HTRPrint(const HcalHTRData &htr, int prtlvl)
unsigned long long uint64_t
MonitorElement * meCrate11HTRStatus_
int capid() const
get the Capacitor id
MonitorElement * meFib8OrbMsgBCN_
unsigned int getFib5OrbMsgBCN() const
const unsigned short * getRawData() const
Get a pointer to the raw data.
int lenght()
The length of the event fragment counted in 64-bit words including header and trailer.
MonitorElement * meLRBDataCorruptionIndicators_
void dataPointers(const unsigned short **daq_first, const unsigned short **daq_last, const unsigned short **tp_first, const unsigned short **tp_last) const
Obtain the starting and ending pointers for external unpacking of the data.
MonitorElement * meCh_DataIntegrityFED08_
unsigned int getErrorsWord() const
Get the errors word.
MonitorElement * meCh_DataIntegrityFED29_
MonitorElement * meCh_DataIntegrityFED00_
bool null() const
is this a null id ?
MonitorElement * meCh_DataIntegrityFED26_
float HalfHTRDataCorruptionIndicators_[THREE_FED][THREE_SPG]
MonitorElement * meCrate1HTRStatus_
unsigned int getExtHdr7() const
MonitorElement * meStatusWdCrate_
MonitorElement * meFib7OrbMsgBCN_
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
void mapChannproblem(int dcc, int spigot, int htrchan)
int CalcEtaBin(int subdet, int ieta, int depth)
unsigned int readoutVMECrateId() const
HcalElectronicsId-style VME crate number.
MonitorElement * meCh_DataIntegrityFED16_
unsigned int getFib4OrbMsgBCN() const
MonitorElement * meCh_DataIntegrityFED07_
double getBinContent(int binx) const
get content of bin (1-D)
uint64_t UScount[NUMDCCS][NUMSPIGS]
MonitorElement * meEvFragSize_
MonitorElement * HTR_StatusWd_HF
MonitorElement * meCh_DataIntegrityFED28_
unsigned int getBunchNumber() const
Get the HTR bunch number.
unsigned int getFib2OrbMsgBCN() const
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
MonitorElement * meFib2OrbMsgBCN_
float Chann_DataIntegrityCheck_[NUMDCCS][TWO_CHANN][TWO__SPGT]
MonitorElement * meEvFragSize2_
MonitorElement * meDCCVersion_
MonitorElement * meCh_DataIntegrityFED20_
std::map< int, short > DCCEvtFormat_list
MonitorElement * meCrate10HTRStatus_
unsigned int getFirmwareRevision() const
Get the HTR firmware version.
MonitorElement * meHTRFWVersion_
MonitorElement * meFEDRawDataSizes_
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.
MonitorElement * meCh_DataIntegrityFED01_
MonitorElement * mefedEntries_
MonitorElement * meCh_DataIntegrityFED15_
float DataFlowInd_[TWO___FED][THREE_SPG]
Detector det() const
get the detector field from this detid
unsigned int getL1ANumber() const
Get the HTR event number.
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
MonitorElement * meCh_DataIntegrityFED31_
HcalDetId HashToHDI(int thehash)
void Reset(void)
reset ME (ie. contents, errors, etc)
MonitorElement * meHalfHTRDataCorruptionIndicators_
int hashup(uint32_t d=0, uint32_t s=0, uint32_t c=1)
MonitorElement * meFib3OrbMsgBCN_
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
bool er() const
is the error bit set?
MonitorElement * meCh_DataIntegrityFED21_
MonitorElement * meFib6OrbMsgBCN_
void setCurrentFolder(const std::string &fullpath)
bool isHistogramEvent() const
Is this event a histogram event? (do not call standard unpack in this case!!!!!)
MonitorElement * meCh_DataIntegrityFED18_
MonitorElement * meCrate9HTRStatus_
MonitorElement * meCh_DataIntegrityFED22_