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) final
 
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
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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
 
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)
 
 ~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
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, 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
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices 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 double CM2_TO_NANOBARN = 1.0 / 1.e-33
 
static double FREQ_ORBIT = 11245.5
 
static const unsigned int lastBunchCrossing = 3564
 
static double rXSEC_PIXEL_CLUSTER = 9.4e-24
 
static double rXSEC_PIXEL_CLUSTER_UNC = 0.119e-24
 
static double SECONDS_PER_LS = double(0x40000) / double(FREQ_ORBIT)
 
static double XSEC_PIXEL_CLUSTER = 10.08e-24
 
static 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 dqmBeginRun (edm::Run const &, edm::EventSetup const &) override
 
void dqmEndRun (edm::Run const &, edm::EventSetup const &) override
 
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_
 
bool useInnerBarrelLayer
 

Static Private Attributes

static size_t kNumDisks = 12
 
static size_t kNumLayers = 5
 
static size_t kOffsetDisks = 4
 
static 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
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 analyze (edm::Event const &, edm::EventSetup const &)
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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<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)
 
- 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 40 of file PixelLumiDQM.h.

Constructor & Destructor Documentation

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 HLT_2018_cff::InputTag.

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

Definition at line 80 of file PixelLumiDQM.cc.

80 {}

Member Function Documentation

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

Definition at line 88 of file PixelLumiDQM.cc.

References edmNew::DetSetVector< T >::begin(), edm::EventBase::bunchCrossing(), ALCARECOTkAlJpsiMuMu_cff::charge, TrackerGeometry::dets(), edmNew::DetSetVector< T >::end(), edm::EventID::event(), fBXNo, fDeadModules, fEvtNo, fHistBunchCrossings, fHistBunchCrossingsLastLumi, fHistContainerThisRun, dqm::impl::MonitorElement::Fill(), fIncludePixelClusterInfo, fIncludePixelQualCheckHistos, spr::find(), fLSNo, fMinClusterCharge, fMinPixelsPerCluster, fNumPixelClusters, fPixelClusterLabel, fRunNo, fTimestamp, edm::EventSetup::get(), edm::Event::getByToken(), edm::Event::getLuminosityBlock(), mps_fire::i, edm::EventBase::id(), TrackerGeometry::idToDet(), GeomDetEnumerators::isTrackerPixel(), kNumDisks, kNumLayers, kOffsetDisks, kOffsetLayers, PixelBarrelNameUpgrade::layerName(), Topology::localPosition(), edm::LuminosityBlockBase::luminosityBlock(), PixelEndcapNameUpgrade::mI, PixelEndcapNameUpgrade::mO, PV3DBase< T, PVType, FrameType >::phi(), PixelEndcapNameUpgrade::pI, PixelSubdetector::PixelBarrel, LumiMonitor_cff::pixelClusters, PixelSubdetector::PixelEndcap, PixelEndcapNameUpgrade::pO, edm::EventID::run(), findQualityFiles::size, PixelGeomDetUnit::specificTopology(), mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, DetId::subdetId(), GeomDet::surface(), edm::EventBase::time(), Surface::toGlobal(), edm::Timestamp::unixTime(), x, PV3DBase< T, PVType, FrameType >::x(), y, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

88  {
89  // Collect all bookkeeping information.
90  fRunNo = iEvent.id().run();
91  fEvtNo = iEvent.id().event();
93  fBXNo = iEvent.bunchCrossing();
94  fTimestamp = iEvent.time().unixTime();
97  // This serves as event counter to compute luminosity from cluster counts.
98  std::map<int, PixelClusterCount>::iterator it = fNumPixelClusters.find(fBXNo);
99  if (it == fNumPixelClusters.end())
100  fNumPixelClusters[fBXNo] = PixelClusterCount();
101 
103  // Find tracker geometry.
105  iSetup.get<TrackerDigiGeometryRecord>().get(trackerGeo);
106 
107  // Find pixel clusters.
109  iEvent.getByToken(fPixelClusterLabel, pixelClusters);
110 
111  // Loop over entire tracker geometry.
112  for (TrackerGeometry::DetContainer::const_iterator i = trackerGeo->dets().begin(); i != trackerGeo->dets().end();
113  ++i) {
114  // See if this is a pixel unit(?).
115 
116  if (GeomDetEnumerators::isTrackerPixel((*i)->subDetector())) {
117  DetId detId = (*i)->geographicalId();
118  // Find all clusters on this detector module.
119  edmNew::DetSetVector<SiPixelCluster>::const_iterator iSearch = pixelClusters->find(detId);
120  if (iSearch != pixelClusters->end()) {
121  // Count the number of clusters with at least a minimum
122  // number of pixels per cluster and at least a minimum charge.
123  size_t numClusters = 0;
124  for (edmNew::DetSet<SiPixelCluster>::const_iterator itClus = iSearch->begin(); itClus != iSearch->end();
125  ++itClus) {
126  if ((itClus->size() >= fMinPixelsPerCluster) && (itClus->charge() >= fMinClusterCharge)) {
127  ++numClusters;
128  }
129  }
130  // DEBUG DEBUG DEBUG
131  assert(numClusters <= iSearch->size());
132  // DEBUG DEBUG DEBUG end
133 
134  // Add up the cluster count based on the position of this detector
135  // element.
136  if (detId.subdetId() == PixelSubdetector::PixelBarrel) {
138  int layer = detName.layerName() - kOffsetLayers;
139  fNumPixelClusters[fBXNo].numB.at(layer) += numClusters;
140  fNumPixelClusters[fBXNo].dnumB.at(layer) += sqrt(numClusters);
141  } else {
142  // DEBUG DEBUG DEBUG
143  assert(detId.subdetId() == PixelSubdetector::PixelEndcap);
144  // DEBUG DEBUG DEBUG end
145 
147  PixelEndcapNameUpgrade::HalfCylinder halfCylinder = detName.halfCylinder();
148  int disk = detName.diskName() - kOffsetDisks;
149  switch (halfCylinder) {
152  fNumPixelClusters[fBXNo].numFM.at(disk) += numClusters;
153  fNumPixelClusters[fBXNo].dnumFM.at(disk) += sqrt(numClusters);
154  break;
157  fNumPixelClusters[fBXNo].numFP.at(disk) += numClusters;
158  fNumPixelClusters[fBXNo].dnumFP.at(disk) += sqrt(numClusters);
159  break;
160  default:
161  assert(false);
162  break;
163  }
164  }
165  }
166  }
167  }
168  }
169  // ----------
170 
171  // Fill some pixel cluster quality check histograms if requested.
173  // Find tracker geometry.
175  iSetup.get<TrackerDigiGeometryRecord>().get(trackerGeo);
176 
177  // Find pixel clusters.
179  iEvent.getByToken(fPixelClusterLabel, pixelClusters);
180 
181  bool filterDeadModules = (!fDeadModules.empty());
182  std::vector<uint32_t>::const_iterator deadModulesBegin = fDeadModules.begin();
183  std::vector<uint32_t>::const_iterator deadModulesEnd = fDeadModules.end();
184 
185  // Loop over entire tracker geometry.
186  for (TrackerGeometry::DetContainer::const_iterator i = trackerGeo->dets().begin(); i != trackerGeo->dets().end();
187  ++i) {
188  // See if this is a pixel module.
189  if (GeomDetEnumerators::isTrackerPixel((*i)->subDetector())) {
190  DetId detId = (*i)->geographicalId();
191 
192  // Skip this module if it's on the list of modules to be ignored.
193  if (filterDeadModules && find(deadModulesBegin, deadModulesEnd, detId()) != deadModulesEnd) {
194  continue;
195  }
196 
197  // Find all clusters in this module.
198  edmNew::DetSetVector<SiPixelCluster>::const_iterator iSearch = pixelClusters->find(detId);
199 
200  // Loop over all clusters in this module.
201  if (iSearch != pixelClusters->end()) {
202  for (edmNew::DetSet<SiPixelCluster>::const_iterator clus = iSearch->begin(); clus != iSearch->end(); ++clus) {
203  if ((clus->size() >= fMinPixelsPerCluster) && (clus->charge() >= fMinClusterCharge)) {
204  PixelGeomDetUnit const *theGeomDet = dynamic_cast<PixelGeomDetUnit const *>(trackerGeo->idToDet(detId));
205  PixelTopology const *topol = &(theGeomDet->specificTopology());
206  double x = clus->x();
207  double y = clus->y();
208  LocalPoint clustLP = topol->localPosition(MeasurementPoint(x, y));
209  GlobalPoint clustGP = theGeomDet->surface().toGlobal(clustLP);
210  double charge = clus->charge() / 1.e3;
211  int size = clus->size();
212 
213  if (detId.subdetId() == PixelSubdetector::PixelBarrel) {
215  unsigned int layer = detName.layerName() - kOffsetLayers;
216  if (layer < kNumLayers) {
217  std::string histName;
218  histName = "clusPosBarrel" + std::to_string(layer);
219  fHistContainerThisRun[histName]->Fill(clustGP.z(), clustGP.phi());
220  histName = "clusChargeBarrel" + std::to_string(layer);
221  fHistContainerThisRun[histName]->Fill(iEvent.bunchCrossing(), charge);
222  histName = "clusSizeBarrel" + std::to_string(layer);
223  fHistContainerThisRun[histName]->Fill(iEvent.bunchCrossing(), size);
224  } else {
225  edm::LogWarning("pixelLumi") << "higher layer number, " << layer << ", than layers";
226  }
227  } else {
228  // DEBUG DEBUG DEBUG
229  assert(detId.subdetId() == PixelSubdetector::PixelEndcap);
230  // DEBUG DEBUG DEBUG end
231 
233  unsigned int disk = detName.diskName() - kOffsetDisks;
234  if (disk < kNumDisks) {
235  std::string histName;
236  histName = "clusPosEndCap" + std::to_string(disk);
237  fHistContainerThisRun[histName]->Fill(clustGP.x(), clustGP.y());
238  histName = "clusChargeEndCap" + std::to_string(disk);
239  fHistContainerThisRun[histName]->Fill(iEvent.bunchCrossing(), charge);
240  histName = "clusSizeEndCap" + std::to_string(disk);
241  fHistContainerThisRun[histName]->Fill(iEvent.bunchCrossing(), size);
242  } else {
243  edm::LogWarning("pixelLumi")
244  << "higher disk number, " << disk << ", than disks," << kNumDisks << std::endl;
245  }
246  }
247  }
248  }
249  }
250  }
251  }
252  }
253 }
RunNumber_t run() const
Definition: EventID.h:38
size
Write out results.
bool fIncludePixelQualCheckHistos
Definition: PixelLumiDQM.h:135
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:81
EventNumber_t event() const
Definition: EventID.h:40
const_iterator end(bool update=false) const
std::vector< uint32_t > fDeadModules
Definition: PixelLumiDQM.h:142
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
static size_t kOffsetDisks
Definition: PixelLumiDQM.h:79
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
T y() const
Definition: PV3DBase.h:60
int bunchCrossing() const
Definition: EventBase.h:64
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
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
LuminosityBlockNumber_t luminosityBlock() const
void Fill(long long x)
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > fPixelClusterLabel
Definition: PixelLumiDQM.h:116
T sqrt(T t)
Definition: SSEVec.h:19
T z() const
Definition: PV3DBase.h:61
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
unsigned int unixTime() const
Time in seconds since January 1, 1970.
Definition: Timestamp.h:40
LuminosityBlock const & getLuminosityBlock() const
Definition: Event.h:98
std::map< std::string, MonitorElement * > fHistContainerThisRun
Definition: PixelLumiDQM.h:138
double fMinClusterCharge
Definition: PixelLumiDQM.h:150
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetId.h:17
bool fIncludePixelClusterInfo
Definition: PixelLumiDQM.h:134
MonitorElement * fHistBunchCrossings
Definition: PixelLumiDQM.h:158
MonitorElement * fHistBunchCrossingsLastLumi
Definition: PixelLumiDQM.h:159
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
UInt_t fTimestamp
Definition: PixelLumiDQM.h:122
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
static size_t kNumLayers
Definition: PixelLumiDQM.h:76
edm::EventID id() const
Definition: EventBase.h:59
std::map< int, PixelClusterCount > fNumPixelClusters
Definition: PixelLumiDQM.h:131
int fMinPixelsPerCluster
Definition: PixelLumiDQM.h:147
T get() const
Definition: EventSetup.h:73
const TrackerGeomDet * idToDet(DetId) const override
static size_t kOffsetLayers
Definition: PixelLumiDQM.h:78
static size_t kNumDisks
Definition: PixelLumiDQM.h:77
T x() const
Definition: PV3DBase.h:59
int layerName() const
layer id
edm::Timestamp time() const
Definition: EventBase.h:60
bool isTrackerPixel(GeomDetEnumerators::SubDetector m)
const_iterator begin(bool update=false) const
void PixelLumiDQM::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &   
)
overrideprivate

