CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
MuonTruth Class Reference

#include <MuonTruth.h>

Public Types

typedef edm::DetSetVector
< StripDigiSimLink
DigiSimLinks
 
typedef edm::DetSet
< StripDigiSimLink
LayerLinks
 
typedef std::pair< uint32_t,
EncodedEventId
SimHitIdpr
 
typedef edm::DetSetVector
< StripDigiSimLink
WireDigiSimLinks
 

Public Member Functions

void analyze (const CSCRecHit2D &recHit)
 
void analyze (const CSCStripDigi &stripDigi, int rawDetIdCorrespondingToCSCLayer)
 
void analyze (const CSCWireDigi &wireDigi, int rawDetIdCorrespondingToCSCLayer)
 
std::vector< SimHitIdprassociateCSCHitId (const CSCRecHit2D *)
 
std::vector< SimHitIdprassociateHitId (const TrackingRecHit &)
 
float muonFraction ()
 analyze() must be called before any of the following More...
 
std::vector< PSimHitmuonHits ()
 
 MuonTruth (const edm::Event &, const edm::EventSetup &, const edm::ParameterSet &)
 
std::vector< PSimHitsimHits ()
 

Public Attributes

const CSCBadChamberscscBadChambers
 

Private Member Functions

void addChannel (const LayerLinks &layerLinks, int channel, float weight=1.)
 
std::vector< PSimHithitsFromSimTrack (SimHitIdpr truthId)
 
int particleType (SimHitIdpr truthId)
 

Private Attributes

bool crossingframe
 
const CSCGeometrycscgeom
 
edm::InputTag CSCsimHitsTag
 
edm::InputTag CSCsimHitsXFTag
 
edm::InputTag linksTag
 
std::map< SimHitIdpr, float > theChargeMap
 
unsigned int theDetId
 
const DigiSimLinkstheDigiSimLinks
 
std::map< unsigned int,
edm::PSimHitContainer
theSimHitMap
 
float theTotalCharge
 
const DigiSimLinkstheWireDigiSimLinks
 
edm::InputTag wireLinksTag
 

Detailed Description

Definition at line 23 of file MuonTruth.h.

Member Typedef Documentation

Definition at line 26 of file MuonTruth.h.

Definition at line 28 of file MuonTruth.h.

typedef std::pair<uint32_t, EncodedEventId> MuonTruth::SimHitIdpr

Definition at line 29 of file MuonTruth.h.

Definition at line 27 of file MuonTruth.h.

Constructor & Destructor Documentation

MuonTruth::MuonTruth ( const edm::Event event,
const edm::EventSetup setup,
const edm::ParameterSet conf 
)

Definition at line 8 of file MuonTruth.cc.

References MixCollection< T >::begin(), crossingframe, cscBadChambers, cscgeom, CSCsimHitsTag, CSCsimHitsXFTag, edm::EventSetup::get(), edm::InputTag::label(), linksTag, LogTrace, edm::Handle< T >::product(), edm::ESHandle< class >::product(), theDigiSimLinks, theSimHitMap, theWireDigiSimLinks, and wireLinksTag.

8  :
11  linksTag(conf.getParameter<edm::InputTag>("CSClinksTag")),
12  wireLinksTag(conf.getParameter<edm::InputTag>("CSCwireLinksTag")),
13  // CrossingFrame used or not ?
14  crossingframe(conf.getParameter<bool>("crossingframe")),
15  CSCsimHitsTag(conf.getParameter<edm::InputTag>("CSCsimHitsTag")),
16  CSCsimHitsXFTag(conf.getParameter<edm::InputTag>("CSCsimHitsXFTag"))
17 
18 {
19  edm::Handle<DigiSimLinks> digiSimLinks;
20  LogTrace("MuonTruth") <<"getting CSC Strip DigiSimLink collection - "<<linksTag;
21  event.getByLabel(linksTag, digiSimLinks);
22  theDigiSimLinks = digiSimLinks.product();
23 
24  edm::Handle<DigiSimLinks> wireDigiSimLinks;
25  LogTrace("MuonTruth") <<"getting CSC Wire DigiSimLink collection - "<<wireLinksTag;
26  event.getByLabel(wireLinksTag, wireDigiSimLinks);
27  theWireDigiSimLinks = wireDigiSimLinks.product();
28 
29  // get CSC Geometry to use CSCLayer methods
31  setup.get<MuonGeometryRecord>().get( mugeom );
32  cscgeom = &*mugeom;
33 
34  // get CSC Bad Chambers (ME4/2)
36  setup.get<CSCBadChambersRcd>().get(badChambers);
37  cscBadChambers = badChambers.product();
38 
39  theSimHitMap.clear();
40 
41  if (crossingframe) {
42 
44  LogTrace("MuonTruth") <<"getting CrossingFrame<PSimHit> collection - "<<CSCsimHitsXFTag;
45  event.getByLabel(CSCsimHitsXFTag, cf);
46 
47  std::auto_ptr<MixCollection<PSimHit> >
48  CSCsimhits( new MixCollection<PSimHit>(cf.product()) );
49  LogTrace("MuonTruth") <<"... size = "<<CSCsimhits->size();
50 
51  for(MixCollection<PSimHit>::MixItr hitItr = CSCsimhits->begin();
52  hitItr != CSCsimhits->end(); ++hitItr)
53  {
54  theSimHitMap[hitItr->detUnitId()].push_back(*hitItr);
55  }
56 
57  } else if (!CSCsimHitsTag.label().empty()){
58 
60  LogTrace("MuonTruth") <<"getting PSimHit collection - "<<CSCsimHitsTag;
61  event.getByLabel(CSCsimHitsTag, CSCsimhits);
62  LogTrace("MuonTruth") <<"... size = "<<CSCsimhits->size();
63 
64  for(edm::PSimHitContainer::const_iterator hitItr = CSCsimhits->begin();
65  hitItr != CSCsimhits->end(); ++hitItr)
66  {
67  theSimHitMap[hitItr->detUnitId()].push_back(*hitItr);
68  }
69  }
70 }
std::map< unsigned int, edm::PSimHitContainer > theSimHitMap
Definition: MuonTruth.h:71
T getParameter(std::string const &) const
edm::InputTag CSCsimHitsTag
Definition: MuonTruth.h:68
edm::InputTag linksTag
Definition: MuonTruth.h:64
edm::InputTag CSCsimHitsXFTag
Definition: MuonTruth.h:69
edm::InputTag wireLinksTag
Definition: MuonTruth.h:65
const DigiSimLinks * theWireDigiSimLinks
Definition: MuonTruth.h:62
const CSCGeometry * cscgeom
Definition: MuonTruth.h:73
bool crossingframe
Definition: MuonTruth.h:67
const CSCBadChambers * cscBadChambers
Definition: MuonTruth.h:46
#define LogTrace(id)
iterator begin()
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
T const * product() const
Definition: Handle.h:74
std::string const & label() const
Definition: InputTag.h:25
const DigiSimLinks * theDigiSimLinks
Definition: MuonTruth.h:61

Member Function Documentation

void MuonTruth::addChannel ( const LayerLinks layerLinks,
int  channel,
float  weight = 1. 
)
private

Definition at line 289 of file MuonTruth.cc.

References edm::DetSet< T >::begin(), DeDxDiscriminatorTools::charge(), edm::DetSet< T >::end(), theChargeMap, theTotalCharge, and CommonMethods::weight().

Referenced by analyze().

