CMS 3D CMS Logo

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

#include <ME0SegmentsValidation.h>

Inheritance diagram for ME0SegmentsValidation:
ME0BaseValidation DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
std::pair< int, int > isMatched (ME0DetId, LocalPoint, edm::Handle< ME0DigiPreRecoCollection >)
 
bool isSimMatched (edm::SimTrackContainer::const_iterator, edm::PSimHitContainer::const_iterator)
 
bool isSimTrackGood (edm::SimTrackContainer::const_iterator simTrack)
 
 ME0SegmentsValidation (const edm::ParameterSet &)
 
 ~ME0SegmentsValidation () override
 
- Public Member Functions inherited from ME0BaseValidation
MonitorElementBookHistXY (DQMStore::IBooker &, const char *name, const char *label, unsigned int region_num, unsigned int layer_num=99)
 
MonitorElementBookHistZR (DQMStore::IBooker &, const char *name, const char *label, unsigned int region_num, unsigned int layer_num=99)
 
 ME0BaseValidation (const edm::ParameterSet &ps)
 
 ~ME0BaseValidation () override
 
- 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
 

Private Types

typedef std::map< ME0SegmentCollection::const_iterator, std::vector< ME0RecHit > > MapTypeSeg
 
typedef std::map< edm::SimTrackContainer::const_iterator, edm::PSimHitContainerMapTypeSim
 

Private Attributes

double eta_max_
 
double eta_min_
 
edm::EDGetToken InputTagToken_
 
edm::EDGetToken InputTagToken_Digis
 
edm::EDGetToken InputTagToken_Segments
 
edm::EDGetToken InputTagTokenST_
 
bool isMuonGun_
 
MonitorElementme0_matchedsimsegment_eta
 
MonitorElementme0_matchedsimsegment_phi
 
MonitorElementme0_matchedsimsegment_pt
 
MonitorElementme0_rh_xy_Muon [2][6]
 
MonitorElementme0_segment_chi2
 
MonitorElementme0_segment_EtaRH
 
MonitorElementme0_segment_ndof
 
MonitorElementme0_segment_numRH
 
MonitorElementme0_segment_numRHBkg
 
MonitorElementme0_segment_numRHSig
 
MonitorElementme0_segment_PhiRH
 
MonitorElementme0_segment_redchi2
 
MonitorElementme0_segment_size
 
MonitorElementme0_segment_time
 
MonitorElementme0_segment_timeErr
 
MonitorElementme0_simsegment_eta
 
MonitorElementme0_simsegment_phi
 
MonitorElementme0_simsegment_pt
 
MonitorElementme0_specRH_DeltaX [2][6]
 
MonitorElementme0_specRH_DeltaY [2][6]
 
MonitorElementme0_specRH_PullX [2][6]
 
MonitorElementme0_specRH_PullY [2][6]
 
MonitorElementme0_specRH_xy [2][6]
 
MonitorElementme0_specRH_zr [2]
 
int npart
 
double pt_min_
 
double sigma_x_
 
double sigma_y_
 

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
 
- 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 inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from ME0BaseValidation
edm::ESGetToken< ME0Geometry, MuonGeometryRecordgeomToken_
 
edm::EDGetToken InputTagToken_
 
std::vector< std::string > layerLabel
 
int nBinXY_
 
std::vector< double > nBinZR_
 
std::vector< double > RangeZR_
 
std::vector< std::string > regionLabel
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 9 of file ME0SegmentsValidation.h.

Member Typedef Documentation

◆ MapTypeSeg

Definition at line 49 of file ME0SegmentsValidation.h.

◆ MapTypeSim

typedef std::map<edm::SimTrackContainer::const_iterator, edm::PSimHitContainer> ME0SegmentsValidation::MapTypeSim
private

Definition at line 48 of file ME0SegmentsValidation.h.

Constructor & Destructor Documentation

◆ ME0SegmentsValidation()

ME0SegmentsValidation::ME0SegmentsValidation ( const edm::ParameterSet cfg)
explicit

Definition at line 5 of file ME0SegmentsValidation.cc.

References looper::cfg, eta_max_, eta_min_, InputTagToken_, InputTagToken_Digis, InputTagToken_Segments, InputTagTokenST_, isMuonGun_, pt_min_, sigma_x_, and sigma_y_.

