35 std::pair<double,double>
pt;
36 std::pair<uint32_t,uint32_t>
vlayers, lhits;
85 std::unique_ptr<TrackingRecHitCollection> *
selHits_;
86 std::unique_ptr<std::vector<Trajectory>> *
selTrajs_;
87 std::unique_ptr<TrajTrackAssociationCollection> *
selTTAss_;
90 std::vector<TrackingRecHitRefProd>
rHits_;
100 typedef typename std::vector<T> Ts;
102 if (ret.size() != 2)
throw cms::Exception(
"Invalid configuration") <<
"Parameter '" << name <<
"' must be given as {min,max}";
103 return std::pair<T,T>(ret[0],ret[1]);
108 #include <Math/DistFunc.h> 113 pt(p2p<double>(cfg,
"pt")),
114 vlayers(p2p<uint32_t>(cfg,
"validLayers")),
115 lhits(p2p<uint32_t>(cfg,
"lostHits")),
116 chi2n(p2p<double>(cfg,
"chi2n")),
117 d0(cfg.getParameter<double>(
"d0")),
118 dz(cfg.getParameter<double>(
"dz")),
119 d0Rel(cfg.getParameter<double>(
"d0Rel")),
120 dzRel(cfg.getParameter<double>(
"dzRel"))
125 src_( cfg.getParameter<
edm::InputTag>(
"src" ) ),
129 vtxNumber_( cfg.getParameter<int32_t>(
"vtxNumber") ),
130 vtxTracks_( cfg.getParameter<uint32_t>(
"vtxTracks") ),
144 typedef std::vector<edm::ParameterSet>
VPSet;
147 for (VPSet::const_iterator it = psets.begin(), ed = psets.end(); it != ed; ++it) {
154 sprintf(buff,
"set%d", static_cast<int>(
i+1));
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);
166 produces<reco::TrackExtraCollection>(
l).setBranchAlias( alias +
"TrackExtras" + l);
167 produces<TrackingRecHitCollection>(
l).setBranchAlias( alias +
"RecHits" + l);
169 produces< std::vector<Trajectory> >(
l).setBranchAlias( alias +
"Trajectories" + l);
170 produces< TrajTrackAssociationCollection >(
l).setBranchAlias( alias +
"TrajectoryTrackAssociations" + l);
176 selTracks_ =
new std::unique_ptr<reco::TrackCollection>[nblocks];
177 selTrackExtras_ =
new std::unique_ptr<reco::TrackExtraCollection>[nblocks];
178 selHits_ =
new std::unique_ptr<TrackingRecHitCollection>[nblocks];
179 selTrajs_ =
new std::unique_ptr<std::vector<Trajectory> >[nblocks];
180 selTTAss_ =
new std::unique_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::make_unique<reco::TrackCollection>();
188 selHits_[
i] = std::make_unique<TrackingRecHitCollection>();
189 selTrajs_[
i] = std::make_unique<std::vector<Trajectory>>();
190 selTTAss_[
i] = std::make_unique<TrajTrackAssociationCollection>();
207 using namespace reco;
217 std::vector<Point>
points;
225 for (
size_t i = 0;
i < nblocks;
i++) {
226 selTracks_[
i] = std::make_unique<TrackCollection>();
230 selHits_[
i] = std::make_unique<TrackingRecHitCollection>();
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);
259 auto& selHitsWhere =
selHits_[where];
260 auto const firstHitIndex = selHitsWhere->size();
262 selHitsWhere->push_back( (*hit)->clone() );
264 tx.
setHits(
rHits_[where], firstHitIndex, selHitsWhere->size() - firstHitIndex);
275 for (
size_t i = 0;
i < nblocks;
i++) {
277 selTrajs_[
i] = std::make_unique<std::vector<Trajectory>>();
278 selTTAss_[
i] = std::make_unique<TrajTrackAssociationCollection>();
280 for (
size_t i = 0,
n = hTraj->size();
i <
n; ++
i) {
283 if (match != hTTAss->
end()) {
285 short oldKey =
static_cast<short>(trkRef.
key());
297 for (
size_t i = 0;
i < nblocks;
i++) {
312 const std::vector<Point> &
points,
316 if (points.empty()) {
321 for (std::vector<Point>::const_iterator
point = points.begin(),
end = points.end();
point !=
end; ++
point) {
323 if ((dz < cut.
dz) && (
d0 < cut.
d0)
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) )
346 using namespace reco;
349 for (VertexCollection::const_iterator it = vtxs.begin(), ed = vtxs.end(); it != ed; ++it) {
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;
const edm::RefToBase< TrajectorySeed > & seedRef() const
T getParameter(std::string const &) const
std::pair< double, double > pt
double d0Error() const
error on d0
edm::EDGetTokenT< std::vector< Trajectory > > tokenTraj
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
int32_t vtxNumber_
vertex cuts
bool copyExtras_
copy only the tracks, not extras and rechits (for AOD)
std::vector< reco::TrackExtraRefProd > rTrackExtras_
friend struct const_iterator
const_iterator end() const
last iterator over the map (read only)
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
edm::InputTag src_
source collection label
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool testVtx(const reco::Track &tk, const reco::BeamSpot &beamSpot, const std::vector< Point > &points, const Block &cut)
#define DEFINE_FWK_MODULE(type)
const_iterator find(const key_type &k) const
find element with specified reference key
std::vector< Track > TrackCollection
collection of Tracks
virtual ~TrackMultiSelector()
destructor
bool innerOk() const
return true if the innermost hit is valid
unsigned short numberOfLostHits() const
number of cases where track crossed a layer without getting a hit.
std::vector< Vertex > VertexCollection
collection of Vertex objects
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
std::pair< uint32_t, uint32_t > vlayers
key_type key() const
Accessor for product key.
std::unique_ptr< reco::TrackExtraCollection > * selTrackExtras_
const math::XYZPoint & outerPosition() const
position of the outermost hit
short select(const reco::Track &tk, const reco::BeamSpot &beamSpot, const std::vector< Point > &points)
return class, or -1 if rejected
int trackerLayersWithMeasurement() const
std::unique_ptr< reco::TrackCollection > * selTracks_
some storage
const math::XYZPoint & innerPosition() const
position of the innermost hit
U second(std::pair< T, U > const &p)
std::pair< T, T > p2p(const edm::ParameterSet &cfg, const std::string name)
std::unique_ptr< TrackingRecHitCollection > * selHits_
edm::EDGetTokenT< TrajTrackAssociationCollection > tokenTrajTrack
std::vector< edm::RefProd< std::vector< Trajectory > > > rTrajectories_
std::vector< reco::TrackRefProd > rTracks_
CovarianceMatrix outerStateCovariance() const
outermost trajectory state curvilinear errors
double pt() const
track transverse momentum
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.
Abs< T >::type abs(const T &t)
std::pair< double, double > chi2n
bool copyTrajectories_
copy also trajectories and trajectory->track associations
Block(const edm::ParameterSet &cfg)
std::vector< std::string > labels_
output labels
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
std::vector< Block > blocks_
filter psets
std::unique_ptr< std::vector< Trajectory > > * selTrajs_
edm::EDGetTokenT< reco::TrackCollection > tokenTracks
RefProd< PROD > getRefBeforePut()
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...
double dzError() const
error on dz
std::vector< TrackingRecHitRefProd > rHits_
void selectVertices(const reco::VertexCollection &vtxs, std::vector< Point > &points)
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
bool splitOutputs_
split selections in more sets
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
bool outerOk() const
return true if the outermost hit is valid
const PropagationDirection & seedDirection() const
direction of how the hits were sorted in the original seed
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
XYZPointD XYZPoint
point in space with cartesian internal representation
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
double sigmaZ() const
sigma z
CovarianceMatrix innerStateCovariance() const
innermost trajectory state curvilinear errors
TrackMultiSelector(const edm::ParameterSet &cfg)
constructor
static std::string const emptyString("")
std::unique_ptr< TrajTrackAssociationCollection > * selTTAss_
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
const TrackResiduals & residuals() const
get the residuals
const Point & position() const
position
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
void produce(edm::Event &evt, const edm::EventSetup &es) override
process one event
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
edm::EDGetTokenT< reco::BeamSpot > beamspot_
*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
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.