CMS 3D CMS Logo

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

#include <CSCRecHitDBuilder.h>

Public Member Functions

void build (const CSCStripDigiCollection *stripds, const CSCWireDigiCollection *wireds, CSCRecHit2DCollection &oc)
 
 CSCRecHitDBuilder (const edm::ParameterSet &ps)
 
const CSCLayergetLayer (const CSCDetId &detId)
 
void setConditions (CSCRecoConditions *reco)
 
void setGeometry (const CSCGeometry *geom)
 
 ~CSCRecHitDBuilder ()
 

Private Attributes

const CSCGeometrygeom_
 
CSCHitFromStripOnlyhitsFromStripOnly_
 
CSCHitFromWireOnlyhitsFromWireOnly_
 
CSCMake2DRecHitmake2DHits_
 
bool makePseudo2DHits
 
CSCRecoConditionsrecoConditions_
 
int stripWireDeltaT
 
bool useCalib
 

Detailed Description

Algorithm to build 2-D RecHit from wire and strip digis in endcap muon CSCs by implementing a 'build' function required by CSCRecHitDProducer.

The builder goes through many stages before building 2-D hits: 1) It finds wire clusters and form wire hits which it stores in CSCWireHit. 2) From these wire hits, it builds pseudo-wire segments to clean up the wire hit collection from noisy hits. Only the hits falling on the segment or far away from existing segments are retained. 1) It then finds strip cluster and hits which it stores in CSCStripHit. 2) Similary to the wire hits, segments are build using the strip hits. Because of the trapezoidal geometry of the strips, all strip hits falling close to the pseudo-strip segments are retained.

Author
Stoyan Stoynev - NU

Definition at line 38 of file CSCRecHitDBuilder.h.

Constructor & Destructor Documentation

◆ CSCRecHitDBuilder()

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

Configure the algorithm via ctor. Receives ParameterSet percolated down from EDProducer which owns this Builder.

Definition at line 30 of file CSCRecHitDBuilder.cc.

References edm::ParameterSet::getParameter(), hitsFromStripOnly_, hitsFromWireOnly_, make2DHits_, stripWireDeltaT, and useCalib.

30  : geom_(nullptr) {
31  // Receives ParameterSet percolated down from EDProducer
32 
33  useCalib = ps.getParameter<bool>("CSCUseCalibrations");
34  stripWireDeltaT = ps.getParameter<int>("CSCstripWireDeltaTime");
35 
38  make2DHits_ = new CSCMake2DRecHit(ps);
39 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const CSCGeometry * geom_
CSCHitFromWireOnly * hitsFromWireOnly_
CSCHitFromStripOnly * hitsFromStripOnly_
CSCMake2DRecHit * make2DHits_

◆ ~CSCRecHitDBuilder()

CSCRecHitDBuilder::~CSCRecHitDBuilder ( )

Definition at line 41 of file CSCRecHitDBuilder.cc.

References hitsFromStripOnly_, hitsFromWireOnly_, and make2DHits_.

41  {
42  delete hitsFromStripOnly_;
43  delete hitsFromWireOnly_;
44  delete make2DHits_;
45 }
CSCHitFromWireOnly * hitsFromWireOnly_
CSCHitFromStripOnly * hitsFromStripOnly_
CSCMake2DRecHit * make2DHits_

Member Function Documentation

◆ build()

void CSCRecHitDBuilder::build ( const CSCStripDigiCollection stripds,
const CSCWireDigiCollection wireds,
CSCRecHit2DCollection oc 
)

Find digis in each CSCLayer, build strip and wire proto-hits in each layer from which pseudo-segments are build to select hits. Then, strip/wire hits are combined to form 2-D hits, whereas remaining "good" strip and wire only hits are also stored
into output collection.

Definition at line 47 of file CSCRecHitDBuilder.cc.

References relativeConstraints::chamber, CSCDetId::chamber(), CSCDetId::endcap(), makeMuonMisalignmentScenario::endcap, Exception, CSCRecoConditions::fillBadChannelWords(), geom_, getLayer(), CSCMake2DRecHit::hitFromStripAndWire(), hitsFromStripOnly_, hitsFromWireOnly_, l1ctLayer2EG_cff::id, CSCMake2DRecHit::isHitInFiducial(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, nano_mu_digi_cff::layer, CSCDetId::layer(), CSCRecHit2D::localPosition(), LogTrace, make2DHits_, recoConditions_, CSCDetId::ring(), CSCHitFromStripOnly::runStrip(), CSCHitFromWireOnly::runWire(), CSCDetId::station(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by CSCRecHitDProducer::produce().

49  {
50  LogTrace("CSCRecHitDBuilder") << "[CSCRecHitDBuilder] build entered";
51 
52  if (!geom_)
53  throw cms::Exception("MissingGeometry") << "[CSCRecHitDBuilder::getLayer] Missing geometry" << std::endl;
54 
55  // create 2-D hits by looking at superposition of strip and wire hit in a layer
56  //
57  // N.B. I've sorted the hits from layer 1-6 always, so can test if there are "holes",
58  // that is layers without hits for a given chamber.
59 
60  int layer_idx = 0;
61  CSCDetId old_id;
62 
63  for (CSCStripDigiCollection::DigiRangeIterator it = stripdc->begin(); it != stripdc->end(); ++it) {
64  const CSCDetId& id = (*it).first;
65  const CSCLayer* layer = getLayer(id);
66  const CSCStripDigiCollection::Range& rstripd = (*it).second;
67 
68  // Skip if no strip digis in this layer
69  if (rstripd.second == rstripd.first)
70  continue;
71 
72  const CSCDetId& sDetId = id;
73 
74  // This is used to test for gaps in layers and needs to be initialized here
75  if (layer_idx == 0) {
76  old_id = sDetId;
77  }
78 
79  CSCDetId compId = sDetId;
80  CSCWireDigiCollection::Range rwired = wiredc->get(sDetId);
81  // Skip if no wire digis in this layer
82  // But for ME11, real wire digis are labelled as belonging to ME1b, so that's where ME1a must look
83  // (We try ME1a - above - anyway, because simulated wire digis are labelled as ME1a.)
84  if (rwired.second == rwired.first) {
85  if (sDetId.station() != 1 || sDetId.ring() != 4) {
86  continue; // not ME1a, skip to next layer
87  }
88  // So if ME1a has no wire digis (always the case for data) make the
89  // wire digi ID point to ME1b. This is what is compared to the
90  // strip digi ID below (and not used anywhere else).
91  // Later, rechits use the strip digi ID for construction.
92 
93  // It is ME1a but no wire digis there, so try ME1b...
94  int endcap = sDetId.endcap();
95  int chamber = sDetId.chamber();
96  int layer = sDetId.layer();
97  CSCDetId idw(endcap, 1, 1, chamber, layer); // Set idw to same layer in ME1b
98  compId = idw;
99  rwired = wiredc->get(compId);
100  }
101 
102  // Fill bad channel bitsets for this layer
104 
105  // Build strip hits for this layer
106  std::vector<CSCStripHit> const& cscStripHit = hitsFromStripOnly_->runStrip(id, layer, rstripd);
107 
108  if (cscStripHit.empty())
109  continue;
110 
111  // now build collection of wire only hits !
112  std::vector<CSCWireHit> const& cscWireHit = hitsFromWireOnly_->runWire(compId, layer, rwired);
113 
114  // Build 2D hit for all possible strip-wire pairs
115  // overlapping within this layer
116 
117  LogTrace("CSCRecHitBuilder") << "[CSCRecHitDBuilder] found " << cscStripHit.size() << " strip and "
118  << cscWireHit.size() << " wire hits in layer " << sDetId;
119 
120  // Vector to store rechit within layer
121  std::vector<CSCRecHit2D> hitsInLayer;
122  unsigned int hits_in_layer = 0;
123 
124  for (auto const& s_hit : cscStripHit) {
125  for (auto const& w_hit : cscWireHit) {
126  CSCRecHit2D rechit = make2DHits_->hitFromStripAndWire(sDetId, layer, w_hit, s_hit);
127  // Store rechit as a Local Point:
128  LocalPoint rhitlocal = rechit.localPosition();
129  float yreco = rhitlocal.y();
130  bool isInFiducial = false;
131  //in me1/1 chambers the strip cut region is at local y = 30 cm, +-5 cm area around it proved to be a suitabla region for omiting the check
132  if ((sDetId.station() == 1) && (sDetId.ring() == 1 || sDetId.ring() == 4) && (fabs(yreco + 30.) < 5.)) {
133  isInFiducial = true;
134  } else {
135  isInFiducial = make2DHits_->isHitInFiducial(layer, rechit);
136  }
137  if (isInFiducial) {
138  hitsInLayer.push_back(rechit);
139  hits_in_layer++;
140  }
141  }
142  }
143 
144  LogTrace("CSCRecHitDBuilder") << "[CSCRecHitDBuilder] " << hits_in_layer << " rechits found in layer " << sDetId;
145 
146  // output vector of 2D rechits to collection
147  if (hits_in_layer > 0) {
148  oc.put(sDetId, hitsInLayer.begin(), hitsInLayer.end());
149  }
150  layer_idx++;
151  old_id = sDetId;
152  }
153 
154  LogTrace("CSCRecHitDBuilder") << "[CSCRecHitDBuilder] " << oc.size() << " 2d rechits created in this event.";
155 }
const CSCGeometry * geom_
std::vector< CSCStripHit > runStrip(const CSCDetId &id, const CSCLayer *layer, const CSCStripDigiCollection::Range &rstripd)
int layer() const
Definition: CSCDetId.h:56
const CSCLayer * getLayer(const CSCDetId &detId)
#define LogTrace(id)
T y() const
Definition: PV3DBase.h:60
void fillBadChannelWords(const CSCDetId &id)
fill bad strip & bad wiregroup bitsets from conditions data
CSCHitFromWireOnly * hitsFromWireOnly_
CSCRecoConditions * recoConditions_
int chamber() const
Definition: CSCDetId.h:62
bool isHitInFiducial(const CSCLayer *layer, const CSCRecHit2D &rh)
Test if rechit is in fiducial volume.
CSCHitFromStripOnly * hitsFromStripOnly_
LocalPoint localPosition() const override
Definition: CSCRecHit2D.h:56
int station() const
Definition: CSCDetId.h:79
std::vector< CSCWireHit > runWire(const CSCDetId &id, const CSCLayer *layer, const CSCWireDigiCollection::Range &rwired)
std::pair< const_iterator, const_iterator > Range
int endcap() const
Definition: CSCDetId.h:85
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.
CSCMake2DRecHit * make2DHits_
int ring() const
Definition: CSCDetId.h:68

◆ getLayer()

const CSCLayer * CSCRecHitDBuilder::getLayer ( const CSCDetId detId)

Definition at line 157 of file CSCRecHitDBuilder.cc.

References hcalRecHitTable_cff::detId, geom_, and CSCGeometry::layer().

Referenced by build().

157 { return geom_->layer(detId); }
const CSCGeometry * geom_
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
Definition: CSCGeometry.cc:105

◆ setConditions()

void CSCRecHitDBuilder::setConditions ( CSCRecoConditions reco)

Pass conditions downstream

Definition at line 159 of file CSCRecHitDBuilder.cc.

References hitsFromStripOnly_, hitsFromWireOnly_, make2DHits_, dt_dqm_sourceclient_common_cff::reco, recoConditions_, CSCHitFromStripOnly::setConditions(), CSCMake2DRecHit::setConditions(), and CSCHitFromWireOnly::setConditions().

Referenced by CSCRecHitDProducer::CSCRecHitDProducer().

159  {
164 }
void setConditions(const CSCRecoConditions *reco)
Pass pointer to conditions data onwards.
void setConditions(const CSCRecoConditions *reco)
CSCHitFromWireOnly * hitsFromWireOnly_
CSCRecoConditions * recoConditions_
CSCHitFromStripOnly * hitsFromStripOnly_
void setConditions(const CSCRecoConditions *reco)
CSCMake2DRecHit * make2DHits_
fixed size matrix

◆ setGeometry()

void CSCRecHitDBuilder::setGeometry ( const CSCGeometry geom)
inline

Cache pointer to geometry so it can be passed downstream

Definition at line 61 of file CSCRecHitDBuilder.h.

References relativeConstraints::geom, and geom_.

Referenced by CSCRecHitDProducer::produce().

Member Data Documentation

◆ geom_

const CSCGeometry* CSCRecHitDBuilder::geom_
private

Definition at line 88 of file CSCRecHitDBuilder.h.

Referenced by build(), getLayer(), and setGeometry().

◆ hitsFromStripOnly_

CSCHitFromStripOnly* CSCRecHitDBuilder::hitsFromStripOnly_
private

The Program first constructs proto wire/strip hits which it stores in a special collection. Proto strip/wire segments are then build from these hits and allow to clean up up the list of hits.

Definition at line 80 of file CSCRecHitDBuilder.h.

Referenced by build(), CSCRecHitDBuilder(), setConditions(), and ~CSCRecHitDBuilder().

◆ hitsFromWireOnly_

CSCHitFromWireOnly* CSCRecHitDBuilder::hitsFromWireOnly_
private

Definition at line 81 of file CSCRecHitDBuilder.h.

Referenced by build(), CSCRecHitDBuilder(), setConditions(), and ~CSCRecHitDBuilder().

◆ make2DHits_

CSCMake2DRecHit* CSCRecHitDBuilder::make2DHits_
private

Definition at line 83 of file CSCRecHitDBuilder.h.

Referenced by build(), CSCRecHitDBuilder(), setConditions(), and ~CSCRecHitDBuilder().

◆ makePseudo2DHits

bool CSCRecHitDBuilder::makePseudo2DHits
private

Definition at line 73 of file CSCRecHitDBuilder.h.

◆ recoConditions_

CSCRecoConditions* CSCRecHitDBuilder::recoConditions_
private

Definition at line 92 of file CSCRecHitDBuilder.h.

Referenced by build(), and setConditions().

◆ stripWireDeltaT

int CSCRecHitDBuilder::stripWireDeltaT
private

Definition at line 72 of file CSCRecHitDBuilder.h.

Referenced by CSCRecHitDBuilder().

◆ useCalib

bool CSCRecHitDBuilder::useCalib
private

Definition at line 71 of file CSCRecHitDBuilder.h.

Referenced by CSCRecHitDBuilder().