diff --git a/convertDRS4/read_binary.cpp b/convertDRS4/read_binary.cpp index 40dde8189581c1904cd06fe75591b7005ee48e54..8641367399cc95a07d58b55ee40cbee91baf406f 100644 --- a/convertDRS4/read_binary.cpp +++ b/convertDRS4/read_binary.cpp @@ -333,6 +333,9 @@ int main(int argc, const char * argv[]) sumdt2 += dt*dt; } } //end of the boards loop + +// event->SetGraphs(); + rtree->Fill(); } // end of the events loop diff --git a/convertTektronix/IntegralFULL.c b/convertTektronix/IntegralFULL.c index 7139501f9e96df99dde7d484e99c7d82e042dc1f..52cbd5ba36f5c5e724aeb6329223711b519acb0a 100644 --- a/convertTektronix/IntegralFULL.c +++ b/convertTektronix/IntegralFULL.c @@ -1,3 +1,5 @@ +#include "TF1.h" + void IntegralFULL(){ Int_t j,i,nentry,NumM; diff --git a/convertTektronix/read.c b/convertTektronix/read.c index e30cdcc18a7cea1c2ec373086c59eb827dcec129..582fcf3f51db3cf1144d9d6f1be184ec42889c1a 100644 --- a/convertTektronix/read.c +++ b/convertTektronix/read.c @@ -14,7 +14,7 @@ void read() { Double_t T[1000]; Int_t i,j,n; - TFile *f1 = new TFile("exp2.root","RECREATE"); + TFile *f1 = new TFile("exp2.root","RECREATE"); TTree *tree = new TTree("tree","signal"); tree->Branch("A",A,"A[1000]/D"); tree->Branch("T",T,"T[1000]/D"); @@ -26,14 +26,14 @@ void read() { //std::vector *A = new std::vector(); //tree->Branch("mybranch","vector",A); - ifstream myfile1; + ifstream myfile1; myfile1.open("../data/rawDataTektronix/ch12016.12.07-02.11.54.dat"); if (!myfile1.is_open()) { Error("read.c", "Some error when opening file"); return; } - + for(i = 0; i<100000; i++){ n=i/1000; // if ((i==1002)||(i==900)||(i==2002)||(i==8002)) {cout<> A[i-1000*n]; @@ -46,11 +46,11 @@ void read() { T[j]=0;A[j]=0; } } - } + } myfile1.close(); - ifstream myfile2; - myfile2.open("ch12016.12.07-08.48.05.dat"); + ifstream myfile2; + myfile2.open("ch12016.12.07-08.48.05.dat"); for(i = 0; i<100000; i++){ n=i/1000; // if ((i==1002)||(i==900)||(i==2002)||(i==8002)) {cout<> A[i-1000*n]; @@ -63,11 +63,11 @@ void read() { T[j]=0;A[j]=0; } } - } + } myfile2.close(); - ifstream myfile3; - myfile3.open("ch12016.12.07-10.03.01.dat"); + ifstream myfile3; + myfile3.open("ch12016.12.07-10.03.01.dat"); for(i = 0; i<29000; i++){ n=i/1000;// if ((i==1002)||(i==900)||(i==2002)||(i==8002)) {cout<> A[i-1000*n]; @@ -80,7 +80,7 @@ void read() { T[j]=0;A[j]=0; } } - } + } myfile3.close(); tree->Write(); diff --git a/data/rawDataDSR4/NeuRad_test_07_1.root b/data/rawDataDSR4/NeuRad_test_07_1.root index 6232fe283cef29e9703e75ac25479fcf96ae6263..5ada2064d4a54249b23d386ef8e8b3e7ba96783d 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/AEvent.cpp b/dataClasses/AEvent.cpp new file mode 100644 index 0000000000000000000000000000000000000000..710ef4aa537f0ff641c803967f4948d4ce3a8932 --- /dev/null +++ b/dataClasses/AEvent.cpp @@ -0,0 +1,104 @@ +/* + * AEvent.cpp + * + * Created on: Dec 28, 2016 + * Author: daria + */ + +#include "AEvent.h" + +AEvent::AEvent() : fNPoints(1024) { + // TODO Auto-generated constructor stub + + Init(); + Reset(); + +} + +AEvent::~AEvent() { + // TODO Auto-generated destructor stub + delete gSignal; +} + +void AEvent::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()); + } + TTree *traw = (TTree*)fraw->Get(treename); + if (!traw) { + Error("SetRawDataFile", "Tree %s was not found in file %s", treename, iFileName.Data()); + } +} + +void AEvent::ProcessEvent() { + + if (fInputEvent == NULL) { + Warning("AEvent::ProcessEvent", "Input event wasn't set. Function won't be processed."); + return; + } + + const Double_t *amp = fInputEvent->GetAmp(); + const Double_t *time = fInputEvent->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 maxAmp) { + maxAmp = fAmpPos[j]; + maxAmpT = fTime[j]; + } + } + fAmpMax = maxAmp; + fTimeAmpMax = maxAmpT; + + return; + +} + +void AEvent::Reset() { + + for (Int_t i = 0; i < NCELLS; i++) { + fAmpPos[i] = 0; + fTime[i] = 0; + } + + fAmpMax = 0.; + fTimeAmpMax = 0.; +} + +void AEvent::SetInputEvent(RawEvent** event) { + + if (event == 0) { + Warning("AEvent::SetInputEvent", "Input event was set as 0."); + } + fInputEvent = *event; + +} + +void AEvent::Init() { + + gSignal = new TGraph(); + fInputEvent = 0; + +} + +void AEvent::SetGraphs() { + + gSignal->Set(fNPoints); + + for (Int_t i=0; iSetPoint(i, fTime[i], fAmpPos[i]); + } + + return; +} diff --git a/dataClasses/AEvent.h b/dataClasses/AEvent.h new file mode 100644 index 0000000000000000000000000000000000000000..67ccd078d55b6bf0addda8311875fc14f5c2f9c5 --- /dev/null +++ b/dataClasses/AEvent.h @@ -0,0 +1,65 @@ +/* + * AEvent.h + * + * Created on: Dec 28, 2016 + * Author: daria + */ + +#ifndef DATACLASSES_AEVENT_H_ +#define DATACLASSES_AEVENT_H_ + +#include +#include +#include +#include + +#include "TError.h" +#include "TString.h" +#include "TTree.h" +#include "TFile.h" +//#include "TMath.h" + + +#include "RawEvent.h" + +#define NCELLS 1024 + +using std::cout; +using std::endl; + +class AEvent { + +private: + + const Int_t fNPoints; //! + Double_t fAmpPos[NCELLS]; //array for raw amplitudes + Double_t fTime[NCELLS]; //array for raw times + Double_t fAmpMax; + Double_t fTimeAmpMax; + + TGraph *gSignal; + + RawEvent *fInputEvent; //! + +public: + AEvent(); + virtual ~AEvent();ClassDef(AEvent,1) + ; + + void SetRawDataFile(const char* inprawfile, const char* treename); + void ProcessEvent(); +// void Integral() + void SetInputEvent(RawEvent** event); + void Reset(); + //Resets arrays to zeros + + void SetGraphs(); + TGraph* GetGraph() { + return gSignal; + } + +private: + void Init(); +}; + +#endif /* DATACLASSES_AEVENT_H_ */ diff --git a/dataClasses/RawEvent.cpp b/dataClasses/RawEvent.cpp new file mode 100644 index 0000000000000000000000000000000000000000..37435800c08772c7d25b7f6636b86555e532ddac --- /dev/null +++ b/dataClasses/RawEvent.cpp @@ -0,0 +1,74 @@ +/* + * RawEvent.cpp + * + * Created on: Dec 27, 2016 + * Author: vratik + */ + +#include "RawEvent.h" + +RawEvent::RawEvent() : fNPoints(1024) { + // TODO Auto-generated constructor stub + Init(); +} + +RawEvent::RawEvent(const Int_t npoints) : fNPoints(npoints) { + // TODO Auto-generated constructor stub + Init(); +} + +RawEvent::~RawEvent() { + // TODO Auto-generated destructor stub +} + +void RawEvent::Init() { + fAmp.Set(fNPoints); + fTime.Set(fNPoints); +} + +void RawEvent::Reset() { + + for (Int_t i = 0; i < fNPoints; i++) { + fAmp[i] = 0; + fTime[i] = 0; + } + + // TODO how to deal with graphs? +} + +void RawEvent::PrintTime(Int_t i) { + cout << fTime[i] << endl; +} + +void RawEvent::PrintAmp(Int_t i) { + cout << fAmp[i] << endl; +} + +void RawEvent::SetAmp(Double_t a, Int_t i) { + if (i >= fNPoints) { + cout << "Error: array with raw amplitudes is overloaded!" << endl; + return; + } + fAmp[i] = a; + return; +} + +void RawEvent::SetTime(Double_t t, Int_t i) { + if (i >=fNPoints) { + cout << "Error: array with raw times is overloaded!" << endl; + return; + } + fTime[i] = t; + return; +} + +//void RawEvent::SetGraphs() { +// +// gAmp->Set(fNPoints); +// +// for (Int_t i=0; iSetPoint(i, fTime[i], fAmp[i]); +// } +// +// return; +//} diff --git a/dataClasses/RawEvent.h b/dataClasses/RawEvent.h new file mode 100644 index 0000000000000000000000000000000000000000..0b67d18aa642747d9a576a086c5465b25bf66f30 --- /dev/null +++ b/dataClasses/RawEvent.h @@ -0,0 +1,79 @@ +/* + * RawEvent.h + * + * Created on: Dec 27, 2016 + * Author: vratik + */ + +#ifndef DATACLASSES_RAWEVENT_H_ +#define DATACLASSES_RAWEVENT_H_ + +#include + +//#include "Rtypes.h" +#include "TError.h" +#include "TGraph.h" +#include "TArrayD.h" + +//#define NCELLS 1024 + +using std::cout; +using std::endl; + +class RawEvent { + +private: +// Double_t fAmp[NCELLS]; //array for raw amplitudes +// Double_t fTime[NCELLS]; //array for raw times + + TArrayD fAmp; //array for raw amplitudes + TArrayD fTime; //array for raw times + + const Int_t fNPoints; //! + +// TGraph *gAmp; + +//public: +// TArrayD fAmpA; + +public: + RawEvent(); + RawEvent(const Int_t npoints); + virtual ~RawEvent(); + ClassDef(RawEvent,1); + + void Reset(); + //Resets arrays to zeros + + const Double_t* GetAmp() const { return fAmp.GetArray(); } + + const Double_t* GetTime() const { return fTime.GetArray(); } + + 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. + +// void SetGraphs(); +// TGraph* GetGraph() { +// return gAmp; +// } + +private: + void Init(); + +}; + +#endif /* DATACLASSES_RAWEVENT_H_ */ diff --git a/macros/analyse.C b/macros/analyse.C index 53d4d61f99be60fc1dc8a62600097c8442830b6a..d7e89e782f62b4f7361db240a6edfa95d51d08b5 100644 --- a/macros/analyse.C +++ b/macros/analyse.C @@ -31,90 +31,4 @@ void analyse() fw->Close(); return; - -// tr->SetBranchAddress("amp_ch1", ampl1); -// tr->SetBranchAddress("time_ch1", time1); -// tr->SetBranchAddress("ncell", ncells); - - tw->Branch("maxAmplitude1", &maxAmplitude1, "maxAmplitude1/D"); - tw->Branch("timemaxAmplitude1", &timemaxAmplitude1, "timemaxAmplitude1/D"); - tw->Branch("ampl1_pos", ampl1_pos, "ampl1_pos[1023]/D"); //branch for positive signals - tw->Branch("time1_pos", time1_pos, "time1_pos[1023]/D"); - - const Long64_t nEntries = tr->GetEntries(); - cout <<"Number of entries: "<Divide(3,4); - - for(Int_t i=12; i<24; i++) { - c1->cd(i-11); - tr->GetEntry(i); - TGraph *gr1 = new TGraph(1023, time1, ampl1); - gr1->SetTitle("Signal shape for one event"); - gr1->GetXaxis(); - gr1->Draw("Al*"); - } - - tr->GetEntry(499); - TGraph *gr1 = new TGraph(1023, time1, ampl1); - gr1->SetTitle("Signal shape for one event"); - gr1->Draw("Al*");*/ -//----- - Double_t maxAmpl1 = 0.; - Double_t timemaxAmpl1 = 0.; - - for(Int_t i=0; iGetEntries(); i++) { - tr->GetEntry(i); - - //changing polarity of the signal - for(Int_t j=0; j<1023; j++) { - ampl1_pos[j] = ampl1[j]*(-1.); - time1_pos[j] = time1[j]; - } - - //find maximum by hand - maxAmpl1 = ampl1_pos[0]; - for(Int_t j=0; j<1023; j++) { - if(ampl1_pos[j] > maxAmpl1) { - maxAmpl1 = ampl1_pos[j]; - timemaxAmpl1 = time1_pos[j]; - } - //cout<<"Time "< 0.1*maxAmpl1 && ampl1[k] < 0.9*maxAmpl1) { //we have negative signals, amplitude between 10 and 90 proc from maximum - /*cout<<"rjgnfre"<SetTitle("stupido"); - gr2->Fit("pol1"); - gr2->Draw("Al*");*/ - } - } - - //getting integral - TGraph *gr3 = new TGraph(1023, time1, ampl1_pos); - gr3->Integral(120,180); - cout<<"INtegral "<Integral(120,180)<Fill(); - } - tw->GetEntry(498); - TGraph *gr2 = new TGraph(1023, time1_pos, ampl1_pos); - gr2->SetTitle("Signal shape for one gsgsg event"); - gr2->Draw("Al*"); - - fw->cd(); - tw->Write(); - fw->Close(); } diff --git a/macros/daria@nra106 b/macros/daria@nra106 deleted file mode 100644 index f900914b8b4a15b7846977ffa0a4d0864f208c2e..0000000000000000000000000000000000000000 Binary files a/macros/daria@nra106 and /dev/null differ diff --git a/macros/event.C b/macros/event.C deleted file mode 100644 index bc4c745229b53ecead929f045fb124d55b3e94e6..0000000000000000000000000000000000000000 --- a/macros/event.C +++ /dev/null @@ -1,51 +0,0 @@ -#define event_cxx -#include "event.h" -#include -#include -#include -#include - -void event::Loop() -{ -// In a ROOT session, you can do: -// Root > .L event.C -// Root > event t -// Root > t.GetEntry(12); // Fill t data members with entry number 12 -// Root > t.Show(); // Show values of entry 12 -// Root > t.Show(16); // Read and show values of entry 16 -// Root > t.Loop(); // Loop on all entries -// - -// This is the loop skeleton where: -// jentry is the global entry number in the chain -// ientry is the entry number in the current Tree -// Note that the argument to GetEntry must be: -// jentry for TChain::GetEntry -// ientry for TTree::GetEntry and TBranch::GetEntry -// -// To read only selected branches, Insert statements like: -// METHOD1: -// fChain->SetBranchStatus("*",0); // disable all branches -// fChain->SetBranchStatus("branchname",1); // activate branchname -// METHOD2: replace line -// fChain->GetEntry(jentry); //read all branches -//by b_branchname->GetEntry(ientry); //read only this branch - if (fChain == 0) return; - - Long64_t nentries = fChain->GetEntriesFast(); - - Long64_t nbytes = 0, nb = 0; - for (Long64_t jentry=0; jentryGetEntry(jentry); nbytes += nb; - // if (Cut(ientry) < 0) continue; - - //----Daria added - - TGraph *gr3 = new TGraph(1023, time1_pos, ampl1_pos); - gr3->Integral(120,180); - cout<<"INtegral "<Integral(120,180)<Draw(); - } -} diff --git a/macros/event.C~ b/macros/event.C~ deleted file mode 100644 index 2ad224dba58596e519c3b7ed4bd5b8d13099b28f..0000000000000000000000000000000000000000 --- a/macros/event.C~ +++ /dev/null @@ -1,50 +0,0 @@ -#define event_cxx -#include "event.h" -#include -#include -#include - -void event::Loop() -{ -// In a ROOT session, you can do: -// Root > .L event.C -// Root > event t -// Root > t.GetEntry(12); // Fill t data members with entry number 12 -// Root > t.Show(); // Show values of entry 12 -// Root > t.Show(16); // Read and show values of entry 16 -// Root > t.Loop(); // Loop on all entries -// - -// This is the loop skeleton where: -// jentry is the global entry number in the chain -// ientry is the entry number in the current Tree -// Note that the argument to GetEntry must be: -// jentry for TChain::GetEntry -// ientry for TTree::GetEntry and TBranch::GetEntry -// -// To read only selected branches, Insert statements like: -// METHOD1: -// fChain->SetBranchStatus("*",0); // disable all branches -// fChain->SetBranchStatus("branchname",1); // activate branchname -// METHOD2: replace line -// fChain->GetEntry(jentry); //read all branches -//by b_branchname->GetEntry(ientry); //read only this branch - if (fChain == 0) return; - - Long64_t nentries = fChain->GetEntriesFast(); - - Long64_t nbytes = 0, nb = 0; - for (Long64_t jentry=0; jentryGetEntry(jentry); nbytes += nb; - // if (Cut(ientry) < 0) continue; - - //----Daria added - - TGraph *gr3 = new TGraph(1023, time1_pos, ampl1_pos); - gr3->Integral(120,180); - cout<<"INtegral "<Integral(120,180)<Draw(); - } -} diff --git a/macros/event.h b/macros/event.h deleted file mode 100644 index 51b4d74d6a84fcff7077cae85a983847d9e45623..0000000000000000000000000000000000000000 --- a/macros/event.h +++ /dev/null @@ -1,139 +0,0 @@ -////////////////////////////////////////////////////////// -// This class has been automatically generated on -// Mon Dec 26 16:40:43 2016 by ROOT version 5.34/36 -// from TTree drs4analysis/title of drs4 analysis tree -// found on file: ../data/dataDSR4/analysis_07_1.root -////////////////////////////////////////////////////////// - -#ifndef event_h -#define event_h - -#include -#include -#include -#include - -// Header file for the classes stored in the TTree if any. - -// Fixed size dimensions of array or collections stored in the TTree if any. - -class event { -public : - TTree *fChain; //!pointer to the analyzed TTree or TChain - Int_t fCurrent; //!current Tree number in a TChain - - // Declaration of leaf types - Double_t maxAmplitude1; - Double_t timemaxAmplitude1; - Double_t ampl1_pos[1023]; - Double_t time1_pos[1023]; - - // List of branches - TBranch *b_maxAmplitude1; //! - TBranch *b_timemaxAmplitude1; //! - TBranch *b_ampl1_pos; //! - TBranch *b_time1_pos; //! - - event(TTree *tree=0); - virtual ~event(); - virtual Int_t Cut(Long64_t entry); - virtual Int_t GetEntry(Long64_t entry); - virtual Long64_t LoadTree(Long64_t entry); - virtual void Init(TTree *tree); - virtual void Loop(); - virtual Bool_t Notify(); - virtual void Show(Long64_t entry = -1); -}; - -#endif - -#ifdef event_cxx -event::event(TTree *tree) : fChain(0) -{ -// if parameter tree is not specified (or zero), connect the file -// used to generate this class and read the Tree. - if (tree == 0) { - TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("../data/dataDSR4/analysis_07_1.root"); - if (!f || !f->IsOpen()) { - f = new TFile("../data/dataDSR4/analysis_07_1.root"); - } - f->GetObject("drs4analysis",tree); - - } - Init(tree); -} - -event::~event() -{ - if (!fChain) return; - delete fChain->GetCurrentFile(); -} - -Int_t event::GetEntry(Long64_t entry) -{ -// Read contents of entry. - if (!fChain) return 0; - return fChain->GetEntry(entry); -} -Long64_t event::LoadTree(Long64_t entry) -{ -// Set the environment to read one entry - if (!fChain) return -5; - Long64_t centry = fChain->LoadTree(entry); - if (centry < 0) return centry; - if (fChain->GetTreeNumber() != fCurrent) { - fCurrent = fChain->GetTreeNumber(); - Notify(); - } - return centry; -} - -void event::Init(TTree *tree) -{ - // The Init() function is called when the selector needs to initialize - // a new tree or chain. Typically here the branch addresses and branch - // pointers of the tree will be set. - // It is normally not necessary to make changes to the generated - // code, but the routine can be extended by the user if needed. - // Init() will be called many times when running on PROOF - // (once per file to be processed). - - // Set branch addresses and branch pointers - if (!tree) return; - fChain = tree; - fCurrent = -1; - fChain->SetMakeClass(1); - - fChain->SetBranchAddress("maxAmplitude1", &maxAmplitude1, &b_maxAmplitude1); - fChain->SetBranchAddress("timemaxAmplitude1", &timemaxAmplitude1, &b_timemaxAmplitude1); - fChain->SetBranchAddress("ampl1_pos", ampl1_pos, &b_ampl1_pos); - fChain->SetBranchAddress("time1_pos", time1_pos, &b_time1_pos); - Notify(); -} - -Bool_t event::Notify() -{ - // The Notify() function is called when a new file is opened. This - // can be either for a new TTree in a TChain or when when a new TTree - // is started when using PROOF. It is normally not necessary to make changes - // to the generated code, but the routine can be extended by the - // user if needed. The return value is currently not used. - - return kTRUE; -} - -void event::Show(Long64_t entry) -{ -// Print contents of entry. -// If entry is not specified, print current entry - if (!fChain) return; - fChain->Show(entry); -} -Int_t event::Cut(Long64_t entry) -{ -// This function may be called from Loop. -// returns 1 if entry is accepted. -// returns -1 otherwise. - return 1; -} -#endif // #ifdef event_cxx diff --git a/macros/event.h~ b/macros/event.h~ deleted file mode 100644 index 8aa951cf84c23d504305086a81f220b8f22457a5..0000000000000000000000000000000000000000 --- a/macros/event.h~ +++ /dev/null @@ -1,138 +0,0 @@ -////////////////////////////////////////////////////////// -// This class has been automatically generated on -// Mon Dec 26 16:40:43 2016 by ROOT version 5.34/36 -// from TTree drs4analysis/title of drs4 analysis tree -// found on file: ../data/dataDSR4/analysis_07_1.root -////////////////////////////////////////////////////////// - -#ifndef event_h -#define event_h - -#include -#include -#include - -// Header file for the classes stored in the TTree if any. - -// Fixed size dimensions of array or collections stored in the TTree if any. - -class event { -public : - TTree *fChain; //!pointer to the analyzed TTree or TChain - Int_t fCurrent; //!current Tree number in a TChain - - // Declaration of leaf types - Double_t maxAmplitude1; - Double_t timemaxAmplitude1; - Double_t ampl1_pos[1023]; - Double_t time1_pos[1023]; - - // List of branches - TBranch *b_maxAmplitude1; //! - TBranch *b_timemaxAmplitude1; //! - TBranch *b_ampl1_pos; //! - TBranch *b_time1_pos; //! - - event(TTree *tree=0); - virtual ~event(); - virtual Int_t Cut(Long64_t entry); - virtual Int_t GetEntry(Long64_t entry); - virtual Long64_t LoadTree(Long64_t entry); - virtual void Init(TTree *tree); - virtual void Loop(); - virtual Bool_t Notify(); - virtual void Show(Long64_t entry = -1); -}; - -#endif - -#ifdef event_cxx -event::event(TTree *tree) : fChain(0) -{ -// if parameter tree is not specified (or zero), connect the file -// used to generate this class and read the Tree. - if (tree == 0) { - TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("../data/dataDSR4/analysis_07_1.root"); - if (!f || !f->IsOpen()) { - f = new TFile("../data/dataDSR4/analysis_07_1.root"); - } - f->GetObject("drs4analysis",tree); - - } - Init(tree); -} - -event::~event() -{ - if (!fChain) return; - delete fChain->GetCurrentFile(); -} - -Int_t event::GetEntry(Long64_t entry) -{ -// Read contents of entry. - if (!fChain) return 0; - return fChain->GetEntry(entry); -} -Long64_t event::LoadTree(Long64_t entry) -{ -// Set the environment to read one entry - if (!fChain) return -5; - Long64_t centry = fChain->LoadTree(entry); - if (centry < 0) return centry; - if (fChain->GetTreeNumber() != fCurrent) { - fCurrent = fChain->GetTreeNumber(); - Notify(); - } - return centry; -} - -void event::Init(TTree *tree) -{ - // The Init() function is called when the selector needs to initialize - // a new tree or chain. Typically here the branch addresses and branch - // pointers of the tree will be set. - // It is normally not necessary to make changes to the generated - // code, but the routine can be extended by the user if needed. - // Init() will be called many times when running on PROOF - // (once per file to be processed). - - // Set branch addresses and branch pointers - if (!tree) return; - fChain = tree; - fCurrent = -1; - fChain->SetMakeClass(1); - - fChain->SetBranchAddress("maxAmplitude1", &maxAmplitude1, &b_maxAmplitude1); - fChain->SetBranchAddress("timemaxAmplitude1", &timemaxAmplitude1, &b_timemaxAmplitude1); - fChain->SetBranchAddress("ampl1_pos", ampl1_pos, &b_ampl1_pos); - fChain->SetBranchAddress("time1_pos", time1_pos, &b_time1_pos); - Notify(); -} - -Bool_t event::Notify() -{ - // The Notify() function is called when a new file is opened. This - // can be either for a new TTree in a TChain or when when a new TTree - // is started when using PROOF. It is normally not necessary to make changes - // to the generated code, but the routine can be extended by the - // user if needed. The return value is currently not used. - - return kTRUE; -} - -void event::Show(Long64_t entry) -{ -// Print contents of entry. -// If entry is not specified, print current entry - if (!fChain) return; - fChain->Show(entry); -} -Int_t event::Cut(Long64_t entry) -{ -// This function may be called from Loop. -// returns 1 if entry is accepted. -// returns -1 otherwise. - return 1; -} -#endif // #ifdef event_cxx diff --git a/macros/event_C.d b/macros/event_C.d deleted file mode 100644 index be304615f3be2585ef8d9efc6c5fd3f96aa6f8f2..0000000000000000000000000000000000000000 --- a/macros/event_C.d +++ /dev/null @@ -1,47 +0,0 @@ - -# DO NOT DELETE - -./event_C.so: event.h /usr/include/root/TROOT.h -./event_C.so: /usr/include/root/TDirectory.h /usr/include/root/TNamed.h -./event_C.so: /usr/include/root/TObject.h /usr/include/root/Rtypes.h -./event_C.so: /usr/include/root/RConfig.h /usr/include/root/RVersion.h -./event_C.so: /usr/include/root/DllImport.h /usr/include/root/Rtypeinfo.h -./event_C.so: /usr/include/root/snprintf.h /usr/include/root/strlcpy.h -./event_C.so: /usr/include/root/TGenericClassInfo.h -./event_C.so: /usr/include/root/TSchemaHelper.h /usr/include/root/TStorage.h -./event_C.so: /usr/include/root/TVersionCheck.h /usr/include/root/Riosfwd.h -./event_C.so: /usr/include/root/TBuffer.h /usr/include/root/TString.h -./event_C.so: /usr/include/root/TMathBase.h /usr/include/root/TList.h -./event_C.so: /usr/include/root/TSeqCollection.h -./event_C.so: /usr/include/root/TCollection.h /usr/include/root/TIterator.h -./event_C.so: /usr/include/root/TDatime.h /usr/include/root/TUUID.h -./event_C.so: /usr/include/root/TChain.h /usr/include/root/TTree.h -./event_C.so: /usr/include/root/TBranch.h /usr/include/root/TObjArray.h -./event_C.so: /usr/include/root/TAttFill.h /usr/include/root/TDataType.h -./event_C.so: /usr/include/root/TDictionary.h /usr/include/root/Property.h -./event_C.so: /usr/include/root/ESTLType.h /usr/include/root/TAttLine.h -./event_C.so: /usr/include/root/TAttMarker.h /usr/include/root/TArrayD.h -./event_C.so: /usr/include/root/TArray.h /usr/include/root/TArrayI.h -./event_C.so: /usr/include/root/TClass.h /usr/include/root/TObjString.h -./event_C.so: /usr/include/root/ThreadLocalStorage.h -./event_C.so: /usr/include/root/RConfigure.h -./event_C.so: /usr/include/root/TVirtualTreePlayer.h -./event_C.so: /usr/include/root/TFile.h /usr/include/root/TDirectoryFile.h -./event_C.so: /usr/include/root/TMap.h /usr/include/root/THashTable.h -./event_C.so: /usr/include/root/TUrl.h /usr/include/root/TGraph.h -./event_C.so: /usr/include/root/TVectorFfwd.h /usr/include/root/TVectorDfwd.h -./event_C.so: /usr/include/root/TFitResultPtr.h /usr/include/root/TH2.h -./event_C.so: /usr/include/root/TH1.h /usr/include/root/TAxis.h -./event_C.so: /usr/include/root/TAttAxis.h /usr/include/root/TArrayC.h -./event_C.so: /usr/include/root/TArrayS.h /usr/include/root/TArrayF.h -./event_C.so: /usr/include/root/Foption.h /usr/include/root/TMatrixFBasefwd.h -./event_C.so: /usr/include/root/TMatrixDBasefwd.h /usr/include/root/TStyle.h -./event_C.so: /usr/include/root/TAttText.h /usr/include/root/TCanvas.h -./event_C.so: /usr/include/root/TPad.h /usr/include/root/TVirtualPad.h -./event_C.so: /usr/include/root/TAttPad.h /usr/include/root/TVirtualX.h -./event_C.so: /usr/include/root/GuiTypes.h /usr/include/root/Buttons.h -./event_C.so: /usr/include/root/TQObject.h /usr/include/root/TAttBBox2D.h -./event_C.so: /usr/include/root/TPoint.h /usr/include/root/TAttCanvas.h -./event_C.so: /usr/include/root/TCanvasImp.h -./event_C.so: /usr/include/root/cintdictversion.h /usr/include/root/RVersion.h -event_C__ROOTBUILDVERSION= 5.34/36 diff --git a/macros/event_C.so b/macros/event_C.so deleted file mode 100755 index 26377864840a5c4588fc610bf598c3f46a104dc7..0000000000000000000000000000000000000000 Binary files a/macros/event_C.so and /dev/null differ diff --git a/macros/makeClass.cxx b/macros/makeClass.cxx deleted file mode 100644 index 3c1c400243ac01f02ac40735e2116ba85cd9a73d..0000000000000000000000000000000000000000 --- a/macros/makeClass.cxx +++ /dev/null @@ -1,7 +0,0 @@ -{ - TFile fr("../data/dataDSR4/analysis_07_1.root"); - TTree *tr = (TTree*)fr.Get("drs4analysis"); - - tr->MakeClass("event"); - -} diff --git a/macros/makeClass.cxx~ b/macros/makeClass.cxx~ deleted file mode 100644 index bc45e53f128b1f1f403f36fefd24ca420a3c0149..0000000000000000000000000000000000000000 --- a/macros/makeClass.cxx~ +++ /dev/null @@ -1,10 +0,0 @@ -{ - TFile fr("../data/dataDSR4/analysis_07_1.root"); - TTree *tr = (TTree*)fr.Get("drs4analysis"); - - tr->MakeClass("event"); -// gSystem->Load("/home/dariak/NeuRad_tests/macros/event_C.so"); -// event ev; -// ev. - -} diff --git a/macros/test.cxx b/macros/test.cxx index b236ea4ae8ca499a71b307639866fd0809945f57..76f71433088aef514e9f87f454cf8d031b57a350 100644 --- a/macros/test.cxx +++ b/macros/test.cxx @@ -1,15 +1,31 @@ -//void test() +void test() { gSystem->Load("../libData.so"); - RawData o; + TFile fr("../data/rawDataDSR4/NeuRad_test_07_1.root"); + TTree *tr = (TTree*)fr.Get("rtree"); - Double_t *m = o.GetAmp(); + RawEvent *revent = new RawEvent(); + tr->SetBranchAddress("rawEvent",&revent); - for(Int_t i = 0; i < 1024; i++) { - m[i] = 1; + TGraph *gr[10]; + + for (Int_t i = 0; i < 10; i++) { + gr[i] = 0; + tr->GetEntry(i+28); + gr[i] = new TGraph(*revent->GetGraph()); + } + + + auto c1 = new TCanvas("c1","test",10,10,1000,600); + c1->Divide(3,2); + + for (Int_t i = 0; i < 6; i++) { + c1->cd(i+1); + gr[i]->Draw(); } - o.Print(); +// c1->cd(2); +// tr->Draw("gAmp.Draw()","","goff",1,124); } diff --git a/macros/testShowGraphs.cxx b/macros/testShowGraphs.cxx new file mode 100644 index 0000000000000000000000000000000000000000..82fc03f0b180344b35029323aae8bc98cee002bc --- /dev/null +++ b/macros/testShowGraphs.cxx @@ -0,0 +1,31 @@ +void testShowGraphs() +{ + + gSystem->Load("../libData.so"); + + TFile fr("../data/rawDataDSR4/NeuRad_test_07_1.root"); + TTree *tr = (TTree*)fr.Get("rtree"); + + RawEvent *revent = new RawEvent(); + tr->SetBranchAddress("rawEvent",&revent); + + TGraph *gr[10]; + + for (Int_t i = 0; i < 10; i++) { + gr[i] = 0; + tr->GetEntry(i+28); + gr[i] = new TGraph(*revent->GetGraph()); + } + + + auto c1 = new TCanvas("c1","test",10,10,1000,600); + c1->Divide(3,2); + + for (Int_t i = 0; i < 6; i++) { + c1->cd(i+1); + gr[i]->Draw(); + } + +// c1->cd(2); +// tr->Draw("gAmp.Draw()","","goff",1,124); +} diff --git a/macros/try_event_class.cxx~ b/macros/try_event_class.cxx~ deleted file mode 100644 index 34f32820269d18f0390a8917491754ecb8d77187..0000000000000000000000000000000000000000 --- a/macros/try_event_class.cxx~ +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include - -using namespace std; - -void try_event_class() -{ - gSystem->Load("/home/dariak/NeuRad_tests/macros/event_C.so"); - event ev; - ev.GetEntry(501); - ev.Show(); - ev.Loop(); - - -}