• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ LoadTree函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中LoadTree函数的典型用法代码示例。如果您正苦于以下问题:C++ LoadTree函数的具体用法?C++ LoadTree怎么用?C++ LoadTree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: LoadTree

void EventCollection::Loop()
{
//   In a ROOT session, you can do:
//      root> .L EventCollection.C
//      root> EventCollection t
//      root> t.GetEntry(12); // Fill t data members with entry number 12
//      root> t.Show();       // Show values of entry 12
//      root> t.Show(16);     // Read and show values of entry 16
//      root> t.Loop();       // Loop on all entries
//

//     This is the loop skeleton where:
//    jentry is the global entry number in the chain
//    ientry is the entry number in the current Tree
//  Note that the argument to GetEntry must be:
//    jentry for TChain::GetEntry
//    ientry for TTree::GetEntry and TBranch::GetEntry
//
//       To read only selected branches, Insert statements like:
// METHOD1:
//    fChain->SetBranchStatus("*",0);  // disable all branches
//    fChain->SetBranchStatus("branchname",1);  // activate branchname
// METHOD2: replace line
//    fChain->GetEntry(jentry);       //read all branches
//by  b_branchname->GetEntry(ientry); //read only this branch
   if (fChain == 0) return;

   Long64_t nentries = fChain->GetEntriesFast();

   Long64_t nbytes = 0, nb = 0;
   for (Long64_t jentry=0; jentry<nentries;jentry++) {
      Long64_t ientry = LoadTree(jentry);
      if (ientry < 0) break;
      nb = fChain->GetEntry(jentry);   nbytes += nb;
      // if (Cut(ientry) < 0) continue;
   }
}
开发者ID:agioiosa,项目名称:test-beam-slac-2016,代码行数:37,代码来源:EventCollection.C


示例2: TProfile

void AnalysisBase::getTDC(){
  TProfile *hb = new TProfile("hb","Cluster Charge vs TDC time",12,0,12,100,1000);
  Long64_t nentries = fChain->GetEntriesFast();
  float lo = 0, hi = 0;
  int istrip;

  Long64_t nbytes = 0, nb = 0;
  std::cout << "============================================" << std::endl;
  std::cout << "getTDC(): Determining Optimal TDC time range" << std::endl;
  std::cout << "============================================" << std::endl;   
  for (Long64_t jentry=0; jentry<max(50000,(int)nentries);jentry++) {
    Long64_t ientry = LoadTree(jentry);
    if (ientry < 0) break;
    nb = fChain->GetEntry(jentry);   nbytes += nb;

    for(int j=0; j<min((int)clusterNumberPerEvent,10); j++){
      //std::cout << "j: " << ", clustersTDC: " << clustersTDC << ", clustersCharge[j]: " << clustersCharge[j] << ", clustersPosition[j]: " << clustersPosition[j] << std::endl; 
      istrip = clustersSeedPosition[j];
      if(badStrips[istrip]==0) continue; // exclude bad strips
      if(clustersPosition[j] < 0.1) continue;
      if(polarity*clustersCharge[j] < kClusterChargeMin) continue;
      if(clustersPosition[j]>=iLo && clustersPosition[j]<=iHi && clustersTDC>1.0 && 
         polarity*clustersCharge[j]>150 && polarity*clustersCharge[j]<500) hb->Fill(clustersTDC+0.1,polarity*clustersCharge[j]);
    }
  }

  getTDCBins(hb,lo,hi);
  tdcLo = lo;
  tdcHi = hi;
  std::cout << "====> TDC Range determined to be from " << tdcLo << " -- " << tdcHi << std::endl;
  hb->Draw();
  //delete hb;
  

  return;
}
开发者ID:yabezsh,项目名称:Tb,代码行数:36,代码来源:AnalysisBase.C


示例3: TH1F

