CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes
PixelLumiDQM Class Reference

#include <PixelLumiDQM.h>

Inheritance diagram for PixelLumiDQM:
DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks > edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::Accumulator, Args... > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

class  PixelClusterCount
 

Public Member Functions

 PixelLumiDQM (const edm::ParameterSet &)
 
 ~PixelLumiDQM () override
 
- Public Member Functions inherited from DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >
void accumulate (edm::Event const &event, edm::EventSetup const &setup) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
 DQMOneEDAnalyzer ()
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::Accumulator, Args... >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Static Public Attributes

static constexpr double CM2_TO_NANOBARN = 1.0 / 1.e-33
 
static constexpr double FREQ_ORBIT = 11245.5
 
static const unsigned int lastBunchCrossing = 3564
 
static constexpr double rXSEC_PIXEL_CLUSTER = 9.4e-24
 
static constexpr double rXSEC_PIXEL_CLUSTER_UNC = 0.119e-24
 
static constexpr double SECONDS_PER_LS = double(0x40000) / double(FREQ_ORBIT)
 
static constexpr double XSEC_PIXEL_CLUSTER = 10.08e-24
 
static constexpr double XSEC_PIXEL_CLUSTER_UNC = 0.17e-24
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
unsigned int calculateBunchMask (MonitorElement *, std::vector< bool > &)
 
unsigned int calculateBunchMask (std::vector< float > &, unsigned int, std::vector< bool > &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 

Private Attributes

std::vector< bool > bunchTriggerMask
 
UInt_t fBXNo
 
Double_t fChi2
 
std::vector< uint32_t > fDeadModules
 
UInt_t fEvtNo
 
unsigned int fFillNumber
 
MonitorElementfHistBunchCrossings
 
MonitorElementfHistBunchCrossingsLastLumi
 
MonitorElementfHistClusByLS
 
MonitorElementfHistClusterCountByBxCumulative
 
MonitorElementfHistClusterCountByBxLastLumi
 
std::map< std::string, MonitorElement * > fHistContainerThisRun
 
MonitorElementfHistnBClusVsLS [3]
 
MonitorElementfHistnFMClusVsLS [2]
 
MonitorElementfHistnFPClusVsLS [2]
 
MonitorElementfHistRecordedByBxCumulative
 
MonitorElementfHistRecordedByBxLastLumi
 
MonitorElementfHistTotalRecordedLumiByLS
 
unsigned int filledAndUnmaskedBunches
 
bool fIncludePixelClusterInfo
 
bool fIncludePixelQualCheckHistos
 
bool fIncludeVertexInfo
 
MonitorElementfIntActiveCrossingsFromDB
 
std::string fLogFileName_
 
UInt_t fLSNo
 
double fMinClusterCharge
 
int fMinPixelsPerCluster
 
Double_t fNdof
 
std::map< int, PixelClusterCountfNumPixelClusters
 
UInt_t fNumTrkPerVtx
 
UInt_t fNumVtx
 
UInt_t fNumVtxGood
 
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > fPixelClusterLabel
 
int fResetIntervalInLumiSections
 
UInt_t fRunNo
 
UInt_t fTimestamp
 
Double_t fVtxX
 
Double_t fVtxY
 
Double_t fVtxZ
 
std::ofstream logFile_
 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtkGeomToken_
 
bool useInnerBarrelLayer
 

Static Private Attributes

static constexpr size_t kNumDisks = 12
 
static constexpr size_t kNumLayers = 5
 
static constexpr size_t kOffsetDisks = 4
 
static constexpr size_t kOffsetLayers = 0
 

Additional Inherited Members

- Public Types inherited from DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 
- Protected Attributes inherited from DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

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.

Definition at line 41 of file PixelLumiDQM.h.

Constructor & Destructor Documentation

◆ PixelLumiDQM()

PixelLumiDQM::PixelLumiDQM ( const edm::ParameterSet iConfig)
explicit

Definition at line 47 of file PixelLumiDQM.cc.

References fDeadModules, fIncludePixelClusterInfo, fIncludePixelQualCheckHistos, fMinClusterCharge, fMinPixelsPerCluster, edm::ParameterSet::getUntrackedParameter(), and ProducerED_cfi::InputTag.

49  iConfig.getUntrackedParameter<edm::InputTag>("pixelClusterLabel", edm::InputTag("siPixelClusters")))),
51  fIncludePixelClusterInfo(iConfig.getUntrackedParameter<bool>("includePixelClusterInfo", true)),
52  fIncludePixelQualCheckHistos(iConfig.getUntrackedParameter<bool>("includePixelQualCheckHistos", true)),
53  fResetIntervalInLumiSections(iConfig.getUntrackedParameter<int>("resetEveryNLumiSections", 1)),
54  fDeadModules(iConfig.getUntrackedParameter<std::vector<uint32_t>>("deadModules", std::vector<uint32_t>())),
55  fMinPixelsPerCluster(iConfig.getUntrackedParameter<int>("minNumPixelsPerCluster", 0)),
56  fMinClusterCharge(iConfig.getUntrackedParameter<double>("minChargePerCluster", 0)),
59  useInnerBarrelLayer(iConfig.getUntrackedParameter<bool>("useInnerBarrelLayer", false)),
60  fLogFileName_(iConfig.getUntrackedParameter<std::string>("logFileName", "/tmp/pixel_lumi.txt")) {
61  edm::LogInfo("Configuration") << "PixelLumiDQM looking for pixel clusters in '"
62  << iConfig.getUntrackedParameter<edm::InputTag>("pixelClusterLabel",
63  edm::InputTag("siPixelClusters"))
64  << "'";
65  edm::LogInfo("Configuration") << "PixelLumiDQM storing pixel cluster info? " << fIncludePixelClusterInfo;
66  edm::LogInfo("Configuration") << "PixelLumiDQM storing pixel cluster quality check histograms? "
68 
69  if (fDeadModules.empty()) {
70  edm::LogInfo("Configuration") << "No pixel modules specified to be ignored";
71  } else {
72  edm::LogInfo("Configuration") << fDeadModules.size() << " pixel modules specified to be ignored:";
73  for (std::vector<uint32_t>::const_iterator it = fDeadModules.begin(); it != fDeadModules.end(); ++it) {
74  edm::LogInfo("Configuration") << " " << *it;
75  }
76  }
77  edm::LogInfo("Configuration") << "Ignoring pixel clusters with less than " << fMinPixelsPerCluster << " pixels";
78  edm::LogInfo("Configuration") << "Ignoring pixel clusters with charge less than " << fMinClusterCharge;
79 }
bool fIncludePixelQualCheckHistos
Definition: PixelLumiDQM.h:135
unsigned int filledAndUnmaskedBunches
Definition: PixelLumiDQM.h:168
static const unsigned int lastBunchCrossing
Definition: PixelLumiDQM.h:56
std::vector< uint32_t > fDeadModules
Definition: PixelLumiDQM.h:142
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
Definition: PixelLumiDQM.h:116
int fResetIntervalInLumiSections
Definition: PixelLumiDQM.h:136
bool useInnerBarrelLayer
Definition: PixelLumiDQM.h:169
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > fPixelClusterLabel
Definition: PixelLumiDQM.h:115
double fMinClusterCharge
Definition: PixelLumiDQM.h:150
Log< level::Info, false > LogInfo
std::vector< bool > bunchTriggerMask
Definition: PixelLumiDQM.h:167
bool fIncludePixelClusterInfo
Definition: PixelLumiDQM.h:134
std::string fLogFileName_
Definition: PixelLumiDQM.h:171
int fMinPixelsPerCluster
Definition: PixelLumiDQM.h:147

