CMS 3D CMS Logo

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

#include <RPCSimModelTiming.h>

Inheritance diagram for RPCSimModelTiming:
RPCSim

Public Member Functions

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

Protected Member Functions

void init () override
 
- Protected Member Functions inherited from RPCSim
virtual void addLinks (unsigned int strip, int bx)
 
 RPCSim (const edm::ParameterSet &config)
 

Protected Attributes

RPCSynchronizer_rpcSync
 
double aveCls
 
double aveEff
 
std::vector< double > clsForDetId
 
std::map< int, std::vector
< double > > 
clsMap
 
bool do_Y
 
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 sigmaY
 
double sspeed
 
std::vector< double > sum_clsize
 
double timOff
 
- Protected Attributes inherited from RPCSim
std::set< RPCDigiirpc_digis
 
std::set< std::pair< int, int > > strips
 
DetectorHitMap theDetectorHitMap
 
DigiSimLinks theDigiSimLinks
 
RPCDigiSimLinks theRpcDigiSimLinks
 
RPCSimSetUptheSimSetUp
 

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
 

Detailed Description

Definition at line 31 of file RPCSimModelTiming.h.

Constructor & Destructor Documentation

RPCSimModelTiming::RPCSimModelTiming ( const edm::ParameterSet config)

Definition at line 42 of file RPCSimModelTiming.cc.

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

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

Definition at line 76 of file RPCSimModelTiming.cc.

References _rpcSync.

77 {
78  delete _rpcSync;
79 }
RPCSynchronizer * _rpcSync

Member Function Documentation

int RPCSimModelTiming::getClSize ( uint32_t  id,
float  posX,
CLHEP::HepRandomEngine *  engine 
)

Definition at line 252 of file RPCSimModelTiming.cc.

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

Referenced by simulate().

253 {
254  std::vector<double> clsForDetId = getRPCSimSetUp()->getCls(id);
255 
256  int cnt = 1;
257  int min = 1;
258  double func=0.0;
259  std::vector<double> sum_clsize;
260 
261  sum_clsize.clear();
262  sum_clsize = clsForDetId;
263  int vectOffset(0);
264 
265  double rr_cl = CLHEP::RandFlat::shoot(engine);
266 
267  if(0.0 <= posX && posX < 0.2) {
268  func = clsForDetId[19]*(rr_cl);
269  vectOffset = 0;
270  }
271  if(0.2 <= posX && posX < 0.4) {
272  func = clsForDetId[39]*(rr_cl);
273  vectOffset = 20;
274  }
275  if(0.4 <= posX && posX < 0.6) {
276  func = clsForDetId[59]*(rr_cl);
277  vectOffset = 40;
278  }
279  if(0.6 <= posX && posX < 0.8) {
280  func = clsForDetId[79]*(rr_cl);
281  vectOffset = 60;
282  }
283  if(0.8 <= posX && posX < 1.0) {
284  func = clsForDetId[89]*(rr_cl);
285  vectOffset = 80;
286  }
287 
288 
289  for(int i = vectOffset; i<(vectOffset+20); i++){
290  cnt++;
291  if(func > clsForDetId[i]){
292  min = cnt;
293  }
294  else if(func < clsForDetId[i]){
295  break;
296  }
297  }
298  return min;
299 }
int i
Definition: DBlmapReader.cc:9
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:50
std::vector< double > clsForDetId
std::vector< double > sum_clsize
const std::vector< double > & getCls(uint32_t id)
Definition: RPCSimSetUp.cc:408
T min(T a, T b)
Definition: MathUtil.h:58
void RPCSimModelTiming::init ( void  )
inlineoverrideprotectedvirtual

Implements RPCSim.

Definition at line 45 of file RPCSimModelTiming.h.

45 {};
int RPCSimModelTiming::LeftRightNeighbour ( const RPCRoll roll,
const LocalPoint hit_pos,
int  strip 
)

Definition at line 301 of file RPCSimModelTiming.cc.

References RPCRoll::centreOfStrip(), RPCRoll::nstrips(), x, and PV3DBase< T, PVType, FrameType >::x().

Referenced by simulate().

