CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
RPCSimAverageNoise Class Reference

#include <RPCSimAverageNoise.h>

Inheritance diagram for RPCSimAverageNoise:
RPCSim

Public Member Functions

int getClSize (float posX, CLHEP::HepRandomEngine *)
 
 RPCSimAverageNoise (const edm::ParameterSet &config)
 
void simulate (const RPCRoll *roll, const edm::PSimHitContainer &rpcHits, CLHEP::HepRandomEngine *) override
 
void simulateNoise (const RPCRoll *, CLHEP::HepRandomEngine *) override
 
 ~RPCSimAverageNoise () override
 
- 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 () override
 

Private Attributes

RPCSynchronizer_rpcSync
 
double aveCls
 
double aveEff
 
std::map< int, std::vector< double > > clsMap
 
double dtimCs
 
double frate
 
double gate
 
std::ifstream * infile
 
double lbGate
 
int N_hits
 
int nbxing
 
double rate
 
double resEle
 
double resRPC
 
bool rpcdigiprint
 
double sspeed
 
std::vector< double > sum_clsize
 
double timOff
 

Additional Inherited Members

- Public Types inherited from RPCSim
typedef edm::DetSet< StripDigiSimLinkDigiSimLinks
 
typedef edm::DetSet< RPCDigiSimLinkRPCDigiSimLinks
 
- 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< RPCDigiirpc_digis
 
std::set< std::pair< int, int > > strips
 
DetectorHitMap theDetectorHitMap
 
DigiSimLinks theDigiSimLinks
 
RPCDigiSimLinks theRpcDigiSimLinks
 
RPCSimSetUptheSimSetUp
 

Detailed Description

Definition at line 28 of file RPCSimAverageNoise.h.

Constructor & Destructor Documentation

RPCSimAverageNoise::RPCSimAverageNoise ( const edm::ParameterSet config)

Definition at line 39 of file RPCSimAverageNoise.cc.

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

39  :
40  RPCSim(config)
41 {
42  aveEff = config.getParameter<double>("averageEfficiency");
43  aveCls = config.getParameter<double>("averageClusterSize");
44  resRPC = config.getParameter<double>("timeResolution");
45  timOff = config.getParameter<double>("timingRPCOffset");
46  dtimCs = config.getParameter<double>("deltatimeAdjacentStrip");
47  resEle = config.getParameter<double>("timeJitter");
48  sspeed = config.getParameter<double>("signalPropagationSpeed");
49  lbGate = config.getParameter<double>("linkGateWidth");
50  rpcdigiprint = config.getParameter<bool>("printOutDigitizer");
51  rate=config.getParameter<double>("Rate");
52  nbxing=config.getParameter<int>("Nbxing");
53  gate=config.getParameter<double>("Gate");
54  frate=config.getParameter<double>("Frate");
55 
56  if (rpcdigiprint) {
57  std::cout <<"Average Efficiency = "<<aveEff<<std::endl;
58  std::cout <<"Average Cluster Size = "<<aveCls<<" strips"<<std::endl;
59  std::cout <<"RPC Time Resolution = "<<resRPC<<" ns"<<std::endl;
60  std::cout <<"RPC Signal formation time = "<<timOff<<" ns"<<std::endl;
61  std::cout <<"RPC adjacent strip delay = "<<dtimCs<<" ns"<<std::endl;
62  std::cout <<"Electronic Jitter = "<<resEle<<" ns"<<std::endl;
63  std::cout <<"Signal propagation time = "<<sspeed<<" x c"<<std::endl;
64  std::cout <<"Link Board Gate Width = "<<lbGate<<" ns"<<std::endl;
65  }
66 
67  _rpcSync = new RPCSynchronizer(config);
68 
69 }
T getParameter(std::string const &) const
RPCSim(const edm::ParameterSet &config)
Definition: RPCSim.cc:5
RPCSynchronizer * _rpcSync
RPCSimAverageNoise::~RPCSimAverageNoise ( )
override

Definition at line 71 of file RPCSimAverageNoise.cc.

References _rpcSync.

72 {
73  delete _rpcSync;
74 }
RPCSynchronizer * _rpcSync

Member Function Documentation

int RPCSimAverageNoise::getClSize ( float  posX,
CLHEP::HepRandomEngine *  engine 
)

Definition at line 76 of file RPCSimAverageNoise.cc.

References clsMap, jets_cff::func, RPCSimSetUp::getClsMap(), RPCSim::getRPCSimSetUp(), min(), and sum_clsize.

Referenced by simulate().

77 {
78 
79  std::map< int, std::vector<double> > clsMap = getRPCSimSetUp()->getClsMap();
80 
81  int cnt = 1;
82  int min = 1;
83  double func=0.0;
84  std::vector<double> sum_clsize;
85 
86  double rr_cl = CLHEP::RandFlat::shoot(engine);
87  if(0.0 <= posX && posX < 0.2) {
88  func = (clsMap[1])[(clsMap[1]).size()-1]*(rr_cl);
89  sum_clsize = clsMap[1];
90  }
91  if(0.2 <= posX && posX < 0.4) {
92  func = (clsMap[2])[(clsMap[2]).size()-1]*(rr_cl);
93  sum_clsize = clsMap[2];
94  }
95  if(0.4 <= posX && posX < 0.6) {
96  func = (clsMap[3])[(clsMap[3]).size()-1]*(rr_cl);
97  sum_clsize = clsMap[3];
98  }
99  if(0.6 <= posX && posX < 0.8) {
100  func = (clsMap[4])[(clsMap[4]).size()-1]*(rr_cl);
101  sum_clsize = clsMap[4];
102  }
103  if(0.8 <= posX && posX < 1.0) {
104  func = (clsMap[5])[(clsMap[5]).size()-1]*(rr_cl);
105  sum_clsize = clsMap[5];
106  }
107 
108  for(vector<double>::iterator iter = sum_clsize.begin();
109  iter != sum_clsize.end(); ++iter){
110  cnt++;
111  if(func > (*iter)){
112  min = cnt;
113  }
114  else if(func < (*iter)){
115  break;
116  }
117  }
118  return min;
119 }
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:50
std::map< int, std::vector< double > > clsMap
const std::map< int, std::vector< double > > & getClsMap()
Definition: RPCSimSetUp.cc:397
T min(T a, T b)
Definition: MathUtil.h:58
std::vector< double > sum_clsize
void RPCSimAverageNoise::init ( void  )
inlineoverrideprivatevirtual

Implements RPCSim.

Definition at line 44 of file RPCSimAverageNoise.h.

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

Implements RPCSim.

Definition at line 123 of file RPCSimAverageNoise.cc.

References _rpcSync, aveEff, RPCRoll::centreOfStrip(), haddnano::cl, edm::DetSet< T >::clear(), getClSize(), RPCSim::getRPCSimSetUp(), RPCSynchronizer::getSimHitBx(), mps_fire::i, RPCRoll::id(), RPCRoll::nstrips(), RecoTauValidation_cfi::posX, DetId::rawId(), RPCSynchronizer::setRPCSimSetUp(), RPCRoll::specs(), RPCRoll::strip(), RPCSim::strips, RPCSim::theDetectorHitMap, RPCSim::theRpcDigiSimLinks, RPCRollSpecs::topology(), ecaldqm::topology(), and PV3DBase< T, PVType, FrameType >::x().

