CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

ctfseeding::HitExtractorSTRP Class Reference

#include <HitExtractorSTRP.h>

Inheritance diagram for ctfseeding::HitExtractorSTRP:
ctfseeding::HitExtractor

List of all members.

Public Member Functions

virtual HitExtractorSTRPclone () const
 HitExtractorSTRP (const DetLayer *detLayer, SeedingLayer::Side &side, int idLayer)
virtual HitExtractor::Hits hits (const SeedingLayer &sl, const edm::Event &, const edm::EventSetup &) const
void useMatchedHits (const edm::InputTag &m)
void useRingSelector (int minRing, int maxRing)
void useRPhiHits (const edm::InputTag &m)
void useSimpleRphiHitsCleaner (bool use)
void useStereoHits (const edm::InputTag &m)
virtual ~HitExtractorSTRP ()

Private Member Functions

bool ringRange (int ring) const

Private Attributes

bool hasMatchedHits
bool hasRingSelector
bool hasRPhiHits
bool hasSimpleRphiHitsCleaner
bool hasStereoHits
int theIdLayer
const DetLayertheLayer
edm::InputTag theMatchedHits
int theMaxRing
int theMinRing
edm::InputTag theRPhiHits
SeedingLayer::Side theSide
edm::InputTag theStereoHits

Detailed Description

Definition at line 14 of file HitExtractorSTRP.h.


Constructor & Destructor Documentation

HitExtractorSTRP::HitExtractorSTRP ( const DetLayer detLayer,
SeedingLayer::Side side,
int  idLayer 
)

Definition at line 22 of file HitExtractorSTRP.cc.

Referenced by clone().

  : theLayer(detLayer), theSide(side), theIdLayer(idLayer),
    hasMatchedHits(false), hasRPhiHits(false), hasStereoHits(false),
    hasRingSelector(false), theMinRing(1), theMaxRing(0), hasSimpleRphiHitsCleaner(true)
{ }
virtual ctfseeding::HitExtractorSTRP::~HitExtractorSTRP ( ) [inline, virtual]

Definition at line 18 of file HitExtractorSTRP.h.

{}

Member Function Documentation

virtual HitExtractorSTRP* ctfseeding::HitExtractorSTRP::clone ( void  ) const [inline, virtual]

Definition at line 21 of file HitExtractorSTRP.h.

References HitExtractorSTRP().

{ return new HitExtractorSTRP(*this); }
HitExtractor::Hits HitExtractorSTRP::hits ( const SeedingLayer sl,
const edm::Event ev,
const edm::EventSetup es 
) const [virtual]

Implements ctfseeding::HitExtractor.

Definition at line 43 of file HitExtractorSTRP.cc.

References TransientTrackingRecHitBuilder::build(), end, edm::Event::getByLabel(), hasMatchedHits, hasRPhiHits, hasSimpleRphiHitsCleaner, hasStereoHits, ctfseeding::SeedingLayer::hitBuilder(), ctfseeding::range2SeedingHits(), query::result, relativeConstraints::ring, ringRange(), TrackerLayerIdAccessor::stripTECDisk(), TrackerLayerIdAccessor::stripTIBLayer(), TrackerLayerIdAccessor::stripTIDDisk(), TrackerLayerIdAccessor::stripTOBLayer(), DetLayer::subDetector(), sistripsummary::TEC, theIdLayer, theLayer, theMatchedHits, theRPhiHits, theSide, theStereoHits, sistripsummary::TIB, sistripsummary::TID, and sistripsummary::TOB.

