CMS 3D CMS Logo

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

#include <CSCCathodeLCTAnalyzer.h>

Public Member Functions

 CSCCathodeLCTAnalyzer ()
 
std::vector< CSCCathodeLayerInfogetSimInfo (const CSCCLCTDigi &clct, const CSCDetId &clctId, const CSCComparatorDigiCollection *compdc, const edm::PSimHitContainer *allSimHits)
 
double getStripPhi (const CSCDetId &layerId, const float strip)
 
int nearestHS (const std::vector< CSCCathodeLayerInfo > &allLayerInfo, double &closestPhi, double &closestEta)
 
void setGeometry (const CSCGeometry *geom)
 

Static Public Member Functions

static void setDebug ()
 
static void setNoDebug ()
 

Private Member Functions

void digiSimHitAssociator (CSCCathodeLayerInfo &info, const edm::PSimHitContainer *allSimHits)
 
std::vector< CSCCathodeLayerInfolctDigis (const CSCCLCTDigi &clct, const CSCDetId &clctId, const CSCComparatorDigiCollection *compdc)
 
int preselectDigis (const int clct_bx, const CSCDetId &layerId, const CSCComparatorDigiCollection *compdc, std::vector< CSCComparatorDigi > &digiMap, int hfstripDigis[CSCConstants::NUM_HALF_STRIPS], int time[CSCConstants::MAX_NUM_STRIPS], int comp[CSCConstants::MAX_NUM_STRIPS], int digiNum[CSCConstants::MAX_NUM_STRIPS])
 

Private Attributes

const CSCGeometrygeom_
 

Static Private Attributes

static bool debug = true
 
static bool doME1A = false
 

Detailed Description

Class for Monte Carlo studies of cathode LCTs. Returns a vector of up to six (one per layer) CSCCathodeLayerInfo objects for a given CLCT. They contain the list of comparator digis used to build a given CLCT, and the list of associated (closest) SimHits.

Author
Slava Valuev 26 May 2004. Porting from ORCA by S. Valuev in September 2006.

Definition at line 25 of file CSCCathodeLCTAnalyzer.h.

Constructor & Destructor Documentation

CSCCathodeLCTAnalyzer::CSCCathodeLCTAnalyzer ( )
inline

Default constructor.

Definition at line 28 of file CSCCathodeLCTAnalyzer.h.

References relativeConstraints::geom, getSimInfo(), getStripPhi(), nearestHS(), setGeometry(), and digitizers_cfi::strip.

28 {};

Member Function Documentation

void CSCCathodeLCTAnalyzer::digiSimHitAssociator ( CSCCathodeLayerInfo info,
const edm::PSimHitContainer allSimHits 
)
private

Definition at line 225 of file CSCCathodeLCTAnalyzer.cc.

References CSCLayerInfo< TYPE >::addComponent(), CSCDetId::chamber(), debug, SiPixelRawToDigiRegional_cfi::deltaPhi, CSCDetId::endcap(), CSCLayerInfo< TYPE >::getId(), CSCLayerInfo< TYPE >::getRecDigis(), CSCDetId::layer(), LogDebug, LogTrace, M_PI, PSimHit::particleType(), PV3DBase< T, PVType, FrameType >::phi(), create_new_empty_test_file_cfg::prd, CSCDetId::ring(), FastTrackerRecHitCombiner_cfi::simHits, CSCDetId::station(), digitizers_cfi::strip, and GeomDet::toGlobal().