void H_bb::Loop()
{

   if (fChain == 0) return;

   Long64_t nentries = fChain->GetEntriesFast();
   TH1F *pt_pt = new TH1F("shist10724" , "BJet: pTbjet/pTbquark HP", 100, 0, 2 );
   TH1F *rec_mass = new TH1F("shist12751" , "BJet: Higgs mass from bjets", 100, 0, 200 );
   TH1F *gen_mass = new TH1F("shist12761" , "BJet: Higgs mass from bquarks HP", 100, 122, 128 );


   vector<float> pt_1;
   vector<float> pt_2;
   vector<float> eta_1;
   vector<float> eta_2;
   vector<float> phi_1;
   vector<float> phi_2;
   vector<float> r;
   float  m = 0, E_sum = 0, px_sum = 0, py_sum = 0, pz_sum = 0, pt_0 = 0, pt_a = 0, pt_b = 0, eta_a = 0, eta_b = 0, phi_a = 0, r_a = 0, factor = 0, qualified = 0, b1 = 0, b2 = 0, b3 = 0, x1 = 0, x2 = 0;	
   Long64_t gen_pho_event = 0, gen_pho = 0, rec_pho = 0, selected = 0;

   for (Long64_t jentry = 0; jentry<nentries;jentry++) {
	Long64_t ientry = LoadTree(jentry);
	if (ientry < 0) break;
	GetEntry(jentry);
	m = 0;
	E_sum = 0;
	px_sum = 0;
	py_sum = 0;
        pz_sum = 0;
	gen_pho_event = 0;
	pt_1.clear();
	pt_2.clear();
	eta_1.clear();
	eta_2.clear();
	phi_1.clear();
	phi_2.clear();
	r.clear();
	phi_a = 0;
	eta_1 = 0;
	pt_a = 0;

	for (Long64_t kentry = 0; kentry < part_pdgId->size(); kentry++){

	  if( (part_pdgId->at(kentry) == 5 || part_pdgId->at(kentry) == -5) && part_mother_pdgId->at(kentry) == 25 ){	
		  factor = 1.0;
		  E_sum += part_E->at(kentry);
		  px_sum += part_px->at(kentry);
		  py_sum += part_py->at(kentry);
		  pz_sum += part_pz->at(kentry);
		  pt_a = sqrt(pow(part_px->at(kentry),2)+pow(part_py->at(kentry),2));
		  if ( part_pz->at(kentry) < 0 ) factor = -1.0;
		  eta_a =  log( (sqrt(pow(pt_a,2)+pow(part_pz->at(kentry),2)) + (factor * part_pz->at(kentry))) / pt_a) * factor;
		  phi_a = TMath::ASinH( (part_py->at(kentry)) / pt_a );
	        
	  
		  pt_1.push_back(pt_a);
		  eta_1.push_back(eta_a);
		  phi_1.push_back(phi_a);
		 
		  gen_pho_event++;
		
		}
	}
	if (gen_pho_event == 2) {
	        m = sqrt(E_sum*E_sum - px_sum*px_sum - py_sum*py_sum - pz_sum*pz_sum);
		pt_0 = sqrt(pow(px_sum,2)+pow(py_sum,2));
		gen_mass->Fill(m);
	        
	}
	
	
        
      gen_pho += gen_pho_event;
      rec_pho += pho_n;
      E_sum = 0;
      px_sum = 0;
      py_sum = 0;
      pz_sum = 0;
      qualified = 0;
      
      for( Long64_t zentry = 0; zentry < jet_n; zentry++ ){

	if (jet_pdgId->at(zentry) == 5 || jet_pdgId->at(zentry)== -5){
	  qualified++;
	  factor = 1;
      	  E_sum += jet_E->at(zentry);
	  px_sum += jet_px->at(zentry);
	  py_sum += jet_py->at(zentry);
	  pz_sum += jet_pz->at(zentry);	
	  pt_a = sqrt(pow(jet_px->at(zentry),2)+pow(jet_py->at(zentry),2));
	  if ( jet_pz->at(zentry) < 0 ) factor = -1.0;
	  eta_a =  log( (sqrt(pow(pt_a,2)+pow(jet_pz->at(zentry),2)) + (factor * jet_pz->at(zentry))) / pt_a) * factor;
	  phi_a = TMath::ASinH( (jet_py->at(zentry)) / pt_a );

	  
	  pt_2.push_back(pt_a);
	  eta_2.push_back(eta_a);
	  phi_2.push_back(phi_a);
	}
//.........这里部分代码省略.........
开发者ID:sokar92,项目名称:acerdet,代码行数:101,代码来源:H_bb.C


示例4: TH1F

void debugCount::Loop() 
{

  cout << "here version 2" << endl;
   if (fChain == 0) return;

   cout << "there" << endl;
   Long64_t nentries = fChain->GetEntriesFast();

   cout << "There are " << nentries << " entries" << endl; 
   // declare and define histograms
   TH1F* h_dec = new TH1F("h_dec","",2,fEtaBin);
   TH1F* h_dR  = new TH1F("h_dR","",100,0,5);

   // pt distribution
   TH1F* h_pt_template = new TH1F("h_pt_template","",500,0,500);
   TH1F* h_pt_dirgamma = (TH1F*) h_pt_template->Clone("h_pt_dirgamma");
   TH1F* h_pt_1stjet = (TH1F*) h_pt_template->Clone("h_pt_1stjet");
   TH1F* h_pt_2ndjet = (TH1F*) h_pt_template->Clone("h_pt_2ndjet");
   
   // rapidity distribution
   TH1F* h_y_template = new TH1F("h_y_template","",100,-5,5);
   TH1F* h_y_dirgamma = (TH1F*) h_y_template->Clone("h_y_dirgamma");
   TH1F* h_y_1stjet = (TH1F*) h_y_template->Clone("h_y_1stjet");
   TH1F* h_y_2ndjet = (TH1F*) h_y_template->Clone("h_y_2ndjet");


   Long64_t nPass[30]={0};

   Long64_t nbytes = 0, nb = 0;
   for (Long64_t jentry=0; jentry<nentries;jentry++) {
      Long64_t ientry = LoadTree(jentry);
      if (ientry < 0) break;
      nb = fChain->GetEntry(jentry);   nbytes += nb;
      // if (Cut(ientry) < 0) continue;
      //      if(jentry>50000)break;
      nPass[0] ++;

      Int_t TriggerHLT75 = HLTIndex[30];

      if(TriggerHLT75    > 0 && HLT[TriggerHLT75]>0)      
      nPass[1]++;
      else continue;
      


      Int_t ngood_vtx=IsVtxGood;
      if(ngood_vtx==0)continue;

      nPass[2] ++;

      bool findLeadingPhoton = false;
      int leadingPhotonIndex = -1;
      Float_t phoMaxPt = -9999.;

     
      // now find a good leading photon
      for(int ipho=0; ipho < nPho; ipho++){
	
	if(!isGoodPho(ientry,ipho))continue;


	h_pt_dirgamma->Fill(phoEt[ipho]);
	h_y_dirgamma ->Fill(phoSCEta[ipho]);

	if(phoEt[ipho] > phoMaxPt)
	  {
	    phoMaxPt = phoEt[ipho];
	    leadingPhotonIndex= ipho;
	    findLeadingPhoton = true;
	  }

	
      } // end of leading photon search

      if(!findLeadingPhoton)continue;
      nPass[3]++;

      TLorentzVector l4_pho(0,0,0,0);
      l4_pho.SetPtEtaPhiE(
			  phoEt[leadingPhotonIndex],
			  phoEta[leadingPhotonIndex],
			  phoPhi[leadingPhotonIndex],
			  phoE[leadingPhotonIndex]
			  );

      Float_t leadingPhotonEt = phoEt[leadingPhotonIndex];

      // first check which reco jet is the one from the highest and 
      // second et gen jet
      bool findLeadingJet = false;
      Int_t leadingJetIndex=-1;
      Float_t jetMaxPt=-9999.;

      bool findSecondLeadingJet = false;
      Int_t secondLeadingJetIndex=-1;
      Float_t secondJetMaxPt=-9999.;

      for(int ijet=0; ijet < nJet; ijet++){

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


示例5: LoadTree

void ks_efficiency::Loop(int weight_choice)
{
//   In a ROOT session, you can do:
//      Root > .L ks_efficiency.C
//      Root > ks_efficiency t
//      Root > t.GetEntry(12); // Fill t data members with entry number 12
//      Root > t.Show();       // Show values of entry 12
//      Root > t.Show(16);     // Read and show values of entry 16
//      Root > t.Loop();       // Loop on all entries
//

//     This is the loop skeleton where:
//    jentry is the global entry number in the chain
//    ientry is the entry number in the current Tree
//  Note that the argument to GetEntry must be:
//    jentry for TChain::GetEntry
//    ientry for TTree::GetEntry and TBranch::GetEntry
//
//       To read only selected branches, Insert statements like:
// METHOD1:
//    fChain->SetBranchStatus("*",0);  // disable all branches
//    fChain->SetBranchStatus("branchname",1);  // activate branchname
// METHOD2: replace line
//    fChain->GetEntry(jentry);       //read all branches
//by  b_branchname->GetEntry(ientry); //read only this branch

  const Double_t ksMassConst = 0.497614;
  const Double_t ksMassConst2 = ksMassConst * ksMassConst;
  int trk_weight_choice, kin_weight_choice;
  if ( weight_choice >= 100 ) {
    trk_weight_choice = weight_choice - 100;
    kin_weight_choice = trk_weight_choice;
  } else {
    trk_weight_choice = weight_choice;
    kin_weight_choice = 0;
  }

   if (fChain == 0) return;

   Long64_t nentries = fChain->GetEntriesFast();
   // HARDCODE to test
   //Long64_t nentries = 500000;
   double p, pt, y, life, mass, p2, pz, energy;
   //   cout << "Check incoming values: " << ksEtaXmin << ", " << ksEtaBinWidth << ", " << ksptNbins << endl;
   cout << "nentries = " << nentries << endl;
   Long64_t nbytes = 0, nb = 0;
   for (Long64_t jentry=0; jentry<nentries;jentry++) {
      Long64_t ientry = LoadTree(jentry);
      if (ientry < 0) break;
      nb = fChain->GetEntry(jentry);   nbytes += nb;
      // if (Cut(ientry) < 0) continue;
      int ncand = (*ksv0MatchStatus).size();
      veematch->Fill(ncand);
      double wgt = ntrk_wgt(nLooseTracks, trk_weight_choice);

      for ( int i = 0; i<ncand; i++ ) {
	if ( (*ksgenMass)[i] < 0.49763 ) continue;
	// Switching to rapidity
	//eta = fabs((*ksgenEta)[i]);
	//if (eta > 2.5) continue;
	p2 = ((*ksgenp)[i]) * ((*ksgenp)[i]);
	pt = (*ksgenpT)[i];
	pz = sqrt( p2 - pt*pt );
	energy = sqrt( p2 + ksMassConst2 );
	y = 0.5*log((energy + pz) / (energy - pz));
	if ( y > 2.3 ) continue;
	life = (*ksgenCtau)[i];
	double y_wgt = kspt_wgt( pt, kin_weight_choice );
	double pt_wgt = ksy_wgt( y, kin_weight_choice );
	if (processType != 103 && processType != 104 ) {
	  ks_dNdy_gen->Fill(y,wgt*y_wgt);
	  ks_dNdpT_gen->Fill(pt,wgt*pt_wgt);
	  ks_dNdlife_gen->Fill(life,wgt*y_wgt);
	}

	if ( (*ksv0MatchStatus)[i] != 1 ) continue;
	if ( !kstrigTech34 || !kstrigScraping 
	     || !kstrigTech40_41 || !kstrigTech36_39 || !trigHLTminBias
	     || priVtxIsFake) continue;
	if ( fabs((*ks3dIpWrtPrimarySig)[i]) >= 3.0 ) continue;
	if ( fabs((*ksrecoOtherCandMass)[i]-1.115683)<0.0075 ) continue;
	if ( (*ksrecoVtxSig)[i] <= 10.0 ) continue;
	if ( (*ksrecoNegDauNormChi2)[i] < 0.0 || (*ksrecoPosDauNormChi2)[i] < 0.0 ) continue;
	//if ( fabs((*ksrecoEta)[i]) > 2.5 ) continue;

	p2 = ((*ksrecop)[i]) * ((*ksrecop)[i]);
	pt = (*ksrecopT)[i];
	pz = (*ksrecopZ)[i];
	energy = sqrt( p2 + ksMassConst2 );
	y = fabs(0.5*log((energy + pz) / (energy - pz)));
	if( y > 2.3 ) continue;

	//eta = fabs((*ksrecoEta)[i]);
	life = (*ksrecoCtau)[i];
	ks_dNdy_rec->Fill(y,wgt*y_wgt);
	ks_dNdpT_rec->Fill(pt,wgt*pt_wgt);
	ks_dNdlife_rec->Fill(life,wgt*y_wgt);

      }
   }
//.........这里部分代码省略.........
开发者ID:XuQiao,项目名称:HI,代码行数:101,代码来源:ks_efficiency_pythia8_trigBSC.C


示例6: LoadTree

void VHanalysis::Loop()
{
//   In a ROOT session, you can do:
//      root> .L VHanalysis.C
//      root> VHanalysis t
//      root> t.GetEntry(12); // Fill t data members with entry number 12
//      root> t.Show();       // Show values of entry 12
//      root> t.Show(16);     // Read and show values of entry 16
//      root> t.Loop();       // Loop on all entries
//

//     This is the loop skeleton where:
//    jentry is the global entry number in the chain
//    ientry is the entry number in the current Tree
//  Note that the argument to GetEntry must be:
//    jentry for TChain::GetEntry
//    ientry for TTree::GetEntry and TBranch::GetEntry
//
//       To read only selected branches, Insert statements like:
// METHOD1:
//    fChain->SetBranchStatus("*",0);  // disable all branches
//    fChain->SetBranchStatus("branchname",1);  // activate branchname
// METHOD2: replace line
//    fChain->GetEntry(jentry);       //read all branches
//by  b_branchname->GetEntry(ientry); //read only this branch
   if (fChain == 0) return;

   Long64_t nentries = fChain->GetEntriesFast();

   Long64_t nbytes = 0, nb = 0;
   
   float px_0 = -2.104;
   float px_1 = -0.07336;
   float py_0 = 0.5667;
   float py_1 = -0.0;
   for (Long64_t jentry=0; jentry<nentries;jentry++) {
     Long64_t ientry = LoadTree(jentry);
      if (ientry < 0) break;
      nb = fChain->GetEntry(jentry);   nbytes += nb;
      float oldPx = pfMET_corPt*cos(pfMET_corPhi);
      float oldPy = pfMET_corPt*sin(pfMET_corPhi);



      
      //pxfit:
      //Chi2                      =       2195.7
      //NDf                       =           29
      //p0                        =     -1.15382   +/-   0.476161    
      //p1                        =   -0.0613663   +/-   0.0037346  
	
      //pyfit
      //Chi2                      =      22.2401
      //NDf                       =           21
      //p0                        =     0.906762   +/-   0.688286    
      //p1                        =    -0.040754   +/-   0.0395147
      
      pxOLD->Fill(pfMET_corSumEt,oldPx,weight);
      pyOLD->Fill(pfMET_corSumEt,oldPy,weight);
      
      
      float newPx = oldPx - (px_0 +px_1*pfMET_corSumEt);
      float newPy = oldPy - (py_0 +py_1*pfMET_corSumEt);
      //float newPy = oldPy - (1.71741 -0.0062300*pfMET_corSumEt);
      float newPhi=pfMET_corPhi;
      newPhi = atan(newPy/newPx); //px>0
      if(newPx<0&&newPy<0)
      	newPhi = -3.14159 + newPhi;
      else if(newPx<0&&newPy>=0)
      	newPhi = 3.14159 + newPhi;
      px->Fill(pfMET_corSumEt, newPx,weight);
      py->Fill(pfMET_corSumEt, newPy,weight);
      
      phiOLD->Fill(pfMET_corPhi,weight);
      phiNEW->Fill(newPhi,weight);
      
      if(hasZ&&VhasNeutrinos)
	{
	  pfCorrSig->Fill(pfMET_corPt,weight);
	  DphiSig->Fill(fabs(pfMET_corPhi-phi),weight);
	}
      else
	{
	  pfCorrBkg->Fill(pfMET_corPt,weight);
	  DphiBkg->Fill(fabs(pfMET_corPhi-phi),weight);
	}
      // if (Cut(ientry) < 0) continue;
   }
}
开发者ID:mplaner,项目名称:flashgg,代码行数:89,代码来源:VHanalysis.C


示例7: TFile


//.........这里部分代码省略.........
  TH1D *phiJetHF_early_H=new TH1D("phiJetHF_early_H","",30,-TMath::Pi(),TMath::Pi());
  TH1D *phiJetHF_central_H=new TH1D("phiJetHF_central_H","",30,-TMath::Pi(),TMath::Pi());

  // HCAL TPs
  TH1D *ietaTP_hf_H=new TH1D("ietaTP_hf_H","",69,-34.5,34.5);
  TH1D *iphiTP_hf_H=new TH1D("iphiTP_hf_H","",77,-0.5,76.5);
  TH2D *ietaTP_iphiTP_hf_H=new TH2D("ietaTP_iphiTP_hf_H","",69,-34.5,34.5,77,-0.5,76.5);
  TH2D *ietaJet_iphiJet_hf_H=new TH2D("ietaJet_iphiJet_hf_H","",69,-34.5,34.5,77,-0.5,76.5);
  TH2D *ietaJet_iphiJet_hf_central_H=new TH2D("ietaJet_iphiJet_hf_central_H","",69,-34.5,34.5,77,-0.5,76.5);
  TH2D *ietaTP_iphiTP_hf_H_2=new TH2D("ietaTP_iphiTP_hf_H_2","",69,-34.5,34.5,77,-0.5,76.5);
  TH3D *ietaTP_iphiTP_etTP_hf_H=new TH3D("ietaTP_iphiTP_etTP_hf_H","",69,-34.5,34.5,77,-0.5,76.5,500,0.,50.);

  TH1D *etTP_hf_H=new TH1D("etTP_hf_H","",500,0.,50.);
  TH1D *compEtTP_hf_H=new TH1D("compEtTP_hf_H","",1500,0.,150.);

  TH2D *ietaJet_iphiJet_hf=new TH2D("ietaJet_iphiJet_hf","",69,-34.5,34.5,77,-0.5,76.5);
  TH2D *ietaJet_iphiJet_hf_central=new TH2D("ietaJet_iphiJet_hf_central","",69,-34.5,34.5,77,-0.5,76.5);

  TH1D *ietaTP_hf_Hs=new TH1D("ietaTP_hf_Hs","",69,-34.5,34.5);
  TH1D *iphiTP_hf_Hs=new TH1D("iphiTP_hf_Hs","",77,-0.5,76.5);
  TH2D *ietaTP_iphiTP_hf_Hs=new TH2D("ietaTP_iphiTP_hf_Hs","",69,-34.5,34.5,77,-0.5,76.5);
  TH2D *ietaJet_iphiJet_hf_Hs=new TH2D("ietaJet_iphiJet_hf_Hs","",69,-34.5,34.5,77,-0.5,76.5);
  TH2D *ietaJet_iphiJet_hf_central_Hs=new TH2D("ietaJet_iphiJet_hf_central_Hs","",69,-34.5,34.5,77,-0.5,76.5);
  TH2D *ietaTP_iphiTP_hf_Hs_2=new TH2D("ietaTP_iphiTP_hf_Hs_2","",69,-34.5,34.5,77,-0.5,76.5);
  TH3D *ietaTP_iphiTP_etTP_hf_Hs=new TH3D("ietaTP_iphiTP_etTP_hf_Hs","",69,-34.5,34.5,77,-0.5,76.5,500,0.,50.);

  TH1D *etTP_hf_Hs=new TH1D("etTP_hf_Hs","",500,0.,50.);
  TH1D *compEtTP_hf_Hs=new TH1D("compEtTP_hf_Hs","",1500,0.,150.);

  Int_t runPeak=0;

  for (Long64_t jentry=0; jentry<nentries;jentry++)
  {
    Long64_t ientry = LoadTree(jentry);
    if (ientry < 0) break;
    
    nb = fChain->GetEntry(jentry);   nbytes += nb;

    if(!(ientry%100000) && ientry) { std::cout << "processing event " << ientry << "\r" << std::endl; }

    //    if (jentry!=2492259 && event_->run!=205666) continue;

    Int_t ie,ic,il;
    ie=ic=il=0;

    Int_t ie1,ic1,il1;
    ie1=ic1=il1=-1;

    // Write your code here
    
    // Loop over central Jets in l1extra
    for (Int_t i=0; i<l1extra_->nCenJets; i++) {
      // eaarly candidates 
      if (l1extra_->cenJetBx[i]==-1 ) {
	ie++; if(ie>1) continue;
	ie1=i;
      }
      // central cadndidates
      if (l1extra_->cenJetBx[i]==0) {
	ic++; if (ic>1) continue;
	ic1=i;
      }
      // eaarly candidates
      if (l1extra_->cenJetBx[i]==1 ) {
	il++; if (il>1) continue;
	il1=i;
开发者ID:tapperad,项目名称:HCALprefiringAnalysis,代码行数:67,代码来源:L1Ntuple.C


示例8: TH1D

vector<TH1*> PlotsFeeder::Loop(int NumOfVtx)
{
//   In a ROOT session, you can do:
//      Root > .L PlotsFeeder.C
//      Root > PlotsFeeder t
//      Root > t.GetEntry(12); // Fill t data members with entry number 12
//      Root > t.Show();       // Show values of entry 12
//      Root > t.Show(16);     // Read and show values of entry 16
//      Root > t.Loop();       // Loop on all entries
//

//     This is the loop skeleton where:
//    jentry is the global entry number in the chain
//    ientry is the entry number in the current Tree
//  Note that the argument to GetEntry must be:
//    jentry for TChain::GetEntry
//    ientry for TTree::GetEntry and TBranch::GetEntry
//
//       To read only selected branches, Insert statements like:
// METHOD1:
//    fChain->SetBranchStatus("*",0);  // disable all branches
//    fChain->SetBranchStatus("branchname",1);  // activate branchname
// METHOD2: replace line
//    fChain->GetEntry(jentry);       //read all branches
//by  b_branchname->GetEntry(ientry); //read only this branch

	vector<TH1 *> vHistograms;

//DS! PER IL MOMENTO LI LASCIO TUTTI, SE POI DECIDIAMO EFFETTIVAMENTE DI TENERE SOLO LE 3 ISO, 
//QUESTA MACRO È MEGLIO INTEGRARLA CON LA PlotsFeeder.C 
//(e modificare di conseguenza anche la DataMCValidation.C per far sparire la DataMCValidationPUR.C

	//EB Reweight
	TH1D * h_IsoTrk_EBR_PUR; 
	TH1D * h_IsoEcal_EBR_PUR;
	TH1D * h_IsoHcal_EBR_PUR;
	TH1D * h_HE_EBR;
	TH1F * h_DeltaPhiTkClu_EBR;
	TH1F * h_DeltaEtaTkClu_EBR;
	TH1F * h_sigmaIeIe_EBR;
	//EB Reweight
	h_IsoTrk_EBR_PUR = new TH1D("h_IsoTrk_EBR_PUR","IsoTrk_PUR",36,0.,0.09);
	h_IsoEcal_EBR_PUR = new TH1D("h_IsoEcal_EBR_PUR","IsoEcal_PUR",28,0.,0.07);
	h_IsoHcal_EBR_PUR = new TH1D("h_IsoHcal_EBR_PUR","IsoHcal_PUR",40,0.,0.10);
	/*h_IsoTrk_EBR_PUR = new TH1D("h_IsoTrk_EBR_PUR","IsoTrk_PUR",20,0.,0.20);
	h_IsoEcal_EBR_PUR = new TH1D("h_IsoEcal_EBR_PUR","IsoEcal_PUR",20,0.,0.20);
	h_IsoHcal_EBR_PUR = new TH1D("h_IsoHcal_EBR_PUR","IsoHcal_PUR",20,0.,0.20);*/
	h_HE_EBR = new TH1D("h_HE_EBR","H/E",20,0.,0.20);
	h_DeltaPhiTkClu_EBR = new TH1F("h_DeltaPhiTkClu_EBR","DeltaPhiTkClu",20,0.,0.2);
	h_DeltaEtaTkClu_EBR = new TH1F("h_DeltaEtaTkClu_EBR","DeltaEtaTkClu",20,0.,.05);
	h_sigmaIeIe_EBR = new TH1F("h_sigmaIeIe_EBR","sigmaIeIe",20,0.,0.1);

	/*=========================*/

	//EE Reweight
	TH1D * h_IsoTrk_EER_PUR; 
	TH1D * h_IsoEcal_EER_PUR;
	TH1D * h_IsoHcal_EER_PUR;
	TH1D * h_HE_EER;
	TH1F * h_DeltaPhiTkClu_EER;
	TH1F * h_DeltaEtaTkClu_EER;
	TH1F * h_sigmaIeIe_EER;
	//EE Reweight
	h_IsoTrk_EER_PUR = new TH1D("h_IsoTrk_EER_PUR","IsoTrk",16,0.,0.04);
	h_IsoEcal_EER_PUR = new TH1D("h_IsoEcal_EER_PUR","IsoEcal",20,0.,0.05);
	h_IsoHcal_EER_PUR = new TH1D("h_IsoHcal_EER_PUR","IsoHcal",10,0.,0.025);
	/*h_IsoTrk_EER_PUR = new TH1D("h_IsoTrk_EER_PUR","IsoTrk",20,0.,0.20);
	h_IsoEcal_EER_PUR = new TH1D("h_IsoEcal_EER_PUR","IsoEcal",20,0.,0.20);
	h_IsoHcal_EER_PUR = new TH1D("h_IsoHcal_EER_PUR","IsoHcal",20,0.,0.20);*/
	h_HE_EER = new TH1D("h_HE_EER","H/E",20,0.,0.20);
	h_DeltaPhiTkClu_EER = new TH1F("h_DeltaPhiTkClu_EER","DeltaPhiTkClu",20,0.,0.2);
	h_DeltaEtaTkClu_EER = new TH1F("h_DeltaEtaTkClu_EER","DeltaEtaTkClu",20,0.,.05);
	h_sigmaIeIe_EER = new TH1F("h_sigmaIeIe_EER","sigmaIeIe",20,0.,0.1);

	/*=========================*/

	if (fChain == 0){ cout << " something went wrong in PlotsFeeder "; return vHistograms;}

	Long64_t nentries = fChain->GetEntriesFast();

	Long64_t nbytes = 0, nb = 0;
	for (Long64_t jentry=0; jentry<nentries;jentry++) {
		Long64_t ientry = LoadTree(jentry);
		if (ientry < 0) break;
		nb = fChain->GetEntry(jentry);   nbytes += nb;
		// if (Cut(ientry) < 0) continue;

		if(numberOfVertices==NumOfVtx){

			if (IsoTrkEB_PUR->size()>0) {
				for (unsigned int i=0; i<IsoTrkEB_PUR->size();i++){
					float var=IsoTrkEB_PUR->at(i);
					h_IsoTrk_EBR_PUR->Fill(var,Weight);
				}
			} 
			if (IsoEcalEB_PUR->size()>0) {
				for (unsigned int i=0; i<IsoEcalEB_PUR->size();i++){
					float var=IsoEcalEB_PUR->at(i);
					h_IsoEcal_EBR_PUR->Fill(var,Weight);
				}
//.........这里部分代码省略.........
开发者ID:bajarang,项目名称:VJets_TreeMaker5311,代码行数:101,代码来源:PlotsFeederPUR.C


示例9: frame

void analysisClass::Loop()
{
   std::cout << "analysisClass::Loop() begins" <<std::endl;   
   TStopwatch time;
   frame("Starting the analysis");
   time.Start(true);
   setTDRStyle();
   if (fChain == 0) return;
   
   //////////book histos here

   // TH1F *h_nJetFinal = new TH1F ("h_nJetFinal","",10,0,10);
   // h_nJetFinal->Sumw2();      
   // TH1F *h_nVtx = new TH1F ("h_nVtx","",30,0,30);
   // h_nVtx->Sumw2(); 
   // TH1F *h_trueVtx = new TH1F ("h_trueVtx","",40,0,40);
   // h_trueVtx->Sumw2();  
   // TH1F *h_pT1stJet = new TH1F ("h_pT1stJet","",100,0,3000);
   // h_pT1stJet->Sumw2();
   // TH1F *h_pT2ndJet = new TH1F ("h_pT2ndJet","",100,0,3000);
   // h_pT2ndJet->Sumw2();
   // TH1F *h_eta1stJet = new TH1F ("h_eta1stJet","",5,-2.5,2.5);
   // h_eta1stJet->Sumw2();
   // TH1F *h_eta2ndJet = new TH1F ("h_eta2ndJet","",5,-2.5,2.5);
   // h_eta2ndJet->Sumw2();
   // TH1F *h_DijetMass = new TH1F ("h_DijetMass","",600,0,6000);
   // h_DijetMass->Sumw2();
   // TH1F *h_DeltaETAjj = new TH1F ("h_DeltaETAjj","",120,0,3.);
   // h_DeltaETAjj->Sumw2();

   /////////initialize variables

   Long64_t nentries = fChain->GetEntriesFast();
   std::cout << "analysisClass::Loop(): nentries = " << nentries << std::endl;   

   double lepton_mass;
   std::vector <int> goodLepton, looseLepton, goodAK08, goodAK04, goodAK08_lep, goodAK04_lep, goodAK08Pruned, goodEle, goodMuon, looseEle, looseMuon;
   TLorentzVector genW, ak04, ak08, ak08Pruned, lepton, leptonLoose, W, MET, wGenQ1, wGenQ2, wGenSumi, subjet1, subjet2, subjetSum, wGenSum, bGen1, bGen2;
   int btag_ak04_loose, btag_ak04_medium, btag_ak04_tight;
   int subjet_index1, subjet_index2;
   ////// The following ~7 lines have been taken from rootNtupleClass->Loop() /////
   ////// If the root version is updated and rootNtupleClass regenerated,     /////
   ////// these lines may need to be updated.                                 /////    
   Long64_t nbytes = 0, nb = 0;
   for (Long64_t jentry=0; jentry<nentries;jentry++) {
   //for (Long64_t jentry=0; jentry<1000;jentry++) {
     Long64_t ientry = LoadTree(jentry);
     if (ientry < 0) break;
     nb = fChain->GetEntry(jentry);   nbytes += nb;
     if(jentry < 10 || jentry%1000 == 0) std::cout << "analysisClass::Loop(): jentry = " << jentry << std::endl;   
     // if (Cut(ientry) < 0) continue;

     ////////////////////// User's code starts here ///////////////////////

     ///Stuff to be done for every event
     btag_ak04_loose=0;
     btag_ak04_medium=0;
     btag_ak04_tight=0;
     goodLepton.clear();
     looseLepton.clear();
     goodAK04.clear();
     goodAK08.clear();
     goodAK08_lep.clear();
     goodAK04_lep.clear();
     goodAK08Pruned.clear();
     goodEle.clear();
     goodMuon.clear();
     looseEle.clear();
     looseMuon.clear();

     resetCuts();
   

//=== Forse da inserire ===

/*     fillVariableWithValue("run",runNo);     
     fillVariableWithValue("event",evtNo);     
     fillVariableWithValue("lumi",lumi);     
     fillVariableWithValue("nVtx",nvtx);     
     fillVariableWithValue("nJet",widejets.size());
*/
    

    for(int i=0; i<nselLeptons; ++i){
      if((abs(selLeptons_pdgId[i])==11 && selLeptons_isMyGoodElectron[i]==1 && selLeptons_pt[i]>30 && (abs(selLeptons_eta[i])<1.442 || (abs(selLeptons_eta[i])>1.56 && abs(selLeptons_eta[i])<2.5))) || (abs(selLeptons_pdgId[i])==13 && selLeptons_isMyGoodMuon[i]==1 && selLeptons_pt[i]>30 && abs(selLeptons_eta[i])<2.1)){// && selLeptons_relIso03[0]<0.1)){
        goodLepton.push_back(i);
        //std::cout<<"Passing tight selection"<<std::endl;
        CreateAndFillUserTH1D("goodEleTightSelection", 2,-.5,1.5, 1);
      }//end if 'good' lepton cuts
      else if(((abs(selLeptons_pdgId[i])==11 && selLeptons_isMyGoodElectron[i]==1 && selLeptons_pt[i]>35 && (abs(selLeptons_eta[i])<1.442 || (abs(selLeptons_eta[i])>1.56 && abs(selLeptons_eta[i])<2.5))) || (abs(selLeptons_pdgId[i])==13 && selLeptons_isMyGoodMuon[i]==1 && selLeptons_pt[i]>20 && abs(selLeptons_eta[i])<2.1))){// && selLeptons_relIso03[i]<0.1))){
        looseLepton.push_back(i);
        //if(abs(selLeptons_pdgId[i])==11) lepton_mass=e_mass;
        //if(abs(selLeptons_pdgId[i])==13) lepton_mass=mu_mass;
        //leptonLoose.SetPtEtaPhiM(selLeptons_pt[i],selLeptons_eta[i],selLeptons_phi[i], lepton_mass);
      }//end if loose lepton
      if(abs(selLeptons_pdgId[i])==13 && selLeptons_isMyGoodMuon[i]==1 && selLeptons_pt[i]>53 && abs(selLeptons_eta[i])<2.1 && (selLeptons_muTrackIso[i]/selLeptons_pt[i])<0.1){
        goodMuon.push_back(i);
      }
      else if(abs(selLeptons_pdgId[i])==13 && selLeptons_isMyGoodMuon[i]==1 && selLeptons_pt[i]>20 && abs(selLeptons_eta[i])<2.4 && (selLeptons_muTrackIso[i]/selLeptons_pt[i])<0.1){
        // if(abs(selLeptons_pdgId[i])==13 && selLeptons_isMyGoodMuon[i]==1 && selLeptons_pt[i]>53 && abs(selLeptons_eta[i])<2.1 && (selLeptons_muTrackIso[i]/selLeptons_pt[i])<0.1){
//.........这里部分代码省略.........
开发者ID:simoneg90,项目名称:DiBosonAnalysis,代码行数:101,代码来源:analysisClass_ttBarEfficiences.C


示例10: Setup

//------------------------------------------------------------------------------
// Loop
//------------------------------------------------------------------------------
void AnalysisControl::Loop(TString analysis, TString filename, float luminosity)
{
  if (fChain == 0) return;

  Setup(analysis, filename, luminosity);


  // Define histograms
  //----------------------------------------------------------------------------
  root_output->cd();

  for (int j=0; j<ncut; j++) {

    for (int k=0; k<=njetbin; k++) {

      TString sbin = (k < njetbin) ? Form("/%djet", k) : "";

      TString directory = scut[j] + sbin;

      root_output->cd();

      if (k < njetbin) gDirectory->mkdir(directory);

      root_output->cd(directory);

      for (int i=ee; i<=ll; i++) {

	TString suffix = "_" + schannel[i];

	DefineHistograms(i, j, k, suffix);
      }
    }
  }

  root_output->cd();


  // Loop over events
  //----------------------------------------------------------------------------
  for (Long64_t jentry=0; jentry<_nentries;jentry++) {

    Long64_t ientry = LoadTree(jentry);

    if (ientry < 0) break;

    fChain->GetEntry(jentry);

    PrintProgress(jentry, _nentries);

    EventSetup();


    // Analysis
    //--------------------------------------------------------------------------
    _nelectron = 0;

    if (abs(Lepton1.flavour) == ELECTRON_FLAVOUR) _nelectron++;
    if (abs(Lepton2.flavour) == ELECTRON_FLAVOUR) _nelectron++;

    if      (_nelectron == 2) _channel = ee;
    else if (_nelectron == 1) _channel = em;
    else if (_nelectron == 0) _channel = mm;
    
    _m2l  = mll;   // Needs l2Sel
    _pt2l = ptll;  // Needs l2Sel

    bool pass_2l = (Lepton1.flavour * Lepton2.flavour < 0);

    pass_2l &= (Lepton1.v.Pt() > 25.);
    pass_2l &= (Lepton2.v.Pt() > 20.);
    pass_2l &= (std_vector_lepton_pt->at(2) < 10.);
    pass_2l &= (_m2l > 20.);


    bool pass;


    // No cuts
    //--------------------------------------------------------------------------
    pass = true;

    FillLevelHistograms(Control_00_NoCuts, pass);


    // Has 2 tight leptons
    //--------------------------------------------------------------------------
    pass = pass_2l;

    FillLevelHistograms(Control_01_TwoLeptons, pass);

    if (_saveminitree && pass) minitree->Fill();


    // R out/in
    //--------------------------------------------------------------------------
    pass = pass_2l;

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


示例11: TH1F

void sigeff1::Loop()
{

   if (fChain == 0) return;

   TH1F* h_lowestcsv_csv = new TH1F("h_lowestcsv_csv", "Lowest CSV jet, CVS output", 40, 0., 1. ) ;
   TH1F* h_lowestcsv_pt = new TH1F("h_lowestcsv_pt", "Lowest CSV jet, pt", 40, 0., 200. ) ;
   TH1F* h_lowestcsv_csv_4b = new TH1F("h_lowestcsv_csv_4b", "Lowest CSV jet, CVS output, 4b", 40, 0., 1. ) ;
   TH1F* h_lowestcsv_pt_4b = new TH1F("h_lowestcsv_pt_4b", "Lowest CSV jet, pt, 4b", 40, 0., 200. ) ;


   Long64_t nentries = fChain->GetEntries();

   Long64_t nbytes = 0, nb = 0;
   for (Long64_t jentry=0; jentry<nentries;jentry++) {
      Long64_t ientry = LoadTree(jentry);
      if (ientry < 0) break;
      nb = fChain->GetEntry(jentry);   nbytes += nb;

      //-- find the lowest CSV jet
      float lowestcsv(9.) ;
      float lowestcsvpt(0.) ;

      if ( higgs1CSV1 < lowestcsv ) {
         lowestcsv = higgs1CSV1 ;
         lowestcsvpt = higgs1jetpt1 ;
      }
      if ( higgs1CSV2 < lowestcsv ) {
         lowestcsv = higgs1CSV2 ;
         lowestcsvpt = higgs1jetpt2 ;
      }
      if ( higgs2CSV1 < lowestcsv ) {
         lowestcsv = higgs2CSV1 ;
         lowestcsvpt = higgs2jetpt1 ;
      }
      if ( higgs2CSV2 < lowestcsv ) {
         lowestcsv = higgs2CSV2 ;
         lowestcsvpt = higgs2jetpt2 ;
      }


      //--- lepton veto
      if ( ! (nMuons==0&&nElectrons==0&&nIsoTracks15_005_03==0&&nIsoTracks5_005_03<2&&nTausLoose==0 ) ) continue ;

      //--- two tight b tags
      if ( ! (CSVbest2>0.898) ) continue ;

      //--- max Dr cut
      if ( ! (deltaRmax_hh<2.2) ) continue ;

      //--- METsig>30
      if ( ! (METsig>30) ) continue ;
      ///////////////////if ( ! (METsig>100) ) continue ;

      bool pass2b(false) ;
      if ( CSVbest2>0.898&&CSVbest3<0.244 ) { pass2b = true ;  }

      bool pass4b(false) ;
      if ( CSVbest2>0.898&&CSVbest3>0.679&&CSVbest4>0.244  ) { pass4b = true ; }

      h_lowestcsv_csv -> Fill( lowestcsv ) ;
      h_lowestcsv_pt -> Fill( lowestcsvpt ) ;

      if ( pass4b ) {
         h_lowestcsv_csv_4b -> Fill( lowestcsv ) ;
         h_lowestcsv_pt_4b -> Fill( lowestcsvpt ) ;
      }


   } // jentry.

   addoverflow( h_lowestcsv_pt_4b ) ;
   addoverflow( h_lowestcsv_csv_4b ) ;

   addoverflow( h_lowestcsv_pt ) ;
   addoverflow( h_lowestcsv_csv ) ;


}
开发者ID:owen234,项目名称:hbb-rtwork,代码行数:79,代码来源:sigeff1.c


示例12: TH1D

void testlor::Loop()
{
//   In a ROOT session, you can do:
//      Root > .L testlor.C
//      Root > testlor t
//      Root > t.GetEntry(12); // Fill t data members with entry number 12
//      Root > t.Show();       // Show values of entry 12
//      Root > t.Show(16);     // Read and show values of entry 16
//      Root > t.Loop();       // Loop on all entries
//

//     This is the loop skeleton where:
//    jentry is the global entry number in the chain
//    ientry is the entry number in the current Tree
//  Note that the argument to GetEntry must be:
//    jentry for TChain::GetEntry
//    ientry for TTree::GetEntry and TBranch::GetEntry
//
//       To read only selected branches, Insert statements like:
// METHOD1:
//    fChain->SetBranchStatus("*",0);  // disable all branches
//    fChain->SetBranchStatus("branchname",1);  // activate branchname
// METHOD2: replace line
//    fChain->GetEntry(jentry);       //read all branches
//by  b_branchname->GetEntry(ientry); //read only this branch

//Set-up Code
	if (fChain == 0) return;

	Long64_t nentries = fChain->GetEntriesFast();

	Long64_t nbytes = 0, nb = 0;
	int pions=0,kaons=0,ksTOpi=0,i=0,j=0;
	int ipart1,ipart2,a,b;
	Double_t ppion[kMaxentry];
	Double_t npion[kMaxentry];
	Double_t p[kMaxentry];
	double prop=0;
	Double_t pp,E,KSmass;
   	TLorentzVector q[kMaxentry];//pinakas tupou tlorentz
	TLorentzVector w,v; 
	TVector3 l;
	
	TH1D *pzhist=new TH1D("pz","pz histogram",120,-12,12);
	TH1D *pthist=new TH1D("pt","pt histogram",50,0,1.5);
	TH1D *kshist=new TH1D("KSmass","KSmasss",120,0.2,0.8);
	TH1D *kshist2=new TH1D("KSmass","KSmasss",120,0.,5);
	TH1D *pseudohist=new TH1D("Pseudorapidity","Pseudorapidity",120,-15,15);
	
	cout << "Number of events = " << nentries << endl;
	
   //event loop
	for (Long64_t jentry=0; jentry<nentries;jentry++) {//nentries
		Long64_t ientry = LoadTree(jentry);
		if (ientry < 0) break;
		nb = fChain->GetEntry(jentry);   nbytes += nb;
		cout << " event # " << jentry << ",  #particles " <<  entry_ << endl;
		// if (Cut(ientry) < 0) continue;

		//particle loop
		for (int ipart = 0; ipart < entry_ ; ipart++) {
			w.SetPx(entry_pSave_xx[ipart]);
			w.SetPy(entry_pSave_yy[ipart]);
			w.SetPz(entry_pSave_zz[ipart]);
			w.SetE(entry_pSave_tt[ipart]);
			q[ipart]=w;
			l=q[ipart].Vect();
			//~ cout<<"pseudorapidity="<<l.PseudoRapidity()<<endl;
			p[ipart]=l.Mag();
			cout<<"p="<<l.Mag()<<endl;//P!
			//~ cout<<"m="<<q[ipart].M()<<endl;//m?not right
			//~ cout<<"pt="<<q[ipart].Perp()<<endl;//PT!
			//~ cout <<"i="<<ipart<< "\tpdgID = " << entry_idSave[ipart]<<",\t Daughter1="<<entry_idSave[entry_daughter1Save[ipart]]<<",\tDaughter2="<<entry_idSave[entry_daughter2Save[ipart]]<<"\tEnergy="<<entry_pSave_tt[ipart]<<endl;
		
			//pions vs kaons
			if(((TMath::Abs(entry_idSave[ipart]))==(211))||(entry_idSave[ipart]==(111))) {
				pions++;
			} 	
			else if((entry_idSave[ipart]==130)||
				((TMath::Abs(entry_idSave[ipart]))==(321))||(entry_idSave[ipart]==310)
				||((TMath::Abs(entry_idSave[ipart]))==(311))||((TMath::Abs(entry_idSave[ipart]))==(323))
				||((TMath::Abs(entry_idSave[ipart]))==(313)) ) {
				kaons++; 
			}
			
			
			//Ks->pions
			if((entry_idSave[ipart]==310)&&(((entry_idSave[entry_daughter1Save[ipart]]==(211))&&(entry_idSave[entry_daughter2Save[ipart]]==(-1)*(211)))
			||((entry_idSave[entry_daughter1Save[ipart]]==(-1)*(211))&&(entry_idSave[entry_daughter2Save[ipart]]==(211))) )){
				
				ipart1[ksTOpi]=entry_daughter1Save[ipart];
		        ipart2[ksTOpi]=entry_daughter2Save[ipart];
		        cout<<"ipart1="<<ipart1<<"\t ipart2="<<ipart2<<endl;
				ksTOpi++;
				cout<<"ksTOpi="<<ksTOpi<<endl;
				
			}//end of ks->pions if
				
			if(entry_idSave[ipart]==211){
				ppion[i]=ipart;
//.........这里部分代码省略.........
开发者ID:geparask,项目名称:Thesis,代码行数:101,代码来源:testlor.C


示例13: TH1F

void anatree::Loop()
{
//   To execute this code you will do this:
//      > root -l
//      Root > .L anatree.C
//  (or to compile :  Root > .L anatree.C+)
//      Root > anatree t
//      Root > t.Loop();       // Loop on all entries

  TH1F* StartPointOffset = new TH1F("startpointoffset",";X-aXis title; Y-Axis title", 50, 0, 1000);

   if (fChain == 0) return;

   /// Define how many entries are in the tree:
   /// Start
   Long64_t nentries = fChain->GetEntriesFast();
   Long64_t nbytes = 0, nb = 0;
   ///End 


   /// Here we START to loop over all entries in the TTree
   /// these are events, so be careful how you think of these events
   /// Start
   for (Long64_t jentry=0; jentry<nentries;jentry++) {
      Long64_t ientry = LoadTree(jentry);
      if (ientry < 0) break;
      nb = fChain->GetEntry(jentry);   nbytes += nb;
   /// End
      
      std::cout << "\n ########################### \n Looking at Event == " << jentry << std::endl; 

      /* List of useful variables that you might want to look at:

	 event -- this is what you call event number
	 subrun -- this is what you call subrun

	 RECONSTRUCTION INFORMATION:
	 nshowers -- The number of reconstruted showers (N) 
	 showerID[N] -- A unique shower ID, just a number (int)
	 shwr_bestplane[N] -- The plane that has the largest (spatial) projection of hits, this is the P you should use typically 
	 shwr_length[N] -- The length of the shower in blah dimensions
	 shwr_startdcosx[N] -- the "i" component of the unit vector describing the direction
	 shwr_startdcosy[N] -- the "j" component of the unit vector describing the direction
	 shwr_startdcosz[N] -- the "k" component of the unit vector describing the direction
	 shwr_startx[N] -- the "x" posistion start point 
	 shwr_starty[N] -- the "y" posistion start point 
	 shwr_startz[N] -- the "z" posistion start point 
	 shwr_totEng[N][P] -- The total energy of the shower in plane P (focus on P == 2 for now)
	 shwr_mipEng[N][P] -- The total energy of the shower in plane P (focus on P == 2 for now)
	 shwr_dedx[N][P] -- The total energy deposited at the start of the shower 

	 MC TRUTH INFORMATION: 
	 geant_list_size -- The number of particles (N), you will usually only be intrested in the first particle 
         pdg[N] -- The pdg of the n-th particle in the list
	 Eng[N] -- The TRUE energy of the n-th particle 
	 Px[N] -- X-projection of the n-th particle momentum
	 Py[N] -- Y-projection of the n-th particle momentum
	 Pz[N] -- Z-projection of the n-th particle momentum
	 P[N] -- n-th particle momentum
	 StartPointx[N] -- X-projection of the n-th start point
	 StartPointy[N] -- Y-projection of the n-th start point
	 StartPointz[N] -- X-projection of the n-th start point
	 theta[N] -- The theta of the n-th particle 
	 phi[N] -- the phi of the n-th paritlce 
      */

      //Here you will build your code, build whatever you want! [email protected]

      
      

      //// EXAMPLE loop through all reco showers in event

      if(nshowers == 1){	

	// look it up, this is wrong.
	double dist = sqrt( pow((shwr_startx[0] - StartPointx[0]),2) + pow((shwr_starty[0] - StartPointx[0]),2) + pow((shwr_startz[0] -StartPointx[0]),2));
	
	// Histogram (TH1F)  -> Fill(var) [function, var] 
	StartPointOffset->Fill(dist);
	
	std::cout << "Start Point Reco : " <<  shwr_startx[0]  << std::endl;
	std::cout << "Start Point MC : " <<  StartPointx[0]  << std::endl;

      }

      /*
	double max_eng = 0;
	int max_N = 0;
	
	for(int n = 0; n < nshowers; n++){
	double temp_eng = shwr_totEng[n][2]; 
	
	if(max_eng < temp_eng) {max_eng = temp_eng; max_N = n;}
	
	}
      */
      ////// END

   /// Here is the end of the loop
//.........这里部分代码省略.........
开发者ID:marinadavid,项目名称:ShowerReco_SummerProject,代码行数:101,代码来源:anatree.C


示例14: if

void MFVFlatNtupleReader::genHists(std::string target)
{
  //   In a ROOT session, you can do:
  //      Root > .L MFVFlatNtupleReader.C
  //      Root > MFVFlatNtupleReader t
  //      Root > t.GetEntry(12); // Fill t data members with entry number 12
  //      Root > t.Show();       // Show values of entry 12
  //      Root > t.Show(16);     // Read and show values of entry 16
  //      Root > t.Loop();       // Loop on all entries
  //

  //     This is the loop skeleton where:
  //    jentry is the global entry number in the chain
  //    ientry is the entry number in the current Tree
  //  Note that the argument to GetEntry must be:
  //    jentry for TChain::GetEntry
  //    ientry for TTree::GetEntry and TBranch::GetEntry
  //
  //       To read only selected branches, Insert statements like:
  // METHOD1:
  //    fChain->SetBranchStatus("*",0);  // disable all branches
  //    fChain->SetBranchStatus("branchname",1);  // activate branchname
  // METHOD2: replace line
  //    fChain->GetEntry(jentry);       //read all branches
  //by  b_branchname->GetEntry(ientry); //read only this branch
  if (fChain == 0) return;
  
  //set up the program for a specific target
  std::vector<unsigned char> *loc;
  loc = 0;
  if (target == "vtx_ntracks") fChain 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LoadValues函数代码示例发布时间:2022-05-30
下一篇:
C++ LoadTextures函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap