CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
ME0DigiModel Class Referenceabstract

#include <ME0DigiModel.h>

Inheritance diagram for ME0DigiModel:
ME0SimpleModel

Public Types

typedef edm::DetSet
< ME0DigiSimLink
ME0DigiSimLinks
 
typedef edm::DetSet
< StripDigiSimLink
StripDigiSimLinks
 

Public Member Functions

void fillDigis (int rollDetId, ME0DigiCollection &)
 
const ME0GeometrygetGeometry ()
 
const ME0DigiSimLinksme0DigiSimLinks () const
 
void setGeometry (const ME0Geometry *geom)
 
virtual void setup ()=0
 
virtual std::vector< std::pair
< int, int > > 
simulateClustering (const ME0EtaPartition *, const PSimHit *, const int, CLHEP::HepRandomEngine *engine)=0
 
virtual void simulateNoise (const ME0EtaPartition *, CLHEP::HepRandomEngine *engine)=0
 
virtual void simulateSignal (const ME0EtaPartition *, const edm::PSimHitContainer &, CLHEP::HepRandomEngine *engine)=0
 
const StripDigiSimLinksstripDigiSimLinks () const
 
virtual ~ME0DigiModel ()
 

Protected Types

typedef std::multimap
< std::pair< unsigned int, int >
, const PSimHit *, std::less
< std::pair< unsigned int, int > > > 
DetectorHitMap
 

Protected Member Functions

void addLinks (unsigned int strip, int bx)
 creates links from Digi to SimTrack More...
 
void addLinksWithPartId (unsigned int strip, int bx)
 
 ME0DigiModel (const edm::ParameterSet &)
 

Protected Attributes

DetectorHitMap detectorHitMap_
 
const ME0Geometrygeometry_
 
StripDigiSimLinks stripDigiSimLinks_
 
std::set< std::pair< int, int > > strips_
 
ME0DigiSimLinks theME0DigiSimLinks_
 

Detailed Description

Base Class for the ME0 strip response simulation

Author
Roumyana Hadjiiska

Definition at line 32 of file ME0DigiModel.h.

Member Typedef Documentation

typedef std::multimap<std::pair<unsigned int, int>, const PSimHit*, std::less<std::pair<unsigned int, int> > > ME0DigiModel::DetectorHitMap
protected

Definition at line 72 of file ME0DigiModel.h.

Definition at line 35 of file ME0DigiModel.h.

Definition at line 34 of file ME0DigiModel.h.

Constructor & Destructor Documentation

virtual ME0DigiModel::~ME0DigiModel ( )
inlinevirtual

Definition at line 37 of file ME0DigiModel.h.

37 {}
ME0DigiModel::ME0DigiModel ( const edm::ParameterSet )
inlineprotected

Definition at line 60 of file ME0DigiModel.h.

60 {}

Member Function Documentation

void ME0DigiModel::addLinks ( unsigned int  strip,
int  bx 
)
protected

creates links from Digi to SimTrack

Definition at line 18 of file ME0DigiModel.cc.

References RecoTauCleanerPlugins::charge, detectorHitMap_, PSimHit::eventId(), validate-o2o-wbm::f, MainPageGenerator::link, edm::DetSet< T >::push_back(), stripDigiSimLinks_, and PSimHit::trackId().

Referenced by fillDigis().

18  {
19  std::pair<unsigned int, int> digi(strip, bx);
20  auto channelHitItr = detectorHitMap_.equal_range(digi);
21 
22  // find the fraction contribution for each SimTrack
23  std::map<int, float> simTrackChargeMap;
24  std::map<int, EncodedEventId> eventIdMap;
25  float totalCharge(0.);
26  for (auto hitItr = channelHitItr.first; hitItr != channelHitItr.second; ++hitItr) {
27  const PSimHit *hit(hitItr->second);
28  // might be zero for unit tests and such
29  if (hit == nullptr)
30  continue;
31 
32  int simTrackId(hit->trackId());
33  //float charge = hit->getCharge();
34  const float charge(1.f);
35  auto chargeItr = simTrackChargeMap.find(simTrackId);
36  if (chargeItr == simTrackChargeMap.end()) {
37  simTrackChargeMap[simTrackId] = charge;
38  eventIdMap[simTrackId] = hit->eventId();
39  } else {
40  chargeItr->second += charge;
41  }
42  totalCharge += charge;
43  }
44 
45  for (const auto &charge : simTrackChargeMap) {
46  const int simTrackId(charge.first);
47  auto link(StripDigiSimLink(strip, simTrackId, eventIdMap[simTrackId], charge.second / totalCharge));
49  }
50 }
void push_back(const T &t)
Definition: DetSet.h:66
StripDigiSimLinks stripDigiSimLinks_
Definition: ME0DigiModel.h:75
DetectorHitMap detectorHitMap_
Definition: ME0DigiModel.h:74
void ME0DigiModel::addLinksWithPartId ( unsigned int  strip,
int  bx 
)
protected

Definition at line 52 of file ME0DigiModel.cc.

References detectorHitMap_, PSimHit::eventId(), PSimHit::particleType(), edm::DetSet< T >::push_back(), theME0DigiSimLinks_, and PSimHit::trackId().

Referenced by fillDigis().

52  {
53  std::pair<unsigned int, int> digi(strip, bx);
54  auto channelHitItr = detectorHitMap_.equal_range(digi);
55  for (auto hitItr = channelHitItr.first; hitItr != channelHitItr.second; ++hitItr) {
56  const PSimHit *hit = (hitItr->second);
57  // might be zero for unit tests and such
58  if (hit == nullptr)
59  continue;
60 
62  }
63 }
void push_back(const T &t)
Definition: DetSet.h:66
EncodedEventId eventId() const
Definition: PSimHit.h:108
ME0DigiSimLinks theME0DigiSimLinks_
Definition: ME0DigiModel.h:76
int particleType() const
Definition: PSimHit.h:89
unsigned int trackId() const
Definition: PSimHit.h:106
DetectorHitMap detectorHitMap_
Definition: ME0DigiModel.h:74
void ME0DigiModel::fillDigis ( int  rollDetId,
ME0DigiCollection digis 
)

Definition at line 4 of file ME0DigiModel.cc.

References addLinks(), addLinksWithPartId(), ztail::d, and strips_.

4  {
5  for (const auto &d : strips_) {
6  if (d.second == -999)
7  continue;
8 
9  // (strip, bx)
10  ME0Digi digi(d.first, d.second);
11  digis.insertDigi(ME0DetId(rollDetId), digi);
12  addLinks(d.first, d.second);
13  addLinksWithPartId(d.first, d.second);
14  }
15  strips_.clear();
16 }
void addLinks(unsigned int strip, int bx)
creates links from Digi to SimTrack
Definition: ME0DigiModel.cc:18
tuple d
Definition: ztail.py:151
void addLinksWithPartId(unsigned int strip, int bx)
Definition: ME0DigiModel.cc:52
std::set< std::pair< int, int > > strips_
Definition: ME0DigiModel.h:64
const ME0Geometry* ME0DigiModel::getGeometry ( )
inline

Definition at line 41 of file ME0DigiModel.h.

References geometry_.

41 { return geometry_; }
const ME0Geometry * geometry_
Definition: ME0DigiModel.h:62
const ME0DigiSimLinks& ME0DigiModel::me0DigiSimLinks ( ) const
inline

Definition at line 57 of file ME0DigiModel.h.

References theME0DigiSimLinks_.

57 { return theME0DigiSimLinks_; }
ME0DigiSimLinks theME0DigiSimLinks_
Definition: ME0DigiModel.h:76
void ME0DigiModel::setGeometry ( const ME0Geometry geom)
inline

Definition at line 39 of file ME0DigiModel.h.

References relativeConstraints::geom, and geometry_.

39 { geometry_ = geom; }
const ME0Geometry * geometry_
Definition: ME0DigiModel.h:62
virtual void ME0DigiModel::setup ( )
pure virtual

Implemented in ME0SimpleModel.

virtual std::vector<std::pair<int, int> > ME0DigiModel::simulateClustering ( const ME0EtaPartition ,
const PSimHit ,
const int  ,
CLHEP::HepRandomEngine *  engine 
)
pure virtual

Implemented in ME0SimpleModel.

virtual void ME0DigiModel::simulateNoise ( const ME0EtaPartition ,
CLHEP::HepRandomEngine *  engine 
)
pure virtual

Implemented in ME0SimpleModel.

virtual void ME0DigiModel::simulateSignal ( const ME0EtaPartition ,
const edm::PSimHitContainer ,
CLHEP::HepRandomEngine *  engine 
)
pure virtual

Implemented in ME0SimpleModel.

const StripDigiSimLinks& ME0DigiModel::stripDigiSimLinks ( ) const
inline

Definition at line 56 of file ME0DigiModel.h.

References stripDigiSimLinks_.

56 { return stripDigiSimLinks_; }
StripDigiSimLinks stripDigiSimLinks_
Definition: ME0DigiModel.h:75

Member Data Documentation

DetectorHitMap ME0DigiModel::detectorHitMap_
protected

Definition at line 74 of file ME0DigiModel.h.

Referenced by addLinks(), addLinksWithPartId(), and ME0SimpleModel::simulateSignal().

const ME0Geometry* ME0DigiModel::geometry_
protected

Definition at line 62 of file ME0DigiModel.h.

Referenced by getGeometry(), ME0SimpleModel::getSimHitBx(), and setGeometry().

StripDigiSimLinks ME0DigiModel::stripDigiSimLinks_
protected

Definition at line 75 of file ME0DigiModel.h.

Referenced by addLinks(), ME0SimpleModel::simulateSignal(), and stripDigiSimLinks().

std::set<std::pair<int, int> > ME0DigiModel::strips_
protected
ME0DigiSimLinks ME0DigiModel::theME0DigiSimLinks_
protected