diff --git a/DQM/Integration/python/test/pixellumi_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/test/pixellumi_dqm_sourceclient-live_cfg.py old mode 100644 new mode 100755 index 8a058958cda44..65cbf8d45908c --- a/DQM/Integration/python/test/pixellumi_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/test/pixellumi_dqm_sourceclient-live_cfg.py @@ -1,191 +1,125 @@ -###################################################################### -## File: pixellumidqm_live_cfg.py -## -## Unpacks AlCaLumiPixels, then runs some basic selection, -## followed by the PixelLumi Calculation, separately for the three trigger types. -## NB: only one, ZeroBias trigger, used for now. -## Bug Adder: Amita Raval -###################################################################### import FWCore.ParameterSet.Config as cms -import os - -##################### -# Configurable pieces -##################### process = cms.Process("PixelLumiDQM") -#------------------------------- -# Import standard configurations -#------------------------------- -process.load('Configuration.StandardSequences.Services_cff') -#process.load('Configuration.EventContent.EventContent_cff') -process.load('FWCore.MessageService.MessageLogger_cfi') -#process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.MessageLogger = cms.Service("MessageLogger", + debugModules = cms.untracked.vstring('siPixelDigis', + 'sipixelEDAClient'), + cout = cms.untracked.PSet(threshold = cms.untracked.string('ERROR')), + destinations = cms.untracked.vstring('cout') +) + +#---------------------------- +# Event Source +#----------------------------- +# for live online DQM in P5 +process.load("DQM.Integration.test.inputsource_cfi") + +# for testing in lxplus +#process.load("DQM.Integration.test.fileinputsource_cfi") + +## +#---------------------------- +# DQM Environment +#----------------------------- +process.load("DQMServices.Components.DQMEnvironment_cfi") -#--------------- +#---------------------------- +# DQM Live Environment +#----------------------------- +process.load("DQM.Integration.test.environment_cfi") +process.dqmEnv.subSystemFolder = "PixelLumi" +# for local running +process.dqmSaver.dirName = '.' + +process.source.SelectEvents = cms.untracked.vstring("HLT_ZeroBias*") +#process.DQMStore.referenceFileName = '/dqmdata/dqm/reference/pixel_reference_pp.root' +#if (process.runType.getRunType() == process.runType.hi_run): +# process.DQMStore.referenceFileName = '/dqmdata/dqm/reference/pixel_reference_hi.root' + +if (process.runType.getRunType() == process.runType.cosmic_run): + process.source.SelectEvents = cms.untracked.vstring('HLT*SingleMu*') + +#---------------------------- # Magnetic Field -#--------------- +#----------------------------- +# 3.8T field process.load('Configuration.StandardSequences.MagneticField_AutoFromDBCurrent_cff') -#process.load('Configuration.StandardSequences.MagneticField_38T_cff') -#--------- +#------------------------------------------------- # GEOMETRY -#--------- +#------------------------------------------------- process.load("Configuration.StandardSequences.GeometryRecoDB_cff") -#---------- +#------------------------------------------------- # GLOBALTAG -#---------- +#------------------------------------------------- # Condition for P5 cluster process.load("DQM.Integration.test.FrontierCondition_GT_cfi") # Condition for lxplus #process.load("DQM.Integration.test.FrontierCondition_GT_Offline_cfi") -#---------------- -# DQM Environment -#---------------- -process.load("DQMServices.Components.DQMEnvironment_cfi") - -#----------------------------------------------------------------------------- -# DQM Live Environment (for integration, replace with standard for deployment) -#----------------------------------------------------------------------------- -process.load("DQM.Integration.test.environment_cfi") -process.dqmEnv.subSystemFolder = "PixelLumi" -process.dqmSaver.dirName = '.' -#------------------------ +#----------------------- # Reconstruction Modules -#------------------------ -# Replace the whole reco config with just the local pixel reco -#------------------------------------------------------------- -#process.load('Configuration.StandardSequences.Reconstruction_cff') -#process.load("Configuration.StandardSequences.ReconstructionCosmics_cff") -#process.load("RecoLocalTracker.SiPixelRecHits.SiPixelRecHits_cfi") -#process.load("RecoLocalTracker.SiPixelRecHits.PixelCPEESProducers_cff") +#----------------------- +# Real data raw to digi +process.load("EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi") +process.siPixelDigis.IncludeErrors = True + +# Local Reconstruction process.load("RecoLocalTracker.SiPixelClusterizer.SiPixelClusterizer_cfi") +#---------------------------------- +# High Pileup Configuration Changes +#---------------------------------- +#if (process.runType.getRunType() == process.runType.hpu_run): +# process.DQMEventStreamHttpReader.SelectEvents = cms.untracked.PSet( +# SelectEvents = cms.vstring('HLT_600Tower*','HLT_L1*','HLT_Jet*','HLT_*Cosmic*','HLT_HT*','HLT_MinBias_*','HLT_Physics*', 'HLT_ZeroBias*','HLT_HcalNZS*')) + + +process.siPixelDigis.InputLabel = cms.InputTag("rawDataCollector") #-------------------------------- -# Data - raw to digi; just pixels +# Heavy Ion Configuration Changes #-------------------------------- -#process.load("Configuration.StandardSequences.RawToDigi_cff") -#process.load('Configuration.StandardSequences.RawToDigi_Data_cff') -#process.load('Configuration.StandardSequences.EndOfProcess_cff') -process.load("EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi") -process.siPixelDigis.InputLabel = 'source' -process.siPixelDigis.IncludeErrors = True +if (process.runType.getRunType() == process.runType.hi_run): + process.load('Configuration.StandardSequences.RawToDigi_Repacked_cff') + process.siPixelDigis.InputLabel = cms.InputTag("rawDataRepacker") +# process.DQMEventStreamHttpReader.SelectEvents = cms.untracked.PSet( +# SelectEvents = cms.vstring('HLT_HI*')) + +#-------------------------- +# Pixel DQM Source and Client +#---------------------- +process.load("DQM.PixelLumi.PixelLumiDQM_cfi") + +process.dqmSaver.producer = "Playback" -#-------- -# Filters -#-------- -# HLT Filters: trigger path filters for 3 triggers in the AlCaLumi stream -# NB: Only ZeroBiasSelector_cfi being used for now -process.load("DQM.PixelLumi.ZeroBiasSelector_cfi") -process.load("DQM.PixelLumi.AlCaLumiPixelsZeroBiasSelector_cfi") -process.load("DQM.PixelLumi.RandomTriggerSelector_cfi") - -# Make three instances of pixel_lumi_dqm; only 1 being used for now -#------------------------------------------------------------------ -from DQM.PixelLumi.PixelLumiDQM_cfi import pixel_lumi_dqm - -process.PixelLumiDqmAlcaLumiPixel = pixel_lumi_dqm - -process.PixelLumiDqmZeroBias = pixel_lumi_dqm.clone( - resetEveryNLumiSections=cms.untracked.int32(1), - logFileName = cms.untracked.string("/nfshome0/dqmdev/pixel_lumi.txt") - ) if process.dqmSaver.producer.value() is "Playback": - process.PixelLumiDqmZeroBias.logFileName = cms.untracked.string("/nfshome0/dqmdev/pixel_lumi.txt") + process.pixel_lumi_dqm.logFileName = cms.untracked.string("pixel_lumi.txt") else: - process.PixelLumiDqmZeroBias.logFileName = cms.untracked.string("/nfshome0/dqmpro/pixel_lumi.txt") + process.pixel_lumi_dqm.logFileName = cms.untracked.string("/nfshome0/dqmpro/pixel_lumi.txt") +print process.pixel_lumi_dqm.logFileName -process.PixelLumiDqmRandom = pixel_lumi_dqm.clone( - resetEveryNLumiSections=cms.untracked.int32(20) - ) +#-------------------------- +# Service +#-------------------------- +process.AdaptorConfig = cms.Service("AdaptorConfig") -process.PixelLumiDqmHFGetter = cms.EDAnalyzer("HFLumiGetter") +#-------------------------- +# Filters +#-------------------------- -#---------------- -# Lumi from "DIP" -#------------------------------------------------- -# process.DBService=cms.Service('DBService', -# authPath= cms.untracked.string('/nfshome0/centraltspro/secure/') -# ) -process.GlobalTag.DBParameters.authenticationPath = cms.untracked.string('/nfshome0/centraltspro/secure/') -# process.DIPLumiProducer=cms.ESSource("DIPLumiProducer", -# connect=cms.string('oracle://cms_omds_lb/CMS_RUNTIME_LOGGER') -# #Zhen recommends: -# # connect=cms.string('oracle://cms_orcon_prod/cms_lumi_prod') -# # crashes at end of lumisection -# ) - -process.options = cms.untracked.PSet( - wantSummary = cms.untracked.bool(True) - ) -process.MessageLogger.cerr.threshold = cms.untracked.string("INFO") -process.MessageLogger.cerr.INFO.limit = cms.untracked.int32(-1) -process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(100) - -#------------- -# Input Source -#------------- -process.load("DQM.Integration.test.inputsource_cfi") -#process.DQMEventStreamHttpReader.consumerName = 'DQM Pixel Luminosity Consumer' -#process.DQMEventStreamHttpReader.SelectHLTOutput = cms.untracked.string('hltOutputALCALUMIPIXELS') -#process.DQMEventStreamHttpReader.maxEventRequestRate = cms.untracked.double(200.0) -#process.DQMEventStreamHttpReader.SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring('AlCa_LumiPixels_ZeroBias_v*')) - - -# Only unpack pixel data; there is nothing else, really. -process.MyRawToDigi = cms.Sequence(process.siPixelDigis) -# Change this to test without stable beams -process.siPixelDigis.InputLabel = cms.InputTag("hltFEDSelectorLumiPixels") -#process.siPixelDigis.InputLabel = cms.InputTag("rawDataCollector") - -# Only reconstruct the pixel clusters. -process.MyReconstruction = cms.Sequence(process.siPixelClusters) -process.reconstruction_step = cms.Path(process.MyReconstruction) - -#------------- -# DQM services -#------------- -process.dqm_step = cms.Path(process.dqmEnv*process.dqmSaver) - -# Lumi DQM settings. These are from J's code, now default in the _cfi for PixelLumiDQM. -#process.pixel_lumi_tupler.includeVertexInfo = cms.untracked.bool(False) -#process.pixel_lumi_tupler.includeTrackInfo = cms.untracked.bool(False) -#process.pixel_lumi_tupler.includeStripClusterInfo = cms.untracked.bool(False) - -#------------------------------- -# Path and schedule definitions. -#------------------------------- -process.raw2digi_step = cms.Path(process.MyRawToDigi) -process.HF = cms.Path(process.PixelLumiDqmHFGetter) -#process.plumdqm_alca_lumipixel_step = cms.Path(process.alca_lumi_pixels_zerobias_selector* -# process.PixelLumiDqmAlcaLumiPixel) -process.plumdqm_alca_zerobias_step = cms.Path( - #process.scraping_filter * # this seems to need tracks so cannot be used - process.zerobias_selector * - process.PixelLumiDqmZeroBias) -# -#process.plumdqm_alca_random_step = cms.Path( -# process.scraping_filter * # this seems to need tracks so cannot be used -# process.random_trigger_selector * -# process.PixelLumiDqmRandom) - -#-------------------- -# Schedule definition -#-------------------- -process.schedule = cms.Schedule(process.raw2digi_step, - process.reconstruction_step, -# process.HF, - process.plumdqm_alca_zerobias_step, - #process.plumdqm_alca_random_step, - process.dqm_step) +#-------------------------- +# Scheduling +#-------------------------- +process.Reco = cms.Sequence(process.siPixelDigis*process.siPixelClusters) +process.DQMmodules = cms.Sequence(process.dqmEnv* + process.pixel_lumi_dqm* + process.dqmSaver) +process.p = cms.Path(process.Reco*process.DQMmodules) ### process customizations included here from DQM.Integration.test.online_customizations_cfi import * process = customise(process) - -###################################################################### diff --git a/DQM/PixelLumi/plugins/BuildFile.xml b/DQM/PixelLumi/plugins/BuildFile.xml new file mode 100755 index 0000000000000..370ebd11f3f8c --- /dev/null +++ b/DQM/PixelLumi/plugins/BuildFile.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/DQM/PixelLumi/plugins/PixelLumiDQM.cc b/DQM/PixelLumi/plugins/PixelLumiDQM.cc new file mode 100755 index 0000000000000..b6ce829c280ff --- /dev/null +++ b/DQM/PixelLumi/plugins/PixelLumiDQM.cc @@ -0,0 +1,731 @@ +// -*- C++ -*- + +// Package: PixelLumiDQM +// Class: PixelLumiDQM + +// Author: Amita Raval +// Based on Jeroen Hegeman's code for Pixel Cluster Count Luminosity + +#include "PixelLumiDQM.h" + +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/GeometryVector/interface/Pi.h" +#include "DataFormats/GeometryVector/interface/LocalPoint.h" +#include "DataFormats/GeometryVector/interface/GlobalPoint.h" +#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" +#include "DataFormats/SiPixelDetId/interface/PixelBarrelName.h" +#include "DataFormats/SiPixelDetId/interface/PixelEndcapName.h" +#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" +#include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/MonitorElement.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/LuminosityBlock.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/Run.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Utilities/interface/EDMException.h" +#include "Geometry/CommonTopologies/interface/PixelTopology.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" + +#include +#include +#include +#include +#include +#include + +// Constructors and destructor. +PixelLumiDQM::PixelLumiDQM(const edm::ParameterSet& iConfig): + fPixelClusterLabel(consumes >(iConfig.getUntrackedParameter("pixelClusterLabel", + edm::InputTag("siPixelClusters")))), + fIncludePixelClusterInfo(iConfig.getUntrackedParameter("includePixelClusterInfo", true)), + fIncludePixelQualCheckHistos(iConfig.getUntrackedParameter("includePixelQualCheckHistos", true)), + fResetIntervalInLumiSections(iConfig.getUntrackedParameter("resetEveryNLumiSections", 1)), + fDeadModules(iConfig.getUntrackedParameter >("deadModules", std::vector())), + fMinPixelsPerCluster(iConfig.getUntrackedParameter("minNumPixelsPerCluster", 0)), + fMinClusterCharge(iConfig.getUntrackedParameter("minChargePerCluster", 0)), + bunchTriggerMask(lastBunchCrossing+1,false), + filledAndUnmaskedBunches(0), + useInnerBarrelLayer(iConfig.getUntrackedParameter("useInnerBarrelLayer", false)), + fLogFileName_(iConfig.getUntrackedParameter("logFileName","/tmp/pixel_lumi.txt")) +{ + edm::LogInfo("Configuration") + << "PixelLumiDQM looking for pixel clusters in '" + << iConfig.getUntrackedParameter("pixelClusterLabel", + edm::InputTag("siPixelClusters")) << "'"; + edm::LogInfo("Configuration") + << "PixelLumiDQM storing pixel cluster info? " + << fIncludePixelClusterInfo; + edm::LogInfo("Configuration") + << "PixelLumiDQM storing pixel cluster quality check histograms? " + << fIncludePixelQualCheckHistos; + + if (!fDeadModules.size()) { + edm::LogInfo("Configuration") + << "No pixel modules specified to be ignored"; + } else { + edm::LogInfo("Configuration") + << fDeadModules.size() << " pixel modules specified to be ignored:"; + for (std::vector::const_iterator it = fDeadModules.begin(); + it != fDeadModules.end(); ++it) { + edm::LogInfo("Configuration") + << " " << *it; + } + } + edm::LogInfo("Configuration") + << "Ignoring pixel clusters with less than " + << fMinPixelsPerCluster << " pixels"; + edm::LogInfo("Configuration") + << "Ignoring pixel clusters with charge less than " + << fMinClusterCharge; +} + + +PixelLumiDQM::~PixelLumiDQM() +{ +} + + +void +PixelLumiDQM::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.setUnknown(); + descriptions.addDefault(desc); +} + + +void +PixelLumiDQM::analyze(const edm::Event& iEvent, + const edm::EventSetup& iSetup) +{ + // Collect all bookkeeping information. + fRunNo = iEvent.id().run(); + fEvtNo = iEvent.id().event(); + fLSNo = iEvent.getLuminosityBlock().luminosityBlock(); + fBXNo = iEvent.bunchCrossing(); + fTimestamp = iEvent.time().unixTime(); + fHistBunchCrossings->Fill(float(fBXNo)); + fHistBunchCrossingsLastLumi->Fill(float(fBXNo)); + // This serves as event counter to compute luminosity from cluster counts. + std::map::iterator it = fNumPixelClusters.find(fBXNo); + if(it==fNumPixelClusters.end()) fNumPixelClusters[fBXNo] = PixelClusterCount(); + + if (fIncludePixelClusterInfo) { + // Find tracker geometry. + edm::ESHandle trackerGeo; + iSetup.get().get(trackerGeo); + + // Find pixel clusters. + edm::Handle > pixelClusters; + iEvent.getByToken(fPixelClusterLabel, pixelClusters); + + // Loop over entire tracker geometry. + for (TrackerGeometry::DetContainer::const_iterator + i = trackerGeo->dets().begin(); + i != trackerGeo->dets().end(); ++i) { + // See if this is a pixel unit(?). + + if ( GeomDetEnumerators::isTrackerPixel((*i)->subDetector())) { + DetId detId = (*i)->geographicalId(); + // Find all clusters on this detector module. + edmNew::DetSetVector::const_iterator iSearch = + pixelClusters->find(detId); + if (iSearch != pixelClusters->end()) { + + // Count the number of clusters with at least a minimum + // number of pixels per cluster and at least a minimum charge. + size_t numClusters = 0; + for (edmNew::DetSet::const_iterator + itClus = iSearch->begin(); + itClus != iSearch->end(); ++itClus) { + if ((itClus->size() >= fMinPixelsPerCluster) && + (itClus->charge() >= fMinClusterCharge)) { + ++numClusters; + } + } + // DEBUG DEBUG DEBUG + assert(numClusters <= iSearch->size()); + // DEBUG DEBUG DEBUG end + + // Add up the cluster count based on the position of this detector element. + if (detId.subdetId() == PixelSubdetector::PixelBarrel) { + PixelBarrelName detName = PixelBarrelName(detId); + int layer = detName.layerName(); + fNumPixelClusters[fBXNo].numB.at(layer - 1) += numClusters; + fNumPixelClusters[fBXNo].dnumB.at(layer - 1) += sqrt(numClusters); + } else { + // DEBUG DEBUG DEBUG + assert(detId.subdetId() == PixelSubdetector::PixelEndcap); + // DEBUG DEBUG DEBUG end + + PixelEndcapName detName = PixelEndcapName(detId); + PixelEndcapName::HalfCylinder halfCylinder = detName.halfCylinder(); + int disk = detName.diskName(); + switch (halfCylinder) { + case PixelEndcapName::mO: + case PixelEndcapName::mI: + fNumPixelClusters[fBXNo].numFM.at(disk - 1) += numClusters; + fNumPixelClusters[fBXNo].dnumFM.at(disk - 1) += sqrt(numClusters); + break; + case PixelEndcapName::pO: + case PixelEndcapName::pI: + fNumPixelClusters[fBXNo].numFP.at(disk - 1) += numClusters; + fNumPixelClusters[fBXNo].dnumFP.at(disk - 1) += sqrt(numClusters); + break; + default: + assert(false); + break; + } + } + } + } + } + } + // ---------- + + // Fill some pixel cluster quality check histograms if requested. + if (fIncludePixelQualCheckHistos) { + + // Find tracker geometry. + edm::ESHandle trackerGeo; + iSetup.get().get(trackerGeo); + + // Find pixel clusters. + edm::Handle > pixelClusters; + iEvent.getByToken(fPixelClusterLabel, pixelClusters); + + bool filterDeadModules = (fDeadModules.size() > 0); + std::vector::const_iterator deadModulesBegin = fDeadModules.begin(); + std::vector::const_iterator deadModulesEnd = fDeadModules.end(); + + // Loop over entire tracker geometry. + for (TrackerGeometry::DetContainer::const_iterator + i = trackerGeo->dets().begin(); + i != trackerGeo->dets().end(); ++i) { + + // See if this is a pixel module. + if ( GeomDetEnumerators::isTrackerPixel((*i)->subDetector())) { + DetId detId = (*i)->geographicalId(); + + // Skip this module if it's on the list of modules to be ignored. + if (filterDeadModules && + find(deadModulesBegin, deadModulesEnd, detId()) != deadModulesEnd) { + continue; + } + + // Find all clusters in this module. + edmNew::DetSetVector::const_iterator iSearch = + pixelClusters->find(detId); + + // Loop over all clusters in this module. + if (iSearch != pixelClusters->end()) { + for (edmNew::DetSet::const_iterator clus = iSearch->begin(); + clus != iSearch->end(); ++clus) { + + if ((clus->size() >= fMinPixelsPerCluster) && + (clus->charge() >= fMinClusterCharge)) { + + PixelGeomDetUnit const* theGeomDet = + dynamic_cast(trackerGeo->idToDet(detId)); + PixelTopology const* topol = &(theGeomDet->specificTopology()); + double x = clus->x(); + double y = clus->y(); + LocalPoint clustLP = topol->localPosition(MeasurementPoint(x, y)); + GlobalPoint clustGP = theGeomDet->surface().toGlobal(clustLP); + double charge = clus->charge() / 1.e3; + int size = clus->size(); + + if (detId.subdetId() == PixelSubdetector::PixelBarrel) { + PixelBarrelName detName = PixelBarrelName(detId); + int layer = detName.layerName(); + switch (layer) { + case 1: + fHistContainerThisRun["clusPosBarrel1"]->Fill(clustGP.z(), clustGP.phi()); + fHistContainerThisRun["clusChargeBarrel1"]->Fill(iEvent.bunchCrossing(), charge); + fHistContainerThisRun["clusSizeBarrel1"]->Fill(iEvent.bunchCrossing(), size); + break; + case 2: + fHistContainerThisRun["clusPosBarrel2"]->Fill(clustGP.z(), clustGP.phi()); + fHistContainerThisRun["clusChargeBarrel2"]->Fill(iEvent.bunchCrossing(), charge); + fHistContainerThisRun["clusSizeBarrel2"]->Fill(iEvent.bunchCrossing(), size); + break; + case 3: + fHistContainerThisRun["clusPosBarrel3"]->Fill(clustGP.z(), clustGP.phi()); + fHistContainerThisRun["clusChargeBarrel3"]->Fill(iEvent.bunchCrossing(), charge); + fHistContainerThisRun["clusSizeBarrel3"]->Fill(iEvent.bunchCrossing(), size); + break; + default: + assert(false); + break; + } + } else { + + // DEBUG DEBUG DEBUG + assert(detId.subdetId() == PixelSubdetector::PixelEndcap); + // DEBUG DEBUG DEBUG end + + PixelEndcapName detName = PixelEndcapName(detId); + PixelEndcapName::HalfCylinder halfCylinder = detName.halfCylinder(); + int disk = detName.diskName(); + switch (halfCylinder) { + case PixelEndcapName::mO: + case PixelEndcapName::mI: + switch (disk) { + case 1: + fHistContainerThisRun["clusPosEndCapM1"]->Fill(clustGP.x(), clustGP.y()); + fHistContainerThisRun["clusChargeEndCapM1"]->Fill(iEvent.bunchCrossing(), charge); + fHistContainerThisRun["clusSizeEndCapM1"]->Fill(iEvent.bunchCrossing(), size); + break; + case 2: + fHistContainerThisRun["clusPosEndCapM2"]->Fill(clustGP.x(), clustGP.y()); + fHistContainerThisRun["clusChargeEndCapM2"]->Fill(iEvent.bunchCrossing(), charge); + fHistContainerThisRun["clusSizeEndCapM2"]->Fill(iEvent.bunchCrossing(), size); + break; + default: + assert(false); + break; + } + break; + case PixelEndcapName::pO: + case PixelEndcapName::pI: + switch (disk) { + case 1: + fHistContainerThisRun["clusPosEndCapP1"]->Fill(clustGP.x(), clustGP.y()); + fHistContainerThisRun["clusChargeEndCapP1"]->Fill(iEvent.bunchCrossing(), charge); + fHistContainerThisRun["clusSizeEndCapP1"]->Fill(iEvent.bunchCrossing(), size); + break; + case 2: + fHistContainerThisRun["clusPosEndCapP2"]->Fill(clustGP.x(), clustGP.y()); + fHistContainerThisRun["clusChargeEndCapP2"]->Fill(iEvent.bunchCrossing(), charge); + fHistContainerThisRun["clusSizeEndCapP2"]->Fill(iEvent.bunchCrossing(), size); + break; + default: + assert(false); + break; + } + break; + default: + assert(false); + break; + } + } + } + } + } + } + } + } +} + +void +PixelLumiDQM::bookHistograms(DQMStore::IBooker & ibooker, + edm::Run const & run, + edm::EventSetup const & /* iSetup */) +{ + edm::LogInfo("Status") << "Starting processing of run #" << run.id().run(); + + // Top folder containing high-level information about pixel and HF lumi. + std::string folder = "PixelLumi/"; + ibooker.setCurrentFolder(folder); + + fHistTotalRecordedLumiByLS = ibooker.book1D("totalPixelLumiByLS","Pixel Lumi in nb vs LS",8000,0.5,8000.5); + fHistRecordedByBxCumulative = ibooker.book1D("PXLumiByBXsum","Pixel Lumi in nb by BX Cumulative vs LS",lastBunchCrossing, + 0.5,float(lastBunchCrossing)+0.5); + + std::string subfolder = folder + "lastLS/"; + ibooker.setCurrentFolder(subfolder); + fHistRecordedByBxLastLumi = ibooker.book1D("PXByBXLastLumi","Pixel By BX Last Lumi",lastBunchCrossing+1, + -0.5,float(lastBunchCrossing)+0.5); + + subfolder = folder+"ClusterCountingDetails/"; + ibooker.setCurrentFolder(subfolder); + + fHistnBClusVsLS[0] = ibooker.book1D("nBClusVsLS_0","Fraction of Clusters vs LS Barrel layer 0",8000,0.5,8000.5); + fHistnBClusVsLS[1] = ibooker.book1D("nBClusVsLS_1","Fraction of Clusters vs LS Barrel layer 1",8000,0.5,8000.5); + fHistnBClusVsLS[2] = ibooker.book1D("nBClusVsLS_2","Fraction of Clusters vs LS Barrel layer 2",8000,0.5,8000.5); + fHistnFPClusVsLS[0] = ibooker.book1D("nFPClusVsLS_0","Fraction of Clusters vs LS Barrel layer 0",8000,0.5,8000.5); + fHistnFPClusVsLS[1] = ibooker.book1D("nFPClusVsLS_1","Fraction of Clusters vs LS Barrel layer 1",8000,0.5,8000.5); + fHistnFMClusVsLS[0] = ibooker.book1D("nFMClusVsLS_0","Fraction of Clusters vs LS Barrel layer 0",8000,0.5,8000.5); + fHistnFMClusVsLS[1] = ibooker.book1D("nFMClusVsLS_1","Fraction of Clusters vs LS Barrel layer 1",8000,0.5,8000.5); + fHistBunchCrossings = ibooker.book1D("BunchCrossings","Cumulative Bunch Crossings",lastBunchCrossing, + 0.5,float(lastBunchCrossing)+0.5); + fHistBunchCrossingsLastLumi = ibooker.book1D("BunchCrossingsLL","Bunch Crossings Last Lumi",lastBunchCrossing, + 0.5,float(lastBunchCrossing)+0.5); + fHistClusterCountByBxLastLumi = ibooker.book1D("ClusterCountByBxLL","Cluster Count by BX Last Lumi",lastBunchCrossing, + 0.5,float(lastBunchCrossing)+0.5); + fHistClusterCountByBxCumulative = ibooker.book1D("ClusterCountByBxSum","Cluster Count by BX Cumulative",lastBunchCrossing, + 0.5,float(lastBunchCrossing)+0.5); + fHistClusByLS = ibooker.book1D("totalClusByLS","Number of Clusters all dets vs LS",8000,0.5,8000.5); + + // Add some pixel cluster quality check histograms (in a subfolder). + subfolder = folder+"qualityChecks/"; + ibooker.setCurrentFolder(subfolder); + + if (fIncludePixelQualCheckHistos) { + // Create histograms for this run if not already present in our list. + edm::LogInfo("Status") << "Creating histograms for run #" << run.id().run(); + + // Pixel cluster positions in the barrel - (z, phi). + for (size_t i = 1; i <= kNumLayers; ++i) { + std::stringstream key; + key << "clusPosBarrel" << i; + std::stringstream name; + name << key.str() << "_" << run.run(); + std::stringstream title; + title << "Pixel cluster position - barrel layer " << i; + fHistContainerThisRun[key.str()] = ibooker.book2D(name.str().c_str(), + title.str().c_str(), + 100, -30., 30., + 64, -Geom::pi(), Geom::pi()); + } + + // Pixel cluster positions in the endcaps (x, y). + std::vector sides; + sides.push_back("M"); + sides.push_back("P"); + for (std::vector::const_iterator side = sides.begin(); + side != sides.end(); ++side) { + for (size_t i = 1; i <= kNumDisks; ++i) { + std::stringstream key; + key << "clusPosEndCap" << *side << i; + std::stringstream name; + name << key.str() << "_" << run.run(); + std::stringstream title; + title << "Pixel cluster position - endcap disk " << i; + fHistContainerThisRun[key.str()] = ibooker.book2D(name.str().c_str(), + title.str().c_str(), + 100, -20., 20., + 100, -20., 20.); + } + } + + // Pixel cluster charge in the barrel, per bx. + for (size_t i = 1; i <= kNumLayers; ++i) { + std::stringstream key; + key << "clusChargeBarrel" << i; + std::stringstream name; + name << key.str() << "_" << run.run(); + std::stringstream title; + title << "Pixel cluster charge - barrel layer " << i; + fHistContainerThisRun[key.str()] = ibooker.book2D(name.str().c_str(), + title.str().c_str(), + 3564, .5, 3564.5, + 100, 0., 100.); + } + + // Pixel cluster charge in the endcaps, per bx. + for (std::vector::const_iterator side = sides.begin(); + side != sides.end(); ++side) { + for (size_t i = 1; i <= kNumDisks; ++i) { + std::stringstream key; + key << "clusChargeEndCap" << *side << i; + std::stringstream name; + name << key.str() << "_" << run.run(); + std::stringstream title; + title << "Pixel cluster charge - endcap disk " << i; + fHistContainerThisRun[key.str()] = ibooker.book2D(name.str().c_str(), + title.str().c_str(), + 3564, .5, 3564.5, + 100, 0., 100.); + } + } + + // Pixel cluster size in the barrel, per bx. + for (size_t i = 1; i <= kNumLayers; ++i) { + std::stringstream key; + key << "clusSizeBarrel" << i; + std::stringstream name; + name << key.str() << "_" << run.run(); + std::stringstream title; + title << "Pixel cluster size - barrel layer " << i; + fHistContainerThisRun[key.str()] = ibooker.book2D(name.str().c_str(), + title.str().c_str(), + 3564, .5, 3564.5, + 100, 0., 100.); + } + + // Pixel cluster size in the endcaps, per bx. + for (std::vector::const_iterator side = sides.begin(); + side != sides.end(); ++side) { + for (size_t i = 1; i <= kNumDisks; ++i) { + std::stringstream key; + key << "clusSizeEndCap" << *side << i; + std::stringstream name; + name << key.str() << "_" << run.run(); + std::stringstream title; + title << "Pixel cluster size - endcap disk " << i; + fHistContainerThisRun[key.str()] = ibooker.book2D(name.str().c_str(), + title.str().c_str(), + 3564, .5, 3564.5, + 100, 0., 100.); + } + } + } +} + +// ------------ Method called when ending the processing of a run. ------------ +void +PixelLumiDQM::dqmBeginRun(edm::Run const&, edm::EventSetup const&) +{ +} + +// ------------ Method called when ending the processing of a run. ------------ +void +PixelLumiDQM::endRun(edm::Run const&, edm::EventSetup const&) +{ +} + + +// ------------ Method called when starting to process a luminosity block. ------------ +void +PixelLumiDQM::beginLuminosityBlock(edm::LuminosityBlock const&lumiBlock, + edm::EventSetup const&) +{ + // Only reset and fill every fResetIntervalInLumiSections (default is 1 LS) + // Return unless the PREVIOUS LS was at the right modulo value + // (e.g. is resetinterval = 5 the rest will only be executed at LS=6 + // NB: reset is done here so the histograms by LS are sent before resetting. + // NB: not being used for now since default is 1 LS. There is a bug here. + + unsigned int ls = lumiBlock.luminosityBlockAuxiliary().luminosityBlock(); + + if((ls-1)%fResetIntervalInLumiSections==0){ + fHistBunchCrossingsLastLumi->Reset(); + fHistClusterCountByBxLastLumi->Reset(); + fHistRecordedByBxLastLumi->Reset(); + } +} + + +// ------------ Method called when ending the processing of a luminosity block. ------------ +void +PixelLumiDQM::endLuminosityBlock(edm::LuminosityBlock const& lumiBlock, + edm::EventSetup const&es) +{ + + unsigned int ls = lumiBlock.luminosityBlockAuxiliary().luminosityBlock(); + + // Only fill every fResetIntervalInLumiSections (default is 1 LS) + if(ls%fResetIntervalInLumiSections!=0) return; + + printf("Lumi Block = %d\n",ls); + + if((ls-1)%fResetIntervalInLumiSections==0){ + } + + unsigned int nBClus[3] = {0,0,0}; + unsigned int nFPClus[2] = {0, 0}; + unsigned int nFMClus[2] = {0, 0}; + + double total_recorded = 0.; + double total_recorded_unc_square = 0.; + + // Obtain bunch-by-bunch cluster counts and compute totals for lumi calculation. + double totalcounts = 0.0; + double etotalcounts = 0.0; + double totalevents = 0.0; + double lumi_factor_per_bx = 0.0; + if(useInnerBarrelLayer) + lumi_factor_per_bx = FREQ_ORBIT * SECONDS_PER_LS * fResetIntervalInLumiSections / XSEC_PIXEL_CLUSTER ; + else + lumi_factor_per_bx = FREQ_ORBIT * SECONDS_PER_LS * fResetIntervalInLumiSections / rXSEC_PIXEL_CLUSTER ; + + for(std::map::iterator it = fNumPixelClusters.begin(); + it != fNumPixelClusters.end(); it++) { + + // Sum all clusters for this BX. + unsigned int total = (*it).second.numB.at(1)+ + (*it).second.numB.at(2)+(*it).second.numFP.at(0)+(*it).second.numFP.at(1)+ + (*it).second.numFM.at(0)+(*it).second.numFM.at(1); + if(useInnerBarrelLayer) total+=(*it).second.numB.at(0); + totalcounts += total; + double etotal = (*it).second.dnumB.at(1)+ + (*it).second.dnumB.at(2)+(*it).second.dnumFP.at(0)+(*it).second.dnumFP.at(1)+ + (*it).second.dnumFM.at(0)+(*it).second.dnumFM.at(1); + if(useInnerBarrelLayer) etotal = (*it).second.dnumB.at(0); + etotalcounts += etotal; + etotal = sqrt(etotal); + + fHistClusterCountByBxLastLumi->setBinContent((*it).first,total); + fHistClusterCountByBxLastLumi->setBinError((*it).first,etotal); + fHistClusterCountByBxCumulative->setBinContent((*it).first,fHistClusterCountByBxCumulative->getBinContent((*it).first)+total); + + unsigned int events_per_bx = fHistBunchCrossingsLastLumi->getBinContent((*it).first); + totalevents += events_per_bx; + double average_cluster_count = events_per_bx !=0 ? double(total)/events_per_bx : 0.; + double average_cluster_count_unc = events_per_bx!=0 ? etotal/events_per_bx : 0.; + double pixel_bx_lumi_per_ls = lumi_factor_per_bx * average_cluster_count / CM2_TO_NANOBARN ; + double pixel_bx_lumi_per_ls_unc = 0.0; + if(useInnerBarrelLayer) + pixel_bx_lumi_per_ls_unc = sqrt(lumi_factor_per_bx*lumi_factor_per_bx * + (average_cluster_count_unc*average_cluster_count_unc + + (average_cluster_count* XSEC_PIXEL_CLUSTER_UNC / + XSEC_PIXEL_CLUSTER )* + (average_cluster_count* XSEC_PIXEL_CLUSTER / + XSEC_PIXEL_CLUSTER )) + ) / CM2_TO_NANOBARN ; + else + pixel_bx_lumi_per_ls_unc = sqrt(lumi_factor_per_bx*lumi_factor_per_bx * + (average_cluster_count_unc*average_cluster_count_unc + + (average_cluster_count* rXSEC_PIXEL_CLUSTER_UNC / + rXSEC_PIXEL_CLUSTER )* + (average_cluster_count* rXSEC_PIXEL_CLUSTER / + rXSEC_PIXEL_CLUSTER )) + ) / CM2_TO_NANOBARN ; + + fHistRecordedByBxLastLumi->setBinContent((*it).first,pixel_bx_lumi_per_ls); + fHistRecordedByBxLastLumi->setBinError((*it).first,pixel_bx_lumi_per_ls_unc); + + fHistRecordedByBxCumulative->setBinContent((*it).first, + fHistRecordedByBxCumulative->getBinContent((*it).first)+ + pixel_bx_lumi_per_ls); + + /* + if(fHistRecordedByBxLastLumi->getBinContent((*it).first)!=0.) + fHistRecordedByBxLastLumi->getBinContent((*it).first)); + if(fHistRecordedByBxCumulative->getBinContent((*it).first)!=0.) + fHistRecordedByBxCumulative->getBinContent((*it).first)); + */ + + nBClus[0] +=(*it).second.numB.at(0); + nBClus[1] +=(*it).second.numB.at(1); + nBClus[2] +=(*it).second.numB.at(2); + nFPClus[0] +=(*it).second.numFP.at(0); + nFPClus[1] +=(*it).second.numFP.at(1); + nFMClus[0] +=(*it).second.numFM.at(0); + nFMClus[1] +=(*it).second.numFM.at(1); + + // Reset counters + (*it).second.Reset(); + + // std::cout << "bx="<< (*it).first << " clusters=" << (*it).second.numB.at(0)) << std::endl; + } + + if((filledAndUnmaskedBunches = calculateBunchMask(fHistClusterCountByBxCumulative,bunchTriggerMask))!=0){ + for(unsigned int i = 0; i<= lastBunchCrossing; i++){ + if(bunchTriggerMask[i]){ + double err = fHistRecordedByBxLastLumi->getBinError(i); + total_recorded += fHistRecordedByBxLastLumi->getBinContent(i); + total_recorded_unc_square += err*err; + } + } + + // Replace the total obtained by summing over BXs with the average per BX from the total cluster count and rescale + + if(totalevents > 10){ + total_recorded = lumi_factor_per_bx * totalcounts / totalevents / CM2_TO_NANOBARN ; + } + else total_recorded = 0.0; + + std::cout << " Total recorded " << total_recorded << std::endl; + fHistTotalRecordedLumiByLS->setBinContent(ls,total_recorded); + fHistTotalRecordedLumiByLS->setBinError(ls, + sqrt(total_recorded_unc_square)); + } + // fill cluster counts by detector regions for sanity checks + unsigned int all_detectors_counts = 0; + for(unsigned int i = 0; i < 3; i++){ + all_detectors_counts+=nBClus[i]; + } + for(unsigned int i = 0; i < 2; i++){ + all_detectors_counts+=nFPClus[i]; + } + for(unsigned int i = 0; i < 2; i++){ + all_detectors_counts+=nFMClus[i]; + } + + fHistClusByLS->setBinContent(ls, all_detectors_counts); + + for(unsigned int i = 0; i < 3; i++){ + fHistnBClusVsLS[i]->setBinContent(ls, + float(nBClus[i])/float(all_detectors_counts)); + } + for(unsigned int i = 0; i < 2; i++){ + fHistnFPClusVsLS[i]->setBinContent(ls, + float(nFPClus[i])/float(all_detectors_counts)); + } + for(unsigned int i = 0; i < 2; i++){ + fHistnFMClusVsLS[i]->setBinContent(ls, + float(nFMClus[i])/float(all_detectors_counts)); + } + + logFile_.open(fLogFileName_.c_str(),std::ios_base::trunc); + + timeval tv; + gettimeofday(&tv,0); + tm *ts = gmtime(&tv.tv_sec); + char datestring[256]; + strftime(datestring, sizeof(datestring),"%Y.%m.%d %T GMT %s",ts); + logFile_ << "RunNumber "<< fRunNo << std::endl; + logFile_ << "EndTimeOfFit " << datestring << std::endl; + logFile_.close(); +} + +unsigned int PixelLumiDQM::calculateBunchMask(MonitorElement *e, std::vector &mask){ + unsigned int nbins = e->getNbinsX(); + std::vector ar(nbins,0.); + for(unsigned int i = 1; i<= nbins; i++){ + ar[i] = e->getBinContent(i); + } + return calculateBunchMask(ar,nbins,mask); +} +unsigned int PixelLumiDQM::calculateBunchMask(std::vector &e, unsigned int nbins, std::vector &mask){ + // Take the cumulative cluster count histogram and find max and average of non-empty bins. + unsigned int active_count = 0; + double maxc = 0.0; + double ave = 0.0; // Average of non-empty bins + unsigned int non_empty_bins = 0; + + for(unsigned int i = 1; i<= nbins; i++){ + double bin = e[i]; + if(bin !=0.0){ + if(maxcGetParameter("Mean"); + sigma = fit->GetParameter("Sigma"); + } + std::cout << "Bunch mask will use mean" << mean << " sigma " << sigma << std::endl; + // Active BX defined as those which have nclus within fixed standard deviations of peak. + for(unsigned int i = 1; i<= nbins; i++){ + double bin = e[i]; + if(bin>0. && abs(bin-mean)<5.*(sigma)){ mask[i]=true; active_count++;} + } + std::cout << "Bunch mask finds " << active_count << " active bunch crossings " << std::endl; + // std::cout << "this is the full bx mask " ; + // for(unsigned int i = 1; i<= nbins; i++) + // std::cout << ((mask[i]) ? 1:0); + // std::cout << std::endl; + return active_count; +} +// Define this as a CMSSW plug-in. +DEFINE_FWK_MODULE(PixelLumiDQM); diff --git a/DQM/PixelLumi/plugins/PixelLumiDQM.h b/DQM/PixelLumi/plugins/PixelLumiDQM.h new file mode 100755 index 0000000000000..eac0488f0a9d0 --- /dev/null +++ b/DQM/PixelLumi/plugins/PixelLumiDQM.h @@ -0,0 +1,175 @@ +// -*- C++ -*- + +// Package: PixelLumiDQM +// Class: PixelLumiDQM + +/**\class PixelLumiDQM PixelLumiDQM.h PixelLumi/PixelLumiDQM/plugins/PixelLumiDQM.h + + Description: DQM Module producing Pixel Cluster Count Luminosity + + Implementation notes: + 1) Filling scheme is put in by 'hand' for now. + Can obtain it from the cluster count but need higher rate in trigger; + Best would be to have filling scheme in the DB. + 2) Afterglow correction is put in by hand. + 3) Currently barrel layer 0 is excluded, but a version using all pixel layers and disks is also in place. + 4) A stable beam flag should be obtained from the DB to turn on actual checks. + (Pixel Lumi does not make sense outside stable beams.) + 5) Need a top module to correlate the info from the three trigger categories. + NB: at present the module only uses the ZeroBias trigger providing about 85 Hz. +*/ + +// Original author: Amita Raval + +#ifndef __PixelLumi_PixelLumiDQM_PixelLumiDQM_h__ +#define __PixelLumi_PixelLumiDQM_PixelLumiDQM_h__ + +#include +#include +#include +#include + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" +#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" + +class ConfigurationDescriptions; + +class PixelLumiDQM : public DQMEDAnalyzer { +public: + explicit PixelLumiDQM(const edm::ParameterSet&); + ~PixelLumiDQM(); + static constexpr double FREQ_ORBIT = 11245.5; + static constexpr double SECONDS_PER_LS = double(0x40000)/double(FREQ_ORBIT); + + // Using all pixel clusters: + static constexpr double XSEC_PIXEL_CLUSTER = 10.08e-24; //in cm^2 + static constexpr double XSEC_PIXEL_CLUSTER_UNC = 0.17e-24; + + // Excluding the inner barrel layer. + static constexpr double rXSEC_PIXEL_CLUSTER = 6.08e-24; //in cm^2 + static constexpr double rXSEC_PIXEL_CLUSTER_UNC = 0.084e-24; + static constexpr double CM2_TO_NANOBARN = 1.0/1.e-33; + static const unsigned int lastBunchCrossing = 3564; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + virtual void analyze(const edm::Event&, const edm::EventSetup&); + virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const&) override; + virtual void dqmBeginRun(edm::Run const&, edm::EventSetup const&); + virtual void endRun(edm::Run const&, edm::EventSetup const&); + virtual void beginLuminosityBlock(edm::LuminosityBlock const&, + edm::EventSetup const&); + virtual void endLuminosityBlock(edm::LuminosityBlock const&, + edm::EventSetup const&); + + // This is a kludge method to infer the filled bunches from the cluster count; + // notice that this cannot be used with random triggers. + // The filling scheme should be acquired from the database once it's there. + + unsigned int calculateBunchMask(MonitorElement *, std::vector &); + unsigned int calculateBunchMask(std::vector &, unsigned int, std::vector &); + // ---------- Member data ---------- + + // Hard-coded numbers of layers and disks... + static size_t const kNumLayers = 3; + static size_t const kNumDisks = 2; + + class PixelClusterCount { + // B for barrel, F for forwared, M for minus, P for plus side, + // O for outer and I for inner. Numbers used for layers. + public: + PixelClusterCount() : + numB(kNumLayers, 0), + numFM(kNumDisks, 0), + numFP(kNumDisks, 0), + dnumB(kNumLayers, 0.0), + dnumFM(kNumDisks, 0.0), + dnumFP(kNumDisks, 0.0) + + { + } + void Reset() + { + for(unsigned int i = 0 ; i< numB.size(); i++){ + numB[i]=0; + dnumB[i]=0.0; + } + for(unsigned int i = 0 ; i< numFM.size(); i++){ + numFM[i] = 0; + numFP[i] = 0; + dnumFM[i] = 0.0; + dnumFP[i] = 0.0; + } + } + std::vector numB; + std::vector numFM; + std::vector numFP; + std::vector dnumB; + std::vector dnumFM; + std::vector dnumFP; + private: + }; + + edm::EDGetTokenT > fPixelClusterLabel; + + UInt_t fRunNo; + UInt_t fEvtNo; + UInt_t fLSNo; + UInt_t fBXNo; + UInt_t fTimestamp; + UInt_t fNumVtx; + UInt_t fNumVtxGood; + UInt_t fNumTrkPerVtx; + Double_t fVtxX; + Double_t fVtxY; + Double_t fVtxZ; + Double_t fChi2; + Double_t fNdof; + std::map fNumPixelClusters; + + bool fIncludeVertexInfo; + bool fIncludePixelClusterInfo; + bool fIncludePixelQualCheckHistos; + int fResetIntervalInLumiSections; + + std::map fHistContainerThisRun; + + // This is a list of modules to be ignored, either because they were + // dead or are dead in part of the data-taking period. + std::vector fDeadModules; + + // The minimum number of pixels that should live in a cluster in + // order for the cluster to be counted as a real cluster + // (as opposed to, e.g., a noise pixel). + int fMinPixelsPerCluster; + + // The minimum pixel cluster charge for a cluster to be counted. + double fMinClusterCharge; + + // Use the module label to distinguish the three different streams. + + MonitorElement *fIntActiveCrossingsFromDB; + MonitorElement *fHistnBClusVsLS[3]; + MonitorElement *fHistnFPClusVsLS[2]; + MonitorElement *fHistnFMClusVsLS[2]; + MonitorElement *fHistBunchCrossings; + MonitorElement *fHistBunchCrossingsLastLumi; + MonitorElement *fHistClusterCountByBxLastLumi; + MonitorElement *fHistClusterCountByBxCumulative; + MonitorElement *fHistClusByLS; + MonitorElement *fHistTotalRecordedLumiByLS; + MonitorElement *fHistRecordedByBxLastLumi; + MonitorElement *fHistRecordedByBxCumulative; + + std::vector bunchTriggerMask; + unsigned int filledAndUnmaskedBunches; + bool useInnerBarrelLayer; + unsigned int fFillNumber; + std::string fLogFileName_; + + std::ofstream logFile_; +}; + +#endif diff --git a/DQM/PixelLumi/python/PixelLumiDQM_cfi.py b/DQM/PixelLumi/python/PixelLumiDQM_cfi.py new file mode 100755 index 0000000000000..c24eda682fcc5 --- /dev/null +++ b/DQM/PixelLumi/python/PixelLumiDQM_cfi.py @@ -0,0 +1,13 @@ +import FWCore.ParameterSet.Config as cms + +pixel_lumi_dqm = cms.EDAnalyzer('PixelLumiDQM', + pixelClusterLabel = cms.untracked.InputTag("siPixelClusters"), + includePixelClusterInfo = cms.untracked.bool(True), + includePixelQualCheckHistos = cms.untracked.bool(True), + # This is the correct list of modules to be ignored for 2012. + deadModules = cms.untracked.vuint32(), + # Only count pixel clusters with a minimum number of pixels. + minNumPixelsPerCluster = cms.untracked.int32(2), + # Only count pixel clusters with a minimum charge. + minChargePerCluster = cms.untracked.double(15000.) + ) diff --git a/DQM/PixelLumi/python/ZeroBiasSelector_cfi.py b/DQM/PixelLumi/python/ZeroBiasSelector_cfi.py new file mode 100755 index 0000000000000..88af2c2fec12c --- /dev/null +++ b/DQM/PixelLumi/python/ZeroBiasSelector_cfi.py @@ -0,0 +1,11 @@ +import FWCore.ParameterSet.Config as cms + +# Selects only zerobias events. + +zerobias_selector = cms.EDFilter("HLTHighLevel", + TriggerResultsTag = cms.InputTag("TriggerResults","","HLT"), + HLTPaths = cms.vstring("AlCa_LumiPixels_ZeroBias*"), + eventSetupPathsKey = cms.string(''), + andOr = cms.bool(True), + throw = cms.bool(False) + )