CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CSCStubEfficiencyValidation Class Reference

#include <CSCStubEfficiencyValidation.h>

Inheritance diagram for CSCStubEfficiencyValidation:
CSCBaseValidation

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &)
 
 CSCStubEfficiencyValidation (const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
 
 ~CSCStubEfficiencyValidation () override
 
- Public Member Functions inherited from CSCBaseValidation
 CSCBaseValidation (const edm::ParameterSet &ps)
 
void setGeometry (const CSCGeometry *geom)
 
void setSimHitMap (const PSimHitMap *simHitMap)
 
virtual ~CSCBaseValidation ()
 

Private Attributes

std::unique_ptr< CSCStubMatchercscStubMatcher_
 
MonitorElementetaALCTDenom [10]
 
MonitorElementetaALCTNum [10]
 
MonitorElementetaCLCTDenom [10]
 
MonitorElementetaCLCTNum [10]
 
MonitorElementetaLCTDenom [10]
 
MonitorElementetaLCTNum [10]
 
std::vector< double > etaMaxs_
 
std::vector< double > etaMins_
 
edm::EDGetTokenT< edm::SimTrackContainersimTrackInput_
 
edm::EDGetTokenT< edm::SimVertexContainersimVertexInput_
 

Additional Inherited Members

- Public Types inherited from CSCBaseValidation
typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Protected Member Functions inherited from CSCBaseValidation
const CSCLayerfindLayer (int detId) const
 
bool isSimTrackGood (const SimTrack &t) const
 
- Protected Attributes inherited from CSCBaseValidation
bool doSim_
 
double simTrackMaxEta_
 
double simTrackMinEta_
 
double simTrackMinPt_
 
const CSCGeometrytheCSCGeometry
 
const PSimHitMaptheSimHitMap
 

Detailed Description

Definition at line 10 of file CSCStubEfficiencyValidation.h.

Constructor & Destructor Documentation

◆ CSCStubEfficiencyValidation()

CSCStubEfficiencyValidation::CSCStubEfficiencyValidation ( const edm::ParameterSet pset,
edm::ConsumesCollector &&  iC 
)

Definition at line 6 of file CSCStubEfficiencyValidation.cc.

References cscStubMatcher_, etaMaxs_, etaMins_, eostools::move(), muonDTDigis_cfi::pset, cscDigiValidation_cfi::simTrack, simTrackInput_, ecalDetailedTimeRecHit_cfi::simVertex, and simVertexInput_.

8  const auto& simVertex = pset.getParameter<edm::ParameterSet>("simVertex");
10  const auto& simTrack = pset.getParameter<edm::ParameterSet>("simTrack");
11  simTrackInput_ = iC.consumes<edm::SimTrackContainer>(simTrack.getParameter<edm::InputTag>("inputTag"));
12 
13  // Initialize stub matcher
14  cscStubMatcher_ = std::make_unique<CSCStubMatcher>(pset, std::move(iC));
15 
16  // get the eta ranges
17  etaMins_ = pset.getParameter<std::vector<double>>("etaMins");
18  etaMaxs_ = pset.getParameter<std::vector<double>>("etaMaxs");
19 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::SimTrackContainer > simTrackInput_
CSCBaseValidation(const edm::ParameterSet &ps)
std::vector< SimVertex > SimVertexContainer
edm::EDGetTokenT< edm::SimVertexContainer > simVertexInput_
std::unique_ptr< CSCStubMatcher > cscStubMatcher_
std::vector< SimTrack > SimTrackContainer
def move(src, dest)
Definition: eostools.py:511

◆ ~CSCStubEfficiencyValidation()

CSCStubEfficiencyValidation::~CSCStubEfficiencyValidation ( )
override

Definition at line 21 of file CSCStubEfficiencyValidation.cc.

21 {}

Member Function Documentation

◆ analyze()

void CSCStubEfficiencyValidation::analyze ( const edm::Event e,
const edm::EventSetup eventSetup 
)
overridevirtual

Implements CSCBaseValidation.

Definition at line 55 of file CSCStubEfficiencyValidation.cc.

References cscStubMatcher_, MillePedeFileConverter_cfg::e, etaALCTDenom, etaALCTNum, etaCLCTDenom, etaCLCTNum, etaLCTDenom, etaLCTNum, options_cfi::eventSetup, dqm::impl::MonitorElement::Fill(), mps_fire::i, CSCDetId::iChamberType(), CSCBaseValidation::isSimTrackGood(), edm::Handle< T >::product(), simTrackInput_, simVertexInput_, and submitPVValidationJobs::t.

55  {
56  // Define handles
59 
60  // Use token to retreive event information
61  e.getByToken(simTrackInput_, sim_tracks);
62  e.getByToken(simVertexInput_, sim_vertices);
63 
64  // Initialize StubMatcher
66 
67  const edm::SimTrackContainer& sim_track = *sim_tracks.product();
68  const edm::SimVertexContainer& sim_vert = *sim_vertices.product();
69 
70  // select simtracks for true muons
71  edm::SimTrackContainer sim_track_selected;
72  for (const auto& t : sim_track) {
73  if (!isSimTrackGood(t))
74  continue;
75  sim_track_selected.push_back(t);
76  }
77 
78  // Skip events with no selected simtracks
79  if (sim_track_selected.empty())
80  return;
81 
82  // Loop through good tracks, use corresponding vetrex to match stubs, then fill hists of chambers where the stub appears.
83  for (const auto& t : sim_track_selected) {
84  std::vector<bool> hitALCT(10);
85  std::vector<bool> hitCLCT(10);
86  std::vector<bool> hitLCT(10);
87 
88  // Match track to stubs with appropriate vertex
89  cscStubMatcher_->match(t, sim_vert[t.vertIndex()]);
90 
91  // Store matched stubs.
92  // Key: ChamberID, Value : CSCStubDigiContainer
93  const auto& alcts = cscStubMatcher_->alcts();
94  const auto& clcts = cscStubMatcher_->clcts();
95  const auto& lcts = cscStubMatcher_->lcts();
96 
97  // denominator histograms
98  for (int i = 0; i < 10; ++i) {
99  etaALCTDenom[i]->Fill(t.momentum().eta());
100  etaCLCTDenom[i]->Fill(t.momentum().eta());
101  etaLCTDenom[i]->Fill(t.momentum().eta());
102  }
103 
104  for (auto& [id, container] : alcts) {
105  const CSCDetId cscId(id);
106  const unsigned chamberType(cscId.iChamberType());
107  hitALCT[chamberType - 1] = true;
108  }
109 
110  for (auto& [id, container] : clcts) {
111  const CSCDetId cscId(id);
112  const unsigned chamberType(cscId.iChamberType());
113  hitCLCT[chamberType - 1] = true;
114  }
115 
116  for (auto& [id, container] : lcts) {
117  const CSCDetId cscId(id);
118  const unsigned chamberType(cscId.iChamberType());
119  hitLCT[chamberType - 1] = true;
120  }
121 
122  // numerator histograms
123  for (int i = 0; i < 10; ++i) {
124  if (hitALCT[i])
125  etaALCTNum[i]->Fill(t.momentum().eta());
126  if (hitCLCT[i])
127  etaCLCTNum[i]->Fill(t.momentum().eta());
128  if (hitLCT[i])
129  etaLCTNum[i]->Fill(t.momentum().eta());
130  }
131  }
132 }
T const * product() const
Definition: Handle.h:70
edm::EDGetTokenT< edm::SimTrackContainer > simTrackInput_
void Fill(long long x)
bool isSimTrackGood(const SimTrack &t) const
std::vector< SimVertex > SimVertexContainer
edm::EDGetTokenT< edm::SimVertexContainer > simVertexInput_
std::unique_ptr< CSCStubMatcher > cscStubMatcher_
std::vector< SimTrack > SimTrackContainer

◆ bookHistograms()

void CSCStubEfficiencyValidation::bookHistograms ( DQMStore::IBooker iBooker)

Definition at line 23 of file CSCStubEfficiencyValidation.cc.

References dqm::implementation::IBooker::book1D(), CSCDetId::chamberName(), etaALCTDenom, etaALCTNum, etaCLCTDenom, etaCLCTNum, etaLCTDenom, etaLCTNum, etaMaxs_, etaMins_, dqm::legacy::MonitorElement::getTH1(), mps_fire::i, dqmiolumiharvest::j, dqm::implementation::NavigatorBase::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, RandomServiceHelper::t1, RandomServiceHelper::t2, and RandomServiceHelper::t3.

23  {
24  for (int i = 1; i <= 10; ++i) {
25  int j = i - 1;
27 
28  std::string t1 = "ALCTEtaDenom_" + cn;
29  std::string t2 = "CLCTEtaDenom_" + cn;
30  std::string t3 = "LCTEtaDenom_" + cn;
31 
32  iBooker.setCurrentFolder("MuonCSCDigisV/CSCDigiTask/ALCT/Occupancy/");
33  etaALCTDenom[j] = iBooker.book1D(t1, t1 + ";True Muon |#eta|; Entries", 50, etaMins_[j], etaMaxs_[j]);
34  etaALCTDenom[j]->getTH1()->SetMinimum(0);
35  t1 = "ALCTEtaNum_" + cn;
36  etaALCTNum[j] = iBooker.book1D(t1, t1 + ";True Muon |#eta|; Entries", 50, etaMins_[j], etaMaxs_[j]);
37  etaALCTNum[j]->getTH1()->SetMinimum(0);
38 
39  iBooker.setCurrentFolder("MuonCSCDigisV/CSCDigiTask/CLCT/Occupancy/");
40  etaCLCTDenom[j] = iBooker.book1D(t2, t2 + ";True Muon |#eta|; Entries", 50, etaMins_[j], etaMaxs_[j]);
41  etaCLCTDenom[j]->getTH1()->SetMinimum(0);
42  t2 = "CLCTEtaNum_" + cn;
43  etaCLCTNum[j] = iBooker.book1D(t2, t2 + ";True Muon |#eta|; Entries", 50, etaMins_[j], etaMaxs_[j]);
44  etaCLCTNum[j]->getTH1()->SetMinimum(0);
45 
46  iBooker.setCurrentFolder("MuonCSCDigisV/CSCDigiTask/LCT/Occupancy/");
47  etaLCTDenom[j] = iBooker.book1D(t3, t3 + ";True Muon |#eta|; Entries", 50, etaMins_[j], etaMaxs_[j]);
48  etaLCTDenom[j]->getTH1()->SetMinimum(0);
49  t3 = "LCTEtaNum_" + cn;
50  etaLCTNum[j] = iBooker.book1D(t3, t3 + ";True Muon |#eta|; Entries", 50, etaMins_[j], etaMaxs_[j]);
51  etaLCTNum[j]->getTH1()->SetMinimum(0);
52  }
53 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
std::string chamberName() const
Definition: CSCDetId.cc:92
virtual TH1 * getTH1() 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

Member Data Documentation

◆ cscStubMatcher_

std::unique_ptr<CSCStubMatcher> CSCStubEfficiencyValidation::cscStubMatcher_
private

Definition at line 19 of file CSCStubEfficiencyValidation.h.

Referenced by analyze(), and CSCStubEfficiencyValidation().

◆ etaALCTDenom

MonitorElement* CSCStubEfficiencyValidation::etaALCTDenom[10]
private

Definition at line 23 of file CSCStubEfficiencyValidation.h.

Referenced by analyze(), and bookHistograms().

◆ etaALCTNum

MonitorElement* CSCStubEfficiencyValidation::etaALCTNum[10]
private

Definition at line 22 of file CSCStubEfficiencyValidation.h.

Referenced by analyze(), and bookHistograms().

◆ etaCLCTDenom

MonitorElement* CSCStubEfficiencyValidation::etaCLCTDenom[10]
private

Definition at line 25 of file CSCStubEfficiencyValidation.h.

Referenced by analyze(), and bookHistograms().

◆ etaCLCTNum

MonitorElement* CSCStubEfficiencyValidation::etaCLCTNum[10]
private

Definition at line 24 of file CSCStubEfficiencyValidation.h.

Referenced by analyze(), and bookHistograms().

◆ etaLCTDenom

MonitorElement* CSCStubEfficiencyValidation::etaLCTDenom[10]
private

Definition at line 27 of file CSCStubEfficiencyValidation.h.

Referenced by analyze(), and bookHistograms().

◆ etaLCTNum

MonitorElement* CSCStubEfficiencyValidation::etaLCTNum[10]
private

Definition at line 26 of file CSCStubEfficiencyValidation.h.

Referenced by analyze(), and bookHistograms().

◆ etaMaxs_

std::vector<double> CSCStubEfficiencyValidation::etaMaxs_
private

Definition at line 33 of file CSCStubEfficiencyValidation.h.

Referenced by bookHistograms(), and CSCStubEfficiencyValidation().

◆ etaMins_

std::vector<double> CSCStubEfficiencyValidation::etaMins_
private

Definition at line 32 of file CSCStubEfficiencyValidation.h.

Referenced by bookHistograms(), and CSCStubEfficiencyValidation().

◆ simTrackInput_

edm::EDGetTokenT<edm::SimTrackContainer> CSCStubEfficiencyValidation::simTrackInput_
private

Definition at line 30 of file CSCStubEfficiencyValidation.h.

Referenced by analyze(), and CSCStubEfficiencyValidation().

◆ simVertexInput_

edm::EDGetTokenT<edm::SimVertexContainer> CSCStubEfficiencyValidation::simVertexInput_
private

Definition at line 29 of file CSCStubEfficiencyValidation.h.

Referenced by analyze(), and CSCStubEfficiencyValidation().