CMS 3D CMS Logo

Public Types | Public Member Functions | Public Attributes

HitPixelLayersTPSelector Class Reference

#include <HitPixelLayersTPSelector.h>

List of all members.

Public Types

typedef TrackingParticleCollection collection
typedef container::const_iterator const_iterator
typedef std::vector< const
TrackingParticle * > 
container

Public Member Functions

const_iterator begin () const
const_iterator end () const
bool goodHitPattern (const std::vector< bool > hitpattern)
 HitPixelLayersTPSelector (const edm::ParameterSet &iConfig)
std::vector< bool > pixelHitPattern (const TrackingParticleRef &simTrack)
void select (const edm::Handle< collection > &TPCH, const edm::Event &iEvent, const edm::EventSetup &iSetup)
size_t size () const

Public Attributes

bool chargedOnly_
double lip_
double maxRapidity_
int minHit_
double minRapidity_
std::vector< int > pdgId_
bool primaryOnly_
double ptMin_
container selected_
bool signalOnly_
double tip_
bool tpStatusBased_
bool tripletSeedOnly_

Detailed Description

Selector to select only tracking particles that leave hits in three pixel layers Additional selection done on pt, rapidity, impact parameter, min hits, pdg id, etc.

Inspired by CommonTools.RecoAlgos.TrackingParticleSelector.h

Definition at line 17 of file HitPixelLayersTPSelector.h.


Member Typedef Documentation

Definition at line 22 of file HitPixelLayersTPSelector.h.

typedef container::const_iterator HitPixelLayersTPSelector::const_iterator

Definition at line 29 of file HitPixelLayersTPSelector.h.

Definition at line 26 of file HitPixelLayersTPSelector.h.


Constructor & Destructor Documentation

HitPixelLayersTPSelector::HitPixelLayersTPSelector ( const edm::ParameterSet iConfig) [inline]

Definition at line 32 of file HitPixelLayersTPSelector.h.

                                                            : 
    tripletSeedOnly_(iConfig.getParameter<bool>("tripletSeedOnly")),
    ptMin_(iConfig.getParameter<double>("ptMin")), 
    minRapidity_(iConfig.getParameter<double>("minRapidity")), 
    maxRapidity_(iConfig.getParameter<double>("maxRapidity")),
    tip_(iConfig.getParameter<double>("tip")), 
    lip_(iConfig.getParameter<double>("lip")), 
    minHit_(iConfig.getParameter<int>("minHit")), 
    signalOnly_(iConfig.getParameter<bool>("signalOnly")), 
    chargedOnly_(iConfig.getParameter<bool>("chargedOnly")), 
    primaryOnly_(iConfig.getParameter<bool>("primaryOnly")),
    tpStatusBased_(iConfig.getParameter<bool>("tpStatusBased")),
    pdgId_(iConfig.getParameter< std::vector<int> >("pdgId"))                              
      {};

Member Function Documentation

const_iterator HitPixelLayersTPSelector::begin ( void  ) const [inline]

Definition at line 125 of file HitPixelLayersTPSelector.h.

References selected_.

    {
      return selected_.begin();
    }
const_iterator HitPixelLayersTPSelector::end ( void  ) const [inline]

Definition at line 131 of file HitPixelLayersTPSelector.h.

References selected_.

    {
      return selected_.end();
    }
bool HitPixelLayersTPSelector::goodHitPattern ( const std::vector< bool >  hitpattern) [inline]

Definition at line 114 of file HitPixelLayersTPSelector.h.

Referenced by select().

    {
      if( (hitpattern[0] && hitpattern[1] && hitpattern[2]) ||
          (hitpattern[0] && hitpattern[1] && hitpattern[3]) ||
          (hitpattern[0] && hitpattern[3] && hitpattern[4]) ) 
        return true;
      else 
        return false;
    }
std::vector<bool> HitPixelLayersTPSelector::pixelHitPattern ( const TrackingParticleRef simTrack) [inline]

Definition at line 91 of file HitPixelLayersTPSelector.h.

References cond::rpcobgas::detid, PXFDetId::disk(), PXBDetId::layer(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, and DetId::Tracker.

Referenced by select().

      {
        std::vector<bool> hitpattern(5,false); // PXB 0,1,2  PXF 0,1
        
        for(std::vector<PSimHit>::const_iterator simHit = simTrack->pSimHit_begin();simHit!= simTrack->pSimHit_end();simHit++){
          
          DetId id = DetId(simHit->detUnitId());
          uint32_t detid = id.det();
          uint32_t subdet = id.subdetId();
          
          if (detid == DetId::Tracker) {
            if (subdet == PixelSubdetector::PixelBarrel) 
              hitpattern[PXBDetId(id).layer()-1]=true;
            else if (subdet == PixelSubdetector::PixelEndcap) 
              hitpattern[PXFDetId(id).disk()+2]=true;
          }
          
        }// end simhit loop
        
        return hitpattern;
      }
void HitPixelLayersTPSelector::select ( const edm::Handle< collection > &  TPCH,
const edm::Event iEvent,
const edm::EventSetup iSetup 
) [inline]

Definition at line 49 of file HitPixelLayersTPSelector.h.

References chargedOnly_, goodHitPattern(), i, lip_, maxRapidity_, minHit_, minRapidity_, pdgId_, pixelHitPattern(), primaryOnly_, edm::Handle< T >::product(), ptMin_, selected_, signalOnly_, mathSSE::sqrt(), tip_, tpStatusBased_, and tripletSeedOnly_.

    {
      selected_.clear();
      

      const collection & tpc = *(TPCH.product());
      
      for (TrackingParticleCollection::size_type i=0; i<tpc.size(); i++)
        {
          TrackingParticleRef tpr(TPCH, i);
          
          // quickly reject if it is from pile-up
          if (signalOnly_ && !(tpr->eventId().bunchCrossing()==0 && tpr->eventId().event()==0) ) continue;
          if (chargedOnly_ && tpr->charge()==0) continue; //select only if charge!=0
          if (tpStatusBased_ && primaryOnly_ && tpr->status()!=1 ) continue; // TP status based sel primary
          if ((!tpStatusBased_) && primaryOnly_ && tpr->parentVertex()->nSourceTracks()!=0 ) continue; // vertex based sel for primary

          // loop over specified PID values 
          bool testId = false;
          unsigned int idSize = pdgId_.size();
          if (idSize==0) testId = true;
          else for (unsigned int it=0;it!=idSize;++it){
            if (tpr->pdgId()==pdgId_[it]) testId = true;
          }
          
          // selection criteria
          if ( tpr->matchedHit() >= minHit_ &&   
               sqrt(tpr->momentum().perp2()) >= ptMin_ && 
               tpr->momentum().eta() >= minRapidity_ && tpr->momentum().eta() <= maxRapidity_ && 
               sqrt(tpr->vertex().perp2()) <= tip_ &&
               fabs(tpr->vertex().z()) <= lip_ &&
               testId)
            {
              if (tripletSeedOnly_ && !goodHitPattern(pixelHitPattern(tpr)) ) continue; //findable triplet seed
              const TrackingParticle * trap = &(tpc[i]);
              selected_.push_back(trap);
            } 
          
        }
    }
size_t HitPixelLayersTPSelector::size ( void  ) const [inline]

Definition at line 137 of file HitPixelLayersTPSelector.h.

References selected_.

    {
      return selected_.size();
    }

Member Data Documentation

Definition at line 153 of file HitPixelLayersTPSelector.h.

Referenced by select().

Definition at line 150 of file HitPixelLayersTPSelector.h.

Referenced by select().

Definition at line 148 of file HitPixelLayersTPSelector.h.

Referenced by select().

Definition at line 151 of file HitPixelLayersTPSelector.h.

Referenced by select().

Definition at line 147 of file HitPixelLayersTPSelector.h.

Referenced by select().

Definition at line 156 of file HitPixelLayersTPSelector.h.

Referenced by select().

Definition at line 154 of file HitPixelLayersTPSelector.h.

Referenced by select().

Definition at line 146 of file HitPixelLayersTPSelector.h.

Referenced by select().

Definition at line 144 of file HitPixelLayersTPSelector.h.

Referenced by begin(), end(), select(), and size().

Definition at line 152 of file HitPixelLayersTPSelector.h.

Referenced by select().

Definition at line 149 of file HitPixelLayersTPSelector.h.

Referenced by select().

Definition at line 155 of file HitPixelLayersTPSelector.h.

Referenced by select().

Definition at line 145 of file HitPixelLayersTPSelector.h.

Referenced by select().