CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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),
12  theGasIonizer( new CSCGasCollisions( p ) ) ,
14 {
15 }
CSCDriftSim * theDriftSim
Definition: CSCWireHitSim.h:48
CSCGasCollisions * theGasIonizer
Definition: CSCWireHitSim.h:49
std::vector< CSCDetectorHit > theNewWireHits
Definition: CSCWireHitSim.h:50
CSCWireHitSim::~CSCWireHitSim ( )

Definition at line 18 of file CSCWireHitSim.cc.

References theGasIonizer.

18  {
19  delete theGasIonizer;
20 }
CSCGasCollisions * theGasIonizer
Definition: CSCWireHitSim.h:49

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 59 of file CSCWireHitSim.cc.

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

Referenced by simulate().

62 {
63  const LocalPoint & entryPoint = simHit.entryPoint();
64  const LocalPoint & exitPoint = simHit.exitPoint();
65 
66  LogTrace("CSCWireHitSim") << "CSCWireHitSim:"
67  << " type=" << simHit.particleType()
68  << " mom=" << simHit.pabs()
69  << "\n Local entry " << entryPoint << " exit " << exitPoint;
70 
71  std::vector<LocalPoint> positions;
72  std::vector<int> electrons;
73  theGasIonizer->simulate( simHit, positions, electrons, engine );
74 
75  std::vector<LocalPoint> results; // start empty
76 
77  int j = 0;
78  for( std::vector<LocalPoint>::const_iterator pointItr = positions.begin();
79  pointItr != positions.end(); ++pointItr )
80  {
81  ++j;
82  // some verification
83  if(layer->geometry()->inside(*pointItr) ) {
84  // push the point for each electron at this point
85 
86  for( int ie = 1; ie <= electrons[j-1]; ++ie ) {
87  // probability of getting attached
88  float f_att = 0.5;
89  if(CLHEP::RandFlat::shoot(engine) > f_att) {
90  results.push_back(*pointItr);
91  }
92  }
93  }
94  }
95  LogTrace("CSCWireHitSim") << "CSCWireHitSim: there are " << results.size()
96  << " clusters identified with each electron.";
97  return results;
98 }
tuple results
Definition: mps_update.py:44
int j
Definition: DBlmapReader.cc:9
#define LogTrace(id)
CSCGasCollisions * theGasIonizer
Definition: CSCWireHitSim.h:49
bool inside(const Local3DPoint &, const LocalError &, float scale=1.f) const
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 101 of file CSCWireHitSim.cc.

References CSCGasCollisions::setParticleDataTable(), and theGasIonizer.

Referenced by CSCDigitizer::setParticleDataTable().

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

Definition at line 24 of file CSCWireHitSim.cc.

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

Referenced by CSCDigitizer::doAction().

27 {
28  const CSCLayerGeometry * geom = layer->geometry();
29 
30  theNewWireHits.clear();
31  for (edm::PSimHitContainer::const_iterator hitItr = simHits.begin();
32  hitItr != simHits.end(); ++hitItr)
33  {
34 
35  std::vector<LocalPoint> ionClusters
36  = getIonizationClusters(*hitItr, layer, engine);
37 
38  unsigned nClusters = ionClusters.size();
39  theNewWireHits.reserve(theNewWireHits.size()+nClusters);
40 
41  for(unsigned icl = 0; icl < nClusters; ++icl) {
42 
43  // Drift the electrons in the cluster to the nearest wire...
44  int nearestWire=geom->nearestWire(ionClusters[icl]);
45 
46  // The wire hit contains wire# and position measured _along the wire_
47  // from where it intersects local y axis.
48 
49  theNewWireHits.push_back(
50  theDriftSim->getWireHit(ionClusters[icl], layer, nearestWire,
51  *hitItr, engine) );
52 
53  }
54  }
55  return theNewWireHits;
56 }
int nearestWire(const LocalPoint &lp) const
CSCDetectorHit getWireHit(const Local3DPoint &ionClusterPosition, const CSCLayer *, int wire, const PSimHit &simHit, CLHEP::HepRandomEngine *)
Definition: CSCDriftSim.cc:61
CSCDriftSim * theDriftSim
Definition: CSCWireHitSim.h:48
std::vector< Local3DPoint > getIonizationClusters(const PSimHit &hit, const CSCLayer *, CLHEP::HepRandomEngine *)
tuple simHits
Definition: trackerHits.py:16
std::vector< CSCDetectorHit > theNewWireHits
Definition: CSCWireHitSim.h:50
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:47

Member Data Documentation

CSCDriftSim* CSCWireHitSim::theDriftSim
private

Definition at line 48 of file CSCWireHitSim.h.

Referenced by simulate().

CSCGasCollisions* CSCWireHitSim::theGasIonizer
private

Definition at line 49 of file CSCWireHitSim.h.

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

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

Definition at line 50 of file CSCWireHitSim.h.

Referenced by simulate().