◆ ~PixelLumiDQM()

PixelLumiDQM::~PixelLumiDQM ( )
override

Definition at line 81 of file PixelLumiDQM.cc.

81 {}

Member Function Documentation

◆ analyze()

void PixelLumiDQM::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >.

Definition at line 89 of file PixelLumiDQM.cc.

References cms::cuda::assert(), edmNew::DetSetVector< T >::begin(), ALCARECOTkAlJpsiMuMu_cff::charge, hcalRecHitTable_cff::detId, TrackerGeometry::dets(), edmNew::DetSetVector< T >::end(), fBXNo, fDeadModules, fEvtNo, fHistBunchCrossings, fHistBunchCrossingsLastLumi, fHistContainerThisRun, dqm::impl::MonitorElement::Fill(), fIncludePixelClusterInfo, fIncludePixelQualCheckHistos, spr::find(), fLSNo, fMinClusterCharge, fMinPixelsPerCluster, fNumPixelClusters, fPixelClusterLabel, fRunNo, fTimestamp, edm::EventSetup::getData(), mps_fire::i, TrackerGeometry::idToDet(), iEvent, GeomDetEnumerators::isTrackerPixel(), kNumDisks, kNumLayers, kOffsetDisks, kOffsetLayers, nano_mu_digi_cff::layer, PixelBarrelNameUpgrade::layerName(), Topology::localPosition(), PixelEndcapNameUpgrade::mI, PixelEndcapNameUpgrade::mO, PV3DBase< T, PVType, FrameType >::phi(), PixelEndcapNameUpgrade::pI, PixelSubdetector::PixelBarrel, DQMOffline_LumiMonitoring_cff::pixelClusters, PixelSubdetector::PixelEndcap, PixelEndcapNameUpgrade::pO, findQualityFiles::size, PixelGeomDetUnit::specificTopology(), mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, GeomDet::surface(), tkGeomToken_, to_string(), Surface::toGlobal(), x, PV3DBase< T, PVType, FrameType >::x(), y, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

