CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
CSCWireHitSim Class Reference

#include <CSCWireHitSim.h>

Public Member Functions

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

Private Member Functions

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

Private Attributes

CSCDriftSimtheDriftSim
 
CSCGasCollisionstheGasIonizer
 
std::vector< CSCDetectorHittheNewWireHits
 

Detailed Description

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

Author
Rick Wilkinson
Tim Cox

Definition at line 27 of file CSCWireHitSim.h.

Constructor & Destructor Documentation

CSCWireHitSim::CSCWireHitSim ( CSCDriftSim driftSim,
const edm::ParameterSet p 
)
explicit

Definition at line 10 of file CSCWireHitSim.cc.

11  : theDriftSim(driftSim), theGasIonizer(new CSCGasCollisions(p)), theNewWireHits() {}
CSCDriftSim * theDriftSim
Definition: CSCWireHitSim.h:45
CSCGasCollisions * theGasIonizer
Definition: CSCWireHitSim.h:46
std::vector< CSCDetectorHit > theNewWireHits
Definition: CSCWireHitSim.h:47
CSCWireHitSim::~CSCWireHitSim ( )

Definition at line 13 of file CSCWireHitSim.cc.

References theGasIonizer.

13 { delete theGasIonizer; }
CSCGasCollisions * theGasIonizer
Definition: CSCWireHitSim.h:46

Member Function Documentation

CSCDetectorHit CSCWireHitSim::driftElectronsToWire ( )
private
std::vector< LocalPoint > CSCWireHitSim::getIonizationClusters ( const PSimHit hit,
const CSCLayer layer,
CLHEP::HepRandomEngine *  engine 
)
private

Definition at line 40 of file CSCWireHitSim.cc.

References lowPtElectrons_cff::electrons, PSimHit::entryPoint(), PSimHit::exitPoint(), CSCLayer::geometry(), CSCLayerGeometry::inside(), LogTrace, PSimHit::pabs(), PSimHit::particleType(), CSCGasCollisions::simulate(), and theGasIonizer.

Referenced by simulate().

42  {
43  const LocalPoint &entryPoint = simHit.entryPoint();
44  const LocalPoint &exitPoint = simHit.exitPoint();
45 
46  LogTrace("CSCWireHitSim") << "CSCWireHitSim:"
47  << " type=" << simHit.particleType() << " mom=" << simHit.pabs() << "\n Local entry "
48  << entryPoint << " exit " << exitPoint;
49 
50  std::vector<LocalPoint> positions;
51  std::vector<int> electrons;
52  theGasIonizer->simulate(simHit, positions, electrons, engine);
53 
54  std::vector<LocalPoint> results; // start empty
55 
56  int j = 0;
57  for (std::vector<LocalPoint>::const_iterator pointItr = positions.begin(); pointItr != positions.end(); ++pointItr) {
58  ++j;
59  // some verification
60  if (layer->geometry()->inside(*pointItr)) {
61  // push the point for each electron at this point
62 
63  for (int ie = 1; ie <= electrons[j - 1]; ++ie) {
64  // probability of getting attached
65  float f_att = 0.5;
66  if (CLHEP::RandFlat::shoot(engine) > f_att) {
67  results.push_back(*pointItr);
68  }
69  }
70  }
71  }
72  LogTrace("CSCWireHitSim") << "CSCWireHitSim: there are " << results.size()
73  << " clusters identified with each electron.";
74  return results;
75 }
bool inside(const Local3DPoint &, const LocalError &, float scale=1.f) const override
#define LogTrace(id)
CSCGasCollisions * theGasIonizer
Definition: CSCWireHitSim.h:46
void simulate(const PSimHit &, std::vector< LocalPoint > &clusters, std::vector< int > &electrons, CLHEP::HepRandomEngine *)
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:47
void CSCWireHitSim::setParticleDataTable ( const ParticleDataTable pdt)

Definition at line 77 of file CSCWireHitSim.cc.

References CSCGasCollisions::setParticleDataTable(), and theGasIonizer.

Referenced by CSCDigitizer::setParticleDataTable().

void setParticleDataTable(const ParticleDataTable *pdt)
CSCGasCollisions * theGasIonizer
Definition: CSCWireHitSim.h:46
std::vector< CSCDetectorHit > & CSCWireHitSim::simulate ( const CSCLayer layer,
const edm::PSimHitContainer simHits,
CLHEP::HepRandomEngine *  engine 
)

Definition at line 15 of file CSCWireHitSim.cc.

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

Referenced by CSCDigitizer::doAction().

17  {
18  const CSCLayerGeometry *geom = layer->geometry();
19 
20  theNewWireHits.clear();
21  for (edm::PSimHitContainer::const_iterator hitItr = simHits.begin(); hitItr != simHits.end(); ++hitItr) {
22  std::vector<LocalPoint> ionClusters = getIonizationClusters(*hitItr, layer, engine);
23 
24  unsigned nClusters = ionClusters.size();
25  theNewWireHits.reserve(theNewWireHits.size() + nClusters);
26 
27  for (unsigned icl = 0; icl < nClusters; ++icl) {
28  // Drift the electrons in the cluster to the nearest wire...
29  int nearestWire = geom->nearestWire(ionClusters[icl]);
30 
31  // The wire hit contains wire# and position measured _along the wire_
32  // from where it intersects local y axis.
33 
34  theNewWireHits.push_back(theDriftSim->getWireHit(ionClusters[icl], layer, nearestWire, *hitItr, engine));
35  }
36  }
37  return theNewWireHits;
38 }
int nearestWire(const LocalPoint &lp) const
CSCDetectorHit getWireHit(const Local3DPoint &ionClusterPosition, const CSCLayer *, int wire, const PSimHit &simHit, CLHEP::HepRandomEngine *)
Definition: CSCDriftSim.cc:55
CSCDriftSim * theDriftSim
Definition: CSCWireHitSim.h:45
std::vector< Local3DPoint > getIonizationClusters(const PSimHit &hit, const CSCLayer *, CLHEP::HepRandomEngine *)
std::vector< CSCDetectorHit > theNewWireHits
Definition: CSCWireHitSim.h:47
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:47

Member Data Documentation

CSCDriftSim* CSCWireHitSim::theDriftSim
private

Definition at line 45 of file CSCWireHitSim.h.

Referenced by simulate().

CSCGasCollisions* CSCWireHitSim::theGasIonizer
private

Definition at line 46 of file CSCWireHitSim.h.

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

std::vector<CSCDetectorHit> CSCWireHitSim::theNewWireHits
private

Definition at line 47 of file CSCWireHitSim.h.

Referenced by simulate().