6  InputTagToken_Segments = consumes<ME0SegmentCollection>(cfg.getParameter<edm::InputTag>("segmentInputLabel"));
7  InputTagToken_Digis = consumes<ME0DigiPreRecoCollection>(cfg.getParameter<edm::InputTag>("digiInputLabel"));
8  InputTagToken_ = consumes<edm::PSimHitContainer>(cfg.getParameter<edm::InputTag>("simInputLabel"));
9  InputTagTokenST_ = consumes<edm::SimTrackContainer>(cfg.getParameter<edm::InputTag>("simInputLabelST"));
10  sigma_x_ = cfg.getParameter<double>("sigma_x");
11  sigma_y_ = cfg.getParameter<double>("sigma_y");
12  eta_max_ = cfg.getParameter<double>("eta_max");
13  eta_min_ = cfg.getParameter<double>("eta_min");
14  pt_min_ = cfg.getParameter<double>("pt_min");
15  isMuonGun_ = cfg.getParameter<bool>("isMuonGun");
16 }
ME0BaseValidation(const edm::ParameterSet &ps)
edm::EDGetToken InputTagToken_Segments
edm::EDGetToken InputTagTokenST_
edm::EDGetToken InputTagToken_
edm::EDGetToken InputTagToken_Digis

◆ ~ME0SegmentsValidation()

ME0SegmentsValidation::~ME0SegmentsValidation ( )
override

Definition at line 105 of file ME0SegmentsValidation.cc.

105 {}

Member Function Documentation

◆ analyze()

void ME0SegmentsValidation::analyze ( const edm::Event e,
const edm::EventSetup iSetup 
)
overridevirtual

Implements ME0BaseValidation.

Definition at line 107 of file ME0SegmentsValidation.cc.

References funct::abs(), ME0Geometry::chamber(), relativeConstraints::chamber, hltPixelTracks_cff::chi2, submitPVResolutionJobs::count, MillePedeFileConverter_cfg::e, PV3DBase< T, PVType, FrameType >::eta(), ME0Geometry::etaPartition(), dqm::impl::MonitorElement::Fill(), dqmMemoryStats::float, ME0BaseValidation::geomToken_, edm::EventSetup::getData(), runTauDisplay::gp, l1ctLayer2EG_cff::id, ME0Geometry::idToDet(), InputTagToken_, InputTagToken_Digis, InputTagToken_Segments, InputTagTokenST_, createfilelist::int, isMatched(), isSimMatched(), isSimTrackGood(), edm::HandleBase::isValid(), pixelTopology::layer, me0_matchedsimsegment_eta, me0_matchedsimsegment_phi, me0_matchedsimsegment_pt, me0_segment_chi2, me0_segment_ndof, me0_segment_numRH, me0_segment_numRHBkg, me0_segment_numRHSig, me0_segment_redchi2, me0_segment_size, me0_segment_time, me0_segment_timeErr, me0_simsegment_eta, me0_simsegment_phi, me0_simsegment_pt, me0_specRH_DeltaX, me0_specRH_DeltaY, me0_specRH_PullX, me0_specRH_PullY, me0_specRH_xy, me0_specRH_zr, ndof, PV3DBase< T, PVType, FrameType >::phi(), quality, HLT_2023v12_cff::region, mps_fire::result, sigma_x_, sigma_y_, cscDigiValidation_cfi::simTrack, TrackCandidateProducer_cfi::simTracks, mathSSE::sqrt(), GeomDet::surface(), protons_cff::time, Surface::toGlobal(), x, and y.