89  {
90  // Collect all bookkeeping information.
91  fRunNo = iEvent.id().run();
92  fEvtNo = iEvent.id().event();
93  fLSNo = iEvent.getLuminosityBlock().luminosityBlock();
94  fBXNo = iEvent.bunchCrossing();
95  fTimestamp = iEvent.time().unixTime();
98  // This serves as event counter to compute luminosity from cluster counts.
99  std::map<int, PixelClusterCount>::iterator it = fNumPixelClusters.find(fBXNo);
100  if (it == fNumPixelClusters.end())
101  fNumPixelClusters[fBXNo] = PixelClusterCount();
102  // Find tracker geometry.
103  const TrackerGeometry *trackerGeo = &iSetup.getData(tkGeomToken_);
105  // Find pixel clusters.
108 
109  // Loop over entire tracker geometry.
110  for (TrackerGeometry::DetContainer::const_iterator i = trackerGeo->dets().begin(); i != trackerGeo->dets().end();
111  ++i) {
112  // See if this is a pixel unit(?).
113 
114  if (GeomDetEnumerators::isTrackerPixel((*i)->subDetector())) {
115  DetId detId = (*i)->geographicalId();
116  // Find all clusters on this detector module.
118  if (iSearch != pixelClusters->end()) {
119  // Count the number of clusters with at least a minimum
120  // number of pixels per cluster and at least a minimum charge.
121  size_t numClusters = 0;
122  for (edmNew::DetSet<SiPixelCluster>::const_iterator itClus = iSearch->begin(); itClus != iSearch->end();
123  ++itClus) {
124  if ((itClus->size() >= fMinPixelsPerCluster) && (itClus->charge() >= fMinClusterCharge)) {
125  ++numClusters;
126  }
127  }
128  // DEBUG DEBUG DEBUG
129  assert(numClusters <= iSearch->size());
130  // DEBUG DEBUG DEBUG end
131 
132  // Add up the cluster count based on the position of this detector
133  // element.
134  if (detId.subdetId() == PixelSubdetector::PixelBarrel) {
136  int layer = detName.layerName() - kOffsetLayers;
137  fNumPixelClusters[fBXNo].numB.at(layer) += numClusters;
138  fNumPixelClusters[fBXNo].dnumB.at(layer) += sqrt(numClusters);
139  } else {
140  // DEBUG DEBUG DEBUG
142  // DEBUG DEBUG DEBUG end
143 
145  PixelEndcapNameUpgrade::HalfCylinder halfCylinder = detName.halfCylinder();
146  int disk = detName.diskName() - kOffsetDisks;
147  switch (halfCylinder) {
150  fNumPixelClusters[fBXNo].numFM.at(disk) += numClusters;
151  fNumPixelClusters[fBXNo].dnumFM.at(disk) += sqrt(numClusters);
152  break;
155  fNumPixelClusters[fBXNo].numFP.at(disk) += numClusters;
156  fNumPixelClusters[fBXNo].dnumFP.at(disk) += sqrt(numClusters);
157  break;
158  default:
159  assert(false);
160  break;
161  }
162  }
163  }
164  }
165  }
166  }
167  // ----------
168 
169  // Fill some pixel cluster quality check histograms if requested.
171  // Find pixel clusters.
174 
175  bool filterDeadModules = (!fDeadModules.empty());
176  std::vector<uint32_t>::const_iterator deadModulesBegin = fDeadModules.begin();
177  std::vector<uint32_t>::const_iterator deadModulesEnd = fDeadModules.end();
178 
179  // Loop over entire tracker geometry.
180  for (TrackerGeometry::DetContainer::const_iterator i = trackerGeo->dets().begin(); i != trackerGeo->dets().end();
181  ++i) {
182  // See if this is a pixel module.
183  if (GeomDetEnumerators::isTrackerPixel((*i)->subDetector())) {
184  DetId detId = (*i)->geographicalId();
185 
186  // Skip this module if it's on the list of modules to be ignored.
187  if (filterDeadModules && find(deadModulesBegin, deadModulesEnd, detId()) != deadModulesEnd) {
188  continue;
189  }
190 
191  // Find all clusters in this module.
193 
194  // Loop over all clusters in this module.
195  if (iSearch != pixelClusters->end()) {
196  for (edmNew::DetSet<SiPixelCluster>::const_iterator clus = iSearch->begin(); clus != iSearch->end(); ++clus) {
197  if ((clus->size() >= fMinPixelsPerCluster) && (clus->charge() >= fMinClusterCharge)) {
198  PixelGeomDetUnit const *theGeomDet = dynamic_cast<PixelGeomDetUnit const *>(trackerGeo->idToDet(detId));
199  PixelTopology const *topol = &(theGeomDet->specificTopology());
200  double x = clus->x();
201  double y = clus->y();
202  LocalPoint clustLP = topol->localPosition(MeasurementPoint(x, y));
203  GlobalPoint clustGP = theGeomDet->surface().toGlobal(clustLP);
204  double charge = clus->charge() / 1.e3;
205  int size = clus->size();
206 
207  if (detId.subdetId() == PixelSubdetector::PixelBarrel) {
209  unsigned int layer = detName.layerName() - kOffsetLayers;
210  if (layer < kNumLayers) {
211  std::string histName;
212  histName = "clusPosBarrel" + std::to_string(layer);
213  fHistContainerThisRun[histName]->Fill(clustGP.z(), clustGP.phi());
214  histName = "clusChargeBarrel" + std::to_string(layer);
215  fHistContainerThisRun[histName]->Fill(iEvent.bunchCrossing(), charge);
216  histName = "clusSizeBarrel" + std::to_string(layer);
217  fHistContainerThisRun[histName]->Fill(iEvent.bunchCrossing(), size);
218  } else {
219  edm::LogWarning("pixelLumi") << "higher layer number, " << layer << ", than layers";
220  }
221  } else {
222  // DEBUG DEBUG DEBUG
224  // DEBUG DEBUG DEBUG end
225 
227  unsigned int disk = detName.diskName() - kOffsetDisks;
228  if (disk < kNumDisks) {
229  std::string histName;
230  histName = "clusPosEndCap" + std::to_string(disk);
231  fHistContainerThisRun[histName]->Fill(clustGP.x(), clustGP.y());
232  histName = "clusChargeEndCap" + std::to_string(disk);
233  fHistContainerThisRun[histName]->Fill(iEvent.bunchCrossing(), charge);
234  histName = "clusSizeEndCap" + std::to_string(disk);
235  fHistContainerThisRun[histName]->Fill(iEvent.bunchCrossing(), size);
236  } else {
237  edm::LogWarning("pixelLumi")
238  << "higher disk number, " << disk << ", than disks," << kNumDisks << std::endl;
239  }
240  }
241  }
242  }
243  }
244  }
245  }
246  }
247 }
size
Write out results.
bool fIncludePixelQualCheckHistos
Definition: PixelLumiDQM.h:135
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
std::vector< uint32_t > fDeadModules
Definition: PixelLumiDQM.h:142
T z() const
Definition: PV3DBase.h:61
int layerName() const
layer id
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
static constexpr size_t kOffsetDisks
Definition: PixelLumiDQM.h:78
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
Definition: PixelLumiDQM.h:116
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
data_type const * const_iterator
Definition: DetSetNew.h:31
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
assert(be >=bs)
static std::string to_string(const XMLCh *ch)
const_iterator end(bool update=false) const
void Fill(long long x)
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
static constexpr size_t kNumDisks
Definition: PixelLumiDQM.h:76
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > fPixelClusterLabel
Definition: PixelLumiDQM.h:115
T sqrt(T t)
Definition: SSEVec.h:19
const TrackerGeomDet * idToDet(DetId) const override
std::map< std::string, MonitorElement * > fHistContainerThisRun
Definition: PixelLumiDQM.h:138
double fMinClusterCharge
Definition: PixelLumiDQM.h:150
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetId.h:17
const_iterator begin(bool update=false) const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
bool fIncludePixelClusterInfo
Definition: PixelLumiDQM.h:134
MonitorElement * fHistBunchCrossings
Definition: PixelLumiDQM.h:158
MonitorElement * fHistBunchCrossingsLastLumi
Definition: PixelLumiDQM.h:159
UInt_t fTimestamp
Definition: PixelLumiDQM.h:122
static constexpr size_t kOffsetLayers
Definition: PixelLumiDQM.h:77
std::map< int, PixelClusterCount > fNumPixelClusters
Definition: PixelLumiDQM.h:131
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
int fMinPixelsPerCluster
Definition: PixelLumiDQM.h:147
Log< level::Warning, false > LogWarning
bool isTrackerPixel(GeomDetEnumerators::SubDetector m)
static constexpr size_t kNumLayers
Definition: PixelLumiDQM.h:75

◆ beginLuminosityBlock()

void PixelLumiDQM::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &   
)
overrideprivate

Definition at line 374 of file PixelLumiDQM.cc.

References fHistBunchCrossingsLastLumi, fHistClusterCountByBxLastLumi, fHistRecordedByBxLastLumi, fResetIntervalInLumiSections, eostools::ls(), edm::LuminosityBlockAuxiliary::luminosityBlock(), edm::LuminosityBlock::luminosityBlockAuxiliary(), and dqm::impl::MonitorElement::Reset().

374  {
375  // Only reset and fill every fResetIntervalInLumiSections (default is 1 LS)
376  // Return unless the PREVIOUS LS was at the right modulo value
377  // (e.g. is resetinterval = 5 the rest will only be executed at LS=6
378  // NB: reset is done here so the histograms by LS are sent before resetting.
379  // NB: not being used for now since default is 1 LS. There is a bug here.
380 
381  unsigned int ls = lumiBlock.luminosityBlockAuxiliary().luminosityBlock();
382 
383  if ((ls - 1) % fResetIntervalInLumiSections == 0) {
387  }
388 }
int fResetIntervalInLumiSections
Definition: PixelLumiDQM.h:136
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
MonitorElement * fHistClusterCountByBxLastLumi
Definition: PixelLumiDQM.h:160
def ls(path, rec=False)
Definition: eostools.py:349
MonitorElement * fHistBunchCrossingsLastLumi
Definition: PixelLumiDQM.h:159
MonitorElement * fHistRecordedByBxLastLumi
Definition: PixelLumiDQM.h:164

◆ bookHistograms()

void PixelLumiDQM::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  run,
edm::EventSetup const &   
)
overrideprivatevirtual

Implements DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >.

Definition at line 249 of file PixelLumiDQM.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), fHistBunchCrossings, fHistBunchCrossingsLastLumi, fHistClusByLS, fHistClusterCountByBxCumulative, fHistClusterCountByBxLastLumi, fHistContainerThisRun, fHistnBClusVsLS, fHistnFMClusVsLS, fHistnFPClusVsLS, fHistRecordedByBxCumulative, fHistRecordedByBxLastLumi, fHistTotalRecordedLumiByLS, fIncludePixelQualCheckHistos, printsummarytable::folder, mps_fire::i, submitPVResolutionJobs::key, kNumDisks, kNumLayers, lastBunchCrossing, Skims_PA_cff::name, Geom::pi(), writedatasetfile::run, dqm::implementation::NavigatorBase::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and runGCPTkAlMap::title.

251  {
252  edm::LogInfo("Status") << "Starting processing of run #" << run.id().run();
253 
254  // Top folder containing high-level information about pixel and HF lumi.
255  std::string folder = "PixelLumi/";
256  ibooker.setCurrentFolder(folder);
257 
258  fHistTotalRecordedLumiByLS = ibooker.book1D("totalPixelLumiByLS", "Pixel Lumi in nb vs LS", 8000, 0.5, 8000.5);
259  fHistRecordedByBxCumulative = ibooker.book1D("PXLumiByBXsum",
260  "Pixel Lumi in nb by BX Cumulative vs LS",
262  0.5,
263  float(lastBunchCrossing) + 0.5);
264 
265  std::string subfolder = folder + "lastLS/";
266  ibooker.setCurrentFolder(subfolder);
268  "PXByBXLastLumi", "Pixel By BX Last Lumi", lastBunchCrossing + 1, -0.5, float(lastBunchCrossing) + 0.5);
269 
270  subfolder = folder + "ClusterCountingDetails/";
271  ibooker.setCurrentFolder(subfolder);
272 
273  fHistnBClusVsLS[0] = ibooker.book1D("nBClusVsLS_0", "Fraction of Clusters vs LS Barrel layer 0", 8000, 0.5, 8000.5);
274  fHistnBClusVsLS[1] = ibooker.book1D("nBClusVsLS_1", "Fraction of Clusters vs LS Barrel layer 1", 8000, 0.5, 8000.5);
275  fHistnBClusVsLS[2] = ibooker.book1D("nBClusVsLS_2", "Fraction of Clusters vs LS Barrel layer 2", 8000, 0.5, 8000.5);
276  fHistnFPClusVsLS[0] = ibooker.book1D("nFPClusVsLS_0", "Fraction of Clusters vs LS Barrel layer 0", 8000, 0.5, 8000.5);
277  fHistnFPClusVsLS[1] = ibooker.book1D("nFPClusVsLS_1", "Fraction of Clusters vs LS Barrel layer 1", 8000, 0.5, 8000.5);
278  fHistnFMClusVsLS[0] = ibooker.book1D("nFMClusVsLS_0", "Fraction of Clusters vs LS Barrel layer 0", 8000, 0.5, 8000.5);
279  fHistnFMClusVsLS[1] = ibooker.book1D("nFMClusVsLS_1", "Fraction of Clusters vs LS Barrel layer 1", 8000, 0.5, 8000.5);
280  fHistBunchCrossings = ibooker.book1D(
281  "BunchCrossings", "Cumulative Bunch Crossings", lastBunchCrossing, 0.5, float(lastBunchCrossing) + 0.5);
283  "BunchCrossingsLL", "Bunch Crossings Last Lumi", lastBunchCrossing, 0.5, float(lastBunchCrossing) + 0.5);
285  "ClusterCountByBxLL", "Cluster Count by BX Last Lumi", lastBunchCrossing, 0.5, float(lastBunchCrossing) + 0.5);
287  "ClusterCountByBxSum", "Cluster Count by BX Cumulative", lastBunchCrossing, 0.5, float(lastBunchCrossing) + 0.5);
288  fHistClusByLS = ibooker.book1D("totalClusByLS", "Number of Clusters all dets vs LS", 8000, 0.5, 8000.5);
289 
290  // Add some pixel cluster quality check histograms (in a subfolder).
291  subfolder = folder + "qualityChecks/";
292  ibooker.setCurrentFolder(subfolder);
293 
295  // Create histograms for this run if not already present in our list.
296  edm::LogInfo("Status") << "Creating histograms for run #" << run.id().run();
297 
298  // Pixel cluster positions in the barrel - (z, phi).
299  for (size_t i = 0; i <= kNumLayers; ++i) {
300  std::stringstream key;
301  key << "clusPosBarrel" << i;
302  std::stringstream name;
303  name << key.str() << "_" << run.run();
304  std::stringstream title;
305  title << "Pixel cluster position - barrel layer " << i;
306  fHistContainerThisRun[key.str()] =
307  ibooker.book2D(name.str().c_str(), title.str().c_str(), 100, -30., 30., 64, -Geom::pi(), Geom::pi());
308  }
309 
310  // Pixel cluster positions in the endcaps (x, y).
311  for (size_t i = 0; i <= kNumDisks; ++i) {
312  std::stringstream key;
313  key << "clusPosEndCap" << i;
314  std::stringstream name;
315  name << key.str() << "_" << run.run();
316  std::stringstream title;
317  title << "Pixel cluster position - endcap disk " << i;
318  fHistContainerThisRun[key.str()] =
319  ibooker.book2D(name.str().c_str(), title.str().c_str(), 100, -20., 20., 100, -20., 20.);
320  }
321 
322  // Pixel cluster charge in the barrel, per bx.
323  for (size_t i = 0; i <= kNumLayers; ++i) {
324  std::stringstream key;
325  key << "clusChargeBarrel" << i;
326  std::stringstream name;
327  name << key.str() << "_" << run.run();
328  std::stringstream title;
329  title << "Pixel cluster charge - barrel layer " << i;
330  fHistContainerThisRun[key.str()] =
331  ibooker.book2D(name.str().c_str(), title.str().c_str(), 3564, .5, 3564.5, 100, 0., 100.);
332  }
333 
334  // Pixel cluster charge in the endcaps, per bx.
335  for (size_t i = 0; i <= kNumDisks; ++i) {
336  std::stringstream key;
337  key << "clusChargeEndCap" << i;
338  std::stringstream name;
339  name << key.str() << "_" << run.run();
340  std::stringstream title;
341  title << "Pixel cluster charge - endcap disk " << i;
342  fHistContainerThisRun[key.str()] =
343  ibooker.book2D(name.str().c_str(), title.str().c_str(), 3564, .5, 3564.5, 100, 0., 100.);
344  }
345 
346  // Pixel cluster size in the barrel, per bx.
347  for (size_t i = 0; i <= kNumLayers; ++i) {
348  std::stringstream key;
349  key << "clusSizeBarrel" << i;
350  std::stringstream name;
351  name << key.str() << "_" << run.run();
352  std::stringstream title;
353  title << "Pixel cluster size - barrel layer " << i;
354  fHistContainerThisRun[key.str()] =
355  ibooker.book2D(name.str().c_str(), title.str().c_str(), 3564, .5, 3564.5, 100, 0., 100.);
356  }
357 
358  // Pixel cluster size in the endcaps, per bx.
359  for (size_t i = 0; i <= kNumDisks; ++i) {
360  std::stringstream key;
361  key << "clusSizeEndCap" << i;
362  std::stringstream name;
363  name << key.str() << "_" << run.run();
364  std::stringstream title;
365  title << "Pixel cluster size - endcap disk " << i;
366  fHistContainerThisRun[key.str()] =
367  ibooker.book2D(name.str().c_str(), title.str().c_str(), 3564, .5, 3564.5, 100, 0., 100.);
368  }
369  }
370 }
bool fIncludePixelQualCheckHistos
Definition: PixelLumiDQM.h:135
static const unsigned int lastBunchCrossing
Definition: PixelLumiDQM.h:56
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
MonitorElement * fHistRecordedByBxCumulative
Definition: PixelLumiDQM.h:165
MonitorElement * fHistClusByLS
Definition: PixelLumiDQM.h:162
static constexpr size_t kNumDisks
Definition: PixelLumiDQM.h:76
MonitorElement * fHistnFMClusVsLS[2]
Definition: PixelLumiDQM.h:157
MonitorElement * fHistClusterCountByBxLastLumi
Definition: PixelLumiDQM.h:160
MonitorElement * fHistTotalRecordedLumiByLS
Definition: PixelLumiDQM.h:163
key
prepare the HTCondor submission files and eventually submit them
MonitorElement * fHistClusterCountByBxCumulative
Definition: PixelLumiDQM.h:161
MonitorElement * fHistnBClusVsLS[3]
Definition: PixelLumiDQM.h:155
std::map< std::string, MonitorElement * > fHistContainerThisRun
Definition: PixelLumiDQM.h:138
Log< level::Info, false > LogInfo
MonitorElement * fHistBunchCrossings
Definition: PixelLumiDQM.h:158
MonitorElement * fHistBunchCrossingsLastLumi
Definition: PixelLumiDQM.h:159
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
MonitorElement * fHistRecordedByBxLastLumi
Definition: PixelLumiDQM.h:164
constexpr double pi()
Definition: Pi.h:31
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * fHistnFPClusVsLS[2]
Definition: PixelLumiDQM.h:156
static constexpr size_t kNumLayers
Definition: PixelLumiDQM.h:75

◆ calculateBunchMask() [1/2]

unsigned int PixelLumiDQM::calculateBunchMask ( MonitorElement e,
std::vector< bool > &  mask 
)
private

Definition at line 549 of file PixelLumiDQM.cc.

References MillePedeFileConverter_cfg::e, mps_fire::i, gpuClustering::pixelStatus::mask, and LaserClient_cfi::nbins.

Referenced by endLuminosityBlock().

549  {
550  unsigned int nbins = e->getNbinsX();
551  std::vector<float> ar(nbins + 1, 0.);
552  for (unsigned int i = 1; i <= nbins; i++) {
553  ar[i] = e->getBinContent(i);
554  }
555  return calculateBunchMask(ar, nbins, mask);
556 }
constexpr uint32_t mask
Definition: gpuClustering.h:26
unsigned int calculateBunchMask(MonitorElement *, std::vector< bool > &)

◆ calculateBunchMask() [2/2]

unsigned int PixelLumiDQM::calculateBunchMask ( std::vector< float > &  e,
unsigned int  nbins,
std::vector< bool > &  mask 
)
private

Definition at line 557 of file PixelLumiDQM.cc.

References funct::abs(), newFWLiteAna::bin, MillePedeFileConverter_cfg::e, l1tTowerCalibrationProducer_cfi::fit, mps_fire::i, gpuClustering::pixelStatus::mask, SiStripPI::mean, and LaserClient_cfi::nbins.

557  {
558  // Take the cumulative cluster count histogram and find max and average of
559  // non-empty bins.
560  unsigned int active_count = 0;
561  double maxc = 0.0;
562  double ave = 0.0; // Average of non-empty bins
563  unsigned int non_empty_bins = 0;
564 
565  for (unsigned int i = 1; i <= nbins; i++) {
566  double bin = e[i];
567  if (bin != 0.0) {
568  if (maxc < bin)
569  maxc = bin;
570  ave += bin;
571  non_empty_bins++;
572  }
573  }
574 
575  ave /= non_empty_bins;
576  edm::LogWarning("pixelLumi") << "Bunch mask finder - non empty bins " << non_empty_bins
577  << " average of non empty bins " << ave << " max content of one bin " << maxc;
578  double mean = 0.;
579  double sigma = 0.;
580  if (non_empty_bins < 50) {
581  mean = maxc;
582  sigma = (maxc) / 20;
583  } else {
584  TH1F dist("dist", "dist", 500, 0., maxc + (maxc / 500.) * 20.);
585  for (unsigned int i = 1; i <= nbins; i++) {
586  double bin = e[i];
587  dist.Fill(bin);
588  }
589  TF1 fit("plgaus", "gaus");
590  dist.Fit(&fit, "", "", fmax(0., ave - (maxc - ave) / 5.), maxc);
591  mean = fit.GetParameter("Mean");
592  sigma = fit.GetParameter("Sigma");
593  }
594  edm::LogWarning("pixelLumi") << "Bunch mask will use mean" << mean << " sigma " << sigma;
595  // Active BX defined as those which have nclus within fixed standard
596  // deviations of peak.
597  for (unsigned int i = 1; i <= nbins; i++) {
598  double bin = e[i];
599  if (bin > 0. && std::abs(bin - mean) < 5. * (sigma)) {
600  mask[i] = true;
601  active_count++;
602  }
603  }
604  edm::LogWarning("pixelLumi") << "Bunch mask finds " << active_count << " active bunch crossings ";
605  // edm::LogWarning("pixelLumi") << "this is the full bx mask " ;
606  // for(unsigned int i = 1; i<= nbins; i++)
607  // edm::LogWarning("pixelLumi") << ((mask[i]) ? 1:0);
608  return active_count;
609 }
constexpr uint32_t mask
Definition: gpuClustering.h:26
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Log< level::Warning, false > LogWarning

◆ endLuminosityBlock()

void PixelLumiDQM::endLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  es 
)
overrideprivate

Definition at line 392 of file PixelLumiDQM.cc.

References bunchTriggerMask, calculateBunchMask(), CM2_TO_NANOBARN, submitPVResolutionJobs::err, fHistBunchCrossingsLastLumi, fHistClusByLS, fHistClusterCountByBxCumulative, fHistClusterCountByBxLastLumi, fHistnBClusVsLS, fHistnFMClusVsLS, fHistnFPClusVsLS, fHistRecordedByBxCumulative, fHistRecordedByBxLastLumi, fHistTotalRecordedLumiByLS, filledAndUnmaskedBunches, fLogFileName_, fNumPixelClusters, FREQ_ORBIT, fResetIntervalInLumiSections, fRunNo, dqm::impl::MonitorElement::getBinContent(), dqm::impl::MonitorElement::getBinError(), mps_fire::i, lastBunchCrossing, logFile_, eostools::ls(), edm::LuminosityBlockAuxiliary::luminosityBlock(), edm::LuminosityBlock::luminosityBlockAuxiliary(), rXSEC_PIXEL_CLUSTER, rXSEC_PIXEL_CLUSTER_UNC, SECONDS_PER_LS, dqm::impl::MonitorElement::setBinContent(), dqm::impl::MonitorElement::setBinError(), mathSSE::sqrt(), dqmMemoryStats::total, pileupReCalc_HLTpaths::trunc, useInnerBarrelLayer, XSEC_PIXEL_CLUSTER, and XSEC_PIXEL_CLUSTER_UNC.

392  {
393  unsigned int ls = lumiBlock.luminosityBlockAuxiliary().luminosityBlock();
394 
395  // Only fill every fResetIntervalInLumiSections (default is 1 LS)
396  if (ls % fResetIntervalInLumiSections != 0)
397  return;
398 
399  printf("Lumi Block = %d\n", ls);
400 
401  if ((ls - 1) % fResetIntervalInLumiSections == 0) {
402  }
403 
404  unsigned int nBClus[3] = {0, 0, 0};
405  unsigned int nFPClus[2] = {0, 0};
406  unsigned int nFMClus[2] = {0, 0};
407 
408  double total_recorded = 0.;
409  double total_recorded_unc_square = 0.;
410 
411  // Obtain bunch-by-bunch cluster counts and compute totals for lumi
412  // calculation.
413  double totalcounts = 0.0;
414  double totalevents = 0.0;
415  double lumi_factor_per_bx = 0.0;
418  else
420 
421  for (std::map<int, PixelClusterCount>::iterator it = fNumPixelClusters.begin(); it != fNumPixelClusters.end(); it++) {
422  // Sum all clusters for this BX.
423  unsigned int total = (*it).second.numB.at(1) + (*it).second.numB.at(2) + (*it).second.numFP.at(0) +
424  (*it).second.numFP.at(1) + (*it).second.numFM.at(0) + (*it).second.numFM.at(1);
426  total += (*it).second.numB.at(0);
427  totalcounts += total;
428  double etotal = useInnerBarrelLayer
429  ? (*it).second.dnumB.at(0)
430  : (*it).second.dnumB.at(1) + (*it).second.dnumB.at(2) + (*it).second.dnumFP.at(0) +
431  (*it).second.dnumFP.at(1) + (*it).second.dnumFM.at(0) + (*it).second.dnumFM.at(1);
432  etotal = sqrt(etotal);
433 
435  fHistClusterCountByBxLastLumi->setBinError((*it).first, etotal);
438 
439  unsigned int events_per_bx = fHistBunchCrossingsLastLumi->getBinContent((*it).first);
440  totalevents += events_per_bx;
441  double average_cluster_count = events_per_bx != 0 ? double(total) / events_per_bx : 0.;
442  double average_cluster_count_unc = events_per_bx != 0 ? etotal / events_per_bx : 0.;
443  double pixel_bx_lumi_per_ls = lumi_factor_per_bx * average_cluster_count / CM2_TO_NANOBARN;
444  double pixel_bx_lumi_per_ls_unc = 0.0;
446  pixel_bx_lumi_per_ls_unc = sqrt(lumi_factor_per_bx * lumi_factor_per_bx *
447  (average_cluster_count_unc * average_cluster_count_unc +
448  (average_cluster_count * XSEC_PIXEL_CLUSTER_UNC / XSEC_PIXEL_CLUSTER) *
449  (average_cluster_count * XSEC_PIXEL_CLUSTER / XSEC_PIXEL_CLUSTER))) /
451  else
452  pixel_bx_lumi_per_ls_unc = sqrt(lumi_factor_per_bx * lumi_factor_per_bx *
453  (average_cluster_count_unc * average_cluster_count_unc +
454  (average_cluster_count * rXSEC_PIXEL_CLUSTER_UNC / rXSEC_PIXEL_CLUSTER) *
455  (average_cluster_count * rXSEC_PIXEL_CLUSTER / rXSEC_PIXEL_CLUSTER))) /
457 
458  fHistRecordedByBxLastLumi->setBinContent((*it).first, pixel_bx_lumi_per_ls);
459  fHistRecordedByBxLastLumi->setBinError((*it).first, pixel_bx_lumi_per_ls_unc);
460 
462  (*it).first, fHistRecordedByBxCumulative->getBinContent((*it).first) + pixel_bx_lumi_per_ls);
463 
464  /*
465  if(fHistRecordedByBxLastLumi->getBinContent((*it).first)!=0.)
466  fHistRecordedByBxLastLumi->getBinContent((*it).first));
467  if(fHistRecordedByBxCumulative->getBinContent((*it).first)!=0.)
468  fHistRecordedByBxCumulative->getBinContent((*it).first));
469  */
470 
471  nBClus[0] += (*it).second.numB.at(0);
472  nBClus[1] += (*it).second.numB.at(1);
473  nBClus[2] += (*it).second.numB.at(2);
474  nFPClus[0] += (*it).second.numFP.at(0);
475  nFPClus[1] += (*it).second.numFP.at(1);
476  nFMClus[0] += (*it).second.numFM.at(0);
477  nFMClus[1] += (*it).second.numFM.at(1);
478 
479  // Reset counters
480  (*it).second.Reset();
481 
482  // edm::LogWarning("pixelLumi") << "bx="<< (*it).first << " clusters=" <<
483  // (*it).second.numB.at(0));
484  }
485 
487  for (unsigned int i = 0; i <= lastBunchCrossing; i++) {
488  if (bunchTriggerMask[i]) {
490  total_recorded += fHistRecordedByBxLastLumi->getBinContent(i);
491  total_recorded_unc_square += err * err;
492  }
493  }
494 
495  // Replace the total obtained by summing over BXs with the average per BX
496  // from the total cluster count and rescale
497 
498  if (totalevents > 10) {
499  total_recorded = lumi_factor_per_bx * totalcounts / totalevents / CM2_TO_NANOBARN;
500  } else
501  total_recorded = 0.0;
502 
503  edm::LogWarning("pixelLumi") << " Total recorded " << total_recorded;
504  fHistTotalRecordedLumiByLS->setBinContent(ls, total_recorded);
505  fHistTotalRecordedLumiByLS->setBinError(ls, sqrt(total_recorded_unc_square));
506  }
507  // fill cluster counts by detector regions for sanity checks
508  unsigned int all_detectors_counts = 0;
509  for (unsigned int i = 0; i < 3; i++) {
510  all_detectors_counts += nBClus[i];
511  }
512  for (unsigned int i = 0; i < 2; i++) {
513  all_detectors_counts += nFPClus[i];
514  }
515  for (unsigned int i = 0; i < 2; i++) {
516  all_detectors_counts += nFMClus[i];
517  }
518 
519  fHistClusByLS->setBinContent(ls, all_detectors_counts);
520 
521  for (unsigned int i = 0; i < 3; i++) {
522  fHistnBClusVsLS[i]->setBinContent(ls, float(nBClus[i]) / float(all_detectors_counts));
523  }
524  for (unsigned int i = 0; i < 2; i++) {
525  fHistnFPClusVsLS[i]->setBinContent(ls, float(nFPClus[i]) / float(all_detectors_counts));
526  }
527  for (unsigned int i = 0; i < 2; i++) {
528  fHistnFMClusVsLS[i]->setBinContent(ls, float(nFMClus[i]) / float(all_detectors_counts));
529  }
530 
532 
533  timeval tv;
534  gettimeofday(&tv, nullptr);
535  tm *ts = gmtime(&tv.tv_sec);
536  char datestring[256];
537  strftime(datestring, sizeof(datestring), "%Y.%m.%d %T GMT %s", ts);
538  logFile_ << "RunNumber " << fRunNo << std::endl;
539  logFile_ << "EndTimeOfFit " << datestring << std::endl;
540  logFile_ << "LumiRange " << ls << "-" << ls << std::endl;
541  logFile_ << "Fill " << -99 << std::endl;
542  logFile_ << "ActiveBunchCrossings " << filledAndUnmaskedBunches << std::endl;
543  logFile_ << "PixelLumi " << fHistTotalRecordedLumiByLS->getBinContent(ls) * 0.98 << std::endl;
544  logFile_ << "HFLumi " << -99 << std::endl;
545  logFile_ << "Ratio " << -99 << std::endl;
546  logFile_.close();
547 }
static constexpr double XSEC_PIXEL_CLUSTER
Definition: PixelLumiDQM.h:49
static constexpr double XSEC_PIXEL_CLUSTER_UNC
Definition: PixelLumiDQM.h:50
unsigned int filledAndUnmaskedBunches
Definition: PixelLumiDQM.h:168
static const unsigned int lastBunchCrossing
Definition: PixelLumiDQM.h:56
int fResetIntervalInLumiSections
Definition: PixelLumiDQM.h:136
MonitorElement * fHistRecordedByBxCumulative
Definition: PixelLumiDQM.h:165
bool useInnerBarrelLayer
Definition: PixelLumiDQM.h:169
MonitorElement * fHistClusByLS
Definition: PixelLumiDQM.h:162
static constexpr double rXSEC_PIXEL_CLUSTER_UNC
Definition: PixelLumiDQM.h:54
MonitorElement * fHistnFMClusVsLS[2]
Definition: PixelLumiDQM.h:157
static constexpr double SECONDS_PER_LS
Definition: PixelLumiDQM.h:46
unsigned int calculateBunchMask(MonitorElement *, std::vector< bool > &)
T sqrt(T t)
Definition: SSEVec.h:19
MonitorElement * fHistClusterCountByBxLastLumi
Definition: PixelLumiDQM.h:160
MonitorElement * fHistTotalRecordedLumiByLS
Definition: PixelLumiDQM.h:163
MonitorElement * fHistClusterCountByBxCumulative
Definition: PixelLumiDQM.h:161
MonitorElement * fHistnBClusVsLS[3]
Definition: PixelLumiDQM.h:155
std::vector< bool > bunchTriggerMask
Definition: PixelLumiDQM.h:167
def ls(path, rec=False)
Definition: eostools.py:349
static constexpr double rXSEC_PIXEL_CLUSTER
Definition: PixelLumiDQM.h:53
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * fHistBunchCrossingsLastLumi
Definition: PixelLumiDQM.h:159
std::string fLogFileName_
Definition: PixelLumiDQM.h:171
std::map< int, PixelClusterCount > fNumPixelClusters
Definition: PixelLumiDQM.h:131
MonitorElement * fHistRecordedByBxLastLumi
Definition: PixelLumiDQM.h:164
virtual double getBinError(int binx) const
get uncertainty on content of bin (1-D) - See TH1::GetBinError for details
virtual void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
Log< level::Warning, false > LogWarning
MonitorElement * fHistnFPClusVsLS[2]
Definition: PixelLumiDQM.h:156
static constexpr double FREQ_ORBIT
Definition: PixelLumiDQM.h:45
static constexpr double CM2_TO_NANOBARN
Definition: PixelLumiDQM.h:55
std::ofstream logFile_
Definition: PixelLumiDQM.h:173
virtual double getBinContent(int binx) const
get content of bin (1-D)

◆ fillDescriptions()

void PixelLumiDQM::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 83 of file PixelLumiDQM.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

83  {
85  desc.setUnknown();
86  descriptions.addDefault(desc);
87 }
void addDefault(ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ bunchTriggerMask

std::vector<bool> PixelLumiDQM::bunchTriggerMask
private

Definition at line 167 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

◆ CM2_TO_NANOBARN

constexpr double PixelLumiDQM::CM2_TO_NANOBARN = 1.0 / 1.e-33
static

Definition at line 55 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

◆ fBXNo

UInt_t PixelLumiDQM::fBXNo
private

Definition at line 121 of file PixelLumiDQM.h.

Referenced by analyze().

◆ fChi2

Double_t PixelLumiDQM::fChi2
private

Definition at line 129 of file PixelLumiDQM.h.

◆ fDeadModules

std::vector<uint32_t> PixelLumiDQM::fDeadModules
private

Definition at line 142 of file PixelLumiDQM.h.

Referenced by analyze(), and PixelLumiDQM().

◆ fEvtNo

UInt_t PixelLumiDQM::fEvtNo
private

Definition at line 119 of file PixelLumiDQM.h.

Referenced by analyze().

◆ fFillNumber

unsigned int PixelLumiDQM::fFillNumber
private

Definition at line 170 of file PixelLumiDQM.h.

◆ fHistBunchCrossings

MonitorElement* PixelLumiDQM::fHistBunchCrossings
private

Definition at line 158 of file PixelLumiDQM.h.

Referenced by analyze(), and bookHistograms().

◆ fHistBunchCrossingsLastLumi

MonitorElement* PixelLumiDQM::fHistBunchCrossingsLastLumi
private

Definition at line 159 of file PixelLumiDQM.h.

Referenced by analyze(), beginLuminosityBlock(), bookHistograms(), and endLuminosityBlock().

◆ fHistClusByLS

MonitorElement* PixelLumiDQM::fHistClusByLS
private

Definition at line 162 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

◆ fHistClusterCountByBxCumulative

MonitorElement* PixelLumiDQM::fHistClusterCountByBxCumulative
private

Definition at line 161 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

◆ fHistClusterCountByBxLastLumi

MonitorElement* PixelLumiDQM::fHistClusterCountByBxLastLumi
private

Definition at line 160 of file PixelLumiDQM.h.

Referenced by beginLuminosityBlock(), bookHistograms(), and endLuminosityBlock().

◆ fHistContainerThisRun

std::map<std::string, MonitorElement *> PixelLumiDQM::fHistContainerThisRun
private

Definition at line 138 of file PixelLumiDQM.h.

Referenced by analyze(), and bookHistograms().

◆ fHistnBClusVsLS

MonitorElement* PixelLumiDQM::fHistnBClusVsLS[3]
private

Definition at line 155 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

◆ fHistnFMClusVsLS

MonitorElement* PixelLumiDQM::fHistnFMClusVsLS[2]
private

Definition at line 157 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

◆ fHistnFPClusVsLS

MonitorElement* PixelLumiDQM::fHistnFPClusVsLS[2]
private

Definition at line 156 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

◆ fHistRecordedByBxCumulative

MonitorElement* PixelLumiDQM::fHistRecordedByBxCumulative
private

Definition at line 165 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

◆ fHistRecordedByBxLastLumi

MonitorElement* PixelLumiDQM::fHistRecordedByBxLastLumi
private

Definition at line 164 of file PixelLumiDQM.h.

Referenced by beginLuminosityBlock(), bookHistograms(), and endLuminosityBlock().

◆ fHistTotalRecordedLumiByLS

MonitorElement* PixelLumiDQM::fHistTotalRecordedLumiByLS
private

Definition at line 163 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

◆ filledAndUnmaskedBunches

unsigned int PixelLumiDQM::filledAndUnmaskedBunches
private

Definition at line 168 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

◆ fIncludePixelClusterInfo

bool PixelLumiDQM::fIncludePixelClusterInfo
private

Definition at line 134 of file PixelLumiDQM.h.

Referenced by analyze(), and PixelLumiDQM().

◆ fIncludePixelQualCheckHistos

bool PixelLumiDQM::fIncludePixelQualCheckHistos
private

Definition at line 135 of file PixelLumiDQM.h.

Referenced by analyze(), bookHistograms(), and PixelLumiDQM().

◆ fIncludeVertexInfo

bool PixelLumiDQM::fIncludeVertexInfo
private

Definition at line 133 of file PixelLumiDQM.h.

◆ fIntActiveCrossingsFromDB

MonitorElement* PixelLumiDQM::fIntActiveCrossingsFromDB
private

Definition at line 154 of file PixelLumiDQM.h.

◆ fLogFileName_

std::string PixelLumiDQM::fLogFileName_
private

Definition at line 171 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

◆ fLSNo

UInt_t PixelLumiDQM::fLSNo
private

Definition at line 120 of file PixelLumiDQM.h.

Referenced by analyze().

◆ fMinClusterCharge

double PixelLumiDQM::fMinClusterCharge
private

Definition at line 150 of file PixelLumiDQM.h.

Referenced by analyze(), and PixelLumiDQM().

◆ fMinPixelsPerCluster

int PixelLumiDQM::fMinPixelsPerCluster
private

Definition at line 147 of file PixelLumiDQM.h.

Referenced by analyze(), and PixelLumiDQM().

◆ fNdof

Double_t PixelLumiDQM::fNdof
private

Definition at line 130 of file PixelLumiDQM.h.

◆ fNumPixelClusters

std::map<int, PixelClusterCount> PixelLumiDQM::fNumPixelClusters
private

Definition at line 131 of file PixelLumiDQM.h.

Referenced by analyze(), and endLuminosityBlock().

◆ fNumTrkPerVtx

UInt_t PixelLumiDQM::fNumTrkPerVtx
private

Definition at line 125 of file PixelLumiDQM.h.

◆ fNumVtx

UInt_t PixelLumiDQM::fNumVtx
private

Definition at line 123 of file PixelLumiDQM.h.

◆ fNumVtxGood

UInt_t PixelLumiDQM::fNumVtxGood
private

Definition at line 124 of file PixelLumiDQM.h.

◆ fPixelClusterLabel

edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > PixelLumiDQM::fPixelClusterLabel
private

Definition at line 115 of file PixelLumiDQM.h.

Referenced by analyze().

◆ FREQ_ORBIT

constexpr double PixelLumiDQM::FREQ_ORBIT = 11245.5
static

Definition at line 45 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

◆ fResetIntervalInLumiSections

int PixelLumiDQM::fResetIntervalInLumiSections
private

Definition at line 136 of file PixelLumiDQM.h.

Referenced by beginLuminosityBlock(), and endLuminosityBlock().

◆ fRunNo

UInt_t PixelLumiDQM::fRunNo
private

Definition at line 118 of file PixelLumiDQM.h.

Referenced by analyze(), and endLuminosityBlock().

◆ fTimestamp

UInt_t PixelLumiDQM::fTimestamp
private

Definition at line 122 of file PixelLumiDQM.h.

Referenced by analyze().

◆ fVtxX

Double_t PixelLumiDQM::fVtxX
private

Definition at line 126 of file PixelLumiDQM.h.

◆ fVtxY

Double_t PixelLumiDQM::fVtxY
private

Definition at line 127 of file PixelLumiDQM.h.

◆ fVtxZ

Double_t PixelLumiDQM::fVtxZ
private

Definition at line 128 of file PixelLumiDQM.h.

◆ kNumDisks

constexpr size_t PixelLumiDQM::kNumDisks = 12
staticprivate

Definition at line 76 of file PixelLumiDQM.h.

Referenced by analyze(), and bookHistograms().

◆ kNumLayers

constexpr size_t PixelLumiDQM::kNumLayers = 5
staticprivate

Definition at line 75 of file PixelLumiDQM.h.

Referenced by analyze(), and bookHistograms().

◆ kOffsetDisks

constexpr size_t PixelLumiDQM::kOffsetDisks = 4
staticprivate

Definition at line 78 of file PixelLumiDQM.h.

Referenced by analyze().

◆ kOffsetLayers

constexpr size_t PixelLumiDQM::kOffsetLayers = 0
staticprivate

Definition at line 77 of file PixelLumiDQM.h.

Referenced by analyze().

◆ lastBunchCrossing

const unsigned int PixelLumiDQM::lastBunchCrossing = 3564
static

Definition at line 56 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

◆ logFile_

std::ofstream PixelLumiDQM::logFile_
private

Definition at line 173 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

◆ rXSEC_PIXEL_CLUSTER

constexpr double PixelLumiDQM::rXSEC_PIXEL_CLUSTER = 9.4e-24
static

Definition at line 53 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

◆ rXSEC_PIXEL_CLUSTER_UNC

constexpr double PixelLumiDQM::rXSEC_PIXEL_CLUSTER_UNC = 0.119e-24
static

Definition at line 54 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

◆ SECONDS_PER_LS

constexpr double PixelLumiDQM::SECONDS_PER_LS = double(0x40000) / double(FREQ_ORBIT)
static

Definition at line 46 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

◆ tkGeomToken_

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> PixelLumiDQM::tkGeomToken_
private

Definition at line 116 of file PixelLumiDQM.h.

Referenced by analyze().

◆ useInnerBarrelLayer

bool PixelLumiDQM::useInnerBarrelLayer
private

Definition at line 169 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

◆ XSEC_PIXEL_CLUSTER

constexpr double PixelLumiDQM::XSEC_PIXEL_CLUSTER = 10.08e-24
static

Definition at line 49 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

◆ XSEC_PIXEL_CLUSTER_UNC

constexpr double PixelLumiDQM::XSEC_PIXEL_CLUSTER_UNC = 0.17e-24
static

Definition at line 50 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().