QIE10 Chip Test:

  • Macro to plot two set of data corresponding two different Ranges:
void trans() {


TFile f1 = new TFile("basic2.root","READ");
TTree *t1 = (TTree
)f1->Get("ntuple");
TFile f2 = new TFile("basic3.root","READ");
TTree *t2 = (TTree
)f2->Get("ntuple");

float Charge,Mantissa;
std::vector<float> q1;
std::vector<float> m1;
std::vector<float> q2;
std::vector<float> m2;

t1->SetBranchAddress("Charge",&Charge);
t1->SetBranchAddress("Mantissa",&Mantissa);

int nEvents = t1->GetEntries();

//loop over all events
for(int j = 0;j < nEvents; ++j)
{
t1->GetEntry(j);
q1.push_back(Charge);
m1.push_back(Mantissa);
}
TGraph *g1 = new TGraph(q1.size(),&(q1[0]),&(m1[0]));

t2->SetBranchAddress("z",&Charge);
t2->SetBranchAddress("x",&Mantissa);

int nEvents = t2->GetEntries();

//loop over all events
for(int j = 0;j < nEvents; ++j)
{
t2->GetEntry(j);
q2.push_back(Charge);
m2.push_back(Mantissa);
}
TGraph *g2 = new TGraph(q2.size(),&(q2[0]),&(m2[0]));

TMultiGraph *mg = new TMultiGraph();
mg->Add(g1);
mg->Add(g2);

g1->SetLineColor(2);
g1->SetMarkerColor(2);

mg->Draw("ALP");

}

  • The files can be .dat or .txt extension
Edit | Attach | Watch | Print version | History: r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r1 - 2013-06-03 - HectorHernandez
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback