CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
TotemT2DQMSource Class Reference
Inheritance diagram for TotemT2DQMSource:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Classes

struct  PlanePlots
 
struct  SectorPlots
 

Public Member Functions

 TotemT2DQMSource (const edm::ParameterSet &)
 
 ~TotemT2DQMSource () override=default
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Protected Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &) override
 
void dqmBeginRun (const edm::Run &, const edm::EventSetup &) override
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 

Private Member Functions

bool areChannelsTriggered (const TotemT2DetId &)
 
void bookErrorFlagsHistogram (DQMStore::IBooker &)
 
void clearTriggerBitset ()
 
void fillActivePlanes (std::unordered_map< unsigned int, std::set< unsigned int >> &, const TotemT2DetId &)
 
void fillEdges (const TotemT2Digi &, const TotemT2DetId &)
 
void fillErrorFlagsHistogram (const TotemT2Digi &)
 
void fillToT (const TotemT2RecHit &, const TotemT2DetId &)
 
void fillTriggerBitset (const TotemT2DetId &)
 

Private Attributes

const edm::EDGetTokenT< edmNew::DetSetVector< TotemT2Digi > > digiToken_
 
const edm::ESGetToken< TotemGeometry, TotemGeometryRcdgeometryToken_
 
MonitorElementHPTDCErrorFlags_2D_ = nullptr
 
const unsigned int nbinsx_
 
const unsigned int nbinsy_
 
std::unordered_map< unsigned int, PlanePlotsplanePlots_
 
const edm::EDGetTokenT< edmNew::DetSetVector< TotemT2RecHit > > rechitToken_
 
std::unordered_map< unsigned int, SectorPlotssectorPlots_
 
std::unique_ptr< TotemT2Segmentationsegm_
 
const unsigned int windowsNum_
 

Static Private Attributes

static constexpr double HPTDC_BIN_WIDTH_NS_ = 25. / 1024
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 31 of file TotemT2DQMSource.cc.

Constructor & Destructor Documentation

◆ TotemT2DQMSource()

TotemT2DQMSource::TotemT2DQMSource ( const edm::ParameterSet iConfig)

Definition at line 148 of file TotemT2DQMSource.cc.

149  : geometryToken_(esConsumes<TotemGeometry, TotemGeometryRcd, edm::Transition::BeginRun>()),
152  nbinsx_(iConfig.getParameter<unsigned int>("nbinsx")),
153  nbinsy_(iConfig.getParameter<unsigned int>("nbinsy")),
154  windowsNum_(iConfig.getParameter<unsigned int>("windowsNum")) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const unsigned int nbinsx_
const edm::EDGetTokenT< edmNew::DetSetVector< TotemT2Digi > > digiToken_
const unsigned int nbinsy_
const unsigned int windowsNum_
const edm::EDGetTokenT< edmNew::DetSetVector< TotemT2RecHit > > rechitToken_
const edm::ESGetToken< TotemGeometry, TotemGeometryRcd > geometryToken_

◆ ~TotemT2DQMSource()

TotemT2DQMSource::~TotemT2DQMSource ( )
overridedefault

Member Function Documentation

◆ analyze()

void TotemT2DQMSource::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 179 of file TotemT2DQMSource.cc.

References areChannelsTriggered(), protons_cff::arm, CTPPSDetId::armId(), clearTriggerBitset(), digiToken_, fillActivePlanes(), fillEdges(), fillErrorFlagsHistogram(), fillToT(), fillTriggerBitset(), l1ctLayer2EG_cff::id, iEvent, CTPPSDetId::maxArm, TotemT2DetId::maxChannel, planePlots_, rechitToken_, sectorPlots_, and segm_.

179  {
180  // fill digis information
181  for (const auto& ds_digis : iEvent.get(digiToken_)) {
182  const TotemT2DetId detid(ds_digis.detId());
183  const TotemT2DetId planeId(detid.planeId());
184  for (const auto& digi : ds_digis) {
185  segm_->fill(planePlots_[planeId].digisMultiplicity->getTH2D(), detid);
186  fillTriggerBitset(detid);
188  fillEdges(digi, detid);
189  }
190  }
191 
192  // fill rechits information
193  std::unordered_map<unsigned int, std::set<unsigned int>> planes;
194  for (const auto& ds_rechits : iEvent.get(rechitToken_)) {
195  const TotemT2DetId detid(ds_rechits.detId());
196  const TotemT2DetId planeId(detid.planeId());
197  for (const auto& rechit : ds_rechits) {
198  segm_->fill(planePlots_[planeId].rechitMultiplicity->getTH2D(), detid);
199  fillToT(rechit, detid);
200  fillActivePlanes(planes, detid);
201  }
202  }
203 
204  for (const auto& plt : sectorPlots_)
205  plt.second.activePlanesCount->Fill(planes[plt.first].size());
206 
207  for (unsigned short arm = 0; arm <= CTPPSDetId::maxArm; ++arm)
208  for (unsigned short plane = 0; plane <= 1; ++plane)
209  for (unsigned short id = 0; id <= TotemT2DetId::maxChannel; ++id) {
210  const TotemT2DetId detid(arm, plane, id);
211  if (areChannelsTriggered(detid)) {
212  const TotemT2DetId secId(detid.armId());
213  segm_->fill(sectorPlots_[secId].triggerEmulator->getTH2D(), detid);
214  }
215  }
216 
218 }
void fillActivePlanes(std::unordered_map< unsigned int, std::set< unsigned int >> &, const TotemT2DetId &)
Detector ID class for Totem T2 detectors. Bits [19:31] : Base CTPPSDetId class attributes Bits [16:18...
Definition: TotemT2DetId.h:25
std::unique_ptr< TotemT2Segmentation > segm_
void fillEdges(const TotemT2Digi &, const TotemT2DetId &)
static constexpr uint32_t maxChannel
Definition: TotemT2DetId.h:35
int iEvent
Definition: GenABIO.cc:224
void fillToT(const TotemT2RecHit &, const TotemT2DetId &)
const edm::EDGetTokenT< edmNew::DetSetVector< TotemT2Digi > > digiToken_
static const uint32_t maxArm
Definition: CTPPSDetId.h:51
const edm::EDGetTokenT< edmNew::DetSetVector< TotemT2RecHit > > rechitToken_
bool areChannelsTriggered(const TotemT2DetId &)
std::unordered_map< unsigned int, PlanePlots > planePlots_
void fillTriggerBitset(const TotemT2DetId &)
std::unordered_map< unsigned int, SectorPlots > sectorPlots_
void fillErrorFlagsHistogram(const TotemT2Digi &)

◆ areChannelsTriggered()

bool TotemT2DQMSource::areChannelsTriggered ( const TotemT2DetId detid)
private

Definition at line 242 of file TotemT2DQMSource.cc.

References CTPPSDetId::armId(), TotemT2DetId::channel(), submitPVResolutionJobs::count, gpuClustering::pixelStatus::mask, TotemT2DetId::maxPlane, TotemT2DQMSource::SectorPlots::MINIMAL_TRIGGER, TotemT2DetId::plane(), and sectorPlots_.

Referenced by analyze().

242  {
243  unsigned int channel = detid.channel();
244 
245  // prepare mask
246  std::bitset<(TotemT2DetId::maxPlane + 1) * (TotemT2DetId::maxChannel + 1)> mask;
247  // check if plane is even or not
248  unsigned int pl = detid.plane() % 2 == 0 ? 0 : 1;
249  // set only even or only odd plane bits for this channel
250  for (; pl <= TotemT2DetId::maxPlane; pl += 2)
251  mask[4 * pl + channel] = true;
252  const TotemT2DetId secId(detid.armId());
253  // check how many masked channels were hit
254  unsigned int triggeredChannelsNumber = (mask & sectorPlots_[secId].hitTilesArray).count();
255 
256  return triggeredChannelsNumber >= SectorPlots::MINIMAL_TRIGGER;
257 }
Detector ID class for Totem T2 detectors. Bits [19:31] : Base CTPPSDetId class attributes Bits [16:18...
Definition: TotemT2DetId.h:25
static const unsigned int MINIMAL_TRIGGER
static constexpr uint32_t maxPlane
Definition: TotemT2DetId.h:34
constexpr uint32_t mask
Definition: gpuClustering.h:26
uint32_t plane() const
Definition: TotemT2DetId.h:44
CTPPSDetId armId() const
Definition: CTPPSDetId.h:80
std::unordered_map< unsigned int, SectorPlots > sectorPlots_
uint32_t channel() const
Definition: TotemT2DetId.h:51

◆ bookErrorFlagsHistogram()

void TotemT2DQMSource::bookErrorFlagsHistogram ( DQMStore::IBooker ibooker)
private

Definition at line 259 of file TotemT2DQMSource.cc.

References dqm::implementation::IBooker::book2D(), HPTDCErrorFlags_2D_, dqm::impl::MonitorElement::setBinLabel(), and cond::impl::to_string().

Referenced by bookHistograms().

259  {
260  HPTDCErrorFlags_2D_ = ibooker.book2D("HPTDC Errors", " HPTDC Errors?", 8, -0.5, 7.5, 2, -0.5, 1.5);
261  for (unsigned short error_index = 1; error_index <= 8; ++error_index)
262  HPTDCErrorFlags_2D_->setBinLabel(error_index, "Flag " + std::to_string(error_index));
263 
264  int tmpIndex = 0;
265  HPTDCErrorFlags_2D_->setBinLabel(++tmpIndex, "some id 0", /* axis */ 2);
266  HPTDCErrorFlags_2D_->setBinLabel(++tmpIndex, "some id 1", /* axis */ 2);
267 }
MonitorElement * HPTDCErrorFlags_2D_
std::string to_string(const V &value)
Definition: OMSAccess.h:77
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212

◆ bookHistograms()

void TotemT2DQMSource::bookHistograms ( DQMStore::IBooker ibooker,
const edm::Run ,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 158 of file TotemT2DQMSource.cc.

References protons_cff::arm, CTPPSDetId::armId(), bookErrorFlagsHistogram(), dqm::implementation::NavigatorBase::cd(), geometryToken_, edm::EventSetup::getData(), CTPPSDetId::maxArm, TotemT2DetId::maxPlane, nbinsx_, nbinsy_, TotemT2DetId::planeId(), planePlots_, sectorPlots_, segm_, dqm::implementation::NavigatorBase::setCurrentFolder(), and windowsNum_.

158  {
159  ibooker.cd();
160  ibooker.setCurrentFolder("TotemT2");
161 
162  bookErrorFlagsHistogram(ibooker);
163 
164  for (unsigned int arm = 0; arm <= CTPPSDetId::maxArm; ++arm) {
165  for (unsigned int pl = 0; pl <= TotemT2DetId::maxPlane; ++pl) {
166  const TotemT2DetId detid(arm, pl, 0);
167  const TotemT2DetId planeId(detid.planeId());
168  planePlots_[planeId] = PlanePlots(ibooker, planeId, nbinsx_, nbinsy_);
169  }
170  const TotemT2DetId detid(arm, 0, 0);
171  const TotemT2DetId secId(detid.armId());
172  sectorPlots_[secId] = SectorPlots(ibooker, secId, nbinsx_, nbinsy_, windowsNum_);
173  }
174 
175  // build a segmentation helper for the size of histograms previously booked
176  segm_ = std::make_unique<TotemT2Segmentation>(iSetup.getData(geometryToken_), nbinsx_, nbinsy_);
177 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
Detector ID class for Totem T2 detectors. Bits [19:31] : Base CTPPSDetId class attributes Bits [16:18...
Definition: TotemT2DetId.h:25
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
std::unique_ptr< TotemT2Segmentation > segm_
const unsigned int nbinsx_
static constexpr uint32_t maxPlane
Definition: TotemT2DetId.h:34
const unsigned int nbinsy_
static const uint32_t maxArm
Definition: CTPPSDetId.h:51
const unsigned int windowsNum_
std::unordered_map< unsigned int, PlanePlots > planePlots_
const edm::ESGetToken< TotemGeometry, TotemGeometryRcd > geometryToken_
std::unordered_map< unsigned int, SectorPlots > sectorPlots_
void bookErrorFlagsHistogram(DQMStore::IBooker &)

◆ clearTriggerBitset()

void TotemT2DQMSource::clearTriggerBitset ( )
private

Definition at line 237 of file TotemT2DQMSource.cc.

References sectorPlots_.

Referenced by analyze().

237  {
238  for (auto& sectorPlot : sectorPlots_)
239  sectorPlot.second.hitTilesArray.reset();
240 }
std::unordered_map< unsigned int, SectorPlots > sectorPlots_

◆ dqmBeginRun()

void TotemT2DQMSource::dqmBeginRun ( const edm::Run ,
const edm::EventSetup  
)
overrideprotectedvirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 156 of file TotemT2DQMSource.cc.

156 {}

◆ fillActivePlanes()

void TotemT2DQMSource::fillActivePlanes ( std::unordered_map< unsigned int, std::set< unsigned int >> &  planes,
const TotemT2DetId detid 
)
private

Definition at line 220 of file TotemT2DQMSource.cc.

References CTPPSDetId::armId(), TotemT2DetId::plane(), and sectorPlots_.

Referenced by analyze().

221  {
222  const TotemT2DetId secId(detid.armId());
223  unsigned short pl = detid.plane();
224 
225  planes[secId].insert(pl);
226 
227  sectorPlots_[secId].activePlanes->Fill(pl);
228 }
Detector ID class for Totem T2 detectors. Bits [19:31] : Base CTPPSDetId class attributes Bits [16:18...
Definition: TotemT2DetId.h:25
uint32_t plane() const
Definition: TotemT2DetId.h:44
CTPPSDetId armId() const
Definition: CTPPSDetId.h:80
std::unordered_map< unsigned int, SectorPlots > sectorPlots_

◆ fillEdges()

void TotemT2DQMSource::fillEdges ( const TotemT2Digi digi,
const TotemT2DetId detid 
)
private

Definition at line 274 of file TotemT2DQMSource.cc.

References CTPPSDetId::armId(), HPTDC_BIN_WIDTH_NS_, TotemT2Digi::leadingEdge(), sectorPlots_, and TotemT2Digi::trailingEdge().

Referenced by analyze().

274  {
275  const TotemT2DetId secId(detid.armId());
276  sectorPlots_[secId].leadingEdge->Fill(HPTDC_BIN_WIDTH_NS_ * digi.leadingEdge());
277  sectorPlots_[secId].trailingEdge->Fill(HPTDC_BIN_WIDTH_NS_ * digi.trailingEdge());
278 }
Detector ID class for Totem T2 detectors. Bits [19:31] : Base CTPPSDetId class attributes Bits [16:18...
Definition: TotemT2DetId.h:25
static constexpr double HPTDC_BIN_WIDTH_NS_
CTPPSDetId armId() const
Definition: CTPPSDetId.h:80
unsigned short trailingEdge() const
Definition: TotemT2Digi.h:20
unsigned short leadingEdge() const
Definition: TotemT2Digi.h:18
std::unordered_map< unsigned int, SectorPlots > sectorPlots_

◆ fillErrorFlagsHistogram()

void TotemT2DQMSource::fillErrorFlagsHistogram ( const TotemT2Digi digi)
private

Definition at line 269 of file TotemT2DQMSource.cc.

References funct::void.

Referenced by analyze().

269  {
270  // placeholder for error hitogram filling
271  (void)digi;
272 }
TEMPL(T2) struct Divides void
Definition: Factorize.h:24

◆ fillToT()

void TotemT2DQMSource::fillToT ( const TotemT2RecHit rechit,
const TotemT2DetId detid 
)
private

Definition at line 280 of file TotemT2DQMSource.cc.

References CTPPSDetId::armId(), sectorPlots_, and TotemT2RecHit::toT().

Referenced by analyze().

280  {
281  const TotemT2DetId secId(detid.armId());
282  sectorPlots_[secId].timeOverTreshold->Fill(rechit.toT());
283 }
Detector ID class for Totem T2 detectors. Bits [19:31] : Base CTPPSDetId class attributes Bits [16:18...
Definition: TotemT2DetId.h:25
CTPPSDetId armId() const
Definition: CTPPSDetId.h:80
std::unordered_map< unsigned int, SectorPlots > sectorPlots_
float toT() const
Definition: TotemT2RecHit.h:25

◆ fillTriggerBitset()

void TotemT2DQMSource::fillTriggerBitset ( const TotemT2DetId detid)
private

Definition at line 230 of file TotemT2DQMSource.cc.

References CTPPSDetId::armId(), TotemT2DetId::channel(), TotemT2DetId::plane(), and sectorPlots_.

Referenced by analyze().

230  {
231  const TotemT2DetId secId(detid.armId());
232  unsigned short pl = detid.plane();
233  unsigned short ch = detid.channel();
234  sectorPlots_[secId].hitTilesArray[4 * pl + ch] = true;
235 }
Detector ID class for Totem T2 detectors. Bits [19:31] : Base CTPPSDetId class attributes Bits [16:18...
Definition: TotemT2DetId.h:25
uint32_t plane() const
Definition: TotemT2DetId.h:44
CTPPSDetId armId() const
Definition: CTPPSDetId.h:80
std::unordered_map< unsigned int, SectorPlots > sectorPlots_
uint32_t channel() const
Definition: TotemT2DetId.h:51

Member Data Documentation

◆ digiToken_

const edm::EDGetTokenT<edmNew::DetSetVector<TotemT2Digi> > TotemT2DQMSource::digiToken_
private

Definition at line 52 of file TotemT2DQMSource.cc.

Referenced by analyze().

◆ geometryToken_

const edm::ESGetToken<TotemGeometry, TotemGeometryRcd> TotemT2DQMSource::geometryToken_
private

Definition at line 51 of file TotemT2DQMSource.cc.

Referenced by bookHistograms().

◆ HPTDC_BIN_WIDTH_NS_

constexpr double TotemT2DQMSource::HPTDC_BIN_WIDTH_NS_ = 25. / 1024
staticprivate

Definition at line 57 of file TotemT2DQMSource.cc.

Referenced by fillEdges().

◆ HPTDCErrorFlags_2D_

MonitorElement* TotemT2DQMSource::HPTDCErrorFlags_2D_ = nullptr
private

Definition at line 58 of file TotemT2DQMSource.cc.

Referenced by bookErrorFlagsHistogram().

◆ nbinsx_

const unsigned int TotemT2DQMSource::nbinsx_
private

Definition at line 60 of file TotemT2DQMSource.cc.

Referenced by bookHistograms().

◆ nbinsy_

const unsigned int TotemT2DQMSource::nbinsy_
private

Definition at line 60 of file TotemT2DQMSource.cc.

Referenced by bookHistograms().

◆ planePlots_

std::unordered_map<unsigned int, PlanePlots> TotemT2DQMSource::planePlots_
private

Definition at line 87 of file TotemT2DQMSource.cc.

Referenced by analyze(), and bookHistograms().

◆ rechitToken_

const edm::EDGetTokenT<edmNew::DetSetVector<TotemT2RecHit> > TotemT2DQMSource::rechitToken_
private

Definition at line 53 of file TotemT2DQMSource.cc.

Referenced by analyze().

◆ sectorPlots_

std::unordered_map<unsigned int, SectorPlots> TotemT2DQMSource::sectorPlots_
private

◆ segm_

std::unique_ptr<TotemT2Segmentation> TotemT2DQMSource::segm_
private

Definition at line 55 of file TotemT2DQMSource.cc.

Referenced by analyze(), and bookHistograms().

◆ windowsNum_

const unsigned int TotemT2DQMSource::windowsNum_
private

Definition at line 61 of file TotemT2DQMSource.cc.

Referenced by bookHistograms().