本文整理汇总了C++中Jet::P4方法的典型用法代码示例。如果您正苦于以下问题:C++ Jet::P4方法的具体用法?C++ Jet::P4怎么用?C++ Jet::P4使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jet
的用法示例。
在下文中一共展示了Jet::P4方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AnalyseJets
void LHCOWriter::AnalyseJets()
{
Jet *element;
Track *track;
Int_t counter;
fItJet->Reset();
while((element = static_cast<Jet*>(fItJet->Next())))
{
if(element->TauTag != 0) continue;
Reset();
counter = 0;
fItTrack->Reset();
while((track = static_cast<Track*>(fItTrack->Next())))
{
if(element->P4().DeltaR(track->P4()) < 0.5) ++counter;
}
fIntParam[1] = 4;
fDblParam[0] = element->Eta;
fDblParam[1] = element->Phi;
fDblParam[2] = element->PT;
fDblParam[3] = element->Mass;
fDblParam[4] = counter;
fDblParam[5] = element->BTag;
fDblParam[6] = element->EhadOverEem;
Write();
}
}
示例2: DphiCuts
bool Analysis::DphiCuts(){
bool IsCutPass = false;
if (branchJet && branchMissingET){
MissingET *met = (MissingET*) branchMissingET->At(0);
int nJets = branchJet->GetEntriesFast();
for (int i=0; i < nJets; i++){
Jet *jet = (Jet*) branchJet->At(i);
if (jet->PT > 200.){
if (jet->P4().DeltaR(met->P4()) > 1.)
IsCutPass=true;
else {IsCutPass=false; break;}
}
}
}
IsEventPass = IsEventPass && IsCutPass;
return IsCutPass;
}
示例3: LeptonEnergy
//.........这里部分代码省略.........
//cout << "lepton+jets" << endl;
nsemileptonic++;
if( ntaus ==0 || ( ntaus == 1 && (ntauelectrons+ntaumuons) == 1) ) nsemileptonic2++;
if( ntaus == 0 ) {
nsemileptonic3++;
if( nmuons ) {
h_muon_energy->Fill(genmuon->E, genweight);
h_lepton_energy->Fill(genmuon->E, genweight);
}
if( nelectrons ) {
h_electron_energy->Fill(genelectron->E, genweight);
h_lepton_energy->Fill(genelectron->E, genweight);
}
}
}else if ( nleptons == 0 && nhadrons == 2 ){
//cout << "hadronic" << endl;
nhadronic++;
}else{
//cout << "remaining" << endl;
remaining++;
}
}
Muon * mymuon;
Electron * myelectron;
bool passmuon = false;
bool passelectron = false;
if(branchMuon->GetEntries() > 0)
{
bool mymuonpass = false;
for(int i = 0; i < branchMuon->GetEntriesFast() ; i++){
Muon * muon = (Muon *) branchMuon->At(i);
if( muon->P4().E() > 20 && fabs( muon->P4().Eta() < 2.4) ){
mymuon = muon;
mymuonpass = true;
}
break;
}
if( mymuonpass && ( nmuons > 0 || nelectrons > 0 ) ){
//h_muon_energy_reco->Fill(mymuon->P4().E(), genweight);
h_lepton_energy_reco->Fill(mymuon->P4().E(), genweight);
h2_lepton_energy_response->Fill(mymuon->P4().E(), genmuon->E, genweight);
passmuon = true;
}
}
if(branchElectron->GetEntries() > 0)
{
bool myelectronpass = false;
for(int i = 0; i < branchElectron->GetEntriesFast() ; i++){
Electron * electron = (Electron *) branchElectron->At(i);
if( electron->P4().E() > 20 && fabs( electron->P4().Eta() < 2.4) ){
myelectron = electron;
myelectronpass = true;
}
break;
}
if( myelectronpass && ( nmuons > 0 || nelectrons > 0 ) ){
//h_electron_energy_reco->Fill(myelectron->P4().E(), genweight);
h_lepton_energy_reco->Fill(myelectron->P4().E(), genweight);
h2_lepton_energy_response->Fill(myelectron->P4().E(), genelectron->E, genweight);
passelectron = true;
示例4: AnalyseEvents
void AnalyseEvents(ExRootTreeReader *treeReader, TestPlots *plots) {
TClonesArray *branchParticle = treeReader->UseBranch("Particle");
TClonesArray *branchElectron = treeReader->UseBranch("Electron");
TClonesArray *branchMuon = treeReader->UseBranch("Muon");
TClonesArray *branchPhoton = treeReader->UseBranch("Photon");
TClonesArray *branchEFlowTrack = treeReader->UseBranch("EFlowTrack");
TClonesArray *branchEFlowTower = treeReader->UseBranch("EFlowTower");
TClonesArray *branchEFlowMuon = treeReader->UseBranch("EFlowMuon");
TClonesArray *branchJet = treeReader->UseBranch("Jet");
Long64_t allEntries = treeReader->GetEntries();
cout << "** Chain contains " << allEntries << " events" << endl;
GenParticle *particle;
Electron *electron;
Photon *photon;
Muon *muon;
Track *track;
Tower *tower;
Jet *jet; // P4 returns a TLorentzVector
TObject *object;
TLorentzVector momentum;
Float_t Eem, Ehad;
Bool_t skip;
Long64_t entry;
Int_t i, j, pdgCode;
// Loop over all events
for(entry = 0; entry < allEntries; entry++) {
// Load selected branches with data from specified event
treeReader->ReadEntry(entry);
///---- take the two highest pt leptons in the event (m or e)
// maps are ordered in ascending order
std::map <float, int> m_maxptleptons;
// Loop over all electrons in event
for(i = 0; i < branchElectron->GetEntriesFast(); i++) {
electron = (Electron*) branchElectron->At(i);
double pt = electron->PT;
m_maxptleptons[-pt] = -(i+1);
}
// Loop over all muons in event
for(i = 0; i < branchMuon->GetEntriesFast(); i++) {
muon = (Muon*) branchMuon->At(i);
double pt = muon->PT;
m_maxptleptons[-pt] = (i+1);
}
//---- at least 2 leptons ----
if (m_maxptleptons.size() < 2) continue;
// kind = 0/1 if m/e
std::map<float, int>::iterator it_type_m_lepton = m_maxptleptons.begin();
int flav1 = (it_type_m_lepton->second<0); // m>0, e<0 ---> m=0, e=1
plots->hpt1->Fill(- it_type_m_lepton->first);
it_type_m_lepton++;
int flav2 = (it_type_m_lepton->second<0); // m>0, e<0 ---> m=0, e=1
plots->hpt2->Fill(- it_type_m_lepton->first);
int nlep = 0;
for(it_type_m_lepton = m_maxptleptons.begin(); it_type_m_lepton != m_maxptleptons.end(); it_type_m_lepton++) {
if ( -(it_type_m_lepton->first) > 10) nlep++;
}
plots->hnleppt10->Fill(nlep);
// ee/mm e m m e
plots->hchannel->Fill(flav1*flav2+2*(flav1>flav2)+3*(flav1<flav2));
// # mumu # channel == 0
// # mue # channel == 3
// # emu # channel == 2
// # ee # channel == 1
TLorentzVector l1, l2;
it_type_m_lepton = m_maxptleptons.begin();
if (it_type_m_lepton->second>0) { l1 = ((Muon*) branchMuon->At( it_type_m_lepton->second - 1 ))->P4();}
else { l1 = ((Electron*) branchElectron->At(-(it_type_m_lepton->second + 1)))->P4();}
it_type_m_lepton++;
if (it_type_m_lepton->second>0) { l2 = ((Muon*) branchMuon->At( it_type_m_lepton->second - 1 ))->P4();}
else { l2 = ((Electron*) branchElectron->At(-(it_type_m_lepton->second + 1)))->P4();}
plots->hmll->Fill((l1+l2).M());
plots->hdphill->Fill( l1.DeltaPhi(l2) );
//.........这里部分代码省略.........
示例5: AnalyseMuons
void LHCOWriter::AnalyseMuons()
{
Muon *element;
Track *track;
Tower *tower;
Jet *jet;
Int_t muonCounter, tauCounter, jetCounter, minIndex;
Float_t sumPT, sumET, ratET, jetDR, minDR;
muonCounter = 0;
fItMuon->Reset();
while((element = static_cast<Muon*>(fItMuon->Next())))
{
Reset();
sumPT = 0.0;
fItTrack->Reset();
while((track = static_cast<Track*>(fItTrack->Next())))
{
if(element->P4().DeltaR(track->P4()) < 0.5) sumPT += track->PT;
}
sumET = 0.0;
fItTower->Reset();
while((tower = static_cast<Tower*>(fItTower->Next())))
{
if(element->P4().DeltaR(tower->P4()) < 0.5) sumET += tower->ET;
}
tauCounter = 0;
jetCounter = 0;
minIndex = -1;
minDR = 1.0E9;
fItJet->Reset();
while((jet = static_cast<Jet*>(fItJet->Next())))
{
if(jet->TauTag != 0)
{
++tauCounter;
continue;
}
jetDR = element->P4().DeltaR(jet->P4());
if(jetDR < minDR)
{
minIndex = jetCounter;
minDR = jetDR;
}
++jetCounter;
}
fIntParam[1] = 2;
fDblParam[0] = element->Eta;
fDblParam[1] = element->Phi;
fDblParam[2] = element->PT;
fDblParam[3] = 0.11;
fDblParam[4] = element->Charge;
if(minIndex >= 0)
{
fDblParam[5] = fIntParam[0] + fBranchMuon->GetEntriesFast() - muonCounter + tauCounter + minIndex;
}
ratET = sumET/element->PT;
fDblParam[6] = Float_t(TMath::Nint(sumPT)) + (ratET < 1.0 ? ratET : 0.99);
Write();
++muonCounter;
}
}
示例6: CalculateVariables
void GlobalRecoTTbarPlugin::CalculateVariables(Jet const &bTopLep, Jet const &bTopHad,
Jet const &q1TopHad, Jet const &q2TopHad)
{
// Calculate variables related to the top quark decaying semileptonically
auto const &lepton = (*reader)->GetLeptons().front();
Candidate const wLep(lepton.P4() + (*reader)->GetNeutrino().P4());
Candidate const topLep(wLep.P4() + bTopLep.P4());
//bfMass_TopLep = topLep.M();
LogPt_TopLep = log(topLep.Pt());
//bfEta_TopLep = topLep.Eta();
//bfPt_BTopLep = bTopLep.Pt();
//bfEta_BTopLep = bTopLep.Eta();
//PassBTag_BTopLep = 0 + bTagger->IsTagged(bTopLep);
//bfCharge_BTopLep = bTopLep.Charge() * lepton.Charge();
LogMass_BTopLepLep = log((bTopLep.P4() + lepton.P4()).M());
DeltaR_BTopLepWLep = bTopLep.P4().DeltaR(wLep.P4());
//bfDEta_TopLepLep = fabs(topLep.Eta() - lepton.Eta());
// Calculate the cosine
// TVector3 b((wLep.P4()).BoostVector());
// TLorentzVector boostedLepton(lepton.P4());
// boostedLepton.Boost(-b);
// TVector3 p3Lepton(boostedLepton.Vect());
// TLorentzVector boostedBJet(bTopLep.P4());
// boostedBJet.Boost(-b);
// TVector3 const p3BJet(boostedBJet.Vect());
// bfCos_LepBTopLep_WLep = p3Lepton.Dot(p3BJet) / (p3Lepton.Mag() * p3BJet.Mag());
// Calculate variables related to the top quark decaying semileptonically
Candidate const wHad(q1TopHad.P4() + q2TopHad.P4());
Candidate const topHad(wHad.P4() + bTopHad.P4());
//bfMass_TopHad = topHad.M();
LogPt_TopHad = log(topHad.Pt());
AbsEta_TopHad = fabs(topHad.Eta());
LogMass_WHad = log(wHad.M());
//bfPt_WHad = wHad.Pt();
//bfEta_WHad= wHad.Eta();
DeltaR_BTopHadWHad = bTopHad.P4().DeltaR(wHad.P4());
//bfPt_BTopHad = bTopHad.Pt();
//bfEta_BTopHad = bTopHad.Eta();
//PassBTag_BTopHad = 0 + bTagger->IsTagged(bTopHad);
//bfCharge_BTopHad = bTopHad.Charge() * lepton.Charge();
//bfMinPt_Light = min(fabs(q1TopHad.Pt()), fabs(q2TopHad.Pt()));
//bfMaxEta_Light = max(fabs(q1TopHad.Eta()), fabs(q2TopHad.Eta()));
SumCharge_Light = (q1TopHad.Charge() + q2TopHad.Charge()) * lepton.Charge();
NumBTag_Light = 0 + bTagger->IsTagged(q1TopHad) + bTagger->IsTagged(q2TopHad);
DeltaR_Light = q1TopHad.P4().DeltaR(q2TopHad.P4());
// bfMaxMass_BTopHadLight =
// max((bTopHad.P4() + q1TopHad.P4()).M(), (bTopHad.P4() + q2TopHad.P4()).M());
LogDMass_TopHadWHad = log(topHad.M() - wHad.M());
// Calcualate variables with correlations between different objects
double Ht = lepton.Pt() + (*reader)->GetMET().Pt();
for (auto const &j: (*reader)->GetJets())
Ht += j.Pt();
RelHt = (topLep.Pt() + topHad.Pt()) / Ht;
//bfMass_TopLepTopHad = (topLep.P4() + topHad.P4()).M();
//bfPt_TopLepTopHad = (topLep.P4() + topHad.P4()).Pt();
//bfEta_TopLepTopHad = (topLep.P4() + topHad.P4()).Eta();
//bfDeltaR_TopLepTopHad = topLep.P4().DeltaR(topHad.P4());
DCharge_BTopHadBTopLep = (bTopHad.Charge() - bTopLep.Charge()) * lepton.Charge();
}