Commit 8122863f authored by Muzalevsky I.A's avatar Muzalevsky I.A

Merge branch 'master' of http://er.jinr.ru:90/vratislav.chudoba/NeuRad_tests

Conflicts:
	dataClasses/AEvent.h
parents de01b6ad 5eb9075c
......@@ -14,9 +14,9 @@ int main(int argc, char* argv[])
{
//to be extracted from the source as parameters
const Int_t noBranches = 4;
const Int_t noBranches = 2;
const Double_t cfRatio = 0.3;
const Double_t cfTD = 1.5; //in ns
const Double_t cfTD = 0.6; //in ns
Double_t noiseMin = 5;
Double_t noiseMax = 25;
Int_t nump = 5; //number of points for smoothing
......
......@@ -5,86 +5,93 @@
#include "TError.h"
#include "TTree.h"
#include "../dataClasses/RawEvent.h"
//#include "../dataClasses/RawEvent.h"
void read2()
{
// std::cout << argv[1] << "says hello, " << argv[2] << "!" << std::endl;
// std::cout << infiles << "says hello, " << ofile << "!" << std::endl;
// return 0;
// find . -type f | wc -l для подсчёта файлов в папке
// cout << gSystem->Load("../libData.so") << endl;
gSystem->Load("../libData.so");
Double_t A1[1000],A2[1000];
Double_t T1[1000],T2[1000];
Int_t k,n,p,Nchannel,nHun,nDec;
using std::cout;
using std::endl;
Int_t k,n,p,Nchannel,nHun,nDec,counter;
TString line1,line2,filename1,filename2;
Double_t amp1,amp2,time1,time2;
const Int_t nfiles = 400;
const Int_t Nlines = 500;
const Int_t nfiles = 5000;
const Int_t NEvents = 1000;
//Double_t A1[1000],A2[1000];
//Double_t T1[1000],T2[1000];
p=0;
TFile *f1 = new TFile("../data/rawDataTektronix/GSItests/1000v_5mv.root","RECREATE");
//TFile *f1 = new TFile("1000V_10mv.root","RECREATE");
TTree *rtree = new TTree("rtree","signal");
TFile *f1 = new TFile("source.root","RECREATE");
TTree *tree = new TTree("rtree","signal");
tree->Branch("A1",A1,"A1[1000]/D");
tree->Branch("A2",A2,"A2[1000]/D");
/* rtree->Branch("A1",A1,"A1[1000]/D");
rtree->Branch("A2",A2,"A2[1000]/D");
tree->Branch("T1",T1,"T1[1000]/D");
tree->Branch("T2",T2,"T2[1000]/D");
rtree->Branch("T1",T1,"T1[1000]/D");
rtree->Branch("T2",T2,"T2[1000]/D");*/
ifstream myfile1,myfile2;
Int_t i=0;
//for(Int_t i=0;i<nfiles;i++)
{
nHun = (i%1000 - i%100)/100; // изза кривых названий файла приходится выяснять количетсво единиц, сотен, десятков, в данноом числе.
nDec = (i%100 - i%10)/10; // делю на соответствующие числа для получения цифры
n = i%10;
filename1.Form("../data/rawDataTektronix/SORCE/trigger_10mv/C2BCF12_H9500_1000_ToT00%d%d%d.txt",nHun,nDec,n);
myfile1.open("../data/rawDataTektronix/SORCE/trigger_10mv/try.txt");
if (myfile1.is_open()) {cout<<"file opened "<<filename1.Data()<<endl;}
else{
Error("read2.cpp", "Some error when opening file %s", filename1.Data());
return;
}
filename2.Form("../data/rawDataTektronix/SORCE/nontrigger_10mV/C3BCF12_H9500_1000_ToT00%d%d%d.txt",nHun,nDec,n);
RawEvent *event1 = new RawEvent(1000);
rtree->Bronch("ch0.", "RawEvent", &event1);
RawEvent *event2 = new RawEvent(1000);
rtree->Bronch("ch1.", "RawEvent", &event2);
RawEvent *event3 = new RawEvent(1000);
rtree->Bronch("ch2.", "RawEvent", &event3);
RawEvent *event4 = new RawEvent(1000);
rtree->Bronch("ch3.", "RawEvent", &event4);
counter = 0;
ifstream myfile1,myfile2; // i=0;
for(Int_t i=0; i<nfiles; i++) { if(i%1000==0){ cout<<i<<endl;}
filename1.Form("../data/rawDataTektronix/muzalevsky/1000V_trigg5mv_nosurce/1000V_5.2mv_nosource%dWfm_Ch1.txt",i+1);
myfile1.open(filename1.Data());
if (myfile1.is_open()) {
filename2.Form("../data/rawDataTektronix/muzalevsky/1000V_trigg5mv_nosurce/1000V_5.2mv_nosource%dWfm_Ch2.txt",i+1);
myfile2.open(filename2.Data());
if (myfile2.is_open()) {/*cout<<"file opened "<<filename2.Data()<<endl;*/}
else{
Error("read2.cpp", "Some error when opening file %s", filename2.Data());
return;
}
for(Int_t j=0;j<5;j++){// пропускаю первые 5 строк
line1.ReadLine(myfile1);
line2.ReadLine(myfile2);
//cout<<line1<<endl;
}
for(Int_t j =0;j<Nlines;j++){
if(j==1) break;
if (myfile2.is_open()) {
p++;
for(Int_t j =0;j<NEvents;j++){
line1.ReadLine(myfile1);
line2.ReadLine(myfile2);
//cout<<line1<<endl;
if( line1.IsNull() || line2.IsNull() ) break;
sscanf(line1.Data(), "%lf", &amp1);
sscanf(line2.Data(), "%lf", &amp2);
//cout<<line1.Data()<<endl;
//cout<<amp1<<" "<<j<<endl;
time1 = j*0.1;
time2 = j*0.1;
sscanf(line1.Data(), "%e%*c%e", &amp1, &time1);
sscanf(line2.Data(), "%f%*c%f", &amp2, &time2);
cout<<line1.Data()<<endl;
cout<<amp1<<" "<<time1<<endl;
//cout<<amp2<<" "<<time2<<endl;
A1[j] = amp1; T1[j] = time1;
A2[j] = amp2; T2[j] = time2;
event1->SetAmp(amp1, j);
event2->SetAmp(amp2, j);
event1->SetTime(time1, j);
event2->SetTime(time2, j);
}
tree->Fill();
rtree->Fill();
counter++;
//cout<<counter<<" events founded"<<endl;
for(j=0;j<Nlines;j++){ // reset
T1[j]=0; T2[j]=0;
A1[j]=0;A2[j]=0;
for(j=0;j<NEvents;j++){ // reset
event1->Reset();
event2->Reset();
}
myfile1.close();
myfile2.close();
}
tree->Write();
else{
Error("read2.cpp", "Some error when opening file %s", filename2.Data());
return;
}
}
else{
Error("read2.cpp", "Some error when opening file %s", filename1.Data());
return;
}//*/
} //for
cout << p << " files processed" << endl;
rtree->Write();
f1->Close();
}
......@@ -6,7 +6,6 @@
*/
#include "AEvent.h"
AEvent::AEvent() : fNPoints(1024) { //fNPoints is number of points in one event, 1024 or 1000
Init();
......@@ -66,7 +65,7 @@ void AEvent::ProcessEvent(Bool_t bSmooth) {
SetChargeLED();
SetChargeTF();
SetToT();
SetThreshold();
// SmoothGraphs();
return;
......@@ -96,6 +95,8 @@ void AEvent::Reset() {
fChargeCFD = -10.;
fChargeLED = -10.;
fTimeFront = -100.;
fTimeThreshBack = -100.;
fTimeThresh = -100.;
}
void AEvent::SetInputEvent(RawEvent** event) {
......@@ -185,7 +186,7 @@ void AEvent::SetCFD() {
Int_t i = 0; //for graph
//while goes by the graph with the step of timeStep
while( mytime < (200. - fCFtimeDelay) ) {
while( mytime < (fTimeLast - fCFtimeDelay) ) {
ampCFD = fGraphSignal->Eval(mytime)*fCFratio*(-1) + fGraphSignal->Eval(mytime - fCFtimeDelay);
fGraphCFD->SetPoint(i, mytime, ampCFD);
......@@ -223,7 +224,7 @@ void AEvent::FindFrontProperties() {
const Double_t timeStep = 0.05; //in ns
Double_t time = 0; //in ns
Double_t mytime = 0.;
Double_t mytime = fTimeAmpMax;
if (!fGraphSignal) {
Warning("AEvent::FindFrontProperties", "Graph was not set");
......@@ -261,14 +262,12 @@ void AEvent::FindFrontProperties() {
b = fit1->GetParameter(0);
line->SetParameter(0,b);
line->SetParameter(1,a);
//cout<<"par 0 "<<b<<endl;
//cout<<"par 1 "<<a<<endl;
if( a!= 0. && b!= 0. ) { //in case of fit data is empty
while(line->Eval(mytime) <= 0 && mytime <= 200.) {
while(line->Eval(mytime) >=0 && mytime <= fTimeLast && mytime>=0) {
//cout<< "mytime "<<mytime<<endl;
fTimeFront = mytime;
mytime = mytime + timeStep;
mytime = mytime - timeStep;
}
}
......@@ -299,7 +298,7 @@ void AEvent::SetChargeCFD(Int_t tmin, Int_t tmax) { // tmin = -3, tmax = 17
Double_t integral = 0.; //voltage
Double_t time_sig = 0; //approximate signal duration in seconds
const Double_t res = 50.; //resistance 50 Om
time_sig = (double)(-tmin + tmax)*(1e-9);
time_sig = (double)(-tmin + tmax);
/*for(Int_t i = 0; i < fNPoints; i++) {
if( fTime[i] > (fTimeCFD + tmin) && fTime[i] < (fTimeCFD + tmax) ) {
......@@ -326,7 +325,7 @@ void AEvent::SetChargeLED(Int_t tmin, Int_t tmax) { // tmin = -3, tmax = 17
Double_t integral = 0.; //voltage
Double_t time_sig = 0; //approximate signal duration in seconds
const Double_t res = 50.; //resistance 50 Om
time_sig = (double)(-tmin + tmax)*(1e-9);
time_sig = (double)(-tmin + tmax);
/* for(Int_t i = 0; i < fNPoints; i++) {
if( fTime[i] > (fTimeLED + tmin) && fTime[i] < (fTimeLED + tmax) ) {
......@@ -354,7 +353,7 @@ void AEvent::SetChargeTF(Int_t tmin, Int_t tmax) { // tmin = -3, tmax = 17
Double_t integral = 0.; //voltage
Double_t time_sig = 0; //approximate signal duration in seconds
const Double_t res = 50.; //resistance 50 Om
time_sig = (double)(-tmin + tmax)*(1e-9);
time_sig = (double)(-tmin + tmax);
Int_t imin = 0, imax = 0;
......@@ -379,6 +378,10 @@ Double_t AEvent::GetfLED() {
return fTimeLED;
}
Double_t AEvent::GetfThresh() {
return fTimeThresh;
}
Double_t AEvent::GetOnefTime(Int_t i) {
return fTime[i];
}
......@@ -403,6 +406,14 @@ Double_t AEvent::GetEdgeXi() {
return fEdgeXi;
}
Double_t AEvent::GetfChargeCFD() {
return fChargeCFD;
}
Double_t AEvent::GetfChargeTF() {
return fChargeTF;
}
void AEvent::SetMaxAmplitudes() {
Double_t maxAmp = 0.;
Double_t maxAmpT = 0.;
......@@ -416,7 +427,7 @@ void AEvent::SetMaxAmplitudes() {
}
fAmpMax = maxAmp;
fTimeAmpMax = maxAmpT;
fTimeLast = fTime[fNPoints-1];
}
void AEvent::SetLED(Double_t threshold) {
......@@ -432,16 +443,36 @@ void AEvent::SetLED(Double_t threshold) {
}
void AEvent::SetThreshold(Double_t thresholdBack, Double_t threshRise) {
Double_t time = fTimeAmpMax;
const Double_t timeStep = 0.05;
while( time < fTimeLast && fGraphSignal->Eval(time) >= thresholdBack ) {
fTimeThreshBack = time;
time = time + timeStep;
}
time = fTimeAmpMax;
while( time >0 && fGraphSignal->Eval(time) >= threshRise) {
fTimeThresh = time;
time = time - timeStep;
}
//fTimeLED = time; найти номера точек которые лежат на 3 нс раньше и на 20 нс позже чем точка с временем timeled (искать точки в пределах условных)
// сделать через функцию getpoint и цикл по точкам от
}
void AEvent::SetToT() {
Double_t time = fTimeMid;
Double_t timeBack = 0;
const Double_t ns = 15.; //withing this interval signal should end for sure, in nanosec
Double_t time = fTimeAmpMax;
Double_t timeBack;
const Double_t ns = 10.; //withing this interval signal should end for sure, in nanosec
const Double_t timeStep = 0.05;
//cout<<"fAmpMid "<<fAmpMid<<endl;
while( fGraphSignal->Eval(time) >= fAmpMid && time < fTimeMid + ns) {
while( fGraphSignal->Eval(time) >= fAmpMid && time < fTimeLast) {
//cout<<"timeback "<<timeBack<<endl;
//cout<<"fGraphSignal->Eval(time) "<<fGraphSignal->Eval(time)<<endl;
//cout<<endl;
......
......@@ -50,7 +50,11 @@ private:
TArrayD fAmpCFD; //array for CFD amplitudes (attenuated, inversed and delayed)
Double_t fTimeCFD; //zero-crossing time
<<<<<<< HEAD
Double_t fChargeCFD;
=======
Double_t fChargeCFD; //
>>>>>>> 5eb9075c10d86d66bba9b5c694fbdb722d11105d
Double_t fChargeLED; //charge of the signal in Coulomb
Double_t fChargeTF; //
......
This diff is collapsed.
......@@ -5,16 +5,16 @@
void histCorrNew01 (
//01 means it is used for channels 0 and 1
// const char *filename = "analysis_07_8.root", //considered non-collimated
const char *filename = "analysis_07_8.root", //considered non-collimated
// const char *filename = "analysis_07_2.root", //collimated?
// const char *filename = "analysis_07_4.root",
const char *filename = "analysis_08_2.root",
// const char *filename = "analysis_08_2.root",
const char *foldername = "7_8/chpair01",
// const char *ext = ".eps",
const char *ext = ".gif",
const Bool_t can1 = 0, const Bool_t can2 = 0,
const Bool_t can3 = 0, const Bool_t can4 = 1)
const Bool_t can1 = 1, const Bool_t can2 = 0,
const Bool_t can3 = 0, const Bool_t can4 = 0)
//const Bool_t can5 = 0, const Bool_t can6 = 0)
{
using std::cout;
......@@ -29,11 +29,12 @@ void histCorrNew01 (
if(can1){
TCanvas *c1 = new TCanvas("c1", "Correlation pictures for non-collimated data: delta t and integrals");
c1->Divide(2,2);
// c1->Divide(2,2);
c1->cd(1);
TH2F *h1 = new TH2F("h1", "front time tau vs charge TF 0 ", 200, 0 ,0.5e-9, 100, 5, 15 );
t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach0.fChargeTF >> h1","","col");
/* c1->cd(1);
TH2F *h1 = new TH2F("h1", "front time tau vs charge TF 0 ", 200, 0 ,1.0e-9, 200, -40, 40 );
// t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach0.fChargeTF >> h1","","col");
t->Draw(" Ach0.fTimeLED - Ach1.fTimeLED : Ach0.fChargeLED >> h1","","col");
//x
h1->GetXaxis()->SetTitle("Charge [C]");
h1->GetXaxis()->CenterTitle();
......@@ -44,8 +45,9 @@ void histCorrNew01 (
c1->Update();
c1->cd(2);
TH2F *h2 = new TH2F("h2", "front time tau vs charge TF 1 ", 200, 0, 0.5e-9, 200, 5 ,15);
t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach1.fChargeTF >> h2","","col");
TH2F *h2 = new TH2F("h2", "front time tau vs charge TF 1 ", 200, 0, 0.5e-9, 200, -20 ,30);
// t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach1.fChargeTF >> h2","","col");
t->Draw(" Ach0.fTimeLED - Ach1.fTimeLED : Ach1.fChargeLED >> h2","","col");
//x
h2->GetXaxis()->SetTitle("Charge [C]");
h2->GetXaxis()->CenterTitle();
......@@ -56,8 +58,9 @@ void histCorrNew01 (
c1->Update();
c1->cd(3);
TH2F *h3 = new TH2F("h3", "charge TF 1 vs charge TF 0", 200, 0 ,0.5e-9, 200, 0, 0.5e-9);
t->Draw(" Ach0.fChargeTF : Ach1.fChargeTF >> h3","","col");
TH2F *h3 = new TH2F("h3", "charge TF 1 vs charge TF 0", 400, 0.02 ,0.7e-9, 400, 0.06, 0.5e-9);
// t->Draw(" Ach0.fChargeTF : Ach1.fChargeTF >> h3","","col");
t->Draw(" Ach0.fChargeLED : Ach1.fChargeLED >> h3","","col");
//x
h3->GetXaxis()->SetTitle("Charge_0 [C]");
h3->GetXaxis()->CenterTitle();
......@@ -66,7 +69,62 @@ void histCorrNew01 (
h3->GetYaxis()->CenterTitle();
c1->Update();
*/
//pictures for latex report, LED
c1->Divide(2,1);
c1->cd(1);
TH2F *h2 = new TH2F("h2", "time difference (LED method) vs charge of non-trigger channel ", 100, -12 ,5, 100, 0, 0.17e-9);
// t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach1.fChargeTF >> h2","","col");
t->Draw(" Ach1.fChargeLED : Ach0.fTimeLED - Ach1.fTimeLED >> h2","","col");
//x
h2->GetXaxis()->SetTitle("time [ns]");
h2->GetXaxis()->CenterTitle();
//y
h2->GetYaxis()->SetTitle("Q [C]");
h2->GetYaxis()->CenterTitle();
c1->Update();
c1->cd(2);
TH2F *h3 = new TH2F("h3", "charge of trigger channel vs charge of non-trigger channel", 400, 0.02 ,0.7e-9, 400, 0.06, 0.5e-9);
// t->Draw(" Ach0.fChargeTF : Ach1.fChargeTF >> h3","","col");
t->Draw(" Ach0.fChargeLED : Ach1.fChargeLED >> h3","","col");
//x
h3->GetXaxis()->SetTitle("Q_{0} [C]");
h3->GetXaxis()->CenterTitle();
//y
h3->GetYaxis()->SetTitle("Q_{1} [C]");
h3->GetYaxis()->CenterTitle();
c1->Update();
//pictures for latex report, CFD
/* c1->Divide(2,1);
c1->cd(1);
TH2F *h2 = new TH2F("h2", "time difference (CFD method) vs charge of non-trigger channel ", 100, -12 ,5, 100, 0, 0.17e-9);
// t->Draw(" Ach0.fTimeFront - Ach1.fTimeFront : Ach1.fChargeTF >> h2","","col");
t->Draw(" Ach1.fChargeCFD : Ach0.fTimeCFD - Ach1.fTimeCFD >> h2","","col");
//x
h2->GetXaxis()->SetTitle("time [ns]");
h2->GetXaxis()->CenterTitle();
//y
h2->GetYaxis()->SetTitle("Q [C]");
h2->GetYaxis()->CenterTitle();
c1->Update();
c1->cd(2);
TH2F *h3 = new TH2F("h3", "charge of trigger channel vs charge of non-trigger channel", 400, 0.02 ,0.7e-9, 400, 0.06, 0.5e-9);
// t->Draw(" Ach0.fChargeTF : Ach1.fChargeTF >> h3","","col");
t->Draw(" Ach0.fChargeCFD : Ach1.fChargeCFD >> h3","","col");
//x
h3->GetXaxis()->SetTitle("Q_{0} [C]");
h3->GetXaxis()->CenterTitle();
//y
h3->GetYaxis()->SetTitle("Q_{1} [C]");
h3->GetYaxis()->CenterTitle();
*/
c1->Update();
// c1->Print(Form("../macros/picsDRS4/file%s/time_front_corr1%s", foldername, ext));
}
......
......@@ -10,9 +10,9 @@ void histCorrNew02 (
// const char *ext = ".eps",
const char *ext = ".gif",
const Bool_t can1 = 0, const Bool_t can2 = 0,
const Bool_t can1 = 1, const Bool_t can2 = 0,
const Bool_t can3 = 0, const Bool_t can4 = 0,
const Bool_t can5 = 0 , const Bool_t can6 = 1)
const Bool_t can5 = 0, const Bool_t can6 = 0)
{
using std::cout;
using std::endl;
......@@ -29,7 +29,7 @@ void histCorrNew02 (
c1->Divide(2,2);
c1->cd(1);
TH2F *h1 = new TH2F("h1", "front time tau vs charge TF 0 ", 200, 0 ,0.5e-9, 100, 5, 15 );
TH2F *h1 = new TH2F("h1", "front time tau vs charge TF 0 ", 200, 0 ,1.0e-9, 200, -40, 40 );
t->Draw(" Ach0.fTimeFront - Ach2.fTimeFront : Ach0.fChargeTF >> h1","","col");
//x
h1->GetXaxis()->SetTitle("Charge [C]");
......@@ -41,7 +41,7 @@ void histCorrNew02 (
c1->Update();
c1->cd(2);
TH2F *h2 = new TH2F("h2", "front time tau vs charge TF 2 ", 200, 0, 0.5e-9, 200, 5 ,15);
TH2F *h2 = new TH2F("h2", "front time tau vs charge TF 2 ", 200, 0, 0.5e-9, 200, -20 ,30);
t->Draw(" Ach0.fTimeFront - Ach2.fTimeFront : Ach2.fChargeTF >> h2","","col");
//x
h2->GetXaxis()->SetTitle("Charge [C]");
......@@ -53,7 +53,7 @@ void histCorrNew02 (
c1->Update();
c1->cd(3);
TH2F *h3 = new TH2F("h3", "charge TF 2 vs charge TF 0", 200, 0 ,0.5e-9, 200, 0, 0.5e-9);
TH2F *h3 = new TH2F("h3", "charge TF 2 vs charge TF 0", 200, 0 ,2.0e-9, 200, 0, 2.0e-9);
t->Draw(" Ach0.fChargeTF : Ach2.fChargeTF >> h3","","col");
//x
h3->GetXaxis()->SetTitle("Charge_0 [C]");
......
#include "TH2F.h"
#include "TH3F.h"
#include "TStyle.h"
void histPresent (
const char *filename = "analysis_07_8.root",
// const char *filename = "analysis_07_8_smooth.root",
// const char *filename = "analysis_08_2.root",
// const char *filename = "analysis_08_2_smooth.root",
const char *foldername = "nustar_present",
// const char *ext = ".eps",
const char *ext = ".pdf",
const Bool_t can1 = 1, const Bool_t can2 = 1,
const Bool_t can3 = 1, const Bool_t can4 = 0)
//const Bool_t can5 = 0/*, const Bool_t can6 = 0*/)
{
using std::cout;
using std::endl;
gSystem->Load("../libData.so");
TFile *f = new TFile(Form("../data/dataDSR4/%s", filename));
TTree *t = (TTree*)f->Get("atree");
if(can1){
TCanvas *c1 = new TCanvas("c1", "canvas 1");
c1->Divide(2,2);
c1->cd(1);
//TH1F *h1 = new TH1F("h1", "CFD", 50, -15, 15);
TH1F *h1 = new TH1F("h1", "CFD", 50, 0, 20);
t->Draw("Ach0.fTimeCFD - Ach1.fTimeCFD >> h1","Ach0.fTimeCFD>100. && Ach0.fTimeCFD<160 && Ach1.fTimeCFD>100. && Ach1.fTimeCFD<160","");
//x
h1->GetXaxis()->SetTitle("Time difference [ns]");
h1->GetXaxis()->CenterTitle();
//h1->Fit("gaus", "","",-3,2);
h1->Fit("gaus", "","",8,13);
gStyle->SetOptFit();
c1->Update();
c1->cd(2);
//TH1F *h2 = new TH1F("h2", "LED",50, -10, 10);
TH1F *h2 = new TH1F("h2", "LED",50, 0, 20);
t->Draw("Ach0.fTimeLED - Ach1.fTimeLED >> h2","Ach0.fTimeLED>100. && Ach0.fTimeLED < 150 && Ach1.fTimeLED>100 && Ach1.fTimeLED < 150","col");
//x
h2->GetXaxis()->SetTitle("Time difference [ns]");
h2->GetXaxis()->CenterTitle();
//h2->Fit("gaus", "","",-3,1);
h2->Fit("gaus", "","",7,12);
gStyle->SetOptFit();
c1->Update();
/* c1->cd(3);
//TH1F *h3 = new TH1F("h3", "Front edge fit crossing zero level", 100, -20, 20);
TH1F *h3 = new TH1F("h3", "Front edge fit crossing zero level", 100,0, 20);
t->Draw("Ach0.fTimeFront - Ach1.fTimeFront >> h3","Ach0.fTimeFront>100. && Ach0.fTimeFront < 150 && Ach1.fTimeFront>100 && Ach1.fTimeFront < 150","col");
//x
h3->GetXaxis()->SetTitle("Time difference [ns]");
h3->GetXaxis()->CenterTitle();
//h3->Fit("gaus", "","",-3,2);
h3->Fit("gaus", "","",9,12);
gStyle->SetOptFit();*/
c1->cd(3);
//TH1F *h3 = new TH1F("h3", "Front edge fit crossing zero level", 100, -20, 20);
TH1F *h3 = new TH1F("h3", "Middle point of front level", 100,1, 20);
t->Draw("Ach0.fTimeMid - Ach1.fTimeMid >> h3","","col");
//x
h3->GetXaxis()->SetTitle("Time difference [ns]");
h3->GetXaxis()->CenterTitle();
//h3->Fit("gaus", "","",-3,2);
h3->Fit("gaus", "","",9,12);
gStyle->SetOptFit();
c1->Update();
c1->cd(4);
//TH1F *h4 = new TH1F("h4", "the middle point of front edge", 50, -10, 10);
TH1F *h4 = new TH1F("h4", "the 10 percent point of front edge", 80, 1, 20);
t->Draw("Ach0.fTime10 - Ach1.fTime10 >> h4","","");
h4->GetXaxis()->SetTitle("Time difference [ns]");
h4->GetXaxis()->CenterTitle();
//h4->Fit("gaus","","",-3,1);
h4->Fit("gaus","","",9,13);
gStyle->SetOptFit();
c1->Print(Form("../macros/picsDRS4/%s/Smoothed_deltas%s", foldername, ext));
}
if(can2){
TCanvas *c2 = new TCanvas("c2", "canvas 2");
c2->Divide(2,2);
c2->cd(1);
//TH1F *h1 = new TH1F("h1", "CFD", 50, -15, 15);
TH1F *h5 = new TH1F("h5", "ToT", 50, 0, 12);
t->Draw("Ach0.fToT >> h5","Ach0.fToT > 0","");
//x
h5->GetXaxis()->SetTitle("Time over threshold [ns]");
h5->GetXaxis()->CenterTitle();
//h1->Fit("gaus", "","",-3,2);
//h1->Fit("gaus", "","",8,13);
//gStyle->SetOptFit();
c2->Update();
c2->cd(2);
//TH1F *h2 = new TH1F("h2", "LED",50, -10, 10);
TH1F *h6 = new TH1F("h6", "ToT",50, 0, 12);
t->Draw("Ach1.fToT >> h6","Ach1.fToT > 0","col");
//x
h6->GetXaxis()->SetTitle("Time over threshold [ns]");
h6->GetXaxis()->CenterTitle();
//h2->Fit("gaus", "","",-3,1);
//h2->Fit("gaus", "","",7,12);
//gStyle->SetOptFit();
c2->Update();
c2->cd(3);
//TH1F *h3 = new TH1F("h3", "Front edge fit crossing zero level", 100, -20, 20);
TH1F *h7 = new TH1F("h7", "Middle point of front level", 80,1, 20);
t->Draw("Ach0.fTimeMid - Ach1.fTimeMid >> h7","Ach0.fToT > 2. && Ach0.fToT < 6. && Ach1.fToT > 2. && Ach1.fToT < 6. ","col");
//x
h7->GetXaxis()->SetTitle("Time difference [ns]");
h7->GetXaxis()->CenterTitle();
//h3->Fit("gaus", "","",-3,2);
h7->Fit("gaus", "","",9,12);
gStyle->SetOptFit();
c2->Update();
c2->cd(4);
//TH1F *h4 = new TH1F("h4", "the middle point of front edge", 50, -10, 10);
TH1F *h8 = new TH1F("h8", "the 10 percent point of front edge", 80, 1, 20);
t->Draw("Ach0.fTime10 - Ach1.fTime10 >> h8"," Ach0.fToT > 2. && Ach0.fToT < 6. && Ach1.fToT > 2. && Ach1.fToT < 6.","");
h8->GetXaxis()->SetTitle("Time difference [ns]");
h8->GetXaxis()->CenterTitle();
//h4->Fit("gaus","","",-3,1);
h8->Fit("gaus","","",9,13);
gStyle->SetOptFit();
c2->Print(Form("../macros/picsDRS4/%s/Smoothed_deltas_tot_corr%s", foldername, ext));
}
if(can3){
TCanvas *c3 = new TCanvas("c3", "canvas 3");
c3->Divide(2,2);
c3->cd(1);
TH1F *h9 = new TH1F("h9", "Charge CFD", 200, 0 ,0.5e-9);
t->Draw("Ach0.fChargeCFD >> h9","","");
c3->Update();
c3->cd(2);
TH1F *h10 = new TH1F("h10", "Charge LED",200, 0 ,0.5e-9);
t->Draw("Ach0.fChargeLED >> h10","","");
c3->Update();
c3->cd(3);
TH1F *h11 = new TH1F("h11", "Sum of charges CFD for 4 channels",200, 0 ,10e-9);
t->Draw("Ach0.fChargeCFD + Ach1.fChargeCFD + Ach2.fChargeCFD + Ach3.fChargeCFD >> h11","","");
c3->Update();
c3->cd(4);
TH1F *h12 = new TH1F("h12", "Sum of charges LED for 4 channels",200, 0 ,10e-9);
t->Draw("Ach0.fChargeLED + Ach1.fChargeLED + Ach2.fChargeLED + Ach3.fChargeLED >> h12","","");
c3->Update();
}
}
{
gSystem->Load("../libData.so");
TFile *f = new TFile("../data/dataDSR4/Neurad_081216_2NEW.root");
TFile *f = new TFile("../data/dataDSR4/analysis_07_8.root");
TTree *tr = (TTree*)f->Get("atree");
const Int_t nP = 1024;
......
......@@ -3,10 +3,13 @@ void testShowCFD()
gSystem->Load("../libData.so");
const Long64_t kFirstEvent = 128;
const Long64_t kFirstEvent = 133;
const char *foldername = "nustar_present";
const char *ext = ".pdf";
// TFile fr("../data/dataDSR4/analysis_08_2_CFD02_06.root");
TFile fr("../data/dataDSR4/analysis_08_2.root");
// TFile fr("../data/dataDSR4/analysis_08_2.root");
TFile fr("../data/dataDSR4/analysis_08_2_smooth.root");
TTree *tr = (TTree*)fr.Get("atree");
AEvent *revent = new AEvent();
......@@ -23,12 +26,32 @@ void testShowCFD()
TCanvas *c1 = new TCanvas("c1","CFD implementation",10,10,1000,600);
c1->Divide(3,4);
for (Int_t i = 0; i < 12; i++) {
// four event picture
/* c1->Divide(2,2);
for (Int_t i = 0; i < 4; i++) {
c1->cd(i+1);
gr[i]->Draw("");
gr[i]->GetXaxis()->SetRangeUser(130, 175);
gr[i]->GetXaxis()->SetTitle("Time [ns]");
gr[i]->GetXaxis()->CenterTitle();
gr[i]->GetYaxis()->SetTitle("Signal CFD [V]");
gr[i]->GetYaxis()->CenterTitle();
gr[i]->Draw("AL*");
}
c1->Print(Form("../macros/picsDRS4/%s/Signal_shapes_CFD%s", foldername, ext));*/
//one event picture
gr[2]->GetXaxis()->SetRangeUser(130, 160);
gr[2]->GetXaxis()->SetTitle("Time [ns]");
gr[2]->GetXaxis()->CenterTitle();
gr[2]->GetYaxis()->SetTitle("Signal [V]");
gr[2]->GetYaxis()->CenterTitle();
gr[2]->Draw("AL*");
//f1->SetRange(t10[2], t90[2]);
//gr[2]->Fit(f1, "RQ");
c1->Print(Form("../macros/picsDRS4/%s/CFD_one_signal_shape%s", foldername, ext));
// c1->cd(2);
// tr->Draw("gAmp.Draw()","","goff",1,124);
......
......@@ -13,21 +13,22 @@ void testShowGraphs()
gStyle->SetCanvasDefH(900);
gStyle->SetCanvasDefW(1500);
const char *foldername = "7_8";
const char *ext = ".gif";
// const char *foldername = "7_8";
const char *foldername = "nustar_present";
const char *ext = ".pdf";
gSystem->Load("../libData.so");
const Long64_t kFirstEvent = 128;
const Long64_t kFirstEvent = 110;
// TFile fr("../data/dataDSR4/Neurad_7_08_NEW.root");
// TFile fr("../data/dataDSR4/analysis_07_8.root");
TFile fr("../data/dataDSR4/analysis_07_8.root");
// TFile fr("../data/dataDSR4/Neurad_081216_2NEW.root");
// TFile fr("../data/dataTektronix/exp18.root");
TFile fr("../data/dataDSR4/analysis_07_8.root");
//TFile fr("../data/dataDSR4/analysis_07_8_smooth.root");
// TFile fr("../data/dataDSR4/Neurad_081216_2NEW.root");
// TFile fr("../data/dataTektronix/exp18.root");
......@@ -60,15 +61,13 @@ void testShowGraphs()
}//for over events
TCanvas *c1 = new TCanvas("c1","test",10,10,1000,600);
c1->Divide(2,2);
TF1 *f1 = new TF1("f1name", "[0]+x*[1]");
// TF1 *f1 = new TF1("pol1", );
TCanvas *c1 = new TCanvas("c1","Signal shape",10,10,1000,600);
//c1->Divide(3,4);
// four event picture
c1->Divide(2,2);
for (Int_t k = 0; k < 4; k++) {
c1->cd(k+1);
gr[k]->GetXaxis()->SetRangeUser(130, 175);
......@@ -81,7 +80,42 @@ void testShowGraphs()
//f1->SetRange(t10[k], t90[k]);
//gr[k]->Fit(f1, "RQ");
}
//c1->Print(Form("../macros/picsDRS4/file%s/signals%s", foldername, ext));
// c1->cd(2);
// tr->Draw("gAmp.Draw()","","goff",1,124);
c1->Print(Form("../macros/picsDRS4/%s/Signal_shapes_bad%s", foldername, ext));
// one event picture
/* gr[4]->GetXaxis()->SetRangeUser(130, 160);
gr[4]->GetXaxis()->SetTitle("Time [ns]");
gr[4]->GetXaxis()->CenterTitle();
gr[4]->GetYaxis()->SetTitle("Signal [V]");
gr[4]->GetYaxis()->CenterTitle();
gr[4]->Draw("AL*");
f1->SetRange(t10[4], t90[4]);
gr[4]->Fit(f1, "RQ");
c1->Print(Form("../macros/picsDRS4/%s/One_signal_shape%s", foldername, ext));
//c1->Print(Form("../macros/picsDRS4/%s/Signal_shapes_with_fit%s", foldername, ext));
*/
// picture for TDR
/*
c1->Divide(1,2);
c1->cd(1);
gr[2]->GetXaxis()->SetRangeUser(130, 175);
gr[2]->GetXaxis()->SetTitle("Time [ns]");
gr[2]->GetXaxis()->CenterTitle();
gr[2]->GetYaxis()->SetTitle("Signal [V]");
gr[2]->GetYaxis()->CenterTitle();
gr[2]->Draw("AL*");
c1->cd(2);
gr[3]->GetXaxis()->SetRangeUser(130, 175);
gr[3]->GetXaxis()->SetTitle("Time [ns]");
gr[3]->GetXaxis()->CenterTitle();
gr[3]->GetYaxis()->SetTitle("Signal [V]");
gr[3]->GetYaxis()->CenterTitle();
gr[3]->Draw("AL*");
*/
}
#include "TH2F.h"
#include "TH3F.h"
#include "TStyle.h"
void walk_corr(
//01 means it is used for channels 0 and 1
const char *filename = "analysis_07_8.root", //considered non-collimated
// const char *filename = "analysis_08_2.root",
const Bool_t can1 = 1)
{
using std::cout;
using std::endl;
gSystem->Load("../libData.so");
TFile *f = new TFile(Form("../data/dataDSR4/%s", filename));
TTree *t = (TTree*)f->Get("atree");
if(can1){
TCanvas *c1 = new TCanvas("c1", "Trying to correct the walk effect");
//pictures for latex report, LED
/* c1->Divide(2,1);
c1->cd(1);
TH2F *h2 = new TH2F("h2", "time difference (LED method) vs charge of non-trigger channel ", 100, -12 ,5, 100, 0, 0.14e-9);
t->Draw(" Ach1.fChargeLED : Ach0.fTimeLED - Ach1.fTimeLED >> h2","","col");
//x
h2->GetXaxis()->SetTitle("time [ns]");
h2->GetXaxis()->CenterTitle();
//y
h2->GetYaxis()->SetTitle("Q [C]");
h2->GetYaxis()->CenterTitle();
// c1->cd(2);
TProfile *prof1 = new TProfile("prof1","Profile of y vs x",100, -12, 5, 0, 0.17e-9);
prof1 = h2->ProfileX();
// prof1->Fit("pol2","","",-6,0);
prof1->Draw("same");
*/
//pictures for latex report, CFD
c1->Divide(2,2);
c1->cd(1);
TH2F *h2 = new TH2F("h2", "time difference (CFD method) vs charge of non-trigger channel ", 100, -12 ,5, 100, 0, 0.17e-9);
t->Draw(" Ach1.fChargeCFD : Ach0.fTimeCFD - Ach1.fTimeCFD >> h2","","col");
//x
h2->GetXaxis()->SetTitle("time [ns]");
h2->GetXaxis()->CenterTitle();
//y
h2->GetYaxis()->SetTitle("Q [C]");
h2->GetYaxis()->CenterTitle();
h2->SetMaximum(10);
c1->Update();
c1->cd(2);
//TProfile *prof1 = new TProfile("prof1","Profile of y vs x"/*,100, -12, 5, 0, 0.17e-9, "o"*/);
TProfile *prof1 = h2->ProfileX();
//prof1 = h2->ProfileY();
TF1 *myfit = new TF1("myfit","[0] - [1]*exp([2]/sqrt(x))");
myfit->SetRange(0.0, 0.08);
prof1->Fit("pol1","","",-4,0);
//prof1->Fit("myfit","R");//,0,0.06);
prof1->Draw();
c1->cd(3);
TH2F *h3 = new TH2F("h3", "time difference (CFD method) vs charge of non-trigger channel AFTER CORRECTION", 100, -12 ,5, 100, 0, 0.17e-9);
h3->SetMaximum(10);
t->Draw("Ach1.fChargeCFD : (Ach0.fTimeCFD - Ach1.fTimeCFD) + 0.550*1.58e-11/Ach1.fChargeCFD >> h3","","col");
c1->cd(4);
TH1F *h4 = new TH1F("h4", "time difference AFTER CORRECTION", 50, -8, 8);
t->Draw(" (Ach0.fTimeCFD - Ach1.fTimeCFD) + 0.550*1.58e-11/Ach1.fChargeCFD >> h4","Ach0.fTimeCFD>100. && Ach0.fTimeCFD<160 && Ach1.fTimeCFD>100. && Ach1.fTimeCFD<160","");
h4->GetXaxis()->SetTitle("Time difference [ns]");
h4->GetXaxis()->CenterTitle();
//h4->Fit("gaus","","",-3,1);
h4->Fit("gaus","","",-2,1.5);
gStyle->SetOptFit();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment