CMS 3D CMS Logo

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

#include <CalibTracker/SiStripLorentzAnglePCLMonitor/plugins/SiStripLorentzAnglePCLMonitor.cc>

Inheritance diagram for SiStripLorentzAnglePCLMonitor:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Classes

struct  OnTrackCluster
 

Public Member Functions

 SiStripLorentzAnglePCLMonitor (const edm::ParameterSet &)
 
 ~SiStripLorentzAnglePCLMonitor () 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
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- 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 &)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (edm::Run const &, edm::EventSetup const &) override
 
std::string moduleLocationType (const uint32_t &mod, const TrackerTopology *tTopo)
 

Private Attributes

const std::string folder_
 
SiStripLorentzAngleCalibrationHistograms iHists_
 
const edm::EDGetTokenT< TrajTrackAssociationCollectionm_association_token
 
SiStripClusterInfo m_clusterInfo
 
const edm::ESGetToken< SiStripLatency, SiStripLatencyRcdm_latencyTokenBR
 
const edm::ESGetToken< SiStripLorentzAngle, SiStripLorentzAngleDepRcdm_lorentzAngleTokenBR
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordm_magFieldTokenBR
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordm_tkGeomToken
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordm_tkGeomTokenBR
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdm_topoEsTokenBR
 
const edm::EDGetTokenT< edm::View< reco::Track > > m_tracks_token
 
bool mismatchedBField_
 
bool mismatchedLatency_
 
const bool saveHistosMods_
 

Static Private Attributes

static constexpr float teslaToInverseGeV_ = 2.99792458e-3f
 

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
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Description: class to book and fill histograms necessary for the online monitoring of the SiStripLorentzAngle

Implementation: Largely taken from https://github.com/robervalwalsh/tracker-la/blob/master/SiStripLAMonitor.cc

Definition at line 59 of file SiStripLorentzAnglePCLMonitor.cc.

Constructor & Destructor Documentation

◆ SiStripLorentzAnglePCLMonitor()

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

Definition at line 109 of file SiStripLorentzAnglePCLMonitor.cc.

