CMS 3D CMS Logo

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