void plotallped(int chip = 0,const int runnb = 1,const char *title = "") { char name[100]; Char_t iChan; // Channel number Char_t iChip; // Channel number UShort_t iClLength; //number of samples UInt_t iEventnb; Int_t iSamples[1024]; // Samples Int_t iMax = 0; TH1F* hSignal[16]; TCanvas *c1 = new TCanvas("c1","Single cluster",600,600); sprintf(name, "readout-%i_0.root", runnb); TFile *inFile = new TFile(name); TTree *tree = (TTree*) inFile->Get("tree"); c1->Divide(4,4); if(!tree) { cerr << "Tree SALTRO events was not found: " << name << "\n"; return; } // tree->Show(iEntry); tree->SetBranchAddress("iEventnb",&iEventnb); tree->SetBranchAddress("iSamples",&iSamples); tree->SetBranchAddress("iChan",&iChan); tree->SetBranchAddress("iChip",&iChip); tree->SetBranchAddress("iClLength",&iClLength); Int_t nentries = tree->GetEntries(); printf("ENTRIES %d\n",nentries); for (Int_t j = 0; j < 16; j++) { sprintf(name, "hSignal_%d", j); hSignal[j] = ((TH1F *)(gROOT->FindObject(name))); if (hSignal[j]) delete hSignal[j]; hSignal[j] = new TH1F(name, "",1024,-0.5,1023.5); hSignal[j]->SetMinimum(0); // hSignal[j]->SetMaximum(1024); } gStyle->SetOptStat(1100); for (Int_t j = 0; j < nentries; j++) { tree->GetEntry(j); for(Int_t l = 20; l < iClLength - 20; l++) { hSignal[iChan]->Fill(iSamples[l]); } } // Print in pedestal file format for chip=7 for (Int_t j = 0; j < 16; j++) { printf("%d\t%d\t%5.2f\t%5.3f\t%5.1f\n",j+112,(int)hSignal[j]->GetMean(), hSignal[j]->GetMean(),hSignal[j]->GetRMS(),hSignal[j]->GetEntries()); } for (Int_t j = 0; j < 16; j++) { c1->cd(j+1); sprintf(name, "Pedestals ch %d chip %d %s", j,chip,title); hSignal[j]->SetTitle(name); hSignal[j]->GetYaxis()->SetTitle("Entries"); hSignal[j]->GetXaxis()->SetTitle("ADC value"); // hSignal[j]->SetAxisRange(0, 1023, "X"); hSignal[j]->SetAxisRange(0, 200, "X"); hSignal[j]->Draw(); printf("%d\t%5.2f\t%5.3f\t%5.1f\n",j+iChip*16,hSignal[j]->GetMean(),hSignal[j]->GetRMS(),hSignal[j]->GetEntries()); } sprintf(name, "ch-all-chip%d-%d-ped-%s.pdf",chip,runnb,title); c1->SaveAs(name); }