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 <PixelLumi/PixelLumiDQM/plugins/PixelLumiDQM.h>

Inheritance diagram for PixelLumiDQM:
DQMEDAnalyzer edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns > 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 DQMEDAnalyzer
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
 DQMEDAnalyzer ()
 
 DQMEDAnalyzer (DQMEDAnalyzer const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer &&)=delete
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
 ~DQMEDAnalyzer () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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
 
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)
 
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 endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void endRun (edm::Run 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 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 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 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 DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

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 38 of file PixelLumiDQM.h.

Constructor & Destructor Documentation

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

Definition at line 48 of file PixelLumiDQM.cc.

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

48  :
50  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 {
62  edm::LogInfo("Configuration")
63  << "PixelLumiDQM looking for pixel clusters in '"
64  << iConfig.getUntrackedParameter<edm::InputTag>("pixelClusterLabel",
65  edm::InputTag("siPixelClusters")) << "'";
66  edm::LogInfo("Configuration")
67  << "PixelLumiDQM storing pixel cluster info? "
69  edm::LogInfo("Configuration")
70  << "PixelLumiDQM storing pixel cluster quality check histograms? "
72 
73  if (fDeadModules.empty()) {
74  edm::LogInfo("Configuration")
75  << "No pixel modules specified to be ignored";
76  } else {
77  edm::LogInfo("Configuration")
78  << fDeadModules.size() << " pixel modules specified to be ignored:";
79  for (std::vector<uint32_t>::const_iterator it = fDeadModules.begin();
80  it != fDeadModules.end(); ++it) {
81  edm::LogInfo("Configuration")
82  << " " << *it;
83  }
84  }
85  edm::LogInfo("Configuration")
86  << "Ignoring pixel clusters with less than "
87  << fMinPixelsPerCluster << " pixels";
88  edm::LogInfo("Configuration")
89  << "Ignoring pixel clusters with charge less than "
91 }
bool fIncludePixelQualCheckHistos
Definition: PixelLumiDQM.h:136
T getUntrackedParameter(std::string const &, T const &) const
unsigned int filledAndUnmaskedBunches
Definition: PixelLumiDQM.h:169
static const unsigned int lastBunchCrossing
Definition: PixelLumiDQM.h:53
std::vector< uint32_t > fDeadModules
Definition: PixelLumiDQM.h:143
int fResetIntervalInLumiSections
Definition: PixelLumiDQM.h:137
bool useInnerBarrelLayer
Definition: PixelLumiDQM.h:170
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > fPixelClusterLabel
Definition: PixelLumiDQM.h:117
double fMinClusterCharge
Definition: PixelLumiDQM.h:151
std::vector< bool > bunchTriggerMask
Definition: PixelLumiDQM.h:168
bool fIncludePixelClusterInfo
Definition: PixelLumiDQM.h:135
std::string fLogFileName_
Definition: PixelLumiDQM.h:172
int fMinPixelsPerCluster
Definition: PixelLumiDQM.h:148
PixelLumiDQM::~PixelLumiDQM ( )
override

Definition at line 94 of file PixelLumiDQM.cc.

95 {
96 }

Member Function Documentation

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

Definition at line 108 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, 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, HiRegitMuonDetachedTripletStep_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().

110 {
111  // Collect all bookkeeping information.
112  fRunNo = iEvent.id().run();
113  fEvtNo = iEvent.id().event();
115  fBXNo = iEvent.bunchCrossing();
116  fTimestamp = iEvent.time().unixTime();
117  fHistBunchCrossings->Fill(float(fBXNo));
119  // This serves as event counter to compute luminosity from cluster counts.
120  std::map<int, PixelClusterCount>::iterator it = fNumPixelClusters.find(fBXNo);
121  if(it==fNumPixelClusters.end()) fNumPixelClusters[fBXNo] = PixelClusterCount();
122 
124  // Find tracker geometry.
126  iSetup.get<TrackerDigiGeometryRecord>().get(trackerGeo);
127 
128  // Find pixel clusters.
130  iEvent.getByToken(fPixelClusterLabel, pixelClusters);
131 
132  // Loop over entire tracker geometry.
133  for (TrackerGeometry::DetContainer::const_iterator
134  i = trackerGeo->dets().begin();
135  i != trackerGeo->dets().end(); ++i) {
136  // See if this is a pixel unit(?).
137 
138  if ( GeomDetEnumerators::isTrackerPixel((*i)->subDetector())) {
139  DetId detId = (*i)->geographicalId();
140  // Find all clusters on this detector module.
142  pixelClusters->find(detId);
143  if (iSearch != pixelClusters->end()) {
144 
145  // Count the number of clusters with at least a minimum
146  // number of pixels per cluster and at least a minimum charge.
147  size_t numClusters = 0;
149  itClus = iSearch->begin();
150  itClus != iSearch->end(); ++itClus) {
151  if ((itClus->size() >= fMinPixelsPerCluster) &&
152  (itClus->charge() >= fMinClusterCharge)) {
153  ++numClusters;
154  }
155  }
156  // DEBUG DEBUG DEBUG
157  assert(numClusters <= iSearch->size());
158  // DEBUG DEBUG DEBUG end
159 
160  // Add up the cluster count based on the position of this detector element.
161  if (detId.subdetId() == PixelSubdetector::PixelBarrel) {
163  int layer = detName.layerName() - kOffsetLayers;
164  fNumPixelClusters[fBXNo].numB.at(layer) += numClusters;
165  fNumPixelClusters[fBXNo].dnumB.at(layer) += sqrt(numClusters);
166  } else {
167  // DEBUG DEBUG DEBUG
168  assert(detId.subdetId() == PixelSubdetector::PixelEndcap);
169  // DEBUG DEBUG DEBUG end
170 
172  PixelEndcapNameUpgrade::HalfCylinder halfCylinder = detName.halfCylinder();
173  int disk = detName.diskName() - kOffsetDisks;
174  switch (halfCylinder) {
177  fNumPixelClusters[fBXNo].numFM.at(disk) += numClusters;
178  fNumPixelClusters[fBXNo].dnumFM.at(disk) += sqrt(numClusters);
179  break;
182  fNumPixelClusters[fBXNo].numFP.at(disk) += numClusters;
183  fNumPixelClusters[fBXNo].dnumFP.at(disk) += sqrt(numClusters);
184  break;
185  default:
186  assert(false);
187  break;
188  }
189  }
190  }
191  }
192  }
193  }
194  // ----------
195 
196  // Fill some pixel cluster quality check histograms if requested.
198 
199  // Find tracker geometry.
201  iSetup.get<TrackerDigiGeometryRecord>().get(trackerGeo);
202 
203  // Find pixel clusters.
205  iEvent.getByToken(fPixelClusterLabel, pixelClusters);
206 
207  bool filterDeadModules = (!fDeadModules.empty());
208  std::vector<uint32_t>::const_iterator deadModulesBegin = fDeadModules.begin();
209  std::vector<uint32_t>::const_iterator deadModulesEnd = fDeadModules.end();
210 
211  // Loop over entire tracker geometry.
212  for (TrackerGeometry::DetContainer::const_iterator
213  i = trackerGeo->dets().begin();
214  i != trackerGeo->dets().end(); ++i) {
215 
216  // See if this is a pixel module.
217  if ( GeomDetEnumerators::isTrackerPixel((*i)->subDetector())) {
218  DetId detId = (*i)->geographicalId();
219 
220  // Skip this module if it's on the list of modules to be ignored.
221  if (filterDeadModules &&
222  find(deadModulesBegin, deadModulesEnd, detId()) != deadModulesEnd) {
223  continue;
224  }
225 
226  // Find all clusters in this module.
228  pixelClusters->find(detId);
229 
230  // Loop over all clusters in this module.
231  if (iSearch != pixelClusters->end()) {
233  clus != iSearch->end(); ++clus) {
234 
235  if ((clus->size() >= fMinPixelsPerCluster) &&
236  (clus->charge() >= fMinClusterCharge)) {
237 
238  PixelGeomDetUnit const* theGeomDet =
239  dynamic_cast<PixelGeomDetUnit const*>(trackerGeo->idToDet(detId));
240  PixelTopology const* topol = &(theGeomDet->specificTopology());
241  double x = clus->x();
242  double y = clus->y();
243  LocalPoint clustLP = topol->localPosition(MeasurementPoint(x, y));
244  GlobalPoint clustGP = theGeomDet->surface().toGlobal(clustLP);
245  double charge = clus->charge() / 1.e3;
246  int size = clus->size();
247 
248  if (detId.subdetId() == PixelSubdetector::PixelBarrel) {
250  unsigned int layer = detName.layerName()-kOffsetLayers;
251  if (layer<kNumLayers) {
252  std::string histName;
253  histName="clusPosBarrel"+std::to_string(layer);
254  fHistContainerThisRun[histName]->Fill(clustGP.z(), clustGP.phi());
255  histName="clusChargeBarrel"+std::to_string(layer);
256  fHistContainerThisRun[histName]->Fill(iEvent.bunchCrossing(), charge);
257  histName="clusSizeBarrel"+std::to_string(layer);
258  fHistContainerThisRun[histName]->Fill(iEvent.bunchCrossing(), size);
259  } else {
260  edm::LogWarning("pixelLumi")<<"higher layer number, "<<layer<<", than layers";
261  }
262  } else {
263 
264  // DEBUG DEBUG DEBUG
265  assert(detId.subdetId() == PixelSubdetector::PixelEndcap);
266  // DEBUG DEBUG DEBUG end
267 
269  unsigned int disk = detName.diskName() - kOffsetDisks;
270  if (disk<kNumDisks) {
271  std::string histName;
272  histName="clusPosEndCap"+std::to_string(disk);
273  fHistContainerThisRun[histName]->Fill(clustGP.x(), clustGP.y());
274  histName="clusChargeEndCap"+std::to_string(disk);
275  fHistContainerThisRun[histName]->Fill(iEvent.bunchCrossing(), charge);
276  histName="clusSizeEndCap"+std::to_string(disk);
277  fHistContainerThisRun[histName]->Fill(iEvent.bunchCrossing(), size);
278  } else {
279  edm::LogWarning("pixelLumi")<<"higher disk number, "<<disk<<", than disks,"<<kNumDisks<<std::endl;
280  }
281  }
282  }
283  }
284  }
285  }
286  }
287  }
288 }
RunNumber_t run() const
Definition: EventID.h:39
size
Write out results.
bool fIncludePixelQualCheckHistos
Definition: PixelLumiDQM.h:136
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
EventNumber_t event() const
Definition: EventID.h:41
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator end(bool update=false) const
std::vector< uint32_t > fDeadModules
Definition: PixelLumiDQM.h:143
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
static size_t kOffsetDisks
Definition: PixelLumiDQM.h:79
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
int bunchCrossing() const
Definition: EventBase.h:66
data_type const * const_iterator
Definition: DetSetNew.h:30
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
void Fill(long long x)
LuminosityBlockNumber_t luminosityBlock() const
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:117
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
unsigned int unixTime() const
Time in seconds since January 1, 1970.
Definition: Timestamp.h:46
LuminosityBlock const & getLuminosityBlock() const
Definition: Event.h:101
double fMinClusterCharge
Definition: PixelLumiDQM.h:151
Definition: DetId.h:18
bool fIncludePixelClusterInfo
Definition: PixelLumiDQM.h:135
MonitorElement * fHistBunchCrossings
Definition: PixelLumiDQM.h:159
std::map< std::string, MonitorElement * > fHistContainerThisRun
Definition: PixelLumiDQM.h:139
MonitorElement * fHistBunchCrossingsLastLumi
Definition: PixelLumiDQM.h:160
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
UInt_t fTimestamp
Definition: PixelLumiDQM.h:123
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
static size_t kNumLayers
Definition: PixelLumiDQM.h:76
edm::EventID id() const
Definition: EventBase.h:60
std::map< int, PixelClusterCount > fNumPixelClusters
Definition: PixelLumiDQM.h:132
int fMinPixelsPerCluster
Definition: PixelLumiDQM.h:148
T get() const
Definition: EventSetup.h:63
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:62
int layerName() const
layer id
edm::Timestamp time() const
Definition: EventBase.h:61
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 440 of file PixelLumiDQM.cc.

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

442 {
443  // Only reset and fill every fResetIntervalInLumiSections (default is 1 LS)
444  // Return unless the PREVIOUS LS was at the right modulo value
445  // (e.g. is resetinterval = 5 the rest will only be executed at LS=6
446  // NB: reset is done here so the histograms by LS are sent before resetting.
447  // NB: not being used for now since default is 1 LS. There is a bug here.
448 
449  unsigned int ls = lumiBlock.luminosityBlockAuxiliary().luminosityBlock();
450 
451  if((ls-1)%fResetIntervalInLumiSections==0){
455  }
456 }
int fResetIntervalInLumiSections
Definition: PixelLumiDQM.h:137
MonitorElement * fHistClusterCountByBxLastLumi
Definition: PixelLumiDQM.h:161
void Reset()
reset ME (ie. contents, errors, etc)
def ls(path, rec=False)
Definition: eostools.py:348
MonitorElement * fHistBunchCrossingsLastLumi
Definition: PixelLumiDQM.h:160
MonitorElement * fHistRecordedByBxLastLumi
Definition: PixelLumiDQM.h:165
void PixelLumiDQM::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  run,
edm::EventSetup const &   
)
overrideprivatevirtual

Implements DQMEDAnalyzer.

Definition at line 291 of file PixelLumiDQM.cc.

References DQMStore::IBooker::book1D(), 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, dataset::name, Geom::pi(), edm::RunID::run(), edm::RunBase::run(), DQMStore::IBooker::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and fftjetcommon_cfi::title.

294 {
295  edm::LogInfo("Status") << "Starting processing of run #" << run.id().run();
296 
297  // Top folder containing high-level information about pixel and HF lumi.
298  std::string folder = "PixelLumi/";
299  ibooker.setCurrentFolder(folder);
300 
301  fHistTotalRecordedLumiByLS = ibooker.book1D("totalPixelLumiByLS","Pixel Lumi in nb vs LS",8000,0.5,8000.5);
302  fHistRecordedByBxCumulative = ibooker.book1D("PXLumiByBXsum","Pixel Lumi in nb by BX Cumulative vs LS",lastBunchCrossing,
303  0.5,float(lastBunchCrossing)+0.5);
304 
305  std::string subfolder = folder + "lastLS/";
306  ibooker.setCurrentFolder(subfolder);
307  fHistRecordedByBxLastLumi = ibooker.book1D("PXByBXLastLumi","Pixel By BX Last Lumi",lastBunchCrossing+1,
308  -0.5,float(lastBunchCrossing)+0.5);
309 
310  subfolder = folder+"ClusterCountingDetails/";
311  ibooker.setCurrentFolder(subfolder);
312 
313  fHistnBClusVsLS[0] = ibooker.book1D("nBClusVsLS_0","Fraction of Clusters vs LS Barrel layer 0",8000,0.5,8000.5);
314  fHistnBClusVsLS[1] = ibooker.book1D("nBClusVsLS_1","Fraction of Clusters vs LS Barrel layer 1",8000,0.5,8000.5);
315  fHistnBClusVsLS[2] = ibooker.book1D("nBClusVsLS_2","Fraction of Clusters vs LS Barrel layer 2",8000,0.5,8000.5);
316  fHistnFPClusVsLS[0] = ibooker.book1D("nFPClusVsLS_0","Fraction of Clusters vs LS Barrel layer 0",8000,0.5,8000.5);
317  fHistnFPClusVsLS[1] = ibooker.book1D("nFPClusVsLS_1","Fraction of Clusters vs LS Barrel layer 1",8000,0.5,8000.5);
318  fHistnFMClusVsLS[0] = ibooker.book1D("nFMClusVsLS_0","Fraction of Clusters vs LS Barrel layer 0",8000,0.5,8000.5);
319  fHistnFMClusVsLS[1] = ibooker.book1D("nFMClusVsLS_1","Fraction of Clusters vs LS Barrel layer 1",8000,0.5,8000.5);
320  fHistBunchCrossings = ibooker.book1D("BunchCrossings","Cumulative Bunch Crossings",lastBunchCrossing,
321  0.5,float(lastBunchCrossing)+0.5);
322  fHistBunchCrossingsLastLumi = ibooker.book1D("BunchCrossingsLL","Bunch Crossings Last Lumi",lastBunchCrossing,
323  0.5,float(lastBunchCrossing)+0.5);
324  fHistClusterCountByBxLastLumi = ibooker.book1D("ClusterCountByBxLL","Cluster Count by BX Last Lumi",lastBunchCrossing,
325  0.5,float(lastBunchCrossing)+0.5);
326  fHistClusterCountByBxCumulative = ibooker.book1D("ClusterCountByBxSum","Cluster Count by BX Cumulative",lastBunchCrossing,
327  0.5,float(lastBunchCrossing)+0.5);
328  fHistClusByLS = ibooker.book1D("totalClusByLS","Number of Clusters all dets vs LS",8000,0.5,8000.5);
329 
330  // Add some pixel cluster quality check histograms (in a subfolder).
331  subfolder = folder+"qualityChecks/";
332  ibooker.setCurrentFolder(subfolder);
333 
335  // Create histograms for this run if not already present in our list.
336  edm::LogInfo("Status") << "Creating histograms for run #" << run.id().run();
337 
338  // Pixel cluster positions in the barrel - (z, phi).
339  for (size_t i = 0; i <= kNumLayers; ++i) {
340  std::stringstream key;
341  key << "clusPosBarrel" << i;
342  std::stringstream name;
343  name << key.str() << "_" << run.run();
344  std::stringstream title;
345  title << "Pixel cluster position - barrel layer " << i;
346  fHistContainerThisRun[key.str()] = ibooker.book2D(name.str().c_str(),
347  title.str().c_str(),
348  100, -30., 30.,
349  64, -Geom::pi(), Geom::pi());
350  }
351 
352  // Pixel cluster positions in the endcaps (x, y).
353  for (size_t i = 0; i <= kNumDisks; ++i) {
354  std::stringstream key;
355  key << "clusPosEndCap" << i;
356  std::stringstream name;
357  name << key.str() << "_" << run.run();
358  std::stringstream title;
359  title << "Pixel cluster position - endcap disk " << i;
360  fHistContainerThisRun[key.str()] = ibooker.book2D(name.str().c_str(),
361  title.str().c_str(),
362  100, -20., 20.,
363  100, -20., 20.);
364  }
365 
366  // Pixel cluster charge in the barrel, per bx.
367  for (size_t i = 0; i <= kNumLayers; ++i) {
368  std::stringstream key;
369  key << "clusChargeBarrel" << i;
370  std::stringstream name;
371  name << key.str() << "_" << run.run();
372  std::stringstream title;
373  title << "Pixel cluster charge - barrel layer " << i;
374  fHistContainerThisRun[key.str()] = ibooker.book2D(name.str().c_str(),
375  title.str().c_str(),
376  3564, .5, 3564.5,
377  100, 0., 100.);
378  }
379 
380  // Pixel cluster charge in the endcaps, per bx.
381  for (size_t i = 0; i <= kNumDisks; ++i) {
382  std::stringstream key;
383  key << "clusChargeEndCap" << i;
384  std::stringstream name;
385  name << key.str() << "_" << run.run();
386  std::stringstream title;
387  title << "Pixel cluster charge - endcap disk " << i;
388  fHistContainerThisRun[key.str()] = ibooker.book2D(name.str().c_str(),
389  title.str().c_str(),
390  3564, .5, 3564.5,
391  100, 0., 100.);
392  }
393 
394 
395  // Pixel cluster size in the barrel, per bx.
396  for (size_t i = 0; i <= kNumLayers; ++i) {
397  std::stringstream key;
398  key << "clusSizeBarrel" << i;
399  std::stringstream name;
400  name << key.str() << "_" << run.run();
401  std::stringstream title;
402  title << "Pixel cluster size - barrel layer " << i;
403  fHistContainerThisRun[key.str()] = ibooker.book2D(name.str().c_str(),
404  title.str().c_str(),
405  3564, .5, 3564.5,
406  100, 0., 100.);
407  }
408 
409  // Pixel cluster size in the endcaps, per bx.
410  for (size_t i = 0; i <= kNumDisks; ++i) {
411  std::stringstream key;
412  key << "clusSizeEndCap" << i;
413  std::stringstream name;
414  name << key.str() << "_" << run.run();
415  std::stringstream title;
416  title << "Pixel cluster size - endcap disk " << i;
417  fHistContainerThisRun[key.str()] = ibooker.book2D(name.str().c_str(),
418  title.str().c_str(),
419  3564, .5, 3564.5,
420  100, 0., 100.);
421  }
422  }
423 }
bool fIncludePixelQualCheckHistos
Definition: PixelLumiDQM.h:136
static const unsigned int lastBunchCrossing
Definition: PixelLumiDQM.h:53
MonitorElement * fHistRecordedByBxCumulative
Definition: PixelLumiDQM.h:166
MonitorElement * fHistClusByLS
Definition: PixelLumiDQM.h:163
MonitorElement * fHistnFMClusVsLS[2]
Definition: PixelLumiDQM.h:158
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
MonitorElement * fHistClusterCountByBxLastLumi
Definition: PixelLumiDQM.h:161
MonitorElement * fHistTotalRecordedLumiByLS
Definition: PixelLumiDQM.h:164
MonitorElement * fHistClusterCountByBxCumulative
Definition: PixelLumiDQM.h:162
MonitorElement * fHistnBClusVsLS[3]
Definition: PixelLumiDQM.h:156
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:136
MonitorElement * fHistBunchCrossings
Definition: PixelLumiDQM.h:159
std::map< std::string, MonitorElement * > fHistContainerThisRun
Definition: PixelLumiDQM.h:139
MonitorElement * fHistBunchCrossingsLastLumi
Definition: PixelLumiDQM.h:160
static size_t kNumLayers
Definition: PixelLumiDQM.h:76
MonitorElement * fHistRecordedByBxLastLumi
Definition: PixelLumiDQM.h:165
static size_t kNumDisks
Definition: PixelLumiDQM.h:77
constexpr double pi()
Definition: Pi.h:31
MonitorElement * fHistnFPClusVsLS[2]
Definition: PixelLumiDQM.h:157
unsigned int PixelLumiDQM::calculateBunchMask ( MonitorElement e,
std::vector< bool > &  mask 
)
private

