CMS 3D CMS Logo

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

Public Member Functions

 ShortenedTrackResolution (const edm::ParameterSet &)
 
- 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
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 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 &)
 

Protected Member Functions

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

Private Attributes

const std::string folderName_
 
std::vector< MonitorElement * > histsPtAll_
 
const std::vector< std::string > hitsRemain_
 
const double maxDr_
 
const double maxTracksEta_
 
const double maxTracksPt_
 
const double minTracksEta_
 
const double minTracksPt_
 
const std::vector< edm::InputTagtracksRerecoTag_
 
const std::vector< edm::EDGetTokenT< std::vector< reco::Track > > > tracksRerecoToken_
 
const edm::InputTag tracksTag_
 
const edm::EDGetTokenT< std::vector< reco::Track > > tracksToken_
 

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 Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 19 of file ShortenedTrackResolution.cc.

Constructor & Destructor Documentation

◆ ShortenedTrackResolution()

ShortenedTrackResolution::ShortenedTrackResolution ( const edm::ParameterSet ps)

Definition at line 48 of file ShortenedTrackResolution.cc.

References makeGlobalPositionRcd_cfg::tag.

49  : folderName_(ps.getUntrackedParameter<std::string>("folderName", "TrackRefitting")),
50  hitsRemain_(ps.getUntrackedParameter<std::vector<std::string>>("hitsRemainInput")),
51  minTracksEta_(ps.getUntrackedParameter<double>("minTracksEtaInput", 0.0)),
52  maxTracksEta_(ps.getUntrackedParameter<double>("maxTracksEtaInput", 2.2)),
53  minTracksPt_(ps.getUntrackedParameter<double>("minTracksPtInput", 15.0)),
54  maxTracksPt_(ps.getUntrackedParameter<double>("maxTracksPtInput", 99999.9)),
55  maxDr_(ps.getUntrackedParameter<double>("maxDrInput", 0.01)),
56  tracksTag_(ps.getUntrackedParameter<edm::InputTag>("tracksInputTag", edm::InputTag("generalTracks", "", "DQM"))),
57  tracksRerecoTag_(ps.getUntrackedParameter<std::vector<edm::InputTag>>("tracksRerecoInputTag")),
58  tracksToken_(consumes<std::vector<reco::Track>>(tracksTag_)),
60  tracksRerecoTag_, [this](edm::InputTag const &tag) { return consumes<std::vector<reco::Track>>(tag); })) {
61  histsPtAll_.clear();
62 }
const std::vector< edm::EDGetTokenT< std::vector< reco::Track > > > tracksRerecoToken_
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
T getUntrackedParameter(std::string const &, T const &) const
const edm::EDGetTokenT< std::vector< reco::Track > > tracksToken_
const std::vector< edm::InputTag > tracksRerecoTag_
const std::vector< std::string > hitsRemain_
std::vector< MonitorElement * > histsPtAll_

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 84 of file ShortenedTrackResolution.cc.

References funct::abs(), PbPb_ZMuSkimMuonDPG_cff::deltaR, edm::InputTag::encode(), histsPtAll_, trackingPlots::hp, mps_fire::i, iEvent, maxDr_, maxTracksEta_, maxTracksPt_, minTracksEta_, minTracksPt_, unpackBuffers-CaloStage2::token, HLT_2024v11_cff::track, reco::HitPattern::TRACK_HITS, DiMuonV_cfg::tracks, tracksRerecoToken_, tracksTag_, and tracksToken_.

84  {
85  const auto &tracks = iEvent.getHandle(tracksToken_);
86 
87  if (!tracks.isValid()) {
88  edm::LogError("ShortenedTrackResolution") << "Missing input track collection " << tracksTag_.encode() << std::endl;
89  return;
90  }
91 
92  for (const auto &track : *tracks) {
93  const reco::HitPattern &hp = track.hitPattern();
94  if (int(int(hp.numberOfValidHits()) - int(hp.numberOfAllHits(reco::HitPattern::TRACK_HITS))) != 0) {
95  break;
96  }
97 
98  TLorentzVector tvec;
99  tvec.SetPtEtaPhiM(track.pt(), track.eta(), track.phi(), 0.0);
100 
101  int i = 0; // token index
102  for (const auto &token : tracksRerecoToken_) {
103  const auto &tracks_rereco = iEvent.getHandle(token);
104 
105  for (const auto &track_rereco : *tracks_rereco) {
106  TLorentzVector trerecovec;
107  trerecovec.SetPtEtaPhiM(track_rereco.pt(), track_rereco.eta(), track_rereco.phi(), 0.0);
108  double deltaR = tvec.DeltaR(trerecovec);
109 
110  if (deltaR < maxDr_) {
111  if (track_rereco.pt() >= minTracksPt_ && track_rereco.pt() <= maxTracksPt_ &&
112  std::abs(track_rereco.eta()) >= minTracksEta_ && std::abs(track_rereco.eta()) <= maxTracksEta_) {
113  histsPtAll_[i]->Fill(1.0 * track_rereco.pt() / track.pt());
114  }
115  }
116  }
117  ++i;
118  }
119  }
120 }
const std::vector< edm::EDGetTokenT< std::vector< reco::Track > > > tracksRerecoToken_
std::string encode() const
Definition: InputTag.cc:159
Log< level::Error, false > LogError
const edm::EDGetTokenT< std::vector< reco::Track > > tracksToken_
int iEvent
Definition: GenABIO.cc:224
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< MonitorElement * > histsPtAll_

