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


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

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


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

示例1: Ana


//.........这里部分代码省略.........
  int nentries = tree->GetEntries();
  double pexp = sqrt(pow(Ebeam/2,2)-pow(mka,2));
  std::cout<<"Total entries is " << nentries << std::endl;
  std::cout<<"Beam energy is " << Ebeam << std::endl;
  std::cout<<"Expected K momentum is " << pexp << std::endl;
  int count0=0,count1=0,count2=0,count3=0;
  int count[10]={0};
  int tagmc=0;

  for (int ien=0;ien<nentries;ien++){
    tree->GetEntry(ien);
    
    isrtag = 0;
    for (int j=0;j<idxmc;j++){
      if (pdgid[j] == 22 && motheridx[j]==j) { tagmc++; isrtag=1;}
    }
    if (emcstatusShort!=0x3 && emcstatusInt!=0x3) continue;
    if (ntof1<1) continue;
    if (ntof2<1) continue;
    for (int i=0;i<ntof1;i++){
      if (tofl1[i]==1) tof11=tof1[i];
    }
    for (int i=0;i<ntof2;i++){
      if (tofl2[i]==1) tof21=tof2[i];
    }
 
    count0++;

    kap.SetVectMag(TVector3(kappx,kappy,kappz),mka);
    kam.SetVectMag(TVector3(kampx,kampy,kampz),mka);
    
    // angular information in lab coordinate
    costheta1 = kap.CosTheta();
    costheta2 = kam.CosTheta();
    
    // momentum information in cms coordinalte
    pt1 = kap.Perp();
    pt2 = kam.Perp();
    kap.Boost(-0.011,0,0);
    kam.Boost(-0.011,0,0);
    costheta = kap.Vect().Dot(kam.Vect())/(kap.Vect().Mag()*kam.Vect().Mag());
    theta = kap.Vect().Angle(kam.Vect())/TMath::Pi()*180.;
    mass = (kap+kam).M();
    totp = (kap+kam).Rho();
    p1 = kap.Rho();
    p2 = kam.Rho();
    dtof = tof11 - tof21;
    eop1 = epratio1;
    eop2 = epratio2;

    //vars->Fill();

    if (fabs(costheta1)<0.93 && costheta1 < 0.8 ) { count[4]++;
    if (fabs(costheta2)<0.93 && costheta2 > -0.8){ count[5]++;
    if (theta>m_thecut)
    { count[2]++;
    //if (epratio1<m_epcut)
    { count[0]++;
      //if (epratio2<m_epcut)
      { count[1]++;
        //if (fabs(tof11-tof21)<m_tofcut)
        if (p1<m_pcut && p2<m_pcut)
        {
          count3++;
          vars->Fill();
        //if (p2<m_pcut) {/*datasel2->Fill();*/ count2++; // p2 dis
        //  //datasel1->Fill();
        //  vars->Fill();
        //}
        }
      }
    }
    }
    
    }
    }
  }
  dir->Write();

  ofstream cutflow("cutflow2",std::ios::app);
  //ofstream cutflow("cutflow_cmp665andp01",std::ios::app);
  cutflow<<filename<<std::endl;
  //std::cout<<"data selction 2 size is "<<datasel2->GetEntries()<<" "<<count2<<std::endl;
  cutflow<<"Initial size      :"<<nentries<<std::endl;
  cutflow<<"Tagged ISR evt    :"<< tagmc  <<std::endl;
  cutflow<<"Tagged no ISR evt :"<< nentries - tagmc  <<std::endl;
  cutflow<<"Valid tof and emc :"<<count0<<std::endl;
  cutflow<<"After cos1<0.8    :"<<count[4]<<std::endl;
  cutflow<<"After cos2>-0.8   :"<<count[5]<<std::endl;
  cutflow<<"After theta cut   :"<<count[2]<<std::endl;
  cutflow<<"After ep1         :"<<count[0]<<std::endl;
  cutflow<<"After ep2         :"<<count[1]<<std::endl;
  //cutflow<<"After totp<0.05   :"<<count[3]<<std::endl;
  cutflow<<"After dtof<3      :"<<count3<<std::endl;
  //cutflow<<"p1-exp<0.08 for p1:"<<count1<<std::endl;
  cutflow<<"p1-exp<3 sigma    :"<<count2<<std::endl;

  return 0;
 
}
开发者ID:dannielliu,项目名称:KKcross,代码行数:101,代码来源:Ana_openAng.C

示例2: ScanTree


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

    try {
      //      cout << "trying passL1" << endl;
      bool passL1 = false;
      for (int iL1 = 0; iL1 < nL1; iL1++) {
	if ((*l1Pt).at(iL1) + 0.01 > 7 && (*l1Quality).at(iL1) >= 4) {
	  passL1 = true;
	}
      }

      //      cout << "trying passL2" << endl;
      bool passL2 = false;
      for (int iL2 = 0; iL2 < nL2; iL2++) {
	if (passL1) {
	  if ((*l2Pt).at(iL2) > 7 && (*l2Eta).at(iL2) > -2.5 && (*l2Eta).at(iL2) < 2.5) {
	    passL2 = true;
	  }
	}
      }
      bool passL3 = false;
      for (int iL3 = 0; iL3 < nL3; iL3++) {
	if (passL2) {
	  if ((*l3Pt).at(iL3) > 9 && (*l3Eta).at(iL3) > -2.5 && (*l3Eta).at(iL3) < 2.5) {
	    passL3 = true;
	  }
	}
      }

      for (int i = 0; i < nSimMuon; i++) {
	if ((*simMuonPt).at(i) > ptCut) {
	
	  lXOverSimEtaEffDenom->Fill((*simMuonEta).at(i));
	  lXOverSimPtEffDenom->Fill((*simMuonPt).at(i));
	  lXOverSimPtEtaEffDenom->Fill((*simMuonPt).at(i),(*simMuonEta).at(i));

	  //	cout << "trying to associate sim to L1 by DR" << endl;
	  int l1Index = STR_Association_Index((*simMuonEta).at(i),(*simMuonPhi).at(i),l1Eta,l1Phi,1.0,l1UsedBySim);
	  int l2Index = STR_Association_Index((*simMuonEta).at(i),(*simMuonPhi).at(i),l2Eta,l2Phi,0.2,l2UsedBySim);
	  int l3Index = STR_Association_Index((*simMuonEta).at(i),(*simMuonPhi).at(i),l3Eta,l3Phi,0.1,l3UsedBySim);
	  if (l1Index >= 0) {
	    l1OverXEtaEffNum->Fill((*simMuonEta).at(i));
	    l1OverXPtEffNum->Fill((*simMuonPt).at(i));
	    l1OverXPtEtaEffNum->Fill((*simMuonPt).at(i),(*simMuonEta).at(i));
	    
	    lXOverL1EtaEffDenom->Fill((*simMuonEta).at(i));
	    lXOverL1PtEffDenom->Fill((*simMuonPt).at(i));
	    lXOverL1PtEtaEffDenom->Fill((*simMuonPt).at(i),(*simMuonEta).at(i));

	    if (l2Index >= 0) {
	      l2OverXEtaEffNum->Fill((*simMuonEta).at(i));
	      l2OverXPtEffNum->Fill((*simMuonPt).at(i));
	      l2OverXPtEtaEffNum->Fill((*simMuonPt).at(i),(*simMuonEta).at(i));	      

	      lXOverL2EtaEffDenom->Fill((*simMuonEta).at(i));
	      lXOverL2PtEffDenom->Fill((*simMuonPt).at(i));
	      lXOverL2PtEtaEffDenom->Fill((*simMuonPt).at(i),(*simMuonEta).at(i));

	      if (l3Index >= 0) {
		l3OverXEtaEffNum->Fill((*simMuonEta).at(i));
		l3OverXPtEffNum->Fill((*simMuonPt).at(i));
		l3OverXPtEtaEffNum->Fill((*simMuonPt).at(i),(*simMuonEta).at(i));	      
	      } // l3 associated
	    } // l2 associated
	  } // l1 associated
	} // cut on sim pT
      } // loop over sim
      (*l1UsedBySim).clear();
      (*l2UsedBySim).clear();
      (*l3UsedBySim).clear();
    } // try statement
    catch (...) {
      cout << "Fuck it.  Pressing on" << endl;
    }
  } // event loop
  
  divide_histos_and_errors(l3OverXEtaEffNum,lXOverSimEtaEffDenom,l3OverSimEtaEff);
  divide_histos_and_errors(l3OverXEtaEffNum,lXOverL1EtaEffDenom,l3OverL1EtaEff);
  divide_histos_and_errors(l3OverXEtaEffNum,lXOverL2EtaEffDenom,l3OverL2EtaEff);
  divide_histos_and_errors(l3OverXPtEffNum,lXOverSimPtEffDenom,l3OverSimPtEff);
  divide_histos_and_errors(l3OverXPtEffNum,lXOverL1PtEffDenom,l3OverL1PtEff);
  divide_histos_and_errors(l3OverXPtEffNum,lXOverL2PtEffDenom,l3OverL2PtEff);
  divide_TH2_histos_and_errors(l3OverXPtEtaEffNum,lXOverSimPtEtaEffDenom,l3OverSimPtEtaEff);
  divide_TH2_histos_and_errors(l3OverXPtEtaEffNum,lXOverL1PtEtaEffDenom,l3OverL1PtEtaEff);
  divide_TH2_histos_and_errors(l3OverXPtEtaEffNum,lXOverL2PtEtaEffDenom,l3OverL2PtEtaEff);

  divide_histos_and_errors(l2OverXEtaEffNum,lXOverSimEtaEffDenom,l2OverSimEtaEff);
  divide_histos_and_errors(l2OverXEtaEffNum,lXOverL1EtaEffDenom,l2OverL1EtaEff);
  divide_histos_and_errors(l2OverXPtEffNum,lXOverSimPtEffDenom,l2OverSimPtEff);
  divide_histos_and_errors(l2OverXPtEffNum,lXOverL1PtEffDenom,l2OverL1PtEff);  
  divide_TH2_histos_and_errors(l2OverXPtEtaEffNum,lXOverSimPtEtaEffDenom,l2OverSimPtEtaEff);
  divide_TH2_histos_and_errors(l2OverXPtEtaEffNum,lXOverL1PtEtaEffDenom,l2OverL1PtEtaEff);

  divide_histos_and_errors(l1OverXEtaEffNum,lXOverSimEtaEffDenom,l1OverSimEtaEff);
  divide_histos_and_errors(l1OverXPtEffNum,lXOverSimPtEffDenom,l1OverSimPtEff);
  divide_TH2_histos_and_errors(l1OverXPtEtaEffNum,lXOverSimPtEtaEffDenom,l1OverSimPtEtaEff);
 
  histDir->Write("",TObject::kOverwrite);
  
  return 0;
}
开发者ID:vlimant,项目名称:usercode,代码行数:101,代码来源:recoEff_histMaker.C

