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
 
SiStripHashedDetId m_hash
 
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 61 of file SiStripLorentzAnglePCLMonitor.cc.

Constructor & Destructor Documentation

◆ SiStripLorentzAnglePCLMonitor()

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

Definition at line 112 of file SiStripLorentzAnglePCLMonitor.cc.

113  : m_clusterInfo(consumesCollector()),
114  mismatchedBField_{false},
115  mismatchedLatency_{false},
116  folder_(iConfig.getParameter<std::string>("folder")),
117  saveHistosMods_(iConfig.getParameter<bool>("saveHistoMods")),
118  m_tracks_token(consumes<edm::View<reco::Track>>(iConfig.getParameter<edm::InputTag>("Tracks"))),
119  m_association_token(consumes<TrajTrackAssociationCollection>(iConfig.getParameter<edm::InputTag>("Tracks"))),
120  m_tkGeomToken{esConsumes<>()},
121  m_latencyTokenBR{esConsumes<edm::Transition::BeginRun>()},
122  m_topoEsTokenBR{esConsumes<edm::Transition::BeginRun>()},
123  m_tkGeomTokenBR{esConsumes<edm::Transition::BeginRun>()},
124  m_magFieldTokenBR{esConsumes<edm::Transition::BeginRun>()},
125  m_lorentzAngleTokenBR{esConsumes<edm::Transition::BeginRun>()} {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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 223 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_, ecalpyutils::hashedIndex(), SiStripHashedDetId::hashedIndex(), iEvent, iHists_, LogDebug, m_association_token, m_clusterInfo, m_hash, 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, pwdgSkimBPark_cfi::tracks, and SiStripClusterInfo::variance().

223  {
224  using namespace edm;
225 
226  // return immediately if the field is not consistent!
227  if (mismatchedBField_)
228  return;
229 
230  if (mismatchedLatency_)
231  return;
232 
234  iEvent.getByToken(m_tracks_token, tracks);
235  edm::Handle<TrajTrackAssociationCollection> trajTrackAssociations;
236  iEvent.getByToken(m_association_token, trajTrackAssociations);
237 
238  LogDebug(moduleDescription().moduleName()) << "I AM IN EVENT" << iEvent.id() << std::endl;
239 
240  std::vector<OnTrackCluster> clusters{};
241 
242  // first collect all the clusters
243  for (const auto& assoc : *trajTrackAssociations) {
244  const auto traj = assoc.key.get();
245  const auto track = assoc.val.get();
246 
247  iHists_.h1_["track_pt"]->Fill(track->pt());
248  iHists_.h1_["track_eta"]->Fill(track->eta());
249  iHists_.h1_["track_phi"]->Fill(track->phi());
250  iHists_.h1_["track_validhits"]->Fill(track->numberOfValidHits());
251  iHists_.h1_["track_chi2ndof"]->Fill((track->chi2() / track->ndof()));
252  iHists_.h2_["track_chi2xhits"]->Fill((track->chi2() / track->ndof()), track->numberOfValidHits());
253  iHists_.h2_["track_ptxhits"]->Fill(track->pt(), track->numberOfValidHits());
254  iHists_.h2_["track_etaxhits"]->Fill(track->eta(), track->numberOfValidHits());
255  iHists_.h2_["track_ptxchi2"]->Fill(track->pt(), (track->chi2() / track->ndof()));
256  iHists_.h2_["track_ptxeta"]->Fill(track->pt(), track->eta());
257  iHists_.h2_["track_etaxchi2"]->Fill(track->eta(), (track->chi2() / track->ndof()));
258 
259  edm::LogInfo("SiStripLorentzAnglePCLMonitor")
260  << " track pT()" << track->pt() << " track eta()" << track->eta() << std::endl;
261 
262  for (const auto& meas : traj->measurements()) {
263  const auto& trajState = meas.updatedState();
264  if (!trajState.isValid())
265  continue;
266 
267  // there can be 2 (stereo module), 1 (no stereo module), or 0 (no strip hit) clusters per measurement
268  const auto trechit = meas.recHit()->hit();
269  const auto simple1d = dynamic_cast<const SiStripRecHit1D*>(trechit);
270  const auto simple = dynamic_cast<const SiStripRecHit2D*>(trechit);
271  const auto matched = dynamic_cast<const SiStripMatchedRecHit2D*>(trechit);
272  if (matched) {
273  clusters.emplace_back(matched->monoId(), &matched->monoCluster(), traj, track, meas);
274  clusters.emplace_back(matched->stereoId(), &matched->stereoCluster(), traj, track, meas);
275  } else if (simple) {
276  clusters.emplace_back(simple->geographicalId().rawId(), simple->cluster().get(), traj, track, meas);
277  } else if (simple1d) {
278  clusters.emplace_back(simple1d->geographicalId().rawId(), simple1d->cluster().get(), traj, track, meas);
279  }
280  }
281  }
282 
283  for (const auto clus : clusters) {
284  uint32_t c_nstrips = clus.cluster->amplitudes().size();
285  m_clusterInfo.setCluster(*clus.cluster, clus.det);
286  float c_variance = m_clusterInfo.variance();
287  const auto& trajState = clus.measurement.updatedState();
288  const auto trackDir = trajState.localDirection();
289  float c_localdirx = trackDir.x();
290  float c_localdiry = trackDir.y();
291  float c_localdirz = trackDir.z();
292  const auto hit = clus.measurement.recHit()->hit();
293 
294  // not yet needed (might be used for Backplane correction later on
295  /*
296  const auto& tkGeom = iSetup.getData(m_tkGeomToken);
297  const auto stripDet = dynamic_cast<const StripGeomDetUnit*>(tkGeom.idToDet(hit->geographicalId()));
298  float c_barycenter = stripDet->specificTopology().localPosition(clus.cluster->barycenter()).x();
299  float c_localx = stripDet->toLocal(trajState.globalPosition()).x();
300  float c_rhlocalx = hit->localPosition().x();
301  float c_rhlocalxerr = hit->localPositionError().xx();
302  */
303 
304  const uint32_t mod = hit->geographicalId().rawId();
305 
306  std::string locationtype = iHists_.moduleLocationType_[mod];
307  if (locationtype.empty())
308  return;
309 
310  const auto& hashedIndex = m_hash.hashedIndex(mod);
311 
312  TVector3 localdir(c_localdirx, c_localdiry, c_localdirz);
313  int sign = iHists_.orientation_[mod];
314  float tantheta = TMath::Tan(localdir.Theta());
315  float cosphi = TMath::Cos(localdir.Phi());
316  float theta = localdir.Theta();
317 
318  iHists_.h1_[Form("%s_nstrips", locationtype.c_str())]->Fill(c_nstrips);
319  iHists_.h1_[Form("%s_tanthetatrk", locationtype.c_str())]->Fill(sign * tantheta);
320  iHists_.h1_[Form("%s_cosphitrk", locationtype.c_str())]->Fill(cosphi);
321 
322  // nstrips
323  iHists_.h2_[Form("%s_tanthcosphtrk_nstrip", locationtype.c_str())]->Fill(sign * cosphi * tantheta, c_nstrips);
324  iHists_.h2_[Form("%s_thetatrk_nstrip", locationtype.c_str())]->Fill(sign * theta * cosphi, c_nstrips);
325 
326  // variance for width == 2
327  if (c_nstrips == 2) {
328  iHists_.h1_[Form("%s_variance_w2", locationtype.c_str())]->Fill(c_variance);
329  iHists_.h2_[Form("%s_tanthcosphtrk_var2", locationtype.c_str())]->Fill(sign * cosphi * tantheta, c_variance);
330  iHists_.h2_[Form("%s_thcosphtrk_var2", locationtype.c_str())]->Fill(sign * cosphi * theta, c_variance);
331 
332  // not in PCL
333  if (saveHistosMods_) {
334  iHists_.h2_ct_var2_m_[hashedIndex]->Fill(sign * cosphi * tantheta, c_variance);
335  iHists_.h2_t_var2_m_[hashedIndex]->Fill(sign * cosphi * theta, c_variance);
336  }
337  }
338  // variance for width == 3
339  if (c_nstrips == 3) {
340  iHists_.h1_[Form("%s_variance_w3", locationtype.c_str())]->Fill(c_variance);
341  iHists_.h2_[Form("%s_tanthcosphtrk_var3", locationtype.c_str())]->Fill(sign * cosphi * tantheta, c_variance);
342  iHists_.h2_[Form("%s_thcosphtrk_var3", locationtype.c_str())]->Fill(sign * cosphi * theta, c_variance);
343 
344  // not in PCL
345  if (saveHistosMods_) {
346  iHists_.h2_ct_var3_m_[hashedIndex]->Fill(sign * cosphi * tantheta, c_variance);
347  iHists_.h2_t_var3_m_[hashedIndex]->Fill(sign * cosphi * theta, c_variance);
348  }
349  }
350  // not in PCL
351  if (saveHistosMods_) {
352  iHists_.h2_ct_w_m_[hashedIndex]->Fill(sign * cosphi * tantheta, c_nstrips);
353  iHists_.h2_t_w_m_[hashedIndex]->Fill(sign * cosphi * theta, c_nstrips);
354  }
355  }
356 }
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 358 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_, iHists_, MainPageGenerator::l, hgcalTBTopologyTester_cfi::layers, m_hash, mod(), SiStripLorentzAngleCalibrationHistograms::modtypes_, SiStripLorentzAngleCalibrationHistograms::moduleLocationType_, EcalCalibMonitorClient_cfi::moduleName, SiStripLorentzAngleCalibrationHistograms::nlayers_, saveHistosMods_, dqm::implementation::NavigatorBase::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, submitPVValidationJobs::t, and SiStripCondTypes::titles.

360  {
361  std::string bvalue = (iHists_.bfield_ == "3.8") ? "B-ON" : "B-OFF";
362  std::string folderToBook = fmt::format("{}/{}_{}", folder_, bvalue, iHists_.apvmode_);
363 
364  ibook.setCurrentFolder(folderToBook);
365  edm::LogPrint(moduleDescription().moduleName()) << "booking in " << folderToBook;
366 
367  // prepare track histograms
368  // clang-format off
369  iHists_.h1_["track_pt"] = ibook.book1D("track_pt", "track p_{T};track p_{T} [GeV];n. tracks", 2000, 0, 1000);
370  iHists_.h1_["track_eta"] = ibook.book1D("track_eta", "track #eta;track #eta;n. tracks", 100, -4, 4);
371  iHists_.h1_["track_phi"] = ibook.book1D("track_phi", "track #phi;track #phi;n. tracks", 80, -3.2, 3.2);
372  iHists_.h1_["track_validhits"] =
373  ibook.book1D("track_validhits", "track n. valid hits;track n. valid hits;n. tracks", 50, 0, 50);
374  iHists_.h1_["track_chi2ndof"] =
375  ibook.book1D("track_chi2ndof", "track #chi^{2}/ndf;track #chi^{2}/ndf;n. tracks", 100, 0, 5);
376  iHists_.h2_["track_chi2xhits"] =
377  ibook.book2D("track_chi2xhits_2d",
378  "track track n. hits vs track #chi^{2}/ndf;track #chi^{2};track n. valid hits;tracks",
379  100, 0, 5, 50, 0, 50);
380  iHists_.h2_["track_ptxhits"] = ibook.book2D(
381  "track_ptxhits_2d", "track n. hits vs p_{T};track p_{T} [GeV];track n. valid hits;tracks", 200, 0, 100, 50, 0, 50);
382  iHists_.h2_["track_etaxhits"] = ibook.book2D(
383  "track_etaxhits_2d", "track n. hits vs track #eta;track #eta;track n. valid hits;tracks", 60, -3, 3, 50, 0, 50);
384  iHists_.h2_["track_ptxchi2"] =
385  ibook.book2D("track_ptxchi2_2d",
386  "track #chi^{2}/ndf vs track p_{T};track p_{T} [GeV]; track #chi^{2}/ndf;tracks",
387  200, 0, 100, 100, 0, 5);
388  iHists_.h2_["track_ptxeta"] = ibook.book2D(
389  "track_ptxeta_2d", "track #eta vs track p_{T};track p_{T} [GeV];track #eta;tracks", 200, 0, 100, 60, -3, 3);
390  iHists_.h2_["track_etaxchi2"] = ibook.book2D(
391  "track_etaxchi2_2d", "track #chi^{2}/ndf vs track #eta;track #eta;track #chi^{2};tracks", 60, -3, 3, 100, 0, 5);
392  // clang-format on
393 
394  // fill in the module types
395  iHists_.nlayers_["TIB"] = 4;
396  iHists_.nlayers_["TOB"] = 6;
397  iHists_.modtypes_.push_back("s");
398  iHists_.modtypes_.push_back("a");
399 
400  // prepare type histograms
401  for (auto& layers : iHists_.nlayers_) {
402  std::string subdet = layers.first;
403  for (int l = 1; l <= layers.second; ++l) {
404  ibook.setCurrentFolder(folderToBook + Form("/%s/L%d", subdet.c_str(), l));
405  for (auto& t : iHists_.modtypes_) {
406  // do not fill stereo where there aren't
407  if (l > 2 && t == "s")
408  continue;
409  std::string locType = Form("%s_L%d%s", subdet.c_str(), l, t.c_str());
410 
411  // clang-format off
412  const char* titles = Form("n.strips in %s;n.strips;n. clusters", locType.c_str());
413  iHists_.h1_[Form("%s_nstrips", locType.c_str())] = ibook.book1D(Form("%s_nstrips", locType.c_str()), titles, 20, 0, 20);
414 
415  titles = Form("tan(#theta_{trk}) in %s;tan(#theta_{trk});n. clusters", locType.c_str());
416  iHists_.h1_[Form("%s_tanthetatrk", locType.c_str())] = ibook.book1D(Form("%s_tanthetatrk", locType.c_str()), titles, 300, -1.5, 1.5);
417 
418  titles = Form("cos(#phi_{trk}) in %s;cos(#phi_{trk});n. clusters", locType.c_str());
419  iHists_.h1_[Form("%s_cosphitrk", locType.c_str())] = ibook.book1D(Form("%s_cosphitrk", locType.c_str()), titles, 40, -1, 1);
420 
421  titles = Form("Cluster variance (w=2) in %s;cluster variance (w=2);n. clusters", locType.c_str());
422  iHists_.h1_[Form("%s_variance_w2", locType.c_str())] = ibook.book1D(Form("%s_variance_w2", locType.c_str()), titles, 100, 0, 1);
423 
424  titles = Form("Cluster variance (w=3) in %s;cluster variance (w=3);n. clusters", locType.c_str());
425  iHists_.h1_[Form("%s_variance_w3", locType.c_str())] = ibook.book1D(Form("%s_variance_w3", locType.c_str()), titles, 100, 0, 1);
426 
427  titles = Form("tan(#theta_{trk})cos(#phi_{trk}) vs n. strips in %s;n. strips;tan(#theta_{trk})cos(#phi_{trk});n. clusters", locType.c_str());
428  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);
429 
430  titles = Form("#theta_{trk} vs n. strips in %s;n. strips;#theta_{trk} [rad];n. clusters", locType.c_str());
431  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);
432 
433  titles = Form("tan(#theta_{trk})cos(#phi_{trk}) vs cluster variance (w=2) in %s;cluster variance (w=2);tan(#theta_{trk})cos(#phi_{trk});n. clusters", locType.c_str());
434  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);
435 
436  titles = Form("tan(#theta_{trk})cos(#phi_{trk}) vs cluster variance (w=3) in %s;cluster variance (w=3);tan(#theta_{trk})cos(#phi_{trk});n. clusters", locType.c_str());
437  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);
438 
439  titles = Form("#theta_{trk}cos(#phi_{trk}) vs cluster variance (w=2) in %s;cluster variance (w=2);#theta_{trk}cos(#phi_{trk});n. clusters", locType.c_str());
440  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);
441 
442  titles = Form("#theta_{trk}cos(#phi_{trk}) vs cluster variance (w=3) in %s;cluster variance (w=3);#theta_{trk}cos(#phi_{trk});n. clusters", locType.c_str());
443  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);
444  // clang-format on
445  }
446  }
447  }
448 
449  // prepare module histograms
450  if (saveHistosMods_) {
451  ibook.setCurrentFolder(folderToBook + "/modules");
452  for (const auto& [mod, locationType] : iHists_.moduleLocationType_) {
453  // histograms for each module
454  iHists_.h1_[Form("%s_%d_nstrips", locationType.c_str(), mod)] =
455  ibook.book1D(Form("%s_%d_nstrips", locationType.c_str(), mod), "", 10, 0, 10);
456  iHists_.h1_[Form("%s_%d_tanthetatrk", locationType.c_str(), mod)] =
457  ibook.book1D(Form("%s_%d_tanthetatrk", locationType.c_str(), mod), "", 40, -1., 1.);
458  iHists_.h1_[Form("%s_%d_cosphitrk", locationType.c_str(), mod)] =
459  ibook.book1D(Form("%s_%d_cosphitrk", locationType.c_str(), mod), "", 40, -1, 1);
460  iHists_.h1_[Form("%s_%d_variance_w2", locationType.c_str(), mod)] =
461  ibook.book1D(Form("%s_%d_variance_w2", locationType.c_str(), mod), "", 20, 0, 1);
462  iHists_.h1_[Form("%s_%d_variance_w3", locationType.c_str(), mod)] =
463  ibook.book1D(Form("%s_%d_variance_w3", locationType.c_str(), mod), "", 20, 0, 1);
464  }
465 
466  int counter{0};
468  for (; iter != m_hash.end(); ++iter) {
469  const auto& locationType = iHists_.moduleLocationType_[(*iter)];
470  iHists_.h2_ct_w_m_.push_back(
471  ibook.book2D(Form("ct_w_m_%s_%d", locationType.c_str(), *iter), "", 90, -0.9, 0.9, 10, 0, 10));
472  iHists_.h2_t_w_m_.push_back(
473  ibook.book2D(Form("t_w_m_%s_%d", locationType.c_str(), *iter), "", 90, -0.9, 0.9, 10, 0, 10));
474  iHists_.h2_ct_var2_m_.push_back(
475  ibook.book2D(Form("ct_var2_m_%s_%d", locationType.c_str(), *iter), "", 90, -0.9, 0.9, 20, 0, 1));
476  iHists_.h2_ct_var3_m_.push_back(
477  ibook.book2D(Form("ct_var3_m_%s_%d", locationType.c_str(), *iter), "", 90, -0.9, 0.9, 20, 0, 1));
478  iHists_.h2_t_var2_m_.push_back(
479  ibook.book2D(Form("t_var2_m_%s_%d", locationType.c_str(), *iter), "", 90, -0.9, 0.9, 20, 0, 1));
480  iHists_.h2_t_var3_m_.push_back(
481  ibook.book2D(Form("t_var3_m_%s_%d", locationType.c_str(), *iter), "", 90, -0.9, 0.9, 20, 0, 1));
482  counter++;
483  }
484  edm::LogPrint(moduleDescription().moduleName())
485  << __PRETTY_FUNCTION__ << " Booked " << counter << " module level histograms!";
486  } // if saveHistoMods
487 }
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_
std::vector< dqm::reco::MonitorElement * > h2_ct_w_m_
SiStripLorentzAngleCalibrationHistograms iHists_
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

◆ dqmBeginRun()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 130 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_, iHists_, SiStripLorentzAngleCalibrationHistograms::la_db_, m_hash, m_latencyTokenBR, m_lorentzAngleTokenBR, m_magFieldTokenBR, m_tkGeomTokenBR, m_topoEsTokenBR, mismatchedBField_, mismatchedLatency_, moduleLocationType(), SiStripLorentzAngleCalibrationHistograms::moduleLocationType_, SiStripLorentzAngleCalibrationHistograms::orientation_, GloballyPositioned< T >::position(), 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().

130  {
131  const auto& tkGeom = iSetup.getData(m_tkGeomTokenBR);
132  const auto& magField = iSetup.getData(m_magFieldTokenBR);
133  const auto& lorentzAngle = iSetup.getData(m_lorentzAngleTokenBR);
134  const TrackerTopology* tTopo = &iSetup.getData(m_topoEsTokenBR);
135 
136  // fast cachecd access
137  const auto& theMagField = 1.f / (magField.inverseBzAtOriginInGeV() * teslaToInverseGeV_);
138 
139  if (iHists_.bfield_.empty()) {
141  } else {
143  mismatchedBField_ = true;
144  }
145  }
146 
147  const SiStripLatency* apvlat = &iSetup.getData(m_latencyTokenBR);
148  if (iHists_.apvmode_.empty()) {
150  } else {
152  mismatchedLatency_ = true;
153  }
154  }
155 
156  std::vector<uint32_t> c_rawid;
157  std::vector<float> c_globalZofunitlocalY, c_localB, c_BdotY, c_driftx, c_drifty, c_driftz, c_lorentzAngle;
158 
159  auto dets = tkGeom.detsTIB();
160  //dets.insert(dets.end(), tkGeom.detsTID().begin(), tkGeom.detsTID().end()); // no LA in endcaps
161  dets.insert(dets.end(), tkGeom.detsTOB().begin(), tkGeom.detsTOB().end());
162  //dets.insert(dets.end(), tkGeom.detsTEC().begin(), tkGeom.detsTEC().end()); // no LA in endcaps
163 
164  for (auto det : dets) {
165  auto detid = det->geographicalId().rawId();
166  const StripGeomDetUnit* stripDet = dynamic_cast<const StripGeomDetUnit*>(tkGeom.idToDet(det->geographicalId()));
167  if (stripDet) {
168  c_rawid.push_back(detid);
169  c_globalZofunitlocalY.push_back(stripDet->toGlobal(LocalVector(0, 1, 0)).z());
170  iHists_.orientation_[detid] = (stripDet->toGlobal(LocalVector(0, 1, 0)).z() < 0 ? -1 : 1);
171  const auto locB = magField.inTesla(stripDet->surface().position());
172  c_localB.push_back(locB.mag());
173  c_BdotY.push_back(stripDet->surface().toLocal(locB).y());
174  const auto drift = shallow::drift(stripDet, magField, lorentzAngle);
175  c_driftx.push_back(drift.x());
176  c_drifty.push_back(drift.y());
177  c_driftz.push_back(drift.z());
178  c_lorentzAngle.push_back(lorentzAngle.getLorentzAngle(detid));
179  iHists_.la_db_[detid] = lorentzAngle.getLorentzAngle(detid);
180  iHists_.moduleLocationType_[detid] = this->moduleLocationType(detid, tTopo);
181  }
182  }
183 
184  // Sorted DetId list gives max performance, anything else is worse
185  std::sort(c_rawid.begin(), c_rawid.end());
186 
187  // initialized the hash map
188  m_hash = SiStripHashedDetId(c_rawid);
189 
190  //reserve the size of the vector
191  iHists_.h2_ct_w_m_.reserve(c_rawid.size());
192  iHists_.h2_ct_var2_m_.reserve(c_rawid.size());
193  iHists_.h2_ct_var3_m_.reserve(c_rawid.size());
194 
195  iHists_.h2_t_w_m_.reserve(c_rawid.size());
196  iHists_.h2_t_var2_m_.reserve(c_rawid.size());
197  iHists_.h2_t_var3_m_.reserve(c_rawid.size());
198 }
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 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 490 of file SiStripLorentzAnglePCLMonitor.cc.

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

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

