129 edm::LogError(
"ME0SegmentsValidation") <<
"Cannot get ME0Digis by Token InputTagToken";
134 edm::LogError(
"ME0SegmentsValidation") <<
"Cannot get ME0RecHits/ME0Segments by Token InputTagToken";
139 edm::LogError(
"ME0HitsValidation") <<
"Cannot get ME0Hits by Token simInputTagToken";
148 edm::SimTrackContainer::const_iterator
simTrack;
149 for (simTrack = simTracks->begin(); simTrack != simTracks->end(); ++
simTrack) {
156 for (edm::PSimHitContainer::const_iterator itHit = ME0Hits->begin(); itHit != ME0Hits->end(); ++itHit) {
157 int particleType_sh = itHit->particleType();
158 int evtId_sh = itHit->eventId().event();
159 int bx_sh = itHit->eventId().bunchCrossing();
160 int procType_sh = itHit->processType();
161 if (!(
abs(particleType_sh) == 13 && evtId_sh == 0 && bx_sh == 0 && procType_sh == 0))
166 selectedME0Hits.push_back(*itHit);
172 if (selectedME0Hits.size() >= 3) {
183 for (
auto me0s = ME0Segments->begin(); me0s != ME0Segments->end(); me0s++) {
187 auto segLP = me0s->localPosition();
188 auto segLD = me0s->localDirection();
189 auto me0rhs = me0s->specificRecHits();
195 int numberRH = me0rhs.size();
197 float ndof = me0s->degreesOfFreedom();
198 double time = me0s->time();
199 double timeErr = me0s->timeErr();
201 float reducedChi2 = chi2 /
ndof;
213 std::vector<ME0RecHit> selectedME0RecHits;
215 for (
auto rh = me0rhs.begin(); rh != me0rhs.end(); rh++) {
216 auto me0id = rh->me0Id();
218 auto rhLP = rh->localPosition();
223 selectedME0RecHits.push_back(*rh);
228 auto erhLEP = rh->localPositionError();
229 auto rhGP = rhr->toGlobal(rhLP);
230 auto rhLPSegm =
chamber->toLocal(rhGP);
231 float xe = segLP.x() + segLD.x() * rhLPSegm.z() / segLD.z();
232 float ye = segLP.y() + segLD.y() * rhLPSegm.z() / segLD.z();
233 float ze = rhLPSegm.z();
235 auto extSegm = rhr->toLocal(
chamber->toGlobal(extrPoint));
237 int region = me0id.region();
238 int layer = me0id.layer();
242 float xErr = erhLEP.xx();
244 float yErr = erhLEP.yy();
246 float globalR = rhGP.perp();
247 float globalX = rhGP.x();
248 float globalY = rhGP.y();
249 float globalZ = rhGP.z();
251 float xExt = extSegm.x();
252 float yExt = extSegm.y();
254 float pull_x = (x - xExt) /
sqrt(xErr);
255 float pull_y = (y - yExt) /
sqrt(yErr);
260 else if (region == 1)
262 int layer_num = layer - 1;
280 for (
auto const &st : myMap) {
282 int num_sh = st.second.size();
283 bool isThereOneSegmentMatched =
false;
285 for (
auto const &seg : myMapSeg) {
287 int num_sh_matched = 0;
288 if (seg.second.empty())
291 for (
auto const &sh : st.second) {
294 for (
auto const &rh : seg.second) {
297 auto me0id = rh.me0Id();
298 int region_rh = (
int)me0id.region();
299 int layer_rh = (
int)me0id.layer();
300 int chamber_rh = (
int)me0id.chamber();
301 int roll_rh = (
int)me0id.roll();
304 int region_sh =
id.region();
305 int layer_sh =
id.layer();
306 int chamber_sh =
id.chamber();
307 int roll_sh =
id.roll();
309 if (!(region_sh == region_rh && chamber_sh == chamber_rh && layer_sh == layer_rh && roll_sh == roll_rh))
317 float dphi_glob = gp_sh.
phi() - gp.
phi();
318 float deta_glob = gp_sh.
eta() - gp.
eta();
329 quality = num_sh_matched / (1.0 * num_sh);
331 isThereOneSegmentMatched =
true;
336 if (isThereOneSegmentMatched) {
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
bool isSimTrackGood(edm::SimTrackContainer::const_iterator simTrack)
MonitorElement * me0_segment_redchi2
MonitorElement * me0_simsegment_pt
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Geom::Phi< T > phi() const
edm::EDGetToken InputTagToken_Segments
const ME0EtaPartition * etaPartition(ME0DetId id) const
Return a etaPartition given its id.
const Plane & surface() const
The nominal surface of the GeomDet.
std::map< edm::SimTrackContainer::const_iterator, edm::PSimHitContainer > MapTypeSim
MonitorElement * me0_specRH_xy[2][6]
MonitorElement * me0_segment_ndof
Container::value_type value_type
MonitorElement * me0_segment_numRH
MonitorElement * me0_specRH_DeltaX[2][6]
MonitorElement * me0_segment_time
const ME0Chamber * chamber(ME0DetId id) const
Return a chamber given its id.
Abs< T >::type abs(const T &t)
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
MonitorElement * me0_specRH_PullY[2][6]
MonitorElement * me0_matchedsimsegment_pt
std::pair< int, int > isMatched(ME0DetId, LocalPoint, edm::Handle< ME0DigiPreRecoCollection >)
MonitorElement * me0_segment_size
const GeomDet * idToDet(DetId) const override
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]