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


C++ TTree::SetBranchAddress方法代码示例

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


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

示例1: readAllToysFromFile

void readAllToysFromFile(TGraphErrors*tge, TFile*f, double d_quantile) {
	tge->Set(0);	
	if (!f) throw std::logic_error("Cannot use readHypoTestResult: option toysFile not specified, or input file empty");
	TDirectory *toyDir = f->GetDirectory("");
	if (!toyDir) throw std::logic_error("Cannot use readHypoTestResult: empty toy dir in input file empty");
	TIter next(toyDir->GetListOfKeys()); TKey *k;
	std::map<double, TTree*> gridCLsb; //r, <clsb, clserr>
	std::map<double, TTree*> gridCLb; //r, <clsb, clserr>
	std::map<double, double> gridQdata; //r, q_data
	bool bdata = false;
	while ((k = (TKey *) next()) != 0) {
		double rVal;
		TString name(k->GetName());
		if(name.BeginsWith("SAMPLING_SB_TESTED_R")){
			rVal = name.ReplaceAll("SAMPLING_SB_TESTED_R","").Atof();
			TTree *t = dynamic_cast<TTree *>(toyDir->Get(k->GetName()));
			gridCLsb[rVal]=t;
			if (_debug > 2) std::cout << "  Do " << k->GetName() << " -> " << name << " --> " << rVal << " tsb->entries= "<<t->GetEntries()<< std::endl;
		}else if(name.BeginsWith("SAMPLING_B_TESTED_R")){
			rVal = name.ReplaceAll("SAMPLING_B_TESTED_R","").Atof();
			TTree *t = dynamic_cast<TTree *>(toyDir->Get(k->GetName()));
			gridCLb[rVal]=t;
			if (_debug > 2) std::cout << "  Do " << k->GetName() << " -> " << name << " --> " << rVal << " tb->entries= "<<t->GetEntries()<< std::endl;
		}else if(name.BeginsWith("DATA_R")){
			name.ReplaceAll("DATA_R","");
			TString tmp = name;
			rVal = tmp.Remove(tmp.Index("_"), tmp.Length()).Atof();
			name.Remove(0,name.Index("_Q")+2);
			gridQdata[rVal]=name.Atof();
			if (_debug > 2) std::cout << "  Do " << k->GetName() << " -> " << tmp << " --> " << rVal << " Q_data ="<<name<<" --> "<<name.Atof()<< std::endl;
			bdata = true;
		}else if(!bdata && name.BeginsWith("TESTED_R")){
			rVal = name.ReplaceAll("TESTED_R","").Atof();
			TTree *t = dynamic_cast<TTree *>(toyDir->Get(k->GetName()));
			if(t!=NULL) {
				TBranch *brQ;
				double q;
				t->SetBranchAddress("brT", &q, &brQ);
				t->GetEntry(0);
				gridQdata[rVal]=q;
				if (_debug > 2) std::cout << "  Do " << k->GetName() << " -> " << name << " --> " << rVal << " Q_data ="<<q<< std::endl;
			}
		}


	}

	int i = 0, n = gridCLsb.size();
	if(_debug)cout<<" grid size = "<<n<<endl;
	int n_valid = 0;
	for (std::map<double, TTree *>::iterator itg = gridCLsb.begin(), edg = gridCLsb.end(); itg != edg; ++itg) {
		double cls, clserr;
		GetCLs(gridQdata[itg->first], itg->second, gridCLb[itg->first], cls, clserr, d_quantile);
		//if(itg->first != 1.74 && itg->first != 1.95) continue;
		if(cls!=1 and clserr==0)continue;
		if(cls>0.9) continue;
		if(cls<0.0001) continue;
		if(clserr>=cls)continue;

		if( scanRmin >= 0 && itg->first < scanRmin ) continue; 
		if( scanRmax >= 0 && itg->first > scanRmax ) continue; 

		n_valid+=1;
		tge->Set(n_valid);
		tge->SetPoint(     n_valid-1, itg->first, cls   ); 
		tge->SetPointError(n_valid-1, 0,          clserr);
		if(_debug)cout<<" input grid:  r="<<itg->first<<" cls="<<cls<<"+/-"<<clserr<<endl;
		i++;
	}
	if(_debug)cout<<"tge->N = "<<tge->GetN()<<endl;
}
开发者ID:kelleyrw,项目名称:StopAnalysis,代码行数:71,代码来源:fitRvsCLs.C

示例2: ReadTree_normDet

void ReadTree_normDet(){

  bool testrun          = 0;
  const int norder_     = 2;
  const double vtxCut   = 15.;

  const double ptMin = 0.3;
  const double ptMax = 3.00;
  const double etaMax = 1.0;

  static const int ptBinMin  = 0;
  static const int ptBinMax  = nptbinsDefault-1;
  static const int etaBinMin = 0; //0;
  static const int etaBinMax = netabinsDefault-1;

  TFile * fAna;
  TTree * tree;
  double centval;
  double vtx;
  TH2D * sumw;
  TH2D * sumwqx;
  TH2D * sumwqy;
  TH2I * hMult;

  TFile * fVNDet;
  TH1D * hVNDetX_0;
  TH1D * hVNDetY_0;
  TH1D * hVNDetX_1;
  TH1D * hVNDetY_1;
  TH1D * hVNDetX_full;
  TH1D * hVNDetY_full;

  TFile * fHists;
  TDirectory * qwebye;
  TH2D * hVn2Dfull[NCENT];
  TH2D * hVn2Dsub0[NCENT];
  TH2D * hVn2Dsub1[NCENT];
  TH2D * hVn2D0v1[NCENT];
  TH1D * hVnFull[NCENT];
  TH1D * hVnSub0[NCENT];
  TH1D * hVnSub1[NCENT];
  TH1I * Mult[NCENT];
  TH2D * h2Vn2D0v1[NCENT];
  TH1D * h2Vn2D0v1Magnitude[NCENT];

  double VnRaw_x_0;
  double VnRaw_y_0;
  double VnRaw_x_1;
  double VnRaw_y_1;
  double VnRaw_x_full;
  double VnRaw_y_full;

  double sumw_0;
  double sumw_1;
  double sumw_full;

  double VnCorrected_x_0;
  double VnCorrected_y_0;
  double VnCorrected_x_1;
  double VnCorrected_y_1;
  double VnCorrected_x_full;
  double VnCorrected_y_full;

  int evtMult_0;
  int evtMult_1;
  int evtMult_full;

  //
  // MAIN
  //
  setTDRStyle();
  TH1D::SetDefaultSumw2();
  TH2D::SetDefaultSumw2();
  TH1I::SetDefaultSumw2();

  //-- Set up analyzer objects
  fAna = new TFile("/rfs/jcastle/PbPb2015/PixelTracking_MB2/EbyETree_SMEARpt.root");

  tree   = (TTree *) fAna->Get("ebyeana/tree");
  sumwqx = new TH2D(Form("sumwqx%i", norder_), Form("sumwqx%i", norder_), nptbinsDefault, ptbinsDefault, netabinsDefault, etabinsDefault);
  sumwqy = new TH2D(Form("sumwqy%i", norder_), Form("sumwqy%i", norder_), nptbinsDefault, ptbinsDefault, netabinsDefault, etabinsDefault);
  sumw   = new TH2D("sumw",                    "sumw",                    nptbinsDefault, ptbinsDefault, netabinsDefault, etabinsDefault);
  hMult  = new TH2I("hMult",                   "hMult",                   nptbinsDefault, ptbinsDefault, netabinsDefault, etabinsDefault);

  tree->SetBranchAddress("Cent",                    &centval);
  tree->SetBranchAddress("Vtx",                     &vtx);
  tree->SetBranchAddress("mult",                    &hMult);
  tree->SetBranchAddress(Form("sumwqx%i", norder_), &sumwqx);
  tree->SetBranchAddress(Form("sumwqy%i", norder_), &sumwqy);
  tree->SetBranchAddress("sumw",                    &sumw);

  //-- Set up VN detector objects 
  fVNDet = new TFile( Form("V%iDet.root", norder_ ) );
  hVNDetX_0    = (TH1D*) fVNDet->Get("SubEvt_0/hVNDetX_0");
  hVNDetY_0    = (TH1D*) fVNDet->Get("SubEvt_0/hVNDetY_0");
  hVNDetX_1    = (TH1D*) fVNDet->Get("SubEvt_1/hVNDetX_1");
  hVNDetY_1    = (TH1D*) fVNDet->Get("SubEvt_1/hVNDetY_1");
  hVNDetX_full = (TH1D*) fVNDet->Get("FullEvt/hVNDetX_full");
  hVNDetY_full = (TH1D*) fVNDet->Get("FullEvt/hVNDetY_full");

//.........这里部分代码省略.........
开发者ID:jrcastle,项目名称:EbyEAnalysis,代码行数:101,代码来源:ReadTree_normDet.C

示例3: main


//.........这里部分代码省略.........
	Double_t ePhi_ini, ePhi, gPhi,hPhi;
	Double_t eTheta_ini, eTheta, gTheta,hTheta;
	Int_t Ngen,Nacc;

	//Define new measured quantities that include detector resolutions
	double eE_i, eE_f, gE, hE;
	double eE_i_res, eE_f_res,eP_res, eTheta_res, ePhi_res, ePx_res, ePy_res, ePz_res;
	double gP_res, gTheta_res, gPhi_res, gPx_res, gPy_res, gPz_res;
	double MM = 0.0,MM_res = 0.0, W=0.0, Wp=0.0;

	int e_theta_bin= 0, e_phi_bin= 0, e_p_bin=0;
	int h_theta_bin= 0, h_phi_bin= 0, h_p_bin=0;
	int g_theta_bin= 0, g_phi_bin=0, g_p_bin=0;
	double e_acc_f= 0.0, e_acc_l= 0.0, g_acc_f=0, g_acc_l=0, h_acc_f=0, h_acc_l=0;
	/*}}}*/

	/*DVCS: Define Rootfile and variables{{{*/
	TString filename = "";
	if(particle=="p"){
		if(energy_flag==11)
			filename = "../DVCS_Proton_11GeV.root";
		else if(energy_flag==8)
			filename = "../DVCS_Proton_8.8GeV.root";
	}else if(particle=="n"){
		if(energy_flag==11)
			filename = "../DVCS_Neutron_11GeV.root";
		else if(energy_flag==8)
			filename = "../DVCS_Neutron_8.8GeV.root";
	}

	TFile *file = new TFile(filename.Data(), "r");
	TTree *T = (TTree*) file->Get("T");

	T->SetBranchAddress("vertexz", &vertexz);
	T->SetBranchAddress("E0", &E0);

	T->SetBranchAddress("eP_ini", &eP_ini);
	T->SetBranchAddress("ePx_ini", &ePx_ini);
	T->SetBranchAddress("ePy_ini", &ePy_ini);
	T->SetBranchAddress("ePz_ini", &ePz_ini);
	T->SetBranchAddress("eTheta_ini",&eTheta_ini);
	T->SetBranchAddress("ePhi_ini",&ePhi_ini);

	T->SetBranchAddress("eP", &eP);
	T->SetBranchAddress("ePx", &ePx);
	T->SetBranchAddress("ePy", &ePy);
	T->SetBranchAddress("ePz", &ePz);
	T->SetBranchAddress("eTheta",&eTheta);
	T->SetBranchAddress("ePhi",&ePhi);

	T->SetBranchAddress("gP", &gP);
	T->SetBranchAddress("gPx", &gPx);
	T->SetBranchAddress("gPy", &gPy);
	T->SetBranchAddress("gPz", &gPz);
	T->SetBranchAddress("gTheta", &gTheta);
	T->SetBranchAddress("gPhi", &gPhi);

	T->SetBranchAddress("hP", &hP);
	T->SetBranchAddress("hPx", &hPx);
	T->SetBranchAddress("hPy", &hPy);
	T->SetBranchAddress("hPz", &hPz);
	T->SetBranchAddress("hTheta",&hTheta);
	T->SetBranchAddress("hPhi",&hPhi);

	T->SetBranchAddress("Q2", &Q2);
	T->SetBranchAddress("x", &x);
开发者ID:yezhihong,项目名称:My-DVCS,代码行数:67,代码来源:add_branch.C

示例4: checkPullTree


//.........这里部分代码省略.........
  TString c0String = c0Info->GetTitle();
  c0 = c0String.Atof();
  printf("Loaded parameter 0 for sigma: %f\n\n", c0);

  if (plotPull)
    std::cout << "Plotting pull..." << std::endl << std::endl;
  else
    std::cout << "Plotting delta'..." << std::endl << std::endl;

  Long64_t nTreeEntries = tree->GetEntriesFast();

  Double_t dEdx = 0.; // Measured dE/dx
  Double_t dEdxExpected = 0.; // Expected dE/dx according to parametrisation
  Double_t tanTheta = 0.; // Tangens of (local) theta at TPC inner wall
  Double_t pTPC = 0.; // Momentum at TPC inner wall
  UShort_t tpcSignalN = 0; // Number of clusters used for dEdx
  UChar_t  pidType = 0;
  Int_t    fMultiplicity = 0;
  //Double_t phiPrime = 0;

  // Only activate the branches of interest to save processing time
  tree->SetBranchStatus("*", 0); // Disable all branches
  tree->SetBranchStatus("pTPC", 1);
  tree->SetBranchStatus("dEdx", 1);
  tree->SetBranchStatus("dEdxExpected", 1);
  tree->SetBranchStatus("tanTheta", 1);
  tree->SetBranchStatus("tpcSignalN", 1);
  tree->SetBranchStatus("pidType", 1);
  //tree->SetBranchStatus("phiPrime", 1);
  if (isNonPP)
    tree->SetBranchStatus("fMultiplicity", 1);

  
  tree->SetBranchAddress("dEdx", &dEdx);
  tree->SetBranchAddress("dEdxExpected", &dEdxExpected);
  tree->SetBranchAddress("tanTheta", &tanTheta);
  tree->SetBranchAddress("tpcSignalN", &tpcSignalN);
  tree->SetBranchAddress("pTPC", &pTPC);
  tree->SetBranchAddress("pidType", &pidType);
  //tree->SetBranchAddress("phiPrime", &phiPrime);
  if (isNonPP)
    tree->SetBranchAddress("fMultiplicity", &fMultiplicity);

  
  // Output file
  TDatime daTime;
  TString savefileName = Form("%s%s_checkPullSigma_%04d_%02d_%02d__%02d_%02d.root", fileNameTree.ReplaceAll(".root", "").Data(),
                              recalculateExpecteddEdx ? "_recalcdEdx" : "",
                              daTime.GetYear(), daTime.GetMonth(), daTime.GetDay(), daTime.GetHour(), daTime.GetMinute());

  TFile* fSave = TFile::Open(Form("%s/%s", pathTree.Data(), savefileName.Data()), "recreate");
  if (!fSave) {
    std::cout << "Failed to open save file \"" << Form("%s/%s", pathTree.Data(), savefileName.Data()) << "\"!" << std::endl;
    return -1;
  }
  
  const Double_t pBoundLow = 0.1;
  const Double_t pBoundUp = 5;

  const Int_t nBins1 = TMath::Ceil(180 / downScaleFactor);
  const Int_t nBins2 = TMath::Ceil(100 / downScaleFactor);
  const Int_t nBins3 = TMath::Ceil(60 / downScaleFactor);
  
  const Int_t nPbinsForMap = nBins1 + nBins2 + nBins3;
  Double_t binsPforMap[nPbinsForMap + 1];
  
开发者ID:ktf,项目名称:AliPhysics,代码行数:66,代码来源:checkPullTree.C

示例5: execCheckErrors

void execCheckErrors(bool what = 0)
{
  TTree *tree = 0;
  TFile *file = 0;
  if (what == 0) {
    tree = new TTree("ntuple","");
    float px = 0;
    tree->Branch("px",&px);
    TString str;
    tree->Branch("str",&str);
    tree->Fill();
    tree->ResetBranchAddresses(); 
  } else if (what == 1) {
    file = new TFile("hsimple.root");
    tree = (TTree*)file->Get("ntuple");
  } else {
    tree = new TChain("ntuple", "ntuple");
    ((TChain*)tree)->Add("hsimple.root");
  }
  // tree->SetBranchStatus("*", 1);
  // tree->SetBranchStatus("px", 1);
  // std::cout << "fTreeNumber = " << tree->GetTreeNumber() << std::endl;
  tree->LoadTree(0); // REQUIRED
  // std::cout << "fTreeNumber = " << tree->GetTreeNumber() << std::endl;
  
  TBranch *p = ((TBranch *)-1);
  Int_t r;
  
  Float_t px, fake_px;
  Float_t *pxp = new Float_t();
  Float_t *fake_pxp = new Float_t();
  
  Int_t ix;
  Int_t *ixp = new Int_t();
  
  TString s;
  TString *sp = new TString();
  
  TObjString os;
  TObjString *osp = new TObjString();
  
  // Float_t ... (should be fine)
  std::cout << std::endl << "ALL should be FINE ... " << std::endl;
  p = ((TBranch *)-1);
  r = tree->SetBranchAddress("px", &px, &p);
  std::cout << "Float_t ... " << r << std::endl;
  if (p==((TBranch*)-1)) {
     std::cout << "p unchanged\n";
  } else if (p==0) {
     std::cout << "p set to zero\n";
  } else {
     std::cout << "p set to the branch address\n";
  }
  r = tree->SetBranchAddress("px", &px);
  std::cout << "Float_t ... "  << r << std::endl;
  r = tree->SetBranchAddress("px", pxp);
  std::cout << "Float_t ... "  << r << std::endl;
  r = tree->SetBranchAddress("px", &pxp);
  std::cout << "Float_t ... "  << r << std::endl;
  
  // Int_t ...  (should fail)
  std::cout << std::endl << "ALL should FAIL ... " << std::endl;
  p = ((TBranch *)-1);
  r = tree->SetBranchAddress("px", &ix, &p);
  std::cout << "Int_t ...  "  << r << std::endl;
  if (p==((TBranch*)-1)) {
     std::cout << "p unchanged\n";
  } else if (p==0) {
     std::cout << "p set to zero\n";
  } else {
     std::cout << "p set to the branch address\n";
  }
  r = tree->SetBranchAddress("px", &ix);
  std::cout << "Int_t ...  "  << r << std::endl;
  r = tree->SetBranchAddress("px", ixp);
  std::cout << "Int_t ...  "  << r << std::endl;
  r = tree->SetBranchAddress("px", &ixp);
  std::cout << "Int_t ...  "  << r << std::endl;
  
  // TString ... (should fail)
  std::cout << std::endl << "ALL should FAIL ... " << std::endl;
  p = ((TBranch *)-1);
  r = tree->SetBranchAddress("px", &s, &p);
  std::cout << "TString ... "  << r << std::endl;
  if (p==((TBranch *)-1)) {
     std::cout << "p unchanged\n";
  } else if (p==0) {
     std::cout << "p set to zero\n";
  } else {
     std::cout << "p set to the branch address\n";
  }
  r = tree->SetBranchAddress("px", sp);
  std::cout << "TString ... "  << r << std::endl;
  r = tree->SetBranchAddress("px", &sp);
  std::cout << "TString ... "  << r << std::endl;
  
  // TObjString ... (should fail)
  std::cout << std::endl << "ALL should FAIL ... " << std::endl;
  p = ((TBranch *)-1);
  r = tree->SetBranchAddress("px", &os, &p);
//.........这里部分代码省略.........
开发者ID:asmagina1995,项目名称:roottest,代码行数:101,代码来源:execCheckErrors.C

示例6: gastof_simple

void gastof_simple()
{
  const unsigned int run_id = 725;
  TFile* f = new TFile(Form("../../gastof_inner_run%d.root", run_id)); //FIXME
  TTree* t = (TTree*)f->Get("tdc");

  const unsigned int channels_to_probe = 32; //64;
  const double tot_min = 70., tot_max = -1.;
  const double lead_min = 6.8, lead_max = 6.95; // in \mus

  int num_hits;
  unsigned int ettt;
  double leading_edge[5000], tot[5000];
  int channel_id[5000];
  t->SetBranchStatus("*", 0);
  t->SetBranchStatus("num_measurements", 1); t->SetBranchAddress("num_measurements", &num_hits);
  t->SetBranchStatus("leading_edge", 1); t->SetBranchAddress("leading_edge", leading_edge);
  t->SetBranchStatus("channel_id", 1); t->SetBranchAddress("channel_id", channel_id);
  t->SetBranchStatus("tot", 1); t->SetBranchAddress("tot", tot);

  const unsigned int num_triggers = t->GetEntries();

  TH1D* h_tot_all_channels = new TH1D("h_tot_all_channels", "", 250, 0., 1000.);
  TH1D* h_lead_all_channels = new TH1D("h_lead_all_channels", "", 500, 0., 10.);

  double last_ettt = -1.;
  unsigned int num_overfl = 0;
  unsigned int mult[channels_to_probe];
  for (unsigned int i=0; i<num_triggers; i++) {
    t->GetEntry(i);
    for (unsigned int j=0; j<channels_to_probe; j++) {
//       lead[j].clear();    //lead[] not defined in gastof_simple
      mult[j] = 0;
    }
    if (i%10000==0) cerr << "Processing event " << i << " / " << num_triggers << endl;

    for (int j=0; j<num_hits; j++) {
      h_lead_all_channels->Fill(leading_edge[j]/1.e3, 1./num_triggers);
      if (leading_edge[j]<lead_min*1.e3 or leading_edge[j]>lead_max*1.e3) continue;
      h_tot_all_channels->Fill(tot[j]);
    }
  }

  GastofCanvas c_tot_all_chan("tot_all-channels", Form("Run %d, all channels", run_id));
  h_tot_all_channels->Draw();
  h_tot_all_channels->GetXaxis()->SetTitle("Time over threshold (ns)");
  h_tot_all_channels->GetYaxis()->SetTitle("Hits");

  {
    TPaveText* cuts = new TPaveText(0.4, 0.8, 0.5, 0.85, "ndc");
    cuts->SetTextAlign(13);
    cuts->SetTextFont(43);
    cuts->SetTextSize(18);
    cuts->SetFillColor(kWhite);
    cuts->SetLineColor(kWhite);
    //cuts->AddText(Form("ToT > %.1f ns", tot_min));
    cuts->AddText(Form("Lead. edge #in [%.1f-%.2f]  #mus", lead_min, lead_max));
    cuts->Draw("same");
  }

  c_tot_all_chan.Pad()->SetLogy();
  {
    TLine* line = new TLine(tot_min, 0., tot_min, h_tot_all_channels->GetMaximum()*0.8); //constructor for line: TLine( x1, y1, x2, y2)
    line->SetLineColor(kBlack);
    line->SetLineStyle(2);
    line->SetLineWidth(2);
    line->Draw("same");
  }
//   if (tot_max>0.) {  //<- condition never met in gastof_simple
//     TLine* line = new TLine(tot_max, 0., tot_max, h_tot_all_channels->GetMaximum()*0.8);
//     line->SetLineColor(kBlack);
//     line->SetLineStyle(2);
//     line->SetLineWidth(2);
//     line->Draw("same");
  }
开发者ID:MaximeRenaud,项目名称:pps-reconstruction,代码行数:75,代码来源:gastof_simple.C

示例7: top_extractor_all_variables_STS

void top_extractor_all_variables_STS() {
    
    TFile *f = new TFile(source_file_path);
    
    TTree *t = (TTree *) f->Get("TopologicalVariables");
	
	Double_t Centrality_AllJets; t->SetBranchAddress("Centrality_AllJets", &Centrality_AllJets);
	Double_t Cos_Jet1AllJets_AllJets; t->SetBranchAddress("Cos_Jet1AllJets_AllJets", &Cos_Jet1AllJets_AllJets);
	Double_t Cos_Jet1Lepton_Lab; t->SetBranchAddress("Cos_Jet1Lepton_Lab", &Cos_Jet1Lepton_Lab);
	Double_t Cos_Jet2AllJets_AllJets; t->SetBranchAddress("Cos_Jet2AllJets_AllJets", &Cos_Jet2AllJets_AllJets);
	Double_t Cos_Jet2Lepton_Lab; t->SetBranchAddress("Cos_Jet2Lepton_Lab", &Cos_Jet2Lepton_Lab);
	Double_t Cos_LightQuarkJetLepton_BTaggedTop; t->SetBranchAddress("Cos_LightQuarkJetLepton_BTaggedTop", &Cos_LightQuarkJetLepton_BTaggedTop);
	Double_t DeltaPhiJet1Jet2; t->SetBranchAddress("DeltaPhiJet1Jet2", &DeltaPhiJet1Jet2);
	Double_t DeltaPhiJet1MET; t->SetBranchAddress("DeltaPhiJet1MET", &DeltaPhiJet1MET);
	Double_t DeltaPhiJet2MET; t->SetBranchAddress("DeltaPhiJet2MET", &DeltaPhiJet2MET);
	Double_t DeltaPhiLeptonMET; t->SetBranchAddress("DeltaPhiLeptonMET", &DeltaPhiLeptonMET);
	Double_t DeltaRJet1Jet2; t->SetBranchAddress("DeltaRJet1Jet2", &DeltaRJet1Jet2);
	Double_t DeltaRMinLeptonJet; t->SetBranchAddress("DeltaRMinLeptonJet", &DeltaRMinLeptonJet);
	Double_t EventWeight; t->SetBranchAddress("EventWeight", &EventWeight);
	Double_t H_AllJets; t->SetBranchAddress("H_AllJets", &H_AllJets);
	Double_t H_Jet1Jet2; t->SetBranchAddress("H_Jet1Jet2", &H_Jet1Jet2);
	Double_t HT_AllJets; t->SetBranchAddress("HT_AllJets", &HT_AllJets);
	Double_t HT_AllJetsLeptonMET; t->SetBranchAddress("HT_AllJetsLeptonMET", &HT_AllJetsLeptonMET);
	Double_t HT_Jet1Jet2; t->SetBranchAddress("HT_Jet1Jet2", &HT_Jet1Jet2);
	Double_t HT_METlep; t->SetBranchAddress("HT_METlep", &HT_METlep);
	Double_t InstLumi; t->SetBranchAddress("InstLumi", &InstLumi);
	Double_t InvariantMass_AllJets; t->SetBranchAddress("InvariantMass_AllJets", &InvariantMass_AllJets);
	Double_t InvariantMass_Jet1Jet2; t->SetBranchAddress("InvariantMass_Jet1Jet2", &InvariantMass_Jet1Jet2);
	Double_t Jet1MuonPtRel; t->SetBranchAddress("Jet1MuonPtRel", &Jet1MuonPtRel);
	Double_t Jet2MuonPtRel; t->SetBranchAddress("Jet2MuonPtRel", &Jet2MuonPtRel);
	Double_t Jet3MuonPtRel; t->SetBranchAddress("Jet3MuonPtRel", &Jet3MuonPtRel);
	Double_t Jet4MuonPtRel; t->SetBranchAddress("Jet4MuonPtRel", &Jet4MuonPtRel);
	Double_t LeptonDCA; t->SetBranchAddress("LeptonDCA", &LeptonDCA);
	Double_t LeptonDCASig; t->SetBranchAddress("LeptonDCASig", &LeptonDCASig);
	Double_t LeptonDetEta; t->SetBranchAddress("LeptonDetEta", &LeptonDetEta);
	Double_t LeptonDetEtaCFT; t->SetBranchAddress("LeptonDetEtaCFT", &LeptonDetEtaCFT);
	Double_t LeptonE; t->SetBranchAddress("LeptonE", &LeptonE);
	Double_t LeptonEta; t->SetBranchAddress("LeptonEta", &LeptonEta);
	Double_t LeptonPhi; t->SetBranchAddress("LeptonPhi", &LeptonPhi);
	Double_t LeptonPt; t->SetBranchAddress("LeptonPt", &LeptonPt);
	Double_t METPhi; t->SetBranchAddress("METPhi", &METPhi);
	Double_t METPt; t->SetBranchAddress("METPt", &METPt);
	Double_t METPx; t->SetBranchAddress("METPx", &METPx);
	Double_t METPy; t->SetBranchAddress("METPy", &METPy);
	Double_t MetSig; t->SetBranchAddress("MetSig", &MetSig);
	Double_t Pt_Jet1Jet2; t->SetBranchAddress("Pt_Jet1Jet2", &Pt_Jet1Jet2);
	Double_t PVz; t->SetBranchAddress("PVz", &PVz);
	Double_t QTimesEta; t->SetBranchAddress("QTimesEta", &QTimesEta);
	Double_t TransverseMass_Jet1Jet2; t->SetBranchAddress("TransverseMass_Jet1Jet2", &TransverseMass_Jet1Jet2);
	Double_t weight_btag; t->SetBranchAddress("weight_btag", &weight_btag);
	Double_t weight_btagSF; t->SetBranchAddress("weight_btagSF", &weight_btagSF);
	Double_t weight_btagTaga; t->SetBranchAddress("weight_btagTaga", &weight_btagTaga);
	Double_t weight_Lumi; t->SetBranchAddress("weight_Lumi", &weight_Lumi);
	Double_t weight_Lumi2; t->SetBranchAddress("weight_Lumi2", &weight_Lumi2);
	Double_t weight_LeptonDetEta; t->SetBranchAddress("weight_LeptonDetEta", &weight_LeptonDetEta);
	Double_t weight_WPt; t->SetBranchAddress("weight_WPt", &weight_WPt);
	Double_t weight_VJets; t->SetBranchAddress("weight_VJets", &weight_VJets);
	Double_t weight_QCDshape; t->SetBranchAddress("weight_QCDshape", &weight_QCDshape);
	Double_t scale_HF; t->SetBranchAddress("scale_HF", &scale_HF);
	Double_t scale_MC; t->SetBranchAddress("scale_MC", &scale_MC);
	Double_t scale_MC2; t->SetBranchAddress("scale_MC2", &scale_MC2);
	Double_t scale_norm; t->SetBranchAddress("scale_norm", &scale_norm);
	Double_t weight_EMcorr; t->SetBranchAddress("weight_EMcorr", &weight_EMcorr);
	Double_t weight_Muon_ID; t->SetBranchAddress("weight_Muon_ID", &weight_Muon_ID);
	Double_t WPt; t->SetBranchAddress("WPt", &WPt);
	Double_t WTransverseMass; t->SetBranchAddress("WTransverseMass", &WTransverseMass);
	Double_t KS_LeptonPt; t->SetBranchAddress("KS_LeptonPt", &KS_LeptonPt);
	Double_t KS_METPt; t->SetBranchAddress("KS_METPt", &KS_METPt);
	Double_t KS_WTransverseMass; t->SetBranchAddress("KS_WTransverseMass", &KS_WTransverseMass);
	Double_t TrackQPt; t->SetBranchAddress("TrackQPt", &TrackQPt);
	Double_t TrackCurvSig; t->SetBranchAddress("TrackCurvSig", &TrackCurvSig);
	Double_t w_superOR_trig; t->SetBranchAddress("w_superOR_trig", &w_superOR_trig);
	Double_t w_singlelep_trig; t->SetBranchAddress("w_singlelep_trig", &w_singlelep_trig);
	Double_t w_ljets_trig; t->SetBranchAddress("w_ljets_trig", &w_ljets_trig);
	Double_t NuPz_S1; t->SetBranchAddress("NuPz_S1", &NuPz_S1);
	Double_t NuPz_S2; t->SetBranchAddress("NuPz_S2", &NuPz_S2);
	Double_t TopMassMinChiSqr; t->SetBranchAddress("TopMassMinChiSqr", &TopMassMinChiSqr);
	Double_t TopMassMinSig; t->SetBranchAddress("TopMassMinSig", &TopMassMinSig);
	Double_t SigTopMass; t->SetBranchAddress("SigTopMass", &SigTopMass);
	Double_t ChiTopMass; t->SetBranchAddress("ChiTopMass", &ChiTopMass);
	Int_t Is_W1c; t->SetBranchAddress("Is_W1c", &Is_W1c);
	Int_t Analysis; t->SetBranchAddress("Analysis", &Analysis);
	Int_t EventNumber; t->SetBranchAddress("EventNumber", &EventNumber);
	Int_t MCindex; t->SetBranchAddress("MCindex", &MCindex);
	Int_t FiredLepJetsTrigger; t->SetBranchAddress("FiredLepJetsTrigger", &FiredLepJetsTrigger);
	Int_t FiredSingleLepTrigger; t->SetBranchAddress("FiredSingleLepTrigger", &FiredSingleLepTrigger);
	Int_t Jet1MuonTagCharge; t->SetBranchAddress("Jet1MuonTagCharge", &Jet1MuonTagCharge);
	Int_t Jet1PartonMatch; t->SetBranchAddress("Jet1PartonMatch", &Jet1PartonMatch);
	Int_t Jet2MuonTagCharge; t->SetBranchAddress("Jet2MuonTagCharge", &Jet2MuonTagCharge);
	Int_t Jet2PartonMatch; t->SetBranchAddress("Jet2PartonMatch", &Jet2PartonMatch);
	Int_t Jet3MuonTagCharge; t->SetBranchAddress("Jet3MuonTagCharge", &Jet3MuonTagCharge);
	Int_t Jet3PartonMatch; t->SetBranchAddress("Jet3PartonMatch", &Jet3PartonMatch);
	Int_t Jet4MuonTagCharge; t->SetBranchAddress("Jet4MuonTagCharge", &Jet4MuonTagCharge);
	Int_t Jet4PartonMatch; t->SetBranchAddress("Jet4PartonMatch", &Jet4PartonMatch);
	Int_t LeptonCharge; t->SetBranchAddress("LeptonCharge", &LeptonCharge);
	Int_t LeptonNCFTHits; t->SetBranchAddress("LeptonNCFTHits", &LeptonNCFTHits);
	Int_t LeptonNSMTHits; t->SetBranchAddress("LeptonNSMTHits", &LeptonNSMTHits);
	Int_t NGoodJets; t->SetBranchAddress("NGoodJets", &NGoodJets);
	Int_t NAllPrimaryVertex; t->SetBranchAddress("NAllPrimaryVertex", &NAllPrimaryVertex);
	Int_t NTaggedJets; t->SetBranchAddress("NTaggedJets", &NTaggedJets);
//.........这里部分代码省略.........
开发者ID:lamatko,项目名称:root_scripts,代码行数:101,代码来源:top_extractor_all_variables_STS.C

示例8: reweightCheck


//.........这里部分代码省略.........
   TBranch        *b_vm_pz;   //!
   TBranch        *b_vm_eta;   //!
   TBranch        *b_vm_phi;   //!
   TBranch        *b_vm_e;   //!
   TBranch        *b_vm_pid;   //!
   TBranch        *b_g1_mass;   //!
   TBranch        *b_g1_pt;   //!
   TBranch        *b_g1_px;   //!
   TBranch        *b_g1_py;   //!
   TBranch        *b_g1_pz;   //!
   TBranch        *b_g1_eta;   //!
   TBranch        *b_g1_phi;   //!
   TBranch        *b_g1_e;   //!
   TBranch        *b_g1_pid;   //!
   TBranch        *b_g2_mass;   //!
   TBranch        *b_g2_pt;   //!
   TBranch        *b_g2_px;   //!
   TBranch        *b_g2_py;   //!
   TBranch        *b_g2_pz;   //!
   TBranch        *b_g2_eta;   //!
   TBranch        *b_g2_phi;   //!
   TBranch        *b_g2_e;   //!
   TBranch        *b_g2_pid;   //!
   TBranch        *b_h_mass;   //!
   TBranch        *b_h_pt;   //!
   TBranch        *b_h_px;   //!
   TBranch        *b_h_py;   //!
   TBranch        *b_h_pz;   //!
   TBranch        *b_h_eta;   //!
   TBranch        *b_h_phi;   //!
   TBranch        *b_h_e;   //!
   TBranch        *b_h_pid;   //!

  tin->SetBranchAddress("elec_mass", &elec_mass, &b_elec_mass);
   tin->SetBranchAddress("elec_pt", &elec_pt, &b_elec_pt);
   tin->SetBranchAddress("elec_px", &elec_px, &b_elec_px);
   tin->SetBranchAddress("elec_py", &elec_py, &b_elec_py);
   tin->SetBranchAddress("elec_pz", &elec_pz, &b_elec_pz);
   tin->SetBranchAddress("elec_eta", &elec_eta, &b_elec_eta);
   tin->SetBranchAddress("elec_phi", &elec_phi, &b_elec_phi);
   tin->SetBranchAddress("elec_e", &elec_e, &b_elec_e);
   tin->SetBranchAddress("elec_pid", &elec_pid, &b_elec_pid);
   tin->SetBranchAddress("ve_mass", &ve_mass, &b_ve_mass);
   tin->SetBranchAddress("ve_pt", &ve_pt, &b_ve_pt);
   tin->SetBranchAddress("ve_px", &ve_px, &b_ve_px);
   tin->SetBranchAddress("ve_py", &ve_py, &b_ve_py);
   tin->SetBranchAddress("ve_pz", &ve_pz, &b_ve_pz);
   tin->SetBranchAddress("ve_eta", &ve_eta, &b_ve_eta);
   tin->SetBranchAddress("ve_phi", &ve_phi, &b_ve_phi);
   tin->SetBranchAddress("ve_e", &ve_e, &b_ve_e);
   tin->SetBranchAddress("ve_pid", &ve_pid, &b_ve_pid);
   tin->SetBranchAddress("mu_mass", &mu_mass, &b_mu_mass);
   tin->SetBranchAddress("mu_pt", &mu_pt, &b_mu_pt);
   tin->SetBranchAddress("mu_px", &mu_px, &b_mu_px);
   tin->SetBranchAddress("mu_py", &mu_py, &b_mu_py);
   tin->SetBranchAddress("mu_pz", &mu_pz, &b_mu_pz);
   tin->SetBranchAddress("mu_eta", &mu_eta, &b_mu_eta);
   tin->SetBranchAddress("mu_phi", &mu_phi, &b_mu_phi);
   tin->SetBranchAddress("mu_e", &mu_e, &b_mu_e);
   tin->SetBranchAddress("mu_pid", &mu_pid, &b_mu_pid);
   tin->SetBranchAddress("vm_mass", &vm_mass, &b_vm_mass);
   tin->SetBranchAddress("vm_pt", &vm_pt, &b_vm_pt);
   tin->SetBranchAddress("vm_px", &vm_px, &b_vm_px);
   tin->SetBranchAddress("vm_py", &vm_py, &b_vm_py);
   tin->SetBranchAddress("vm_pz", &vm_pz, &b_vm_pz);
   tin->SetBranchAddress("vm_eta", &vm_eta, &b_vm_eta);
开发者ID:nkarast,项目名称:MG5quadme,代码行数:67,代码来源:reweightCheck.C

示例9: main


//.........这里部分代码省略.........
  vector<Int_t>   cscSegRing;
  vector<Int_t>   cscSegStation;
  vector<Int_t>   cscSegChamber;
  vector<UInt_t>  cscSegNHits;
  vector<Double_t> cscSegPhi;
  vector<Double_t> cscSegZ;
  vector<Double_t> cscSegR;
  vector<Double_t> cscSegDirPhi;
  vector<Double_t> cscSegDirTheta;
  UInt_t          DTSegment_N;
  vector<Int_t> DTSegWheel;
  vector<Int_t> DTSegStation;
  vector<Int_t> DTSegSector;
  vector<Double_t> DTSegLocalX;
  vector<Double_t> DTSegLocalY;
  vector<Double_t> DTSegZ;
  vector<Double_t> DTSegRho;
  vector<Double_t> DTSegPhi;
  Int_t           leadingDigiIEta;
  Int_t           leadingDigiIPhi;
  vector<double>  leadingDigiTimeSamples;
  UInt_t          leadingDigiPeakSample;
  Double_t        leadingDigiTotal;
  Double_t        leadingDigiR1;
  Double_t        leadingDigiR2;
  Double_t        leadingDigiRPeak;
  Double_t        leadingDigiROuter;
  vector<double>  top5DigiTimeSamples;
  UInt_t          top5DigiPeakSample;
  Double_t        top5DigiTotal;
  Double_t        top5DigiR1;
  Double_t        top5DigiR2;
  Double_t        top5DigiRPeak;
  Double_t        top5DigiROuter;

  //set old branch address
  tree->SetBranchAddress("events",&events);

  //define histograms
  TH1D* id_hist = new TH1D("id_hist","Event Number",100000,0,100000);
  TH1D* run_hist = new TH1D("run_hist","Run Number",8000,192000,200000);
  TH1D* bx_hist = new TH1D("bx_hist","BX",8000,0,4000);
  TH1D* bxWrtCollision_hist = new TH1D("bxWrtCollision_hist","BX w.r.t. Collision",4000,-1000,1000);
  TH1D* bxWrtBunch_hist = new TH1D("bxWrtBunch_hist","BX w.r.t. Bunch",4000,-1000,1000);

  TH1D* muStandAlonePt_numerator_hist = new TH1D("muStandAlonePt_numerator_hist","StandAlone Muon p_{T}",200,0,200);
  TH1D* muStandAlonePt_denominator_hist = new TH1D("muStandAlonePt_denominator_hist","StandAlone Muon p_{T}",200,0,200);

  //get entries for data_tree (read in the old tree), set new variables, fill new tree
  Int_t nentries = tree->GetEntriesFast();
  //Int_t nentries = tree->GetEntries();
  cout<<"number of entries is: "<<nentries<<endl;
  
  int pass_bx_cut = 0;
  int pass_trigger_cut = 0;

  for (Int_t i=0; i<nentries; i++) {
  //for (Int_t i=0; i<2000; i++) {    
  //for (Int_t i=0; i<100; i++) {
    tree->GetEntry(i);

    if ( (do_bx_cut && TMath::Abs(events->bxWrtCollision)>=2. && TMath::Abs(events->bxWrtBunch)>=2.) || (!do_bx_cut) ){
      pass_bx_cut++;

      if(events->mu_StandAlone_N>0){
	if(TMath::Abs(events->muStandAloneEta[0])<1.0){
	  if( (events->muStandAloneTrackNChambersDt[0] + events->muStandAloneTrackNChambersCsc[0])>1 ){
	    
	    muStandAlonePt_denominator_hist->Fill(events->muStandAlonePt[0],1.0);
	    
	    //pass trigger
	    //if ( (do_other_cut && (events->hltL2Mu20NoVertexNoBptx3BX || events->hltL2Mu30NoVertexNoBptx3BX || events->hltL2Mu20NoVertexNoBptx3BXNoHalo || events->hltL2Mu30NoVertexNoBptx3BXNoHalo || events->hltL2Mu20NoVertex2ChaNoBptx3BXNoHalo || events->hltL2Mu30NoVertex2ChaNoBptx3BXNoHalo ) ) || (!do_other_cut) ){ //hlt
	      if ( (do_other_cut && events->l1SingleMu6NoBptx ) || (!do_other_cut) ){ //L1
	      pass_trigger_cut++;
	      
	      
	      id_hist->Fill(events->id,1.0);
	      run_hist->Fill(events->run,1.0);
	      bx_hist->Fill(events->bx,1.0);
	      bxWrtCollision_hist->Fill(events->bxWrtCollision,1.0);
	      bxWrtBunch_hist->Fill(events->bxWrtBunch,1.0);
	    
	      muStandAlonePt_numerator_hist->Fill(events->muStandAlonePt[0],1.0);
	      
	    } //end of pass trigger
	  }//end of noise cut
	}//end of eta<1 cut
      } //end of at least 1 SA muon
    }//end of bx_cut
  }//end of loop over entries


  cout<<endl;
  cout<<"number of events passing bx cut is: "<<pass_bx_cut<<endl;
  cout<<"number of events passing trigger cut is: "<<pass_trigger_cut<<endl;

  fnew->Write();
  
  return(0);
}
开发者ID:jalimena,项目名称:UserCode,代码行数:101,代码来源:findTreevalues_makehistos_triggerTurnOn.cpp

示例10: RunMakeRazorPlots


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

  //*******************************************************************************************
  //Define Counts
  //*******************************************************************************************


  //*******************************************************************************************
  //Read files
  //*******************************************************************************************
  for (uint i=0; i < inputfiles.size(); ++i) {

    TFile* inputFile = new TFile(inputfiles[i].c_str(),"READ");
    assert(inputFile);
    TTree* tree = 0;
    tree = (TTree*)inputFile->Get("RazorInclusive");
  // if (box == 0) {
    //   tree = (TTree*)inputFile->Get("MultiJet");
    // } else if (box == 1) {
    //   tree = (TTree*)inputFile->Get("LooseLeptonMultiJet");
    // } else if (box == 2) {
    //   tree = (TTree*)inputFile->Get("MuMultiJet");
    // } else if (box == 3) {
    //   tree = (TTree*)inputFile->Get("EleMultiJet");
    // }
 
    float weight = 0;
    int box = -1;
    int nBTaggedJets = 0;
    float dPhiRazor = 0;
    float MR = 0;
    float Rsq = 0;
    float mT = 0;

    tree->SetBranchAddress("weight",&weight);
    tree->SetBranchAddress("box",&box);
    tree->SetBranchAddress("nBTaggedJets",&nBTaggedJets);
    tree->SetBranchAddress("dPhiRazor",&dPhiRazor);
    tree->SetBranchAddress("MR",&MR);
    tree->SetBranchAddress("Rsq",&Rsq);
    tree->SetBranchAddress("mT",&mT);

    cout << "Process : " << processLabels[i] << " : Total Events: " << tree->GetEntries() << "\n";
    for (int n=0;n<tree->GetEntries();n++) { 
     // for (int n=0;n<1000;n++) { 
   
      tree->GetEntry(n);
      if (n % 1000000 == 0) cout << "Processing Event " << n << "\n";       


      // if (intLumi*weight > 100) continue;

      //Box Options
      if (option == 0 ) {
	if (nBTaggedJets != 0) continue;
      }
      if (option == 1 ) {
	if (nBTaggedJets != 1) continue;
      }
      if (option == 2 ) {
	if (nBTaggedJets != 2) continue;
      }
      if (option == 3 ) {
	if (nBTaggedJets < 3) continue;
      }
      if (option == 4 ) {
	if (nBTaggedJets < 0) continue; // all b-tag categories combined
开发者ID:RazorCMS,项目名称:RazorAnalyzer,代码行数:67,代码来源:MakeRazorPlots_QCD.C

示例11: ppEffJpsiSysSFsSTA__idx_


//.........这里部分代码省略.........
      //double vertexZ;
      //double GenvertexZ;
      //Jpsi Variables
      Double_t JpsiMass,JpsiPt,JpsiRap, JpsiCharge;
      Double_t JpsiVprob;
      Double_t JpsiPhi;
      Double_t JpsiEta;
      //2.) muon variables RECO                                                                       
      double muPosPx, muPosPy, muPosPz,  muPosEta, muPosPt, muPosP, muPosPhi;
      double muNegPx, muNegPy, muNegPz,  muNegEta, muNegPt, muNegP, muNegPhi;
      //(1).Positive Muon                                     
      double muPos_nchi2In, muPos_dxy, muPos_dz, muPos_nchi2Gl;
      int muPos_found, muPos_pixeLayers, muPos_nValidMuHits,muPos_arbitrated;
      bool muPos_matches,muPos_tracker;
      int muPos_Trigger10, muPos_Trigger2, muPos_Trigger21, muPos_Trigger22;
      //(2).Negative Muon                                     
      double muNeg_nchi2In, muNeg_dxy, muNeg_dz, muNeg_nchi2Gl;
      int muNeg_found, muNeg_pixeLayers, muNeg_nValidMuHits,muNeg_arbitrated;
      bool muNeg_matches,muNeg_tracker;
      int muNeg_Trigger10, muNeg_Trigger2, muNeg_Trigger21, muNeg_Trigger22;

      //Gen Level variables
      //Gen PrJpsi Variables
      double GenJpsiMass, GenJpsiPt, GenJpsiRap;
      double GenJpsiPx, GenJpsiPy, GenJpsiPz;
      double GenJpsiPhi;
      double GenJpsiEta;
      //2.) Gen muon variables 
      double GenmuPosPx, GenmuPosPy, GenmuPosPz,  GenmuPosEta, GenmuPosPt, GenmuPosPhi;
      double GenmuNegPx, GenmuNegPy, GenmuNegPz,  GenmuNegEta, GenmuNegPt, GenmuNegPhi;
      double zVtx;

      //Event variables
      tree->SetBranchAddress("eventNb",&eventNb);
      tree->SetBranchAddress("runNb",&runNb);
      tree->SetBranchAddress("lumiBlock",&lumiBlock);
      tree->SetBranchAddress("hbit1",&hbit1);
      tree->SetBranchAddress("zVtx",&zVtx);
      //tree->SetBranchAddress("vertexZ",&vertexZ);

      //Jpsi Variables
      tree->SetBranchAddress("JpsiCharge",&JpsiCharge);
      tree->SetBranchAddress("JpsiMass",&JpsiMass);
      tree->SetBranchAddress("JpsiPt",&JpsiPt);
      tree->SetBranchAddress("JpsiPhi",&JpsiPhi);
      tree->SetBranchAddress("JpsiEta",&JpsiEta);
      tree->SetBranchAddress("JpsiRap",&JpsiRap);
      tree->SetBranchAddress("JpsiVprob",&JpsiVprob);

      //muon variable
      tree->SetBranchAddress("muPosPx",&muPosPx);
      tree->SetBranchAddress("muPosPy",&muPosPy);
      tree->SetBranchAddress("muPosPz",&muPosPz);
      tree->SetBranchAddress("muPosEta",&muPosEta);
      tree->SetBranchAddress("muPosPhi",&muPosPhi);
      tree->SetBranchAddress("muNegPx", &muNegPx);
      tree->SetBranchAddress("muNegPy", &muNegPy);
      tree->SetBranchAddress("muNegPz", &muNegPz);
      tree->SetBranchAddress("muNegEta", &muNegEta);
      tree->SetBranchAddress("muNegPhi", &muNegPhi);


      //1). Positive Muon
      tree->SetBranchAddress("muPos_nchi2In", &muPos_nchi2In);
      tree->SetBranchAddress("muPos_dxy", &muPos_dxy);
      tree->SetBranchAddress("muPos_dz", &muPos_dz);
开发者ID:CMS-HIN-dilepton,项目名称:DimuonCADIs,代码行数:67,代码来源:ppEffJpsiSysSFsSTA.C

示例12: pbpbEffJpsiSFSysSTA__idx_


//.........这里部分代码省略.........
      Double_t JpsiEta;
      Double_t JpsiPsi[38];
      Double_t JpsiGenPsi;
      //2.) muon variables RECO                                                                       
      double muPosPx, muPosPy, muPosPz,  muPosEta, muPosPt, muPosP, muPosPhi;
      double muNegPx, muNegPy, muNegPz,  muNegEta, muNegPt, muNegP, muNegPhi;
      //(1).Positive Muon                                     
      double muPos_nchi2In, muPos_dxy, muPos_dz, muPos_nchi2Gl;
      int muPos_found, muPos_pixeLayers, muPos_nValidMuHits,muPos_arbitrated,muPos_TMOneST,muPos_trkLayMeas;
      bool muPos_matches,muPos_tracker;
      int muPos_Trigger2, muPos_Trigger10;
      int muPos_Trigger4, muPos_Trigger12, muPos_Trigger13;
      int muPos_Trigger21, muPos_Trigger22;
      //(2).Negative Muon                                     
      double muNeg_nchi2In, muNeg_dxy, muNeg_dz, muNeg_nchi2Gl;
      int muNeg_found, muNeg_pixeLayers, muNeg_nValidMuHits,muNeg_arbitrated,muNeg_TMOneST,muNeg_trkLayMeas;
      bool muNeg_matches,muNeg_tracker;
      int muNeg_Trigger2, muNeg_Trigger10;
      int muNeg_Trigger4, muNeg_Trigger12, muNeg_Trigger13;
      int muNeg_Trigger21, muNeg_Trigger22;

      //Gen Level variables
      //Gen PrJpsi Variables
      double GenJpsiMass, GenJpsiPt, GenJpsiRap;
      double GenJpsiPx, GenJpsiPy, GenJpsiPz;
      double GenJpsiPhi;
      double GenJpsiEta;
      double GenJpsiPsi;
      //2.) Gen muon variables 
      double GenmuPosPx, GenmuPosPy, GenmuPosPz,  GenmuPosEta, GenmuPosPt, GenmuPosPhi;
      double GenmuNegPx, GenmuNegPy, GenmuNegPz,  GenmuNegEta, GenmuNegPt, GenmuNegPhi;

      //Event variables
      tree->SetBranchAddress("eventNb",&eventNb);
      tree->SetBranchAddress("runNb",&runNb);
      tree->SetBranchAddress("lumiBlock",&lumiBlock);
      tree->SetBranchAddress("hbit1",&hbit1);
      tree->SetBranchAddress("zVtx",&zVtx);

      //Jpsi Variables
      tree->SetBranchAddress("JpsiCharge",&JpsiCharge);
      tree->SetBranchAddress("JpsiMass",&JpsiMass);
      tree->SetBranchAddress("JpsiPt",&JpsiPt);
      tree->SetBranchAddress("JpsiPhi",&JpsiPhi);
      tree->SetBranchAddress("JpsiEta",&JpsiEta);
      tree->SetBranchAddress("JpsiPsi",&JpsiPsi);
      tree->SetBranchAddress("JpsiGenPsi",&JpsiGenPsi);
      tree->SetBranchAddress("JpsiRap",&JpsiRap);
      tree->SetBranchAddress("JpsiVprob",&JpsiVprob);
      tree->SetBranchAddress("rbin",&rbin);

      //muon variable
      tree->SetBranchAddress("muPosPx",&muPosPx);
      tree->SetBranchAddress("muPosPy",&muPosPy);
      tree->SetBranchAddress("muPosPz",&muPosPz);
      tree->SetBranchAddress("muPosEta",&muPosEta);
      tree->SetBranchAddress("muPosPhi",&muPosPhi);
      tree->SetBranchAddress("muNegPx", &muNegPx);
      tree->SetBranchAddress("muNegPy", &muNegPy);
      tree->SetBranchAddress("muNegPz", &muNegPz);
      tree->SetBranchAddress("muNegEta", &muNegEta);
      tree->SetBranchAddress("muNegPhi", &muNegPhi);


      //1). Positive Muon
      tree->SetBranchAddress("muPos_nchi2In", &muPos_nchi2In);
开发者ID:CMS-HIN-dilepton,项目名称:DimuonCADIs,代码行数:67,代码来源:pbpbEffJpsiSFSysSTA.C

示例13: readBacon

void readBacon(){


        TFile* fIn = new TFile("ntuple.root");
        TTree* tree = (TTree*) fIn->Get("Events");
        TClonesArray *fPFPart = new TClonesArray("baconhep::TPFPart");
        TClonesArray *fGenPart = new TClonesArray("baconhep::TGenParticle");
        TClonesArray *fVertex = new TClonesArray("baconhep::TVertex");
     
        tree->SetBranchAddress("PFPart", &fPFPart);
        tree->SetBranchAddress("GenParticle", &fGenPart);
        tree->SetBranchAddress("PV",&fVertex);

for(int i0 = 0; i0 <tree->GetEntriesFast(); i0++) { //1, event loop



tree->GetEntry(i0);

std::vector<fastjet::PseudoJet> particles; particles.clear();
        for( int i1 = 0; i1 < fPFPart->GetEntriesFast(); i1++){//2,entries loop,fill the vector particles with PF particles
            baconhep::TPFPart *pPartTmp = (baconhep::TPFPart*)((*fPFPart)[i1]);

        double Px=pPartTmp->pt*cos(pPartTmp->phi);
        double Py= pPartTmp->pt*sin(pPartTmp->phi);
        double theta = 2*atan(exp(-pPartTmp->eta)); //eta = -ln(tan(theta/2))
        double Pz = pPartTmp->pt/tan(theta);
        double E = pPartTmp->e;
        double pdgId = pPartTmp->pfType;
        int charge = pPartTmp->q;
        fastjet::PseudoJet tmp_psjet(Px, Py, Pz, E);
        tmp_psjet.set_user_info( new PseudoJetUserInfo(pdgId, charge) );
        particles.push_back(tmp_psjet);
  

        }//2,entries loop ,fill the vector particles with PFparticles


        double rhoEtaMax=4.4;
        fastjet::GridMedianBackgroundEstimator* mBgeGrid;
        fastjet::Subtractor* subtractor;
        subtractor=NULL;
        mBgeGrid= new fastjet::GridMedianBackgroundEstimator(rhoEtaMax, 0.55);
        mBgeGrid->set_particles(particles);
        if(subtractor) delete subtractor;
        subtractor= new fastjet::Subtractor(mBgeGrid);
        double rhoVal_grid=mBgeGrid->rho();
         fastjet::GhostedAreaSpec fjActiveArea(ghostEtaMax,activeAreaRepeats,ghostArea);
        fjActiveArea.set_fj2_placement(true);
        fastjet::AreaDefinition *mAreaDefinition;
        mAreaDefinition =new fastjet::AreaDefinition( fastjet::active_area_explicit_ghosts, fjActiveArea );
        fastjet::Selector selected_eta = fastjet::SelectorAbsEtaMax(2.4);
        
        double R=0.8;//define the jet cone radius to use 
        std::string JetAlgorithm = "AK"; //choose which jet algo to use , write AK for antikt, CA for Cambridge/Achen, KT for kt algo
        
        JetDefinition jet_def(antikt_algorithm,R);


      if (JetAlgorithm == "AK")jet_def.set_jet_algorithm( fastjet::antikt_algorithm );
      else if (JetAlgorithm == "CA")jet_def.set_jet_algorithm( fastjet::cambridge_algorithm );
      else if (JetAlgorithm == "KT")jet_def.set_jet_algorithm( fastjet::kt_algorithm );
       //else throw << " unknown jet algorithm " << std::endl;

        fastjet::ClusterSequenceArea thisClustering_area(particles, jet_def, *mAreaDefinition);
        fastjet::ClusterSequence thisClustering_basic(particles, jet_def);



        std::vector<fastjet::PseudoJet> out_jets = sorted_by_pt( selected_eta(thisClustering_area.inclusive_jets(15.0)) );
        std::vector<fastjet::PseudoJet> out_jets_basic = sorted_by_pt( selected_eta(thisClustering_basic.inclusive_jets(15.0)) );
  



//Now you can print the jet momentum , mass , pt etc like the following
        for(int j=0;j<out_jets.size();j++){
        cout<<"jet pt = "<<out_jets.at(j).pt()<<endl;
         cout<<"jet eta = "<<out_jets.at(j).eta()<<endl;
          cout<<"jet phi = "<<out_jets.at(j).phi()<<endl;
        }



















//.........这里部分代码省略.........
开发者ID:bmahakud,项目名称:BaconFramework,代码行数:101,代码来源:readBaconForIvan.C

示例14: main

int main(int argc, char* argv[])
{
  TFile* f = new TFile("example/ntuple.root","READ");
  TTree* t = (TTree*) f->Get("EleTauKinFit");
  
  TH1F* h_mH    = new TH1F("h_mH",   "distribution of mH_{fit};mH_{fit} [GeV];entries/5GeV", 40,200,400);
  TH1F* h_chi2  = new TH1F("h_chi2", "distribution of #chi^{2}_{fit};#chi^{2}_{fit};entries/1", 100,0,25);
  TH1F* h_prob  = new TH1F("h_prob", "distribution of fit probability;P_{fit};entries/0.05", 100,0,1);
  TH1F* h_pull1 = new TH1F("h_pull1","pull distribution E_{b1};pull;entries/0.25", 20,-5,5);
  TH1F* h_pull2 = new TH1F("h_pull2","pull distribution E_{b2};pull;entries/0.25", 20,-5,5);
  TH1F* h_pullB = new TH1F("h_pullB","pull distribution balance;pull;entries/0.25", 20,-5,5);
  
  Int_t max_nevent = t->GetEntriesFast();

  //Leaf types  
   Int_t           njets;
   Double_t        b1_dR;
   Double_t        b1_csv;
   Double_t        b1_px;
   Double_t        b1_py;
   Double_t        b1_pz;
   Double_t        b1_E;
   Double_t        b2_dR;
   Double_t        b2_csv;
   Double_t        b2_px;
   Double_t        b2_py;
   Double_t        b2_pz;
   Double_t        b2_E;
   Double_t        tauvis1_dR;
   Double_t        tauvis1_px;
   Double_t        tauvis1_py;
   Double_t        tauvis1_pz;
   Double_t        tauvis1_E;
   Double_t        tauvis2_dR;
   Double_t        tauvis2_px;
   Double_t        tauvis2_py;
   Double_t        tauvis2_pz;
   Double_t        tauvis2_E;
   Double_t        met_pt;
   Double_t        met_px;
   Double_t        met_py;
   Double_t        met_cov00;
   Double_t        met_cov10;
   Double_t        met_cov01;
   Double_t        met_cov11;


  // List of branches
   TBranch        *b_njets;
   TBranch        *b_b1_dR;
   TBranch        *b_b1_csv;
   TBranch        *b_b1_px;
   TBranch        *b_b1_py;
   TBranch        *b_b1_pz;
   TBranch        *b_b1_E;
   TBranch        *b_b2_dR;
   TBranch        *b_b2_csv;
   TBranch        *b_b2_px;
   TBranch        *b_b2_py;
   TBranch        *b_b2_pz;
   TBranch        *b_b2_E;
   TBranch        *b_tauvis1_dR;
   TBranch        *b_tauvis1_px;
   TBranch        *b_tauvis1_py;
   TBranch        *b_tauvis1_pz;
   TBranch        *b_tauvis1_E;
   TBranch        *b_tauvis2_dR;
   TBranch        *b_tauvis2_px;
   TBranch        *b_tauvis2_py;
   TBranch        *b_tauvis2_pz;
   TBranch        *b_tauvis2_E;
   TBranch        *b_met_pt;
   TBranch        *b_met_px;
   TBranch        *b_met_py;
   TBranch        *b_met_cov00;
   TBranch        *b_met_cov10;
   TBranch        *b_met_cov01;
   TBranch        *b_met_cov11;
     
   t->SetBranchAddress("Njets", &njets, &b_njets);
   t->SetBranchAddress("b1_dR", &b1_dR, &b_b1_dR);
   t->SetBranchAddress("b1_csv", &b1_csv, &b_b1_csv);
   t->SetBranchAddress("b1_px", &b1_px, &b_b1_px);
   t->SetBranchAddress("b1_py", &b1_py, &b_b1_py);
   t->SetBranchAddress("b1_pz", &b1_pz, &b_b1_pz);
   t->SetBranchAddress("b1_E", &b1_E, &b_b1_E);
   t->SetBranchAddress("b2_dR", &b2_dR, &b_b2_dR);
   t->SetBranchAddress("b2_csv", &b2_csv, &b_b2_csv);
   t->SetBranchAddress("b2_px", &b2_px, &b_b2_px);
   t->SetBranchAddress("b2_py", &b2_py, &b_b2_py);
   t->SetBranchAddress("b2_pz", &b2_pz, &b_b2_pz);
   t->SetBranchAddress("b2_E", &b2_E, &b_b2_E);
   t->SetBranchAddress("tauvis1_dR", &tauvis1_dR, &b_tauvis1_dR);
   t->SetBranchAddress("tauvis1_px", &tauvis1_px, &b_tauvis1_px);
   t->SetBranchAddress("tauvis1_py", &tauvis1_py, &b_tauvis1_py);
   t->SetBranchAddress("tauvis1_pz", &tauvis1_pz, &b_tauvis1_pz);
   t->SetBranchAddress("tauvis1_E", &tauvis1_E, &b_tauvis1_E);
   t->SetBranchAddress("tauvis2_dR", &tauvis2_dR, &b_tauvis2_dR);
   t->SetBranchAddress("tauvis2_px", &tauvis2_px, &b_tauvis2_px);
   t->SetBranchAddress("tauvis2_py", &tauvis2_py, &b_tauvis2_py);
//.........这里部分代码省略.........
开发者ID:bvormwald,项目名称:HHKinFit,代码行数:101,代码来源:example.C

示例15: FillHistos


//.........这里部分代码省略.........
  }
  hBDT->Sumw2();
  hMLP->Sumw2();
  hMLP_demo->Sumw2();
  hMLP_JESlo->Sumw2();
  hMLP_JESup->Sumw2();
  hCos->Sumw2();  
  hHT->Sumw2();
  hHT_JESlo->Sumw2();
  hHT_JESup->Sumw2();
  hM8J->Sumw2();
  hM4J->Sumw2();  
  hHT4J->Sumw2();
  hPT4J->Sumw2();
  hEta4J->Sumw2();  
  hM2J->Sumw2();
  hB4J->Sumw2();
  hB2J->Sumw2();
  hPtAll->Sumw2();
  hEtaAll->Sumw2();
  hPhiAll->Sumw2();
  hBetaAll->Sumw2();
  hChfAll->Sumw2();
  hNhfAll->Sumw2();
  hPhfAll->Sumw2();
  hMufAll->Sumw2();
  hElfAll->Sumw2();
  //----- tree variables ---------------------- 
  float BDT,MLP,BDT_JESlo,MLP_JESlo,BDT_JESup,MLP_JESup,m2jAve,m2jSig,m4jAve,m4jBalance,m8j,ht,cosThetaStar,wt(1.0);
  float ht4j[2],pt4j[2],eta4j[2];
  float pt[8],eta[8],phi[8],beta[8],chf[8],nhf[8],phf[8],muf[8],elf[8],unc[8];
  //----- tree branches -----------------------
  tr = (TTree*)inf->Get("multijets/events");  
  tr->SetBranchAddress("BDT",&BDT);
  tr->SetBranchAddress("MLP",&MLP);
  tr->SetBranchAddress("MLP_JESlo",&MLP_JESlo);
  tr->SetBranchAddress("MLP_JESup",&MLP_JESup);
  tr->SetBranchAddress("ht",&ht);
  tr->SetBranchAddress("m8j",&m8j); 
  tr->SetBranchAddress("m4jAve",&m4jAve);
  tr->SetBranchAddress("m4jBalance",&m4jBalance);  
  tr->SetBranchAddress("m2jAve",&m2jAve);
  tr->SetBranchAddress("m2jSig",&m2jSig);
  tr->SetBranchAddress("cosThetaStar",&cosThetaStar);
  tr->SetBranchAddress("ht4j",&ht4j);
  tr->SetBranchAddress("pt4j",&pt4j);
  tr->SetBranchAddress("eta4j",&eta4j);
  tr->SetBranchAddress("pt",&pt);
  tr->SetBranchAddress("eta",&eta);
  tr->SetBranchAddress("phi",&phi);
  tr->SetBranchAddress("beta",&beta);
  tr->SetBranchAddress("chf",&chf);
  tr->SetBranchAddress("nhf",&nhf);
  tr->SetBranchAddress("phf",&phf);
  tr->SetBranchAddress("muf",&muf);
  tr->SetBranchAddress("elf",&elf);
  tr->SetBranchAddress("unc",&unc);
  if (UseWeights) {  
    tr->SetBranchAddress("wt",&wt); 
  }    
  //----- loop over tree entries ----------------
  for(int iev=0;iev<tr->GetEntries();iev++) {
    tr->GetEntry(iev);
    bool preselection = (ht > 750 && pt[7] > 30);
    if (!preselection) continue;
    hBDT->Fill(BDT,wt);
开发者ID:ForwardGroupBrazil,项目名称:QCDCodes,代码行数:67,代码来源:FillHistos.C


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