diff --git a/convertDRS4/read_binary.cpp b/convertDRS4/read_binary.cpp index acc6f3808b187430a0841e369b7f546e4921048c..eb4a5f65e00ea7507ec07b28ab0035ee5e09ca11 100644 --- a/convertDRS4/read_binary.cpp +++ b/convertDRS4/read_binary.cpp @@ -254,7 +254,7 @@ int main(int argc, const char * argv[]) if(chn_index == 0) { amp_ch1[i] = waveform[b][chn_index][i]; event->SetAmp(waveform[b][chn_index][i], i); - event->InvertAmp(waveform[b][chn_index][i], i); +// event->InvertAmp(waveform[b][chn_index][i], i); /*printf("old ampl %f ",amp_ch1[i]); event->PrintAmp(i); printf("\n");*/ diff --git a/data/dataDSR4/analysis_07_1.root b/data/dataDSR4/analysis_07_1.root index ab55ba18c0c18f5334c1632cd6b0892cb1f6d941..e12c8b7d7c07adb2f88192db7be47f95c1c6a52b 100644 Binary files a/data/dataDSR4/analysis_07_1.root and b/data/dataDSR4/analysis_07_1.root differ diff --git a/data/rawDataDSR4/NeuRad_test_07_1.root b/data/rawDataDSR4/NeuRad_test_07_1.root index e0d4d622fa2397e5f717109c4c4510528e9f91d5..745aa21a08f6e214e988c28ab6902fce71a284bf 100644 Binary files a/data/rawDataDSR4/NeuRad_test_07_1.root and b/data/rawDataDSR4/NeuRad_test_07_1.root differ diff --git a/dataClasses/AnalyzeData.cpp b/dataClasses/AnalyzeData.cpp index 29be5c413d667656402ac4b8ec7306e5791b3999..40fd1f9e041502e8589d9a2154dd91a1291ec1b0 100644 --- a/dataClasses/AnalyzeData.cpp +++ b/dataClasses/AnalyzeData.cpp @@ -10,7 +10,7 @@ AnalyzeData::AnalyzeData() { // TODO Auto-generated constructor stub - TGraph gr; +// TGraph gr; } @@ -18,21 +18,47 @@ AnalyzeData::~AnalyzeData() { // TODO Auto-generated destructor stub } -Bool_t AnalyzeData::SetRawDataFile(const char* inprawfile, const char* treename) { +void AnalyzeData::SetRawDataFile(const char* inprawfile, const char* treename) { TString iFileName = inprawfile; TFile *fraw = new TFile(iFileName.Data()); if ( !fraw->IsOpen() ) { Error("SetRawDataFile", "File %s was not opened and won't be processed", iFileName.Data()); - return 0; +// return 0; } TTree *traw = (TTree*)fraw->Get(treename); if (!traw) { Error("SetRawDataFile", "Tree %s was not found in file %s", treename, iFileName.Data()); - return 0; +// return 0; } //traw->Draw } + +void AnalyzeData::ProcessEvent(RawData *event) { + + const Double_t *amp = event->GetAmp(); + const Double_t *time = event->GetTime(); + + for(Int_t j = 0; j < NCELLS; j++) { + fAmpPos[j] = amp[j]*(-1.); + fTime[j] = time[j]; + } + + Double_t maxAmp = 0.; + Double_t maxAmpT = 0.; + + maxAmp = fAmpPos[0]; + for(Int_t j=0; j maxAmp) { + maxAmp = fAmpPos[j]; + maxAmpT = fTime[j]; + } + } + fAmpMax = maxAmp; + fTimeAmpMax = maxAmpT; + + +} /* void RawData::Reset() { diff --git a/dataClasses/AnalyzeData.h b/dataClasses/AnalyzeData.h index 0728a5db9af9c304f1e38e83911df551ab99509e..fd0df9941c33ffcb0ba94bef18002430be41c25c 100644 --- a/dataClasses/AnalyzeData.h +++ b/dataClasses/AnalyzeData.h @@ -7,26 +7,19 @@ #ifndef DATACLASSES_ANALYZEDATA_H_ #define DATACLASSES_ANALYZEDATA_H_ + #include #include #include #include -#include "TGraph.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include + +#include "TString.h" +#include "TTree.h" +#include "TFile.h" +#include "TMath.h" + +#include "RawData.h" + #define NCELLS 1024 using std::cout; @@ -36,15 +29,18 @@ class AnalyzeData { private: -/* Double_t Amp[NCELLS]; //array for raw amplitudes - Double_t Time[NCELLS]; //array for raw times*/ + Double_t fAmpPos[NCELLS]; //array for raw amplitudes + Double_t fTime[NCELLS]; //array for raw times*/ + Double_t fAmpMax; + Double_t fTimeAmpMax; public: AnalyzeData(); virtual ~AnalyzeData(); ClassDef(AnalyzeData,1); - Bool_t SetRawDataFile(const char* inprawfile, const char* treename); + void SetRawDataFile(const char* inprawfile, const char* treename); + void ProcessEvent(RawData* event); // void Integral() /* void Reset(); //Resets arrays to zeros diff --git a/dataClasses/RawData.cpp b/dataClasses/RawData.cpp index 37b9bb530d5d3c4bb7c3096ee285ba8cda9426db..fcaf4f010c924352d749724f947ce47415e5186a 100644 --- a/dataClasses/RawData.cpp +++ b/dataClasses/RawData.cpp @@ -53,12 +53,12 @@ void RawData::SetTime(Double_t t, Int_t i) { return; } -void RawData::InvertAmp(Double_t a,Int_t i) { +/*void RawData::InvertAmp(Double_t a,Int_t i) { if (i >=NCELLS) { cout << "Error: array with raw amplitudes for turn over is overloaded!" << endl; return; } Amplitude[i] = a*(-1.); return; -} +}*/ diff --git a/dataClasses/RawData.h b/dataClasses/RawData.h index 83f16243f3d7b3e1c8db1664b131af337c25c87d..09801c279160a83ae5a90a430cd460a02a607878 100644 --- a/dataClasses/RawData.h +++ b/dataClasses/RawData.h @@ -19,7 +19,7 @@ class RawData { private: Double_t Amp[NCELLS]; //array for raw amplitudes Double_t Time[NCELLS]; //array for raw times - Double_t Amplitude[NCELLS]; //array for inverted amplitudes +// Double_t Amplitude[NCELLS]; //array for inverted amplitudes public: RawData(); virtual ~RawData(); @@ -49,7 +49,7 @@ public: void PrintTime(Int_t i); - void InvertAmp(Double_t a, Int_t i); +// void InvertAmp(Double_t a, Int_t i); //Inverts the amplitudes i.e. makes from negative singals //posititve signals and vise versa.