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 | Protected Types | Protected Member Functions | Protected Attributes
GEMDigiModel Class Referenceabstract

#include <GEMDigiModel.h>

Inheritance diagram for GEMDigiModel:
GEMSimpleModel GEMTrivialModel

Public Types

typedef edm::DetSet
< StripDigiSimLink
StripDigiSimLinks
 

Public Member Functions

void fillDigis (int rollDetId, GEMDigiCollection &)
 
const GEMGeometrygetGeometry ()
 
void setGeometry (const GEMGeometry *geom)
 
virtual void setup ()=0
 
virtual std::vector< std::pair
< int, int > > 
simulateClustering (const GEMEtaPartition *, const PSimHit *, const int, CLHEP::HepRandomEngine *engine)=0
 
virtual void simulateNoise (const GEMEtaPartition *, CLHEP::HepRandomEngine *engine)=0
 
virtual void simulateSignal (const GEMEtaPartition *, const edm::PSimHitContainer &, CLHEP::HepRandomEngine *engine)=0
 
const StripDigiSimLinksstripDigiSimLinks () const
 
virtual ~GEMDigiModel ()
 

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...
 
 GEMDigiModel (const edm::ParameterSet &)
 

Protected Attributes

DetectorHitMap detectorHitMap_
 
const GEMGeometrygeometry_
 
StripDigiSimLinks stripDigiSimLinks_
 
std::set< std::pair< int, int > > strips_
 

Detailed Description

Base Class for the GEM strip response simulation

Author
Sven Dildick

Definition at line 31 of file GEMDigiModel.h.

Member Typedef Documentation

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

Definition at line 72 of file GEMDigiModel.h.

Definition at line 35 of file GEMDigiModel.h.

Constructor & Destructor Documentation

virtual GEMDigiModel::~GEMDigiModel ( )
inlinevirtual

Definition at line 37 of file GEMDigiModel.h.

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

Definition at line 58 of file GEMDigiModel.h.

58 {}

Member Function Documentation

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

creates links from Digi to SimTrack

Definition at line 20 of file GEMDigiModel.cc.

References DeDxDiscriminatorTools::charge(), detectorHitMap_, PSimHit::eventId(), f, link(), edm::DetSet< T >::push_back(), stripDigiSimLinks_, and PSimHit::trackId().

Referenced by fillDigis().

21 {
22  std::pair<unsigned int, int> digi(strip, bx);
23  auto channelHitItr = detectorHitMap_.equal_range(digi);
24 
25  // find the fraction contribution for each SimTrack
26  std::map<int, float> simTrackChargeMap;
27  std::map<int, EncodedEventId> eventIdMap;
28  float totalCharge(0.);
29  for(auto hitItr = channelHitItr.first; hitItr != channelHitItr.second; ++hitItr)
30  {
31  const PSimHit * hit(hitItr->second);
32  // might be zero for unit tests and such
33  if(hit == nullptr) continue;
34 
35  int simTrackId(hit->trackId());
36  //float charge = hit->getCharge();
37  const float charge(1.f);
38  auto chargeItr = simTrackChargeMap.find(simTrackId);
39  if( chargeItr == simTrackChargeMap.end() )
40  {
41  simTrackChargeMap[simTrackId] = charge;
42  eventIdMap[simTrackId] = hit->eventId();
43  }
44  else
45  {
46  chargeItr->second += charge;
47  }
48  totalCharge += charge;
49  }
50 
51  for(auto &charge: simTrackChargeMap)
52  {
53  const int simTrackId(charge.first);
54  auto link(StripDigiSimLink(strip, simTrackId, eventIdMap[simTrackId], charge.second/totalCharge));
56  }
57 }
void push_back(const T &t)
Definition: DetSet.h:68
double charge(const std::vector< uint8_t > &Ampls)
std::string link(std::string &nm, std::string &ns)
Definition: hierarchy.cc:24
double f[11][100]
string bx
Definition: rpc-layouts.py:13
DetectorHitMap detectorHitMap_
Definition: GEMDigiModel.h:74
StripDigiSimLinks stripDigiSimLinks_
Definition: GEMDigiModel.h:75
void GEMDigiModel::fillDigis ( int  rollDetId,
GEMDigiCollection digis 
)

Definition at line 5 of file GEMDigiModel.cc.

References addLinks(), and strips_.

Referenced by GEMDigiProducer::produce().

6 {
7  for (auto d: strips_)
8  {
9  if (d.second == -999) continue;
10 
11  // (strip, bx)
12  GEMDigi digi(d.first, d.second);
13  digis.insertDigi(GEMDetId(rollDetId), digi);
14  addLinks(d.first, d.second);
15  }
16  strips_.clear();
17 }
void addLinks(unsigned int strip, int bx)
creates links from Digi to SimTrack
Definition: GEMDigiModel.cc:20
std::set< std::pair< int, int > > strips_
Definition: GEMDigiModel.h:62
const GEMGeometry* GEMDigiModel::getGeometry ( )
inline

Definition at line 41 of file GEMDigiModel.h.

References geometry_.

Referenced by GEMDigiProducer::produce().

41 {return geometry_;}
const GEMGeometry * geometry_
Definition: GEMDigiModel.h:60
void GEMDigiModel::setGeometry ( const GEMGeometry geom)
inline

Definition at line 39 of file GEMDigiModel.h.

References relativeConstraints::geom, and geometry_.

Referenced by GEMDigiProducer::beginRun().

39 {geometry_ = geom;}
const GEMGeometry * geometry_
Definition: GEMDigiModel.h:60
virtual void GEMDigiModel::setup ( )
pure virtual

Implemented in GEMTrivialModel, and GEMSimpleModel.

Referenced by GEMDigiProducer::beginRun().

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

Implemented in GEMSimpleModel, and GEMTrivialModel.

virtual void GEMDigiModel::simulateNoise ( const GEMEtaPartition ,
CLHEP::HepRandomEngine *  engine 
)
pure virtual

Implemented in GEMSimpleModel, and GEMTrivialModel.

Referenced by GEMDigiProducer::produce().

virtual void GEMDigiModel::simulateSignal ( const GEMEtaPartition ,
const edm::PSimHitContainer ,
CLHEP::HepRandomEngine *  engine 
)
pure virtual

Implemented in GEMSimpleModel, and GEMTrivialModel.

Referenced by GEMDigiProducer::produce().

const StripDigiSimLinks& GEMDigiModel::stripDigiSimLinks ( ) const
inline

Definition at line 54 of file GEMDigiModel.h.

References stripDigiSimLinks_.

Referenced by GEMDigiProducer::produce().

54 {return stripDigiSimLinks_;}
StripDigiSimLinks stripDigiSimLinks_
Definition: GEMDigiModel.h:75

Member Data Documentation

DetectorHitMap GEMDigiModel::detectorHitMap_
protected
const GEMGeometry* GEMDigiModel::geometry_
protected

Definition at line 60 of file GEMDigiModel.h.

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

StripDigiSimLinks GEMDigiModel::stripDigiSimLinks_
protected
std::set< std::pair<int, int> > GEMDigiModel::strips_
protected