10 theWireDigiSimLinks(0),
11 linksTag(conf.getParameter<
edm::InputTag>(
"CSClinksTag")),
12 wireLinksTag(conf.getParameter<
edm::InputTag>(
"CSCwireLinksTag")),
25 linksTag(conf.getParameter<
edm::InputTag>(
"CSClinksTag")),
46 LogTrace(
"MuonTruth") <<
"getting CSC Strip DigiSimLink collection - "<<
linksTag;
47 event.getByLabel(
linksTag, digiSimLinks);
73 std::unique_ptr<MixCollection<PSimHit> >
75 LogTrace(
"MuonTruth") <<
"... size = "<<CSCsimhits->size();
78 hitItr != CSCsimhits->end(); ++hitItr)
88 LogTrace(
"MuonTruth") <<
"... size = "<<CSCsimhits->size();
90 for(edm::PSimHitContainer::const_iterator hitItr = CSCsimhits->begin();
91 hitItr != CSCsimhits->end(); ++hitItr)
102 float muonCharge = 0.;
103 for(std::map<SimHitIdpr, float>::const_iterator chargeMapItr =
theChargeMap.begin();
108 muonCharge += chargeMapItr->second;
118 std::vector<PSimHit>
result;
119 for(std::map<SimHitIdpr, float>::const_iterator chargeMapItr =
theChargeMap.begin();
123 result.insert(result.end(), trackHits.begin(), trackHits.end());
132 std::vector<PSimHit>
result;
133 std::vector<PSimHit> allHits =
simHits();
134 std::vector<PSimHit>::const_iterator hitItr = allHits.begin(), lastHit = allHits.end();
136 for( ; hitItr != lastHit; ++hitItr)
138 if(
abs((*hitItr).particleType()) == 13)
140 result.push_back(*hitItr);
150 std::vector<PSimHit>
result;
157 unsigned int hitTrack =
hit.trackId();
160 if(hitTrack == truthId.first && hitEvId == truthId.second)
162 result.push_back(
hit);
176 result = hits[0].particleType();
188 int nchannels = recHit.
nStrips();
191 for(
int idigi = 0; idigi < nchannels; ++idigi)
194 int istrip = recHit.
channels(idigi);
195 int channel = laygeom->
channel(istrip);
210 theDetId = rawDetIdCorrespondingToCSCLayer;
224 theDetId = rawDetIdCorrespondingToCSCLayer;
233 int wireDigiInSimulation = wireDigi.
getWireGroup() + 100;
235 addChannel(*layerLinks, wireDigiInSimulation, 1.);
243 lastLayerLink = layerLinks.
end();
245 for ( ; linkItr != lastLayerLink; ++linkItr)
247 int linkChannel = linkItr->channel();
248 if(linkChannel == channel)
253 SimHitIdpr truthId(linkItr->SimTrackId(),linkItr->eventId());
254 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
def setup(process, global_tag, zero_tesla=False)
const DigiSimLinks * theWireDigiSimLinks
const CSCGeometry * cscgeom
std::map< SimHitIdpr, float > theChargeMap
std::vector< PSimHit > muonHits()
std::vector< PSimHit > simHits()
uint32_t rawId() const
get the raw id
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
ESHandle< TrackerGeometry > geometry
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
T const * product() const
void addChannel(const LayerLinks &layerLinks, int channel, float weight=1.)
void initEvent(const edm::Event &, const edm::EventSetup &)