CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
CSCHitFromStripOnly Class Reference

#include <CSCHitFromStripOnly.h>

Public Types

typedef std::array< CSCStripData, 100 > PulseHeightMap
 

Public Member Functions

 CSCHitFromStripOnly (const edm::ParameterSet &ps)
 
bool ganged ()
 
std::vector< CSCStripHitrunStrip (const CSCDetId &id, const CSCLayer *layer, const CSCStripDigiCollection::Range &rstripd)
 
void setConditions (const CSCRecoConditions *reco)
 
void setGanged (bool ig)
 
 ~CSCHitFromStripOnly ()
 

Private Member Functions

void fillPulseHeights (const CSCStripDigiCollection::Range &rstripd)
 Store SCA pulseheight information from strips in digis of one layer. More...
 
float findHitOnStripPosition (const std::vector< CSCStripHitData > &data, const int &centerStrip)
 Find position of hit in strip cluster in terms of strip #. More...
 
void findMaxima (const CSCDetId &id)
 Find local maxima. More...
 
bool isDeadStrip (const CSCDetId &id, int centralStrip, int nstrips)
 Is the strip 'bad'? More...
 
bool isNearDeadStrip (const CSCDetId &id, int centralStrip, int nstrips)
 Is either neighbour 'bad'? More...
 
bool isPeakOK (int iStrip, float heightCluster)
 
float makeCluster (int centerStrip)
 Make clusters using local maxima. More...
 
CSCStripHitData makeStripData (int centerStrip, int offset)
 

Private Attributes

CSCPedestalChoicecalcped_
 
int clusterSize
 
float gainWeight [80]
 
bool ganged_
 
CSCDetId id_
 
const CSCLayerlayer_
 
unsigned nstrips_
 
const CSCRecoConditionsrecoConditions_
 
std::vector< float > strips_adc
 
std::vector< float > strips_adcRaw
 
std::vector< int > theClosestMaximum
 
std::vector< int > theConsecutiveStrips
 
std::vector< int > theMaxima
 
PulseHeightMap thePulseHeightMap
 
std::vector< int > theStrips
 
float theThresholdForAPeak
 
float theThresholdForCluster
 
int tmax_cluster
 
bool useCalib
 

Static Private Attributes

static const int theClusterSize = 3
 

Detailed Description

below)

Search for strip with ADC output exceeding theThresholdForAPeak. For each of these strips, build a cluster of strip of size theClusterSize (typically 5 strips). Finally, make a Strip Hit out of these clusters by finding the center-of-mass position of the hit The DetId, strip hit position, and peaking time are stored in a CSCStripHit collection.

Be careful with the ME_1/a chambers: the 48 strips are ganged into 16 channels, Each channel contains signals from three strips, each separated by 16 strips from the next.

Definition at line 34 of file CSCHitFromStripOnly.h.

Member Typedef Documentation

Definition at line 39 of file CSCHitFromStripOnly.h.

Constructor & Destructor Documentation

CSCHitFromStripOnly::CSCHitFromStripOnly ( const edm::ParameterSet ps)
explicit

Definition at line 22 of file CSCHitFromStripOnly.cc.

References calcped_, edm::ParameterSet::getParameter(), LogTrace, theThresholdForAPeak, theThresholdForCluster, and useCalib.

22  : recoConditions_(nullptr), calcped_(nullptr), ganged_(false) {
23 
24  useCalib = ps.getParameter<bool>("CSCUseCalibrations");
25  bool useStaticPedestals = ps.getParameter<bool>("CSCUseStaticPedestals");
26  int noOfTimeBinsForDynamicPed = ps.getParameter<int>("CSCNoOfTimeBinsForDynamicPedestal");
27 
28  theThresholdForAPeak = ps.getParameter<double>("CSCStripPeakThreshold");
29  theThresholdForCluster = ps.getParameter<double>("CSCStripClusterChargeCut");
30 
31  LogTrace("CSCRecHit") << "[CSCHitFromStripOnly] CSCUseStaticPedestals = " << useStaticPedestals;
32  if ( !useStaticPedestals ) LogTrace("CSCRecHit") << "[CSCHitFromStripOnly] CSCNoOfTimeBinsForDynamicPedestal = "
33  << noOfTimeBinsForDynamicPed;
34 
35  if ( useStaticPedestals ) {
37  }
38  else {
39  if ( noOfTimeBinsForDynamicPed == 1 ) {
41  }
42  else {
43  calcped_ = new CSCDynamicPedestal2(); // NORMAL DEFAULT!
44  }
45  }
46 
47 }
CSCPedestalChoice * calcped_
T getParameter(std::string const &) const
const CSCRecoConditions * recoConditions_
#define LogTrace(id)
CSCHitFromStripOnly::~CSCHitFromStripOnly ( )

