CMS 3D CMS Logo

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

#include <ME0RecHitsValidation.h>

Inheritance diagram for ME0RecHitsValidation:
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
 
 ME0RecHitsValidation (const edm::ParameterSet &)
 
 ~ME0RecHitsValidation () 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 Attributes

edm::EDGetToken InputTagToken_RecHit
 
MonitorElementme0_rh_DeltaX [2][6]
 
MonitorElementme0_rh_DeltaY [2][6]
 
MonitorElementme0_rh_PullX [2][6]
 
MonitorElementme0_rh_PullY [2][6]
 
MonitorElementme0_rh_xy [2][6]
 
MonitorElementme0_rh_zr [2]
 
Int_t npart
 

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 7 of file ME0RecHitsValidation.h.

Constructor & Destructor Documentation

◆ ME0RecHitsValidation()

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

Definition at line 4 of file ME0RecHitsValidation.cc.

References looper::cfg, ME0BaseValidation::InputTagToken_, and InputTagToken_RecHit.

5  InputTagToken_ = consumes<edm::PSimHitContainer>(cfg.getParameter<edm::InputTag>("simInputLabel"));
6  InputTagToken_RecHit = consumes<ME0RecHitCollection>(cfg.getParameter<edm::InputTag>("recHitInputLabel"));
7 }
edm::EDGetToken InputTagToken_RecHit
ME0BaseValidation(const edm::ParameterSet &ps)
edm::EDGetToken InputTagToken_

◆ ~ME0RecHitsValidation()

ME0RecHitsValidation::~ME0RecHitsValidation ( )
override

Definition at line 59 of file ME0RecHitsValidation.cc.

59 {}

Member Function Documentation

◆ analyze()

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

Implements ME0BaseValidation.

Definition at line 61 of file ME0RecHitsValidation.cc.

References simKBmtfDigis_cfi::bx, relativeConstraints::chamber, MillePedeFileConverter_cfg::e, dqm::impl::MonitorElement::Fill(), spr::find(), ME0BaseValidation::geomToken_, edm::EventSetup::getData(), hfClusterShapes_cfi::hits, mps_fire::i, l1ctLayer2EG_cff::id, ME0Geometry::idToDet(), ME0BaseValidation::InputTagToken_, InputTagToken_RecHit, edm::HandleBase::isValid(), phase1PixelTopology::layer, me0_rh_DeltaX, me0_rh_DeltaY, me0_rh_PullX, me0_rh_PullY, me0_rh_xy, me0_rh_zr, or, PV3DBase< T, PVType, FrameType >::perp(), rpcPointValidation_cfi::recHit, HLT_2022v15_cff::region, mathSSE::sqrt(), relativeConstraints::station, GeomDet::toGlobal(), x, PV3DBase< T, PVType, FrameType >::x(), y, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

61  {
62  const ME0Geometry *ME0Geometry_ = &iSetup.getData(geomToken_);
63 
65  e.getByToken(InputTagToken_, ME0Hits);
66 
68  e.getByToken(InputTagToken_RecHit, ME0RecHits);
69 
70  if (!ME0Hits.isValid() | !ME0RecHits.isValid()) {
71  edm::LogError("ME0RecHitsValidation") << "Cannot get ME0Hits/ME0RecHits by Token simInputTagToken";
72  return;
73  }
74 
75  for (auto hits = ME0Hits->begin(); hits != ME0Hits->end(); hits++) {
76  const ME0DetId id(hits->detUnitId());
77  Int_t sh_region = id.region();
78  Int_t sh_layer = id.layer();
79  Int_t sh_station = 0;
80  Int_t sh_chamber = id.chamber();
81  Int_t sh_roll = id.roll();
82 
83  // Int_t even_odd = id.chamber()%2;
84  if (ME0Geometry_->idToDet(hits->detUnitId()) == nullptr) {
85  edm::LogInfo("ME0RecHitsValidation") << "simHit did not matched with GEMGeometry." << std::endl;
86  continue;
87  }
88 
89  const LocalPoint hitLP(hits->localPosition());
90 
91  for (ME0RecHitCollection::const_iterator recHit = ME0RecHits->begin(); recHit != ME0RecHits->end(); ++recHit) {
92  Float_t x = recHit->localPosition().x();
93  Float_t xErr = recHit->localPositionError().xx();
94  Float_t y = recHit->localPosition().y();
95  Float_t yErr = recHit->localPositionError().yy();
96  // Float_t detId = (Short_t) (*recHit).me0Id();
97  Float_t bx = 0;
98  Float_t clusterSize = 0;
99  Float_t firstClusterStrip = 0;
100 
101  ME0DetId id((*recHit).me0Id());
102 
103  Short_t region = (Short_t)id.region();
104  Short_t station = 0;
105  Short_t layer = (Short_t)id.layer();
106  Short_t chamber = (Short_t)id.chamber();
107  Short_t roll = (Short_t)id.roll();
108 
109  LocalPoint rhLP = recHit->localPosition();
110  GlobalPoint rhGP = ME0Geometry_->idToDet((*recHit).me0Id())->surface().toGlobal(rhLP);
111 
112  Float_t globalR = rhGP.perp();
113  Float_t globalX = rhGP.x();
114  Float_t globalY = rhGP.y();
115  Float_t globalZ = rhGP.z();
116 
117  Float_t x_sim = hitLP.x();
118  Float_t y_sim = hitLP.y();
119  Float_t pullX = (x_sim - x) / sqrt(xErr);
120  Float_t pullY = (y_sim - y) / sqrt(yErr);
121 
122  if (bx != 0)
123  continue;
124 
125  std::vector<int> stripsFired;
126  for (int i = firstClusterStrip; i < (firstClusterStrip + clusterSize); i++) {
127  stripsFired.push_back(i);
128  }
129 
130  const bool cond1(sh_region == region and sh_layer == layer and sh_station == station);
131  const bool cond2(sh_chamber == chamber and sh_roll == roll);
132  const bool cond3(
133  (std::find(stripsFired.begin(), stripsFired.end(), (firstClusterStrip + 1)) != stripsFired.end()) or
134  clusterSize == 0);
135 
136  int region_num = 0;
137  if (region == -1)
138  region_num = 0;
139  else if (region == 1)
140  region_num = 1;
141  int layer_num = layer - 1;
142 
143  if (cond1 and cond2 and cond3) {
144  me0_rh_xy[region_num][layer_num]->Fill(globalX, globalY);
145  me0_rh_zr[region_num]->Fill(globalZ, globalR);
146 
147  me0_rh_DeltaX[region_num][layer_num]->Fill(x_sim - x);
148  me0_rh_DeltaY[region_num][layer_num]->Fill(y_sim - y);
149  me0_rh_PullX[region_num][layer_num]->Fill(pullX);
150  me0_rh_PullY[region_num][layer_num]->Fill(pullY);
151  }
152  }
153  }
154 }
edm::EDGetToken InputTagToken_RecHit
MonitorElement * me0_rh_DeltaX[2][6]
T perp() const
Definition: PV3DBase.h:69
MonitorElement * me0_rh_PullY[2][6]
T z() const
Definition: PV3DBase.h:61
edm::ESGetToken< ME0Geometry, MuonGeometryRecord > geomToken_
MonitorElement * me0_rh_xy[2][6]
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const GeomDet * idToDet(DetId) const override
Definition: ME0Geometry.cc:24
constexpr std::array< uint8_t, layerIndexSize > layer
MonitorElement * me0_rh_zr[2]
void Fill(long long x)
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
T sqrt(T t)
Definition: SSEVec.h:19
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
bool getData(T &iHolder) const
Definition: EventSetup.h:122
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
Log< level::Info, false > LogInfo
MonitorElement * me0_rh_PullX[2][6]
edm::EDGetToken InputTagToken_
bool isValid() const
Definition: HandleBase.h:70
MonitorElement * me0_rh_DeltaY[2][6]

◆ bookHistograms()

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

Implements DQMEDAnalyzer.

Definition at line 9 of file ME0RecHitsValidation.cc.

References dqm::implementation::IBooker::book1D(), ME0BaseValidation::BookHistXY(), ME0BaseValidation::BookHistZR(), ME0BaseValidation::layerLabel, LogDebug, me0_rh_DeltaX, me0_rh_DeltaY, me0_rh_PullX, me0_rh_PullY, me0_rh_xy, me0_rh_zr, ME0BaseValidation::regionLabel, dqm::implementation::NavigatorBase::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

