74 input_MinQuality_ = iConfig.
getParameter<
int>(
"MinQuality");
78 if ( input_AssociationType_.label() ==
"TracksToVertex" ) {
79 produces<TrackCollection>(
"T2V");
81 if ( input_AssociationType_.label() ==
"VertexToTracks" ) {
82 produces<TrackCollection>(
"V2T");
84 if ( input_AssociationType_.label() ==
"Both" ) {
85 produces<TrackCollection>(
"T2V");
86 produces<TrackCollection>(
"V2T");
88 edm::LogWarning(
"FirstVertexTracks") <<
"No correct InputTag for AssociationType!" << std::endl
89 <<
"Won't produce any TrackCollection!" << std::endl;
115 auto_ptr<TrackCollection> t2v_firstvertextracks(
new TrackCollection() );
116 auto_ptr<TrackCollection> v2t_firstvertextracks(
new TrackCollection() );
118 bool t2vassmap =
false;
119 bool v2tassmap =
false;
125 string asstype = input_AssociationType_.label();
127 if ( ( asstype ==
"TracksToVertex" ) || ( asstype ==
"Both" ) ) {
128 if ( iEvent.
getByLabel(input_AssociationMap_, t2vAM ) ) {
133 if ( ( asstype ==
"VertexToTracks" ) || ( asstype ==
"Both" ) ) {
134 if ( iEvent.
getByLabel(input_AssociationMap_, v2tAM ) ) {
139 if ( !t2vassmap && !v2tassmap ) {
140 edm::LogWarning(
"FirstVertexTracks") <<
"No input collection could be found" << endl;
146 iEvent.
getByLabel(input_generalTracksCollection_,input_trckcollH);
153 for (
unsigned int trckcoll_ite = 0; trckcoll_ite < trckcoll.size(); trckcoll_ite++ ) {
155 float quality = trckcoll[trckcoll_ite].second;
157 if ( quality>=input_MinQuality_ ) {
159 TrackRef AMtrkref = trckcoll[trckcoll_ite].first;
161 for (
unsigned int index_input_trck=0; index_input_trck<input_trckcollH->size(); index_input_trck++ ) {
165 if( TrackMatch(*AMtrkref,*input_trackref) ){
167 t2v_firstvertextracks->push_back(*AMtrkref);
178 iEvent.
put( t2v_firstvertextracks,
"T2V" );
186 iEvent.
getByLabel(input_VertexCollection_,input_vtxcollH);
188 VertexRef firstVertexRef(input_vtxcollH,0);
192 for ( v2t_ite=v2tAM->begin(); v2t_ite!=v2tAM->end(); v2t_ite++ ) {
196 for (
unsigned int index_input_trck=0; index_input_trck<input_trckcollH->size(); index_input_trck++ ) {
200 if( TrackMatch(*AMtrkref,*input_trackref) ){
202 for(
unsigned v_ite = 0; v_ite<(v2t_ite->
val).
size(); v_ite++){
205 float quality = (v2t_ite->
val)[v_ite].
second;
207 if ( ( vtxref==firstVertexRef ) && ( quality>=input_MinQuality_ ) ){
208 v2t_firstvertextracks->push_back(*AMtrkref);
219 iEvent.
put( v2t_firstvertextracks,
"V2T" );
230 ( track1.
eta() == track2.
eta() ) &&
231 ( track1.
phi() == track2.
phi() ) &&
232 ( track1.
chi2() == track2.
chi2() ) &&
233 ( track1.
ndof() == track2.
ndof() ) &&
234 ( track1.
p() == track2.
p() )
double p() const
momentum vector magnitude
T getParameter(std::string const &) const
std::vector< TrackQualityPair > TrackQualityPairVector
std::vector< Track > TrackCollection
collection of Tracks
double phi() const
azimuthal angle of momentum vector
DEFINE_FWK_MODULE(HiMixingModule)
U second(std::pair< T, U > const &p)
double eta() const
pseudorapidity of momentum vector
void addDefault(ParameterSetDescription const &psetDescription)
double chi2() const
chi-squared of the fit
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
double ndof() const
number of degrees of freedom of the fit
edm::AssociationMap< edm::OneToManyWithQuality< reco::VertexCollection, reco::TrackCollection, int > > TrackToVertexAssMap
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
T first(std::pair< T, U > const &p)
tuple size
Write out results.
edm::AssociationMap< edm::OneToManyWithQuality< reco::TrackCollection, reco::VertexCollection, int > > VertexToTrackAssMap