CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCWireHitSim.cc
Go to the documentation of this file.
7 
8 
10 : theDriftSim(driftSim),
11  theGasIonizer( new CSCGasCollisions() ) ,
12  theNewWireHits()
13 {
14 }
15 
16 
18  delete theGasIonizer;
19 }
20 
21 
22 std::vector<CSCDetectorHit> &
25 {
26  const CSCLayerGeometry * geom = layer->geometry();
27 
28  theNewWireHits.clear();
29  for (edm::PSimHitContainer::const_iterator hitItr = simHits.begin();
30  hitItr != simHits.end(); ++hitItr)
31  {
32 
33  std::vector<LocalPoint> ionClusters
34  = getIonizationClusters(*hitItr, layer);
35 
36  unsigned nClusters = ionClusters.size();
37  theNewWireHits.reserve(theNewWireHits.size()+nClusters);
38 
39  for(unsigned icl = 0; icl < nClusters; ++icl) {
40 
41  // Drift the electrons in the cluster to the nearest wire...
42  int nearestWire=geom->nearestWire(ionClusters[icl]);
43 
44  // The wire hit contains wire# and position measured _along the wire_
45  // from where it intersects local y axis.
46 
47  theNewWireHits.push_back(
48  theDriftSim->getWireHit(ionClusters[icl], layer, nearestWire,
49  *hitItr) );
50 
51  }
52  }
53  return theNewWireHits;
54 }
55 
56 std::vector<LocalPoint>
58  const CSCLayer * layer)
59 {
60  const LocalPoint & entryPoint = simHit.entryPoint();
61  const LocalPoint & exitPoint = simHit.exitPoint();
62 
63  LogTrace("CSCWireHitSim") << "CSCWireHitSim:"
64  << " type=" << simHit.particleType()
65  << " mom=" << simHit.pabs()
66  << "\n Local entry " << entryPoint << " exit " << exitPoint;
67 
68  std::vector<LocalPoint> positions;
69  std::vector<int> electrons;
70  theGasIonizer->simulate( simHit, layer, positions, electrons );
71 
72  std::vector<LocalPoint> results; // start empty
73 
74  int j = 0;
75  for( std::vector<LocalPoint>::const_iterator pointItr = positions.begin();
76  pointItr != positions.end(); ++pointItr )
77  {
78  ++j;
79  // some verification
80  if(layer->geometry()->inside(*pointItr) ) {
81  // push the point for each electron at this point
82 
83  for( int ie = 1; ie <= electrons[j-1]; ++ie ) {
84  results.push_back(*pointItr);
85  }
86  }
87  }
88  LogTrace("CSCWireHitSim") << "CSCWireHitSim: there are " << results.size()
89  << " clusters identified with each electron.";
90  return results;
91 }
92 
93 
95 {
97 }
98 
99 
100 void CSCWireHitSim::setRandomEngine(CLHEP::HepRandomEngine& engine)
101 {
102  theDriftSim->setRandomEngine(engine);
104 }
105 
106 
int nearestWire(const LocalPoint &lp) const
std::vector< Local3DPoint > getIonizationClusters(const PSimHit &hit, const CSCLayer *)
HepPDT::ParticleDataTable ParticleDataTable
CSCDriftSim * theDriftSim
Definition: CSCWireHitSim.h:45
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:38
int j
Definition: DBlmapReader.cc:9
void setRandomEngine(CLHEP::HepRandomEngine &engine)
Definition: CSCDriftSim.cc:60
float pabs() const
fast and more accurate access to momentumAtEntry().mag()
Definition: PSimHit.h:63
void setParticleDataTable(const ParticleDataTable *pdt)
#define LogTrace(id)
void simulate(const PSimHit &, const CSCLayer *layer, std::vector< LocalPoint > &clusters, std::vector< int > &electrons)
void setRandomEngine(CLHEP::HepRandomEngine &engine)
CSCWireHitSim(CSCDriftSim *driftSim)
Definition: CSCWireHitSim.cc:9
CSCGasCollisions * theGasIonizer
Definition: CSCWireHitSim.h:46
tuple simHits
Definition: trackerHits.py:16
std::vector< CSCDetectorHit > & simulate(const CSCLayer *layer, const edm::PSimHitContainer &simHits)
int particleType() const
Definition: PSimHit.h:85
CSCDetectorHit getWireHit(const Local3DPoint &ionClusterPosition, const CSCLayer *, int wire, const PSimHit &simHit)
Definition: CSCDriftSim.cc:68
bool inside(const Local3DPoint &, const LocalError &, float scale=1.f) const
std::vector< PSimHit > PSimHitContainer
std::vector< CSCDetectorHit > theNewWireHits
Definition: CSCWireHitSim.h:47
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:35
void setParticleDataTable(const ParticleDataTable *pdt)
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:47
void setRandomEngine(CLHEP::HepRandomEngine &engine)