Definition at line 386 of file PixelLumiDQM.cc.

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

386  {
387  // Only reset and fill every fResetIntervalInLumiSections (default is 1 LS)
388  // Return unless the PREVIOUS LS was at the right modulo value
389  // (e.g. is resetinterval = 5 the rest will only be executed at LS=6
390  // NB: reset is done here so the histograms by LS are sent before resetting.
391  // NB: not being used for now since default is 1 LS. There is a bug here.
392 
393  unsigned int ls = lumiBlock.luminosityBlockAuxiliary().luminosityBlock();
394 
395  if ((ls - 1) % fResetIntervalInLumiSections == 0) {
399  }
400 }
int fResetIntervalInLumiSections
Definition: PixelLumiDQM.h:136
virtual void Reset()
reset ME (ie. contents, errors, etc)
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
void PixelLumiDQM::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  run,
edm::EventSetup const &   
)
overrideprivatevirtual

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

Definition at line 255 of file PixelLumiDQM.cc.

References dqm::dqmstoreimpl::DQMStore::IBooker::book1D(), dqm::dqmstoreimpl::DQMStore::IBooker::book2D(), fHistBunchCrossings, fHistBunchCrossingsLastLumi, fHistClusByLS, fHistClusterCountByBxCumulative, fHistClusterCountByBxLastLumi, fHistContainerThisRun, fHistnBClusVsLS, fHistnFMClusVsLS, fHistnFPClusVsLS, fHistRecordedByBxCumulative, fHistRecordedByBxLastLumi, fHistTotalRecordedLumiByLS, fIncludePixelQualCheckHistos, printsummarytable::folder, mps_fire::i, edm::RunBase::id(), crabWrapper::key, kNumDisks, kNumLayers, lastBunchCrossing, Skims_PA_cff::name, Geom::pi(), edm::RunID::run(), edm::RunBase::run(), dqm::dqmstoreimpl::DQMStore::IBooker::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and overlapproblemtsosanalyzer_cfi::title.

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

