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

#include <RPCSimAverage.h>

Inheritance diagram for RPCSimAverage:
RPCSim

Public Member Functions

int getClSize (float posX)
 
 RPCSimAverage (const edm::ParameterSet &config)
 
void setRandomEngine (CLHEP::HepRandomEngine &eng)
 
void simulate (const RPCRoll *roll, const edm::PSimHitContainer &rpcHits)
 
void simulateNoise (const RPCRoll *)
 
 ~RPCSimAverage ()
 
- 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
 
CLHEP::RandFlat * flatDistribution1
 
CLHEP::RandFlat * flatDistribution2
 
CLHEP::RandFlat * flatDistribution_
 
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

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

Author
Raffaello Trentadue – INFN Bari

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

Author
Borislav Pavlov – University of Sofia

Definition at line 30 of file RPCSimAverage.h.

Constructor & Destructor Documentation

RPCSimAverage::RPCSimAverage ( const edm::ParameterSet config)

Definition at line 48 of file RPCSimAverage.cc.

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

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

Definition at line 87 of file RPCSimAverage.cc.

References _rpcSync, flatDistribution1, flatDistribution2, flatDistribution_, and poissonDistribution.

87  {
88  delete flatDistribution_;
89  delete flatDistribution1;
90  delete flatDistribution2;
91  delete poissonDistribution;
92  delete _rpcSync;
93 }
CLHEP::RandFlat * flatDistribution_
Definition: RPCSimAverage.h:71
CLHEP::RandPoissonQ * poissonDistribution
Definition: RPCSimAverage.h:74
CLHEP::RandFlat * flatDistribution1
Definition: RPCSimAverage.h:72
CLHEP::RandFlat * flatDistribution2
Definition: RPCSimAverage.h:73
RPCSynchronizer * _rpcSync
Definition: RPCSimAverage.h:68

Member Function Documentation

int RPCSimAverage::getClSize ( float  posX)

Definition at line 95 of file RPCSimAverage.cc.

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

Referenced by simulate().

96 {
97 
98  std::map< int, std::vector<double> > clsMap = getRPCSimSetUp()->getClsMap();
99 
100  int cnt = 1;
101  int min = 1;
102  double func=0.0;
103  std::vector<double> sum_clsize;
104 
105  double rr_cl = flatDistribution_->fire(1);
106  if(0.0 <= posX && posX < 0.2) {
107  func = (clsMap[1])[(clsMap[1]).size()-1]*(rr_cl);
108  sum_clsize = clsMap[1];
109  }
110  if(0.2 <= posX && posX < 0.4) {
111  func = (clsMap[2])[(clsMap[2]).size()-1]*(rr_cl);
112  sum_clsize = clsMap[2];
113  }
114  if(0.4 <= posX && posX < 0.6) {
115  func = (clsMap[3])[(clsMap[3]).size()-1]*(rr_cl);
116  sum_clsize = clsMap[3];
117  }
118  if(0.6 <= posX && posX < 0.8) {
119  func = (clsMap[4])[(clsMap[4]).size()-1]*(rr_cl);
120  sum_clsize = clsMap[4];
121  }
122  if(0.8 <= posX && posX < 1.0) {
123  func = (clsMap[5])[(clsMap[5]).size()-1]*(rr_cl);
124  sum_clsize = clsMap[5];
125  }
126 
127  for(vector<double>::iterator iter = sum_clsize.begin();
128  iter != sum_clsize.end(); ++iter){
129  cnt++;
130  if(func > (*iter)){
131  min = cnt;
132  }
133  else if(func < (*iter)){
134  break;
135  }
136  }
137  return min;
138 }
CLHEP::RandFlat * flatDistribution_
Definition: RPCSimAverage.h:71
std::vector< double > sum_clsize
Definition: RPCSimAverage.h:65
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:47
#define min(a, b)
Definition: mlp_lapack.h:161
const std::map< int, std::vector< double > > & getClsMap()
Definition: RPCSimSetUp.cc:195
std::map< int, std::vector< double > > clsMap
Definition: RPCSimAverage.h:64
void RPCSimAverage::init ( void  )
inlineprivatevirtual

Implements RPCSim.

Definition at line 47 of file RPCSimAverage.h.

47 {};
void RPCSimAverage::setRandomEngine ( CLHEP::HepRandomEngine &  eng)
virtual

Implements RPCSim.

Definition at line 79 of file RPCSimAverage.cc.

References _rpcSync, flatDistribution1, flatDistribution2, flatDistribution_, poissonDistribution, and RPCSynchronizer::setRandomEngine().

