CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

RPCSimTriv Class Reference

#include <RPCSimTriv.h>

Inheritance diagram for RPCSimTriv:
RPCSim

List of all members.

Public Member Functions

 RPCSimTriv (const edm::ParameterSet &config)
void setRandomEngine (CLHEP::HepRandomEngine &eng)
void simulate (const RPCRoll *roll, const edm::PSimHitContainer &rpcHits)
void simulateNoise (const RPCRoll *)
 ~RPCSimTriv ()

Private Member Functions

void init ()

Private Attributes

RPCSynchronizer_rpcSync
CLHEP::RandFlat * flatDistribution1
CLHEP::RandFlat * flatDistribution2
double gate
int N_hits
int nbxing
CLHEP::RandPoissonQ * poissonDistribution
double rate

Detailed Description

Class for the RPC strip response simulation based on a very simple model

Author:
Marcello Maggi -- INFN Bari

Definition at line 21 of file RPCSimTriv.h.


Constructor & Destructor Documentation

RPCSimTriv::RPCSimTriv ( const edm::ParameterSet config)

Definition at line 24 of file RPCSimTriv.cc.

References _rpcSync, gate, edm::ParameterSet::getParameter(), nbxing, and rate.

                                                    : RPCSim(config){

  rate=config.getParameter<double>("Rate");
  nbxing=config.getParameter<int>("Nbxing");
  gate=config.getParameter<double>("Gate");

  _rpcSync = new RPCSynchronizer(config);
}
RPCSimTriv::~RPCSimTriv ( )

Definition at line 40 of file RPCSimTriv.cc.

References _rpcSync, flatDistribution1, flatDistribution2, and poissonDistribution.

                       {
  delete flatDistribution1;
  delete flatDistribution2;
  delete poissonDistribution;
  delete _rpcSync;
}

Member Function Documentation

void RPCSimTriv::init ( void  ) [inline, private, virtual]

Implements RPCSim.

Definition at line 35 of file RPCSimTriv.h.

{};
void RPCSimTriv::setRandomEngine ( CLHEP::HepRandomEngine &  eng) [virtual]

Implements RPCSim.

Definition at line 33 of file RPCSimTriv.cc.

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

                                                         {
  flatDistribution1 = new CLHEP::RandFlat(eng);
  flatDistribution2 = new CLHEP::RandFlat(eng);
  poissonDistribution = new CLHEP::RandPoissonQ(eng);
  _rpcSync->setRandomEngine(eng);
}
void RPCSimTriv::simulate ( const RPCRoll roll,
const edm::PSimHitContainer rpcHits 
) [virtual]

Implements RPCSim.

Definition at line 48 of file RPCSimTriv.cc.

References _rpcSync, edm::DetSet< T >::clear(), RPCSim::getRPCSimSetUp(), RPCSynchronizer::getSimHitBx(), RPCRoll::id(), DetId::rawId(), RPCSynchronizer::setRPCSimSetUp(), RPCRoll::specs(), RPCSim::strips, RPCSim::theDetectorHitMap, RPCSim::theRpcDigiSimLinks, and RPCRollSpecs::topology().

{

  _rpcSync->setRPCSimSetUp(getRPCSimSetUp());
  theRpcDigiSimLinks.clear();
  theDetectorHitMap.clear();
  theRpcDigiSimLinks = RPCDigiSimLinks(roll->id().rawId());

  const Topology& topology=roll->specs()->topology();
  for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
       _hit != rpcHits.end(); ++_hit){

    int type = _hit->particleType();
    if (type == 13 || type == -13){
      // Here I hould check if the RPC are up side down;
      const LocalPoint& entr=_hit->entryPoint();
      int time_hit = _rpcSync->getSimHitBx(&(*_hit));
      std::pair<int, int> digi(topology.channel(entr)+1,
                               time_hit);

      theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit)));
      strips.insert(digi);
    }
  }
}
void RPCSimTriv::simulateNoise ( const RPCRoll roll) [virtual]

Implements RPCSim.

Definition at line 76 of file RPCSimTriv.cc.

References compareJSON::const, flatDistribution1, flatDistribution2, gate, i, RPCRoll::id(), TrapezoidalStripTopology::localPosition(), RectangularStripTopology::localPosition(), N_hits, nbxing, RPCRoll::nstrips(), poissonDistribution, rate, RPCDetId::region(), strip(), RectangularStripTopology::stripLength(), TrapezoidalStripTopology::stripLength(), RPCSim::strips, RPCRoll::topology(), and ExpressReco_HICollisions_FallBack::x.

{

  RPCDetId rpcId = roll->id();
  int nstrips = roll->nstrips();
  double area = 0.0;
  
  if ( rpcId.region() == 0 )
    {
      const RectangularStripTopology* top_ = dynamic_cast<const
        RectangularStripTopology*>(&(roll->topology()));
      float xmin = (top_->localPosition(0.)).x();
      float xmax = (top_->localPosition((float)roll->nstrips())).x();
      float striplength = (top_->stripLength());
      area = striplength*(xmax-xmin);
    }
  else
    {
      const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
      float xmin = (top_->localPosition(0.)).x();
      float xmax = (top_->localPosition((float)roll->nstrips())).x();
      float striplength = (top_->stripLength());
      area = striplength*(xmax-xmin);
    }
  

  double ave = rate*nbxing*gate*area*1.0e-9;

  N_hits = poissonDistribution->fire(ave);
  
  for (int i = 0; i < N_hits; i++ ){
    int strip = static_cast<int>(flatDistribution1->fire(1,nstrips));
    int time_hit;
    time_hit = (static_cast<int>(flatDistribution2->fire((nbxing*gate)/gate))) - nbxing/2;
    std::pair<int, int> digi(strip,time_hit);
    strips.insert(digi);
  }
}

Member Data Documentation

Definition at line 35 of file RPCSimTriv.h.

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

CLHEP::RandFlat* RPCSimTriv::flatDistribution1 [private]

Definition at line 45 of file RPCSimTriv.h.

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

CLHEP::RandFlat* RPCSimTriv::flatDistribution2 [private]

Definition at line 46 of file RPCSimTriv.h.

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

double RPCSimTriv::gate [private]

Definition at line 42 of file RPCSimTriv.h.

Referenced by RPCSimTriv(), and simulateNoise().

int RPCSimTriv::N_hits [private]

Definition at line 39 of file RPCSimTriv.h.

Referenced by simulateNoise().

int RPCSimTriv::nbxing [private]

Definition at line 40 of file RPCSimTriv.h.

Referenced by RPCSimTriv(), and simulateNoise().

CLHEP::RandPoissonQ* RPCSimTriv::poissonDistribution [private]

Definition at line 47 of file RPCSimTriv.h.

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

double RPCSimTriv::rate [private]

Definition at line 41 of file RPCSimTriv.h.

Referenced by RPCSimTriv(), and simulateNoise().