110  : m_clusterInfo(consumesCollector()),
111  mismatchedBField_{false},
112  mismatchedLatency_{false},
113  folder_(iConfig.getParameter<std::string>("folder")),
114  saveHistosMods_(iConfig.getParameter<bool>("saveHistoMods")),
115  m_tracks_token(consumes<edm::View<reco::Track>>(iConfig.getParameter<edm::InputTag>("Tracks"))),
116  m_association_token(consumes<TrajTrackAssociationCollection>(iConfig.getParameter<edm::InputTag>("Tracks"))),
117  m_tkGeomToken{esConsumes<>()},
118  m_latencyTokenBR{esConsumes<edm::Transition::BeginRun>()},
119  m_topoEsTokenBR{esConsumes<edm::Transition::BeginRun>()},
120  m_tkGeomTokenBR{esConsumes<edm::Transition::BeginRun>()},
121  m_magFieldTokenBR{esConsumes<edm::Transition::BeginRun>()},
122  m_lorentzAngleTokenBR{esConsumes<edm::Transition::BeginRun>()} {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::ESGetToken< SiStripLorentzAngle, SiStripLorentzAngleDepRcd > m_lorentzAngleTokenBR
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > m_tkGeomTokenBR
const edm::EDGetTokenT< TrajTrackAssociationCollection > m_association_token
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > m_tkGeomToken
const edm::ESGetToken< SiStripLatency, SiStripLatencyRcd > m_latencyTokenBR
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > m_topoEsTokenBR
const edm::EDGetTokenT< edm::View< reco::Track > > m_tracks_token
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_magFieldTokenBR

◆ ~SiStripLorentzAnglePCLMonitor()

SiStripLorentzAnglePCLMonitor::~SiStripLorentzAnglePCLMonitor ( )
overridedefault

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 225 of file SiStripLorentzAnglePCLMonitor.cc.

References trackingPlots::assoc, bsc_activity_cfg::clusters, HcalObjRepresent::Fill(), SiStripLorentzAngleCalibrationHistograms::h1_, SiStripLorentzAngleCalibrationHistograms::h2_, SiStripLorentzAngleCalibrationHistograms::h2_ct_var2_m_, SiStripLorentzAngleCalibrationHistograms::h2_ct_var3_m_, SiStripLorentzAngleCalibrationHistograms::h2_ct_w_m_, SiStripLorentzAngleCalibrationHistograms::h2_t_var2_m_, SiStripLorentzAngleCalibrationHistograms::h2_t_var3_m_, SiStripLorentzAngleCalibrationHistograms::h2_t_w_m_, SiStripLorentzAngleCalibrationHistograms::hash_, ecalpyutils::hashedIndex(), SiStripHashedDetId::hashedIndex(), iEvent, iHists_, LogDebug, m_association_token, m_clusterInfo, m_tracks_token, muonTagProbeFilters_cff::matched, mismatchedBField_, mismatchedLatency_, mod(), SiStripLorentzAngleCalibrationHistograms::moduleLocationType_, EcalCalibMonitorClient_cfi::moduleName, SiStripLorentzAngleCalibrationHistograms::orientation_, saveHistosMods_, SiStripClusterInfo::setCluster(), Validation_hcalonly_cfi::sign, AlCaHLTBitMon_QueryRunRegistry::string, theta(), HLT_2023v12_cff::track, DiMuonV_cfg::tracks, and SiStripClusterInfo::variance().

225  {
226  using namespace edm;
227 
228  // return immediately if the field is not consistent!
229  if (mismatchedBField_)
230  return;
231 
232  if (mismatchedLatency_)
233  return;
234 
236  iEvent.getByToken(m_tracks_token, tracks);
237  edm::Handle<TrajTrackAssociationCollection> trajTrackAssociations;
238  iEvent.getByToken(m_association_token, trajTrackAssociations);
239 
240  LogDebug(moduleDescription().moduleName()) << "I AM IN EVENT" << iEvent.id() << std::endl;
241 
242  std::vector<OnTrackCluster> clusters{};
243 
244  // first collect all the clusters
245  for (const auto& assoc : *trajTrackAssociations) {
246  const auto traj = assoc.key.get();
247  const auto track = assoc.val.get();
248 
249  iHists_.h1_["track_pt"]->Fill(track->pt());
250  iHists_.h1_["track_eta"]->Fill(track->eta());
251  iHists_.h1_["track_phi"]->Fill(track->phi());
252  iHists_.h1_["track_validhits"]->Fill(track->numberOfValidHits());
253 
254  const auto normChi2 = track->ndof() > 0 ? track->chi2() / track->ndof() : -1.;
255  iHists_.h1_["track_chi2ndof"]->Fill(normChi2);
256  iHists_.h2_["track_chi2xhits"]->Fill(normChi2, track->numberOfValidHits());
257  iHists_.h2_["track_ptxhits"]->Fill(track->pt(), track->numberOfValidHits());
258  iHists_.h2_["track_etaxhits"]->Fill(track->eta(), track->numberOfValidHits());
259  iHists_.h2_["track_ptxchi2"]->Fill(track->pt(), normChi2);
260  iHists_.h2_["track_ptxeta"]->Fill(track->pt(), track->eta());
261  iHists_.h2_["track_etaxchi2"]->Fill(track->eta(), normChi2);
262 
263  edm::LogInfo("SiStripLorentzAnglePCLMonitor")
264  << " track pT()" << track->pt() << " track eta()" << track->eta() << std::endl;
265 
266  for (const auto& meas : traj->measurements()) {
267  const auto& trajState = meas.updatedState();
268  if (!trajState.isValid())
269  continue;
270 
271  // there can be 2 (stereo module), 1 (no stereo module), or 0 (no strip hit) clusters per measurement
272  const auto trechit = meas.recHit()->hit();
273  const auto simple1d = dynamic_cast<const SiStripRecHit1D*>(trechit);
274  const auto simple = dynamic_cast<const SiStripRecHit2D*>(trechit);
275  const auto matched = dynamic_cast<const SiStripMatchedRecHit2D*>(trechit);
276  if (matched) {
277  clusters.emplace_back(matched->monoId(), &matched->monoCluster(), traj, track, meas);
278  clusters.emplace_back(matched->stereoId(), &matched->stereoCluster(), traj, track, meas);
279  } else if (simple) {
280  clusters.emplace_back(simple->geographicalId().rawId(), simple->cluster().get(), traj, track, meas);
281  } else if (simple1d) {
282  clusters.emplace_back(simple1d->geographicalId().rawId(), simple1d->cluster().get(), traj, track, meas);
283  }
284  }
285  }
286 
287  for (const auto clus : clusters) {
288  uint32_t c_nstrips = clus.cluster->amplitudes().size();
289  m_clusterInfo.setCluster(*clus.cluster, clus.det);
290  float c_variance = m_clusterInfo.variance();
291  const auto& trajState = clus.measurement.updatedState();
292  const auto trackDir = trajState.localDirection();
293  float c_localdirx = trackDir.x();
294  float c_localdiry = trackDir.y();
295  float c_localdirz = trackDir.z();
296  const auto hit = clus.measurement.recHit()->hit();
297 
298  // not yet needed (might be used for Backplane correction later on
299  /*
300  const auto& tkGeom = iSetup.getData(m_tkGeomToken);
301  const auto stripDet = dynamic_cast<const StripGeomDetUnit*>(tkGeom.idToDet(hit->geographicalId()));
302  float c_barycenter = stripDet->specificTopology().localPosition(clus.cluster->barycenter()).x();
303  float c_localx = stripDet->toLocal(trajState.globalPosition()).x();
304  float c_rhlocalx = hit->localPosition().x();
305  float c_rhlocalxerr = hit->localPositionError().xx();
306  */
307 
308  const uint32_t mod = hit->geographicalId().rawId();
309 
310  std::string locationtype = iHists_.moduleLocationType_[mod];
311  if (locationtype.empty())
312  return;
313 
314  // retrive the hashed index
315  const auto& hashedIndex = iHists_.hash_.hashedIndex(mod);
316 
317  if (saveHistosMods_) {
318  LogDebug("SiStripLorentzAnglePCLMonitor") << "module ID: " << mod << " hashedIndex: " << hashedIndex;
319  iHists_.h1_["occupancyPerIndex"]->Fill(hashedIndex);
320  }
321 
322  TVector3 localdir(c_localdirx, c_localdiry, c_localdirz);
323  int sign = iHists_.orientation_[mod];
324  float tantheta = TMath::Tan(localdir.Theta());
325  float cosphi = TMath::Cos(localdir.Phi());
326  float theta = localdir.Theta();
327 
328  iHists_.h1_[Form("%s_nstrips", locationtype.c_str())]->Fill(c_nstrips);
329  iHists_.h1_[Form("%s_tanthetatrk", locationtype.c_str())]->Fill(sign * tantheta);
330  iHists_.h1_[Form("%s_cosphitrk", locationtype.c_str())]->Fill(cosphi);
331 
332  // nstrips
333  iHists_.h2_[Form("%s_tanthcosphtrk_nstrip", locationtype.c_str())]->Fill(sign * cosphi * tantheta, c_nstrips);
334  iHists_.h2_[Form("%s_thetatrk_nstrip", locationtype.c_str())]->Fill(sign * theta * cosphi, c_nstrips);
335 
336  if (saveHistosMods_) {
337  iHists_.h1_[Form("%s_%d_nstrips", locationtype.c_str(), mod)]->Fill(c_nstrips);
338  iHists_.h1_[Form("%s_%d_tanthetatrk", locationtype.c_str(), mod)]->Fill(sign * tantheta);
339  iHists_.h1_[Form("%s_%d_cosphitrk", locationtype.c_str(), mod)]->Fill(cosphi);
340  }
341 
342  // variance for width == 2
343  if (c_nstrips == 2) {
344  iHists_.h1_[Form("%s_variance_w2", locationtype.c_str())]->Fill(c_variance);
345  iHists_.h2_[Form("%s_tanthcosphtrk_var2", locationtype.c_str())]->Fill(sign * cosphi * tantheta, c_variance);
346  iHists_.h2_[Form("%s_thcosphtrk_var2", locationtype.c_str())]->Fill(sign * cosphi * theta, c_variance);
347 
348  // not in PCL
349  if (saveHistosMods_) {
350  LogDebug("SiStripLorentzAnglePCLMonitor") << iHists_.h2_ct_var2_m_[hashedIndex]->getName();
351  iHists_.h1_[Form("%s_%d_variance_w2", locationtype.c_str(), mod)]->Fill(c_variance);
352  iHists_.h2_ct_var2_m_[hashedIndex]->Fill(sign * cosphi * tantheta, c_variance);
353  iHists_.h2_t_var2_m_[hashedIndex]->Fill(sign * cosphi * theta, c_variance);
354  }
355  }
356  // variance for width == 3
357  if (c_nstrips == 3) {
358  iHists_.h1_[Form("%s_variance_w3", locationtype.c_str())]->Fill(c_variance);
359  iHists_.h2_[Form("%s_tanthcosphtrk_var3", locationtype.c_str())]->Fill(sign * cosphi * tantheta, c_variance);
360  iHists_.h2_[Form("%s_thcosphtrk_var3", locationtype.c_str())]->Fill(sign * cosphi * theta, c_variance);
361 
362  // not in PCL
363  if (saveHistosMods_) {
364  iHists_.h1_[Form("%s_%d_variance_w3", locationtype.c_str(), mod)]->Fill(c_variance);
365  iHists_.h2_ct_var3_m_[hashedIndex]->Fill(sign * cosphi * tantheta, c_variance);
366  iHists_.h2_t_var3_m_[hashedIndex]->Fill(sign * cosphi * theta, c_variance);
367  }
368  }
369 
370  // not in PCL
371  if (saveHistosMods_) {
372  iHists_.h2_ct_w_m_[hashedIndex]->Fill(sign * cosphi * tantheta, c_nstrips);
373  iHists_.h2_t_w_m_[hashedIndex]->Fill(sign * cosphi * theta, c_nstrips);
374  }
375  }
376 }
void setCluster(const SiStripCluster &cluster, int detId)
std::vector< dqm::reco::MonitorElement * > h2_ct_var3_m_
std::vector< dqm::reco::MonitorElement * > h2_t_w_m_
std::vector< dqm::reco::MonitorElement * > h2_t_var3_m_
uint32_t hashedIndex(uint32_t det_id)
std::vector< dqm::reco::MonitorElement * > h2_ct_w_m_
SiStripLorentzAngleCalibrationHistograms iHists_
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:36
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< TrajTrackAssociationCollection > m_association_token
std::map< std::string, dqm::reco::MonitorElement * > h2_
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::vector< dqm::reco::MonitorElement * > h2_t_var2_m_
Log< level::Info, false > LogInfo
std::vector< dqm::reco::MonitorElement * > h2_ct_var2_m_
std::map< std::string, dqm::reco::MonitorElement * > h1_
const edm::EDGetTokenT< edm::View< reco::Track > > m_tracks_token
HLT enums.
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
Geom::Theta< T > theta() const
#define LogDebug(id)

◆ bookHistograms()

void SiStripLorentzAnglePCLMonitor::bookHistograms ( DQMStore::IBooker ibook,
edm::Run const &  run,
edm::EventSetup const &  iSetup 
)
overrideprivatevirtual

Implements DQMEDAnalyzer.

Definition at line 378 of file SiStripLorentzAnglePCLMonitor.cc.

References SiStripLorentzAngleCalibrationHistograms::apvmode_, SiStripHashedDetId::begin(), SiStripLorentzAngleCalibrationHistograms::bfield_, dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), SiStripHashedDetId::end(), folder_, dqm-mbProfile::format, SiStripLorentzAngleCalibrationHistograms::h1_, SiStripLorentzAngleCalibrationHistograms::h2_, SiStripLorentzAngleCalibrationHistograms::h2_ct_var2_m_, SiStripLorentzAngleCalibrationHistograms::h2_ct_var3_m_, SiStripLorentzAngleCalibrationHistograms::h2_ct_w_m_, SiStripLorentzAngleCalibrationHistograms::h2_t_var2_m_, SiStripLorentzAngleCalibrationHistograms::h2_t_var3_m_, SiStripLorentzAngleCalibrationHistograms::h2_t_w_m_, SiStripLorentzAngleCalibrationHistograms::hash_, SiStripHashedDetId::hashedIndex(), iHists_, MainPageGenerator::l, hgcalTBTopologyTester_cfi::layers, LogDebug, mod(), SiStripLorentzAngleCalibrationHistograms::modtypes_, SiStripLorentzAngleCalibrationHistograms::moduleLocationType_, EcalCalibMonitorClient_cfi::moduleName, SiStripLorentzAngleCalibrationHistograms::nlayers_, saveHistosMods_, dqm::implementation::NavigatorBase::setCurrentFolder(), SiStripHashedDetId::size(), AlCaHLTBitMon_QueryRunRegistry::string, submitPVValidationJobs::t, and SiStripCondTypes::titles.

380  {
381  std::string bvalue = (iHists_.bfield_ == "3.8") ? "B-ON" : "B-OFF";
382  std::string folderToBook = fmt::format("{}/{}_{}", folder_, bvalue, iHists_.apvmode_);
383 
384  ibook.setCurrentFolder(folderToBook);
385  edm::LogPrint(moduleDescription().moduleName()) << "booking in " << folderToBook;
386 
387  // prepare track histograms
388  // clang-format off
389  iHists_.h1_["track_pt"] = ibook.book1D("track_pt", "track p_{T};track p_{T} [GeV];n. tracks", 2000, 0, 1000);
390  iHists_.h1_["track_eta"] = ibook.book1D("track_eta", "track #eta;track #eta;n. tracks", 100, -4, 4);
391  iHists_.h1_["track_phi"] = ibook.book1D("track_phi", "track #phi;track #phi;n. tracks", 80, -3.2, 3.2);
392  iHists_.h1_["track_validhits"] =
393  ibook.book1D("track_validhits", "track n. valid hits;track n. valid hits;n. tracks", 50, 0, 50);
394  iHists_.h1_["track_chi2ndof"] =
395  ibook.book1D("track_chi2ndof", "track #chi^{2}/ndf;track #chi^{2}/ndf;n. tracks", 100, 0, 5);
396  iHists_.h2_["track_chi2xhits"] =
397  ibook.book2D("track_chi2xhits_2d",
398  "track track n. hits vs track #chi^{2}/ndf;track #chi^{2};track n. valid hits;tracks",
399  100, 0, 5, 50, 0, 50);
400  iHists_.h2_["track_ptxhits"] = ibook.book2D(
401  "track_ptxhits_2d", "track n. hits vs p_{T};track p_{T} [GeV];track n. valid hits;tracks", 200, 0, 100, 50, 0, 50);
402  iHists_.h2_["track_etaxhits"] = ibook.book2D(
403  "track_etaxhits_2d", "track n. hits vs track #eta;track #eta;track n. valid hits;tracks", 60, -3, 3, 50, 0, 50);
404  iHists_.h2_["track_ptxchi2"] =
405  ibook.book2D("track_ptxchi2_2d",
406  "track #chi^{2}/ndf vs track p_{T};track p_{T} [GeV]; track #chi^{2}/ndf;tracks",
407  200, 0, 100, 100, 0, 5);
408  iHists_.h2_["track_ptxeta"] = ibook.book2D(
409  "track_ptxeta_2d", "track #eta vs track p_{T};track p_{T} [GeV];track #eta;tracks", 200, 0, 100, 60, -3, 3);
410  iHists_.h2_["track_etaxchi2"] = ibook.book2D(
411  "track_etaxchi2_2d", "track #chi^{2}/ndf vs track #eta;track #eta;track #chi^{2};tracks", 60, -3, 3, 100, 0, 5);
412  // clang-format on
413 
414  if (saveHistosMods_) {
415  iHists_.h1_["occupancyPerIndex"] = ibook.book1D("ClusterOccupancyPerHashedIndex",
416  "cluster occupancy;hashed index;# clusters per module",
417  iHists_.hash_.size(),
418  -0.5,
419  iHists_.hash_.size() - 0.5);
420  }
421 
422  // fill in the module types
423  iHists_.nlayers_["TIB"] = 4;
424  iHists_.nlayers_["TOB"] = 6;
425  iHists_.modtypes_.push_back("s");
426  iHists_.modtypes_.push_back("a");
427 
428  // prepare type histograms
429  for (auto& layers : iHists_.nlayers_) {
430  std::string subdet = layers.first;
431  for (int l = 1; l <= layers.second; ++l) {
432  ibook.setCurrentFolder(folderToBook + Form("/%s/L%d", subdet.c_str(), l));
433  for (auto& t : iHists_.modtypes_) {
434  // do not fill stereo where there aren't
435  if (l > 2 && t == "s")
436  continue;
437  std::string locType = Form("%s_L%d%s", subdet.c_str(), l, t.c_str());
438 
439  // clang-format off
440  const char* titles = Form("n.strips in %s;n.strips;n. clusters", locType.c_str());
441  iHists_.h1_[Form("%s_nstrips", locType.c_str())] = ibook.book1D(Form("%s_nstrips", locType.c_str()), titles, 20, 0, 20);
442 
443  titles = Form("tan(#theta_{trk}) in %s;tan(#theta_{trk});n. clusters", locType.c_str());
444  iHists_.h1_[Form("%s_tanthetatrk", locType.c_str())] = ibook.book1D(Form("%s_tanthetatrk", locType.c_str()), titles, 300, -1.5, 1.5);
445 
446  titles = Form("cos(#phi_{trk}) in %s;cos(#phi_{trk});n. clusters", locType.c_str());
447  iHists_.h1_[Form("%s_cosphitrk", locType.c_str())] = ibook.book1D(Form("%s_cosphitrk", locType.c_str()), titles, 40, -1, 1);
448 
449  titles = Form("Cluster variance (w=2) in %s;cluster variance (w=2);n. clusters", locType.c_str());
450  iHists_.h1_[Form("%s_variance_w2", locType.c_str())] = ibook.book1D(Form("%s_variance_w2", locType.c_str()), titles, 100, 0, 1);
451 
452  titles = Form("Cluster variance (w=3) in %s;cluster variance (w=3);n. clusters", locType.c_str());
453  iHists_.h1_[Form("%s_variance_w3", locType.c_str())] = ibook.book1D(Form("%s_variance_w3", locType.c_str()), titles, 100, 0, 1);
454 
455  titles = Form("n. strips in %s vs tan(#theta_{trk})cos(#phi_{trk});tan(#theta_{trk})cos(#phi_{trk});n. strips;n. clusters", locType.c_str());
456  iHists_.h2_[Form("%s_tanthcosphtrk_nstrip", locType.c_str())] = ibook.book2D(Form("%s_tanthcosphtrk_nstrip", locType.c_str()), titles, 360, -0.9, 0.9, 20, 0, 20);
457 
458  titles = Form("n. strips in %s vs #theta_{trk};#theta_{trk} [rad];n. strips;n. clusters", locType.c_str());
459  iHists_.h2_[Form("%s_thetatrk_nstrip", locType.c_str())] = ibook.book2D(Form("%s_thetatrk_nstrip", locType.c_str()), titles, 360, -0.9, 0.9, 20, 0, 20);
460 
461  titles = Form("cluster variance (w=2) in %s vs tan(#theta_{trk})cos(#phi_{trk});tan(#theta_{trk})cos(#phi_{trk});cluster variance (w=2);n. clusters", locType.c_str());
462  iHists_.h2_[Form("%s_tanthcosphtrk_var2", locType.c_str())] = ibook.book2D(Form("%s_tanthcosphtrk_var2", locType.c_str()), titles, 360, -0.9, 0.9, 50, 0, 1);
463 
464  titles = Form("cluster variance (w=3) in %s vs tan(#theta_{trk})cos(#phi_{trk});tan(#theta_{trk})cos(#phi_{trk});cluster variance (w=3);n. clusters", locType.c_str());
465  iHists_.h2_[Form("%s_tanthcosphtrk_var3", locType.c_str())] = ibook.book2D(Form("%s_tanthcosphtrk_var3", locType.c_str()), titles, 360, -0.9, 0.9, 50, 0, 1);
466 
467  titles = Form("cluster variance (w=2) in %s vs #theta_{trk}cos(#phi_{trk});#theta_{trk}cos(#phi_{trk});cluster variance (w=2);n. clusters", locType.c_str());
468  iHists_.h2_[Form("%s_thcosphtrk_var2", locType.c_str())] = ibook.book2D(Form("%s_thcosphtrk_var2", locType.c_str()), titles, 360, -0.9, 0.9, 50, 0, 1);
469 
470  titles = Form("cluster variance (w=3) in %s vs #theta_{trk}cos(#phi_{trk});#theta_{trk}cos(#phi_{trk});cluster variance (w=3);n. clusters", locType.c_str());
471  iHists_.h2_[Form("%s_thcosphtrk_var3", locType.c_str())] = ibook.book2D(Form("%s_thcosphtrk_var3", locType.c_str()), titles, 360, -0.9, 0.9, 50, 0, 1);
472  // clang-format on
473  }
474  }
475  }
476 
477  // prepare module histograms
478  if (saveHistosMods_) {
479  ibook.setCurrentFolder(folderToBook + "/modules");
480  for (const auto& [mod, locationType] : iHists_.moduleLocationType_) {
481  ibook.setCurrentFolder(folderToBook + "/modules" + Form("/%s", locationType.c_str()));
482  // histograms for each module
483  iHists_.h1_[Form("%s_%d_nstrips", locationType.c_str(), mod)] =
484  ibook.book1D(Form("%s_%d_nstrips", locationType.c_str(), mod), "", 10, 0, 10);
485  iHists_.h1_[Form("%s_%d_tanthetatrk", locationType.c_str(), mod)] =
486  ibook.book1D(Form("%s_%d_tanthetatrk", locationType.c_str(), mod), "", 40, -1., 1.);
487  iHists_.h1_[Form("%s_%d_cosphitrk", locationType.c_str(), mod)] =
488  ibook.book1D(Form("%s_%d_cosphitrk", locationType.c_str(), mod), "", 40, -1, 1);
489  iHists_.h1_[Form("%s_%d_variance_w2", locationType.c_str(), mod)] =
490  ibook.book1D(Form("%s_%d_variance_w2", locationType.c_str(), mod), "", 20, 0, 1);
491  iHists_.h1_[Form("%s_%d_variance_w3", locationType.c_str(), mod)] =
492  ibook.book1D(Form("%s_%d_variance_w3", locationType.c_str(), mod), "", 20, 0, 1);
493  }
494 
495  int counter{0};
497  for (; iter != iHists_.hash_.end(); ++iter) {
498  LogDebug("SiStripLorentzAnglePCLMonitor")
499  << "detId: " << (*iter) << " hashed index: " << iHists_.hash_.hashedIndex((*iter));
500  const auto& locationType = iHists_.moduleLocationType_[(*iter)];
501  ibook.setCurrentFolder(folderToBook + "/modules" + Form("/%s", locationType.c_str()));
502  iHists_.h2_ct_w_m_.push_back(
503  ibook.book2D(Form("ct_w_m_%s_%d", locationType.c_str(), *iter), "", 90, -0.9, 0.9, 10, 0, 10));
504  iHists_.h2_t_w_m_.push_back(
505  ibook.book2D(Form("t_w_m_%s_%d", locationType.c_str(), *iter), "", 90, -0.9, 0.9, 10, 0, 10));
506  iHists_.h2_ct_var2_m_.push_back(
507  ibook.book2D(Form("ct_var2_m_%s_%d", locationType.c_str(), *iter), "", 90, -0.9, 0.9, 20, 0, 1));
508  iHists_.h2_ct_var3_m_.push_back(
509  ibook.book2D(Form("ct_var3_m_%s_%d", locationType.c_str(), *iter), "", 90, -0.9, 0.9, 20, 0, 1));
510  iHists_.h2_t_var2_m_.push_back(
511  ibook.book2D(Form("t_var2_m_%s_%d", locationType.c_str(), *iter), "", 90, -0.9, 0.9, 20, 0, 1));
512  iHists_.h2_t_var3_m_.push_back(
513  ibook.book2D(Form("t_var3_m_%s_%d", locationType.c_str(), *iter), "", 90, -0.9, 0.9, 20, 0, 1));
514  counter++;
515  }
516  edm::LogPrint(moduleDescription().moduleName())
517  << __PRETTY_FUNCTION__ << " Booked " << counter << " module level histograms!";
518  } // if saveHistoMods
519 }
static const std::array< std::string, 5 > titles
std::vector< uint32_t >::const_iterator const_iterator
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
std::vector< dqm::reco::MonitorElement * > h2_ct_var3_m_
std::vector< dqm::reco::MonitorElement * > h2_t_w_m_
std::vector< dqm::reco::MonitorElement * > h2_t_var3_m_
uint32_t hashedIndex(uint32_t det_id)
std::vector< dqm::reco::MonitorElement * > h2_ct_w_m_
SiStripLorentzAngleCalibrationHistograms iHists_
const size_t size() const
std::map< std::string, dqm::reco::MonitorElement * > h2_
std::vector< dqm::reco::MonitorElement * > h2_t_var2_m_
Log< level::Warning, true > LogPrint
std::vector< dqm::reco::MonitorElement * > h2_ct_var2_m_
std::map< std::string, dqm::reco::MonitorElement * > h1_
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
const_iterator end() const
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
const_iterator begin() const
#define LogDebug(id)

◆ dqmBeginRun()

void SiStripLorentzAnglePCLMonitor::dqmBeginRun ( edm::Run const &  run,
edm::EventSetup const &  iSetup 
)
overrideprivatevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 127 of file SiStripLorentzAnglePCLMonitor.cc.

References SiStripLorentzAngleCalibrationHistograms::apvmode_, siStripLACalibration::apvModeAsString(), SiStripLorentzAngleCalibrationHistograms::bfield_, shallow::drift(), siStripLACalibration::fieldAsString(), edm::EventSetup::getData(), SiStripLorentzAngleCalibrationHistograms::h2_ct_var2_m_, SiStripLorentzAngleCalibrationHistograms::h2_ct_var3_m_, SiStripLorentzAngleCalibrationHistograms::h2_ct_w_m_, SiStripLorentzAngleCalibrationHistograms::h2_t_var2_m_, SiStripLorentzAngleCalibrationHistograms::h2_t_var3_m_, SiStripLorentzAngleCalibrationHistograms::h2_t_w_m_, SiStripLorentzAngleCalibrationHistograms::hash_, iHists_, SiStripLorentzAngleCalibrationHistograms::la_db_, m_latencyTokenBR, m_lorentzAngleTokenBR, m_magFieldTokenBR, m_tkGeomTokenBR, m_topoEsTokenBR, mismatchedBField_, mismatchedLatency_, moduleLocationType(), SiStripLorentzAngleCalibrationHistograms::moduleLocationType_, SiStripLorentzAngleCalibrationHistograms::orientation_, GloballyPositioned< T >::position(), saveHistosMods_, SiStripHashedDetId::size(), jetUpdater_cfi::sort, GeomDet::surface(), teslaToInverseGeV_, GeomDet::toGlobal(), GloballyPositioned< T >::toLocal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

