CMS 3D CMS Logo

Public Member Functions | Private Attributes

RPCSynchronizer Class Reference

#include <RPCSynchronizer.h>

List of all members.

Public Member Functions

RPCSimSetUpgetRPCSimSetUp ()
int getSimHitBx (const PSimHit *)
 RPCSynchronizer (const edm::ParameterSet &config)
void setRandomEngine (CLHEP::HepRandomEngine &eng)
void setRPCSimSetUp (RPCSimSetUp *simsetup)
 ~RPCSynchronizer ()

Private Attributes

double cosmicPar
bool cosmics
double cspeed
double dtimCs
CLHEP::RandGaussQ * gauss1
CLHEP::RandGaussQ * gauss2
double lbGate
double lbGateNew
double resEle
double resRPC
double sspeed
RPCSimSetUptheSimSetUp
double timOff

Detailed Description

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

Author:
Raffaello Trentadue -- INFN Bari

Definition at line 44 of file RPCSynchronizer.h.


Constructor & Destructor Documentation

RPCSynchronizer::RPCSynchronizer ( const edm::ParameterSet config)

Definition at line 40 of file RPCSynchronizer.cc.

References trackerHits::c, alignCSCRings::e, and edm::ParameterSet::getParameter().

                                                             {

  resRPC = config.getParameter<double>("timeResolution");
  timOff = config.getParameter<double>("timingRPCOffset");
  dtimCs = config.getParameter<double>("deltatimeAdjacentStrip");
  resEle = config.getParameter<double>("timeJitter");
  sspeed = config.getParameter<double>("signalPropagationSpeed");
  lbGate = config.getParameter<double>("linkGateWidth");

  cosmics = config.getParameter<bool>("cosmics");

  //"magic" parameter for cosmics
  cosmicPar=37.62;

  double c=299792458;// [m/s]
  //light speed in [cm/ns]
  cspeed=c*1e+2*1e-9;
  //signal propagation speed [cm/ns]
  sspeed=sspeed*cspeed;

}
RPCSynchronizer::~RPCSynchronizer ( )

Definition at line 68 of file RPCSynchronizer.cc.

                                 {
  delete gauss1;
  delete gauss2;
}

Member Function Documentation

RPCSimSetUp* RPCSynchronizer::getRPCSimSetUp ( ) [inline]

Definition at line 52 of file RPCSynchronizer.h.

References theSimSetUp.

{ return theSimSetUp; }
int RPCSynchronizer::getSimHitBx ( const PSimHit simhit)

Definition at line 74 of file RPCSynchronizer.cc.