◆ bookHistograms()

void ShortenedTrackResolution::bookHistograms ( DQMStore::IBooker iBook,
edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 65 of file ShortenedTrackResolution.cc.

References dqm::implementation::IBooker::book1D(), folderName_, histsPtAll_, hitsRemain_, mps_fire::i, createfilelist::int, dqm::implementation::NavigatorBase::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

67  {
68  std::string currentFolder = folderName_ + "/";
69  iBook.setCurrentFolder(currentFolder);
70 
71  for (int i = 0; i < int(hitsRemain_.size()); ++i) {
72  histsPtAll_.push_back(iBook.book1D(
73  fmt::sprintf("trackPtRatio_%s", hitsRemain_[i]).c_str(),
74  fmt::sprintf("Short Track p_{T} / Full Track p_{T} - %s layers;p_{T}^{short}/p_{T}^{full};n. tracks",
75  hitsRemain_[i])
76  .c_str(),
77  101,
78  -0.05,
79  2.05));
80  }
81 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
const std::vector< std::string > hitsRemain_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
std::vector< MonitorElement * > histsPtAll_

◆ fillDescriptions()

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

Definition at line 123 of file ShortenedTrackResolution.cc.

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

123  {
125  desc.addUntracked<std::string>("folderName", "TrackRefitting");
126  desc.addUntracked<std::vector<std::string>>("hitsRemainInput", {});
127  desc.addUntracked<double>("minTracksEtaInput", 0.0);
128  desc.addUntracked<double>("maxTracksEtaInput", 2.2);
129  desc.addUntracked<double>("minTracksPtInput", 15.0);
130  desc.addUntracked<double>("maxTracksPtInput", 99999.9);
131  desc.addUntracked<double>("maxDrInput", 0.01);
132  desc.addUntracked<edm::InputTag>("tracksInputTag", edm::InputTag("generalTracks", "", "DQM"));
133  desc.addUntracked<std::vector<edm::InputTag>>("tracksRerecoInputTag", {});
134  descriptions.addWithDefaultLabel(desc);
135 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ folderName_

const std::string ShortenedTrackResolution::folderName_
private

Definition at line 29 of file ShortenedTrackResolution.cc.

Referenced by bookHistograms().

◆ histsPtAll_

std::vector<MonitorElement *> ShortenedTrackResolution::histsPtAll_
private

Definition at line 42 of file ShortenedTrackResolution.cc.

Referenced by analyze(), and bookHistograms().

◆ hitsRemain_

const std::vector<std::string> ShortenedTrackResolution::hitsRemain_
private

Definition at line 30 of file ShortenedTrackResolution.cc.

Referenced by bookHistograms().

◆ maxDr_

const double ShortenedTrackResolution::maxDr_
private

Definition at line 36 of file ShortenedTrackResolution.cc.

Referenced by analyze().

◆ maxTracksEta_

const double ShortenedTrackResolution::maxTracksEta_
private

Definition at line 32 of file ShortenedTrackResolution.cc.

Referenced by analyze().

◆ maxTracksPt_

const double ShortenedTrackResolution::maxTracksPt_
private

Definition at line 34 of file ShortenedTrackResolution.cc.

Referenced by analyze().

◆ minTracksEta_

const double ShortenedTrackResolution::minTracksEta_
private

Definition at line 31 of file ShortenedTrackResolution.cc.

Referenced by analyze().

◆ minTracksPt_

const double ShortenedTrackResolution::minTracksPt_
private

Definition at line 33 of file ShortenedTrackResolution.cc.

Referenced by analyze().

◆ tracksRerecoTag_

const std::vector<edm::InputTag> ShortenedTrackResolution::tracksRerecoTag_
private

Definition at line 38 of file ShortenedTrackResolution.cc.

◆ tracksRerecoToken_

const std::vector<edm::EDGetTokenT<std::vector<reco::Track> > > ShortenedTrackResolution::tracksRerecoToken_
private

Definition at line 40 of file ShortenedTrackResolution.cc.

Referenced by analyze().

◆ tracksTag_

const edm::InputTag ShortenedTrackResolution::tracksTag_
private

Definition at line 37 of file ShortenedTrackResolution.cc.

Referenced by analyze().

◆ tracksToken_

const edm::EDGetTokenT<std::vector<reco::Track> > ShortenedTrackResolution::tracksToken_
private

Definition at line 39 of file ShortenedTrackResolution.cc.

Referenced by analyze().