225  {
226  // This routine matches up the closest simHit to every digi on a given layer.
227  // Note that it is possible to have up to 2 digis contribute to an LCT
228  // on a given layer. In a primitive algorithm used now more than one digi on
229  // a layer can be associated with the same simHit.
230  vector<PSimHit> simHits;
231 
232  vector<CSCComparatorDigi> thisLayerDigis = info.getRecDigis();
233  if (!thisLayerDigis.empty()) {
234  CSCDetId layerId = info.getId();
235  bool me11 = (layerId.station() == 1) && (layerId.ring() == 1);
236 
237  // Get simHits in this layer.
238  for (edm::PSimHitContainer::const_iterator simHitIt = allSimHits->begin(); simHitIt != allSimHits->end();
239  simHitIt++) {
240  // Find detId where simHit is located.
241  CSCDetId hitId = (CSCDetId)(*simHitIt).detUnitId();
242  if (hitId == layerId)
243  simHits.push_back(*simHitIt);
244  if (me11) {
245  CSCDetId layerId_me1a(layerId.endcap(), layerId.station(), 4, layerId.chamber(), layerId.layer());
246  if (hitId == layerId_me1a)
247  simHits.push_back(*simHitIt);
248  }
249  }
250 
251  if (!simHits.empty()) {
252  ostringstream strstrm;
253  if (debug) {
254  strstrm << "\nLayer " << layerId.layer() << " has " << simHits.size() << " SimHit(s); phi value(s) = ";
255  }
256 
257  // Get the strip number for every digi and convert to phi.
258  for (vector<CSCComparatorDigi>::iterator prd = thisLayerDigis.begin(); prd != thisLayerDigis.end(); prd++) {
259  double deltaPhiMin = 999.;
260  double bestHitPhi = 999.;
261  PSimHit* bestHit = nullptr;
262 
263  int strip = prd->getStrip();
264  double digiPhi = getStripPhi(layerId, strip - 0.5);
265 
266  const CSCLayer* csclayer = geom_->layer(layerId);
267  for (vector<PSimHit>::iterator psh = simHits.begin(); psh != simHits.end(); psh++) {
268  // Get the local phi for the simHit.
269  LocalPoint hitLP = psh->localPosition();
270  GlobalPoint hitGP = csclayer->toGlobal(hitLP);
271  double hitPhi = hitGP.phi();
272  if (debug)
273  strstrm << hitPhi << " ";
274  // Find the lowest deltaPhi and store the associated simHit.
275  // Check to see if comparison is on pi border, and if so, make
276  // corrections.
277  double deltaPhi = 999.;
278  if (fabs(hitPhi - digiPhi) < M_PI) {
279  deltaPhi = fabs(hitPhi - digiPhi);
280  } else {
281  if (debug)
282  LogDebug("digiSimHitAssociator") << "SimHit and Digi are close to edge!!!";
283  deltaPhi = fabs(fabs(hitPhi - digiPhi) - 2. * M_PI);
284  }
285  if (deltaPhi < deltaPhiMin) {
286  deltaPhiMin = deltaPhi;
287  bestHit = &(*psh);
288  bestHitPhi = hitPhi;
289  }
290  }
291  if (debug) {
292  strstrm << "\nDigi Phi: " << digiPhi << ", closest SimHit phi: " << bestHitPhi
293  << ", particle type: " << bestHit->particleType();
294  }
295  info.addComponent(*bestHit);
296  }
297  if (debug) {
298  LogTrace("digiSimHitAssociator") << strstrm.str();
299  }
300  }
301  }
302 }
#define LogDebug(id)
int chamber() const
Definition: CSCDetId.h:62
std::vector< TYPE > getRecDigis() const
Definition: CSCLayerInfo.h:45
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
void addComponent(const TYPE digi)
Definition: CSCLayerInfo.h:36
int layer() const
Definition: CSCDetId.h:56
int endcap() const
Definition: CSCDetId.h:85
const CSCGeometry * geom_
#define LogTrace(id)
#define M_PI
int ring() const
Definition: CSCDetId.h:68
double getStripPhi(const CSCDetId &layerId, const float strip)
int particleType() const
Definition: PSimHit.h:89
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
Definition: CSCGeometry.cc:105
CSCDetId getId() const
Definition: CSCLayerInfo.h:42
int station() const
Definition: CSCDetId.h:79
vector< CSCCathodeLayerInfo > CSCCathodeLCTAnalyzer::getSimInfo ( const CSCCLCTDigi clct,
const CSCDetId clctId,
const CSCComparatorDigiCollection compdc,
const edm::PSimHitContainer allSimHits 
)