示例3: ScanTree


//.........这里部分代码省略.........
  l3PtRate_cd->Add(l3PtRate_motherBin_3_cd);
  l3PtRate_cd->Add(l3PtRate_motherBin_4_cd);
  l3PtRate_cd->Add(l3PtRate_motherBin_5_cd);
  l3PtRate_cd->Add(l3PtRate_motherBin_6_cd);
  l3PtRate_cd->Add(l3PtRate_motherBin_10_cd);
  l3PtRate_cd->Add(l3PtRate_motherBin_12_cd);
  l3PtRate_cd->Add(l3PtRate_motherBin_13_cd);

  l2IsoPtRate->Add(l2IsoPtRate_motherBin_1);
  l2IsoPtRate->Add(l2IsoPtRate_motherBin_2);
  l2IsoPtRate->Add(l2IsoPtRate_motherBin_3);
  l2IsoPtRate->Add(l2IsoPtRate_motherBin_4);
  l2IsoPtRate->Add(l2IsoPtRate_motherBin_5);
  l2IsoPtRate->Add(l2IsoPtRate_motherBin_6);
  l2IsoPtRate->Add(l2IsoPtRate_motherBin_10);
  l2IsoPtRate->Add(l2IsoPtRate_motherBin_12);
  l2IsoPtRate->Add(l2IsoPtRate_motherBin_13);

  l2IsoPtRate_cd->Add(l2IsoPtRate_motherBin_1_cd);
  l2IsoPtRate_cd->Add(l2IsoPtRate_motherBin_2_cd);
  l2IsoPtRate_cd->Add(l2IsoPtRate_motherBin_3_cd);
  l2IsoPtRate_cd->Add(l2IsoPtRate_motherBin_4_cd);
  l2IsoPtRate_cd->Add(l2IsoPtRate_motherBin_5_cd);
  l2IsoPtRate_cd->Add(l2IsoPtRate_motherBin_6_cd);
  l2IsoPtRate_cd->Add(l2IsoPtRate_motherBin_10_cd);
  l2IsoPtRate_cd->Add(l2IsoPtRate_motherBin_12_cd);
  l2IsoPtRate_cd->Add(l2IsoPtRate_motherBin_13_cd);

  l3PreIsoPtRate->Add(l3PreIsoPtRate_motherBin_1);
  l3PreIsoPtRate->Add(l3PreIsoPtRate_motherBin_2);
  l3PreIsoPtRate->Add(l3PreIsoPtRate_motherBin_3);
  l3PreIsoPtRate->Add(l3PreIsoPtRate_motherBin_4);
  l3PreIsoPtRate->Add(l3PreIsoPtRate_motherBin_5);
  l3PreIsoPtRate->Add(l3PreIsoPtRate_motherBin_6);
  l3PreIsoPtRate->Add(l3PreIsoPtRate_motherBin_10);
  l3PreIsoPtRate->Add(l3PreIsoPtRate_motherBin_12);
  l3PreIsoPtRate->Add(l3PreIsoPtRate_motherBin_13);

  l3PreIsoPtRate_cd->Add(l3PreIsoPtRate_motherBin_1_cd);
  l3PreIsoPtRate_cd->Add(l3PreIsoPtRate_motherBin_2_cd);
  l3PreIsoPtRate_cd->Add(l3PreIsoPtRate_motherBin_3_cd);
  l3PreIsoPtRate_cd->Add(l3PreIsoPtRate_motherBin_4_cd);
  l3PreIsoPtRate_cd->Add(l3PreIsoPtRate_motherBin_5_cd);
  l3PreIsoPtRate_cd->Add(l3PreIsoPtRate_motherBin_6_cd);
  l3PreIsoPtRate_cd->Add(l3PreIsoPtRate_motherBin_10_cd);
  l3PreIsoPtRate_cd->Add(l3PreIsoPtRate_motherBin_12_cd);
  l3PreIsoPtRate_cd->Add(l3PreIsoPtRate_motherBin_13_cd);

  l3IsoPtRate->Add(l3IsoPtRate_motherBin_1);
  l3IsoPtRate->Add(l3IsoPtRate_motherBin_2);
  l3IsoPtRate->Add(l3IsoPtRate_motherBin_3);
  l3IsoPtRate->Add(l3IsoPtRate_motherBin_4);
  l3IsoPtRate->Add(l3IsoPtRate_motherBin_5);
  l3IsoPtRate->Add(l3IsoPtRate_motherBin_6);
  l3IsoPtRate->Add(l3IsoPtRate_motherBin_10);
  l3IsoPtRate->Add(l3IsoPtRate_motherBin_12);
  l3IsoPtRate->Add(l3IsoPtRate_motherBin_13);

  l3IsoPtRate_cd->Add(l3IsoPtRate_motherBin_1_cd);
  l3IsoPtRate_cd->Add(l3IsoPtRate_motherBin_2_cd);
  l3IsoPtRate_cd->Add(l3IsoPtRate_motherBin_3_cd);
  l3IsoPtRate_cd->Add(l3IsoPtRate_motherBin_4_cd);
  l3IsoPtRate_cd->Add(l3IsoPtRate_motherBin_5_cd);
  l3IsoPtRate_cd->Add(l3IsoPtRate_motherBin_6_cd);
  l3IsoPtRate_cd->Add(l3IsoPtRate_motherBin_10_cd);
  l3IsoPtRate_cd->Add(l3IsoPtRate_motherBin_12_cd);
  l3IsoPtRate_cd->Add(l3IsoPtRate_motherBin_13_cd);

  //  double crossSection_mb = 75.28; // MinBias
  //  double crossSection_mb = 51.6; // ppMuX
  double crossSection_mb = 48.44; // ppMuX @ 7 TeV
  //  double crossSection_mb = 0.000317 ; // ttbar
  //  double filterEff = 1.0; //MinBias
  //  double filterEff = 0.00289; // ppMuX
  double filterEff = 0.00176; // ppMuX @ 7 TeV
  //   double filterEff = 0.33;  // ttbar

  double eventNumberUnit= 1000000;
  //   double filterEff = inclusiveppMuX_filterEff;
  double numberOfEvents = nEntries /eventNumberUnit /filterEff ;
  cout << "numberOfEvents = " << numberOfEvents << endl;

  double crossSection=crossSection_mb ;
  double L_E32= 100000; //10^32 cm-2.s-1 = 10^5 mb-1.s-1
  double L_E31= 10000; //10^31 cm-2.s-1 = 10^4 mb-1.s-1
  double L_E30= 1000; //10^30 cm-2.s-1 = 10^3 mb-1.s-1
  double L=L_E30;

  double mbInvToHz=L/eventNumberUnit;
  double rateFactor=crossSection / numberOfEvents * mbInvToHz ;
  cout << "rateFactor = " << rateFactor << endl;

  histDir->cd();
  scaleToRate("*PtRate*", rateFactor);


  histDir->Write("",TObject::kOverwrite);
  
  return 0;
}
开发者ID:vlimant,项目名称:usercode,代码行数:101,代码来源:rate_histMaker.C


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