Commit d85c43d5 authored by Muzalevsky I.A's avatar Muzalevsky I.A

trying to commit program

Merge branch 'master' of http://er.jinr.ru:90/vratislav.chudoba/NeuRad_tests
parents 170451e3 e45257b3
...@@ -55,9 +55,9 @@ void AEvent::ProcessEvent() { ...@@ -55,9 +55,9 @@ void AEvent::ProcessEvent() {
fTime[j] = time[j]; fTime[j] = time[j];
} }
const Double_t zeroLevel = FindZeroLevel(); fZeroLevel = FindZeroLevel();
for(Int_t j = 0; j < fNPoints; j++) { for(Int_t j = 0; j < fNPoints; j++) {
fAmpPos[j] = fAmpPos[j] - zeroLevel; fAmpPos[j] = fAmpPos[j] - fZeroLevel;
} }
Double_t maxAmp = 0.; Double_t maxAmp = 0.;
...@@ -76,6 +76,7 @@ void AEvent::ProcessEvent() { ...@@ -76,6 +76,7 @@ void AEvent::ProcessEvent() {
SetGraphs(); SetGraphs();
SetCFD(); SetCFD();
SetChargeCFD();
return; return;
...@@ -91,7 +92,9 @@ void AEvent::Reset() { ...@@ -91,7 +92,9 @@ void AEvent::Reset() {
fAmpMax = 0.; fAmpMax = 0.;
fTimeAmpMax = 0.; fTimeAmpMax = 0.;
fCFD = 0.; fTimeCFD = 0.;
fZeroLevel = 0.;
fCharge = 0.;
} }
void AEvent::SetInputEvent(RawEvent** event) { void AEvent::SetInputEvent(RawEvent** event) {
...@@ -166,7 +169,7 @@ void AEvent::SetCFD() { ...@@ -166,7 +169,7 @@ void AEvent::SetCFD() {
for(Int_t j = imin; j < imax; j++) { for(Int_t j = imin; j < imax; j++) {
if(abs(fAmpCFD[j]) < level) { if(abs(fAmpCFD[j]) < level) {
level = abs(fAmpCFD[j]); level = abs(fAmpCFD[j]);
fCFD = fTime[j]; fTimeCFD = fTime[j];
} }
} }
} }
...@@ -190,8 +193,28 @@ Double_t AEvent::FindZeroLevel(Int_t pmin, Int_t pmax) { ...@@ -190,8 +193,28 @@ Double_t AEvent::FindZeroLevel(Int_t pmin, Int_t pmax) {
return correction; return correction;
} }
void AEvent::SetChargeCFD(Int_t tmin, Int_t tmax) {
Double_t integral = 0.; //voltage
Double_t time_sig = 0; //approximate signal duration in seconds
Double_t res = 50.; //resistance 50 Om
time_sig = (double)(tmin + tmax)*(1e-9);
for(Int_t i = 0; i < fNPoints; i++) {
if( fTime[i] > (fTimeCFD - tmin) && fTime[i] < (fTimeCFD + tmax) ) {
integral = integral + fAmpPos[i];
}
}
fCharge = integral*time_sig/res;
// cout<<fCharge<<endl;
// printf("\nIntegral is %f , charge is %lf \n", integral, fCharge);
return;
}
Double_t AEvent::GetfCFD() { Double_t AEvent::GetfCFD() {
return fCFD; return fTimeCFD;
} }
Double_t AEvent::GetOnefTime(Int_t i) { Double_t AEvent::GetOnefTime(Int_t i) {
......
...@@ -38,9 +38,11 @@ private: ...@@ -38,9 +38,11 @@ private:
Double_t fAmpMax; Double_t fAmpMax;
Double_t fTimeAmpMax; Double_t fTimeAmpMax;
Double_t fZeroLevel;
TArrayD fAmpCFD; //array for CFD amplitudes (attenuated, inversed and delayed) TArrayD fAmpCFD; //array for CFD amplitudes (attenuated, inversed and delayed)
Double_t fCFD; //zero-crossing time Double_t fTimeCFD; //zero-crossing time
Double_t fCharge; //charge of the signal in Coulomb
TGraph *fGraphSignal; TGraph *fGraphSignal;
TGraph *fGraphCFD; TGraph *fGraphCFD;
...@@ -88,6 +90,11 @@ public: ...@@ -88,6 +90,11 @@ public:
//for zero level correction. one parameter fit between pmin and pmax //for zero level correction. one parameter fit between pmin and pmax
//returns fit parameter i.e. number on which amplitude should be corrected //returns fit parameter i.e. number on which amplitude should be corrected
void SetChargeCFD(Int_t tmin = 3, Int_t tmax = 17);
//calculates charge of the signal (i.e. its integral
//in range of (tmin,tmax) in ns)
//CFD time is taken as a start point
private: private:
void Init(); void Init();
void SetGraphs(); void SetGraphs();
......
...@@ -2,7 +2,7 @@ void analyse() ...@@ -2,7 +2,7 @@ void analyse()
{ {
gSystem->Load("../libData.so"); gSystem->Load("../libData.so");
TFile *f = new TFile("../data/rawDataDSR4/NeuRad_test_07_3.root"); TFile *f = new TFile("../data/rawDataDSR4/NeuRad_test_07_1.root");
TTree *tr = (TTree*)f->Get("rtree"); TTree *tr = (TTree*)f->Get("rtree");
const Int_t noBranches = 4; const Int_t noBranches = 4;
...@@ -19,7 +19,7 @@ void analyse() ...@@ -19,7 +19,7 @@ void analyse()
// tr->SetMakeClass(1); // tr->SetMakeClass(1);
TFile *fw = new TFile("../data/dataDSR4/analysis_07_3.root", "RECREATE"); //create .root file with somehow analyzed data TFile *fw = new TFile("../data/dataDSR4/analysis_07_1.root", "RECREATE"); //create .root file with somehow analyzed data
TTree *tw = new TTree("atree", "title of drs4 analysis tree"); //create analysis tree atree in it TTree *tw = new TTree("atree", "title of drs4 analysis tree"); //create analysis tree atree in it
AEvent *wevent[noBranches]; // pointer to the array (of AEvent class) in which analyzed data for each channel will be put AEvent *wevent[noBranches]; // pointer to the array (of AEvent class) in which analyzed data for each channel will be put
...@@ -37,19 +37,17 @@ void analyse() ...@@ -37,19 +37,17 @@ void analyse()
for(Long64_t i = 0; i < nentries; i++) { for(Long64_t i = 0; i < nentries; i++) {
tr->GetEntry(i); tr->GetEntry(i);
if ( !(tr->GetEntry(i)%100) ) {
printf("Found event #%d\n", tr->GetEntry(i));
}
for (Int_t j = 0; j<noBranches; j++) { for (Int_t j = 0; j<noBranches; j++) {
wevent[j]->Reset(); wevent[j]->Reset();
wevent[j]->ProcessEvent(); //here all the analysis is going on so far wevent[j]->ProcessEvent(); //here all the analysis is going on so far
} }
if ( !(i%100) ) { printf("Found event #%d\n", i); }
tw->Fill(); tw->Fill();
} }
//----end of event loop //----end of event loop
printf("%d events are processed\n", nentries);
tw->Write(); tw->Write();
fw->Close(); fw->Close();
......
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