本文整理汇总了C++中TTree::SetDirectory方法的典型用法代码示例。如果您正苦于以下问题:C++ TTree::SetDirectory方法的具体用法?C++ TTree::SetDirectory怎么用?C++ TTree::SetDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTree
的用法示例。
在下文中一共展示了TTree::SetDirectory方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//**********MAIN**************************************************************************
int main(int argc, char* argv[])
{
if(argc < 2)
{
cout << argv[0] << " cfg file " << "[run]" << endl;
return -1;
}
//---memory consumption tracking---
float cpu[2]{0}, mem[2]={0}, vsz[2]={0}, rss[2]={0};
//---load options---
CfgManager opts;
opts.ParseConfigFile(argv[1]);
//-----input setup-----
if(argc > 2)
{
vector<string> run(1, argv[2]);
opts.SetOpt("h4reco.run", run);
}
string outSuffix = opts.GetOpt<string>("h4reco.outNameSuffix");
string run = opts.GetOpt<string>("h4reco.run");
TChain* inTree = new TChain("H4tree");
ReadInputFiles(opts, inTree);
H4Tree h4Tree(inTree);
//-----output setup-----
uint64 index=stoul(run)*1e9;
TFile* outROOT = new TFile(outSuffix+TString(run)+".root", "RECREATE");
outROOT->cd();
RecoTree mainTree(&index);
//---Get plugin sequence---
PluginLoader<PluginBase>* loader;
vector<PluginLoader<PluginBase>* > pluginLoaders;
map<string, PluginBase*> pluginMap;
vector<PluginBase*> pluginSequence;
vector<string> pluginList = opts.GetOpt<vector<string> >("h4reco.pluginList");
//---plugin creation
pluginLoaders.reserve(pluginList.size());
for(auto& plugin : pluginList)
{
cout << ">>> Loading plugin <" << plugin << ">" << endl;
//---create loader
loader = new PluginLoader<PluginBase>(opts.GetOpt<string>(plugin+".pluginType"));
pluginLoaders.push_back(loader);
pluginLoaders.back()->Create();
//---get instance and put it in the plugin sequence
PluginBase* newPlugin = pluginLoaders.back()->CreateInstance();
if(newPlugin)
{
pluginSequence.push_back(newPlugin);
pluginSequence.back()->SetInstanceName(plugin);
pluginMap[plugin] = pluginSequence.back();
}
else
{
cout << ">>> ERROR: plugin type " << opts.GetOpt<string>(plugin+".pluginType") << " is not defined." << endl;
return 0;
}
}
//---begin
for(auto& plugin : pluginSequence)
{
//---call Begin() methods and check the return status
bool r_status = plugin->Begin(opts, &index);
if(!r_status)
{
cout << ">>> ERROR: plugin returned bad flag from Begin() call: " << plugin->GetInstanceName() << endl;
exit(-1);
}
//---Get plugin shared data
for(auto& shared : plugin->GetSharedData("", "TTree", true))
{
TTree* tree = (TTree*)shared.obj;
tree->SetMaxVirtualSize(10000);
tree->SetDirectory(outROOT);
}
}
//---events loop
int maxEvents = opts.OptExist("h4reco.maxEvents") ? opts.GetOpt<int>("h4reco.maxEvents") : -1;
cout << ">>> Processing H4DAQ run #" << run << " <<<" << endl;
while(h4Tree.NextEntry() && (index-stoul(run)*1e9<maxEvents || maxEvents==-1))
{
if(index % 1000 == 0)
{
cout << ">>> Processed events: " << index-stoul(run)*1e9 << "/"
<< (maxEvents<0 ? h4Tree.GetEntries() : min(h4Tree.GetEntries(), (uint64)maxEvents))
<< endl;
TrackProcess(cpu, mem, vsz, rss);
}
//---call ProcessEvent for each plugin and check the return status
bool status=true;
for(auto& plugin : pluginSequence)
if(status)
//.........这里部分代码省略.........
示例2: c
TTree *ToyTree(TString dirname="test/dato/fitres/Hgg_Et-toys/0.01-0.00", TString fname="outProfile-scaleStep2smearing_7-Et_25-trigger-noPF-EB.root", TString opt="", int nSmooth=10){
TString outDir=dirname; outDir.ReplaceAll("fitres","img");
outDir="tmp/";
//std::map<TString, TH2F *> deltaNLL_map;
//bool smooth=false;
//if(opt.Contains("smooth")) smooth=true;
/*------------------------------ Plotto */
TCanvas c("ctoy","c");
TTree *toys = new TTree("toys","");
toys->SetDirectory(0);
Double_t constTerm_tree, constTermTrue_tree;
Double_t alpha_tree, alphaTrue_tree;
char catName[100];
Int_t catIndex;
toys->Branch("constTerm", &constTerm_tree, "constTerm/D");
toys->Branch("alpha", &alpha_tree, "alpha/D");
toys->Branch("constTermTrue", &constTermTrue_tree, "constTermTrue/D");
toys->Branch("alphaTrue", &alphaTrue_tree, "alphaTrue/D");
toys->Branch("catName", catName, "catName/C");
toys->Branch("catIndex", &catIndex, "catIndex/I");
std::map<TString, Int_t> catIndexMap;
///1/
for(int itoy =2; itoy <= 50; itoy++){
TString filename=dirname+"/"; filename+=itoy; filename+="/"+fname;
TString fout=dirname+"/"; fout+=itoy; fout+="/";
TFile f_in(filename, "read");
if(f_in.IsZombie()){
std::cerr << "File opening error: " << filename << std::endl;
continue; //return NULL;
}
//std::cout << filename << std::endl;
TList *KeyList = f_in.GetListOfKeys();
//std::cout << KeyList->GetEntries() << std::endl;
for(int i =0; i < KeyList->GetEntries(); i++){
c.Clear();
TKey *key = (TKey *)KeyList->At(i);
if(TString(key->GetClassName())!="RooDataSet") continue;
RooDataSet *dataset = (RooDataSet *) key->ReadObj();
TString constTermName = dataset->GetName();
TString alphaName=constTermName; alphaName.ReplaceAll("constTerm","alpha");
if(constTermName.Contains("scale")) continue;
if(constTermName.Contains("alpha")) continue;
if(constTermName.Contains("1.4442-gold")) continue;
TTree *tree = dataset2tree(dataset);
TGraph *rhoGraph = GetRho(tree, alphaName, constTermName);
rhoGraph->SaveAs(fout+"rhoGraph-"+constTermName+".root");
TGraphErrors bestFit_ = bestFit(tree, alphaName, constTermName);
//TString binning="(241,-0.0005,0.2405,61,-0.00025,0.03025)"; //"(40,0.00025,0.02025,61,-0.0022975,0.1401475)";
TString binning="(241,-0.0005,0.2405,301,-0.00005,0.03005)";
TH2F *hist = prof2d(tree, constTermName, alphaName, "nll", binning, true, nSmooth, opt);
//hist->SaveAs("myhist.root");
Int_t iBinX, iBinY;
hist->GetBinWithContent2(0.0002,iBinX,iBinY,1,-1,1,-1,0.0000001);
// if(iBinX!=0 && iBinY!=0 && iBinX < 41 && iBinY < 62){
{
TString catName_=constTermName; catName_.ReplaceAll("constTerm_",""); catName_.ReplaceAll("-","_");
if(catIndexMap.count(catName_)==0) catIndexMap.insert(std::pair<TString,Int_t>(catName_,catIndexMap.size()));
catIndex=catIndexMap[catName_];
constTerm_tree = hist->GetYaxis()->GetBinCenter(iBinY);
alpha_tree = hist->GetXaxis()->GetBinCenter(iBinX);
sprintf(catName,"%s", catName_.Data());
bestFit_.GetPoint(0, constTermTrue_tree,alphaTrue_tree);
// std::cout << constTerm_tree << " " << constTermTrue_tree
// << "\t" << alpha_tree << " " << alphaTrue_tree
// << std::endl;
if(opt.Contains("scandiff")){
constTermTrue_tree = getMinimumFromTree(tree, "nll",TString(constTermName).ReplaceAll("-","_"));
} else if(opt.Contains("scan")){
constTerm_tree = getMinimumFromTree(tree, "nll",TString(constTermName).ReplaceAll("-","_"));
}
//std::cout << iBinX << "\t" << iBinY << "\t" << constTerm_tree - getMinimumFromTree(tree, "nll",TString(constTermName).ReplaceAll("-","_")) << std::endl;
toys->Fill();
// }else{
// hist->SaveAs("myhist.root");
// exit(0);
}
delete tree;
delete hist;
}
f_in.Close();
//.........这里部分代码省略.........
示例3: ZJetsToLL_App_bflavor
//.........这里部分代码省略.........
// Book output histograms
TH1F* hCHFb0_OpenSelection= new TH1F ("hCHFb0_OpenSelection", "charged Hadron Energy Fraction b1", 40, 0.0, 1.2);
TH1F* hCHFb1_OpenSelection= new TH1F ("hCHFb1_OpenSelection", "charged Hadron Energy Fraction b2", 40, 0.0, 1.2);
TH1F* hPtjj_OpenSelection= new TH1F ("hPtjj_OpenSelection","Pt of two b jets with highest CSV ", 50, 0.0, 400);
TH1F* hPtmumu_OpenSelection= new TH1F ("hPtmumu_OpenSelection","Pt of two muons with highest pt ", 50, 0.0, 400);
TH1F* hPtbalZH_OpenSelection= new TH1F ("hPtbalZH_OpenSelection", "Pt balance of Z and H", 40, -80, 80);
TH1F* hPtmu0_OpenSelection= new TH1F ("hPtmu0_OpenSelection","Pt of muon with highest pt ", 30, 0.0, 300);
TH1F* hPtmu1_OpenSelection= new TH1F ("hPtmu1_OpenSelection","Pt of muon with second highest pt ", 30, 0.0, 300);
TH1F* hPFRelIsomu0_OpenSelection= new TH1F ("hPFRelIsomu0_OpenSelection", "PF Rel Iso of muon with highest Pt", 40, 0., 0.2);
TH1F* hPFRelIsomu1_OpenSelection= new TH1F ("hPFRelIsomu1_OpenSelection", "PF Rel Iso of muon with second highest Pt", 40, 0., 0.2);
TH1F* hCSV0_OpenSelection= new TH1F ("hCSV0_OpenSelection","Jet with highest CSV ", 40, 0, 1.5);
TH1F* hCSV1_OpenSelection= new TH1F ("hCSV1_OpenSelection","Jet with second highest CSV ", 40, 0, 1.5);
TH1F* hdphiVH_OpenSelection= new TH1F ("hdphiVH_OpenSelection","Delta phi between Z and Higgs ", 50, -0.1, 4.5);
TH1F* hdetaJJ_OpenSelection= new TH1F ("hdetaJJ_OpenSelection","Delta eta between two jets ", 60, -4, 4);
TH1F* hNjets_OpenSelection= new TH1F ("hNjets_OpenSelection", "Number of Jets", 13, -2.5, 10.5);
TH1F* hMjj_OpenSelection = new TH1F ("hMjj_OpenSelection", "Invariant Mass of two Jets ", 50, 0, 300);
TH1F* hMmumu_OpenSelection = new TH1F ("hMmumu_OpenSelection", "Invariant Mass of two muons ", 75, 0, 200);
TH1F* hRMSeta_OpenSelection= new TH1F ("hRMSeta_OpenSelection", "RMS Eta", 30, 0, 3);
TH1F* hStaDeveta_OpenSelection= new TH1F ("hStaDeveta_OpenSelection", "Standard Deviation Eta", 30, 0, 3);
TH1F* hUnweightedEta_OpenSelection= new TH1F ("hUnweightedEta_OpenSelection", "Unweighted Eta ", 50, 0, 15);
TH1F* hdphiJJ_vect_OpenSelection= new TH1F ("hdphiJJ_vect_OpenSelection", "Delta phi between two jets", 30, -3.5, 4);
TH1F* hCircularity_OpenSelection= new TH1F("hCircularity_OpenSelection","EventShapeVariables circularity", 30, 0.0, 1.2);
TH1F* hHt_OpenSelection= new TH1F("hHt_OpenSelection","scalar sum of pt of four particles", 50, 0.0, 500);
TH1F* hCentrality_OpenSelection= new TH1F ("hCentrality_OpenSelection", "Centrality", 40, 0.0, 0.8);
TH1F* hEventPt_OpenSelection= new TH1F ("hEventPt_OpenSelection", "Pt of HV system", 50, 0.0, 100);
TH1F* hAngle_OpenSelection= new TH1F ("hAngle_OpenSelection", "Angle between H and Z", 45, 0, 4.5);
TH1F* hSphericity_OpenSelection= new TH1F ("hSphericity_OpenSelection", "EventShapeVariables sphericity", 50, 0.0, 1);
TH1F* hAplanarity_OpenSelection= new TH1F ("hAplanarity_OpenSelection", "EventShapeVariables Aplanarity", 50, -0.1, .4);
TH1F* hIsotropy_OpenSelection= new TH1F ("hIsotropy_OpenSelection", "EventShapeVariables isotropy", 30, 0.0, 1.3);
TH2F* hDphiDetajj_OpenSelection= new TH2F ("hDphiDetajj_OpenSelection", "#Delta#phi vs #Delta#eta JJ", 25, -5, 5, 25, -5, 5);
TTree *treeWithBDT = new TTree("treeWithBDT","Tree wiht BDT output");
treeWithBDT->SetDirectory(0);
treeWithBDT->Branch("nJets",&nJets, "nJets/I");
treeWithBDT->Branch("Naj",&Naj, "Naj/F");
treeWithBDT->Branch("eventFlavor",&eventFlavor, "eventFlavor/I");
treeWithBDT->Branch("CSV0",&CSV0, "CSV0/F");
treeWithBDT->Branch("CSV1",&CSV1, "CSV1/F");
treeWithBDT->Branch("Zmass",&Zmass, "Zmass/F");
treeWithBDT->Branch("Hmass",&Hmass, "Hmass/F");
treeWithBDT->Branch("DeltaPhiHV",&DeltaPhiHV, "DeltaPhiHV/F");
treeWithBDT->Branch("Hpt",&Hpt, "Hpt/F");
treeWithBDT->Branch("Zpt",&Zpt, "Zpt/F");
treeWithBDT->Branch("mu0pt",&mu0pt, "mu0pt/F");
treeWithBDT->Branch("Ht",&Ht, "Ht/F");
treeWithBDT->Branch("EtaStandDev",&EtaStandDev, "EtaStandDev/F");
treeWithBDT->Branch("UnweightedEta",&UnweightedEta, "UnweightedEta/F");
treeWithBDT->Branch("EvntShpCircularity",&EvntShpCircularity, "EvntShpCircularity/F");
treeWithBDT->Branch("alpha_j",&alpha_j, "alpha_j/F");
treeWithBDT->Branch("qtb1",&qtb1, "qtb1/F");
treeWithBDT->Branch("nSV",&nSV, "nSV/F");
treeWithBDT->Branch("Trigweight",&Trigweight, "Trigweight/F");
treeWithBDT->Branch("B2011PUweight",&B2011PUweight, "B2011PUweight/F");
treeWithBDT->Branch("btag2CSF",&btag2CSF, "btag2CSF/F");
treeWithBDT->Branch("DetaJJ",&DetaJJ, "DetaJJ/F");
treeWithBDT->Branch("jetCHF0",&jetCHF0, "jetCHF0/F");
treeWithBDT->Branch("jetCHF1",&jetCHF1, "jetCHF1/F");
treeWithBDT->Branch("jetPhi0",&jetPhi0, "jetPhi0/F");
treeWithBDT->Branch("jetPhi1",&jetPhi1, "jetPhi1/F");
treeWithBDT->Branch("jetEta0",&jetEta0, "jetEta0/F");
treeWithBDT->Branch("jetEta1",&jetEta1, "jetEta1/F");
treeWithBDT->Branch("mu1pt",&mu1pt, "mu1pt/F");
treeWithBDT->Branch("muonPFiso0",&muonPFiso0, "muonPFiso0/F");
treeWithBDT->Branch("muonPFiso1",&muonPFiso1, "muonPFiso1/F");
treeWithBDT->Branch("DphiJJ",&DphiJJ, "DphiJJ/F");
示例4: GenerateFriend
//_____________________________________________________________________________
Int_t ProofAux::GenerateFriend(const char *fnt, const char *fnf)
{
// Generate the friend tree for the main tree in the 'friends' tutorial fetched
// from 'fnt'.
// the tree is called 'Tfriend', has the same number of entries as the main
// tree and is saved to file 'fnf'. If 'fnf' is not defined the filename is
// derived from 'fnt' either replacing 'tree' with 'friend', or adding '_friend'
// before the '.root' extension.
// Return 0 on success, -1 on error.
Int_t rc = -1;
// Check the input filename
TString fin(fnt);
if (fin.IsNull()) {
Error("GenerateFriend", "file name for the main tree undefined!");
return rc;
}
// Make sure that the file can be read
if (gSystem->AccessPathName(fin, kReadPermission)) {
Error("GenerateFriend", "input file does not exist or cannot be read: %s", fin.Data());
return rc;
}
// File handlers
Bool_t sameFile = kTRUE;
const char *openMain = "UPDATE";
// The output filename
TString fout(fnf);
if (!fout.IsNull()) {
sameFile = kFALSE;
openMain = "READ";
// Make sure the directory exists
TString dir = gSystem->DirName(fout);
if (gSystem->AccessPathName(dir, kWritePermission)) {
if (gSystem->mkdir(dir, kTRUE) != 0) {
Error("GenerateFriend", "problems creating directory %s to store the file", dir.Data());
return rc;
}
}
} else {
// We set the same name
fout = fin;
}
// Get main tree
TFile *fi = TFile::Open(fin, openMain);
if (!fi || fi->IsZombie()) {
Error("GenerateFriend", "problems opening input file %s", fin.Data());
return rc;
}
TTree *Tin = (TTree *) fi->Get("Tmain");
if (!Tin) {
Error("GenerateFriend", "problems getting tree 'Tmain' from file %s", fin.Data());
delete fi;
return rc;
}
// Set branches
Float_t x, y, z;
Tin->SetBranchAddress("x", &x);
Tin->SetBranchAddress("y", &y);
Tin->SetBranchAddress("z", &z);
TBranch *b_x = Tin->GetBranch("x");
TBranch *b_y = Tin->GetBranch("y");
TBranch *b_z = Tin->GetBranch("z");
TDirectory* savedir = gDirectory;
// Create output file
TFile *fo = 0;
if (!sameFile) {
fo = new TFile(fout, "RECREATE");
if (!fo || fo->IsZombie()) {
Error("GenerateFriend", "problems opening file %s", fout.Data());
delete fi;
return rc;
}
savedir->cd();
} else {
// Same file
fo = fi;
}
rc = 0;
// Create the tree
TTree *Tfrnd = new TTree("Tfrnd", "Friend tree for tutorial 'friends'");
Tfrnd->SetDirectory(fo);
Float_t r = 0;
Tfrnd->Branch("r",&r,"r/F");
Long64_t ent = Tin->GetEntries();
for (Long64_t i = 0; i < ent; i++) {
b_x->GetEntry(i);
b_y->GetEntry(i);
b_z->GetEntry(i);
r = TMath::Sqrt(x*x + y*y + z*z);
Tfrnd->Fill();
}
if (!sameFile) {
fi->Close();
delete fi;
//.........这里部分代码省略.........
示例5: GenerateTree
//_____________________________________________________________________________
Int_t ProofAux::GenerateTree(const char *fnt, Long64_t ent, TString &fn)
{
// Generate the main tree for the 'friends' tutorial; the tree is called
// 'Tmain', has 'ent' entries and is saved to file 'fnt'.
// The full file path is returned in 'fn'.
// Return 0 on success, -1 on error.
Int_t rc = -1;
// Check the filename
fn = fnt;
if (fn.IsNull()) {
Error("GenerateTree", "file name undefined!");
return rc;
}
TUrl uu(fn, kTRUE);
if (!strcmp(uu.GetProtocol(), "file") && !fn.BeginsWith("/")) {
// Local file with relative path: create under the data directory
if (!gProofServ ||
!(gProofServ->GetDataDir()) || strlen(gProofServ->GetDataDir()) <= 0) {
Error("GenerateTree", "data directory undefined!");
return rc;
}
// Insert data directory
fn.Insert(0, TString::Format("%s/", gProofServ->GetDataDir()));
// Make sure the directory exists
TString dir = gSystem->DirName(fn);
if (gSystem->AccessPathName(dir, kWritePermission)) {
if (gSystem->mkdir(dir, kTRUE) != 0) {
Error("GenerateTree", "problems creating directory %s to store the file", dir.Data());
return rc;
}
}
}
// Create the file
TDirectory* savedir = gDirectory;
TFile *f = new TFile(fn, "RECREATE");
if (!f || f->IsZombie()) {
Error("GenerateTree", "problems opening file %s", fn.Data());
return rc;
}
savedir->cd();
rc = 0;
// Create the tree
TTree *T = new TTree("Tmain","Main tree for tutorial friends");
T->SetDirectory(f);
Int_t Run = 1;
T->Branch("Run",&Run,"Run/I");
Long64_t Event = 0;
T->Branch("Event",&Event,"Event/L");
Float_t x = 0., y = 0., z = 0.;
T->Branch("x",&x,"x/F");
T->Branch("y",&y,"y/F");
T->Branch("z",&z,"z/F");
TRandom r;
for (Long64_t i = 0; i < ent; i++) {
if (i > 0 && i%1000 == 0) Run++;
Event = i;
x = r.Gaus(10,1);
y = r.Gaus(20,2);
z = r.Landau(2,1);
T->Fill();
}
T->Print();
f->cd();
T->Write();
T->SetDirectory(0);
f->Close();
delete f;
delete T;
// Notify success
Info("GenerateTree", "file '%s' successfully created", fn.Data());
// Add to the list
TString fds(fn);
if (!strcmp(uu.GetProtocol(), "file")) {
if (gSystem->Getenv("LOCALDATASERVER")) {
if (strcmp(TUrl(gSystem->Getenv("LOCALDATASERVER"), kTRUE).GetProtocol(), "file"))
fds.Insert(0, TString::Format("%s/", gSystem->Getenv("LOCALDATASERVER")));
} else {
fds.Insert(0, TString::Format("root://%s/", gSystem->HostName()));
}
}
fMainList->Add(new TObjString(fds));
// Done
return rc;
}
示例6: main
int main (int argc, char** argv)
{
std::string inputFolder = argv[1];
std::string outputFile = argv[2];
std::string leptonName = argv[3];
std::string inputFile = argv[4];
std::cout<<"file: "<<(inputFile).c_str()<<std::endl;
TFile * fS = new TFile((inputFolder+leptonName+"/WWTree_"+inputFile+".root").c_str());
TTree * inputTree = (TTree *)fS->Get("otree");
int run;
int event;
int lumi;
int njets;
int nPV;
int issignal;
float pfMET;
float pfMET_Phi;
float l_pt;
float l_eta;
float l_phi;
float l_e;
float ungroomed_jet_pt;
float ungroomed_jet_eta;
float ungroomed_jet_phi;
float ungroomed_jet_e;
float jet_mass_pr;
float jet_mass_so;
float jet_tau2tau1;
float v_pt;
float v_eta;
float v_phi;
float v_mt;
float mass_lvj_type0;
int nBTagJet_medium;
float jet2_pt;
float jet2_btag;
float jet3_pt;
float jet3_btag;
inputTree->SetBranchAddress("run", &run);
inputTree->SetBranchAddress("event", &event);
inputTree->SetBranchAddress("lumi", &lumi);
inputTree->SetBranchAddress("njets", &njets);
inputTree->SetBranchAddress("nPV", &nPV);
inputTree->SetBranchAddress("issignal", &issignal);
inputTree->SetBranchAddress("pfMET", &pfMET);
inputTree->SetBranchAddress("pfMET_Phi", &pfMET_Phi);
inputTree->SetBranchAddress("l_pt", &l_pt);
inputTree->SetBranchAddress("l_eta", &l_eta);
inputTree->SetBranchAddress("l_phi", &l_phi);
inputTree->SetBranchAddress("l_e", &l_e);
inputTree->SetBranchAddress("ungroomed_jet_pt", &ungroomed_jet_pt);
inputTree->SetBranchAddress("ungroomed_jet_eta", &ungroomed_jet_eta);
inputTree->SetBranchAddress("ungroomed_jet_phi", &ungroomed_jet_phi);
inputTree->SetBranchAddress("ungroomed_jet_e", &ungroomed_jet_e);
inputTree->SetBranchAddress("jet_mass_pr", &jet_mass_pr);
inputTree->SetBranchAddress("jet_mass_so", &jet_mass_so);
inputTree->SetBranchAddress("jet_tau2tau1", &jet_tau2tau1);
inputTree->SetBranchAddress("v_pt", &v_pt);
inputTree->SetBranchAddress("v_eta", &v_eta);
inputTree->SetBranchAddress("v_phi", &v_phi);
inputTree->SetBranchAddress("v_mt", &v_mt);
inputTree->SetBranchAddress("mass_lvj_type2", &mass_lvj_type0);
inputTree->SetBranchAddress("nBTagJet_medium", &nBTagJet_medium);
inputTree->SetBranchAddress("jet2_pt", &jet2_pt);
inputTree->SetBranchAddress("jet2_btag", &jet2_btag);
inputTree->SetBranchAddress("jet3_pt", &jet3_pt);
inputTree->SetBranchAddress("jet3_btag", &jet3_btag);
//---------output tree----------------
TFile* outROOT = TFile::Open((std::string("output/output_synch_")+leptonName+std::string("/")+std::string("WWTree_")+outputFile+std::string(".root")).c_str(),"recreate");
outROOT->cd();
TTree* outTree = new TTree("otree", "otree");
outTree->SetDirectory(0);
setOutputTreeSynch *WWTree = new setOutputTreeSynch(outTree);
//---------start loop on events------------
for (Long64_t jentry=0; jentry<inputTree->GetEntries();jentry++) {
inputTree->GetEntry(jentry);
WWTree->initializeVariables(); //initialize all variables
if(jentry % 1000 == 0)
cout << "read entry: " << jentry << endl;
WWTree->issignal = issignal;
//save event variables
WWTree->run = run;
WWTree->event = event;
WWTree->lumi = lumi;
WWTree->njets = njets;
WWTree->nPV = nPV;
WWTree->l_pt = l_pt;
WWTree->l_eta = l_eta;
WWTree->l_phi = l_phi;
//.........这里部分代码省略.........