CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 (const CSCRecoConditions *reco)
 
void setGeometry (const CSCGeometry *geom)
 
 ~CSCRecHitDBuilder ()
 

Private Attributes

const CSCGeometrygeom_
 
CSCHitFromStripOnlyhitsFromStripOnly_
 
CSCHitFromWireOnlyhitsFromWireOnly_
 
CSCMake2DRecHitmake2DHits_
 
bool makePseudo2DHits
 
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 39 of file CSCRecHitDBuilder.h.

Constructor & Destructor Documentation

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_(0) {
31 
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 }
T getParameter(std::string const &) const
const CSCGeometry * geom_
CSCHitFromWireOnly * hitsFromWireOnly_
CSCHitFromStripOnly * hitsFromStripOnly_
CSCMake2DRecHit * make2DHits_
CSCRecHitDBuilder::~CSCRecHitDBuilder ( )

Definition at line 43 of file CSCRecHitDBuilder.cc.

References hitsFromStripOnly_, hitsFromWireOnly_, and make2DHits_.

43  {
44  delete hitsFromStripOnly_;
45  delete hitsFromWireOnly_;
46  delete make2DHits_;
47 }
CSCHitFromWireOnly * hitsFromWireOnly_
CSCHitFromStripOnly * hitsFromStripOnly_
CSCMake2DRecHit * make2DHits_

Member Function Documentation

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 50 of file CSCRecHitDBuilder.cc.

References CSCDetId::chamber(), CSCRangeMapForRecHit::cscDetLayer(), Reference_intrackfit_cff::endcap, CSCDetId::endcap(), getLayer(), CSCMake2DRecHit::hitFromStripAndWire(), hitsFromStripOnly_, hitsFromWireOnly_, i, CSCMake2DRecHit::isHitInFiducial(), j, CSCDetId::layer(), LogTrace, make2DHits_, CSCDetId::ring(), CSCHitFromStripOnly::runStrip(), CSCHitFromWireOnly::runWire(), and CSCDetId::station().

Referenced by CSCRecHitDProducer::produce().

