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
RPCSimAverageNoiseEff Class Reference

#include <RPCSimAverageNoiseEff.h>

Inheritance diagram for RPCSimAverageNoiseEff:
RPCSim

Public Member Functions

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

Definition at line 29 of file RPCSimAverageNoiseEff.h.

Constructor & Destructor Documentation

RPCSimAverageNoiseEff::RPCSimAverageNoiseEff ( const edm::ParameterSet config)

Definition at line 41 of file RPCSimAverageNoiseEff.cc.

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

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

Definition at line 75 of file RPCSimAverageNoiseEff.cc.

References _rpcSync.

76 {
77  delete _rpcSync;
78 }
RPCSynchronizer * _rpcSync

Member Function Documentation

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

Definition at line 80 of file RPCSimAverageNoiseEff.cc.

References clsMap, RPCSimSetUp::getClsMap(), RPCSim::getRPCSimSetUp(), getDQMSummary::iter, bookConverter::min, and sum_clsize.

Referenced by simulate().

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

Implements RPCSim.

Definition at line 45 of file RPCSimAverageNoiseEff.h.

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

Implements RPCSim.

Definition at line 126 of file RPCSimAverageNoiseEff.cc.

References _rpcSync, RPCRoll::centreOfStrip(), Topology::channel(), GetRecoTauVFromDQM_MC_cff::cl, edm::DetSet< T >::clear(), alignCSCRings::e, getClSize(), RPCSim::getRPCSimSetUp(), RPCSynchronizer::getSimHitBx(), i, RPCRoll::id(), RPCGeomServ::name(), RPCRoll::nstrips(), DetId::rawId(), RPCSynchronizer::setRPCSimSetUp(), RPCRoll::specs(), AlCaHLTBitMon_QueryRunRegistry::string, RPCRoll::strip(), RPCSim::strips, RPCSim::theDetectorHitMap, RPCSim::theRpcDigiSimLinks, RPCRollSpecs::topology(), ecaldqm::topology(), w(), and PV3DBase< T, PVType, FrameType >::x().

