21 #include <fmt/format.h> 22 #include <fmt/printf.h> 113 : m_clusterInfo(consumesCollector()),
114 mismatchedBField_{
false},
115 mismatchedLatency_{
false},
117 saveHistosMods_(iConfig.getParameter<
bool>(
"saveHistoMods")),
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>()} {}
137 const auto& theMagField = 1.f / (magField.inverseBzAtOriginInGeV() *
teslaToInverseGeV_);
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;
159 auto dets = tkGeom.detsTIB();
161 dets.insert(dets.end(), tkGeom.detsTOB().begin(), tkGeom.detsTOB().end());
164 for (
auto det : dets) {
165 auto detid = det->geographicalId().rawId();
168 c_rawid.push_back(detid);
172 c_localB.push_back(locB.mag());
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));
185 std::sort(c_rawid.begin(), c_rawid.end());
203 unsigned int layer = 0;
240 std::vector<OnTrackCluster>
clusters{};
243 for (
const auto&
assoc : *trajTrackAssociations) {
244 const auto traj =
assoc.key.get();
260 <<
" track pT()" <<
track->pt() <<
" track eta()" <<
track->eta() << std::endl;
262 for (
const auto& meas : traj->measurements()) {
263 const auto& trajState = meas.updatedState();
264 if (!trajState.isValid())
268 const auto trechit = meas.recHit()->hit();
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);
284 uint32_t c_nstrips = clus.cluster->amplitudes().size();
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();
304 const uint32_t
mod =
hit->geographicalId().rawId();
307 if (locationtype.empty())
312 TVector3 localdir(c_localdirx, c_localdiry, c_localdirz);
314 float tantheta = TMath::Tan(localdir.Theta());
315 float cosphi = TMath::Cos(localdir.Phi());
316 float theta = localdir.Theta();
318 iHists_.
h1_[Form(
"%s_nstrips", locationtype.c_str())]->
Fill(c_nstrips);
320 iHists_.
h1_[Form(
"%s_cosphitrk", locationtype.c_str())]->
Fill(cosphi);
323 iHists_.
h2_[Form(
"%s_tanthcosphtrk_nstrip", locationtype.c_str())]->
Fill(
sign * cosphi * tantheta, c_nstrips);
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);
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);
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);
373 ibook.
book1D(
"track_validhits",
"track n. valid hits;track n. valid hits;n. tracks", 50, 0, 50);
375 ibook.
book1D(
"track_chi2ndof",
"track #chi^{2}/ndf;track #chi^{2}/ndf;n. tracks", 100, 0, 5);
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);
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);
383 "track_etaxhits_2d",
"track n. hits vs track #eta;track #eta;track n. valid hits;tracks", 60, -3, 3, 50, 0, 50);
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);
389 "track_ptxeta_2d",
"track #eta vs track p_{T};track p_{T} [GeV];track #eta;tracks", 200, 0, 100, 60, -3, 3);
391 "track_etaxchi2_2d",
"track #chi^{2}/ndf vs track #eta;track #eta;track #chi^{2};tracks", 60, -3, 3, 100, 0, 5);
403 for (
int l = 1;
l <=
layers.second; ++
l) {
407 if (
l > 2 &&
t ==
"s")
409 std::string locType = Form(
"%s_L%d%s", subdet.c_str(),
l,
t.c_str());
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
471 ibook.
book2D(Form(
"ct_w_m_%s_%d", locationType.c_str(), *iter),
"", 90, -0.9, 0.9, 10, 0, 10));
473 ibook.
book2D(Form(
"t_w_m_%s_%d", locationType.c_str(), *iter),
"", 90, -0.9, 0.9, 10, 0, 10));
475 ibook.
book2D(Form(
"ct_var2_m_%s_%d", locationType.c_str(), *iter),
"", 90, -0.9, 0.9, 20, 0, 1));
477 ibook.
book2D(Form(
"ct_var3_m_%s_%d", locationType.c_str(), *iter),
"", 90, -0.9, 0.9, 20, 0, 1));
479 ibook.
book2D(Form(
"t_var2_m_%s_%d", locationType.c_str(), *iter),
"", 90, -0.9, 0.9, 20, 0, 1));
481 ibook.
book2D(Form(
"t_var3_m_%s_%d", locationType.c_str(), *iter),
"", 90, -0.9, 0.9, 20, 0, 1));
485 << __PRETTY_FUNCTION__ <<
" Booked " <<
counter <<
" module level histograms!";
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!");
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
static const std::array< std::string, 5 > titles
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
std::vector< std::string > modtypes_
const edm::ESGetToken< SiStripLorentzAngle, SiStripLorentzAngleDepRcd > m_lorentzAngleTokenBR
Local3DVector LocalVector
std::vector< uint32_t >::const_iterator const_iterator
std::string moduleLocationType(const uint32_t &mod, const TrackerTopology *tTopo)
void setCluster(const SiStripCluster &cluster, int detId)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual void setCurrentFolder(std::string const &fullpath)
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_
LocalVector drift(const StripGeomDetUnit *, const MagneticField &, const SiStripLorentzAngle &)
std::map< std::string, int > nlayers_
SubDetector subDetector() const
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > m_tkGeomTokenBR
const TrajectoryMeasurement & measurement
const bool saveHistosMods_
SiStripHashedDetId m_hash
LocalPoint toLocal(const GlobalPoint &gp) const
uint32_t hashedIndex(uint32_t det_id)
unsigned int layer(const DetId &id) const
Provides dense hash map in place of DetId.
std::vector< dqm::reco::MonitorElement * > h2_ct_w_m_
SiStripLorentzAngleCalibrationHistograms iHists_
int hashedIndex(int ieta, int iphi)
const edm::EDGetTokenT< TrajTrackAssociationCollection > m_association_token
std::map< std::string, dqm::reco::MonitorElement * > h2_
std::map< uint32_t, std::string > moduleLocationType_
const reco::Track * track
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > m_tkGeomToken
SiStripClusterInfo m_clusterInfo
const std::string fieldAsString(const float &inputField)
std::vector< dqm::reco::MonitorElement * > h2_t_var2_m_
OnTrackCluster(uint32_t detId, const SiStripCluster *stripCluster, const Trajectory *trajectory, const reco::Track *track_, const TrajectoryMeasurement &measurement_)
#define DEFINE_FWK_MODULE(type)
SiStripLorentzAnglePCLMonitor(const edm::ParameterSet &)
const SiStripCluster * cluster
const std::string apvModeAsString(const SiStripLatency *latency)
const edm::ESGetToken< SiStripLatency, SiStripLatencyRcd > m_latencyTokenBR
static constexpr auto TOB
Log< level::Warning, true > LogPrint
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Log< level::Info, false > LogInfo
Detector identifier class for the strip tracker.
std::vector< dqm::reco::MonitorElement * > h2_ct_var2_m_
std::map< uint32_t, int > orientation_
std::map< std::string, dqm::reco::MonitorElement * > h1_
void analyze(const edm::Event &, const edm::EventSetup &) override
const Plane & surface() const
The nominal surface of the GeomDet.
const PositionType & position() const
std::map< uint32_t, float > la_db_
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
static constexpr auto TIB
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > m_topoEsTokenBR
const edm::EDGetTokenT< edm::View< reco::Track > > m_tracks_token
~SiStripLorentzAnglePCLMonitor() override=default
static constexpr float teslaToInverseGeV_
const_iterator end() const
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
const std::string folder_
T mod(const T &a, const T &b)
Geom::Theta< T > theta() const
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_magFieldTokenBR
const_iterator begin() const