CMS 3D CMS Logo

CSCStubEfficiencyValidation.cc
Go to the documentation of this file.
4 
8 
11  const auto& simVertex = pset.getParameter<edm::ParameterSet>("simVertex");
12  simVertexInput_ = iC.consumes<edm::SimVertexContainer>(simVertex.getParameter<edm::InputTag>("inputTag"));
13  const auto& simTrack = pset.getParameter<edm::ParameterSet>("simTrack");
14  simTrackInput_ = iC.consumes<edm::SimTrackContainer>(simTrack.getParameter<edm::InputTag>("inputTag"));
15  simTrackMinPt_ = simTrack.getParameter<double>("minPt");
16  simTrackMinEta_ = simTrack.getParameter<double>("minEta");
17  simTrackMaxEta_ = simTrack.getParameter<double>("maxEta");
18 
19  // all CSC TPs have the same label
20  const auto& stubConfig = pset.getParameterSet("cscALCT");
21  inputTag_ = stubConfig.getParameter<edm::InputTag>("inputTag");
25 
26  // Initialize stub matcher
28 
29  // get the eta ranges
30  etaMins_ = pset.getParameter<std::vector<double>>("etaMins");
31  etaMaxs_ = pset.getParameter<std::vector<double>>("etaMaxs");
32 }
33 
35 
37  iBooker.setCurrentFolder("MuonCSCDigisV/CSCDigiTask/Stub/Occupancy/");
38 
39  for (int i = 1; i <= 10; ++i) {
40  int j = i - 1;
42 
43  std::string t1 = "ALCTEtaDenom_" + cn;
44  std::string t2 = "CLCTEtaDenom_" + cn;
45  std::string t3 = "LCTEtaDenom_" + cn;
46 
47  etaALCTDenom[j] = iBooker.book1D(t1, t1 + ";True Muon |#eta|; Entries", 50, etaMins_[j], etaMaxs_[j]);
48  etaCLCTDenom[j] = iBooker.book1D(t2, t2 + ";True Muon |#eta|; Entries", 50, etaMins_[j], etaMaxs_[j]);
49  etaLCTDenom[j] = iBooker.book1D(t3, t3 + ";True Muon |#eta|; Entries", 50, etaMins_[j], etaMaxs_[j]);
50 
51  t1 = "ALCTEtaNum_" + cn;
52  t2 = "CLCTEtaNum_" + cn;
53  t3 = "LCTEtaNum_" + cn;
54 
55  etaALCTNum[j] = iBooker.book1D(t1, t1 + ";True Muon |#eta|; Entries", 50, etaMins_[j], etaMaxs_[j]);
56  etaCLCTNum[j] = iBooker.book1D(t2, t2 + ";True Muon |#eta|; Entries", 50, etaMins_[j], etaMaxs_[j]);
57  etaLCTNum[j] = iBooker.book1D(t3, t3 + ";True Muon |#eta|; Entries", 50, etaMins_[j], etaMaxs_[j]);
58  }
59 }
60 
62  // Define handles
68 
69  // Use token to retreive event information
70  e.getByToken(simTrackInput_, sim_tracks);
71  e.getByToken(simVertexInput_, sim_vertices);
72  e.getByToken(alcts_Token_, alcts);
73  e.getByToken(clcts_Token_, clcts);
74  e.getByToken(lcts_Token_, lcts);
75 
76  // Initialize StubMatcher
77  cscStubMatcher_->init(e, eventSetup);
78 
79  const edm::SimTrackContainer& sim_track = *sim_tracks.product();
80  const edm::SimVertexContainer& sim_vert = *sim_vertices.product();
81 
82  if (!alcts.isValid()) {
83  edm::LogError("CSCStubEfficiencyValidation") << "Cannot get ALCTs by label " << inputTag_.encode();
84  }
85  if (!clcts.isValid()) {
86  edm::LogError("CSCStubEfficiencyValidation") << "Cannot get CLCTs by label " << inputTag_.encode();
87  }
88  if (!lcts.isValid()) {
89  edm::LogError("CSCStubEfficiencyValidation") << "Cannot get LCTs by label " << inputTag_.encode();
90  }
91 
92  // select simtracks for true muons
93  edm::SimTrackContainer sim_track_selected;
94  for (const auto& t : sim_track) {
95  if (!isSimTrackGood(t))
96  continue;
97  sim_track_selected.push_back(t);
98  }
99 
100  // Skip events with no selected simtracks
101  if (sim_track_selected.empty())
102  return;
103 
104  // Loop through good tracks, use corresponding vetrex to match stubs, then fill hists of chambers where the stub appears.
105  for (const auto& t : sim_track_selected) {
106  std::vector<bool> hitALCT(10);
107  std::vector<bool> hitCLCT(10);
108  std::vector<bool> hitLCT(10);
109 
110  // Match track to stubs with appropriate vertex
111  cscStubMatcher_->match(t, sim_vert[t.vertIndex()]);
112 
113  // Store matched stubs.
114  // Key: ChamberID, Value : CSCStubDigiContainer
115  const auto& alcts = cscStubMatcher_->alcts();
116  const auto& clcts = cscStubMatcher_->clcts();
117  const auto& lcts = cscStubMatcher_->lcts();
118 
119  // denominator histograms
120  for (int i = 0; i < 10; ++i) {
121  etaALCTDenom[i]->Fill(t.momentum().eta());
122  etaCLCTDenom[i]->Fill(t.momentum().eta());
123  etaLCTDenom[i]->Fill(t.momentum().eta());
124  }
125 
126  for (auto& [id, container] : alcts) {
127  const CSCDetId cscId(id);
128  const unsigned chamberType(cscId.iChamberType());
129  hitALCT[chamberType - 1] = true;
130  }
131 
132  for (auto& [id, container] : clcts) {
133  const CSCDetId cscId(id);
134  const unsigned chamberType(cscId.iChamberType());
135  hitCLCT[chamberType - 1] = true;
136  }
137 
138  for (auto& [id, container] : lcts) {
139  const CSCDetId cscId(id);
140  const unsigned chamberType(cscId.iChamberType());
141  hitLCT[chamberType - 1] = true;
142  }
143 
144  // numerator histograms
145  for (int i = 0; i < 10; ++i) {
146  if (hitALCT[i])
147  etaALCTNum[i]->Fill(t.momentum().eta());
148  if (hitCLCT[i])
149  etaCLCTNum[i]->Fill(t.momentum().eta());
150  if (hitLCT[i])
151  etaLCTNum[i]->Fill(t.momentum().eta());
152  }
153  }
154 }
155 
157  // SimTrack selection
158  if (t.noVertex())
159  return false;
160  if (t.noGenpart())
161  return false;
162  // only muons
163  if (std::abs(t.type()) != 13)
164  return false;
165  // pt selection
166  if (t.momentum().pt() < simTrackMinPt_)
167  return false;
168  // eta selection
169  const float eta(std::abs(t.momentum().eta()));
171  return false;
172  return true;
173 }
CSCStubEfficiencyValidation::etaLCTDenom
MonitorElement * etaLCTDenom[10]
Definition: CSCStubEfficiencyValidation.h:50
RandomServiceHelper.t2
t2
Definition: RandomServiceHelper.py:257
Handle.h
cscDigiValidation_cfi.simTrack
simTrack
Definition: cscDigiValidation_cfi.py:29
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
edm::Handle::product
T const * product() const
Definition: Handle.h:70
CSCStubEfficiencyValidation::simTrackMinPt_
double simTrackMinPt_
Definition: CSCStubEfficiencyValidation.h:54
CSCStubEfficiencyValidation::etaLCTNum
MonitorElement * etaLCTNum[10]
Definition: CSCStubEfficiencyValidation.h:49
CSCStubEfficiencyValidation::simTrackInput_
edm::EDGetTokenT< edm::SimTrackContainer > simTrackInput_
Definition: CSCStubEfficiencyValidation.h:53
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
CSCStubEfficiencyValidation::cscStubMatcher_
std::shared_ptr< CSCStubMatcher > cscStubMatcher_
Definition: CSCStubEfficiencyValidation.h:42
DQMStore.h
CSCStubEfficiencyValidation.h
edm::Handle< edm::SimTrackContainer >
CSCDetId::iChamberType
unsigned short iChamberType() const
Definition: CSCDetId.h:96
HLTEgPhaseIITestSequence_cff.simVertex
simVertex
Definition: HLTEgPhaseIITestSequence_cff.py:51
CSCStubEfficiencyValidation::etaCLCTDenom
MonitorElement * etaCLCTDenom[10]
Definition: CSCStubEfficiencyValidation.h:48
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
CSCStubEfficiencyValidation::bookHistograms
void bookHistograms(DQMStore::IBooker &)
Definition: CSCStubEfficiencyValidation.cc:36
CSCStubEfficiencyValidation::CSCStubEfficiencyValidation
CSCStubEfficiencyValidation(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
Definition: CSCStubEfficiencyValidation.cc:9
PVValHelper::eta
Definition: PVValidationHelpers.h:70
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
CSCLayerGeometry.h
CSCStubEfficiencyValidation::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: CSCStubEfficiencyValidation.cc:61
CSCStubEfficiencyValidation::etaMins_
std::vector< double > etaMins_
Definition: CSCStubEfficiencyValidation.h:58
CSCStubEfficiencyValidation::alcts_Token_
edm::EDGetTokenT< CSCALCTDigiCollection > alcts_Token_
Definition: CSCStubEfficiencyValidation.h:37
RandomServiceHelper.t3
t3
Definition: RandomServiceHelper.py:258
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CSCStubEfficiencyValidation::clcts_Token_
edm::EDGetTokenT< CSCCLCTDigiCollection > clcts_Token_
Definition: CSCStubEfficiencyValidation.h:38
edm::ParameterSet
Definition: ParameterSet.h:47
CSCDetId
Definition: CSCDetId.h:26
CSCStubEfficiencyValidation::etaCLCTNum
MonitorElement * etaCLCTNum[10]
Definition: CSCStubEfficiencyValidation.h:47
CSCALCTDigiCollection
edm::InputTag::encode
std::string encode() const
Definition: InputTag.cc:159
edm::EventSetup
Definition: EventSetup.h:58
CSCStubEfficiencyValidation::simVertexInput_
edm::EDGetTokenT< edm::SimVertexContainer > simVertexInput_
Definition: CSCStubEfficiencyValidation.h:52
CSCCorrelatedLCTDigiCollection
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
CSCStubEfficiencyValidation::isSimTrackGood
bool isSimTrackGood(const SimTrack &t)
Definition: CSCStubEfficiencyValidation.cc:156
CSCStubEfficiencyValidation::simTrackMinEta_
double simTrackMinEta_
Definition: CSCStubEfficiencyValidation.h:55
CSCStubEfficiencyValidation::~CSCStubEfficiencyValidation
~CSCStubEfficiencyValidation() override
Definition: CSCStubEfficiencyValidation.cc:34
CSCStubEfficiencyValidation::etaMaxs_
std::vector< double > etaMaxs_
Definition: CSCStubEfficiencyValidation.h:59
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::SimTrackContainer
std::vector< SimTrack > SimTrackContainer
Definition: SimTrackContainer.h:12
SimTrack
Definition: SimTrack.h:9
CSCCLCTDigiCollection
CSCDetId::chamberName
std::string chamberName() const
Definition: CSCDetId.cc:74
CSCStubEfficiencyValidation::simTrackMaxEta_
double simTrackMaxEta_
Definition: CSCStubEfficiencyValidation.h:56
CSCStubEfficiencyValidation::inputTag_
edm::InputTag inputTag_
Definition: CSCStubEfficiencyValidation.h:40
dqm::implementation::IBooker
Definition: DQMStore.h:43
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
CSCBaseValidation
Definition: CSCBaseValidation.h:14
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
CSCStubMatcher
Definition: CSCStubMatcher.h:22
CSCStubEfficiencyValidation::etaALCTDenom
MonitorElement * etaALCTDenom[10]
Definition: CSCStubEfficiencyValidation.h:46
edm::SimVertexContainer
std::vector< SimVertex > SimVertexContainer
Definition: SimVertexContainer.h:12
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
CSCStubEfficiencyValidation::lcts_Token_
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > lcts_Token_
Definition: CSCStubEfficiencyValidation.h:39
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
CSCGeometry.h
CSCStubEfficiencyValidation::etaALCTNum
MonitorElement * etaALCTNum[10]
Definition: CSCStubEfficiencyValidation.h:45
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37