Blame | Last modification | View Log | RSS feed
#define tree_cxx
#include "tree.h"
#include <TH2.h>
#include <TStyle.h>
#include <TCanvas.h>
#include <TMath.h>
#include <iostream>
void tree::Loop(int mode, TString ext)
{
// In a ROOT session, you can do:
// Root > .L tree.C
// Root > tree 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;
int snp=0;
TCanvas *c=0;
gStyle->SetOptStat(0) ;
//gROOT->ForceStyle();
//gStyle->SetTitleSize(0.2);
TString pdfname("tmp.pdf");
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;
TString msn=*sn;
TObjArray *ppname = msn.Tokenize("_");
int snid = (((TObjString *)(ppname->At(0)))->String()).Atoi();
cout << "Event" << voltage << " " << temp << " " << *id << " " << snid << qdc2->GetMean() <<endl;
qdc2->SetTitle( Form("T=%d V=%d sn=",temp, voltage, snid ) );
//qdc2->SetTitleSize(5.2,"t");
if (snp!=snid){
if (c){
c->Modified();
c->Update();
if (ext.Length()>2) c->Print(pdfname, ext);
}
pdfname=TString("results/")+*id + "_"+*sn+ Form("_%d.", mode) + ext;
c= new TCanvas(*sn,*id + " "+*sn,600,900);
c->Divide(5,12,0,0.01,0.01);
}
snp = snid;
c->cd((temp+30)/5*5+(voltage/100-1)+1);
if (mode==2 || mode==3) gPad->SetLogz(1) ;
else gPad->SetLogz(0) ;
if (mode==6) gPad->SetLogy(1) ;
else gPad->SetLogy(0) ;
switch (mode){
case 0: qdc2->DrawCopy(); break;
case 1: qdc2->DrawCopy(); break;
case 2: dpo2->DrawCopy("col"); break;
case 3: dpo3->DrawCopy("col"); break;
case 4: tdc2->GetXaxis()->SetRangeUser(86, 92); tdc2->DrawCopy(); break;
case 5: tdc3->GetXaxis()->SetRangeUser(128, 132); tdc3->DrawCopy(); break;
case 6: {
TGraph *gr=(TGraph *)thscan->Clone();
gr->Draw("awl");
gr->GetXaxis()->SetRangeUser(0,TMath::Power(2,voltage/100)*33);
break;}
case 7: cout << thscan->GetName()<<" " << thscan->GetN() << endl; break;
}
}
c->Modified();
c->Update();
if (ext.Length()>2) c->Print(pdfname,ext);
}