CMS 3D CMS Logo

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< GEMDigiSimLinkGEMDigiSimLinks
 
typedef edm::DetSet< StripDigiSimLinkStripDigiSimLinks
 

Public Member Functions

void fillDigis (int rollDetId, GEMDigiCollection &)
 
const GEMDigiSimLinksgemDigiSimLinks () const
 
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...
 
void addLinksWithPartId (unsigned int strip, int bx)
 
 GEMDigiModel (const edm::ParameterSet &)
 

Protected Attributes

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

Detailed Description

Base Class for the GEM strip response simulation

Author
Sven Dildick

Definition at line 32 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 76 of file GEMDigiModel.h.

Definition at line 37 of file GEMDigiModel.h.

Definition at line 36 of file GEMDigiModel.h.

Constructor & Destructor Documentation

virtual GEMDigiModel::~GEMDigiModel ( )
inlinevirtual

Definition at line 39 of file GEMDigiModel.h.

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

Definition at line 61 of file GEMDigiModel.h.

61 {}

Member Function Documentation

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

creates links from Digi to SimTrack

Definition at line 21 of file GEMDigiModel.cc.

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

Referenced by fillDigis().

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

Definition at line 60 of file GEMDigiModel.cc.

References detectorHitMap_, PSimHit::detUnitId(), PSimHit::energyLoss(), PSimHit::entryPoint(), PSimHit::eventId(), PSimHit::momentumAtEntry(), PSimHit::particleType(), PSimHit::processType(), edm::DetSet< T >::push_back(), theGemDigiSimLinks_, PSimHit::timeOfFlight(), and PSimHit::trackId().

Referenced by fillDigis().

61 {
62 
63  std::pair<unsigned int, int > digi(strip, bx);
64  std::pair<DetectorHitMap::iterator, DetectorHitMap::iterator> channelHitItr
65  = detectorHitMap_.equal_range(digi);
66 
67  for( DetectorHitMap::iterator hitItr = channelHitItr.first; hitItr != channelHitItr.second; ++hitItr)
68  {
69  const PSimHit * hit = (hitItr->second);
70  // might be zero for unit tests and such
71  if (hit == nullptr) continue;
72 
74  hit->particleType(), hit->detUnitId(), hit->trackId(), hit->eventId(), hit->processType()));
75 
76  }
77 }
void push_back(const T &t)
Definition: DetSet.h:68
LocalVector momentumAtEntry() const
The momentum of the track that produced the hit, at entry point.
Definition: PSimHit.h:55
GEMDigiSimLinks theGemDigiSimLinks_
Definition: GEMDigiModel.h:80
float timeOfFlight() const
Definition: PSimHit.h:73
EncodedEventId eventId() const
Definition: PSimHit.h:108
unsigned short processType() const
Definition: PSimHit.h:120
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Definition: PSimHit.h:79
int particleType() const
Definition: PSimHit.h:89
unsigned int trackId() const
Definition: PSimHit.h:106
DetectorHitMap detectorHitMap_
Definition: GEMDigiModel.h:78
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:43
unsigned int detUnitId() const
Definition: PSimHit.h:97
void GEMDigiModel::fillDigis ( int  rollDetId,
GEMDigiCollection digis 
)

Definition at line 5 of file GEMDigiModel.cc.

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

6 {
7  for (const 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  addLinksWithPartId(d.first, d.second);
16  }
17  strips_.clear();
18 }
void addLinks(unsigned int strip, int bx)
creates links from Digi to SimTrack
Definition: GEMDigiModel.cc:21
std::set< std::pair< int, int > > strips_
Definition: GEMDigiModel.h:65
void addLinksWithPartId(unsigned int strip, int bx)
Definition: GEMDigiModel.cc:60
const GEMDigiSimLinks& GEMDigiModel::gemDigiSimLinks ( ) const
inline

Definition at line 57 of file GEMDigiModel.h.

57 {return theGemDigiSimLinks_;}
GEMDigiSimLinks theGemDigiSimLinks_
Definition: GEMDigiModel.h:80
const GEMGeometry* GEMDigiModel::getGeometry ( )
inline

Definition at line 43 of file GEMDigiModel.h.

References GeneralSetup::setup().

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

Definition at line 41 of file GEMDigiModel.h.

References relativeConstraints::geom.

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

Implemented in GEMTrivialModel, and GEMSimpleModel.

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.

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

Implemented in GEMSimpleModel, and GEMTrivialModel.

const StripDigiSimLinks& GEMDigiModel::stripDigiSimLinks ( ) const
inline

Definition at line 56 of file GEMDigiModel.h.

56 {return stripDigiSimLinks_;}
StripDigiSimLinks stripDigiSimLinks_
Definition: GEMDigiModel.h:79

Member Data Documentation

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

Definition at line 63 of file GEMDigiModel.h.

Referenced by GEMSimpleModel::getSimHitBx().

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

Definition at line 80 of file GEMDigiModel.h.

Referenced by addLinksWithPartId(), and GEMSimpleModel::simulateSignal().