CMS 3D CMS Logo

Public Member Functions | Private Attributes

CSCRecHitDBuilder Class Reference

#include <CSCRecHitDBuilder.h>

List of all members.

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.

                                                                : geom_(0) {
  
  // Receives ParameterSet percolated down from EDProducer      

  useCalib               = ps.getParameter<bool>("CSCUseCalibrations");  
  stripWireDeltaT        = ps.getParameter<int>("CSCstripWireDeltaTime");
  
  hitsFromStripOnly_     = new CSCHitFromStripOnly( ps ); 
  hitsFromWireOnly_      = new CSCHitFromWireOnly( ps );  
  make2DHits_            = new CSCMake2DRecHit( ps );
}
CSCRecHitDBuilder::~CSCRecHitDBuilder ( )

Definition at line 43 of file CSCRecHitDBuilder.cc.

References hitsFromStripOnly_, hitsFromWireOnly_, and make2DHits_.

                                      {
  delete hitsFromStripOnly_;
  delete hitsFromWireOnly_;
  delete 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().

                                                           {
  LogTrace("CSCRecHit") << "CSCRecHitDBuilder: build entered";
  // Clean hit collections sorted by layer    
  std::vector<CSCDetId> stripLayer;
  std::vector<CSCDetId>::const_iterator sIt;
  std::vector<CSCDetId> wireLayer;
  std::vector<CSCDetId>::const_iterator wIt;

  
  // Make collection of wire only hits !  
  CSCWireHitCollection clean_woc;
  
  for ( CSCWireDigiCollection::DigiRangeIterator it = wiredc->begin(); it != wiredc->end(); ++it ){
    const CSCDetId& id = (*it).first;
    const CSCLayer* layer = getLayer( id );
    const CSCWireDigiCollection::Range rwired = wiredc->get( id );
    // Skip if no wire digis in this layer
    if ( rwired.second == rwired.first ) {
            continue; 
    }
          
    std::vector<CSCWireHit> rhv = hitsFromWireOnly_->runWire( id, layer, rwired);

    if ( rhv.size() > 0 ) wireLayer.push_back( id );
    
    // Add the wire hits to master collection
    clean_woc.put( id, rhv.begin(), rhv.end() );
  }

  LogTrace("CSCRecHit") << "CSCRecHitDBuilder: wire hits created";

  // Make collection of strip only hits
  
  CSCStripHitCollection clean_soc;  
  for ( CSCStripDigiCollection::DigiRangeIterator it = stripdc->begin(); it != stripdc->end(); ++it ){
    const CSCDetId& id = (*it).first;
    const CSCLayer* layer = getLayer( id );
    const CSCStripDigiCollection::Range& rstripd = (*it).second;
    
    // Skip if no strip digis in this layer
    if ( rstripd.second == rstripd.first ) continue;
    
    std::vector<CSCStripHit> rhv = hitsFromStripOnly_->runStrip( id, layer, rstripd);

    if ( rhv.size() > 0 ) stripLayer.push_back( id );
    
    // Add the strip hits to master collection
    clean_soc.put( id, rhv.begin(), rhv.end() );
  }

  LogTrace("CSCRecHit") << "CSCRecHitDBuilder: strip hits created";


  // Now create 2-D hits by looking at superposition of strip and wire hit in a layer
  //
  // N.B.  I've sorted the hits from layer 1-6 always, so can test if there are "holes", 
  // that is layers without hits for a given chamber.

  // Vector to store rechit within layer
  std::vector<CSCRecHit2D> hitsInLayer;

  int layer_idx     = 0;
  int hits_in_layer = 0;
  CSCDetId old_id; 

  // Now loop over each layer containing strip hits
  for ( sIt=stripLayer.begin(); sIt != stripLayer.end(); ++sIt ) {

    bool foundMatch = false;
    hitsInLayer.clear();
    hits_in_layer = 0;
   
    std::vector<CSCStripHit> cscStripHit;
    
    CSCRangeMapForRecHit acc;
    CSCStripHitCollection::range range = clean_soc.get(acc.cscDetLayer(*sIt));

    // Create vector of strip hits for this layer    
    for ( CSCStripHitCollection::const_iterator clean_soc = range.first; clean_soc != range.second; ++clean_soc)
      cscStripHit.push_back(*clean_soc);

    const CSCDetId& sDetId = (*sIt);
    const CSCLayer* layer  = getLayer( sDetId );

    // This is used to test for gaps in layers and needs to be initialized here 
    if ( layer_idx == 0 ) {
      old_id = sDetId;
    }

    CSCDetId compId = sDetId;
    CSCWireDigiCollection::Range rwired = wiredc->get( sDetId );
    // Skip if no wire digis in this layer
    // But for ME11, real wire digis are labelled as belonging to
    //ME1b, so that's where ME1a must look
    // (We try ME1a - above - anyway, because simulated wire digis are labelled as ME1a.)
    if ( rwired.second == rwired.first ) {
      if ( sDetId.station()!=1 || sDetId.ring()!=4 ){
        continue; // not ME1a, skip to next layer
      }
      // So if ME1a has no wire digis (always the case for data) make the
      // wire digi ID pointing to ME1b. This is what is compared to the
      // strip digi ID below (and not used anywhere else). Later, rechits use 
      // the strip digi ID for construction,  
   
      // It is ME1a but no wire digis there, so try ME1b...
      int endcap  = sDetId.endcap();
      int chamber = sDetId.chamber();
      int layer   = sDetId.layer();
      CSCDetId idw( endcap, 1, 1, chamber, layer ); // Set idw to same layer in ME1b
      compId = idw;
    }
    
    // Now loop over wire hits
    for ( wIt=wireLayer.begin(); wIt != wireLayer.end(); ++wIt ) {
        
      const CSCDetId& wDetId  = (*wIt);
        
      // Because of ME1a, use the compId to make a comparison between strip and wire hit CSCDetId
      if ((wDetId.endcap()  == compId.endcap() ) &&
          (wDetId.station() == compId.station()) &&
          (wDetId.ring()    == compId.ring()   ) &&
          (wDetId.chamber() == compId.chamber()) &&
          (wDetId.layer()   == compId.layer()  )) {
          
        // Create vector of wire hits for this layer
        std::vector<CSCWireHit> cscWireHit;
       
        CSCRangeMapForRecHit acc2;
        CSCWireHitCollection::range range = clean_woc.get(acc2.cscDetLayer(*wIt));
      
        for ( CSCWireHitCollection::const_iterator clean_woc = range.first; clean_woc != range.second; ++clean_woc)
          cscWireHit.push_back(*clean_woc);

        // Build 2D hit for all possible strip-wire pairs 
        // overlapping within this layer

        LogTrace("CSCRecHit")<< "CSCRecHitDBuilder: found " << cscStripHit.size() << " strip and " 
                             << cscWireHit.size()  << " wire hits in layer " << sDetId;

        for (unsigned i = 0; i != cscStripHit.size(); ++i ) {
          const CSCStripHit s_hit = cscStripHit[i];
          for (unsigned j = 0; j != cscWireHit.size(); ++j ) {
            const CSCWireHit w_hit = cscWireHit[j];
            CSCRecHit2D rechit = make2DHits_->hitFromStripAndWire(sDetId, layer, w_hit, s_hit);
            bool isInFiducial = make2DHits_->isHitInFiducial( layer, rechit );
            if ( isInFiducial ) {
              foundMatch = true;  
              hitsInLayer.push_back( rechit );
              hits_in_layer++;
            }
          }
        }
      }
    }

    LogTrace("CSCRecHit") << "CSCRecHitDBuilder: " << hits_in_layer << " rechits found in layer " << sDetId;

    // output vector of 2D rechits to collection
    if (hits_in_layer > 0) {
      oc.put( sDetId, hitsInLayer.begin(), hitsInLayer.end() );
      hitsInLayer.clear();
    }
    hits_in_layer = 0;
    layer_idx++;
    old_id = sDetId;
  }

  LogTrace("CSCRecHit|CSCOutput") << "CSCRecHitDBuilder: " << oc.size() << " 2d rechits created in this event.";

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

Definition at line 223 of file CSCRecHitDBuilder.cc.

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

Referenced by build().

                                                                    {
  if ( !geom_ ) throw cms::Exception("MissingGeometry") << "[CSCRecHitDBuilder::getLayer] Missing geometry" << std::endl;
  return geom_->layer(detId);
}
void CSCRecHitDBuilder::setConditions ( const CSCRecoConditions reco)
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().

{geom_ = geom;}

Member Data Documentation

Definition at line 94 of file CSCRecHitDBuilder.h.

Referenced by getLayer(), and setGeometry().

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().

Definition at line 87 of file CSCRecHitDBuilder.h.

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

Definition at line 89 of file CSCRecHitDBuilder.h.

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

Definition at line 79 of file CSCRecHitDBuilder.h.

Definition at line 78 of file CSCRecHitDBuilder.h.

Referenced by CSCRecHitDBuilder().

Definition at line 77 of file CSCRecHitDBuilder.h.

Referenced by CSCRecHitDBuilder().