Definition at line 50 of file CSCHitFromStripOnly.cc.

References calcped_.

50  {
51  delete calcped_;
52 }
CSCPedestalChoice * calcped_

Member Function Documentation

void CSCHitFromStripOnly::fillPulseHeights ( const CSCStripDigiCollection::Range rstripd)
private

Store SCA pulseheight information from strips in digis of one layer.

Definition at line 360 of file CSCHitFromStripOnly.cc.

References calcped_, popcon2dropbox::copy(), gainWeight, ganged(), id_, CSCPedestalChoice::pedestal(), recoConditions_, thePulseHeightMap, tmax, and useCalib.

Referenced by runStrip(), and setGanged().

360  {
361 
362  // Loop over strip digis in one CSCLayer and fill PulseHeightMap with pedestal-subtracted
363  // SCA pulse heights.
364 
365 
366  for (auto & ph : thePulseHeightMap) ph.reset();
367 
368  // for storing sca pulseheights once they may no longer be integer (e.g. after ped subtraction)
369  for ( CSCStripDigiCollection::const_iterator it = rstripd.first; it != rstripd.second; ++it ) {
370  int thisChannel = (*it).getStrip();
371  auto & stripData = thePulseHeightMap[thisChannel-1];
372  auto & scaRaw = stripData.phRaw_;
373  auto & sca = stripData.ph_;
374 
375  auto const & scaOri = (*it).getADCCounts();
376  assert(scaOri.size()==8);
377  // Fill sca from scaRaw, implicitly converting to float
378  std::copy( scaOri.begin(), scaOri.end(), scaRaw.begin());
379  std::copy( scaRaw.begin(), scaRaw.end(), sca.begin());
380 
381  //@@ Find bin with largest pulseheight (_before_ ped subtraction - shouldn't matter, right?)
382  int tmax = std::max_element( sca.begin(), sca.end() ) - sca.begin(); // counts from 0
383 
384  // get pedestal - calculated as appropriate - for this sca pulse
385  float ped = calcped_->pedestal(sca, recoConditions_, id_, thisChannel );
386 
387  // subtract the pedestal (from BOTH sets of sca pulseheights)
388  std::for_each( sca.begin(), sca.end(), CSCSubtractPedestal( ped ) );
389  std::for_each( scaRaw.begin(), scaRaw.end(), CSCSubtractPedestal( ped ) );
390 
391  //@@ Max in first 3 or last time bins is unacceptable, if so set to zero (why?)
392  float phmax = 0.f;
393  if ( tmax > 2 && tmax < 7 ) {
394  phmax = sca[tmax];
395  }
396  stripData.phmax_ = phmax;
397  stripData.tmax_ = tmax;
398 
399 
400  // Fill the map, possibly apply gains from cond data, and unfold ME1A channels
401  // (To apply gains use CSCStripData::op*= which scales only the non-raw sca ph's;
402  // but note that both sca & scaRaw are pedestal-subtracted.)
403 
404  // From StripDigi, thisChannel labels strip channel. Values phmax, tmax, scaRaw, sca belong to thisChannel
405  if ( useCalib ) stripData *= gainWeight[thisChannel-1];
406 
407  // for ganged ME1a need to duplicate values on istrip=thisChannel to iStrip+16 and iStrip+32
408  if ( ganged() ) {
409  for ( int j = 1; j < 3; ++j ) {
410  thePulseHeightMap[thisChannel-1+16*j] = stripData;
411  }
412  }
413 
414  }
415 }
CSCPedestalChoice * calcped_
def copy(args, dbName)
PulseHeightMap thePulseHeightMap
const CSCRecoConditions * recoConditions_
virtual float pedestal(const std::vector< float > &sca, const CSCRecoConditions *cond=0, const CSCDetId id=0, int ichan=0)=0
static const double tmax[3]
std::vector< CSCStripDigi >::const_iterator const_iterator
float CSCHitFromStripOnly::findHitOnStripPosition ( const std::vector< CSCStripHitData > &  data,
const int &  centerStrip 
)
private

Find position of hit in strip cluster in terms of strip #.

Definition at line 510 of file CSCHitFromStripOnly.cc.

References popcon2dropbox::copy(), mps_fire::i, LogTrace, digitizers_cfi::strip, strips_adc, strips_adcRaw, and w.

Referenced by makeCluster(), and setGanged().

