15 bool is_gem(
unsigned int detid) {
31 : track_(track), gem_geo_(geom) {
59 for (
auto id : gem_det_ids) {
63 cout <<
"detid " <<
GEMDetId(
id) <<
": " << gem_simhits.size() <<
" " << gem_simhits_gp.phi() <<
" " 71 for (
auto id : gem_ch_ids) {
74 cout <<
"cchid " <<
GEMDetId(
id) <<
": " << gem_simhits.size() <<
" " << gem_simhits_gp.phi() <<
" " 78 for (
auto id : gem_sch_ids) {
90 vector<unsigned int>
result;
91 result.push_back(initial_trk_id);
95 for (
auto&
t : sim_tracks) {
97 bool is_child =
false;
101 if (sim_vertices[last_trk.
vertIndex()].noParent())
104 unsigned parentId = sim_vertices[last_trk.
vertIndex()].parentIndex();
105 if (parentId == initial_trk_id) {
117 result.push_back(
t.trackId());
124 for (
auto& track_id : track_ids) {
125 for (
auto&
h : gem_hits) {
126 if (
h.trackId() != track_id)
128 int pdgid =
h.particleType();
138 GEMDetId superch_id(p_id.region(), p_id.ring(), p_id.station(), 1, p_id.chamber(), 0);
146 for (
auto d : detids) {
152 for (
auto&
h :
hits) {
154 pads.insert(1 + static_cast<int>(roll->padTopology().channel(lp)));
160 for (
auto d : detids) {
162 if (id1.
layer() != 1)
166 if (detids.find(
id2()) == detids.end())
173 for (
auto&
h : hits1) {
175 pads1.insert(1 + static_cast<int>(roll1->padTopology().channel(lp)));
182 for (
auto&
h : hits2) {
184 pads2.insert(1 + static_cast<int>(roll2->padTopology().channel(lp)));
188 std::set_intersection(
189 pads1.begin(), pads1.end(), pads2.begin(), pads2.end(), std::inserter(copads, copads.begin()));
197 std::set<unsigned int>
result;
199 result.insert(
p.first);
204 std::set<unsigned int>
result;
206 result.insert(
p.first);
211 std::set<unsigned int>
result;
213 result.insert(
p.first);
218 std::set<unsigned int>
result;
220 result.insert(
p.first);
225 std::set<unsigned int>
result;
228 result.insert(
id.chamberId().rawId());
264 set<int> layers_with_hits;
266 for (
auto&
h :
hits) {
269 layers_with_hits.insert(idd.layer());
272 return layers_with_hits.size();
276 if (sim_hits.empty())
279 float sumx, sumy, sumz;
280 sumx = sumy = sumz = 0.f;
282 for (
auto&
h : sim_hits) {
285 if (is_gem(
h.detUnitId())) {
300 if (sim_hits.empty())
305 for (
auto&
h : sim_hits) {
308 auto d =
h.detUnitId();
330 int smin = central_strip - margin_n_strips;
331 smin = (smin > 0) ? smin : 1;
332 int smax = central_strip + margin_n_strips;
333 smax = (smax <= max_nstrips) ? smax : max_nstrips;
334 for (
int ss = smin;
ss <= smax; ++
ss)
359 for (
auto id : detids) {
361 result.insert(idd.
roll());
369 for (
auto id : pad_ids) {
378 for (
auto id : copad_ids) {
std::set< unsigned int > detIdsGEM() const
GEM partitions' detIds with SimHits.
T getUntrackedParameter(std::string const &, T const &) const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
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::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_
const GEMEtaPartition * etaPartition(GEMDetId id) const
Return a GEMEtaPartition given its id.
std::map< unsigned int, edm::PSimHitContainer > gem_superchamber_to_hits_
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
std::set< unsigned int > superChamberIdsGEMCoincidences() const
GEM superchamber detIds with SimHits 2 layers of coincidence pads.
Abs< T >::type abs(const T &t)
edm::PSimHitContainer no_hits_
virtual int channel(const LocalPoint &p) const =0
std::set< unsigned int > detIdsGEMCoincidences() const
edm::Handle< edm::SimVertexContainer > sim_vertices
int vertIndex() const
index of the vertex in the Event container (-1 if no vertex)
std::map< unsigned int, edm::PSimHitContainer > gem_chamber_to_hits_
std::string simInputLabel_
unsigned int trackId() const
T const * product() const
const GeomDet * idToDet(DetId) const override
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.
strips
#turn off noise in all subdetectors simHcalUnsuppressedDigis.doNoise = False mix.digitizers.hcal.doNoise = False simEcalUnsuppressedDigis.doNoise = False mix.digitizers.ecal.doNoise = False simEcalUnsuppressedDigis.doESNoise = False simSiPixelDigis.AddNoise = False mix.digitizers.pixel.AddNoise = False simSiStripDigis.Noise = False mix.digitizers.strip.AddNoise = False
std::map< unsigned int, edm::PSimHitContainer > gem_detid_to_hits_
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