52 const float sqrt_12 = 3.4641;
62 int wg_left = wgroups[0];;
63 int wg_right = wgroups[wgroups.size()-1];
71 int centerWire_left = (
int) (Mwire1 - Nwires1 / 2. + 0.5);
72 int centerWire_right = (
int) (Mwire2 + Nwires2 / 2.);
74 float centerWire = (centerWire_left + centerWire_right) / 2.;
80 if(wHit.
deadWG()>0 || wgroups.size()>2){
82 for(
unsigned int iWG=0;iWG<wgroups.size();iWG++){
86 else if(2==wgroups.size()){
96 else if(1==wgroups.size()){
105 int nStrip = strips.size();
106 int idCenterStrip = nStrip/2;
107 int centerStrip = strips[idCenterStrip];
110 const std::vector<float>&
adc = sHit.
s_adc();
111 const std::vector<float>& adcRaw = sHit.
s_adcRaw();
113 std::vector<float> adc2;
114 std::vector<float> adc2Raw;
116 LogTrace(
"CSCMake2DRecHit") <<
"[CSCMake2DRecHit] dump of adc values to be added to rechit follows...";
118 for (
int iStrip = 0; iStrip < nStrip; ++iStrip) {
124 for (
int t = 0;
t < 4; ++
t ){
125 adc2.push_back(adc[
t+iStrip*4]);
126 adc2Raw.push_back(adcRaw[
t+iStrip*4]);
129 adcMap.
put( strips[iStrip], adc2.begin(), adc2.end() );
133 LogTrace(
"CSCMake2DRecHit") <<
"[CSCMake2DRecHit] strip = " << strips[iStrip] <<
134 " adcs= " << adc2Raw[0] <<
" " << adc2Raw[1] <<
" " << adc2Raw[2] <<
" " << adc2Raw[3];
141 for (
int t = 0;
t < 4; ++
t ) {
142 int k =
t+4*(idCenterStrip);
143 adcArray[
t] = adc[
k];
147 float t_zero = tpeak - 133.f;
148 LogTrace(
"CSCRecHit") <<
"[CSCMake2DRecHit] " <<
149 id <<
" strip=" << centerStrip <<
", t_zero=" << t_zero <<
", tpeak=" << tpeak;
152 float positionWithinTheStrip= -99.;
153 float sigmaWithinTheStrip = -99.;
157 float stripWidth = -99.f;
159 if ( centerStrip == 1 || centerStrip ==
specs_->
nStrips() || nStrip < 2 ) {
161 positionWithinTheStrip = 0.f;
163 sigmaWithinTheStrip = stripWidth / sqrt_12;
172 float xWithinChamber = lp11.
x();
178 stripWidth, tpeak, positionWithinTheStrip,
179 sigmaWithinTheStrip, quality);
188 sigmaWithinTheStrip, sigmaWire );
193 float phaseCorrection = (sHit.
stripsl1a()[0]>> (15-0) & 0x1)*25.;
197 float tofCorrection = gp0.
mag()/29.9792458;
198 float signalPropagationSpeed[11] = {0.0, -78, -76, -188, -262, -97, -99, -90, -99, -99, -113};
200 float yCorrection = position/signalPropagationSpeed[
id_.
iChamberType()];
205 tpeak = tpeak + chipCorrection + phaseCorrection + chamberCorrection-tofCorrection+yCorrection;
216 float gasGainCorrection = -999.f;
229 float energyDeposit = -999.f;
230 if (gasGainCorrection < -998.
f) {
232 energyDeposit = -998.f;
234 }
else if (gasGainCorrection < 0.
f) {
236 energyDeposit = -997.f;
240 if (adcMap.
size()==12) {
242 adcMap[0] * gasGainCorrection + adcMap[1] * gasGainCorrection + adcMap[2] * gasGainCorrection +
243 adcMap[4] * gasGainCorrection + adcMap[5] * gasGainCorrection + adcMap[6] * gasGainCorrection +
244 adcMap[8] * gasGainCorrection + adcMap[9] * gasGainCorrection + adcMap[10]* gasGainCorrection ;
246 }
else if (adcMap.
size()==4) {
248 energyDeposit = -996.f;
262 CSCRecHit2D rechit(
id, lp0, localerr, L1A_and_strips,
264 adcMap, BX_and_wgroups, tpeak, positionWithinTheStrip,
265 sigmaWithinTheStrip/stripWidth, quality, sHit.
deadStrip(), wHit.
deadWG(), scaledWireTime,
271 LogTrace(
"CSCRecHit") <<
"[CSCMake2DRecHit] rechit created in layer " <<
id <<
"... \n" << rechit;
280 bool isInFiducial =
true;
287 if(!layergeom_->
inside(rhPosition)){
288 isInFiducial =
false;
307 float timeGuess=tpeak/25.f + anode_bx_offset;
308 float diffMin=9999.f;
310 for (
int j=0; j<(
int)timeBinsOn.size(); j++) {
311 auto diff=timeGuess-timeBinsOn[j];
316 wireBx=timeBinsOn[j];
319 int side= diffMin>0 ? 1 : -1;
322 if ((bestMatch+side)>-1 && (bestMatch+side)<(
int)timeBinsOn.size()) {
323 if (timeBinsOn[bestMatch]==(timeBinsOn[bestMatch+side]-side)) {
325 wireBx=wireBx+ 0.5f*side;
330 if ((bestMatch-side)>-1 && (bestMatch-side)<(
int)timeBinsOn.size() && unchanged) {
331 if (timeBinsOn[bestMatch]==(timeBinsOn[bestMatch-side]+side)) {
332 wireBx=wireBx- 0.5f*side;
336 return wireBx - anode_bx_offset;
int adc(sample_type sample)
get the ADC sample (12 bits)
float gasGainCorrection(const CSCDetId &id, int strip, int wireGroup) const
returns gas-gain correction
T getParameter(std::string const &) const
ChannelContainer wgroups() const
The wire groups used for forming the cluster.
const ChannelContainer & stripsl1a() const
L1A.
Point3DBase< Scalar, LocalTag > LocalPoint
bool useGasGainCorrections
std::vector< int > timeBinsOn() const
Vector of time bins ON for central wire digi, lower of center pair if even number.
const StripHitADCContainer & s_adcRaw() const
the raw ADC counts for each of the strip within cluster
size_t size() const
return number of contained object
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Sin< T >::type sin(const T &t)
const StripHitADCContainer & s_adc() const
L1A.
int numberOfWiresPerGroup(int wireGroup) const
const CSCChamberSpecs * specs_
float findWireBx(const std::vector< int > &timeBinsOn, float tpeak, const CSCDetId &id)
ChannelContainer wgroupsBXandWire() const
The BX + wire group number.
void setConditions(const CSCRecoConditions *reco)
Pass pointer to conditions data onwards.
LocalError localError(int strip, float sigmaStrip, float sigmaWire) const
short int deadStrip() const
is a neighbouring string a dead strip?
void setConditions(const CSCRecoConditions *reco)
Cache pointer to conditions data.
CSCXonStrip_MatchGatti * xMatchGatti_
float yOfWire(float wire, float x=0.) const
const CSCChamberSpecs * specs() const
float middleWireOfGroup(int wireGroup) const
float yResolution(int wireGroup=1) const
Abs< T >::type abs(const T &t)
bool isHitInFiducial(const CSCLayer *layer, const CSCRecHit2D &rh)
Test if rechit is in fiducial volume.
void put(ID id, CI begin, CI end)
insert an object range with specified identifier
unsigned short iChamberType()
float chipCorrection(const CSCDetId &detId, int channel) const
All other functions are accessed by geometrical strip label (i.e. strip number according to local coo...
static const double tmax[3]
int tmax() const
Strip hit maximum time bin.
const CSCRecoConditions * recoConditions_
const ChannelContainer & stripsTotal() const
The strips used in cluster to produce strip hit (total content)
float anodeBXoffset(const CSCDetId &detId) const
const CSCLayerGeometry * layergeom_
def bestMatch(object, matchCollection)
void findXOnStrip(const CSCDetId &id, const CSCLayer *layer, const CSCStripHit &stripHit, int centralStrip, float &xWithinChamber, float &stripWidth, const float &tpeak, float &xWithinStrip, float &sigma, int &quality_flag)
Returns fitted local x position and its estimated error.
CSCRecHit2D hitFromStripAndWire(const CSCDetId &id, const CSCLayer *layer, const CSCWireHit &wHit, const CSCStripHit &sHit)
Make 2D hits when have both wire and strip hit available in same layer.
const ChannelContainer & strips() const
L1A.
LocalPoint stripWireIntersection(int strip, float wire) const
static int position[264][3]
bool useTimingCorrections
bool inside(const Local3DPoint &, const LocalError &, float scale=1.f) const
const std::unique_ptr< CSCFindPeakTime > peakTimeFinder_
LocalPoint localPosition() const
float chamberTimingCorrection(const CSCDetId &id) const
CSCMake2DRecHit(const edm::ParameterSet &)
float stripAngle(int strip) const
const CSCChamber * chamber() const
const CSCLayerGeometry * geometry() const
short int deadWG() const
a dead WG in the cluster?
std::vector< int > ChannelContainer