15 bool is_gem(
unsigned int detid)
61 for (
auto id: gem_det_ids)
71 for (
auto id: gem_ch_ids)
78 for (
auto id: gem_sch_ids)
88 std::vector<unsigned int>
92 vector<unsigned int>
result;
93 result.push_back(initial_trk_id);
96 for (
auto&
t: sim_tracks)
103 if ( sim_vertices[last_trk.
vertIndex()].noParent() )
break;
105 unsigned parentId = sim_vertices[last_trk.
vertIndex()].parentIndex();
106 if ( parentId == initial_trk_id )
119 result.push_back(
t.trackId());
130 for (
auto& track_id: track_ids)
132 for (
auto&
h: gem_hits)
134 if (
h.trackId() != track_id)
continue;
135 int pdgid =
h.particleType();
143 GEMDetId superch_id(p_id.region(), p_id.ring(), p_id.station(), 1, p_id.chamber(), 0);
161 pads.insert( 1 + static_cast<int>(roll->padTopology().channel(lp)) );
170 if (id1.
layer() != 1)
continue;
173 if (detids.find(id2()) == detids.end())
continue;
182 pads1.insert( 1 + static_cast<int>(roll1->padTopology().channel(lp)) );
192 pads2.insert( 1 + static_cast<int>(roll2->padTopology().channel(lp)) );
196 std::set_intersection(pads1.begin(), pads1.end(), pads2.begin(), pads2.end(), std::inserter(copads, copads.begin()));
197 if (copads.empty())
continue;
205 std::set<unsigned int>
result;
213 std::set<unsigned int>
result;
221 std::set<unsigned int>
result;
227 std::set<unsigned int>
230 std::set<unsigned int>
result;
236 std::set<unsigned int>
239 std::set<unsigned int>
result;
243 result.insert(
id.chamberId().rawId());
290 set<int> layers_with_hits;
297 layers_with_hits.insert(idd.layer());
300 return layers_with_hits.size();
309 float sumx, sumy, sumz;
310 sumx = sumy = sumz = 0.f;
312 for (
auto&
h: sim_hits)
316 if ( is_gem(
h.detUnitId()) )
333 if (sim_hits.empty())
return -1.
f;
337 for (
auto&
h: sim_hits)
341 auto d =
h.detUnitId();
350 if (n == 0)
return -1.f;
363 for (
auto&
h: simhits)
367 int smin = central_strip - margin_n_strips;
368 smin = (smin > 0) ? smin : 1;
369 int smax = central_strip + margin_n_strips;
370 smax = (smax <= max_nstrips) ? smax : max_nstrips;
371 for (
int ss = smin; ss <= smax; ++ss) result.insert(ss);
398 for (
auto id: detids)
401 result.insert( idd.
roll() );
412 for (
auto id: pad_ids)
424 for (
auto id: copad_ids)
std::set< unsigned int > detIdsGEM() const
GEM partitions' detIds with SimHits.
T getUntrackedParameter(std::string const &, T const &) const
SimHitMatcher(const SimTrack &track, const edm::Event &, const GEMGeometry &geom, const edm::ParameterSet &cfg, edm::EDGetToken &simhitToken, edm::EDGetToken &simtrackToken, edm::EDGetToken &simvertexToken)
const edm::PSimHitContainer & hitsInDetId(unsigned int) const
simhits from a particular partition (GEM)/layer (CSC), chamber or superchamber
float simHitsMeanStrip(const edm::PSimHitContainer &sim_hits) const
calculate average strip (strip for GEM, half-strip for CSC) number for a provided collection of simhi...
int nPadsWithHits() const
How many pads with simhits in GEM did this simtrack get?
edm::Handle< edm::SimTrackContainer > sim_tracks
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const edm::PSimHitContainer & hitsInChamber(unsigned int) const
std::set< unsigned int > chamberIdsGEM() const
GEM chamber detIds with SimHits.
std::map< unsigned int, edm::PSimHitContainer > gem_chamber_to_hits_
std::vector< unsigned int > getIdsOfSimTrackShower(unsigned trk_id, const edm::SimTrackContainer &simTracks, const edm::SimVertexContainer &simVertices)
std::set< int > hitPartitions() const
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
std::set< int > hitStripsInDetId(unsigned int, int margin_n_strips=0) const
edm::PSimHitContainer gem_hits_
Global3DPoint GlobalPoint
const GEMGeometry & gem_geo_
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
const GEMEtaPartition * etaPartition(GEMDetId id) const
Return a GEMEtaPartition given its id.
GlobalPoint simHitsMeanPosition(const edm::PSimHitContainer &sim_hits) const
calculate Global average position for a provided collection of simhits
int nCoincidencePadsWithHits() const
How many coincidence pads with simhits in GEM did this simtrack get?
std::set< int > hitPadsInDetId(unsigned int) const
int layer() const
Layer id: each station have two layers of chambers: layer 1 is the inner chamber and layer 2 is the o...
std::set< unsigned int > superChamberIdsGEMCoincidences() const
GEM superchamber detIds with SimHits 2 layers of coincidence pads.
int station() const
Station id : the station is the pair of chambers at same disk.
Abs< T >::type abs(const T &t)
edm::PSimHitContainer no_hits_
std::map< unsigned int, edm::PSimHitContainer > gem_detid_to_hits_
virtual int channel(const LocalPoint &p) const =0
std::set< unsigned int > detIdsGEMCoincidences() const
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
edm::Handle< edm::SimVertexContainer > sim_vertices
int vertIndex() const
index of the vertex in the Event container (-1 if no vertex)
std::string simInputLabel_
unsigned int trackId() const
T const * product() const
virtual const GeomDet * idToDet(DetId) const override
std::map< unsigned int, edm::PSimHitContainer > gem_superchamber_to_hits_
void matchSimHitsToSimTrack(std::vector< unsigned int > track_ids, const edm::PSimHitContainer &gem_hits)
edm::Handle< edm::PSimHitContainer > gem_hits
std::vector< SimVertex > SimVertexContainer
void init(const edm::Event &)
const edm::PSimHitContainer & hitsInSuperChamber(unsigned int) const
std::set< unsigned int > superChamberIdsGEM() const
GEM superchamber detIds with SimHits.
std::vector< PSimHit > PSimHitContainer
std::map< unsigned int, unsigned int > trkid_to_index_
std::vector< SimTrack > SimTrackContainer
std::set< int > hitCoPadsInDetId(unsigned int) const
std::map< unsigned int, std::set< int > > gem_detids_to_copads_
std::map< unsigned int, std::set< int > > gem_detids_to_pads_
int nLayersWithHitsInSuperChamber(unsigned int) const