11  {
12  LogDebug("MuonME0RecHitsValidation") << "Info : Loading Geometry information\n";
13  ibooker.setCurrentFolder("MuonME0RecHitsV/ME0RecHitsTask");
14 
15  unsigned int nregion = 2;
16 
17  edm::LogInfo("MuonME0RecHitsValidation") << "+++ Info : # of region : " << nregion << std::endl;
18 
19  LogDebug("MuonME0RecHitsValidation") << "+++ Info : finish to get geometry information from ES.\n";
20 
21  for (unsigned int region_num = 0; region_num < nregion; region_num++) {
22  me0_rh_zr[region_num] = BookHistZR(ibooker, "me0_rh_tot", "Digi", region_num);
23  for (unsigned int layer_num = 0; layer_num < 6; layer_num++) {
24  me0_rh_xy[region_num][layer_num] = BookHistXY(ibooker, "me0_rh", "RecHit", region_num, layer_num);
25 
26  std::string histo_name_DeltaX =
27  std::string("me0_rh_DeltaX_r") + regionLabel[region_num] + "_l" + layerLabel[layer_num];
28  std::string histo_name_DeltaY =
29  std::string("me0_rh_DeltaY_r") + regionLabel[region_num] + "_l" + layerLabel[layer_num];
30  std::string histo_label_DeltaX = "RecHit Delta X : region" + regionLabel[region_num] + " layer " +
31  layerLabel[layer_num] + " " + " ; x_{SimHit} - x_{RecHit} ; entries";
32  std::string histo_label_DeltaY = "RecHit Delta Y : region" + regionLabel[region_num] + " layer " +
33  layerLabel[layer_num] + " " + " ; y_{SimHit} - y_{RecHit} ; entries";
34 
35  me0_rh_DeltaX[region_num][layer_num] =
36  ibooker.book1D(histo_name_DeltaX.c_str(), histo_label_DeltaX.c_str(), 100, -10, 10);
37  me0_rh_DeltaY[region_num][layer_num] =
38  ibooker.book1D(histo_name_DeltaY.c_str(), histo_label_DeltaY.c_str(), 100, -10, 10);
39 
40  std::string histo_name_PullX =
41  std::string("me0_rh_PullX_r") + regionLabel[region_num] + "_l" + layerLabel[layer_num];
42  std::string histo_name_PullY =
43  std::string("me0_rh_PullY_r") + regionLabel[region_num] + "_l" + layerLabel[layer_num];
44  std::string histo_label_PullX = "RecHit Pull X : region" + regionLabel[region_num] + " layer " +
45  layerLabel[layer_num] + " " +
46  " ; #frac{x_{SimHit} - x_{RecHit}}{#sigma_{x,RecHit}} ; entries";
47  std::string histo_label_PullY = "RecHit Pull Y : region" + regionLabel[region_num] + " layer " +
48  layerLabel[layer_num] + " " +
49  " ; #frac{y_{SimHit} - y_{RecHit}}{#sigma_{y,RecHit}} ; entries";
50 
51  me0_rh_PullX[region_num][layer_num] =
52  ibooker.book1D(histo_name_PullX.c_str(), histo_label_DeltaX.c_str(), 100, -10, 10);
53  me0_rh_PullY[region_num][layer_num] =
54  ibooker.book1D(histo_name_PullY.c_str(), histo_label_DeltaY.c_str(), 100, -10, 10);
55  }
56  }
57 }
MonitorElement * me0_rh_DeltaX[2][6]
MonitorElement * me0_rh_PullY[2][6]
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
std::vector< std::string > regionLabel
MonitorElement * me0_rh_xy[2][6]
MonitorElement * BookHistZR(DQMStore::IBooker &, const char *name, const char *label, unsigned int region_num, unsigned int layer_num=99)
MonitorElement * me0_rh_zr[2]
MonitorElement * BookHistXY(DQMStore::IBooker &, const char *name, const char *label, unsigned int region_num, unsigned int layer_num=99)
Log< level::Info, false > LogInfo
MonitorElement * me0_rh_PullX[2][6]
std::vector< std::string > layerLabel
MonitorElement * me0_rh_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
#define LogDebug(id)

Member Data Documentation

◆ InputTagToken_RecHit

edm::EDGetToken ME0RecHitsValidation::InputTagToken_RecHit
private

Definition at line 23 of file ME0RecHitsValidation.h.

Referenced by analyze(), and ME0RecHitsValidation().

◆ me0_rh_DeltaX

MonitorElement* ME0RecHitsValidation::me0_rh_DeltaX[2][6]
private

Definition at line 18 of file ME0RecHitsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_rh_DeltaY

MonitorElement* ME0RecHitsValidation::me0_rh_DeltaY[2][6]
private

Definition at line 19 of file ME0RecHitsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_rh_PullX

MonitorElement* ME0RecHitsValidation::me0_rh_PullX[2][6]
private

Definition at line 20 of file ME0RecHitsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_rh_PullY

MonitorElement* ME0RecHitsValidation::me0_rh_PullY[2][6]
private

Definition at line 21 of file ME0RecHitsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_rh_xy

MonitorElement* ME0RecHitsValidation::me0_rh_xy[2][6]
private

Definition at line 15 of file ME0RecHitsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me0_rh_zr

MonitorElement* ME0RecHitsValidation::me0_rh_zr[2]
private

Definition at line 16 of file ME0RecHitsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ npart

Int_t ME0RecHitsValidation::npart
private

Definition at line 25 of file ME0RecHitsValidation.h.