79  {
80  flatDistribution_ = new CLHEP::RandFlat(eng);
81  flatDistribution1 = new CLHEP::RandFlat(eng);
82  flatDistribution2 = new CLHEP::RandFlat(eng);
83  poissonDistribution = new CLHEP::RandPoissonQ(eng);
85 }
CLHEP::RandFlat * flatDistribution_
Definition: RPCSimAverage.h:71
CLHEP::RandPoissonQ * poissonDistribution
Definition: RPCSimAverage.h:74
CLHEP::RandFlat * flatDistribution1
Definition: RPCSimAverage.h:72
CLHEP::RandFlat * flatDistribution2
Definition: RPCSimAverage.h:73
RPCSynchronizer * _rpcSync
Definition: RPCSimAverage.h:68
void setRandomEngine(CLHEP::HepRandomEngine &eng)
void RPCSimAverage::simulate ( const RPCRoll roll,
const edm::PSimHitContainer rpcHits 
)
virtual

Implements RPCSim.

Definition at line 142 of file RPCSimAverage.cc.

References _rpcSync, aveEff, RPCRoll::centreOfStrip(), 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().

144 {
147  theDetectorHitMap.clear();
149 
150  const Topology& topology=roll->specs()->topology();
151 
152  for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
153  _hit != rpcHits.end(); ++_hit){
154 
155  // Here I hould check if the RPC are up side down;
156  const LocalPoint& entr=_hit->entryPoint();
157 
158  // const LocalPoint& exit=_hit->exitPoint();
159 
160  float posX = roll->strip(_hit->localPosition()) - static_cast<int>(roll->strip(_hit->localPosition()));
161  int time_hit = _rpcSync->getSimHitBx(&(*_hit));
162 
163  // Effinciecy
164 
165  if (flatDistribution_->fire(1) < aveEff) {
166 
167  int centralStrip = topology.channel(entr)+1;
168  int fstrip=centralStrip;
169  int lstrip=centralStrip;
170  // Compute the cluster size
171  double w = flatDistribution_->fire(1);
172  if (w < 1.e-10) w=1.e-10;
173  int clsize = this->getClSize(posX);
174 
175  std::vector<int> cls;
176  cls.push_back(centralStrip);
177  if (clsize > 1){
178  for (int cl = 0; cl < (clsize-1)/2; cl++)
179  if (centralStrip - cl -1 >= 1 ){
180  fstrip = centralStrip-cl-1;
181  cls.push_back(fstrip);
182  }
183  for (int cl = 0; cl < (clsize-1)/2; cl++)
184  if (centralStrip + cl + 1 <= roll->nstrips() ){
185  lstrip = centralStrip+cl+1;
186  cls.push_back(lstrip);
187  }
188  if (clsize%2 == 0 ){
189  // insert the last strip according to the
190  // simhit position in the central strip
191  double deltaw=roll->centreOfStrip(centralStrip).x()-entr.x();
192  if (deltaw<0.) {
193  if (lstrip < roll->nstrips() ){
194  lstrip++;
195  cls.push_back(lstrip);
196  }
197  }else{
198  if (fstrip > 1 ){
199  fstrip--;
200  cls.push_back(fstrip);
201  }
202  }
203  }
204  }
205 
206  for (std::vector<int>::iterator i=cls.begin(); i!=cls.end();i++){
207  // Check the timing of the adjacent strip
208  std::pair<int, int> digi(*i,time_hit);
209  theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit)));
210  strips.insert(digi);
211  }
212  }
213  }
214 }
CLHEP::RandFlat * flatDistribution_
Definition: RPCSimAverage.h:71
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)
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:45
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
Definition: RPCSim.h:32
RPCDetId id() const
Definition: RPCRoll.cc:24
Container::value_type value_type
int getSimHitBx(const PSimHit *)
RPCSynchronizer * _rpcSync
Definition: RPCSimAverage.h:68
void clear()
Definition: DetSet.h:70
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 RPCSimAverage::simulateNoise ( const RPCRoll roll)
virtual

Implements RPCSim.

Definition at line 216 of file RPCSimAverage.cc.

References compareJSON::const, flatDistribution1, flatDistribution2, gate, i, RPCRoll::id(), N_hits, nbxing, RPCRoll::nstrips(), poissonDistribution, rate, RPCDetId::region(), RPCSim::strips, RPCRoll::topology(), x, SiStripMonitorClusterAlca_cfi::xmax, and SiStripMonitorClusterAlca_cfi::xmin.

217 {
218 
219  RPCDetId rpcId = roll->id();
220  int nstrips = roll->nstrips();
221  double area = 0.0;
222 
223  if ( rpcId.region() == 0 )
224  {
225  const RectangularStripTopology* top_ = dynamic_cast<const
226  RectangularStripTopology*>(&(roll->topology()));
227  float xmin = (top_->localPosition(0.)).x();
228  float xmax = (top_->localPosition((float)roll->nstrips())).x();
229  float striplength = (top_->stripLength());
230  area = striplength*(xmax-xmin);
231  }
232  else
233  {
234  const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
235  float xmin = (top_->localPosition(0.)).x();
236  float xmax = (top_->localPosition((float)roll->nstrips())).x();
237  float striplength = (top_->stripLength());
238  area = striplength*(xmax-xmin);
239  }
240 
241  double ave = rate*nbxing*gate*area*1.0e-9;
242 
243  N_hits = poissonDistribution->fire(ave);
244 
245  for (int i = 0; i < N_hits; i++ ){
246  int strip = static_cast<int>(flatDistribution1->fire(1,nstrips));
247  int time_hit;
248  time_hit = (static_cast<int>(flatDistribution2->fire((nbxing*gate)/gate))) - nbxing/2;
249  std::pair<int, int> digi(strip,time_hit);
250  strips.insert(digi);
251  }
252 
253 }
int i
Definition: DBlmapReader.cc:9
const Topology & topology() const
Definition: RPCRoll.cc:30
CLHEP::RandPoissonQ * poissonDistribution
Definition: RPCSimAverage.h:74
int nstrips() const
Definition: RPCRoll.cc:46
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:57
RPCDetId id() const
Definition: RPCRoll.cc:24
CLHEP::RandFlat * flatDistribution1
Definition: RPCSimAverage.h:72
CLHEP::RandFlat * flatDistribution2
Definition: RPCSimAverage.h:73
string const
Definition: compareJSON.py:14
Definition: DDAxes.h:10
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:66

Member Data Documentation

RPCSynchronizer* RPCSimAverage::_rpcSync
private

Definition at line 68 of file RPCSimAverage.h.

Referenced by RPCSimAverage(), setRandomEngine(), simulate(), and ~RPCSimAverage().

double RPCSimAverage::aveCls
private

Definition at line 50 of file RPCSimAverage.h.

Referenced by RPCSimAverage().

double RPCSimAverage::aveEff
private

Definition at line 47 of file RPCSimAverage.h.

Referenced by RPCSimAverage(), and simulate().

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

Definition at line 64 of file RPCSimAverage.h.

Referenced by getClSize().

double RPCSimAverage::dtimCs
private

Definition at line 53 of file RPCSimAverage.h.

Referenced by RPCSimAverage().

CLHEP::RandFlat* RPCSimAverage::flatDistribution1
private

Definition at line 72 of file RPCSimAverage.h.

Referenced by setRandomEngine(), simulateNoise(), and ~RPCSimAverage().

CLHEP::RandFlat* RPCSimAverage::flatDistribution2
private

Definition at line 73 of file RPCSimAverage.h.

Referenced by setRandomEngine(), simulateNoise(), and ~RPCSimAverage().

CLHEP::RandFlat* RPCSimAverage::flatDistribution_
private

Definition at line 71 of file RPCSimAverage.h.

Referenced by getClSize(), setRandomEngine(), simulate(), and ~RPCSimAverage().

double RPCSimAverage::gate
private

Definition at line 62 of file RPCSimAverage.h.

Referenced by RPCSimAverage(), and simulateNoise().

std::ifstream* RPCSimAverage::infile
private

Definition at line 66 of file RPCSimAverage.h.

double RPCSimAverage::lbGate
private

Definition at line 56 of file RPCSimAverage.h.

Referenced by RPCSimAverage().

int RPCSimAverage::N_hits
private

Definition at line 59 of file RPCSimAverage.h.

Referenced by simulateNoise().

int RPCSimAverage::nbxing
private

Definition at line 60 of file RPCSimAverage.h.

Referenced by RPCSimAverage(), and simulateNoise().

CLHEP::RandPoissonQ* RPCSimAverage::poissonDistribution
private

Definition at line 74 of file RPCSimAverage.h.

Referenced by setRandomEngine(), simulateNoise(), and ~RPCSimAverage().

double RPCSimAverage::rate
private

Definition at line 61 of file RPCSimAverage.h.

Referenced by RPCSimAverage(), and simulateNoise().

double RPCSimAverage::resEle
private

Definition at line 54 of file RPCSimAverage.h.

Referenced by RPCSimAverage().

double RPCSimAverage::resRPC
private

Definition at line 51 of file RPCSimAverage.h.

Referenced by RPCSimAverage().

bool RPCSimAverage::rpcdigiprint
private

Definition at line 57 of file RPCSimAverage.h.

Referenced by RPCSimAverage().

double RPCSimAverage::sspeed
private

Definition at line 55 of file RPCSimAverage.h.

Referenced by RPCSimAverage().

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

Definition at line 65 of file RPCSimAverage.h.

Referenced by getClSize().

double RPCSimAverage::timOff
private

Definition at line 52 of file RPCSimAverage.h.

Referenced by RPCSimAverage().