Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:08:51

0001 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
0002 #include "DataFormats/SiStripCommon/interface/SiStripFedKey.h"
0003 #include "DataFormats/SiStripCommon/interface/ConstantsForHardwareSystems.h"
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005 
0006 #include "DQM/SiStripMonitorHardware/interface/SiStripFEDSpyBuffer.h"
0007 #include "DQM/SiStripMonitorHardware/interface/SPYHistograms.h"
0008 
0009 using edm::LogError;
0010 using edm::LogInfo;
0011 using edm::LogWarning;
0012 
0013 SPYHistograms::SPYHistograms() {}
0014 
0015 SPYHistograms::~SPYHistograms() {}
0016 
0017 void SPYHistograms::initialise(const edm::ParameterSet& iConfig, std::ostringstream* pDebugStream) {
0018   getConfigForHistogram(nNoData_, "nNoData", iConfig, pDebugStream);
0019   getConfigForHistogram(nLowRange_, "nLowRange", iConfig, pDebugStream);
0020   getConfigForHistogram(nHighRange_, "nHighRange", iConfig, pDebugStream);
0021   getConfigForHistogram(nMinZero_, "nMinZero", iConfig, pDebugStream);
0022   getConfigForHistogram(nMaxSat_, "nMaxSat", iConfig, pDebugStream);
0023   getConfigForHistogram(nLowPb_, "nLowPb", iConfig, pDebugStream);
0024   getConfigForHistogram(nHighPb_, "nHighPb", iConfig, pDebugStream);
0025   getConfigForHistogram(nOutOfSync_, "nOutOfSync", iConfig, pDebugStream);
0026   getConfigForHistogram(nOtherPbs_, "nOtherPbs", iConfig, pDebugStream);
0027   getConfigForHistogram(nApvErrorBit_, "nApvErrorBit", iConfig, pDebugStream);
0028   getConfigForHistogram(nApvAddressError_, "nApvAddressError", iConfig, pDebugStream);
0029   getConfigForHistogram(nNegativePeds_, "nNegativePeds", iConfig, pDebugStream);
0030 
0031   getConfigForHistogram(nNoDatavsTime_, "nNoDatavsTime", iConfig, pDebugStream);
0032   getConfigForHistogram(nLowRangevsTime_, "nLowRangevsTime", iConfig, pDebugStream);
0033   getConfigForHistogram(nHighRangevsTime_, "nHighRangevsTime", iConfig, pDebugStream);
0034   getConfigForHistogram(nMinZerovsTime_, "nMinZerovsTime", iConfig, pDebugStream);
0035   getConfigForHistogram(nMaxSatvsTime_, "nMaxSatvsTime", iConfig, pDebugStream);
0036   getConfigForHistogram(nLowPbvsTime_, "nLowPbvsTime", iConfig, pDebugStream);
0037   getConfigForHistogram(nHighPbvsTime_, "nHighPbvsTime", iConfig, pDebugStream);
0038   getConfigForHistogram(nOutOfSyncvsTime_, "nOutOfSyncvsTime", iConfig, pDebugStream);
0039   getConfigForHistogram(nOtherPbsvsTime_, "nOtherPbsvsTime", iConfig, pDebugStream);
0040   getConfigForHistogram(nApvErrorBitvsTime_, "nApvErrorBitvsTime", iConfig, pDebugStream);
0041   getConfigForHistogram(nApvAddressErrorvsTime_, "nApvAddressErrorvsTime", iConfig, pDebugStream);
0042   getConfigForHistogram(nNegativePedsvsTime_, "nNegativePedsvsTime", iConfig, pDebugStream);
0043 
0044   getConfigForHistogram(meanDigitalLowvsTime_, "meanDigitalLowvsTime", iConfig, pDebugStream);
0045 
0046   getConfigForHistogram(noData_, "NoData", iConfig, pDebugStream);
0047   getConfigForHistogram(lowRange_, "LowRange", iConfig, pDebugStream);
0048   getConfigForHistogram(highRange_, "HighRange", iConfig, pDebugStream);
0049   getConfigForHistogram(minZero_, "MinZero", iConfig, pDebugStream);
0050   getConfigForHistogram(maxSat_, "MaxSat", iConfig, pDebugStream);
0051   getConfigForHistogram(lowPb_, "LowPb", iConfig, pDebugStream);
0052   getConfigForHistogram(highPb_, "HighPb", iConfig, pDebugStream);
0053   getConfigForHistogram(outOfSync_, "OutOfSync", iConfig, pDebugStream);
0054   getConfigForHistogram(otherPbs_, "OtherPbs", iConfig, pDebugStream);
0055   getConfigForHistogram(apvErrorBit_, "ApvErrorBit", iConfig, pDebugStream);
0056   getConfigForHistogram(apvAddressError_, "ApvAddressError", iConfig, pDebugStream);
0057   getConfigForHistogram(negativePeds_, "NegativePeds", iConfig, pDebugStream);
0058 
0059   getConfigForHistogram(frameRange_, "FrameRange", iConfig, pDebugStream);
0060   getConfigForHistogram(frameMin_, "FrameMin", iConfig, pDebugStream);
0061   getConfigForHistogram(frameMax_, "FrameMax", iConfig, pDebugStream);
0062   getConfigForHistogram(baseline_, "Baseline", iConfig, pDebugStream);
0063 
0064   getConfigForHistogram(noDataDetailed_, "NoDataDetailed", iConfig, pDebugStream);
0065   getConfigForHistogram(lowRangeDetailed_, "LowRangeDetailed", iConfig, pDebugStream);
0066   getConfigForHistogram(highRangeDetailed_, "HighRangeDetailed", iConfig, pDebugStream);
0067   getConfigForHistogram(minZeroDetailed_, "MinZeroDetailed", iConfig, pDebugStream);
0068   getConfigForHistogram(maxSatDetailed_, "MaxSatDetailed", iConfig, pDebugStream);
0069   getConfigForHistogram(lowPbDetailed_, "LowPbDetailed", iConfig, pDebugStream);
0070   getConfigForHistogram(highPbDetailed_, "HighPbDetailed", iConfig, pDebugStream);
0071   getConfigForHistogram(outOfSyncDetailed_, "OutOfSyncDetailed", iConfig, pDebugStream);
0072   getConfigForHistogram(otherPbsDetailed_, "OtherPbsDetailed", iConfig, pDebugStream);
0073   getConfigForHistogram(apvErrorBitDetailed_, "ApvErrorBitDetailed", iConfig, pDebugStream);
0074   getConfigForHistogram(apvAddressErrorDetailed_, "ApvAddressErrorDetailed", iConfig, pDebugStream);
0075   getConfigForHistogram(negativePedsDetailed_, "NegativePedsDetailed", iConfig, pDebugStream);
0076 
0077   getConfigForHistogram(positionOfFirstHeaderBitDetailed_, "PositionOfFirstHeaderBitDetailed", iConfig, pDebugStream);
0078   getConfigForHistogram(positionOfFirstTrailerBitDetailed_, "PositionOfFirstTrailerBitDetailed", iConfig, pDebugStream);
0079   getConfigForHistogram(distanceHeaderTrailerDetailed_, "DistanceHeaderTrailerDetailed", iConfig, pDebugStream);
0080 }
0081 
0082 void SPYHistograms::fillGainHistograms(const Trends& aTrendElement, const double aTime) {
0083   fillHistogram(meanDigitalLowvsTime_, aTime, aTrendElement.meanDigitalLow);
0084 }
0085 
0086 void SPYHistograms::fillCountersHistograms(const ErrorCounters& aCounter, const double aTime) {
0087   fillHistogram(nNoData_, aCounter.nNoData);
0088   fillHistogram(nLowRange_, aCounter.nLowRange);
0089   fillHistogram(nHighRange_, aCounter.nHighRange);
0090   fillHistogram(nMinZero_, aCounter.nMinZero);
0091   fillHistogram(nMaxSat_, aCounter.nMaxSat);
0092   fillHistogram(nLowPb_, aCounter.nLowPb);
0093   fillHistogram(nHighPb_, aCounter.nHighPb);
0094   fillHistogram(nOutOfSync_, aCounter.nOOS);
0095   fillHistogram(nOtherPbs_, aCounter.nOtherPbs);
0096   fillHistogram(nApvErrorBit_, aCounter.nAPVError);
0097   fillHistogram(nApvAddressError_, aCounter.nAPVAddressError);
0098   fillHistogram(nNegativePeds_, aCounter.nNegPeds);
0099 
0100   fillHistogram(nNoDatavsTime_, aTime, aCounter.nNoData);
0101   fillHistogram(nLowRangevsTime_, aTime, aCounter.nLowRange);
0102   fillHistogram(nHighRangevsTime_, aTime, aCounter.nHighRange);
0103   fillHistogram(nMinZerovsTime_, aTime, aCounter.nMinZero);
0104   fillHistogram(nMaxSatvsTime_, aTime, aCounter.nMaxSat);
0105   fillHistogram(nLowPbvsTime_, aTime, aCounter.nLowPb);
0106   fillHistogram(nHighPbvsTime_, aTime, aCounter.nHighPb);
0107   fillHistogram(nOutOfSyncvsTime_, aTime, aCounter.nOOS);
0108   fillHistogram(nOtherPbsvsTime_, aTime, aCounter.nOtherPbs);
0109   fillHistogram(nApvErrorBitvsTime_, aTime, aCounter.nAPVError);
0110   fillHistogram(nApvAddressErrorvsTime_, aTime, aCounter.nAPVAddressError);
0111   fillHistogram(nNegativePedsvsTime_, aTime, aCounter.nNegPeds);
0112 }
0113 
0114 void SPYHistograms::fillFEDHistograms(const Errors& aErr, const unsigned int aFedId) {
0115   //else is used when filling the Error struct per channel, to avoid redundancy
0116   //use only if here, in case channels in the same FED have different
0117   //"exclusive" error types...
0118 
0119   if (aErr.hasNoData) {
0120     //fill in channel loop with delay FPGA number...
0121     //fillHistogram(noData_,aFedId);
0122   }
0123   if (aErr.hasLowRange) {
0124     fillHistogram(lowRange_, aFedId);
0125   }
0126   if (aErr.hasHighRange) {
0127     fillHistogram(highRange_, aFedId);
0128   }
0129   if (aErr.hasMinZero) {
0130     fillHistogram(minZero_, aFedId);
0131   }
0132   if (aErr.hasMaxSat) {
0133     fillHistogram(maxSat_, aFedId);
0134   }
0135   if (aErr.hasLowPb) {
0136     fillHistogram(lowPb_, aFedId);
0137   }
0138   if (aErr.hasHighPb) {
0139     fillHistogram(highPb_, aFedId);
0140   }
0141   if (aErr.hasOOS) {
0142     fillHistogram(outOfSync_, aFedId);
0143   }
0144   if (aErr.hasOtherPbs) {
0145     fillHistogram(otherPbs_, aFedId);
0146   }
0147   if (aErr.hasErrorBit0 || aErr.hasErrorBit1) {
0148     fillHistogram(apvErrorBit_, aFedId);
0149   }
0150   if (aErr.hasAPVAddressError0 || aErr.hasAPVAddressError1) {
0151     fillHistogram(apvAddressError_, aFedId);
0152   }
0153   if (aErr.hasNegPeds) {
0154     fillHistogram(negativePeds_, aFedId);
0155   }
0156 }
0157 
0158 void SPYHistograms::fillDetailedHistograms(const Errors& aErr,
0159                                            const sistrip::SpyUtilities::Frame& aFrame,
0160                                            const unsigned int aFedId,
0161                                            const unsigned int aFedChannel) {
0162   //removed: tomas
0163   //bookFEDHistograms(aFedId,aErr);
0164 
0165   if (!aErr.hasNoData) {
0166     fillHistogram(frameRange_, sistrip::SpyUtilities::range(aFrame));
0167     fillHistogram(frameMin_, aFrame.digitalLow);
0168     fillHistogram(frameMax_, aFrame.digitalHigh);
0169     fillHistogram(baseline_, aFrame.baseline);
0170   }
0171 
0172   if (aErr.hasNoData) {
0173     fillHistogram(noDataDetailedMap_[aFedId], aFedChannel);
0174     //fillHistogram(noData_,24*aFedId+static_cast<unsigned int>(aFedChannel/4.));
0175     fillHistogram(noData_, static_cast<unsigned int>(aFedChannel / 4.));
0176   }
0177 
0178   if (aErr.hasLowRange) {
0179     fillHistogram(lowRangeDetailedMap_[aFedId], aFedChannel);
0180   }
0181   if (aErr.hasHighRange) {
0182     fillHistogram(highRangeDetailedMap_[aFedId], aFedChannel);
0183   }
0184   if (aErr.hasMinZero) {
0185     fillHistogram(minZeroDetailedMap_[aFedId], aFedChannel);
0186   }
0187   if (aErr.hasMaxSat) {
0188     fillHistogram(maxSatDetailedMap_[aFedId], aFedChannel);
0189   }
0190   if (aErr.hasLowPb) {
0191     fillHistogram(lowPbDetailedMap_[aFedId], aFedChannel);
0192   }
0193   if (aErr.hasHighPb) {
0194     fillHistogram(highPbDetailedMap_[aFedId], aFedChannel);
0195   }
0196   if (aErr.hasOOS) {
0197     fillHistogram(outOfSyncDetailedMap_[aFedId], aFedChannel);
0198   }
0199   if (aErr.hasOtherPbs) {
0200     fillHistogram(otherPbsDetailedMap_[aFedId], aFedChannel);
0201   }
0202   if (aErr.hasErrorBit0) {
0203     fillHistogram(apvErrorBitDetailedMap_[aFedId], 2 * aFedChannel);
0204   }
0205   if (aErr.hasErrorBit1) {
0206     fillHistogram(apvErrorBitDetailedMap_[aFedId], 2 * aFedChannel + 1);
0207   }
0208   if (aErr.hasAPVAddressError0) {
0209     fillHistogram(apvAddressErrorDetailedMap_[aFedId], 2 * aFedChannel);
0210   }
0211   if (aErr.hasAPVAddressError1) {
0212     fillHistogram(apvAddressErrorDetailedMap_[aFedId], 2 * aFedChannel + 1);
0213   }
0214   if (aErr.hasNegPeds) {
0215     fillHistogram(negativePedsDetailedMap_[aFedId], aFedChannel);
0216   }
0217 
0218   fillHistogram(positionOfFirstHeaderBitDetailedMap_[aFedId], aFrame.firstHeaderBit);
0219   fillHistogram(positionOfFirstTrailerBitDetailedMap_[aFedId], aFrame.firstTrailerBit);
0220   if (aFrame.firstTrailerBit != sistrip::SPY_SAMPLES_PER_CHANNEL &&
0221       aFrame.firstHeaderBit != sistrip::SPY_SAMPLES_PER_CHANNEL)
0222     fillHistogram(distanceHeaderTrailerDetailedMap_[aFedId], aFrame.firstTrailerBit - aFrame.firstHeaderBit);
0223   else
0224     fillHistogram(distanceHeaderTrailerDetailedMap_[aFedId], 0);
0225 }
0226 
0227 void SPYHistograms::bookTopLevelHistograms(DQMStore::IBooker& ibooker, const TkDetMap*) {
0228   //get FED IDs
0229   const unsigned int siStripFedIdMin = sistrip::FED_ID_MIN;
0230   const unsigned int siStripFedIdMax = sistrip::FED_ID_MAX;
0231 
0232   //book FED level histograms: resize boolean so
0233   //they will be booked only once for the first event.
0234   histosBooked_.resize(siStripFedIdMax + 1, false);
0235 
0236   //book histos
0237   bookHistogram(ibooker, nNoData_, "nNoData", ";n_{noData};n_{entries}", "n_{noData}");
0238 
0239   bookHistogram(ibooker, nLowRange_, "nLowRange", ";n_{LowRange};n_{entries}", "n_{LowRange}");
0240 
0241   bookHistogram(ibooker, nHighRange_, "nHighRange", ";n_{HighRange};n_{entries}", "n_{HighRange}");
0242 
0243   bookHistogram(ibooker, nMinZero_, "nMinZero", ";n_{MinZero};n_{entries}", "n_{MinZero}");
0244 
0245   bookHistogram(ibooker, nMaxSat_, "nMaxSat", ";n_{MaxSat};n_{entries}", "n_{MaxSat}");
0246 
0247   bookHistogram(ibooker, nLowPb_, "nLowPb", ";n_{lowPb};n_{entries}", "n_{lowPb}");
0248 
0249   bookHistogram(ibooker, nHighPb_, "nHighPb", ";n_{highPb};n_{entries}", "n_{highPb}");
0250 
0251   bookHistogram(ibooker, nOutOfSync_, "nOutOfSync", ";n_{OOS};n_{entries}", "n_{OOS}");
0252 
0253   bookHistogram(ibooker, nOtherPbs_, "nOtherPbs", ";n_{OtherPbs};n_{entries}", "n_{OtherPbs}");
0254 
0255   bookHistogram(ibooker, nApvErrorBit_, "nApvErrorBit", ";n_{APVerror};n_{entries}", "n_{APVerror}");
0256 
0257   bookHistogram(
0258       ibooker, nApvAddressError_, "nApvAddressError", ";n_{APVAddressError};n_{entries}", "n_{APVAddressError}");
0259 
0260   bookHistogram(ibooker, nNegativePeds_, "nNegativePeds", ";n_{negPeds};n_{entries}", "n_{negPeds}");
0261 
0262   bookHistogram(ibooker,
0263                 noData_,
0264                 "NoData",
0265                 ";delayFPGA;n_{noData}",
0266                 //24*(siStripFedIdMax+1)-24*siStripFedIdMin,
0267                 //24*siStripFedIdMin,24*(siStripFedIdMax+1),
0268                 24,
0269                 0,
0270                 24,
0271                 "delayFPGA index");
0272 
0273   bookHistogram(ibooker,
0274                 lowRange_,
0275                 "LowRange",
0276                 ";fedId;n_{LowRange}",
0277                 siStripFedIdMax - siStripFedIdMin + 1,
0278                 siStripFedIdMin - 0.5,
0279                 siStripFedIdMax + 0.5,
0280                 "FED-ID");
0281 
0282   bookHistogram(ibooker,
0283                 highRange_,
0284                 "HighRange",
0285                 ";fedId;n_{HighRange}",
0286                 siStripFedIdMax - siStripFedIdMin + 1,
0287                 siStripFedIdMin - 0.5,
0288                 siStripFedIdMax + 0.5,
0289                 "FED-ID");
0290 
0291   bookHistogram(ibooker,
0292                 minZero_,
0293                 "MinZero",
0294                 ";fedId;n_{MinZero}",
0295                 siStripFedIdMax - siStripFedIdMin + 1,
0296                 siStripFedIdMin - 0.5,
0297                 siStripFedIdMax + 0.5,
0298                 "FED-ID");
0299 
0300   bookHistogram(ibooker,
0301                 maxSat_,
0302                 "MaxSat",
0303                 ";fedId;n_{MaxSat}",
0304                 siStripFedIdMax - siStripFedIdMin + 1,
0305                 siStripFedIdMin - 0.5,
0306                 siStripFedIdMax + 0.5,
0307                 "FED-ID");
0308 
0309   bookHistogram(ibooker,
0310                 lowPb_,
0311                 "LowPb",
0312                 ";fedId;n_{lowPb}",
0313                 siStripFedIdMax - siStripFedIdMin + 1,
0314                 siStripFedIdMin - 0.5,
0315                 siStripFedIdMax + 0.5,
0316                 "FED-ID");
0317 
0318   bookHistogram(ibooker,
0319                 highPb_,
0320                 "HighPb",
0321                 ";fedId;n_{highPb}",
0322                 siStripFedIdMax - siStripFedIdMin + 1,
0323                 siStripFedIdMin - 0.5,
0324                 siStripFedIdMax + 0.5,
0325                 "FED-ID");
0326 
0327   bookHistogram(ibooker,
0328                 outOfSync_,
0329                 "OutOfSync",
0330                 ";fedId;n_{OOS}",
0331                 siStripFedIdMax - siStripFedIdMin + 1,
0332                 siStripFedIdMin - 0.5,
0333                 siStripFedIdMax + 0.5,
0334                 "FED-ID");
0335 
0336   bookHistogram(ibooker,
0337                 otherPbs_,
0338                 "OtherPbs",
0339                 ";fedId;n_{OtherPbs}",
0340                 siStripFedIdMax - siStripFedIdMin + 1,
0341                 siStripFedIdMin - 0.5,
0342                 siStripFedIdMax + 0.5,
0343                 "FED-ID");
0344 
0345   bookHistogram(ibooker,
0346                 apvErrorBit_,
0347                 "ApvErrorBit",
0348                 ";fedId;n_{APVerror}",
0349                 siStripFedIdMax - siStripFedIdMin + 1,
0350                 siStripFedIdMin - 0.5,
0351                 siStripFedIdMax + 0.5,
0352                 "FED-ID");
0353 
0354   bookHistogram(ibooker,
0355                 apvAddressError_,
0356                 "ApvAddressError",
0357                 ";fedId;n_{APVAddressError}",
0358                 siStripFedIdMax - siStripFedIdMin + 1,
0359                 siStripFedIdMin - 0.5,
0360                 siStripFedIdMax + 0.5,
0361                 "FED-ID");
0362 
0363   bookHistogram(ibooker,
0364                 negativePeds_,
0365                 "NegativePeds",
0366                 ";fedId;n_{negPeds}",
0367                 siStripFedIdMax - siStripFedIdMin + 1,
0368                 siStripFedIdMin - 0.5,
0369                 siStripFedIdMax + 0.5,
0370                 "FED-ID");
0371 
0372   bookHistogram(ibooker, frameRange_, "FrameRange", ";range;n_{entries}", 1024, 0, 1024, "range (adc counts)");
0373 
0374   bookHistogram(
0375       ibooker, frameMin_, "FrameMin", ";Zero-light level;n_{entries}", 800, 0, 800, "Zero-light level (adc counts)");
0376 
0377   bookHistogram(ibooker, frameMax_, "FrameMax", ";Tick height;n_{entries}", 824, 200, 1024, "Tick height (adc counts)");
0378 
0379   bookHistogram(ibooker, baseline_, "Baseline", ";Baseline;n_{entries}", 1024, 0, 1024, "Baseline (adc counts)");
0380 
0381   //book histos
0382 
0383   bookProfile(ibooker,
0384               nNoDatavsTime_,
0385               "nNoDatavsTime",
0386               ";time;n_{noData}",
0387               0,
0388               42241,  //total number of channels
0389               "Time",
0390               "n_{noData}");
0391 
0392   bookProfile(ibooker,
0393               nLowRangevsTime_,
0394               "nLowRangevsTime",
0395               ";time;n_{LowRange}",
0396               0,
0397               42241,  //total number of channels
0398               "Time",
0399               "n_{LowRange}");
0400 
0401   bookProfile(ibooker,
0402               nHighRangevsTime_,
0403               "nHighRangevsTime",
0404               ";time;n_{HighRange}",
0405               0,
0406               42241,  //total number of channels
0407               "Time",
0408               "n_{HighRange}");
0409 
0410   bookProfile(ibooker,
0411               nMinZerovsTime_,
0412               "nMinZerovsTime",
0413               ";time;n_{MinZero}",
0414               0,
0415               42241,  //total number of channels
0416               "Time",
0417               "n_{MinZero}");
0418 
0419   bookProfile(ibooker,
0420               nMaxSatvsTime_,
0421               "nMaxSatvsTime",
0422               ";time;n_{MaxSat}",
0423               0,
0424               42241,  //total number of channels
0425               "Time",
0426               "n_{MaxSat}");
0427 
0428   bookProfile(ibooker,
0429               nLowPbvsTime_,
0430               "nLowPbvsTime",
0431               ";time;n_{lowPb}",
0432               0,
0433               42241,  //total number of channels
0434               "Time",
0435               "n_{lowPb}");
0436 
0437   bookProfile(ibooker,
0438               nHighPbvsTime_,
0439               "nHighPbvsTime",
0440               ";time;n_{highPb}",
0441               0,
0442               42241,  //total number of channels
0443               "Time",
0444               "n_{highPb}");
0445 
0446   bookProfile(ibooker,
0447               nOutOfSyncvsTime_,
0448               "nOutOfSyncvsTime",
0449               ";time;n_{OOS}",
0450               0,
0451               42241,  //total number of channels
0452               "Time",
0453               "n_{OOS}");
0454 
0455   bookProfile(ibooker,
0456               nOtherPbsvsTime_,
0457               "nOtherPbsvsTime",
0458               ";time;n_{OtherPbs}",
0459               0,
0460               42241,  //total number of channels
0461               "Time",
0462               "n_{OtherPbs}");
0463 
0464   bookProfile(ibooker,
0465               nApvErrorBitvsTime_,
0466               "nApvErrorBitvsTime",
0467               ";time;n_{APVerror}",
0468               0,
0469               42241,  //total number of channels
0470               "Time",
0471               "n_{APVerror}");
0472 
0473   bookProfile(ibooker,
0474               nApvAddressErrorvsTime_,
0475               "nApvAddressErrorvsTime",
0476               ";time;n_{APVAddressError}",
0477               0,
0478               42241,  //total number of channels
0479               "Time",
0480               "n_{APVAddressError}");
0481 
0482   bookProfile(ibooker,
0483               nNegativePedsvsTime_,
0484               "nNegativePedsvsTime",
0485               ";time;n_{negPeds}",
0486               0,
0487               42241,  //total number of channels
0488               "Time",
0489               "n_{negPeds}");
0490 
0491   //book histos
0492 
0493   bookProfile(ibooker,
0494               meanDigitalLowvsTime_,
0495               "meanDigitalLowvsTime",
0496               ";time;meanDigitalLow",
0497               0,
0498               800,  //maximum for digitalLow
0499               "Time",
0500               "meanDigitalLow");
0501 }
0502 
0503 void SPYHistograms::bookFEDHistograms(DQMStore::IBooker& ibooker,
0504                                       const unsigned int fedId,
0505                                       const Errors& aErr,
0506                                       bool doAll) {
0507   if (!histosBooked_[fedId]) {
0508     //will do that only once
0509 
0510     //only if at least one error corresponds to enabled histo....
0511     if (!doAll && !((aErr.hasNoData && noDataDetailed_.enabled) || (aErr.hasLowRange && lowRangeDetailed_.enabled) ||
0512                     (aErr.hasHighRange && highRangeDetailed_.enabled) ||
0513                     (aErr.hasMinZero && minZeroDetailed_.enabled) || (aErr.hasMaxSat && maxSatDetailed_.enabled) ||
0514                     (aErr.hasLowPb && lowPbDetailed_.enabled) || (aErr.hasHighPb && highPbDetailed_.enabled) ||
0515                     (aErr.hasOOS && outOfSyncDetailed_.enabled) || (aErr.hasOtherPbs && otherPbsDetailed_.enabled) ||
0516                     ((aErr.hasErrorBit0 || aErr.hasErrorBit1) && apvErrorBitDetailed_.enabled) ||
0517                     ((aErr.hasAPVAddressError0 || aErr.hasAPVAddressError1) && apvAddressErrorDetailed_.enabled) ||
0518                     (aErr.hasNegPeds && negativePedsDetailed_.enabled)))
0519       return;
0520 
0521     SiStripFedKey fedKey(fedId, 0, 0, 0);
0522     std::stringstream fedIdStream;
0523     fedIdStream << fedId;
0524     ibooker.setCurrentFolder(fedKey.path());
0525 
0526     bookHistogram(ibooker,
0527                   noDataDetailed_,
0528                   noDataDetailedMap_[fedId],
0529                   "NoDataForFED" + fedIdStream.str(),
0530                   "No data for FED ID " + fedIdStream.str(),
0531                   sistrip::FEDCH_PER_FED,
0532                   0,
0533                   sistrip::FEDCH_PER_FED,
0534                   "Channel Index");
0535 
0536     bookHistogram(ibooker,
0537                   lowRangeDetailed_,
0538                   lowRangeDetailedMap_[fedId],
0539                   "LowRangeForFED" + fedIdStream.str(),
0540                   "Max-min<VAL for FED ID " + fedIdStream.str(),
0541                   sistrip::FEDCH_PER_FED,
0542                   0,
0543                   sistrip::FEDCH_PER_FED,
0544                   "Channel Index");
0545 
0546     bookHistogram(ibooker,
0547                   highRangeDetailed_,
0548                   highRangeDetailedMap_[fedId],
0549                   "HighRangeForFED" + fedIdStream.str(),
0550                   "Max-min>VAL for FED ID " + fedIdStream.str(),
0551                   sistrip::FEDCH_PER_FED,
0552                   0,
0553                   sistrip::FEDCH_PER_FED,
0554                   "Channel Index");
0555 
0556     bookHistogram(ibooker,
0557                   minZeroDetailed_,
0558                   minZeroDetailedMap_[fedId],
0559                   "MinZeroForFED" + fedIdStream.str(),
0560                   "min=0 for FED ID " + fedIdStream.str(),
0561                   sistrip::FEDCH_PER_FED,
0562                   0,
0563                   sistrip::FEDCH_PER_FED,
0564                   "Channel Index");
0565 
0566     bookHistogram(ibooker,
0567                   maxSatDetailed_,
0568                   maxSatDetailedMap_[fedId],
0569                   "MaxSatForFED" + fedIdStream.str(),
0570                   "max=1023 for FED ID " + fedIdStream.str(),
0571                   sistrip::FEDCH_PER_FED,
0572                   0,
0573                   sistrip::FEDCH_PER_FED,
0574                   "Channel Index");
0575 
0576     bookHistogram(ibooker,
0577                   lowPbDetailed_,
0578                   lowPbDetailedMap_[fedId],
0579                   "LowPbForFED" + fedIdStream.str(),
0580                   "Pb with digitalLow for FED ID " + fedIdStream.str(),
0581                   sistrip::FEDCH_PER_FED,
0582                   0,
0583                   sistrip::FEDCH_PER_FED,
0584                   "Channel Index");
0585 
0586     bookHistogram(ibooker,
0587                   highPbDetailed_,
0588                   highPbDetailedMap_[fedId],
0589                   "HighPbForFED" + fedIdStream.str(),
0590                   "Pb with digitalHigh for FED ID " + fedIdStream.str(),
0591                   sistrip::FEDCH_PER_FED,
0592                   0,
0593                   sistrip::FEDCH_PER_FED,
0594                   "Channel Index");
0595 
0596     bookHistogram(ibooker,
0597                   outOfSyncDetailed_,
0598                   outOfSyncDetailedMap_[fedId],
0599                   "OutOfSyncForFED" + fedIdStream.str(),
0600                   "Out-of-sync for FED ID " + fedIdStream.str(),
0601                   sistrip::FEDCH_PER_FED,
0602                   0,
0603                   sistrip::FEDCH_PER_FED,
0604                   "Channel Index");
0605 
0606     bookHistogram(ibooker,
0607                   otherPbsDetailed_,
0608                   otherPbsDetailedMap_[fedId],
0609                   "OtherPbsForFED" + fedIdStream.str(),
0610                   "Other issues for FED ID " + fedIdStream.str(),
0611                   sistrip::FEDCH_PER_FED,
0612                   0,
0613                   sistrip::FEDCH_PER_FED,
0614                   "Channel Index");
0615 
0616     bookHistogram(ibooker,
0617                   apvErrorBitDetailed_,
0618                   apvErrorBitDetailedMap_[fedId],
0619                   "ApvErrorBitForFED" + fedIdStream.str(),
0620                   "APV error for FED ID " + fedIdStream.str(),
0621                   2 * sistrip::FEDCH_PER_FED,
0622                   0,
0623                   2 * sistrip::FEDCH_PER_FED,
0624                   "APV Index");
0625 
0626     bookHistogram(ibooker,
0627                   apvAddressErrorDetailed_,
0628                   apvAddressErrorDetailedMap_[fedId],
0629                   "ApvAddressErrorForFED" + fedIdStream.str(),
0630                   "APV address error for FED ID " + fedIdStream.str(),
0631                   2 * sistrip::FEDCH_PER_FED,
0632                   0,
0633                   2 * sistrip::FEDCH_PER_FED,
0634                   "APV Index");
0635 
0636     bookHistogram(ibooker,
0637                   negativePedsDetailed_,
0638                   negativePedsDetailedMap_[fedId],
0639                   "NegativePedsForFED" + fedIdStream.str(),
0640                   "Negative ped subtr for FED ID " + fedIdStream.str(),
0641                   sistrip::FEDCH_PER_FED,
0642                   0,
0643                   sistrip::FEDCH_PER_FED,
0644                   "Channel Index");
0645 
0646     bookHistogram(ibooker,
0647                   positionOfFirstHeaderBitDetailed_,
0648                   positionOfFirstHeaderBitDetailedMap_[fedId],
0649                   "PositionOfFirstHeaderBitForFED" + fedIdStream.str(),
0650                   "FED ID " + fedIdStream.str(),
0651                   300,
0652                   0,
0653                   300,
0654                   "first header bit");
0655 
0656     bookHistogram(ibooker,
0657                   positionOfFirstTrailerBitDetailed_,
0658                   positionOfFirstTrailerBitDetailedMap_[fedId],
0659                   "PositionOfFirstTrailerBitForFED" + fedIdStream.str(),
0660                   "FED ID " + fedIdStream.str(),
0661                   15,
0662                   285,
0663                   300,
0664                   "first trailer bit");
0665 
0666     bookHistogram(ibooker,
0667                   distanceHeaderTrailerDetailed_,
0668                   distanceHeaderTrailerDetailedMap_[fedId],
0669                   "DistanceHeaderTrailerForFED" + fedIdStream.str(),
0670                   "FED ID " + fedIdStream.str(),
0671                   300,
0672                   0,
0673                   300,
0674                   "trailer - header");
0675 
0676     histosBooked_[fedId] = true;
0677   }
0678 }
0679 
0680 void SPYHistograms::bookAllFEDHistograms(DQMStore::IBooker& ibooker) {
0681   //get FED IDs
0682   const unsigned int siStripFedIdMin = FEDNumbering::MINSiStripFEDID;
0683   const unsigned int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID;
0684   //book them
0685   for (unsigned int iFed = siStripFedIdMin; iFed <= siStripFedIdMax; iFed++) {
0686     //dummy error object
0687     Errors lError;
0688     bookFEDHistograms(ibooker, iFed, lError, true);
0689   }
0690 }