CMS 3D CMS Logo

ME0RecHitsValidation.cc
Go to the documentation of this file.
2 #include <TMath.h>
3 
5  InputTagToken_ = consumes<edm::PSimHitContainer>(cfg.getParameter<edm::InputTag>("simInputLabel"));
6  InputTagToken_RecHit = consumes<ME0RecHitCollection>(cfg.getParameter<edm::InputTag>("recHitInputLabel"));
7 }
8 
10  edm::Run const &Run,
11  edm::EventSetup const &iSetup) {
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 }
58 
60 
63  iSetup.get<MuonGeometryRecord>().get(hGeom);
64  const ME0Geometry *ME0Geometry_ = (&*hGeom);
66  e.getByToken(InputTagToken_, ME0Hits);
67 
69  e.getByToken(InputTagToken_RecHit, ME0RecHits);
70 
71  if (!ME0Hits.isValid() | !ME0RecHits.isValid()) {
72  edm::LogError("ME0RecHitsValidation") << "Cannot get ME0Hits/ME0RecHits by Token simInputTagToken";
73  return;
74  }
75 
76  for (auto hits = ME0Hits->begin(); hits != ME0Hits->end(); hits++) {
77  const ME0DetId id(hits->detUnitId());
78  Int_t sh_region = id.region();
79  Int_t sh_layer = id.layer();
80  Int_t sh_station = 0;
81  Int_t sh_chamber = id.chamber();
82  Int_t sh_roll = id.roll();
83 
84  // Int_t even_odd = id.chamber()%2;
85  if (ME0Geometry_->idToDet(hits->detUnitId()) == nullptr) {
86  std::cout << "simHit did not matched with GEMGeometry." << std::endl;
87  continue;
88  }
89 
90  const LocalPoint hitLP(hits->localPosition());
91 
92  for (ME0RecHitCollection::const_iterator recHit = ME0RecHits->begin(); recHit != ME0RecHits->end(); ++recHit) {
93  Float_t x = recHit->localPosition().x();
94  Float_t xErr = recHit->localPositionError().xx();
95  Float_t y = recHit->localPosition().y();
96  Float_t yErr = recHit->localPositionError().yy();
97  // Float_t detId = (Short_t) (*recHit).me0Id();
98  Float_t bx = 0;
99  Float_t clusterSize = 0;
100  Float_t firstClusterStrip = 0;
101 
102  ME0DetId id((*recHit).me0Id());
103 
104  Short_t region = (Short_t)id.region();
105  Short_t station = 0;
106  Short_t layer = (Short_t)id.layer();
107  Short_t chamber = (Short_t)id.chamber();
108  Short_t roll = (Short_t)id.roll();
109 
110  LocalPoint rhLP = recHit->localPosition();
111  GlobalPoint rhGP = ME0Geometry_->idToDet((*recHit).me0Id())->surface().toGlobal(rhLP);
112 
113  Float_t globalR = rhGP.perp();
114  Float_t globalX = rhGP.x();
115  Float_t globalY = rhGP.y();
116  Float_t globalZ = rhGP.z();
117 
118  Float_t x_sim = hitLP.x();
119  Float_t y_sim = hitLP.y();
120  Float_t pullX = (x_sim - x) / sqrt(xErr);
121  Float_t pullY = (y_sim - y) / sqrt(yErr);
122 
123  if (bx != 0)
124  continue;
125 
126  std::vector<int> stripsFired;
127  for (int i = firstClusterStrip; i < (firstClusterStrip + clusterSize); i++) {
128  stripsFired.push_back(i);
129  }
130 
131  const bool cond1(sh_region == region and sh_layer == layer and sh_station == station);
132  const bool cond2(sh_chamber == chamber and sh_roll == roll);
133  const bool cond3(
134  (std::find(stripsFired.begin(), stripsFired.end(), (firstClusterStrip + 1)) != stripsFired.end()) or
135  clusterSize == 0);
136 
137  int region_num = 0;
138  if (region == -1)
139  region_num = 0;
140  else if (region == 1)
141  region_num = 1;
142  int layer_num = layer - 1;
143 
144  if (cond1 and cond2 and cond3) {
145  me0_rh_xy[region_num][layer_num]->Fill(globalX, globalY);
146  me0_rh_zr[region_num]->Fill(globalZ, globalR);
147 
148  me0_rh_DeltaX[region_num][layer_num]->Fill(x_sim - x);
149  me0_rh_DeltaY[region_num][layer_num]->Fill(y_sim - y);
150  me0_rh_PullX[region_num][layer_num]->Fill(pullX);
151  me0_rh_PullY[region_num][layer_num]->Fill(pullY);
152  }
153  }
154  }
155 }
ME0BaseValidation::regionLabel
std::vector< std::string > regionLabel
Definition: ME0BaseValidation.h:32
DDAxes::y
mps_fire.i
i
Definition: mps_fire.py:355
ME0BaseValidation::layerLabel
std::vector< std::string > layerLabel
Definition: ME0BaseValidation.h:33
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
edm::Run
Definition: Run.h:45
relativeConstraints.station
station
Definition: relativeConstraints.py:67
ME0Geometry
Definition: ME0Geometry.h:12
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::LogInfo
Definition: MessageLogger.h:254
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
ME0Geometry::idToDet
const GeomDet * idToDet(DetId) const override
Definition: ME0Geometry.cc:24
DDAxes::x
ME0BaseValidation
Definition: ME0BaseValidation.h:21
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::Handle< edm::PSimHitContainer >
ME0RecHitsValidation::me0_rh_xy
MonitorElement * me0_rh_xy[2][6]
Definition: ME0RecHitsValidation.h:19
rpcPointValidation_cfi.recHit
recHit
Definition: rpcPointValidation_cfi.py:7
ME0RecHitsValidation.h
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
ME0RecHitsValidation::analyze
void analyze(const edm::Event &e, const edm::EventSetup &) override
Definition: ME0RecHitsValidation.cc:61
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
ME0RecHitsValidation::ME0RecHitsValidation
ME0RecHitsValidation(const edm::ParameterSet &)
Definition: ME0RecHitsValidation.cc:4
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
ME0RecHitsValidation::me0_rh_PullX
MonitorElement * me0_rh_PullX[2][6]
Definition: ME0RecHitsValidation.h:24
edm::ESHandle< ME0Geometry >
Point3DBase< float, LocalTag >
ME0RecHitsValidation::me0_rh_DeltaX
MonitorElement * me0_rh_DeltaX[2][6]
Definition: ME0RecHitsValidation.h:22
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ME0BaseValidation::BookHistXY
MonitorElement * BookHistXY(DQMStore::IBooker &, const char *name, const char *label, unsigned int region_num, unsigned int layer_num=99)
Definition: ME0BaseValidation.cc:55
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
ME0RecHitsValidation::me0_rh_PullY
MonitorElement * me0_rh_PullY[2][6]
Definition: ME0RecHitsValidation.h:25
ME0BaseValidation::BookHistZR
MonitorElement * BookHistZR(DQMStore::IBooker &, const char *name, const char *label, unsigned int region_num, unsigned int layer_num=99)
Definition: ME0BaseValidation.cc:23
edm::RangeMap::const_iterator
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
ME0RecHitsValidation::InputTagToken_RecHit
edm::EDGetToken InputTagToken_RecHit
Definition: ME0RecHitsValidation.h:27
edm::EventSetup
Definition: EventSetup.h:57
ME0DetId
Definition: ME0DetId.h:16
ME0RecHitsValidation::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: ME0RecHitsValidation.cc:9
get
#define get
ME0RecHitsValidation::me0_rh_zr
MonitorElement * me0_rh_zr[2]
Definition: ME0RecHitsValidation.h:20
looper.cfg
cfg
Definition: looper.py:297
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
HLT_2018_cff.region
region
Definition: HLT_2018_cff.py:81479
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
or
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
dqm::implementation::IBooker
Definition: DQMStore.h:43
ME0RecHitsValidation::me0_rh_DeltaY
MonitorElement * me0_rh_DeltaY[2][6]
Definition: ME0RecHitsValidation.h:23
ME0RecHitsValidation::~ME0RecHitsValidation
~ME0RecHitsValidation() override
Definition: ME0RecHitsValidation.cc:59
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
edm::InputTag
Definition: InputTag.h:15
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
ME0BaseValidation::InputTagToken_
edm::EDGetToken InputTagToken_
Definition: ME0BaseValidation.h:36
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
Run