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::CSCWireHitSim ( CSCDriftSim driftSim,
const edm::ParameterSet p 
)
explicit

Definition at line 10 of file CSCWireHitSim.cc.

CSCDriftSim * theDriftSim
Definition: CSCWireHitSim.h:45
CSCGasCollisions * theGasIonizer
Definition: CSCWireHitSim.h:46
std::vector< CSCDetectorHit > theNewWireHits
Definition: CSCWireHitSim.h:47

◆ ~CSCWireHitSim()

CSCWireHitSim::~CSCWireHitSim ( )

Definition at line 13 of file CSCWireHitSim.cc.

References theGasIonizer.

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

Member Function Documentation

◆ driftElectronsToWire()

CSCDetectorHit CSCWireHitSim::driftElectronsToWire ( )
private

◆ getIonizationClusters()

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

Definition at line 40 of file CSCWireHitSim.cc.

References pwdgSkimBPark_cfi::electrons, ecal::raw::entryPoint(), dqmiolumiharvest::j, pixelTopology::layer, LogTrace, mysort::results, rpcPointValidation_cfi::simHit, 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 }
void entryPoint(InputDataCPU const &, InputDataGPU &, OutputDataGPU &, ScratchDataGPU &, OutputDataCPU &, ConditionsProducts const &, cudaStream_t, uint32_t const, uint32_t const)
#define LogTrace(id)
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
CSCGasCollisions * theGasIonizer
Definition: CSCWireHitSim.h:46
results
Definition: mysort.py:8
void simulate(const PSimHit &, std::vector< LocalPoint > &clusters, std::vector< int > &electrons, CLHEP::HepRandomEngine *)

◆ setParticleDataTable()

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

◆ simulate()

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, getIonizationClusters(), CSCDriftSim::getWireHit(), pixelTopology::layer, heavyionUCCDQM_cfi::nClusters, FastTrackerRecHitCombiner_cfi::simHits, 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 }
CSCDetectorHit getWireHit(const Local3DPoint &ionClusterPosition, const CSCLayer *, int wire, const PSimHit &simHit, CLHEP::HepRandomEngine *)
Definition: CSCDriftSim.cc:55
CSCDriftSim * theDriftSim
Definition: CSCWireHitSim.h:45
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
std::vector< Local3DPoint > getIonizationClusters(const PSimHit &hit, const CSCLayer *, CLHEP::HepRandomEngine *)
std::vector< CSCDetectorHit > theNewWireHits
Definition: CSCWireHitSim.h:47

Member Data Documentation

◆ theDriftSim

CSCDriftSim* CSCWireHitSim::theDriftSim
private

Definition at line 45 of file CSCWireHitSim.h.

Referenced by simulate().

◆ theGasIonizer

CSCGasCollisions* CSCWireHitSim::theGasIonizer
private

Definition at line 46 of file CSCWireHitSim.h.

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

◆ theNewWireHits

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

Definition at line 47 of file CSCWireHitSim.h.

Referenced by simulate().