10 m_kMatchingPt(iConfig.getParameter<double>(
"RecoAnalysisMatchingPt")),
11 m_kTauMassCut(iConfig.getParameter<double>(
"RecoAnalysisTauMassCut")),
12 m_kTauMass(iConfig.getParameter<double>(
"RecoAnalysisTauMass")),
13 m_kMuonMass(iConfig.getParameter<double>(
"RecoAnalysisMuonMass")),
14 m_kMuonSourceToken(iC.consumes<
reco::
MuonCollection>(iConfig.getParameter<edm::InputTag>(
"MuonSourceTag"))),
15 m_kTrackSourceToken(iC.consumes<
reco::
TrackCollection>(iConfig.getParameter<edm::InputTag>(
"TrackSourceTag")))
32 reco::MuonCollection::const_iterator
muon;
37 for( muon = muons->begin(); muon != muons->end(); ++
muon )
48 LogDebug(
"Tau3MuReco") <<
"Could not find correct combination!" << std::endl;
71 LogDebug(
"Tau3MuReco") <<
"A 3rd Track can not be assigned!" << std::endl;
88 reco::TrackCollection::const_iterator
iter;
94 if((*iter).charge() == track.
charge()
98 LogDebug(
"Tau3MuReco") <<
"Found muon track in Tracks with DeltaR: " <<
getDeltaR(*iter,track)
99 <<
" Pt: " << track.
pt()
100 <<
" Muons Pt is: " << (*iter).pt() << std::endl;
118 double SumDeltaR = 0;
124 LogDebug(
"Tau3MuReco") <<
"Number of tracks found: " << Tracks.size() << std::endl;
126 std::multimap<double, const reco::Track> TrackMultiMap;
128 unsigned short muonCounter = 0;
130 reco::TrackCollection::const_iterator track;
132 for(track=Tracks.begin(); track!=Tracks.end(); track++)
140 SumDeltaR = MuonDeltaR;
145 std::pair<double, const reco::Track> actTrack(SumDeltaR,*track);
147 TrackMultiMap.insert(actTrack);
154 LogDebug(
"Tau3MuReco") <<
"Not enough muons (" << muonCounter <<
") assigned to a track! Event skipped!" << std::endl;
158 std::multimap<double, const reco::Track>::iterator it = TrackMultiMap.begin();
160 if(it==TrackMultiMap.end())
162 LogDebug(
"Tau3MuReco") <<
"Not enough tracks (0) left! Event skipped!" << std::endl;
175 unsigned int count = 0;
178 while((Charge > 0 && ((*it).second).charge()==(
m_TrackCollection->at(0)).charge())
185 LogDebug(
"Tau3MuReco") <<
"Track canidate: " << count << std::endl;
188 LogDebug(
"Tau3MuReco") <<
"\tWrong charge!" << std::endl;
190 LogDebug(
"Tau3MuReco") <<
"\tTrack Pt: " << (*it).second.pt() << std::endl;
191 LogDebug(
"Tau3MuReco") <<
"\tDelta R: " << (*it).first << std::endl;
192 LogDebug(
"Tau3MuReco") <<
"\tChi2: " << ((*it).second).normalizedChi2() << std::endl;
199 if(it==TrackMultiMap.end())
206 LogDebug(
"Tau3MuReco") <<
"Found corresponding 3rd track: " << std::endl;
207 LogDebug(
"Tau3MuReco") <<
"Track canidate: " << count << std::endl;
209 LogDebug(
"Tau3MuReco") <<
"\tDelta R: " << (*it).first << std::endl;
210 LogDebug(
"Tau3MuReco") <<
"\tNormChi2: " << ((*it).second).normalizedChi2() << std::endl;
220 std::vector < std::vector<UInt_t> > CombinationVec = myCombinatorics.
GetCombinations();
222 std::vector< std::vector<UInt_t> >::iterator it = CombinationVec.begin();
231 if(it==CombinationVec.end())
236 tempMuonCollection.clear();
237 tempTrackCollection.clear();
239 for(UInt_t
i=0;
i< (*it).size();
i++)
246 LogDebug(
"Tau3MuReco") <<
"Charge is: " << (int)Charge <<
" Have to be -1 or 1!!!" << std::endl;
273 deltaR12 < deltaR23 ? temp=3 : temp=1;
274 deltaR12 < deltaR23 ? junk=deltaR12 : junk=deltaR23;
286 unsigned int numOfParticles = tracks->size();
294 for(
unsigned int i=0;
i<numOfParticles;
i++)
296 SumPx += tracks->at(
i).px();
297 SumPy += tracks->at(
i).py();
298 SumPz += tracks->at(
i).pz();
300 SumE +=
sqrt(
pow(tracks->at(
i).p(),2)+
pow(MuonMass,2));
310 double dEta = track1.
eta() - track2.
eta();
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 dPhi(double phi1, double phi2)
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)