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

#include <RPCSimAverageNoiseEffCls.h>

Inheritance diagram for RPCSimAverageNoiseEffCls:
RPCSim

Public Member Functions

int getClSize (float posX)
 
int getClSize (uint32_t id, float posX)
 
 RPCSimAverageNoiseEffCls (const edm::ParameterSet &config)
 
void setRandomEngine (CLHEP::HepRandomEngine &eng)
 
void simulate (const RPCRoll *roll, const edm::PSimHitContainer &rpcHits)
 
void simulateNoise (const RPCRoll *)
 
 ~RPCSimAverageNoiseEffCls ()
 
- 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::vector< double > clsForDetId
 
std::map< int, std::vector
< double > > 
clsMap
 
double dtimCs
 
CLHEP::RandFlat * flatDistribution
 
CLHEP::RandFlat * flatDistribution2
 
double frate
 
double gate
 
std::ifstream * infile
 
double lbGate
 
int N_hits
 
int nbxing
 
CLHEP::RandPoissonQ * poissonDistribution_
 
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 31 of file RPCSimAverageNoiseEffCls.h.

Constructor & Destructor Documentation

RPCSimAverageNoiseEffCls::RPCSimAverageNoiseEffCls ( const edm::ParameterSet config)

Definition at line 50 of file RPCSimAverageNoiseEffCls.cc.

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

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

Definition at line 91 of file RPCSimAverageNoiseEffCls.cc.

References _rpcSync, flatDistribution, flatDistribution2, and poissonDistribution_.

92 {
93  //Deleting the distribution defined in the constructor
94  delete flatDistribution;
95  delete flatDistribution2;
96  delete poissonDistribution_;
97  delete _rpcSync;
98 }
CLHEP::RandPoissonQ * poissonDistribution_

Member Function Documentation

int RPCSimAverageNoiseEffCls::getClSize ( float  posX)

Definition at line 150 of file RPCSimAverageNoiseEffCls.cc.

References clsMap, flatDistribution, statics::func, RPCSimSetUp::getClsMap(), RPCSim::getRPCSimSetUp(), bookConverter::min, and sum_clsize.

Referenced by simulate().

151 {
152 
153  std::map< int, std::vector<double> > clsMap = getRPCSimSetUp()->getClsMap();
154 
155  int cnt = 1;
156  int min = 1;
157  double func=0.0;
158  std::vector<double> sum_clsize;
159 
160  double rr_cl = flatDistribution->fire(1);
161  if(0.0 <= posX && posX < 0.2) {
162  func = (clsMap[1])[(clsMap[1]).size()-1]*(rr_cl);
163  sum_clsize = clsMap[1];
164  }
165  if(0.2 <= posX && posX < 0.4) {
166  func = (clsMap[2])[(clsMap[2]).size()-1]*(rr_cl);
167  sum_clsize = clsMap[2];
168  }
169  if(0.4 <= posX && posX < 0.6) {
170  func = (clsMap[3])[(clsMap[3]).size()-1]*(rr_cl);
171  sum_clsize = clsMap[3];
172  }
173  if(0.6 <= posX && posX < 0.8) {
174  func = (clsMap[4])[(clsMap[4]).size()-1]*(rr_cl);
175  sum_clsize = clsMap[4];
176  }
177  if(0.8 <= posX && posX < 1.0) {
178  func = (clsMap[5])[(clsMap[5]).size()-1]*(rr_cl);
179  sum_clsize = clsMap[5];
180  }
181 
182  for(vector<double>::iterator iter = sum_clsize.begin();
183  iter != sum_clsize.end(); ++iter){
184  cnt++;
185  if(func > (*iter)){
186  min = cnt;
187  }
188  else if(func < (*iter)){
189  break;
190  }
191  }
192  return min;
193 }
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:47
std::vector< double > sum_clsize
const std::map< int, std::vector< double > > & getClsMap()
Definition: RPCSimSetUp.cc:195
std::map< int, std::vector< double > > clsMap
string func
Definition: statics.py:48
int RPCSimAverageNoiseEffCls::getClSize ( uint32_t  id,
float  posX 
)