Referenced by endLuminosityBlock().

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

Definition at line 571 of file PixelLumiDQM.cc.

References funct::abs(), newFWLiteAna::bin, DEFINE_FWK_MODULE, trackingPlots::fit, mps_fire::i, SiStripPI::mean, and LaserClient_cfi::nbins.

571  {
572  // Take the cumulative cluster count histogram and find max and average of
573  // non-empty bins.
574  unsigned int active_count = 0;
575  double maxc = 0.0;
576  double ave = 0.0; // Average of non-empty bins
577  unsigned int non_empty_bins = 0;
578 
579  for (unsigned int i = 1; i <= nbins; i++) {
580  double bin = e[i];
581  if (bin != 0.0) {
582  if (maxc < bin)
583  maxc = bin;
584  ave += bin;
585  non_empty_bins++;
586  }
587  }
588 
589  ave /= non_empty_bins;
590  edm::LogWarning("pixelLumi") << "Bunch mask finder - non empty bins " << non_empty_bins
591  << " average of non empty bins " << ave << " max content of one bin " << maxc;
592  double mean = 0.;
593  double sigma = 0.;
594  if (non_empty_bins < 50) {
595  mean = maxc;
596  sigma = (maxc) / 20;
597  } else {
598  TH1F dist("dist", "dist", 500, 0., maxc + (maxc / 500.) * 20.);
599  for (unsigned int i = 1; i <= nbins; i++) {
600  double bin = e[i];
601  dist.Fill(bin);
602  }
603  TF1 fit("plgaus", "gaus");
604  dist.Fit(&fit, "", "", fmax(0., ave - (maxc - ave) / 5.), maxc);
605  mean = fit.GetParameter("Mean");
606  sigma = fit.GetParameter("Sigma");
607  }
608  edm::LogWarning("pixelLumi") << "Bunch mask will use mean" << mean << " sigma " << sigma;
609  // Active BX defined as those which have nclus within fixed standard
610  // deviations of peak.
611  for (unsigned int i = 1; i <= nbins; i++) {
612  double bin = e[i];
613  if (bin > 0. && std::abs(bin - mean) < 5. * (sigma)) {
614  mask[i] = true;
615  active_count++;
616  }
617  }
618  edm::LogWarning("pixelLumi") << "Bunch mask finds " << active_count << " active bunch crossings ";
619  // edm::LogWarning("pixelLumi") << "this is the full bx mask " ;
620  // for(unsigned int i = 1; i<= nbins; i++)
621  // edm::LogWarning("pixelLumi") << ((mask[i]) ? 1:0);
622  return active_count;
623 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void PixelLumiDQM::dqmBeginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivatevirtual

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

Definition at line 379 of file PixelLumiDQM.cc.

379 {}
void PixelLumiDQM::dqmEndRun ( edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivatevirtual

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

Definition at line 382 of file PixelLumiDQM.cc.

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

Definition at line 404 of file PixelLumiDQM.cc.

References bunchTriggerMask, calculateBunchMask(), CM2_TO_NANOBARN, MillePedeFileConverter_cfg::e, runTheMatrix::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(), dqm::impl::MonitorElement::getNbinsX(), mps_fire::i, lastBunchCrossing, logFile_, eostools::ls(), edm::LuminosityBlockAuxiliary::luminosityBlock(), edm::LuminosityBlock::luminosityBlockAuxiliary(), LaserClient_cfi::nbins, 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.

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

Definition at line 82 of file PixelLumiDQM.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

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

Member Data Documentation

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

Definition at line 167 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

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

Definition at line 54 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

UInt_t PixelLumiDQM::fBXNo
private

Definition at line 121 of file PixelLumiDQM.h.

Referenced by analyze().

Double_t PixelLumiDQM::fChi2
private

Definition at line 129 of file PixelLumiDQM.h.

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

Definition at line 142 of file PixelLumiDQM.h.

Referenced by analyze(), and PixelLumiDQM().

UInt_t PixelLumiDQM::fEvtNo
private

Definition at line 119 of file PixelLumiDQM.h.

Referenced by analyze().

unsigned int PixelLumiDQM::fFillNumber
private

Definition at line 170 of file PixelLumiDQM.h.

MonitorElement* PixelLumiDQM::fHistBunchCrossings
private

Definition at line 158 of file PixelLumiDQM.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* PixelLumiDQM::fHistBunchCrossingsLastLumi
private

Definition at line 159 of file PixelLumiDQM.h.

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

MonitorElement* PixelLumiDQM::fHistClusByLS
private

Definition at line 162 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

MonitorElement* PixelLumiDQM::fHistClusterCountByBxCumulative
private

Definition at line 161 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

MonitorElement* PixelLumiDQM::fHistClusterCountByBxLastLumi
private

Definition at line 160 of file PixelLumiDQM.h.

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

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

Definition at line 138 of file PixelLumiDQM.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* PixelLumiDQM::fHistnBClusVsLS[3]
private

Definition at line 155 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

MonitorElement* PixelLumiDQM::fHistnFMClusVsLS[2]
private

Definition at line 157 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

MonitorElement* PixelLumiDQM::fHistnFPClusVsLS[2]
private

Definition at line 156 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

MonitorElement* PixelLumiDQM::fHistRecordedByBxCumulative
private

Definition at line 165 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

MonitorElement* PixelLumiDQM::fHistRecordedByBxLastLumi
private

Definition at line 164 of file PixelLumiDQM.h.

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

MonitorElement* PixelLumiDQM::fHistTotalRecordedLumiByLS
private

Definition at line 163 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

unsigned int PixelLumiDQM::filledAndUnmaskedBunches
private

Definition at line 168 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

bool PixelLumiDQM::fIncludePixelClusterInfo
private

Definition at line 134 of file PixelLumiDQM.h.

Referenced by analyze(), and PixelLumiDQM().

bool PixelLumiDQM::fIncludePixelQualCheckHistos
private

Definition at line 135 of file PixelLumiDQM.h.

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

bool PixelLumiDQM::fIncludeVertexInfo
private

Definition at line 133 of file PixelLumiDQM.h.

MonitorElement* PixelLumiDQM::fIntActiveCrossingsFromDB
private

Definition at line 154 of file PixelLumiDQM.h.

std::string PixelLumiDQM::fLogFileName_
private

Definition at line 171 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

UInt_t PixelLumiDQM::fLSNo
private

Definition at line 120 of file PixelLumiDQM.h.

Referenced by analyze().

double PixelLumiDQM::fMinClusterCharge
private

Definition at line 150 of file PixelLumiDQM.h.

Referenced by analyze(), and PixelLumiDQM().

int PixelLumiDQM::fMinPixelsPerCluster
private

Definition at line 147 of file PixelLumiDQM.h.

Referenced by analyze(), and PixelLumiDQM().

Double_t PixelLumiDQM::fNdof
private

Definition at line 130 of file PixelLumiDQM.h.

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

Definition at line 131 of file PixelLumiDQM.h.

Referenced by analyze(), and endLuminosityBlock().

UInt_t PixelLumiDQM::fNumTrkPerVtx
private

Definition at line 125 of file PixelLumiDQM.h.

UInt_t PixelLumiDQM::fNumVtx
private

Definition at line 123 of file PixelLumiDQM.h.

UInt_t PixelLumiDQM::fNumVtxGood
private

Definition at line 124 of file PixelLumiDQM.h.

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

Definition at line 116 of file PixelLumiDQM.h.

Referenced by analyze().

double PixelLumiDQM::FREQ_ORBIT = 11245.5
static

Definition at line 44 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

int PixelLumiDQM::fResetIntervalInLumiSections
private

Definition at line 136 of file PixelLumiDQM.h.

Referenced by beginLuminosityBlock(), and endLuminosityBlock().

UInt_t PixelLumiDQM::fRunNo
private

Definition at line 118 of file PixelLumiDQM.h.

Referenced by analyze(), and endLuminosityBlock().

UInt_t PixelLumiDQM::fTimestamp
private

Definition at line 122 of file PixelLumiDQM.h.

Referenced by analyze().

Double_t PixelLumiDQM::fVtxX
private

Definition at line 126 of file PixelLumiDQM.h.

Double_t PixelLumiDQM::fVtxY
private

Definition at line 127 of file PixelLumiDQM.h.

Double_t PixelLumiDQM::fVtxZ
private

Definition at line 128 of file PixelLumiDQM.h.

size_t PixelLumiDQM::kNumDisks = 12
staticprivate

Definition at line 77 of file PixelLumiDQM.h.

Referenced by analyze(), and bookHistograms().

size_t PixelLumiDQM::kNumLayers = 5
staticprivate

Definition at line 76 of file PixelLumiDQM.h.

Referenced by analyze(), and bookHistograms().

size_t PixelLumiDQM::kOffsetDisks = 4
staticprivate

Definition at line 79 of file PixelLumiDQM.h.

Referenced by analyze().

size_t PixelLumiDQM::kOffsetLayers = 0
staticprivate

Definition at line 78 of file PixelLumiDQM.h.

Referenced by analyze().

const unsigned int PixelLumiDQM::lastBunchCrossing = 3564
static

Definition at line 55 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

std::ofstream PixelLumiDQM::logFile_
private

Definition at line 173 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

double PixelLumiDQM::rXSEC_PIXEL_CLUSTER = 9.4e-24
static

Definition at line 52 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

double PixelLumiDQM::rXSEC_PIXEL_CLUSTER_UNC = 0.119e-24
static

Definition at line 53 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

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

Definition at line 45 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

bool PixelLumiDQM::useInnerBarrelLayer
private

Definition at line 169 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

double PixelLumiDQM::XSEC_PIXEL_CLUSTER = 10.08e-24
static

Definition at line 48 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

double PixelLumiDQM::XSEC_PIXEL_CLUSTER_UNC = 0.17e-24
static

Definition at line 49 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().