Commit 96538c9e authored by Vratislav Chudoba's avatar Vratislav Chudoba

Class for analyzed event modified. Script for analysis added.

parent 8f6e3e68
...@@ -254,7 +254,7 @@ int main(int argc, const char * argv[]) ...@@ -254,7 +254,7 @@ int main(int argc, const char * argv[])
if(chn_index == 0) { if(chn_index == 0) {
amp_ch1[i] = waveform[b][chn_index][i]; amp_ch1[i] = waveform[b][chn_index][i];
event->SetAmp(waveform[b][chn_index][i], 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]); /*printf("old ampl %f ",amp_ch1[i]);
event->PrintAmp(i); event->PrintAmp(i);
printf("\n");*/ printf("\n");*/
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
AnalyzeData::AnalyzeData() { AnalyzeData::AnalyzeData() {
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
TGraph gr; // TGraph gr;
} }
...@@ -18,21 +18,47 @@ AnalyzeData::~AnalyzeData() { ...@@ -18,21 +18,47 @@ AnalyzeData::~AnalyzeData() {
// TODO Auto-generated destructor stub // 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; TString iFileName = inprawfile;
TFile *fraw = new TFile(iFileName.Data()); TFile *fraw = new TFile(iFileName.Data());
if ( !fraw->IsOpen() ) { if ( !fraw->IsOpen() ) {
Error("SetRawDataFile", "File %s was not opened and won't be processed", iFileName.Data()); Error("SetRawDataFile", "File %s was not opened and won't be processed", iFileName.Data());
return 0; // return 0;
} }
TTree *traw = (TTree*)fraw->Get(treename); TTree *traw = (TTree*)fraw->Get(treename);
if (!traw) { if (!traw) {
Error("SetRawDataFile", "Tree %s was not found in file %s", treename, iFileName.Data()); Error("SetRawDataFile", "Tree %s was not found in file %s", treename, iFileName.Data());
return 0; // return 0;
} }
//traw->Draw //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() { void RawData::Reset() {
......
...@@ -7,26 +7,19 @@ ...@@ -7,26 +7,19 @@
#ifndef DATACLASSES_ANALYZEDATA_H_ #ifndef DATACLASSES_ANALYZEDATA_H_
#define DATACLASSES_ANALYZEDATA_H_ #define DATACLASSES_ANALYZEDATA_H_
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <iomanip> #include <iomanip>
#include <sstream> #include <sstream>
#include "TGraph.h"
#include <TObject.h> #include "TString.h"
#include <TFile.h> #include "TTree.h"
#include <TTree.h> #include "TFile.h"
#include <TH1I.h> #include "TMath.h"
#include <TPolyMarker.h>
#include <TF1.h> #include "RawData.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 #define NCELLS 1024
using std::cout; using std::cout;
...@@ -36,15 +29,18 @@ class AnalyzeData { ...@@ -36,15 +29,18 @@ class AnalyzeData {
private: private:
/* Double_t Amp[NCELLS]; //array for raw amplitudes Double_t fAmpPos[NCELLS]; //array for raw amplitudes
Double_t Time[NCELLS]; //array for raw times*/ Double_t fTime[NCELLS]; //array for raw times*/
Double_t fAmpMax;
Double_t fTimeAmpMax;
public: public:
AnalyzeData(); AnalyzeData();
virtual ~AnalyzeData(); virtual ~AnalyzeData();
ClassDef(AnalyzeData,1); 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 Integral()
/* void Reset(); /* void Reset();
//Resets arrays to zeros //Resets arrays to zeros
......
...@@ -53,12 +53,12 @@ void RawData::SetTime(Double_t t, Int_t i) { ...@@ -53,12 +53,12 @@ void RawData::SetTime(Double_t t, Int_t i) {
return; return;
} }
void RawData::InvertAmp(Double_t a,Int_t i) { /*void RawData::InvertAmp(Double_t a,Int_t i) {
if (i >=NCELLS) { if (i >=NCELLS) {
cout << "Error: array with raw amplitudes for turn over is overloaded!" << endl; cout << "Error: array with raw amplitudes for turn over is overloaded!" << endl;
return; return;
} }
Amplitude[i] = a*(-1.); Amplitude[i] = a*(-1.);
return; return;
} }*/
...@@ -19,7 +19,7 @@ class RawData { ...@@ -19,7 +19,7 @@ class RawData {
private: private:
Double_t Amp[NCELLS]; //array for raw amplitudes Double_t Amp[NCELLS]; //array for raw amplitudes
Double_t Time[NCELLS]; //array for raw times 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: public:
RawData(); RawData();
virtual ~RawData(); virtual ~RawData();
...@@ -49,7 +49,7 @@ public: ...@@ -49,7 +49,7 @@ public:
void PrintTime(Int_t i); 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 //Inverts the amplitudes i.e. makes from negative singals
//posititve signals and vise versa. //posititve signals and vise versa.
......
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