CMS 3D CMS Logo

CSCRecHitDBuilder Class Reference

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

#include <RecoLocalMuon/CSCRecHitD/src/CSCRecHitDBuilder.h>

List of all members.

Public Member Functions

void 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.
 CSCRecHitDBuilder (const edm::ParameterSet &ps)
 Configure the algorithm via ctor.
const CSCLayergetLayer (const CSCDetId &detId)
void setConditions (const CSCRecoConditions *reco)
 Pass conditions downstream.
void setGeometry (const CSCGeometry *geom)
 Cache pointer to geometry so it can be passed downstream.
 ~CSCRecHitDBuilder ()

Private Attributes

const CSCGeometrygeom_
CSCHitFromStripOnlyhitsFromStripOnly_
 The Program first constructs proto wire/strip hits which it stores in a special collection.
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 41 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 35 of file CSCRecHitDBuilder.cc.

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

00035                                                                 : geom_(0) {
00036   
00037   // Receives ParameterSet percolated down from EDProducer      
00038 
00039 
00040   useCalib               = ps.getUntrackedParameter<bool>("CSCUseCalibrations");  
00041   stripWireDeltaT        = ps.getUntrackedParameter<int>("CSCstripWireDeltaTime");
00042   
00043   hitsFromStripOnly_     = new CSCHitFromStripOnly( ps ); 
00044   hitsFromWireOnly_      = new CSCHitFromWireOnly( ps );  
00045   //hitsFromWireSegments_  = new CSCWireSegments( ps );
00046   //hitsFromStripSegments_ = new CSCStripSegments( ps );
00047   make2DHits_            = new CSCMake2DRecHit( ps );
00048 }

CSCRecHitDBuilder::~CSCRecHitDBuilder (  ) 

Definition at line 53 of file CSCRecHitDBuilder.cc.

References hitsFromStripOnly_, hitsFromWireOnly_, and make2DHits_.

00053                                       {
00054   delete hitsFromStripOnly_;
00055   delete hitsFromWireOnly_;
00056   //delete hitsFromWireSegments_;
00057   //delete hitsFromStripSegments_;
00058   delete make2DHits_;   
00059 }


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

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

Referenced by CSCRecHitDProducer::produce().