129 {
130 
133  theDetectorHitMap.clear();
135 
136  RPCDetId rpcId = roll->id();
137  RPCGeomServ RPCname(rpcId);
138  std::string nameRoll = RPCname.name();
139 
140  const Topology& topology=roll->specs()->topology();
141 
142  for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
143  _hit != rpcHits.end(); ++_hit){
144 
145  if(_hit-> particleType() == 11) continue;
146 
147  // Here I hould check if the RPC are up side down;
148  const LocalPoint& entr=_hit->entryPoint();
149 
150  int time_hit = _rpcSync->getSimHitBx(&(*_hit), engine);
151  float posX = roll->strip(_hit->localPosition()) - static_cast<int>(roll->strip(_hit->localPosition()));
152 
153  std::vector<float> veff = (getRPCSimSetUp())->getEff(rpcId.rawId());
154 
155  // Effinciecy
156  int centralStrip = topology.channel(entr)+1;;
157  float fire = CLHEP::RandFlat::shoot(engine);
158 
159  if (fire < veff[centralStrip-1]) {
160 
161  int fstrip=centralStrip;
162  int lstrip=centralStrip;
163 
164  // Compute the cluster size
165  double w = CLHEP::RandFlat::shoot(engine);
166  if (w < 1.e-10) w=1.e-10;
167  int clsize = this->getClSize(posX, engine);
168 
169  std::vector<int> cls;
170  cls.push_back(centralStrip);
171  if (clsize > 1){
172  for (int cl = 0; cl < (clsize-1)/2; cl++){
173  if (centralStrip - cl -1 >= 1 ){
174  fstrip = centralStrip-cl-1;
175  cls.push_back(fstrip);
176  }
177  if (centralStrip + cl + 1 <= roll->nstrips() ){
178  lstrip = centralStrip+cl+1;
179  cls.push_back(lstrip);
180  }
181  }
182  if (clsize%2 == 0 ){
183  // insert the last strip according to the
184  // simhit position in the central strip
185  double deltaw=roll->centreOfStrip(centralStrip).x()-entr.x();
186  if (deltaw<0.) {
187  if (lstrip < roll->nstrips() ){
188  lstrip++;
189  cls.push_back(lstrip);
190  }
191  }else{
192  if (fstrip > 1 ){
193  fstrip--;
194  cls.push_back(fstrip);
195  }
196  }
197  }
198  }
199 
200  for (std::vector<int>::iterator i=cls.begin(); i!=cls.end();i++){
201  // Check the timing of the adjacent strip
202  if(*i != centralStrip){
203  if(CLHEP::RandFlat::shoot(engine) < veff[*i-1]){
204  std::pair<int, int> digi(*i,time_hit);
205  strips.insert(digi);
206 
207  theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit)));
208  }
209  }
210  else {
211  std::pair<int, int> digi(*i,time_hit);
212  theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit)));
213 
214  strips.insert(digi);
215  }
216  }
217  }
218  }
219 }
float strip(const LocalPoint &lp) const
Definition: RPCRoll.cc:71
int i
Definition: DBlmapReader.cc:9
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:52
int getClSize(float posX, CLHEP::HepRandomEngine *)
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
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
virtual int channel(const LocalPoint &p) const =0
Container::value_type value_type
RPCSynchronizer * _rpcSync
void clear()
Definition: DetSet.h:69
T w() const
T x() const
Definition: PV3DBase.h:62
RPCDigiSimLinks theRpcDigiSimLinks
Definition: RPCSim.h:73
const Topology & topology() const
Definition: RPCRollSpecs.cc:43
void RPCSimAverageNoiseEff::simulateNoise ( const RPCRoll roll,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

Implements RPCSim.

Definition at line 221 of file RPCSimAverageNoiseEff.cc.

References compareJSON::const, frate, gate, RPCSim::getRPCSimSetUp(), i, RPCRoll::id(), j, N_hits, RPCGeomServ::name(), nbxing, RPCRoll::nstrips(), DetId::rawId(), RPCDetId::region(), AlCaHLTBitMon_QueryRunRegistry::string, RPCSim::strips, RPCRoll::topology(), x, SiStripMonitorClusterAlca_cfi::xmax, and SiStripMonitorClusterAlca_cfi::xmin.

223 {
224 
225  RPCDetId rpcId = roll->id();
226 
227  RPCGeomServ RPCname(rpcId);
228  std::string nameRoll = RPCname.name();
229 
230  std::vector<float> vnoise = (getRPCSimSetUp())->getNoise(rpcId.rawId());
231  std::vector<float> veff = (getRPCSimSetUp())->getEff(rpcId.rawId());
232 
233  unsigned int nstrips = roll->nstrips();
234  double area = 0.0;
235 
236  if ( rpcId.region() == 0 )
237  {
238  const RectangularStripTopology* top_ = dynamic_cast<const
239  RectangularStripTopology*>(&(roll->topology()));
240  float xmin = (top_->localPosition(0.)).x();
241  float xmax = (top_->localPosition((float)roll->nstrips())).x();
242  float striplength = (top_->stripLength());
243  area = striplength*(xmax-xmin);
244  }
245  else
246  {
247  const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
248  float xmin = (top_->localPosition(0.)).x();
249  float xmax = (top_->localPosition((float)roll->nstrips())).x();
250  float striplength = (top_->stripLength());
251  area = striplength*(xmax-xmin);
252  }
253 
254  for(unsigned int j = 0; j < vnoise.size(); ++j){
255 
256  if(j >= nstrips) break;
257 
258  // The efficiency of 0% does not imply on the noise rate.
259  // If the strip is masked the noise rate should be 0 Hz/cm^2
260  // if(veff[j] == 0) continue;
261 
262 
263  // double ave = vnoise[j]*nbxing*gate*area*1.0e-9*frate;
264  // The vnoise is the noise rate per strip, so we shout multiply not
265  // by the chamber area,
266  // but the strip area which is area/((float)roll->nstrips()));
267  double ave =
268  vnoise[j]*nbxing*gate*area*1.0e-9*frate/((float)roll->nstrips());
269 
270  CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
271  N_hits = randPoissonQ.fire();
272 
273  for (int i = 0; i < N_hits; i++ ){
274 
275  int time_hit = (static_cast<int>(CLHEP::RandFlat::shoot(engine, (nbxing*gate)/gate))) - nbxing/2;
276  std::pair<int, int> digi(j+1,time_hit);
277  strips.insert(digi);
278  }
279  }
280 }
int i
Definition: DBlmapReader.cc:9
const Topology & topology() const
Definition: RPCRoll.cc:30
int nstrips() const
Definition: RPCRoll.cc:46
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:50
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:60
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
RPCDetId id() const
Definition: RPCRoll.cc:24
int j
Definition: DBlmapReader.cc:9
string const
Definition: compareJSON.py:14
Definition: DDAxes.h:10
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63

Member Data Documentation

RPCSynchronizer* RPCSimAverageNoiseEff::_rpcSync
private

Definition at line 67 of file RPCSimAverageNoiseEff.h.

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

double RPCSimAverageNoiseEff::aveCls
private

Definition at line 48 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

double RPCSimAverageNoiseEff::aveEff
private

Definition at line 45 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

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

Definition at line 63 of file RPCSimAverageNoiseEff.h.

Referenced by getClSize().

double RPCSimAverageNoiseEff::dtimCs
private

Definition at line 51 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

double RPCSimAverageNoiseEff::frate
private

Definition at line 61 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff(), and simulateNoise().

double RPCSimAverageNoiseEff::gate
private

Definition at line 60 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff(), and simulateNoise().

std::ifstream* RPCSimAverageNoiseEff::infile
private

Definition at line 65 of file RPCSimAverageNoiseEff.h.

double RPCSimAverageNoiseEff::lbGate
private

Definition at line 54 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

int RPCSimAverageNoiseEff::N_hits
private

Definition at line 57 of file RPCSimAverageNoiseEff.h.

Referenced by simulateNoise().

int RPCSimAverageNoiseEff::nbxing
private

Definition at line 58 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff(), and simulateNoise().

double RPCSimAverageNoiseEff::rate
private

Definition at line 59 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

double RPCSimAverageNoiseEff::resEle
private

Definition at line 52 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

double RPCSimAverageNoiseEff::resRPC
private

Definition at line 49 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

bool RPCSimAverageNoiseEff::rpcdigiprint
private

Definition at line 55 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

double RPCSimAverageNoiseEff::sspeed
private

Definition at line 53 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().

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

Definition at line 64 of file RPCSimAverageNoiseEff.h.

Referenced by getClSize().

double RPCSimAverageNoiseEff::timOff
private

Definition at line 50 of file RPCSimAverageNoiseEff.h.

Referenced by RPCSimAverageNoiseEff().