CMS 3D CMS Logo

CSCWireHitSim.cc
Go to the documentation of this file.
7 
8 #include "CLHEP/Random/RandFlat.h"
9 
11  : theDriftSim(driftSim), theGasIonizer(new CSCGasCollisions(p)), theNewWireHits() {}
12 
14 
15 std::vector<CSCDetectorHit> &CSCWireHitSim::simulate(const CSCLayer *layer,
17  CLHEP::HepRandomEngine *engine) {
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 }
39 
40 std::vector<LocalPoint> CSCWireHitSim::getIonizationClusters(const PSimHit &simHit,
41  const CSCLayer *layer,
42  CLHEP::HepRandomEngine *engine) {
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 }
76 
heavyionUCCDQM_cfi.nClusters
nClusters
Definition: heavyionUCCDQM_cfi.py:9
MessageLogger.h
CSCWireHitSim::getIonizationClusters
std::vector< Local3DPoint > getIonizationClusters(const PSimHit &hit, const CSCLayer *, CLHEP::HepRandomEngine *)
Definition: CSCWireHitSim.cc:40
FastTrackerRecHitCombiner_cfi.simHits
simHits
Definition: FastTrackerRecHitCombiner_cfi.py:5
bookConverter.results
results
Definition: bookConverter.py:144
CSCLayer
Definition: CSCLayer.h:24
CSCDriftSim::getWireHit
CSCDetectorHit getWireHit(const Local3DPoint &ionClusterPosition, const CSCLayer *, int wire, const PSimHit &simHit, CLHEP::HepRandomEngine *)
Definition: CSCDriftSim.cc:55
CSCWireHitSim::setParticleDataTable
void setParticleDataTable(const ParticleDataTable *pdt)
Definition: CSCWireHitSim.cc:77
rpcPointValidation_cfi.simHit
simHit
Definition: rpcPointValidation_cfi.py:24
CSCLayerGeometry
Definition: CSCLayerGeometry.h:25
ecal::raw::entryPoint
void entryPoint(InputDataCPU const &, InputDataGPU &, OutputDataGPU &, ScratchDataGPU &, OutputDataCPU &, ConditionsProducts const &, cudaStream_t, uint32_t const, uint32_t const)
CSCGasCollisions.h
CSCLayerGeometry.h
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
Point3DBase< float, LocalTag >
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
CSCWireHitSim::simulate
std::vector< CSCDetectorHit > & simulate(const CSCLayer *layer, const edm::PSimHitContainer &simHits, CLHEP::HepRandomEngine *)
Definition: CSCWireHitSim.cc:15
CSCDriftSim.h
edm::ParameterSet
Definition: ParameterSet.h:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CSCGasCollisions::simulate
void simulate(const PSimHit &, std::vector< LocalPoint > &clusters, std::vector< int > &electrons, CLHEP::HepRandomEngine *)
Definition: CSCGasCollisions.cc:148
CSCWireHitSim::theDriftSim
CSCDriftSim * theDriftSim
Definition: CSCWireHitSim.h:45
CSCDriftSim
Definition: CSCDriftSim.h:32
CSCWireHitSim.h
CSCGasCollisions::setParticleDataTable
void setParticleDataTable(const ParticleDataTable *pdt)
Definition: CSCGasCollisions.cc:146
CSCWireHitSim::theNewWireHits
std::vector< CSCDetectorHit > theNewWireHits
Definition: CSCWireHitSim.h:47
pwdgSkimBPark_cfi.electrons
electrons
Definition: pwdgSkimBPark_cfi.py:6
CSCLayer.h
CSCWireHitSim::theGasIonizer
CSCGasCollisions * theGasIonizer
Definition: CSCWireHitSim.h:46
CSCWireHitSim::~CSCWireHitSim
~CSCWireHitSim()
Definition: CSCWireHitSim.cc:13
CSCGasCollisions
Definition: CSCGasCollisions.h:27
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
edm::PSimHitContainer
std::vector< PSimHit > PSimHitContainer
Definition: PSimHitContainer.h:11
PSimHit
Definition: PSimHit.h:15
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
ParticleDataTable
HepPDT::ParticleDataTable ParticleDataTable
Definition: ParticleDataTable.h:8
CSCWireHitSim::CSCWireHitSim
CSCWireHitSim(CSCDriftSim *driftSim, const edm::ParameterSet &p)
Definition: CSCWireHitSim.cc:10