diff --git a/convertDRS4/read_root.C b/convertDRS4/read_root.C index ca691829030c073a0fd3f87cc84dd4c0dc6b2b1b..04d5f38146c7a5f04aacd617340ecc2cd4c091b1 100644 --- a/convertDRS4/read_root.C +++ b/convertDRS4/read_root.C @@ -10,18 +10,25 @@ void read_root() // time1.Set(ncellMax); const int ncellMax = 1030; - Double_t ampl1[ncellMax]; - Double_t time1[ncellMax]; +// int ncells; + Double_t ampl1[1023]; + Double_t time1[1023]; + Double_t ampl1_pos[1023]; //branch for positive signals + Double_t maxAmplitude1; + Double_t timemaxAmplitude1; + Double_t time1_pos[1023]; TFile *fw = new TFile("/home/dariak/NeuRad_tests/data/dataDSR4/analysis_07_1.root", "RECREATE"); TTree *tw = new TTree("drs4analysis", "title of drs4 analysis tree"); - Double_t minAmplitude1; - tw->Branch("minAmplitude1", &minAmplitude1, "minAmplitude1/D"); -/* Double_t ampl1[1024]; - Double_t time1[1024];*/ 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: "<Draw("Al*"); } - tr->GetEntry(428); + tr->GetEntry(499); TGraph *gr1 = new TGraph(1023, time1, ampl1); gr1->SetTitle("Signal shape for one event"); gr1->Draw("Al*");*/ //----- - Double_t minAmpl1 = 0.; + Double_t maxAmpl1 = 0.; + Double_t timemaxAmpl1 = 0.; for(Int_t i=0; iGetEntries(); i++) { tr->GetEntry(i); - minAmpl1 = ampl1[0]; + + //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 minimum by hand + //find maximum by hand + maxAmpl1 = ampl1_pos[0]; for(Int_t j=0; j<1023; j++) { - //cout< maxAmpl1) { + maxAmpl1 = ampl1_pos[j]; + timemaxAmpl1 = time1_pos[j]; } - /*cout<<"Time "< 0.9*minAmpl1) { //we have negative signals, amplitude between 10 and 90 proc from minimum + if(ampl1[k] > 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); - //for(Int_t k=120; k<180; k++) { + //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/data/dataDSR4/analysis_07_1.root b/data/dataDSR4/analysis_07_1.root index 7c495ba3f79138280dc4643197aefff4dd0f0c10..a02252f0f4c0182996abcff0496f4a0e055c9b6a 100644 Binary files a/data/dataDSR4/analysis_07_1.root and b/data/dataDSR4/analysis_07_1.root differ diff --git a/macros/daria@nra106 b/macros/daria@nra106 new file mode 100644 index 0000000000000000000000000000000000000000..f900914b8b4a15b7846977ffa0a4d0864f208c2e Binary files /dev/null and b/macros/daria@nra106 differ diff --git a/macros/event.C b/macros/event.C new file mode 100644 index 0000000000000000000000000000000000000000..bc4c745229b53ecead929f045fb124d55b3e94e6 --- /dev/null +++ b/macros/event.C @@ -0,0 +1,51 @@ +#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~ new file mode 100644 index 0000000000000000000000000000000000000000..2ad224dba58596e519c3b7ed4bd5b8d13099b28f --- /dev/null +++ b/macros/event.C~ @@ -0,0 +1,50 @@ +#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 new file mode 100644 index 0000000000000000000000000000000000000000..51b4d74d6a84fcff7077cae85a983847d9e45623 --- /dev/null +++ b/macros/event.h @@ -0,0 +1,139 @@ +////////////////////////////////////////////////////////// +// 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~ new file mode 100644 index 0000000000000000000000000000000000000000..8aa951cf84c23d504305086a81f220b8f22457a5 --- /dev/null +++ b/macros/event.h~ @@ -0,0 +1,138 @@ +////////////////////////////////////////////////////////// +// 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 new file mode 100644 index 0000000000000000000000000000000000000000..be304615f3be2585ef8d9efc6c5fd3f96aa6f8f2 --- /dev/null +++ b/macros/event_C.d @@ -0,0 +1,47 @@ + +# 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 new file mode 100755 index 0000000000000000000000000000000000000000..26377864840a5c4588fc610bf598c3f46a104dc7 Binary files /dev/null and b/macros/event_C.so differ diff --git a/macros/makeClass.cxx b/macros/makeClass.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3c1c400243ac01f02ac40735e2116ba85cd9a73d --- /dev/null +++ b/macros/makeClass.cxx @@ -0,0 +1,7 @@ +{ + 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~ new file mode 100644 index 0000000000000000000000000000000000000000..bc45e53f128b1f1f403f36fefd24ca420a3c0149 --- /dev/null +++ b/macros/makeClass.cxx~ @@ -0,0 +1,10 @@ +{ + 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/try_event_class.cxx b/macros/try_event_class.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a34763766fa3669e1a7a6c7a77d9147228eb798b --- /dev/null +++ b/macros/try_event_class.cxx @@ -0,0 +1,15 @@ +#include +#include + +using namespace std; + +void try_event_class() +{ + gSystem->Load("/home/dariak/NeuRad_tests/macros/event_C.so"); + event ev; + ev.GetEntry(499); + ev.Show(); + ev.Loop(); + + +} diff --git a/macros/try_event_class.cxx~ b/macros/try_event_class.cxx~ new file mode 100644 index 0000000000000000000000000000000000000000..34f32820269d18f0390a8917491754ecb8d77187 --- /dev/null +++ b/macros/try_event_class.cxx~ @@ -0,0 +1,15 @@ +#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(); + + +} diff --git a/macros/unname.gif b/macros/unname.gif new file mode 100644 index 0000000000000000000000000000000000000000..f900914b8b4a15b7846977ffa0a4d0864f208c2e Binary files /dev/null and b/macros/unname.gif differ