290 {
291  LayerLinks::const_iterator linkItr = layerLinks.begin(),
292  lastLayerLink = layerLinks.end();
293 
294  for ( ; linkItr != lastLayerLink; ++linkItr)
295  {
296  int linkChannel = linkItr->channel();
297  if(linkChannel == channel)
298  {
299  float charge = linkItr->fraction() * weight;
301  // see if it's in the map
302  SimHitIdpr truthId(linkItr->SimTrackId(),linkItr->eventId());
303  std::map<SimHitIdpr, float>::const_iterator chargeMapItr = theChargeMap.find(truthId);
304  if(chargeMapItr == theChargeMap.end())
305  {
306  theChargeMap[truthId] = charge;
307  }
308  else
309  {
310  theChargeMap[truthId] += charge;
311  }
312  }
313  }
314 }
std::map< SimHitIdpr, float > theChargeMap
Definition: MuonTruth.h:56
double charge(const std::vector< uint8_t > &Ampls)
float theTotalCharge
Definition: MuonTruth.h:57
std::pair< uint32_t, EncodedEventId > SimHitIdpr
collection_type::const_iterator const_iterator
Definition: DetSet.h:34
void MuonTruth::analyze ( const CSCRecHit2D recHit)

Definition at line 231 of file MuonTruth.cc.

References CSCRecHit2D::adcs(), addChannel(), CSCLayerGeometry::channel(), CSCRecHit2D::channels(), CSCRecHit2D::cscDetId(), cscgeom, edm::DetSetVector< T >::end(), edm::DetSetVector< T >::find(), TrackingRecHit::geographicalId(), geometry, CSCGeometry::layer(), CSCRecHit2D::nStrips(), DetId::rawId(), theChargeMap, theDetId, theDigiSimLinks, theTotalCharge, and CommonMethods::weight().

Referenced by CSCTruthTest::analyze().

232 {
233  theChargeMap.clear();
234  theTotalCharge = 0.;
235  theDetId = recHit.geographicalId().rawId();
236 
237  int nchannels = recHit.nStrips();
238  const CSCLayerGeometry * laygeom = cscgeom->layer(recHit.cscDetId())->geometry();
239 
240  for(int idigi = 0; idigi < nchannels; ++idigi)
241  {
242  // strip and readout channel numbers may differ in ME1/1A
243  int istrip = recHit.channels(idigi);
244  int channel = laygeom->channel(istrip);
245  float weight = recHit.adcs(idigi,0);//DL: I think this is wrong before and after...seems to assume one time binadcContainer[idigi];
246 
248 
249  if(layerLinks != theDigiSimLinks->end())
250  {
251  addChannel(*layerLinks, channel, weight);
252  }
253  }
254 }
CSCDetId cscDetId() const
Definition: CSCRecHit2D.h:52
iterator find(det_id_type id)
Definition: DetSetVector.h:285
const CSCGeometry * cscgeom
Definition: MuonTruth.h:73
std::map< SimHitIdpr, float > theChargeMap
Definition: MuonTruth.h:56
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
int channels(unsigned int i) const
Extracting strip channel numbers comprising the rechit - low.
Definition: CSCRecHit2D.h:55
unsigned int theDetId
Definition: MuonTruth.h:59
unsigned int nStrips() const
Definition: CSCRecHit2D.h:56
float adcs(unsigned int strip, unsigned int timebin) const
Map of strip ADCs for strips comprising the rechit.
Definition: CSCRecHit2D.h:68
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:356
int channel(int strip) const
float theTotalCharge
Definition: MuonTruth.h:57
ESHandle< TrackerGeometry > geometry
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
Definition: CSCGeometry.cc:123
DetId geographicalId() const
const DigiSimLinks * theDigiSimLinks
Definition: MuonTruth.h:61
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:106
void addChannel(const LayerLinks &layerLinks, int channel, float weight=1.)
Definition: MuonTruth.cc:289
void MuonTruth::analyze ( const CSCStripDigi stripDigi,
int  rawDetIdCorrespondingToCSCLayer 
)

Definition at line 257 of file MuonTruth.cc.

References addChannel(), edm::DetSetVector< T >::end(), edm::DetSetVector< T >::find(), CSCStripDigi::getStrip(), theChargeMap, theDetId, theDigiSimLinks, and theTotalCharge.

258 {
259  theDetId = rawDetIdCorrespondingToCSCLayer;
260  theChargeMap.clear();
261  theTotalCharge = 0.;
262 
264  if(layerLinks != theDigiSimLinks->end())
265  {
266  addChannel(*layerLinks, stripDigi.getStrip(), 1.);
267  }
268 }
iterator find(det_id_type id)
Definition: DetSetVector.h:285
std::map< SimHitIdpr, float > theChargeMap
Definition: MuonTruth.h:56
int getStrip() const
Definition: CSCStripDigi.h:39
unsigned int theDetId
Definition: MuonTruth.h:59
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:356
float theTotalCharge
Definition: MuonTruth.h:57
const DigiSimLinks * theDigiSimLinks
Definition: MuonTruth.h:61
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:106
void addChannel(const LayerLinks &layerLinks, int channel, float weight=1.)
Definition: MuonTruth.cc:289
void MuonTruth::analyze ( const CSCWireDigi wireDigi,
int  rawDetIdCorrespondingToCSCLayer 
)

Definition at line 271 of file MuonTruth.cc.

References addChannel(), edm::DetSetVector< T >::end(), edm::DetSetVector< T >::find(), CSCWireDigi::getWireGroup(), theChargeMap, theDetId, theDigiSimLinks, theTotalCharge, and theWireDigiSimLinks.

272 {
273  theDetId = rawDetIdCorrespondingToCSCLayer;
274  theChargeMap.clear();
275  theTotalCharge = 0.;
276 
278 
279  if(layerLinks != theDigiSimLinks->end())
280  {
281  // In the simulation digis, the channel labels for wires and strips must be distinct, therefore:
282  int wireDigiInSimulation = wireDigi.getWireGroup() + 100;
283  //
284  addChannel(*layerLinks, wireDigiInSimulation, 1.);
285  }
286 }
iterator find(det_id_type id)
Definition: DetSetVector.h:285
const DigiSimLinks * theWireDigiSimLinks
Definition: MuonTruth.h:62
std::map< SimHitIdpr, float > theChargeMap
Definition: MuonTruth.h:56
unsigned int theDetId
Definition: MuonTruth.h:59
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:356
float theTotalCharge
Definition: MuonTruth.h:57
int getWireGroup() const
default
Definition: CSCWireDigi.h:24
const DigiSimLinks * theDigiSimLinks
Definition: MuonTruth.h:61
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:106
void addChannel(const LayerLinks &layerLinks, int channel, float weight=1.)
Definition: MuonTruth.cc:289
std::vector< MuonTruth::SimHitIdpr > MuonTruth::associateCSCHitId ( const CSCRecHit2D cscrechit)

Definition at line 121 of file MuonTruth.cc.

References CSCLayerGeometry::channel(), CSCRecHit2D::channels(), CSCRecHit2D::cscDetId(), cscgeom, edm::DetSetVector< T >::end(), spr::find(), edm::DetSetVector< T >::find(), TrackingRecHit::geographicalId(), geometry, CSCGeometry::layer(), link(), CSCRecHit2D::nStrips(), DetId::rawId(), theDetId, and theDigiSimLinks.

Referenced by MuonAssociatorByHits::getMatchedIds().

121  {
122  std::vector<SimHitIdpr> simtrackids;
123 
124  theDetId = cscrechit->geographicalId().rawId();
125  int nchannels = cscrechit->nStrips();
126  const CSCLayerGeometry * laygeom = cscgeom->layer(cscrechit->cscDetId())->geometry();
127 
129 
130  if (layerLinks != theDigiSimLinks->end()) {
131 
132  for(int idigi = 0; idigi < nchannels; ++idigi) {
133  // strip and readout channel numbers may differ in ME1/1A
134  int istrip = cscrechit->channels(idigi);
135  int channel = laygeom->channel(istrip);
136 
137  for (LayerLinks::const_iterator link=layerLinks->begin(); link!=layerLinks->end(); ++link) {
138  int ch = static_cast<int>(link->channel());
139  if (ch == channel) {
140  SimHitIdpr currentId(link->SimTrackId(), link->eventId());
141  if (find(simtrackids.begin(), simtrackids.end(), currentId) == simtrackids.end())
142  simtrackids.push_back(currentId);
143  }
144  }
145  }
146 
147  } else edm::LogWarning("MuonTruth")
148  <<"*** WARNING in MuonTruth::associateCSCHitId - CSC layer "<<theDetId<<" has no DigiSimLinks !"<<std::endl;
149 
150  return simtrackids;
151 }
CSCDetId cscDetId() const
Definition: CSCRecHit2D.h:52
iterator find(det_id_type id)
Definition: DetSetVector.h:285
const CSCGeometry * cscgeom
Definition: MuonTruth.h:73
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
std::string link(std::string &nm, std::string &ns)
Definition: hierarchy.cc:47
int channels(unsigned int i) const
Extracting strip channel numbers comprising the rechit - low.
Definition: CSCRecHit2D.h:55
unsigned int theDetId
Definition: MuonTruth.h:59
unsigned int nStrips() const
Definition: CSCRecHit2D.h:56
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:356
int channel(int strip) const
std::pair< uint32_t, EncodedEventId > SimHitIdpr
ESHandle< TrackerGeometry > geometry
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
Definition: CSCGeometry.cc:123
DetId geographicalId() const
const DigiSimLinks * theDigiSimLinks
Definition: MuonTruth.h:61
collection_type::const_iterator const_iterator
Definition: DetSet.h:34
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:106
std::vector< MuonTruth::SimHitIdpr > MuonTruth::associateHitId ( const TrackingRecHit hit)

Definition at line 154 of file MuonTruth.cc.

References CSCLayerGeometry::channel(), CSCRecHit2D::channels(), CSCRecHit2D::cscDetId(), cscgeom, edm::DetSetVector< T >::end(), spr::find(), edm::DetSetVector< T >::find(), TrackingRecHit::geographicalId(), geometry, CSCGeometry::layer(), link(), CSCRecHit2D::nStrips(), DetId::rawId(), theDetId, and theDigiSimLinks.

155 {
156  std::vector<SimHitIdpr> simtrackids;
157 
158  const TrackingRecHit * hitp = &hit;
159  const CSCRecHit2D * cscrechit = dynamic_cast<const CSCRecHit2D *>(hitp);
160 
161  if (cscrechit) {
162 
163  theDetId = cscrechit->geographicalId().rawId();
164  int nchannels = cscrechit->nStrips();
165  const CSCLayerGeometry * laygeom = cscgeom->layer(cscrechit->cscDetId())->geometry();
166 
168 
169  if (layerLinks != theDigiSimLinks->end()) {
170 
171  for(int idigi = 0; idigi < nchannels; ++idigi) {
172  // strip and readout channel numbers may differ in ME1/1A
173  int istrip = cscrechit->channels(idigi);
174  int channel = laygeom->channel(istrip);
175 
176  for (LayerLinks::const_iterator link=layerLinks->begin(); link!=layerLinks->end(); ++link) {
177  int ch = static_cast<int>(link->channel());
178  if (ch == channel) {
179  SimHitIdpr currentId(link->SimTrackId(), link->eventId());
180  if (find(simtrackids.begin(), simtrackids.end(), currentId) == simtrackids.end())
181  simtrackids.push_back(currentId);
182  }
183  }
184  }
185 
186  } else edm::LogWarning("MuonTruth")
187  <<"*** WARNING in MuonTruth::associateHitId - CSC layer "<<theDetId<<" has no DigiSimLinks !"<<std::endl;
188 
189  } else edm::LogWarning("MuonTruth")<<"*** WARNING in MuonTruth::associateHitId, null dynamic_cast !";
190 
191  return simtrackids;
192 }
CSCDetId cscDetId() const
Definition: CSCRecHit2D.h:52
iterator find(det_id_type id)
Definition: DetSetVector.h:285
const CSCGeometry * cscgeom
Definition: MuonTruth.h:73
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
std::string link(std::string &nm, std::string &ns)
Definition: hierarchy.cc:47
int channels(unsigned int i) const
Extracting strip channel numbers comprising the rechit - low.
Definition: CSCRecHit2D.h:55
unsigned int theDetId
Definition: MuonTruth.h:59
unsigned int nStrips() const
Definition: CSCRecHit2D.h:56
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:356
int channel(int strip) const
std::pair< uint32_t, EncodedEventId > SimHitIdpr
ESHandle< TrackerGeometry > geometry
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
Definition: CSCGeometry.cc:123
DetId geographicalId() const
const DigiSimLinks * theDigiSimLinks
Definition: MuonTruth.h:61
collection_type::const_iterator const_iterator
Definition: DetSet.h:34
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:106
std::vector< PSimHit > MuonTruth::hitsFromSimTrack ( MuonTruth::SimHitIdpr  truthId)
private

Definition at line 195 of file MuonTruth.cc.

References query::result, theDetId, and theSimHitMap.

Referenced by particleType(), and simHits().

196 {
197  std::vector<PSimHit> result;
199 
200  if (theSimHitMap.find(theDetId) != theSimHitMap.end())
201  hits = theSimHitMap[theDetId];
202 
203  edm::PSimHitContainer::const_iterator hitItr = hits.begin(), lastHit = hits.end();
204 
205  for( ; hitItr != lastHit; ++hitItr)
206  {
207  unsigned int hitTrack = hitItr->trackId();
208  EncodedEventId hitEvId = hitItr->eventId();
209 
210  if(hitTrack == truthId.first && hitEvId == truthId.second)
211  {
212  result.push_back(*hitItr);
213  }
214  }
215  return result;
216 }
std::map< unsigned int, edm::PSimHitContainer > theSimHitMap
Definition: MuonTruth.h:71
unsigned int theDetId
Definition: MuonTruth.h:59
tuple result
Definition: query.py:137
std::vector< PSimHit > PSimHitContainer
float MuonTruth::muonFraction ( )

analyze() must be called before any of the following

Definition at line 72 of file MuonTruth.cc.

References abs, particleType(), theChargeMap, and theTotalCharge.

Referenced by CSCTruthTest::analyze().

73 {
74  if(theChargeMap.size() == 0) return 0.;
75 
76  float muonCharge = 0.;
77  for(std::map<SimHitIdpr, float>::const_iterator chargeMapItr = theChargeMap.begin();
78  chargeMapItr != theChargeMap.end(); ++chargeMapItr)
79  {
80  if( abs(particleType(chargeMapItr->first)) == 13)
81  {
82  muonCharge += chargeMapItr->second;
83  }
84  }
85 
86  return muonCharge / theTotalCharge;
87 }
int particleType(SimHitIdpr truthId)
Definition: MuonTruth.cc:219
#define abs(x)
Definition: mlp_lapack.h:159
std::map< SimHitIdpr, float > theChargeMap
Definition: MuonTruth.h:56
float theTotalCharge
Definition: MuonTruth.h:57
std::vector< PSimHit > MuonTruth::muonHits ( )

Definition at line 104 of file MuonTruth.cc.

References abs, query::result, and simHits().

105 {
106  std::vector<PSimHit> result;
107  std::vector<PSimHit> allHits = simHits();
108  std::vector<PSimHit>::const_iterator hitItr = allHits.begin(), lastHit = allHits.end();
109 
110  for( ; hitItr != lastHit; ++hitItr)
111  {
112  if(abs((*hitItr).particleType()) == 13)
113  {
114  result.push_back(*hitItr);
115  }
116  }
117  return result;
118 }
#define abs(x)
Definition: mlp_lapack.h:159
std::vector< PSimHit > simHits()
Definition: MuonTruth.cc:90
tuple result
Definition: query.py:137
int MuonTruth::particleType ( MuonTruth::SimHitIdpr  truthId)
private