◆ moduleLocationType()

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

Definition at line 200 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().

200  {
201  const SiStripDetId detid(mod);
202  std::string subdet = "";
203  unsigned int layer = 0;
204  if (detid.subDetector() == SiStripDetId::TIB) {
205  subdet = "TIB";
206  layer = tTopo->layer(mod);
207  }
208 
209  if (detid.subDetector() == SiStripDetId::TOB) {
210  subdet = "TOB";
211  layer = tTopo->layer(mod);
212  }
213 
214  std::string type = (detid.stereo() ? "s" : "a");
215  std::string d_l_t = Form("%s_L%d%s", subdet.c_str(), layer, type.c_str());
216 
217  if (layer == 0)
218  return subdet;
219  return d_l_t;
220 }
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 85 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by bookHistograms().

◆ iHists_

SiStripLorentzAngleCalibrationHistograms SiStripLorentzAnglePCLMonitor::iHists_
private

Definition at line 77 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 88 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by analyze().

◆ m_clusterInfo

SiStripClusterInfo SiStripLorentzAnglePCLMonitor::m_clusterInfo
private

Definition at line 76 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by analyze().

◆ m_hash

SiStripHashedDetId SiStripLorentzAnglePCLMonitor::m_hash
private

Definition at line 78 of file SiStripLorentzAnglePCLMonitor.cc.

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

◆ m_latencyTokenBR

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

Definition at line 91 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by dqmBeginRun().

◆ m_lorentzAngleTokenBR

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

Definition at line 95 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by dqmBeginRun().

◆ m_magFieldTokenBR

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

Definition at line 94 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by dqmBeginRun().

◆ m_tkGeomToken

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

Definition at line 89 of file SiStripLorentzAnglePCLMonitor.cc.

◆ m_tkGeomTokenBR

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

Definition at line 93 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by dqmBeginRun().

◆ m_topoEsTokenBR

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

Definition at line 92 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 87 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by analyze().

◆ mismatchedBField_

bool SiStripLorentzAnglePCLMonitor::mismatchedBField_
private

Definition at line 83 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by analyze(), and dqmBeginRun().

◆ mismatchedLatency_

bool SiStripLorentzAnglePCLMonitor::mismatchedLatency_
private

Definition at line 84 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by analyze(), and dqmBeginRun().

◆ saveHistosMods_

const bool SiStripLorentzAnglePCLMonitor::saveHistosMods_
private

Definition at line 86 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by analyze(), and bookHistograms().

◆ teslaToInverseGeV_

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

Definition at line 81 of file SiStripLorentzAnglePCLMonitor.cc.

Referenced by dqmBeginRun().