コード例 #1
0
ファイル: reader.C プロジェクト: asmagina1995/roottest
int reader() 
{
  gROOT->LoadClass("Foo", "Foo");

  // gDebug = 2; 

  Int_t  foo_     = 0;
  Int_t  foo_fFoo[3];
  TFile* file     = TFile::Open("file.root", "READ"); 
  TTree* tree     = (TTree*)file->Get("tree");
  tree->SetMakeClass(1);
  tree->SetBranchAddress("foo", &foo_);
  tree->SetBranchAddress("foo.fFoo", &foo_fFoo);
  
  Int_t  n = (Int_t)tree->GetEntries();

  for (Int_t i = 0; i < n; i++) {
    tree->GetEntry(i);
    for (Int_t j = 0; j < foo_; j++) 
      cout << "Foo # " << i << "," << j << ": " << foo_fFoo[j] << endl;
  }
  file->Close();
  
  return 0;
}
コード例 #2
0
ファイル: CalibTree.C プロジェクト: tj710/TTEmulator
void CalibTree::Init(TTree *tree) {
  // The Init() function is called when the selector needs to initialize
  // a new tree or chain. Typically here the branch addresses and branch
  // pointers of the tree will be set.
  // It is normally not necessary to make changes to the generated
  // code, but the routine can be extended by the user if needed.
  // Init() will be called many times when running on PROOF
  // (once per file to be processed).

  // Set object pointer
  t_DetIds = 0;
  t_HitEnergies = 0;
  // Set branch addresses and branch pointers
  if (!tree) return;
  fChain = tree;
  fCurrent = -1;
  fChain->SetMakeClass(1);

  fChain->SetBranchAddress("t_Run", &t_Run, &b_t_Run);
  fChain->SetBranchAddress("t_Event", &t_Event, &b_t_Event);
  fChain->SetBranchAddress("t_ieta", &t_ieta, &b_t_ieta);
  fChain->SetBranchAddress("t_EventWeight", &t_EventWeight, &b_t_EventWeight);
  fChain->SetBranchAddress("t_l1pt", &t_l1pt, &b_t_l1pt);
  fChain->SetBranchAddress("t_l1eta", &t_l1eta, &b_t_l1eta);
  fChain->SetBranchAddress("t_l1phi", &t_l1phi, &b_t_l1phi);
  fChain->SetBranchAddress("t_l3pt", &t_l3pt, &b_t_l3pt);
  fChain->SetBranchAddress("t_l3eta", &t_l3eta, &b_t_l3eta);
  fChain->SetBranchAddress("t_l3phi", &t_l3phi, &b_t_l3phi);
  fChain->SetBranchAddress("t_p", &t_p, &b_t_p);
  fChain->SetBranchAddress("t_mindR1", &t_mindR1, &b_t_mindR1);
  fChain->SetBranchAddress("t_mindR2", &t_mindR2, &b_t_mindR2);
  fChain->SetBranchAddress("t_eMipDR", &t_eMipDR, &b_t_eMipDR);
  fChain->SetBranchAddress("t_eHcal", &t_eHcal, &b_t_eHcal);
  fChain->SetBranchAddress("t_hmaxNearP", &t_hmaxNearP, &b_t_hmaxNearP);
  fChain->SetBranchAddress("t_selectTk", &t_selectTk, &b_t_selectTk);
  fChain->SetBranchAddress("t_qltyMissFlag", &t_qltyMissFlag, &b_t_qltyMissFlag);
  fChain->SetBranchAddress("t_qltyPVFlag", &t_qltyPVFlag, &b_t_qltyPVFlag);
  fChain->SetBranchAddress("t_DetIds", &t_DetIds, &b_t_DetIds);
  fChain->SetBranchAddress("t_HitEnergies", &t_HitEnergies, &b_t_HitEnergies);
  Notify();
}
コード例 #3
0
ファイル: CountEvents.C プロジェクト: Le-voyeur/training
void CountEvents()
{
   // Variables used to store the data
   Int_t     totalSize = 0;        // Sum of data size (in bytes) of all events
   Int_t     eventSize = 0;        // Size of the current event
   TBranch  *eventSizeBranch = 0;  // Pointer to the event.fEventsize branch

   // open the file
   TFile *f = TFile::Open("http://lcg-heppkg.web.cern.ch/lcg-heppkg/ROOT/eventdata.root");
   if (f == 0) {
      // if we cannot open the file, print an error message and return immediatly
      printf("Error: cannot open http://lcg-heppkg.web.cern.ch/lcg-heppkg/ROOT/eventdata.root!\n");
      return;
   }
   // get a pointer to the tree
   TTree *tree = (TTree *)f->Get("EventTree");
   // To use SetBranchAddress() with simple types (e.g. double, int)
   // instead of objects (e.g. std::vector<Particle>).
   tree->SetMakeClass(1);

   // Connect the branch "fEventSize" with the variable
   // eventSize that we want to contain the data.
   // While we are at it, ask the tree to save the branch
   // in eventSizeBranch
   tree->SetBranchAddress("fEventSize", &eventSize, &eventSizeBranch);

   // First, get the total number of entries
   Long64_t nentries = tree->GetEntries();
   // then loop over all of them
   for (Long64_t i=0;i<nentries;i++) {
      // Load the data for TTree entry number "i" from branch
      // fEventSize into the connected variable (eventSize):
      eventSizeBranch->GetEntry(i);
      totalSize += eventSize;
   }
   Int_t sizeInMB = totalSize/1024/1024;
   printf("Total size of all events: %d MB\n", sizeInMB);
}
コード例 #4
0
ファイル: dNdeta_dAu.C プロジェクト: XuQiao/phenix
void dNdeta_dAu(int i){
    TFile *f = TFile::Open(Form("phhijing_dAu_%d.root",i));
    TTree *tree = (TTree*)f->Get("T");
    TBranchElement *array = (TBranchElement*)T->GetBranch("part_array");
    tree->SetMakeClass(1);
    TH1::SetDefaultSumw2(kTRUE);
    const int ncent = 3;
    TH1F* hKF = new TH1F("hKF","particle id",10000,-5000,5000);
    TH1F* hn = new TH1F("hn","Ntotal",1000,0,1000);
    TH2F* hnchntrk = new TH2F("hnchntrk","",300,0,300,100,0,100);
    TH2F* hNbinary = new TH2F("hNbinary","Nbinary",300,0,300,300,0,300);
    TH2F* hb = new TH2F("hb","bimpact",300,0,300,200,0,20);
    TH1F* hnchtotal = new TH1F("hnchtotal","Nchargetotal",500,0,500);
    TH2F* hNbinarymbtrig = new TH2F("hNbinarymbtrig","Nbinary",300,0,300,300,0,300);
    TH2F* hbmbtrig = new TH2F("hbmbtrig","bimpact",300,0,300,200,0,20);
    TH2F* hnchntrkmbtrig = new TH2F("hnchntrkmbtrig","",300,0,300,100,0,100);
    TH1F* heta = new TH1F("heta","particle eta distr",120,-6,6);
    TH1F* hy = new TH1F("hy","particle y distr",120,-6,6);
    TH1F* hy1 = new TH1F("hy1","particle y distr in |y|<1",150,-1.5,1.5);
    TH1F* hphi = new TH1F("hphi","",200,0,8);
    TH1F* hMass= new TH1F("hMass","mass distribution",500,0,5);
    TH2F* hpteta[ncent];
    TH2F* hptetambtrig[ncent];
    TH2F* hpty[ncent];
    TH2F* hptymbtrig[ncent];
    for(int icent=0;icent<ncent;icent++){
      hpteta[icent]  = new TH2F(Form("hpteta_%d",icent),"",100,0,10,120,-6,6);
      hptetambtrig[icent] = new TH2F(Form("hptetambtrig_%d",icent),"",100,0,10,120,-6,6);
      hpty[icent] = new TH2F(Form("hpty_%d",icent),"",100,0,10,120,-6,6);
      hptymbtrig[icent] = new TH2F(Form("hptymbtrig_%d",icent),"",100,0,10,120,-6,6);
    }
    
    int Nbinary;
    float b;
    float px[MAXP];
    float py[MAXP];
    float pz[MAXP];
    float E[MAXP];
    int KS[MAXP];
    int KF[MAXP];
    float M[MAXP];
    int n;
    int nPion = 0;
    int nPrim = 0;
    int nSecond = 0;
    int nPionC = 0;
    int nKaonC = 0;
    int nout=0;
    tree->SetBranchAddress("nbin",&Nbinary);
    tree->SetBranchAddress("bimpact",&b);
    tree->SetBranchAddress("part_array.fKS",&KS);
    tree->SetBranchAddress("part_array.fKF",&KF);
    tree->SetBranchAddress("part_array.fPx",&px);
    tree->SetBranchAddress("part_array.fPy",&py);
    tree->SetBranchAddress("part_array.fPz",&pz);
    tree->SetBranchAddress("part_array.fEnergy",&E);
    tree->SetBranchAddress("part_array.fMass",&M);
    array->SetAddress(&n);
    for(int ievent = 0;ievent < tree->GetEntries(); ievent++){
        int nch = 0;
        int nchtotal = 0;
        int ntrk = 0;
        int nbbcau = 0;
        int nbbcde = 0;
        tree->GetEntry(ievent);
 //       array->GetEntry(ievent);
 //       int n = array->GetNdata();
        if(n>MAXP)  {cout<<n<<"!"<<endl;  continue;}
        if(ievent%10000==0) cout<<ievent<<endl;
        for(int iparticle = 0;iparticle < n; iparticle++){
     //     if(KS[iparticle] < 1 || KS[iparticle] > 10) continue;
     //     if(iparticle>10000) cout<<KF[iparticle]<<" ";
            hKF->Fill(KF[iparticle]);
            if(KF[iparticle] == 111) nPion++;
            if(fabs(KF[iparticle]) == 211) nPionC++;
            if(fabs(KF[iparticle]) == 321) nKaonC++;
            if(fabs(KF[iparticle]) > 5000) nout++;
         //   if(KF[iparticle]!=313 && KF[iparticle]!=421 && KF[iparticle]!=311 && KF[iparticle]!d221 && KF[iparticle]!=111 && KF[iparticle]!=223 && KF[iparticle]!=333 && KF[iparticle]!=443 && KF[iparticle]!=2112 && KF[iparticle]!=3122) nch++;
            if(!(fabs(KF[iparticle]) == 211 || fabs(KF[iparticle]) == 213 || fabs(KF[iparticle]) == 321 || fabs(KF[iparticle]) == 323 ||fabs(KF[iparticle]) == 2212)) continue;
            if(KS[iparticle]==1) nPrim++;
            if(KS[iparticle]==11) nSecond++;
            hMass->Fill(M[iparticle]);
         //   if(KS[iparticle]!=1) continue;
            float pt = sqrt(px[iparticle]**2+py[iparticle]**2);
            float theta = atan(pt/pz[iparticle]);
            if(theta<0) theta = TMath::Pi()+theta;
            float eta = -log(tan(theta/2));
            if(px[iparticle]>0){
                float phi = atan(py[iparticle]/px[iparticle]);
            if(py[iparticle]<0)
                float phi = 2*TMath::Pi()+atan(py[iparticle]/px[iparticle]);
            }
            else
                float phi = TMath::Pi()+atan(py[iparticle]/px[iparticle]);
            if((E[iparticle]+pz[iparticle])/(E[iparticle]-pz[iparticle])<=0) continue;
            float y = 0.5*log((E[iparticle]+pz[iparticle])/(E[iparticle]-pz[iparticle]));

          if(fabs(eta)<0.35 && pt>0.2 && pt< 5.0){
              ntrk++;
          }
          if(fabs(eta)>3 && fabs(eta)<4 && pt>0.05){
            int iarm = 0;
            if (eta > 0) iarm = 1;
	    if(iarm==0){
	        nbbcau++;
	    }
	    else{
                nbbcde++;
	    }
            if(iarm==0)   nch++;
        }
          nchtotal++;
        }
        
        if(nch>21) icent=0;//0-4.6%
        else if(nch<5) icent=2; //58-100%
        else icent = 1;

        for(int iparticle = 0;iparticle < n; iparticle++){
            if(!(fabs(KF[iparticle]) == 211 || fabs(KF[iparticle]) == 213 || fabs(KF[iparticle]) == 321 || fabs(KF[iparticle]) == 323 ||fabs(KF[iparticle]) == 2212)) continue;
            float pt = sqrt(px[iparticle]**2+py[iparticle]**2);
            float theta = atan(pt/pz[iparticle]);
            if(theta<0) theta = TMath::Pi()+theta;
            float eta = -log(tan(theta/2));
            if(px[iparticle]>0){
                float phi = atan(py[iparticle]/px[iparticle]);
            if(py[iparticle]<0)
                float phi = 2*TMath::Pi()+atan(py[iparticle]/px[iparticle]);
            }
            else
                float phi = TMath::Pi()+atan(py[iparticle]/px[iparticle]);
            if((E[iparticle]+pz[iparticle])/(E[iparticle]-pz[iparticle])<=0) continue;
            float y = 0.5*log((E[iparticle]+pz[iparticle])/(E[iparticle]-pz[iparticle]));
            hy->Fill(y);
            heta->Fill(eta);
            if(fabs(y)<=1)
            hy1->Fill(y);

            hphi->Fill(phi);
            hpteta[icent]->Fill(pt,eta);
            hpty[icent]->Fill(pt,y);
        }
        hn->Fill(n);
        hnchtotal->Fill(nchtotal);
        hnchntrk->Fill(nch,ntrk);
        hNbinary->Fill(nch,Nbinary);
        hb->Fill(nch,b);


        if(nbbcau<1 || nbbcde<1) continue; //mb trigger
            hnchntrkmbtrig->Fill(nch,ntrk);
            hNbinarymbtrig->Fill(nch,Nbinary);
            hbmbtrig->Fill(nch,b);


        for(int iparticle = 0;iparticle < n; iparticle++){
            if(!(fabs(KF[iparticle]) == 211 || fabs(KF[iparticle]) == 213 || fabs(KF[iparticle]) == 321 || fabs(KF[iparticle]) == 323 ||fabs(KF[iparticle]) == 2212)) continue;
            float pt = sqrt(px[iparticle]**2+py[iparticle]**2);
            float theta = atan(pt/pz[iparticle]);
            if(theta<0) theta = TMath::Pi()+theta;
            float eta = -log(tan(theta/2));
            if(px[iparticle]>0){
                float phi = atan(py[iparticle]/px[iparticle]);
            if(py[iparticle]<0)
                float phi = 2*TMath::Pi()+atan(py[iparticle]/px[iparticle]);
            }
            else
                float phi = TMath::Pi()+atan(py[iparticle]/px[iparticle]);
            if((E[iparticle]+pz[iparticle])/(E[iparticle]-pz[iparticle])<=0) continue;
            float y = 0.5*log((E[iparticle]+pz[iparticle])/(E[iparticle]-pz[iparticle]));
            hptetambtrig[icent]->Fill(pt,eta);
            hptymbtrig[icent]->Fill(pt,y);
    }
    }
    TFile *fout = new TFile(Form("outhisto_dAu_%d.root",i),"Recreate");
    fout->cd();
    hKF->Write();
    heta->Write();
    hy->Write();
    hy1->Write();
    hphi->Write();
    for(int icent=0;icent<ncent;icent++){
    hpteta[icent]->Write();
    hpty[icent]->Write();
    hptetambtrig[icent]->Write();
    hptymbtrig[icent]->Write();
    }
    hMass->Write();
    hn->Write();
    hnchntrk->Write();
    hnchntrkmbtrig->Write();
    hnchtotal->Write();
    hNbinary->Write();
    hb->Write();
    hNbinarymbtrig->Write();
    hbmbtrig->Write();
    fout->Close();
    cout<<nPion<<"\t"<<nPionC<<"\t"<<nKaonC<<"\t"<<nout<<"\t"<<nPrim<<"\t"<<nSecond<<endl;
}
コード例 #5
0
int main(int argc, char * argv[])
{
  if (argc!=3) {
    cerr << "Usage: " << argv[0] << " input_file output_file." << endl;
    return 1;
  }
  // variables in tree
  int run_id;
  int event_id;
  string * parent = 0;
  double t0;
  double t1;
  double energy;
  double maxDx;
  double maxDy;
  double maxDz;
  double maxDd;
  double primaryX;
  double primaryY;
  double primaryZ;

  // open the file for read
  TFile f(argv[1], "READ");
  TTree * tree = (TTree *) f.Get("simple_out");
  TBranch * b_parent;
  // mapping
  tree->SetMakeClass(1);
  tree->SetBranchAddress("runId", &run_id);
  tree->SetBranchAddress("eventId", &event_id);
  tree->SetBranchAddress("parent", &parent, &b_parent);
  tree->SetBranchAddress("t0", &t0);
  tree->SetBranchAddress("t1", &t1);
  tree->SetBranchAddress("energy", &energy);
  tree->SetBranchAddress("maxDx", &maxDx);
  tree->SetBranchAddress("maxDy", &maxDy);
  tree->SetBranchAddress("maxDz", &maxDz);
  tree->SetBranchAddress("maxDd", &maxDd);
  tree->SetBranchAddress("primaryX", &primaryX);
  tree->SetBranchAddress("primaryY", &primaryY);
  tree->SetBranchAddress("primaryZ", &primaryZ);

  // ROI
  double fwhm_0_5 = 0.005 * Q_value;
  double fwhm_1 = 0.01 * Q_value;
  double fwhm_3 = 0.03 * Q_value;

  double sigma_0_5 = getSigma(fwhm_0_5);
  double sigma_1 = getSigma(fwhm_1);
  double sigma_3 = getSigma(fwhm_3);

  double l_edge_0_5 = Q_value - 2 * sigma_0_5;
  double u_edge_0_5 = Q_value + 2 * sigma_0_5;
  double l_edge_1 = Q_value - 2 * sigma_1;
  double u_edge_1 = Q_value + 2 * sigma_1;
  double l_edge_3 = Q_value - 2 * sigma_3;
  double u_edge_3 = Q_value + 2 * sigma_3;
  cout << "0.5% FHWM " << fwhm_0_5 << " - sigma " << sigma_0_5 << endl;
  cout << "1.0% FHWM " << fwhm_1 << " - sigma " << sigma_1 << endl;
  cout << "3.0% FHWM " << fwhm_3 << " - sigma " << sigma_3 << endl;

  cout << "0.5% FHWM - (" << l_edge_0_5 << ", " << u_edge_0_5 << ")." << endl;
  cout << "1.0% FHWM - (" << l_edge_1 << ", " << u_edge_1 << ")." << endl;
  cout << "3.0% FHWM - (" << l_edge_3 << ", " << u_edge_3 << ")." << endl;

  // output file, only with the smeared energy.
  TFile fo(argv[2], "RECREATE");
  TTree * out_tree = new TTree ("smear_e", "smeared energy");
  // output variables
  double e_smear_0_5, e_smear_1, e_smear_3;
  string pparent;
  out_tree->Branch("runId", &run_id, "runId/I");
  out_tree->Branch("eventId", &event_id, "eventId/I");
  out_tree->Branch("parent", &pparent);
  out_tree->Branch("energy", &energy, "energy/D");
  out_tree->Branch("e_smear_0_5", &e_smear_0_5, "e_smear_0_5/D");
  out_tree->Branch("e_smear_1", &e_smear_1, "e_smear_1/D");
  out_tree->Branch("e_smear_3", &e_smear_3, "e_smear_3/D");
  out_tree->Branch("maxDx", &maxDx, "maxDx/D");
  out_tree->Branch("maxDy", &maxDy, "maxDy/D");
  out_tree->Branch("maxDz", &maxDz, "maxDz/D");
  out_tree->Branch("maxDd", &maxDd, "maxDd/D");
  out_tree->Branch("primaryX", &primaryX, "primaryX/D");
  out_tree->Branch("primaryY", &primaryY, "primaryY/D");
  out_tree->Branch("primaryZ", &primaryZ, "primaryZ/D");

  long nEntries = tree->GetEntries();
  cout << nEntries << endl;
  // loop over entries and smear the energy

  tr.SetSeed(0);
  // TCanvas c1("c1", "c1", 800, 600);
  // TH1D * th_esm = new TH1D("th_esm", "smeared energy", 500, 2200, 2700);
  // for (int i=0; i<1000; ++i) {
  //   double esm = smearEnergy(Q_value, sigma_3);
  //   th_esm->Fill(esm);
  // }
  // th_esm->Draw();
  // c1.Print("esm.png");
  vector<double> es;		// selected energy
  int n_0_5(0), ns_0_5(0);
  int n_1(0), ns_1(0);
  int n_3(0), ns_3(0);
  double dn_0_5(0), dn_1(1), dn_3(2); // variable for n calculated from integration

  TTree * count_tree = new TTree ("count_tree", "tree of counts");
  count_tree->Branch("ns_0_5", &ns_0_5, "ns_0_5/I");
  count_tree->Branch("ns_1", &ns_1, "ns_1/I");
  count_tree->Branch("ns_3", &ns_3, "ns_3/I");
  double times = 6.0;
  TF1 * f1 = new TF1("gaus_smear", smearFunc, 2200, 2700, 2);
  for (long i=0; i<nEntries; ++i) {
    tree->GetEntry(i);
    e_smear_0_5 = 0;
    e_smear_1 = 0;
    e_smear_3 = 0;
    // calculate the integration of n
    if (energy > 2200 && energy < 2700) {
      f1->SetParameter(0, sigma_0_5);
      f1->SetParameter(1, energy);
      dn_0_5 += f1->Integral(Q_value-2*sigma_0_5, Q_value+2*sigma_0_5);
      f1->SetParameter(0, sigma_1);
      dn_1 += f1->Integral(Q_value-2*sigma_1, Q_value+2*sigma_1);
      f1->SetParameter(0, sigma_3);
      dn_3 += f1->Integral(Q_value-2*sigma_3, Q_value+2*sigma_3);
    }
    // end the calculation of integration
    if (energy>Q_value-times*sigma_0_5 && energy<Q_value+times*sigma_0_5) {
      e_smear_0_5 = smearEnergy(energy, sigma_0_5);
      if (energy>Q_value-2*sigma_0_5 && energy<Q_value+2*sigma_0_5) {
	n_0_5++;
      }
      if (e_smear_0_5>Q_value-2*sigma_0_5&&e_smear_0_5<Q_value+2*sigma_0_5) {
	ns_0_5++;
      }
    }
    if (energy>Q_value-times*sigma_1 && energy<Q_value+times*sigma_1) {
      e_smear_1 = smearEnergy(energy, sigma_1);
      if (energy>Q_value-2*sigma_1 && energy<Q_value+2*sigma_1) {
	n_1++;
      }
      if (e_smear_1>Q_value-2*sigma_1&&e_smear_1<Q_value+2*sigma_1) {
	ns_1++;
      }
    }
    if (energy>Q_value-times*sigma_3 && energy<Q_value+times*sigma_3) {
      e_smear_3 = smearEnergy(energy, sigma_3);
      if (energy>Q_value-2*sigma_3 && energy<Q_value+2*sigma_3) {
	n_3++;
      }
      if (e_smear_3>Q_value-2*sigma_3&&e_smear_3<Q_value+2*sigma_3) {
	ns_3++;
      }
      es.push_back(energy);
      pparent = * parent;
      //      cout << event_id << " " << * parent << endl;
      out_tree->Fill();
    }
  }
  // print out the values
  cout << "0.5%: " << n_0_5 << " (original), " << ns_0_5 << " (smeared), " << dn_0_5 << "(smeared with integration)." << endl;
  cout << "1.0%: " << n_1 << " (original), " << ns_1 << " (smeared), " << dn_1 << "(smeared with integration)." << endl;
  cout << "3.0%: " << n_3 << " (original), " << ns_3 << " (smeared), " << dn_3 << "(smeared with integration)." << endl;
  out_tree->Write();
  // further simulation
  for (int i=0; i<500; ++i) {
    ns_0_5 = 0;
    ns_1 = 0;
    ns_3 = 0;
    for (size_t j=0; j<es.size(); ++j) {
      double e = es[j];
      if (e>Q_value-times*sigma_0_5&&e<Q_value+times*sigma_0_5) {
	double ex = smearEnergy(e, sigma_0_5);
	if (ex>Q_value-2*sigma_0_5&&e<Q_value+2*sigma_0_5) {
	  ns_0_5++;
	}
      }
      if (e>Q_value-times*sigma_1&&e<Q_value+times*sigma_1) {
	double ex = smearEnergy(e, sigma_1);
	if (ex>Q_value-2*sigma_1&&e<Q_value+2*sigma_1) {
	  ns_1++;
	}
      }
      if (e>Q_value-times*sigma_3&&e<Q_value+times*sigma_3) {
	double ex = smearEnergy(e, sigma_3);
	if (ex>Q_value-2*sigma_3&&e<Q_value+2*sigma_3) {
	  ns_3++;
	}
      }
    }
    count_tree->Fill();
  }
  count_tree->Write();
  fo.Close();
  f.Close();
}
コード例 #6
0
ファイル: testdNdeta.C プロジェクト: XuQiao/HI
void testdNdeta(){
    //TFile *f = TFile::Open(Form("/phenix/plhf3/xuq/MCgen/Hijing/phhijing_AuAu_bmax2.root"));
    //TFile *f = TFile::Open(Form("/phenix/plhf3/peng/MCgen/Hijing/phhijing_pAu_7.root"));
    TFile *f = TFile::Open(Form("../Generator/phhijing_dAu_0.root"));
    TTree *tree = (TTree*)f->Get("T");
    TBranchElement *array = (TBranchElement*)T->GetBranch("part_array");
    tree->SetMakeClass(1);
    TH1::SetDefaultSumw2(kTRUE);
    TH1F* hKF = new TH1F("hKF","particle id",10000,-5000,5000);
    TH1F* hn = new TH1F("hn","Ntotal",1000,0,1000);
    TH1F* hnch = new TH1F("hnch","Ncharge",500,0,500);
    TH1F* heta = new TH1F("heta","particle eta distr",120,-6,6);
    TH1F* hy = new TH1F("hy","particle y distr",120,-6,6);
    TH1F* hy1 = new TH1F("hy1","particle y distr in |y|<1",150,-1.5,1.5);
    TH1F* hphi = new TH1F("hphi","particle phi distr",200,0,8);
    TH1F* hMass= new TH1F("hMass","mass distribution",500,0,5);
    TH2F* hpteta = new TH2F("hpteta","",1000,0,10,120,-6,6);
    TH2F* hnchNtrig[10];
    for(int i=0;i<10;i++)
        hnchNtrig[i] = new TH2F(Form("hnchNtrig_%d",i),"",500,0,500,100,0,100);
    
    float px[MAXP];
    float py[MAXP];
    float pz[MAXP];
    float E[MAXP];
    int KS[MAXP];
    int KF[MAXP];
    float M[MAXP];
    int n;
    int nPion = 0;
    int nPionC = 0;
    int nKaonC = 0;
    int nout=0;
    tree->SetBranchAddress("part_array.fKS",KS);
    tree->SetBranchAddress("part_array.fKF",KF);
    tree->SetBranchAddress("part_array.fPx",px);
    tree->SetBranchAddress("part_array.fPy",py);
    tree->SetBranchAddress("part_array.fPz",pz);
    tree->SetBranchAddress("part_array.fEnergy",E);
    tree->SetBranchAddress("part_array.fMass",M);
    array->SetAddress(&n);
    int Ntrig[10];
    int nEvent = tree->GetEntries();
    for(int ievent = 0;ievent < nEvent; ievent++){
        int nch=0;
        for(int i=0;i<10;i++)
            Ntrig[i]=0;
        tree->GetEntry(ievent);
 //       array->GetEntry(ievent);
 //       int n = array->GetNdata();
        if(n>MAXP)  {cout<<n<<"!"<<endl;  continue;}
        if(ievent%10000==0) cout<<ievent<<endl;
        for(int iparticle = 0;iparticle < n; iparticle++){
     //     if(KS[iparticle] < 1 || KS[iparticle] > 10) continue;
     //     if(iparticle>10000) cout<<KF[iparticle]<<" ";
            hKF->Fill(KF[iparticle]);
            if(KF[iparticle] == 111) nPion++;
            if(fabs(KF[iparticle]) == 211) nPionC++;
            if(fabs(KF[iparticle]) == 321) nKaonC++;
            if(fabs(KF[iparticle]) > 5000) nout++;
         //   if(KF[iparticle]!=313 && KF[iparticle]!=421 && KF[iparticle]!=311 && KF[iparticle]!=221 && KF[iparticle]!=111 && KF[iparticle]!=223 && KF[iparticle]!=333 && KF[iparticle]!=443 && KF[iparticle]!=2112 && KF[iparticle]!=3122) 
          if(!(fabs(KF[iparticle]) == 211 || fabs(KF[iparticle]) == 213 || fabs(KF[iparticle]) == 321 || fabs(KF[iparticle]) == 323 ||fabs(KF[iparticle]) == 2212))continue;
            float pt = sqrt(px[iparticle]**2+py[iparticle]**2);
            float theta = atan(pt/pz[iparticle]);
            if(theta<0) theta = TMath::Pi()+theta;
            float eta = -log(tan(theta/2));
            if(fabs(eta)<4 && fabs(eta)>3 && pt>0.05)
            nch++;
            if(px[iparticle]>0){
                float phi = atan(py[iparticle]/px[iparticle]);
            if(py[iparticle]<0)
                float phi = 2*TMath::Pi()+atan(py[iparticle]/px[iparticle]);
            }
            else
                float phi = TMath::Pi()+atan(py[iparticle]/px[iparticle]);
            if((E[iparticle]+pz[iparticle])/(E[iparticle]-pz[iparticle])<=0) continue;
            float y = 0.5*log((E[iparticle]+pz[iparticle])/(E[iparticle]-pz[iparticle]));
            hy->Fill(y);
            if(fabs(y)<=1)
            hy1->Fill(y);
            
            heta->Fill(eta);
            hMass->Fill(M[iparticle]);
            hphi->Fill(phi);
            hpteta->Fill(pt,eta);
            if(fabs(eta)<0.35)
                if(pt>0.2 && pt<5.0){
                    int ipt = pt/0.5;
                    Ntrig[ipt]++;
                }
        }
        hn->Fill(n);
        hnch->Fill(nch);
        for(int i=0;i<10;i++){
            hnchNtrig[i]->Fill(nch,Ntrig[i]);
        }
    }
    TFile *fout = new TFile(Form("outhisto_dAu_0.root"),"Recreate");
    fout->cd();
    hKF->Write();
    heta->Write();
    hy->Write();
    hy1->Write();
    hphi->Write();
    hpteta->Write();
    hMass->Write();
    hn->Write();
    hnch->Write();
        for(int i=0;i<10;i++)
    hnchNtrig[i]->Write();
    fout->Close();
    cout<<nPion<<"\t"<<nPionC<<"\t"<<nKaonC<<"\t"<<nout<<endl;
}
コード例 #7
0
void ElectronMuonPreTagTree::Init(TTree *tree)
{
   // The Init() function is called when the selector needs to initialize
   // a new tree or chain. Typically here the branch addresses and branch
   // pointers of the tree will be set.
   // It is normally not necessary to make changes to the generated
   // code, but the routine can be extended by the user if needed.
   // Init() will be called many times when running on PROOF
   // (once per file to be processed).

   // Set object pointer
   Jet_Barcode = 0;
   Jet_flavor_truth_trueflav = 0;
   Jet_flavor_truth_BHadronpdg = 0;
   Jet_pt = 0;
   Jet_eta = 0;
   Jet_phi = 0;
   Jet_E = 0;
   Jet_Et = 0;
   Jet_emscale_pt = 0;
   Jet_emscale_eta = 0;
   Jet_emscale_phi = 0;
   Jet_emscale_E = 0;
   Jet_flavor_weight = 0;
   Jet_flavor_weight_TrackCounting2D = 0;
   Jet_flavor_weight_JetProb = 0;
   Jet_flavor_weight_IP1D = 0;
   Jet_flavor_weight_IP2D = 0;
   Jet_flavor_weight_IP3D = 0;
   Jet_flavor_weight_SV0 = 0;
   Jet_flavor_weight_SV1 = 0;
   Jet_flavor_weight_SV2 = 0;
   Jet_flavor_weight_JetFitterTag = 0;
   Jet_flavor_weight_JetFitterCOMB = 0;
   Jet_flavor_weight_JetFitterCOMBNN = 0;
   Jet_flavor_weight_SoftMuonTag = 0;
   Jet_flavor_weight_SoftElectronTag = 0;
   Jet_flavor_truth_dRMinToB = 0;
   Jet_flavor_truth_dRMinToC = 0;
   Jet_flavor_truth_dRMinToT = 0;
   BJet_Barcode = 0;
   BJet_flavor_truth_trueflav = 0;
   BJet_flavor_truth_BHadronpdg = 0;
   BJet_pt = 0;
   BJet_eta = 0;
   BJet_phi = 0;
   BJet_E = 0;
   BJet_Et = 0;
   BJet_emscale_pt = 0;
   BJet_emscale_eta = 0;
   BJet_emscale_phi = 0;
   BJet_emscale_E = 0;
   BJet_flavor_weight = 0;
   BJet_flavor_weight_TrackCounting2D = 0;
   BJet_flavor_weight_JetProb = 0;
   BJet_flavor_weight_IP1D = 0;
   BJet_flavor_weight_IP2D = 0;
   BJet_flavor_weight_IP3D = 0;
   BJet_flavor_weight_SV0 = 0;
   BJet_flavor_weight_SV1 = 0;
   BJet_flavor_weight_SV2 = 0;
   BJet_flavor_weight_JetFitterTag = 0;
   BJet_flavor_weight_JetFitterCOMB = 0;
   BJet_flavor_weight_JetFitterCOMBNN = 0;
   BJet_flavor_weight_SoftMuonTag = 0;
   BJet_flavor_weight_SoftElectronTag = 0;
   BJet_flavor_truth_dRMinToB = 0;
   BJet_flavor_truth_dRMinToC = 0;
   BJet_flavor_truth_dRMinToT = 0;
   BJet_index = 0;
   VetoJet_Barcode = 0;
   VetoJet_flavor_truth_trueflav = 0;
   VetoJet_flavor_truth_BHadronpdg = 0;
   VetoJet_pt = 0;
   VetoJet_eta = 0;
   VetoJet_phi = 0;
   VetoJet_E = 0;
   VetoJet_Et = 0;
   VetoJet_emscale_pt = 0;
   VetoJet_emscale_eta = 0;
   VetoJet_emscale_phi = 0;
   VetoJet_emscale_E = 0;
   VetoJet_flavor_weight = 0;
   VetoJet_flavor_weight_TrackCounting2D = 0;
   VetoJet_flavor_weight_JetProb = 0;
   VetoJet_flavor_weight_IP1D = 0;
   VetoJet_flavor_weight_IP2D = 0;
   VetoJet_flavor_weight_IP3D = 0;
   VetoJet_flavor_weight_SV0 = 0;
   VetoJet_flavor_weight_SV1 = 0;
   VetoJet_flavor_weight_SV2 = 0;
   VetoJet_flavor_weight_JetFitterTag = 0;
   VetoJet_flavor_weight_JetFitterCOMB = 0;
   VetoJet_flavor_weight_JetFitterCOMBNN = 0;
   VetoJet_flavor_weight_SoftMuonTag = 0;
   VetoJet_flavor_weight_SoftElectronTag = 0;
   VetoJet_flavor_truth_dRMinToB = 0;
   VetoJet_flavor_truth_dRMinToC = 0;
   VetoJet_flavor_truth_dRMinToT = 0;
   // Set branch addresses and branch pointers
   if (!tree) return;
   fChain = tree;
   fCurrent = -1;
   fChain->SetMakeClass(1);

   fChain->SetBranchAddress("Lepton1_loose", &Lepton1_loose, &b_Lepton1_loose);
   fChain->SetBranchAddress("Lepton1_medium", &Lepton1_medium, &b_Lepton1_medium);
   fChain->SetBranchAddress("Lepton1_mediumIso", &Lepton1_mediumIso, &b_Lepton1_mediumIso);
   fChain->SetBranchAddress("Lepton1_tight", &Lepton1_tight, &b_Lepton1_tight);
   fChain->SetBranchAddress("Lepton1_tightIso", &Lepton1_tightIso, &b_Lepton1_tightIso);
   fChain->SetBranchAddress("Lepton1_trackBlayer", &Lepton1_trackBlayer, &b_Lepton1_trackBlayer);
   fChain->SetBranchAddress("Lepton1_trackMatchEoverP", &Lepton1_trackMatchEoverP, &b_Lepton1_trackMatchEoverP);
   fChain->SetBranchAddress("Lepton1_trackTRThits", &Lepton1_trackTRThits, &b_Lepton1_trackTRThits);
   fChain->SetBranchAddress("Lepton1_trackTRTratio", &Lepton1_trackTRTratio, &b_Lepton1_trackTRTratio);
   fChain->SetBranchAddress("Lepton1_trackA0Tight", &Lepton1_trackA0Tight, &b_Lepton1_trackA0Tight);
   fChain->SetBranchAddress("Lepton1_trackMatchEtaTight", &Lepton1_trackMatchEtaTight, &b_Lepton1_trackMatchEtaTight);
   fChain->SetBranchAddress("Lepton1_trackMatchPhi", &Lepton1_trackMatchPhi, &b_Lepton1_trackMatchPhi);
   fChain->SetBranchAddress("Lepton1_conversionMatch", &Lepton1_conversionMatch, &b_Lepton1_conversionMatch);
   fChain->SetBranchAddress("Lepton1_Barcode", &Lepton1_Barcode, &b_Lepton1_Barcode);
   fChain->SetBranchAddress("Lepton1_pdgId", &Lepton1_pdgId, &b_Lepton1_pdgId);
   fChain->SetBranchAddress("Lepton1_charge", &Lepton1_charge, &b_Lepton1_charge);
   fChain->SetBranchAddress("Lepton1_Etcone45", &Lepton1_Etcone45, &b_Lepton1_Etcone45);
   fChain->SetBranchAddress("Lepton1_Etcone20", &Lepton1_Etcone20, &b_Lepton1_Etcone20);
   fChain->SetBranchAddress("Lepton1_Etcone30", &Lepton1_Etcone30, &b_Lepton1_Etcone30);
   fChain->SetBranchAddress("Lepton1_Etcone40", &Lepton1_Etcone40, &b_Lepton1_Etcone40);
   fChain->SetBranchAddress("Lepton1_ptcone20", &Lepton1_ptcone20, &b_Lepton1_ptcone20);
   fChain->SetBranchAddress("Lepton1_ptcone30", &Lepton1_ptcone30, &b_Lepton1_ptcone30);
   fChain->SetBranchAddress("Lepton1_ptcone40", &Lepton1_ptcone40, &b_Lepton1_ptcone40);
   fChain->SetBranchAddress("Lepton1_cluster_pt", &Lepton1_cluster_pt, &b_Lepton1_cluster_pt);
   fChain->SetBranchAddress("Lepton1_cluster_eta", &Lepton1_cluster_eta, &b_Lepton1_cluster_eta);
   fChain->SetBranchAddress("Lepton1_cluster_phi", &Lepton1_cluster_phi, &b_Lepton1_cluster_phi);
   fChain->SetBranchAddress("Lepton1_cluster_E", &Lepton1_cluster_E, &b_Lepton1_cluster_E);
   fChain->SetBranchAddress("Lepton1_cluster_Et", &Lepton1_cluster_Et, &b_Lepton1_cluster_Et);
   fChain->SetBranchAddress("Lepton1_cluster_track_Et", &Lepton1_cluster_track_Et, &b_Lepton1_cluster_track_Et);
   fChain->SetBranchAddress("Lepton1_track_d0", &Lepton1_track_d0, &b_Lepton1_track_d0);
   fChain->SetBranchAddress("Lepton1_track_z0", &Lepton1_track_z0, &b_Lepton1_track_z0);
   fChain->SetBranchAddress("Lepton1_track_phi", &Lepton1_track_phi, &b_Lepton1_track_phi);
   fChain->SetBranchAddress("Lepton1_track_theta", &Lepton1_track_theta, &b_Lepton1_track_theta);
   fChain->SetBranchAddress("Lepton1_track_qoverp", &Lepton1_track_qoverp, &b_Lepton1_track_qoverp);
   fChain->SetBranchAddress("Lepton1_track_pt", &Lepton1_track_pt, &b_Lepton1_track_pt);
   fChain->SetBranchAddress("Lepton1_track_eta", &Lepton1_track_eta, &b_Lepton1_track_eta);
   fChain->SetBranchAddress("Lepton2_Barcode", &Lepton2_Barcode, &b_Lepton2_Barcode);
   fChain->SetBranchAddress("Lepton2_pdgId", &Lepton2_pdgId, &b_Lepton2_pdgId);
   fChain->SetBranchAddress("Lepton2_isGoodIDTrack", &Lepton2_isGoodIDTrack, &b_Lepton2_isGoodIDTrack);
   fChain->SetBranchAddress("Lepton2_pt", &Lepton2_pt, &b_Lepton2_pt);
   fChain->SetBranchAddress("Lepton2_eta", &Lepton2_eta, &b_Lepton2_eta);
   fChain->SetBranchAddress("Lepton2_phi", &Lepton2_phi, &b_Lepton2_phi);
   fChain->SetBranchAddress("Lepton2_E", &Lepton2_E, &b_Lepton2_E);
   fChain->SetBranchAddress("Lepton2_Et", &Lepton2_Et, &b_Lepton2_Et);
   fChain->SetBranchAddress("Lepton2_charge", &Lepton2_charge, &b_Lepton2_charge);
   fChain->SetBranchAddress("Lepton2_etcone20", &Lepton2_etcone20, &b_Lepton2_etcone20);
   fChain->SetBranchAddress("Lepton2_etcone30", &Lepton2_etcone30, &b_Lepton2_etcone30);
   fChain->SetBranchAddress("Lepton2_etcone40", &Lepton2_etcone40, &b_Lepton2_etcone40);
   fChain->SetBranchAddress("Lepton2_ptcone20", &Lepton2_ptcone20, &b_Lepton2_ptcone20);
   fChain->SetBranchAddress("Lepton2_ptcone30", &Lepton2_ptcone30, &b_Lepton2_ptcone30);
   fChain->SetBranchAddress("Lepton2_ptcone40", &Lepton2_ptcone40, &b_Lepton2_ptcone40);
   fChain->SetBranchAddress("Lepton2_id_pt", &Lepton2_id_pt, &b_Lepton2_id_pt);
   fChain->SetBranchAddress("Lepton2_id_eta", &Lepton2_id_eta, &b_Lepton2_id_eta);
   fChain->SetBranchAddress("Lepton2_me_pt", &Lepton2_me_pt, &b_Lepton2_me_pt);
   fChain->SetBranchAddress("Lepton2_me_eta", &Lepton2_me_eta, &b_Lepton2_me_eta);
   fChain->SetBranchAddress("MissingEt_etx", &MissingEt_etx, &b_MissingEt_etx);
   fChain->SetBranchAddress("MissingEt_ety", &MissingEt_ety, &b_MissingEt_ety);
   fChain->SetBranchAddress("MissingEt_et", &MissingEt_et, &b_MissingEt_et);
   fChain->SetBranchAddress("MissingEt_sumet", &MissingEt_sumet, &b_MissingEt_sumet);
   fChain->SetBranchAddress("MissingEt_phi", &MissingEt_phi, &b_MissingEt_phi);
   fChain->SetBranchAddress("Jet_n", &Jet_n, &b_Jet_n);
   fChain->SetBranchAddress("Jet_Barcode", &Jet_Barcode, &b_Jet_Barcode);
   fChain->SetBranchAddress("Jet_flavor_truth_trueflav", &Jet_flavor_truth_trueflav, &b_Jet_flavor_truth_trueflav);
   fChain->SetBranchAddress("Jet_flavor_truth_BHadronpdg", &Jet_flavor_truth_BHadronpdg, &b_Jet_flavor_truth_BHadronpdg);
   fChain->SetBranchAddress("Jet_pt", &Jet_pt, &b_Jet_pt);
   fChain->SetBranchAddress("Jet_eta", &Jet_eta, &b_Jet_eta);
   fChain->SetBranchAddress("Jet_phi", &Jet_phi, &b_Jet_phi);
   fChain->SetBranchAddress("Jet_E", &Jet_E, &b_Jet_E);
   fChain->SetBranchAddress("Jet_Et", &Jet_Et, &b_Jet_Et);
   fChain->SetBranchAddress("Jet_emscale_pt", &Jet_emscale_pt, &b_Jet_emscale_pt);
   fChain->SetBranchAddress("Jet_emscale_eta", &Jet_emscale_eta, &b_Jet_emscale_eta);
   fChain->SetBranchAddress("Jet_emscale_phi", &Jet_emscale_phi, &b_Jet_emscale_phi);
   fChain->SetBranchAddress("Jet_emscale_E", &Jet_emscale_E, &b_Jet_emscale_E);
   fChain->SetBranchAddress("Jet_flavor_weight", &Jet_flavor_weight, &b_Jet_flavor_weight);
   fChain->SetBranchAddress("Jet_flavor_weight_TrackCounting2D", &Jet_flavor_weight_TrackCounting2D, &b_Jet_flavor_weight_TrackCounting2D);
   fChain->SetBranchAddress("Jet_flavor_weight_JetProb", &Jet_flavor_weight_JetProb, &b_Jet_flavor_weight_JetProb);
   fChain->SetBranchAddress("Jet_flavor_weight_IP1D", &Jet_flavor_weight_IP1D, &b_Jet_flavor_weight_IP1D);
   fChain->SetBranchAddress("Jet_flavor_weight_IP2D", &Jet_flavor_weight_IP2D, &b_Jet_flavor_weight_IP2D);
   fChain->SetBranchAddress("Jet_flavor_weight_IP3D", &Jet_flavor_weight_IP3D, &b_Jet_flavor_weight_IP3D);
   fChain->SetBranchAddress("Jet_flavor_weight_SV0", &Jet_flavor_weight_SV0, &b_Jet_flavor_weight_SV0);
   fChain->SetBranchAddress("Jet_flavor_weight_SV1", &Jet_flavor_weight_SV1, &b_Jet_flavor_weight_SV1);
   fChain->SetBranchAddress("Jet_flavor_weight_SV2", &Jet_flavor_weight_SV2, &b_Jet_flavor_weight_SV2);
   fChain->SetBranchAddress("Jet_flavor_weight_JetFitterTag", &Jet_flavor_weight_JetFitterTag, &b_Jet_flavor_weight_JetFitterTag);
   fChain->SetBranchAddress("Jet_flavor_weight_JetFitterCOMB", &Jet_flavor_weight_JetFitterCOMB, &b_Jet_flavor_weight_JetFitterCOMB);
   fChain->SetBranchAddress("Jet_flavor_weight_JetFitterCOMBNN", &Jet_flavor_weight_JetFitterCOMBNN, &b_Jet_flavor_weight_JetFitterCOMBNN);
   fChain->SetBranchAddress("Jet_flavor_weight_SoftMuonTag", &Jet_flavor_weight_SoftMuonTag, &b_Jet_flavor_weight_SoftMuonTag);
   fChain->SetBranchAddress("Jet_flavor_weight_SoftElectronTag", &Jet_flavor_weight_SoftElectronTag, &b_Jet_flavor_weight_SoftElectronTag);
   fChain->SetBranchAddress("Jet_flavor_truth_dRMinToB", &Jet_flavor_truth_dRMinToB, &b_Jet_flavor_truth_dRMinToB);
   fChain->SetBranchAddress("Jet_flavor_truth_dRMinToC", &Jet_flavor_truth_dRMinToC, &b_Jet_flavor_truth_dRMinToC);
   fChain->SetBranchAddress("Jet_flavor_truth_dRMinToT", &Jet_flavor_truth_dRMinToT, &b_Jet_flavor_truth_dRMinToT);
   fChain->SetBranchAddress("DiLeptons_m", &DiLeptons_m, &b_DiLeptons_m);
   fChain->SetBranchAddress("DiLeptons_E", &DiLeptons_E, &b_DiLeptons_E);
   fChain->SetBranchAddress("DiLeptons_Et", &DiLeptons_Et, &b_DiLeptons_Et);
   fChain->SetBranchAddress("DiLeptons_pt", &DiLeptons_pt, &b_DiLeptons_pt);
   fChain->SetBranchAddress("DiLeptons_eta", &DiLeptons_eta, &b_DiLeptons_eta);
   fChain->SetBranchAddress("DiLeptons_phi", &DiLeptons_phi, &b_DiLeptons_phi);
   fChain->SetBranchAddress("DiLeptons_charge", &DiLeptons_charge, &b_DiLeptons_charge);
   fChain->SetBranchAddress("BJet_n", &BJet_n, &b_BJet_n);
   fChain->SetBranchAddress("BJet_Barcode", &BJet_Barcode, &b_BJet_Barcode);
   fChain->SetBranchAddress("BJet_flavor_truth_trueflav", &BJet_flavor_truth_trueflav, &b_BJet_flavor_truth_trueflav);
   fChain->SetBranchAddress("BJet_flavor_truth_BHadronpdg", &BJet_flavor_truth_BHadronpdg, &b_BJet_flavor_truth_BHadronpdg);
   fChain->SetBranchAddress("BJet_pt", &BJet_pt, &b_BJet_pt);
   fChain->SetBranchAddress("BJet_eta", &BJet_eta, &b_BJet_eta);
   fChain->SetBranchAddress("BJet_phi", &BJet_phi, &b_BJet_phi);
   fChain->SetBranchAddress("BJet_E", &BJet_E, &b_BJet_E);
   fChain->SetBranchAddress("BJet_Et", &BJet_Et, &b_BJet_Et);
   fChain->SetBranchAddress("BJet_emscale_pt", &BJet_emscale_pt, &b_BJet_emscale_pt);
   fChain->SetBranchAddress("BJet_emscale_eta", &BJet_emscale_eta, &b_BJet_emscale_eta);
   fChain->SetBranchAddress("BJet_emscale_phi", &BJet_emscale_phi, &b_BJet_emscale_phi);
   fChain->SetBranchAddress("BJet_emscale_E", &BJet_emscale_E, &b_BJet_emscale_E);
   fChain->SetBranchAddress("BJet_flavor_weight", &BJet_flavor_weight, &b_BJet_flavor_weight);
   fChain->SetBranchAddress("BJet_flavor_weight_TrackCounting2D", &BJet_flavor_weight_TrackCounting2D, &b_BJet_flavor_weight_TrackCounting2D);
   fChain->SetBranchAddress("BJet_flavor_weight_JetProb", &BJet_flavor_weight_JetProb, &b_BJet_flavor_weight_JetProb);
   fChain->SetBranchAddress("BJet_flavor_weight_IP1D", &BJet_flavor_weight_IP1D, &b_BJet_flavor_weight_IP1D);
   fChain->SetBranchAddress("BJet_flavor_weight_IP2D", &BJet_flavor_weight_IP2D, &b_BJet_flavor_weight_IP2D);
   fChain->SetBranchAddress("BJet_flavor_weight_IP3D", &BJet_flavor_weight_IP3D, &b_BJet_flavor_weight_IP3D);
   fChain->SetBranchAddress("BJet_flavor_weight_SV0", &BJet_flavor_weight_SV0, &b_BJet_flavor_weight_SV0);
   fChain->SetBranchAddress("BJet_flavor_weight_SV1", &BJet_flavor_weight_SV1, &b_BJet_flavor_weight_SV1);
   fChain->SetBranchAddress("BJet_flavor_weight_SV2", &BJet_flavor_weight_SV2, &b_BJet_flavor_weight_SV2);
   fChain->SetBranchAddress("BJet_flavor_weight_JetFitterTag", &BJet_flavor_weight_JetFitterTag, &b_BJet_flavor_weight_JetFitterTag);
   fChain->SetBranchAddress("BJet_flavor_weight_JetFitterCOMB", &BJet_flavor_weight_JetFitterCOMB, &b_BJet_flavor_weight_JetFitterCOMB);
   fChain->SetBranchAddress("BJet_flavor_weight_JetFitterCOMBNN", &BJet_flavor_weight_JetFitterCOMBNN, &b_BJet_flavor_weight_JetFitterCOMBNN);
   fChain->SetBranchAddress("BJet_flavor_weight_SoftMuonTag", &BJet_flavor_weight_SoftMuonTag, &b_BJet_flavor_weight_SoftMuonTag);
   fChain->SetBranchAddress("BJet_flavor_weight_SoftElectronTag", &BJet_flavor_weight_SoftElectronTag, &b_BJet_flavor_weight_SoftElectronTag);
   fChain->SetBranchAddress("BJet_flavor_truth_dRMinToB", &BJet_flavor_truth_dRMinToB, &b_BJet_flavor_truth_dRMinToB);
   fChain->SetBranchAddress("BJet_flavor_truth_dRMinToC", &BJet_flavor_truth_dRMinToC, &b_BJet_flavor_truth_dRMinToC);
   fChain->SetBranchAddress("BJet_flavor_truth_dRMinToT", &BJet_flavor_truth_dRMinToT, &b_BJet_flavor_truth_dRMinToT);
   fChain->SetBranchAddress("BJet_index", &BJet_index, &b_BJet_index);
   fChain->SetBranchAddress("RunNumber", &RunNumber, &b_RunNumber);
   fChain->SetBranchAddress("EventNumber", &EventNumber, &b_EventNumber);
   fChain->SetBranchAddress("lbn", &lbn, &b_lbn);
   fChain->SetBranchAddress("weight", &weight, &b_weight);
   fChain->SetBranchAddress("Lepton1_inTrigger", &Lepton1_inTrigger, &b_Lepton1_inTrigger);
   fChain->SetBranchAddress("Lepton2_inTrigger", &Lepton2_inTrigger, &b_Lepton2_inTrigger);
   fChain->SetBranchAddress("isElectronTriggerPassed", &isElectronTriggerPassed, &b_isElectronTriggerPassed);
   fChain->SetBranchAddress("isMuonTriggerPassed", &isMuonTriggerPassed, &b_isMuonTriggerPassed);
   fChain->SetBranchAddress("VetoJet_n", &VetoJet_n, &b_VetoJet_n);
   fChain->SetBranchAddress("VetoJet_Barcode", &VetoJet_Barcode, &b_VetoJet_Barcode);
   fChain->SetBranchAddress("VetoJet_flavor_truth_trueflav", &VetoJet_flavor_truth_trueflav, &b_VetoJet_flavor_truth_trueflav);
   fChain->SetBranchAddress("VetoJet_flavor_truth_BHadronpdg", &VetoJet_flavor_truth_BHadronpdg, &b_VetoJet_flavor_truth_BHadronpdg);
   fChain->SetBranchAddress("VetoJet_pt", &VetoJet_pt, &b_VetoJet_pt);
   fChain->SetBranchAddress("VetoJet_eta", &VetoJet_eta, &b_VetoJet_eta);
   fChain->SetBranchAddress("VetoJet_phi", &VetoJet_phi, &b_VetoJet_phi);
   fChain->SetBranchAddress("VetoJet_E", &VetoJet_E, &b_VetoJet_E);
   fChain->SetBranchAddress("VetoJet_Et", &VetoJet_Et, &b_VetoJet_Et);
   fChain->SetBranchAddress("VetoJet_emscale_pt", &VetoJet_emscale_pt, &b_VetoJet_emscale_pt);
   fChain->SetBranchAddress("VetoJet_emscale_eta", &VetoJet_emscale_eta, &b_VetoJet_emscale_eta);
   fChain->SetBranchAddress("VetoJet_emscale_phi", &VetoJet_emscale_phi, &b_VetoJet_emscale_phi);
   fChain->SetBranchAddress("VetoJet_emscale_E", &VetoJet_emscale_E, &b_VetoJet_emscale_E);
   fChain->SetBranchAddress("VetoJet_flavor_weight", &VetoJet_flavor_weight, &b_VetoJet_flavor_weight);
   fChain->SetBranchAddress("VetoJet_flavor_weight_TrackCounting2D", &VetoJet_flavor_weight_TrackCounting2D, &b_VetoJet_flavor_weight_TrackCounting2D);
   fChain->SetBranchAddress("VetoJet_flavor_weight_JetProb", &VetoJet_flavor_weight_JetProb, &b_VetoJet_flavor_weight_JetProb);
   fChain->SetBranchAddress("VetoJet_flavor_weight_IP1D", &VetoJet_flavor_weight_IP1D, &b_VetoJet_flavor_weight_IP1D);
   fChain->SetBranchAddress("VetoJet_flavor_weight_IP2D", &VetoJet_flavor_weight_IP2D, &b_VetoJet_flavor_weight_IP2D);
   fChain->SetBranchAddress("VetoJet_flavor_weight_IP3D", &VetoJet_flavor_weight_IP3D, &b_VetoJet_flavor_weight_IP3D);
   fChain->SetBranchAddress("VetoJet_flavor_weight_SV0", &VetoJet_flavor_weight_SV0, &b_VetoJet_flavor_weight_SV0);
   fChain->SetBranchAddress("VetoJet_flavor_weight_SV1", &VetoJet_flavor_weight_SV1, &b_VetoJet_flavor_weight_SV1);
   fChain->SetBranchAddress("VetoJet_flavor_weight_SV2", &VetoJet_flavor_weight_SV2, &b_VetoJet_flavor_weight_SV2);
   fChain->SetBranchAddress("VetoJet_flavor_weight_JetFitterTag", &VetoJet_flavor_weight_JetFitterTag, &b_VetoJet_flavor_weight_JetFitterTag);
   fChain->SetBranchAddress("VetoJet_flavor_weight_JetFitterCOMB", &VetoJet_flavor_weight_JetFitterCOMB, &b_VetoJet_flavor_weight_JetFitterCOMB);
   fChain->SetBranchAddress("VetoJet_flavor_weight_JetFitterCOMBNN", &VetoJet_flavor_weight_JetFitterCOMBNN, &b_VetoJet_flavor_weight_JetFitterCOMBNN);
   fChain->SetBranchAddress("VetoJet_flavor_weight_SoftMuonTag", &VetoJet_flavor_weight_SoftMuonTag, &b_VetoJet_flavor_weight_SoftMuonTag);
   fChain->SetBranchAddress("VetoJet_flavor_weight_SoftElectronTag", &VetoJet_flavor_weight_SoftElectronTag, &b_VetoJet_flavor_weight_SoftElectronTag);
   fChain->SetBranchAddress("VetoJet_flavor_truth_dRMinToB", &VetoJet_flavor_truth_dRMinToB, &b_VetoJet_flavor_truth_dRMinToB);
   fChain->SetBranchAddress("VetoJet_flavor_truth_dRMinToC", &VetoJet_flavor_truth_dRMinToC, &b_VetoJet_flavor_truth_dRMinToC);
   fChain->SetBranchAddress("VetoJet_flavor_truth_dRMinToT", &VetoJet_flavor_truth_dRMinToT, &b_VetoJet_flavor_truth_dRMinToT);
   fChain->SetBranchAddress("isNoEleMuOverlap", &isNoEleMuOverlap, &b_isNoEleMuOverlap);
   Notify();
}