CMS 3D CMS Logo

MtdGlobalRecoValidation.cc
Go to the documentation of this file.
1 #include <string>
2 
7 
10 
15 
21 
29 
36 
38 public:
40  ~MtdGlobalRecoValidation() override;
41 
42  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
43 
44 private:
45  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
46 
47  void analyze(const edm::Event&, const edm::EventSetup&) override;
48 
49  // ------------ member data ------------
50 
52  const float trackMinEnergy_;
53  const float trackMinEta_;
54  const float trackMaxEta_;
55 
58 
66 
75 
77 
81 };
82 
83 // ------------ constructor and destructor --------------
85  : folder_(iConfig.getParameter<std::string>("folder")),
86  trackMinEnergy_(iConfig.getParameter<double>("trackMinimumEnergy")),
87  trackMinEta_(iConfig.getParameter<double>("trackMinimumEta")),
88  trackMaxEta_(iConfig.getParameter<double>("trackMaximumEta")) {
89  RecTrackToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("inputTagT"));
90  RecVertexToken_ = consumes<std::vector<reco::Vertex>>(iConfig.getParameter<edm::InputTag>("inputTagV"));
91 }
92 
94 
95 // ------------ method called for each event ------------
97  using namespace edm;
98  using namespace geant_units::operators;
99  using namespace std;
100 
101  auto RecTrackHandle = makeValid(iEvent.getHandle(RecTrackToken_));
102  auto RecVertexHandle = makeValid(iEvent.getHandle(RecVertexToken_));
103 
104  // --- Loop over all RECO tracks ---
105  for (const auto& track : *RecTrackHandle) {
106  if (track.pt() < trackMinEnergy_)
107  continue;
108 
109  if (fabs(track.eta()) < trackMinEta_) {
110  // --- all BTL tracks (with and without hit in MTD) ---
114 
115  bool MTDBtl = false;
116  int numMTDBtlvalidhits = 0;
117  for (const auto hit : track.recHits()) {
118  if (hit->isValid() == false)
119  continue;
120  MTDDetId Hit = hit->geographicalId();
121  if ((Hit.det() == 6) && (Hit.subdetId() == 1) && (Hit.mtdSubDetector() == 1)) {
122  MTDBtl = true;
123  numMTDBtlvalidhits++;
124  }
125  }
126  meTrackNumHits_->Fill(numMTDBtlvalidhits);
127 
128  // --- keeping only tracks with last hit in MTD ---
129  if (MTDBtl == true) {
134  }
135  }
136 
137  else {
138  // --- all ETL tracks (with and without hit in MTD) ---
139  if ((track.eta() < -trackMinEta_) && (track.eta() > -trackMaxEta_)) {
140  meETLTrackEffEtaTot_[0]->Fill(track.eta());
141  meETLTrackEffPhiTot_[0]->Fill(track.phi());
142  meETLTrackEffPtTot_[0]->Fill(track.pt());
143  }
144 
145  if ((track.eta() > trackMinEta_) && (track.eta() < trackMaxEta_)) {
146  meETLTrackEffEtaTot_[1]->Fill(track.eta());
147  meETLTrackEffPhiTot_[1]->Fill(track.phi());
148  meETLTrackEffPtTot_[1]->Fill(track.pt());
149  }
150 
151  bool MTDEtlZneg = false;
152  bool MTDEtlZpos = false;
153  int numMTDEtlvalidhits = 0;
154  for (const auto hit : track.recHits()) {
155  if (hit->isValid() == false)
156  continue;
157  MTDDetId Hit = hit->geographicalId();
158  if ((Hit.det() == 6) && (Hit.subdetId() == 1) && (Hit.mtdSubDetector() == 2) && (Hit.zside() == -1)) {
159  MTDEtlZneg = true;
160  numMTDEtlvalidhits++;
161  }
162  if ((Hit.det() == 6) && (Hit.subdetId() == 1) && (Hit.mtdSubDetector() == 2) && (Hit.zside() == 1)) {
163  MTDEtlZpos = true;
164  numMTDEtlvalidhits++;
165  }
166  }
167  meTrackNumHits_->Fill(-numMTDEtlvalidhits);
168 
169  // --- keeping only tracks with last hit in MTD ---
170  if ((track.eta() < -trackMinEta_) && (track.eta() > -trackMaxEta_)) {
171  if (MTDEtlZneg == true) {
172  meETLTrackEffEtaMtd_[0]->Fill(track.eta());
173  meETLTrackEffPhiMtd_[0]->Fill(track.phi());
174  meETLTrackEffPtMtd_[0]->Fill(track.pt());
175  meETLTrackRPTime_[0]->Fill(track.t0());
176  }
177  }
178  if ((track.eta() > trackMinEta_) && (track.eta() < trackMaxEta_)) {
179  if (MTDEtlZpos == true) {
180  meETLTrackEffEtaMtd_[1]->Fill(track.eta());
181  meETLTrackEffPhiMtd_[1]->Fill(track.phi());
182  meETLTrackEffPtMtd_[1]->Fill(track.pt());
183  meETLTrackRPTime_[1]->Fill(track.t0());
184  }
185  }
186  }
187  } //RECO tracks loop
188 
189  // --- Loop over the RECO vertices ---
190  int nv = 0;
191  for (const auto& v : *RecVertexHandle) {
192  if (v.isValid()) {
193  meVerZ_->Fill(v.z());
194  meVerTime_->Fill(v.t());
195  nv++;
196  } else
197  cout << "The vertex is not valid" << endl;
198  }
199  meVerNumber_->Fill(nv);
200 }
201 
202 // ------------ method for histogram booking ------------
204  edm::Run const& run,
205  edm::EventSetup const& iSetup) {
206  ibook.setCurrentFolder(folder_);
207 
208  // histogram booking
209  meBTLTrackRPTime_ = ibook.book1D("TrackBTLRPTime", "Track t0 with respect to R.P.;t0 [ns]", 100, -1, 3);
210  meBTLTrackEffEtaTot_ = ibook.book1D("TrackBTLEffEtaTot", "Track efficiency vs eta (Tot);#eta_{RECO}", 100, -1.6, 1.6);
212  ibook.book1D("TrackBTLEffPhiTot", "Track efficiency vs phi (Tot);#phi_{RECO} [rad]", 100, -3.2, 3.2);
213  meBTLTrackEffPtTot_ = ibook.book1D("TrackBTLEffPtTot", "Track efficiency vs pt (Tot);pt_{RECO} [GeV]", 50, 0, 10);
214  meBTLTrackEffEtaMtd_ = ibook.book1D("TrackBTLEffEtaMtd", "Track efficiency vs eta (Mtd);#eta_{RECO}", 100, -1.6, 1.6);
216  ibook.book1D("TrackBTLEffPhiMtd", "Track efficiency vs phi (Mtd);#phi_{RECO} [rad]", 100, -3.2, 3.2);
217  meBTLTrackEffPtMtd_ = ibook.book1D("TrackBTLEffPtMtd", "Track efficiency vs pt (Mtd);pt_{RECO} [GeV]", 50, 0, 10);
218  meETLTrackRPTime_[0] = ibook.book1D("TrackETLRPTimeZneg", "Track t0 with respect to R.P. (-Z);t0 [ns]", 100, -1, 3);
219  meETLTrackRPTime_[1] = ibook.book1D("TrackETLRPTimeZpos", "Track t0 with respect to R.P. (+Z);t0 [ns]", 100, -1, 3);
221  ibook.book1D("TrackETLEffEtaTotZneg", "Track efficiency vs eta (Tot) (-Z);#eta_{RECO}", 100, -3.2, -1.4);
223  ibook.book1D("TrackETLEffEtaTotZpos", "Track efficiency vs eta (Tot) (+Z);#eta_{RECO}", 100, 1.4, 3.2);
225  ibook.book1D("TrackETLEffPhiTotZneg", "Track efficiency vs phi (Tot) (-Z);#phi_{RECO} [rad]", 100, -3.2, 3.2);
227  ibook.book1D("TrackETLEffPhiTotZpos", "Track efficiency vs phi (Tot) (+Z);#phi_{RECO} [rad]", 100, -3.2, 3.2);
229  ibook.book1D("TrackETLEffPtTotZneg", "Track efficiency vs pt (Tot) (-Z);pt_{RECO} [GeV]", 50, 0, 10);
231  ibook.book1D("TrackETLEffPtTotZpos", "Track efficiency vs pt (Tot) (+Z);pt_{RECO} [GeV]", 50, 0, 10);
233  ibook.book1D("TrackETLEffEtaMtdZneg", "Track efficiency vs eta (Mtd) (-Z);#eta_{RECO}", 100, -3.2, -1.4);
235  ibook.book1D("TrackETLEffEtaMtdZpos", "Track efficiency vs eta (Mtd) (+Z);#eta_{RECO}", 100, 1.4, 3.2);
237  ibook.book1D("TrackETLEffPhiMtdZneg", "Track efficiency vs phi (Mtd) (-Z);#phi_{RECO} [rad]", 100, -3.2, 3.2);
239  ibook.book1D("TrackETLEffPhiMtdZpos", "Track efficiency vs phi (Mtd) (+Z);#phi_{RECO} [rad]", 100, -3.2, 3.2);
241  ibook.book1D("TrackETLEffPtMtdZneg", "Track efficiency vs pt (Mtd) (-Z);pt_{RECO} [GeV]", 50, 0, 10);
243  ibook.book1D("TrackETLEffPtMtdZpos", "Track efficiency vs pt (Mtd) (+Z);pt_{RECO} [GeV]", 50, 0, 10);
244  meTrackNumHits_ = ibook.book1D("TrackNumHits", "Number of valid MTD hits per track ; Number of hits", 10, -5, 5);
245  meVerZ_ = ibook.book1D("VerZ", "RECO Vertex Z;Z_{RECO} [cm]", 180, -18, 18);
246  meVerTime_ = ibook.book1D("VerTime", "RECO Vertex Time;t0 [ns]", 100, -1, 1);
247  meVerNumber_ = ibook.book1D("VerNumber", "RECO Vertex Number: Number of vertices", 100, 0, 500);
248 }
249 
250 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
251 
254 
255  desc.add<std::string>("folder", "MTD/GlobalReco");
256  desc.add<edm::InputTag>("inputTagT", edm::InputTag("trackExtenderWithMTD", ""));
257  desc.add<edm::InputTag>("inputTagV", edm::InputTag("offlinePrimaryVertices4D", ""));
258  desc.add<double>("trackMinimumEnergy", 1.0); // [GeV]
259  desc.add<double>("trackMinimumEta", 1.5);
260  desc.add<double>("trackMaximumEta", 3.2);
261 
262  descriptions.add("globalReco", desc);
263 }
264 
RefProd.h
Hit
Definition: SiPixelLorentzAngle.h:57
dqm::impl::MonitorElement
Definition: MonitorElement.h:98
BTLDetId.h
MtdGlobalRecoValidation::meETLTrackEffPtMtd_
MonitorElement * meETLTrackEffPtMtd_[2]
Definition: MtdGlobalRecoValidation.cc:74
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
MtdGlobalRecoValidation::trackMinEnergy_
const float trackMinEnergy_
Definition: MtdGlobalRecoValidation.cc:52
MtdGlobalRecoValidation::~MtdGlobalRecoValidation
~MtdGlobalRecoValidation() override
Definition: MtdGlobalRecoValidation.cc:93
MtdGlobalRecoValidation::meBTLTrackEffEtaMtd_
MonitorElement * meBTLTrackEffEtaMtd_
Definition: MtdGlobalRecoValidation.cc:63
edm::Run
Definition: Run.h:45
MtdGlobalRecoValidation::RecVertexToken_
edm::EDGetTokenT< std::vector< reco::Vertex > > RecVertexToken_
Definition: MtdGlobalRecoValidation.cc:57
edm::EDGetTokenT< reco::TrackCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
MTDGeometry.h
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
MTDDigiGeometryRecord.h
MtdGlobalRecoValidation::meBTLTrackEffPhiTot_
MonitorElement * meBTLTrackEffPhiTot_
Definition: MtdGlobalRecoValidation.cc:61
MtdGlobalRecoValidation::meETLTrackEffEtaTot_
MonitorElement * meETLTrackEffEtaTot_[2]
Definition: MtdGlobalRecoValidation.cc:69
DQMStore.h
MtdGlobalRecoValidation::meTrackNumHits_
MonitorElement * meTrackNumHits_
Definition: MtdGlobalRecoValidation.cc:76
MtdGlobalRecoValidation::RecTrackToken_
edm::EDGetTokenT< reco::TrackCollection > RecTrackToken_
Definition: MtdGlobalRecoValidation.cc:56
MtdGlobalRecoValidation::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: MtdGlobalRecoValidation.cc:203
geant_units::operators
Definition: GeantUnits.h:18
findQualityFiles.v
v
Definition: findQualityFiles.py:179
ETLDetId.h
MtdGlobalRecoValidation::meETLTrackEffPhiTot_
MonitorElement * meETLTrackEffPhiTot_[2]
Definition: MtdGlobalRecoValidation.cc:70
MtdGlobalRecoValidation::meETLTrackEffPtTot_
MonitorElement * meETLTrackEffPtTot_[2]
Definition: MtdGlobalRecoValidation.cc:71
MakerMacros.h
Track.h
TrackFwd.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
MtdGlobalRecoValidation::trackMaxEta_
const float trackMaxEta_
Definition: MtdGlobalRecoValidation.cc:54
PtrVector.h
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
RectangularMTDTopology.h
MtdGlobalRecoValidation::meBTLTrackEffEtaTot_
MonitorElement * meBTLTrackEffEtaTot_
Definition: MtdGlobalRecoValidation.cc:60
DQMEDAnalyzer.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
ValidHandle.h
MTDTrackingRecHit.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Vertex.h
folder_
std::string folder_
Definition: DQMEDAnalyzer.cc:60
DQMEDAnalyzer
Definition: DQMEDAnalyzer.py:1
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
RefVector.h
Event.h
GeantUnits.h
MtdGlobalRecoValidation::trackMinEta_
const float trackMinEta_
Definition: MtdGlobalRecoValidation.cc:53
MtdGlobalRecoValidation::meETLTrackRPTime_
MonitorElement * meETLTrackRPTime_[2]
Definition: MtdGlobalRecoValidation.cc:67
Ptr.h
iEvent
int iEvent
Definition: GenABIO.cc:224
MtdGlobalRecoValidation::meBTLTrackEffPtMtd_
MonitorElement * meBTLTrackEffPtMtd_
Definition: MtdGlobalRecoValidation.cc:65
GsfTrack.h
MtdGlobalRecoValidation::meBTLTrackRPTime_
MonitorElement * meBTLTrackRPTime_
Definition: MtdGlobalRecoValidation.cc:59
MtdGlobalRecoValidation
Definition: MtdGlobalRecoValidation.cc:37
MtdGlobalRecoValidation::meETLTrackEffPhiMtd_
MonitorElement * meETLTrackEffPhiMtd_[2]
Definition: MtdGlobalRecoValidation.cc:73
edm::EventSetup
Definition: EventSetup.h:57
edm::makeValid
auto makeValid(const U &iOtherHandleType) noexcept(false)
Definition: ValidHandle.h:52
MtdGlobalRecoValidation::meVerZ_
MonitorElement * meVerZ_
Definition: MtdGlobalRecoValidation.cc:79
VertexFwd.h
ProxyMTDTopology.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
MtdGlobalRecoValidation::meVerNumber_
MonitorElement * meVerNumber_
Definition: MtdGlobalRecoValidation.cc:78
std
Definition: JetResolutionObject.h:76
writedatasetfile.run
run
Definition: writedatasetfile.py:27
Ref.h
GsfTrackFwd.h
MTDTopologyRcd.h
MtdGlobalRecoValidation::meBTLTrackEffPhiMtd_
MonitorElement * meBTLTrackEffPhiMtd_
Definition: MtdGlobalRecoValidation.cc:64
Frameworkfwd.h
MtdGlobalRecoValidation::meETLTrackNumHits_
MonitorElement * meETLTrackNumHits_[2]
Definition: MtdGlobalRecoValidation.cc:68
MTDDetId
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
dqm::implementation::IBooker
Definition: DQMStore.h:43
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
ParameterSet.h
MtdGlobalRecoValidation::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: MtdGlobalRecoValidation.cc:96
edm::Event
Definition: Event.h:73
MtdGlobalRecoValidation::folder_
const std::string folder_
Definition: MtdGlobalRecoValidation.cc:51
MtdGlobalRecoValidation::meETLTrackEffEtaMtd_
MonitorElement * meETLTrackEffEtaMtd_[2]
Definition: MtdGlobalRecoValidation.cc:72
MtdGlobalRecoValidation::meVerTime_
MonitorElement * meVerTime_
Definition: MtdGlobalRecoValidation.cc:80
MtdGlobalRecoValidation::MtdGlobalRecoValidation
MtdGlobalRecoValidation(const edm::ParameterSet &)
Definition: MtdGlobalRecoValidation.cc:84
edm::InputTag
Definition: InputTag.h:15
MTDTopology.h
hit
Definition: SiStripHitEffFromCalibTree.cc:88
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
MtdGlobalRecoValidation::meBTLTrackEffPtTot_
MonitorElement * meBTLTrackEffPtTot_
Definition: MtdGlobalRecoValidation.cc:62
MtdGlobalRecoValidation::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: MtdGlobalRecoValidation.cc:252