51  {
52  LogTrace("CSCRecHit") << "CSCRecHitDBuilder: build entered";
53  // Clean hit collections sorted by layer
54  std::vector<CSCDetId> stripLayer;
55  std::vector<CSCDetId>::const_iterator sIt;
56  std::vector<CSCDetId> wireLayer;
57  std::vector<CSCDetId>::const_iterator wIt;
58 
59 
60  // Make collection of wire only hits !
61  CSCWireHitCollection clean_woc;
62 
63  for ( CSCWireDigiCollection::DigiRangeIterator it = wiredc->begin(); it != wiredc->end(); ++it ){
64  const CSCDetId& id = (*it).first;
65  const CSCLayer* layer = getLayer( id );
66  const CSCWireDigiCollection::Range rwired = wiredc->get( id );
67  // Skip if no wire digis in this layer
68  if ( rwired.second == rwired.first ) {
69  continue;
70  }
71 
72  std::vector<CSCWireHit> rhv = hitsFromWireOnly_->runWire( id, layer, rwired);
73 
74  if ( rhv.size() > 0 ) wireLayer.push_back( id );
75 
76  // Add the wire hits to master collection
77  clean_woc.put( id, rhv.begin(), rhv.end() );
78  }
79 
80  LogTrace("CSCRecHit") << "CSCRecHitDBuilder: wire hits created";
81 
82  // Make collection of strip only hits
83 
84  CSCStripHitCollection clean_soc;
85  for ( CSCStripDigiCollection::DigiRangeIterator it = stripdc->begin(); it != stripdc->end(); ++it ){
86  const CSCDetId& id = (*it).first;
87  const CSCLayer* layer = getLayer( id );
88  const CSCStripDigiCollection::Range& rstripd = (*it).second;
89 
90  // Skip if no strip digis in this layer
91  if ( rstripd.second == rstripd.first ) continue;
92 
93  std::vector<CSCStripHit> rhv = hitsFromStripOnly_->runStrip( id, layer, rstripd);
94 
95  if ( rhv.size() > 0 ) stripLayer.push_back( id );
96 
97  // Add the strip hits to master collection
98  clean_soc.put( id, rhv.begin(), rhv.end() );
99  }
100 
101  LogTrace("CSCRecHit") << "CSCRecHitDBuilder: strip hits created";
102 
103 
104  // Now create 2-D hits by looking at superposition of strip and wire hit in a layer
105  //
106  // N.B. I've sorted the hits from layer 1-6 always, so can test if there are "holes",
107  // that is layers without hits for a given chamber.
108 
109  // Vector to store rechit within layer
110  std::vector<CSCRecHit2D> hitsInLayer;
111 
112  int layer_idx = 0;
113  int hits_in_layer = 0;
114  CSCDetId old_id;
115 
116  // Now loop over each layer containing strip hits
117  for ( sIt=stripLayer.begin(); sIt != stripLayer.end(); ++sIt ) {
118 
119  bool foundMatch = false;
120  hitsInLayer.clear();
121  hits_in_layer = 0;
122 
123  std::vector<CSCStripHit> cscStripHit;
124 
126  CSCStripHitCollection::range range = clean_soc.get(acc.cscDetLayer(*sIt));
127 
128  // Create vector of strip hits for this layer
129  for ( CSCStripHitCollection::const_iterator clean_soc = range.first; clean_soc != range.second; ++clean_soc)
130  cscStripHit.push_back(*clean_soc);
131 
132  const CSCDetId& sDetId = (*sIt);
133  const CSCLayer* layer = getLayer( sDetId );
134 
135  // This is used to test for gaps in layers and needs to be initialized here
136  if ( layer_idx == 0 ) {
137  old_id = sDetId;
138  }
139 
140  CSCDetId compId = sDetId;
141  CSCWireDigiCollection::Range rwired = wiredc->get( sDetId );
142  // Skip if no wire digis in this layer
143  // But for ME11, real wire digis are labelled as belonging to
144  //ME1b, so that's where ME1a must look
145  // (We try ME1a - above - anyway, because simulated wire digis are labelled as ME1a.)
146  if ( rwired.second == rwired.first ) {
147  if ( sDetId.station()!=1 || sDetId.ring()!=4 ){
148  continue; // not ME1a, skip to next layer
149  }
150  // So if ME1a has no wire digis (always the case for data) make the
151  // wire digi ID pointing to ME1b. This is what is compared to the
152  // strip digi ID below (and not used anywhere else). Later, rechits use
153  // the strip digi ID for construction,
154 
155  // It is ME1a but no wire digis there, so try ME1b...
156  int endcap = sDetId.endcap();
157  int chamber = sDetId.chamber();
158  int layer = sDetId.layer();
159  CSCDetId idw( endcap, 1, 1, chamber, layer ); // Set idw to same layer in ME1b
160  compId = idw;
161  }
162 
163  // Now loop over wire hits
164  for ( wIt=wireLayer.begin(); wIt != wireLayer.end(); ++wIt ) {
165 
166  const CSCDetId& wDetId = (*wIt);
167 
168  // Because of ME1a, use the compId to make a comparison between strip and wire hit CSCDetId
169  if ((wDetId.endcap() == compId.endcap() ) &&
170  (wDetId.station() == compId.station()) &&
171  (wDetId.ring() == compId.ring() ) &&
172  (wDetId.chamber() == compId.chamber()) &&
173  (wDetId.layer() == compId.layer() )) {
174 
175  // Create vector of wire hits for this layer
176  std::vector<CSCWireHit> cscWireHit;
177 
179  CSCWireHitCollection::range range = clean_woc.get(acc2.cscDetLayer(*wIt));
180 
181  for ( CSCWireHitCollection::const_iterator clean_woc = range.first; clean_woc != range.second; ++clean_woc)
182  cscWireHit.push_back(*clean_woc);
183 
184  // Build 2D hit for all possible strip-wire pairs
185  // overlapping within this layer
186 
187  LogTrace("CSCRecHit")<< "CSCRecHitDBuilder: found " << cscStripHit.size() << " strip and "
188  << cscWireHit.size() << " wire hits in layer " << sDetId;
189 
190  for (unsigned i = 0; i != cscStripHit.size(); ++i ) {
191  const CSCStripHit s_hit = cscStripHit[i];
192  for (unsigned j = 0; j != cscWireHit.size(); ++j ) {
193  const CSCWireHit w_hit = cscWireHit[j];
194  CSCRecHit2D rechit = make2DHits_->hitFromStripAndWire(sDetId, layer, w_hit, s_hit);
195  bool isInFiducial = make2DHits_->isHitInFiducial( layer, rechit );
196  if ( isInFiducial ) {
197  foundMatch = true;
198  hitsInLayer.push_back( rechit );
199  hits_in_layer++;
200  }
201  }
202  }
203  }
204  }
205 
206  LogTrace("CSCRecHit") << "CSCRecHitDBuilder: " << hits_in_layer << " rechits found in layer " << sDetId;
207 
208  // output vector of 2D rechits to collection
209  if (hits_in_layer > 0) {
210  oc.put( sDetId, hitsInLayer.begin(), hitsInLayer.end() );
211  hitsInLayer.clear();
212  }
213  hits_in_layer = 0;
214  layer_idx++;
215  old_id = sDetId;
216  }
217 
218  LogTrace("CSCRecHit|CSCOutput") << "CSCRecHitDBuilder: " << oc.size() << " 2d rechits created in this event.";
219 
220 }
int chamber() const
Definition: CSCDetId.h:70
int i
Definition: DBlmapReader.cc:9
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:53
std::vector< CSCStripHit > runStrip(const CSCDetId &id, const CSCLayer *layer, const CSCStripDigiCollection::Range &rstripd)
int layer() const
Definition: CSCDetId.h:63
const CSCLayer * getLayer(const CSCDetId &detId)
int endcap() const
Definition: CSCDetId.h:95
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:46
CSCHitFromWireOnly * hitsFromWireOnly_
int j
Definition: DBlmapReader.cc:9
bool isHitInFiducial(const CSCLayer *layer, const CSCRecHit2D &rh)
Test if rechit is in fiducial volume.
#define LogTrace(id)
static std::pair< CSCDetId, CSCDetIdSameDetLayerCompare > cscDetLayer(CSCDetId id)
CSCHitFromStripOnly * hitsFromStripOnly_
int ring() const
Definition: CSCDetId.h:77
std::vector< CSCWireHit > runWire(const CSCDetId &id, const CSCLayer *layer, const CSCWireDigiCollection::Range &rwired)
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 station() const
Definition: CSCDetId.h:88
std::pair< const_iterator, const_iterator > Range
const CSCLayer * CSCRecHitDBuilder::getLayer ( const CSCDetId detId)

