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;
91 unique_ptr<TrackCollection> t2v_firstvertextracks(
new TrackCollection());
92 unique_ptr<TrackCollection> v2t_firstvertextracks(
new TrackCollection());
94 bool t2vassmap =
false;
95 bool v2tassmap =
false;
101 string asstype = input_AssociationType_.label();
103 if ((asstype ==
"TracksToVertex") || (asstype ==
"Both")) {
104 if (
iEvent.getByToken(token_TrackToVertexAssMap_, t2vAM)) {
109 if ((asstype ==
"VertexToTracks") || (asstype ==
"Both")) {
110 if (
iEvent.getByToken(token_VertexToTrackAssMap_, v2tAM)) {
115 if (!t2vassmap && !v2tassmap) {
116 cout <<
"No input collection could be found" << endl;
122 iEvent.getByToken(token_generalTracksCollection_, input_trckcollH);
128 for (
unsigned int trckcoll_ite = 0; trckcoll_ite < trckcoll.size(); trckcoll_ite++) {
129 float quality = trckcoll[trckcoll_ite].second;
131 if (
quality >= input_MinQuality_) {
132 TrackRef AMtrkref = trckcoll[trckcoll_ite].first;
134 for (
unsigned int index_input_trck = 0; index_input_trck < input_trckcollH->size(); index_input_trck++) {
137 if (trackMatch(*AMtrkref, *input_trackref)) {
138 t2v_firstvertextracks->push_back(*AMtrkref);
151 iEvent.getByToken(token_VertexCollection_, input_vtxcollH);
153 VertexRef firstVertexRef(input_vtxcollH, 0);
157 for (v2t_ite = v2tAM->
begin(); v2t_ite != v2tAM->
end(); v2t_ite++) {
160 for (
unsigned int index_input_trck = 0; index_input_trck < input_trckcollH->size(); index_input_trck++) {
163 if (trackMatch(*AMtrkref, *input_trackref)) {
164 for (
unsigned v_ite = 0; v_ite < (v2t_ite->
val).
size(); v_ite++) {
168 if ((vtxref == firstVertexRef) && (
quality >= input_MinQuality_)) {
169 v2t_firstvertextracks->push_back(*AMtrkref);
181 return ((track1).
eta() == (track2).
eta() && (track1).phi() == (track2).phi() && (track1).
chi2() == (track2).
chi2() &&
182 (track1).
ndof() == (track2).
ndof() && (track1).
p() == (track2).
p());
196 desc.add<
int>(
"MinQuality");
T getParameter(std::string const &) const
std::vector< Track > TrackCollection
collection of Tracks
const_iterator end() const
last iterator over the map (read only)
U second(std::pair< T, U > const &p)
void addDefault(ParameterSetDescription const &psetDescription)
#define DEFINE_FWK_MODULE(type)
std::vector< TrackQualityPair > TrackQualityPairVector
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
const_iterator begin() const
first iterator over the map (read only)
T first(std::pair< T, U > const &p)