diff --git a/convertDRS4/read_binary.cpp b/convertDRS4/read_binary.cpp index f7049ca1c2e6438a9445e43fb0808c558f608419..acc6f3808b187430a0841e369b7f546e4921048c 100644 --- a/convertDRS4/read_binary.cpp +++ b/convertDRS4/read_binary.cpp @@ -254,6 +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); /*printf("old ampl %f ",amp_ch1[i]); event->PrintAmp(i); printf("\n");*/ diff --git a/data/rawDataDSR4/NeuRad_test_07_1.root b/data/rawDataDSR4/NeuRad_test_07_1.root index 0bbbc8f7d3901a27e10ccb27e94f3dfe82d48aad..e0d4d622fa2397e5f717109c4c4510528e9f91d5 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 new file mode 100644 index 0000000000000000000000000000000000000000..29be5c413d667656402ac4b8ec7306e5791b3999 --- /dev/null +++ b/dataClasses/AnalyzeData.cpp @@ -0,0 +1,71 @@ +/* + * AnalyzeData.cpp + * + * Created on: Dec 28, 2016 + * Author: daria + */ + +#include "AnalyzeData.h" + +AnalyzeData::AnalyzeData() { + // TODO Auto-generated constructor stub + + TGraph gr; + +} + +AnalyzeData::~AnalyzeData() { + // TODO Auto-generated destructor stub +} + +Bool_t 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; + } + TTree *traw = (TTree*)fraw->Get(treename); + if (!traw) { + Error("SetRawDataFile", "Tree %s was not found in file %s", treename, iFileName.Data()); + return 0; + } + //traw->Draw +} +/* +void RawData::Reset() { + + for (Int_t i = 0; i < NCELLS; i++) { + Amp[i] = 0; + Time[i] = 0; + } + +} + +void RawData::PrintTime(Int_t i) { + cout << Time[i] << endl; +} + +void RawData::PrintAmp(Int_t i) { + cout << Amp[i] << endl; +} + +void RawData::SetAmp(Double_t a, Int_t i) { + if (i >=NCELLS) { + cout << "Error: array with raw amplitudes is overloaded!" << endl; + return; + } + Amp[i] = a; + return; +} + +void RawData::SetTime(Double_t t, Int_t i) { + if (i >=NCELLS) { + cout << "Error: array with raw times is overloaded!" << endl; + return; + } + Time[i] = t; + return; +}*/ + diff --git a/dataClasses/AnalyzeData.h b/dataClasses/AnalyzeData.h new file mode 100644 index 0000000000000000000000000000000000000000..0728a5db9af9c304f1e38e83911df551ab99509e --- /dev/null +++ b/dataClasses/AnalyzeData.h @@ -0,0 +1,72 @@ +/* + * AnalyzeData.h + * + * Created on: Dec 28, 2016 + * Author: daria + */ + +#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 +#define NCELLS 1024 + +using std::cout; +using std::endl; + +class AnalyzeData { + +private: + +/* Double_t Amp[NCELLS]; //array for raw amplitudes + Double_t Time[NCELLS]; //array for raw times*/ + +public: + AnalyzeData(); + virtual ~AnalyzeData(); + ClassDef(AnalyzeData,1); + + Bool_t SetRawDataFile(const char* inprawfile, const char* treename); +// void Integral() +/* void Reset(); + //Resets arrays to zeros + + const Double_t* GetAmp() const { + return Amp; + } + + const Double_t* GetTime() const { + return Time; + } + + void SetAmp(Double_t a, Int_t i); + //Takes amplitude (raw data, voltage from binary file) + //and places it in the array Amp[NCELLS] + + void SetTime(Double_t t, Int_t i); + //Takes time (raw data, times from binary file) + //and places it in the array Time[NCELLS] + + void PrintAmp(Int_t i); + void PrintTime(Int_t i);*/ +}; + +#endif /* DATACLASSES_ANALYZEDATA_H_ */ diff --git a/dataClasses/Data.mk b/dataClasses/Data.mk index a5ad69c03c0dcc4677dca9f1ccf6785a66ae33c5..38b7876a309bd852a1bc09733958b0a4121852c5 100755 --- a/dataClasses/Data.mk +++ b/dataClasses/Data.mk @@ -7,16 +7,21 @@ DATALIBS := -lHist #-lCore #-lCint -lRIO -lTree -lNet -lThread -lMatrix -lMathCo # Add inputs and outputs from these tool invocations to the build variables DATA_HEADERS += \ $(DATA)/RawData.h \ +$(DATA)/AnalyzeData.h \ $(DATA)/linkdef.h + DATACPP_SRCS += \ $(DATA)/RawData.cpp \ +$(DATA)/AnalyzeData.cpp \ $(DATA)/DataCint.cpp DATAOBJS += \ $(DATA)/RawData.o \ +$(DATA)/AnalyzeData.o \ $(DATA)/DataCint.o DATACPP_DEPS += \ $(DATA)/RawData.d \ -$(DATA)/DataCint.d \ No newline at end of file +$(DATA)/AnalyzeData.d \ +$(DATA)/DataCint.d diff --git a/dataClasses/RawData.cpp b/dataClasses/RawData.cpp index ac4c7d4bae746f64c45d68da3f1eb07e4b392628..37b9bb530d5d3c4bb7c3096ee285ba8cda9426db 100644 --- a/dataClasses/RawData.cpp +++ b/dataClasses/RawData.cpp @@ -53,3 +53,12 @@ void RawData::SetTime(Double_t t, Int_t i) { return; } +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 8554acd7d1aba91792e9facbdc1d59719ef861ae..83f16243f3d7b3e1c8db1664b131af337c25c87d 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 public: RawData(); virtual ~RawData(); @@ -31,7 +31,7 @@ public: const Double_t* GetAmp() const { return Amp; } - + const Double_t* GetTime() const { return Time; } @@ -45,7 +45,14 @@ public: //and places it in the array Time[NCELLS] void PrintAmp(Int_t i); + //Prints i amplitudes (to make sense i shold be NCELLS) + void PrintTime(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. + }; #endif /* DATACLASSES_RAWDATA_H_ */ diff --git a/dataClasses/linkdef.h b/dataClasses/linkdef.h index f83a2b1bdc935f4531c3f1979dbf478c49196cb0..0f01ae6c9bbdbe33b37a58bf655dd51a6e4d9812 100755 --- a/dataClasses/linkdef.h +++ b/dataClasses/linkdef.h @@ -3,7 +3,8 @@ #pragma link off all classes; #pragma link off all functions; -#pragma link C++ class RawData; +#pragma link C++ class RawData; +#pragma link C++ class AnalyzeData; //#pragma link C++ class ConfigDictionary;