CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
MultiTrackSelector Class Reference

#include <MultiTrackSelector.h>

Inheritance diagram for MultiTrackSelector:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper AnalyticalTrackSelector

Public Member Functions

 MultiTrackSelector ()
 constructor More...
 
 MultiTrackSelector (const edm::ParameterSet &cfg)
 
virtual ~MultiTrackSelector ()
 destructor More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Types

typedef math::XYZPoint Point
 

Protected Member Functions

void beginStream (edm::StreamID) overridefinal
 
void processMVA (edm::Event &evt, const edm::EventSetup &es, std::vector< float > &mvaVals_) const
 
void produce (edm::Event &evt, const edm::EventSetup &es) overridefinal
 process one event More...
 
virtual void run (edm::Event &evt, const edm::EventSetup &es) const
 
bool select (unsigned tsNum, const reco::BeamSpot &vertexBeamSpot, const TrackingRecHitCollection &recHits, const reco::Track &tk, const std::vector< Point > &points, std::vector< float > &vterr, std::vector< float > &vzerr, double mvaVal) const
 return class, or -1 if rejected More...
 
void selectVertices (unsigned int tsNum, const reco::VertexCollection &vtxs, std::vector< Point > &points, std::vector< float > &vterr, std::vector< float > &vzerr) const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Protected Attributes

std::vector< bool > applyAbsCutsIfNoPV_
 
std::vector< bool > applyAdaptedPVCuts_
 
edm::EDGetTokenT< reco::BeamSpotbeamspot_
 
std::vector< double > chi2n_no1Dmod_par_
 
std::vector< double > chi2n_par_
 
std::vector< std::vector
< double > > 
d0_par1_
 
std::vector< std::vector
< double > > 
d0_par2_
 
std::string dbFileName_
 
std::vector< std::vector
< double > > 
dz_par1_
 
std::vector< std::vector
< double > > 
dz_par2_
 
GBRForestforest_
 
std::string forestLabel_
 
edm::EDGetTokenT
< TrackingRecHitCollection
hSrc_
 
std::vector< bool > keepAllTracks_
 
std::vector< double > max_d0_
 Impact parameter absolute cuts. More...
 
std::vector< double > max_d0NoPV_
 
std::vector< double > max_eta_
 
std::vector< int32_t > max_lostHitFraction_
 
std::vector< uint32_t > max_lostLayers_
 
std::vector< int32_t > max_minMissHitOutOrIn_
 
std::vector< double > max_relpterr_
 
std::vector< double > max_z0_
 
std::vector< double > max_z0NoPV_
 
std::vector< uint32_t > min_3Dlayers_
 
std::vector< double > min_eta_
 
std::vector< uint32_t > min_hits_bypass_
 
std::vector< uint32_t > min_layers_
 Cuts on numbers of layers with hits/3D hits/lost hits. More...
 
std::vector< double > min_MVA_
 
std::vector< uint32_t > min_nhits_
 
std::string mvaType_
 
std::vector< std::string > name_
 
std::vector< double > nSigmaZ_
 
std::vector< unsigned int > preFilter_
 
std::vector
< reco::TrackBase::TrackQuality
qualityToSet_
 
std::vector< std::vector
< double > > 
res_par_
 
std::vector< bool > setQualityBit_
 do I have to set a quality bit? More...
 
edm::EDGetTokenT
< reco::TrackCollection
src_
 source collection label More...
 
bool useAnyMVA_
 
bool useForestFromDB_
 
std::vector< bool > useMVA_
 
bool useVertices_
 
bool useVtxError_
 
std::vector
< StringCutObjectSelector
< reco::Vertex > > 
vertexCut_
 
edm::EDGetTokenT
< reco::VertexCollection
vertices_
 
std::vector< int32_t > vtxNumber_
 vertex cuts More...
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

selects a subset of a track collection, copying extra information on demand

Author
David Lange

Definition at line 35 of file MultiTrackSelector.h.

Member Typedef Documentation

Definition at line 53 of file MultiTrackSelector.h.

Constructor & Destructor Documentation

MultiTrackSelector::MultiTrackSelector ( )
explicit

constructor

Definition at line 58 of file MultiTrackSelector.cc.

59 {
60  useForestFromDB_ = true;
61  forest_ = nullptr;
62 }
MultiTrackSelector::MultiTrackSelector ( const edm::ParameterSet cfg)
explicit

Definition at line 64 of file MultiTrackSelector.cc.

References applyAbsCutsIfNoPV_, applyAdaptedPVCuts_, chi2n_no1Dmod_par_, chi2n_par_, d0_par1_, d0_par2_, dbFileName_, dz_par1_, dz_par2_, edm::hlt::Exception, edm::ParameterSet::exists(), forest_, forestLabel_, edm::ParameterSet::getParameter(), i, j, keepAllTracks_, max_d0_, max_d0NoPV_, max_eta_, max_lostHitFraction_, max_lostLayers_, max_minMissHitOutOrIn_, max_relpterr_, max_z0_, max_z0NoPV_, min_3Dlayers_, min_eta_, min_hits_bypass_, min_layers_, min_MVA_, min_nhits_, mvaType_, name_, nSigmaZ_, preFilter_, qualityToSet_, res_par_, setQualityBit_, AlCaHLTBitMon_QueryRunRegistry::string, useAnyMVA_, useForestFromDB_, useMVA_, useVertices_, useVtxError_, vertexCut_, vertices_, and vtxNumber_.

