CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes
TrackMultiSelector Class Reference
Inheritance diagram for TrackMultiSelector:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  Block
 

Public Member Functions

 TrackMultiSelector (const edm::ParameterSet &cfg)
 constructor More...
 
virtual ~TrackMultiSelector ()
 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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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 ()
 

Private Types

typedef math::XYZPoint Point
 

Private Member Functions

void produce (edm::Event &evt, const edm::EventSetup &es) override
 process one event More...
 
short select (const reco::Track &tk, const reco::BeamSpot &beamSpot, const std::vector< Point > &points)
 return class, or -1 if rejected More...
 
void selectVertices (const reco::VertexCollection &vtxs, std::vector< Point > &points)
 
bool testVtx (const reco::Track &tk, const reco::BeamSpot &beamSpot, const std::vector< Point > &points, const Block &cut)
 

Private Attributes

edm::EDGetTokenT< reco::BeamSpotbeamspot_
 
double beamspotD0_
 
double beamspotDZsigmas_
 
std::vector< Blockblocks_
 filter psets More...
 
bool copyExtras_
 copy only the tracks, not extras and rechits (for AOD) More...
 
bool copyTrajectories_
 copy also trajectories and trajectory->track associations More...
 
std::vector< std::string > labels_
 output labels More...
 
std::vector
< TrackingRecHitRefProd
rHits_
 
std::vector
< reco::TrackExtraRefProd
rTrackExtras_
 
std::vector< reco::TrackRefProdrTracks_
 
std::vector< edm::RefProd
< std::vector< Trajectory > > > 
rTrajectories_
 
std::auto_ptr
< TrackingRecHitCollection > * 
selHits_
 
std::auto_ptr
< reco::TrackExtraCollection > * 
selTrackExtras_
 
std::auto_ptr
< reco::TrackCollection > * 
selTracks_
 some storage More...
 
std::auto_ptr< std::vector
< Trajectory > > * 
selTrajs_
 
std::auto_ptr
< TrajTrackAssociationCollection > * 
selTTAss_
 
bool splitOutputs_
 split selections in more sets More...
 
edm::InputTag src_
 source collection label More...
 
edm::EDGetTokenT
< reco::TrackCollection
tokenTracks
 
edm::EDGetTokenT< std::vector
< Trajectory > > 
tokenTraj
 
edm::EDGetTokenT
< TrajTrackAssociationCollection
tokenTrajTrack
 
edm::EDGetTokenT
< reco::VertexCollection
vertices_
 
double vtxChi2Prob_
 
int32_t vtxNumber_
 vertex cuts More...
 
size_t vtxTracks_
 
std::vector< std::pair< short,
reco::TrackRef > > 
whereItWent_
 

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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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)
 

Detailed Description

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

Author
Giovanni Petrucciani

Definition at line 32 of file TrackMultiSelector.cc.

Member Typedef Documentation

Definition at line 51 of file TrackMultiSelector.cc.

Constructor & Destructor Documentation

TrackMultiSelector::TrackMultiSelector ( const edm::ParameterSet cfg)
explicit

constructor

Definition at line 124 of file TrackMultiSelector.cc.

References HLT_FULL_cff::alias, beamspot_, beamspotD0_, beamspotDZsigmas_, blocks_, copyExtras_, copyTrajectories_, edm::ParameterSet::getParameter(), i, cmsLHEtoEOSManager::l, labels_, rHits_, rTrackExtras_, rTracks_, rTrajectories_, selHits_, selTrackExtras_, selTracks_, selTrajs_, selTTAss_, splitOutputs_, src_, AlCaHLTBitMon_QueryRunRegistry::string, tokenTracks, tokenTraj, tokenTrajTrack, and vertices_.

