4 #include <boost/foreach.hpp>
15 namespace reco {
namespace tau {
23 std::vector<PFCandidatePtr>
tracks;
25 if (!allTracks.size()){
26 LogDebug(
"VxTrkAssocInfo") <<
" No tracks at this jet! Returning empty reference.";
32 LogDebug(
"VxTrkAssocInfo") <<
" No quality cuts applied. All tracks passing.";
37 LogDebug(
"VxTrkAssocInfo") <<
" All " << allTracks.size() <<
" tracks rejected!";
41 LogDebug(
"VxTrkAssocInfo") <<
" All " << allTracks.size() <<
" tracks rejected but leading track was recovered!";
43 }
else cand = tracks[0];
47 else if (cand->gsfTrackRef().
isNonnull()) {
55 class DZtoTrack :
public std::unary_function<double, reco::VertexRef> {
68 class TrackWeightInVertex :
public std::unary_function<double, reco::VertexRef>
76 return vtx->trackWeight(
trk_);
91 if (!pset.
exists(
"primaryVertexSrc") || !pset.
exists(
"pvFindingAlgo")) {
93 <<
"The PSet passed to the RecoTauVertexAssociator was"
94 <<
" incorrectly configured. The vertex will be taken as the "
95 <<
"highest Pt vertex from the offlinePrimaryVertices collection."
102 if(!pset.
exists(
"vertexTrackFiltering") && pset.
exists(
"vxAssocQualityCuts")){
104 <<
"The PSet passed to the RecoTauVertexAssociator was"
105 <<
" incorrectly configured. Please define vertexTrackFiltering in config file."
106 <<
" No filtering of tracks to vertices will be applied"
112 LogDebug(
"TauVxAssociatorInfo") <<
" ----> Using " << algorithm <<
" algorithm to select vertex.";
113 if (algorithm ==
"highestPtInEvent") {
115 }
else if (algorithm ==
"closestInDeltaZ") {
117 }
else if (algorithm ==
"highestWeightForLeadTrack") {
119 }
else if (algorithm ==
"combined"){
123 <<
"The algorithm specified for tau-vertex association "
124 << algorithm <<
" is invalid. Options are: " << std::endl
125 <<
"highestPtInEvent, "
126 <<
"closestInDeltaZ, "
127 <<
"highestWeightForLeadTrack, "
128 <<
" or combined." << std::endl;
144 for(
size_t i = 0;
i < verticesH_->size(); ++
i) {
148 int currentEvent = evt.
id().
event();
170 LogDebug(
"VxTrkAssocInfo") <<
"There are " <<
vertices_.size() <<
" vertices in this event. The jet is " <<
jet;
177 LogTrace(
"VxTrkAssocInfo") <<
"I have seen this jet! Returning pointer to stored value.";
187 LogTrace(
"VxTrkAssocInfo") <<
"No track to associate to! Returning vx no. 0.";
192 DZtoTrack dzComputer(leadTrack);
195 double dz = dzComputer(vtx);
196 if (dz < closestDistance) {
197 closestDistance = dz;
205 LogTrace(
"VxTrkAssocInfo") <<
"No track to associate to! Returning vx no. 0.";
209 double largestWeight = 0.;
211 TrackWeightInVertex weightComputer(leadTrack);
213 double weight = weightComputer(vtx);
214 if (weight > largestWeight) {
221 LogTrace(
"VxTrkAssocInfo") <<
" No vertex had positive weight! Trying dZ instead... ";
222 DZtoTrack dzComputer(leadTrack);
225 double dz_i = dzComputer(vtx);
226 if (dz_i < closestDistance) {
227 closestDistance = dz_i;
T getParameter(std::string const &) const
EventNumber_t event() const
reco::VertexRef associatedVertex(const PFJet &tau) const
< trclass="colgroup">< tdclass="colgroup"colspan=5 > Ecal cluster collections</td ></tr >< tr >< td >< ahref="classreco_1_1BasicCluster.html"> reco::BasicCluster</a ></td >< td >< ahref="DataFormats_EgammaReco.html"> reco::BasicClusterCollection</a ></td >< td >< ahref="#"> hybridSuperClusters</a ></td >< tdclass="description"> Basic clusters reconstructed with hybrid algorithm(barrel only)</td >< td >S.Rahatlou</td ></tr >< tr >< td >< a href
const PFJetRef & jetRef() const
std::map< const reco::PFJet *, reco::VertexRef > * JetToVertexAssociation
Coll filterCandRefs(const Coll &refcoll, bool invert=false) const
Filter a ref vector of PFCandidates.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
ParameterSet const & getParameterSet(ParameterSetID const &id)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::vector< Vertex > VertexCollection
collection of Vertex objects
void setEvent(const edm::Event &evt)
Load the vertices from the event.
reco::TrackBaseRef getLeadTrack(const PFJet &jet) const
Jets made from PFObjects.
bool isNonnull() const
Checks for non-null.
bool isNull() const
Checks for null.
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
void setPV(const reco::VertexRef &vtx) const
Update the primary vertex.
Abs< T >::type abs(const T &t)
edm::Ref< VertexCollection > VertexRef
persistent reference to a Vertex
RecoTauVertexAssociator(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
RecoTauQualityCuts qcuts_
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...
const PFTauTagInfoRef & pfTauTagInfoRef() const
std::vector< reco::VertexRef > vertices_
std::vector< PFCandidatePtr > pfChargedCands(const PFJet &jet, bool sort=true)
Extract all non-neutral candidates from a PFJet.
edm::EDGetTokenT< reco::VertexCollection > vx_token
const reco::TrackBaseRef trk_