From 5bb5f5895653d540dd830552f8ab07cbd8eed4ee Mon Sep 17 00:00:00 2001 From: "Ryan@SOLARIS_testStation" Date: Mon, 8 Jul 2024 14:52:46 -0400 Subject: [PATCH] still working on the Monitor --- Armory/ClassReactionConfig.h | 4 +- working/ClassMonPlotter.h | 215 +++++++++++++++++++++++++------ working/MonAnalyzer.C | 88 +++++++++++++ working/MonAnalyzer.h | 115 +++++++++++++++++ working/Monitor.C | 236 ++++++++++++++++------------------- working/Monitor.h | 97 +++++--------- working/test.C | 37 ++++-- 7 files changed, 547 insertions(+), 245 deletions(-) create mode 100644 working/MonAnalyzer.C create mode 100644 working/MonAnalyzer.h diff --git a/Armory/ClassReactionConfig.h b/Armory/ClassReactionConfig.h index e8cd448..caeb77e 100644 --- a/Armory/ClassReactionConfig.h +++ b/Armory/ClassReactionConfig.h @@ -263,9 +263,9 @@ inline void ReactionConfig::Print(int ID, bool withEx) const{ } printf("================================= Number of recoil reactions : %zu\n", recoil.size()); - for( size_t i = 0; i < recoil.size(); i ++ ){ + for( int i = 0; i < (int)recoil.size(); i ++ ){ if( ID == i || ID < 0 ){ - printf("------------------------------------------ Recoil-%zu\n", i); + printf("------------------------------------------ Recoil-%d\n", i); recoil[i].Print(); if( withEx ) exList[i].Print(); } diff --git a/working/ClassMonPlotter.h b/working/ClassMonPlotter.h index 1fcbd10..0fc8a69 100644 --- a/working/ClassMonPlotter.h +++ b/working/ClassMonPlotter.h @@ -40,7 +40,7 @@ * Excitation energy calls Ex * * * * * -* TH2D is always using "V" to seperate 2 variables, like eVx * +* TH2D is always using "_" to seperate 2 variables, like e_x * * * * histogram with TCutG, add suffix "GC" for Graphical-Cut. * * * @@ -49,54 +49,84 @@ class MonPlotter{ public: - MonPlotter(unsigned short arrayID, DetGeo * detGeo); + MonPlotter(unsigned short arrayID, DetGeo * detGeo, int numRDT); ~MonPlotter(); - void SetUpCanvas(TString title, int sizeX, int sizeY, int divX, int divY); - - void SetUpHistograms(int * energyRange, double * exRange, int * thetaCMRange, int numRDT); + void SetUpCanvas(TString title, int padSize, int divX, int divY); + void SetUpHistograms(int * rawEnergyRange, int * energyRange, double * exRange, int * thetaCMRange, int * rdtDERange, int * rdtERange); void Plot(); TCanvas * canvas; + //====================== Histograms + //======== raw data + TH2F * he_ID, * hxf_ID, * hxn_ID; // vs ID + + TH1I * hArrayMulti; + + TH1F ** he, ** hxf, ** hxn; //basic data + TH2F ** hxf_xn, ** he_xs; // correlation + + //====== cal data + TH1F ** heCal; + TH2F ** hxfCal_xnCal; + TH2F ** he_xsCal; // raw e vs xf + TH2F ** he_x; // raw e vs x + //===== eCal V z - TH2F * heCalVz; - TH2F * heCalVzGC; + TH2F * heCal_z; + TH2F * heCal_zGC; + + //======= Recoil + TH2F * hrdt_ID; + TH1F ** hrdt; // single recoil + + TH2F ** hrdt2D; + TH2F ** hrdt2Dg; //====== Ex data TH1F * hEx; TH1F ** hExi; - TH2F ** hExVxCal; - - TH2F * hExThetaCM; + TH2F ** hEx_xCal; TH1F * hExCut1; TH1F * hExCut2; + TH2F * hEx_ThetaCM; + //======================= private: unsigned short aID; int numDet, colDet, rowDet; //array + float detLength; int numRDT; - // DetGeo detGeo; + float recoilOutter; double zRange[2] ; // zMin, zMax TString suffix; + int numPad; -} + template void CreateListOfHist1D(T ** &histList, int size, const char * namePrefix, const char * TitleForm, int binX, float xMin, float xMax); + template void CreateListOfHist2D(T ** &histList, int size, const char * namePrefix, const char * TitleForm, int binX, float xMin, float xMax, int binY, float yMin, float yMax); -MonPlotter::MonPlotter(unsigned short arrayID, DetGeo * detGeo){ +}; +//^################################################################################# +MonPlotter::MonPlotter(unsigned short arrayID, DetGeo * detGeo, int numRDT){ aID = arrayID; numDet = detGeo->array[aID].numDet; colDet = detGeo->array[aID].colDet; - rowDet - numDet/colDet; + rowDet = numDet/colDet; + detLength = detGeo->array[aID].detLength; suffix = Form("_%d", arrayID); - zRange[0] = detGeo.array[aID].zMin - 50; - zRange[1] = detGeo.array[aID].zMax + 50; + this->numRDT = numDet; + recoilOutter = detGeo->aux[aID].outerRadius; + + zRange[0] = detGeo->array[aID].zMin - 50; + zRange[1] = detGeo->array[aID].zMax + 50; canvas = nullptr; @@ -104,50 +134,154 @@ MonPlotter::MonPlotter(unsigned short arrayID, DetGeo * detGeo){ MonPlotter::~MonPlotter(){ + printf("=============== %s\n", __func__); + delete canvas; - delete [] heCalVz; - delete [] heCalVzGC; - delete [] hEx; - for( int i = 0; i < detGeo.array[aID].numDet ; i++ ){ - delete [] hExi[i]; - delete [] hExVxCal[i]; + delete he_ID; + delete hxf_ID; + delete hxn_ID; + delete hArrayMulti; + + delete heCal_z; + delete hEx_ThetaCM; + delete hExCut1; + delete hExCut2; + delete heCal_zGC; + + delete hrdt_ID; + + for( int i = 0; i < numDet ; i++ ){ + delete he[i]; + delete hxf[i]; + delete hxn[i]; + delete hxf_xn[i]; + delete he_xs[i]; + delete he_x[i]; + delete heCal[i]; + delete hExi[i]; + delete hEx_xCal[i]; } + + for( int i = 0; i < numRDT; i++){ + delete hrdt[i]; + } + for( int i = 0; i < numRDT/2; i++){ + delete hrdt2D[i]; + delete hrdt2Dg[i]; + } + + delete [] he; + delete [] hxf; + delete [] hxn; + delete [] hxf_xn; + delete [] he_xs; + delete [] he_x; + delete [] heCal; delete [] hExi; - delete [] hExVxCal; - delete [] hExThetaCM; - delete [] hExCut1; - delete [] hExCut2; + delete [] hEx_xCal; + delete [] hrdt; + delete [] hrdt2D; + delete [] hrdt2Dg; } -void MonPlotter::SetUpCanvas(TString title, int sizeX, int sizeY, int divX, int divY){ +void MonPlotter::SetUpCanvas(TString title, int padSize, int divX, int divY){ - canvas = new TCanvas("canavs" + suffix, title, 200 * aID, 200 * aID, sizeX, sizeY); + canvas = new TCanvas("canavs" + suffix, title, 200 * aID, 200 * aID, divX * padSize, divY * padSize); canvas->Divide(divX, divY); + numPad = divX * divY; } -void MonPlotter::SetUpHistograms(int * energyRange, double * exRange, int * thetaCMRange){ +template void MonPlotter::CreateListOfHist1D(T ** &histList, + int size, + const char * namePrefix, + const char * TitleForm, + int binX, float xMin, float xMax){ - this->numRDT = numRDT; + //printf(" Making %d of %s.\n", size, namePrefix); + histList = new T * [size]; + for(int i = 0; i < size; i++) { + histList[i] = new T(Form("%s%d", namePrefix, i) + suffix, Form(TitleForm, i), binX, xMin, xMax); + } +} + +template void MonPlotter::CreateListOfHist2D(T ** &histList, + int size, + const char * namePrefix, + const char * TitleForm, + int binX, float xMin, float xMax, + int binY, float yMin, float yMax){ + + //printf(" Making %d of %s.\n", size, namePrefix); + histList = new T * [size]; + for(int i = 0; i < size; i++) { + histList[i] = new T(Form("%s%d", namePrefix, i) + suffix, Form(TitleForm, i), binX, xMin, xMax, binY, yMin, yMax); + } +} + +void MonPlotter::SetUpHistograms(int * rawEnergyRange, int * energyRange, double * exRange, int * thetaCMRange, int * rdtDERange, int * rdtERange){ + + he_ID = new TH2F("he_ID" + suffix, "Raw e vs array ID; Array ID; Raw e", numDet, 0, numDet, 200, rawEnergyRange[0], rawEnergyRange[1]); + hxf_ID = new TH2F("hxf_ID" + suffix, "Raw xf vs array ID; Array ID; Raw xf", numDet, 0, numDet, 200, rawEnergyRange[0], rawEnergyRange[1]); + hxn_ID = new TH2F("hxn_ID" + suffix, "Raw xn vs array ID; Array ID; Raw xn", numDet, 0, numDet, 200, rawEnergyRange[0], rawEnergyRange[1]); + + hArrayMulti = new TH1I("hArrayMulti", "Array Multiplicity", numDet, 0, numDet); + + CreateListOfHist1D(he, numDet, "he", "Raw e (ch=%d); e (channel); count", 200, rawEnergyRange[0], rawEnergyRange[1]); + CreateListOfHist1D(hxf, numDet, "hxf", "Raw xf (ch=%d); e (channel); count", 200, rawEnergyRange[0], rawEnergyRange[1]); + CreateListOfHist1D(hxn, numDet, "hxn", "Raw xn (ch=%d); e (channel); count", 200, rawEnergyRange[0], rawEnergyRange[1]); + + CreateListOfHist2D(hxf_xn, numDet, "hxf_xn", "Raw xf vs. xn (ch=%d);xf (channel);xn (channel)" , 500, rawEnergyRange[0], rawEnergyRange[1], 500, rawEnergyRange[0], rawEnergyRange[1]); + CreateListOfHist2D(he_xs, numDet, "he_xs", "Raw e vs xf+xn (ch=%d); xf+xn (channel); e (channel)", 500, rawEnergyRange[0], rawEnergyRange[1], 500, rawEnergyRange[0], rawEnergyRange[1]); + + CreateListOfHist1D(heCal, numDet, "heCal", "Corrected e (ch=%d); e (MeV); count", 2000, energyRange[0], energyRange[1]); + + CreateListOfHist2D(hxfCal_xnCal, numDet, "hxfCal_xnCal", "Corrected XF vs. XN (ch=%d);XF (channel);XN (channel)", 500, 0, rawEnergyRange[1], 500, 0, rawEnergyRange[1]); + CreateListOfHist2D(he_xsCal , numDet, "he_xsCal", "Raw e vs Corrected xf+xn (ch=%d); corrected xf+xn (channel); Raw e (channel)", 500, rawEnergyRange[0], rawEnergyRange[1], 500, rawEnergyRange[0], rawEnergyRange[1]); + + CreateListOfHist2D(he_x , numDet, "he_x", "Raw e vs x (ch=%d); x (mm); Raw e (channel)", 500, rawEnergyRange[0], rawEnergyRange[1], 500, -1, detLength +1); //====================== E-Z plot - heCalVz = new TH2F("heCalVz" + suffix , "E vs. Z;Z (mm);E (MeV)" , 400, zRange[0], zRange[1], 400, energyRange[0], energyRange[1]); - heCalVzGC = new TH2F("heCalVzGC" + suffix ,"E vs. Z gated;Z (mm);E (MeV)", 400, zRange[0], zRange[1], 400, energyRange[0], energyRange[1]); + heCal_z = new TH2F("heCal_z" + suffix , "E vs. Z;Z (mm);E (MeV)" , 400, zRange[0], zRange[1], 400, energyRange[0], energyRange[1]); + heCal_zGC = new TH2F("heCal_zGC" + suffix ,"E vs. Z gated;Z (mm);E (MeV)", 400, zRange[0], zRange[1], 400, energyRange[0], energyRange[1]); - //===================== energy spectrum - hEx = new TH1F("hEx",Form("excitation spectrum w/ goodFlag; Ex [MeV] ; Count / %4.0f keV", exRange[0]), (int) (exRange[2]-exRange[1])/exRange[0]*1000, exRange[1], exRange[2]); + //===================== Recoil + int rdtRange[2]; + rdtRange[0] = rdtDERange[0] < rdtERange[0] ? rdtDERange[0] : rdtERange[0]; + rdtRange[1] = rdtDERange[1] > rdtERange[1] ? rdtDERange[1] : rdtERange[1]; + + hrdt_ID = new TH2F("hrdt_ID" + suffix, "Raw RDT vs ID; ID; Raw RDT", numRDT, 0, numRDT, 400, rdtRange[0], rdtRange[1]); + + hrdt = new TH1F * [numRDT]; + hrdt2D = new TH2F * [numRDT/2]; + hrdt2Dg = new TH2F * [numRDT/2]; + + for (Int_t i = 0; i < numRDT ; i++) { + if( i % 2 == 0 ) hrdt[i] = new TH1F(Form("hrdt%d",i), Form("Raw Recoil E(ch=%d); E (channel)",i), 500, rdtERange[0], rdtERange[1]); + if( i % 2 == 1 ) hrdt[i] = new TH1F(Form("hrdt%d",i), Form("Raw Recoil DE(ch=%d); DE (channel)",i), 500, rdtDERange[0], rdtDERange[1]); + + ///dE vs E + if( i % 2 == 0 ) { + int tempID = i / 2; + hrdt2D[tempID] = new TH2F(Form("hrdt2D%d",tempID) , Form("Raw Recoil DE vs Eres (dE=%d, E=%d); Eres (channel); DE (channel)", i+1, i), 500, rdtERange[0], rdtERange[1],500,rdtDERange[0],rdtDERange[1]); + hrdt2Dg[tempID] = new TH2F(Form("hrdt2Dg%d",tempID), Form("Gated Raw Recoil DE vs Eres (dE=%d, E=%d); Eres (channel); DE (channel)",i+1, i), 500, rdtERange[0], rdtERange[1],500,rdtDERange[0], rdtDERange[1]); + } + } + + //===================== energy spectrum + hEx = new TH1F("hEx" + suffix, Form("excitation spectrum w/ goodFlag; Ex [MeV] ; Count / %4.0f keV", exRange[0]), (int) (exRange[2]-exRange[1])/exRange[0]*1000, exRange[1], exRange[2]); TString haha = "Ex (det=%i) w/goodFlag; Ex [MeV]; Count / " +std::to_string(exRange[0]) + "keV"; hExi = new TH1F * [numDet]; - hExVxCal = new TH2F * [numDet]; + hEx_xCal = new TH2F * [numDet]; for(int i = 0; i < numDet; i++ ){ hExi[i] = new TH1F(Form("hExi%d", i) + suffix, haha, (int) (exRange[2]-exRange[1])/exRange[0]*1000, exRange[1], exRange[2]); - hExVxCal[i] = new TH2F(Form("hExVxCal%d", i) + suffix, + hEx_xCal[i] = new TH2F(Form("hEx_xCal%d", i) + suffix, Form("Ex vs X (ch=%d); X (cm); Ex (MeV)", i), 500, -0.1, 1.1, (int) (exRange[2]-exRange[1])/exRange[0]*1000, exRange[1], exRange[2]); @@ -158,9 +292,16 @@ void MonPlotter::SetUpHistograms(int * energyRange, double * exRange, int * thet hExCut1->SetLineColor(2); hExCut2->SetLineColor(4); - hExThetaCM = new TH2F("hExThetaCM" + suffix, "Ex vs ThetaCM; ThetaCM [deg]; Ex [MeV]", 200, thetaCMRange[0], thetaCMRange[1], (int) (exRange[2]-exRange[1])/exRange[0]*1000, exRange[1], exRange[2]); + hEx_ThetaCM = new TH2F("hExThetaCM" + suffix, "Ex vs ThetaCM; ThetaCM [deg]; Ex [MeV]", 200, thetaCMRange[0], thetaCMRange[1], (int) (exRange[2]-exRange[1])/exRange[0]*1000, exRange[1], exRange[2]); } +void MonPlotter::Plot(){ + + for( int i = 0; i < numPad; i++ ){ + canvas->cd(i+1); + } + +} #endif \ No newline at end of file diff --git a/working/MonAnalyzer.C b/working/MonAnalyzer.C new file mode 100644 index 0000000..6626ed1 --- /dev/null +++ b/working/MonAnalyzer.C @@ -0,0 +1,88 @@ +#define MonAnalyzer_cxx +// The class definition in MonAnalyzer.h has been generated automatically +// by the ROOT utility TTree::MakeSelector(). This class is derived +// from the ROOT class TSelector. For more information on the TSelector +// framework see $ROOTSYS/README/README.SELECTOR or the ROOT User Manual. + + +// The following methods are defined in this file: +// Begin(): called every time a loop on the tree starts, +// a convenient place to create your histograms. +// SlaveBegin(): called after Begin(), when on PROOF called only on the +// slave servers. +// Process(): called for each event, in this function you decide what +// to read and fill your histograms. +// SlaveTerminate: called at the end of the loop on the tree, when on PROOF +// called only on the slave servers. +// Terminate(): called at the end of the loop on the tree, +// a convenient place to draw/fit your histograms. +// +// To use this file, try the following session on your Tree T: +// +// root> T->Process("MonAnalyzer.C") +// root> T->Process("MonAnalyzer.C","some options") +// root> T->Process("MonAnalyzer.C+") +// + + +#include "MonAnalyzer.h" +#include +#include + +void MonAnalyzer::Begin(TTree * /*tree*/) +{ + // The Begin() function is called at the start of the query. + // When running with PROOF Begin() is only called on the client. + // The tree argument is deprecated (on PROOF 0 is passed). + + TString option = GetOption(); +} + +void MonAnalyzer::SlaveBegin(TTree * /*tree*/) +{ + // The SlaveBegin() function is called after the Begin() function. + // When running with PROOF SlaveBegin() is called on each slave server. + // The tree argument is deprecated (on PROOF 0 is passed). + + TString option = GetOption(); + +} + +bool MonAnalyzer::Process(Long64_t entry) +{ + // The Process() function is called for each entry in the tree (or possibly + // keyed object in the case of PROOF) to be processed. The entry argument + // specifies which entry in the currently loaded tree is to be processed. + // When processing keyed objects with PROOF, the object is already loaded + // and is available via the fObject pointer. + // + // This function should contain the \"body\" of the analysis. It can contain + // simple or elaborate selection criteria, run algorithms on the data + // of the event and typically fill histograms. + // + // The processing can be stopped by calling Abort(). + // + // Use fStatus to set the return value of TTree::Process(). + // + // The return value is currently not used. + + fReader.SetLocalEntry(entry); + + return true; +} + +void MonAnalyzer::SlaveTerminate() +{ + // The SlaveTerminate() function is called after all entries or objects + // have been processed. When running with PROOF SlaveTerminate() is called + // on each slave server. + +} + +void MonAnalyzer::Terminate() +{ + // The Terminate() function is the last function to be called during + // a query. It always runs on the client, it can be used to present + // the results graphically or save the results to file. + +} \ No newline at end of file diff --git a/working/MonAnalyzer.h b/working/MonAnalyzer.h new file mode 100644 index 0000000..37378bd --- /dev/null +++ b/working/MonAnalyzer.h @@ -0,0 +1,115 @@ +////////////////////////////////////////////////////////// +// This class has been automatically generated on +// Mon Jul 8 13:26:58 2024 by ROOT version 6.32.02 +// from TTree gen_tree/Tree After GeneralSort +// found on file: ../root_data/gen_run043.root +////////////////////////////////////////////////////////// + +#ifndef MonAnalyzer_h +#define MonAnalyzer_h + +#include +#include +#include +#include +#include +#include +#include + +// Headers needed by this particular selector +#include "TClonesArray.h" + + + +class MonAnalyzer : public TSelector { +public : + TTreeReader fReader; //!the tree reader + TTree *fChain = 0; //!pointer to the analyzed TTree or TChain + + // Readers to access the data (delete the ones you do not need). + TTreeReaderValue EventID = {fReader, "evID"}; + TTreeReaderArray e = {fReader, "e"}; + TTreeReaderArray e_Timestamp = {fReader, "e_t"}; + TTreeReaderArray xf = {fReader, "xf"}; + TTreeReaderArray xf_Timestamp = {fReader, "xf_t"}; + TTreeReaderArray xn = {fReader, "xn"}; + TTreeReaderArray xn_Timestamp = {fReader, "xn_t"}; + TTreeReaderArray rdt = {fReader, "rdt"}; + TTreeReaderArray rdt_Timestamp = {fReader, "rdt_t"}; + TTreeReaderArray trace_fUniqueID = {fReader, "trace.fUniqueID"}; + TTreeReaderArray trace_fBits = {fReader, "trace.fBits"}; + TTreeReaderArray trace_fName = {fReader, "trace.fName"}; + TTreeReaderArray trace_fTitle = {fReader, "trace.fTitle"}; + TTreeReaderArray trace_fLineColor = {fReader, "trace.fLineColor"}; + TTreeReaderArray trace_fLineStyle = {fReader, "trace.fLineStyle"}; + TTreeReaderArray trace_fLineWidth = {fReader, "trace.fLineWidth"}; + TTreeReaderArray trace_fFillColor = {fReader, "trace.fFillColor"}; + TTreeReaderArray trace_fFillStyle = {fReader, "trace.fFillStyle"}; + TTreeReaderArray trace_fMarkerColor = {fReader, "trace.fMarkerColor"}; + TTreeReaderArray trace_fMarkerStyle = {fReader, "trace.fMarkerStyle"}; + TTreeReaderArray trace_fMarkerSize = {fReader, "trace.fMarkerSize"}; + TTreeReaderArray trace_fMinimum = {fReader, "trace.fMinimum"}; + TTreeReaderArray trace_fMaximum = {fReader, "trace.fMaximum"}; + TTreeReaderArray trace_fOption = {fReader, "trace.fOption"}; + TTreeReaderArray trace_e = {fReader, "we"}; + TTreeReaderArray trace_e_time = {fReader, "weT"}; + TTreeReaderArray trace_e_rise = {fReader, "weR"}; + TTreeReaderArray trace_xf = {fReader, "wxf"}; + TTreeReaderArray trace_xf_time = {fReader, "wxfT"}; + TTreeReaderArray trace_xf_rise = {fReader, "wxfR"}; + TTreeReaderArray trace_xn = {fReader, "wxn"}; + TTreeReaderArray trace_xn_time = {fReader, "wxnT"}; + TTreeReaderArray trace_xn_rise = {fReader, "wxnR"}; + TTreeReaderArray trace_rdt = {fReader, "wrdt"}; + TTreeReaderArray trace_rdt_time = {fReader, "wrdtT"}; + TTreeReaderArray trace_rdt_rise = {fReader, "wrdtR"}; + + + MonAnalyzer(TTree * /*tree*/ =0) { } + ~MonAnalyzer() override { } + Int_t Version() const override { return 2; } + void Begin(TTree *tree) override; + void SlaveBegin(TTree *tree) override; + void Init(TTree *tree) override; + bool Notify() override; + bool Process(Long64_t entry) override; + Int_t GetEntry(Long64_t entry, Int_t getall = 0) override { return fChain ? fChain->GetTree()->GetEntry(entry, getall) : 0; } + void SetOption(const char *option) override { fOption = option; } + void SetObject(TObject *obj) override { fObject = obj; } + void SetInputList(TList *input) override { fInput = input; } + TList *GetOutputList() const override { return fOutput; } + void SlaveTerminate() override; + void Terminate() override; + + ClassDefOverride(MonAnalyzer,0); + +}; + +#endif + +#ifdef MonAnalyzer_cxx +void MonAnalyzer::Init(TTree *tree) +{ + // The Init() function is called when the selector needs to initialize + // a new tree or chain. Typically here the reader is initialized. + // 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). + + fReader.SetTree(tree); +} + +bool MonAnalyzer::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 true; +} + + +#endif // #ifdef MonAnalyzer_cxx diff --git a/working/Monitor.C b/working/Monitor.C index 5aec044..7afe47f 100644 --- a/working/Monitor.C +++ b/working/Monitor.C @@ -61,40 +61,27 @@ TString ezCutFile = "";//"ezCut.root"; //############################################ end of user setting -//======== raw data -TH1F ** he, ** hxf, ** hxn, * hMultiHit; //basic data -TH2F ** hxfVxn, ** heVxs, ** heVx; // correlation -TH2F * heVID, * hxfVID, * hxnVID; // vs ID -//====== cal data -TH1F ** heCal; -TH2F ** hxfCalVxnCal; -TH2F ** heVxsCal; // raw e vs xf -TH2F ** heCalVxCal; // eCal vs xCal -TH2F ** heCalVxCalG; // eCal vs xCal +// //======= Recoil +// TH2F * hrdtID; +// TH1F ** hrdt; // single recoil +// TH1F ** hrdtg; -TH2F * heCalID; // e vs id +// TH2F ** hrdt2D; +// TH2F ** hrdt2Dg; -//======= Recoil -TH2F * hrdtID; -TH1F ** hrdt; // single recoil -TH1F ** hrdtg; +// TH1F * hrdtRate1; +// TH1F * hrdtRate2; -TH2F ** hrdt2D; -TH2F ** hrdt2Dg; +// //======= multi-Hit +// TH2I * hmult; +// TH1I * hmultEZ; +// TH2I * hArrayRDTMatrix; +// TH2I * hArrayRDTMatrixG; -TH1F * hrdtRate1; -TH1F * hrdtRate2; - -//======= multi-Hit -TH2I * hmult; -TH1I * hmultEZ; -TH2I * hArrayRDTMatrix; -TH2I * hArrayRDTMatrixG; - -//======= ARRAY-RDT time diff -TH1I * htdiff; -TH1I * htdiffg; +// //======= ARRAY-RDT time diff +// TH1I * htdiff; +// TH1I * htdiffg; /*************************** ***************************/ @@ -130,7 +117,7 @@ void Monitor::Begin(TTree *tree){ printf("########## SOLARIS Monitors.C #########\n"); printf("###########################################################\n"); - for( int i = 0; i < detGeo->numGeo ; ++) plotter[i]->SetUpHistograms(energyRange, exRange, thetaCMRange); + for( int i = 0; i < detGeo->numGeo ; i++) plotter[i]->SetUpHistograms(energyRange, exRange, thetaCMRange); //===================================================== loading parameter @@ -148,9 +135,9 @@ void Monitor::Begin(TTree *tree){ if( (int) corr->rdtCorr.size() < mapping::NRDT ) { printf(" !!!!!!!! size of rdtCorr < NRDT .\n"); } - printf("=====================================================\n"); - printf(" time Range : %5.0f - %5.0f min\n", timeRangeInMin[0], timeRangeInMin[1]); - printf("=====================================================\n"); + // printf("=====================================================\n"); + // printf(" time Range : %5.0f - %5.0f min\n", timeRangeInMin[0], timeRangeInMin[1]); + // printf("=====================================================\n"); //================ Get Recoil cuts; cutG = new TCutG(); @@ -166,71 +153,60 @@ void Monitor::Begin(TTree *tree){ gROOT->cd(); - CreateListOfHist1D(he, 0, mapping::NARRAY, "he", "Raw e (ch=%d); e (channel); count", 200, rawEnergyRange[0], rawEnergyRange[1]); - CreateListOfHist1D(hxf, 0, mapping::NARRAY, "hxf", "Raw xf (ch=%d); e (channel); count", 200, rawEnergyRange[0], rawEnergyRange[1]); - CreateListOfHist1D(hxn, 0, mapping::NARRAY, "hxn", "Raw xn (ch=%d); e (channel); count", 200, rawEnergyRange[0], rawEnergyRange[1]); - CreateListOfHist2D(hxfVxn, 0, mapping::NARRAY, "hxfVxn", "Raw xf vs. xn (ch=%d);xf (channel);xn (channel)" , 500, rawEnergyRange[0], rawEnergyRange[1], 500, rawEnergyRange[0], rawEnergyRange[1]); - CreateListOfHist2D(heVxs, 0, mapping::NARRAY, "heVxs", "Raw e vs xf+xn (ch=%d); xf+xn (channel); e (channel)", 500, rawEnergyRange[0], rawEnergyRange[1], 500, rawEnergyRange[0], rawEnergyRange[1]); + // int startIndex = 0; + // for( int i = 0; i < detGeo->numGeo; i++ ){ + // CreateListOfHist2D(heVx , startIndex, detGeo->array[i].numDet, "heVx", "Raw PSD E vs. X (ch=%d);X (channel);E (channel)", 500, -2.5, detGeo->array[i].detLength + 2.5, 500, rawEnergyRange[0], rawEnergyRange[1]); + // CreateListOfHist2D(heCalVxCal , startIndex, detGeo->array[i].numDet, "heCalVxCal", "Cal PSD E vs. X (ch=%d);X (cm);E (MeV)", 500, -2.5, detGeo->array[i].detLength + 2.5, 500, energyRange[0], energyRange[1]); + // CreateListOfHist2D(heCalVxCalG , startIndex, detGeo->array[i].numDet, "heCalVxCalG", "Cal PSD E vs. X (ch=%d);X (cm);E (MeV)", 500, -2.5, detGeo->array[i].detLength + 2.5, 500, energyRange[0], energyRange[1]); + // startIndex += detGeo->array[i].numDet; + // } - CreateListOfHist1D(heCal, 0, mapping::NARRAY, "heCal", "Corrected e (ch=%d); e (MeV); count", 2000, energyRange[0], energyRange[1]); - - CreateListOfHist2D(hxfCalVxnCal, 0, mapping::NARRAY, "hxfCalVxnCal", "Corrected XF vs. XN (ch=%d);XF (channel);XN (channel)", 500, 0, rawEnergyRange[1], 500, 0, rawEnergyRange[1]); - CreateListOfHist2D(heVxsCal , 0, mapping::NARRAY, "heVxsCal", "Raw e vs Corrected xf+xn (ch=%d); corrected xf+xn (channel); Raw e (channel)", 500, rawEnergyRange[0], rawEnergyRange[1], 500, rawEnergyRange[0], rawEnergyRange[1]); - - int startIndex = 0; - for( int i = 0; i < detGeo->numGeo; i++ ){ - CreateListOfHist2D(heVx , startIndex, detGeo->array[i].numDet, "heVx", "Raw PSD E vs. X (ch=%d);X (channel);E (channel)", 500, -2.5, detGeo->array[i].detLength + 2.5, 500, rawEnergyRange[0], rawEnergyRange[1]); - CreateListOfHist2D(heCalVxCal , startIndex, detGeo->array[i].numDet, "heCalVxCal", "Cal PSD E vs. X (ch=%d);X (cm);E (MeV)", 500, -2.5, detGeo->array[i].detLength + 2.5, 500, energyRange[0], energyRange[1]); - CreateListOfHist2D(heCalVxCalG , startIndex, detGeo->array[i].numDet, "heCalVxCalG", "Cal PSD E vs. X (ch=%d);X (cm);E (MeV)", 500, -2.5, detGeo->array[i].detLength + 2.5, 500, energyRange[0], energyRange[1]); - startIndex += detGeo->array[i].numDet; - } - - heVID = new TH2F("heVID", "Raw e vs channel", mapping::NARRAY, 0, mapping::NARRAY, 500, rawEnergyRange[0], rawEnergyRange[1]); - hxfVID = new TH2F("hxfVID", "Raw xf vs channel", mapping::NARRAY, 0, mapping::NARRAY, 500, rawEnergyRange[0], rawEnergyRange[1]); - hxnVID = new TH2F("hxnVID", "Raw xn vs channel", mapping::NARRAY, 0, mapping::NARRAY, 500, rawEnergyRange[0], rawEnergyRange[1]); + // heVID = new TH2F("heVID", "Raw e vs channel", mapping::NARRAY, 0, mapping::NARRAY, 500, rawEnergyRange[0], rawEnergyRange[1]); + // hxfVID = new TH2F("hxfVID", "Raw xf vs channel", mapping::NARRAY, 0, mapping::NARRAY, 500, rawEnergyRange[0], rawEnergyRange[1]); + // hxnVID = new TH2F("hxnVID", "Raw xn vs channel", mapping::NARRAY, 0, mapping::NARRAY, 500, rawEnergyRange[0], rawEnergyRange[1]); - heCalID = new TH2F("heCalID", "Corrected E vs id; id; E / 10 keV", mapping::NARRAY, 0, mapping::NARRAY, 2000, energyRange[0], energyRange[1]); + // heCalID = new TH2F("heCalID", "Corrected E vs id; id; E / 10 keV", mapping::NARRAY, 0, mapping::NARRAY, 2000, energyRange[0], energyRange[1]); - hMultiHit = new TH1F("hMultiHit", "Multi-Hit of Energy", 10, 0, 1); + // hMultiHit = new TH1F("hMultiHit", "Multi-Hit of Energy", 10, 0, 1); - //===================== Recoils - hrdtID = new TH2F("hrdtID", "RDT vs ID; ID; energy [ch]", 8, 0, 8, 500, TMath::Min(rdtERange[0], rdtDERange[0]), TMath::Max(rdtERange[1], rdtDERange[1])); + // //===================== Recoils + // hrdtID = new TH2F("hrdtID", "RDT vs ID; ID; energy [ch]", 8, 0, 8, 500, TMath::Min(rdtERange[0], rdtDERange[0]), TMath::Max(rdtERange[1], rdtDERange[1])); - hrdt = new TH1F * [mapping::NRDT]; - hrdtg = new TH1F * [mapping::NRDT]; + // hrdt = new TH1F * [mapping::NRDT]; + // hrdtg = new TH1F * [mapping::NRDT]; - hrdt2D = new TH2F * [mapping::NRDT/2]; - // hrdt2Dg = new TH2F * [mapping::NRDT/2]; + // hrdt2D = new TH2F * [mapping::NRDT/2]; + // // hrdt2Dg = new TH2F * [mapping::NRDT/2]; - for (Int_t i = 0; i < mapping::NRDT ; i++) { - if( i % 2 == 0 ) hrdt[i] = new TH1F(Form("hrdt%d",i), Form("Raw Recoil E(ch=%d); E (channel)",i), 500, rdtERange[0], rdtERange[1]); - if( i % 2 == 0 ) hrdtg[i] = new TH1F(Form("hrdt%dg",i),Form("Raw Recoil E(ch=%d) gated; E (channel)",i), 500, rdtERange[0], rdtERange[1]); - if( i % 2 == 1 ) hrdt[i] = new TH1F(Form("hrdt%d",i), Form("Raw Recoil DE(ch=%d); DE (channel)",i), 500, rdtDERange[0], rdtDERange[1]); - if( i % 2 == 1 ) hrdtg[i] = new TH1F(Form("hrdt%dg",i),Form("Raw Recoil DE(ch=%d) gated; DE (channel)",i), 500, rdtDERange[0], rdtDERange[1]); + // for (Int_t i = 0; i < mapping::NRDT ; i++) { + // if( i % 2 == 0 ) hrdt[i] = new TH1F(Form("hrdt%d",i), Form("Raw Recoil E(ch=%d); E (channel)",i), 500, rdtERange[0], rdtERange[1]); + // if( i % 2 == 0 ) hrdtg[i] = new TH1F(Form("hrdt%dg",i),Form("Raw Recoil E(ch=%d) gated; E (channel)",i), 500, rdtERange[0], rdtERange[1]); + // if( i % 2 == 1 ) hrdt[i] = new TH1F(Form("hrdt%d",i), Form("Raw Recoil DE(ch=%d); DE (channel)",i), 500, rdtDERange[0], rdtDERange[1]); + // if( i % 2 == 1 ) hrdtg[i] = new TH1F(Form("hrdt%dg",i),Form("Raw Recoil DE(ch=%d) gated; DE (channel)",i), 500, rdtDERange[0], rdtDERange[1]); - ///dE vs E - if( i % 2 == 0 ) { - int tempID = i / 2; - hrdt2D[tempID] = new TH2F(Form("hrdt2D%d",tempID) , Form("Raw Recoil DE vs Eres (dE=%d, E=%d); Eres (channel); DE (channel)", i+1, i), 500, rdtERange[0], rdtERange[1],500,rdtDERange[0],rdtDERange[1]); - hrdt2Dg[tempID] = new TH2F(Form("hrdt2Dg%d",tempID), Form("Gated Raw Recoil DE vs Eres (dE=%d, E=%d); Eres (channel); DE (channel)",i+1, i), 500, rdtERange[0], rdtERange[1],500,rdtDERange[0], rdtDERange[1]); - } - } + // ///dE vs E + // if( i % 2 == 0 ) { + // int tempID = i / 2; + // hrdt2D[tempID] = new TH2F(Form("hrdt2D%d",tempID) , Form("Raw Recoil DE vs Eres (dE=%d, E=%d); Eres (channel); DE (channel)", i+1, i), 500, rdtERange[0], rdtERange[1],500,rdtDERange[0],rdtDERange[1]); + // hrdt2Dg[tempID] = new TH2F(Form("hrdt2Dg%d",tempID), Form("Gated Raw Recoil DE vs Eres (dE=%d, E=%d); Eres (channel); DE (channel)",i+1, i), 500, rdtERange[0], rdtERange[1],500,rdtDERange[0], rdtDERange[1]); + // } + // } - hrdtRate1 = new TH1F("hrdtRate1", "recoil rate 1 / min; min; count / 1 min", timeRangeInMin[1] - timeRangeInMin[0], timeRangeInMin[0], timeRangeInMin[1]); - hrdtRate2 = new TH1F("hrdtRate2", "recoil rate 2 / min; min; count / 1 min", timeRangeInMin[1] - timeRangeInMin[0], timeRangeInMin[0], timeRangeInMin[1]); - hrdtRate1->SetLineColor(2); - hrdtRate2->SetLineColor(4); + // hrdtRate1 = new TH1F("hrdtRate1", "recoil rate 1 / min; min; count / 1 min", timeRangeInMin[1] - timeRangeInMin[0], timeRangeInMin[0], timeRangeInMin[1]); + // hrdtRate2 = new TH1F("hrdtRate2", "recoil rate 2 / min; min; count / 1 min", timeRangeInMin[1] - timeRangeInMin[0], timeRangeInMin[0], timeRangeInMin[1]); + // hrdtRate1->SetLineColor(2); + // hrdtRate2->SetLineColor(4); - //===================== multiplicity - hmultEZ = new TH1I("hmultEZ", "Filled EZ with coinTime and recoil", 10, 0, 10); - hmult = new TH2I("hmult", "Array Multiplicity vs Recoil Multiplicity; Array ; Recoil",10, 0, 10, 10, 0, 10); - hArrayRDTMatrix = new TH2I("hArrayRDTMatrix", "Array ID vs Recoil ID; Array ID; Recoil ID", 30, 0, 30, 8, 0, 8); - hArrayRDTMatrixG = new TH2I("hArrayRDTMatrixG", "Array ID vs Recoil ID / g; Array ID; Recoil ID", 30, 0, 30, 8, 0, 8); + // //===================== multiplicity + // hmultEZ = new TH1I("hmultEZ", "Filled EZ with coinTime and recoil", 10, 0, 10); + // hmult = new TH2I("hmult", "Array Multiplicity vs Recoil Multiplicity; Array ; Recoil",10, 0, 10, 10, 0, 10); + // hArrayRDTMatrix = new TH2I("hArrayRDTMatrix", "Array ID vs Recoil ID; Array ID; Recoil ID", 30, 0, 30, 8, 0, 8); + // hArrayRDTMatrixG = new TH2I("hArrayRDTMatrixG", "Array ID vs Recoil ID / g; Array ID; Recoil ID", 30, 0, 30, 8, 0, 8); - //===================== coincident time - htdiff = new TH1I("htdiff" ,"Coincident time (recoil-dE - array); time [ch = 10ns]; count", coinTimeRange[1] - coinTimeRange[0], coinTimeRange[0], coinTimeRange[1]); - htdiffg = new TH1I("htdiffg","Coincident time (recoil-dE - array) w/ recoil gated; time [ch = 10ns]; count", coinTimeRange[1] - coinTimeRange[0], coinTimeRange[0], coinTimeRange[1]); + // //===================== coincident time + // htdiff = new TH1I("htdiff" ,"Coincident time (recoil-dE - array); time [ch = 10ns]; count", coinTimeRange[1] - coinTimeRange[0], coinTimeRange[0], coinTimeRange[1]); + // htdiffg = new TH1I("htdiffg","Coincident time (recoil-dE - array) w/ recoil gated; time [ch = 10ns]; count", coinTimeRange[1] - coinTimeRange[0], coinTimeRange[0], coinTimeRange[1]); printf("============================================ End of histograms Declaration\n"); @@ -348,9 +324,9 @@ Bool_t Monitor::Process(Long64_t entry){ if( TMath::IsNaN(xn[id]) && TMath::IsNaN(xf[id]) ) continue ; //@==================== Calibrations go here - if( corr->xnCorr.size() corr->xfxneCorr.size() ) xnCal[id] = xn[id] * corr->xnCorr[id] * corr->xfxneCorr[id][1] + corr->xfxneCorr[id][0]; - if( corr->xfxneCorr.size() ) xfCal[id] = xf[id] * corr->xfxneCorr[id][1] + corr->xfxneCorr[id][0]; - if( corr->eCorr.size() ) eCal[id] = e[id] / corr->eCorr[id][0] + corr->eCorr[id][1]; + if( corr->xnCorr.size() >= id && corr->xfxneCorr.size() >= id ) xnCal[id] = xn[id] * corr->xnCorr[id] * corr->xfxneCorr[id][1] + corr->xfxneCorr[id][0]; + if( corr->xfxneCorr.size() >= id ) xfCal[id] = xf[id] * corr->xfxneCorr[id][1] + corr->xfxneCorr[id][0]; + if( corr->eCorr.size() >= id) eCal[id] = e[id] / corr->eCorr[id][0] + corr->eCorr[id][1]; if( eCal[id] < eCalCut[0] || eCalCut[1] < eCal[id] ) continue; @@ -372,7 +348,7 @@ Bool_t Monitor::Process(Long64_t entry){ if ( TMath::IsNaN(xf[id]) && !TMath::IsNaN(xn[id]) ) xCal[id] = 1.0 - xnCal[id]/ e[id]; //@======= Scale xcal from (0,1) - if( corr->xScale.size() ) xCal[id] = (xCal[id]-0.5)/corr->xScale[id] + 0.5; /// if include this scale, need to also inclused in Cali_littleTree + if( corr->xScale.size() >= id ) xCal[id] = (xCal[id]-0.5)/corr->xScale[id] + 0.5; /// if include this scale, need to also inclused in Cali_littleTree if( abs(xCal[id] - 0.5) > xGate/2. ) continue; @@ -394,7 +370,8 @@ Bool_t Monitor::Process(Long64_t entry){ heVx[id]->Fill(x[id],e[id]); heCalVxCal[id]->Fill(xCal[id]*detGeo->array[arrayID].detLength, eCal[id]); - heCalVz->Fill(z[id],eCal[id]); + + plotter[arrayID]->heCalVz->Fill(z[id],eCal[id]); //@=================== Recoil Gate if( isRDTExist && (cutList1 || cutList2)){ @@ -460,7 +437,7 @@ Bool_t Monitor::Process(Long64_t entry){ } if( coinFlag && (rdtgate1 || rdtgate2) && ezGate){ - heCalVzGC->Fill( z[id] , eCal[id] ); + plotter[arrayID]->heCalVzGC->Fill( z[id] , eCal[id] ); heCalVxCalG[id]->Fill(xCal[id]*detGeo->array[arrayID].detLength, eCal[id]); @@ -510,21 +487,20 @@ Bool_t Monitor::Process(Long64_t entry){ if( thetaCM > thetaCMGate ) { - hEx->Fill(Ex); - - hExThetaCM->Fill(thetaCM, Ex); + plotter[arrayID]->hEx->Fill(Ex); + plotter[arrayID]->hExThetaCM->Fill(thetaCM, Ex); if( rdtgate1 ) { - hExCut1->Fill(Ex); - hExThetaCM->Fill(thetaCM, Ex); + plotter[arrayID]->hExCut1->Fill(Ex); + plotter[arrayID]->hExThetaCM->Fill(thetaCM, Ex); } if( rdtgate2 ) { - hExCut2->Fill(Ex); - hExThetaCM->Fill(thetaCM, Ex); + plotter[arrayID]->hExCut2->Fill(Ex); + plotter[arrayID]->hExThetaCM->Fill(thetaCM, Ex); } - hExi[id]->Fill(Ex); - hExVxCal[id]->Fill(xCal[id], Ex); + plotter[arrayID]->hExi[id]->Fill(Ex); + plotter[arrayID]->hExVxCal[id]->Fill(xCal[id], Ex); } } @@ -553,10 +529,10 @@ void Monitor::Terminate(){ double yMax = 0; - Isotope hRecoil(AnalysisLib::reactionConfig.recoilHeavyA, AnalysisLib::reactionConfig.recoilHeavyZ); - double Sn = hRecoil.CalSp(0,1); - double Sp = hRecoil.CalSp(1,0); - double Sa = hRecoil.CalSp2(4,2); + // Isotope hRecoil(AnalysisLib::reactionConfig.recoilHeavyA, AnalysisLib::reactionConfig.recoilHeavyZ); + // double Sn = hRecoil.CalSp(0,1); + // double Sp = hRecoil.CalSp(1,0); + // double Sa = hRecoil.CalSp2(4,2); for( int i = 0; i < detGeo->numGeo; i++ ){ @@ -565,49 +541,49 @@ void Monitor::Terminate(){ // cCanvas[i]->Modified(); cCanvas->Update(); // cCanvas[i]->cd(); cCanvas->Divide(canvasDiv[0],canvasDiv[1]); - plotter[i]->canvas->cd(); + plotter[i]->Plot(); ///----------------------------------- Canvas - 1 - PlotEZ(1); /// raw EZ + // PlotEZ(1); /// raw EZ ///----------------------------------- Canvas - 2 - PlotEZ(0); ///gated EZ + // PlotEZ(0); ///gated EZ ///----------------------------------- Canvas - 3 - PlotTDiff(1, 1); ///with Gated Tdiff, isLog + // PlotTDiff(1, 1); ///with Gated Tdiff, isLog ///----------------------------------- Canvas - 4 - padID++; cCanvas->cd(padID); + // padID++; cCanvas->cd(padID); - //hEx->Draw(); - hExCut1->Draw(""); - hExCut2->Draw("same"); - DrawLine(hEx, Sn); - DrawLine(hEx, Sa); + // //hEx->Draw(); + // hExCut1->Draw(""); + // hExCut2->Draw("same"); + // DrawLine(hEx, Sn); + // DrawLine(hEx, Sa); - if(isTimeGateOn)text.DrawLatex(0.15, 0.8, Form("%d < coinTime < %d", timeGate[0], timeGate[1])); - if( xGate < 1 ) text.DrawLatex(0.15, 0.75, Form("with |x-0.5|<%.4f", xGate/2.)); - if( cutList1 ) text.DrawLatex(0.15, 0.7, "with recoil gated"); + // if(isTimeGateOn)text.DrawLatex(0.15, 0.8, Form("%d < coinTime < %d", timeGate[0], timeGate[1])); + // if( xGate < 1 ) text.DrawLatex(0.15, 0.75, Form("with |x-0.5|<%.4f", xGate/2.)); + // if( cutList1 ) text.DrawLatex(0.15, 0.7, "with recoil gated"); ///----------------------------------- Canvas - 5 - padID++; cCanvas->cd(padID); + // padID++; cCanvas->cd(padID); - //Draw2DHist(hExThetaCM); - //heVIDG->Draw(); - //text.DrawLatex(0.15, 0.75, Form("#theta_{cm} > %.1f deg", thetaCMGate)); + // //Draw2DHist(hExThetaCM); + // //heVIDG->Draw(); + // //text.DrawLatex(0.15, 0.75, Form("#theta_{cm} > %.1f deg", thetaCMGate)); - Draw2DHist(hrdt2D[0]); - // Draw2DHist(hrdt2Dsum[0]); + // Draw2DHist(hrdt2D[0]); + // // Draw2DHist(hrdt2Dsum[0]); - if( cutList1 && cutList1->GetEntries() > 0 ) {cutG = (TCutG *)cutList1->At(0) ; cutG->Draw("same");} - if( cutList2 && cutList2->GetEntries() > 0 ) {cutG = (TCutG *)cutList2->At(0) ; cutG->Draw("same");} + // if( cutList1 && cutList1->GetEntries() > 0 ) {cutG = (TCutG *)cutList1->At(0) ; cutG->Draw("same");} + // if( cutList2 && cutList2->GetEntries() > 0 ) {cutG = (TCutG *)cutList2->At(0) ; cutG->Draw("same");} //helum4D->Draw(); //text.DrawLatex(0.25, 0.3, Form("gated from 800 to 1200 ch\n")); ///----------------------------------- Canvas - 6 - PlotRDT(0,0); + // PlotRDT(0,0); // padID++; cCanvas->cd(padID); // Draw2DHist(hrdtExGated); @@ -680,10 +656,10 @@ void Monitor::Terminate(){ ///text.SetTextColor(2); ///----------------------------------- Canvas - 14 - padID++; cCanvas->cd(padID); + // padID++; cCanvas->cd(padID); - hrdtRate1->Draw(""); - hrdtRate2->Draw("same"); + // hrdtRate1->Draw(""); + // hrdtRate2->Draw("same"); ///----------------------------------- Canvas - 15 //padID++; cCanvas->cd(padID); diff --git a/working/Monitor.h b/working/Monitor.h index bb7a6fe..c2bc231 100644 --- a/working/Monitor.h +++ b/working/Monitor.h @@ -121,7 +121,7 @@ public : plotter = new MonPlotter *[detGeo->numGeo]; for( int i = 0; i < detGeo->numGeo; i++ ){ - plotter[i] = new Monitor(i, detGeo); + plotter[i] = new MonPlotter(i, detGeo); } } virtual ~Monitor() { @@ -167,31 +167,13 @@ public : TString fCanvasTitle; void SetCanvasTitle(TString title) {fCanvasTitle = title;} TString GetCanvasTitle() const {return fCanvasTitle;} - - void SetStartStopTimes(std::vector t1, std::vector t2) { - startTime = t1; - endTime = t2; - - timeRangeInMin[0] = startTime[0] * tick2min; - timeRangeInMin[1] = endTime[0] * tick2min; - for( int i = 1; i < (int) endTime.size(); i++) timeRangeInMin[1] += ((endTime[i] - startTime[i]) * tick2min); - - double duration = timeRangeInMin[1] - timeRangeInMin[0]; - - timeRangeInMin[0] = TMath::Floor( timeRangeInMin[0] - duration * 0.1); - timeRangeInMin[1] = TMath::Ceil( timeRangeInMin[1] + duration * 0.1); - - } - void Draw2DHist(TH2F * hist); - - void PlotEZ(bool isRaw); - void PlotTDiff(bool isGated, bool isLog); - void PlotRDT(int id, bool isRaw); + // void Draw2DHist(TH2F * hist); + // void PlotEZ(bool isRaw); + // void PlotTDiff(bool isGated, bool isLog); + // void PlotRDT(int id, bool isRaw); //void PlotCRDTPolar(); - template void CreateListOfHist1D(T ** &histList, int startIndex, int size, const char * namePrefix, const char * TitleForm, int binX, float xMin, float xMax); - template void CreateListOfHist2D(T ** &histList, int startIndex, int size, const char * namePrefix, const char * TitleForm, int binX, float xMin, float xMax, int binY, float yMin, float yMax); ClassDef(Monitor,0); }; @@ -268,14 +250,14 @@ Bool_t Monitor::Notify(){ return kTRUE; } -void DrawLine(TH1 * hist, double pos){ +// void DrawLine(TH1 * hist, double pos){ - double yMax = hist->GetMaximum(); - TLine * line = new TLine(pos, 0, pos, yMax); - line->SetLineColor(2); - line->Draw(""); +// double yMax = hist->GetMaximum(); +// TLine * line = new TLine(pos, 0, pos, yMax); +// line->SetLineColor(2); +// line->Draw(""); -} +// } void Monitor::SlaveBegin(TTree * /*tree*/){ /// not use, if use, place in Monitor.C TString option = GetOption(); @@ -286,56 +268,32 @@ void Monitor::SlaveTerminate(){ /// not use, if use, place in Monitor.C } -template void Monitor::CreateListOfHist1D(T ** &histList, - int startIndex, - int size, - const char * namePrefix, - const char * TitleForm, - int binX, float xMin, float xMax){ - - //printf(" Making %d of %s.\n", size, namePrefix); - histList = new T * [size]; - for(int i = startIndex; i < startIndex + size; i++) histList[i] = new T(Form("%s%d", namePrefix, i), Form(TitleForm, i), binX, xMin, xMax); -} - -template void Monitor::CreateListOfHist2D(T ** &histList, - int startIndex, - int size, - const char * namePrefix, - const char * TitleForm, - int binX, float xMin, float xMax, - int binY, float yMin, float yMax){ - - //printf(" Making %d of %s.\n", size, namePrefix); - histList = new T * [size]; - for(int i = startIndex; i < startIndex + size; i++) histList[i] = new T(Form("%s%d", namePrefix, i), Form(TitleForm, i), binX, xMin, xMax, binY, yMin, yMax); -} /*########################################################### * Plotting Function ###########################################################*/ -void DrawBox(TH1* hist, double x1, double x2, Color_t color, float alpha){ +// void DrawBox(TH1* hist, double x1, double x2, Color_t color, float alpha){ - double yMax = hist->GetMaximum(); - TBox * box = new TBox (x1, 0, x2, yMax); - box->SetFillColorAlpha(color, alpha); - box->Draw(); +// double yMax = hist->GetMaximum(); +// TBox * box = new TBox (x1, 0, x2, yMax); +// box->SetFillColorAlpha(color, alpha); +// box->Draw(); -} +// } -void Monitor::Draw2DHist(TH2F * hist){ +// void Monitor::Draw2DHist(TH2F * hist){ - if( hist->Integral() < 3000 ){ - hist->SetMarkerStyle(20); - hist->SetMarkerSize(0.3); - hist->Draw(""); - }else{ - hist->Draw("colz"); - } -} - +// if( hist->Integral() < 3000 ){ +// hist->SetMarkerStyle(20); +// hist->SetMarkerSize(0.3); +// hist->Draw(""); +// }else{ +// hist->Draw("colz"); +// } +// } +/* void Monitor::PlotEZ(bool isRaw){ padID++; cCanvas->cd(padID); @@ -429,5 +387,6 @@ void Monitor::PlotRDT(int id, bool isRaw){ // cCanvas->cd(padID)->DrawFrame(-50, -50, 50, 50); // hcrdtPolar->Draw("same colz pol"); //} +*/ #endif // #ifdef Monitor_cxx diff --git a/working/test.C b/working/test.C index 878544e..7604300 100644 --- a/working/test.C +++ b/working/test.C @@ -3,6 +3,8 @@ #include "../Cleopatra/ClassHelios.h" #include "../Cleopatra/ClassTransfer.h" +#include "ClassMonPlotter.h" + void test(){ // DetGeo haha("detectorGeo.txt"); @@ -11,17 +13,17 @@ void test(){ // ReactionConfig config("reactionConfig.txt"); // config.Print(); - TransferReaction * transfer = new TransferReaction(); + // TransferReaction * transfer = new TransferReaction(); // transfer->SetReactionSimple(32, 14, 2, 1, 1, 1, 8.8); - int ID = 0; - transfer->SetReactionFromFile("reactionConfig.txt", ID); + // int ID = 0; + // transfer->SetReactionFromFile("reactionConfig.txt", ID); - transfer->PrintReaction(); + // transfer->PrintReaction(); - transfer->Event(25 * TMath::DegToRad(), 0 * TMath::DegToRad()); - transfer->PrintFourVectors(); + // transfer->Event(25 * TMath::DegToRad(), 0 * TMath::DegToRad()); + // transfer->PrintFourVectors(); // ReactionConfig config2 = transfer->GetRectionConfig(); @@ -44,6 +46,27 @@ void test(){ // orb.PrintTrajectory(); // delete helios; - delete transfer; + // delete transfer;root + + DetGeo dd("detectorGeo.txt"); + MonPlotter * pp = new MonPlotter(0, &dd, 8); + + pp->SetUpCanvas("haha", 500, 3, 2); + + int rawEnergyRange[2] = { 100, 4000}; /// share with e, xf, xn + int energyRange[2] = { 0, 10}; /// in the E-Z plot + + int rdtDERange[2] = { 0, 80}; + int rdtERange[2] = { 0, 80}; + + double exRange[3] = { 100, -2, 10}; /// bin [keV], low[MeV], high[MeV] + int thetaCMRange[2] = {0, 80}; + + pp->SetUpHistograms(rawEnergyRange, energyRange, exRange, thetaCMRange, rdtDERange, rdtERange); + + pp->Plot(); + + delete pp; + } \ No newline at end of file