CMS 3D CMS Logo

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

#include <RPCSimParam.h>

Inheritance diagram for RPCSimParam:
RPCSim

Public Member Functions

 RPCSimParam (const edm::ParameterSet &config)
 
void simulate (const RPCRoll *roll, const edm::PSimHitContainer &rpcHits, CLHEP::HepRandomEngine *) override
 
void simulateNoise (const RPCRoll *, CLHEP::HepRandomEngine *) override
 
 ~RPCSimParam ()
 
- Public Member Functions inherited from RPCSim
const DigiSimLinksdigiSimLinks () const
 
virtual void fillDigis (int rollDetId, RPCDigiCollection &digis)
 
RPCSimSetUpgetRPCSimSetUp ()
 
const RPCDigiSimLinksrpcDigiSimLinks () const
 
void setRPCSimSetUp (RPCSimSetUp *setup)
 
virtual ~RPCSim ()
 

Private Member Functions

void init ()
 

Private Attributes

RPCSynchronizer_rpcSync
 
double aveCls
 
double aveEff
 
double dtimCs
 
double gate
 
double lbGate
 
int N_hits
 
int nbxing
 
double rate
 
double resEle
 
double resRPC
 
bool rpcdigiprint
 
double sspeed
 
double timOff
 

Additional Inherited Members

- Public Types inherited from RPCSim
typedef edm::DetSet
< StripDigiSimLink
DigiSimLinks
 
typedef edm::DetSet
< RPCDigiSimLink
RPCDigiSimLinks
 
- Protected Types inherited from RPCSim
typedef std::multimap
< std::pair< unsigned int, int >
, const PSimHit *, std::less
< std::pair< unsigned int, int > > > 
DetectorHitMap
 
- Protected Member Functions inherited from RPCSim
virtual void addLinks (unsigned int strip, int bx)
 
 RPCSim (const edm::ParameterSet &config)
 
- Protected Attributes inherited from RPCSim
std::set< std::pair< int, int > > strips
 
DetectorHitMap theDetectorHitMap
 
DigiSimLinks theDigiSimLinks
 
RPCDigiSimLinks theRpcDigiSimLinks
 
RPCSimSetUptheSimSetUp
 

Detailed Description

Class for the RPC strip response simulation based on a parametrized model (ORCA-based)

Author
Marcello Maggi – INFN Bari

Definition at line 20 of file RPCSimParam.h.

Constructor & Destructor Documentation

RPCSimParam::RPCSimParam ( const edm::ParameterSet config)

Definition at line 12 of file RPCSimParam.cc.

References _rpcSync, aveCls, aveEff, gather_cfg::cout, dtimCs, gate, edm::ParameterSet::getParameter(), lbGate, nbxing, rate, resEle, resRPC, rpcdigiprint, sspeed, and timOff.

12  : RPCSim(config){
13  aveEff = config.getParameter<double>("averageEfficiency");
14  aveCls = config.getParameter<double>("averageClusterSize");
15  resRPC = config.getParameter<double>("timeResolution");
16  timOff = config.getParameter<double>("timingRPCOffset");
17  dtimCs = config.getParameter<double>("deltatimeAdjacentStrip");
18  resEle = config.getParameter<double>("timeJitter");
19  sspeed = config.getParameter<double>("signalPropagationSpeed");
20  lbGate = config.getParameter<double>("linkGateWidth");
21  rpcdigiprint = config.getParameter<bool>("printOutDigitizer");
22 
23  rate=config.getParameter<double>("Rate");
24  nbxing=config.getParameter<int>("Nbxing");
25  gate=config.getParameter<double>("Gate");
26 
27  if (rpcdigiprint) {
28  std::cout <<"Average Efficiency = "<<aveEff<<std::endl;
29  std::cout <<"Average Cluster Size = "<<aveCls<<" strips"<<std::endl;
30  std::cout <<"RPC Time Resolution = "<<resRPC<<" ns"<<std::endl;
31  std::cout <<"RPC Signal formation time = "<<timOff<<" ns"<<std::endl;
32  std::cout <<"RPC adjacent strip delay = "<<dtimCs<<" ns"<<std::endl;
33  std::cout <<"Electronic Jitter = "<<resEle<<" ns"<<std::endl;
34  std::cout <<"Signal propagation time = "<<sspeed<<" x c"<<std::endl;
35  std::cout <<"Link Board Gate Width = "<<lbGate<<" ns"<<std::endl;
36  }
37 
38  _rpcSync = new RPCSynchronizer(config);
39 }
bool rpcdigiprint
Definition: RPCSimParam.h:44
double resEle
Definition: RPCSimParam.h:41
T getParameter(std::string const &) const
double aveEff
Definition: RPCSimParam.h:34
double gate
Definition: RPCSimParam.h:49
double aveCls
Definition: RPCSimParam.h:37
double resRPC
Definition: RPCSimParam.h:38
double dtimCs
Definition: RPCSimParam.h:40
double timOff
Definition: RPCSimParam.h:39
RPCSim(const edm::ParameterSet &config)
Definition: RPCSim.cc:5
double lbGate
Definition: RPCSimParam.h:43
tuple cout
Definition: gather_cfg.py:121
RPCSynchronizer * _rpcSync
Definition: RPCSimParam.h:51
double rate
Definition: RPCSimParam.h:48
double sspeed
Definition: RPCSimParam.h:42
RPCSimParam::~RPCSimParam ( )