126 {
129  theDetectorHitMap.clear();
131 
132  const Topology& topology=roll->specs()->topology();
133 
134  for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
135  _hit != rpcHits.end(); ++_hit){
136 
137  // Here I hould check if the RPC are up side down;
138  const LocalPoint& entr=_hit->entryPoint();
139  int time_hit = _rpcSync->getSimHitBx(&(*_hit), engine);
140  float posX = roll->strip(_hit->localPosition()) - static_cast<int>(roll->strip(_hit->localPosition()));
141 
142  // Effinciecy
143 
144  if (CLHEP::RandFlat::shoot(engine) < aveEff) {
145 
146  int centralStrip = topology.channel(entr)+1;
147  int fstrip=centralStrip;
148  int lstrip=centralStrip;
149  // Compute the cluster size
150  //double w = CLHEP::RandFlat::shoot(engine);
151  //if (w < 1.e-10) w=1.e-10;
152  int clsize = this->getClSize(posX, engine);
153 
154  std::vector<int> cls;
155  cls.push_back(centralStrip);
156  if (clsize > 1){
157  for (int cl = 0; cl < (clsize-1)/2; cl++)
158  {
159  if (centralStrip - cl -1 >= 1 ){
160  fstrip = centralStrip-cl-1;
161  cls.push_back(fstrip);
162  }
163  if (centralStrip + cl + 1 <= roll->nstrips() ){
164  lstrip = centralStrip+cl+1;
165  cls.push_back(lstrip);
166  }
167  }
168  if (clsize%2 == 0 ){
169  // insert the last strip according to the
170  // simhit position in the central strip
171  double deltaw=roll->centreOfStrip(centralStrip).x()-entr.x();
172  if (deltaw<0.) {
173  if (lstrip < roll->nstrips() ){
174  lstrip++;
175  cls.push_back(lstrip);
176  }
177  }else{
178  if (fstrip > 1 ){
179  fstrip--;
180  cls.push_back(fstrip);
181  }
182  }
183  }
184  }
185 
186  for (std::vector<int>::iterator i=cls.begin(); i!=cls.end();i++){
187  // Check the timing of the adjacent strip
188  std::pair<int, int> digi(*i,time_hit );
189 
190  theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit)));
191  strips.insert(digi);
192  }
193  }
194  }
195 }
float strip(const LocalPoint &lp) const
Definition: RPCRoll.cc:71
const Topology & topology() const override
Definition: RPCRollSpecs.cc:43
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:52
CaloTopology const * topology(0)
DetectorHitMap theDetectorHitMap
Definition: RPCSim.h:72
void setRPCSimSetUp(RPCSimSetUp *simsetup)
int nstrips() const
Definition: RPCRoll.cc:46
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:50
const RPCRollSpecs * specs() const
Definition: RPCRoll.cc:18
int getSimHitBx(const PSimHit *, CLHEP::HepRandomEngine *)
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:60
int getClSize(float posX, CLHEP::HepRandomEngine *)
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
Definition: RPCSim.h:35
RPCDetId id() const
Definition: RPCRoll.cc:24
RPCSynchronizer * _rpcSync
void clear()
Definition: DetSet.h:71
T x() const
Definition: PV3DBase.h:62
RPCDigiSimLinks theRpcDigiSimLinks
Definition: RPCSim.h:74
void RPCSimAverageNoise::simulateNoise ( const RPCRoll roll,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

Implements RPCSim.

Definition at line 197 of file RPCSimAverageNoise.cc.

References custom_jme_cff::area, frate, gate, RPCSim::getRPCSimSetUp(), mps_fire::i, RPCRoll::id(), RectangularStripTopology::localPosition(), TrapezoidalStripTopology::localPosition(), N_hits, nbxing, RPCRoll::nstrips(), DetId::rawId(), RPCDetId::region(), RectangularStripTopology::stripLength(), TrapezoidalStripTopology::stripLength(), RPCSim::strips, RPCRoll::topology(), x, TrackerOfflineValidation_Dqm_cff::xmax, and TrackerOfflineValidation_Dqm_cff::xmin.

198 {
199  RPCDetId rpcId = roll->id();
200  std::vector<float> vnoise = (getRPCSimSetUp())->getNoise(rpcId.rawId());
201  unsigned int nstrips = roll->nstrips();
202 
203  double area = 0.0;
204 
205  if ( rpcId.region() == 0 )
206  {
207  const RectangularStripTopology* top_ = dynamic_cast<const
208  RectangularStripTopology*>(&(roll->topology()));
209  float xmin = (top_->localPosition(0.)).x();
210  float xmax = (top_->localPosition((float)roll->nstrips())).x();
211  float striplength = (top_->stripLength());
212  area = striplength*(xmax-xmin);
213  }
214  else
215  {
216  const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
217  float xmin = (top_->localPosition(0.)).x();
218  float xmax = (top_->localPosition((float)roll->nstrips())).x();
219  float striplength = (top_->stripLength());
220  area = striplength*(xmax-xmin);
221  }
222  for(unsigned int j = 0; j < vnoise.size(); ++j){
223 
224  if(j >= nstrips) break;
225 
226  double ave = frate*vnoise[j]*nbxing*gate*area*1.0e-9;
227  CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
228  N_hits = randPoissonQ.fire();
229 
230  for (int i = 0; i < N_hits; i++ ){
231  int time_hit = (static_cast<int>(CLHEP::RandFlat::shoot(engine, (nbxing*gate)/gate))) - nbxing/2;
232  std::pair<int, int> digi(j+1,time_hit);
233  strips.insert(digi);
234  }
235  }
236 }
LocalPoint localPosition(float strip) const override
int nstrips() const
Definition: RPCRoll.cc:46
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
LocalPoint localPosition(float strip) const override
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:50
const Topology & topology() const override
Definition: RPCRoll.cc:30
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:60
RPCDetId id() const
Definition: RPCRoll.cc:24
float stripLength() const override
det heigth (strip length in the middle)
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63
float stripLength() const override

Member Data Documentation

RPCSynchronizer* RPCSimAverageNoise::_rpcSync
private

Definition at line 66 of file RPCSimAverageNoise.h.

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

double RPCSimAverageNoise::aveCls
private

Definition at line 47 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

double RPCSimAverageNoise::aveEff
private

Definition at line 44 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise(), and simulate().

std::map< int, std::vector<double> > RPCSimAverageNoise::clsMap
private

Definition at line 62 of file RPCSimAverageNoise.h.

Referenced by getClSize().

double RPCSimAverageNoise::dtimCs
private

Definition at line 50 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

double RPCSimAverageNoise::frate
private

Definition at line 60 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise(), and simulateNoise().

double RPCSimAverageNoise::gate
private

Definition at line 59 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise(), and simulateNoise().

std::ifstream* RPCSimAverageNoise::infile
private

Definition at line 64 of file RPCSimAverageNoise.h.

double RPCSimAverageNoise::lbGate
private

Definition at line 53 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

int RPCSimAverageNoise::N_hits
private

Definition at line 56 of file RPCSimAverageNoise.h.

Referenced by simulateNoise().

int RPCSimAverageNoise::nbxing
private

Definition at line 57 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise(), and simulateNoise().

double RPCSimAverageNoise::rate
private

Definition at line 58 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

double RPCSimAverageNoise::resEle
private

Definition at line 51 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

double RPCSimAverageNoise::resRPC
private

Definition at line 48 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

bool RPCSimAverageNoise::rpcdigiprint
private

Definition at line 54 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

double RPCSimAverageNoise::sspeed
private

Definition at line 52 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

std::vector<double> RPCSimAverageNoise::sum_clsize
private

Definition at line 63 of file RPCSimAverageNoise.h.

Referenced by getClSize().

double RPCSimAverageNoise::timOff
private

Definition at line 49 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().