CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/DQM/SiStripMonitorHardware/src/SPYHistograms.cc

Go to the documentation of this file.
00001 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
00002 #include "DataFormats/SiStripCommon/interface/SiStripFedKey.h"
00003 #include "DataFormats/SiStripCommon/interface/ConstantsForHardwareSystems.h"
00004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00005 
00006 #include "DQM/SiStripMonitorHardware/interface/SiStripFEDSpyBuffer.h"
00007 #include "DQM/SiStripMonitorHardware/interface/SPYHistograms.h"
00008 
00009 using edm::LogError;
00010 using edm::LogWarning;
00011 using edm::LogInfo;
00012 
00013 
00014 SPYHistograms::SPYHistograms()
00015 {
00016   dqm_ = 0;
00017 }
00018 
00019 SPYHistograms::~SPYHistograms()
00020 {
00021 }
00022  
00023 
00024 void 
00025 SPYHistograms::initialise(const edm::ParameterSet& iConfig,
00026                           std::ostringstream* pDebugStream){
00027 
00028   getConfigForHistogram(nNoData_,"nNoData",iConfig,pDebugStream);
00029   getConfigForHistogram(nLowRange_,"nLowRange",iConfig,pDebugStream);
00030   getConfigForHistogram(nHighRange_,"nHighRange",iConfig,pDebugStream);
00031   getConfigForHistogram(nMinZero_,"nMinZero",iConfig,pDebugStream);
00032   getConfigForHistogram(nMaxSat_,"nMaxSat",iConfig,pDebugStream);
00033   getConfigForHistogram(nLowPb_,"nLowPb",iConfig,pDebugStream);
00034   getConfigForHistogram(nHighPb_,"nHighPb",iConfig,pDebugStream);
00035   getConfigForHistogram(nOutOfSync_,"nOutOfSync",iConfig,pDebugStream);
00036   getConfigForHistogram(nOtherPbs_,"nOtherPbs",iConfig,pDebugStream);
00037   getConfigForHistogram(nApvErrorBit_,"nApvErrorBit",iConfig,pDebugStream);
00038   getConfigForHistogram(nApvAddressError_,"nApvAddressError",iConfig,pDebugStream);
00039   getConfigForHistogram(nNegativePeds_,"nNegativePeds",iConfig,pDebugStream);
00040 
00041   getConfigForHistogram(nNoDatavsTime_,"nNoDatavsTime",iConfig,pDebugStream);
00042   getConfigForHistogram(nLowRangevsTime_,"nLowRangevsTime",iConfig,pDebugStream);
00043   getConfigForHistogram(nHighRangevsTime_,"nHighRangevsTime",iConfig,pDebugStream);
00044   getConfigForHistogram(nMinZerovsTime_,"nMinZerovsTime",iConfig,pDebugStream);
00045   getConfigForHistogram(nMaxSatvsTime_,"nMaxSatvsTime",iConfig,pDebugStream);
00046   getConfigForHistogram(nLowPbvsTime_,"nLowPbvsTime",iConfig,pDebugStream);
00047   getConfigForHistogram(nHighPbvsTime_,"nHighPbvsTime",iConfig,pDebugStream);
00048   getConfigForHistogram(nOutOfSyncvsTime_,"nOutOfSyncvsTime",iConfig,pDebugStream);
00049   getConfigForHistogram(nOtherPbsvsTime_,"nOtherPbsvsTime",iConfig,pDebugStream);
00050   getConfigForHistogram(nApvErrorBitvsTime_,"nApvErrorBitvsTime",iConfig,pDebugStream);
00051   getConfigForHistogram(nApvAddressErrorvsTime_,"nApvAddressErrorvsTime",iConfig,pDebugStream);
00052   getConfigForHistogram(nNegativePedsvsTime_,"nNegativePedsvsTime",iConfig,pDebugStream);
00053 
00054   getConfigForHistogram(meanDigitalLowvsTime_,"meanDigitalLowvsTime",iConfig,pDebugStream);
00055 
00056 
00057   getConfigForHistogram(noData_,"NoData",iConfig,pDebugStream);
00058   getConfigForHistogram(lowRange_,"LowRange",iConfig,pDebugStream);
00059   getConfigForHistogram(highRange_,"HighRange",iConfig,pDebugStream);
00060   getConfigForHistogram(minZero_,"MinZero",iConfig,pDebugStream);
00061   getConfigForHistogram(maxSat_,"MaxSat",iConfig,pDebugStream);
00062   getConfigForHistogram(lowPb_,"LowPb",iConfig,pDebugStream);
00063   getConfigForHistogram(highPb_,"HighPb",iConfig,pDebugStream);
00064   getConfigForHistogram(outOfSync_,"OutOfSync",iConfig,pDebugStream);
00065   getConfigForHistogram(otherPbs_,"OtherPbs",iConfig,pDebugStream);
00066   getConfigForHistogram(apvErrorBit_,"ApvErrorBit",iConfig,pDebugStream);
00067   getConfigForHistogram(apvAddressError_,"ApvAddressError",iConfig,pDebugStream);
00068   getConfigForHistogram(negativePeds_,"NegativePeds",iConfig,pDebugStream);
00069 
00070   getConfigForHistogram(frameRange_,"FrameRange",iConfig,pDebugStream);
00071   getConfigForHistogram(frameMin_,"FrameMin",iConfig,pDebugStream);
00072   getConfigForHistogram(frameMax_,"FrameMax",iConfig,pDebugStream);
00073   getConfigForHistogram(baseline_,"Baseline",iConfig,pDebugStream);
00074 
00075   getConfigForHistogram(noDataDetailed_,"NoDataDetailed",iConfig,pDebugStream);
00076   getConfigForHistogram(lowRangeDetailed_,"LowRangeDetailed",iConfig,pDebugStream);
00077   getConfigForHistogram(highRangeDetailed_,"HighRangeDetailed",iConfig,pDebugStream);
00078   getConfigForHistogram(minZeroDetailed_,"MinZeroDetailed",iConfig,pDebugStream);
00079   getConfigForHistogram(maxSatDetailed_,"MaxSatDetailed",iConfig,pDebugStream);
00080   getConfigForHistogram(lowPbDetailed_,"LowPbDetailed",iConfig,pDebugStream);
00081   getConfigForHistogram(highPbDetailed_,"HighPbDetailed",iConfig,pDebugStream);
00082   getConfigForHistogram(outOfSyncDetailed_,"OutOfSyncDetailed",iConfig,pDebugStream);
00083   getConfigForHistogram(otherPbsDetailed_,"OtherPbsDetailed",iConfig,pDebugStream);
00084   getConfigForHistogram(apvErrorBitDetailed_,"ApvErrorBitDetailed",iConfig,pDebugStream);
00085   getConfigForHistogram(apvAddressErrorDetailed_,"ApvAddressErrorDetailed",iConfig,pDebugStream);
00086   getConfigForHistogram(negativePedsDetailed_,"NegativePedsDetailed",iConfig,pDebugStream);
00087 
00088   getConfigForHistogram(positionOfFirstHeaderBitDetailed_,"PositionOfFirstHeaderBitDetailed",iConfig,pDebugStream);
00089   getConfigForHistogram(positionOfFirstTrailerBitDetailed_,"PositionOfFirstTrailerBitDetailed",iConfig,pDebugStream);
00090   getConfigForHistogram(distanceHeaderTrailerDetailed_,"DistanceHeaderTrailerDetailed",iConfig,pDebugStream);
00091 
00092 }
00093 
00094 void SPYHistograms::fillGainHistograms(const Trends & aTrendElement, const double aTime) {
00095 
00096   fillHistogram(meanDigitalLowvsTime_,aTime,aTrendElement.meanDigitalLow);
00097 
00098 }
00099 
00100 void SPYHistograms::fillCountersHistograms(const ErrorCounters & aCounter, const double aTime) {
00101 
00102 
00103   fillHistogram(nNoData_,aCounter.nNoData);
00104   fillHistogram(nLowRange_,aCounter.nLowRange);
00105   fillHistogram(nHighRange_,aCounter.nHighRange);
00106   fillHistogram(nMinZero_,aCounter.nMinZero);
00107   fillHistogram(nMaxSat_,aCounter.nMaxSat);
00108   fillHistogram(nLowPb_,aCounter.nLowPb);
00109   fillHistogram(nHighPb_,aCounter.nHighPb);
00110   fillHistogram(nOutOfSync_,aCounter.nOOS);
00111   fillHistogram(nOtherPbs_,aCounter.nOtherPbs);
00112   fillHistogram(nApvErrorBit_,aCounter.nAPVError);
00113   fillHistogram(nApvAddressError_,aCounter.nAPVAddressError);
00114   fillHistogram(nNegativePeds_,aCounter.nNegPeds);
00115 
00116   fillHistogram(nNoDatavsTime_,aTime,aCounter.nNoData);
00117   fillHistogram(nLowRangevsTime_,aTime,aCounter.nLowRange);
00118   fillHistogram(nHighRangevsTime_,aTime,aCounter.nHighRange);
00119   fillHistogram(nMinZerovsTime_,aTime,aCounter.nMinZero);
00120   fillHistogram(nMaxSatvsTime_,aTime,aCounter.nMaxSat);
00121   fillHistogram(nLowPbvsTime_,aTime,aCounter.nLowPb);
00122   fillHistogram(nHighPbvsTime_,aTime,aCounter.nHighPb);
00123   fillHistogram(nOutOfSyncvsTime_,aTime,aCounter.nOOS);
00124   fillHistogram(nOtherPbsvsTime_,aTime,aCounter.nOtherPbs);
00125   fillHistogram(nApvErrorBitvsTime_,aTime,aCounter.nAPVError);
00126   fillHistogram(nApvAddressErrorvsTime_,aTime,aCounter.nAPVAddressError);
00127   fillHistogram(nNegativePedsvsTime_,aTime,aCounter.nNegPeds);
00128 
00129 
00130 }
00131 
00132 
00133 void SPYHistograms::fillFEDHistograms(const Errors & aErr,const unsigned int aFedId) {
00134   //else is used when filling the Error struct per channel, to avoid redundancy
00135   //use only if here, in case channels in the same FED have different 
00136   //"exclusive" error types...
00137 
00138   if (aErr.hasNoData) {
00139     //fill in channel loop with delay FPGA number...
00140     //fillHistogram(noData_,aFedId);
00141   }
00142   if (aErr.hasLowRange) { 
00143     fillHistogram(lowRange_,aFedId);
00144   }
00145   if (aErr.hasHighRange) { 
00146     fillHistogram(highRange_,aFedId);
00147   }
00148   if (aErr.hasMinZero) {
00149     fillHistogram(minZero_,aFedId);
00150   }
00151   if (aErr.hasMaxSat) {
00152     fillHistogram(maxSat_,aFedId);
00153   }
00154   if (aErr.hasLowPb) {
00155     fillHistogram(lowPb_,aFedId);
00156   }
00157   if (aErr.hasHighPb) {
00158     fillHistogram(highPb_,aFedId);
00159   }
00160   if (aErr.hasOOS) {
00161     fillHistogram(outOfSync_,aFedId);
00162   }
00163   if (aErr.hasOtherPbs) {
00164     fillHistogram(otherPbs_,aFedId);
00165   }
00166   if (aErr.hasErrorBit0 || aErr.hasErrorBit1) {
00167     fillHistogram(apvErrorBit_,aFedId);
00168   }
00169   if (aErr.hasAPVAddressError0 || aErr.hasAPVAddressError1) {
00170     fillHistogram(apvAddressError_,aFedId);
00171   }
00172   if (aErr.hasNegPeds) {
00173     fillHistogram(negativePeds_,aFedId);
00174   }
00175 
00176 
00177 }
00178 
00179 
00180 void SPYHistograms::fillDetailedHistograms(const Errors & aErr,
00181                                            const sistrip::SpyUtilities::Frame & aFrame, 
00182                                            const unsigned int aFedId,
00183                                            const unsigned int aFedChannel) {
00184 
00185   bookFEDHistograms(aFedId,aErr);
00186 
00187   if (!aErr.hasNoData) {
00188     fillHistogram(frameRange_,sistrip::SpyUtilities::range(aFrame));
00189     fillHistogram(frameMin_,aFrame.digitalLow);
00190     fillHistogram(frameMax_,aFrame.digitalHigh);
00191     fillHistogram(baseline_,aFrame.baseline);
00192   }
00193 
00194   if (aErr.hasNoData) {
00195     fillHistogram(noDataDetailedMap_[aFedId],aFedChannel);
00196     //fillHistogram(noData_,24*aFedId+static_cast<unsigned int>(aFedChannel/4.));
00197     fillHistogram(noData_,static_cast<unsigned int>(aFedChannel/4.));
00198   }
00199 
00200   if (aErr.hasLowRange) { 
00201     fillHistogram(lowRangeDetailedMap_[aFedId],aFedChannel);
00202   }
00203   if (aErr.hasHighRange) { 
00204     fillHistogram(highRangeDetailedMap_[aFedId],aFedChannel);
00205   }
00206   if (aErr.hasMinZero) {
00207     fillHistogram(minZeroDetailedMap_[aFedId],aFedChannel);
00208   }
00209   if (aErr.hasMaxSat) {
00210     fillHistogram(maxSatDetailedMap_[aFedId],aFedChannel);
00211   }
00212   if (aErr.hasLowPb) {
00213     fillHistogram(lowPbDetailedMap_[aFedId],aFedChannel);
00214   }
00215   if (aErr.hasHighPb) {
00216     fillHistogram(highPbDetailedMap_[aFedId],aFedChannel);
00217   }
00218   if (aErr.hasOOS) {
00219     fillHistogram(outOfSyncDetailedMap_[aFedId],aFedChannel);
00220   }
00221   if (aErr.hasOtherPbs) {
00222     fillHistogram(otherPbsDetailedMap_[aFedId],aFedChannel);
00223   }
00224   if (aErr.hasErrorBit0) {
00225     fillHistogram(apvErrorBitDetailedMap_[aFedId],2*aFedChannel);
00226   }
00227   if (aErr.hasErrorBit1) {
00228     fillHistogram(apvErrorBitDetailedMap_[aFedId],2*aFedChannel+1);
00229   }
00230   if (aErr.hasAPVAddressError0) {
00231     fillHistogram(apvAddressErrorDetailedMap_[aFedId],2*aFedChannel);
00232   }
00233   if (aErr.hasAPVAddressError1) {
00234     fillHistogram(apvAddressErrorDetailedMap_[aFedId],2*aFedChannel+1);
00235   }
00236   if (aErr.hasNegPeds) {
00237     fillHistogram(negativePedsDetailedMap_[aFedId],aFedChannel);
00238   }
00239 
00240   fillHistogram(positionOfFirstHeaderBitDetailedMap_[aFedId],aFrame.firstHeaderBit);
00241   fillHistogram(positionOfFirstTrailerBitDetailedMap_[aFedId],aFrame.firstTrailerBit);
00242   if (aFrame.firstTrailerBit != sistrip::SPY_SAMPLES_PER_CHANNEL &&
00243       aFrame.firstHeaderBit != sistrip::SPY_SAMPLES_PER_CHANNEL)
00244     fillHistogram(distanceHeaderTrailerDetailedMap_[aFedId],aFrame.firstTrailerBit-aFrame.firstHeaderBit);
00245   else fillHistogram(distanceHeaderTrailerDetailedMap_[aFedId],0);
00246 }
00247 
00248 
00249 void SPYHistograms::bookTopLevelHistograms(DQMStore* dqm)
00250 {
00251 
00252   dqm_ = dqm;
00253   //get FED IDs
00254   const unsigned int siStripFedIdMin = sistrip::FED_ID_MIN;
00255   const unsigned int siStripFedIdMax = sistrip::FED_ID_MAX;
00256 
00257   //book FED level histograms: resize boolean so 
00258   //they will be booked only once for the first event.
00259   histosBooked_.resize(siStripFedIdMax+1,false);
00260 
00261 
00262   //book histos
00263   bookHistogram(nNoData_,"nNoData",
00264                 ";n_{noData};n_{entries}",
00265                 "n_{noData}");
00266 
00267   bookHistogram(nLowRange_,"nLowRange",
00268                 ";n_{LowRange};n_{entries}",
00269                 "n_{LowRange}");
00270 
00271   bookHistogram(nHighRange_,"nHighRange",
00272                 ";n_{HighRange};n_{entries}",
00273                 "n_{HighRange}");
00274 
00275   bookHistogram(nMinZero_,"nMinZero",
00276                 ";n_{MinZero};n_{entries}",
00277                 "n_{MinZero}");
00278 
00279   bookHistogram(nMaxSat_,"nMaxSat",
00280                 ";n_{MaxSat};n_{entries}",
00281                 "n_{MaxSat}");
00282   
00283   bookHistogram(nLowPb_,"nLowPb",
00284                 ";n_{lowPb};n_{entries}",
00285                 "n_{lowPb}");
00286 
00287   bookHistogram(nHighPb_,"nHighPb",
00288                 ";n_{highPb};n_{entries}",
00289                 "n_{highPb}");
00290   
00291   bookHistogram(nOutOfSync_,"nOutOfSync",
00292                 ";n_{OOS};n_{entries}",
00293                 "n_{OOS}");
00294 
00295   bookHistogram(nOtherPbs_,"nOtherPbs",
00296                 ";n_{OtherPbs};n_{entries}",
00297                 "n_{OtherPbs}");
00298 
00299   bookHistogram(nApvErrorBit_,"nApvErrorBit",
00300                 ";n_{APVerror};n_{entries}",
00301                 "n_{APVerror}"
00302                 );
00303 
00304   bookHistogram(nApvAddressError_,"nApvAddressError",
00305                 ";n_{APVAddressError};n_{entries}",
00306                 "n_{APVAddressError}"
00307                 );
00308 
00309   bookHistogram(nNegativePeds_,"nNegativePeds",
00310                 ";n_{negPeds};n_{entries}",
00311                 "n_{negPeds}"
00312                 );
00313   
00314 
00315 
00316   bookHistogram(noData_,"NoData",
00317                 ";delayFPGA;n_{noData}",
00318                 //24*(siStripFedIdMax+1)-24*siStripFedIdMin,
00319                 //24*siStripFedIdMin,24*(siStripFedIdMax+1),
00320                 24,0,24,
00321                 "delayFPGA index"
00322                 );
00323 
00324   bookHistogram(lowRange_,"LowRange",
00325                 ";fedId;n_{LowRange}",
00326                 siStripFedIdMax-siStripFedIdMin+1,
00327                 siStripFedIdMin-0.5,siStripFedIdMax+0.5,
00328                 "FED-ID"
00329                 );
00330   
00331   bookHistogram(highRange_,"HighRange",
00332                 ";fedId;n_{HighRange}",
00333                 siStripFedIdMax-siStripFedIdMin+1,
00334                 siStripFedIdMin-0.5,siStripFedIdMax+0.5,
00335                 "FED-ID"
00336                 );
00337 
00338   bookHistogram(minZero_,"MinZero",
00339                 ";fedId;n_{MinZero}",
00340                 siStripFedIdMax-siStripFedIdMin+1,
00341                 siStripFedIdMin-0.5,siStripFedIdMax+0.5,
00342                 "FED-ID"
00343                 );
00344 
00345   bookHistogram(maxSat_,"MaxSat",
00346                 ";fedId;n_{MaxSat}",
00347                 siStripFedIdMax-siStripFedIdMin+1,
00348                 siStripFedIdMin-0.5,siStripFedIdMax+0.5,
00349                 "FED-ID"
00350                 );
00351   
00352   bookHistogram(lowPb_,"LowPb",
00353                 ";fedId;n_{lowPb}",
00354                 siStripFedIdMax-siStripFedIdMin+1,
00355                 siStripFedIdMin-0.5,siStripFedIdMax+0.5,
00356                 "FED-ID"
00357                 );
00358 
00359   bookHistogram(highPb_,"HighPb",
00360                 ";fedId;n_{highPb}",
00361                 siStripFedIdMax-siStripFedIdMin+1,
00362                 siStripFedIdMin-0.5,siStripFedIdMax+0.5,
00363                 "FED-ID"
00364                 );
00365   
00366   bookHistogram(outOfSync_,"OutOfSync",
00367                 ";fedId;n_{OOS}",
00368                 siStripFedIdMax-siStripFedIdMin+1,
00369                 siStripFedIdMin-0.5,siStripFedIdMax+0.5,
00370                 "FED-ID"
00371                 );
00372 
00373   bookHistogram(otherPbs_,"OtherPbs",
00374                 ";fedId;n_{OtherPbs}",
00375                 siStripFedIdMax-siStripFedIdMin+1,
00376                 siStripFedIdMin-0.5,siStripFedIdMax+0.5,
00377                 "FED-ID"
00378                 );
00379 
00380   bookHistogram(apvErrorBit_,"ApvErrorBit",
00381                 ";fedId;n_{APVerror}",
00382                 siStripFedIdMax-siStripFedIdMin+1,
00383                 siStripFedIdMin-0.5,siStripFedIdMax+0.5,
00384                 "FED-ID"
00385                 );
00386 
00387   bookHistogram(apvAddressError_,"ApvAddressError",
00388                 ";fedId;n_{APVAddressError}",
00389                 siStripFedIdMax-siStripFedIdMin+1,
00390                 siStripFedIdMin-0.5,siStripFedIdMax+0.5,
00391                 "FED-ID"
00392                 );
00393 
00394   bookHistogram(negativePeds_,"NegativePeds",
00395                 ";fedId;n_{negPeds}",
00396                 siStripFedIdMax-siStripFedIdMin+1,
00397                 siStripFedIdMin-0.5,siStripFedIdMax+0.5,
00398                 "FED-ID"
00399                 );
00400   
00401   bookHistogram(frameRange_,"FrameRange",
00402                 ";range;n_{entries}",
00403                 1024,0,1024,
00404                 "range (adc counts)");
00405 
00406   bookHistogram(frameMin_,"FrameMin",
00407                 ";Zero-light level;n_{entries}",
00408                 800,0,800,
00409                 "Zero-light level (adc counts)");
00410 
00411   bookHistogram(frameMax_,"FrameMax",
00412                 ";Tick height;n_{entries}",
00413                 824,200,1024,
00414                 "Tick height (adc counts)");
00415 
00416   bookHistogram(baseline_,"Baseline",
00417                 ";Baseline;n_{entries}",
00418                 1024,0,1024,
00419                 "Baseline (adc counts)");
00420 
00421 
00422 
00423   //book histos
00424  
00425   bookProfile(nNoDatavsTime_,"nNoDatavsTime",
00426               ";time;n_{noData}",
00427               0,
00428               42241,//total number of channels 
00429               "Time",
00430               "n_{noData}");
00431 
00432   bookProfile(nLowRangevsTime_,"nLowRangevsTime",
00433               ";time;n_{LowRange}",
00434               0,
00435               42241,//total number of channels 
00436               "Time",
00437               "n_{LowRange}");
00438 
00439   bookProfile(nHighRangevsTime_,"nHighRangevsTime",
00440               ";time;n_{HighRange}",
00441               0,
00442               42241,//total number of channels 
00443               "Time",
00444               "n_{HighRange}");
00445 
00446 
00447   bookProfile(nMinZerovsTime_,"nMinZerovsTime",
00448               ";time;n_{MinZero}",
00449               0,
00450               42241,//total number of channels 
00451               "Time",
00452               "n_{MinZero}");
00453 
00454   bookProfile(nMaxSatvsTime_,"nMaxSatvsTime",
00455               ";time;n_{MaxSat}",
00456               0,
00457               42241,//total number of channels 
00458               "Time",
00459               "n_{MaxSat}");
00460   
00461   bookProfile(nLowPbvsTime_,"nLowPbvsTime",
00462               ";time;n_{lowPb}",
00463               0,
00464               42241,//total number of channels 
00465               "Time",
00466               "n_{lowPb}");
00467 
00468   bookProfile(nHighPbvsTime_,"nHighPbvsTime",
00469               ";time;n_{highPb}",
00470               0,
00471               42241,//total number of channels 
00472               "Time",
00473               "n_{highPb}");
00474 
00475  
00476   bookProfile(nOutOfSyncvsTime_,"nOutOfSyncvsTime",
00477               ";time;n_{OOS}",
00478               0,
00479               42241,//total number of channels 
00480               "Time",
00481               "n_{OOS}");
00482 
00483   bookProfile(nOtherPbsvsTime_,"nOtherPbsvsTime",
00484               ";time;n_{OtherPbs}",
00485               0,
00486               42241,//total number of channels 
00487               "Time",
00488               "n_{OtherPbs}");
00489 
00490   bookProfile(nApvErrorBitvsTime_,"nApvErrorBitvsTime",
00491               ";time;n_{APVerror}",
00492               0,
00493               42241,//total number of channels 
00494               "Time",
00495               "n_{APVerror}");
00496 
00497   bookProfile(nApvAddressErrorvsTime_,"nApvAddressErrorvsTime",
00498               ";time;n_{APVAddressError}",
00499               0,
00500               42241,//total number of channels 
00501               "Time",
00502               "n_{APVAddressError}");
00503 
00504   bookProfile(nNegativePedsvsTime_,"nNegativePedsvsTime",
00505               ";time;n_{negPeds}",
00506               0,
00507               42241,//total number of channels 
00508               "Time",
00509               "n_{negPeds}");
00510 
00511   
00512 
00513   //book histos
00514 
00515 
00516   bookProfile(meanDigitalLowvsTime_,"meanDigitalLowvsTime",
00517               ";time;meanDigitalLow",
00518               0,
00519               800,//maximum for digitalLow 
00520               "Time",
00521               "meanDigitalLow");
00522 
00523 
00524 
00525 
00526 
00527 
00528   LogInfo("SPYHistograms") << " ---- Toplevel histograms book ! Number of MEs : " 
00529                            << dqm_->getMEs().size()
00530                            << std::endl;
00531   
00532 
00533 }
00534 
00535 void SPYHistograms::bookFEDHistograms(const unsigned int fedId,
00536                                       const Errors & aErr,
00537                                       bool doAll)
00538 {
00539   if (!histosBooked_[fedId]) {
00540     //will do that only once
00541 
00542     //only if at least one error corresponds to enabled histo....
00543     if (!doAll && !(
00544                    (aErr.hasNoData && noDataDetailed_.enabled) ||
00545                    (aErr.hasLowRange && lowRangeDetailed_.enabled) ||
00546                    (aErr.hasHighRange && highRangeDetailed_.enabled) ||
00547                    (aErr.hasMinZero && minZeroDetailed_.enabled) ||
00548                    (aErr.hasMaxSat && maxSatDetailed_.enabled) ||
00549                    (aErr.hasLowPb && lowPbDetailed_.enabled) ||
00550                    (aErr.hasHighPb && highPbDetailed_.enabled) ||
00551                    (aErr.hasOOS && outOfSyncDetailed_.enabled) ||
00552                    (aErr.hasOtherPbs && otherPbsDetailed_.enabled) ||
00553                    ((aErr.hasErrorBit0 ||aErr.hasErrorBit1)  && apvErrorBitDetailed_.enabled) ||
00554                    ((aErr.hasAPVAddressError0 || aErr.hasAPVAddressError1) && apvAddressErrorDetailed_.enabled) ||
00555                    (aErr.hasNegPeds && negativePedsDetailed_.enabled)
00556                    )
00557         ) return;
00558     
00559 
00560 
00561     SiStripFedKey fedKey(fedId,0,0,0);
00562     std::stringstream fedIdStream;
00563     fedIdStream << fedId;
00564     dqm_->setCurrentFolder(fedKey.path());
00565     
00566 
00567     bookHistogram(noDataDetailed_,
00568                   noDataDetailedMap_[fedId],
00569                   "NoDataForFED"+fedIdStream.str(),
00570                   "No data for FED ID "+fedIdStream.str(),
00571                   sistrip::FEDCH_PER_FED,0,sistrip::FEDCH_PER_FED,
00572                   "Channel Index"
00573                   );
00574 
00575     bookHistogram(lowRangeDetailed_,
00576                   lowRangeDetailedMap_[fedId],
00577                   "LowRangeForFED"+fedIdStream.str(),
00578                   "Max-min<VAL for FED ID "+fedIdStream.str(),
00579                   sistrip::FEDCH_PER_FED,0,sistrip::FEDCH_PER_FED,
00580                   "Channel Index"
00581                   );
00582 
00583     bookHistogram(highRangeDetailed_,
00584                   highRangeDetailedMap_[fedId],
00585                   "HighRangeForFED"+fedIdStream.str(),
00586                   "Max-min>VAL for FED ID "+fedIdStream.str(),
00587                   sistrip::FEDCH_PER_FED,0,sistrip::FEDCH_PER_FED,
00588                   "Channel Index"
00589                   );
00590 
00591     bookHistogram(minZeroDetailed_,
00592                   minZeroDetailedMap_[fedId],
00593                   "MinZeroForFED"+fedIdStream.str(),
00594                   "min=0 for FED ID "+fedIdStream.str(),
00595                   sistrip::FEDCH_PER_FED,0,sistrip::FEDCH_PER_FED,
00596                   "Channel Index"
00597                   );
00598 
00599     bookHistogram(maxSatDetailed_,
00600                   maxSatDetailedMap_[fedId],
00601                   "MaxSatForFED"+fedIdStream.str(),
00602                   "max=1023 for FED ID "+fedIdStream.str(),
00603                   sistrip::FEDCH_PER_FED,0,sistrip::FEDCH_PER_FED,
00604                   "Channel Index"
00605                   );
00606 
00607     bookHistogram(lowPbDetailed_,
00608                   lowPbDetailedMap_[fedId],
00609                   "LowPbForFED"+fedIdStream.str(),
00610                   "Pb with digitalLow for FED ID "+fedIdStream.str(),
00611                   sistrip::FEDCH_PER_FED,0,sistrip::FEDCH_PER_FED,
00612                   "Channel Index"
00613                   );
00614 
00615     bookHistogram(highPbDetailed_,
00616                   highPbDetailedMap_[fedId],
00617                   "HighPbForFED"+fedIdStream.str(),
00618                   "Pb with digitalHigh for FED ID "+fedIdStream.str(),
00619                   sistrip::FEDCH_PER_FED,0,sistrip::FEDCH_PER_FED,
00620                   "Channel Index"
00621                   );
00622 
00623     bookHistogram(outOfSyncDetailed_,
00624                   outOfSyncDetailedMap_[fedId],
00625                   "OutOfSyncForFED"+fedIdStream.str(),
00626                   "Out-of-sync for FED ID "+fedIdStream.str(),
00627                   sistrip::FEDCH_PER_FED,0,sistrip::FEDCH_PER_FED,
00628                   "Channel Index"
00629                   );
00630 
00631     bookHistogram(otherPbsDetailed_,
00632                   otherPbsDetailedMap_[fedId],
00633                   "OtherPbsForFED"+fedIdStream.str(),
00634                   "Other issues for FED ID "+fedIdStream.str(),
00635                   sistrip::FEDCH_PER_FED,0,sistrip::FEDCH_PER_FED,
00636                   "Channel Index"
00637                   );
00638 
00639     bookHistogram(apvErrorBitDetailed_,
00640                   apvErrorBitDetailedMap_[fedId],
00641                   "ApvErrorBitForFED"+fedIdStream.str(),
00642                   "APV error for FED ID "+fedIdStream.str(),
00643                   2*sistrip::FEDCH_PER_FED,0,2*sistrip::FEDCH_PER_FED,
00644                   "APV Index"
00645                   );
00646 
00647     bookHistogram(apvAddressErrorDetailed_,
00648                   apvAddressErrorDetailedMap_[fedId],
00649                   "ApvAddressErrorForFED"+fedIdStream.str(),
00650                   "APV address error for FED ID "+fedIdStream.str(),
00651                   2*sistrip::FEDCH_PER_FED,0,2*sistrip::FEDCH_PER_FED,
00652                   "APV Index"
00653                   );
00654 
00655     bookHistogram(negativePedsDetailed_,
00656                   negativePedsDetailedMap_[fedId],
00657                   "NegativePedsForFED"+fedIdStream.str(),
00658                   "Negative ped subtr for FED ID "+fedIdStream.str(),
00659                   sistrip::FEDCH_PER_FED,0,sistrip::FEDCH_PER_FED,
00660                   "Channel Index"
00661                   );
00662 
00663 
00664 
00665     bookHistogram(positionOfFirstHeaderBitDetailed_,
00666                   positionOfFirstHeaderBitDetailedMap_[fedId],
00667                   "PositionOfFirstHeaderBitForFED"+fedIdStream.str(),
00668                   "FED ID "+fedIdStream.str(),
00669                   300,0,300,
00670                   "first header bit"
00671                   );
00672 
00673     bookHistogram(positionOfFirstTrailerBitDetailed_,
00674                   positionOfFirstTrailerBitDetailedMap_[fedId],
00675                   "PositionOfFirstTrailerBitForFED"+fedIdStream.str(),
00676                   "FED ID "+fedIdStream.str(),
00677                   15,285,300,
00678                   "first trailer bit"
00679                   );
00680                                             
00681     bookHistogram(distanceHeaderTrailerDetailed_,
00682                   distanceHeaderTrailerDetailedMap_[fedId],
00683                   "DistanceHeaderTrailerForFED"+fedIdStream.str(),
00684                   "FED ID "+fedIdStream.str(),
00685                   300,0,300,
00686                   "trailer - header"
00687                   );
00688 
00689 
00690     histosBooked_[fedId] = true;
00691 
00692   }
00693 
00694 
00695 }
00696 
00697 void SPYHistograms::bookAllFEDHistograms()
00698 {
00699   //get FED IDs
00700   const unsigned int siStripFedIdMin = FEDNumbering::MINSiStripFEDID;
00701   const unsigned int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID;
00702   //book them
00703   for (unsigned int iFed = siStripFedIdMin; iFed <= siStripFedIdMax; iFed++) {
00704     //dummy error object
00705     Errors lError;
00706     bookFEDHistograms(iFed,lError,true);
00707   }
00708 }