124  :
125  src_( cfg.getParameter<edm::InputTag>( "src" ) ),
126  copyExtras_(cfg.getUntrackedParameter<bool>("copyExtras", false)),
127  copyTrajectories_(cfg.getUntrackedParameter<bool>("copyTrajectories", false)),
128  splitOutputs_( cfg.getUntrackedParameter<bool>("splitOutputs", false) ),
129  vtxNumber_( cfg.getParameter<int32_t>("vtxNumber") ),
130  vtxTracks_( cfg.getParameter<uint32_t>("vtxTracks") ),
131  vtxChi2Prob_( cfg.getParameter<double>("vtxChi2Prob") )
132 {
133  edm::ParameterSet beamSpotPSet = cfg.getParameter<edm::ParameterSet>("beamspot");
134  beamspot_ = consumes<reco::BeamSpot>(beamSpotPSet.getParameter<edm::InputTag>("src"));
135  beamspotDZsigmas_ = beamSpotPSet.getParameter<double>("dzSigmas");
136  beamspotD0_ = beamSpotPSet.getParameter<double>("d0");
137  vertices_= consumes<reco::VertexCollection>( cfg.getParameter<edm::InputTag>( "vertices" ) );
138  tokenTracks= consumes<reco::TrackCollection>(src_);
139  if (copyTrajectories_) {
140  tokenTraj= consumes<std::vector<Trajectory> >(src_);
141  tokenTrajTrack= consumes<TrajTrackAssociationCollection>(src_);
142  }
143 
144  typedef std::vector<edm::ParameterSet> VPSet;
145  VPSet psets = cfg.getParameter<VPSet>("cutSets");
146  blocks_.reserve(psets.size());
147  for (VPSet::const_iterator it = psets.begin(), ed = psets.end(); it != ed; ++it) {
148  blocks_.push_back(TrackMultiSelector::Block(*it));
149  }
150 
151  if (splitOutputs_) {
152  char buff[15];
153  for (size_t i = 0; i < blocks_.size(); ++i) {
154  sprintf(buff,"set%d", static_cast<int>(i+1));
155  labels_.push_back(std::string(buff));
156  }
157  } else {
158  labels_.push_back(std::string(""));
159  }
160 
161  std::string alias( cfg.getParameter<std::string>( "@module_label" ) );
162  for (std::vector<std::string>::const_iterator li = labels_.begin(), le = labels_.end(); li != le; ++li) {
163  const char *l= li->c_str();
164  produces<reco::TrackCollection>(l).setBranchAlias( alias + "Tracks" + l);
165  if (copyExtras_) {
166  produces<reco::TrackExtraCollection>(l).setBranchAlias( alias + "TrackExtras" + l);
167  produces<TrackingRecHitCollection>(l).setBranchAlias( alias + "RecHits" + l);
168  if (copyTrajectories_) {
169  produces< std::vector<Trajectory> >(l).setBranchAlias( alias + "Trajectories" + l);
170  produces< TrajTrackAssociationCollection >(l).setBranchAlias( alias + "TrajectoryTrackAssociations" + l);
171  }
172  }
173  }
174 
175  size_t nblocks = splitOutputs_ ? blocks_.size() : 1;
176  selTracks_ = new std::auto_ptr<reco::TrackCollection>[nblocks];
177  selTrackExtras_ = new std::auto_ptr<reco::TrackExtraCollection>[nblocks];
178  selHits_ = new std::auto_ptr<TrackingRecHitCollection>[nblocks];
179  selTrajs_ = new std::auto_ptr< std::vector<Trajectory> >[nblocks];
180  selTTAss_ = new std::auto_ptr< TrajTrackAssociationCollection >[nblocks];
181  rTracks_ = std::vector<reco::TrackRefProd>(nblocks);
182  rHits_ = std::vector<TrackingRecHitRefProd>(nblocks);
183  rTrackExtras_ = std::vector<reco::TrackExtraRefProd>(nblocks);
184  rTrajectories_ = std::vector< edm::RefProd< std::vector<Trajectory> > >(nblocks);
185  for (size_t i = 0; i < nblocks; i++) {
186  selTracks_[i] = std::auto_ptr<reco::TrackCollection>(new reco::TrackCollection());
187  selTrackExtras_[i] = std::auto_ptr<reco::TrackExtraCollection>(new reco::TrackExtraCollection());
188  selHits_[i] = std::auto_ptr<TrackingRecHitCollection>(new TrackingRecHitCollection());
189  selTrajs_[i] = std::auto_ptr< std::vector<Trajectory> >(new std::vector<Trajectory>());
190  selTTAss_[i] = std::auto_ptr< TrajTrackAssociationCollection >(new TrajTrackAssociationCollection());
191  }
192 
193 }
std::auto_ptr< reco::TrackCollection > * selTracks_
some storage
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< std::vector< Trajectory > > tokenTraj
int32_t vtxNumber_
vertex cuts
bool copyExtras_
copy only the tracks, not extras and rechits (for AOD)
std::vector< reco::TrackExtraRefProd > rTrackExtras_
edm::InputTag src_
source collection label
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
std::auto_ptr< TrackingRecHitCollection > * selHits_
edm::EDGetTokenT< TrajTrackAssociationCollection > tokenTrajTrack
std::vector< edm::RefProd< std::vector< Trajectory > > > rTrajectories_
std::vector< reco::TrackRefProd > rTracks_
std::auto_ptr< TrajTrackAssociationCollection > * selTTAss_
edm::EDGetTokenT< reco::VertexCollection > vertices_
bool copyTrajectories_
copy also trajectories and trajectory-&gt;track associations
std::vector< std::string > labels_
output labels
std::vector< Block > blocks_
filter psets
edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > > TrajTrackAssociationCollection
edm::EDGetTokenT< reco::TrackCollection > tokenTracks
std::vector< TrackingRecHitRefProd > rHits_
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:11
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
bool splitOutputs_
split selections in more sets
std::auto_ptr< std::vector< Trajectory > > * selTrajs_
std::auto_ptr< reco::TrackExtraCollection > * selTrackExtras_
edm::EDGetTokenT< reco::BeamSpot > beamspot_
TrackMultiSelector::~TrackMultiSelector ( )
virtual

destructor

Definition at line 195 of file TrackMultiSelector.cc.

References selHits_, selTrackExtras_, selTracks_, selTrajs_, and selTTAss_.

195  {
196  delete [] selTracks_;
197  delete [] selTrackExtras_;
198  delete [] selHits_;
199  delete [] selTrajs_;
200  delete [] selTTAss_;
201 }
std::auto_ptr< reco::TrackCollection > * selTracks_
some storage
std::auto_ptr< TrackingRecHitCollection > * selHits_
std::auto_ptr< TrajTrackAssociationCollection > * selTTAss_
std::auto_ptr< std::vector< Trajectory > > * selTrajs_
std::auto_ptr< reco::TrackExtraCollection > * selTrackExtras_

Member Function Documentation

void TrackMultiSelector::produce ( edm::Event evt,
const edm::EventSetup es 
)
overrideprivatevirtual

process one event

Implements edm::stream::EDProducerBase.

Definition at line 203 of file TrackMultiSelector.cc.

References beamspot_, blocks_, edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, copyExtras_, copyTrajectories_, edm::friendlyname::emptyString(), plotBeamSpotDB::first, edm::Event::getByToken(), edm::Event::getRefBeforePut(), i, reco::Track::innerDetId(), reco::Track::innerMomentum(), reco::Track::innerOk(), reco::Track::innerPosition(), reco::Track::innerStateCovariance(), edm::Ref< C, T, F >::key(), labels_, match(), gen::n, reco::Track::outerDetId(), reco::Track::outerMomentum(), reco::Track::outerOk(), reco::Track::outerPosition(), reco::Track::outerStateCovariance(), edm::Event::put(), reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), dt_dqm_sourceclient_common_cff::reco, reco::Track::residuals(), rHits_, rTrackExtras_, rTracks_, rTrajectories_, edm::second(), reco::Track::seedDirection(), reco::Track::seedRef(), select(), selectVertices(), selHits_, selTrackExtras_, selTracks_, selTrajs_, selTTAss_, reco::TrackExtraBase::setHits(), reco::TrackExtra::setResiduals(), findQualityFiles::size, splitOutputs_, AlCaHLTBitMon_QueryRunRegistry::string, tokenTracks, tokenTraj, tokenTrajTrack, vertices_, vtxNumber_, and whereItWent_.

204 {
205  using namespace std;
206  using namespace edm;
207  using namespace reco;
208 
209  size_t nblocks = splitOutputs_ ? blocks_.size() : 1;
210 
211  Handle<TrackCollection> hSrcTrack;
214 
216  evt.getByToken(vertices_, hVtx);
217  std::vector<Point> points;
218  if (vtxNumber_ != 0) selectVertices(*hVtx, points);
219 
221  evt.getByToken(beamspot_, hBsp);
222 
223  evt.getByToken( tokenTracks, hSrcTrack );
224 
225  for (size_t i = 0; i < nblocks; i++) {
226  selTracks_[i] = auto_ptr<TrackCollection>(new TrackCollection());
228  if (copyExtras_) {
229  selTrackExtras_[i] = auto_ptr<TrackExtraCollection>(new TrackExtraCollection());
230  selHits_[i] = auto_ptr<TrackingRecHitCollection>(new TrackingRecHitCollection());
233  }
234  }
235 
236  if (copyTrajectories_) whereItWent_.resize(hSrcTrack->size());
237  size_t current = 0;
238  for (TrackCollection::const_iterator it = hSrcTrack->begin(), ed = hSrcTrack->end(); it != ed; ++it, ++current) {
239  const Track & trk = * it;
240  short where = select(trk, *hBsp, points);
241  if (where == -1) {
242  if (copyTrajectories_) whereItWent_[current] = std::pair<short, reco::TrackRef>(-1, reco::TrackRef());
243  continue;
244  }
245  if (!splitOutputs_) where = 0;
246  selTracks_[where]->push_back( Track( trk ) ); // clone and store
247  if (!copyExtras_) continue;
248 
249  // TrackExtras
250  selTrackExtras_[where]->push_back( TrackExtra( trk.outerPosition(), trk.outerMomentum(), trk.outerOk(),
251  trk.innerPosition(), trk.innerMomentum(), trk.innerOk(),
252  trk.outerStateCovariance(), trk.outerDetId(),
253  trk.innerStateCovariance(), trk.innerDetId(),
254  trk.seedDirection(), trk.seedRef() ) );
255  selTracks_[where]->back().setExtra( TrackExtraRef( rTrackExtras_[where], selTrackExtras_[where]->size() - 1) );
256  TrackExtra & tx = selTrackExtras_[where]->back();
257  tx.setResiduals(trk.residuals());
258  // TrackingRecHits
259  auto& selHitsWhere = selHits_[where];
260  auto const firstHitIndex = selHitsWhere->size();
261  for( trackingRecHit_iterator hit = trk.recHitsBegin(); hit != trk.recHitsEnd(); ++ hit ) {
262  selHitsWhere->push_back( (*hit)->clone() );
263  }
264  tx.setHits( rHits_[where], firstHitIndex, selHitsWhere->size() - firstHitIndex);
265 
266  if (copyTrajectories_) {
267  whereItWent_[current] = std::pair<short, reco::TrackRef>(where, TrackRef(rTracks_[where], selTracks_[where]->size() - 1));
268  }
269  }
270  if ( copyTrajectories_ ) {
273  evt.getByToken(tokenTrajTrack, hTTAss);
274  evt.getByToken(tokenTraj, hTraj);
275  for (size_t i = 0; i < nblocks; i++) {
276  rTrajectories_[i] = evt.getRefBeforePut< vector<Trajectory> >(labels_[i]);
277  selTrajs_[i] = auto_ptr< vector<Trajectory> >(new vector<Trajectory>());
278  selTTAss_[i] = auto_ptr< TrajTrackAssociationCollection >(new TrajTrackAssociationCollection());
279  }
280  for (size_t i = 0, n = hTraj->size(); i < n; ++i) {
281  Ref< vector<Trajectory> > trajRef(hTraj, i);
283  if (match != hTTAss->end()) {
284  const Ref<TrackCollection> &trkRef = match->val;
285  short oldKey = static_cast<short>(trkRef.key());
286  if (whereItWent_[oldKey].first != -1) {
287  int where = whereItWent_[oldKey].first;
288  selTrajs_[where]->push_back( Trajectory(*trajRef) );
289  selTTAss_[where]->insert ( Ref< vector<Trajectory> >(rTrajectories_[where], selTrajs_[where]->size() - 1), whereItWent_[oldKey].second );
290  }
291  }
292  }
293  }
294 
295 
296  static const std::string emptyString;
297  for (size_t i = 0; i < nblocks; i++) {
298  const std::string & lbl = ( splitOutputs_ ? labels_[i] : emptyString);
299  evt.put(selTracks_[i], lbl);
300  if (copyExtras_ ) {
301  evt.put(selTrackExtras_[i], lbl);
302  evt.put(selHits_[i], lbl);
303  if ( copyTrajectories_ ) {
304  evt.put(selTrajs_[i], lbl);
305  evt.put(selTTAss_[i], lbl);
306  }
307  }
308  }
309 }
std::auto_ptr< reco::TrackCollection > * selTracks_
some storage
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< std::vector< Trajectory > > tokenTraj
int32_t vtxNumber_
vertex cuts
bool copyExtras_
copy only the tracks, not extras and rechits (for AOD)
std::vector< reco::TrackExtraRefProd > rTrackExtras_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
void setHits(TrackingRecHitRefProd const &prod, unsigned firstH, unsigned int nH)
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
std::auto_ptr< TrackingRecHitCollection > * selHits_
bool innerOk() const
return true if the innermost hit is valid
Definition: Track.h:50
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
Definition: TrackExtraFwd.h:17
key_type key() const
Accessor for product key.
Definition: Ref.h:264
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:65
short select(const reco::Track &tk, const reco::BeamSpot &beamSpot, const std::vector< Point > &points)
return class, or -1 if rejected
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:55
U second(std::pair< T, U > const &p)
edm::EDGetTokenT< TrajTrackAssociationCollection > tokenTrajTrack
std::vector< edm::RefProd< std::vector< Trajectory > > > rTrajectories_
std::vector< reco::TrackRefProd > rTracks_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
std::auto_ptr< TrajTrackAssociationCollection > * selTTAss_
CovarianceMatrix outerStateCovariance() const
outermost trajectory state curvilinear errors
Definition: Track.h:75
edm::EDGetTokenT< reco::VertexCollection > vertices_
std::vector< std::pair< short, reco::TrackRef > > whereItWent_
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
Definition: Track.h:94
bool copyTrajectories_
copy also trajectories and trajectory-&gt;track associations
std::vector< std::string > labels_
output labels
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:104
std::vector< Block > blocks_
filter psets
edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > > TrajTrackAssociationCollection
edm::EDGetTokenT< reco::TrackCollection > tokenTracks
RefProd< PROD > getRefBeforePut()
Definition: Event.h:141
std::vector< TrackingRecHitRefProd > rHits_
void selectVertices(const reco::VertexCollection &vtxs, std::vector< Point > &points)
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:11
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
edm::RefToBase< TrajectorySeed > seedRef() const
Definition: Track.h:213
bool splitOutputs_
split selections in more sets
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
Definition: Track.h:70
bool outerOk() const
return true if the outermost hit is valid
Definition: Track.h:45
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
CovarianceMatrix innerStateCovariance() const
innermost trajectory state curvilinear errors
Definition: Track.h:80
std::auto_ptr< std::vector< Trajectory > > * selTrajs_
static std::string const emptyString("")
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
Definition: Track.h:60
const TrackResiduals & residuals() const
Definition: Track.h:220
PropagationDirection seedDirection() const
direction of how the hits were sorted in the original seed
Definition: Track.h:204
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
std::auto_ptr< reco::TrackExtraCollection > * selTrackExtras_
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
Definition: Track.h:99
tuple size
Write out results.
edm::EDGetTokenT< reco::BeamSpot > beamspot_
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:109
void setResiduals(const TrackResiduals &r)
set the residuals
Definition: TrackExtra.h:179
short TrackMultiSelector::select ( const reco::Track tk,
const reco::BeamSpot beamSpot,
const std::vector< Point > &  points 
)
private

