diff --git a/data/dataDSR4/analysis_07_1.root b/data/dataDSR4/analysis_07_1.root index ef57558475da2aaf6abd3097d218accac8e192d6..407c22db450ee7334e1f8a5a23d80e83cb095058 100644 Binary files a/data/dataDSR4/analysis_07_1.root and b/data/dataDSR4/analysis_07_1.root differ diff --git a/dataClasses/AEvent.cpp b/dataClasses/AEvent.cpp index 565fb94a6363b0043f63e5b192d6b23db1cf227f..cf07feeb93ac5ba94d32dcf287c15cde7ee4fbb3 100644 --- a/dataClasses/AEvent.cpp +++ b/dataClasses/AEvent.cpp @@ -55,9 +55,9 @@ void AEvent::ProcessEvent() { fTime[j] = time[j]; } - const Double_t zeroLevel = FindZeroLevel(); + fZeroLevel = FindZeroLevel(); for(Int_t j = 0; j < fNPoints; j++) { - fAmpPos[j] = fAmpPos[j] - zeroLevel; + fAmpPos[j] = fAmpPos[j] - fZeroLevel; } Double_t maxAmp = 0.; @@ -76,6 +76,7 @@ void AEvent::ProcessEvent() { SetGraphs(); SetCFD(); + SetChargeCFD(); return; @@ -91,7 +92,9 @@ void AEvent::Reset() { fAmpMax = 0.; fTimeAmpMax = 0.; - fCFD = 0.; + fTimeCFD = 0.; + fZeroLevel = 0.; + fCharge = 0.; } void AEvent::SetInputEvent(RawEvent** event) { @@ -166,7 +169,7 @@ void AEvent::SetCFD() { for(Int_t j = imin; j < imax; j++) { if(abs(fAmpCFD[j]) < level) { level = abs(fAmpCFD[j]); - fCFD = fTime[j]; + fTimeCFD = fTime[j]; } } } @@ -190,8 +193,28 @@ Double_t AEvent::FindZeroLevel(Int_t pmin, Int_t pmax) { 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<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"); const Int_t noBranches = 4; @@ -19,7 +19,7 @@ void analyse() // 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 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() for(Long64_t i = 0; i < nentries; i++) { tr->GetEntry(i); - if ( !(tr->GetEntry(i)%100) ) { - printf("Found event #%d\n", tr->GetEntry(i)); - } for (Int_t j = 0; jReset(); wevent[j]->ProcessEvent(); //here all the analysis is going on so far } + if ( !(i%100) ) { printf("Found event #%d\n", i); } tw->Fill(); } - //----end of event loop + printf("%d events are processed\n", nentries); tw->Write(); fw->Close();