Definition at line 629 of file PixelLumiDQM.cc.

References MonitorElement::getBinContent(), MonitorElement::getNbinsX(), mps_fire::i, and pileupCalc::nbins.

Referenced by endLuminosityBlock().

629  {
630  unsigned int nbins = e->getNbinsX();
631  std::vector<float> ar(nbins,0.);
632  for(unsigned int i = 1; i<= nbins; i++){
633  ar[i] = e->getBinContent(i);
634  }
635  return calculateBunchMask(ar,nbins,mask);
636 }
unsigned int calculateBunchMask(MonitorElement *, std::vector< bool > &)
double getBinContent(int binx) const
get content of bin (1-D)
int getNbinsX() const
get # of bins in X-axis
unsigned int PixelLumiDQM::calculateBunchMask ( std::vector< float > &  e,
unsigned int  nbins,
std::vector< bool > &  mask 
)
private

Definition at line 637 of file PixelLumiDQM.cc.

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

637  {
638  // Take the cumulative cluster count histogram and find max and average of non-empty bins.
639  unsigned int active_count = 0;
640  double maxc = 0.0;
641  double ave = 0.0; // Average of non-empty bins
642  unsigned int non_empty_bins = 0;
643 
644  for(unsigned int i = 1; i<= nbins; i++){
645  double bin = e[i];
646  if(bin !=0.0){
647  if(maxc<bin) maxc = bin;
648  ave += bin;
649  non_empty_bins++;
650  }
651  }
652 
653  ave /= non_empty_bins;
654  edm::LogWarning("pixelLumi") << "Bunch mask finder - non empty bins " << non_empty_bins
655  << " average of non empty bins " << ave
656  << " max content of one bin " << maxc;
657  double mean = 0.;
658  double sigma = 0.;
659  if(non_empty_bins < 50){
660  mean = maxc;
661  sigma = (maxc)/20;
662  }
663  else{
664  TH1F dist("dist","dist",500,0.,maxc+(maxc/500.)*20.);
665  for(unsigned int i = 1; i<= nbins; i++){
666  double bin = e[i];
667  dist.Fill(bin);
668  }
669  TF1 fit("plgaus","gaus");
670  dist.Fit(&fit,"","",fmax(0.,ave-(maxc-ave)/5.),maxc);
671  mean = fit.GetParameter("Mean");
672  sigma = fit.GetParameter("Sigma");
673  }
674  edm::LogWarning("pixelLumi") << "Bunch mask will use mean" << mean << " sigma " << sigma;
675  // Active BX defined as those which have nclus within fixed standard deviations of peak.
676  for(unsigned int i = 1; i<= nbins; i++){
677  double bin = e[i];
678  if(bin>0. && std::abs(bin-mean)<5.*(sigma)){ mask[i]=true; active_count++;}
679  }
680  edm::LogWarning("pixelLumi") << "Bunch mask finds " << active_count << " active bunch crossings ";
681  // edm::LogWarning("pixelLumi") << "this is the full bx mask " ;
682  // for(unsigned int i = 1; i<= nbins; i++)
683  // edm::LogWarning("pixelLumi") << ((mask[i]) ? 1:0);
684  return active_count;
685 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bin
set the eta bin as selection string.
void PixelLumiDQM::dqmBeginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivatevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 427 of file PixelLumiDQM.cc.

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

Definition at line 461 of file PixelLumiDQM.cc.

References bunchTriggerMask, calculateBunchMask(), CM2_TO_NANOBARN, fHistBunchCrossingsLastLumi, fHistClusByLS, fHistClusterCountByBxCumulative, fHistClusterCountByBxLastLumi, fHistnBClusVsLS, fHistnFMClusVsLS, fHistnFPClusVsLS, fHistRecordedByBxCumulative, fHistRecordedByBxLastLumi, fHistTotalRecordedLumiByLS, filledAndUnmaskedBunches, fLogFileName_, fNumPixelClusters, FREQ_ORBIT, fResetIntervalInLumiSections, fRunNo, MonitorElement::getBinContent(), 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, MonitorElement::setBinContent(), MonitorElement::setBinError(), mathSSE::sqrt(), pileupDistInMC::total, estimatePileup_makeJSON::trunc, useInnerBarrelLayer, XSEC_PIXEL_CLUSTER, and XSEC_PIXEL_CLUSTER_UNC.

463 {
464 
465  unsigned int ls = lumiBlock.luminosityBlockAuxiliary().luminosityBlock();
466 
467  // Only fill every fResetIntervalInLumiSections (default is 1 LS)
468  if(ls%fResetIntervalInLumiSections!=0) return;
469 
470  printf("Lumi Block = %d\n",ls);
471 
472  if((ls-1)%fResetIntervalInLumiSections==0){
473  }
474 
475  unsigned int nBClus[3] = {0,0,0};
476  unsigned int nFPClus[2] = {0, 0};
477  unsigned int nFMClus[2] = {0, 0};
478 
479  double total_recorded = 0.;
480  double total_recorded_unc_square = 0.;
481 
482  // Obtain bunch-by-bunch cluster counts and compute totals for lumi calculation.
483  double totalcounts = 0.0;
484  double etotalcounts = 0.0;
485  double totalevents = 0.0;
486  double lumi_factor_per_bx = 0.0;
489  else
491 
492  for(std::map<int, PixelClusterCount>::iterator it = fNumPixelClusters.begin();
493  it != fNumPixelClusters.end(); it++) {
494 
495  // Sum all clusters for this BX.
496  unsigned int total = (*it).second.numB.at(1)+
497  (*it).second.numB.at(2)+(*it).second.numFP.at(0)+(*it).second.numFP.at(1)+
498  (*it).second.numFM.at(0)+(*it).second.numFM.at(1);
499  if(useInnerBarrelLayer) total+=(*it).second.numB.at(0);
500  totalcounts += total;
501  double etotal = (*it).second.dnumB.at(1)+
502  (*it).second.dnumB.at(2)+(*it).second.dnumFP.at(0)+(*it).second.dnumFP.at(1)+
503  (*it).second.dnumFM.at(0)+(*it).second.dnumFM.at(1);
504  if(useInnerBarrelLayer) etotal = (*it).second.dnumB.at(0);
505  etotalcounts += etotal;
506  etotal = sqrt(etotal);
507 
508  fHistClusterCountByBxLastLumi->setBinContent((*it).first,total);
509  fHistClusterCountByBxLastLumi->setBinError((*it).first,etotal);
511 
512  unsigned int events_per_bx = fHistBunchCrossingsLastLumi->getBinContent((*it).first);
513  totalevents += events_per_bx;
514  double average_cluster_count = events_per_bx !=0 ? double(total)/events_per_bx : 0.;
515  double average_cluster_count_unc = events_per_bx!=0 ? etotal/events_per_bx : 0.;
516  double pixel_bx_lumi_per_ls = lumi_factor_per_bx * average_cluster_count / CM2_TO_NANOBARN ;
517  double pixel_bx_lumi_per_ls_unc = 0.0;
519  pixel_bx_lumi_per_ls_unc = sqrt(lumi_factor_per_bx*lumi_factor_per_bx *
520  (average_cluster_count_unc*average_cluster_count_unc +
521  (average_cluster_count* XSEC_PIXEL_CLUSTER_UNC /
523  (average_cluster_count* XSEC_PIXEL_CLUSTER /
525  ) / CM2_TO_NANOBARN ;
526  else
527  pixel_bx_lumi_per_ls_unc = sqrt(lumi_factor_per_bx*lumi_factor_per_bx *
528  (average_cluster_count_unc*average_cluster_count_unc +
529  (average_cluster_count* rXSEC_PIXEL_CLUSTER_UNC /
531  (average_cluster_count* rXSEC_PIXEL_CLUSTER /
533  ) / CM2_TO_NANOBARN ;
534 
535  fHistRecordedByBxLastLumi->setBinContent((*it).first,pixel_bx_lumi_per_ls);
536  fHistRecordedByBxLastLumi->setBinError((*it).first,pixel_bx_lumi_per_ls_unc);
537 
540  pixel_bx_lumi_per_ls);
541 
542  /*
543  if(fHistRecordedByBxLastLumi->getBinContent((*it).first)!=0.)
544  fHistRecordedByBxLastLumi->getBinContent((*it).first));
545  if(fHistRecordedByBxCumulative->getBinContent((*it).first)!=0.)
546  fHistRecordedByBxCumulative->getBinContent((*it).first));
547  */
548 
549  nBClus[0] +=(*it).second.numB.at(0);
550  nBClus[1] +=(*it).second.numB.at(1);
551  nBClus[2] +=(*it).second.numB.at(2);
552  nFPClus[0] +=(*it).second.numFP.at(0);
553  nFPClus[1] +=(*it).second.numFP.at(1);
554  nFMClus[0] +=(*it).second.numFM.at(0);
555  nFMClus[1] +=(*it).second.numFM.at(1);
556 
557  // Reset counters
558  (*it).second.Reset();
559 
560  // edm::LogWarning("pixelLumi") << "bx="<< (*it).first << " clusters=" << (*it).second.numB.at(0));
561  }
562 
564  for(unsigned int i = 0; i<= lastBunchCrossing; i++){
565  if(bunchTriggerMask[i]){
566  double err = fHistRecordedByBxLastLumi->getBinError(i);
567  total_recorded += fHistRecordedByBxLastLumi->getBinContent(i);
568  total_recorded_unc_square += err*err;
569  }
570  }
571 
572  // Replace the total obtained by summing over BXs with the average per BX from the total cluster count and rescale
573 
574  if(totalevents > 10){
575  total_recorded = lumi_factor_per_bx * totalcounts / totalevents / CM2_TO_NANOBARN ;
576  }
577  else total_recorded = 0.0;
578 
579  edm::LogWarning("pixelLumi") << " Total recorded " << total_recorded ;
580  fHistTotalRecordedLumiByLS->setBinContent(ls,total_recorded);
582  sqrt(total_recorded_unc_square));
583  }
584  // fill cluster counts by detector regions for sanity checks
585  unsigned int all_detectors_counts = 0;
586  for(unsigned int i = 0; i < 3; i++){
587  all_detectors_counts+=nBClus[i];
588  }
589  for(unsigned int i = 0; i < 2; i++){
590  all_detectors_counts+=nFPClus[i];
591  }
592  for(unsigned int i = 0; i < 2; i++){
593  all_detectors_counts+=nFMClus[i];
594  }
595 
596  fHistClusByLS->setBinContent(ls, all_detectors_counts);
597 
598  for(unsigned int i = 0; i < 3; i++){
600  float(nBClus[i])/float(all_detectors_counts));
601  }
602  for(unsigned int i = 0; i < 2; i++){
604  float(nFPClus[i])/float(all_detectors_counts));
605  }
606  for(unsigned int i = 0; i < 2; i++){
608  float(nFMClus[i])/float(all_detectors_counts));
609  }
610 
612 
613  timeval tv;
614  gettimeofday(&tv,nullptr);
615  tm *ts = gmtime(&tv.tv_sec);
616  char datestring[256];
617  strftime(datestring, sizeof(datestring),"%Y.%m.%d %T GMT %s",ts);
618  logFile_ << "RunNumber "<< fRunNo << std::endl;
619  logFile_ << "EndTimeOfFit " << datestring << std::endl;
620  logFile_ << "LumiRange "<< ls << "-" << ls << std::endl;
621  logFile_ << "Fill "<< -99 << std::endl;
622  logFile_ << "ActiveBunchCrossings "<< filledAndUnmaskedBunches << std::endl;
623  logFile_ << "PixelLumi "<< fHistTotalRecordedLumiByLS->getBinContent(ls) * 0.98 << std::endl;
624  logFile_ << "HFLumi "<< -99 << std::endl;
625  logFile_ << "Ratio " << -99 << std::endl;
626  logFile_.close();
627 }
static double SECONDS_PER_LS
Definition: PixelLumiDQM.h:43
unsigned int filledAndUnmaskedBunches
Definition: PixelLumiDQM.h:169
void setBinContent(int binx, double content)
set content of bin (1-D)
static const unsigned int lastBunchCrossing
Definition: PixelLumiDQM.h:53
int fResetIntervalInLumiSections
Definition: PixelLumiDQM.h:137
MonitorElement * fHistRecordedByBxCumulative
Definition: PixelLumiDQM.h:166
bool useInnerBarrelLayer
Definition: PixelLumiDQM.h:170
MonitorElement * fHistClusByLS
Definition: PixelLumiDQM.h:163
MonitorElement * fHistnFMClusVsLS[2]
Definition: PixelLumiDQM.h:158
unsigned int calculateBunchMask(MonitorElement *, std::vector< bool > &)
static double rXSEC_PIXEL_CLUSTER
Definition: PixelLumiDQM.h:50
T sqrt(T t)
Definition: SSEVec.h:18
MonitorElement * fHistClusterCountByBxLastLumi
Definition: PixelLumiDQM.h:161
MonitorElement * fHistTotalRecordedLumiByLS
Definition: PixelLumiDQM.h:164
static double FREQ_ORBIT
Definition: PixelLumiDQM.h:42
static double XSEC_PIXEL_CLUSTER_UNC
Definition: PixelLumiDQM.h:47
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
MonitorElement * fHistClusterCountByBxCumulative
Definition: PixelLumiDQM.h:162
MonitorElement * fHistnBClusVsLS[3]
Definition: PixelLumiDQM.h:156
std::vector< bool > bunchTriggerMask
Definition: PixelLumiDQM.h:168
def ls(path, rec=False)
Definition: eostools.py:348
static double CM2_TO_NANOBARN
Definition: PixelLumiDQM.h:52
static double XSEC_PIXEL_CLUSTER
Definition: PixelLumiDQM.h:46
double getBinError(int binx) const
get uncertainty on content of bin (1-D) - See TH1::GetBinError for details
MonitorElement * fHistBunchCrossingsLastLumi
Definition: PixelLumiDQM.h:160
std::string fLogFileName_
Definition: PixelLumiDQM.h:172
static double rXSEC_PIXEL_CLUSTER_UNC
Definition: PixelLumiDQM.h:51
double getBinContent(int binx) const
get content of bin (1-D)
std::map< int, PixelClusterCount > fNumPixelClusters
Definition: PixelLumiDQM.h:132
MonitorElement * fHistRecordedByBxLastLumi
Definition: PixelLumiDQM.h:165
MonitorElement * fHistnFPClusVsLS[2]
Definition: PixelLumiDQM.h:157
std::ofstream logFile_
Definition: PixelLumiDQM.h:174
void PixelLumiDQM::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivate

Definition at line 433 of file PixelLumiDQM.cc.

434 {
435 }
void PixelLumiDQM::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 100 of file PixelLumiDQM.cc.

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

100  {
102  desc.setUnknown();
103  descriptions.addDefault(desc);
104 }
void addDefault(ParameterSetDescription const &psetDescription)

Member Data Documentation

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

Definition at line 168 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

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

Definition at line 52 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

UInt_t PixelLumiDQM::fBXNo
private

Definition at line 122 of file PixelLumiDQM.h.

Referenced by analyze().

Double_t PixelLumiDQM::fChi2
private

Definition at line 130 of file PixelLumiDQM.h.

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

Definition at line 143 of file PixelLumiDQM.h.

Referenced by analyze(), and PixelLumiDQM().

UInt_t PixelLumiDQM::fEvtNo
private

Definition at line 120 of file PixelLumiDQM.h.

Referenced by analyze().

unsigned int PixelLumiDQM::fFillNumber
private

Definition at line 171 of file PixelLumiDQM.h.

MonitorElement* PixelLumiDQM::fHistBunchCrossings
private

Definition at line 159 of file PixelLumiDQM.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* PixelLumiDQM::fHistBunchCrossingsLastLumi
private

Definition at line 160 of file PixelLumiDQM.h.

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

MonitorElement* PixelLumiDQM::fHistClusByLS
private

Definition at line 163 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

MonitorElement* PixelLumiDQM::fHistClusterCountByBxCumulative
private

Definition at line 162 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

MonitorElement* PixelLumiDQM::fHistClusterCountByBxLastLumi
private

Definition at line 161 of file PixelLumiDQM.h.

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

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

Definition at line 139 of file PixelLumiDQM.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* PixelLumiDQM::fHistnBClusVsLS[3]
private

Definition at line 156 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

MonitorElement* PixelLumiDQM::fHistnFMClusVsLS[2]
private

Definition at line 158 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

MonitorElement* PixelLumiDQM::fHistnFPClusVsLS[2]
private

Definition at line 157 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

MonitorElement* PixelLumiDQM::fHistRecordedByBxCumulative
private

Definition at line 166 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

MonitorElement* PixelLumiDQM::fHistRecordedByBxLastLumi
private

Definition at line 165 of file PixelLumiDQM.h.

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

MonitorElement* PixelLumiDQM::fHistTotalRecordedLumiByLS
private

Definition at line 164 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

unsigned int PixelLumiDQM::filledAndUnmaskedBunches
private

Definition at line 169 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

bool PixelLumiDQM::fIncludePixelClusterInfo
private

Definition at line 135 of file PixelLumiDQM.h.

Referenced by analyze(), and PixelLumiDQM().

bool PixelLumiDQM::fIncludePixelQualCheckHistos
private

Definition at line 136 of file PixelLumiDQM.h.

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

bool PixelLumiDQM::fIncludeVertexInfo
private

Definition at line 134 of file PixelLumiDQM.h.

MonitorElement* PixelLumiDQM::fIntActiveCrossingsFromDB
private

Definition at line 155 of file PixelLumiDQM.h.

std::string PixelLumiDQM::fLogFileName_
private

Definition at line 172 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

UInt_t PixelLumiDQM::fLSNo
private

Definition at line 121 of file PixelLumiDQM.h.

Referenced by analyze().

double PixelLumiDQM::fMinClusterCharge
private

Definition at line 151 of file PixelLumiDQM.h.

Referenced by analyze(), and PixelLumiDQM().

int PixelLumiDQM::fMinPixelsPerCluster
private

Definition at line 148 of file PixelLumiDQM.h.

Referenced by analyze(), and PixelLumiDQM().

Double_t PixelLumiDQM::fNdof
private

Definition at line 131 of file PixelLumiDQM.h.

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

Definition at line 132 of file PixelLumiDQM.h.

Referenced by analyze(), and endLuminosityBlock().

UInt_t PixelLumiDQM::fNumTrkPerVtx
private

Definition at line 126 of file PixelLumiDQM.h.

UInt_t PixelLumiDQM::fNumVtx
private

Definition at line 124 of file PixelLumiDQM.h.

UInt_t PixelLumiDQM::fNumVtxGood
private

Definition at line 125 of file PixelLumiDQM.h.

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

Definition at line 117 of file PixelLumiDQM.h.

Referenced by analyze().

double PixelLumiDQM::FREQ_ORBIT = 11245.5
static

Definition at line 42 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

int PixelLumiDQM::fResetIntervalInLumiSections
private

Definition at line 137 of file PixelLumiDQM.h.

Referenced by beginLuminosityBlock(), and endLuminosityBlock().

UInt_t PixelLumiDQM::fRunNo
private

Definition at line 119 of file PixelLumiDQM.h.

Referenced by analyze(), and endLuminosityBlock().

UInt_t PixelLumiDQM::fTimestamp
private

Definition at line 123 of file PixelLumiDQM.h.

Referenced by analyze().

Double_t PixelLumiDQM::fVtxX
private

Definition at line 127 of file PixelLumiDQM.h.

Double_t PixelLumiDQM::fVtxY
private

Definition at line 128 of file PixelLumiDQM.h.

Double_t PixelLumiDQM::fVtxZ
private

Definition at line 129 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 53 of file PixelLumiDQM.h.

Referenced by bookHistograms(), and endLuminosityBlock().

std::ofstream PixelLumiDQM::logFile_
private

Definition at line 174 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

double PixelLumiDQM::rXSEC_PIXEL_CLUSTER = 9.4e-24
static

Definition at line 50 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

double PixelLumiDQM::rXSEC_PIXEL_CLUSTER_UNC = 0.119e-24
static

Definition at line 51 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

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

Definition at line 43 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

bool PixelLumiDQM::useInnerBarrelLayer
private

Definition at line 170 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

double PixelLumiDQM::XSEC_PIXEL_CLUSTER = 10.08e-24
static

Definition at line 46 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().

double PixelLumiDQM::XSEC_PIXEL_CLUSTER_UNC = 0.17e-24
static

Definition at line 47 of file PixelLumiDQM.h.

Referenced by endLuminosityBlock().