return class, or -1 if rejected

Definition at line 329 of file TrackMultiSelector.cc.

References blocks_, chi2n, reco::TrackBase::hitPattern(), reco::TrackBase::normalizedChi2(), reco::TrackBase::numberOfLostHits(), EnergyCorrector::pt, reco::TrackBase::pt(), testVtx(), reco::HitPattern::trackerLayersWithMeasurement(), and eostools::which().

Referenced by produce().

329  {
330  uint32_t vlayers = tk.hitPattern().trackerLayersWithMeasurement(), lhits = tk.numberOfLostHits();
331  double pt = tk.pt(), chi2n = tk.normalizedChi2();
332  int which = 0;
333  for (std::vector<TrackMultiSelector::Block>::const_iterator itb = blocks_.begin(), edb = blocks_.end(); itb != edb; ++itb, ++which) {
334  if ( ( itb->vlayers.first <= vlayers ) && ( vlayers <= itb->vlayers.second ) &&
335  ( itb->chi2n.first <= chi2n ) && ( chi2n <= itb->chi2n.second ) &&
336  ( itb->pt.first <= pt ) && ( pt <= itb->pt.second ) &&
337  ( itb->lhits.first <= lhits ) && ( lhits <= itb->lhits.second ) &&
338  testVtx(tk, beamSpot, points, *itb) )
339  {
340  return which;
341  }
342  }
343  return -1;
344 }
def which
Definition: eostools.py:335
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:556
bool testVtx(const reco::Track &tk, const reco::BeamSpot &beamSpot, const std::vector< Point > &points, const Block &cut)
unsigned short numberOfLostHits() const
number of cases where track crossed a layer without getting a hit.
Definition: TrackBase.h:821
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:527
double pt() const
track transverse momentum
Definition: TrackBase.h:616
std::vector< Block > blocks_
filter psets
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:445
void TrackMultiSelector::selectVertices ( const reco::VertexCollection vtxs,
std::vector< Point > &  points 
)
private

