Commit 38e4b2e5 authored by Vratislav Chudoba's avatar Vratislav Chudoba

Names of event classes changed.

parent 8525a0b7
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "TH1F.h" #include "TH1F.h"
//our code //our code
#include "../dataClasses/RawData.h" #include "../dataClasses/RawEvent.h"
typedef struct { typedef struct {
char tag[3]; char tag[3];
...@@ -123,8 +123,8 @@ int main(int argc, const char * argv[]) ...@@ -123,8 +123,8 @@ int main(int argc, const char * argv[])
rtree->Branch("amp_ch1", amp_ch1, "amp_ch1[ncell]/D"); rtree->Branch("amp_ch1", amp_ch1, "amp_ch1[ncell]/D");
rtree->Branch("time_ch1", time_ch1, "time_ch1[ncell]/D"); rtree->Branch("time_ch1", time_ch1, "time_ch1[ncell]/D");
RawData *event = new RawData(); RawEvent *event = new RawEvent();
rtree->Bronch("rawEvent", "RawData", &event); rtree->Bronch("rawEvent", "RawEvent", &event);
//------for other channels //------for other channels
// rtree->Branch("amp_ch2", amp_ch2, "amp_ch2[ncell]/D"); // rtree->Branch("amp_ch2", amp_ch2, "amp_ch2[ncell]/D");
......
/*
* 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
}
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;
}
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 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<NCELLS; j++) {
if(fAmpPos[j] > maxAmp) {
maxAmp = fAmpPos[j];
maxAmpT = fTime[j];
}
}
fAmpMax = maxAmp;
fTimeAmpMax = maxAmpT;
}
/*
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;
}*/
/*
* AnalyzeData.h
*
* Created on: Dec 28, 2016
* Author: daria
*/
#ifndef DATACLASSES_ANALYZEDATA_H_
#define DATACLASSES_ANALYZEDATA_H_
#include <iostream>
#include <fstream>
#include <iomanip>
#include <sstream>
#include "TString.h"
#include "TTree.h"
#include "TFile.h"
#include "TMath.h"
#include "RawData.h"
#define NCELLS 1024
using std::cout;
using std::endl;
class AnalyzeData {
private:
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);
void SetRawDataFile(const char* inprawfile, const char* treename);
void ProcessEvent(RawData* event);
// 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_ */
...@@ -6,22 +6,22 @@ DATALIBS := -lHist #-lCore #-lCint -lRIO -lTree -lNet -lThread -lMatrix -lMathCo ...@@ -6,22 +6,22 @@ DATALIBS := -lHist #-lCore #-lCint -lRIO -lTree -lNet -lThread -lMatrix -lMathCo
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
DATA_HEADERS += \ DATA_HEADERS += \
$(DATA)/RawData.h \ $(DATA)/RawEvent.h \
$(DATA)/AnalyzeData.h \ $(DATA)/AEvent.h \
$(DATA)/linkdef.h $(DATA)/linkdef.h
DATACPP_SRCS += \ DATACPP_SRCS += \
$(DATA)/RawData.cpp \ $(DATA)/RawEvent.cpp \
$(DATA)/AnalyzeData.cpp \ $(DATA)/AEvent.cpp \
$(DATA)/DataCint.cpp $(DATA)/DataCint.cpp
DATAOBJS += \ DATAOBJS += \
$(DATA)/RawData.o \ $(DATA)/RawEvent.o \
$(DATA)/AnalyzeData.o \ $(DATA)/AEvent.o \
$(DATA)/DataCint.o $(DATA)/DataCint.o
DATACPP_DEPS += \ DATACPP_DEPS += \
$(DATA)/RawData.d \ $(DATA)/RawEvent.d \
$(DATA)/AnalyzeData.d \ $(DATA)/AEvent.d \
$(DATA)/DataCint.d $(DATA)/DataCint.d
/*
* RawData.cpp
*
* Created on: Dec 27, 2016
* Author: vratik
*/
#include "RawData.h"
RawData::RawData() {
// TODO Auto-generated constructor stub
TGraph gr;
}
RawData::~RawData() {
// TODO Auto-generated destructor stub
}
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;
}
/*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;
}*/
/*
* RawData.h
*
* Created on: Dec 27, 2016
* Author: vratik
*/
#ifndef DATACLASSES_RAWDATA_H_
#define DATACLASSES_RAWDATA_H_
#include <iostream>
#include "TGraph.h"
#define NCELLS 1024
using std::cout;
using std::endl;
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();
ClassDef(RawData,1);
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);
//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_ */
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
#pragma link off all classes; #pragma link off all classes;
#pragma link off all functions; #pragma link off all functions;
#pragma link C++ class RawData; #pragma link C++ class RawEvent;
#pragma link C++ class AnalyzeData; #pragma link C++ class AEvent;
//#pragma link C++ class ConfigDictionary; //#pragma link C++ class ConfigDictionary;
......
...@@ -59,7 +59,7 @@ libData.so: $(DATAOBJS) ...@@ -59,7 +59,7 @@ libData.so: $(DATAOBJS)
@echo 'Finished building target: $@' @echo 'Finished building target: $@'
@echo ' ' @echo ' '
read_binary_DRS4: libData.so $(CONVERTDRS4)/read_binary.cpp read_binary_DRS4: $(CONVERTDRS4)/read_binary.cpp libData.so
@echo 'Building target: $@' @echo 'Building target: $@'
@echo 'Invoking: GCC C++ Linker' @echo 'Invoking: GCC C++ Linker'
# $(CC) -L $(ROOTLIBS) -shared -o"libData.so" $(DATAOBJS) $(DATALIBS) # $(CC) -L $(ROOTLIBS) -shared -o"libData.so" $(DATAOBJS) $(DATALIBS)
......
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