{
  TrackerLayerIdAccessor accessor;
  HitExtractor::Hits result;

  //
  // TIB
  //
  if (theLayer->subDetector() == GeomDetEnumerators::TIB) {
    if (hasMatchedHits) {
      edm::Handle<SiStripMatchedRecHit2DCollection> matchedHits;
      ev.getByLabel( theMatchedHits, matchedHits);
      range2SeedingHits( *matchedHits, result, accessor.stripTIBLayer(theIdLayer), sl, es); 
    }
    if (hasRPhiHits) {
      edm::Handle<SiStripRecHit2DCollection> rphiHits;
      ev.getByLabel( theRPhiHits, rphiHits);
      if (hasMatchedHits){ 
        if (!hasSimpleRphiHitsCleaner){ // this is a brutal "cleaning". Add something smarter in the future
          range2SeedingHits( *rphiHits, result, accessor.stripTIBLayer(theIdLayer), sl, es); 
        }
      } else {
        range2SeedingHits( *rphiHits, result, accessor.stripTIBLayer(theIdLayer), sl, es); 
      }
    }
    if (hasStereoHits) {
      edm::Handle<SiStripRecHit2DCollection> stereoHits;
      ev.getByLabel( theStereoHits, stereoHits);
      range2SeedingHits( *stereoHits, result, accessor.stripTIBLayer(theIdLayer), sl, es); 
    }
  }
  
  //
  // TID
  //
  else if (theLayer->subDetector() == GeomDetEnumerators::TID) {
      if (hasMatchedHits) {
          edm::Handle<SiStripMatchedRecHit2DCollection> matchedHits;
          ev.getByLabel( theMatchedHits, matchedHits);
          std::pair<DetId,DetIdTIDSameDiskComparator> getter = accessor.stripTIDDisk(theSide,theIdLayer);
          SiStripMatchedRecHit2DCollection::Range range = matchedHits->equal_range(getter.first, getter.second);
          for (SiStripMatchedRecHit2DCollection::const_iterator it = range.first; it != range.second; ++it) {
              int ring = TIDDetId( it->detId() ).ring();  if (!ringRange(ring)) continue;
              for (SiStripMatchedRecHit2DCollection::DetSet::const_iterator hit = it->begin(), end = it->end(); hit != end; ++hit) {
                  result.push_back( sl.hitBuilder()->build(hit) ); 
              }
          }
      }
      if (hasRPhiHits) {
          edm::Handle<SiStripRecHit2DCollection> rphiHits;
          ev.getByLabel( theRPhiHits, rphiHits);
          std::pair<DetId,DetIdTIDSameDiskComparator> getter = accessor.stripTIDDisk(theSide,theIdLayer);
          SiStripRecHit2DCollection::Range range = rphiHits->equal_range(getter.first, getter.second);
          for (SiStripRecHit2DCollection::const_iterator it = range.first; it != range.second; ++it) {
              int ring = TIDDetId( it->detId() ).ring();  if (!ringRange(ring)) continue;
              if ((SiStripDetId(it->detId()).partnerDetId() != 0) && hasSimpleRphiHitsCleaner) continue;  // this is a brutal "cleaning". Add something smarter in the future
              for (SiStripRecHit2DCollection::DetSet::const_iterator hit = it->begin(), end = it->end(); hit != end; ++hit) {
                  result.push_back( sl.hitBuilder()->build(hit) );
              }
          }
      }
      if (hasStereoHits) {
          edm::Handle<SiStripRecHit2DCollection> stereoHits;
          ev.getByLabel( theStereoHits, stereoHits);
          std::pair<DetId,DetIdTIDSameDiskComparator> getter = accessor.stripTIDDisk(theSide,theIdLayer);
          SiStripRecHit2DCollection::Range range = stereoHits->equal_range(getter.first, getter.second);
          for (SiStripRecHit2DCollection::const_iterator it = range.first; it != range.second; ++it) {
              int ring = TIDDetId( it->detId() ).ring();  if (!ringRange(ring)) continue;
              for (SiStripRecHit2DCollection::DetSet::const_iterator hit = it->begin(), end = it->end(); hit != end; ++hit) {
                  result.push_back( sl.hitBuilder()->build(hit) );
              }
          }
      }
  }
  //
  // TOB
  //
  else if (theLayer->subDetector() == GeomDetEnumerators::TOB) {
    if (hasMatchedHits) {
      edm::Handle<SiStripMatchedRecHit2DCollection> matchedHits;
      ev.getByLabel( theMatchedHits, matchedHits);
      range2SeedingHits( *matchedHits, result, accessor.stripTOBLayer(theIdLayer), sl, es); 
    }
    if (hasRPhiHits) {
      edm::Handle<SiStripRecHit2DCollection> rphiHits;
      ev.getByLabel( theRPhiHits, rphiHits);
      if (hasMatchedHits){ 
        if (!hasSimpleRphiHitsCleaner){ // this is a brutal "cleaning". Add something smarter in the future
          range2SeedingHits( *rphiHits, result, accessor.stripTOBLayer(theIdLayer), sl, es); 
        }
      } else {
        range2SeedingHits( *rphiHits, result, accessor.stripTOBLayer(theIdLayer), sl, es); 
      }
    }
    if (hasStereoHits) {
      edm::Handle<SiStripRecHit2DCollection> stereoHits;
      ev.getByLabel( theStereoHits, stereoHits);
      range2SeedingHits( *stereoHits, result, accessor.stripTOBLayer(theIdLayer), sl, es); 
    }
  }

  //
  // TEC
  //
  else if (theLayer->subDetector() == GeomDetEnumerators::TEC) {
      if (hasMatchedHits) {
          edm::Handle<SiStripMatchedRecHit2DCollection> matchedHits;
          ev.getByLabel( theMatchedHits, matchedHits);
          std::pair<DetId,DetIdTECSameDiskComparator> getter = accessor.stripTECDisk(theSide,theIdLayer);
          SiStripMatchedRecHit2DCollection::Range range = matchedHits->equal_range(getter.first, getter.second);
          for (SiStripMatchedRecHit2DCollection::const_iterator it = range.first; it != range.second; ++it) {
              int ring = TECDetId( it->detId() ).ring();  if (!ringRange(ring)) continue;
              for (SiStripMatchedRecHit2DCollection::DetSet::const_iterator hit = it->begin(), end = it->end(); hit != end; ++hit) {
                  result.push_back(  sl.hitBuilder()->build(hit) );
              }
          }
      }
      if (hasRPhiHits) {
          edm::Handle<SiStripRecHit2DCollection> rphiHits;
          ev.getByLabel( theRPhiHits, rphiHits);
          std::pair<DetId,DetIdTECSameDiskComparator> getter = accessor.stripTECDisk(theSide,theIdLayer);
          SiStripRecHit2DCollection::Range range = rphiHits->equal_range(getter.first, getter.second);
          for (SiStripRecHit2DCollection::const_iterator it = range.first; it != range.second; ++it) {
              int ring = TECDetId( it->detId() ).ring();  if (!ringRange(ring)) continue;
              if ((SiStripDetId(it->detId()).partnerDetId() != 0) && hasSimpleRphiHitsCleaner) continue;  // this is a brutal "cleaning". Add something smarter in the future
              for (SiStripRecHit2DCollection::DetSet::const_iterator hit = it->begin(), end = it->end(); hit != end; ++hit) {
                  result.push_back( sl.hitBuilder()->build(hit) );
              }
          }

      }
      if (hasStereoHits) {
          edm::Handle<SiStripRecHit2DCollection> stereoHits;
          ev.getByLabel( theStereoHits, stereoHits);
          std::pair<DetId,DetIdTECSameDiskComparator> getter = accessor.stripTECDisk(theSide,theIdLayer);
          SiStripRecHit2DCollection::Range range = stereoHits->equal_range(getter.first, getter.second);
          for (SiStripRecHit2DCollection::const_iterator it = range.first; it != range.second; ++it) {
              int ring = TECDetId( it->detId() ).ring();  if (!ringRange(ring)) continue;
              for (SiStripRecHit2DCollection::DetSet::const_iterator hit = it->begin(), end = it->end(); hit != end; ++hit) {
                  result.push_back( sl.hitBuilder()->build(hit) );
              }
          }
      }
  }
  

  return result;
}
bool HitExtractorSTRP::ringRange ( int  ring) const [private]

Definition at line 36 of file HitExtractorSTRP.cc.

References hasRingSelector, theMaxRing, and theMinRing.

Referenced by hits().

{
  if (!hasRingSelector) return true;
  else if ( ring >= theMinRing && ring <= theMaxRing) return true;
  else return false;
}
void ctfseeding::HitExtractorSTRP::useMatchedHits ( const edm::InputTag m) [inline]

Definition at line 23 of file HitExtractorSTRP.h.

References hasMatchedHits, m, and theMatchedHits.

void HitExtractorSTRP::useRingSelector ( int  minRing,
int  maxRing 
)

Definition at line 29 of file HitExtractorSTRP.cc.

References hasRingSelector, theMaxRing, and theMinRing.

{
  hasRingSelector=true;
  theMinRing=minRing;
  theMaxRing=maxRing; 
}
void ctfseeding::HitExtractorSTRP::useRPhiHits ( const edm::InputTag m) [inline]

Definition at line 24 of file HitExtractorSTRP.h.

References hasRPhiHits, m, and theRPhiHits.

{ hasRPhiHits    = true; theRPhiHits = m; }
void ctfseeding::HitExtractorSTRP::useSimpleRphiHitsCleaner ( bool  use) [inline]

Definition at line 27 of file HitExtractorSTRP.h.

References hasSimpleRphiHitsCleaner.

void ctfseeding::HitExtractorSTRP::useStereoHits ( const edm::InputTag m) [inline]

Definition at line 25 of file HitExtractorSTRP.h.

References hasStereoHits, m, and theStereoHits.

{ hasStereoHits = true; theStereoHits = m; }

Member Data Documentation

Definition at line 35 of file HitExtractorSTRP.h.

Referenced by hits(), and useMatchedHits().

Definition at line 38 of file HitExtractorSTRP.h.

Referenced by ringRange(), and useRingSelector().

Definition at line 36 of file HitExtractorSTRP.h.

Referenced by hits(), and useRPhiHits().

Definition at line 39 of file HitExtractorSTRP.h.

Referenced by hits(), and useSimpleRphiHitsCleaner().

Definition at line 37 of file HitExtractorSTRP.h.

Referenced by hits(), and useStereoHits().

Definition at line 34 of file HitExtractorSTRP.h.

Referenced by hits().

Definition at line 32 of file HitExtractorSTRP.h.

Referenced by hits().

Definition at line 35 of file HitExtractorSTRP.h.

Referenced by hits(), and useMatchedHits().

Definition at line 38 of file HitExtractorSTRP.h.

Referenced by ringRange(), and useRingSelector().

Definition at line 38 of file HitExtractorSTRP.h.

Referenced by ringRange(), and useRingSelector().

Definition at line 36 of file HitExtractorSTRP.h.

Referenced by hits(), and useRPhiHits().

Definition at line 33 of file HitExtractorSTRP.h.

Referenced by hits().

Definition at line 37 of file HitExtractorSTRP.h.

Referenced by hits(), and useStereoHits().