CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

CSCWireHitSim Class Reference

#include <CSCWireHitSim.h>

List of all members.

Public Member Functions

 CSCWireHitSim (CSCDriftSim *driftSim)
void setParticleDataTable (const ParticleDataTable *pdt)
void setRandomEngine (CLHEP::HepRandomEngine &engine)
std::vector< CSCDetectorHit > & simulate (const CSCLayer *layer, const edm::PSimHitContainer &simHits)
 ~CSCWireHitSim ()

Private Member Functions

CSCDetectorHit driftElectronsToWire ()
std::vector< Local3DPointgetIonizationClusters (const PSimHit &hit, const CSCLayer *)

Private Attributes

CSCDriftSimtheDriftSim
CSCGasCollisionstheGasIonizer
std::vector< CSCDetectorHittheNewWireHits
CLHEP::RandFlat * theRandFlat

Detailed Description

Class used to simulate hit on wire in Endcap Muon CSC.

Author:
Rick Wilkinson
Tim Cox

Definition at line 24 of file CSCWireHitSim.h.


Constructor & Destructor Documentation

CSCWireHitSim::CSCWireHitSim ( CSCDriftSim driftSim) [explicit]

Definition at line 9 of file CSCWireHitSim.cc.

CSCWireHitSim::~CSCWireHitSim ( )

Definition at line 18 of file CSCWireHitSim.cc.

References theGasIonizer, and theRandFlat.

                              {
  delete theRandFlat;
  delete theGasIonizer;
}

Member Function Documentation

CSCDetectorHit CSCWireHitSim::driftElectronsToWire ( ) [private]
std::vector< LocalPoint > CSCWireHitSim::getIonizationClusters ( const PSimHit hit,
const CSCLayer layer 
) [private]

Definition at line 59 of file CSCWireHitSim.cc.

References HI_PhotonSkim_cff::electrons, PSimHit::entryPoint(), PSimHit::exitPoint(), CSCLayer::geometry(), CSCLayerGeometry::inside(), j, LogTrace, PSimHit::pabs(), PSimHit::particleType(), python::entryComment::results, CSCGasCollisions::simulate(), theGasIonizer, and theRandFlat.

Referenced by simulate().

{
  const LocalPoint & entryPoint = simHit.entryPoint();
  const LocalPoint & exitPoint  = simHit.exitPoint();

  LogTrace("CSCWireHitSim") << "CSCWireHitSim:" 
      << " type=" << simHit.particleType() 
      << " mom=" << simHit.pabs()
      << "\n Local entry " << entryPoint << " exit " << exitPoint;

  std::vector<LocalPoint> positions;
  std::vector<int> electrons;
  theGasIonizer->simulate( simHit, positions, electrons );

  std::vector<LocalPoint> results; // start empty

  int j = 0;
  for( std::vector<LocalPoint>::const_iterator pointItr = positions.begin(); 
                                         pointItr != positions.end(); ++pointItr ) 
  {
    ++j;
    // some verification
    if(layer->geometry()->inside(*pointItr) ) {
      // push the point for each electron at this point
      
      for( int ie = 1;  ie <= electrons[j-1]; ++ie ) {
        // probability of getting attached
        float f_att = 0.5;
        if(theRandFlat->fire() > f_att) {
          results.push_back(*pointItr);
        }
      }
    }
  }
  LogTrace("CSCWireHitSim") << "CSCWireHitSim: there are " << results.size()
     << " clusters identified with each electron.";
  return results;
}
void CSCWireHitSim::setParticleDataTable ( const ParticleDataTable pdt)
void CSCWireHitSim::setRandomEngine ( CLHEP::HepRandomEngine &  engine)
std::vector< CSCDetectorHit > & CSCWireHitSim::simulate ( const CSCLayer layer,
const edm::PSimHitContainer simHits 
)

Definition at line 25 of file CSCWireHitSim.cc.

References relativeConstraints::geom, CSCLayer::geometry(), getIonizationClusters(), CSCDriftSim::getWireHit(), CSCLayerGeometry::nearestWire(), theDriftSim, and theNewWireHits.

Referenced by CSCDigitizer::doAction().

{
  const CSCLayerGeometry * geom = layer->geometry(); 

  theNewWireHits.clear();
  for (edm::PSimHitContainer::const_iterator hitItr = simHits.begin();
       hitItr != simHits.end();  ++hitItr)
  {

    std::vector<LocalPoint> ionClusters 
      = getIonizationClusters(*hitItr, layer);

    unsigned nClusters = ionClusters.size();
    theNewWireHits.reserve(theNewWireHits.size()+nClusters);

    for(unsigned icl = 0; icl < nClusters; ++icl) {

      // Drift the electrons in the cluster to the nearest wire...
      int nearestWire=geom->nearestWire(ionClusters[icl]);

      // The wire hit contains wire# and position measured _along the wire_
      // from where it intersects local y axis.

      theNewWireHits.push_back( 
          theDriftSim->getWireHit(ionClusters[icl], layer, nearestWire,
          *hitItr) );

    }
  } 
  return theNewWireHits;
}

Member Data Documentation

Definition at line 46 of file CSCWireHitSim.h.

Referenced by setRandomEngine(), and simulate().

Definition at line 48 of file CSCWireHitSim.h.

Referenced by simulate().

CLHEP::RandFlat* CSCWireHitSim::theRandFlat [private]

Definition at line 45 of file CSCWireHitSim.h.

Referenced by getIonizationClusters(), setRandomEngine(), and ~CSCWireHitSim().