Definition at line 345 of file TrackMultiSelector.cc.

References dt_dqm_sourceclient_common_cff::reco, vtxChi2Prob_, vtxNumber_, and vtxTracks_.

Referenced by produce().

345  {
346  using namespace reco;
347 
348  int32_t toTake = vtxNumber_;
349  for (VertexCollection::const_iterator it = vtxs.begin(), ed = vtxs.end(); it != ed; ++it) {
350  if ((it->tracksSize() >= vtxTracks_) &&
351  ( (it->chi2() == 0.0) || (TMath::Prob(it->chi2(), static_cast<int32_t>(it->ndof()) ) >= vtxChi2Prob_) ) ) {
352  points.push_back(it->position());
353  toTake--; if (toTake == 0) break;
354  }
355  }
356 }
int32_t vtxNumber_
vertex cuts
bool TrackMultiSelector::testVtx ( const reco::Track tk,
const reco::BeamSpot beamSpot,
const std::vector< Point > &  points,
const Block cut 
)
inlineprivate

Definition at line 311 of file TrackMultiSelector.cc.

References funct::abs(), beamspotD0_, beamspotDZsigmas_, TrackMultiSelector::Block::d0, reco::TrackBase::d0Error(), TrackMultiSelector::Block::d0Rel, reco::TrackBase::dxy(), TrackMultiSelector::Block::dz, reco::TrackBase::dz(), reco::TrackBase::dzError(), TrackMultiSelector::Block::dzRel, alignCSCRings::e, end, bookConverter::max, point, reco::BeamSpot::position(), and reco::BeamSpot::sigmaZ().

Referenced by select().

313  {
314  using std::abs;
315  double d0Err =abs(tk.d0Error()), dzErr = abs(tk.dzError()); // not fully sure they're > 0!
316  if (points.empty()) {
317  Point spot = beamSpot.position();
318  double dz = abs(tk.dz(spot)), d0 = abs(tk.dxy(spot));
319  return ( dz < beamspotDZsigmas_*beamSpot.sigmaZ() ) && ( d0 < beamspotD0_ );
320  }
321  for (std::vector<Point>::const_iterator point = points.begin(), end = points.end(); point != end; ++point) {
322  double dz = abs(tk.dz(*point)), d0 = abs(tk.dxy(*point));
323  if ((dz < cut.dz) && (d0 < cut.d0)
324  && fabs(dz/std::max(dzErr,1e-9)) < cut.dzRel && (d0/std::max(d0Err,1e-8) < cut.d0Rel )) return true;
325  }
326  return false;
327 }
double d0Error() const
error on d0
Definition: TrackBase.h:797
math::XYZPoint Point
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define end
Definition: vmac.h:37
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:604
double dzError() const
error on dz
Definition: TrackBase.h:809
double sigmaZ() const
sigma z
Definition: BeamSpot.h:80
const Point & position() const
position
Definition: BeamSpot.h:62
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:586
*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

Member Data Documentation

edm::EDGetTokenT<reco::BeamSpot> TrackMultiSelector::beamspot_
private

Definition at line 62 of file TrackMultiSelector.cc.

Referenced by produce(), and TrackMultiSelector().

double TrackMultiSelector::beamspotD0_
private

Definition at line 67 of file TrackMultiSelector.cc.

Referenced by testVtx(), and TrackMultiSelector().

double TrackMultiSelector::beamspotDZsigmas_
private

Definition at line 67 of file TrackMultiSelector.cc.

Referenced by testVtx(), and TrackMultiSelector().

std::vector<Block> TrackMultiSelector::blocks_
private

filter psets

Definition at line 75 of file TrackMultiSelector.cc.

Referenced by produce(), select(), and TrackMultiSelector().

bool TrackMultiSelector::copyExtras_
private

copy only the tracks, not extras and rechits (for AOD)

Definition at line 69 of file TrackMultiSelector.cc.

Referenced by produce(), and TrackMultiSelector().

bool TrackMultiSelector::copyTrajectories_
private

copy also trajectories and trajectory->track associations

Definition at line 71 of file TrackMultiSelector.cc.

Referenced by produce(), and TrackMultiSelector().

std::vector<std::string> TrackMultiSelector::labels_
private

output labels

Definition at line 81 of file TrackMultiSelector.cc.

Referenced by produce(), and TrackMultiSelector().

std::vector<TrackingRecHitRefProd> TrackMultiSelector::rHits_
private

Definition at line 90 of file TrackMultiSelector.cc.

Referenced by produce(), and TrackMultiSelector().

std::vector<reco::TrackExtraRefProd> TrackMultiSelector::rTrackExtras_
private

Definition at line 89 of file TrackMultiSelector.cc.

Referenced by produce(), and TrackMultiSelector().

std::vector<reco::TrackRefProd> TrackMultiSelector::rTracks_
private

Definition at line 88 of file TrackMultiSelector.cc.

Referenced by produce(), and TrackMultiSelector().

std::vector< edm::RefProd< std::vector<Trajectory> > > TrackMultiSelector::rTrajectories_
private

Definition at line 91 of file TrackMultiSelector.cc.

Referenced by produce(), and TrackMultiSelector().

std::auto_ptr< TrackingRecHitCollection>* TrackMultiSelector::selHits_
private

Definition at line 85 of file TrackMultiSelector.cc.

Referenced by produce(), TrackMultiSelector(), and ~TrackMultiSelector().

std::auto_ptr<reco::TrackExtraCollection>* TrackMultiSelector::selTrackExtras_
private

Definition at line 84 of file TrackMultiSelector.cc.

Referenced by produce(), TrackMultiSelector(), and ~TrackMultiSelector().

std::auto_ptr<reco::TrackCollection>* TrackMultiSelector::selTracks_
private

some storage

Definition at line 83 of file TrackMultiSelector.cc.

Referenced by produce(), TrackMultiSelector(), and ~TrackMultiSelector().

std::auto_ptr< std::vector<Trajectory> >* TrackMultiSelector::selTrajs_
private

Definition at line 86 of file TrackMultiSelector.cc.

Referenced by produce(), TrackMultiSelector(), and ~TrackMultiSelector().

std::auto_ptr< TrajTrackAssociationCollection >* TrackMultiSelector::selTTAss_
private

Definition at line 87 of file TrackMultiSelector.cc.

Referenced by produce(), TrackMultiSelector(), and ~TrackMultiSelector().

bool TrackMultiSelector::splitOutputs_
private

split selections in more sets

Definition at line 73 of file TrackMultiSelector.cc.

Referenced by produce(), and TrackMultiSelector().

edm::InputTag TrackMultiSelector::src_
private

source collection label

Definition at line 60 of file TrackMultiSelector.cc.

Referenced by TrackMultiSelector().

edm::EDGetTokenT<reco::TrackCollection> TrackMultiSelector::tokenTracks
private

Definition at line 63 of file TrackMultiSelector.cc.

Referenced by produce(), and TrackMultiSelector().

edm::EDGetTokenT<std::vector<Trajectory> > TrackMultiSelector::tokenTraj
private

Definition at line 64 of file TrackMultiSelector.cc.

Referenced by produce(), and TrackMultiSelector().

edm::EDGetTokenT<TrajTrackAssociationCollection> TrackMultiSelector::tokenTrajTrack
private

Definition at line 65 of file TrackMultiSelector.cc.

Referenced by produce(), and TrackMultiSelector().

edm::EDGetTokenT<reco::VertexCollection> TrackMultiSelector::vertices_
private

Definition at line 61 of file TrackMultiSelector.cc.

Referenced by produce(), and TrackMultiSelector().

double TrackMultiSelector::vtxChi2Prob_
private

Definition at line 79 of file TrackMultiSelector.cc.

Referenced by selectVertices().

int32_t TrackMultiSelector::vtxNumber_
private

vertex cuts

Definition at line 77 of file TrackMultiSelector.cc.

Referenced by produce(), and selectVertices().

size_t TrackMultiSelector::vtxTracks_
private

Definition at line 78 of file TrackMultiSelector.cc.

Referenced by selectVertices().

std::vector< std::pair<short, reco::TrackRef> > TrackMultiSelector::whereItWent_
private

Definition at line 92 of file TrackMultiSelector.cc.

Referenced by produce().