ADC and TDC

Hello

I posted a topic for how drawing a histogram for big file text
and i got this code

[code]{
TFile *f = TFile::Open(“MyData.root”, “RECREATE”);
TTree *t = new TTree(“t”, “My Data tree”);
t->ReadFile(“MyData.txt”, “tdc[10]/s:adc[10]/s”);
TH1F *h_tdc = new TH1F(“h_tdc”, “TDC histogram;tdc value;counts”,
4096, 0, 4096);
TH1F h_adc = new TH1F(“h_adc”, “ADC histogram;adc value;counts”,
4096, 0, 4096);
#if 1 /
0 or 1 /
t->Project(“h_tdc”, “tdc”);
t->Project(“h_adc”, “adc”);
#else /
0 or 1 /
t->Draw(“tdc >> h_tdc”, “”, “goff”);
t->Draw(“adc >> h_adc”, “”, “goff”);
#endif /
0 or 1 */
f->Write();

TCanvas *c = new TCanvas(“c”, “c”);
c->Divide(1, 2);
c->cd(1);
gPad->SetLogy(1);
h_tdc->Draw();
c->cd(2);
gPad->SetLogy(1);
h_adc->Draw();
c->cd(0);
}[/code]

Now i want to divide TDC to 5 in the right and 5 to the left and same for ADC
so i have to have 20 diagrams
Thanks
MyData.txt (674 KB)

You can draw (or project) individual channels using, for example, something like:
t->Draw(“tdc[0]”);

t->Draw(“tdc[9]”);
t->Draw(“adc[0]”);

t->Draw(“adc[9]”);
For more explanations see the TTree::Draw and TTree::Project descriptions.

Can someone help me to get start from 1 instead of O
so having [1]…[10] instead to [0]…[9]

In general, in C/C++, if you have an array of n elements (i.e. array[n]) then the index of the first element is 0 and the index of the last element is n-1 (i.e. the first element is array[0] and the last element is array[(n-1)]).