Commit 8f6e3e68 authored by Kostyleva D.A's avatar Kostyleva D.A

New class to DRS4 analysis is added

parent ff68d4c9
......@@ -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");*/
......
/*
* 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;
}*/
/*
* 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 "TGraph.h"
#include <TObject.h>
#include <TFile.h>
#include <TTree.h>
#include <TH1I.h>
#include <TPolyMarker.h>
#include <TF1.h>
#include <TH1F.h>
#include <TH2F.h>
#include <TCanvas.h>
#include <TMath.h>
#include <TGraph.h>
#include <TObjArray.h>
#include <THStack.h>
#include <TString.h>
#include <TSpectrum.h>
#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_ */
......@@ -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
......@@ -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;
}
......@@ -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_ */
......@@ -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;
......
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