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[])
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");*/
......
......@@ -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<NCELLS; j++) {
if(fAmpPos[j] > maxAmp) {
maxAmp = fAmpPos[j];
maxAmpT = fTime[j];
}
}
fAmpMax = maxAmp;
fTimeAmpMax = maxAmpT;
}
/*
void RawData::Reset() {
......
......@@ -7,26 +7,19 @@
#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>
#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
......
......@@ -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;
}
}*/
......@@ -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.
......
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