57 token_TrackToVertexAssMap_ = mayConsume<TrackToVertexAssMap>(iConfig.
getParameter<
InputTag>(
"AssociationMap"));
58 token_VertexToTrackAssMap_ = mayConsume<VertexToTrackAssMap>(iConfig.
getParameter<
InputTag>(
"AssociationMap"));
60 token_generalTracksCollection_ = consumes<TrackCollection>(iConfig.
getParameter<
InputTag>(
"TrackCollection"));
62 token_VertexCollection_ = mayConsume<VertexCollection>(iConfig.
getParameter<
InputTag>(
"VertexCollection"));
64 input_MinQuality_ = iConfig.
getParameter<
int>(
"MinQuality");
68 if (input_AssociationType_.label() ==
"TracksToVertex") {
69 produces<TrackCollection>(
"T2V");
71 if (input_AssociationType_.label() ==
"VertexToTracks") {
72 produces<TrackCollection>(
"V2T");
74 if (input_AssociationType_.label() ==
"Both") {
75 produces<TrackCollection>(
"T2V");
76 produces<TrackCollection>(
"V2T");
78 std::cout <<
"No correct InputTag for AssociationType!" << std::endl;
79 std::cout <<
"Won't produce any TrackCollection!" << std::endl;
96 unique_ptr<TrackCollection> t2v_firstvertextracks(
new TrackCollection());
97 unique_ptr<TrackCollection> v2t_firstvertextracks(
new TrackCollection());
99 bool t2vassmap =
false;
100 bool v2tassmap =
false;
106 string asstype = input_AssociationType_.label();
108 if ((asstype ==
"TracksToVertex") || (asstype ==
"Both")) {
109 if (iEvent.
getByToken(token_TrackToVertexAssMap_, t2vAM)) {
114 if ((asstype ==
"VertexToTracks") || (asstype ==
"Both")) {
115 if (iEvent.
getByToken(token_VertexToTrackAssMap_, v2tAM)) {
120 if (!t2vassmap && !v2tassmap) {
121 cout <<
"No input collection could be found" << endl;
127 iEvent.
getByToken(token_generalTracksCollection_, input_trckcollH);
133 for (
unsigned int trckcoll_ite = 0; trckcoll_ite < trckcoll.size(); trckcoll_ite++) {
134 float quality = trckcoll[trckcoll_ite].second;
136 if (quality >= input_MinQuality_) {
137 TrackRef AMtrkref = trckcoll[trckcoll_ite].first;
139 for (
unsigned int index_input_trck = 0; index_input_trck < input_trckcollH->size(); index_input_trck++) {
142 if (TrackMatch(*AMtrkref, *input_trackref)) {
143 t2v_firstvertextracks->push_back(*AMtrkref);
156 iEvent.
getByToken(token_VertexCollection_, input_vtxcollH);
158 VertexRef firstVertexRef(input_vtxcollH, 0);
162 for (v2t_ite = v2tAM->begin(); v2t_ite != v2tAM->end(); v2t_ite++) {
165 for (
unsigned int index_input_trck = 0; index_input_trck < input_trckcollH->size(); index_input_trck++) {
168 if (TrackMatch(*AMtrkref, *input_trackref)) {
169 for (
unsigned v_ite = 0; v_ite < (v2t_ite->
val).
size(); v_ite++) {
173 if ((vtxref == firstVertexRef) && (quality >= input_MinQuality_)) {
174 v2t_firstvertextracks->push_back(*AMtrkref);
186 return ((track1).
eta() == (track2).
eta() && (track1).phi() == (track2).phi() && (track1).
chi2() == (track2).
chi2() &&
187 (track1).
ndof() == (track2).
ndof() && (track1).
p() == (track2).
p());
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
std::vector< Track > TrackCollection
collection of Tracks
U second(std::pair< T, U > const &p)
void addDefault(ParameterSetDescription const &psetDescription)
std::vector< TrackQualityPair > TrackQualityPairVector
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
T getParameter(std::string const &) const
T first(std::pair< T, U > const &p)
tuple size
Write out results.