CMS 3D CMS Logo

CSCRecHitDBuilder.cc
Go to the documentation of this file.
1 // This is CSCRecHitDBuilder.cc
2 
10 
15 
17 
24 
27 
28 #include <iostream>
29 #include <cassert>
30 
32  // Receives ParameterSet percolated down from EDProducer
33 
34  useCalib = ps.getParameter<bool>("CSCUseCalibrations");
35  stripWireDeltaT = ps.getParameter<int>("CSCstripWireDeltaTime");
36 
39  make2DHits_ = new CSCMake2DRecHit(ps);
40 }
41 
43  delete hitsFromStripOnly_;
44  delete hitsFromWireOnly_;
45  delete make2DHits_;
46 }
47 
49  const CSCWireDigiCollection* wiredc,
51  LogTrace("CSCRecHitDBuilder") << "[CSCRecHitDBuilder] build entered";
52 
53  if (!geom_)
54  throw cms::Exception("MissingGeometry") << "[CSCRecHitDBuilder::getLayer] Missing geometry" << std::endl;
55 
56  // create 2-D hits by looking at superposition of strip and wire hit in a layer
57  //
58  // N.B. I've sorted the hits from layer 1-6 always, so can test if there are "holes",
59  // that is layers without hits for a given chamber.
60 
61  int layer_idx = 0;
62  CSCDetId old_id;
63 
64  for (CSCStripDigiCollection::DigiRangeIterator it = stripdc->begin(); it != stripdc->end(); ++it) {
65  const CSCDetId& id = (*it).first;
66  const CSCLayer* layer = getLayer(id);
67  const CSCStripDigiCollection::Range& rstripd = (*it).second;
68 
69  // Skip if no strip digis in this layer
70  if (rstripd.second == rstripd.first)
71  continue;
72 
73  const CSCDetId& sDetId = id;
74 
75  // This is used to test for gaps in layers and needs to be initialized here
76  if (layer_idx == 0) {
77  old_id = sDetId;
78  }
79 
80  CSCDetId compId = sDetId;
81  CSCWireDigiCollection::Range rwired = wiredc->get(sDetId);
82  // Skip if no wire digis in this layer
83  // But for ME11, real wire digis are labelled as belonging to ME1b, so that's where ME1a must look
84  // (We try ME1a - above - anyway, because simulated wire digis are labelled as ME1a.)
85  if (rwired.second == rwired.first) {
86  if (sDetId.station() != 1 || sDetId.ring() != 4) {
87  continue; // not ME1a, skip to next layer
88  }
89  // So if ME1a has no wire digis (always the case for data) make the
90  // wire digi ID point to ME1b. This is what is compared to the
91  // strip digi ID below (and not used anywhere else).
92  // Later, rechits use the strip digi ID for construction.
93 
94  // It is ME1a but no wire digis there, so try ME1b...
95  int endcap = sDetId.endcap();
96  int chamber = sDetId.chamber();
97  int layer = sDetId.layer();
98  CSCDetId idw(endcap, 1, 1, chamber, layer); // Set idw to same layer in ME1b
99  compId = idw;
100  rwired = wiredc->get(compId);
101  }
102 
103  // Fill bad channel bitsets for this layer
105 
106  // Build strip hits for this layer
107  std::vector<CSCStripHit> const& cscStripHit = hitsFromStripOnly_->runStrip(id, layer, rstripd);
108 
109  if (cscStripHit.empty())
110  continue;
111 
112  // now build collection of wire only hits !
113  std::vector<CSCWireHit> const& cscWireHit = hitsFromWireOnly_->runWire(compId, layer, rwired);
114 
115  // Build 2D hit for all possible strip-wire pairs
116  // overlapping within this layer
117 
118  LogTrace("CSCRecHitBuilder") << "[CSCRecHitDBuilder] found " << cscStripHit.size() << " strip and "
119  << cscWireHit.size() << " wire hits in layer " << sDetId;
120 
121  // Vector to store rechit within layer
122  std::vector<CSCRecHit2D> hitsInLayer;
123  unsigned int hits_in_layer = 0;
124 
125  for (auto const& s_hit : cscStripHit) {
126  for (auto const& w_hit : cscWireHit) {
127  CSCRecHit2D rechit = make2DHits_->hitFromStripAndWire(sDetId, layer, w_hit, s_hit);
128  // Store rechit as a Local Point:
129  LocalPoint rhitlocal = rechit.localPosition();
130  float yreco = rhitlocal.y();
131  bool isInFiducial = false;
132  //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
133  if ((sDetId.station() == 1) && (sDetId.ring() == 1 || sDetId.ring() == 4) && (fabs(yreco + 30.) < 5.)) {
134  isInFiducial = true;
135  } else {
136  isInFiducial = make2DHits_->isHitInFiducial(layer, rechit);
137  }
138  if (isInFiducial) {
139  hitsInLayer.push_back(rechit);
140  hits_in_layer++;
141  }
142  }
143  }
144 
145  LogTrace("CSCRecHitDBuilder") << "[CSCRecHitDBuilder] " << hits_in_layer << " rechits found in layer " << sDetId;
146 
147  // output vector of 2D rechits to collection
148  if (hits_in_layer > 0) {
149  oc.put(sDetId, hitsInLayer.begin(), hitsInLayer.end());
150  }
151  layer_idx++;
152  old_id = sDetId;
153  }
154 
155  LogTrace("CSCRecHitDBuilder") << "[CSCRecHitDBuilder] " << oc.size() << " 2d rechits created in this event.";
156 }
157 
158 const CSCLayer* CSCRecHitDBuilder::getLayer(const CSCDetId& detId) { return geom_->layer(detId); }
159 
165 }
CSCRecHit2DCollection
MessageLogger.h
CSCHitFromStripOnly.h
CSCDetId::ring
int ring() const
Definition: CSCDetId.h:68
CSCRecHitDBuilder::setConditions
void setConditions(CSCRecoConditions *reco)
Definition: CSCRecHitDBuilder.cc:160
CSCStripDigiCollection
CSCStripHitCollection.h
CSCRecHitDBuilder::stripWireDeltaT
int stripWireDeltaT
Definition: CSCRecHitDBuilder.h:72
CSCRecHitDBuilder::getLayer
const CSCLayer * getLayer(const CSCDetId &detId)
Definition: CSCRecHitDBuilder.cc:158
CSCDBCrosstalk.h
CSCLayer
Definition: CSCLayer.h:24
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
CSCRecHitDBuilder::geom_
const CSCGeometry * geom_
Definition: CSCRecHitDBuilder.h:88
CSCRangeMapForRecHit.h
CSCMake2DRecHit
Definition: CSCMake2DRecHit.h:30
CSCDetId.h
CSCHitFromStripOnly::runStrip
std::vector< CSCStripHit > runStrip(const CSCDetId &id, const CSCLayer *layer, const CSCStripDigiCollection::Range &rstripd)
Definition: CSCHitFromStripOnly.cc:54
CSCHitFromWireOnly::runWire
std::vector< CSCWireHit > runWire(const CSCDetId &id, const CSCLayer *layer, const CSCWireDigiCollection::Range &rwired)
Definition: CSCHitFromWireOnly.cc:31
CSCDBNoiseMatrixRcd.h
CSCDetId::layer
int layer() const
Definition: CSCDetId.h:56
CSCRecHitDBuilder::build
void build(const CSCStripDigiCollection *stripds, const CSCWireDigiCollection *wireds, CSCRecHit2DCollection &oc)
Definition: CSCRecHitDBuilder.cc:48
CSCRecHitDBuilder::hitsFromWireOnly_
CSCHitFromWireOnly * hitsFromWireOnly_
Definition: CSCRecHitDBuilder.h:81
CSCLayerGeometry.h
CSCHitFromWireOnly.h
Point3DBase< float, LocalTag >
CSCWireHitCollection.h
CSCHitFromWireOnly
Definition: CSCHitFromWireOnly.h:36
edm::ParameterSet
Definition: ParameterSet.h:47
CSCRecHit2D
Definition: CSCRecHit2D.h:18
CSCRecHitDBuilder::CSCRecHitDBuilder
CSCRecHitDBuilder(const edm::ParameterSet &ps)
Definition: CSCRecHitDBuilder.cc:31
CSCRecHit2D::localPosition
LocalPoint localPosition() const override
Definition: CSCRecHit2D.h:56
CSCDetId
Definition: CSCDetId.h:26
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
CSCRecoConditions::fillBadChannelWords
void fillBadChannelWords(const CSCDetId &id)
fill bad strip & bad wiregroup bitsets from conditions data
Definition: CSCRecoConditions.cc:13
CSCDBNoiseMatrix.h
CSCDetId::chamber
int chamber() const
Definition: CSCDetId.h:62
CSCRecHitDBuilder::recoConditions_
CSCRecoConditions * recoConditions_
Definition: CSCRecHitDBuilder.h:92
CSCHitFromWireOnly::setConditions
void setConditions(const CSCRecoConditions *reco)
Definition: CSCHitFromWireOnly.h:47
CSCMake2DRecHit::isHitInFiducial
bool isHitInFiducial(const CSCLayer *layer, const CSCRecHit2D &rh)
Test if rechit is in fiducial volume.
Definition: CSCMake2DRecHit.cc:279
CSCDBCrosstalkRcd.h
CSCHitFromStripOnly::setConditions
void setConditions(const CSCRecoConditions *reco)
Definition: CSCHitFromStripOnly.h:46
CSCRecHitDBuilder::useCalib
bool useCalib
Definition: CSCRecHitDBuilder.h:71
CSCWireDigiCollection
CSCGeometry::layer
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
Definition: CSCGeometry.cc:105
CSCRecHitDBuilder.h
CSCLayer.h
CSCRecoConditions
Definition: CSCRecoConditions.h:25
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
CSCRecHitDBuilder::hitsFromStripOnly_
CSCHitFromStripOnly * hitsFromStripOnly_
Definition: CSCRecHitDBuilder.h:80
CSCDetId::endcap
int endcap() const
Definition: CSCDetId.h:85
dt_dqm_sourceclient_common_cff.reco
reco
Definition: dt_dqm_sourceclient_common_cff.py:110
CSCDBGainsRcd.h
Exception
Definition: hltDiff.cc:246
CSCRecHitDBuilder::~CSCRecHitDBuilder
~CSCRecHitDBuilder()
Definition: CSCRecHitDBuilder.cc:42
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
MuonDigiCollection::Range
std::pair< const_iterator, const_iterator > Range
Definition: MuonDigiCollection.h:95
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Exception.h
CSCMake2DRecHit::hitFromStripAndWire
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.
Definition: CSCMake2DRecHit.cc:35
CSCDBGains.h
CSCChamberSpecs.h
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
CSCDetId::station
int station() const
Definition: CSCDetId.h:79
CSCHitFromStripOnly
Definition: CSCHitFromStripOnly.h:34
DigiContainerIterator
Definition: MuonDigiCollection.h:30
CSCRecHitDBuilder::make2DHits_
CSCMake2DRecHit * make2DHits_
Definition: CSCRecHitDBuilder.h:83
CSCMake2DRecHit.h
CSCGeometry.h
CSCMake2DRecHit::setConditions
void setConditions(const CSCRecoConditions *reco)
Pass pointer to conditions data onwards.
Definition: CSCMake2DRecHit.cc:294