Definition at line 101 of file RPCSimAverageNoiseEffCls.cc.

References clsForDetId, flatDistribution, statics::func, RPCSimSetUp::getCls(), RPCSim::getRPCSimSetUp(), i, bookConverter::min, and sum_clsize.

102 {
103  std::vector<double> clsForDetId = getRPCSimSetUp()->getCls(id);
104 
105  int cnt = 1;
106  int min = 1;
107  double func=0.0;
108  std::vector<double> sum_clsize;
109 
110  sum_clsize.clear();
111  sum_clsize = clsForDetId;
112  int vectOffset(0);
113 
114  double rr_cl = flatDistribution->fire(1);
115 
116  if(0.0 <= posX && posX < 0.2) {
117  func = clsForDetId[19]*(rr_cl);
118  vectOffset = 0;
119  }
120  if(0.2 <= posX && posX < 0.4) {
121  func = clsForDetId[39]*(rr_cl);
122  vectOffset = 20;
123  }
124  if(0.4 <= posX && posX < 0.6) {
125  func = clsForDetId[59]*(rr_cl);
126  vectOffset = 40;
127  }
128  if(0.6 <= posX && posX < 0.8) {
129  func = clsForDetId[79]*(rr_cl);
130  vectOffset = 60;
131  }
132  if(0.8 <= posX && posX < 1.0) {
133  func = clsForDetId[89]*(rr_cl);
134  vectOffset = 80;
135  }
136 
137 
138  for(int i = vectOffset; i<(vectOffset+20); i++){
139  cnt++;
140  if(func > clsForDetId[i]){
141  min = cnt;
142  }
143  else if(func < clsForDetId[i]){
144  break;
145  }
146  }
147  return min;
148 }
int i
Definition: DBlmapReader.cc:9
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:47
std::vector< double > clsForDetId
std::vector< double > sum_clsize
const std::vector< double > & getCls(uint32_t id)
Definition: RPCSimSetUp.cc:206
string func
Definition: statics.py:48
void RPCSimAverageNoiseEffCls::init ( void  )
inlineprivatevirtual

Implements RPCSim.

Definition at line 48 of file RPCSimAverageNoiseEffCls.h.

48 {};
void RPCSimAverageNoiseEffCls::setRandomEngine ( CLHEP::HepRandomEngine &  eng)
virtual

Implements RPCSim.

Definition at line 84 of file RPCSimAverageNoiseEffCls.cc.

References _rpcSync, flatDistribution, flatDistribution2, poissonDistribution_, and RPCSynchronizer::setRandomEngine().

84  {
85  flatDistribution = new CLHEP::RandFlat(eng);
86  flatDistribution2 = new CLHEP::RandFlat(eng);
87  poissonDistribution_ = new CLHEP::RandPoissonQ(eng);
89 }
CLHEP::RandPoissonQ * poissonDistribution_
void setRandomEngine(CLHEP::HepRandomEngine &eng)
void RPCSimAverageNoiseEffCls::simulate ( const RPCRoll roll,
const edm::PSimHitContainer rpcHits 
)
virtual

Implements RPCSim.

Definition at line 196 of file RPCSimAverageNoiseEffCls.cc.

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

