本文整理汇总了C++中TLorentzVector::Pt方法的典型用法代码示例。如果您正苦于以下问题:C++ TLorentzVector::Pt方法的具体用法?C++ TLorentzVector::Pt怎么用?C++ TLorentzVector::Pt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLorentzVector
的用法示例。
在下文中一共展示了TLorentzVector::Pt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toyMCele_cat1
void toyMCele_cat1(std::string inputFile, std::string outputFile){
// read the ntuples (in pcncu)
TreeReader data(inputFile.data());
// Declare the histogram
TFile* f = new TFile(inputFile.data());
TH1D* h_totalEvents = (TH1D*)f->Get("h_totalEv");
TH1D* h_PRmassNoSIG = new TH1D("h_PRmassNoSIG", "PRmassNoSIG", 40, 40, 240);
TH1D* h_PRmassAll = new TH1D("h_PRmassAll", "PRmassAll", 40, 40, 240);
h_PRmassNoSIG->Sumw2();
h_PRmassAll ->Sumw2();
h_PRmassNoSIG->GetXaxis()->SetTitle("corrPRmass");
h_PRmassAll ->GetXaxis()->SetTitle("corrPRmass");
// begin of event loop
Long64_t nentries = data.GetEntriesFast();
for(Long64_t ev = 0; ev < nentries; ev++){
if( ev % 1000000 == 0 )
fprintf(stderr, "Processing event %lli of %lli\n", ev + 1, nentries);
data.GetEntry(ev);
Float_t eventWeight = data.GetFloat("ev_weight");
TClonesArray* eleP4 = (TClonesArray*) data.GetPtrTObject("eleP4");
Int_t FATnJet = data.GetInt("FATnJet");
Int_t* FATnSubSDJet = data.GetPtrInt("FATnSubSDJet");
Float_t* corrPRmass = data.GetPtrFloat("FATjetPRmassL2L3Corr");
TClonesArray* FATjetP4 = (TClonesArray*) data.GetPtrTObject("FATjetP4");
vector<bool>& FATjetPassIDLoose = *((vector<bool>*) data.GetPtr("FATjetPassIDLoose"));
vector<float>* FATsubjetSDPx = data.GetPtrVectorFloat("FATsubjetSDPx", FATnJet);
vector<float>* FATsubjetSDPy = data.GetPtrVectorFloat("FATsubjetSDPy", FATnJet);
vector<float>* FATsubjetSDPz = data.GetPtrVectorFloat("FATsubjetSDPz", FATnJet);
vector<float>* FATsubjetSDE = data.GetPtrVectorFloat("FATsubjetSDE", FATnJet);
vector<float>* FATsubjetSDCSV = data.GetPtrVectorFloat("FATsubjetSDCSV", FATnJet);
// select good leptons
vector<Int_t> goodLepID;
TLorentzVector* thisLep = NULL;
TLorentzVector* thatLep = NULL;
if( !isPassZee(data,goodLepID) ) continue;
thisLep = (TLorentzVector*)eleP4->At(goodLepID[0]);
thatLep = (TLorentzVector*)eleP4->At(goodLepID[1]);
// select good FATjet
Int_t goodFATJetID = -1;
TLorentzVector* thisJet = NULL;
for(Int_t ij = 0; ij < FATnJet; ij++){
thisJet = (TLorentzVector*)FATjetP4->At(ij);
if( thisJet->Pt() < 200 ) continue;
if( fabs(thisJet->Eta()) > 2.4 ) continue;
if( !FATjetPassIDLoose[ij] ) continue;
if( thisJet->DeltaR(*thisLep) < 0.8 || thisJet->DeltaR(*thatLep) < 0.8 ) continue;
Int_t nsubBjet = 0;
for(Int_t is = 0; is < FATnSubSDJet[ij]; is++){
if( FATsubjetSDCSV[ij][is] > 0.605 ) nsubBjet++;
}
Double_t subjetDeltaR = -1;
if( nsubBjet == 2 ){
TLorentzVector l4_subjet0(0,0,0,0);
TLorentzVector l4_subjet1(0,0,0,0);
l4_subjet0.SetPxPyPzE(FATsubjetSDPx[ij][0],
FATsubjetSDPy[ij][0],
FATsubjetSDPz[ij][0],
FATsubjetSDE [ij][0]);
l4_subjet1.SetPxPyPzE(FATsubjetSDPx[ij][1],
FATsubjetSDPy[ij][1],
FATsubjetSDPz[ij][1],
FATsubjetSDE [ij][1]);
subjetDeltaR = l4_subjet0.DeltaR(l4_subjet1);
}
// deltaR depends loose cut
//.........这里部分代码省略.........
示例2: HHbbbbMikeBase
void HHbbbbMikeBase(int wMs,int wM, string st,string st2,string option=""){
//1=signal ,0=QCD ,2=data-----------------------------------------------------------
int nameRoot=1;
if(st2.find("QCD")!= std::string::npos)nameRoot=0;
if(st2.find("data")!= std::string::npos)nameRoot=2;
//---------------------Thea correction
TFile *f3;
f3=TFile::Open("puppiCorr.root");
TF1 * puppisd_corrGEN,* puppisd_corrRECO_cen,* puppisd_corrRECO_for;
puppisd_corrGEN=(TF1 *) f3->FindObjectAny("puppiJECcorr_gen");
puppisd_corrRECO_cen=(TF1 *) f3->FindObjectAny("puppiJECcorr_reco_0eta1v3");
puppisd_corrRECO_for=(TF1 *) f3->FindObjectAny("puppiJECcorr_reco_1v3eta2v5");
TF1* tf1[3];
tf1[0]=puppisd_corrGEN;
tf1[1]=puppisd_corrRECO_cen;
tf1[2]=puppisd_corrRECO_for;
//option-----------------------------------------------------------
int JESOption=0;
if(option.find("JESUp")!= std::string::npos)JESOption=1;
if(option.find("JESDown")!= std::string::npos)JESOption=2;
if(option.find("BtagUp")!= std::string::npos)JESOption=3;
if(option.find("BtagDown")!= std::string::npos)JESOption=4;
if(option.find("tau21Up")!= std::string::npos)JESOption=5;
if(option.find("tau21Down")!= std::string::npos)JESOption=6;
cout<<"JESOption = "<<JESOption<<endl;
bool printHighPtSubjet=0;
bool isFast=1;
//tuple tree and cutflow variables------------------------------------------------------------------------------------
TFile *f;
TTree *tree;
int nPass[20]={0},total=0,dataPassingcsc=0;
double nPassB[6]={0};
double fixScaleNum[2]={0};
//using for Btag Eff -----------------------------------------------------------------------------
string btagsystematicsType="central";
if(JESOption==3)btagsystematicsType="up";
else if(JESOption==4)btagsystematicsType="down";
BTagCalibration calib("CSVv2L", "subjet_CSVv2_ichep.csv");
BTagCalibrationReader LF(BTagEntry::OP_LOOSE,"central", {"up", "down"});
BTagCalibrationReader HFC(BTagEntry::OP_LOOSE, "central", {"up", "down"}); // other sys types
BTagCalibrationReader HF(BTagEntry::OP_LOOSE,"central",{"up", "down"}); // other sys types
LF.load(calib, BTagEntry::FLAV_UDSG, // btag flavour
"incl"); // measurement type
HFC.load(calib, BTagEntry::FLAV_C, // btag flavour
"lt"); // measurement type
HF.load(calib, BTagEntry::FLAV_B, // btag flavour
"lt"); // measurement type
TFile *f1;
if(nameRoot==2)f1=TFile::Open("btagEffSource/data.root");
else if (nameRoot!=2 && (JESOption==0||JESOption==3||JESOption==4||JESOption==5||JESOption==6))f1=TFile::Open(Form("btagEffSource/%s.root",st2.data()));
else if (nameRoot!=2 && JESOption==1)f1=TFile::Open(Form("btagEffSource/%s_JESUp.root",st2.data()));
else if (nameRoot!=2 && JESOption==2)f1=TFile::Open(Form("btagEffSource/%s_JESDown.root",st2.data()));
TH1D* th1[6];
string btaggingEff[6]={"effD_b","effN_b","effD_c","effN_c","effD_l","effN_l"};
for(int i=0;i<6;i++){
th1[i]=(TH1D*)f1->FindObjectAny(Form("%s_1d",btaggingEff[i].data()));
if(i==1||i==3||i==5)th1[i]->Divide(th1[i-1]);
}
//check for zero btagging SF----------------------------------------------------------------------------------------
TH2D* th3[6];
th3[0]=new TH2D("zeroSF_b","zeroSF_b",200,0,2000,60,-3,3);
th3[1]=new TH2D("zeroSF_c","zeroSF_c",200,0,2000,60,-3,3);
th3[2]=new TH2D("zeroSF_l","zeroSF_l",200,0,2000,60,-3,3);
th3[3]=new TH2D("SF_vs_Pt_b","SF_vs_Pt_b",120,0,1200,40,0.8,1.2);
th3[4]=new TH2D("SF_vs_Pt_c","SF_vs_Pt_c",120,0,1200,40,0.8,1.2);
th3[5]=new TH2D("SF_vs_Pt_l","SF_vs_Pt_l",120,0,1200,40,0.8,1.2);
for(int i=0;i<6;i++)th3[i]->Sumw2();
//check for high btagging SF----------------------------------------------------------------------------------------
TH1D* th4[14];
string SF_jet_sub[8]={"SF_jet0_sub0_pass","SF_jet0_sub1_pass","SF_jet1_sub0_pass","SF_jet1_sub1_pass","SF_jet0_sub0_fail","SF_jet0_sub1_fail","SF_jet1_sub0_fail","SF_jet1_sub1_fail"};
for(int i=0;i<8;i++)th4[i]=new TH1D(Form("%s",SF_jet_sub[i].data()),Form("%s",SF_jet_sub[i].data()),40,0.8,1.2);
string weightName[6]={"weight","weight_0b","weight_1b","weight_2b","weight_2b_ll","weight_2b_onel"};
for(int i=0;i<6;i++)th4[i+8]=new TH1D(Form("%s",weightName[i].data()),Form("%s",weightName[i].data()),40,0,2);
for(int i=0;i<14;i++)th4[i]->Sumw2();
//saving variables----------------------------------------------------------------------------------------
TH1D * th5[300],* th6[300];
for(int i=0;i<2;i++){
for(int j=0;j<2;j++){
for(int k=0;k<5;k++){
th5[(i*2+j)*5+k]=new TH1D(Form("Pt_j%d_sj%d_%db",i,j,k),Form("Pt_j%d_sj%d_%db",i,j,k),200,0,2000);
th5[(i*2+j)*5+k+20]=new TH1D(Form("Eta_j%d_sj%d_%db",i,j,k),Form("Eta_j%d_sj%d_%db",i,j,k),60,-3,3);
th5[(i*2+j)*5+k+85]=new TH1D(Form("subCSV_j%d_sj%d_%db",i,j,k),Form("subCSV_j%d_sj%d_%db",i,j,k),20,0,1);
th5[(i*2+j)*5+k+194]=new TH1D(Form("subCSVCut_j%d_sj%d_%db",i,j,k),Form("subCSVCut_j%d_sj%d_%db",i,j,k),20,0,1);
}
}
for(int k=0;k<5;k++){
th5[i*5+k+40]=new TH1D(Form("deltaR_j%d_%db",i,k),Form("deltaR_j%d_%db",i,k),20,0,1);
th5[i*5+k+50]=new TH1D(Form("Pt_j%d_%db",i,k),Form("Pt_j%d_%db",i,k),200,0,2000);
th5[i*5+k+60]=new TH1D(Form("Eta_j%d_%db",i,k),Form("Eta_j%d_%db",i,k),60,-3,3);
th5[i*5+k+70]=new TH1D(Form("prMassL2L3_j%d_%db",i,k),Form("prMassL2L3_j%d_%db",i,k),15,90,150);
th5[i*5+k+105]=new TH1D(Form("tau21_j%d_%db",i,k),Form("tau21_j%d_%db",i,k),25,0,1);
th5[i*5+k+120]=new TH1D(Form("PuppiSDMassL2L3_j%d_%db",i,k),Form("PuppiSDMassL2L3_j%d_%db",i,k),15,90,150);
th5[i*5+k+130]=new TH1D(Form("puppiTau21_j%d_%db",i,k),Form("puppiTau21_j%d_%db",i,k),25,0,1);
th5[i*5+k+140]=new TH1D(Form("prMass_j%d_%db",i,k),Form("prMass_j%d_%db",i,k),15,90,150);
th5[i*5+k+150]=new TH1D(Form("PuppiSDMass_j%d_%db",i,k),Form("PuppiSDMass_j%d_%db",i,k),15,90,150);
th5[i*5+k+170]=new TH1D(Form("doubleSV_j%d_%db",i,k),Form("doubleSV_j%d_%db",i,k),40,-1,1);
th5[i*5+k+184]=new TH1D(Form("FatSV_j%d_%db",i,k),Form("FatSV_j%d_%db",i,k),20,0,1);
th5[i*5+k+250]=new TH1D(Form("PuppiSDMassThea_j%d_%db",i,k),Form("PuppiSDMassThea_j%d_%db",i,k),15,90,150);
}
//.........这里部分代码省略.........
示例3: main
int main(int argc, char * argv[]) {
// first argument - config file
// second argument - filelist
using namespace std;
// **** configuration
Config cfg(argv[1]);
// vertex cuts
const float ndofVertexCut = cfg.get<float>("NdofVertexCut");
const float zVertexCut = cfg.get<float>("ZVertexCut");
const float dVertexCut = cfg.get<float>("DVertexCut");
// electron cuta
const float ptElectronLowCut = cfg.get<float>("ptElectronLowCut");
const float ptElectronHighCut = cfg.get<float>("ptElectronHighCut");
const float etaElectronCut = cfg.get<float>("etaElectronCut");
const float dxyElectronCut = cfg.get<float>("dxyElectronCut");
const float dzElectronCut = cfg.get<float>("dzElectronCut");
const float isoElectronLowCut = cfg.get<float>("isoElectronLowCut");
const float isoElectronHighCut = cfg.get<float>("isoElectronHighCut");
const bool applyElectronId = cfg.get<bool>("ApplyElectronId");
// tau cuts
const float ptTauLowCut = cfg.get<float>("ptTauLowCut");
const float ptTauHighCut = cfg.get<float>("ptTauHighCut");
const float etaTauCut = cfg.get<float>("etaTauCut");
const bool applyTauId = cfg.get<bool>("ApplyTauId");
// pair selection
const float dRleptonsCut = cfg.get<float>("dRleptonsCut");
// additional lepton veto
const float ptDiElectronVeto = cfg.get<float>("ptDiElectronVeto");
const float etaDiElectronVeto = cfg.get<float>("etaDiElectronVeto");
// topological cuts
const float dZetaCut = cfg.get<float>("dZetaCut");
const bool oppositeSign = cfg.get<bool>("oppositeSign");
const float deltaRTrigMatch = cfg.get<float>("DRTrigMatch");
const bool isIsoR03 = cfg.get<bool>("IsIsoR03");
const float jetEtaCut = cfg.get<float>("JetEtaCut");
const float jetPtLowCut = cfg.get<float>("JetPtLowCut");
const float jetPtHighCut = cfg.get<float>("JetPtHighCut");
const float dRJetLeptonCut = cfg.get<float>("dRJetLeptonCut");
const bool applyJetPfId = cfg.get<bool>("ApplyJetPfId");
const bool applyJetPuId = cfg.get<bool>("ApplyJetPuId");
const float bJetEtaCut = cfg.get<float>("bJetEtaCut");
const float btagCut = cfg.get<float>("btagCut");
// check overlap
const bool checkOverlap = cfg.get<bool>("CheckOverlap");
const bool debug = cfg.get<bool>("debug");
// **** end of configuration
// file name and tree name
TString rootFileName(argv[2]);
std::ifstream fileList(argv[2]);
std::ifstream fileList0(argv[2]);
std::string ntupleName("makeroottree/AC1B");
rootFileName += "_et_Sync.root";
std::cout <<rootFileName <<std::endl;
// output fileName with histograms
TFile * file = new TFile( rootFileName ,"recreate");
file->cd("");
TH1F * inputEventsH = new TH1F("inputEventsH","",1,-0.5,0.5);
TTree * tree = new TTree("TauCheck","TauCheck");
Spring15Tree *otree = new Spring15Tree(tree);
int nTotalFiles = 0;
std::string dummy;
// count number of files --->
while (fileList0 >> dummy) nTotalFiles++;
int nEvents = 0;
int selEvents = 0;
int nFiles = 0;
vector<int> runList; runList.clear();
vector<int> eventList; eventList.clear();
int nonOverlap = 0;
std::ifstream fileEvents("overlap.txt");
int Run, Event, Lumi;
if (checkOverlap) {
std::cout << "Non-overlapping events ->" << std::endl;
while (fileEvents >> Run >> Event >> Lumi) {
runList.push_back(Run);
//.........这里部分代码省略.........
示例4: PreSelection
// // //
bool analysisClass::PreSelection(TString Process){
//
int TotalN=0;
int TotalTau=0;
int TotalMu=0;
int TotalEl=0;
int TotalJet=0;
int TotalBJet=0;
TotalTau = TauCounter();
TotalMu = MuCounter();
TotalEl = ElCounter();
TotalJet = JetCounter();
TotalBJet = BJetCounter();
TotalN = TotalTau + TotalMu + TotalEl + TotalJet;
//
double LeadMuTauDeltaR=0;
TLorentzVector Mu;
TLorentzVector Tau;
Mu.SetPtEtaPhiM(0,0,0,0);
Tau.SetPtEtaPhiM(0,0,0,0);
for(unsigned int iTauR=0; iTauR<HPSTauPt->size(); iTauR++){
if( !tauRisoCheck(iTauR) )continue;
if( tauPtcorr(iTauR)>Tau.Pt() ){
Tau.SetPtEtaPhiM(tauPtcorr(iTauR), HPSTauEta->at(iTauR), HPSTauPhi->at(iTauR), 0);
}
}
for(unsigned int iMuR=0; iMuR<MuonPt->size(); iMuR++){
if( !muRisoCheck(iMuR) )continue;
if( muPtcorr(iMuR)>Mu.Pt() ){
Mu.SetPtEtaPhiM(muPtcorr(iMuR), MuonEta->at(iMuR), MuonPhi->at(iMuR), 0);
}
}
if( TotalMu>0 && TotalTau>0 ) LeadMuTauDeltaR=Mu.DeltaR(Tau);
//
//
if( Process != "Neutr" && Process != "Neutr2Jet" && Process != "NeutrNoQCD" && Process != "Neutr2JetNoQCD" && Process != "Neutr2Jet250ST" && Process != "Neutr2Jet250STtuneZ"
&& Process != "Neutr0Btag" && Process != "Neutr0BtagNoQCD" && Process != "Neutr2Jet350STtuneZ" && Process != "Neutr1Jet350STtuneZ"
&& Process != "Neutr1Jet350ST" && Process != "Neutr1Jet300ST" && Process != "Neutr1Jet500ST"
&& Process != "ZToMuMuAnalysis" && Process != "ZToMuTauAnalysis" && Process != "TTBar" && Process != "WJets" && Process != "FakeTaus" && Process != "ControlRegion1"
&& Process != "FakeMuons" && Process != "FakeMuonsV2" && Process != "FakeMuonsV3" && Process != "ZJets" && Process != "QCD" && Process != "LQ3M400" ){ return false; }
//
if( Process == "Neutr" ){
//if( MaxDiLepInvMass()<55 ) return false;
if( MaxMuMuInvMass()>0 && MaxMuMuInvMass()<50 ) return false;
//if( isZToMuMu() ) return false;//required to exclude events in MuTrig Calculation
if( TotalJet<1 ) return false;
}
if( Process == "Neutr2Jet" ){
if( MaxMuMuInvMass()>0 && MaxMuMuInvMass()<50 ) return false;
if( TotalJet<2 ) return false;
}
if( Process == "Neutr2Jet250ST" ){
if( MaxMuMuInvMass()>0 && MaxMuMuInvMass()<50 ) return false;
if( TotalJet<2 ) return false;
if( ST()<250 ) return false;
}
if( Process == "Neutr2Jet250STtuneZ" ){
if( MaxMuMuInvMass()>0 && MaxMuMuInvMass()<55 ) return false;
if( MaxMuTauInvMass()>0 && MaxMuTauInvMass()<55 ) return false;
if( MaxTauTauInvMass()>0 && MaxTauTauInvMass()<55 ) return false;
if( TotalJet<2 ) return false;
if( ST()<250 ) return false;
}
if( Process == "Neutr2Jet350STtuneZ" ){
if( MaxMuMuInvMass()>0 && MaxMuMuInvMass()<55 ) return false;
if( MaxMuTauInvMass()>0 && MaxMuTauInvMass()<55 ) return false;
if( MaxTauTauInvMass()>0 && MaxTauTauInvMass()<55 ) return false;
if( TotalJet<2 ) return false;
if( ST()<350 ) return false;
}
if( Process == "Neutr1Jet350STtuneZ" ){
if( MaxMuMuInvMass()>0 && MaxMuMuInvMass()<55 ) return false;
if( MaxMuTauInvMass()>0 && MaxMuTauInvMass()<55 ) return false;
if( MaxTauTauInvMass()>0 && MaxTauTauInvMass()<55 ) return false;
if( TotalJet<1 ) return false;
if( ST()<350 ) return false;
}
if( Process == "Neutr1Jet350ST" ){
if( TotalJet<1 ) return false;
if( ST()<350 ) return false;
}
if( Process == "Neutr1Jet500ST" ){
if( TotalJet<1 ) return false;
if( ST()<500 ) return false;
}
if( Process == "Neutr1Jet300ST" ){
if( TotalJet<1 ) return false;
if( ST()<300 ) return false;
}
if( Process == "Neutr0Btag"){
if( MaxMuMuInvMass()>0 && MaxMuMuInvMass()<50 ) return false;
if( TotalBJet>0 ) return false;
}
if( Process == "Neutr0BtagNoQCD"){
if( MaxMuMuInvMass()>0 && MaxMuMuInvMass()<50 ) return false;
if( TotalBJet>0 ) return false;
if( METlepMT("Mu")<75 ) return false;
}
if( Process == "NeutrNoQCD" ){
//.........这里部分代码省略.........
示例5: fitSingleMass
void fitSingleMass( const std::string& basedir, float mass, const std::string& width, TGraphErrors* gr_mean, TGraphErrors* gr_sigma, TGraphErrors* gr_width, TGraphErrors* gr_alpha1, TGraphErrors* gr_n1, TGraphErrors* gr_alpha2, TGraphErrors* gr_n2 ) {
std::string outdir = "genSignalShapes";
system( Form("mkdir -p %s", outdir.c_str()) );
std::string dataset( Form( "GluGluSpin0ToZGamma_ZToLL_W_%s_M_%.0f_TuneCUEP8M1_13TeV_pythia8", width.c_str(), mass ) );
std::cout << "-> Starting: " << dataset << std::endl;
system( Form("ls %s/%s/crab_%s/*/0000/genAna_1.root >> toBeAdded.txt", basedir.c_str(), dataset.c_str(), dataset.c_str() ) );
TChain* tree = new TChain("mt2");
ifstream ifs("toBeAdded.txt");
while( ifs.good() ) {
std::string fileName;
ifs >> fileName;
TString fileName_tstr(fileName);
if( !fileName_tstr.Contains("pnfs") ) continue;
tree->Add(Form("$DCAP/%s/mt2", fileName.c_str()) );
}
system( "rm toBeAdded.txt" );
if( tree->GetEntries()==0 ) return;
int ngenPart;
tree->SetBranchAddress( "ngenPart", &ngenPart );
float genPart_pt[100];
tree->SetBranchAddress( "genPart_pt", genPart_pt );
float genPart_eta[100];
tree->SetBranchAddress( "genPart_eta", genPart_eta );
float genPart_phi[100];
tree->SetBranchAddress( "genPart_phi", genPart_phi );
float genPart_mass[100];
tree->SetBranchAddress( "genPart_mass", genPart_mass );
int genPart_pdgId[100];
tree->SetBranchAddress( "genPart_pdgId", genPart_pdgId );
int genPart_motherId[100];
tree->SetBranchAddress( "genPart_motherId", genPart_motherId );
int genPart_status[100];
tree->SetBranchAddress( "genPart_status", genPart_status );
RooRealVar* x = new RooRealVar("boss_mass", "boss_mass", mass, 0.5*mass, 1.5*mass );
RooDataSet* data = new RooDataSet( "data", "data", RooArgSet(*x) );
int nentries = tree->GetEntries();
for( int iEntry = 0; iEntry<nentries; ++iEntry ) {
if( iEntry % 25000 == 0 ) std::cout << " Entry: " << iEntry << " / " << nentries << std::endl;
tree->GetEntry(iEntry);
TLorentzVector leptPlus;
TLorentzVector leptMinus;
TLorentzVector photon;
bool foundLeptPlus = false;
bool foundLeptMinus = false;
bool foundPhoton = false;
bool tauEvent = false;
for( int iPart=0; iPart<ngenPart; ++iPart ) {
if( genPart_status[iPart]!=1 ) continue;
if( abs(genPart_pdgId[iPart])==15 ) {
tauEvent = true;
break;
}
if( (genPart_pdgId[iPart]==+11 || genPart_pdgId[iPart]==+13) && genPart_motherId[iPart]==23 ) {
leptMinus.SetPtEtaPhiM( genPart_pt[iPart], genPart_eta[iPart], genPart_phi[iPart], genPart_mass[iPart] );
foundLeptMinus = true;
}
if( (genPart_pdgId[iPart]==-11 || genPart_pdgId[iPart]==-13) && genPart_motherId[iPart]==23 ) {
leptPlus.SetPtEtaPhiM( genPart_pt[iPart], genPart_eta[iPart], genPart_phi[iPart], genPart_mass[iPart] );
foundLeptPlus = true;
}
if( genPart_pdgId[iPart]==22 && genPart_motherId[iPart]==25 ) {
photon.SetPtEtaPhiM( genPart_pt[iPart], genPart_eta[iPart], genPart_phi[iPart], genPart_mass[iPart] );
foundPhoton = true;
}
} // for genparts
if( tauEvent ) continue;
if( !foundLeptPlus || !foundLeptMinus || !foundPhoton ) continue;
if( photon.Pt() < 40. ) continue;
float ptMax = TMath::Max( leptPlus.Pt(), leptMinus.Pt() );
float ptMin = TMath::Min( leptPlus.Pt(), leptMinus.Pt() );
if( ptMax<25. ) continue;
if( ptMin<20. ) continue;
if( fabs( photon.Eta() ) > 2.5 ) continue;
//.........这里部分代码省略.........
示例6: main
//.........这里部分代码省略.........
int nentries = tree->GetEntries();
for( int iEntry=0; iEntry<nentries; ++iEntry ) {
if( iEntry % 50000 == 0 ) std::cout << " Entry: " << iEntry << " / " << nentries << std::endl;
myTree.GetEntry(iEntry);
float weight = (myTree.isData) ? 1. : myTree.evt_scale1fb;
// pu reweighting:
if( !myTree.isData ) {
//weight *= myTree.puWeight;
}
// first find leptons
//if( myTree.ngenLep!=2 ) continue;
//TLorentzVector genLep0, genLep1;
//genLep0.SetPtEtaPhiM( myTree.genLep_pt[0], myTree.genLep_eta[0], myTree.genLep_phi[0], myTree.genLep_mass[0] );
//genLep1.SetPtEtaPhiM( myTree.genLep_pt[1], myTree.genLep_eta[1], myTree.genLep_phi[1], myTree.genLep_mass[1] );
std::vector<TLorentzVector> genLeptons;
int genLeptType = 0;
for( int iGen=0; iGen<myTree.ngenPart && genLeptons.size()<2; ++iGen ) {
if( myTree.genPart_pt[iGen]<1. ) continue;
if( myTree.genPart_status[iGen]!=1 ) continue;
if( abs(myTree.genPart_pdgId[iGen])!=11 && abs(myTree.genPart_pdgId[iGen])!=13 ) continue;
if( myTree.genPart_motherId[iGen]!=myTree.genPart_pdgId[iGen] ) continue;
TLorentzVector tmpLep;
tmpLep.SetPtEtaPhiM( myTree.genPart_pt[iGen], myTree.genPart_eta[iGen], myTree.genPart_phi[iGen], myTree.genPart_mass[iGen] );
genLeptons.push_back(tmpLep);
genLeptType = abs(myTree.genPart_pdgId[iGen]);
}
if( genLeptType!=11 && genLeptType!=13 ) continue;
if( genLeptons.size()<2 ) continue;
TLorentzVector genLep0, genLep1;
genLep0 = genLeptons[0];
genLep1 = genLeptons[1];
float maxPt = TMath::Max( genLep0.Pt(), genLep1.Pt() );
float minPt = TMath::Min( genLep0.Pt(), genLep1.Pt() );
if( maxPt<25. ) continue;
if( minPt<20. ) continue;
if( fabs(genLep0.Eta()) > 2.4 ) continue;
if( fabs(genLep1.Eta()) > 2.4 ) continue;
TLorentzVector genZ = genLep0 + genLep1;
if( genZ.M()<50. ) continue;
//if( genZ.M()<50. || genZ.M()>130. ) continue;
TLorentzVector genPhoton;
bool foundGenPhoton = false;
for( int iGen=0; iGen<myTree.ngenPart && !foundGenPhoton; ++iGen ) {
if( myTree.genPart_pdgId[iGen]!=22 ) continue;
if( myTree.genPart_status[iGen]!=1 ) continue;
示例7: UpsCheck
void UpsCheck() {
TFile *file = TFile::Open("/scratch_rigel/CMSTrees/PbPb_Data/MegaTree/OniaTree_MEGA_Peripheral30100_PromptReco_262548_263757.root");
//Track Tree Set Up
TTree *trackTree = (TTree*)file->Get("anaTrack/trackTree");
trackTree->SetBranchStatus("*",0);
trackTree->SetBranchStatus("nLumi", 1);
trackTree->SetBranchStatus("nTrk", 1);
trackTree->SetBranchStatus("trkPt", 1);
trackTree->SetBranchStatus("trkEta", 1);
trackTree->SetBranchStatus("trkPhi", 1);
trackTree->SetBranchStatus("trkCharge", 1);
trackTree->SetBranchStatus("nEv", 1);
Int_t Lumi, nTrk, event;
Float_t eta[9804];
Float_t phi[9804];
Int_t charge[9804];
Float_t pT[9804];
trackTree->SetBranchAddress("nLumi", &Lumi);
trackTree->SetBranchAddress("nTrk", &nTrk);
trackTree->SetBranchAddress("trkPt", pT);
trackTree->SetBranchAddress("trkEta", eta);
trackTree->SetBranchAddress("trkPhi", phi);
trackTree->SetBranchAddress("trkCharge", charge);
trackTree->SetBranchAddress("nEv", &event);
//Dimuon Tree Set Up
TTree *myTree = (TTree*)file->Get("hionia/myTree");
myTree->SetBranchStatus("*",0);
myTree->SetBranchStatus("Reco_QQ_4mom",1);
myTree->SetBranchStatus("Reco_QQ_mupl_4mom",1);
myTree->SetBranchStatus("Reco_QQ_mumi_4mom",1);
myTree->SetBranchStatus("Reco_QQ_size",1);
myTree->SetBranchStatus("Centrality",1);
myTree->SetBranchStatus("HLTriggers",1);
myTree->SetBranchStatus("Reco_QQ_trig",1);
myTree->SetBranchStatus("Reco_QQ_sign",1);
TClonesArray *Reco_QQ_4mom=0;
TClonesArray *Reco_QQ_mupl_4mom=0;
TClonesArray *Reco_QQ_mumi_4mom=0;
TLorentzVector *dimuon;
TLorentzVector *mumi;
TLorentzVector *mupl;
double events=0;
events = myTree->GetEntries();
cout << events << endl;
Int_t QQsize=0;
Int_t Centrality=0;
ULong64_t HLTrigger=0;
ULong64_t Reco_QQ_trig[21];
Int_t Reco_QQ_sign[21];
myTree->SetBranchAddress("Centrality",&Centrality);
myTree->SetBranchAddress("HLTriggers",&HLTrigger);
myTree->SetBranchAddress("Reco_QQ_4mom",&Reco_QQ_4mom);
myTree->SetBranchAddress("Reco_QQ_mupl_4mom", &Reco_QQ_mupl_4mom);
myTree->SetBranchAddress("Reco_QQ_mumi_4mom", &Reco_QQ_mumi_4mom);
myTree->SetBranchAddress("Reco_QQ_size", &QQsize);
myTree->SetBranchAddress("Reco_QQ_trig", Reco_QQ_trig);
myTree->SetBranchAddress("Reco_QQ_sign", Reco_QQ_sign);
//Histogram Initialization
TH1D* phidiffmid = new TH1D( "phidiffmid", "#Delta#phi for mid mass band (9.0-9.8 GeV)",128,0,3.2);
TH1D* rapdiffmid = new TH1D( "rapdiffmid", "#Delta#eta for mid mass band (9.0-9.8 GeV)",200,-5, 5);
TH2D* midmass = new TH2D("midmass","#Delta#phi vs #Delta#eta for mid mass band",128,0,3.2,200,-5,5);
//Event Loop
int test = 0;
int mid = 0;
int index = 0;
for(int i = 0; i < trackTree->GetEntries(); i++) {
trackTree->GetEntry(i);
myTree->GetEntry(i);
if(Centrality > 140) {
if((HLTrigger&128) == 128 || (HLTrigger&256) == 256) {
for(Int_t j=0; j < QQsize; j++) {
dimuon = (TLorentzVector*)Reco_QQ_4mom->At(j);
mumi = (TLorentzVector*)Reco_QQ_mumi_4mom->At(j);
mupl = (TLorentzVector*)Reco_QQ_mupl_4mom->At(j);
if(((Reco_QQ_trig[j]&128) == 128 || (Reco_QQ_trig[j]&256) == 256) && Reco_QQ_sign[j] == 0) {
if(mumi->Pt() > 4 && mupl->Pt() > 4 && TMath::Abs(mumi->Eta()) < 2.4 && TMath::Abs(mupl->Eta()) < 2.4 ) {
index++;
if(dimuon->M() > 9.3 && dimuon->M() < 9.6) {
test++;
for(Int_t k=0; k < nTrk; k++) {
if(TMath::Abs(eta[k]) < 2.4 && pT[k] > .1 && TMath::Abs(charge[k]) == 1) {
if(TMath::Abs(dimuon->Phi() - phi[k]) > 3.1416) {
phidiffmid->Fill(6.2832-TMath::Abs(phi[k]-dimuon->Phi()));
rapdiffmid->Fill(eta[k] - dimuon->Rapidity());
midmass->Fill(6.2832-TMath::Abs(phi[k]-dimuon->Phi()),eta[k]-dimuon->Rapidity());
}
if(TMath::Abs(dimuon->Phi() - phi[k]) <= 3.1416) {
phidiffmid->Fill(TMath::Abs(phi[k] - dimuon->Phi()));
rapdiffmid->Fill(eta[k]-dimuon->Rapidity());
midmass->Fill(TMath::Abs(phi[k]-dimuon->Phi()),eta[k]-dimuon->Rapidity());
}
}
}
}
}
} }
}
} }
TFile out("EtaPhiMidCent.root", "RECREATE");
//.........这里部分代码省略.........
示例8: iJet
///
///________________________________________________________________________________
///
Bool_t
UEJetAreaFinder::find( TClonesArray& Input, vector<UEJetWithArea>& _jets )
{
/// return if no four-vectors are provided
if ( Input.GetSize() == 0 ) return kFALSE;
/// prepare input
std::vector<fastjet::PseudoJet> fjInputs;
fjInputs.reserve ( Input.GetSize() );
int iJet( 0 );
for( int i(0); i < Input.GetSize(); ++i )
{
TLorentzVector *v = (TLorentzVector*)Input.At(i);
if ( TMath::Abs(v->Eta()) > etaRegionInput ) continue;
if ( v->Pt() < ptThreshold ) continue;
fjInputs.push_back (fastjet::PseudoJet (v->Px(), v->Py(), v->Pz(), v->E()) );
fjInputs.back().set_user_index(iJet);
++iJet;
}
/// return if no four-vectors in visible phase space
if ( fjInputs.size() == 0 ) return kFALSE;
/// print out info on current jet algorithm
// cout << endl;
// cout << mJetDefinition->description() << endl;
// cout << theAreaDefinition->description() << endl;
/// return if active area is not chosen to be calculated
if ( ! theAreaDefinition ) return kFALSE;
// cout << "fastjet::ClusterSequenceActiveArea* clusterSequence" << endl;
fastjet::ClusterSequenceArea* clusterSequence
= new fastjet::ClusterSequenceArea (fjInputs, *mJetDefinition, *theAreaDefinition );
// cout << "retrieve jets for selected mode" << endl;
/// retrieve jets for selected mode
double mJetPtMin( 1. );
std::vector<fastjet::PseudoJet> jets( clusterSequence->inclusive_jets (mJetPtMin) );
unsigned int nJets( jets.size() );
if ( nJets == 0 )
{
delete clusterSequence;
return kFALSE;
}
//Double_t ptByArea[ nJets ];
// int columnwidth( 10 );
//cout << "found " << jets.size() << " jets" << endl;
// cout.width( 5 );
// cout << "jet";
// cout.width( columnwidth );
// cout << "eta";
// cout.width( columnwidth );
// cout << "phi";
// cout.width( columnwidth );
// cout << "pT";
// cout.width( columnwidth );
// cout << "jetArea";
// cout.width( 15 );
// cout << "pT / jetArea";
// cout << endl;
_jets.reserve( nJets );
vector< fastjet::PseudoJet > sorted_jets ( sorted_by_pt( jets ));
for ( int i(0); i<nJets; ++i )
{
//ptByArea[i] = jets[i].perp()/clusterSequence->area(jets[i]);
// cout.width( 5 );
// cout << i;
// cout.width( columnwidth );
// cout << jets[i].eta();
// cout.width( columnwidth );
// cout << jets[i].phi();
// cout.width( columnwidth );
// cout << jets[i].perp();
// cout.width( columnwidth );
// cout << clusterSequence->area(jets[i]);
// cout.width( 15 );
// cout << ptByArea[i];
// cout << endl;
/// save
///
/// TLorentzVector
/// area
/// nconstituents
fastjet::PseudoJet jet( sorted_jets[i] );
//.........这里部分代码省略.........
示例9: phibin
void rochcor_42X::momcor_mc( TLorentzVector& mu, float charge, float sysdev, int runopt){
//sysdev == num : deviation = num
float ptmu = mu.Pt();
float muphi = mu.Phi();
float mueta = mu.Eta(); // same with mu.Eta() in Root
float px = mu.Px();
float py = mu.Py();
float pz = mu.Pz();
float e = mu.E();
int mu_phibin = phibin(muphi);
int mu_etabin = etabin(mueta);
//float mptsys = sran.Gaus(0.0,sysdev);
float dm = 0.0;
float da = 0.0;
if(runopt == 0){
dm = (mcor_bfA[mu_phibin][mu_etabin] + mptsys_mc_dm[mu_phibin][mu_etabin]*mcor_bfAer[mu_phibin][mu_etabin])/mmavgA[mu_phibin][mu_etabin];
da = mcor_maA[mu_phibin][mu_etabin] + mptsys_mc_da[mu_phibin][mu_etabin]*mcor_maAer[mu_phibin][mu_etabin];
}else if(runopt == 1){
dm = (mcor_bfB[mu_phibin][mu_etabin] + mptsys_mc_dm[mu_phibin][mu_etabin]*mcor_bfBer[mu_phibin][mu_etabin])/mmavgB[mu_phibin][mu_etabin];
da = mcor_maB[mu_phibin][mu_etabin] + mptsys_mc_da[mu_phibin][mu_etabin]*mcor_maBer[mu_phibin][mu_etabin];
}
float cor = 1.0/(1.0 + dm + charge*da*ptmu);
//for the momentum tuning - eta,phi,Q correction
px *= cor;
py *= cor;
pz *= cor;
e *= cor;
float recm = 0.0;
float drecm = 0.0;
float delta = 0.0;
float sf = 0.0;
float gscler = 0.0;
float deltaer = 0.0;
float sfer = 0.0;
if(runopt==0){
recm = recmA;
drecm = drecmA;
delta = deltaA;
sf = sfA;
gscler = TMath::Sqrt( TMath::Power(mgsclA_stat,2) + TMath::Power(mgsclA_syst,2) );
deltaer = TMath::Sqrt( TMath::Power(deltaA_stat,2) + TMath::Power(deltaA_syst,2) );
sfer = TMath::Sqrt( TMath::Power(sfA_stat,2) + TMath::Power(sfA_syst,2) );
}else if(runopt==1){
recm = recmB;
drecm = drecmB;
delta = deltaB;
sf = sfB;
gscler = TMath::Sqrt( TMath::Power(mgsclB_stat,2) + TMath::Power(mgsclB_syst,2) );
deltaer = TMath::Sqrt( TMath::Power(deltaB_stat,2) + TMath::Power(deltaB_syst,2) );
sfer = TMath::Sqrt( TMath::Power(sfB_stat,2) + TMath::Power(sfB_syst,2) );
}
float tune = 1.0/(1.0 + (delta + sysdev*deltaer)*sqrt(px*px + py*py)*eran.Gaus(1.0,(sf + sysdev*sfer)));
px *= (tune);
py *= (tune);
pz *= (tune);
e *= (tune);
float gscl = (genm_smr/recm);
px *= (gscl + sysdev*gscler);
py *= (gscl + sysdev*gscler);
pz *= (gscl + sysdev*gscler);
e *= (gscl + sysdev*gscler);
mu.SetPxPyPzE(px,py,pz,e);
}
示例10: RunPidGetterQAEff
void RunPidGetterQAEff()
{
TString PidFrameworkDir = "/lustre/nyx/cbm/users/klochkov/soft/PidFramework/";
gSystem->Load( PidFrameworkDir + "build/libPid");
gStyle->SetOptStat(0000);
TFile *f2 = new TFile("pid_0.root");
TTree *PidTree = (TTree*) f2->Get("PidTree");
TofPidGetter *getter = new TofPidGetter();
TBranch *PidGet = PidTree->GetBranch("TofPidGetter");
PidGet->SetAddress(&getter);
PidGet->GetEntry(0);
Float_t ret[3];
TProfile *hEffP = new TProfile ("hEffP", "", 100, 0, 10);
TProfile *hEffPi = new TProfile ("hEffPi", "", 100, 0, 6);
TProfile *hEffK = new TProfile ("hEffK", "", 100, 0, 5);
TProfile *hEffPSigma = new TProfile ("hEffPSigma", "", 100, 0, 10);
TProfile *hEffPiSigma = new TProfile ("hEffPiSigma", "", 100, 0, 6);
TProfile *hEffKSigma = new TProfile ("hEffKSigma", "", 100, 0, 5);
TProfile2D *hEffPtYP = new TProfile2D ("hEffPtYP", "", 100, -2.5, 2.5, 100, 0, 4);
TProfile2D *hEffPtYK = new TProfile2D ("hEffPtYK", "", 100, -2.5, 2.5, 100, 0, 4);
TProfile2D *hEffPtYPi = new TProfile2D ("hEffPtYPi", "", 100, -2.5, 2.5, 100, 0, 4);
TString InTreeFileName = "/lustre/nyx/cbm/users/dblau/cbm/mc/UrQMD/AuAu/10AGeV/sis100_electron/SC_ON/2016_09_01/tree/11111.root";
TFile *InFile = new TFile(InTreeFileName);
TTree *InTree = (TTree*) InFile->Get("fDataTree");
DataTreeEvent* DTEvent;
InTree -> SetBranchAddress("DTEvent",&DTEvent);
int nevents = 100000;//InTree->GetEntries();
int outputstep = 100;
std::cout << "Entries = " << nevents << std::endl;
for (int j=0;j<nevents;j++)
{
if ( (j+1) % outputstep == 0) std::cout << j+1 << "/" << nevents << "\r" << std::flush;
InTree->GetEntry(j);
Int_t Nmc[3] = {100,100,100};
Int_t Ntof[3] = {0,0,0};
Int_t PdgCode[3] = {2212, 212, 211};
Double_t sigmas [3] = {0,0,0};
for (int i=0;i<DTEvent->GetNTracks(); i++)
{
TLorentzVector v;
DataTreeTrack* track = DTEvent -> GetTrack(i);
DataTreeMCTrack* mctrack = DTEvent -> GetMCTrack(i);
Double_t p = mctrack->GetPt() * TMath::CosH( mctrack->GetEta() );
if (track->GetTOFHitId() < 0)
{
if (mctrack->GetPdgId() == 2212 )
{
v.SetPtEtaPhiM (track->GetPt(0), track->GetEta(0), track->GetPhi(0), 0.9386);
hEffP->Fill ( p, 0 );
hEffPSigma->Fill ( p, 0 );
hEffPtYP -> Fill( v.Rapidity() - 1.52, v.Pt(), 0 );
}
if (mctrack->GetPdgId() == 321 )
{
v.SetPtEtaPhiM (track->GetPt(0), track->GetEta(0), track->GetPhi(0), 0.5);
hEffK->Fill ( p, 0 );
hEffKSigma->Fill ( p, 0 );
hEffPtYK -> Fill( v.Rapidity() - 1.52, v.Pt(), 0 );
}
if (mctrack->GetPdgId() == 211 )
{
v.SetPtEtaPhiM (track->GetPt(0), track->GetEta(0), track->GetPhi(0), 0.14);
hEffPi->Fill ( p, 0 );
hEffPiSigma->Fill ( p, 0);
hEffPtYPi -> Fill( v.Rapidity() - 1.52, v.Pt(), 0 );
}
continue;
}
//
DataTreeTOFHit* toftrack = DTEvent -> GetTOFHit(track->GetTOFHitId());
p = toftrack->GetP();
Double_t m2 = toftrack->GetMass2 ();
Bool_t cut = toftrack->GetBeta() > 0.1 && ( track->GetChiSq(0)/track->GetNDF(0) < 3 ) && p > 1.0 ;
if ( !cut ) continue;
getter->GetBayesProbability (m2, p, ret);
sigmas[0] = getter->GetSigmaProton (m2, p);
sigmas[1] = getter->GetSigmaKaon (m2, p);
sigmas[2] = getter->GetSigmaPion (m2, p);
// std::cout << "pdg = " << mctrack->GetPdgId() << " p = " << p << " Sp = " << sigmas[0] << " Sk = " << sigmas[1]<< " Spi = " << sigmas[2] << std::endl;
//.........这里部分代码省略.........
示例11: get_csv_wgt
double get_csv_wgt( vvdouble jets, vdouble jetCSV, vint jetFlavor, int iSys, double &csvWgtHF, double &csvWgtLF, double &csvWgtCF ){
int iSysHF = 0;
switch(iSys){
case 11: iSysHF=1; break;
case 12: iSysHF=2; break;
case 17: iSysHF=3; break;
case 18: iSysHF=4; break;
case 21: iSysHF=5; break;
case 22: iSysHF=6; break;
case 25: iSysHF=7; break;
case 26: iSysHF=8; break;
default : iSysHF = 0; break;
}
int iSysC = 0;
switch(iSys){
case 29: iSysC=1; break;
case 30: iSysC=2; break;
case 31: iSysC=3; break;
case 32: iSysC=4; break;
default : iSysC = 0; break;
}
int iSysLF = 0;
switch(iSys){
case 11: iSysLF=1; break;
case 12: iSysLF=2; break;
case 19: iSysLF=3; break;
case 20: iSysLF=4; break;
case 23: iSysLF=5; break;
case 24: iSysLF=6; break;
case 27: iSysLF=7; break;
case 28: iSysLF=8; break;
default : iSysLF = 0; break;
}
double csvWgthf = 1.;
double csvWgtC = 1.;
double csvWgtlf = 1.;
for( int iJet=0; iJet<int(jets.size()); iJet++ ){
TLorentzVector myJet;
myJet.SetPxPyPzE( jets[iJet][0], jets[iJet][1], jets[iJet][2], jets[iJet][3] );
double csv = jetCSV[iJet];
double jetPt = myJet.Pt();
double jetAbsEta = fabs(myJet.Eta());
int flavor = jetFlavor[iJet];
int iPt = -1; int iEta = -1;
if (jetPt >=19.99 && jetPt<30) iPt = 0;
else if (jetPt >=30 && jetPt<40) iPt = 1;
else if (jetPt >=40 && jetPt<60) iPt = 2;
else if (jetPt >=60 && jetPt<100) iPt = 3;
else if (jetPt >=100 && jetPt<160) iPt = 4;
else if (jetPt >=160 && jetPt<10000) iPt = 5;
if (jetAbsEta >=0 && jetAbsEta<0.8 ) iEta = 0;
else if ( jetAbsEta>=0.8 && jetAbsEta<1.6 ) iEta = 1;
else if ( jetAbsEta>=1.6 && jetAbsEta<2.41 ) iEta = 2;
if (iPt < 0 || iEta < 0) std::cout << "Error, couldn't find Pt, Eta bins for this b-flavor jet, jetPt = " << jetPt << ", jetAbsEta = " << jetAbsEta << std::endl;
if (abs(flavor) == 5 ){
int useCSVBin = (csv>=0.) ? h_csv_wgt_hf[iSysHF][iPt]->FindBin(csv) : 1;
double iCSVWgtHF = h_csv_wgt_hf[iSysHF][iPt]->GetBinContent(useCSVBin);
if( iCSVWgtHF!=0 ) csvWgthf *= iCSVWgtHF;
// if( iSysHF==0 ) printf(" iJet,\t flavor=%d,\t pt=%.1f,\t eta=%.2f,\t csv=%.3f,\t wgt=%.2f \n",
// flavor, jetPt, iJet->eta, csv, iCSVWgtHF );
}
else if( abs(flavor) == 4 ){
int useCSVBin = (csv>=0.) ? c_csv_wgt_hf[iSysC][iPt]->FindBin(csv) : 1;
double iCSVWgtC = c_csv_wgt_hf[iSysC][iPt]->GetBinContent(useCSVBin);
if( iCSVWgtC!=0 ) csvWgtC *= iCSVWgtC;
// if( iSysC==0 ) printf(" iJet,\t flavor=%d,\t pt=%.1f,\t eta=%.2f,\t csv=%.3f,\t wgt=%.2f \n",
// flavor, jetPt, iJet->eta, csv, iCSVWgtC );
}
else {
if (iPt >=3) iPt=3; /// [30-40], [40-60] and [60-10000] only 3 Pt bins for lf
int useCSVBin = (csv>=0.) ? h_csv_wgt_lf[iSysLF][iPt][iEta]->FindBin(csv) : 1;
double iCSVWgtLF = h_csv_wgt_lf[iSysLF][iPt][iEta]->GetBinContent(useCSVBin);
if( iCSVWgtLF!=0 ) csvWgtlf *= iCSVWgtLF;
// if( iSysLF==0 ) printf(" iJet,\t flavor=%d,\t pt=%.1f,\t eta=%.2f,\t csv=%.3f,\t wgt=%.2f \n",
// flavor, jetPt, iJet->eta, csv, iCSVWgtLF );
}
}
double csvWgtTotal = csvWgthf * csvWgtC * csvWgtlf;
csvWgtHF = csvWgthf;
csvWgtLF = csvWgtlf;
csvWgtCF = csvWgtC;
return csvWgtTotal;
}
示例12: csvSF_treeReader_13TeV
//.........这里部分代码省略.........
int NumCutsHF = 10;
TH1D* h_hf_event_selection = new TH1D("h_hf_event_selection",";cut", NumCutsHF, 0, NumCutsHF );
h_hf_event_selection->GetXaxis()->SetBinLabel(1,"All");
h_hf_event_selection->GetXaxis()->SetBinLabel(2,"==2 jets");
h_hf_event_selection->GetXaxis()->SetBinLabel(3,"Dilepton trigger");
h_hf_event_selection->GetXaxis()->SetBinLabel(4,"==2 leptons");
h_hf_event_selection->GetXaxis()->SetBinLabel(5,"Opposite charge");
h_hf_event_selection->GetXaxis()->SetBinLabel(6,"#Delta R(lep,lep) > 0.2");
h_hf_event_selection->GetXaxis()->SetBinLabel(7,"M(lep,lep) > 12");
h_hf_event_selection->GetXaxis()->SetBinLabel(8,"ZVeto");
h_hf_event_selection->GetXaxis()->SetBinLabel(9,"MET > 50");
h_hf_event_selection->GetXaxis()->SetBinLabel(10,"jet passes medium b-tag");
int NumCutsLF = 10;
TH1D* h_lf_event_selection = new TH1D("h_lf_event_selection",";cut", NumCutsLF, 0, NumCutsLF );
h_lf_event_selection->GetXaxis()->SetBinLabel(1,"All");
h_lf_event_selection->GetXaxis()->SetBinLabel(2,"==2 jets");
h_lf_event_selection->GetXaxis()->SetBinLabel(3,"Dilepton trigger");
h_lf_event_selection->GetXaxis()->SetBinLabel(4,"==2 leptons");
h_lf_event_selection->GetXaxis()->SetBinLabel(5,"Opposite charge");
h_lf_event_selection->GetXaxis()->SetBinLabel(6,"#Delta R(lep,lep) > 0.2");
h_lf_event_selection->GetXaxis()->SetBinLabel(7,"M(lep,lep) > 12");
h_lf_event_selection->GetXaxis()->SetBinLabel(8,"Zmass window");
h_lf_event_selection->GetXaxis()->SetBinLabel(9,"MET < 30");
h_lf_event_selection->GetXaxis()->SetBinLabel(10,"jet fails loose b-tag");
TH1D* h_numLooseLeptons = new TH1D("h_numLooseLeptons",";number of loose leptons", 5, 0, 5 );
// single jet specific plots
int nPt = 6;
int nEta = 1;
if ( !isHF ){
nPt = 4; nEta = 3;
}
//////
TH1D* h_Data_jet_csv[6][3];
TH1D* h_MC_b_jet_csv[6][3];
TH1D* h_MC_nonb_jet_csv[6][3];
TH1D* h_MC_b_jet_vtxMass[6][3];
TH1D* h_MC_nonb_jet_vtxMass[6][3];
TH2D* h_MC_b_jet_csv_vtxMass[6][3];
TH2D* h_MC_nonb_jet_csv_vtxMass[6][3];
/////
int nBins = 18; //Number of bins
double xBins_hf[19] = {-10.0, 0.0, 0.122, 0.244, 0.331, 0.418, 0.505, 0.592, 0.679, 0.7228, 0.7666, 0.8104, 0.8542, 0.898, 0.9184, 0.9388, 0.9592, 0.9796, 1.01};
if(!isHF) nBins = 21;
double xBins_lf[22] = {-10.0, 0.0, 0.04, 0.08, 0.12, 0.16, 0.2, 0.244, 0.331, 0.418, 0.505, 0.592, 0.679, 0.752, 0.825, 0.898, 0.915, 0.932, 0.949, 0.966, 0.983, 1.01};
for ( int iPt=0; iPt<nPt; iPt++){
for ( int iEta=0; iEta<nEta; iEta++){
TString h_Data_Name = Form("csv_Data_Pt%i_Eta%i",iPt,iEta);
TString h_b_Name = Form("csv_MC_bjets_Pt%i_Eta%i",iPt,iEta);
示例13: xAna_ele
//void xAna_ele(std::string inputFile, TCanvas *c1 , TCanvas *c2 , TCanvas *c3 ,TCanvas *c4 ,TCanvas *c5 ,
void xAna_ele(TString inputFile, TCanvas *c1 , TCanvas *c2 , TCanvas *c3 ,TCanvas *c4 ,TCanvas *c5 ,
int mass_point ,double eff,double eff_err, TString dir_name, int dir_flag ){
// define histograms
TString title2 = Form("ele pT for Zprime mass = %d",mass_point);
TString title3 = Form("lepton pairs' pT for Zprime mass = %d",mass_point);
TString title4 = Form("SD mass for Zprime mass = %d",mass_point);
TString title5 = Form("Z mass for Zprime mass = %d",mass_point);
TH1D* h_ele_pT = new TH1D("h_ele_pT", title2 ,300 , 0,3000 );
TH1D* h_lepton_pair_pT = new TH1D("h_lepton_pair_pT", title3 ,400 , 0,4000 );
// TH1D* h_SD_mass = new TH1D("h_SD_mass", title4 ,100 , 0,1000 );
TH1D* h_SD =new TH1D("h_SD",title4 ,100,0,200);
TH1D* h_Z_mass= new TH1D("h_Z_mass",title5 ,250,0,500);
//get TTree from file ...
// TreeReader data(inputFile.data());
TreeReader data(inputFile.Data());
Long64_t nTotal=0;
Long64_t nPass[20]={0};
ofstream fout;
fout.open("ele_Eiko.txt");
// TH1F* h_SD=new TH1F("h_SD","",100,0,200);
//Event loop
for(Long64_t jEntry=0; jEntry<data.GetEntriesFast() ;jEntry++){
if (jEntry % 50000 == 0)
fprintf(stderr, "Processing event %lli of %lli\n", jEntry + 1, data.GetEntriesFast());
data.GetEntry(jEntry);
nTotal ++;
// 0. check the generator-level information and make sure there is a Z->e+e-
Int_t nGenPar = data.GetInt("nGenPar");
Int_t* genParId = data.GetPtrInt("genParId");
Int_t* genParSt = data.GetPtrInt("genParSt");
Int_t* genMomParId = data.GetPtrInt("genMomParId");
Int_t* genDa1 = data.GetPtrInt("genDa1");
Int_t* genDa2 = data.GetPtrInt("genDa2");
bool hasLepton=false;
for(int ig=0; ig < nGenPar; ig++){
if(genParId[ig]!=23)continue;
int da1=genDa1[ig];
int da2=genDa2[ig];
if(da1<0 || da2<0)continue;
int da1pdg = genParId[da1];
int da2pdg = genParId[da2];
if(abs(da1pdg)==11)
hasLepton=true;
if(hasLepton)break;
}
// 1. make sure there is a h-> bb, Yu-Hsiang change it
bool hasHadron=false;
for(int ig=0; ig < nGenPar; ig++){
if(genParId[ig]!=25)continue;
int da1=genDa1[ig];
int da2=genDa2[ig];
if(da1<0 || da2<0)continue;
int da1pdg = genParId[da1];
int da2pdg = genParId[da2];
if(abs(da1pdg)==5)
hasHadron=true;
if(hasHadron)break;
}
if(!hasLepton)continue;
nPass[0]++;
if(!hasHadron)continue;
nPass[1]++;
//2. pass electron or muon trigger
std::string* trigName = data.GetPtrString("hlt_trigName");
vector<bool> &trigResult = *((vector<bool>*) data.GetPtr("hlt_trigResult"));
const Int_t nsize = data.GetPtrStringSize();
bool passTrigger=false;
for(int it=0; it< nsize; it++)
{
std::string thisTrig= trigName[it];
bool results = trigResult[it];
//.........这里部分代码省略.........
示例14: testPhiSRvsDetPhi
void testPhiSRvsDetPhi(){
//LOAD LIBS_____________________
cout << "\n";
gROOT->Macro("StRoot/LoadLibs.C");
gSystem->Load("pionPair");
cout << " loading of pionPair library done" << endl;
//______________________________
TH2D* hPhiSRvPhi_Up = new TH2D("hPhiSRvPhi_Up","hPhiSRvPhi_Up",16,-3.14159,3.14159,16,-3.14159,3.14159);
TH2D* hPhiSRvPhi_Down = new TH2D("hPhiSRvPhi_Down","hPhiSRvPhi_Down",16,-3.14159,3.14159,16,-3.14159,3.14159);
TFile* infile = new TFile("/star/u/klandry/ucladisk/2012IFF/schedOut_Full_4_2/allPairs_4_2.root");
string outFileName = "./resultsNew_4_22/yellowEtaGT0_pairs_4_2.root";
//______________________________
//SET UP TREE TO RECEIVE INPUT__
pionPair* pair1 = new pionPair();
TTree* pairTree = infile->Get("pionPairTree");
pairTree->SetBranchAddress("pionPair", &pair1);
//______________________________
TLorentzVector sum;
TLorentzVector sumY;
TLorentzVector sumB;
for (int iPair = 0; iPair < pairTree->GetEntries(); iPair++)
{
if (iPair%10000 == 0) {cout << "processing pair number " << iPair << endl;}
if (iPair == 1000000){break;}
pairTree->GetEntry(iPair);
if (pair1->withinRadius(0.05, 0.3))
{
bool triggerFired = false;
bool fromKaon = false;
bool passInitialCut_B = false;
bool passInitialCut_Y = false;
bool passDCAcut = false;
StTriggerId trigId = pair1->triggerIds();
//JP0,JP1,JP2,AJP
if (trigId.isTrigger(370601) || trigId.isTrigger(370611) || trigId.isTrigger(370621) || trigId.isTrigger(370641))
{
triggerFired = true;
}
//BHT0VPD,BHT1VPD,BHT2BBC,BHT2
if (trigId.isTrigger(370501) || trigId.isTrigger(370511) || trigId.isTrigger(370522) || trigId.isTrigger(370531))
{
triggerFired = true;
}
if (triggerFired)
{
sum = pair1->piPlusLV() + pair1->piMinusLV();
sumB = sum; //blue beam.
if (sumB.Pt() >= 3 && sumB.Pt() <= 50 && sumB.M() >= 0 && sumB.M() <= 100 && sumB.Eta() >= -1.4 && sumB.Eta() <= 1.4)
{
passInitialCut_B = true;
}
if (passInitialCut_B && (pair1->spinBit() == 9 || pair1->spinBit() == 10))
{
cout << pair1->phiSR('b') << " " << sumB.Phi() << endl;
hPhiSRvPhi_Up->Fill(pair1->phiSR('b'), sumB.Phi());
}
if (passInitialCut_B && (pair1->spinBit() == 5 || pair1->spinBit() == 6))
{
hPhiSRvPhi_Down->Fill(pair1->phiSR('b'), sumB.Phi());
}
}
//.........这里部分代码省略.........
示例15: selectAntiWm
void selectAntiWm(const TString conf="wm.conf", // input file
const TString outputDir="." // output directory
) {
gBenchmark->Start("selectAntiWm");
//--------------------------------------------------------------------------------------------------------------
// Settings
//==============================================================================================================
const Double_t PT_CUT = 25;
const Double_t ETA_CUT = 2.4;
const Double_t MUON_MASS = 0.105658369;
const Double_t VETO_PT = 10;
const Double_t VETO_ETA = 2.4;
const Int_t BOSON_ID = 24;
const Int_t LEPTON_ID = 13;
// load trigger menu
const baconhep::TTrigger triggerMenu("../../BaconAna/DataFormats/data/HLT_50nsGRun");
// load pileup reweighting file
TFile *f_rw = TFile::Open("../Tools/pileup_weights_2015B.root", "read");
TH1D *h_rw = (TH1D*) f_rw->Get("npv_rw");
//--------------------------------------------------------------------------------------------------------------
// Main analysis code
//==============================================================================================================
vector<TString> snamev; // sample name (for output files)
vector<CSample*> samplev; // data/MC samples
//
// parse .conf file
//
confParse(conf, snamev, samplev);
const Bool_t hasData = (samplev[0]->fnamev.size()>0);
// Create output directory
gSystem->mkdir(outputDir,kTRUE);
const TString ntupDir = outputDir + TString("/ntuples");
gSystem->mkdir(ntupDir,kTRUE);
//
// Declare output ntuple variables
//
UInt_t runNum, lumiSec, evtNum;
UInt_t npv, npu;
UInt_t id_1, id_2;
Double_t x_1, x_2, xPDF_1, xPDF_2;
Double_t scalePDF, weightPDF;
TLorentzVector *genV=0, *genLep=0;
Float_t genVPt, genVPhi, genVy, genVMass;
Float_t genLepPt, genLepPhi;
Float_t scale1fb, puWeight;
Float_t met, metPhi, sumEt, mt, u1, u2;
Float_t tkMet, tkMetPhi, tkSumEt, tkMt, tkU1, tkU2;
Float_t mvaMet, mvaMetPhi, mvaSumEt, mvaMt, mvaU1, mvaU2;
Int_t q;
TLorentzVector *lep=0;
///// muon specific /////
Float_t trkIso, emIso, hadIso;
Float_t pfChIso, pfGamIso, pfNeuIso, pfCombIso;
Float_t d0, dz;
Float_t muNchi2;
UInt_t nPixHits, nTkLayers, nValidHits, nMatch, typeBits;
// Data structures to store info from TTrees
baconhep::TEventInfo *info = new baconhep::TEventInfo();
baconhep::TGenEventInfo *gen = new baconhep::TGenEventInfo();
TClonesArray *genPartArr = new TClonesArray("baconhep::TGenParticle");
TClonesArray *muonArr = new TClonesArray("baconhep::TMuon");
TClonesArray *vertexArr = new TClonesArray("baconhep::TVertex");
TFile *infile=0;
TTree *eventTree=0;
//
// loop over samples
//
for(UInt_t isam=0; isam<samplev.size(); isam++) {
// Assume data sample is first sample in .conf file
// If sample is empty (i.e. contains no ntuple files), skip to next sample
Bool_t isData=kFALSE;
if(isam==0 && !hasData) continue;
else if (isam==0) isData=kTRUE;
// Assume signal sample is given name "wm"
Bool_t isSignal = (snamev[isam].CompareTo("wm",TString::kIgnoreCase)==0);
// flag to reject W->mnu events when selecting wrong-flavor background events
Bool_t isWrongFlavor = (snamev[isam].CompareTo("wx",TString::kIgnoreCase)==0);
CSample* samp = samplev[isam];
//
// Set up output ntuple
//
TString outfilename = ntupDir + TString("/") + snamev[isam] + TString("_select.root");
//.........这里部分代码省略.........