107  {
108  const ME0Geometry *ME0Geometry_ = &iSetup.getData(geomToken_);
109 
111  e.getByToken(InputTagToken_, ME0Hits);
112 
114  e.getByToken(InputTagTokenST_, simTracks);
115 
117  e.getByToken(InputTagToken_Segments, ME0Segments);
118 
120  e.getByToken(InputTagToken_Digis, ME0Digis);
121 
122  if (!ME0Digis.isValid()) {
123  edm::LogError("ME0SegmentsValidation") << "Cannot get ME0Digis by Token InputTagToken";
124  return;
125  }
126 
127  if (!ME0Segments.isValid()) {
128  edm::LogError("ME0SegmentsValidation") << "Cannot get ME0RecHits/ME0Segments by Token InputTagToken";
129  return;
130  }
131 
132  if (!ME0Hits.isValid()) {
133  edm::LogError("ME0HitsValidation") << "Cannot get ME0Hits by Token simInputTagToken";
134  return;
135  }
136 
137  MapTypeSim myMap;
138  MapTypeSeg myMapSeg;
139 
140  int countST = 0;
141 
142  edm::SimTrackContainer::const_iterator simTrack;
143  for (simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack) {
144  edm::PSimHitContainer selectedME0Hits;
145 
146  if (!isSimTrackGood(simTrack))
147  continue;
148  int count = 0;
149 
150  for (edm::PSimHitContainer::const_iterator itHit = ME0Hits->begin(); itHit != ME0Hits->end(); ++itHit) {
151  int particleType_sh = itHit->particleType();
152  int evtId_sh = itHit->eventId().event();
153  int bx_sh = itHit->eventId().bunchCrossing();
154  int procType_sh = itHit->processType();
155  if (!(abs(particleType_sh) == 13 && evtId_sh == 0 && bx_sh == 0 && procType_sh == 0))
156  continue;
157 
158  if (isSimMatched(simTrack, itHit)) {
159  ++count;
160  selectedME0Hits.push_back(*itHit);
161  ;
162  }
163 
164  } // End loop SHs
165 
166  if (selectedME0Hits.size() >= 3) {
167  myMap.insert(MapTypeSim::value_type(simTrack, selectedME0Hits));
168  me0_simsegment_eta->Fill(std::abs((*simTrack).momentum().eta()));
169  me0_simsegment_pt->Fill((*simTrack).momentum().pt());
170  me0_simsegment_phi->Fill((*simTrack).momentum().phi());
171  ++countST;
172  }
173  }
174 
175  me0_segment_size->Fill(ME0Segments->size());
176 
177  for (auto me0s = ME0Segments->begin(); me0s != ME0Segments->end(); me0s++) {
178  // The ME0 Ensamble DetId refers to layer = 1
179  ME0DetId id = me0s->me0DetId();
180  auto chamber = ME0Geometry_->chamber(id);
181  auto segLP = me0s->localPosition();
182  auto segLD = me0s->localDirection();
183  auto me0rhs = me0s->specificRecHits();
184 
185  // float localX = segLP.x();
186  // float localY = segLP.y();
187  // float dirTheta = segLD.theta();
188  // float dirPhi = segLD.phi();
189  int numberRH = me0rhs.size();
190  float chi2 = (float)me0s->chi2();
191  float ndof = me0s->degreesOfFreedom();
192  double time = me0s->time();
193  double timeErr = me0s->timeErr();
194 
195  float reducedChi2 = chi2 / ndof;
196 
198  me0_segment_redchi2->Fill(reducedChi2);
200  me0_segment_numRH->Fill(numberRH);
201 
203  me0_segment_timeErr->Fill(timeErr);
204 
205  int numberRHSig = 0;
206  int numberRHBkg = 0;
207  std::vector<ME0RecHit> selectedME0RecHits;
208 
209  for (auto rh = me0rhs.begin(); rh != me0rhs.end(); rh++) {
210  auto me0id = rh->me0Id();
211  auto rhr = ME0Geometry_->etaPartition(me0id);
212  auto rhLP = rh->localPosition();
213 
214  auto result = isMatched(me0id, rhLP, ME0Digis);
215  if (result.second == 1) {
216  ++numberRHSig;
217  selectedME0RecHits.push_back(*rh);
218 
219  } else
220  ++numberRHBkg;
221 
222  auto erhLEP = rh->localPositionError();
223  auto rhGP = rhr->toGlobal(rhLP);
224  auto rhLPSegm = chamber->toLocal(rhGP);
225  float xe = segLP.x() + segLD.x() * rhLPSegm.z() / segLD.z();
226  float ye = segLP.y() + segLD.y() * rhLPSegm.z() / segLD.z();
227  float ze = rhLPSegm.z();
228  LocalPoint extrPoint(xe, ye, ze); // in segment rest frame
229  auto extSegm = rhr->toLocal(chamber->toGlobal(extrPoint)); // in layer restframe
230 
231  int region = me0id.region();
232  int layer = me0id.layer();
233  // int chamber = me0id.chamber();
234 
235  float x = rhLP.x();
236  float xErr = erhLEP.xx();
237  float y = rhLP.y();
238  float yErr = erhLEP.yy();
239 
240  float globalR = rhGP.perp();
241  float globalX = rhGP.x();
242  float globalY = rhGP.y();
243  float globalZ = rhGP.z();
244 
245  float xExt = extSegm.x();
246  float yExt = extSegm.y();
247 
248  float pull_x = (x - xExt) / sqrt(xErr);
249  float pull_y = (y - yExt) / sqrt(yErr);
250 
251  int region_num = 0;
252  if (region == -1)
253  region_num = 0;
254  else if (region == 1)
255  region_num = 1;
256  int layer_num = layer - 1;
257 
258  me0_specRH_xy[region_num][layer_num]->Fill(globalX, globalY);
259  me0_specRH_zr[region_num]->Fill(globalZ, globalR);
260 
261  me0_specRH_DeltaX[region_num][layer_num]->Fill(x - xExt);
262  me0_specRH_DeltaY[region_num][layer_num]->Fill(y - yExt);
263  me0_specRH_PullX[region_num][layer_num]->Fill(pull_x);
264  me0_specRH_PullY[region_num][layer_num]->Fill(pull_y);
265  }
266 
267  me0_segment_numRHSig->Fill(numberRHSig);
268  me0_segment_numRHBkg->Fill(numberRHBkg);
269  myMapSeg.insert(MapTypeSeg::value_type(me0s, selectedME0RecHits));
270  }
271 
272  //------------------- SimToReco -------------------
273 
274  for (auto const &st : myMap) { // loop over the signal simTracks
275 
276  int num_sh = st.second.size();
277  bool isThereOneSegmentMatched = false;
278 
279  for (auto const &seg : myMapSeg) { // loop over the reconstructed me0 segments
280 
281  int num_sh_matched = 0;
282  if (seg.second.empty())
283  continue;
284 
285  for (auto const &sh : st.second) { // loop over the me0 simHits left by
286  // the signal simTracks
287 
288  for (auto const &rh : seg.second) { // loop over the tracking recHits
289  // already matched to signal digis
290 
291  auto me0id = rh.me0Id();
292  int region_rh = (int)me0id.region();
293  int layer_rh = (int)me0id.layer();
294  int chamber_rh = (int)me0id.chamber();
295  int roll_rh = (int)me0id.roll();
296 
297  const ME0DetId id(sh.detUnitId());
298  int region_sh = id.region();
299  int layer_sh = id.layer();
300  int chamber_sh = id.chamber();
301  int roll_sh = id.roll();
302 
303  if (!(region_sh == region_rh && chamber_sh == chamber_rh && layer_sh == layer_rh && roll_sh == roll_rh))
304  continue;
305 
306  LocalPoint lp_sh = sh.localPosition();
307  LocalPoint lp_rh = rh.localPosition();
308 
309  GlobalPoint gp_sh = ME0Geometry_->idToDet(id)->surface().toGlobal(lp_sh);
310  GlobalPoint gp = ME0Geometry_->idToDet((rh).me0Id())->surface().toGlobal(lp_rh);
311  float dphi_glob = gp_sh.phi() - gp.phi();
312  float deta_glob = gp_sh.eta() - gp.eta();
313 
314  if (fabs(dphi_glob) < 3 * sigma_x_ && fabs(deta_glob) < 3 * sigma_y_)
315  ++num_sh_matched;
316 
317  } // End loop over RHs
318 
319  } // End loop over SHs
320 
321  float quality = 0;
322  if (num_sh != 0)
323  quality = num_sh_matched / (1.0 * num_sh);
324  if (quality > 0)
325  isThereOneSegmentMatched = true;
326 
327  } // End loop over segments
328 
329  // Fill hsitograms
330  if (isThereOneSegmentMatched) {
331  me0_matchedsimsegment_eta->Fill(std::abs((*(st.first)).momentum().eta()));
332  me0_matchedsimsegment_pt->Fill((*(st.first)).momentum().pt());
333  me0_matchedsimsegment_phi->Fill((*(st.first)).momentum().phi());
334  }
335 
336  } // End loop over STs
337 }
bool isSimTrackGood(edm::SimTrackContainer::const_iterator simTrack)
MonitorElement * me0_segment_redchi2
MonitorElement * me0_simsegment_pt
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::ESGetToken< ME0Geometry, MuonGeometryRecord > geomToken_
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
T eta() const
Definition: PV3DBase.h:73
edm::EDGetToken InputTagToken_Segments
Log< level::Error, false > LogError
std::map< edm::SimTrackContainer::const_iterator, edm::PSimHitContainer > MapTypeSim
MonitorElement * me0_specRH_xy[2][6]
const GeomDet * idToDet(DetId) const override
Definition: ME0Geometry.cc:24
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
MonitorElement * me0_segment_ndof
void Fill(long long x)
string quality
MonitorElement * me0_segment_numRH
MonitorElement * me0_specRH_DeltaX[2][6]
T sqrt(T t)
Definition: SSEVec.h:19
const ME0Chamber * chamber(ME0DetId id) const
Return a chamber given its id.
Definition: ME0Geometry.cc:43
MonitorElement * me0_segment_time
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MonitorElement * me0_specRH_PullX[2][6]
MonitorElement * me0_segment_numRHBkg
edm::EDGetToken InputTagTokenST_
std::map< ME0SegmentCollection::const_iterator, std::vector< ME0RecHit > > MapTypeSeg
MonitorElement * me0_matchedsimsegment_phi
edm::EDGetToken InputTagToken_
MonitorElement * me0_segment_timeErr
edm::EDGetToken InputTagToken_Digis
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
MonitorElement * me0_specRH_PullY[2][6]
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
MonitorElement * me0_matchedsimsegment_pt
std::pair< int, int > isMatched(ME0DetId, LocalPoint, edm::Handle< ME0DigiPreRecoCollection >)
MonitorElement * me0_segment_size
const ME0EtaPartition * etaPartition(ME0DetId id) const
Return a etaPartition given its id.
Definition: ME0Geometry.cc:35
bool isValid() const
Definition: HandleBase.h:70
MonitorElement * me0_segment_chi2
MonitorElement * me0_simsegment_eta
MonitorElement * me0_segment_numRHSig
MonitorElement * me0_specRH_DeltaY[2][6]
std::vector< PSimHit > PSimHitContainer
MonitorElement * me0_simsegment_phi
MonitorElement * me0_matchedsimsegment_eta
bool isSimMatched(edm::SimTrackContainer::const_iterator, edm::PSimHitContainer::const_iterator)
MonitorElement * me0_specRH_zr[2]