Constructs vector of CSCCathodeLayerInfo objects for CLCT.

Definition at line 16 of file CSCCathodeLCTAnalyzer.cc.

References Exception, and CSCConstants::NUM_LAYERS.

Referenced by CSCTriggerPrimitivesReader::calcResolution(), and CSCCathodeLCTAnalyzer().

19  {
20  // Fills vector of CSCCathodeLayerInfo objects. There can be up to 6 such
21  // objects (one per layer); they contain the list of comparator digis used to
22  // build a given CLCT, and the list of associated (closest) SimHits.
23  // Filling is done in two steps: first, we construct the list of comparator
24  // digis; next, find associated SimHits.
25  vector<CSCCathodeLayerInfo> clctInfo = lctDigis(clct, clctId, compdc);
26 
27  // Sanity checks.
28  if (clctInfo.size() > CSCConstants::NUM_LAYERS) {
29  throw cms::Exception("CSCCathodeLCTAnalyzer") << "+++ Number of CSCCathodeLayerInfo objects, " << clctInfo.size()
30  << ", exceeds max expected, " << CSCConstants::NUM_LAYERS << " +++\n";
31  }
32  // not a good check for high PU
33  //if (clctInfo.size() != (unsigned)clct.getQuality()) {
34  // edm::LogWarning("L1CSCTPEmulatorWrongValues")
35  // << "+++ Warning: mismatch between CLCT quality, " << clct.getQuality()
36  // << ", and the number of layers with digis, " << clctInfo.size()
37  // << ", in clctInfo! +++\n";
38  //}
39 
40  // Find the closest SimHit to each Digi.
41  vector<CSCCathodeLayerInfo>::iterator pcli;
42  for (pcli = clctInfo.begin(); pcli != clctInfo.end(); pcli++) {
43  digiSimHitAssociator(*pcli, allSimHits);
44  }
45 
46  return clctInfo;
47 }
void digiSimHitAssociator(CSCCathodeLayerInfo &info, const edm::PSimHitContainer *allSimHits)
std::vector< CSCCathodeLayerInfo > lctDigis(const CSCCLCTDigi &clct, const CSCDetId &clctId, const CSCComparatorDigiCollection *compdc)
double CSCCathodeLCTAnalyzer::getStripPhi ( const CSCDetId layerId,
const float  strip 
)

Returns phi position of a given strip.

Definition at line 401 of file CSCCathodeLCTAnalyzer.cc.

References CSCLayer::geometry(), OffsetRadialStripTopology::localPosition(), CSCConstants::MAX_NUM_STRIPS, PV3DBase< T, PVType, FrameType >::phi(), GeomDet::toGlobal(), and CSCLayerGeometry::topology().

Referenced by CSCTriggerPrimitivesReader::calcResolution(), and CSCCathodeLCTAnalyzer().

401  {
402  // Returns phi position of a given strip.
403  if (strip < 0. || strip >= CSCConstants::MAX_NUM_STRIPS) {
404  edm::LogWarning("L1CSCTPEmulatorWrongInput")
405  << "+++ Warning: strip, " << strip << ", is not in [0-" << CSCConstants::MAX_NUM_STRIPS << ") interval +++\n";
406  }
407 
408  const CSCLayer* csclayer = geom_->layer(layerId);
409  const CSCLayerGeometry* layerGeom = csclayer->geometry();
410 
411  // Position at the center of the strip.
412  LocalPoint digiLP = layerGeom->topology()->localPosition(strip);
413  // The alternative calculation gives exactly the same answer.
414  // double ystrip = 0.0;
415  // double xstrip = topology->xOfStrip(strip, ystrip);
416  // LocalPoint digiLP = LocalPoint(xstrip, ystrip);
417  GlobalPoint digiGP = csclayer->toGlobal(digiLP);
418  double phi = digiGP.phi();
419 
420  return phi;
421 }
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
const CSCGeometry * geom_
const CSCStripTopology * topology() const
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
Definition: CSCGeometry.cc:105
LocalPoint localPosition(float strip) const override
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:44
vector< CSCCathodeLayerInfo > CSCCathodeLCTAnalyzer::lctDigis ( const CSCCLCTDigi clct,
const CSCDetId clctId,
const CSCComparatorDigiCollection compdc 
)
private