00066                                                            {
00067 
00068   // Clean hit collections sorted by layer    
00069   std::vector<CSCDetId> stripLayer;
00070   std::vector<CSCDetId>::const_iterator sIt;
00071   std::vector<CSCDetId> wireLayer;
00072   std::vector<CSCDetId>::const_iterator wIt;
00073 
00074   
00075   // Make collection of wire only hits !  
00076   CSCWireHitCollection clean_woc;
00077   
00078   for ( CSCWireDigiCollection::DigiRangeIterator it = wiredc->begin(); it != wiredc->end(); ++it ){
00079     const CSCDetId& id = (*it).first;
00080     const CSCLayer* layer = getLayer( id );
00081     const CSCWireDigiCollection::Range rwired = wiredc->get( id );
00082     // Skip if no wire digis in this layer
00083     if ( rwired.second == rwired.first ) {
00084         continue; 
00085     }
00086           
00087     std::vector<CSCWireHit> rhv = hitsFromWireOnly_->runWire( id, layer, rwired);
00088 
00089     if ( rhv.size() > 0 ) wireLayer.push_back( id );
00090     
00091     // Add the wire hits to master collection
00092     clean_woc.put( id, rhv.begin(), rhv.end() );
00093   }
00094 
00095   LogTrace("CSCRecHit") << "Done producing wire hits " << "\n";
00096 
00097   // Make collection of strip only hits
00098   
00099   CSCStripHitCollection clean_soc;  
00100   for ( CSCStripDigiCollection::DigiRangeIterator it = stripdc->begin(); it != stripdc->end(); ++it ){
00101     const CSCDetId& id = (*it).first;
00102     const CSCLayer* layer = getLayer( id );
00103     const CSCStripDigiCollection::Range& rstripd = (*it).second;
00104     
00105     // Skip if no strip digis in this layer
00106     if ( rstripd.second == rstripd.first ) continue;
00107     
00108     std::vector<CSCStripHit> rhv = hitsFromStripOnly_->runStrip( id, layer, rstripd);
00109 
00110     if ( rhv.size() > 0 ) stripLayer.push_back( id );
00111     
00112     // Add the strip hits to master collection
00113     clean_soc.put( id, rhv.begin(), rhv.end() );
00114   }
00115 
00116   LogTrace("CSCRecHit") << "Done producing strip hits " << "\n";
00117 
00118 
00119   // Now create 2-D hits by looking at superposition of strip and wire hit in a layer
00120   //
00121   // N.B.  I've sorted the hits from layer 1-6 always, so can test if there are "holes", 
00122   // that is layers without hits for a given chamber.
00123 
00124   // Vector to store rechit within layer
00125   std::vector<CSCRecHit2D> hitsInLayer;
00126 
00127   int layer_idx     = 0;
00128   int hits_in_layer = 0;
00129   CSCDetId old_id; 
00130 
00131   // Now loop over each layer containing strip hits
00132   for ( sIt=stripLayer.begin(); sIt != stripLayer.end(); ++sIt ) {
00133 
00134     bool foundMatch = false;
00135     hitsInLayer.clear();
00136     hits_in_layer = 0;
00137    
00138     std::vector<CSCStripHit> cscStripHit;
00139     
00140     CSCRangeMapForRecHit acc;
00141     CSCStripHitCollection::range range = clean_soc.get(acc.cscDetLayer(*sIt));
00142 
00143     // Create vector of strip hits for this layer    
00144     for ( CSCStripHitCollection::const_iterator clean_soc = range.first; clean_soc != range.second; ++clean_soc)
00145       cscStripHit.push_back(*clean_soc);
00146 
00147     const CSCDetId& sDetId = (*sIt);
00148     const CSCLayer* layer  = getLayer( sDetId );
00149 
00150     // This is used to test for gaps in layers and needs to be initialized here 
00151     if ( layer_idx == 0 ) {
00152       old_id = sDetId;
00153     }
00154 
00155     CSCDetId compId = sDetId;
00156     CSCWireDigiCollection::Range rwired = wiredc->get( sDetId );
00157     // Skip if no wire digis in this layer
00158     // But for ME11, real wire digis are labelled as belonging to
00159     //ME1b, so that's where ME1a must look
00160     // (We try ME1a - above - anyway, because simulated wire digis are labelled as ME1a.)
00161     if ( rwired.second == rwired.first ) {
00162       if ( sDetId.station()!=1 || sDetId.ring()!=4 ){
00163         continue; // not ME1a, skip to next layer
00164       }
00165       // So if ME1a has no wire digis (always the case for data) make the
00166       // wire digi ID pointing to ME1b. This is what is compared to the
00167       // strip digi ID below (and not used anywhere else). Later, rechits use 
00168       // the strip digi ID for construction,  
00169    
00170       // It is ME1a but no wire digis there, so try ME1b...
00171       int endcap  = sDetId.endcap();
00172       int chamber = sDetId.chamber();
00173       int layer   = sDetId.layer();
00174       CSCDetId idw( endcap, 1, 1, chamber, layer ); // Set idw to same layer in ME1b
00175       compId = idw;
00176     }
00177     
00178     // Now loop over wire hits
00179     for ( wIt=wireLayer.begin(); wIt != wireLayer.end(); ++wIt ) {
00180         
00181       const CSCDetId& wDetId  = (*wIt);
00182         
00183       // Because of ME1a, use the compId to make a comparison between strip and wire hit CSCDetId
00184       if ((wDetId.endcap()  == compId.endcap() ) &&
00185           (wDetId.station() == compId.station()) &&
00186           (wDetId.ring()    == compId.ring()   ) &&
00187           (wDetId.chamber() == compId.chamber()) &&
00188           (wDetId.layer()   == compId.layer()  )) {
00189           
00190         // Create vector of wire hits for this layer
00191         std::vector<CSCWireHit> cscWireHit;
00192        
00193         CSCRangeMapForRecHit acc2;
00194         CSCWireHitCollection::range range = clean_woc.get(acc2.cscDetLayer(*wIt));
00195       
00196         for ( CSCWireHitCollection::const_iterator clean_woc = range.first; clean_woc != range.second; ++clean_woc)
00197           cscWireHit.push_back(*clean_woc);
00198 
00199         // Build 2D hit for all possible strip-wire pairs 
00200         // overlapping within this layer
00201         LogTrace("CSCRecHit")<< "# strip hits in layer: " << cscStripHit.size() << "  " 
00202                              << "# wire hits in layer: "  << cscWireHit.size()  << "\n";
00203 
00204         for (unsigned i = 0; i != cscStripHit.size(); ++i ) {
00205           const CSCStripHit s_hit = cscStripHit[i];
00206           for (unsigned j = 0; j != cscWireHit.size(); ++j ) {
00207             const CSCWireHit w_hit = cscWireHit[j];
00208             CSCRecHit2D rechit = make2DHits_->hitFromStripAndWire(sDetId, layer, w_hit, s_hit);
00209             bool isInFiducial = make2DHits_->isHitInFiducial( layer, rechit );
00210             if ( isInFiducial ) {
00211               foundMatch = true;  
00212               hitsInLayer.push_back( rechit );
00213               hits_in_layer++;
00214             }
00215           }
00216         }
00217       }
00218     }
00219 
00220     // output vector of 2D rechits to collection
00221     if (hits_in_layer > 0) {
00222       oc.put( sDetId, hitsInLayer.begin(), hitsInLayer.end() );
00223       hitsInLayer.clear();
00224     }
00225     hits_in_layer = 0;
00226     layer_idx++;
00227     old_id = sDetId;
00228   }
00229 
00230   LogTrace("CSCRecHit") << "Done producing 2D-hits. Number of hits : " << oc.size()<< "\n";
00231 
00232 }

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

Definition at line 238 of file CSCRecHitDBuilder.cc.

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

Referenced by build().

00238                                                                     {
00239   if ( !geom_ ) throw cms::Exception("MissingGeometry") << "[CSCRecHitDBuilder::getLayer] Missing geometry" << std::endl;
00240   return geom_->layer(detId);
00241 }

void CSCRecHitDBuilder::setConditions ( const CSCRecoConditions reco  ) 

Pass conditions downstream.

Definition at line 243 of file CSCRecHitDBuilder.cc.

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

Referenced by CSCRecHitDProducer::CSCRecHitDProducer().

00243                                                                      {
00244   hitsFromStripOnly_->setConditions( reco );
00245   hitsFromWireOnly_->setConditions( reco );
00246   make2DHits_->setConditions( reco );  
00247 }

void CSCRecHitDBuilder::setGeometry ( const CSCGeometry geom  )  [inline]

Cache pointer to geometry so it can be passed downstream.

Definition at line 67 of file CSCRecHitDBuilder.h.

References geom_.

Referenced by CSCRecHitDProducer::produce().

00067 {geom_ = geom;}


Member Data Documentation

const CSCGeometry* CSCRecHitDBuilder::geom_ [private]

Definition at line 98 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 89 of file CSCRecHitDBuilder.h.

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

CSCHitFromWireOnly* CSCRecHitDBuilder::hitsFromWireOnly_ [private]

Definition at line 90 of file CSCRecHitDBuilder.h.

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

CSCMake2DRecHit* CSCRecHitDBuilder::make2DHits_ [private]

Definition at line 93 of file CSCRecHitDBuilder.h.

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

bool CSCRecHitDBuilder::makePseudo2DHits [private]

Definition at line 82 of file CSCRecHitDBuilder.h.

int CSCRecHitDBuilder::stripWireDeltaT [private]

Definition at line 81 of file CSCRecHitDBuilder.h.

Referenced by CSCRecHitDBuilder().

bool CSCRecHitDBuilder::useCalib [private]

Definition at line 80 of file CSCRecHitDBuilder.h.

Referenced by CSCRecHitDBuilder().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:17:24 2009 for CMSSW by  doxygen 1.5.4