◆ bookHistograms()

void ME0SegmentsValidation::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  Run,
edm::EventSetup const &  iSetup 
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 18 of file ME0SegmentsValidation.cc.

References dqm::implementation::IBooker::book1D(), ME0BaseValidation::BookHistXY(), ME0BaseValidation::BookHistZR(), ME0BaseValidation::layerLabel, LogDebug, M_PI, me0_matchedsimsegment_eta, me0_matchedsimsegment_phi, me0_matchedsimsegment_pt, me0_segment_chi2, me0_segment_ndof, me0_segment_numRH, me0_segment_numRHBkg, me0_segment_numRHSig, me0_segment_redchi2, me0_segment_size, me0_segment_time, me0_segment_timeErr, me0_simsegment_eta, me0_simsegment_phi, me0_simsegment_pt, me0_specRH_DeltaX, me0_specRH_DeltaY, me0_specRH_PullX, me0_specRH_PullY, me0_specRH_xy, me0_specRH_zr, ME0BaseValidation::regionLabel, dqm::implementation::NavigatorBase::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

20  {
21  LogDebug("MuonME0SegmentsValidation") << "Info : Loading Geometry information\n";
22  ibooker.setCurrentFolder("MuonME0RecHitsV/ME0SegmentsTask");
23 
24  unsigned int nregion = 2;
25 
26  edm::LogInfo("MuonME0SegmentsValidation") << "+++ Info : # of region : " << nregion << std::endl;
27 
28  LogDebug("MuonME0SegmentsValidation") << "+++ Info : finish to get geometry information from ES.\n";
29 
30  me0_simsegment_eta = ibooker.book1D("me0_simsegment_eta", "SimSegment Eta Distribution; #eta; entries", 8, 2.0, 2.8);
31  me0_simsegment_pt = ibooker.book1D("me0_simsegment_pt", "SimSegment pT Distribution; p_{T}; entries", 20, 0.0, 100.0);
33  ibooker.book1D("me0_simsegment_phi", "SimSegments phi Distribution; #phi; entries", 18, -M_PI, +M_PI);
34 
36  ibooker.book1D("me0_matchedsimsegment_eta", "Matched SimSegment Eta Distribution; #eta; entries", 8, 2.0, 2.8);
38  ibooker.book1D("me0_matchedsimsegment_pt", "Matched SimSegment pT Distribution; p_{T}; entries", 20, 0.0, 100.0);
40  "me0_matchedsimsegment_phi", "Matched SimSegments phi Distribution; #phi; entries", 18, -M_PI, +M_PI);
41 
42  me0_segment_chi2 = ibooker.book1D("me0_seg_Chi2", "#chi^{2}; #chi^{2}; # Segments", 100, 0, 100);
43  me0_segment_redchi2 = ibooker.book1D("me0_seg_ReducedChi2", "#chi^{2}/ndof; #chi^{2}/ndof; # Segments", 100, 0, 5);
44  me0_segment_ndof = ibooker.book1D("me0_seg_ndof", "ndof; ndof; #Segments", 50, 0, 50);
46  ibooker.book1D("me0_seg_NumberRH", "Number of fitted RecHits; # RecHits; entries", 11, -0.5, 10.5);
48  ibooker.book1D("me0_seg_NumberRHSig", "Number of fitted Signal RecHits; # RecHits; entries", 11, -0.5, 10.5);
50  ibooker.book1D("me0_seg_NumberRHBkg", "Number of fitted BKG RecHits; # RecHits; entries", 11, -0.5, 10.5);
51  // me0_segment_EtaRH = ibooker.book1D("me0_specRH_globalEta","Fitted RecHits
52  // Eta Distribution; #eta; entries",200,-4.0,4.0); me0_segment_PhiRH =
53  // ibooker.book1D("me0_specRH_globalPhi","Fitted RecHits Phi Distribution;
54  // #eta; entries",18,-3.14,3.14);
55  me0_segment_time = ibooker.book1D("me0_seg_time", "Segment Timing; ns; entries", 300, -150, 150);
56  me0_segment_timeErr = ibooker.book1D("me0_seg_timErr", "Segment Timing Error; ns; entries", 50, 0, 0.5);
58  ibooker.book1D("me0_seg_size", "Segment Multiplicity; Number of ME0 segments; entries", 200, 0, 200);
59 
60  for (unsigned int region_num = 0; region_num < nregion; region_num++) {
61  me0_specRH_zr[region_num] = BookHistZR(ibooker, "me0_specRH_tot", "Segment RecHits", region_num);
62  for (unsigned int layer_num = 0; layer_num < 6; layer_num++) {
63  // me0_strip_dg_zr[region_num][layer_num] =
64  // BookHistZR(ibooker,"me0_strip_dg","SimHit",region_num,layer_num);
65  me0_specRH_xy[region_num][layer_num] =
66  BookHistXY(ibooker, "me0_specRH", "Segment RecHits", region_num, layer_num);
67  // me0_rh_xy_Muon[region_num][layer_num] =
68  // BookHistXY(ibooker,"me0_rh","RecHit Muon",region_num,layer_num);
69 
70  std::string histo_name_DeltaX =
71  std::string("me0_specRH_DeltaX_r") + regionLabel[region_num] + "_l" + layerLabel[layer_num];
72  std::string histo_name_DeltaY =
73  std::string("me0_specRH_DeltaY_r") + regionLabel[region_num] + "_l" + layerLabel[layer_num];
74  std::string histo_label_DeltaX = "Segment RecHits Delta X : region" + regionLabel[region_num] + " layer " +
75  layerLabel[layer_num] + " " + " ; x_{SimHit} - x_{Segment RecHits} ; entries";
76  std::string histo_label_DeltaY = "Segment RecHits Delta Y : region" + regionLabel[region_num] + " layer " +
77  layerLabel[layer_num] + " " + " ; y_{SimHit} - y_{Segment RecHit} ; entries";
78 
79  me0_specRH_DeltaX[region_num][layer_num] =
80  ibooker.book1D(histo_name_DeltaX.c_str(), histo_label_DeltaX.c_str(), 100, -10, 10);
81  me0_specRH_DeltaY[region_num][layer_num] =
82  ibooker.book1D(histo_name_DeltaY.c_str(), histo_label_DeltaY.c_str(), 100, -10, 10);
83 
84  std::string histo_name_PullX =
85  std::string("me0_specRH_PullX_r") + regionLabel[region_num] + "_l" + layerLabel[layer_num];
86  std::string histo_name_PullY =
87  std::string("me0_specRH_PullY_r") + regionLabel[region_num] + "_l" + layerLabel[layer_num];
88  std::string histo_label_PullX = "Segment RecHits Pull X : region" + regionLabel[region_num] + " layer " +
89  layerLabel[layer_num] + " " +
90  " ; #frac{x_{SimHit} - x_{Segment "
91  "RecHit}}{#sigma_{x,RecHit}} ; entries";
92  std::string histo_label_PullY = "Segment RecHits Pull Y : region" + regionLabel[region_num] + " layer " +
93  layerLabel[layer_num] + " " +
94  " ; #frac{y_{SimHit} - y_{Segment "
95  "RecHit}}{#sigma_{y,RecHit}} ; entries";
96 
97  me0_specRH_PullX[region_num][layer_num] =
98  ibooker.book1D(histo_name_PullX.c_str(), histo_label_DeltaX.c_str(), 100, -10, 10);
99  me0_specRH_PullY[region_num][layer_num] =
100  ibooker.book1D(histo_name_PullY.c_str(), histo_label_DeltaY.c_str(), 100, -10, 10);
101  }
102  }
103 }
MonitorElement * me0_segment_redchi2
MonitorElement * me0_simsegment_pt
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
std::vector< std::string > regionLabel
MonitorElement * BookHistZR(DQMStore::IBooker &, const char *name, const char *label, unsigned int region_num, unsigned int layer_num=99)
MonitorElement * me0_specRH_xy[2][6]
MonitorElement * me0_segment_ndof
MonitorElement * BookHistXY(DQMStore::IBooker &, const char *name, const char *label, unsigned int region_num, unsigned int layer_num=99)
MonitorElement * me0_segment_numRH
MonitorElement * me0_specRH_DeltaX[2][6]
MonitorElement * me0_segment_time
MonitorElement * me0_specRH_PullX[2][6]
MonitorElement * me0_segment_numRHBkg
MonitorElement * me0_matchedsimsegment_phi
MonitorElement * me0_segment_timeErr
#define M_PI
MonitorElement * me0_specRH_PullY[2][6]
Log< level::Info, false > LogInfo
MonitorElement * me0_matchedsimsegment_pt
MonitorElement * me0_segment_size
MonitorElement * me0_segment_chi2
std::vector< std::string > layerLabel
MonitorElement * me0_simsegment_eta
MonitorElement * me0_segment_numRHSig
MonitorElement * me0_specRH_DeltaY[2][6]
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * me0_simsegment_phi
MonitorElement * me0_matchedsimsegment_eta
MonitorElement * me0_specRH_zr[2]
#define LogDebug(id)

◆ isMatched()

std::pair< int, int > ME0SegmentsValidation::isMatched ( ME0DetId  me0id,
LocalPoint  rhLP,
edm::Handle< ME0DigiPreRecoCollection ME0Digis 
)

Definition at line 339 of file ME0SegmentsValidation.cc.

References ME0DetId::chamber(), relativeConstraints::chamber, createfilelist::int, ME0DetId::layer(), pixelTopology::layer, PbPb_ZMuSkimMuonDPG_cff::particleType, ME0DetId::region(), HLT_2023v12_cff::region, mps_fire::result, ME0DetId::roll(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by analyze().

341  {
342  int region_rh = (int)me0id.region();
343  int layer_rh = (int)me0id.layer();
344  int roll_rh = (int)me0id.roll();
345  int chamber_rh = (int)me0id.chamber();
346 
347  float l_x_rh = rhLP.x();
348  float l_y_rh = rhLP.y();
349 
350  int particleType = 0;
351  int isPrompt = -1;
352 
353  for (ME0DigiPreRecoCollection::DigiRangeIterator cItr = ME0Digis->begin(); cItr != ME0Digis->end(); cItr++) {
354  ME0DetId id = (*cItr).first;
355 
356  int region_dg = (int)id.region();
357  int layer_dg = (int)id.layer();
358  int roll_dg = (int)id.roll();
359  int chamber_dg = (int)id.chamber();
360 
361  if (region_rh != region_dg)
362  continue;
363  if (layer_rh != layer_dg)
364  continue;
365  if (chamber_rh != chamber_dg)
366  continue;
367  if (roll_rh != roll_dg)
368  continue;
369 
371  for (digiItr = (*cItr).second.first; digiItr != (*cItr).second.second; ++digiItr) {
372  float l_x_dg = digiItr->x();
373  float l_y_dg = digiItr->y();
374 
375  if (l_x_rh != l_x_dg)
376  continue;
377  if (l_y_rh != l_y_dg)
378  continue;
379 
380  particleType = digiItr->pdgid();
381  isPrompt = digiItr->prompt();
382  }
383  }
384 
385  std::pair<int, int> result;
386  result = std::make_pair(particleType, isPrompt);
387 
388  return result;
389 }
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
int layer() const
Layer id: each chamber has six layers of chambers: layer 1 is the inner layer and layer 6 is the oute...
Definition: ME0DetId.h:44
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
Definition: ME0DetId.h:38
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: ME0DetId.h:41
std::vector< DigiType >::const_iterator const_iterator
int roll() const
Definition: ME0DetId.h:48

◆ isSimMatched()

bool ME0SegmentsValidation::isSimMatched ( edm::SimTrackContainer::const_iterator  simTrack,
edm::PSimHitContainer::const_iterator  itHit 
)

Definition at line 406 of file ME0SegmentsValidation.cc.

References mps_fire::result, and cscDigiValidation_cfi::simTrack.

Referenced by analyze().

407  {
408  bool result = false;
409  int trackId = simTrack->trackId();
410  int trackId_sim = itHit->trackId();
411  if (trackId == trackId_sim)
412  result = true;
413  return result;
414 }

◆ isSimTrackGood()

bool ME0SegmentsValidation::isSimTrackGood ( edm::SimTrackContainer::const_iterator  simTrack)

Definition at line 391 of file ME0SegmentsValidation.cc.

References funct::abs(), PVValHelper::eta, eta_max_, isMuonGun_, and pt_min_.

Referenced by analyze().

391  {
392  if ((*t).noVertex() && !isMuonGun_)
393  return false;
394  if ((*t).noGenpart() && !isMuonGun_)
395  return false;
396  if (std::abs((*t).type()) != 13)
397  return false; // only interested in direct muon simtracks
398  if ((*t).momentum().pt() < pt_min_)
399  return false;
400  const float eta(std::abs((*t).momentum().eta()));
401  if (eta < eta_min_ || eta > eta_max_)
402  return false; // no GEMs could be in such eta
403  return true;
404 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Member Data Documentation

◆ eta_max_

double ME0SegmentsValidation::eta_max_
private

Definition at line 44 of file ME0SegmentsValidation.h.

Referenced by isSimTrackGood(), and ME0SegmentsValidation().

◆ eta_min_

double ME0SegmentsValidation::eta_min_
private

Definition at line 44 of file ME0SegmentsValidation.h.

Referenced by ME0SegmentsValidation().

◆ InputTagToken_

edm::EDGetToken ME0SegmentsValidation::InputTagToken_
private

Definition at line 39 of file ME0SegmentsValidation.h.

Referenced by analyze(), and ME0SegmentsValidation().

◆ InputTagToken_Digis

edm::EDGetToken ME0SegmentsValidation::InputTagToken_Digis
private

Definition at line 38 of file ME0SegmentsValidation.h.

Referenced by analyze(), and ME0SegmentsValidation().

◆ InputTagToken_Segments

edm::EDGetToken ME0SegmentsValidation::InputTagToken_Segments
private

Definition at line 37 of file ME0SegmentsValidation.h.

Referenced by analyze(), and ME0SegmentsValidation().

◆ InputTagTokenST_

edm::EDGetToken ME0SegmentsValidation::InputTagTokenST_
private

Definition at line 40 of file ME0SegmentsValidation.h.

Referenced by analyze(), and ME0SegmentsValidation().

◆ isMuonGun_

bool ME0SegmentsValidation::isMuonGun_
private

Definition at line 46 of file ME0SegmentsValidation.h.

Referenced by isSimTrackGood(), and ME0SegmentsValidation().

◆ me0_matchedsimsegment_eta

MonitorElement* ME0SegmentsValidation::me0_matchedsimsegment_eta
private

Definition at line 30 of file ME0SegmentsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_matchedsimsegment_phi

MonitorElement * ME0SegmentsValidation::me0_matchedsimsegment_phi
private

Definition at line 30 of file ME0SegmentsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_matchedsimsegment_pt

MonitorElement * ME0SegmentsValidation::me0_matchedsimsegment_pt
private

Definition at line 30 of file ME0SegmentsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_rh_xy_Muon

MonitorElement* ME0SegmentsValidation::me0_rh_xy_Muon[2][6]
private

Definition at line 21 of file ME0SegmentsValidation.h.

◆ me0_segment_chi2

MonitorElement* ME0SegmentsValidation::me0_segment_chi2
private

Definition at line 24 of file ME0SegmentsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_segment_EtaRH

MonitorElement* ME0SegmentsValidation::me0_segment_EtaRH
private

Definition at line 27 of file ME0SegmentsValidation.h.

◆ me0_segment_ndof

MonitorElement * ME0SegmentsValidation::me0_segment_ndof
private

Definition at line 24 of file ME0SegmentsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_segment_numRH

MonitorElement* ME0SegmentsValidation::me0_segment_numRH
private

Definition at line 26 of file ME0SegmentsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_segment_numRHBkg

MonitorElement * ME0SegmentsValidation::me0_segment_numRHBkg
private

Definition at line 26 of file ME0SegmentsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_segment_numRHSig

MonitorElement * ME0SegmentsValidation::me0_segment_numRHSig
private

Definition at line 26 of file ME0SegmentsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_segment_PhiRH

MonitorElement * ME0SegmentsValidation::me0_segment_PhiRH
private

Definition at line 27 of file ME0SegmentsValidation.h.

◆ me0_segment_redchi2

MonitorElement * ME0SegmentsValidation::me0_segment_redchi2
private

Definition at line 24 of file ME0SegmentsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_segment_size

MonitorElement * ME0SegmentsValidation::me0_segment_size
private

Definition at line 27 of file ME0SegmentsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_segment_time

MonitorElement* ME0SegmentsValidation::me0_segment_time
private

Definition at line 25 of file ME0SegmentsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_segment_timeErr

MonitorElement * ME0SegmentsValidation::me0_segment_timeErr
private

Definition at line 25 of file ME0SegmentsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_simsegment_eta

MonitorElement* ME0SegmentsValidation::me0_simsegment_eta
private

Definition at line 29 of file ME0SegmentsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_simsegment_phi

MonitorElement * ME0SegmentsValidation::me0_simsegment_phi
private

Definition at line 29 of file ME0SegmentsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_simsegment_pt

MonitorElement * ME0SegmentsValidation::me0_simsegment_pt
private

Definition at line 29 of file ME0SegmentsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_specRH_DeltaX

MonitorElement* ME0SegmentsValidation::me0_specRH_DeltaX[2][6]
private

Definition at line 32 of file ME0SegmentsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_specRH_DeltaY

MonitorElement* ME0SegmentsValidation::me0_specRH_DeltaY[2][6]
private

Definition at line 33 of file ME0SegmentsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_specRH_PullX

MonitorElement* ME0SegmentsValidation::me0_specRH_PullX[2][6]
private

Definition at line 34 of file ME0SegmentsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_specRH_PullY

MonitorElement* ME0SegmentsValidation::me0_specRH_PullY[2][6]
private

Definition at line 35 of file ME0SegmentsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_specRH_xy

MonitorElement* ME0SegmentsValidation::me0_specRH_xy[2][6]
private

Definition at line 20 of file ME0SegmentsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_specRH_zr

MonitorElement* ME0SegmentsValidation::me0_specRH_zr[2]
private

Definition at line 22 of file ME0SegmentsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ npart

int ME0SegmentsValidation::npart
private

Definition at line 42 of file ME0SegmentsValidation.h.

◆ pt_min_

double ME0SegmentsValidation::pt_min_
private

Definition at line 45 of file ME0SegmentsValidation.h.

Referenced by isSimTrackGood(), and ME0SegmentsValidation().

◆ sigma_x_

double ME0SegmentsValidation::sigma_x_
private

Definition at line 43 of file ME0SegmentsValidation.h.

Referenced by analyze(), and ME0SegmentsValidation().

◆ sigma_y_

double ME0SegmentsValidation::sigma_y_
private

Definition at line 43 of file ME0SegmentsValidation.h.

Referenced by analyze(), and ME0SegmentsValidation().