10 : m_kMatchingDeltaR(iConfig.getParameter<double>(
"RecoAnalysisMatchingDeltaR")),
11 m_kMatchingPt(iConfig.getParameter<double>(
"RecoAnalysisMatchingPt")),
12 m_kTauMassCut(iConfig.getParameter<double>(
"RecoAnalysisTauMassCut")),
13 m_kTauMass(iConfig.getParameter<double>(
"RecoAnalysisTauMass")),
14 m_kMuonMass(iConfig.getParameter<double>(
"RecoAnalysisMuonMass")),
30 reco::MuonCollection::const_iterator
muon;
35 for (muon = muons->begin(); muon != muons->end(); ++
muon) {
43 LogDebug(
"Tau3MuReco") <<
"Could not find correct combination!" << std::endl;
62 LogDebug(
"Tau3MuReco") <<
"A 3rd Track can not be assigned!" << std::endl;
77 reco::TrackCollection::const_iterator iter;
84 LogDebug(
"Tau3MuReco") <<
"Found muon track in Tracks with DeltaR: " <<
getDeltaR(*iter, track)
85 <<
" Pt: " << track.
pt() <<
" Muons Pt is: " << (*iter).pt() << std::endl;
100 if (Tracks.size() <= 2)
103 double SumDeltaR = 0;
109 LogDebug(
"Tau3MuReco") <<
"Number of tracks found: " << Tracks.size() << std::endl;
111 std::multimap<double, const reco::Track> TrackMultiMap;
113 unsigned short muonCounter = 0;
115 reco::TrackCollection::const_iterator
track;
117 for (track = Tracks.begin(); track != Tracks.end(); track++) {
123 SumDeltaR = MuonDeltaR;
128 std::pair<double, const reco::Track> actTrack(SumDeltaR, *track);
130 TrackMultiMap.insert(actTrack);
135 if (muonCounter < 2) {
136 LogDebug(
"Tau3MuReco") <<
"Not enough muons (" << muonCounter <<
") assigned to a track! Event skipped!" 141 std::multimap<double, const reco::Track>::iterator it = TrackMultiMap.begin();
143 if (it == TrackMultiMap.end()) {
144 LogDebug(
"Tau3MuReco") <<
"Not enough tracks (0) left! Event skipped!" << std::endl;
157 unsigned int count = 0;
164 LogDebug(
"Tau3MuReco") <<
"Track canidate: " << count << std::endl;
167 LogDebug(
"Tau3MuReco") <<
"\tWrong charge!" << std::endl;
170 LogDebug(
"Tau3MuReco") <<
"\tTrack Pt: " << (*it).second.pt() << std::endl;
171 LogDebug(
"Tau3MuReco") <<
"\tDelta R: " << (*it).first << std::endl;
179 if (it == TrackMultiMap.end())
186 LogDebug(
"Tau3MuReco") <<
"Found corresponding 3rd track: " << std::endl;
187 LogDebug(
"Tau3MuReco") <<
"Track canidate: " << count << std::endl;
190 LogDebug(
"Tau3MuReco") <<
"\tDelta R: " << (*it).first << std::endl;
200 std::vector<std::vector<UInt_t> > CombinationVec = myCombinatorics.
GetCombinations();
202 std::vector<std::vector<UInt_t> >::iterator it = CombinationVec.begin();
210 if (it == CombinationVec.end())
215 tempMuonCollection.clear();
216 tempTrackCollection.clear();
218 for (UInt_t
i = 0;
i < (*it).size();
i++) {
224 LogDebug(
"Tau3MuReco") <<
"Charge is: " << (
int)Charge <<
" Have to be -1 or 1!!!" << std::endl;
226 <<
" Have to be smaller than " <<
m_kTauMassCut << std::endl;
249 deltaR12 < deltaR23 ? temp = 3 : temp = 1;
250 deltaR12 < deltaR23 ? junk = deltaR12 : junk = deltaR23;
261 unsigned int numOfParticles = tracks->size();
269 for (
unsigned int i = 0;
i < numOfParticles;
i++) {
270 SumPx += tracks->at(
i).px();
271 SumPy += tracks->at(
i).py();
272 SumPz += tracks->at(
i).pz();
274 SumE +=
sqrt(
pow(tracks->at(
i).p(), 2) +
pow(MuonMass, 2));
277 double invmass =
sqrt(
pow(SumE, 2) -
pow(SumPx, 2) -
pow(SumPy, 2) -
pow(SumPz, 2));
Tau3MuReco(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
double getDeltaR(const reco::Track &track1, const reco::Track &track2)
std::vector< std::vector< UInt_t > > GetCombinations()
double getInvariantMass(const reco::TrackCollection *tracks, const double MuonMass=0.106)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool find3rdTrack(const edm::Event &iEvent, const edm::EventSetup &iSetup, const reco::TrackCollection &Tracks)
const double m_kMatchingPt
reco::TrackCollection * m_TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
double phi() const
azimuthal angle of momentum vector
bool findCorrectPairing()
std::vector< Muon > MuonCollection
collection of Muon objects
double eta() const
pseudorapidity of momentum vector
const double m_kMatchingDeltaR
double pt() const
track transverse momentum
Abs< T >::type abs(const T &t)
bool doTau3MuReco(const edm::Event &iEvent, const edm::EventSetup &iSetup, reco::MuonCollection *muonCollection, reco::TrackCollection *trackCollection)
T const * product() const
const double m_kTauMassCut
bool removeIncorrectMuon()
const edm::EDGetTokenT< reco::MuonCollection > m_kMuonSourceToken
const edm::EDGetTokenT< reco::TrackCollection > m_kTrackSourceToken
reco::MuonCollection * m_MuonCollection
int charge() const
track electric charge
bool check4MuonTrack(const reco::Track &track)
Power< A, B >::type pow(const A &a, const B &b)