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

C++ TTree类代码示例

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

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



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

示例1: makeLongTracksonlyunnormalized

//=============================================================================
// Standard constructor, initializes variables
//=============================================================================
void makeLongTracksonlyunnormalized(  ) {
  gROOT->SetBatch(kTRUE);
  TString tuplelocation = "/afs/cern.ch/work/m/mwilkins/b_b-bar_cross-section/";
  TString data2011tuple = tuplelocation+"Strp20r1_SL_D0andDp_MD.root";
  TString MC2011tuple = tuplelocation+"MC_2011_Bu_D0Xmunu_cocktail_12873441_MC2011_S20r1_noPID_Tuples.root";
  TString data2015tuple = tuplelocation+"B2DMuNuX_tuples_05082015.root";
  TString MC2015tuple = tuplelocation+"MC_2015_Bu_D0Xmunu_cocktail_12873441_MC2015_S22_noPID_Tuples.root";
  TFile *f[4];
  f[0] = TFile::Open(data2011tuple);
  f[1] = TFile::Open(MC2011tuple);
  f[2] = TFile::Open(data2015tuple);
  f[3] = TFile::Open(MC2015tuple);
  cout<<"files opened"<<endl;
  
  const int nhpc = 2; //number of histograms per canvas
  const int ncanvases = 4;
  const int nstacks = ncanvases;
  THStack *hs[nstacks];
  TCanvas *c[ncanvases];
  TH1F *h[ncanvases][nhpc];
  TLegend *leg[ncanvases];
  TString outputlocation = "output/longtracksplotsunnormalized/";//where the output will be saved
  TString plotfilename = "longtracksplotsunnormalized.pdf";//name of file that will hold drawn plots

  TCanvas *cf = new TCanvas("cf","combined");//canvas to hold everything
  float sqnc = sqrt(ncanvases), sqncu = ceil(sqnc), sqncd = floor(sqnc);
  while(sqncu*sqncd<ncanvases) sqncu++;
  cf->Divide(sqncu,sqncd);
  TLegend *legf = new TLegend(0.84, 0.84, .99, .95);

  TString placeholder; //to avoid adding strings within functions; assign immediately before use
  TString placeholder2;
  
  cout<<"starting canvas loop..."<<endl;
  for(int ci =0; ci<ncanvases; ci++){ //loop over canvases
    //create indicators and strings:
    int year;
    if(ci<(ncanvases/2)){//2011 for 1st half canvases, 2015 for 2nd half
      year = 2011;
    }else year = 2015;
    TString yearstring = Form("%d",year);
    TString filetype; //assigned in histogram loop
    TString tracktype = "nLongTracks";
    int B0;//assigned in histogram loop
    TString Bdecay;
    TString branch;

    TString cistring = Form("%d",ci);
    cout<<"loop "<<ci<<" indicators and strings created:"<<endl<<"year: "<<year<<endl;

    //create the plots
    placeholder = "c"+cistring;
    placeholder2=yearstring+filetype+tracktype;
    c[ci] = new TCanvas(placeholder,placeholder2,1200,800); //create the canvases
    c[ci]->cd();
    gStyle->SetOptStat("");
    leg[ci] = new TLegend(0.7, 0.7, .97, .93);//create legend
    placeholder = "hs"+cistring;
    hs[ci] = new THStack(placeholder,placeholder2); //create the stack to hold the histograms
    cout<<"starting histogram loop..."<<endl;
    for(int hi=0;hi<nhpc;hi++){ //loop over histograms in a canvas; B0=0 and B0=1
      if(hi%2==0){//true every other histogram
        filetype = "data";
      }else filetype = "MC";
      int file_num=-1000;//assign file_num based on combinations of data and MC
      if(year==2011){
        if(filetype=="data") file_num=0;
        if(filetype=="MC") file_num=1;
      }
      if(year==2015){
        if(filetype=="data") file_num=2;
        if(filetype=="MC") file_num=3;
      }
      cout<<"file_num: "<<file_num<<endl;
      if(ci%2 ==0){//every other canvas
        B0=0;
        Bdecay = "B^{-}->(D^{0}->K^{-} #pi^{+})#mu^{-}";
        if((filetype=="data")&&(year==2011)){
          branch="tupleb2D0Mu/tupleb2D0Mu"; 
        } else branch="Tuple_b2D0MuX/DecayTree"; 
      } else{
        B0=1;
        Bdecay = "B^{0}->(D^{-}->K^{+} #pi^{-} #pi^{-})#mu^{+}";
        if((filetype=="data")&&(year==2011)){
          branch="tupleb2DpMu/tupleb2DpMu"; 
        } else branch="Tuple_b2DpMuX/DecayTree"; 
      }
      //create convenient strings
      TString histring = Form("%d",hi);
      TString hname = "h"+cistring+histring;
      
      //create histograms
      if(tracktype=="nLongTracks") h[ci][hi] = new TH1F(hname,tracktype,131,0,262);
      cout<<"histogram loop "<<hi<<" strings and histograms created"<<endl;
      //navigate files
      cout<<"navigating file..."<<endl;
      TTree *MyTree;
//.........这里部分代码省略.........
开发者ID:goi42,项目名称:b-bbar-cross-section-GEC,代码行数:101,代码来源:makeLongTracksonlyunnormalized.C


示例2: main

int main (int argc, char **argv) {
    
    std::string type = argv[1];   // type "gg" or "qq"
    int bin = atoi(argv[2]);
    int binp1 = bin+100;          // pt bin
    int min = atoi(argv[3]);      // events to run over
    int max = atoi(argv[4]);      // events to run over
    std::string tag = argv[5];
    float rVal = atof(argv[6]);
    
    char inName[192];
    //sprintf( inName, "dataProcessedFinal/LHEFiles/%s-pt%04i-%04i-100k.lhe", type.c_str(), bin, bin+100 );
    // sprintf( inName, "dataProcessedFinal/LHEFiles/%s.lhe", type.c_str() );
    sprintf( inName, "dataLHE/%s-pt%04i-%04i-100k.lhe", type.c_str(), bin, bin+100 );
    std::cout << "fname = " << inName << std::endl;
    std::ifstream ifsbkg (inName) ;
    LHEF::Reader reader(ifsbkg) ;

    char outName[192];
    int rInt = (int) (rVal*10.);
    sprintf( outName, "dataProcessedFinalSCOT/boost2013-%s-pt%04i-%04i%s_ak%02i.root", type.c_str(), bin, bin+100, tag.c_str(), rInt );
    TFile *f = TFile::Open(outName,"RECREATE");
    TTree *t = new TTree("t","Tree with vectors");
    t->Branch("njets"      , &njets      );
    t->Branch("jpt"        , &jpt        );
    t->Branch("jeta"       , &jeta       );
    t->Branch("jmass"      , &jmass      );
    t->Branch("jtau1_b1"   , &jtau1_b1   );
    t->Branch("jtau2_b1"   , &jtau2_b1   );
    t->Branch("jtau1_b2"   , &jtau1_b2   );
    t->Branch("jtau2_b2"   , &jtau2_b2   );
    t->Branch("jtau21_b1"   , &jtau21_b1   );
    t->Branch("jtau21_b2"   , &jtau21_b2   );
    t->Branch("jc1_b0"      , &jc1_b0      );
    t->Branch("jc1_b1"      , &jc1_b1      );
    t->Branch("jc1_b2"      , &jc1_b2      );
    t->Branch("jc2_b1"      , &jc2_b1      );
    t->Branch("jc2_b2"      , &jc2_b2      );
    t->Branch("jd2_b1"      , &jd2_b1      );
    t->Branch("jd2_b2"      , &jd2_b2      );
    t->Branch("j_qjetVol"   , &j_qjetVol      );
    t->Branch("j_mass_trim"      , &j_mass_trim      );
    t->Branch("j_mass_mmdt"      , &j_mass_mmdt      );
    t->Branch("j_mass_prun"      , &j_mass_prun      );
    t->Branch("j_mass_sdb2"      , &j_mass_sdb2      );
    t->Branch("j_mass_sdm1"      , &j_mass_sdm1      );
    t->Branch("j_multiplicity"   , &j_multiplicity      );
            
    evtCtr = 0;
    std::vector < fastjet::PseudoJet > particles;

    // loop over events
    while ( reader.readEvent () ) {
        ++evtCtr;
        if (evtCtr % 1000 == 0) std::cout << "event " << evtCtr << "\n";
        if (evtCtr < min) continue;
        if (evtCtr > max) break;
        
        // per event
        particles.clear();
        jpt.clear();
        jeta.clear();
        jmass.clear();
        jtau1_b1.clear();
        jtau2_b1.clear();
        jtau1_b2.clear();
        jtau2_b2.clear();
        jtau21_b1.clear();
        jtau21_b2.clear();
        jc1_b0.clear();
        jc1_b1.clear();
        jc1_b2.clear();
        jc2_b1.clear();
        jc2_b2.clear();
        jd2_b1.clear();
        jd2_b2.clear();
        j_qjetVol.clear();
        j_mass_trim.clear();
        j_mass_mmdt.clear();
        j_mass_prun.clear();
        j_mass_sdb2.clear();
        j_mass_sdm1.clear();
        j_multiplicity.clear();
        
        for (unsigned int i = 0 ; i < reader.hepeup.IDUP.size(); ++i){

            if (reader.hepeup.ISTUP.at(i) == 1){
                float px = reader.hepeup.PUP.at(i).at(0);
                float py = reader.hepeup.PUP.at(i).at(1);
                float pz = reader.hepeup.PUP.at(i).at(2);
                float e  = reader.hepeup.PUP.at(i).at(3);                                    
                particles.push_back( fastjet::PseudoJet( px, py, pz, e ) );
            }   
        }
        analyzeEvent( particles, rVal );
        t->Fill();
        
    }
    
    std::cout << "finish loop" << std::endl;
//.........这里部分代码省略.........
开发者ID:nhanvtran,项目名称:boost2013WG1,代码行数:101,代码来源:anaSubstructure.cpp


示例3: skimTree

void skimTree(std::string inputFile_)
{

  
  TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject(inputFile_.data());
  if (!f) {
    f = new TFile(inputFile_.data());
    f->cd(Form("%s:/tree",inputFile_.data()));
  }
  TTree* fChain = (TTree*)gDirectory->Get("tree");
  cout << "Input file is " << inputFile_ << endl;

  // rename the output file
  std::string remword=".root";
  size_t pos = inputFile_.find(remword);
  std::string forOutput = inputFile_;  
  if(pos!= std::string::npos)
    forOutput.swap(forOutput.erase(pos,remword.length()));   
  std::string endfix = "_filteredtree.root";
  std::string outputFile = forOutput + endfix;
  // now open new root file
  TFile* newfile_data = new TFile(outputFile.data(),"recreate");
  cout << "Output file " << outputFile << endl;

  // clone tree
  TTree* newtree = fChain->CloneTree(0);
  newtree->SetMaxTreeSize(4000000000);
  cout << "Saving "  << endfix << " tree" << endl;

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

  Int_t           eventNo=-1;
  Int_t           runNo=-1;

  vector<int>*     trigResults;
  vector<string>*  trigName;


  bool isData=false;
  if(forOutput.find("DoubleElectron")!= std::string::npos || forOutput.find("DoubleMu")!= std::string::npos)
    isData=true;


  fChain->SetBranchAddress("EvtInfo_EventNum",&eventNo);
  fChain->SetBranchAddress("EvtInfo_RunNum",&runNo);
  if(isData){
    fChain->SetBranchAddress("trigResults", &trigResults);
    fChain->SetBranchAddress("trigName", &trigName);
  }

  Long64_t nlines=0;

  vector<runInfo> myList;

  ifstream fin;

  if(forOutput.find("DoubleElectron")!= std::string::npos)
    fin.open("/data4/syu/52X_533_validation/DoubleElectron_common.txt");
  else if(forOutput.find("DoubleMu")!= std::string::npos)
    fin.open("/data4/syu/52X_533_validation/DoubleMu_common.txt");
  else if(forOutput.find("GluGlu")!= std::string::npos)
    fin.open("/data4/syu/52X_533_validation/MC_common.txt");
  runInfo tempInfo;
  fin >> tempInfo.run >> tempInfo.evt;
  while(!fin.eof())
    {
      nlines++;
      myList.push_back(tempInfo);
      fin >> tempInfo.run >> tempInfo.evt;
    }
  fin.close();

  cout << "There are " << nlines << " lines" << endl;

  ofstream fout;
  fout.open(Form("%s_updated",forOutput.data()));

  Long64_t nPassEvt=0;

  for (Long64_t jentry=0; jentry<nentries;jentry++) {

    
    eventNo = -1;
    runNo = -1;
    trigName = 0;
    trigResults = 0;
    
    fChain->GetEntry(jentry);


    bool passTrigger=false;
    if(isData){

      for(int it=0; it< trigName->size(); it++)
	{
	  std::string thisTrig= trigName->at(it);
	  int results = trigResults->at(it);
//   	  cout << thisTrig << "\t" << results << endl;

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


示例4: bit_combinations

void bit_combinations(const char * filename="counts.root")
{
  TFile * infile = new TFile(filename,"READ");
  TTree * acc = (TTree*) infile->Get("acc");

  // set branch addresses
  Int_t index,runnum,fill_index,fill;
  Double_t t;
  Double_t bbc[8];
  Double_t zdc[8];
  //Double_t vpd[4];
  Double_t vpd[8];
  Double_t tot_bx;
  Int_t blue,yell;
  acc->SetBranchAddress("i",&index);
  acc->SetBranchAddress("runnum",&runnum);
  acc->SetBranchAddress("fi",&fill_index);
  acc->SetBranchAddress("fill",&fill);
  acc->SetBranchAddress("t",&t);
  acc->SetBranchAddress("tot_bx",&tot_bx);
  acc->SetBranchAddress("blue",&blue);
  acc->SetBranchAddress("yell",&yell);
  char bbc_br[8][16];
  char zdc_br[8][16];
  //char vpd_br[4][16];
  char vpd_br[8][16];
  for(Int_t i=0; i<8; i++)
  {
    sprintf(bbc_br[i],"bbc_%d",i);
    sprintf(zdc_br[i],"zdc_%d",i);
    acc->SetBranchAddress(bbc_br[i],&(bbc[i]));
    acc->SetBranchAddress(zdc_br[i],&(zdc[i]));
    //if(i<4) 
    //{
      sprintf(vpd_br[i],"vpd_%d",i);
      acc->SetBranchAddress(vpd_br[i],&(vpd[i]));
    //};
  };

  // ----------------------------------------------

  // total counts vs. scaler bit bar charts
  TH1F * ntot_vs_bits_bbc = new TH1F();
  TH1F * ntot_vs_bits_zdc = new TH1F();
  TH1F * ntot_vs_bits_vpd = new TH1F();


  // scaler bit combination names
  char comb[8][16];
  strcpy(comb[0],"none");
  strcpy(comb[1],"e");
  strcpy(comb[2],"w");
  strcpy(comb[3],"w+e");
  strcpy(comb[4],"x");
  strcpy(comb[5],"x+e");
  strcpy(comb[6],"x+w");
  strcpy(comb[7],"x+w+e");

  // fill bar charts
  for(Int_t i=0; i<acc->GetEntries(); i++)
  {
    acc->GetEntry(i);
    for(Int_t j=0; j<8; j++)
    {
      ntot_vs_bits_bbc->Fill(comb[j],bbc[j]);
      ntot_vs_bits_zdc->Fill(comb[j],zdc[j]);
      //if(j<4) ntot_vs_bits_vpd->Fill(comb[j],vpd[j]);
      ntot_vs_bits_vpd->Fill(comb[j],vpd[j]);
    };
  };

  ntot_vs_bits_bbc->SetStats(0);
  ntot_vs_bits_bbc->SetTitle("total bbc counts vs. scaler bits");
  ntot_vs_bits_bbc->SetBarWidth(0.4);
  ntot_vs_bits_bbc->SetBarOffset(0.55);
  ntot_vs_bits_bbc->SetFillColor(50);
  TCanvas * c_bbc_bits = new TCanvas("c_bbc_bits","c_bbc_bits",700,500);
  c_bbc_bits->SetGrid(0,1);
  c_bbc_bits->SetLogy();
  ntot_vs_bits_bbc->Draw("bar2");

  ntot_vs_bits_zdc->SetStats(0);
  ntot_vs_bits_zdc->SetTitle("total zdc counts vs. scaler bits");
  ntot_vs_bits_zdc->SetBarWidth(0.4);
  ntot_vs_bits_zdc->SetBarOffset(0.55);
  ntot_vs_bits_zdc->SetFillColor(50);
  TCanvas * c_zdc_bits = new TCanvas("c_zdc_bits","c_zdc_bits",700,500);
  c_zdc_bits->SetGrid(0,1);
  c_zdc_bits->SetLogy();
  ntot_vs_bits_zdc->Draw("bar2");

  ntot_vs_bits_vpd->SetStats(0);
  ntot_vs_bits_vpd->SetTitle("total vpd counts vs. scaler bits");
  ntot_vs_bits_vpd->SetBarWidth(0.4);
  ntot_vs_bits_vpd->SetBarOffset(0.55);
  ntot_vs_bits_vpd->SetFillColor(50);
  TCanvas * c_vpd_bits = new TCanvas("c_vpd_bits","c_vpd_bits",700,500);
  c_vpd_bits->SetGrid(0,1);
  c_vpd_bits->SetLogy();
  ntot_vs_bits_vpd->Draw("bar2");
//.........这里部分代码省略.........
开发者ID:c-dilks,项目名称:scalers11t,代码行数:101,代码来源:bit_combinations.C


示例5: main

////////////////////////////////////
//     M      A     I     N      //
///////////////////////////////////
int main(int argc, char **argv)
{

  bool verbose = true;
  bool higgsDecay = true;

  // Define tree to fill
  TFile file(argv[2],"RECREATE");
  TTree* tree = new TTree("tree","tree");

  float mZ, mH, mVH, mT; //masses
  float costheta1, costheta2, costhetastar, phi, phi1; //angles
  float rapidityVH;
  int isLeptonic;
  int isUpTypeQuark;
  int passEta;
  int isWplus;  
  int decayMode;
  float b0_e, b0_eta, b0_phi, b0_pt;
  float b1_e, b1_eta, b1_phi, b1_pt;
  float f0_e, f0_eta, f0_phi, f0_pt;
  float f1_e, f1_eta, f1_phi, f1_pt;
  float V_e, V_eta, V_phi, V_pt;
  float H_e, H_eta, H_phi, H_pt;
  //float VH_e, VH_eta, VH_phi, VH_pt;


  tree->Branch("b0_e",   &b0_e,   "b0_e/F");
  tree->Branch("b0_eta", &b0_eta, "b0_eta/F");
  tree->Branch("b0_phi", &b0_phi, "b0_phi/F");
  tree->Branch("b0_pt",  &b0_pt,  "b0_pt/F");
  tree->Branch("b1_e",   &b1_e,   "b1_e/F");
  tree->Branch("b1_eta", &b1_eta, "b1_eta/F");
  tree->Branch("b1_phi", &b1_phi, "b1_phi/F");
  tree->Branch("b1_pt",  &b1_pt,  "b1_pt/F");
  tree->Branch("f0_e",   &f0_e,   "f0_e/F");
  tree->Branch("f0_eta", &f0_eta, "f0_eta/F");
  tree->Branch("f0_phi", &f0_phi, "f0_phi/F");
  tree->Branch("f0_pt",  &f0_pt,  "f0_pt/F");
  tree->Branch("f1_e",   &f1_e,   "f1_e/F");
  tree->Branch("f1_eta", &f1_eta, "f1_eta/F");
  tree->Branch("f1_phi", &f1_phi, "f1_phi/F");
  tree->Branch("f1_pt",  &f1_pt,  "f1_pt/F");
  tree->Branch("V_e",    &V_e,   "V_e/F");
  tree->Branch("V_eta",  &V_eta, "V_eta/F");
  tree->Branch("V_phi",  &V_phi, "V_phi/F");
  tree->Branch("V_pt",   &V_pt,  "V_pt/F");
  tree->Branch("H_e",    &H_e,   "H_e/F");
  tree->Branch("H_eta",  &H_eta, "H_eta/F");
  tree->Branch("H_phi",  &H_phi, "H_phi/F");
  tree->Branch("H_pt",   &H_pt,  "H_pt/F");
  //tree->Branch("VH_e",   &VH_e,   "VH_e/F");
  //tree->Branch("VH_eta", &VH_eta, "VH_eta/F");
  //tree->Branch("VH_phi", &VH_phi, "VH_phi/F");
  //tree->Branch("VH_pt",  &VH_pt,  "VH_pt/F");
  tree->Branch("mT",     &mT,     "mT/F");
  tree->Branch("mZ",     &mZ,     "mZ/F");
  tree->Branch("mH",     &mH,     "mH/F");
  tree->Branch("mVH",    &mVH,    "mVH/F");
  tree->Branch("costheta1",    &costheta1,    "costheta1/F");
  tree->Branch("costheta2",    &costheta2,    "costheta2/F");
  tree->Branch("costhetastar", &costhetastar, "costhetastar/F");
  tree->Branch("phi",          &phi,          "phi/F");
  tree->Branch("phi1",         &phi1,         "phi1/F");
  tree->Branch("rapidityVH",   &rapidityVH,   "rapidityVH/F");
  tree->Branch("isLeptonic",   &isLeptonic,   "isLeptonic/I");
  tree->Branch("isUpTypeQuark",&isUpTypeQuark,"isUpTypeQuark/I");
  tree->Branch("passEta",      &passEta,      "passEta/I");
  tree->Branch("isWplus",      &isWplus,      "isWplus/I");
  tree->Branch("decayMode",    &decayMode,    "decayMode/I");
  //Zee=0, Zmm=1, Ztt=2, Zuu=3, Zcc=4, Zdd=5, Zss=6, Zbb=7
  //Wen=8, Wmn=9, Wtn=10, Wud=11, Wcs=12
  //Znene=13, Znmnm=14, Zntnt=15

  // Reader object
  cout << "Creating reader object for input LHE file " << argv[1] << endl;
  std::ifstream ifsLHE (argv[1]) ;
  LHEF::Reader lheReader (ifsLHE) ;

  // Loop over events
  int eventCount = 0;
  int hadronicWCount = 0;
  int leptonicWCount = 0;
  int hadronicZCount = 0;
  int leptonicZCount = 0;
  int BR_Zee=0, BR_Zmm=0, BR_Ztt=0, BR_Znn=0, BR_Zuu=0, BR_Zcc=0, BR_Zdd=0, BR_Zss=0, BR_Zbb=0;
  int BR_Wen=0, BR_Wmn=0, BR_Wtn=0, BR_Wud=0, BR_Wcs=0;
  int BR_Znene=0, BR_Znmnm=0, BR_Zntnt=0;

  while ( lheReader.readEvent() ) 
    {
      eventCount++;
      if (eventCount % 100000 == 0 && verbose) std::cout << "Event " << eventCount << "\n" ;

      //Sanity check on number of particles
      if( higgsDecay==1 && lheReader.hepeup.IDUP.size() != 8 ) 
	{
//.........这里部分代码省略.........
开发者ID:benjaminkreis,项目名称:usercode,代码行数:101,代码来源:hbbTreeMaker.cpp


示例6: s_TEST_IdTree

static void s_TEST_IdTree()
{
    typedef CTreePair<int, int>::TTreePair     TTreePair;
    typedef CTreePair<int, int>::TPairTreeNode TTree;

    TTree* tr = new TTree(TTreePair(0, 0));
    
    tr->AddNode(TTreePair(1, 10));
    tr->AddNode(TTreePair(100, 110));
    TTree* tr2 = tr->AddNode(TTreePair(2, 20));
    tr2->AddNode(TTreePair(20, 21));    
    TTree* tr3 =tr2->AddNode(TTreePair(22, 22));
    tr3->AddNode(TTreePair(222, 222));

    {{
    const TTree* tnd = tr->FindSubNode(100);
    assert(tnd);
    assert(tnd->GetValue().id == 100);
    assert(tnd->GetValue().value == 110);
    const TTree& tv = tnd->GetValue();
    assert(tv.GetValue().value == 110);

    }}

    {{
    list<int> npath;
    npath.push_back(2);
    npath.push_back(22);

    TTree::TConstNodeList res;
    tr->FindNodes(npath, &res);
    assert(!res.empty());
    TTree::TConstNodeList::const_iterator it = res.begin();
    const TTree* ftr = *it;

    assert(ftr->GetValue().value == 22);
    }}

    {{
    list<int> npath;
    npath.push_back(2);
    npath.push_back(32);

    TTree::TConstNodeList res;
    tr->FindNodes(npath, &res);
    assert(res.empty());
    }}

    {{
    list<int> npath;
    npath.push_back(2);
    npath.push_back(22);
    npath.push_back(222);
    npath.push_back(100);

    const TTree* node = PairTreeTraceNode(*tr, npath);
    assert(node);
    cout << node->GetValue().id << " " << node->GetValue().value << endl;
    assert(node->GetValue().value == 110);


    node = PairTreeBackTraceNode(*tr3, 1);
    assert(node);
    cout << node->GetValue().id << " " << node->GetValue().value << endl;
    assert(node->GetValue().value == 10);
    }}

    {{
    list<int> npath;
    npath.push_back(2);
    npath.push_back(22);
    npath.push_back(222);

    const TTree* node = PairTreeTraceNode(*tr, npath);
    assert(node);
    cout << node->GetValue().id << " " << node->GetValue().value << endl;
    assert(node->GetValue().value == 222);
    }}

    delete tr;
}
开发者ID:jackgopack4,项目名称:pico-blast,代码行数:81,代码来源:test_algo_tree.cpp


示例7: TFile

void DCTPCTree::Loop()
{
  TStopwatch timer;
  gROOT->SetStyle("Plain");
  gStyle->SetEndErrorSize(3);
  gStyle->SetPalette(1,0);
  gStyle->SetLineWidth(2);
  gStyle->SetHistLineWidth(2);
  gStyle->SetOptStat(kTRUE);
  gStyle->SetOptFit(kTRUE);
  TH1::AddDirectory(false);
  
  TFile *outtree = new TFile("../input_files/hadd_01041_01158.root");//$LittleDCTPC_physics_input
  TTree *dctreepc = (TTree*)outtree->Get("dctpc_eventinfo");
  DCTPCTree aStep(dctreepc);

  Int_t Exposure_sec;
  TTree *dctreepc2 = (TTree*)outtree->Get("dctpc_runinfo");       
  dctreepc2->SetBranchAddress("Exposure_sec", &Exposure_sec);
  Int_t nentries2 = (Int_t)dctreepc2->GetEntries();  
  double totalexposure=0.;
  
  for (int runcounter = 0; runcounter<nentries2; runcounter++)
    {
      dctreepc2->GetEntry(runcounter);
      totalexposure+=Exposure_sec;
    }
  
  ofstream file_passccd;
  file_passccd.open("Pass_CCD.txt");
  ofstream file_passwfandccd;
  file_passwfandccd.open("Pass_WF_and_CCD.txt");
  
  
  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  
  
  double seqcalib [19] = {0.955114 , 1.06241 , 1.07105 , 1.07669 , 1.02827 , 1.15574 , 1.18828 , 1.08779 , 0.998239 , 1.05118 , 1.03128 , 1.02639 , 0.992746 , 0.925486 , 1.1664 , 1.05791, 0.989169};
  
  /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  
  //create event loop
  Long64_t nentries = dctreepc->GetEntries();
  cout << "Number of Entries: " << nentries << endl;
  
  /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  
  int cutnum=-1;
  int neutronnumber=0;
  int passall=0;
  int passccd=0;
  int passwf=0;
  int passwfandccd=0;

  TH1D *hist_time_ccd=new TH1D("CCD Pass Rate", "CCD Pass Rate", 100, 1374000000, 1396000000);
  TH1D *hist_time_wf=new TH1D("WF Pass Rate", "WF Pass Rate", 100, 1374000000, 1396000000);
  TH1D *hist_time_wfandccd=new TH1D("CCD and WF Pass Rate", "CCD and WF Pass Rate", 100, 1374000000, 1396000000);

  TH1D *hist_time_ccd_percent = new TH1D("% Events Pass CCD", "% Events Pass CCD", 100, 1374000000, 1396000000);
  TH1D *hist_time_wfandccd_percent = new TH1D("% Events Pass WF and CCD", "% Events Pass WF and CCD", 100, 1374000000, 1396000000);

  TH2D *hist_ccdpass_rate=new TH2D("CCD Pass", "CCD Pass", 100, 1374000000, 1386000000, 2000, 0, 2000);
  TH2D *hist_wfpass_rate=new TH2D("WF Pass", "WF Pass", 100, 1374000000, 1386000000, 2000, 0, 2000);
  TH2D *hist_wfandccdpass_rate=new TH2D("CCD and WF Pass", "CCD and WF Pass", 100, 1374000000, 1386000000, 2000, 0, 2000);

  TH2D *hist_ccdpass_rate_percent=new TH2D("% CCD Pass", "% CCD Pass", 100, 1374000000, 1396000000, 100, 0, 100);
  TH2D *hist_wfandccdpass_rate_percent=new TH2D("% WF and CCD Pass", "% WF and CCD Pass", 100, 1374000000, 1396000000, 100, 0, 100);

  TH2D *hist_pass_rate=new TH2D("Pass", "Pass", 100, 1374000000, 1386000000, 100, 0, 1);

  TH1D *hist_eff_vs_eccd_ccd=new TH1D("Efficiency vs CCD Energy - CCD Only", "Efficiency vs CCD Energy - CCD Only", 60, 0, 6000);
  TH1D *hist_eff_vs_eccd_ccd2=new TH1D("Efficiency vs CCD Energy - CCD Only 2", "Efficiency vs CCD Energy - CCD Only 2", 25, 0, 1000);
  TH1D *hist_eff_vs_eccd_wfandccd=new TH1D("Efficiency vs CCD Energy - CCD and WF", "Efficiency vs CCD Energy - CCD and WF", 60, 0, 6000);
  TH1D *hist_eff_vs_eccd_wfandccd2=new TH1D("Efficiency vs CCD Energy - CCD and WF 2", "Efficiency vs CCD Energy - CCD and WF 2", 25, 0, 1000);

  TH1D *hist_eff_vs_elength=new TH1D("Efficiency vs Length Energy", "Efficiency vs Length Energy", 60, 0, 6000);
  TH1D *hist_eff_vs_elength2=new TH1D("Efficiency vs Length Energy 2", "Efficiency vs Length Energy 2", 25, 0, 1000);
  TH1D *hist_eff_vs_elength_ccd=new TH1D("Efficiency vs Length Energy - CCD Only", "Efficiency vs Length Energy - CCD Only", 60, 0, 6000);
  TH1D *hist_eff_vs_elength_ccd2=new TH1D("Efficiency vs Length Energy - CCD Only 2", "Efficiency vs Length Energy - CCD Only 2", 25, 0, 1000);
  TH1D *hist_eff_vs_elength_wf=new TH1D("Efficiency vs Length Energy - WF Only", "Efficiency vs Length Energy - WF Only", 60, 0, 6000);
  TH1D *hist_eff_vs_elength_wfandccd=new TH1D("Efficiency vs Length Energy - CCD and WF", "Efficiency vs Length Energy - CCD and WF", 60, 0, 6000);
  TH1D *hist_eff_vs_elength_wfandccd2=new TH1D("Efficiency vs Length Energy - CCD and WF 2", "Efficiency vs Length Energy - CCD and WF 2", 25, 0, 1000);

  /*TH1D *hist_eff_vs_eccd_ccd_percent=new TH1D("%CCD vs Energy", "%CCD vs Energy", 1000, 0, 10000);
  TH1D *hist_eff_vs_eccd_wfandccd_percent = new TH1D("%WF and CCD vs Energy", "%WF and CCD vs Energy", 1000, 0, 10000);
  TH1D *hist_eff_vs_eccd=new TH1D("Efficiency vs CCD Energy", "Efficiency vs CCD Energy", 1000, 0, 10000);*/
  
  /////////////////////////////////////////////////////////////////////////////////////////////////////////////

  for (int event = 0; event<nentries; event++)
    {
      
      aStep.GetEntry(event); 
      if(event%1000000==0)
	cout<<((double)event/(double)nentries)*100.<<"%"<<endl;
      
      r2 = (aStep.Track_x_pix*aStep.Track_x_pix+aStep.Track_y_pix*aStep.Track_y_pix)*pow(MMPERPIXEL/10.,2);
      weight=1./pow(RADIAL_PARAM0_CALIB/(RADIAL_PARAM1_CALIB+r2),RADIAL_PARAM2_CALIB);//radial calibration 
      rho_start=(sqrt(((aStep.Track_x_start_pix*MMPERPIXEL)*(aStep.Track_x_start_pix*MMPERPIXEL))+((aStep.Track_y_start_pix*MMPERPIXEL)*(aStep.Track_y_start_pix*MMPERPIXEL))));
      rho_end=(sqrt(((aStep.Track_x_end_pix*MMPERPIXEL)*(aStep.Track_x_end_pix*MMPERPIXEL))+((aStep.Track_y_end_pix*MMPERPIXEL)*(aStep.Track_y_end_pix*MMPERPIXEL))));
//.........这里部分代码省略.........
开发者ID:tjjjjjjj,项目名称:OLIVIA-DCTPC,代码行数:101,代码来源:DCTPCTree_efficiency_neutronrun.C


示例8: JetResponseMacro_TheDeadlyEagle_Eta

void  JetResponseMacro_TheDeadlyEagle_Eta(){

  gROOT->ProcessLine(".x rootlogon.C");
  gROOT->ProcessLine(".L format1Dhisto.C");
  gROOT->ProcessLine(".L formatTGraph.C");
  gROOT->ProcessLine(".x betterColors.C");

TFile *FileA = TFile::Open(Form("../JEC/Corrected_dijet_pp_mergedpthatbins_2013MCV2.root"));
  //TFile *FileA = TFile::Open(Form("~/rootFiles/JEC/Files/20120521/Correcteddijet_pp_mergedpthatbins_2012MC.root"));
  TString outname = "JetResponse_Plots.root"; 
  TFile* outf = new TFile(outname,"recreate");

  const char* AlgoNames[] = {"ak1PF","ak2PF","ak3PF","ak4PF","ak5PF","ak6PF","ak1Calo","ak2Calo","ak3Calo","ak4Calo","ak5Calo","ak6Calo","icPu5"};
  
  TCanvas *c1 = new TCanvas("c1","c1",1100,700);
  makeMultiPanelCanvas(c1,3,2,0.0,0.0,0.2,0.15,0.07);
  TCanvas *c1B = new TCanvas("c1B","c1B",1100,700);
  makeMultiPanelCanvas(c1B,3,2,0.0,0.0,0.2,0.15,0.07);
  TCanvas *c1C = new TCanvas("c1C","c1C",1100,700);
  makeMultiPanelCanvas(c1C,3,2,0.0,0.0,0.2,0.15,0.07);
  const int cCanDiv = 13;
  int nCanvDiv = cCanDiv;
  const int CnXbins = 30;
  int nXbins = CnXbins;

  TH2D* iHistoCorrEta[cCanDiv];
  TH2D* iHistoRefEta[cCanDiv];
  TH2D* iHistoJtEta[cCanDiv];
  TH2D* iHistoRawEta[cCanDiv];
  TH1D* h1[cCanDiv][CnXbins];
  TF1* Gauss6[cCanDiv][CnXbins];
  double mean[cCanDiv][CnXbins];
  double sigma[cCanDiv][CnXbins];
  double meanErr[cCanDiv][CnXbins];
  double sigmaErr[cCanDiv][CnXbins];
  double xPoint[cCanDiv][CnXbins];
  double xPointErr[cCanDiv][CnXbins];
  TLegend*  leg[cCanDiv];

  for(int i =0; i<nCanvDiv; i++)
    {
if(i==0 || i==6) continue;//skip the ak1 algos
if(i==12) continue;//skip the icpU5 algos
    if(i<=5)c1->cd(i+1);
    if(i>5 && i<12)c1B->cd(i-5);
    if(i>=12)c1C->cd(i-12);
    if(i==0)  TTree* t      = (TTree*)FileA->Get("ak1PFJetAnalyzer/t");
    if(i==1)  TTree* t      = (TTree*)FileA->Get("ak2PFJetAnalyzer/t");
    if(i==2)  TTree* t      = (TTree*)FileA->Get("ak3PFJetAnalyzer/t");
    if(i==3)  TTree* t      = (TTree*)FileA->Get("ak4PFJetAnalyzer/t");
    if(i==4)  TTree* t      = (TTree*)FileA->Get("ak5PFJetAnalyzer/t");
    if(i==5)  TTree* t      = (TTree*)FileA->Get("ak6PFJetAnalyzer/t");
    if(i==6)  TTree* t      = (TTree*)FileA->Get("ak1CaloJetAnalyzer/t");
    if(i==7)  TTree* t      = (TTree*)FileA->Get("ak2CaloJetAnalyzer/t");
    if(i==8)  TTree* t      = (TTree*)FileA->Get("ak3CaloJetAnalyzer/t");
    if(i==9)  TTree* t      = (TTree*)FileA->Get("ak4CaloJetAnalyzer/t");
    if(i==10) TTree* t      = (TTree*)FileA->Get("ak5CaloJetAnalyzer/t");
    if(i==11) TTree* t      = (TTree*)FileA->Get("ak6CaloJetAnalyzer/t");
    if(i==12) TTree* t      = (TTree*)FileA->Get("icPu5JetAnalyzer/t");
      
      leg[i]= new TLegend(0.22,0.63,0.45,0.90);//top right
      leg[i]->SetFillColor(0);
      leg[i]->SetTextSize(0.05);
      leg[i]->SetBorderSize(0);
      
      iHistoCorrEta[i] = new TH2D(Form("%s_CorrEta",AlgoNames[i]),Form("%s_CorrEta",AlgoNames[i]),nXbins,-2,2,500,0,5);
      //t->Draw(Form("corrpt/refpt:jteta>>%s_CorrEta",AlgoNames[i]),Form("corrpt>0 && fabs(jteta)<2.0"),"goff");
      t->Draw(Form("corrpt/refpt:jteta>>%s_CorrEta",AlgoNames[i]),Form("corrpt>5 && refpt>5 && fabs(jteta)<2.0"),"goff");
      iHistoCorrEta[i]->Draw("colz");
      leg[i]->AddEntry(iHistoCorrEta[i],Form("%s |#eta|<2.0",AlgoNames[i]),"");
      leg[i]->AddEntry(iHistoCorrEta[i],Form("Corrected / ref p_{T}"),"");
      format1Dhisto(*iHistoCorrEta[i],250,-1,2,20,2,1,"Jet #eta","Corrected p_{T}/ ref p_{T}");//Red      
      leg[i]->Draw();
      for(int iX=iHistoCorrEta[i]->GetXaxis()->GetFirst(); iX<iHistoCorrEta[i]->GetXaxis()->GetLast(); iX++ )
	{
	  //cout<<"bin ( "<<iX<<" ) --limits ["<<iHistoCorrEta[i]->GetXaxis()->GetBinLowEdge(iX)<<" , "<<iHistoCorrEta[i]->GetXaxis()->GetBinUpEdge(iX)<<" ] "<<endl;
	  h1[i][iX] = new TH1D(Form("h1_%d_%d_py",i,iX),Form("h1_%d_%d_py",i,iX),500,0,5);
	  h1[i][iX] =(TH1D*)iHistoCorrEta[i]->ProjectionY(Form("h1_%d_%d_py",i,iX),iX,iX,"e");
	  Gauss6[i][iX] = new TF1(Form("F6_c%d_d%d",i,iX),"gaus",0,5);
	  Gauss6[i][iX]->SetParLimits(1,0.7,1.5);
	  h1[i][iX]->Fit(Form("F6_c%d_d%d",i,iX),"0Q");
	  mean[i][iX] = Gauss6[i][iX]->GetParameter(1);
	  sigma[i][iX] = Gauss6[i][iX]->GetParameter(2);
	  meanErr[i][iX] = Gauss6[i][iX]->GetParError(1);
	  sigmaErr[i][iX] = Gauss6[i][iX]->GetParError(2);
	  xPoint[i][iX] =iHistoCorrEta[i]->GetXaxis()->GetBinCenter(iX);
	  xPointErr[i][iX] = 0;
	  
	  if(i==0 && iX==1)//Just to test 
	    {
	      TCanvas *c11 = new TCanvas("c11","c11",500,400);
	      c11->cd();	    
	      h1[i][iX]->Draw();
	      Gauss6[i][iX]->Draw("same");
	    }	  
	}

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


示例9: main


//.........这里部分代码省略.........
     s.SetGlobalStringOption("1DStack",           "includeSignal",    "superimposed");
     s.SetGlobalFloatOption ("1DStack",           "factorSignal",     100.0    );

     s.SetGlobalFloatOption ("DataMCRatio",       "min",              0.0    );
     s.SetGlobalFloatOption ("DataMCRatio",       "max",              2.0    );

     s.SetGlobalStringOption("Plot",              "infoTopRight",     "CMS Preliminary");
     s.SetGlobalStringOption("Plot",              "infoTopLeft",      "#sqrt{s} = 8 TeV, L = 19.5 fb^{-1}");

     s.SetGlobalBoolOption  ("Plot",              "exportPdf",        true);
     s.SetGlobalBoolOption  ("Plot",              "exportEps",        false);
     s.SetGlobalBoolOption  ("Plot",              "exportPng",        false);

  // ########################################
  // ##       Run over the datasets        ##
  // ########################################

  vector<string> datasetsList;
  s.GetDatasetList(&datasetsList);

  cout << "   > Reading datasets... " << endl;
  cout << endl;

  for (unsigned int d = 0 ; d < datasetsList.size() ; d++)
  {
     string currentDataset = datasetsList[d];
     string currentProcessClass = s.GetProcessClass(currentDataset);

     sampleName = currentDataset;
     sampleType = s.GetProcessClassType(currentProcessClass);

     // Open the tree
     TFile f((string(FOLDER_BABYTUPLES)+currentDataset+".root").c_str());
     TTree* theTree = (TTree*) f.Get("babyTuple");

     intermediatePointers pointers;
     InitializeBranchesForReading(theTree,&myEvent,&pointers);

     if (sampleType == "signal")
     {
        theTree->SetBranchAddress("mStop",       &(myEvent.mStop));
        theTree->SetBranchAddress("mNeutralino", &(myEvent.mNeutralino));
     }
     else
     {
         myEvent.mStop       = -1;
         myEvent.mNeutralino = -1;
     }

  // ########################################
  // ##        Run over the events         ##
  // ########################################

     bool ttbarDatasetToBeSplitted = false;
      if (findSubstring(currentDataset,"ttbar"))
          ttbarDatasetToBeSplitted = true;

      int nEntries = theTree->GetEntries();
      for (int i = 0 ; i < nEntries ; i++)
      {
          //if (i > float(nEntries) * 0.1) break;

          if (i % (nEntries / 50) == 0) printProgressBar(i,nEntries,currentDataset);

          // Get the i-th entry
          ReadEvent(theTree,i,&pointers,&myEvent);
开发者ID:dtbinh,项目名称:PhDThesisPlotsAndSketches,代码行数:67,代码来源:METresolution.C


示例10: TH2D

void ManagerNucleiCollisions::generateEvents( NucleiCollision *fPtrNuclStruct, int nEvents )
{
    cout << "generating events..." << endl;
    
    //reset all hists
//    fHistSources->Reset();

    TH2D *fHist2D_impParVSnStrings = new TH2D("fHist2D_impParVSnStrings", ";impact parameter, fm;n strings"
                                                , 400, 0, 20, 2001, -0.5 , 2000.5 );



    // ##### 10.07.2016 - save NucleiCollision info into the tree
    TTree *fNucleiCollisionsTree = new TTree("NucleiCollisionsTree","NucleiCollisionsTree");
    const int NMaxStrings = 35000;//8000;

    Float_t fImpactParameter = 0;
    Float_t fNuclTreeRandomEventPlanePhi = 0;
    Float_t fNuclTreeNu = 0;
    Int_t fNuclTreeNumberOfStrings = 0;
    Int_t fMultFromAllStringsFictiveV0 = 0;
    Int_t fMultFromAllStringsFictiveMidEta = 0;
//    Float_t fNuclTreeStringBoostAngle[NMaxStrings];
//    Float_t fNuclTreeStringBoostMagn[NMaxStrings];
    Float_t fDistanceBetweenPartonsForString[NMaxStrings];
    Float_t fNuclTreeStringRadiusVectorAngle[NMaxStrings];
    Float_t fNuclTreeStringX[NMaxStrings];
    Float_t fNuclTreeStringY[NMaxStrings];
    short fStringOrigin[NMaxStrings];
//    Bool_t fNuclTreeIsHardInteractionString[NMaxStrings];

    fNucleiCollisionsTree->Branch("impactParameter",&fImpactParameter,"fImpactParameter/F");
    fNucleiCollisionsTree->Branch("randomEventPlanePhi",&fNuclTreeRandomEventPlanePhi,"fNuclTreeRandomEventPlanePhi/F");
    fNucleiCollisionsTree->Branch("nu",&fNuclTreeNu,"fNuclTreeNu/F");
    fNucleiCollisionsTree->Branch("numberOfStrings",&fNuclTreeNumberOfStrings,"fNuclTreeNumberOfStrings/I");

//    fNucleiCollisionsTree->Branch("stringBoostAngle", fNuclTreeStringBoostAngle,"fNuclTreeStringBoostAngle[fNuclTreeNumberOfStrings]/F");
//    fNucleiCollisionsTree->Branch("stringBoostMagn", fNuclTreeStringBoostMagn,"fNuclTreeStringBoostMagn[fNuclTreeNumberOfStrings]/F");
    fNucleiCollisionsTree->Branch("stringX", fNuclTreeStringX,"fNuclTreeStringX[fNuclTreeNumberOfStrings]/F");
    fNucleiCollisionsTree->Branch("stringY", fNuclTreeStringY,"fNuclTreeStringY[fNuclTreeNumberOfStrings]/F");
    fNucleiCollisionsTree->Branch("distanceBetweenPartonsForString", fDistanceBetweenPartonsForString,"fDistanceBetweenPartonsForString[fNuclTreeNumberOfStrings]/F");
    fNucleiCollisionsTree->Branch("stringRadiusVectorAngle", fNuclTreeStringRadiusVectorAngle,"fNuclTreeStringRadiusVectorAngle[fNuclTreeNumberOfStrings]/F");
    fNucleiCollisionsTree->Branch("stringOrigin", fStringOrigin,"fStringOrigin[fNuclTreeNumberOfStrings]/S");
//    fNucleiCollisionsTree->Branch("isHardInteraction",fNuclTreeIsHardInteractionString,"fNuclTreeIsHardInteractionString[fNuclTreeNumberOfStrings]/O");

    fNucleiCollisionsTree->Branch( "multFromAllStringsFictiveV0", &fMultFromAllStringsFictiveV0,"fMultFromAllStringsFictiveV0/I");
    fNucleiCollisionsTree->Branch( "multFromAllStringsFictiveMidEta", &fMultFromAllStringsFictiveMidEta,"fMultFromAllStringsFictiveMidEta/I");


    // ##### event loop
    for ( int iEvent = 0; iEvent < nEvents; iEvent++)
    {
        if ( iEvent % 10 == 0 )
            cout <<"generating " << (int)iEvent << "\r"; cout.flush();

        //building event, spec impact parameter if requested:
        fPtrNuclStruct->setEventId( iEvent ); //to be used in fPtrNuclStruct for output files (tmp?)
        fPtrNuclStruct->buildEvent();
        //        fPtrNuclStruct->drawEventStructure();

        //need some event checks/triggers here?..
        if ( !fPtrNuclStruct->isMBcollision() )
        {
            iEvent--;
            continue;
        }

        fImpactParameter = fPtrNuclStruct->getImpactParameter();
        fNuclTreeNumberOfStrings = fPtrNuclStruct->getNstrings();
        fNuclTreeRandomEventPlanePhi = fPtrNuclStruct->getRandomEventPlanePhi();
        fNuclTreeNu = fPtrNuclStruct->getNu();
        fMultFromAllStringsFictiveV0 = fPtrNuclStruct->getMultFromAllStringsFictiveV0();
        fMultFromAllStringsFictiveMidEta = fPtrNuclStruct->getMultFromAllStringsFictiveMidEta();
        //cout << fMultFromAllStringsFictive << endl;

        if ( fNuclTreeNumberOfStrings >= NMaxStrings )
        {
            cout << "AHTUNG: fNuclTreeNumberOfStrings >= NMaxStrings!!!" << endl;
            return;
        }

        // ##### loop over strings
        for ( int iString = 0; iString < fNuclTreeNumberOfStrings; iString++)
        {
//            fNuclTreeStringBoostAngle[iString] = fPtrNuclStruct->getStringBoostAngle(iString);
//            fNuclTreeStringBoostMagn[iString] = fPtrNuclStruct->getStringBoostMagn(iString);
            fNuclTreeStringRadiusVectorAngle[iString] = fPtrNuclStruct->getStringRadiusVectorAngle(iString);
            fNuclTreeStringX[iString] = fPtrNuclStruct->getStringXminusBover2(iString);
            fNuclTreeStringY[iString] = fPtrNuclStruct->getStringY(iString);
            fStringOrigin[iString] = fPtrNuclStruct->getStringOrigin(iString);
            fDistanceBetweenPartonsForString[iString] = fPtrNuclStruct->getDistanceBetweenPartonsForString(iString);
//            fNuclTreeIsHardInteractionString[iString] = fPtrNuclStruct->isHardInteractionString(iString);
        }

        fHist2D_impParVSnStrings->Fill( fImpactParameter, fNuclTreeNumberOfStrings );

        fNucleiCollisionsTree->Fill();

    } // end of the event loop

//.........这里部分代码省略.........
开发者ID:altsybee,项目名称:MISE,代码行数:101,代码来源:ManagerNucleiCollisions.cpp


示例11: loop

void loop(){

	TFile *F=new TFile("TTree_SingleMu_Onia2MuMu_v20_PromptReco_AB.root","READ"); 
	TTree *tree = (TTree*)F->FindObjectAny("data"); 
	int entries = tree->GetEntries(); 
	set_branches(tree);
	
	double pt_bins[]={10,20,30,40,50,60,70,100};
	double dR_bins[]={0,0.25,0.3,0.35,0.4,0.8,1,1.5};
	int ndR=sizeof(dR_bins)/sizeof(double)-1; 
	int npT=sizeof(pt_bins)/sizeof(double)-1;
	//TEfficiency *rho = new TEfficiency("TEff_rho_pt","#rho p_{T}; p_{T}(#mu#mu) [GeV]; #rho",7,pt_bins); 
	
	CreateHistogram("hpt_lead","p_{T}(#mu) of higher p_{T} muon","p_{T}(#mu) [GeV]","#rho",100,0,100); 
	CreateHistogram("hpt_trail","p_{T}(#mu) of lower p_{T} muon","p_{T}(#mu) [GeV]","#rho",100,0,100); 

	CreateHistogram("h_mass_pt0","M_{#mu#mu}, p_{T}<35","M_{#mu#mu}","Events",100,8.5,11.5); 
	CreateHistogram("h_mass_pt1","M_{#mu#mu}, p_{T}>35","M_{#mu#mu}","Events",100,8.5,11.5); 

	CreateHistogram("h_massTrig_pt0","M_{#mu#mu}, p_{T}<35","M_{#mu#mu}","Events",100,8.5,11.5); 
	CreateHistogram("h_massTrig_pt1","M_{#mu#mu}, p_{T}>35","M_{#mu#mu}","Events",100,8.5,11.5); 
	
	CreateHistogram("DeltaRPtE_num","#DeltaR_p_{T}^{ellpictic}","#DeltaR_p_{T}^{ellpictic}","",100,0,3); 
	CreateHistogram("DeltaRPtE_num_uW","#DeltaR_p_{T}^{ellpictic}","#DeltaR_p_{T}^{ellpictic}","",100,0,3); 
	CreateHistogram("DeltaRPtE_den","#DeltaR_p_{T}^{ellpictic}","#DeltaR_p_{T}^{ellpictic}","",100,0,3); 

	
	CreateHistogram("hpt_den","#rho denominator","p_{T} [GeV]","",9,10,100); 
	CreateHistogram("hpt_num_uW","#rho numerator","p_{T} [GeV]","",9,10,100); 
	CreateHistogram("hpt_num","#rho numerator","p_{T} [GeV]","",9,10,100); 

	CreateHistogram("mass","mass","M_{#mu#mu}","",100,8.5,11.5); 
	
	CreateHistogram("mass_DeltaRPtE_num","M_{#mu#mu}","M_{#mu#mu}","#DeltaR_p_{T}^{ellpictic}",100,8.5,11.5,100,0,3);
	CreateHistogram("mass_DeltaRPtE_den","M_{#mu#mu}","M_{#mu#mu}","#DeltaR_p_{T}^{ellpictic}",100,8.5,11.5,100,0,3);

	
	CreateHistogram("mass_y0_DeltaRPtE_numBin","M_{#mu#mu}","M_{#mu#mu}","#DeltaR_p_{T}^{ellpictic}",100,8.5,11.5,ndR,dR_bins);
	CreateHistogram("mass_y0_DeltaRPtE_numBin_uW","M_{#mu#mu}","M_{#mu#mu}","#DeltaR_p_{T}^{ellpictic}",100,8.5,11.5,ndR,dR_bins);
	CreateHistogram("mass_y0_DeltaRPtE_denBin","M_{#mu#mu}","M_{#mu#mu}","#DeltaR_p_{T}^{ellpictic}",100,8.5,11.5,ndR,dR_bins);

	CreateHistogram("mass_y1_DeltaRPtE_numBin","M_{#mu#mu}","M_{#mu#mu}","#DeltaR_p_{T}^{ellpictic}",100,8.5,11.5,ndR,dR_bins);
	CreateHistogram("mass_y1_DeltaRPtE_numBin_uW","M_{#mu#mu}","M_{#mu#mu}","#DeltaR_p_{T}^{ellpictic}",100,8.5,11.5,ndR,dR_bins);
	CreateHistogram("mass_y1_DeltaRPtE_denBin","M_{#mu#mu}","M_{#mu#mu}","#DeltaR_p_{T}^{ellpictic}",100,8.5,11.5,ndR,dR_bins);


	CreateHistogram("mass_pt","M_{#mu#mu}","p_{T} [GeV]","",100,8.5,11.5,npT,pt_bins);
	CreateHistogram("mass_pt_num","M_{#mu#mu}","p_{T} [GeV]","",100,8.5,11.5,npT,pt_bins);
	CreateHistogram("mass_pt_num_uW","M_{#mu#mu}","p_{T} [GeV]","",100,8.5,11.5,npT,pt_bins);

	CreateHistogram("DeltaRPtE_pt","#DeltaR_p_{T}^{ellpictic} vs p_{T}","p_{T} [GeV]", "#DeltaR_p_{T}^{ellpictic}",9,10,100,20,0,3); 
	CreateHistogram("DeltaRPtE_pt_Trig","#DeltaR_p_{T}^{ellpictic} vs p_{T}","p_{T} [GeV]", "#DeltaR_p_{T}^{ellpictic}",9, 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ TTrigger类代码示例发布时间:2022-05-31
下一篇:
C++ TTool类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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