CMS 3D CMS Logo

CSCStripHitSim.cc
Go to the documentation of this file.
6 
7 // This is CSCStripHitSim.cc
8 // Author: Rick Wilkinson, Tim Cox
9 
10 std::vector<CSCDetectorHit> &CSCStripHitSim::simulate(const CSCLayer *layer,
11  const std::vector<CSCDetectorHit> &wireHits) {
12  // make sure the gatti function is initialized
13  const CSCChamberSpecs *chamberSpecs = layer->chamber()->specs();
14  const CSCLayerGeometry *geom = layer->geometry();
15  theGattiFunction.initChamberSpecs(*chamberSpecs);
16  const int nNodes = chamberSpecs->nNodes();
17 
18  // for every wire hit, induce a Gatti-distributed charge on the
19  // cathode strips
20  newStripHits.clear();
21  newStripHits.reserve((2 * nNodes + 1) * wireHits.size());
22  std::vector<CSCDetectorHit>::const_iterator wireHitI;
23  for (wireHitI = wireHits.begin(); wireHitI != wireHits.end(); ++wireHitI) {
24  int wire = (*wireHitI).getElement();
25  float wireCharge = (*wireHitI).getCharge();
26  float wireHitTime = (*wireHitI).getTime();
27  // The wire hit position is _along the wire_, measured from where
28  // the wire intersects local y axis, so convert to local x...
29  float hitX = (*wireHitI).getPosition() * cos(geom->wireAngle());
30  float hitY = geom->yOfWire(wire, hitX);
31  const LocalPoint wireHitPos(hitX, hitY);
32 
33  int centerStrip = geom->nearestStrip(wireHitPos);
34  int firstStrip = std::max(centerStrip - nNodes, 1);
35  int lastStrip = std::min(centerStrip + nNodes, geom->numberOfStrips());
36  for (int istrip = firstStrip; istrip <= lastStrip; istrip++) {
37  float offset = hitX - geom->xOfStrip(istrip, hitY);
38  float stripWidth = geom->stripPitch(wireHitPos);
39  float binValue = theGattiFunction.binValue(offset, stripWidth);
40  // we divide by 2 because charge goes on either cathode.
41  // if you're following the TDR, we already multiplied the
42  // charge by 0.82 in the WireHitSim (well, DriftSim), so that explains
43  // their f_ind=0.41.
44 
45  // this seems to be folded in the Amp response, which peaks
46  // around 0.14. The difference may be because the amp response
47  // convolutes in different drift times.
48  // float collectionFraction = 0.19;
49  const float igain = 1. / 0.9; // mv/fC
50  float stripCharge = wireCharge * binValue * igain * 0.5;
51  float stripTime = wireHitTime;
52  float position = hitY / sin(geom->stripAngle(istrip));
53  CSCDetectorHit newStripHit(istrip, stripCharge, position, stripTime, (*wireHitI).getSimHit());
54  newStripHits.push_back(newStripHit);
55  }
56  } // loop over wire hits
57  return newStripHits;
58 }
std::vector< CSCDetectorHit > & simulate(const CSCLayer *layer, const std::vector< CSCDetectorHit > &wireHits)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
double binValue(double x, double stripWidth) const
std::vector< CSCDetectorHit > newStripHits
constexpr std::array< uint8_t, layerIndexSize > layer
void initChamberSpecs(const CSCChamberSpecs &)
Calculates k1, k2, k3, h per chamber type, if necessary.
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int nNodes() const
static int position[264][3]
Definition: ReadPGInfo.cc:289
CSCGattiFunction theGattiFunction