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)
 
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.

10 : theRandFlat(0),
11  theDriftSim(driftSim),
14 {
15 }
CLHEP::RandFlat * theRandFlat
Definition: CSCWireHitSim.h:45
CSCDriftSim * theDriftSim
Definition: CSCWireHitSim.h:46
CSCGasCollisions * theGasIonizer
Definition: CSCWireHitSim.h:47
std::vector< CSCDetectorHit > theNewWireHits
Definition: CSCWireHitSim.h:48
CSCWireHitSim::~CSCWireHitSim ( )

Definition at line 18 of file CSCWireHitSim.cc.

References theGasIonizer, and theRandFlat.

18  {
19  delete theRandFlat;
20  delete theGasIonizer;
21 }
CLHEP::RandFlat * theRandFlat
Definition: CSCWireHitSim.h:45
CSCGasCollisions * theGasIonizer
Definition: CSCWireHitSim.h:47

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().

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

Definition at line 100 of file CSCWireHitSim.cc.

References CSCGasCollisions::setParticleDataTable(), and theGasIonizer.

Referenced by CSCDigitizer::setParticleDataTable().

101 {
103 }
void setParticleDataTable(const ParticleDataTable *pdt)
CSCGasCollisions * theGasIonizer
Definition: CSCWireHitSim.h:47
void CSCWireHitSim::setRandomEngine ( CLHEP::HepRandomEngine &  engine)

Definition at line 106 of file CSCWireHitSim.cc.

References CSCGasCollisions::setRandomEngine(), CSCDriftSim::setRandomEngine(), theDriftSim, theGasIonizer, and theRandFlat.

Referenced by CSCDigitizer::setRandomEngine().

107 {
108  theRandFlat = new CLHEP::RandFlat(engine);
109  theDriftSim->setRandomEngine(engine);
111 }
CLHEP::RandFlat * theRandFlat
Definition: CSCWireHitSim.h:45
CSCDriftSim * theDriftSim
Definition: CSCWireHitSim.h:46
void setRandomEngine(CLHEP::HepRandomEngine &engine)
Definition: CSCDriftSim.cc:60
CSCGasCollisions * theGasIonizer
Definition: CSCWireHitSim.h:47
void 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().

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);
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) );
52 
53  }
54  }
55  return theNewWireHits;
56 }
int nearestWire(const LocalPoint &lp) const
std::vector< Local3DPoint > getIonizationClusters(const PSimHit &hit, const CSCLayer *)
CSCDriftSim * theDriftSim
Definition: CSCWireHitSim.h:46
tuple simHits
Definition: trackerHits.py:16
CSCDetectorHit getWireHit(const Local3DPoint &ionClusterPosition, const CSCLayer *, int wire, const PSimHit &simHit)
Definition: CSCDriftSim.cc:68
std::vector< CSCDetectorHit > theNewWireHits
Definition: CSCWireHitSim.h:48
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:47

Member Data Documentation

CSCDriftSim* CSCWireHitSim::theDriftSim
private

Definition at line 46 of file CSCWireHitSim.h.

Referenced by setRandomEngine(), and simulate().

CSCGasCollisions* CSCWireHitSim::theGasIonizer
private
std::vector<CSCDetectorHit> CSCWireHitSim::theNewWireHits
private

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().