510  {
511 
512  float strippos = -1.;
513 
514  if ( data.empty() ) return strippos;
515 
516  // biggestStrip is strip with largest pulse height
517  // Use pointer subtraction
518 
519  int biggestStrip = max_element(data.begin(), data.end()) - data.begin();
520  strippos = data[biggestStrip].strip() * 1.;
521 
522  // If more than one strip: use centroid to find center of cluster
523  // but only use time bin == tmax (otherwise, bias centroid).
524  float sum = 0.;
525  float sum_w= 0.;
526 
527  // std::vector<float> w(4);
528  // std::vector<float> wRaw(4);
529 
530  for ( size_t i = 0; i != data.size(); ++i ) {
531  auto const & w = data[i].ph();
532  auto const & wRaw = data[i].phRaw();
533 
534  // (Require ADC to be > 0.)
535  // No later studies suggest that this only do harm
536  /*
537  for ( size_t j = 0; j != w.size(); ++j ) {
538  if ( w[j] < 0. ) w[j] = 0.001;
539  }
540  */
541 
542 
543  // Fill the data members
544  std::copy( w.begin(), w.end(), std::back_inserter(strips_adc));
545  std::copy( wRaw.begin(), wRaw.end(), std::back_inserter(strips_adcRaw));
546 
547  if ( data[i].strip() < 1 ){
548  LogTrace("CSCRecHit") << "[CSCHitFromStripOnly::findHitOnStripPosition] problem in indexing of strip, strip= "
549  << data[i].strip();
550  }
551  sum_w += w[1];
552  sum += w[1] * data[i].strip();
553  }
554 
555  if ( sum_w > 0.) strippos = sum / sum_w;
556 
557  return strippos;
558 }
const double w
Definition: UKUtility.cc:23
def copy(args, dbName)
#define LogTrace(id)
std::vector< float > strips_adcRaw
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
std::vector< float > strips_adc
void CSCHitFromStripOnly::findMaxima ( const CSCDetId id)
private

Find local maxima.

Definition at line 424 of file CSCHitFromStripOnly.cc.

References mps_fire::i, isDeadStrip(), isPeakOK(), gen::k, checklumidiff::l, nstrips_, theClosestMaximum, theConsecutiveStrips, theMaxima, and thePulseHeightMap.

Referenced by runStrip(), and setGanged().

424  {
425 
426  theMaxima.clear();
427  theConsecutiveStrips.clear();
428  theClosestMaximum.clear();
429  for ( size_t i=0; i!=thePulseHeightMap.size(); ++i ) {
430 
431  // sum 3 strips so that hits between strips are not suppressed
432  float heightCluster = 0.;
433 
434  bool maximumFound = false;
435  // Left edge of chamber
436  if( !isDeadStrip(id, i+1, nstrips_) ){ // Is it i or i+1
437  if ( i == 0 ) {
438  heightCluster = thePulseHeightMap[i].phmax()+thePulseHeightMap[i+1].phmax();
439  // Have found a strip Hit if...
440  if(thePulseHeightMap[i].phmax() >= thePulseHeightMap[i+1].phmax() &&
441  isPeakOK(i,heightCluster)){
442  theMaxima.push_back(i);
443  maximumFound = true;
444  }
445  // Right edge of chamber
446  } else if ( i == thePulseHeightMap.size()-1) {
447  heightCluster = thePulseHeightMap[i-1].phmax()+thePulseHeightMap[i].phmax();
448  // Have found a strip Hit if...
449  if(thePulseHeightMap[i].phmax() > thePulseHeightMap[i-1].phmax() &&
450  isPeakOK(i,heightCluster)){
451  theMaxima.push_back(i);
452  maximumFound = true;
453  }
454  // Any other strips
455  } else {
456  heightCluster = thePulseHeightMap[i-1].phmax()+thePulseHeightMap[i].phmax()+thePulseHeightMap[i+1].phmax();
457  // Have found a strip Hit if...
458  if(thePulseHeightMap[i].phmax() > thePulseHeightMap[i-1].phmax() &&
459  thePulseHeightMap[i].phmax() >= thePulseHeightMap[i+1].phmax() &&
460  isPeakOK(i,heightCluster)){
461  theMaxima.push_back(i);
462  maximumFound = true;
463  }
464  }
465  }
466  //---- Consecutive strips with charge (real cluster); if too wide - measurement is not accurate
467  if(maximumFound){
468  int numberOfConsecutiveStrips = 1;
469  float testThreshold = 10.;//---- ADC counts;
470  //---- this is not XTalk corrected so it is correct in first approximation only
471  int j = 0;
472  for(int l = 0; l<8; ++l){
473  if(j<0) edm::LogWarning("FailedStripCountingWrongConsecutiveStripNumber") << "This should never occur!!! Contact CSC expert!";
474  ++j;
475  bool signalPresent = false;
476  for(int k = 0; k<2; ++k){
477  j*= -1;//---- check from left and right
478  int anotherConsecutiveStrip = i+j;
479  if(anotherConsecutiveStrip>=0 && anotherConsecutiveStrip<int( thePulseHeightMap.size() )){
480  if(thePulseHeightMap[anotherConsecutiveStrip].phmax()>testThreshold){
481  ++numberOfConsecutiveStrips;
482  signalPresent = true;
483  }
484  }
485  }
486  if(!signalPresent){
487  break;
488  }
489  }
490  theConsecutiveStrips.push_back(numberOfConsecutiveStrips);
491  }
492  }
493 }
std::vector< int > theConsecutiveStrips
bool isDeadStrip(const CSCDetId &id, int centralStrip, int nstrips)
Is the strip &#39;bad&#39;?
std::vector< int > theClosestMaximum
PulseHeightMap thePulseHeightMap
int k[5][pyjets_maxn]
std::vector< int > theMaxima
bool isPeakOK(int iStrip, float heightCluster)
bool CSCHitFromStripOnly::ganged ( )
inline