Definition at line 223 of file CSCRecHitDBuilder.cc.

References edm::hlt::Exception, geom_, and CSCGeometry::layer().

Referenced by build().

223  {
224  if ( !geom_ ) throw cms::Exception("MissingGeometry") << "[CSCRecHitDBuilder::getLayer] Missing geometry" << std::endl;
225  return geom_->layer(detId);
226 }
const CSCGeometry * geom_
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
Definition: CSCGeometry.cc:123
void CSCRecHitDBuilder::setConditions ( const CSCRecoConditions reco)

Pass conditions downstream

Definition at line 229 of file CSCRecHitDBuilder.cc.

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

Referenced by CSCRecHitDProducer::CSCRecHitDProducer().

229  {
232  make2DHits_->setConditions( reco );
233 }
void setConditions(const CSCRecoConditions *reco)
Pass pointer to conditions data onwards.
void setConditions(const CSCRecoConditions *reco)
CSCHitFromWireOnly * hitsFromWireOnly_
CSCHitFromStripOnly * hitsFromStripOnly_
void setConditions(const CSCRecoConditions *reco)
CSCMake2DRecHit * make2DHits_
void CSCRecHitDBuilder::setGeometry ( const CSCGeometry geom)
inline

Cache pointer to geometry so it can be passed downstream

Definition at line 65 of file CSCRecHitDBuilder.h.

References relativeConstraints::geom, and geom_.

Referenced by CSCRecHitDProducer::produce().

65 {geom_ = geom;}
const CSCGeometry * geom_

Member Data Documentation

const CSCGeometry* CSCRecHitDBuilder::geom_
private

Definition at line 94 of file CSCRecHitDBuilder.h.

Referenced by getLayer(), and setGeometry().

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 86 of file CSCRecHitDBuilder.h.

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

CSCHitFromWireOnly* CSCRecHitDBuilder::hitsFromWireOnly_
private

Definition at line 87 of file CSCRecHitDBuilder.h.

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

CSCMake2DRecHit* CSCRecHitDBuilder::make2DHits_
private

Definition at line 89 of file CSCRecHitDBuilder.h.

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

bool CSCRecHitDBuilder::makePseudo2DHits
private

Definition at line 79 of file CSCRecHitDBuilder.h.

int CSCRecHitDBuilder::stripWireDeltaT
private

Definition at line 78 of file CSCRecHitDBuilder.h.

Referenced by CSCRecHitDBuilder().

bool CSCRecHitDBuilder::useCalib
private

Definition at line 77 of file CSCRecHitDBuilder.h.

Referenced by CSCRecHitDBuilder().