コード例 #1
0
ファイル: dumpSome.C プロジェクト: frmeier/usercode
void dumpSome(string infile, string field, string obj = "lb", string addCut = "")
{
    TFile* tfIn = TFile::Open(infile.c_str(), "READ");
    if (tfIn == 0)
    {
	cout << "Problem opening infile \"" << infile << "\" - exting";
	return;
    }
    TTree* intree = (TTree*) tfIn->Get("events");
    // cut selection
    Cuts cut;
    if (obj == "lb") cut.selectCut("acc03","lb07");
    if (obj == "B0") cut.selectCut("acc03B0","B001");
    //if (obj == "B0") cut.selectCut("acc03B0","B001exp");

    if (addCut.size() > 0)
	intree->Draw(">>lst", (cut.getCut()+"&&"+addCut).c_str());
    else
	intree->Draw(">>lst", cut.getCut().c_str());
    TEventList *lst = (TEventList*)gDirectory->Get("lst");
    intree->SetEventList(lst);

    intree->SetScanField(-1);
    intree->Scan(field.c_str());
}
コード例 #2
0
ファイル: twodimvar.C プロジェクト: asmagina1995/roottest
void tscan(const char *input) {

   TFile* tf = new TFile(input);
   TTree* tree = (TTree*)tf->Get("tree");
   tree->Draw("aa[][]");
   tree->SetScanField(0);
   tree->Scan("aa");

}
コード例 #3
0
ファイル: runtreefriend.C プロジェクト: asmagina1995/roottest
void DrawFriend() {
  // Draw a scatter plot of variable x in the parent TTree versus
  // the same variable in the subtree.
  // This should produce points along a straight line.
   
   TFile *f  = TFile::Open("treeparent.root");
   TTree *T  = (TTree*)f->Get("T");
   T->AddFriend("TF","treefriend.root");
   T->SetScanField(0);
   T->Scan("x:TF.x","","",20);
}
コード例 #4
0
ファイル: make_run_table.C プロジェクト: c-dilks/scalers13pol
void make_run_table(const char * infile="rtree.root")
{
  TFile * tf = new TFile(infile,"READ");
  TTree * tr = (TTree*) tf->Get("rellum");
  tr->SetScanField(0);
  char outfile[64];
  strcpy(outfile,"run_table.txt");
  gSystem->RedirectOutput(outfile,"w");
  tr->Scan("i:runnum:fi:fill");
  gSystem->RedirectOutput(0);
  printf("%s created\n",outfile);
};
コード例 #5
0
ファイル: dumpTrees.c プロジェクト: HuguesBrun/WWAnalysis
void dumpTrees(TString dir = "zz4lTree", const char *cut="", int maxEvents = 200, const char *process=0) {
    TTree *Events = (TTree *) gFile->Get(dir+"/probe_tree");
    if (Events == 0) { std::cerr << "Didn't find " << dir << " in file " << gFile->GetName() << std::endl; return; }
    Events->SetScanField(0);
    if (dir.Contains("4l") || dir.Contains("4L")) {
        Events->Scan("event:mass:m4l:z1mass:z2mass:l1pdgId:l1pt:l1eta:l2pt:l2eta:l3pdgId:l3pt:l3eta:l4pt:l4eta:massErr:melaLD:pho1pt:pho1eta:pho2pt:pho2eta:jet1pt:jet1eta:jet2pt:jet2eta:mjj:njets30",cut,"",maxEvents);
    //} else if (dir.Contains("anyZllTree")) {
    //    Events->Scan("event:zmass:l1pdgId:l1pt:l1eta:l2pt:l2eta:l1pfIsoComb04EACorr/l1pt:l2pfIsoComb04EACorr/l2pt:l1sip:l2sip",cut,"",maxEvents);
    } else if (dir.Contains("muonTree")) {
        Events->Scan("event:pt:eta:phi:looseID:newID:prlID:mvaISO:sip:pfIsoComb04EACorr:bdtIso:mvaISO:pfIsoChHad04:pfIsoNHad04_NoEA:pfIsoPhot04_NoEA:pfIsoEAtot:rho:rhoAA",cut,"",maxEvents);
    } else if (dir.Contains("electronTree")) {
        Events->Scan("event:pt:eta:phi:looseID:newID:prlID:sip:pfIsoComb04EACorr:bdtIso:bdtID:mvaISO:mvaID:pfIsoChHad04:pfIsoNHad04_NoEA:pfIsoPhot04_NoEA:pfIsoEAtot:rho:rhoAA",cut,"",maxEvents);
    } else if (dir.Contains("jetTree")) {
        Events->Scan("event:pt:eta:phi:passID:passPUID:puJetIDMask:jetIDMVA",cut,"",maxEvents);
    } else if (dir.Contains("photonTree")) {
        Events->Scan("event:pt:eta:phi:deltaR:eleMatch:lepMatchNoIso:lepMatch:pfIsoChHad03pt02:pfIsoNHad03:pfIsoPhot03:pfIsoChHadPU03pt02",cut,"",maxEvents);
    } else if (dir.Contains("zeetree")) {
        Events->Scan("event:zmass:zmll:l1pt:l1eta:l1phi:l2pt:l2eta:l2phi:fsr:phopt:phoeta:phophi",cut,"",maxEvents);
    } else if (dir.Contains("zmmtree")) {
        Events->Scan("event:zmass:zmll:l1pt:l1eta:l1phi:l2pt:l2eta:l2phi:fsr:phopt:phoeta:phophi",cut,"",maxEvents);
    }
}
コード例 #6
0
ファイル: runnestedind.C プロジェクト: asmagina1995/roottest
int runnestedind() {
   TTree *t = create();
   t->SetScanField(0);

   t->Scan("type[]:type[sonind[]]","type[]==3");
   TH1I* hgood = new TH1I("hgood","works",10,0,10);
   TH1I* hbad = new TH1I("hbad","used to fail",10,0,10);
   TCanvas *c = new TCanvas("c1");
   c->Divide(1,2);
   c->cd(1);
   t->Draw("type[sonind[]]>>hbad","type[]==3");
   c->cd(2);   
   t->Draw("type[sonind[]]>>hgood","type[]==3 && sonind[]>=0");

   if (hgood->GetMean()!=hbad->GetMean()) {
      cout << "Drawing \"type[sonind[]]>>hbad\",\"type[]==3\" failed!\n";
      return 1;
   }
#ifdef ClingWorkAroundErracticValuePrinter
   printf("(int)0\n");
#endif
   return 0;
}