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
GEMSim Class Referenceabstract

#include <GEMSim.h>

Inheritance diagram for GEMSim:
GEMSimAverage GEMSimTriv

Public Types

typedef edm::DetSet
< StripDigiSimLink
StripDigiSimLinks
 

Public Member Functions

virtual void fillDigis (int rollDetId, GEMDigiCollection &digis)
 
GEMSimSetUpgetGEMSimSetUp ()
 
void setGEMSimSetUp (GEMSimSetUp *setup)
 
virtual void setRandomEngine (CLHEP::HepRandomEngine &eng)=0
 
virtual void simulate (const GEMEtaPartition *roll, const edm::PSimHitContainer &rpcHits)=0
 
virtual void simulateNoise (const GEMEtaPartition *roll)=0
 
const StripDigiSimLinksstripDigiSimLinks () const
 
virtual ~GEMSim ()
 

Protected Types

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

Protected Member Functions

virtual void addLinks (unsigned int strip, int bx)
 
 GEMSim (const edm::ParameterSet &config)
 
virtual void init ()=0
 

Protected Attributes

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

Detailed Description

Base Class for the GEM strip response simulation

Author
Vadim Khotilovich

Definition at line 26 of file GEMSim.h.

Member Typedef Documentation

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

Definition at line 65 of file GEMSim.h.

Definition at line 30 of file GEMSim.h.

Constructor & Destructor Documentation

virtual GEMSim::~GEMSim ( )
inlinevirtual

Definition at line 32 of file GEMSim.h.

32 {}
GEMSim::GEMSim ( const edm::ParameterSet config)
inlineprotected

Definition at line 50 of file GEMSim.h.

50 {}

Member Function Documentation

void GEMSim::addLinks ( unsigned int  strip,
int  bx 
)
protectedvirtual

creates links from Digi to SimTrack disabled for now

Definition at line 21 of file GEMSim.cc.

References DeDxDiscriminatorTools::charge(), detectorHitMap_, PSimHit::eventId(), 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(auto &charge: simTrackChargeMap)
53  {
54  int simTrackId = charge.first;
56  StripDigiSimLink(strip, simTrackId, eventIdMap[simTrackId], charge.second/totalCharge ));
57  }
58 }
void push_back(const T &t)
Definition: DetSet.h:69
DetectorHitMap detectorHitMap_
Definition: GEMSim.h:67
double charge(const std::vector< uint8_t > &Ampls)
EncodedEventId eventId() const
Definition: PSimHit.h:105
unsigned int trackId() const
Definition: PSimHit.h:102
StripDigiSimLinks stripDigiSimLinks_
Definition: GEMSim.h:68
void GEMSim::fillDigis ( int  rollDetId,
GEMDigiCollection digis 
)
virtual

Definition at line 6 of file GEMSim.cc.

References addLinks(), and strips_.

Referenced by GEMDigitizer::digitize().

7 {
8  for (auto d: strips_)
9  {
10  if (d.second != -999)
11  {
12  GEMDigi digi(d.first, d.second); // (strip, bx)
13  digis.insertDigi(GEMDetId(rollDetId), digi);
14  addLinks(d.first, d.second);
15  }
16  }
17  strips_.clear();
18 }
std::set< std::pair< int, int > > strips_
Definition: GEMSim.h:54
virtual void addLinks(unsigned int strip, int bx)
Definition: GEMSim.cc:21
GEMSimSetUp* GEMSim::getGEMSimSetUp ( )
inline

Definition at line 44 of file GEMSim.h.

References simSetUp_.

Referenced by GEMSimAverage::simulate().

44 { return simSetUp_; }
GEMSimSetUp * simSetUp_
Definition: GEMSim.h:70
virtual void GEMSim::init ( )
protectedpure virtual

Implemented in GEMSimAverage, and GEMSimTriv.

void GEMSim::setGEMSimSetUp ( GEMSimSetUp setup)
inline

Definition at line 42 of file GEMSim.h.

References HcalObjRepresent::setup(), and simSetUp_.

Referenced by GEMDigitizer::digitize().

42 { simSetUp_ = setup; }
GEMSimSetUp * simSetUp_
Definition: GEMSim.h:70
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
virtual void GEMSim::setRandomEngine ( CLHEP::HepRandomEngine &  eng)
pure virtual

Implemented in GEMSimAverage, and GEMSimTriv.

virtual void GEMSim::simulate ( const GEMEtaPartition roll,
const edm::PSimHitContainer rpcHits 
)
pure virtual

Implemented in GEMSimAverage, and GEMSimTriv.

Referenced by GEMDigitizer::digitize().

virtual void GEMSim::simulateNoise ( const GEMEtaPartition roll)
pure virtual

Implemented in GEMSimAverage, and GEMSimTriv.

Referenced by GEMDigitizer::digitize().

const StripDigiSimLinks& GEMSim::stripDigiSimLinks ( ) const
inline

Definition at line 46 of file GEMSim.h.

References stripDigiSimLinks_.

Referenced by GEMDigitizer::digitize().

46 { return stripDigiSimLinks_; }
StripDigiSimLinks stripDigiSimLinks_
Definition: GEMSim.h:68

Member Data Documentation

DetectorHitMap GEMSim::detectorHitMap_
protected

Definition at line 67 of file GEMSim.h.

Referenced by addLinks(), GEMSimTriv::simulate(), and GEMSimAverage::simulate().

GEMSimSetUp* GEMSim::simSetUp_
protected

Definition at line 70 of file GEMSim.h.

Referenced by getGEMSimSetUp(), and setGEMSimSetUp().

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