127  {
128  const auto& tkGeom = iSetup.getData(m_tkGeomTokenBR);
129  const auto& magField = iSetup.getData(m_magFieldTokenBR);
130  const auto& lorentzAngle = iSetup.getData(m_lorentzAngleTokenBR);
131  const TrackerTopology* tTopo = &iSetup.getData(m_topoEsTokenBR);
132 
133  // fast cachecd access
134  const auto& theMagField = 1.f / (magField.inverseBzAtOriginInGeV() * teslaToInverseGeV_);
135 
136  if (iHists_.bfield_.empty()) {
138  } else {
140  mismatchedBField_ = true;
141  }
142  }
143 
144  const SiStripLatency* apvlat = &iSetup.getData(m_latencyTokenBR);
145  if (iHists_.apvmode_.empty()) {
147  } else {
149  mismatchedLatency_ = true;
150  }
151  }
152 
153  std::vector<uint32_t> c_rawid;
154  std::vector<float> c_globalZofunitlocalY, c_localB, c_BdotY, c_driftx, c_drifty, c_driftz, c_lorentzAngle;
155 
156  auto dets = tkGeom.detsTIB();
157  //dets.insert(dets.end(), tkGeom.detsTID().begin(), tkGeom.detsTID().end()); // no LA in endcaps
158  dets.insert(dets.end(), tkGeom.detsTOB().begin(), tkGeom.detsTOB().end());
159  //dets.insert(dets.end(), tkGeom.detsTEC().begin(), tkGeom.detsTEC().end()); // no LA in endcaps
160 
161  for (auto det : dets) {
162  auto detid = det->geographicalId().rawId();
163  const StripGeomDetUnit* stripDet = dynamic_cast<const StripGeomDetUnit*>(tkGeom.idToDet(det->geographicalId()));
164  if (stripDet) {
165  c_rawid.push_back(detid);
166  c_globalZofunitlocalY.push_back(stripDet->toGlobal(LocalVector(0, 1, 0)).z());
167  iHists_.orientation_[detid] = (stripDet->toGlobal(LocalVector(0, 1, 0)).z() < 0 ? -1 : 1);
168  const auto locB = magField.inTesla(stripDet->surface().position());
169  c_localB.push_back(locB.mag());
170  c_BdotY.push_back(stripDet->surface().toLocal(locB).y());
171  const auto drift = shallow::drift(stripDet, magField, lorentzAngle);
172  c_driftx.push_back(drift.x());
173  c_drifty.push_back(drift.y());
174  c_driftz.push_back(drift.z());
175  c_lorentzAngle.push_back(lorentzAngle.getLorentzAngle(detid));
176  iHists_.la_db_[detid] = lorentzAngle.getLorentzAngle(detid);
177  iHists_.moduleLocationType_[detid] = this->moduleLocationType(detid, tTopo);
178  }
179  }
180 
181  // Sorted DetId list gives max performance, anything else is worse
182  std::sort(c_rawid.begin(), c_rawid.end());
183 
184  // initialize the hash map
185  // in case it's not already initialized
186  if (iHists_.hash_.size() == 0) {
187  iHists_.hash_ = SiStripHashedDetId(c_rawid);
188  }
189 
190  //reserve the size of the vector
191  if (saveHistosMods_) {
192  iHists_.h2_ct_w_m_.reserve(c_rawid.size());
193  iHists_.h2_ct_var2_m_.reserve(c_rawid.size());
194  iHists_.h2_ct_var3_m_.reserve(c_rawid.size());
195 
196  iHists_.h2_t_w_m_.reserve(c_rawid.size());
197  iHists_.h2_t_var2_m_.reserve(c_rawid.size());
198  iHists_.h2_t_var3_m_.reserve(c_rawid.size());
199  }
200 }
const edm::ESGetToken< SiStripLorentzAngle, SiStripLorentzAngleDepRcd > m_lorentzAngleTokenBR
Local3DVector LocalVector
Definition: LocalVector.h:12
std::string moduleLocationType(const uint32_t &mod, const TrackerTopology *tTopo)
std::vector< dqm::reco::MonitorElement * > h2_ct_var3_m_
std::vector< dqm::reco::MonitorElement * > h2_t_w_m_
T z() const
Definition: PV3DBase.h:61
std::vector< dqm::reco::MonitorElement * > h2_t_var3_m_
LocalVector drift(const StripGeomDetUnit *, const MagneticField &, const SiStripLorentzAngle &)
Definition: ShallowTools.cc:36
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > m_tkGeomTokenBR
LocalPoint toLocal(const GlobalPoint &gp) const
Provides dense hash map in place of DetId.
std::vector< dqm::reco::MonitorElement * > h2_ct_w_m_
SiStripLorentzAngleCalibrationHistograms iHists_
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
const size_t size() const
const std::string fieldAsString(const float &inputField)
std::vector< dqm::reco::MonitorElement * > h2_t_var2_m_
const std::string apvModeAsString(const SiStripLatency *latency)
const edm::ESGetToken< SiStripLatency, SiStripLatencyRcd > m_latencyTokenBR
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
std::vector< dqm::reco::MonitorElement * > h2_ct_var2_m_
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
const PositionType & position() const
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > m_topoEsTokenBR
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_magFieldTokenBR