198 {
199 
202  theDetectorHitMap.clear();
204 
205  RPCDetId rpcId = roll->id();
206  RPCGeomServ RPCname(rpcId);
207  //std::string nameRoll = RPCname.name();
208 
209  const Topology& topology=roll->specs()->topology();
210 
211  for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
212  _hit != rpcHits.end(); ++_hit){
213 
214  if(_hit-> particleType() == 11) continue;
215 
216  // Here I hould check if the RPC are up side down;
217  const LocalPoint& entr=_hit->entryPoint();
218 
219  int time_hit = _rpcSync->getSimHitBx(&(*_hit));
220  float posX = roll->strip(_hit->localPosition()) - static_cast<int>(roll->strip(_hit->localPosition()));
221 
222  std::vector<float> veff = (getRPCSimSetUp())->getEff(rpcId.rawId());
223 
224  // Effinciecy
225  int centralStrip = topology.channel(entr)+1;;
226  float fire = flatDistribution->fire(1);
227 
228  if (fire < veff[centralStrip-1]) {
229 
230  int fstrip=centralStrip;
231  int lstrip=centralStrip;
232 
233  // Compute the cluster size
234  double w = flatDistribution->fire(1);
235  if (w < 1.e-10) w=1.e-10;
236 // int clsize = this->getClSize(posX); // This is for one and the same cls for all the chambers
237  int clsize = this->getClSize(rpcId.rawId(),posX); // This is for cluster size chamber by chamber
238  std::vector<int> cls;
239  cls.push_back(centralStrip);
240  if (clsize > 1){
241  for (int cl = 0; cl < (clsize-1)/2; cl++){
242  if (centralStrip - cl -1 >= 1 ){
243  fstrip = centralStrip-cl-1;
244  cls.push_back(fstrip);
245  }
246  if (centralStrip + cl + 1 <= roll->nstrips() ){
247  lstrip = centralStrip+cl+1;
248  cls.push_back(lstrip);
249  }
250  }
251  if (clsize%2 == 0 ){
252  // insert the last strip according to the
253  // simhit position in the central strip
254  double deltaw=roll->centreOfStrip(centralStrip).x()-entr.x();
255  if (deltaw<0.) {
256  if (lstrip < roll->nstrips() ){
257  lstrip++;
258  cls.push_back(lstrip);
259  }
260  }else{
261  if (fstrip > 1 ){
262  fstrip--;
263  cls.push_back(fstrip);
264  }
265  }
266  }
267  }
268 
269  for (std::vector<int>::iterator i=cls.begin(); i!=cls.end();i++){
270  // Check the timing of the adjacent strip
271  if(*i != centralStrip){
272  if(flatDistribution->fire(1) < veff[*i-1]){
273  std::pair<int, int> digi(*i,time_hit);
274  strips.insert(digi);
275 
276  theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit)));
277  }
278  }
279  else {
280  std::pair<int, int> digi(*i,time_hit);
281  theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit)));
282 
283  strips.insert(digi);
284  }
285  }
286  }
287  }
288 }
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
DetectorHitMap theDetectorHitMap
Definition: RPCSim.h:68
void setRPCSimSetUp(RPCSimSetUp *simsetup)
int nstrips() const
Definition: RPCRoll.cc:46
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:47
const RPCRollSpecs * specs() const
Definition: RPCRoll.cc:18
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:57
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
Definition: RPCSim.h:32
RPCDetId id() const
Definition: RPCRoll.cc:24
virtual int channel(const LocalPoint &p) const =0
Container::value_type value_type
int getSimHitBx(const PSimHit *)
void clear()
Definition: DetSet.h:69
T w() const
T x() const
Definition: PV3DBase.h:62
RPCDigiSimLinks theRpcDigiSimLinks
Definition: RPCSim.h:70
const Topology & topology() const
Definition: RPCRollSpecs.cc:43
void RPCSimAverageNoiseEffCls::simulateNoise ( const RPCRoll roll)
virtual

Implements RPCSim.

Definition at line 290 of file RPCSimAverageNoiseEffCls.cc.

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