Definition at line 51 of file CSCHitFromStripOnly.h.

References ganged_.

Referenced by fillPulseHeights(), and runStrip().

51 { return ganged_;}
bool CSCHitFromStripOnly::isDeadStrip ( const CSCDetId id,
int  centralStrip,
int  nstrips 
)
private

Is the strip 'bad'?

Definition at line 568 of file CSCHitFromStripOnly.cc.

References CSCRecoConditions::badStrip(), recoConditions_, and theClusterSize.

Referenced by findMaxima(), runStrip(), and setGanged().

568  {
569  return recoConditions_->badStrip( id, centralStrip, nstrips );
570 
571 }
bool badStrip(const CSCDetId &id, int geomStrip, int nstrips) const
Is the strip bad?
const CSCRecoConditions * recoConditions_
bool CSCHitFromStripOnly::isNearDeadStrip ( const CSCDetId id,
int  centralStrip,
int  nstrips 
)
private

Is either neighbour 'bad'?

Definition at line 560 of file CSCHitFromStripOnly.cc.

References CSCRecoConditions::nearBadStrip(), and recoConditions_.

Referenced by setGanged().

560  {
561 
562  //@@ Tim says: not sure I understand this properly... but just moved code to CSCRecoConditions
563  // where it can handle the conversion from strip to channel etc.
564  return recoConditions_->nearBadStrip( id, centralStrip, nstrips );
565 
566 }
bool nearBadStrip(const CSCDetId &id, int geomStrip, int nstrips) const
Is a neighbour bad?
const CSCRecoConditions * recoConditions_
bool CSCHitFromStripOnly::isPeakOK ( int  iStrip,
float  heightCluster 
)
private

Definition at line 496 of file CSCHitFromStripOnly.cc.

References mps_fire::i, thePulseHeightMap, theThresholdForAPeak, and theThresholdForCluster.

Referenced by findMaxima(), and setGanged().

496  {
497  int i = iStrip;
498  bool peakOK = ( thePulseHeightMap[i].phmax()>theThresholdForAPeak &&
499  heightCluster > theThresholdForCluster &&
500  // ... and proper peak time; note that the values below are used elsewhere in this file;
501  // they should become parameters or at least constants defined in appropriate place
502  thePulseHeightMap[i].tmax() > 2 && thePulseHeightMap[i].tmax() < 7);
503  return peakOK;
504 }
PulseHeightMap thePulseHeightMap
float CSCHitFromStripOnly::makeCluster ( int  centerStrip)
private

Make clusters using local maxima.

Definition at line 218 of file CSCHitFromStripOnly.cc.

References clusterSize, data, findHitOnStripPosition(), mps_fire::i, LogTrace, makeStripData(), nstrips_, theClusterSize, and theStrips.

Referenced by runStrip(), and setGanged().

218  {
219 
220  float strippos = -1.;
222  std::vector<CSCStripHitData> stripDataV;
223 
224  // We only want to use strip position in terms of strip # for the strip hit. //@@ What other choice is there?
225 
226  // If the cluster size is such that you go beyond the edge of detector, shrink cluster appropriately
227  for ( int i = 1; i < theClusterSize/2 + 1; ++i ) {
228 
229  if ( centerStrip - i < 1 || centerStrip + i > int(nstrips_) ) {
230 
231  // Shrink cluster size, but keep it an odd number of strips.
232  clusterSize = 2*i - 1;
233  }
234  }
235  for ( int i = -clusterSize/2; i <= clusterSize/2; ++i ) {
236  CSCStripHitData data = makeStripData(centerStrip, i);
237  stripDataV.push_back( data );
238  theStrips.push_back( centerStrip + i );
239  }
240  strippos = findHitOnStripPosition( stripDataV, centerStrip );
241 
242  LogTrace("CSCHitFromStripOnly") << "[CSCHitFromStripOnly::makeCluster] centerStrip= " << centerStrip <<
243  " strippos=" << strippos;
244 
245  return strippos;
246 }
std::vector< int > theStrips
float findHitOnStripPosition(const std::vector< CSCStripHitData > &data, const int &centerStrip)
Find position of hit in strip cluster in terms of strip #.
static const int theClusterSize
#define LogTrace(id)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
CSCStripHitData makeStripData(int centerStrip, int offset)
CSCStripHitData CSCHitFromStripOnly::makeStripData ( int  centerStrip,
int  offset 
)
private