◆ fillDescriptions()

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

Definition at line 522 of file SiStripLorentzAnglePCLMonitor.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

522  {
524  desc.add<std::string>("folder", "AlCaReco/SiStripLorentzAngle")->setComment("DQM folder to write into");
525  desc.add<bool>("saveHistoMods", false)->setComment("save module level hisotgrams. Warning! takes a lot of space!");
526  desc.add<edm::InputTag>("Tracks", edm::InputTag("SiStripCalCosmics"))->setComment("input track collection");
527  descriptions.addWithDefaultLabel(desc);
528 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ moduleLocationType()

std::string SiStripLorentzAnglePCLMonitor::moduleLocationType ( const uint32_t &  mod,
const TrackerTopology tTopo 
)
private

Definition at line 202 of file SiStripLorentzAnglePCLMonitor.cc.

References nano_mu_digi_cff::layer, TrackerTopology::layer(), mod(), SiStripDetId::stereo(), AlCaHLTBitMon_QueryRunRegistry::string, SiStripDetId::subDetector(), SiStripDetId::TIB, and SiStripDetId::TOB.

Referenced by dqmBeginRun().

202  {
203  const SiStripDetId detid(mod);
204  std::string subdet = "";
205  unsigned int layer = 0;
206  if (detid.subDetector() == SiStripDetId::TIB) {
207  subdet = "TIB";
208  layer = tTopo->layer(mod);
209  }
210 
211  if (detid.subDetector() == SiStripDetId::TOB) {
212  subdet = "TOB";
213  layer = tTopo->layer(mod);
214  }
215 
216  std::string type = (detid.stereo() ? "s" : "a");
217  std::string d_l_t = Form("%s_L%d%s", subdet.c_str(), layer, type.c_str());
218 
219  if (layer == 0)
220  return subdet;
221  return d_l_t;
222 }
unsigned int layer(const DetId &id) const
static constexpr auto TOB
Definition: SiStripDetId.h:39
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
static constexpr auto TIB
Definition: SiStripDetId.h:37
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4

Member Data Documentation

◆ folder_

const std::string SiStripLorentzAnglePCLMonitor::folder_
private

Definition at line 82 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by bookHistograms().

◆ iHists_

SiStripLorentzAngleCalibrationHistograms SiStripLorentzAnglePCLMonitor::iHists_
private

Definition at line 75 of file SiStripLorentzAnglePCLMonitor.cc.

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

◆ m_association_token

const edm::EDGetTokenT<TrajTrackAssociationCollection> SiStripLorentzAnglePCLMonitor::m_association_token
private

Definition at line 85 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by analyze().

◆ m_clusterInfo

SiStripClusterInfo SiStripLorentzAnglePCLMonitor::m_clusterInfo
private

Definition at line 74 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by analyze().

◆ m_latencyTokenBR

const edm::ESGetToken<SiStripLatency, SiStripLatencyRcd> SiStripLorentzAnglePCLMonitor::m_latencyTokenBR
private

Definition at line 88 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by dqmBeginRun().

◆ m_lorentzAngleTokenBR

const edm::ESGetToken<SiStripLorentzAngle, SiStripLorentzAngleDepRcd> SiStripLorentzAnglePCLMonitor::m_lorentzAngleTokenBR
private

Definition at line 92 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by dqmBeginRun().

◆ m_magFieldTokenBR

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> SiStripLorentzAnglePCLMonitor::m_magFieldTokenBR
private

Definition at line 91 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by dqmBeginRun().

◆ m_tkGeomToken

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiStripLorentzAnglePCLMonitor::m_tkGeomToken
private

Definition at line 86 of file SiStripLorentzAnglePCLMonitor.cc.

◆ m_tkGeomTokenBR

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiStripLorentzAnglePCLMonitor::m_tkGeomTokenBR
private

Definition at line 90 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by dqmBeginRun().

◆ m_topoEsTokenBR

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SiStripLorentzAnglePCLMonitor::m_topoEsTokenBR
private

Definition at line 89 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by dqmBeginRun().

◆ m_tracks_token

const edm::EDGetTokenT<edm::View<reco::Track> > SiStripLorentzAnglePCLMonitor::m_tracks_token
private

Definition at line 84 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by analyze().

◆ mismatchedBField_

bool SiStripLorentzAnglePCLMonitor::mismatchedBField_
private

Definition at line 80 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by analyze(), and dqmBeginRun().

◆ mismatchedLatency_

bool SiStripLorentzAnglePCLMonitor::mismatchedLatency_
private

Definition at line 81 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by analyze(), and dqmBeginRun().

◆ saveHistosMods_

const bool SiStripLorentzAnglePCLMonitor::saveHistosMods_
private

Definition at line 83 of file SiStripLorentzAnglePCLMonitor.cc.

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

◆ teslaToInverseGeV_

constexpr float SiStripLorentzAnglePCLMonitor::teslaToInverseGeV_ = 2.99792458e-3f
staticprivate

Definition at line 78 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by dqmBeginRun().