21 LogDebug(
"MuonME0SegmentsValidation") <<
"Info : Loading Geometry information\n";
24 unsigned int nregion = 2;
26 edm::LogInfo(
"MuonME0SegmentsValidation") <<
"+++ Info : # of region : " << nregion << std::endl;
28 LogDebug(
"MuonME0SegmentsValidation") <<
"+++ Info : finish to get geometry information from ES.\n";
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);
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);
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);
58 ibooker.
book1D(
"me0_seg_size",
"Segment Multiplicity; Number of ME0 segments; entries", 200, 0, 200);
60 for (
unsigned int region_num = 0; region_num < nregion; region_num++) {
62 for (
unsigned int layer_num = 0; layer_num < 6; layer_num++) {
66 BookHistXY(ibooker,
"me0_specRH",
"Segment RecHits", region_num, 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";
80 ibooker.
book1D(histo_name_DeltaX.c_str(), histo_label_DeltaX.c_str(), 100, -10, 10);
82 ibooker.
book1D(histo_name_DeltaY.c_str(), histo_label_DeltaY.c_str(), 100, -10, 10);
90 " ; #frac{x_{SimHit} - x_{Segment " 91 "RecHit}}{#sigma_{x,RecHit}} ; entries";
94 " ; #frac{y_{SimHit} - y_{Segment " 95 "RecHit}}{#sigma_{y,RecHit}} ; entries";
98 ibooker.
book1D(histo_name_PullX.c_str(), histo_label_DeltaX.c_str(), 100, -10, 10);
100 ibooker.
book1D(histo_name_PullY.c_str(), histo_label_DeltaY.c_str(), 100, -10, 10);
123 edm::LogError(
"ME0SegmentsValidation") <<
"Cannot get ME0Digis by Token InputTagToken";
128 edm::LogError(
"ME0SegmentsValidation") <<
"Cannot get ME0RecHits/ME0Segments by Token InputTagToken";
133 edm::LogError(
"ME0HitsValidation") <<
"Cannot get ME0Hits by Token simInputTagToken";
142 edm::SimTrackContainer::const_iterator
simTrack;
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))
160 selectedME0Hits.push_back(*itHit);
166 if (selectedME0Hits.size() >= 3) {
177 for (
auto me0s = ME0Segments->begin(); me0s != ME0Segments->end(); me0s++) {
181 auto segLP = me0s->localPosition();
182 auto segLD = me0s->localDirection();
183 auto me0rhs = me0s->specificRecHits();
189 int numberRH = me0rhs.size();
191 float ndof = me0s->degreesOfFreedom();
192 double time = me0s->time();
193 double timeErr = me0s->timeErr();
207 std::vector<ME0RecHit> selectedME0RecHits;
209 for (
auto rh = me0rhs.begin(); rh != me0rhs.end(); rh++) {
210 auto me0id = rh->me0Id();
212 auto rhLP = rh->localPosition();
217 selectedME0RecHits.push_back(*rh);
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();
229 auto extSegm = rhr->toLocal(
chamber->toGlobal(extrPoint));
231 int region = me0id.region();
232 int layer = me0id.layer();
236 float xErr = erhLEP.xx();
238 float yErr = erhLEP.yy();
240 float globalR = rhGP.perp();
241 float globalX = rhGP.x();
242 float globalY = rhGP.y();
243 float globalZ = rhGP.z();
245 float xExt = extSegm.x();
246 float yExt = extSegm.y();
248 float pull_x = (
x - xExt) /
sqrt(xErr);
249 float pull_y = (
y - yExt) /
sqrt(yErr);
256 int layer_num =
layer - 1;
274 for (
auto const &st : myMap) {
276 int num_sh = st.second.size();
277 bool isThereOneSegmentMatched =
false;
279 for (
auto const &seg : myMapSeg) {
281 int num_sh_matched = 0;
282 if (seg.second.empty())
285 for (
auto const &sh : st.second) {
288 for (
auto const &rh : seg.second) {
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();
298 int region_sh =
id.region();
299 int layer_sh =
id.layer();
300 int chamber_sh =
id.chamber();
301 int roll_sh =
id.roll();
303 if (!(region_sh == region_rh && chamber_sh == chamber_rh && layer_sh == layer_rh && roll_sh == roll_rh))
311 float dphi_glob = gp_sh.
phi() -
gp.phi();
312 float deta_glob = gp_sh.
eta() -
gp.eta();
323 quality = num_sh_matched / (1.0 * num_sh);
325 isThereOneSegmentMatched =
true;
330 if (isThereOneSegmentMatched) {
344 int roll_rh = (
int)me0id.
roll();
347 float l_x_rh = rhLP.
x();
348 float l_y_rh = rhLP.
y();
358 int roll_dg = (
int)
id.roll();
361 if (region_rh != region_dg)
363 if (layer_rh != layer_dg)
365 if (chamber_rh != chamber_dg)
367 if (roll_rh != roll_dg)
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();
375 if (l_x_rh != l_x_dg)
377 if (l_y_rh != l_y_dg)
381 isPrompt = digiItr->prompt();
385 std::pair<int, int>
result;
398 if ((*t).momentum().pt() <
pt_min_)
401 if (eta < eta_min_ || eta >
eta_max_)
407 edm::PSimHitContainer::const_iterator itHit) {
410 int trackId_sim = itHit->trackId();
411 if (trackId == trackId_sim)
bool isSimTrackGood(edm::SimTrackContainer::const_iterator simTrack)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * me0_segment_redchi2
MonitorElement * me0_simsegment_pt
virtual void setCurrentFolder(std::string const &fullpath)
void analyze(const edm::Event &e, const edm::EventSetup &) override
edm::ESGetToken< ME0Geometry, MuonGeometryRecord > geomToken_
std::vector< std::string > regionLabel
Geom::Phi< T > phi() const
edm::EDGetToken InputTagToken_Segments
Log< level::Error, false > LogError
std::map< edm::SimTrackContainer::const_iterator, edm::PSimHitContainer > MapTypeSim
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]
const GeomDet * idToDet(DetId) const override
constexpr std::array< uint8_t, layerIndexSize > layer
MonitorElement * me0_segment_ndof
ME0SegmentsValidation(const edm::ParameterSet &)
MonitorElement * BookHistXY(DQMStore::IBooker &, const char *name, const char *label, unsigned int region_num, unsigned int layer_num=99)
Container::value_type value_type
int layer() const
Layer id: each chamber has six layers of chambers: layer 1 is the inner layer and layer 6 is the oute...
MonitorElement * me0_segment_numRH
MonitorElement * me0_specRH_DeltaX[2][6]
const ME0Chamber * chamber(ME0DetId id) const
Return a chamber given its id.
MonitorElement * me0_segment_time
Abs< T >::type abs(const T &t)
MonitorElement * me0_specRH_PullX[2][6]
MonitorElement * me0_segment_numRHBkg
bool getData(T &iHolder) const
edm::EDGetToken InputTagTokenST_
std::map< ME0SegmentCollection::const_iterator, std::vector< ME0RecHit > > MapTypeSeg
MonitorElement * me0_matchedsimsegment_phi
edm::EDGetToken InputTagToken_
MonitorElement * me0_segment_timeErr
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
edm::EDGetToken InputTagToken_Digis
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
MonitorElement * me0_specRH_PullY[2][6]
Log< level::Info, false > LogInfo
const Plane & surface() const
The nominal surface of the GeomDet.
MonitorElement * me0_matchedsimsegment_pt
~ME0SegmentsValidation() override
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
std::pair< int, int > isMatched(ME0DetId, LocalPoint, edm::Handle< ME0DigiPreRecoCollection >)
MonitorElement * me0_segment_size
std::vector< DigiType >::const_iterator const_iterator
const ME0EtaPartition * etaPartition(ME0DetId id) const
Return a etaPartition given its id.
MonitorElement * me0_segment_chi2
std::vector< std::string > layerLabel
MonitorElement * me0_simsegment_eta
MonitorElement * me0_segment_numRHSig
MonitorElement * me0_specRH_DeltaY[2][6]
std::vector< PSimHit > PSimHitContainer
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
MonitorElement * me0_simsegment_phi
MonitorElement * me0_matchedsimsegment_eta
bool isSimMatched(edm::SimTrackContainer::const_iterator, edm::PSimHitContainer::const_iterator)
MonitorElement * me0_specRH_zr[2]