CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10/src/SimMuon/CSCDigitizer/src/CSCStripHitSim.cc

Go to the documentation of this file.
00001 #include "SimMuon/CSCDigitizer/src/CSCStripHitSim.h"
00002 #include "Geometry/CSCGeometry/interface/CSCLayer.h"
00003 #include "Geometry/CSCGeometry/interface/CSCChamberSpecs.h"
00004 #include "Geometry/CSCGeometry/interface/CSCLayerGeometry.h"
00005 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
00006 
00007 // This is CSCStripHitSim.cc
00008 // Author: Rick Wilkinson, Tim Cox
00009 
00010 
00011 std::vector<CSCDetectorHit> &
00012 CSCStripHitSim::simulate(const CSCLayer * layer, 
00013                            const std::vector<CSCDetectorHit> & wireHits)
00014 {
00015   // make sure the gatti function is initialized
00016   const CSCChamberSpecs * chamberSpecs = layer->chamber()->specs();
00017   const CSCLayerGeometry* geom = layer->geometry();
00018   theGattiFunction.initChamberSpecs(*chamberSpecs);
00019   const int nNodes = chamberSpecs->nNodes();
00020   
00021   // for every wire hit, induce a Gatti-distributed charge on the
00022   // cathode strips
00023   newStripHits.clear();
00024   newStripHits.reserve((2*nNodes+1)*wireHits.size());
00025   std::vector<CSCDetectorHit>::const_iterator wireHitI;
00026   for(wireHitI = wireHits.begin(); wireHitI != wireHits.end(); ++wireHitI){
00027     int   wire        = (*wireHitI).getElement();
00028     float wireCharge  = (*wireHitI).getCharge();
00029     float wireHitTime = (*wireHitI).getTime();
00030     // The wire hit position is _along the wire_, measured from where
00031     // the wire intersects local y axis, so convert to local x...
00032     float hitX   = (*wireHitI).getPosition() * cos(geom->wireAngle());
00033     float hitY   = geom->yOfWire(wire, hitX);
00034     const LocalPoint wireHitPos(hitX, hitY);
00035 
00036     int centerStrip = geom->nearestStrip(wireHitPos);
00037     int firstStrip = std::max(centerStrip - nNodes, 1);
00038     int lastStrip  = std::min(centerStrip + nNodes, geom->numberOfStrips());
00039     for(int istrip = firstStrip; istrip <= lastStrip; istrip++) {
00040       float offset = hitX - geom->xOfStrip(istrip, hitY);
00041       float stripWidth = geom->stripPitch(wireHitPos);
00042       float binValue = theGattiFunction.binValue(offset, stripWidth);
00043       // we divide by 2 because charge goes on either cathode.
00044       // if you're following the TDR, we already multiplied the
00045       // charge by 0.82 in the WireHitSim (well, DriftSim), so that explains 
00046       // their f_ind=0.41.
00047    
00048       // this seems to be folded in the Amp response, which peaks
00049       // around 0.14.  The difference may be because the amp response
00050       // convolutes in different drift times.
00051       //float collectionFraction = 0.19;
00052       const float igain = 1./0.9; // mv/fC
00053       float stripCharge = wireCharge * binValue * igain * 0.5;
00054       float stripTime = wireHitTime;
00055       float position = hitY / sin(geom->stripAngle(istrip));
00056       CSCDetectorHit newStripHit(istrip, stripCharge, position, stripTime, 
00057                                    (*wireHitI).getSimHit());
00058       newStripHits.push_back(newStripHit);
00059     }
00060   }  // loop over wire hits
00061   return newStripHits;
00062 }