Definition at line 41 of file RPCSimParam.cc.

References _rpcSync.

41  {
42  delete _rpcSync;
43 }
RPCSynchronizer * _rpcSync
Definition: RPCSimParam.h:51

Member Function Documentation

void RPCSimParam::init ( void  )
inlineprivatevirtual

Implements RPCSim.

Definition at line 34 of file RPCSimParam.h.

34 {};
void RPCSimParam::simulate ( const RPCRoll roll,
const edm::PSimHitContainer rpcHits,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

Implements RPCSim.

Definition at line 47 of file RPCSimParam.cc.

References _rpcSync, aveCls, aveEff, RPCRoll::centreOfStrip(), GetRecoTauVFromDQM_MC_cff::cl, edm::DetSet< T >::clear(), alignCSCRings::e, RPCSim::getRPCSimSetUp(), RPCSynchronizer::getSimHitBx(), i, RPCRoll::id(), cmsBatch::log, RPCRoll::nstrips(), DetId::rawId(), RPCSynchronizer::setRPCSimSetUp(), RPCRoll::specs(), RPCSim::strips, RPCSim::theDetectorHitMap, RPCSim::theRpcDigiSimLinks, RPCRollSpecs::topology(), ecaldqm::topology(), w, and PV3DBase< T, PVType, FrameType >::x().

50 {
53  theDetectorHitMap.clear();
55 
56  const Topology& topology=roll->specs()->topology();
57 
58  for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
59  _hit != rpcHits.end(); ++_hit){
60 
61  // Here I hould check if the RPC are up side down;
62  const LocalPoint& entr=_hit->entryPoint();
63  int time_hit = _rpcSync->getSimHitBx(&(*_hit), engine);
64 
65  // Effinciecy
66  float eff = CLHEP::RandFlat::shoot(engine);
67  if (eff < aveEff) {
68 
69  int centralStrip = topology.channel(entr)+1;
70  int fstrip=centralStrip;
71  int lstrip=centralStrip;
72  // Compute the cluster size
73  double w = CLHEP::RandFlat::shoot(engine);
74  if (w < 1.e-10) w=1.e-10;
75  int clsize = static_cast<int>( -1.*aveCls*log(w)+1.);
76  std::vector<int> cls;
77  cls.push_back(centralStrip);
78  if (clsize > 1){
79  for (int cl = 0; cl < (clsize-1)/2; cl++)
80  if (centralStrip - cl -1 >= 1 ){
81  fstrip = centralStrip-cl-1;
82  cls.push_back(fstrip);
83  }
84  for (int cl = 0; cl < (clsize-1)/2; cl++)
85  if (centralStrip + cl + 1 <= roll->nstrips() ){
86  lstrip = centralStrip+cl+1;
87  cls.push_back(lstrip);
88  }
89  if (clsize%2 == 0 ){
90  // insert the last strip according to the
91  // simhit position in the central strip
92  double deltaw=roll->centreOfStrip(centralStrip).x()-entr.x();
93  if (deltaw<0.) {
94  if (lstrip < roll->nstrips() ){
95  lstrip++;
96  cls.push_back(lstrip);
97  }
98  }else{
99  if (fstrip > 1 ){
100  fstrip--;
101  cls.push_back(fstrip);
102  }
103  }
104  }
105  }
106 
107  for (std::vector<int>::iterator i=cls.begin(); i!=cls.end();i++){
108  // Check the timing of the adjacent strip
109  std::pair<unsigned int, int> digi(*i,time_hit);
110 
111  theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit)));
112  strips.insert(digi);
113  }
114  }
115  }
116 }
int i
Definition: DBlmapReader.cc:9
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:52
const double w
Definition: UKUtility.cc:23
double aveEff
Definition: RPCSimParam.h:34
CaloTopology const * topology(0)
DetectorHitMap theDetectorHitMap
Definition: RPCSim.h:71
void setRPCSimSetUp(RPCSimSetUp *simsetup)
int nstrips() const
Definition: RPCRoll.cc:46
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:50
const RPCRollSpecs * specs() const
Definition: RPCRoll.cc:18
double aveCls
Definition: RPCSimParam.h:37
int getSimHitBx(const PSimHit *, CLHEP::HepRandomEngine *)
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:60
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
Definition: RPCSim.h:35
RPCDetId id() const
Definition: RPCRoll.cc:24
Container::value_type value_type
void clear()
Definition: DetSet.h:69
RPCSynchronizer * _rpcSync
Definition: RPCSimParam.h:51
T x() const
Definition: PV3DBase.h:62
RPCDigiSimLinks theRpcDigiSimLinks
Definition: RPCSim.h:73
const Topology & topology() const
Definition: RPCRollSpecs.cc:43
tuple log
Definition: cmsBatch.py:341
void RPCSimParam::simulateNoise ( const RPCRoll roll,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

Implements RPCSim.

Definition at line 119 of file RPCSimParam.cc.

References compareJSON::const, gate, i, RPCRoll::id(), RectangularStripTopology::localPosition(), TrapezoidalStripTopology::localPosition(), N_hits, nbxing, RPCRoll::nstrips(), rate, RPCDetId::region(), RectangularStripTopology::stripLength(), TrapezoidalStripTopology::stripLength(), RPCSim::strips, RPCRoll::topology(), x, SiStripMonitorClusterAlca_cfi::xmax, and SiStripMonitorClusterAlca_cfi::xmin.

121 {
122 
123  RPCDetId rpcId = roll->id();
124  int nstrips = roll->nstrips();
125  double area = 0.0;
126 
127  if ( rpcId.region() == 0 )
128  {
129  const RectangularStripTopology* top_ = dynamic_cast<const
130  RectangularStripTopology*>(&(roll->topology()));
131  float xmin = (top_->localPosition(0.)).x();
132  float xmax = (top_->localPosition((float)roll->nstrips())).x();
133  float striplength = (top_->stripLength());
134  area = striplength*(xmax-xmin);
135  }
136  else
137  {
138  const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
139  float xmin = (top_->localPosition(0.)).x();
140  float xmax = (top_->localPosition((float)roll->nstrips())).x();
141  float striplength = (top_->stripLength());
142  area = striplength*(xmax-xmin);
143  }
144 
145  double ave = rate*nbxing*gate*area*1.0e-9;
146 
147  CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
148  N_hits = randPoissonQ.fire();
149 
150  for (int i = 0; i < N_hits; i++ ){
151  int strip = static_cast<int>(CLHEP::RandFlat::shoot(engine, 1, nstrips));
152  int time_hit;
153  time_hit = (static_cast<int>(CLHEP::RandFlat::shoot(engine, (nbxing*gate)/gate))) - nbxing/2;
154  std::pair<int, int> digi(strip,time_hit);
155  strips.insert(digi);
156  }
157 
158 }
int i
Definition: DBlmapReader.cc:9
const Topology & topology() const
Definition: RPCRoll.cc:30
virtual float stripLength() const
double gate
Definition: RPCSimParam.h:49
int nstrips() const
Definition: RPCRoll.cc:46
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:60
RPCDetId id() const
Definition: RPCRoll.cc:24
string const
Definition: compareJSON.py:14
virtual LocalPoint localPosition(float strip) const
virtual LocalPoint localPosition(float strip) const
virtual float stripLength() const
det heigth (strip length in the middle)
double rate
Definition: RPCSimParam.h:48
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63

Member Data Documentation

RPCSynchronizer* RPCSimParam::_rpcSync
private

Definition at line 51 of file RPCSimParam.h.

Referenced by RPCSimParam(), simulate(), and ~RPCSimParam().

double RPCSimParam::aveCls
private

Definition at line 37 of file RPCSimParam.h.

Referenced by RPCSimParam(), and simulate().

double RPCSimParam::aveEff
private

Definition at line 34 of file RPCSimParam.h.

Referenced by RPCSimParam(), and simulate().

double RPCSimParam::dtimCs
private

Definition at line 40 of file RPCSimParam.h.

Referenced by RPCSimParam().

double RPCSimParam::gate
private

Definition at line 49 of file RPCSimParam.h.

Referenced by RPCSimParam(), and simulateNoise().

double RPCSimParam::lbGate
private

Definition at line 43 of file RPCSimParam.h.

Referenced by RPCSimParam().

int RPCSimParam::N_hits
private

Definition at line 46 of file RPCSimParam.h.

Referenced by simulateNoise().

int RPCSimParam::nbxing
private

Definition at line 47 of file RPCSimParam.h.

Referenced by RPCSimParam(), and simulateNoise().

double RPCSimParam::rate
private

Definition at line 48 of file RPCSimParam.h.

Referenced by RPCSimParam(), and simulateNoise().

double RPCSimParam::resEle
private

Definition at line 41 of file RPCSimParam.h.

Referenced by RPCSimParam().

double RPCSimParam::resRPC
private

Definition at line 38 of file RPCSimParam.h.

Referenced by RPCSimParam().

bool RPCSimParam::rpcdigiprint
private

Definition at line 44 of file RPCSimParam.h.

Referenced by RPCSimParam().

double RPCSimParam::sspeed
private

Definition at line 42 of file RPCSimParam.h.

Referenced by RPCSimParam().

double RPCSimParam::timOff
private

Definition at line 39 of file RPCSimParam.h.

Referenced by RPCSimParam().