References RPCGeometry::dets(), PSimHit::detUnitId(), geometry, RPCSimSetUp::getGeometry(), RPCSimSetUp::getTime(), PSimHit::localPosition(), n, alignCSCRings::r, RPCChamber::rolls(), PSimHit::timeOfFlight(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by RPCSimAverageNoiseEff::simulate(), RPCSimAverageNoise::simulate(), RPCSimParam::simulate(), RPCSimAverageNoiseEffCls::simulate(), RPCSimTriv::simulate(), RPCSimSimple::simulate(), and RPCSimAverage::simulate().

{

  RPCSimSetUp* simsetup = this->getRPCSimSetUp();
  const RPCGeometry * geometry = simsetup->getGeometry();
  float timeref = simsetup->getTime(simhit->detUnitId());

  int bx = -999;
  LocalPoint simHitPos = simhit->localPosition();
  float tof = simhit->timeOfFlight();
  
  //automatic variable to prevent memory leak
  
  float rr_el = gauss1->fire(0.,resEle);
  
  RPCDetId SimDetId(simhit->detUnitId());

  const RPCRoll* SimRoll = 0;

  for(TrackingGeometry::DetContainer::const_iterator it = geometry->dets().begin(); it != geometry->dets().end(); it++){
    
    if( dynamic_cast< RPCChamber* >( *it ) != 0 ){
      
      RPCChamber* ch = dynamic_cast< RPCChamber* >( *it ); 

      std::vector< const RPCRoll*> rollsRaf = (ch->rolls());
      for(std::vector<const RPCRoll*>::iterator r = rollsRaf.begin();
          r != rollsRaf.end(); ++r){

          if((*r)->id() == SimDetId) {
            SimRoll = &(*(*r));
            break;
          }
      }
    }
  }

  if(SimRoll != 0){

    float distanceFromEdge = 0;
    float half_stripL = 0.;

    if(SimRoll->id().region() == 0){
      const RectangularStripTopology* top_= dynamic_cast<const RectangularStripTopology*> (&(SimRoll->topology()));
      half_stripL = top_->stripLength()/2;
      distanceFromEdge = half_stripL + simHitPos.y();
    }else{
      const TrapezoidalStripTopology* top_= dynamic_cast<const TrapezoidalStripTopology*> (&(SimRoll->topology()));
      half_stripL = top_->stripLength()/2;
      distanceFromEdge = half_stripL - simHitPos.y();
    }


    float prop_time =  distanceFromEdge/sspeed;

    double rr_tim1 = gauss2->fire(0.,resEle);
    double total_time = tof + prop_time + timOff + rr_tim1 + rr_el;
    
    // Bunch crossing assignment
    double time_differ = 0.;

    if(cosmics){
      time_differ = (total_time - (timeref + ((half_stripL/sspeed ) + timOff)))/cosmicPar;
    }
    else if(!cosmics){
      time_differ = total_time - (timeref + ( half_stripL/sspeed ) + timOff);
    }
     
    double inf_time = 0;
    double sup_time = 0;


    for(int n = -5; n <= 5; ++n){

      if(cosmics){
        inf_time = (-lbGate/2 + n*lbGate )/cosmicPar;
        sup_time = ( lbGate/2 + n*lbGate )/cosmicPar;
      }
      else if(!cosmics){
        inf_time = -lbGate/2 + n*lbGate;
        sup_time =  lbGate/2 + n*lbGate;
      }

      if(inf_time < time_differ && time_differ < sup_time) {
        bx = n;
        break;
      }
    }
  }


  return bx;
}
void RPCSynchronizer::setRandomEngine ( CLHEP::HepRandomEngine &  eng)
void RPCSynchronizer::setRPCSimSetUp ( RPCSimSetUp simsetup) [inline]

Member Data Documentation

double RPCSynchronizer::cosmicPar [private]

Definition at line 66 of file RPCSynchronizer.h.

bool RPCSynchronizer::cosmics [private]

Definition at line 68 of file RPCSynchronizer.h.

double RPCSynchronizer::cspeed [private]

Definition at line 63 of file RPCSynchronizer.h.

double RPCSynchronizer::dtimCs [private]

Definition at line 60 of file RPCSynchronizer.h.

CLHEP::RandGaussQ* RPCSynchronizer::gauss1 [private]

Definition at line 70 of file RPCSynchronizer.h.

CLHEP::RandGaussQ* RPCSynchronizer::gauss2 [private]

Definition at line 71 of file RPCSynchronizer.h.

double RPCSynchronizer::lbGate [private]

Definition at line 64 of file RPCSynchronizer.h.

double RPCSynchronizer::lbGateNew [private]

Definition at line 65 of file RPCSynchronizer.h.

double RPCSynchronizer::resEle [private]

Definition at line 61 of file RPCSynchronizer.h.

double RPCSynchronizer::resRPC [private]

Definition at line 58 of file RPCSynchronizer.h.

double RPCSynchronizer::sspeed [private]

Definition at line 62 of file RPCSynchronizer.h.

Definition at line 72 of file RPCSynchronizer.h.

Referenced by getRPCSimSetUp(), and setRPCSimSetUp().

double RPCSynchronizer::timOff [private]

Definition at line 59 of file RPCSynchronizer.h.