Definition at line 49 of file CSCCathodeLCTAnalyzer.cc.

References CSCLayerInfo< TYPE >::addComponent(), CSCDetId::chamber(), CSCPatternBank::clct_pattern, CSCPatternBank::clct_pattern_offset, CSCLayerInfo< TYPE >::clear(), AlCaHLTBitMon_QueryRunRegistry::comp, debug, CSCDetId::endcap(), CSCCLCTDigi::getBX(), CSCLayerInfo< TYPE >::getId(), CSCCLCTDigi::getKeyStrip(), CSCCLCTDigi::getPattern(), CSCCLCTDigi::getStripType(), CSCDetId::layer(), LogDebug, LogTrace, CSCConstants::MAX_HALFSTRIPS_IN_PATTERN, CSCConstants::MAX_NUM_STRIPS, CSCConstants::NUM_HALF_STRIPS, CSCConstants::NUM_LAYERS, CSCDetId::ring(), CSCLayerInfo< TYPE >::setId(), CSCDetId::station(), digitizers_cfi::strip, and ntuplemaker::time.

51  {
52  // Function to find a list of ComparatorDigis used to create an LCT.
53  // The list of ComparatorDigis is stored in a class called CSCLayerInfo which
54  // contains the layerId's of the stored ComparatorDigis as well as the actual
55  // digis themselves.
56  int hfstripDigis[CSCConstants::NUM_HALF_STRIPS];
58  int digiNum[CSCConstants::MAX_NUM_STRIPS];
59  int digiId = -999;
60  CSCCathodeLayerInfo tempInfo;
61  vector<CSCCathodeLayerInfo> vectInfo;
62 
63  // Inquire the clct for its key half-strip, strip type and pattern number.
64  int clct_keystrip = clct.getKeyStrip();
65  int clct_stripType = clct.getStripType();
66  int clct_pattern = clct.getPattern();
67  int clct_bx = clct.getBX();
68 
69  // Re-scale the key di-strip number to the count used in the search.
70  if (clct_stripType == 0)
71  clct_keystrip /= 4;
72 
73  if (debug) {
74  char stype = (clct_stripType == 0) ? 'D' : 'H';
75  LogDebug("lctDigis") << "\nlctDigis: CLCT keystrip = " << clct_keystrip << " (" << stype << ")"
76  << " pattern = " << clct_pattern << "; Id:"
77  << " endcap " << clctId.endcap() << ", station " << clctId.station() << ", ring "
78  << clctId.ring() << ", chamber " << clctId.chamber();
79  }
80 
81  // 'Staggering' for key layer. Needed for TMB07 version.
82  const int key_layer = 3; // counting from 1.
83  CSCDetId layerId(clctId.endcap(), clctId.station(), clctId.ring(), clctId.chamber(), key_layer);
84  const CSCLayer* csclayer = geom_->layer(layerId);
85  int key_stagger = (csclayer->geometry()->stagger() + 1) / 2;
86 
87  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
88  // Clear tempInfo values every iteration before using.
89  tempInfo.clear();
90 
91  // @ Switch to maps eventually
92  vector<CSCComparatorDigi> digiMap;
93  int digi_num = 0;
94  for (int i_hstrip = 0; i_hstrip < CSCConstants::NUM_HALF_STRIPS; i_hstrip++) {
95  hfstripDigis[i_hstrip] = -999;
96  }
97  for (int i_strip = 0; i_strip < CSCConstants::MAX_NUM_STRIPS; i_strip++) {
98  time[i_strip] = -999;
99  comp[i_strip] = 0;
100  digiNum[i_strip] = -999;
101  }
102 
103  // CLCTs belong to a chamber, so their layerId is 0. Comparator digis
104  // belong to layers, so in order to access them we need to add layer
105  // number to CLCT's endcap, chamber, etc.
106  CSCDetId layerId(clctId.endcap(), clctId.station(), clctId.ring(), clctId.chamber(), i_layer + 1);
107 
108  // Preselection of Digis: right layer and bx.
109  digi_num += preselectDigis(clct_bx, layerId, compdc, digiMap, hfstripDigis, time, comp, digiNum);
110 
111  // In case of ME1/1, one can also look for digis in ME1/A.
112  // Skip them for now since the resolution of CLCTs in ME1/A is
113  // terrible (strips are ganged; channel numbers translated to be
114  // in CFEB=4).
115  if (doME1A) {
116  if (clctId.station() == 1 && clctId.ring() == 1) {
117  CSCDetId layerId_me1a(clctId.endcap(), clctId.station(), 4, clctId.chamber(), i_layer + 1);
118  digi_num += preselectDigis(clct_bx, layerId_me1a, compdc, digiMap, hfstripDigis, time, comp, digiNum);
119  }
120  }
121 
122  // Loop over all the strips in a pattern.
123  int max_pattern_strips, layer, strip;
124  max_pattern_strips = CSCConstants::MAX_HALFSTRIPS_IN_PATTERN;
125  for (int i_strip = 0; i_strip < max_pattern_strips; i_strip++) {
126  layer = CSCPatternBank::clct_pattern[clct_pattern][i_strip];
127  if (layer == i_layer) {
128  strip = clct_keystrip + key_stagger + CSCPatternBank::clct_pattern_offset[i_strip];
129  if (strip >= 0 && strip < CSCConstants::NUM_HALF_STRIPS) {
130  digiId = hfstripDigis[strip];
131  // halfstripDigis contains the digi numbers
132  // that were carried through the different transformations
133  // to keystrip. -999 means there was no Digi.
134  if (digiId >= 0) {
135  tempInfo.setId(layerId); // store the layer of this object
136  tempInfo.addComponent(digiMap[digiId]); // and the RecDigi
137  if (debug)
138  LogTrace("lctDigis") << " Digi on CLCT: strip/comp/time " << digiMap[digiId];
139  }
140  }
141  }
142  }
143 
144  // Save results for each non-empty layer.
145  if (tempInfo.getId().layer() != 0) {
146  vectInfo.push_back(tempInfo);
147  }
148  }
149  return vectInfo;
150 }
#define LogDebug(id)
int chamber() const
Definition: CSCDetId.h:62
void addComponent(const TYPE digi)
Definition: CSCLayerInfo.h:36
int layer() const
Definition: CSCDetId.h:56
int preselectDigis(const int clct_bx, const CSCDetId &layerId, const CSCComparatorDigiCollection *compdc, std::vector< CSCComparatorDigi > &digiMap, int hfstripDigis[CSCConstants::NUM_HALF_STRIPS], int time[CSCConstants::MAX_NUM_STRIPS], int comp[CSCConstants::MAX_NUM_STRIPS], int digiNum[CSCConstants::MAX_NUM_STRIPS])
int getStripType() const
return striptype
Definition: CSCCLCTDigi.h:53
static const int clct_pattern_offset[CSCConstants::MAX_HALFSTRIPS_IN_PATTERN]
int endcap() const
Definition: CSCDetId.h:85
const CSCGeometry * geom_
int getBX() const
return BX
Definition: CSCCLCTDigi.h:77
void clear()
Definition: CSCLayerInfo.h:70
#define LogTrace(id)
int ring() const
Definition: CSCDetId.h:68
void setId(const CSCDetId id)
Definition: CSCLayerInfo.h:33
int getPattern() const
return pattern
Definition: CSCCLCTDigi.h:47
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
Definition: CSCGeometry.cc:105
CSCDetId getId() const
Definition: CSCLayerInfo.h:42
int station() const
Definition: CSCDetId.h:79
int getKeyStrip() const
Definition: CSCCLCTDigi.h:94
static const int clct_pattern[CSCConstants::NUM_CLCT_PATTERNS][CSCConstants::MAX_HALFSTRIPS_IN_PATTERN+2]
int CSCCathodeLCTAnalyzer::nearestHS ( const std::vector< CSCCathodeLayerInfo > &  allLayerInfo,
double &  closestPhi,
double &  closestEta 
)

