当前位置: 首页>>代码示例>>C++>>正文


C++ TDirectory::GetObject方法代码示例

本文整理汇总了C++中TDirectory::GetObject方法的典型用法代码示例。如果您正苦于以下问题:C++ TDirectory::GetObject方法的具体用法?C++ TDirectory::GetObject怎么用?C++ TDirectory::GetObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TDirectory的用法示例。


在下文中一共展示了TDirectory::GetObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fChain

CalibTree::CalibTree(TTree *tree) : fChain(0) {
  // if parameter tree is not specified (or zero), connect the file
  // used to generate this class and read the Tree.
  if (tree == 0) {
    TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("output.root");
    if (!f || !f->IsOpen()) {
      f = new TFile("output.root");
    }
    TDirectory * dir = (TDirectory*)f->Get("output.root:/isopf");
    dir->GetObject("CalibTree",tree);
  }
  Init(tree);
}
开发者ID:tj710,项目名称:TTEmulator,代码行数:13,代码来源:CalibTree.C

示例2: fChain

NeroTree::NeroTree(TTree *tree) : fChain(0) 
{
// if parameter tree is not specified (or zero), connect the file
// used to generate this class and read the Tree.
   if (tree == 0) {
      TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("root://eoscms.cern.ch//store/user/yiiyama/nero/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8+RunIISpring15DR74-Asympt25ns_MCRUN2_74_V9-v3+AODSIM/nero_0000.root");
      if (!f || !f->IsOpen()) {
         f = new TFile("root://eoscms.cern.ch//store/user/yiiyama/nero/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8+RunIISpring15DR74-Asympt25ns_MCRUN2_74_V9-v3+AODSIM/nero_0000.root");
      }
      TDirectory * dir = (TDirectory*)f->Get("root://eoscms.cern.ch//store/user/yiiyama/nero/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8+RunIISpring15DR74-Asympt25ns_MCRUN2_74_V9-v3+AODSIM/nero_0000.root:/nero");
      dir->GetObject("events",tree);

   }
   Init(tree);
}
开发者ID:zdemirag,项目名称:MonoX,代码行数:15,代码来源:NeroTree.C

示例3: HHbbbbMikeBase


//.........这里部分代码省略.........
	}
	
	for(int i=0;i<276;i++){
		th6[i]=(TH1D* )th5[i]->Clone(Form("%ss",th5[i]->GetTitle()));
		th5[i]->Sumw2();
		th6[i]->Sumw2();
	}
	//pileup uncertainty----------------------------------------------------------------------------------------
	TH1D* th7[14];
	th7[0]=new TH1D("totalMass","totalMass",200,1000,5000);
	th7[1]=new TH1D("totalMass_pileup_up","totalMass_pileup_up",200,1000,5000);
	th7[2]=new TH1D("totalMass_pileup_down","totalMass_pileup_down",200,1000,5000);
	th7[3]=new TH1D("pileupEff","pileupEff",15,0.5,15.5);
	double totalPileup[3]={0},passPileup[3]={0};
	standalone_LumiReWeighting LumiWeights_central(0),LumiWeights_up(1),LumiWeights_down(-1);
	//PDF uncertainty
	th7[4]=new TH1D("PDFEff","PDFEff",101,0.5,101.5);
	double passPDF[101]={0},totalPDF[101]={0};
	//QCD uncertainty
	for(int i=5;i<14;i++)th7[i]=new TH1D(Form("uns_QCD_%d",i-5),Form("uns_QCD_%d",i-5),200,1000,5000);
	
	
	
	//NCUtuple loop----------------------------------------------------------------------------------------
	for (int w=wMs;w<wM;w++){
		if(w%20==0)cout<<w<<endl;
		//Get ntuple----------------------------------------------------------------------------------------
		if (nameRoot!=1)f = TFile::Open(Form("%s%d.root",st.data(),w));
		else f = TFile::Open(st.data());
		if (!f || !f->IsOpen())continue;
		TDirectory * dir;
		if (nameRoot!=1)dir = (TDirectory*)f->Get(Form("%s%d.root:/tree",st.data(),w));
		else dir = (TDirectory*)f->Get(Form("%s:/tree",st.data()));
		dir->GetObject("treeMaker",tree);
		TreeReader data(tree);
		total+=data.GetEntriesFast();
		
		
		
		for(Long64_t jEntry=0; jEntry<data.GetEntriesFast() ;jEntry++){//event loop----------------------------------------------------------------------------------------
			data.GetEntry(jEntry);
			
			
			Int_t nVtx        = data.GetInt("nVtx");
			Float_t ntrue= data.GetFloat("pu_nTrueInt");
			//Float_t*  pdfscaleSysWeights= data.GetPtrFloat("pdfscaleSysWeights");
			th5[180]->Fill(nVtx);
			th5[181]->Fill(ntrue);
			double PU_weight[3]={1,1,1};
			
			if(nameRoot!=2){
				if(ntrue<51){
					PU_weight[0] = LumiWeights_central.weight(ntrue);
					PU_weight[1]= LumiWeights_up.weight(ntrue);
					PU_weight[2] = LumiWeights_down.weight(ntrue);
				}
				else {
					PU_weight[0] = LumiWeights_central.weight(50);
					PU_weight[1] = LumiWeights_up.weight(50);
					PU_weight[2]= LumiWeights_down.weight(50);
				}
			}
			
			th6[180]->Fill(nVtx,PU_weight[0]);
			th6[181]->Fill(ntrue,PU_weight[0]);
			fixScaleNum[0]+=PU_weight[0];
开发者ID:chingweich,项目名称:HHbbbbAnalyzer,代码行数:67,代码来源:HHbbbbMikeBase.C

示例4: init

    long init(TFile* f,  string jetcoll) {
        TDirectory* dir = (TDirectory*)f->Get("event");
        dir->GetObject("t",tevent);
        dir = (TDirectory*)f->Get("hlt");
        dir->GetObject("t",thlt);
        dir = (TDirectory*)f->Get("vertex");
        dir->GetObject("t",tvtx);
        dir = (TDirectory*)f->Get(jetcoll.c_str());
        dir->GetObject("t",tjet);
        dir = (TDirectory*)f->Get("met_chs");
        dir->GetObject("t",tmet);

        assert(tevent);
        assert(thlt);
        assert(tvtx);
        assert(tjet);
        assert(tmet);

        // Set branch addresses.
        tevent->SetBranchAddress("nMEPartonsFiltered",&nMEPartonsFiltered);
        tevent->SetBranchAddress("bunch_spacings",&bunch_spacings);
        tevent->SetBranchAddress("bxns",&bxns);
        tevent->SetBranchAddress("evt",&evt);
        tevent->SetBranchAddress("alphaQCD",&alphaQCD);
        tevent->SetBranchAddress("nMEPartons",&nMEPartons);
        tevent->SetBranchAddress("run",&run);
        tevent->SetBranchAddress("alphaQED",&alphaQED);
        tevent->SetBranchAddress("rhos",&rhos);
        tevent->SetBranchAddress("lumi",&lumi);
        tevent->SetBranchAddress("pu_sumpt_lowpt",&pu_sumpt_lowpt);
        tevent->SetBranchAddress("npus",&npus);
        tevent->SetBranchAddress("npv",&npv);
        tevent->SetBranchAddress("rho",&rho);
        tevent->SetBranchAddress("pthat",&pthat);
        tevent->SetBranchAddress("qScale",&qScale);
        tevent->SetBranchAddress("tnpus",&tnpus);
        tevent->SetBranchAddress("weight",&weight);
        tevent->SetBranchAddress("pu_ntrks_lowpt",&pu_ntrks_lowpt);
        tevent->SetBranchAddress("pu_sumpt_highpt",&pu_sumpt_highpt);
        tevent->SetBranchAddress("pu_zpositions",&pu_zpositions);
        tevent->SetBranchAddress("pu_ntrks_highpt",&pu_ntrks_highpt);
        tevent->SetBranchAddress("pdf_x",&pdf_x);
        tevent->SetBranchAddress("pdf_id",&pdf_id);


        thlt->SetBranchAddress("objects_paths_islast",&objects_paths_islast);
        thlt->SetBranchAddress("objects_paths",&objects_paths);
        thlt->SetBranchAddress("objects_paths_isl3",&objects_paths_isl3);
        thlt->SetBranchAddress("objects_phi",&objects_phi);
        thlt->SetBranchAddress("objects_e",&objects_e);
        thlt->SetBranchAddress("objects_eta",&objects_eta);
        thlt->SetBranchAddress("objects_pt",&objects_pt);
        thlt->SetBranchAddress("prescales",&prescales);
        thlt->SetBranchAddress("paths",&paths);

        tjet->SetBranchAddress("allGenJet_patJetmatched",&allGenJet_patJetmatched);
        tjet->SetBranchAddress("allGenJet_phi",&allGenJet_phi);
        tjet->SetBranchAddress("neutralEmEnergyFraction",&neutralEmEnergyFraction);
        tjet->SetBranchAddress("hoEnergyFraction",&hoEnergyFraction);
        tjet->SetBranchAddress("HFEMEnergyFraction",&HFEMEnergyFraction);
        tjet->SetBranchAddress("chargedMuEnergyFraction",&chargedMuEnergyFraction);
        tjet->SetBranchAddress("chargedHadronEnergyFraction",&chargedHadronEnergyFraction);
        tjet->SetBranchAddress("dZ",&dZ);
        tjet->SetBranchAddress("nTot",&nTot);
        tjet->SetBranchAddress("PUJetId_cutBasedId",&PUJetId_cutBasedId);
        tjet->SetBranchAddress("betaStar",&betaStar);
        tjet->SetBranchAddress("jec_factors",&jec_factors);
        tjet->SetBranchAddress("betaClassic",&betaClassic);
        tjet->SetBranchAddress("jec_toraw",&jec_toraw);
        tjet->SetBranchAddress("hadronFlavor",&hadronFlavor);
        tjet->SetBranchAddress("chargedMultiplicity",&chargedMultiplicity);
        tjet->SetBranchAddress("gen_y",&gen_y);
        tjet->SetBranchAddress("y",&y);
        tjet->SetBranchAddress("fRing1",&fRing1);
        tjet->SetBranchAddress("partonFlavor",&partonFlavor);
        tjet->SetBranchAddress("fRing3",&fRing3);
        tjet->SetBranchAddress("allGenJet_pt",&allGenJet_pt);
        tjet->SetBranchAddress("has_gen_particle",&has_gen_particle);
        tjet->SetBranchAddress("refpdgid",&refpdgid);
        tjet->SetBranchAddress("gen_charge",&gen_charge);
        tjet->SetBranchAddress("fRing2",&fRing2);
        tjet->SetBranchAddress("DRweighted",&DRweighted);
        tjet->SetBranchAddress("photonEnergyFraction",&photonEnergyFraction);
        tjet->SetBranchAddress("refarea",&refarea);
        tjet->SetBranchAddress("jtarea",&jtarea);
        tjet->SetBranchAddress("p4",&p4);
        tjet->SetBranchAddress("refdrjt",&refdrjt);
        tjet->SetBranchAddress("neutralHadronEnergyFraction",&neutralHadronEnergyFraction);
        tjet->SetBranchAddress("fRing4",&fRing4);
        tjet->SetBranchAddress("axisMinor",&axisMinor);
        tjet->SetBranchAddress("fRing5",&fRing5);
        tjet->SetBranchAddress("electronEnergyFraction",&electronEnergyFraction);
        tjet->SetBranchAddress("fRing6",&fRing6);
        tjet->SetBranchAddress("axisMajor",&axisMajor);
        tjet->SetBranchAddress("betaStarClassic",&betaStarClassic);
        tjet->SetBranchAddress("fRing7",&fRing7);
        tjet->SetBranchAddress("nCh",&nCh);
        tjet->SetBranchAddress("fRing0",&fRing0);
        tjet->SetBranchAddress("nNeutrals",&nNeutrals);
        tjet->SetBranchAddress("allGenJet_m",&allGenJet_m);
//.........这里部分代码省略.........
开发者ID:stadie,项目名称:BaconTrans,代码行数:101,代码来源:convert.C

示例5: HH4bCategoryBase_80

void HH4bCategoryBase_80(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;
	cout<<"nameRoot = "<<nameRoot<<endl;
	
	//option-----------------------------------------------------------
	
	int JESOption=0;
	if(option.find("JESUp")!= std::string::npos)JESOption=1;
	if(option.find("JESDown")!= std::string::npos)JESOption=2;
	cout<<"JESOption = "<<JESOption<<endl;
	
	
	//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]);
	}
	
	standalone_LumiReWeighting LumiWeights_central(0),LumiWeights_up(1),LumiWeights_down(-1);
	
	TFile *f;
	TTree *tree;
	int nPass[20]={0};
	int total=0;
	double fixScaleNum[2]={0};
	double xBinsForHeavyFlavor[5]={30,140,180,240,3000};
	double xBinsForLightFlavor[11]={20,100,200,300,400,500,600,700,800,900,3000};
	
	TH1D* th5[3];
	th5[0]=new TH1D("cat0","cat0",4000,1000,5000);
	th5[1]=new TH1D("cat1","cat1",4000,1000,5000);
	th5[2]=new TH1D("cat2","cat2",4000,1000,5000);

	for(int i=0;i<3;i++){
		th5[i]->Sumw2();
	}
	
	//---------------------------------
	
	for (int w=wMs;w<wM;w++){
		if(w%20==0)cout<<w<<endl;
		
		if (nameRoot!=1)f = TFile::Open(Form("%s%d.root",st.data(),w));
		else f = TFile::Open(st.data());
		if (!f || !f->IsOpen())continue;
		
		TDirectory * dir;
		if (nameRoot!=1)dir = (TDirectory*)f->Get(Form("%s%d.root:/tree",st.data(),w));
		else dir = (TDirectory*)f->Get(Form("%s:/tree",st.data()));
		
		dir->GetObject("treeMaker",tree);
		TreeReader data(tree);
		total+=data.GetEntriesFast();
		for(Long64_t jEntry=0; jEntry<data.GetEntriesFast() ;jEntry++){
			data.GetEntry(jEntry);
			
			
			double PU_weight[3]={1,1,1};
			Float_t ntrue= data.GetFloat("pu_nTrueInt");
			if(nameRoot!=2){
				if(ntrue<51){
					PU_weight[0] = LumiWeights_central.weight(ntrue);
					PU_weight[1]= LumiWeights_up.weight(ntrue);
					PU_weight[2] = LumiWeights_down.weight(ntrue);
				}
				else {
					PU_weight[0] = LumiWeights_central.weight(50);
					PU_weight[1] = LumiWeights_up.weight(50);
					PU_weight[2]= LumiWeights_down.weight(50);
				}
			}
			fixScaleNum[0]+=PU_weight[0];
			
			Int_t nVtx        = data.GetInt("nVtx");
			//0. has a good vertex
//.........这里部分代码省略.........
开发者ID:chingweich,项目名称:HHbbbbAnalyzer,代码行数:101,代码来源:HH4bCategoryBase_80.C

示例6: HH4bBtagEffBase_80_v2


//.........这里部分代码省略.........
		th_flavor[3][i]=(TH1D* )th5[i]->Clone(Form("%s_udcsg",th5[i]->GetTitle()));
		//th_flavor[0][i]->Sumw2();
		//th_flavor[1][i]->Sumw2();
		//th_flavor[2][i]->Sumw2();
		//th_flavor[3][i]->Sumw2();
	}
	
	//pileup uncertainty----------------------------------------------------------------------------------------
	TH1D* th7[14];
	th7[0]=new TH1D("totalMass","totalMass",200,1000,5000);
	th7[1]=new TH1D("totalMass_pileup_up","totalMass_pileup_up",200,1000,5000);
	th7[2]=new TH1D("totalMass_pileup_down","totalMass_pileup_down",200,1000,5000);
	th7[3]=new TH1D("pileupEff","pileupEff",15,0.5,15.5);
	double totalPileup[3]={0},passPileup[3]={0};
	standalone_LumiReWeighting LumiWeights_central(0),LumiWeights_up(1),LumiWeights_down(-1);
	//PDF uncertainty
	th7[4]=new TH1D("PDFEff","PDFEff",101,0.5,101.5);
	double passPDF[101]={0},totalPDF[101]={0};
	//QCD uncertainty
	for(int i=5;i<14;i++)th7[i]=new TH1D(Form("uns_QCD_%d",i-5),Form("uns_QCD_%d",i-5),200,1000,5000);
	
	
	
	//NCUtuple loop----------------------------------------------------------------------------------------
	for (int w=wMs;w<wM;w++){
		if(w%20==0)cout<<w<<endl;
		//Get ntuple----------------------------------------------------------------------------------------
		if (nameRoot!=1)f = TFile::Open(Form("%s%d.root",st.data(),w));
		else f = TFile::Open(st.data());
		if (!f || !f->IsOpen())continue;
		TDirectory * dir;
		if (nameRoot!=1)dir = (TDirectory*)f->Get(Form("%s%d.root:/tree",st.data(),w));
		else dir = (TDirectory*)f->Get(Form("%s:/tree",st.data()));
		dir->GetObject("treeMaker",tree);
		TreeReader data(tree);
		total+=data.GetEntriesFast();
		
		//TFile* fileFast=TFile::Open(Form("fast/%s/%d.root",st2.data(),w));
		//TTree* treeFast=(TTree* )fileFast->Get("hh4bFast");
		//TreeReader dataFast(treeFast);
		//if(isFast)dataFast=TreeReader(treeFast);
		
		for(Long64_t jEntry=0; jEntry<data.GetEntriesFast() ;jEntry++){//event loop----------------------------------------------------------------------------------------
			data.GetEntry(jEntry);
			//if(isFast)dataFast.GetEntry(jEntry);
			
			Int_t nVtx        = data.GetInt("nVtx");
			Float_t ntrue= data.GetFloat("pu_nTrueInt");
			//Float_t*  pdfscaleSysWeights= data.GetPtrFloat("pdfscaleSysWeights");
			
			double PU_weight[3]={1,1,1};
			
			if(nameRoot!=2){
				if(ntrue<51){
					PU_weight[0] = LumiWeights_central.weight(ntrue);
					PU_weight[1]= LumiWeights_up.weight(ntrue);
					PU_weight[2] = LumiWeights_down.weight(ntrue);
				}
				else {
					PU_weight[0] = LumiWeights_central.weight(50);
					PU_weight[1] = LumiWeights_up.weight(50);
					PU_weight[2]= LumiWeights_down.weight(50);
				}
			}
			fixScaleNum[0]+=PU_weight[0];
			for(int i=0;i<3;i++)totalPileup[i]+=PU_weight[i];
开发者ID:chingweich,项目名称:HHbbbbAnalyzer,代码行数:67,代码来源:HH4bBtagEffBase_80_v2.C

示例7: Analyze7p2_Lin


//.........这里部分代码省略.........
//
    }

    if (OkToContinue("create overlaid angular distributions"))
    {
        gROOT->SetBatch(true);
        f = new TFile(angdist_root_file.Data(),"UPDATE");
        CreatePlotOverlay(f, Form("%s E_{#gamma}=%.1f MeV %s Yields", target.Data(), eg, pol.Data()));
        f->Close();

        f = new TFile(angdist_subbed_root_file.Data(),"UPDATE");
        CreatePlotOverlay(f, Form("%s E_{#gamma}=%.1f MeV %s Yields (subbed)", target.Data(), eg, pol.Data()));
        f->Close();

//        f = new TFile(angdist_sanormed_root_file.Data(),"UPDATE");
//        CreatePlotOverlay(f, Form("%s E_{#gamma}=%.1f MeV %s Yields SA Normed", target.Data(), eg, pol.Data()));
//        f->Close();
//
//        f = new TFile(angdist_subbed_sanormed_root_file.Data(),"UPDATE");
//        CreatePlotOverlay(f, Form("%s E_{#gamma}=%.1f MeV %s Yields SA Normed (subbed)", target.Data(), eg, pol.Data()));
//        f->Close();
//
        gROOT->SetBatch(false);
    }

//    if (OkToContinue("generate 2D angular dist"))
//    {
//        GenerateTGraph2D(angdist_corr_text_file.Data(), angdist_root_file.Data());
//        f = new TFile(angdist_root_file.Data(),"UPDATE");
////        GenerateTH2D(f);
//        f->Close();
//
//        GenerateTGraph2D(angdist_corr_text_file.Data(), angdist_root_file.Data());
//        f = new TFile(angdist_root_file.Data(),"UPDATE");
////        GenerateTH2D(f);
//        f->Close();
//
//
//    }

    if (OkToContinue("form alpha_ratio graph"))
    {
        f = new TFile(combined_hist_run.Data(),"UPDATE");

        StripDb sdb(angle_file.Data());
        TH1* halpha_ints;
        f->GetObject("alpha_ints",halpha_ints);
        TGraphErrors* gr_alpha_ratio = CreateRatioFromStripHist(halpha_ints,sdb);
		gr_alpha_ratio->Sort();
        gr_alpha_ratio->Write("alpha_ratio", TObject::kOverwrite);
        f->Close();
    }



    if (OkToContinue("incorporate systematic uncertainty into the ratio"))
    {
        f = new TFile(combined_hist_run.Data(),"UPDATE");
//        if (gr_==0)
//        {
//            std::cout << "Failed to find the ratio graph" << std::endl;
//        }
//        else
//        {
            TFile* fsim = new TFile("alpha_source_r3_r5_x1_y0_z0_80M_analyzed.root");
            // the next will look for the alpha_ratio graphs in specified directories
            CreateSysCorrRatios(f, fsim, angdist_subbed_root_file.Data());
            fsim->Close();
  //      }
        f->Close();

        f = new TFile(angdist_subbed_root_file.Data(),"UPDATE");
        TDirectory* d = f->GetDirectory("uncorrected");
        TGraphErrors* gr_ = 0;
        d->GetObject("ratio",gr_);
        if (gr_==0)
        {
            std::cout << "Failed to find the ratio graph" << std::endl;
        }
        else
        {
            TGraphErrors* grsys = 0;
            f->GetObject("systematic_alpha_diffs",grsys);
            if (grsys!=0)
            {
                CreateCorrectedRatios(gr_, grsys, f);
            }
            else
            {
                std::cout << "Couldn't find systematic_alpha_diffs graph" << std::endl;
            }
            fsim->Close();
        }

        f->Close();

    }

    cout << "ANALYSIS COMPLETE" << endl;
}
开发者ID:jrtomps,项目名称:phdwork,代码行数:101,代码来源:Analyze7.2_Lin.C

示例8: HHbbbbBtagEffBase_76


//.........这里部分代码省略.........
		th5[k+80]=new TH1D(Form("totalMass_%db",k),Form("totalMass_%db",k),200,1000,5000);
		th5[k+115]=new TH1D(Form("deltaEta_%db",k),Form("deltaEta_%db",k),40,0,2);
		th5[k+160]=new TH1D(Form("logPt_%db",k),Form("logPt_%db",k),70,0,7);
	}
	for(int i=0;i<165;i++){
		th6[i]=(TH1D* )th5[i]->Clone(Form("%ss",th5[i]->GetTitle()));
		th5[i]->Sumw2();
		th6[i]->Sumw2();
	}
	//pileup uncertainty----------------------------------------------------------------------------------------
	TH1D* th7[14];
	th7[0]=new TH1D("totalMass","totalMass",200,1000,5000);
	th7[1]=new TH1D("totalMass_pileup_up","totalMass_pileup_up",200,1000,5000);
	th7[2]=new TH1D("totalMass_pileup_down","totalMass_pileup_down",200,1000,5000);
	th7[3]=new TH1D("pileupEff","pileupEff",15,0.5,15.5);
	double totalPileup[3]={0},passPileup[3]={0};
	standalone_LumiReWeighting LumiWeights_central(0),LumiWeights_up(1),LumiWeights_down(-1);
	//PDF uncertainty
	th7[4]=new TH1D("PDFEff","PDFEff",101,0.5,101.5);
	double passPDF[101]={0},totalPDF[101]={0};
	//QCD uncertainty
	for(int i=5;i<14;i++)th7[i]=new TH1D(Form("uns_QCD_%d",i-5),Form("uns_QCD_%d",i-5),200,1000,5000);
	
	//NCUtuple loop----------------------------------------------------------------------------------------
	for (int w=wMs;w<wM;w++){
		if(w%20==0)cout<<w<<endl;
		//Get ntuple----------------------------------------------------------------------------------------
		if (nameRoot!=1)f = TFile::Open(Form("%s%d.root",st.data(),w));
		else f = TFile::Open(st.data());
		if (!f || !f->IsOpen())continue;
		TDirectory * dir;
		if (nameRoot!=1)dir = (TDirectory*)f->Get(Form("%s%d.root:/tree",st.data(),w));
		else dir = (TDirectory*)f->Get(Form("%s:/tree",st.data()));
		dir->GetObject("treeMaker",tree);
		TreeReader data(tree);
		total+=data.GetEntriesFast();
		for(Long64_t jEntry=0; jEntry<data.GetEntriesFast() ;jEntry++){//event loop----------------------------------------------------------------------------------------
			data.GetEntry(jEntry);
			
			Int_t nVtx        = data.GetInt("nVtx");
			Float_t ntrue= data.GetFloat("pu_nTrueInt");
			//Float_t*  pdfscaleSysWeights= data.GetPtrFloat("pdfscaleSysWeights");
			
			double PU_weight[3]={1,1,1};
			
			if(nameRoot!=2){
				if(ntrue<51){
					PU_weight[0] = LumiWeights_central.weight(ntrue);
					PU_weight[1]= LumiWeights_up.weight(ntrue);
					PU_weight[2] = LumiWeights_down.weight(ntrue);
				}
				else {
					PU_weight[0] = LumiWeights_central.weight(50);
					PU_weight[1] = LumiWeights_up.weight(50);
					PU_weight[2]= LumiWeights_down.weight(50);
				}
			}
			
			for(int i=0;i<3;i++)totalPileup[i]+=PU_weight[i];
			
			for(int i=0;i<101;i++)totalPDF[i]+=PU_weight[0];
			//0. has a good vertex
			if(nVtx<1)continue;nPass[0]++;
			//1.trigger
			std::string* trigName = data.GetPtrString("hlt_trigName");
		 	vector<bool> &trigResult = *((vector<bool>*) data.GetPtr("hlt_trigResult"));
开发者ID:chingweich,项目名称:HHbbbbAnalyzer,代码行数:67,代码来源:HHbbbbBtagEffBase_76.C

示例9: TMVAReaderPracticeDT0818

void TMVAReaderPracticeDT0818() {
	
  bool isTT=0;
    
	string  masspoint[13]={"600","800","1000","1200","1400","1600","1800","2000","2500","3000","3500","4000","4500"};

	//for (int massP=0;massP<13;massP++){
	 for (int massP=0;massP<1;massP++){
		
		//Sig
	   //  TString endfix =Form("treeV4DT/signal-%s.root",masspoint[massP].data());for(int w=1;w<2;w++){f = TFile::Open(Form("/data2/syu/13TeV/ZprimeZhbb/ZprimeToZhToZlephbb_narrow_M-%s_13TeV-madgraph.root",masspoint[massP].data()));if (!f || !f->IsOpen())continue;TDirectory * dir = (TDirectory*)f->Get(Form("/data2/syu/13TeV/ZprimeZhbb/ZprimeToZhToZlephbb_narrow_M-%s_13TeV-madgraph.root:/tree",masspoint[massP].data()));dir->GetObject("treeMaker",tree);


	  //DY100-200
  
	   //for(int w=1;w<90;w++){ f = TFile::Open(Form("/data7/khurana/NCUGlobalTuples/SPRING15/DYJetsHTBins25nsSamples/DYJetsToLL_M-50_HT-100to200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/crab_DYJetsToLL_M-50_HT-100to200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_0803/150812_162742/0000/NCUGlobalTuples_%d.root",w));if (!f || !f->IsOpen())continue;TDirectory * dir = (TDirectory*)f->Get(Form("/data7/khurana/NCUGlobalTuples/SPRING15/DYJetsHTBins25nsSamples/DYJetsToLL_M-50_HT-100to200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/crab_DYJetsToLL_M-50_HT-100to200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_0803/150812_162742/0000/NCUGlobalTuples_%d.root:/tree",w));   dir->GetObject("treeMaker",tree);TString endfix =Form("treeV4DT/DYHT100-%d.root",w);

    //DY200-400
 
	 
	   //  for(int w=1;w<45;w++){f = TFile::Open(Form("/data7/khurana/NCUGlobalTuples/SPRING15/DYJetsHTBins25nsSamples/DYJetsToLL_M-50_HT-200to400_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/crab_DYJetsToLL_M-50_HT-200to400_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_0803/150812_162821/0000/NCUGlobalTuples_%d.root",w));if (!f || !f->IsOpen())continue;TDirectory * dir = (TDirectory*)f->Get(Form("/data7/khurana/NCUGlobalTuples/SPRING15/DYJetsHTBins25nsSamples/DYJetsToLL_M-50_HT-200to400_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/crab_DYJetsToLL_M-50_HT-200to400_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_0803/150812_162821/0000/NCUGlobalTuples_%d.root:/tree",w));   dir->GetObject("treeMaker",tree);TString endfix =Form("treeV4DT/DYHT200-%d.root",w);


    //DY400-600

	   //  for(int w=1;w<45;w++){f = TFile::Open(Form("/data7/khurana/NCUGlobalTuples/SPRING15/DYJetsHTBins25nsSamples/DYJetsToLL_M-50_HT-400to600_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/crab_DYJetsToLL_M-50_HT-400to600_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_0803/150812_162858/0000/NCUGlobalTuples_%d.root",w));if (!f || !f->IsOpen())continue;TDirectory * dir = (TDirectory*)f->Get(Form("/data7/khurana/NCUGlobalTuples/SPRING15/DYJetsHTBins25nsSamples/DYJetsToLL_M-50_HT-400to600_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/crab_DYJetsToLL_M-50_HT-400to600_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_0803/150812_162858/0000/NCUGlobalTuples_%d.root:/tree",w));   dir->GetObject("treeMaker",tree);TString endfix =Form("treeV4DT/DYHT400-%d.root",w);


    //DY600-inf
   
	   //  for(int w=1;w<48;w++){f = TFile::Open(Form("/data7/khurana/NCUGlobalTuples/SPRING15/DYJetsHTBins25nsSamples/DYJetsToLL_M-50_HT-600toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/crab_DYJetsToLL_M-50_HT-600toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_0803/150812_162937/0000/NCUGlobalTuples_%d.root",w));if (!f || !f->IsOpen())continue;TDirectory * dir = (TDirectory*)f->Get(Form("/data7/khurana/NCUGlobalTuples/SPRING15/DYJetsHTBins25nsSamples/DYJetsToLL_M-50_HT-600toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/crab_DYJetsToLL_M-50_HT-600toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8_0803/150812_162937/0000/NCUGlobalTuples_%d.root:/tree",w));   dir->GetObject("treeMaker",tree);TString endfix =Form("treeV4DT/DYHT600-%d.root",w);


//tt
	     isTT=1; for (int w=1;w<174;w++){f = TFile::Open(Form("/data7/khurana/NCUGlobalTuples/SPRING15/crab_TT_TuneCUETP8M1_13TeV-powheg-pythia8_0803/150803_175618/0000/NCUGlobalTuples_%d.root",w));  if (!f || !f->IsOpen())continue;TDirectory * dir = (TDirectory*)f->Get(Form("/data7/khurana/NCUGlobalTuples/SPRING15/crab_TT_TuneCUETP8M1_13TeV-powheg-pythia8_0803/150803_175618/0000/NCUGlobalTuples_%d.root:/tree",w));    dir->GetObject("treeMaker",tree);TString endfix =Form("treeV4DT/TT-%d.root",w);


      // TFile *fw;
      // TTree* treeP;
      // if(w==1){fw = new TFile("tree/DY.root","recreate");
      // 	 treeP=new TTree("treeP","treeP");
      // 	}
      // else {fw = new TFile("tree/DY.root","update");
      // 	treeP =(TTree*)fw->FindObjectAny("treeP");}
		   
       TFile *fw=new TFile(endfix.Data(),"recreate");
       
      float fatPt;
      float fatCSV;
      float sub1Pt;
      
      float sub1CSV;
      float sub2Pt;
     
      float sub2CSV;
      float delta_R;
      float tau21;
      float tau1;
      float tau2;
      
      cout<<massP<<","<<w<<endl;
      TreeReader data(tree);
      //data.Print();
      Long64_t nentries = data.GetEntriesFast();

      TMVA::Reader *reader = new TMVA::Reader( "!Color:!Silent" );
      reader->AddVariable( "fatPt", &fatPt );
      reader->AddVariable( "fatCSV", &fatCSV );
      reader->AddVariable( "sub1Pt", &sub1Pt );
      reader->AddVariable( "sub1CSV", &sub1CSV );
      reader->AddVariable( "sub2Pt", &sub2Pt );
      reader->AddVariable( "sub2CSV", &sub2CSV );
      reader->AddVariable( "delta_R", &delta_R );
      reader->AddVariable( "tau21", &tau21 );
      reader->AddVariable( "tau1", &tau1 );
      reader->AddVariable( "tau2", &tau2 );

      reader->BookMVA("BDT method","weights/DT.xml"); 
      TH1F *th1 =new TH1F("BDT","BDT",100,-0.8,0.8);
		  
		  for (Long64_t jentry=0; jentry<nentries;jentry++) {
		    data.GetEntry(jentry);
		    Int_t FATnJet=data.GetInt("FATnJet");
		    if(FATnJet==0)continue;

		    TClonesArray* eleP4 = (TClonesArray*) data.GetPtrTObject("eleP4");
		    TClonesArray* muP4 = (TClonesArray*) data.GetPtrTObject("muP4");
		    vector<bool> eleIsPassVeto=  *((vector<bool>*) data.GetPtr("eleIsPassVeto"));
		    vector<bool> isLooseMuon=  *((vector<bool>*) data.GetPtr("isLooseMuon"));
		    Int_t nMu=data.GetInt("nMu");
		    Int_t nEle=data.GetInt("nEle");
		    vector<int> mus,eles;
		    for(int i=0;i<nEle;i++){
		      TLorentzVector* thisEle =(TLorentzVector*)eleP4->At(i) ;
		      if(thisEle->Pt()<10 ||fabs(thisEle->Eta())>2.5 || eleIsPassVeto[i]==0 )continue;
		      eles.push_back(i);
		    }
		    
		     for(int i=0;i<nMu;i++){
		       TLorentzVector* thisMu =(TLorentzVector*)muP4->At(i) ;
//.........这里部分代码省略.........
开发者ID:chingweich,项目名称:jet,代码行数:101,代码来源:TMVAReaderPracticeDT0818.C

示例10: HHbbbbAnalyzerBase

void HHbbbbAnalyzerBase(int wM, string st,string st2,double Xsec=1,int SignalBkgNum=0){
	
	//for (int massP=0;massP<1;massP++){
		
		
		
	    
		
		int nPass[10]={0};
		int total=0;
		TH1D* th[30];
		
			th[0]=new TH1D("deltaEta","deltaEta",30,0,3);
			th[1]=new TH1D("Mjj","Mjj",2000,400,4000);
			th[2]=new TH1D("SDMass1","SDMass1",200,0,200);
			th[3]=new TH1D("SDMass2","SDMass2",200,0,200);
			th[4]=new TH1D("PRMass1","PRMass1",200,0,200);
			th[5]=new TH1D("PRMass2","PRMass2",200,0,200);
			th[6]=new TH1D("deltaR1","deltaR1",20,0,1);
			th[7]=new TH1D("deltaR2","deltaR2",20,0,1);
			th[8]=new TH1D("CSV1","CSV1",20,0,1);
			th[9]=new TH1D("CSV2","CSV2",20,0,1);
			th[10]=new TH1D("CSVSum","CSVSum",20,0,2);
			th[11]=new TH1D("CSVMax","CSVMax",20,0,1);
			th[12]=new TH1D("CSVMin","CSVMin",20,0,1);
			th[13]=new TH1D("tau21_1","tau21_1",20,0,1);
			th[14]=new TH1D("tau21_2","tau21_2",20,0,1);
			th[15]=new TH1D("jetPt1","jetPt1",1500,0,1500);
			th[16]=new TH1D("jetPt2","jetPt2",1500,0,1500);
			th[17]=new TH1D("PRMassC1","PRMassC1",600,0,600);
			th[18]=new TH1D("PRMassC2","PRMassC2",600,0,600);
			
			th[19]=new TH1D("FATjetPRmassL2L3Corr","FATjetPRmassL2L3Corr",600,0,600);
			th[20]=new TH1D("FATjetPRmassL2L3Corr_2","FATjetPRmassL2L3Corr_2",600,0,600);
			th[21]=new TH1D("FATjetPRmassL2L3CorrC","FATjetPRmassL2L3CorrC",600,0,600);
			th[22]=new TH1D("FATjetPRmassL2L3CorrC_2","FATjetPRmassL2L3CorrC_2",600,0,600);
			
			th[23]=new TH1D("MjjC","MjjC",2000,400,4000);
			th[24]=new TH1D("Mbb1","Mbb1",600,0,600);
			th[25]=new TH1D("Mbb2","Mbb2",600,0,600);
			th[26]=new TH1D("MbbC1","MbbC1",600,0,600);
			th[27]=new TH1D("MbbC2","MbbC2",600,0,600);
			
			TH1D* cs1=new TH1D("case1","case1",2000,400,6000);
			TH1D* cs2=new TH1D("case2","case2",2000,400,6000);
			TH1D* cs3=new TH1D("case3","case3",2000,400,6000);
			TH1D* cs4=new TH1D("case4","case4",2000,400,6000);
			TH1D* cs5=new TH1D("case5","case5",2000,400,6000);
			TH1D* csS=new TH1D("caseS","caseS",2000,400,6000);
		
			TH2F* th2f=new TH2F("2d","2d",600,0,600,600,0,600);
		for (int w=1;w<wM;w++){
			//cout<<Form("%s%d.root",st.data(),w)<<endl;
		//if(SignalBkgNum==1)f = TFile::Open(Form("%s",st.data()));
		//else 
			TFile *f;
			f = TFile::Open(Form("%s%d.root",st.data(),w));
		if (!f || !f->IsOpen())continue;
		TDirectory * dir;
		//if(SignalBkgNum==1)dir = (TDirectory*)f->Get(Form("%s:/tree",st.data()));
		//else 
			dir = (TDirectory*)f->Get(Form("%s%d.root:/tree",st.data(),w));
		
		cout<<w<<endl;
		
		TTree *tree;
		dir->GetObject("treeMaker",tree);
		
		TreeReader data(tree);
		
		total+=data.GetEntriesFast();
		
		
		
			
			

		
		for(Long64_t jEntry=0; jEntry<data.GetEntriesFast() ;jEntry++){
			data.GetEntry(jEntry);
			
			Int_t nJet         = data.GetInt("FATnJet");
			TClonesArray* FATjetP4 = (TClonesArray*) data.GetPtrTObject("FATjetP4");
			float*   FATjetPRmass= data.GetPtrFloat("FATjetPRmass");  
			float*   FATjetSDmass= data.GetPtrFloat("FATjetSDmass");
			float*  FATjetCISVV2 = data.GetPtrFloat("FATjetCISVV2"); 
			float* FATjetTau1=data.GetPtrFloat("FATjetTau1");
		    float* FATjetTau2=data.GetPtrFloat("FATjetTau2");
			Int_t* FATnSubSDJet=data.GetPtrInt("FATnSubSDJet");
			vector<float>   *FATsubjetSDCSV = data.GetPtrVectorFloat("FATsubjetSDCSV");
		    vector<float>   *FATsubjetSDPx =  data.GetPtrVectorFloat("FATsubjetSDPx");
		    vector<float>   *FATsubjetSDPy =  data.GetPtrVectorFloat("FATsubjetSDPy");
		    vector<float>   *FATsubjetSDPz =  data.GetPtrVectorFloat("FATsubjetSDPz");
			Float_t*  jetPRmassL2L3Corr = data.GetPtrFloat("FATjetPRmassL2L3Corr");
			
			string fixName ="";if(SignalBkgNum==1)fixName="";
			
		    vector<float>   *FATsubjetSDE =  data.GetPtrVectorFloat(Form("FATsubjetSD%sE",fixName.data()));
			
			if(nJet<1)continue;
//.........这里部分代码省略.........
开发者ID:chingweich,项目名称:HHbbbbAnalyzer,代码行数:101,代码来源:HHbbbbDrawer.C

示例11: InputForLimits

int InputForLimits(){
  TH1::SetDefaultSumw2(true);
  if(pcp)cout<<"going to set inputs"<<endl;

  Int_t NBR = 3;
  Float_t BR[] = { 1., 0.75, 0.5};

  TFile* bkgFile = new TFile( "../../BkgPrediction/BkgPrediction.root", "READ"); 
  TTree* bkgTree;
  bkgFile->GetObject( "ElAndMu", bkgTree);
  
  Float_t bkg = 0.;
  Float_t bkgTotUnc = 0.;

  Float_t obs = 0.;

  bkgTree->SetBranchAddress( "srData", &obs);
  bkgTree->SetBranchAddress( "srAllBkgCorr", &bkg);
  bkgTree->SetBranchAddress( "TotUnc", &bkgTotUnc);

  TFile* sigFile = new TFile( "../../SignalSystematics/SignalSys.root", "READ"); 

  std::vector<std::vector<TString> > sysColl;
  std::vector<TString> sys;
  sys.push_back(TString("JES_Up"));
  sys.push_back(TString("JES_Down"));
  sysColl.push_back(sys);

  sys.clear();
  sys.push_back(TString("BTagReweight_UpBC"));
  sys.push_back(TString("BTagReweight_DownBC"));
  sysColl.push_back(sys);

  sys.clear();
  sys.push_back(TString("BTagReweight_UpLight"));
  sys.push_back(TString("BTagReweight_DownLight"));
  sysColl.push_back(sys);

  std::vector<TString> decayMode;
  decayMode.push_back(TString("tt"));
  decayMode.push_back(TString("tb"));
  decayMode.push_back(TString("bb"));
		      
  Systematics* systematics[3];
  TString dirname;
  TString histoname;

  TDirectory* srDir;
  TDirectory* histoDir;

  TFile* outFile = new TFile( "InputForLimits.root", "RECREATE");
  TDirectory* outBRDir;
  TDirectory* outSRDir;

  TH1F* datah = new TH1F( "data", "data", 1, 0., 1.);
  TH1F* bkgh = new TH1F( "bkg", "bkg", 1, 0., 1.);

  TH2F* sigh;
  TH2F* sig_toth;
  TH2F* effh;
  
  TH2F* sigLh;
  TH2F* effLh;

  TH2F* sigRh;
  TH2F* effRh;
  
  TH2F* jesh;
  TH2F* btagBCh;
  TH2F* btagLighth;
  TH2F* btagh;
  
  TH2F* sysh;

  TH2F* unch;

  TH2F* jesPercenth;
  TH2F* btagBCPercenth;
  TH2F* btagLightPercenth;
  TH2F* btagPercenth;
  
  TH2F* sysPercenth;

  TH2F* uncPercenth;

  Float_t sig = 0.;
  Float_t stat = 0.;

  Float_t jes = 0.;
  Float_t bc = 0.;
  Float_t light = 0.;
  
  Float_t unc = 0.;

  int N = bkgTree->GetEntries();

  for ( int ibr = 0; ibr < NBR; ibr++){
    dirname = ""; dirname += BR[ibr];
    outFile->mkdir(dirname);
    outBRDir = outFile->GetDirectory(dirname);
//.........这里部分代码省略.........
开发者ID:fcostanz,项目名称:StopAnalysis,代码行数:101,代码来源:InputForLimits.C

示例12: PhotonIsolation

void PhotonIsolation()

{
  const float chargeHadronIsoCut_LWP_EB = 1.3;
  const float chargeHadronIsoCut_MWP_EB = 0.44;
  const float chargeHadronIsoCut_TWP_EB = 0.2;

  const float chargeHadronIsoCut_LWP_EE = 1.36;
  const float chargeHadronIsoCut_MWP_EE = 0.82;
  const float chargeHadronIsoCut_TWP_EE = 0.27;

  const float HoverECut_LWP_EB = 0.06;
  const float HoverECut_MWP_EB = 0.04;
  const float HoverECut_TWP_EB = 0.027;

  const float HoverECut_LWP_EE = 0.027;
  const float HoverECut_MWP_EE = 0.021;
  const float HoverECut_TWP_EE = 0.020;

  const float SigIEtaIEtaCut_LWP_EB = 0.01031;
  const float SigIEtaIEtaCut_MWP_EB = 0.01023;
  const float SigIEtaIEtaCut_TWP_EB = 0.00994;

  const float SigIEtaIEtaCut_LWP_EE = 0.0269;
  const float SigIEtaIEtaCut_MWP_EE = 0.0259;
  const float SigIEtaIEtaCut_TWP_EE = 0.0258;

  const float beamSpotZ = 0.282329;
  const float beamSpotSigmaZ = 43.131299;
  const float NPU = 140.0;

  const int n_density = 5;

  float IsoEff_NoTiming[n_density] = {0.0};// for n_density pu density bins, ranging from 0 to 2.0, bin width 0.1
  float Err_IsoEff_NoTiming[n_density] = {0.0};// for n_density pu density bins, ranging from 0 to 2.0, bin width 0.1
  float IsoEff_Timing50_TrkVtx[n_density] = {0.0}; 
  float IsoEff_Timing80_TrkVtx[n_density] = {0.0}; 
  float Err_IsoEff_Timing80_TrkVtx[n_density] = {0.0}; 
  float IsoEff_Timing120_TrkVtx[n_density] = {0.0}; 

  float IsoEff_Timing50_TrkPho[n_density] = {0.0}; 
  float IsoEff_Timing80_TrkPho[n_density] = {0.0}; 
  float IsoEff_Timing120_TrkPho[n_density] = {0.0}; 
  float Err_IsoEff_Timing120_TrkPho[n_density] = {0.0}; 


  int N_Pho_Total_NoBin = 0;
  int N_Pho_Total_NoBin200 = 0;
  int N_Pho_Total[n_density] = {0};
  int N_Pho_Total200[n_density] = {0};
  int N_Pho_PassIso_NoTiming[n_density] = {0}; 
  int N_Pho_PassIso_Timing50_TrkVtx[n_density] = {0}; 
  int N_Pho_PassIso_Timing80_TrkVtx[n_density] = {0}; 
  int N_Pho_PassIso_Timing120_TrkVtx[n_density] = {0}; 
 
  int N_Pho_PassIso_Timing50_TrkPho[n_density] = {0}; 
  int N_Pho_PassIso_Timing80_TrkPho[n_density] = {0}; 
  int N_Pho_PassIso_Timing120_TrkPho[n_density] = {0}; 
 

  TTree * tree = 0;
  TFile *f  =new TFile("/afs/cern.ch/work/z/zhicaiz/public/release/CMSSW_8_1_0_pre15/src/SUSYBSMAnalysis/RazorTuplizer/python/razorNtuple_PU140_Timing_Iso.root");
  TDirectory * dir = (TDirectory*)f->Get("/afs/cern.ch/work/z/zhicaiz/public/release/CMSSW_8_1_0_pre15/src/SUSYBSMAnalysis/RazorTuplizer/python/razorNtuple_PU140_Timing_Iso.root:/ntuples");
  dir->GetObject("RazorEvents",tree);
  //cout<<tree->GetEntries()<<endl;  
  int NEntries = tree->GetEntries();

  TTree * tree200 = 0;
  TFile *f200  =new TFile("/afs/cern.ch/work/z/zhicaiz/public/release/CMSSW_8_1_0_pre15/src/SUSYBSMAnalysis/RazorTuplizer/python/razorNtuple_PU200_Timing_Iso.root");
  TDirectory * dir200 = (TDirectory*)f200->Get("/afs/cern.ch/work/z/zhicaiz/public/release/CMSSW_8_1_0_pre15/src/SUSYBSMAnalysis/RazorTuplizer/python/razorNtuple_PU200_Timing_Iso.root:/ntuples");
  dir200->GetObject("RazorEvents",tree200);
  //cout<<tree->GetEntries()<<endl;  
  int NEntries200 = tree200->GetEntries();


  Int_t           nPhotons;

  Float_t         pvZ;
  Float_t         phoSigmaIetaIeta[700];
  Float_t         pho_superClusterEta[700];
  Float_t         pho_superClusterEnergy[700];
  Float_t         pho_HoverE[700];
  Bool_t          pho_passEleVeto[700];
  
  Float_t         pho_sumChargedHadronPt_NewPV_NoTiming[700];
  Float_t         pho_sumChargedHadronPt_NewPV_Timing50_TrkVtx[700];
  Float_t         pho_sumChargedHadronPt_NewPV_Timing80_TrkVtx[700];
  Float_t         pho_sumChargedHadronPt_NewPV_Timing120_TrkVtx[700];
 
  Float_t         pho_sumChargedHadronPt_NewPV_Timing50_TrkPho[700];
  Float_t         pho_sumChargedHadronPt_NewPV_Timing80_TrkPho[700];
  Float_t         pho_sumChargedHadronPt_NewPV_Timing120_TrkPho[700];
  
  tree->SetBranchAddress("nPhotons", &nPhotons);
  tree->SetBranchAddress("pvZ_New", &pvZ);
  tree->SetBranchAddress("phoSigmaIetaIeta", phoSigmaIetaIeta);
  tree->SetBranchAddress("pho_superClusterEta", pho_superClusterEta);
  tree->SetBranchAddress("pho_superClusterEnergy", pho_superClusterEnergy);
  tree->SetBranchAddress("pho_HoverE", pho_HoverE);
  tree->SetBranchAddress("pho_passEleVeto", pho_passEleVeto);
//.........这里部分代码省略.........
开发者ID:RazorCMS,项目名称:RazorAnalyzer,代码行数:101,代码来源:PhotonIsolation.C

示例13: subJetParctice0805

void subJetParctice0805() {
	
  float  DRR[7]={0.1,0.15,0.2,0.25,0.3,0.35,0.4};
  TGraphAsymmErrors* TGrDR[7][13];
  TGraphAsymmErrors* TGrPt[7][13];
  for (int DR=0;DR<7;DR++){
    c1 = new TCanvas("c1","",1360,768);
	string  masspoint[13]={"600","800","1000","1200","1400","1600","1800","2000","2500","3000","3500","4000","4500"};
	string  crabInf[13]={"150729_212416","150729_212459","150729_211555","150729_211640","150729_211727","150729_211727","150729_211855","150729_211940","150729_212023","150729_212110","150729_212159","150729_212245","150729_212331"};
    for (int massP=0;massP<13;massP++){
		TString endfix =Form("signal-%s",masspoint[massP].data());
		TH1F* th1=new TH1F("deltaR","deltaR",40,0,1);
		TH1F* th2=new TH1F("deltaRCut","deltaRCut",40,0,1);
		TH1F* th3,*th4;
		if(massP<5){
			double bins[7]={200,250,300,350,500,1000,2000};
			th3=new TH1F("Pt","Pt",6,bins);
		    th4=new TH1F("PtCut","PtCut",6,bins);
			
		}
		else{
			double bins[10]={200,300,400,500,700,1000,1300,1500,2000,2500};
			th3=new TH1F("Pt","Pt",9,bins);
		    th4=new TH1F("PtCut","PtCut",9,bins);
		}
		
		TH1F* th5=new TH1F("SDMass","SDMass",14,0,210);
		TH1F* th6=new TH1F("SDMassCut","SDMassCut",14,0,210);
		th2->SetLineColor(2);
	
		for(int w=1;w<2;w++){
		  f = TFile::Open(Form("/data2/syu/13TeV/ZprimeZhbb/ZprimeToZhToZlephbb_narrow_M-%s_13TeV-madgraph.root",masspoint[massP].data()));
		  if (!f || !f->IsOpen())continue;
		  TDirectory * dir = (TDirectory*)f->Get(Form("/data2/syu/13TeV/ZprimeZhbb/ZprimeToZhToZlephbb_narrow_M-%s_13TeV-madgraph.root:/tree",masspoint[massP].data()));
		  dir->GetObject("treeMaker",tree);

			

			cout<<w<<endl;
			TreeReader data(tree);
			data.Print();
			Long64_t nentries = data.GetEntriesFast();
			
			
			
			for (Long64_t jentry=0; jentry<nentries;jentry++) {
				data.GetEntry(jentry);
				TClonesArray* FATjetP4 = (TClonesArray*) data.GetPtrTObject("FATjetP4");
				Float_t*  FATjetSDmass = data.GetPtrFloat("FATjetSDmass");
				Float_t*  FATjetCISVV2 = data.GetPtrFloat("FATjetCISVV2");
				Int_t* FATnSubSDJet=data.GetPtrInt("FATnSubSDJet");
				Int_t FATnJet=data.GetInt("FATnJet");
				
				
				if(FATnJet==0)continue;
				TLorentzVector* FATjetP4_1 = (TLorentzVector*)FATjetP4->At(0);
				
				if(FATjetP4_1->Pt()<200)continue;
				//if(FATjetSDmass[0]<100||FATjetSDmass[0]>150)continue;
				if(FATnSubSDJet[0]<2)continue;
				
				TLorentzVector  FATsubjet_1,FATsubjet_2;
				
				vector<float>   *FATsubjetSDPx =  data.GetPtrVectorFloat("FATsubjetSDPx", FATnSubSDJet[0]);
				vector<float>   *FATsubjetSDPy =  data.GetPtrVectorFloat("FATsubjetSDPy", FATnSubSDJet[0]);
				vector<float>   *FATsubjetSDPz =  data.GetPtrVectorFloat("FATsubjetSDPz", FATnSubSDJet[0]);
				vector<float>   *FATsubjetSDCE =  data.GetPtrVectorFloat("FATsubjetSDCE", FATnSubSDJet[0]);
				vector<float>   *FATsubjetSDCSV =  data.GetPtrVectorFloat("FATsubjetSDCSV", FATnSubSDJet[0]);
				
				FATsubjet_1.SetPxPyPzE(FATsubjetSDPx[0][0],FATsubjetSDPy[0][0],FATsubjetSDPz[0][0],FATsubjetSDCSV[0][0]);
	            FATsubjet_2.SetPxPyPzE(FATsubjetSDPx[0][1],FATsubjetSDPy[0][1],FATsubjetSDPz[0][1],FATsubjetSDCSV[0][1]);
	            
				th1->Fill(FATsubjet_1.DeltaR(FATsubjet_2));
				th3->Fill(FATjetP4_1->Pt());
				th5->Fill(FATjetSDmass[0]);
				if(FATsubjet_1.DeltaR(FATsubjet_2)>DRR[DR] &&(FATsubjetSDCSV[0][0]<0.432|| FATsubjetSDCSV[0][1]<0.432))continue;
				if(FATsubjet_1.DeltaR(FATsubjet_2)<DRR[DR] && FATjetCISVV2[0]<0.432)continue;
				th2->Fill(FATsubjet_1.DeltaR(FATsubjet_2));
				th4->Fill(FATjetP4_1->Pt());
				th6->Fill(FATjetSDmass[0]);
			}
			
			
		}	
		
		th1->SetTitle(Form("deltaR,mass %s Gev",masspoint[massP].data()));
		th1->Draw();
		th2->Draw("same");
		//TH1F* th5=(TH1F*)th4->Clone("eff");
		//th5->Divide(th3);
		if(massP==0)c1->Print(Form("pdf/0807_deltaR_%0.2f.pdf(",DRR[DR]));
		else if (massP==12)c1->Print(Form("pdf/0807_deltaR_%0.2f.pdf)",DRR[DR]));
		else c1->Print(Form("pdf/0807_deltaR_%0.2f.pdf",DRR[DR]));
		//th5->SetXTitle("Pt");
		//th5->SetTitle("efficiency");

	       
		TGraphAsymmErrors* g = new TGraphAsymmErrors(th2,th1);
		g->SetTitle(Form("deltaR eff %s",masspoint[massP].data()));
		g->Draw("AP");
//.........这里部分代码省略.........
开发者ID:chingweich,项目名称:jet,代码行数:101,代码来源:subJetParctice0805.C

示例14: HHbbbbBtagAdditionThinJet

void HHbbbbBtagAdditionThinJet(int wMs,int wM, string st,string st2,double Xsec,int nameRoot=0){	
	TFile *f;
	TTree *tree;
	int nPass[20]={0};int total=0;
	int dataPassingcsc=0;
	
	TH1D* th1[4];
	
	th1[0]=new TH1D("addThinJet_3b","addThinJet_3b",10,-0.5,9.5);
	th1[1]=new TH1D("addThinJet_4b","addThinJet_4b",10,-0.5,9.5);
	
	th1[2]=new TH1D("addThinJet_3b_withoutDr","addThinJet_3b_withoutDr",10,-0.5,9.5);
	th1[3]=new TH1D("addThinJet_4b_withoutDr","addThinJet_4b_withoutDr",10,-0.5,9.5);
	
	std::vector<TString> eventlist;                                                                                                                                            
	if(nameRoot==2){
		std::vector<TString> eventlist;                                                                                                                                            
		std::ifstream fin("somfilename.txt");
		eventlist.clear();
		std::string line;
		if (fin.is_open())  {
			while (fin.good())  {
				getline(fin,line);
				eventlist.push_back(line);
		}
		fin.close();
		}
	}
		
	for (int w=wMs;w<wM;w++){
		
		if (nameRoot!=1)f = TFile::Open(Form("%s%d.root",st.data(),w));
		else f = TFile::Open(st.data());
		if (!f || !f->IsOpen())continue;
		
		TDirectory * dir;
		
		if (nameRoot!=1)dir = (TDirectory*)f->Get(Form("%s%d.root:/tree",st.data(),w));
		else dir = (TDirectory*)f->Get(Form("%s:/tree",st.data()));
		
		if(w%20==0)cout<<w<<endl;
		
		dir->GetObject("treeMaker",tree);
		TreeReader data(tree);
		total+=data.GetEntriesFast();
		for(Long64_t jEntry=0; jEntry<data.GetEntriesFast() ;jEntry++){
			data.GetEntry(jEntry);
			
			
			//Int_t event        = data.GetInt("eventId");
			//0. has a good vertex
			Int_t nVtx        = data.GetInt("nVtx");
			if(nVtx<1)continue;
			nPass[0]++;
	
			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];
				//cout<<it<<"="<<thisTrig<<endl;
				// std::cout << thisTrig << " : " << results << std::endl;
				if( ((thisTrig.find("HLT_PFHT800")!= std::string::npos||
						thisTrig.find("HLT_PFHT650_WideJetMJJ900DEtaJJ1p5_v")!= std::string::npos||
						thisTrig.find("HLT_PFHT650_WideJetMJJ950DEtaJJ1p5_v")!= std::string::npos||
						thisTrig.find("HLT_AK8PFJet360_TrimMass30_v")!= std::string::npos||
						thisTrig.find("HLT_AK8PFHT700_TrimR0p1PT0p03Mass50_v")!= std::string::npos
						) && results==1)){
					passTrigger=true;
					break;
				}
			}
			if(!passTrigger && (nameRoot!=0))continue;
			nPass[1]++;
		
			int nFATJet         = data.GetInt("FATnJet");
			const int nJets=nFATJet;
			TClonesArray* fatjetP4 = (TClonesArray*) data.GetPtrTObject("FATjetP4");
			Float_t*  fatjetTau1 = data.GetPtrFloat("FATjetTau1");
			Float_t*  fatjetTau2 = data.GetPtrFloat("FATjetTau2");
			//Float_t*  fatjetTau4 = data.GetPtrFloat("FATjetTau4");
			Float_t*  fatjetCISVV2 = data.GetPtrFloat("FATjetCISVV2");
			Float_t*  fatjetPRmass = data.GetPtrFloat("FATjetPRmass");
			Float_t*  fatjetPRmassL2L3Corr = data.GetPtrFloat("FATjetPRmassL2L3Corr");
			Float_t*  fatjetSDmass = data.GetPtrFloat("FATjetSDmass");
			Int_t*   nSubSoftDropJet = data.GetPtrInt("FATnSubSDJet");
			vector<float>   *subjetSDCSV =  data.GetPtrVectorFloat("FATsubjetSDCSV");
			//  vector<float>   *subjetSDCSV =  data.GetPtrVectorFloat("FATsubjetSDCSV", nFATJet);
			vector<float>   *subjetSDPx  =  data.GetPtrVectorFloat("FATsubjetSDPx", nFATJet);
			vector<float>   *subjetSDPy  =  data.GetPtrVectorFloat("FATsubjetSDPy", nFATJet);
			vector<float>   *subjetSDPz  =  data.GetPtrVectorFloat("FATsubjetSDPz", nFATJet);
			vector<float>   *subjetSDE   =  data.GetPtrVectorFloat("FATsubjetSDE", nFATJet);
			vector<Int_t>   *FATsubjetSDHadronFlavor =  data.GetPtrVectorInt("FATsubjetSDHadronFlavor");
			//vector<bool>    &passFatJetLooseID = *((vector<bool>*) data.GetPtr("FATjetPassIDLoose"));
			vector<bool>    &FATjetPassIDTight = *((vector<bool>*) data.GetPtr("FATjetPassIDTight"));
			if(nJets<2)continue;
			//-----------------------------------------
//.........这里部分代码省略.........
开发者ID:chingweich,项目名称:HHbbbbAnalyzer,代码行数:101,代码来源:HHbbbbBtagAdditionThinJet.C

示例15: AK8CorrBase

void AK8CorrBase(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)||
	(st2.find("bGen")!= std::string::npos)||
	(st2.find("bEnriched")!= std::string::npos))nameRoot=0;
	if(st2.find("data")!= std::string::npos)nameRoot=2;
	
	bool fixGen=0;
	if(st2.find("B1000")!= std::string::npos)fixGen=1;
	cout<<"nameRoot = "<<nameRoot<<endl;
	
	//option-----------------------------------------------------------
	
	int JESOption=0;
	if(option.find("JESUp")!= std::string::npos)JESOption=1;
	if(option.find("JESDown")!= std::string::npos)JESOption=2;
	cout<<"JESOption = "<<JESOption<<endl;
	
	
	TFile *f;
	TTree *tree;
	int nPass[20]={0};
	int total=0;
	
	TH1D* th1;
	th1=new TH1D("mass","mass",150,0,150);
	
	TH1D* th3;
	th3=new TH1D("mass","mass",1500,200,3200);
	
	double ptBins[14]={200,300,400,500,600,700,800,900,1000,1250,1500,1750,2000,2500};
	
	TH1D* th2[6][14];
	
	for(int i=0;i<14;i++){
		th2[0][i]=(TH1D*)th1->Clone(Form("genBarelMass%.0f",ptBins[i]));
		th2[1][i]=(TH1D*)th1->Clone(Form("genEndcapMass%.0f",ptBins[i]));
		th2[2][i]=(TH1D*)th1->Clone(Form("recoBarelMass%.0f",ptBins[i]));
		th2[3][i]=(TH1D*)th1->Clone(Form("recoEndcapMass%.0f",ptBins[i]));
		th2[4][i]=(TH1D*)th3->Clone(Form("ptBarel%.0f",ptBins[i]));
		th2[5][i]=(TH1D*)th3->Clone(Form("ptEndcap%.0f",ptBins[i]));
	}

	for(int i=0;i<14;i++){
		th2[0][i]->Sumw2();
		th2[1][i]->Sumw2();
		th2[2][i]->Sumw2();
		th2[3][i]->Sumw2();
		th2[4][i]->Sumw2();
		th2[5][i]->Sumw2();
	}
	
	//---------------------------------
	
	for (int w=wMs;w<wM;w++){
		if(w%20==0)cout<<w<<endl;
		
		if (nameRoot!=1)f = TFile::Open(Form("%s%d.root",st.data(),w));
		else f = TFile::Open(st.data());
		if (!f || !f->IsOpen())continue;
		
		TDirectory * dir;
		if (nameRoot!=1)dir = (TDirectory*)f->Get(Form("%s%d.root:/tree",st.data(),w));
		else dir = (TDirectory*)f->Get(Form("%s:/tree",st.data()));
		
		dir->GetObject("treeMaker",tree);
		TreeReader data(tree);
		total+=data.GetEntriesFast();
		for(Long64_t jEntry=0; jEntry<data.GetEntriesFast() ;jEntry++){
			if(jEntry%2)continue;
			data.GetEntry(jEntry);
			
			
			
			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");

			int genHIndex[2]={-1,-1};
			int genbIndex[2][2]={{-1,-1},
						{-1,-1}};		       

			for(int ig=0; ig < nGenPar; ig++){

				if(genParId[ig]!=25)continue;

				if(genHIndex[0]<0)
				{
				genHIndex[0]=ig;
				genbIndex[0][0]=genDa1[ig];
				genbIndex[0][1]=genDa2[ig];
				}

				else if(genHIndex[1]<0)
				{
//.........这里部分代码省略.........
开发者ID:chingweich,项目名称:HHbbbbAnalyzer,代码行数:101,代码来源:AK8CorrBase.C


注:本文中的TDirectory::GetObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。