10 theWireDigiSimLinks(0),
11 linksTag(conf.getParameter<edm::InputTag>(
"CSClinksTag")),
12 wireLinksTag(conf.getParameter<edm::InputTag>(
"CSCwireLinksTag")),
14 crossingframe(conf.getParameter<bool>(
"crossingframe")),
15 CSCsimHitsTag(conf.getParameter<edm::InputTag>(
"CSCsimHitsTag")),
16 CSCsimHitsXFTag(conf.getParameter<edm::InputTag>(
"CSCsimHitsXFTag"))
24 theWireDigiSimLinks(0),
25 linksTag(conf.getParameter<edm::InputTag>(
"CSClinksTag")),
26 wireLinksTag(conf.getParameter<edm::InputTag>(
"CSCwireLinksTag")),
28 crossingframe(conf.getParameter<bool>(
"crossingframe")),
29 CSCsimHitsTag(conf.getParameter<edm::InputTag>(
"CSCsimHitsTag")),
30 CSCsimHitsXFTag(conf.getParameter<edm::InputTag>(
"CSCsimHitsXFTag"))
46 LogTrace(
"MuonTruth") <<
"getting CSC Strip DigiSimLink collection - "<<
linksTag;
47 event.getByLabel(
linksTag, digiSimLinks);
73 std::auto_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);
148 std::vector<SimHitIdpr> simtrackids;
150 theDetId = cscrechit->geographicalId().rawId();
151 int nchannels = cscrechit->nStrips();
158 for(
int idigi = 0; idigi < nchannels; ++idigi) {
160 int istrip = cscrechit->channels(idigi);
161 int channel = laygeom->
channel(istrip);
164 int ch =
static_cast<int>(
link->channel());
167 if (
find(simtrackids.begin(), simtrackids.end(), currentId) == simtrackids.end())
168 simtrackids.push_back(currentId);
174 <<
"*** WARNING in MuonTruth::associateCSCHitId - CSC layer "<<
theDetId<<
" has no DigiSimLinks !"<<std::endl;
182 std::vector<SimHitIdpr> simtrackids;
189 theDetId = cscrechit->geographicalId().rawId();
190 int nchannels = cscrechit->nStrips();
197 for(
int idigi = 0; idigi < nchannels; ++idigi) {
199 int istrip = cscrechit->channels(idigi);
200 int channel = laygeom->
channel(istrip);
203 int ch =
static_cast<int>(
link->channel());
206 if (
find(simtrackids.begin(), simtrackids.end(), currentId) == simtrackids.end())
207 simtrackids.push_back(currentId);
213 <<
"*** WARNING in MuonTruth::associateHitId - CSC layer "<<
theDetId<<
" has no DigiSimLinks !"<<std::endl;
215 }
else edm::LogWarning(
"MuonTruth")<<
"*** WARNING in MuonTruth::associateHitId, null dynamic_cast !";
223 std::vector<PSimHit>
result;
229 edm::PSimHitContainer::const_iterator hitItr = hits.begin(), lastHit = hits.end();
231 for( ; hitItr != lastHit; ++hitItr)
233 unsigned int hitTrack = hitItr->trackId();
236 if(hitTrack == truthId.first && hitEvId == truthId.second)
238 result.push_back(*hitItr);
251 result = hits[0].particleType();
261 theDetId = recHit.geographicalId().rawId();
263 int nchannels = recHit.nStrips();
266 for(
int idigi = 0; idigi < nchannels; ++idigi)
269 int istrip = recHit.channels(idigi);
270 int channel = laygeom->
channel(istrip);
271 float weight = recHit.adcs(idigi,0);
285 theDetId = rawDetIdCorrespondingToCSCLayer;
299 theDetId = rawDetIdCorrespondingToCSCLayer;
308 int wireDigiInSimulation = wireDigi.
getWireGroup() + 100;
310 addChannel(*layerLinks, wireDigiInSimulation, 1.);
318 lastLayerLink = layerLinks.
end();
320 for ( ; linkItr != lastLayerLink; ++linkItr)
322 int linkChannel = linkItr->channel();
323 if(linkChannel == channel)
328 SimHitIdpr truthId(linkItr->SimTrackId(),linkItr->eventId());
329 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
iterator find(det_id_type id)
int particleType(SimHitIdpr truthId)
edm::InputTag CSCsimHitsXFTag
edm::InputTag wireLinksTag
const DigiSimLinks * theWireDigiSimLinks
const CSCGeometry * cscgeom
std::map< SimHitIdpr, float > theChargeMap
std::vector< SimHitIdpr > associateHitId(const TrackingRecHit &)
std::vector< PSimHit > muonHits()
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< PSimHit > simHits()
std::string link(std::string &nm, std::string &ns)
const CSCBadChambers * cscBadChambers
std::vector< PSimHit > hitsFromSimTrack(SimHitIdpr truthId)
std::vector< SimHitIdpr > associateCSCHitId(const CSCRecHit2D *)
Abs< T >::type abs(const T &t)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
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 &)
int getWireGroup() const
default
T const * product() const
T const * product() const
ESHandle< TrackerGeometry > geometry
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
std::vector< PSimHit > PSimHitContainer
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 setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void initEvent(const edm::Event &, const edm::EventSetup &)