64  :
65  src_( consumes<reco::TrackCollection>( cfg.getParameter<edm::InputTag>( "src" ) ) ),
66  hSrc_(consumes<TrackingRecHitCollection>( cfg.getParameter<edm::InputTag>( "src" ) ) ),
67  beamspot_( consumes<reco::BeamSpot>( cfg.getParameter<edm::InputTag>( "beamspot" ) ) ),
68  useVertices_( cfg.getParameter<bool>( "useVertices" ) ),
69  useVtxError_( cfg.getParameter<bool>( "useVtxError" ) )
70  // now get the pset for each selector
71 {
72  if (useVertices_) vertices_ = consumes<reco::VertexCollection>(cfg.getParameter<edm::InputTag>( "vertices" ));
73  if(useVtxError_){
74  edm::LogWarning("MultiTRackSelector") << "you are executing buggy code, if intentional please help to fix it";
75  }
76  useAnyMVA_ = false;
77  forestLabel_ = "MVASelectorIter0";
78  std::string type = "BDTG";
79  useForestFromDB_ = true;
80  dbFileName_ = "";
81 
82  forest_ = nullptr;
83 
84  if(cfg.exists("useAnyMVA")) useAnyMVA_ = cfg.getParameter<bool>("useAnyMVA");
85 
86  if(useAnyMVA_){
87  if(cfg.exists("mvaType"))type = cfg.getParameter<std::string>("mvaType");
88  if(cfg.exists("GBRForestLabel"))forestLabel_ = cfg.getParameter<std::string>("GBRForestLabel");
89  if(cfg.exists("GBRForestFileName")){
90  dbFileName_ = cfg.getParameter<std::string>("GBRForestFileName");
91  useForestFromDB_ = false;
92  }
93 
94  mvaType_ = type;
95  }
96  std::vector<edm::ParameterSet> trkSelectors( cfg.getParameter<std::vector< edm::ParameterSet> >("trackSelectors") );
97  qualityToSet_.reserve(trkSelectors.size());
98  vtxNumber_.reserve(trkSelectors.size());
99  vertexCut_.reserve(trkSelectors.size());
100  res_par_.reserve(trkSelectors.size());
101  chi2n_par_.reserve(trkSelectors.size());
102  chi2n_no1Dmod_par_.reserve(trkSelectors.size());
103  d0_par1_.reserve(trkSelectors.size());
104  dz_par1_.reserve(trkSelectors.size());
105  d0_par2_.reserve(trkSelectors.size());
106  dz_par2_.reserve(trkSelectors.size());
107  applyAdaptedPVCuts_.reserve(trkSelectors.size());
108  max_d0_.reserve(trkSelectors.size());
109  max_z0_.reserve(trkSelectors.size());
110  nSigmaZ_.reserve(trkSelectors.size());
111  min_layers_.reserve(trkSelectors.size());
112  min_3Dlayers_.reserve(trkSelectors.size());
113  max_lostLayers_.reserve(trkSelectors.size());
114  min_hits_bypass_.reserve(trkSelectors.size());
115  applyAbsCutsIfNoPV_.reserve(trkSelectors.size());
116  max_d0NoPV_.reserve(trkSelectors.size());
117  max_z0NoPV_.reserve(trkSelectors.size());
118  preFilter_.reserve(trkSelectors.size());
119  max_relpterr_.reserve(trkSelectors.size());
120  min_nhits_.reserve(trkSelectors.size());
121  max_minMissHitOutOrIn_.reserve(trkSelectors.size());
122  max_lostHitFraction_.reserve(trkSelectors.size());
123  min_eta_.reserve(trkSelectors.size());
124  max_eta_.reserve(trkSelectors.size());
125  useMVA_.reserve(trkSelectors.size());
126  //mvaReaders_.reserve(trkSelectors.size());
127  min_MVA_.reserve(trkSelectors.size());
128  //mvaType_.reserve(trkSelectors.size());
129 
130  produces<edm::ValueMap<float> >("MVAVals");
131 
132  for ( unsigned int i=0; i<trkSelectors.size(); i++) {
133 
134  qualityToSet_.push_back( TrackBase::undefQuality );
135  // parameters for vertex selection
136  vtxNumber_.push_back( useVertices_ ? trkSelectors[i].getParameter<int32_t>("vtxNumber") : 0 );
137  vertexCut_.push_back( useVertices_ ? trkSelectors[i].getParameter<std::string>("vertexCut") : 0);
138  // parameters for adapted optimal cuts on chi2 and primary vertex compatibility
139  res_par_.push_back(trkSelectors[i].getParameter< std::vector<double> >("res_par") );
140  chi2n_par_.push_back( trkSelectors[i].getParameter<double>("chi2n_par") );
141  chi2n_no1Dmod_par_.push_back( trkSelectors[i].getParameter<double>("chi2n_no1Dmod_par") );
142  d0_par1_.push_back(trkSelectors[i].getParameter< std::vector<double> >("d0_par1"));
143  dz_par1_.push_back(trkSelectors[i].getParameter< std::vector<double> >("dz_par1"));
144  d0_par2_.push_back(trkSelectors[i].getParameter< std::vector<double> >("d0_par2"));
145  dz_par2_.push_back(trkSelectors[i].getParameter< std::vector<double> >("dz_par2"));
146  // Boolean indicating if adapted primary vertex compatibility cuts are to be applied.
147  applyAdaptedPVCuts_.push_back(trkSelectors[i].getParameter<bool>("applyAdaptedPVCuts"));
148  // Impact parameter absolute cuts.
149  max_d0_.push_back(trkSelectors[i].getParameter<double>("max_d0"));
150  max_z0_.push_back(trkSelectors[i].getParameter<double>("max_z0"));
151  nSigmaZ_.push_back(trkSelectors[i].getParameter<double>("nSigmaZ"));
152  // Cuts on numbers of layers with hits/3D hits/lost hits.
153  min_layers_.push_back(trkSelectors[i].getParameter<uint32_t>("minNumberLayers") );
154  min_3Dlayers_.push_back(trkSelectors[i].getParameter<uint32_t>("minNumber3DLayers") );
155  max_lostLayers_.push_back(trkSelectors[i].getParameter<uint32_t>("maxNumberLostLayers"));
156  min_hits_bypass_.push_back(trkSelectors[i].getParameter<uint32_t>("minHitsToBypassChecks"));
157  // Flag to apply absolute cuts if no PV passes the selection
158  applyAbsCutsIfNoPV_.push_back(trkSelectors[i].getParameter<bool>("applyAbsCutsIfNoPV"));
159  keepAllTracks_.push_back( trkSelectors[i].getParameter<bool>("keepAllTracks"));
160  max_relpterr_.push_back(trkSelectors[i].getParameter<double>("max_relpterr"));
161  min_nhits_.push_back(trkSelectors[i].getParameter<uint32_t>("min_nhits"));
162  max_minMissHitOutOrIn_.push_back(
163  trkSelectors[i].existsAs<int32_t>("max_minMissHitOutOrIn") ?
164  trkSelectors[i].getParameter<int32_t>("max_minMissHitOutOrIn") : 99);
165  max_lostHitFraction_.push_back(
166  trkSelectors[i].existsAs<double>("max_lostHitFraction") ?
167  trkSelectors[i].getParameter<double>("max_lostHitFraction") : 1.0);
168  min_eta_.push_back(trkSelectors[i].existsAs<double>("min_eta") ?
169  trkSelectors[i].getParameter<double>("min_eta"):-9999);
170  max_eta_.push_back(trkSelectors[i].existsAs<double>("max_eta") ?
171  trkSelectors[i].getParameter<double>("max_eta"):9999);
172 
173  setQualityBit_.push_back( false );
174  std::string qualityStr = trkSelectors[i].getParameter<std::string>("qualityBit");
175  if (qualityStr != "") {
176  setQualityBit_[i] = true;
177  qualityToSet_[i] = TrackBase::qualityByName(trkSelectors[i].getParameter<std::string>("qualityBit"));
178  }
179 
180  if (setQualityBit_[i] && (qualityToSet_[i] == TrackBase::undefQuality)) throw cms::Exception("Configuration") <<
181  "You can't set the quality bit " << trkSelectors[i].getParameter<std::string>("qualityBit") << " as it is 'undefQuality' or unknown.\n";
182 
183  if (applyAbsCutsIfNoPV_[i]) {
184  max_d0NoPV_.push_back(trkSelectors[i].getParameter<double>("max_d0NoPV"));
185  max_z0NoPV_.push_back(trkSelectors[i].getParameter<double>("max_z0NoPV"));
186  }
187  else{//dummy values
188  max_d0NoPV_.push_back(0.);
189  max_z0NoPV_.push_back(0.);
190  }
191 
192  name_.push_back( trkSelectors[i].getParameter<std::string>("name") );
193 
194  preFilter_[i]=trkSelectors.size(); // no prefilter
195 
196  std::string pfName=trkSelectors[i].getParameter<std::string>("preFilterName");
197  if (pfName!="") {
198  bool foundPF=false;
199  for ( unsigned int j=0; j<i; j++)
200  if (name_[j]==pfName ) {
201  foundPF=true;
202  preFilter_[i]=j;
203  }
204  if ( !foundPF)
205  throw cms::Exception("Configuration") << "Invalid prefilter name in MultiTrackSelector "
206  << trkSelectors[i].getParameter<std::string>("preFilterName");
207 
208  }
209 
210  // produces<std::vector<int> >(name_[i]).setBranchAlias( name_[i] + "TrackQuals");
211  produces<edm::ValueMap<int> >(name_[i]).setBranchAlias( name_[i] + "TrackQuals");
212  if(useAnyMVA_){
213  bool thisMVA = false;
214  if(trkSelectors[i].exists("useMVA"))thisMVA = trkSelectors[i].getParameter<bool>("useMVA");
215  useMVA_.push_back(thisMVA);
216  if(thisMVA){
217  double minVal = -1;
218  if(trkSelectors[i].exists("minMVA"))minVal = trkSelectors[i].getParameter<double>("minMVA");
219  min_MVA_.push_back(minVal);
220 
221  }else{
222  min_MVA_.push_back(-9999.0);
223  }
224  }else{
225  min_MVA_.push_back(-9999.0);
226  }
227 
228  }
229 }
std::vector< double > chi2n_no1Dmod_par_
type
Definition: HCALResponse.h:21
T getParameter(std::string const &) const
std::vector< uint32_t > min_nhits_
std::vector< double > chi2n_par_
int i
Definition: DBlmapReader.cc:9
std::vector< std::vector< double > > d0_par1_
std::vector< double > max_d0NoPV_
std::vector< double > max_z0_
std::vector< uint32_t > min_layers_
Cuts on numbers of layers with hits/3D hits/lost hits.
std::vector< std::string > name_
std::vector< double > max_z0NoPV_
std::vector< bool > useMVA_
std::vector< bool > keepAllTracks_
std::vector< uint32_t > min_hits_bypass_
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::vector< bool > applyAdaptedPVCuts_
std::vector< double > nSigmaZ_
std::vector< unsigned int > preFilter_
edm::EDGetTokenT< TrackingRecHitCollection > hSrc_
edm::EDGetTokenT< reco::VertexCollection > vertices_
std::vector< uint32_t > min_3Dlayers_
std::vector< uint32_t > max_lostLayers_
std::vector< int32_t > max_lostHitFraction_
edm::EDGetTokenT< reco::BeamSpot > beamspot_
std::vector< double > min_eta_
std::vector< bool > setQualityBit_
do I have to set a quality bit?
int j
Definition: DBlmapReader.cc:9
std::vector< std::vector< double > > dz_par1_
std::vector< std::vector< double > > dz_par2_
std::vector< std::vector< double > > res_par_
std::vector< double > max_relpterr_
std::vector< int32_t > vtxNumber_
vertex cuts
std::vector< reco::TrackBase::TrackQuality > qualityToSet_
std::vector< StringCutObjectSelector< reco::Vertex > > vertexCut_
std::vector< bool > applyAbsCutsIfNoPV_
std::vector< int32_t > max_minMissHitOutOrIn_
std::vector< double > min_MVA_
edm::EDGetTokenT< reco::TrackCollection > src_
source collection label
std::vector< std::vector< double > > d0_par2_
std::vector< double > max_d0_
Impact parameter absolute cuts.
std::vector< double > max_eta_
MultiTrackSelector::~MultiTrackSelector ( )
virtual

