Back to home page

Project CMSSW displayed by LXR

 
 

    


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 // This is CSCStripHitSim.cc
0008 // Author: Rick Wilkinson, Tim Cox
0009 
0010 std::vector<CSCDetectorHit> &CSCStripHitSim::simulate(const CSCLayer *layer,
0011                                                       const std::vector<CSCDetectorHit> &wireHits) {
0012   // make sure the gatti function is initialized
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   // for every wire hit, induce a Gatti-distributed charge on the
0019   // cathode strips
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     // The wire hit position is _along the wire_, measured from where
0028     // the wire intersects local y axis, so convert to local x...
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       // we divide by 2 because charge goes on either cathode.
0041       // if you're following the TDR, we already multiplied the
0042       // charge by 0.82 in the WireHitSim (well, DriftSim), so that explains
0043       // their f_ind=0.41.
0044 
0045       // this seems to be folded in the Amp response, which peaks
0046       // around 0.14.  The difference may be because the amp response
0047       // convolutes in different drift times.
0048       // float collectionFraction = 0.19;
0049       const float igain = 1. / 0.9;  // mv/fC
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   }  // loop over wire hits
0057   return newStripHits;
0058 }