301  {
302 
303  //if left return -1
304  //if right return +1
305 
306  int leftStrip = strip-1;
307  int rightStrip = strip+1;
308 
309  if(leftStrip<0)
310  return +1;
311  if( rightStrip > roll.nstrips())
312  return -1;
313 
314  double deltawL = fabs((roll.centreOfStrip(leftStrip)).x()-hit_pos.x());
315  double deltawR = fabs((roll.centreOfStrip(rightStrip)).x()-hit_pos.x());
316 
317  if(deltawL>=deltawR){
318  return +1;
319  }
320  else {
321  return -1;
322  }
323 
324 }
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:52
int nstrips() const
Definition: RPCRoll.cc:46
T x() const
Definition: PV3DBase.h:62
void RPCSimModelTiming::simulate ( const RPCRoll roll,
const edm::PSimHitContainer rpcHits,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

Implements RPCSim.

Definition at line 81 of file RPCSimModelTiming.cc.

References _rpcSync, Topology::channel(), GetRecoTauVFromDQM_MC_cff::cl, edm::DetSet< T >::clear(), do_Y, getClSize(), RPCSim::getRPCSimSetUp(), RPCSynchronizer::getSimHitBxAndTimingForIRPC(), RPCSynchronizer::getSmearedTime(), RPCDigi::hasTime(), RPCDigi::hasY(), i, RPCRoll::id(), RPCSim::irpc_digis, LeftRightNeighbour(), RPCRoll::nstrips(), HLT_FULL_cff::particleType, DetId::rawId(), RPCDigi::setDeltaY(), RPCSynchronizer::setRPCSimSetUp(), RPCDigi::setTime(), RPCDigi::setY(), sigmaY, RPCRoll::specs(), RPCRoll::strip(), RPCSim::theDetectorHitMap, RPCSim::theRpcDigiSimLinks, RPCRollSpecs::topology(), and ecaldqm::topology().

84 {
85 
88  theDetectorHitMap.clear();
90 
91  RPCDetId rpcId = roll->id();
92  RPCGeomServ RPCname(rpcId);
93 
94  const Topology& topology=roll->specs()->topology();
95 
96  for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
97  _hit != rpcHits.end(); ++_hit){
98 
99  if(_hit-> particleType() == 11) continue;
100  // Here I hould check if the RPC are up side down;
101  const LocalPoint& entr=_hit->entryPoint();
102 
103  int time_hit = _rpcSync->getSimHitBxAndTimingForIRPC(&(*_hit), engine);
104  double precise_time = _rpcSync->getSmearedTime();
105 
106  float posX = roll->strip(_hit->localPosition()) - static_cast<int>(roll->strip(_hit->localPosition()));
107 
108  std::vector<float> veff = (getRPCSimSetUp())->getEff(rpcId.rawId());
109 
110  // Effinciecy
111  int centralStrip = topology.channel(entr)+1;;
112  float fire = CLHEP::RandFlat::shoot(engine);
113 
114  float smearedPositionY = CLHEP::RandGaussQ::shoot(engine,_hit->localPosition().y(),sigmaY);
115 
116  if (fire < veff[centralStrip-1]) {
117 
118  int fstrip=centralStrip;
119  int lstrip=centralStrip;
120 
121  // Compute the cluster size
122  int clsize = this->getClSize(rpcId.rawId(),posX, engine); // This is for cluster size chamber by chamber
123  std::vector<int> cls;
124  cls.push_back(centralStrip);
125  if (clsize > 1){
126  for (int cl = 0; cl < (clsize-1)/2; cl++){
127  if (centralStrip - cl -1 >= 1 ){
128  fstrip = centralStrip-cl-1;
129  cls.push_back(fstrip);
130  }
131  if (centralStrip + cl + 1 <= roll->nstrips() ){
132  lstrip = centralStrip+cl+1;
133  cls.push_back(lstrip);
134  }
135  }
136  if (clsize%2 == 0 ){
137  // insert the last strip according to the
138  // simhit position in the central strip
139  int lr = LeftRightNeighbour(*roll, entr, centralStrip);
140  if (lr==1) {
141  if (lstrip < roll->nstrips() ){
142  lstrip++;
143  cls.push_back(lstrip);
144  }
145  }else{
146  if (fstrip > 1 ){
147  fstrip--;
148  cls.push_back(fstrip);
149  }
150  }
151  }
152  }
153 
154  for (std::vector<int>::iterator i=cls.begin(); i!=cls.end();i++){
155  // Check the timing of the adjacent strip
156  if(*i != centralStrip){
157  if(CLHEP::RandFlat::shoot(engine) < veff[*i-1]){
158  std::pair<int, int> digi(*i,time_hit);
159  RPCDigi adigi(*i,time_hit);
160  adigi.hasTime(true);
161  adigi.setTime(precise_time);
162  if(do_Y)
163  {
164  adigi.hasY(true);
165  adigi.setY(smearedPositionY);
166  adigi.setDeltaY(sigmaY);
167  }
168  irpc_digis.insert(adigi);
169 
170  theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit)));
171  }
172  }
173  else {
174  std::pair<int, int> digi(*i,time_hit);
175  RPCDigi adigi(*i,time_hit);
176  adigi.hasTime(true);
177  adigi.setTime(precise_time);
178  if(do_Y)
179  {
180  adigi.hasY(true);
181  adigi.setY(smearedPositionY);
182  adigi.setDeltaY(sigmaY);
183  }
184  irpc_digis.insert(adigi);
185  theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit)));
186  }
187  }
188  }
189  }
190 }
float strip(const LocalPoint &lp) const
Definition: RPCRoll.cc:71
int i
Definition: DBlmapReader.cc:9
int LeftRightNeighbour(const RPCRoll &roll, const LocalPoint &hit_pos, int strip)
CaloTopology const * topology(0)
DetectorHitMap theDetectorHitMap
Definition: RPCSim.h:72
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
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
double getSmearedTime() const
virtual int channel(const LocalPoint &p) const =0
int getClSize(uint32_t id, float posX, CLHEP::HepRandomEngine *)
std::set< RPCDigi > irpc_digis
Definition: RPCSim.h:61
RPCSynchronizer * _rpcSync
void clear()
Definition: DetSet.h:69
RPCDigiSimLinks theRpcDigiSimLinks
Definition: RPCSim.h:74
int getSimHitBxAndTimingForIRPC(const PSimHit *, CLHEP::HepRandomEngine *)
tuple particleType
const Topology & topology() const
Definition: RPCRollSpecs.cc:43
void RPCSimModelTiming::simulateNoise ( const RPCRoll roll,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

Implements RPCSim.

Definition at line 192 of file RPCSimModelTiming.cc.

References edmStreamStallGrapher::const, do_Y, frate, gate, RPCSim::getRPCSimSetUp(), RPCDigi::hasTime(), RPCDigi::hasY(), i, RPCRoll::id(), RPCSim::irpc_digis, j, RectangularStripTopology::localPosition(), TrapezoidalStripTopology::localPosition(), N_hits, nbxing, RPCRoll::nstrips(), DetId::rawId(), RPCDetId::region(), RPCDigi::setDeltaY(), RPCDigi::setTime(), RPCDigi::setY(), sigmaY, RectangularStripTopology::stripLength(), TrapezoidalStripTopology::stripLength(), RPCRoll::topology(), x, hlt_dqm_clientPB-live_cfg::xmax, and hlt_dqm_clientPB-live_cfg::xmin.

194 {
195  RPCDetId rpcId = roll->id();
196  RPCGeomServ RPCname(rpcId);
197  std::vector<float> vnoise = (getRPCSimSetUp())->getNoise(rpcId.rawId());
198  std::vector<float> veff = (getRPCSimSetUp())->getEff(rpcId.rawId());
199  unsigned int nstrips = roll->nstrips();
200  double area = 0.0;
201  float striplength, xmin,xmax ;
202  if ( rpcId.region() == 0 )
203  {
204  const RectangularStripTopology* top_ = dynamic_cast<const
205  RectangularStripTopology*>(&(roll->topology()));
206  xmin = (top_->localPosition(0.)).x();
207  xmax = (top_->localPosition((float)roll->nstrips())).x();
208  striplength = (top_->stripLength());
209  area = striplength*(xmax-xmin);
210  }
211  else
212  {
213  const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
214  xmin = (top_->localPosition(0.)).x();
215  xmax = (top_->localPosition((float)roll->nstrips())).x();
216  striplength = (top_->stripLength());
217  area = striplength*(xmax-xmin);
218  }
219 
220  for(unsigned int j = 0; j < vnoise.size(); ++j){
221 
222  if(j >= nstrips) break;
223 
224  double ave =
225  vnoise[j]*nbxing*gate*area*1.0e-9*frate/((float)roll->nstrips());
226 
227  CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
228  N_hits = randPoissonQ.fire();
229  for (int i = 0; i < N_hits; i++ ){
230 
231 
232  double precise_time = CLHEP::RandFlat::shoot(engine, (nbxing*gate)/gate);
233  int time_hit = (static_cast<int>(precise_time)) - nbxing/2;
234  RPCDigi adigi(j+1,time_hit);
235  adigi.hasTime(true);
236  adigi.setTime(precise_time);
237  if(do_Y)
238  {
239  double positionY = CLHEP::RandFlat::shoot(engine,striplength);
240  positionY-=striplength/2;
241  adigi.hasY(true);
242  adigi.setY(positionY);
243  adigi.setDeltaY(sigmaY);
244  }
245  irpc_digis.insert(adigi);
246 
247  }
248  }
249 }
int i
Definition: DBlmapReader.cc:9
const Topology & topology() const
Definition: RPCRoll.cc:30
virtual float stripLength() const
int nstrips() const
Definition: RPCRoll.cc:46
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:50
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
std::set< RPCDigi > irpc_digis
Definition: RPCSim.h:61
virtual LocalPoint localPosition(float strip) const
virtual LocalPoint localPosition(float strip) const
virtual float stripLength() const
det heigth (strip length in the middle)
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63

Member Data Documentation

RPCSynchronizer* RPCSimModelTiming::_rpcSync
protected

Definition at line 70 of file RPCSimModelTiming.h.

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

double RPCSimModelTiming::aveCls
protected

Definition at line 48 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming().

double RPCSimModelTiming::aveEff
protected

Definition at line 45 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming().

std::vector<double> RPCSimModelTiming::clsForDetId
protected

Definition at line 67 of file RPCSimModelTiming.h.

Referenced by getClSize().

std::map< int, std::vector<double> > RPCSimModelTiming::clsMap
protected

Definition at line 65 of file RPCSimModelTiming.h.

bool RPCSimModelTiming::do_Y
protected

Definition at line 62 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming(), simulate(), and simulateNoise().

double RPCSimModelTiming::dtimCs
protected

Definition at line 51 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming().

double RPCSimModelTiming::frate
protected

Definition at line 61 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming(), and simulateNoise().

double RPCSimModelTiming::gate
protected

Definition at line 60 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming(), and simulateNoise().

std::ifstream* RPCSimModelTiming::infile
protected

Definition at line 68 of file RPCSimModelTiming.h.

double RPCSimModelTiming::lbGate
protected

Definition at line 54 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming().

int RPCSimModelTiming::N_hits
protected

Definition at line 57 of file RPCSimModelTiming.h.

Referenced by simulateNoise().

int RPCSimModelTiming::nbxing
protected

Definition at line 58 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming(), and simulateNoise().

double RPCSimModelTiming::rate
protected

Definition at line 59 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming().

double RPCSimModelTiming::resEle
protected

Definition at line 52 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming().

double RPCSimModelTiming::resRPC
protected

Definition at line 49 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming().

bool RPCSimModelTiming::rpcdigiprint
protected

Definition at line 55 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming().

double RPCSimModelTiming::sigmaY
protected

Definition at line 63 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming(), simulate(), and simulateNoise().

double RPCSimModelTiming::sspeed
protected

Definition at line 53 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming().

std::vector<double> RPCSimModelTiming::sum_clsize
protected

Definition at line 66 of file RPCSimModelTiming.h.

Referenced by getClSize().

double RPCSimModelTiming::timOff
protected

Definition at line 50 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming().