File indexing completed on 2024-04-06 12:30:43
0001 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
0002 #include "Geometry/CSCGeometry/interface/CSCChamberSpecs.h"
0003 #include "Geometry/CSCGeometry/interface/CSCLayer.h"
0004 #include "Geometry/CSCGeometry/interface/CSCLayerGeometry.h"
0005 #include "SimMuon/CSCDigitizer/src/CSCStripHitSim.h"
0006
0007
0008
0009
0010 std::vector<CSCDetectorHit> &CSCStripHitSim::simulate(const CSCLayer *layer,
0011 const std::vector<CSCDetectorHit> &wireHits) {
0012
0013 const CSCChamberSpecs *chamberSpecs = layer->chamber()->specs();
0014 const CSCLayerGeometry *geom = layer->geometry();
0015 theGattiFunction.initChamberSpecs(*chamberSpecs);
0016 const int nNodes = chamberSpecs->nNodes();
0017
0018
0019
0020 newStripHits.clear();
0021 newStripHits.reserve((2 * nNodes + 1) * wireHits.size());
0022 std::vector<CSCDetectorHit>::const_iterator wireHitI;
0023 for (wireHitI = wireHits.begin(); wireHitI != wireHits.end(); ++wireHitI) {
0024 int wire = (*wireHitI).getElement();
0025 float wireCharge = (*wireHitI).getCharge();
0026 float wireHitTime = (*wireHitI).getTime();
0027
0028
0029 float hitX = (*wireHitI).getPosition() * cos(geom->wireAngle());
0030 float hitY = geom->yOfWire(wire, hitX);
0031 const LocalPoint wireHitPos(hitX, hitY);
0032
0033 int centerStrip = geom->nearestStrip(wireHitPos);
0034 int firstStrip = std::max(centerStrip - nNodes, 1);
0035 int lastStrip = std::min(centerStrip + nNodes, geom->numberOfStrips());
0036 for (int istrip = firstStrip; istrip <= lastStrip; istrip++) {
0037 float offset = hitX - geom->xOfStrip(istrip, hitY);
0038 float stripWidth = geom->stripPitch(wireHitPos);
0039 float binValue = theGattiFunction.binValue(offset, stripWidth);
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049 const float igain = 1. / 0.9;
0050 float stripCharge = wireCharge * binValue * igain * 0.5;
0051 float stripTime = wireHitTime;
0052 float position = hitY / sin(geom->stripAngle(istrip));
0053 CSCDetectorHit newStripHit(istrip, stripCharge, position, stripTime, (*wireHitI).getSimHit());
0054 newStripHits.push_back(newStripHit);
0055 }
0056 }
0057 return newStripHits;
0058 }