import FWCore.ParameterSet.Config as cms


from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
SiStripSpyMonitor = DQMEDAnalyzer(
    "SiStripSpyMonitorModule",
    #Raw data collection
    SpyScopeRawDigisTag = cms.untracked.InputTag('SiStripSpyUnpacker','ScopeRawDigis'),
    SpyPedSubtrDigisTag = cms.untracked.InputTag('SiStripFEDEmulator','PedSubtrModuleDigis'),
    SpyL1Tag = cms.untracked.InputTag('SiStripSpyUnpacker','L1ACount'),
    SpyTotalEventCountTag = cms.untracked.InputTag('SiStripSpyUnpacker','TotalEventCount'),
    SpyAPVeTag = cms.untracked.InputTag('SiStripSpyDigiConverter','APVAddress'),
    MinDigiRange = cms.untracked.uint32(400),
    MaxDigiRange = cms.untracked.uint32(950),
    MinZeroLight = cms.untracked.uint32(15),
    MaxZeroLight = cms.untracked.uint32(180),
    MinTickHeight = cms.untracked.uint32(555),
    MaxTickHeight = cms.untracked.uint32(1010),
    #Folder in DQM Store to write global histograms to
    HistogramFolderName = cms.untracked.string('SiStrip/ReadoutView/SpyMonitoringSummary'),
    #Fill all detailed histograms at FED level even if they will be empty (so that files can be merged)
    FillAllDetailedHistograms = cms.untracked.bool(False),
    FillWithEventNumber = cms.untracked.bool(True),
    FillWithLocalEventNumber = cms.untracked.bool(False),
    #Whether to write the DQM store to a file at the end of the run and the file name
    WriteDQMStore = cms.untracked.bool(True),
    DQMStoreFileName = cms.untracked.string('DQMStore.root'),
    #OutputErrors = cms.untracked.vstring('NoData','MinZero','MaxSat','LowRange','HighRange','LowPb','HighPb','OOS','OtherPbs','APVError','APVAddressError','NegPeds'),
    OutputErrors = cms.untracked.vstring(),
    WriteCabling = cms.untracked.bool(False),
    #Histogram configuration
    nNoDataHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                 NBins = cms.untracked.uint32(100),
                                                 Min = cms.untracked.double(0),
                                                 Max = cms.untracked.double(1000) ),
    nLowRangeHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                   NBins = cms.untracked.uint32(100),
                                                   Min = cms.untracked.double(0),
                                                   Max = cms.untracked.double(100) ),
    nHighRangeHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                    NBins = cms.untracked.uint32(100),
                                                    Min = cms.untracked.double(0),
                                                    Max = cms.untracked.double(100) ),
    nMinZeroHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                  NBins = cms.untracked.uint32(100),
                                                  Min = cms.untracked.double(0),
                                                  Max = cms.untracked.double(100) ),
    nMaxSatHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                 NBins = cms.untracked.uint32(100),
                                                 Min = cms.untracked.double(0),
                                                 Max = cms.untracked.double(100) ),
    nLowPbHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                     NBins = cms.untracked.uint32(100),
                                                     Min = cms.untracked.double(0),
                                                     Max = cms.untracked.double(100) ),
    nHighPbHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                      NBins = cms.untracked.uint32(100),
                                                      Min = cms.untracked.double(0),
                                                      Max = cms.untracked.double(100) ),
    nOutOfSyncHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                    NBins = cms.untracked.uint32(100),
                                                    Min = cms.untracked.double(0),
                                                    Max = cms.untracked.double(1000) ),
    nOtherPbsHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                   NBins = cms.untracked.uint32(100),
                                                   Min = cms.untracked.double(0),
                                                   Max = cms.untracked.double(1000) ),
    nApvErrorBitHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                      NBins = cms.untracked.uint32(100),
                                                      Min = cms.untracked.double(0),
                                                      Max = cms.untracked.double(100) ),
    nApvAddressErrorHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                          NBins = cms.untracked.uint32(100),
                                                          Min = cms.untracked.double(0),
                                                          Max = cms.untracked.double(100) ),
    nNegativePedsHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                       NBins = cms.untracked.uint32(100),
                                                       Min = cms.untracked.double(0),
                                                       Max = cms.untracked.double(100) ),
    #vs time
    nNoDatavsTimeHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                       NBins = cms.untracked.uint32(600),
                                                       Min = cms.untracked.double(0),
                                                       Max = cms.untracked.double(600) ),
    nLowRangevsTimeHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                         NBins = cms.untracked.uint32(600),
                                                         Min = cms.untracked.double(0),
                                                         Max = cms.untracked.double(600) ),
    nHighRangevsTimeHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                          NBins = cms.untracked.uint32(600),
                                                          Min = cms.untracked.double(0),
                                                          Max = cms.untracked.double(600) ),
    nMinZerovsTimeHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                        NBins = cms.untracked.uint32(600),
                                                        Min = cms.untracked.double(0),
                                                        Max = cms.untracked.double(600) ),
    nMaxSatvsTimeHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                       NBins = cms.untracked.uint32(600),
                                                       Min = cms.untracked.double(0),
                                                       Max = cms.untracked.double(600) ),
    nLowPbvsTimeHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                           NBins = cms.untracked.uint32(600),
                                                           Min = cms.untracked.double(0),
                                                           Max = cms.untracked.double(600) ),
    nHighPbvsTimeHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                            NBins = cms.untracked.uint32(600),
                                                            Min = cms.untracked.double(0),
                                                            Max = cms.untracked.double(600) ),
    nOutOfSyncvsTimeHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                          NBins = cms.untracked.uint32(600),
                                                          Min = cms.untracked.double(0),
                                                          Max = cms.untracked.double(600) ),
    nOtherPbsvsTimeHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                         NBins = cms.untracked.uint32(600),
                                                         Min = cms.untracked.double(0),
                                                         Max = cms.untracked.double(600) ),
    nApvErrorBitvsTimeHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                            NBins = cms.untracked.uint32(600),
                                                            Min = cms.untracked.double(0),
                                                            Max = cms.untracked.double(600) ),
    nApvAddressErrorvsTimeHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                                NBins = cms.untracked.uint32(600),
                                                                Min = cms.untracked.double(0),
                                                                Max = cms.untracked.double(600) ),
    nNegativePedsvsTimeHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True),
                                                             NBins = cms.untracked.uint32(600),
                                                             Min = cms.untracked.double(0),
                                                             Max = cms.untracked.double(600) ),
    #vs fedid
    NoDataHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    LowRangeHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    HighRangeHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    MinZeroHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    MaxSatHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    LowPbHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    HighPbHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    OutOfSyncHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    OtherPbsHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    ApvErrorBitHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    ApvAddressErrorHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    NegativePedsHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    #for all channels
    FrameRangeHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    FrameMinHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    FrameMaxHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    BaselineHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
   #vs channel id
    NoDataDetailedHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(False) ),
    LowRangeDetailedHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    HighRangeDetailedHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    MinZeroDetailedHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    MaxSatDetailedHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    LowPbDetailedHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    HighPbDetailedHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    OutOfSyncDetailedHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    OtherPbsDetailedHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    ApvErrorBitDetailedHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    ApvAddressErrorDetailedHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    NegativePedsDetailedHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    #for all channels / per FED
    PositionOfFirstHeaderBitDetailedHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    PositionOfFirstTrailerBitDetailedHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
    DistanceHeaderTrailerDetailedHistogramConfig = cms.untracked.PSet( Enabled = cms.untracked.bool(True) ),
)