Finds half-strip, phi and eta of the nearest SimHit for comparison to the reconstructed values.

Definition at line 304 of file CSCCathodeLCTAnalyzer.cc.

References AlCaHLTBitMon_QueryRunRegistry::comp, debug, relativeConstraints::empty, PV3DBase< T, PVType, FrameType >::eta(), CSCLayer::geometry(), mps_fire::i, CSCConstants::KEY_CLCT_LAYER, CSCDetId::layer(), PSimHit::localPosition(), LogDebug, M_PI, CSCConstants::MAX_NUM_STRIPS, PV3DBase< T, PVType, FrameType >::phi(), digitizers_cfi::strip, OffsetRadialStripTopology::strip(), GeomDet::toGlobal(), and CSCLayerGeometry::topology().

Referenced by CSCTriggerPrimitivesReader::calcResolution(), and CSCCathodeLCTAnalyzer().

306  {
307  // Function to set the simulated values for comparison to the reconstructed.
308  // It first tries to look for the SimHit in the key layer. If it is
309  // unsuccessful, it loops over all layers and looks for an associated
310  // hit in any one of the layers. First instance of a hit gives a calculation
311  // for phi.
312  int nearestHS = -999;
313  PSimHit matchedHit;
314  bool hit_found = false;
315  CSCDetId layerId;
316  static const int key_layer = CSCConstants::KEY_CLCT_LAYER;
317 
318  vector<CSCCathodeLayerInfo>::const_iterator pli;
319  for (pli = allLayerInfo.begin(); pli != allLayerInfo.end(); pli++) {
320  if (pli->getId().layer() == key_layer) {
321  vector<PSimHit> thisLayerHits = pli->getSimHits();
322  if (!thisLayerHits.empty()) {
323  // There can be one RecDigi (and therefore only one SimHit)
324  // in a keylayer.
325  if (thisLayerHits.size() != 1) {
326  edm::LogWarning("L1CSCTPEmulatorWrongValues")
327  << "+++ Warning: " << thisLayerHits.size() << " SimHits in key layer " << key_layer << "! +++ \n";
328  for (unsigned i = 0; i < thisLayerHits.size(); i++) {
329  edm::LogWarning("L1CSCTPEmulatorWrongValues") << " SimHit # " << i << thisLayerHits[i] << "\n";
330  }
331  }
332  matchedHit = thisLayerHits[0];
333  layerId = pli->getId();
334  hit_found = true;
335  break;
336  }
337  }
338  }
339 
340  if (hit_found == false) {
341  for (pli = allLayerInfo.begin(); pli != allLayerInfo.end(); pli++) {
342  // if there is any occurrence of simHit size greater that zero, use this.
343  if (!(pli->getRecDigis()).empty() && !(pli->getSimHits()).empty()) {
344  // Always use the first SimHit for now.
345  matchedHit = (pli->getSimHits())[0];
346  layerId = pli->getId();
347  hit_found = true;
348  break;
349  }
350  }
351  }
352 
353  // Set phi and eta if there were any hits found.
354  if (hit_found) {
355  const CSCLayer* csclayer = geom_->layer(layerId);
356  const CSCLayerGeometry* layerGeom = csclayer->geometry();
357  //nearestStrip = layerGeom->nearestStrip(matchedHit.localPosition());
358  // Float in units of the strip (angular) width. From RadialStripTopology
359  // comments: "Strip in which a given LocalPoint lies. This is a float
360  // which represents the fractional strip position within the detector.
361  // Returns zero if the LocalPoint falls at the extreme low edge of the
362  // detector or BELOW, and float(nstrips) if it falls at the extreme high
363  // edge or ABOVE."
364  float strip = layerGeom->topology()->strip(matchedHit.localPosition());
365 
366  // Should be in the interval [0-MAX_STRIPS). I see (rarely) cases when
367  // strip = nearestStrip = MAX_STRIPS; do not know how to handle them.
368  int nearestStrip = static_cast<int>(strip);
369  if (nearestStrip < 0 || nearestStrip >= CSCConstants::MAX_NUM_STRIPS) {
370  edm::LogWarning("L1CSCTPEmulatorWrongInput")
371  << "+++ Warning: nearest strip, " << nearestStrip << ", is not in [0-" << CSCConstants::MAX_NUM_STRIPS
372  << ") interval; strip = " << strip << " +++\n";
373  }
374  // Left/right half of the strip.
375  int comp = ((strip - nearestStrip) < 0.5) ? 0 : 1;
376  nearestHS = 2 * nearestStrip + comp;
377 
378  GlobalPoint thisPoint = csclayer->toGlobal(matchedHit.localPosition());
379  closestPhi = thisPoint.phi();
380  closestEta = thisPoint.eta();
381  ostringstream strstrm;
382  if (debug)
383  strstrm << "Matched cathode phi: " << closestPhi;
384  if (closestPhi < 0.) {
385  closestPhi += 2. * M_PI;
386  if (debug)
387  strstrm << "(" << closestPhi << ")";
388  }
389  if (debug) {
390  strstrm << " eta: " << closestEta << " on a layer " << layerId.layer() << " (1-6);"
391  << " nearest strip: " << nearestStrip;
392  LogDebug("nearestHS") << strstrm.str();
393  }
394  }
395 
396  return nearestHS;
397 }
#define LogDebug(id)
float strip(const LocalPoint &) const override
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
int layer() const
Definition: CSCDetId.h:56
Local3DPoint localPosition() const
Definition: PSimHit.h:52
const CSCGeometry * geom_
int nearestHS(const std::vector< CSCCathodeLayerInfo > &allLayerInfo, double &closestPhi, double &closestEta)
#define M_PI
const CSCStripTopology * topology() const
T eta() const
Definition: PV3DBase.h:73
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
Definition: CSCGeometry.cc:105
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:44
int CSCCathodeLCTAnalyzer::preselectDigis ( const int  clct_bx,
const CSCDetId layerId,
const CSCComparatorDigiCollection compdc,
std::vector< CSCComparatorDigi > &  digiMap,
int  hfstripDigis[CSCConstants::NUM_HALF_STRIPS],
int  time[CSCConstants::MAX_NUM_STRIPS],
int  comp[CSCConstants::MAX_NUM_STRIPS],
int  digiNum[CSCConstants::MAX_NUM_STRIPS] 
)
private

Definition at line 152 of file CSCCathodeLCTAnalyzer.cc.

References AlCaHLTBitMon_QueryRunRegistry::comp, debug, CSCLayer::geometry(), CSCDetId::layer(), LogDebug, CSCDetId::ring(), CSCLayerGeometry::stagger(), CSCDetId::station(), and ntuplemaker::time.

159  {
160  // Preselection of Digis: right layer and bx.
161  int digi_num = 0;
162 
163  // Parameters defining time window for accepting hits; should come from
164  // configuration file eventually.
165  const int fifo_tbins = 12;
166  const int hit_persist = 4;
167  const int drift_delay = 2;
168 
169  // 'Staggering' for this layer.
170  const CSCLayer* csclayer = geom_->layer(layerId);
171  int stagger = (csclayer->geometry()->stagger() + 1) / 2;
172 
173  bool me1a = (layerId.station() == 1) && (layerId.ring() == 4);
174 
175  const CSCComparatorDigiCollection::Range rcompd = compdc->get(layerId);
176  for (CSCComparatorDigiCollection::const_iterator digiIt = rcompd.first; digiIt != rcompd.second; ++digiIt) {
177  if (debug)
178  LogDebug("lctDigis") << "Comparator digi: layer " << layerId.layer() - 1
179  << " strip/comparator/time =" << (*digiIt);
180 
181  if ((*digiIt).getComparator() == 0 || (*digiIt).getComparator() == 1) {
182  int bx_time = (*digiIt).getTimeBin();
183  if (bx_time >= 0 && bx_time < fifo_tbins) {
184  // Do not use digis which could not have contributed to a given CLCT.
185  int latch_bx = clct_bx + drift_delay;
186  if (bx_time <= latch_bx - hit_persist || bx_time > latch_bx) {
187  if (debug)
188  LogDebug("lctDigis") << "Late comparator digi: layer " << layerId.layer() - 1
189  << " strip/comparator/time =" << (*digiIt) << " skipping...";
190  continue;
191  }
192 
193  // If there is more than one digi on the same strip, pick the one
194  // which occurred earlier.
195  int i_strip = (*digiIt).getStrip() - 1; // starting from 0
196  if (me1a && i_strip < 16) {
197  // Move ME1/A comparators from CFEB=0 to CFEB=4 if this has not
198  // been done already.
199  i_strip += 64;
200  }
201 
202  if (time[i_strip] <= 0 || time[i_strip] > bx_time) {
203  // @ Switch to maps; check for match in time.
204  int i_hfstrip = 2 * i_strip + (*digiIt).getComparator() + stagger;
205  hfstripDigis[i_hfstrip] = digi_num;
206 
207  // Arrays for distrip stagger
208  comp[i_strip] = (*digiIt).getComparator();
209  time[i_strip] = bx_time;
210  digiNum[i_strip] = digi_num;
211 
212  if (debug)
213  LogDebug("lctDigis") << "digi_num = " << digi_num << " half-strip = " << i_hfstrip
214  << " strip = " << i_strip;
215  }
216  }
217  }
218  digiMap.push_back(*digiIt);
219  digi_num++;
220  }
221 
222  return digi_num;
223 }
#define LogDebug(id)
int layer() const
Definition: CSCDetId.h:56
const CSCGeometry * geom_
int ring() const
Definition: CSCDetId.h:68
int stagger() const
std::pair< const_iterator, const_iterator > Range
std::vector< DigiType >::const_iterator const_iterator
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
Definition: CSCGeometry.cc:105
int station() const
Definition: CSCDetId.h:79
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:44
static void CSCCathodeLCTAnalyzer::setDebug ( )
inlinestatic

Turns on the debug flag for this class.

Definition at line 47 of file CSCCathodeLCTAnalyzer.h.

References debug.

47 { debug = true; }
void CSCCathodeLCTAnalyzer::setGeometry ( const CSCGeometry geom)

Cache pointer to geometry for current event.

Definition at line 399 of file CSCCathodeLCTAnalyzer.cc.

References relativeConstraints::geom.

Referenced by CSCTriggerPrimitivesReader::calcResolution(), and CSCCathodeLCTAnalyzer().

static void CSCCathodeLCTAnalyzer::setNoDebug ( )
inlinestatic

Turns off the debug flag for this class (default).

Definition at line 50 of file CSCCathodeLCTAnalyzer.h.

References debug.

50 { debug = false; }

Member Data Documentation

bool CSCCathodeLCTAnalyzer::debug = true
staticprivate
bool CSCCathodeLCTAnalyzer::doME1A = false
staticprivate

Flag to decide whether to analyze stubs in ME1/A or not.

Definition at line 56 of file CSCCathodeLCTAnalyzer.h.

const CSCGeometry* CSCCathodeLCTAnalyzer::geom_
private

Definition at line 59 of file CSCCathodeLCTAnalyzer.h.