makeStripData

Definition at line 252 of file CSCHitFromStripOnly.cc.

References ecalMGPA::adc(), begin, clusterSize, popcon2dropbox::copy(), spr::find(), mps_fire::i, gen::k, LogTrace, min(), PFRecoTauDiscriminationByIsolation_cfi::offset, Validation_hcalonly_cfi::sign, theMaxima, thePulseHeightMap, tmax, and tmax_cluster.

Referenced by makeCluster(), and setGanged().

252  {
253 
254  CSCStripHitData prelimData;
255  int thisStrip = centerStrip+offset;
256 
257  int tmax = thePulseHeightMap[centerStrip-1].tmax();
258  tmax_cluster = tmax;
259 
260  std::vector<float> adc(4);
261  std::vector<float> adcRaw(4);
262 
263  // Fill adc & adcRaw
264 
265  int istart = tmax-1;
266  int istop = std::min( tmax+2, 7 ) ; // there are only time bins 0-7
267  adc[3] = 0.1; // in case it isn't filled
268 
269  if ( tmax > 2 && tmax < 7 ) { // for time bins 3-6
270  int ibin = thisStrip-1;
271  if (thePulseHeightMap[ibin].valid()) {
272  std::copy( thePulseHeightMap[ibin].ph().begin()+istart,
273  thePulseHeightMap[ibin].ph().begin()+istop+1, adc.begin() );
274 
275  std::copy( thePulseHeightMap[ibin].phRaw().begin()+istart,
276  thePulseHeightMap[ibin].phRaw().begin()+istop+1, adcRaw.begin() );
277  }
278  }
279  else {
280  adc[0] = 0.1;
281  adc[1] = 0.1;
282  adc[2] = 0.1;
283  adc[3] = 0.1;
284  adcRaw = adc;
285  LogTrace("CSCRecHit") << "[CSCHitFromStripOnly::makeStripData] Tmax out of range: contact CSC expert!";
286  }
287 
288  if ( offset == 0 ) {
289  prelimData = CSCStripHitData(thisStrip, tmax_cluster, adcRaw, adc);
290  } else {
291  int sign = offset>0 ? 1 : -1;
292  // If there's another maximum that would like to use part of this cluster,
293  // it gets shared in proportion to the height of the maxima
294  for ( int i = 1; i <= clusterSize/2; ++i ) {
295 
296  // Find the direction of the offset
297  int testStrip = thisStrip + sign*i;
298  std::vector<int>::iterator otherMax = find(theMaxima.begin(), theMaxima.end(), testStrip-1);
299 
300  // No other maxima found, so just store
301  if ( otherMax == theMaxima.end() ) {
302  prelimData = CSCStripHitData(thisStrip, tmax_cluster, adcRaw, adc); }
303  else {
304 
305  // Another maximum found - share
306  std::vector<float> adc1(4);
307  std::vector<float> adcRaw1(4);
308  std::vector<float> adc2(4);
309  std::vector<float> adcRaw2(4);
310  // In case we only copy (below) into 3 of the 4 bins i.e. when istart=5, istop=7
311  adc1[3] = 0.1;
312  adc2[3] = 0.1;
313  adcRaw1[3] = 0.1;
314  adcRaw2[3] = 0.1;
315 
316  // Fill adcN with content of time bins tmax-1 to tmax+2 (if it exists!)
317  if ( tmax > 2 && tmax < 7 ) { // for time bin tmax from 3-6
318  int ibin = testStrip-1;
319  int jbin = centerStrip-1;
320  if (thePulseHeightMap[ibin].valid()) {
321  std::copy(thePulseHeightMap[ibin].ph().begin()+istart,
322  thePulseHeightMap[ibin].ph().begin()+istop+1, adc1.begin());
323  std::copy(thePulseHeightMap[ibin].phRaw().begin()+istart,
324  thePulseHeightMap[ibin].phRaw().begin()+istop+1, adcRaw1.begin());
325  }
326 
327  if (thePulseHeightMap[jbin].valid()) {
328  std::copy(thePulseHeightMap[jbin].ph().begin()+istart,
329  thePulseHeightMap[jbin].ph().begin()+istop+1, adc2.begin());
330 
331  std::copy(thePulseHeightMap[jbin].phRaw().begin()+istart,
332  thePulseHeightMap[jbin].phRaw().begin()+istop+1, adcRaw2.begin());
333  }
334  }
335  else {
336  adc1.assign(4, 0.1);
337  adcRaw1 = adc1;
338  adc2.assign(4, 0.1);
339  adcRaw2 = adc2;
340  }
341 
342  // Scale shared strip B ('adc') by ratio of peak of ADC counts from central strip A ('adc2')
343  // to sum of A and neighbouring maxima C ('adc1')
344 
345  for (size_t k = 0; k < 4; ++k){
346  if(adc1[k]>0 && adc2[k]>0) adc[k] = adc[k] * adc2[k] / ( adc1[k]+adc2[k] );
347  if(adcRaw1[k]>0 && adcRaw2[k]>0) adcRaw[k] = adcRaw[k] * adcRaw2[k] / ( adcRaw1[k]+adcRaw2[k] );
348  }
349  prelimData = CSCStripHitData(thisStrip, tmax_cluster, adcRaw, adc);
350  }
351  }
352  }
353  return prelimData;
354 }
int adc(sample_type sample)
get the ADC sample (12 bits)
def copy(args, dbName)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
PulseHeightMap thePulseHeightMap
T min(T a, T b)
Definition: MathUtil.h:58
#define LogTrace(id)
int k[5][pyjets_maxn]
static const double tmax[3]
std::vector< int > theMaxima
#define begin
Definition: vmac.h:32
std::vector< CSCStripHit > CSCHitFromStripOnly::runStrip ( const CSCDetId id,
const CSCLayer layer,
const CSCStripDigiCollection::Range rstripd 
)

fact (20.10.09);

L1A (Begin looping) Attempt to redefine theStrips, to encode L1A phase bits

L1A (end Looping)

L1A

Print statement to check StripHit content w/ LA1

Definition at line 61 of file CSCHitFromStripOnly.cc.

References funct::abs(), CSCLayer::chamber(), clusterSize, fillPulseHeights(), findMaxima(), gainWeight, ganged(), CSCChamberSpecs::gangedStrips(), triggerObjects_cff::id, id_, createfilelist::int, isDeadStrip(), layer_, LogTrace, makeCluster(), CSCChamberSpecs::nStrips(), nstrips_, recoConditions_, CSCDetId::ring(), setGanged(), CSCChamber::specs(), strips_adc, strips_adcRaw, CSCRecoConditions::stripWeights(), theClosestMaximum, theClusterSize, theConsecutiveStrips, theMaxima, theStrips, tmax_cluster, and useCalib.

Referenced by CSCRecHitDBuilder::build().

63 {
64 
65  std::vector<CSCStripHit> hitsInLayer;
66 
67  // cache layer info for ease of access
68  id_ = id;
69  layer_ = layer;
70  nstrips_ = layer->chamber()->specs()->nStrips();
71 
72  setGanged(false);
73  if ( id_.ring() == 4 && layer_->chamber()->specs()->gangedStrips() ) setGanged(true); //@@ ONLY ME1/1A CAN BE GANGED
74 
75  LogTrace("CSCHitFromStripOnly") << "[CSCHitFromStripOnly::runStrip] id= " << id_ <<
76  " nstrips= " << nstrips_ << " ganged strips? " << ganged();
77 
78  tmax_cluster = 5;
79 
80  // Get gain correction weights for all strips in layer, and cache in gainWeight.
81  // They're used in fillPulseHeights below.
82  // When ME11a is ganged we only need the first 16 values of the 48 filled,
83  // but 17-48 are just duplicates of 1-16 anyway
84 
85  if ( useCalib ) {
87 
88  // *** START DUMP gainWeight
89  // std::cout << "gainWeight for id= " << id_ << " nstrips= " << nstrips_ << std::endl;
90  // for ( size_t i = 0; i!=10; ++i ) {
91  // for ( size_t j = 0; j!=8; ++j ) {
92  // std::cout << gainWeight[i*8 + j] << " ";
93  // }
94  // std::cout << std::endl;
95  // }
96  // *** END DUMP gainWeight
97 
98  }
99 
100  // Store pulseheights from SCA and find maxima (potential hits)
101  fillPulseHeights( rstripd );
102  findMaxima(id);
103 
104  // Make a Strip Hit out of each strip local maximum
105  for ( size_t imax = 0; imax != theMaxima.size(); ++imax ) {
106 
107  // Initialize parameters entering the CSCStripHit
109  theStrips.clear();
110  strips_adc.clear();
111  strips_adcRaw.clear();
112 
113  // makeCluster calls findHitOnStripPosition to determine the centroid position
114 
115  // Remember, the array starts at 0, but the stripId starts at 1...
116  float strippos = makeCluster( theMaxima[imax]+1 );
117 
118  //if ( strippos < 0 || tmax_cluster < 3 ){
119  // the strippos (as calculated here) is not used later on in
121  // with the negative charges allowed it can become negative
122  if ( tmax_cluster < 3 ){
123  theClosestMaximum.push_back(99); // to keep proper vector size
124  continue;
125  }
126  //---- If two maxima are too close the error assigned will be width/sqrt(12) - see CSCXonStrip_MatchGatti.cc
127  int maximum_to_left = 99; //---- If there is one maximum - the distance is set to 99 (strips)
128  int maximum_to_right = 99;
129  if(imax<theMaxima.size()-1){
130  maximum_to_right = theMaxima.at(imax+1) - theMaxima.at(imax);
131  }
132  if(imax>0 ){
133  maximum_to_left = theMaxima.at(imax-1) - theMaxima.at(imax);
134  }
135  if(std::abs(maximum_to_right) < std::abs(maximum_to_left)){
136  theClosestMaximum.push_back(maximum_to_right);
137  }
138  else{
139  theClosestMaximum.push_back(maximum_to_left);
140  }
141 
142  //---- Check if a neighbouring strip is a dead strip
143  //bool deadStrip = isNearDeadStrip(id, theMaxima.at(imax));
144  bool deadStripL = isDeadStrip(id, theMaxima.at(imax)-1, nstrips_);
145  bool deadStripR = isDeadStrip(id, theMaxima.at(imax)+1, nstrips_);
146  short int aDeadStrip = 0;
147  if(!deadStripL && !deadStripR){
148  aDeadStrip = 0;
149  }
150  else if(deadStripL && deadStripR){
151  aDeadStrip = 255;
152  }
153  else{
154  if(deadStripL){
155  aDeadStrip = theMaxima.at(imax)-1;
156  }
157  else{
158  aDeadStrip = theMaxima.at(imax)+1;
159  }
160  }
161 
164  std::vector<int> theL1AStrips;
165  for(int ila=0; ila<(int)theStrips.size(); ila++){
166  bool stripMatchCounter=false;
167  for ( auto itl1 = rstripd.first; itl1 != rstripd.second; ++itl1 ) {
168  int stripNproto = (*itl1).getStrip();
169  if( !ganged() ){
170  if(theStrips[ila]==stripNproto){
171  stripMatchCounter=true;
172  auto sz = (*itl1).getOverlappedSample().size();
173  int L1AbitOnPlace=0;
174  for(auto iBit=0UL; iBit<sz; iBit++){
175  L1AbitOnPlace |= ( (*itl1).getL1APhase(iBit) << (15-iBit));
176  }
177  theL1AStrips.push_back(theStrips[ila] | L1AbitOnPlace);
178  }
179  } else{
180  for(int tripl=0; tripl<3; ++tripl){
181  if(theStrips[ila]==(stripNproto+tripl*16)){
182  stripMatchCounter=true;
183  auto sz = (*itl1).getOverlappedSample().size();
184  int L1AbitOnPlace=0;
185  for(auto iBit=0UL; iBit<sz; iBit++){
186  L1AbitOnPlace |= ( (*itl1).getL1APhase(iBit) << (15-iBit));
187  }
188  theL1AStrips.push_back(theStrips[ila] | L1AbitOnPlace);
189  }
190  }
191  }
192  }
193  if(!stripMatchCounter){
194  theL1AStrips.push_back(theStrips[ila]);
195  }
196  }
198 
199  CSCStripHit striphit( id, strippos, tmax_cluster, theL1AStrips, strips_adc, strips_adcRaw,
200  theConsecutiveStrips.at(imax), theClosestMaximum.at(imax), aDeadStrip);
201  hitsInLayer.push_back( striphit );
202  }
203 
205  /*
206  for(std::vector<CSCStripHit>::const_iterator itSHit=hitsInLayer.begin(); itSHit!=hitsInLayer.end(); ++itSHit){
207  (*itSHit).print();
208  }
209  */
210 
211  return hitsInLayer;
212 }
int nStrips() const
const CSCLayer * layer_
void findMaxima(const CSCDetId &id)
Find local maxima.
std::vector< int > theConsecutiveStrips
bool isDeadStrip(const CSCDetId &id, int centralStrip, int nstrips)
Is the strip &#39;bad&#39;?
std::vector< int > theStrips
std::vector< int > theClosestMaximum
static const int theClusterSize
const CSCChamberSpecs * specs() const
Definition: CSCChamber.h:42
const CSCRecoConditions * recoConditions_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool gangedStrips() const
float makeCluster(int centerStrip)
Make clusters using local maxima.
#define LogTrace(id)
int ring() const
Definition: CSCDetId.h:75
std::vector< float > strips_adcRaw
std::vector< int > theMaxima
void stripWeights(const CSCDetId &id, short int nstrips, float *weights) const
std::vector< float > strips_adc
void fillPulseHeights(const CSCStripDigiCollection::Range &rstripd)
Store SCA pulseheight information from strips in digis of one layer.
const CSCChamber * chamber() const
Definition: CSCLayer.h:52
void CSCHitFromStripOnly::setConditions ( const CSCRecoConditions reco)
inline

Definition at line 47 of file CSCHitFromStripOnly.h.

References trackingPlots::reco, and recoConditions_.

Referenced by CSCRecHitDBuilder::setConditions().

47  {
49  }
const CSCRecoConditions * recoConditions_
void CSCHitFromStripOnly::setGanged ( bool  ig)
inline

Member Data Documentation

CSCPedestalChoice* CSCHitFromStripOnly::calcped_
private
int CSCHitFromStripOnly::clusterSize
private

Definition at line 110 of file CSCHitFromStripOnly.h.

Referenced by makeCluster(), makeStripData(), and runStrip().

float CSCHitFromStripOnly::gainWeight[80]
private

Definition at line 89 of file CSCHitFromStripOnly.h.

Referenced by fillPulseHeights(), and runStrip().

bool CSCHitFromStripOnly::ganged_
private

Definition at line 115 of file CSCHitFromStripOnly.h.

Referenced by ganged(), and setGanged().

CSCDetId CSCHitFromStripOnly::id_
private

Definition at line 83 of file CSCHitFromStripOnly.h.

Referenced by fillPulseHeights(), and runStrip().

const CSCLayer* CSCHitFromStripOnly::layer_
private

Definition at line 84 of file CSCHitFromStripOnly.h.

Referenced by runStrip().

unsigned CSCHitFromStripOnly::nstrips_
private

Definition at line 87 of file CSCHitFromStripOnly.h.

Referenced by findMaxima(), makeCluster(), and runStrip().

const CSCRecoConditions* CSCHitFromStripOnly::recoConditions_
private
std::vector<float> CSCHitFromStripOnly::strips_adc
private

Definition at line 111 of file CSCHitFromStripOnly.h.

Referenced by findHitOnStripPosition(), and runStrip().

std::vector<float> CSCHitFromStripOnly::strips_adcRaw
private

Definition at line 112 of file CSCHitFromStripOnly.h.

Referenced by findHitOnStripPosition(), and runStrip().

std::vector<int> CSCHitFromStripOnly::theClosestMaximum
private

Definition at line 106 of file CSCHitFromStripOnly.h.

Referenced by findMaxima(), and runStrip().

const int CSCHitFromStripOnly::theClusterSize = 3
staticprivate

Definition at line 96 of file CSCHitFromStripOnly.h.

Referenced by isDeadStrip(), makeCluster(), and runStrip().

std::vector<int> CSCHitFromStripOnly::theConsecutiveStrips
private

Definition at line 105 of file CSCHitFromStripOnly.h.

Referenced by findMaxima(), and runStrip().

std::vector<int> CSCHitFromStripOnly::theMaxima
private

Definition at line 104 of file CSCHitFromStripOnly.h.

Referenced by findMaxima(), makeStripData(), and runStrip().

PulseHeightMap CSCHitFromStripOnly::thePulseHeightMap
private

Definition at line 102 of file CSCHitFromStripOnly.h.

Referenced by fillPulseHeights(), findMaxima(), isPeakOK(), and makeStripData().

std::vector<int> CSCHitFromStripOnly::theStrips
private

Definition at line 113 of file CSCHitFromStripOnly.h.

Referenced by makeCluster(), and runStrip().

float CSCHitFromStripOnly::theThresholdForAPeak
private

Definition at line 97 of file CSCHitFromStripOnly.h.

Referenced by CSCHitFromStripOnly(), and isPeakOK().

float CSCHitFromStripOnly::theThresholdForCluster
private

Definition at line 98 of file CSCHitFromStripOnly.h.

Referenced by CSCHitFromStripOnly(), and isPeakOK().

int CSCHitFromStripOnly::tmax_cluster
private

Definition at line 109 of file CSCHitFromStripOnly.h.

Referenced by makeStripData(), and runStrip().

bool CSCHitFromStripOnly::useCalib
private

Definition at line 95 of file CSCHitFromStripOnly.h.

Referenced by CSCHitFromStripOnly(), fillPulseHeights(), and runStrip().