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"))
20 LogTrace(
"MuonTruth") <<
"getting CSC Strip DigiSimLink collection - "<<
linksTag;
21 event.getByLabel(
linksTag, digiSimLinks);
47 std::auto_ptr<MixCollection<PSimHit> >
49 LogTrace(
"MuonTruth") <<
"... size = "<<CSCsimhits->size();
52 hitItr != CSCsimhits->end(); ++hitItr)
62 LogTrace(
"MuonTruth") <<
"... size = "<<CSCsimhits->size();
64 for(edm::PSimHitContainer::const_iterator hitItr = CSCsimhits->begin();
65 hitItr != CSCsimhits->end(); ++hitItr)
76 float muonCharge = 0.;
77 for(std::map<SimHitIdpr, float>::const_iterator chargeMapItr =
theChargeMap.begin();
82 muonCharge += chargeMapItr->second;
92 std::vector<PSimHit>
result;
93 for(std::map<SimHitIdpr, float>::const_iterator chargeMapItr =
theChargeMap.begin();
97 result.insert(result.end(), trackHits.begin(), trackHits.end());
106 std::vector<PSimHit>
result;
107 std::vector<PSimHit> allHits =
simHits();
108 std::vector<PSimHit>::const_iterator hitItr = allHits.begin(), lastHit = allHits.end();
110 for( ; hitItr != lastHit; ++hitItr)
112 if(
abs((*hitItr).particleType()) == 13)
114 result.push_back(*hitItr);
122 std::vector<SimHitIdpr> simtrackids;
124 theDetId = cscrechit->geographicalId().rawId();
125 int nchannels = cscrechit->nStrips();
132 for(
int idigi = 0; idigi < nchannels; ++idigi) {
134 int istrip = cscrechit->channels(idigi);
135 int channel = laygeom->
channel(istrip);
138 int ch =
static_cast<int>(
link->channel());
141 if (
find(simtrackids.begin(), simtrackids.end(), currentId) == simtrackids.end())
142 simtrackids.push_back(currentId);
148 <<
"*** WARNING in MuonTruth::associateCSCHitId - CSC layer "<<
theDetId<<
" has no DigiSimLinks !"<<std::endl;
156 std::vector<SimHitIdpr> simtrackids;
163 theDetId = cscrechit->geographicalId().rawId();
164 int nchannels = cscrechit->nStrips();
171 for(
int idigi = 0; idigi < nchannels; ++idigi) {
173 int istrip = cscrechit->channels(idigi);
174 int channel = laygeom->
channel(istrip);
177 int ch =
static_cast<int>(
link->channel());
180 if (
find(simtrackids.begin(), simtrackids.end(), currentId) == simtrackids.end())
181 simtrackids.push_back(currentId);
187 <<
"*** WARNING in MuonTruth::associateHitId - CSC layer "<<
theDetId<<
" has no DigiSimLinks !"<<std::endl;
189 }
else edm::LogWarning(
"MuonTruth")<<
"*** WARNING in MuonTruth::associateHitId, null dynamic_cast !";
197 std::vector<PSimHit>
result;
203 edm::PSimHitContainer::const_iterator hitItr = hits.begin(), lastHit = hits.end();
205 for( ; hitItr != lastHit; ++hitItr)
207 unsigned int hitTrack = hitItr->trackId();
210 if(hitTrack == truthId.first && hitEvId == truthId.second)
212 result.push_back(*hitItr);
225 result = hits[0].particleType();
235 theDetId = recHit.geographicalId().rawId();
237 int nchannels = recHit.nStrips();
240 for(
int idigi = 0; idigi < nchannels; ++idigi)
243 int istrip = recHit.channels(idigi);
244 int channel = laygeom->
channel(istrip);
245 float weight = recHit.adcs(idigi,0);
259 theDetId = rawDetIdCorrespondingToCSCLayer;
273 theDetId = rawDetIdCorrespondingToCSCLayer;
282 int wireDigiInSimulation = wireDigi.
getWireGroup() + 100;
284 addChannel(*layerLinks, wireDigiInSimulation, 1.);
292 lastLayerLink = layerLinks.
end();
294 for ( ; linkItr != lastLayerLink; ++linkItr)
296 int linkChannel = linkItr->channel();
297 if(linkChannel == channel)
302 SimHitIdpr truthId(linkItr->SimTrackId(),linkItr->eventId());
303 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="")