destructor

Definition at line 231 of file MultiTrackSelector.cc.

References forest_.

231  {
232  delete forest_;
233 }

Member Function Documentation

void MultiTrackSelector::beginStream ( edm::StreamID  )
finaloverrideprotectedvirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 236 of file MultiTrackSelector.cc.

References dbFileName_, forest_, forestLabel_, and useForestFromDB_.

236  {
237  if(!useForestFromDB_){
238  TFile gbrfile(dbFileName_.c_str());
239  forest_ = (GBRForest*)gbrfile.Get(forestLabel_.c_str());
240  }
241 
242 }
void MultiTrackSelector::processMVA ( edm::Event evt,
const edm::EventSetup es,
std::vector< float > &  mvaVals_ 
) const
protected

Definition at line 533 of file MultiTrackSelector.cc.

References assert(), reco::TrackBase::chi2(), cond::rpcobimon::current, TrackingRecHit::dimension(), reco::TrackBase::eta(), reco::Track::extra(), f, forest_, forestLabel_, edm::EventSetup::get(), edm::Event::getByToken(), GBRForest::GetClassifier(), reco::TrackBase::hitPattern(), hSrc_, bookConverter::max, min(), reco::HitPattern::MISSING_INNER_HITS, reco::HitPattern::MISSING_OUTER_HITS, reco::TrackBase::ndof(), reco::TrackBase::normalizedChi2(), reco::TrackBase::numberOfLostHits(), reco::HitPattern::numberOfLostTrackerHits(), reco::TrackBase::numberOfValidHits(), reco::HitPattern::numberOfValidStripLayersWithMonoAndStereo(), reco::HitPattern::pixelLayersWithMeasurement(), edm::ESHandle< class >::product(), reco::TrackBase::pt(), reco::TrackBase::ptError(), edm::Event::put(), reco::Track::recHitsSize(), dt_dqm_sourceclient_common_cff::reco, src_, reco::HitPattern::TRACK_HITS, reco::HitPattern::trackerLayersWithMeasurement(), reco::HitPattern::trackerLayersWithoutMeasurement(), useAnyMVA_, and useForestFromDB_.

Referenced by AnalyticalTrackSelector::run(), and run().

534 {
535 
536  using namespace std;
537  using namespace edm;
538  using namespace reco;
539 
540  // Get tracks
541  Handle<TrackCollection> hSrcTrack;
542  evt.getByToken( src_, hSrcTrack );
543  const TrackCollection& srcTracks(*hSrcTrack);
544  assert(mvaVals_.size()==srcTracks.size());
545 
546  // get hits in track..
548  evt.getByToken( hSrc_, hSrcHits );
549  const TrackingRecHitCollection & srcHits(*hSrcHits);
550 
551 
552  auto_ptr<edm::ValueMap<float> >mvaValValueMap = auto_ptr<edm::ValueMap<float> >(new edm::ValueMap<float>);
553  edm::ValueMap<float>::Filler mvaFiller(*mvaValValueMap);
554 
555 
556  if(!useAnyMVA_){
557  // mvaVals_ already initalized...
558  mvaFiller.insert(hSrcTrack,mvaVals_.begin(),mvaVals_.end());
559  mvaFiller.fill();
560  evt.put(mvaValValueMap,"MVAVals");
561  return;
562  }
563 
564 
565  size_t current = 0;
566  for (TrackCollection::const_iterator it = srcTracks.begin(), ed = srcTracks.end(); it != ed; ++it, ++current) {
567  const Track & trk = * it;
568  auto tmva_ndof_ = trk.ndof();
569  auto tmva_nlayers_ = trk.hitPattern().trackerLayersWithMeasurement();
570  auto tmva_nlayers3D_ = trk.hitPattern().pixelLayersWithMeasurement()
573  float chi2n = trk.normalizedChi2();
574  float chi2n_no1Dmod = chi2n;
575 
576  int count1dhits = 0;
577  auto ith = trk.extra()->firstRecHit();
578  auto edh = ith + trk.recHitsSize();
579  for (; ith<edh; ++ith) {
580  const TrackingRecHit & hit = srcHits[ith];
581  if (hit.dimension()==1) ++count1dhits;
582  }
583  if (count1dhits > 0) {
584  float chi2 = trk.chi2();
585  float ndof = trk.ndof();
586  chi2n = (chi2+count1dhits)/float(ndof+count1dhits);
587  }
588  auto tmva_chi2n_ = chi2n;
589  auto tmva_chi2n_no1dmod_ = chi2n_no1Dmod;
590  auto tmva_eta_ = trk.eta();
591  auto tmva_relpterr_ = float(trk.ptError())/std::max(float(trk.pt()),0.000001f);
592  auto tmva_nhits_ = trk.numberOfValidHits();
595  auto tmva_minlost_ = std::min(lostIn,lostOut);
596  auto tmva_lostmidfrac_ = trk.numberOfLostHits() / (trk.numberOfValidHits() + trk.numberOfLostHits());
597 
598  float gbrVals_[11];
599  gbrVals_[0] = tmva_lostmidfrac_;
600  gbrVals_[1] = tmva_minlost_;
601  gbrVals_[2] = tmva_nhits_;
602  gbrVals_[3] = tmva_relpterr_;
603  gbrVals_[4] = tmva_eta_;
604  gbrVals_[5] = tmva_chi2n_no1dmod_;
605  gbrVals_[6] = tmva_chi2n_;
606  gbrVals_[7] = tmva_nlayerslost_;
607  gbrVals_[8] = tmva_nlayers3D_;
608  gbrVals_[9] = tmva_nlayers_;
609  gbrVals_[10] = tmva_ndof_;
610 
611 
612  GBRForest const * forest = forest_;
613  if(useForestFromDB_){
614  edm::ESHandle<GBRForest> forestHandle;
615  es.get<GBRWrapperRcd>().get(forestLabel_,forestHandle);
616  forest = forestHandle.product();
617  }
618 
619  auto gbrVal = forest->GetClassifier(gbrVals_);
620  mvaVals_[current] = gbrVal;
621  }
622  mvaFiller.insert(hSrcTrack,mvaVals_.begin(),mvaVals_.end());
623  mvaFiller.fill();
624  evt.put(mvaValValueMap,"MVAVals");
625 
626 }
virtual int dimension() const =0
const TrackExtraRef & extra() const
reference to &quot;extra&quot; object
Definition: Track.h:189
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
Definition: TrackBase.h:514
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
size_t recHitsSize() const
Get number of RecHits. (Warning, this includes invalid hits, which are not physical hits)...
Definition: Track.h:119
assert(m_qm.get())
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:13
unsigned short numberOfLostHits() const
number of cases where track crossed a layer without getting a hit.
Definition: TrackBase.h:779
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:458
edm::EDGetTokenT< TrackingRecHitCollection > hSrc_
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:477
int numberOfLostTrackerHits(HitCategory category) const
Definition: HitPattern.h:809
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:604
int numberOfValidStripLayersWithMonoAndStereo(uint16_t stripdet, uint16_t layer) const
Definition: HitPattern.cc:300
double chi2() const
chi-squared of the fit
Definition: TrackBase.h:502
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
double ndof() const
number of degrees of freedom of the fit
Definition: TrackBase.h:508
double pt() const
track transverse momentum
Definition: TrackBase.h:574
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
Definition: TrackBase.h:716
double f[11][100]
unsigned short numberOfValidHits() const
number of valid hits found
Definition: TrackBase.h:773
T min(T a, T b)
Definition: MathUtil.h:58
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:411
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
int trackerLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.cc:494
edm::EDGetTokenT< reco::TrackCollection > src_
source collection label
double GetClassifier(const float *vector) const
Definition: GBRForest.h:43
void MultiTrackSelector::produce ( edm::Event evt,
const edm::EventSetup es 
)
inlinefinaloverrideprotectedvirtual

process one event

Implements edm::stream::EDProducerBase.

Definition at line 55 of file MultiTrackSelector.h.

References DTTTrigCorrFirst::run.

55  {
56  run(evt,es);
57  }
virtual void run(edm::Event &evt, const edm::EventSetup &es) const
void MultiTrackSelector::run ( edm::Event evt,
const edm::EventSetup es 
) const
protectedvirtual

Reimplemented in AnalyticalTrackSelector.

Definition at line 246 of file MultiTrackSelector.cc.

References beamspot_, cond::rpcobimon::current, edm::Event::getByToken(), hSrc_, i, j, keepAllTracks_, LogTrace, name_, convertSQLiteXML::ok, preFilter_, processMVA(), reco::TrackBase::pt(), edm::Event::put(), reco::TrackBase::qualityMask(), qualityToSet_, dt_dqm_sourceclient_common_cff::reco, select(), selectVertices(), setQualityBit_, src_, useAnyMVA_, useVertices_, and vertices_.

247 {
248  using namespace std;
249  using namespace edm;
250  using namespace reco;
251 
252  // Get tracks
253  Handle<TrackCollection> hSrcTrack;
254  evt.getByToken(src_, hSrcTrack );
255  const TrackCollection& srcTracks(*hSrcTrack);
256 
257  // get hits in track..
259  evt.getByToken(hSrc_, hSrcHits );
260  const TrackingRecHitCollection & srcHits(*hSrcHits);
261 
262 
263  // looking for the beam spot
265  evt.getByToken(beamspot_, hBsp);
266  const reco::BeamSpot& vertexBeamSpot(*hBsp);
267 
268 
269  // Select good primary vertices for use in subsequent track selection
271  if (useVertices_) evt.getByToken(vertices_, hVtx);
272 
273  unsigned int trkSize=srcTracks.size();
274  std::vector<int> selTracksSave( qualityToSet_.size()*trkSize,0);
275 
276  std::vector<float> mvaVals_(srcTracks.size(),-99.f);
277  processMVA(evt,es, mvaVals_);
278 
279  for (unsigned int i=0; i<qualityToSet_.size(); i++) {
280  std::vector<int> selTracks(trkSize,0);
281  auto_ptr<edm::ValueMap<int> > selTracksValueMap = auto_ptr<edm::ValueMap<int> >(new edm::ValueMap<int>);
282  edm::ValueMap<int>::Filler filler(*selTracksValueMap);
283 
284  std::vector<Point> points;
285  std::vector<float> vterr, vzerr;
286  if (useVertices_) selectVertices(i,*hVtx, points, vterr, vzerr);
287 
288  // Loop over tracks
289  size_t current = 0;
290  for (TrackCollection::const_iterator it = srcTracks.begin(), ed = srcTracks.end(); it != ed; ++it, ++current) {
291  const Track & trk = * it;
292  // Check if this track passes cuts
293 
294  LogTrace("TrackSelection") << "ready to check track with pt="<< trk.pt() ;
295 
296  //already removed
297  bool ok=true;
298  if (preFilter_[i]<i && selTracksSave[preFilter_[i]*trkSize+current] < 0) {
299  selTracks[current]=-1;
300  ok=false;
301  if ( !keepAllTracks_[i])
302  continue;
303  }
304  else {
305  float mvaVal = 0;
306  if(useAnyMVA_) mvaVal = mvaVals_[current];
307  ok = select(i,vertexBeamSpot, srcHits, trk, points, vterr, vzerr,mvaVal);
308  if (!ok) {
309  LogTrace("TrackSelection") << "track with pt="<< trk.pt() << " NOT selected";
310  if (!keepAllTracks_[i]) {
311  selTracks[current]=-1;
312  continue;
313  }
314  }
315  else
316  LogTrace("TrackSelection") << "track with pt="<< trk.pt() << " selected";
317  }
318 
319  if (preFilter_[i]<i ) {
320  selTracks[current]=selTracksSave[preFilter_[i]*trkSize+current];
321  }
322  else {
323  selTracks[current]=trk.qualityMask();
324  }
325  if ( ok && setQualityBit_[i]) {
326  selTracks[current]= (selTracks[current] | (1<<qualityToSet_[i]));
327  if (qualityToSet_[i]==TrackBase::tight) {
328  selTracks[current]=(selTracks[current] | (1<<TrackBase::loose));
329  }
330  else if (qualityToSet_[i]==TrackBase::highPurity) {
331  selTracks[current]=(selTracks[current] | (1<<TrackBase::loose));
332  selTracks[current]=(selTracks[current] | (1<<TrackBase::tight));
333  }
334  if (!points.empty()) {
335  if (qualityToSet_[i]==TrackBase::loose) {
336  selTracks[current]=(selTracks[current] | (1<<TrackBase::looseSetWithPV));
337  }
338  else if (qualityToSet_[i]==TrackBase::highPurity) {
339  selTracks[current]=(selTracks[current] | (1<<TrackBase::looseSetWithPV));
340  selTracks[current]=(selTracks[current] | (1<<TrackBase::highPuritySetWithPV));
341  }
342  }
343  }
344  }
345  for ( unsigned int j=0; j< trkSize; j++ ) selTracksSave[j+i*trkSize]=selTracks[j];
346  filler.insert(hSrcTrack, selTracks.begin(),selTracks.end());
347  filler.fill();
348 
349  // evt.put(selTracks,name_[i]);
350  evt.put(selTracksValueMap,name_[i]);
351  }
352 }
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > name_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
std::vector< bool > keepAllTracks_
bool select(unsigned tsNum, const reco::BeamSpot &vertexBeamSpot, const TrackingRecHitCollection &recHits, const reco::Track &tk, const std::vector< Point > &points, std::vector< float > &vterr, std::vector< float > &vzerr, double mvaVal) const
return class, or -1 if rejected
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:13
std::vector< unsigned int > preFilter_
edm::EDGetTokenT< TrackingRecHitCollection > hSrc_
edm::EDGetTokenT< reco::VertexCollection > vertices_
edm::EDGetTokenT< reco::BeamSpot > beamspot_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
std::vector< bool > setQualityBit_
do I have to set a quality bit?
double pt() const
track transverse momentum
Definition: TrackBase.h:574
int qualityMask() const
Definition: TrackBase.h:815
int j
Definition: DBlmapReader.cc:9
#define LogTrace(id)
void selectVertices(unsigned int tsNum, const reco::VertexCollection &vtxs, std::vector< Point > &points, std::vector< float > &vterr, std::vector< float > &vzerr) const
std::vector< reco::TrackBase::TrackQuality > qualityToSet_
void processMVA(edm::Event &evt, const edm::EventSetup &es, std::vector< float > &mvaVals_) const
edm::EDGetTokenT< reco::TrackCollection > src_
source collection label
bool MultiTrackSelector::select ( unsigned  tsNum,
const reco::BeamSpot vertexBeamSpot,
const TrackingRecHitCollection recHits,
const reco::Track tk,
const std::vector< Point > &  points,
std::vector< float > &  vterr,
std::vector< float > &  vzerr,
double  mvaVal 
) const
protected

return class, or -1 if rejected

Definition at line 355 of file MultiTrackSelector.cc.

References funct::abs(), applyAbsCutsIfNoPV_, applyAdaptedPVCuts_, reco::TrackBase::chi2(), chi2n_no1Dmod_par_, chi2n_par_, d0_par1_, d0_par2_, reco::TrackBase::d0Error(), TrackingRecHit::dimension(), reco::TrackBase::dxy(), reco::TrackBase::dz(), dz_par1_, dz_par2_, reco::TrackBase::dzError(), HLT_25ns14e33_v1_cff::dzPV, end, eta(), reco::TrackBase::eta(), reco::Track::extra(), f, reco::TrackBase::hitPattern(), LogDebug, LogTrace, bookConverter::max, max_d0_, max_d0NoPV_, max_eta_, max_lostHitFraction_, max_lostLayers_, max_minMissHitOutOrIn_, max_relpterr_, max_z0_, max_z0NoPV_, min(), min_3Dlayers_, min_eta_, min_hits_bypass_, min_layers_, min_MVA_, min_nhits_, reco::HitPattern::MISSING_INNER_HITS, reco::HitPattern::MISSING_OUTER_HITS, reco::TrackBase::ndof(), reco::TrackBase::normalizedChi2(), nSigmaZ_, reco::TrackBase::numberOfLostHits(), reco::HitPattern::numberOfLostTrackerHits(), reco::TrackBase::numberOfValidHits(), reco::HitPattern::numberOfValidStripLayersWithMonoAndStereo(), reco::HitPattern::pixelLayersWithMeasurement(), point, reco::BeamSpot::position(), funct::pow(), EnergyCorrector::pt, reco::TrackBase::pt(), reco::TrackBase::ptError(), reco::Track::recHitsSize(), res_par_, reco::BeamSpot::sigmaZ(), mathSSE::sqrt(), reco::HitPattern::TRACK_HITS, reco::HitPattern::trackerLayersWithMeasurement(), reco::HitPattern::trackerLayersWithoutMeasurement(), useAnyMVA_, useMVA_, and useVtxError_.

Referenced by AnalyticalTrackSelector::run(), and run().

362  {
363  // Decide if the given track passes selection cuts.
364 
365  using namespace std;
366 
367  //cuts on number of valid hits
368  auto nhits = tk.numberOfValidHits();
369  if(nhits>=min_hits_bypass_[tsNum]) return true;
370  if(nhits < min_nhits_[tsNum]) return false;
371 
372  if ( tk.ndof() < 1E-5 ) return false;
373 
374 
376  //Adding the MVA selection before any other cut//
378  if(useAnyMVA_ && useMVA_[tsNum]){
379  if(mvaVal < min_MVA_[tsNum])return false;
380  }
382  //End of MVA selection section//
384 
385 
386  // Cuts on numbers of layers with hits/3D hits/lost hits.
387  uint32_t nlayers = tk.hitPattern().trackerLayersWithMeasurement();
388  uint32_t nlayers3D = tk.hitPattern().pixelLayersWithMeasurement() +
391  LogDebug("TrackSelection") << "cuts on nlayers: " << nlayers << " " << nlayers3D << " " << nlayersLost << " vs "
392  << min_layers_[tsNum] << " " << min_3Dlayers_[tsNum] << " " << max_lostLayers_[tsNum];
393  if (nlayers < min_layers_[tsNum]) return false;
394  if (nlayers3D < min_3Dlayers_[tsNum]) return false;
395  if (nlayersLost > max_lostLayers_[tsNum]) return false;
396  LogTrace("TrackSelection") << "cuts on nlayers passed";
397 
398  float chi2n = tk.normalizedChi2();
399  float chi2n_no1Dmod = chi2n;
400 
401  int count1dhits = 0;
402  auto ith = tk.extra()->firstRecHit();
403  auto edh = ith + tk.recHitsSize();
404  for (; ith<edh; ++ith) {
405  const TrackingRecHit & hit = recHits[ith];
406  if (hit.dimension()==1) ++count1dhits;
407  }
408  if (count1dhits > 0) {
409  float chi2 = tk.chi2();
410  float ndof = tk.ndof();
411  chi2n = (chi2+count1dhits)/float(ndof+count1dhits);
412  }
413  // For each 1D rechit, the chi^2 and ndof is increased by one. This is a way of retaining approximately
414  // the same normalized chi^2 distribution as with 2D rechits.
415  if (chi2n > chi2n_par_[tsNum]*nlayers) return false;
416 
417  if (chi2n_no1Dmod > chi2n_no1Dmod_par_[tsNum]*nlayers) return false;
418 
419  // Get track parameters
420  float pt = std::max(float(tk.pt()),0.000001f);
421  float eta = tk.eta();
422  if (eta<min_eta_[tsNum] || eta>max_eta_[tsNum]) return false;
423 
424  //cuts on relative error on pt
425  float relpterr = float(tk.ptError())/pt;
426  if(relpterr > max_relpterr_[tsNum]) return false;
427 
430  int minLost = std::min(lostIn,lostOut);
431  if (minLost > max_minMissHitOutOrIn_[tsNum]) return false;
432  float lostMidFrac = tk.numberOfLostHits() / (tk.numberOfValidHits() + tk.numberOfLostHits());
433  if (lostMidFrac > max_lostHitFraction_[tsNum]) return false;
434 
435 
436 
437  //other track parameters
438  float d0 = -tk.dxy(vertexBeamSpot.position()), d0E = tk.d0Error(),
439  dz = tk.dz(vertexBeamSpot.position()), dzE = tk.dzError();
440 
441  // parametrized d0 resolution for the track pt
442  float nomd0E = sqrt(res_par_[tsNum][0]*res_par_[tsNum][0]+(res_par_[tsNum][1]/pt)*(res_par_[tsNum][1]/pt));
443  // parametrized z0 resolution for the track pt and eta
444  float nomdzE = nomd0E*(std::cosh(eta));
445 
446  float dzCut = std::min( powN(dz_par1_[tsNum][0]*nlayers,int(dz_par1_[tsNum][1]+0.5))*nomdzE,
447  powN(dz_par2_[tsNum][0]*nlayers,int(dz_par2_[tsNum][1]+0.5))*dzE );
448  float d0Cut = std::min( powN(d0_par1_[tsNum][0]*nlayers,int(d0_par1_[tsNum][1]+0.5))*nomd0E,
449  powN(d0_par2_[tsNum][0]*nlayers,int(d0_par2_[tsNum][1]+0.5))*d0E );
450 
451 
452  // ---- PrimaryVertex compatibility cut
453  bool primaryVertexZCompatibility(false);
454  bool primaryVertexD0Compatibility(false);
455 
456  if (points.empty()) { //If not primaryVertices are reconstructed, check just the compatibility with the BS
457  //z0 within (n sigma + dzCut) of the beam spot z, if no good vertex is found
458  if ( abs(dz) < hypot(vertexBeamSpot.sigmaZ()*nSigmaZ_[tsNum],dzCut) ) primaryVertexZCompatibility = true;
459  // d0 compatibility with beam line
460  if (abs(d0) < d0Cut) primaryVertexD0Compatibility = true;
461  }
462 
463  int iv=0;
464  for (std::vector<Point>::const_iterator point = points.begin(), end = points.end(); point != end; ++point) {
465  LogTrace("TrackSelection") << "Test track w.r.t. vertex with z position " << point->z();
466  if(primaryVertexZCompatibility && primaryVertexD0Compatibility) break;
467  float dzPV = tk.dz(*point); //re-evaluate the dz with respect to the vertex position
468  float d0PV = tk.dxy(*point); //re-evaluate the dxy with respect to the vertex position
469  if(useVtxError_){
470  float dzErrPV = std::sqrt(dzE*dzE+vzerr[iv]*vzerr[iv]); // include vertex error in z
471  float d0ErrPV = std::sqrt(d0E*d0E+vterr[iv]*vterr[iv]); // include vertex error in xy
472  iv++;
473  if (abs(dzPV) < dz_par1_[tsNum][0]*pow(nlayers,dz_par1_[tsNum][1])*nomdzE &&
474  abs(dzPV) < dz_par2_[tsNum][0]*pow(nlayers,dz_par2_[tsNum][1])*dzErrPV &&
475  abs(dzPV) < max_z0_[tsNum]) primaryVertexZCompatibility = true;
476  if (abs(d0PV) < d0_par1_[tsNum][0]*pow(nlayers,d0_par1_[tsNum][1])*nomd0E &&
477  abs(d0PV) < d0_par2_[tsNum][0]*pow(nlayers,d0_par2_[tsNum][1])*d0ErrPV &&
478  abs(d0PV) < max_d0_[tsNum]) primaryVertexD0Compatibility = true;
479  }else{
480  if (abs(dzPV) < dzCut) primaryVertexZCompatibility = true;
481  if (abs(d0PV) < d0Cut) primaryVertexD0Compatibility = true;
482  }
483  LogTrace("TrackSelection") << "distances " << dzPV << " " << d0PV << " vs " << dzCut << " " << d0Cut;
484  }
485 
486  if (points.empty() && applyAbsCutsIfNoPV_[tsNum]) {
487  if ( abs(dz) > max_z0NoPV_[tsNum] || abs(d0) > max_d0NoPV_[tsNum]) return false;
488  } else {
489  // Absolute cuts on all tracks impact parameters with respect to beam-spot.
490  // If BS is not compatible, verify if at least the reco-vertex is compatible (useful for incorrect BS settings)
491  if (abs(d0) > max_d0_[tsNum] && !primaryVertexD0Compatibility) return false;
492  LogTrace("TrackSelection") << "absolute cuts on d0 passed";
493  if (abs(dz) > max_z0_[tsNum] && !primaryVertexZCompatibility) return false;
494  LogTrace("TrackSelection") << "absolute cuts on dz passed";
495  }
496 
497  LogTrace("TrackSelection") << "cuts on PV: apply adapted PV cuts? " << applyAdaptedPVCuts_[tsNum]
498  << " d0 compatibility? " << primaryVertexD0Compatibility
499  << " z compatibility? " << primaryVertexZCompatibility ;
500 
501  if (applyAdaptedPVCuts_[tsNum]) {
502  return (primaryVertexD0Compatibility && primaryVertexZCompatibility);
503  } else {
504  return true;
505  }
506 
507 }
#define LogDebug(id)
std::vector< double > chi2n_no1Dmod_par_
std::vector< uint32_t > min_nhits_
std::vector< double > chi2n_par_
virtual int dimension() const =0
std::vector< std::vector< double > > d0_par1_
std::vector< double > max_d0NoPV_
double d0Error() const
error on d0
Definition: TrackBase.h:755
std::vector< double > max_z0_
std::vector< uint32_t > min_layers_
Cuts on numbers of layers with hits/3D hits/lost hits.
std::vector< double > max_z0NoPV_
const TrackExtraRef & extra() const
reference to &quot;extra&quot; object
Definition: Track.h:189
std::vector< bool > useMVA_
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
Definition: TrackBase.h:514
size_t recHitsSize() const
Get number of RecHits. (Warning, this includes invalid hits, which are not physical hits)...
Definition: Track.h:119
std::vector< uint32_t > min_hits_bypass_
std::vector< bool > applyAdaptedPVCuts_
unsigned short numberOfLostHits() const
number of cases where track crossed a layer without getting a hit.
Definition: TrackBase.h:779
std::vector< double > nSigmaZ_
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:458
T eta() const
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:477
std::vector< uint32_t > min_3Dlayers_
int numberOfLostTrackerHits(HitCategory category) const
Definition: HitPattern.h:809
std::vector< uint32_t > max_lostLayers_
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:604
int numberOfValidStripLayersWithMonoAndStereo(uint16_t stripdet, uint16_t layer) const
Definition: HitPattern.cc:300
std::vector< int32_t > max_lostHitFraction_
std::vector< double > min_eta_
double chi2() const
chi-squared of the fit
Definition: TrackBase.h:502
double ndof() const
number of degrees of freedom of the fit
Definition: TrackBase.h:508
T sqrt(T t)
Definition: SSEVec.h:48
double pt() const
track transverse momentum
Definition: TrackBase.h:574
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
Definition: TrackBase.h:716
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< std::vector< double > > dz_par1_
double f[11][100]
unsigned short numberOfValidHits() const
number of valid hits found
Definition: TrackBase.h:773
#define end
Definition: vmac.h:37
std::vector< std::vector< double > > dz_par2_
std::vector< std::vector< double > > res_par_
T min(T a, T b)
Definition: MathUtil.h:58
#define LogTrace(id)
std::vector< double > max_relpterr_
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Definition: TrackBase.h:562
double dzError() const
error on dz
Definition: TrackBase.h:767
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:411
double sigmaZ() const
sigma z
Definition: BeamSpot.h:80
int trackerLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.cc:494
std::vector< bool > applyAbsCutsIfNoPV_
const Point & position() const
position
Definition: BeamSpot.h:62
std::vector< int32_t > max_minMissHitOutOrIn_
std::vector< double > min_MVA_
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Definition: TrackBase.h:544
std::vector< std::vector< double > > d0_par2_
std::vector< double > max_d0_
Impact parameter absolute cuts.
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
std::vector< double > max_eta_
void MultiTrackSelector::selectVertices ( unsigned int  tsNum,
const reco::VertexCollection vtxs,
std::vector< Point > &  points,
std::vector< float > &  vterr,
std::vector< float > &  vzerr 
) const
protected

Definition at line 509 of file MultiTrackSelector.cc.

References LogDebug, LogTrace, dt_dqm_sourceclient_common_cff::reco, mathSSE::sqrt(), vertexCut_, and vtxNumber_.

Referenced by AnalyticalTrackSelector::run(), and run().

513  {
514  // Select good primary vertices
515  using namespace reco;
516  int32_t toTake = vtxNumber_[tsNum];
517  for (VertexCollection::const_iterator it = vtxs.begin(), ed = vtxs.end(); it != ed; ++it) {
518 
519  LogDebug("SelectVertex") << " select vertex with z position " << it->z() << " "
520  << it->chi2() << " " << it->ndof() << " " << TMath::Prob(it->chi2(), static_cast<int32_t>(it->ndof()));
521  Vertex vtx = *it;
522  bool pass = vertexCut_[tsNum]( vtx );
523  if( pass ) {
524  points.push_back(it->position());
525  vterr.push_back(sqrt(it->yError()*it->xError()));
526  vzerr.push_back(it->zError());
527  LogTrace("SelectVertex") << " SELECTED vertex with z position " << it->z();
528  toTake--; if (toTake == 0) break;
529  }
530  }
531 }
#define LogDebug(id)
T sqrt(T t)
Definition: SSEVec.h:48
#define LogTrace(id)
std::vector< int32_t > vtxNumber_
vertex cuts
std::vector< StringCutObjectSelector< reco::Vertex > > vertexCut_

Member Data Documentation

std::vector<bool> MultiTrackSelector::applyAbsCutsIfNoPV_
protected
std::vector<bool> MultiTrackSelector::applyAdaptedPVCuts_
protected
edm::EDGetTokenT<reco::BeamSpot> MultiTrackSelector::beamspot_
protected
std::vector< double > MultiTrackSelector::chi2n_no1Dmod_par_
protected
std::vector< double > MultiTrackSelector::chi2n_par_
protected
std::vector< std::vector<double> > MultiTrackSelector::d0_par1_
protected
std::vector< std::vector<double> > MultiTrackSelector::d0_par2_
protected
std::string MultiTrackSelector::dbFileName_
protected

Definition at line 149 of file MultiTrackSelector.h.

Referenced by beginStream(), and MultiTrackSelector().

std::vector< std::vector<double> > MultiTrackSelector::dz_par1_
protected
std::vector< std::vector<double> > MultiTrackSelector::dz_par2_
protected
GBRForest* MultiTrackSelector::forest_
protected
std::string MultiTrackSelector::forestLabel_
protected

Definition at line 146 of file MultiTrackSelector.h.

Referenced by beginStream(), MultiTrackSelector(), and processMVA().

edm::EDGetTokenT<TrackingRecHitCollection> MultiTrackSelector::hSrc_
protected
std::vector<bool> MultiTrackSelector::keepAllTracks_
protected
std::vector<double> MultiTrackSelector::max_d0_
protected

Impact parameter absolute cuts.

Definition at line 107 of file MultiTrackSelector.h.

Referenced by AnalyticalTrackSelector::AnalyticalTrackSelector(), MultiTrackSelector(), and select().

std::vector<double> MultiTrackSelector::max_d0NoPV_
protected
std::vector<double> MultiTrackSelector::max_eta_
protected
std::vector<int32_t> MultiTrackSelector::max_lostHitFraction_
protected
std::vector<uint32_t> MultiTrackSelector::max_lostLayers_
protected
std::vector<int32_t> MultiTrackSelector::max_minMissHitOutOrIn_
protected
std::vector<double> MultiTrackSelector::max_relpterr_
protected
std::vector<double> MultiTrackSelector::max_z0_
protected
std::vector<double> MultiTrackSelector::max_z0NoPV_
protected
std::vector<uint32_t> MultiTrackSelector::min_3Dlayers_
protected
std::vector<double> MultiTrackSelector::min_eta_
protected
std::vector<uint32_t> MultiTrackSelector::min_hits_bypass_
protected
std::vector<uint32_t> MultiTrackSelector::min_layers_
protected

Cuts on numbers of layers with hits/3D hits/lost hits.

Definition at line 112 of file MultiTrackSelector.h.

Referenced by AnalyticalTrackSelector::AnalyticalTrackSelector(), MultiTrackSelector(), and select().

std::vector<double> MultiTrackSelector::min_MVA_
protected

Definition at line 142 of file MultiTrackSelector.h.

Referenced by MultiTrackSelector(), and select().

std::vector<uint32_t> MultiTrackSelector::min_nhits_
protected
std::string MultiTrackSelector::mvaType_
protected

Definition at line 145 of file MultiTrackSelector.h.

Referenced by MultiTrackSelector().

std::vector<std::string> MultiTrackSelector::name_
protected

Definition at line 136 of file MultiTrackSelector.h.

Referenced by MultiTrackSelector(), and run().

std::vector<double> MultiTrackSelector::nSigmaZ_
protected
std::vector<unsigned int> MultiTrackSelector::preFilter_
protected
std::vector<reco::TrackBase::TrackQuality> MultiTrackSelector::qualityToSet_
protected
std::vector< std::vector<double> > MultiTrackSelector::res_par_
protected
std::vector<bool> MultiTrackSelector::setQualityBit_
protected

do I have to set a quality bit?

Definition at line 87 of file MultiTrackSelector.h.

Referenced by AnalyticalTrackSelector::AnalyticalTrackSelector(), MultiTrackSelector(), AnalyticalTrackSelector::run(), and run().

edm::EDGetTokenT<reco::TrackCollection> MultiTrackSelector::src_
protected

source collection label

Definition at line 78 of file MultiTrackSelector.h.

Referenced by AnalyticalTrackSelector::AnalyticalTrackSelector(), processMVA(), AnalyticalTrackSelector::run(), and run().

bool MultiTrackSelector::useAnyMVA_
protected
bool MultiTrackSelector::useForestFromDB_
protected

Definition at line 148 of file MultiTrackSelector.h.

Referenced by beginStream(), MultiTrackSelector(), and processMVA().

std::vector<bool> MultiTrackSelector::useMVA_
protected

Definition at line 139 of file MultiTrackSelector.h.

Referenced by MultiTrackSelector(), and select().

bool MultiTrackSelector::useVertices_
protected
bool MultiTrackSelector::useVtxError_
protected
std::vector<StringCutObjectSelector<reco::Vertex> > MultiTrackSelector::vertexCut_
protected
edm::EDGetTokenT<reco::VertexCollection> MultiTrackSelector::vertices_
protected
std::vector<int32_t> MultiTrackSelector::vtxNumber_
protected