110 edm::LogError(
"ME0SegmentsValidation") <<
"Cannot get ME0Digis by Token InputTagToken";
115 edm::LogError(
"ME0SegmentsValidation") <<
"Cannot get ME0RecHits/ME0Segments by Token InputTagToken";
120 edm::LogError(
"ME0HitsValidation") <<
"Cannot get ME0Hits by Token simInputTagToken";
130 edm::SimTrackContainer::const_iterator
simTrack;
131 for (simTrack = simTracks->begin(); simTrack != simTracks->end(); ++
simTrack){
138 for (edm::PSimHitContainer::const_iterator itHit = ME0Hits->begin(); itHit != ME0Hits->end(); ++itHit){
140 int particleType_sh = itHit->particleType();
141 int evtId_sh = itHit->eventId().event();
142 int bx_sh = itHit->eventId().bunchCrossing();
143 int procType_sh = itHit->processType();
144 if(!(
abs(particleType_sh) == 13 && evtId_sh == 0 && bx_sh == 0 && procType_sh == 0))
continue;
149 selectedME0Hits.push_back(*itHit);;
155 if(selectedME0Hits.size() >= 3){
169 for (
auto me0s = ME0Segments->begin(); me0s != ME0Segments->end(); me0s++) {
174 auto segLP = me0s->localPosition();
175 auto segLD = me0s->localDirection();
176 auto me0rhs = me0s->specificRecHits();
182 int numberRH = me0rhs.size();
184 float ndof = me0s->degreesOfFreedom();
185 double time = me0s->time();
186 double timeErr = me0s->timeErr();
188 float reducedChi2 = chi2/
ndof;
200 std::vector<ME0RecHit> selectedME0RecHits;
202 for (
auto rh = me0rhs.begin(); rh!= me0rhs.end(); rh++)
205 auto me0id = rh->me0Id();
207 auto rhLP = rh->localPosition();
213 selectedME0RecHits.push_back(*rh);
218 auto erhLEP = rh->localPositionError();
219 auto rhGP = rhr->toGlobal(rhLP);
220 auto rhLPSegm =
chamber->toLocal(rhGP);
221 float xe = segLP.x()+segLD.x()*rhLPSegm.z()/segLD.z();
222 float ye = segLP.y()+segLD.y()*rhLPSegm.z()/segLD.z();
223 float ze = rhLPSegm.z();
225 auto extSegm = rhr->toLocal(
chamber->toGlobal(extrPoint));
227 int region = me0id.region();
228 int layer = me0id.layer();
232 float xErr = erhLEP.xx();
234 float yErr = erhLEP.yy();
236 float globalR = rhGP.perp();
237 float globalX = rhGP.x();
238 float globalY = rhGP.y();
239 float globalZ = rhGP.z();
241 float xExt = extSegm.x();
242 float yExt = extSegm.y();
244 float pull_x = (x - xExt) /
sqrt(xErr);
245 float pull_y = (y - yExt) /
sqrt(yErr);
248 if ( region ==-1 ) region_num = 0 ;
249 else if ( region==1) region_num = 1;
250 int layer_num = layer-1;
270 for(
auto const& st : myMap) {
272 int num_sh = st.second.size();
273 bool isThereOneSegmentMatched =
false;
275 for(
auto const& seg : myMapSeg) {
277 int num_sh_matched = 0;
278 if(seg.second.empty())
continue;
280 for(
auto const& sh : st.second) {
282 for(
auto const& rh : seg.second) {
284 auto me0id = rh.me0Id();
285 int region_rh = (
int) me0id.region();
286 int layer_rh = (
int) me0id.layer();
287 int chamber_rh = (
int) me0id.chamber();
288 int roll_rh = (
int) me0id.roll();
291 int region_sh =
id.region();
292 int layer_sh =
id.layer();
293 int chamber_sh =
id.chamber();
294 int roll_sh =
id.roll();
296 if( !(region_sh == region_rh && chamber_sh == chamber_rh && layer_sh == layer_rh && roll_sh == roll_rh) )
continue;
303 float dphi_glob = gp_sh.
phi()-gp.
phi();
304 float deta_glob = gp_sh.
eta()-gp.
eta();
306 if(fabs(dphi_glob) < 3*
sigma_x_ && fabs(deta_glob) < 3*
sigma_y_) ++num_sh_matched;
313 if(num_sh != 0) quality = num_sh_matched/(1.0*num_sh);
314 if(quality > 0) isThereOneSegmentMatched =
true;
319 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.
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]
simTrack
per collection params
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_
MonitorElement * me0_matchedsimsegment_phi
std::map< ME0SegmentCollection::const_iterator, std::vector< ME0RecHit > > MapTypeSeg
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
std::map< edm::SimTrackContainer::const_iterator, edm::PSimHitContainer > MapTypeSim
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]