modified readRawTrace.C
This commit is contained in:
parent
8eaffa22ff
commit
d79ea1a783
|
@ -10,6 +10,7 @@
|
||||||
#include <TF1.h>
|
#include <TF1.h>
|
||||||
#include <TLatex.h>
|
#include <TLatex.h>
|
||||||
#include <TLine.h>
|
#include <TLine.h>
|
||||||
|
#include <TBox.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
void readRawTrace(TString fileName, int minDetID = 0, int maxDetID = 1000){
|
void readRawTrace(TString fileName, int minDetID = 0, int maxDetID = 1000){
|
||||||
|
@ -41,15 +42,17 @@ void readRawTrace(TString fileName, int minDetID = 0, int maxDetID = 1000){
|
||||||
UShort_t trace[1024];
|
UShort_t trace[1024];
|
||||||
UShort_t traceLength;
|
UShort_t traceLength;
|
||||||
Int_t QDC[8];
|
Int_t QDC[8];
|
||||||
|
ULong64_t time;
|
||||||
tree->SetBranchAddress("detID", &detID);
|
tree->SetBranchAddress("detID", &detID);
|
||||||
tree->SetBranchAddress("trace", trace);
|
tree->SetBranchAddress("trace", trace);
|
||||||
tree->SetBranchAddress("trace_length", &traceLength);
|
tree->SetBranchAddress("trace_length", &traceLength);
|
||||||
tree->SetBranchAddress("qdc", QDC);
|
tree->SetBranchAddress("qdc", QDC);
|
||||||
|
tree->SetBranchAddress("e_t", &time);
|
||||||
|
|
||||||
TLatex text ;
|
TLatex text ;
|
||||||
text.SetNDC();
|
text.SetNDC();
|
||||||
text.SetTextFont(62);
|
text.SetTextFont(62);
|
||||||
text.SetTextSize(0.06);
|
text.SetTextSize(0.05);
|
||||||
text.SetTextColor(2);
|
text.SetTextColor(2);
|
||||||
|
|
||||||
bool breakFlag = false;
|
bool breakFlag = false;
|
||||||
|
@ -57,6 +60,11 @@ void readRawTrace(TString fileName, int minDetID = 0, int maxDetID = 1000){
|
||||||
int oldEv = 0;
|
int oldEv = 0;
|
||||||
|
|
||||||
TGraph * g = new TGraph();
|
TGraph * g = new TGraph();
|
||||||
|
|
||||||
|
int QDCsum[8] = {0}; ///directly sum from trace
|
||||||
|
double x[9] = {0, 31, 60, 75, 95, 105, 160, 175, 200};
|
||||||
|
Color_t color[8] = {4, kGreen+2, 4, kGreen+2, 4, kGreen+2, 4, kGreen+2};
|
||||||
|
|
||||||
|
|
||||||
for( int ev = 0; ev < totnumEntry; ev++){
|
for( int ev = 0; ev < totnumEntry; ev++){
|
||||||
|
|
||||||
|
@ -66,25 +74,41 @@ void readRawTrace(TString fileName, int minDetID = 0, int maxDetID = 1000){
|
||||||
}
|
}
|
||||||
tree->GetEntry(ev);
|
tree->GetEntry(ev);
|
||||||
|
|
||||||
|
|
||||||
if( !(minDetID <= detID && detID <= maxDetID ) ) continue;
|
if( !(minDetID <= detID && detID <= maxDetID ) ) continue;
|
||||||
|
|
||||||
printf("-------------------------------- ev : %d \n", ev);
|
printf("-------------------------------- ev : %d \n", ev);
|
||||||
|
|
||||||
printf("id : %d, trace Length : %u ( enter = next , q = stop, w = last)\n", detID, traceLength);
|
printf("id : %d, trace Length : %u, time: %16llu ( enter = next , q = stop, w = last)\n", detID, traceLength, time);
|
||||||
|
|
||||||
g->Clear();
|
g->Clear();
|
||||||
g->Set(traceLength);
|
g->Set(traceLength);
|
||||||
for( int k = 0; k < traceLength ; k++) g->SetPoint(k, k, trace[k]);
|
|
||||||
|
int minY = 9999, maxY = 0;
|
||||||
|
for( int i = 0 ; i < 8; i++) QDCsum[i] = 0;
|
||||||
|
|
||||||
g->SetTitle(Form("ev: %d, id : %d, trace Length : %u\n", ev, detID, traceLength));
|
for( int k = 0; k < traceLength ; k++) {
|
||||||
|
g->SetPoint(k, k, trace[k]);
|
||||||
|
for( int i = 0; i < 8; i++) if( x[i] <= k && k < x[i+1] ) QDCsum[i] += trace[k];
|
||||||
|
if( trace[k] > maxY ) maxY = trace[k];
|
||||||
|
if( trace[k] < minY ) minY = trace[k];
|
||||||
|
}
|
||||||
|
|
||||||
|
g->SetTitle(Form("ev: %d, id : %d, trace Length : %u, time: %16llu\n", ev, detID, traceLength, time));
|
||||||
|
|
||||||
cRead->cd(1);
|
cRead->cd(1);
|
||||||
cRead->Clear();
|
cRead->Clear();
|
||||||
g->Draw("AL");
|
g->Draw("AL");
|
||||||
|
|
||||||
for( int i = 0; i < 8; i++) text.DrawLatex(0.2, 0.8-0.05*i, Form("%d", QDC[i]));
|
text.SetTextColor(kRed);
|
||||||
|
text.DrawLatex(0.12, 0.85, Form("QDC, QDCtrace (diff)"));
|
||||||
|
for( int i = 0; i < 8; i++) {
|
||||||
|
text.SetTextColor(color[i]);
|
||||||
|
text.DrawLatex(0.12, 0.8-0.05*i, Form("%d, %d (%+-d)", QDC[i], QDCsum[i], QDC[i]-QDCsum[i]));
|
||||||
|
|
||||||
|
TBox * box = new TBox(x[i], minY, x[i+1], maxY);
|
||||||
|
box->SetFillColorAlpha(color[i], 0.1);
|
||||||
|
box->Draw("same");
|
||||||
|
}
|
||||||
cRead->Update();
|
cRead->Update();
|
||||||
gSystem->ProcessEvents();
|
gSystem->ProcessEvents();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user