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, const TrackerTopology *tTopo)
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 18 of file HitPixelLayersTPSelector.h.


Member Typedef Documentation

Definition at line 23 of file HitPixelLayersTPSelector.h.

typedef container::const_iterator HitPixelLayersTPSelector::const_iterator

Definition at line 30 of file HitPixelLayersTPSelector.h.

Definition at line 27 of file HitPixelLayersTPSelector.h.


Constructor & Destructor Documentation

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

Definition at line 33 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 133 of file HitPixelLayersTPSelector.h.

References selected_.

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

Definition at line 139 of file HitPixelLayersTPSelector.h.

References selected_.

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

Definition at line 122 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,
const TrackerTopology tTopo 
) [inline]

Definition at line 96 of file HitPixelLayersTPSelector.h.

References cond::rpcobgas::detid, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, TrackerTopology::pxbLayer(), TrackerTopology::pxfDisk(), and DetId::Tracker.

Referenced by select().

      {
        std::vector<bool> hitpattern(5,false); // PXB 0,1,2  PXF 0,1
        
#warning "This file has been modified just to get it to compile without any regard as to whether it still functions as intended"
#ifdef REMOVED_JUST_TO_GET_IT_TO_COMPILE__THIS_CODE_NEEDS_TO_BE_CHECKED
        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[tTopo->pxbLayer(id)-1]=true;
            else if (subdet == PixelSubdetector::PixelEndcap) 
              hitpattern[tTopo->pxfDisk(id)+2]=true;
          }
          
        }// end simhit loop
#endif
        
        return hitpattern;
      }
void HitPixelLayersTPSelector::select ( const edm::Handle< collection > &  TPCH,
const edm::Event iEvent,
const edm::EventSetup iSetup 
) [inline]

Definition at line 50 of file HitPixelLayersTPSelector.h.

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

    {
      selected_.clear();
      //Retrieve tracker topology from geometry
      edm::ESHandle<TrackerTopology> tTopoHand;
      iSetup.get<IdealGeometryRecord>().get(tTopoHand);
      const TrackerTopology *tTopo=tTopoHand.product();
      

      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->numberOfTrackerLayers() >= 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,tTopo)) ) continue; //findable triplet seed
              const TrackingParticle * trap = &(tpc[i]);
              selected_.push_back(trap);
            } 
          
        }
    }
size_t HitPixelLayersTPSelector::size ( void  ) const [inline]

Definition at line 145 of file HitPixelLayersTPSelector.h.

References selected_.

    {
      return selected_.size();
    }

Member Data Documentation

Definition at line 161 of file HitPixelLayersTPSelector.h.

Referenced by select().

Definition at line 158 of file HitPixelLayersTPSelector.h.

Referenced by select().

Definition at line 156 of file HitPixelLayersTPSelector.h.

Referenced by select().

Definition at line 159 of file HitPixelLayersTPSelector.h.

Referenced by select().

Definition at line 155 of file HitPixelLayersTPSelector.h.

Referenced by select().

Definition at line 164 of file HitPixelLayersTPSelector.h.

Referenced by select().

Definition at line 162 of file HitPixelLayersTPSelector.h.

Referenced by select().

Definition at line 154 of file HitPixelLayersTPSelector.h.

Referenced by select().

Definition at line 152 of file HitPixelLayersTPSelector.h.

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

Definition at line 160 of file HitPixelLayersTPSelector.h.

Referenced by select().

Definition at line 157 of file HitPixelLayersTPSelector.h.

Referenced by select().

Definition at line 163 of file HitPixelLayersTPSelector.h.

Referenced by select().

Definition at line 153 of file HitPixelLayersTPSelector.h.

Referenced by select().