291 {
292 
293  RPCDetId rpcId = roll->id();
294 
295  RPCGeomServ RPCname(rpcId);
296  //std::string nameRoll = RPCname.name();
297 
298  std::vector<float> vnoise = (getRPCSimSetUp())->getNoise(rpcId.rawId());
299  std::vector<float> veff = (getRPCSimSetUp())->getEff(rpcId.rawId());
300 
301  unsigned int nstrips = roll->nstrips();
302  double area = 0.0;
303 
304  if ( rpcId.region() == 0 )
305  {
306  const RectangularStripTopology* top_ = dynamic_cast<const
307  RectangularStripTopology*>(&(roll->topology()));
308  float xmin = (top_->localPosition(0.)).x();
309  float xmax = (top_->localPosition((float)roll->nstrips())).x();
310  float striplength = (top_->stripLength());
311  area = striplength*(xmax-xmin);
312  }
313  else
314  {
315  const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
316  float xmin = (top_->localPosition(0.)).x();
317  float xmax = (top_->localPosition((float)roll->nstrips())).x();
318  float striplength = (top_->stripLength());
319  area = striplength*(xmax-xmin);
320  }
321 
322  for(unsigned int j = 0; j < vnoise.size(); ++j){
323 
324  if(j >= nstrips) break;
325 
326  // The efficiency of 0% does not imply on the noise rate.
327  // If the strip is masked the noise rate should be 0 Hz/cm^2
328  // if(veff[j] == 0) continue;
329 
330  // double ave = vnoise[j]*nbxing*gate*area*1.0e-9*frate;
331  // The vnoise is the noise rate per strip, so we shout multiply not
332  // by the chamber area,
333  // but the strip area which is area/((float)roll->nstrips()));
334  double ave =
335  vnoise[j]*nbxing*gate*area*1.0e-9*frate/((float)roll->nstrips());
336 
337  N_hits = poissonDistribution_->fire(ave);
338 
339  for (int i = 0; i < N_hits; i++ ){
340 
341  int time_hit = (static_cast<int>(flatDistribution2->fire((nbxing*gate)/gate))) - nbxing/2;
342  std::pair<int, int> digi(j+1,time_hit);
343  strips.insert(digi);
344  }
345  }
346 }
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:47
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:57
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
CLHEP::RandPoissonQ * poissonDistribution_
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* RPCSimAverageNoiseEffCls::_rpcSync
private
double RPCSimAverageNoiseEffCls::aveCls
private

Definition at line 51 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

double RPCSimAverageNoiseEffCls::aveEff
private

Definition at line 48 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

std::vector<double> RPCSimAverageNoiseEffCls::clsForDetId
private

Definition at line 68 of file RPCSimAverageNoiseEffCls.h.

Referenced by getClSize().

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

Definition at line 66 of file RPCSimAverageNoiseEffCls.h.

Referenced by getClSize().

double RPCSimAverageNoiseEffCls::dtimCs
private

Definition at line 54 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

CLHEP::RandFlat* RPCSimAverageNoiseEffCls::flatDistribution
private
CLHEP::RandFlat* RPCSimAverageNoiseEffCls::flatDistribution2
private
double RPCSimAverageNoiseEffCls::frate
private

Definition at line 64 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls(), and simulateNoise().

double RPCSimAverageNoiseEffCls::gate
private

Definition at line 63 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls(), and simulateNoise().

std::ifstream* RPCSimAverageNoiseEffCls::infile
private

Definition at line 69 of file RPCSimAverageNoiseEffCls.h.

double RPCSimAverageNoiseEffCls::lbGate
private

Definition at line 57 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

int RPCSimAverageNoiseEffCls::N_hits
private

Definition at line 60 of file RPCSimAverageNoiseEffCls.h.

Referenced by simulateNoise().

int RPCSimAverageNoiseEffCls::nbxing
private

Definition at line 61 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls(), and simulateNoise().

CLHEP::RandPoissonQ* RPCSimAverageNoiseEffCls::poissonDistribution_
private
double RPCSimAverageNoiseEffCls::rate
private

Definition at line 62 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

double RPCSimAverageNoiseEffCls::resEle
private

Definition at line 55 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

double RPCSimAverageNoiseEffCls::resRPC
private

Definition at line 52 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

bool RPCSimAverageNoiseEffCls::rpcdigiprint
private

Definition at line 58 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

double RPCSimAverageNoiseEffCls::sspeed
private

Definition at line 56 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().

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

Definition at line 67 of file RPCSimAverageNoiseEffCls.h.

Referenced by getClSize().

double RPCSimAverageNoiseEffCls::timOff
private

Definition at line 53 of file RPCSimAverageNoiseEffCls.h.

Referenced by RPCSimAverageNoiseEffCls().