9 : theDigiSimLinks(nullptr),
10 theWireDigiSimLinks(nullptr),
11 linksTag(conf.getParameter<edm::
InputTag>(
"CSClinksTag")),
12 wireLinksTag(conf.getParameter<edm::
InputTag>(
"CSCwireLinksTag")),
14 crossingframe(conf.getParameter<bool>(
"crossingframe")),
23 : theDigiSimLinks(nullptr),
24 theWireDigiSimLinks(nullptr),
25 linksTag(conf.getParameter<edm::
InputTag>(
"CSClinksTag")),
26 wireLinksTag(conf.getParameter<edm::
InputTag>(
"CSCwireLinksTag")),
28 crossingframe(conf.getParameter<bool>(
"crossingframe")),
44 LogTrace(
"MuonTruth") <<
"getting CSC Strip DigiSimLink collection - " <<
linksTag;
45 event.getByLabel(
linksTag, digiSimLinks);
71 LogTrace(
"MuonTruth") <<
"... size = " << CSCsimhits->size();
81 LogTrace(
"MuonTruth") <<
"... size = " << CSCsimhits->size();
83 for (edm::PSimHitContainer::const_iterator hitItr = CSCsimhits->begin(); hitItr != CSCsimhits->end(); ++hitItr) {
93 float muonCharge = 0.;
94 for (std::map<SimHitIdpr, float>::const_iterator chargeMapItr =
theChargeMap.begin();
98 muonCharge += chargeMapItr->second;
106 std::vector<PSimHit>
result;
107 for (std::map<SimHitIdpr, float>::const_iterator chargeMapItr =
theChargeMap.begin();
111 result.insert(result.end(), trackHits.begin(), trackHits.end());
118 std::vector<PSimHit>
result;
119 std::vector<PSimHit> allHits =
simHits();
120 std::vector<PSimHit>::const_iterator hitItr = allHits.begin(), lastHit = allHits.end();
122 for (; hitItr != lastHit; ++hitItr) {
123 if (
abs((*hitItr).particleType()) == 13) {
124 result.push_back(*hitItr);
131 std::vector<PSimHit>
result;
135 for (
auto const &
hit :
found->second) {
136 unsigned int hitTrack =
hit.trackId();
139 if (hitTrack == truthId.first && hitEvId == truthId.second) {
140 result.push_back(
hit);
151 result = hits[0].particleType();
161 int nchannels = recHit.
nStrips();
164 for (
int idigi = 0; idigi < nchannels; ++idigi) {
166 int istrip = recHit.
channels(idigi);
167 int channel = laygeom->
channel(istrip);
180 theDetId = rawDetIdCorrespondingToCSCLayer;
191 theDetId = rawDetIdCorrespondingToCSCLayer;
200 int wireDigiInSimulation = wireDigi.
getWireGroup() + 100;
202 addChannel(*layerLinks, wireDigiInSimulation, 1.);
209 for (; linkItr != lastLayerLink; ++linkItr) {
210 int linkChannel = linkItr->channel();
211 if (linkChannel == channel) {
215 SimHitIdpr truthId(linkItr->SimTrackId(), linkItr->eventId());
216 std::map<SimHitIdpr, float>::const_iterator chargeMapItr =
theChargeMap.find(truthId);
std::map< unsigned int, edm::PSimHitContainer > theSimHitMap
std::pair< uint32_t, EncodedEventId > SimHitIdpr
edm::InputTag CSCsimHitsTag
CSCDetId cscDetId() const
iterator find(det_id_type id)
int particleType(SimHitIdpr truthId)
edm::InputTag CSCsimHitsXFTag
edm::InputTag wireLinksTag
constexpr uint32_t rawId() const
get the raw id
const DigiSimLinks * theWireDigiSimLinks
const CSCGeometry * cscgeom
std::map< SimHitIdpr, float > theChargeMap
std::vector< PSimHit > muonHits()
std::vector< PSimHit > simHits()
int channels(unsigned int i) const
Extracting strip channel numbers comprising the rechit - low.
const CSCBadChambers * cscBadChambers
std::vector< PSimHit > hitsFromSimTrack(SimHitIdpr truthId)
unsigned int nStrips() const
Abs< T >::type abs(const T &t)
float adcs(unsigned int strip, unsigned int timebin) const
Map of strip ADCs for strips comprising the rechit.
void analyze(const CSCRecHit2D &recHit)
iterator end()
Return the off-the-end iterator.
int channel(int strip) const
MuonTruth(const edm::Event &, const edm::EventSetup &, const edm::ParameterSet &)
T const * product() const
int getWireGroup() const
default
T const * product() const
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
std::vector< PSimHit > PSimHitContainer
DetId geographicalId() const
float muonFraction()
analyze() must be called before any of the following
const DigiSimLinks * theDigiSimLinks
collection_type::const_iterator const_iterator
collection_type::const_iterator const_iterator
void addChannel(const LayerLinks &layerLinks, int channel, float weight=1.)
void initEvent(const edm::Event &, const edm::EventSetup &)