Definition at line 219 of file MuonTruth.cc.

References hitsFromSimTrack(), and query::result.

Referenced by muonFraction().

220 {
221  int result = 0;
222  std::vector<PSimHit> hits = hitsFromSimTrack(truthId);
223  if(!hits.empty())
224  {
225  result = hits[0].particleType();
226  }
227  return result;
228 }
std::vector< PSimHit > hitsFromSimTrack(SimHitIdpr truthId)
Definition: MuonTruth.cc:195
tuple result
Definition: query.py:137
std::vector< PSimHit > MuonTruth::simHits ( )

Definition at line 90 of file MuonTruth.cc.

References hitsFromSimTrack(), query::result, and theChargeMap.

Referenced by muonHits().

91 {
92  std::vector<PSimHit> result;
93  for(std::map<SimHitIdpr, float>::const_iterator chargeMapItr = theChargeMap.begin();
94  chargeMapItr != theChargeMap.end(); ++chargeMapItr)
95  {
96  std::vector<PSimHit> trackHits = hitsFromSimTrack(chargeMapItr->first);
97  result.insert(result.end(), trackHits.begin(), trackHits.end());
98  }
99 
100  return result;
101 }
std::map< SimHitIdpr, float > theChargeMap
Definition: MuonTruth.h:56
std::vector< PSimHit > hitsFromSimTrack(SimHitIdpr truthId)
Definition: MuonTruth.cc:195
tuple result
Definition: query.py:137

Member Data Documentation

bool MuonTruth::crossingframe
private

Definition at line 67 of file MuonTruth.h.

Referenced by MuonTruth().

const CSCBadChambers* MuonTruth::cscBadChambers

Definition at line 46 of file MuonTruth.h.

Referenced by MuonAssociatorByHits::associateSimToRecoIndices(), and MuonTruth().

const CSCGeometry* MuonTruth::cscgeom
private

Definition at line 73 of file MuonTruth.h.

Referenced by analyze(), associateCSCHitId(), associateHitId(), and MuonTruth().

edm::InputTag MuonTruth::CSCsimHitsTag
private

Definition at line 68 of file MuonTruth.h.

Referenced by MuonTruth().

edm::InputTag MuonTruth::CSCsimHitsXFTag
private

Definition at line 69 of file MuonTruth.h.

Referenced by MuonTruth().

edm::InputTag MuonTruth::linksTag
private

Definition at line 64 of file MuonTruth.h.

Referenced by MuonTruth().

std::map<SimHitIdpr, float> MuonTruth::theChargeMap
private

Definition at line 56 of file MuonTruth.h.

Referenced by addChannel(), analyze(), muonFraction(), and simHits().

unsigned int MuonTruth::theDetId
private

Definition at line 59 of file MuonTruth.h.

Referenced by analyze(), associateCSCHitId(), associateHitId(), and hitsFromSimTrack().

const DigiSimLinks* MuonTruth::theDigiSimLinks
private

Definition at line 61 of file MuonTruth.h.

Referenced by analyze(), associateCSCHitId(), associateHitId(), and MuonTruth().

std::map<unsigned int, edm::PSimHitContainer> MuonTruth::theSimHitMap
private

Definition at line 71 of file MuonTruth.h.

Referenced by hitsFromSimTrack(), and MuonTruth().

float MuonTruth::theTotalCharge
private

Definition at line 57 of file MuonTruth.h.

Referenced by addChannel(), analyze(), and muonFraction().

const DigiSimLinks* MuonTruth::theWireDigiSimLinks
private

Definition at line 62 of file MuonTruth.h.

Referenced by analyze(), and MuonTruth().

edm::InputTag MuonTruth::wireLinksTag
private

Definition at line 65 of file MuonTruth.h.

Referenced by MuonTruth().