still working on the Monitor

This commit is contained in:
Ryan Tang 2024-07-08 14:52:46 -04:00
parent 7741529c0c
commit 5bb5f58956
7 changed files with 547 additions and 245 deletions

View File

@ -263,9 +263,9 @@ inline void ReactionConfig::Print(int ID, bool withEx) const{
} }
printf("================================= Number of recoil reactions : %zu\n", recoil.size()); 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 ){ if( ID == i || ID < 0 ){
printf("------------------------------------------ Recoil-%zu\n", i); printf("------------------------------------------ Recoil-%d\n", i);
recoil[i].Print(); recoil[i].Print();
if( withEx ) exList[i].Print(); if( withEx ) exList[i].Print();
} }

View File

@ -40,7 +40,7 @@
* Excitation energy calls Ex * * 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. * * histogram with TCutG, add suffix "GC" for Graphical-Cut. *
* * * *
@ -49,54 +49,84 @@
class MonPlotter{ class MonPlotter{
public: public:
MonPlotter(unsigned short arrayID, DetGeo * detGeo); MonPlotter(unsigned short arrayID, DetGeo * detGeo, int numRDT);
~MonPlotter(); ~MonPlotter();
void SetUpCanvas(TString title, int sizeX, int sizeY, int divX, int divY); void SetUpCanvas(TString title, int padSize, int divX, int divY);
void SetUpHistograms(int * energyRange, double * exRange, int * thetaCMRange, int numRDT);
void SetUpHistograms(int * rawEnergyRange, int * energyRange, double * exRange, int * thetaCMRange, int * rdtDERange, int * rdtERange);
void Plot(); void Plot();
TCanvas * canvas; 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 //===== eCal V z
TH2F * heCalVz; TH2F * heCal_z;
TH2F * heCalVzGC; TH2F * heCal_zGC;
//======= Recoil
TH2F * hrdt_ID;
TH1F ** hrdt; // single recoil
TH2F ** hrdt2D;
TH2F ** hrdt2Dg;
//====== Ex data //====== Ex data
TH1F * hEx; TH1F * hEx;
TH1F ** hExi; TH1F ** hExi;
TH2F ** hExVxCal; TH2F ** hEx_xCal;
TH2F * hExThetaCM;
TH1F * hExCut1; TH1F * hExCut1;
TH1F * hExCut2; TH1F * hExCut2;
TH2F * hEx_ThetaCM;
//=======================
private: private:
unsigned short aID; unsigned short aID;
int numDet, colDet, rowDet; //array int numDet, colDet, rowDet; //array
float detLength;
int numRDT; int numRDT;
// DetGeo detGeo; float recoilOutter;
double zRange[2] ; // zMin, zMax double zRange[2] ; // zMin, zMax
TString suffix; TString suffix;
int numPad;
} template<typename T> void CreateListOfHist1D(T ** &histList, int size, const char * namePrefix, const char * TitleForm, int binX, float xMin, float xMax);
template<typename T> 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; aID = arrayID;
numDet = detGeo->array[aID].numDet; numDet = detGeo->array[aID].numDet;
colDet = detGeo->array[aID].colDet; colDet = detGeo->array[aID].colDet;
rowDet - numDet/colDet; rowDet = numDet/colDet;
detLength = detGeo->array[aID].detLength;
suffix = Form("_%d", arrayID); suffix = Form("_%d", arrayID);
zRange[0] = detGeo.array[aID].zMin - 50; this->numRDT = numDet;
zRange[1] = detGeo.array[aID].zMax + 50; recoilOutter = detGeo->aux[aID].outerRadius;
zRange[0] = detGeo->array[aID].zMin - 50;
zRange[1] = detGeo->array[aID].zMax + 50;
canvas = nullptr; canvas = nullptr;
@ -104,50 +134,154 @@ MonPlotter::MonPlotter(unsigned short arrayID, DetGeo * detGeo){
MonPlotter::~MonPlotter(){ MonPlotter::~MonPlotter(){
printf("=============== %s\n", __func__);
delete canvas; delete canvas;
delete [] heCalVz; delete he_ID;
delete [] heCalVzGC; delete hxf_ID;
delete [] hEx; delete hxn_ID;
for( int i = 0; i < detGeo.array[aID].numDet ; i++ ){ delete hArrayMulti;
delete [] hExi[i];
delete [] hExVxCal[i]; 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 [] hExi;
delete [] hExVxCal; delete [] hEx_xCal;
delete [] hExThetaCM;
delete [] hExCut1;
delete [] hExCut2;
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); canvas->Divide(divX, divY);
numPad = divX * divY;
} }
void MonPlotter::SetUpHistograms(int * energyRange, double * exRange, int * thetaCMRange){ template<typename T> 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<typename T> 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 //====================== 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]); heCal_z = new TH2F("heCal_z" + 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_zGC = new TH2F("heCal_zGC" + suffix ,"E vs. Z gated;Z (mm);E (MeV)", 400, zRange[0], zRange[1], 400, energyRange[0], energyRange[1]);
//===================== 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 //===================== 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]); 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"; TString haha = "Ex (det=%i) w/goodFlag; Ex [MeV]; Count / " +std::to_string(exRange[0]) + "keV";
hExi = new TH1F * [numDet]; hExi = new TH1F * [numDet];
hExVxCal = new TH2F * [numDet]; hEx_xCal = new TH2F * [numDet];
for(int i = 0; i < numDet; i++ ){ 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]); 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), Form("Ex vs X (ch=%d); X (cm); Ex (MeV)", i),
500, -0.1, 1.1, 500, -0.1, 1.1,
(int) (exRange[2]-exRange[1])/exRange[0]*1000, exRange[1], exRange[2]); (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); hExCut1->SetLineColor(2);
hExCut2->SetLineColor(4); 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 #endif

88
working/MonAnalyzer.C Normal file
View File

@ -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 <TH2.h>
#include <TStyle.h>
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.
}

115
working/MonAnalyzer.h Normal file
View File

@ -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 <TROOT.h>
#include <TChain.h>
#include <TFile.h>
#include <TSelector.h>
#include <TTreeReader.h>
#include <TTreeReaderValue.h>
#include <TTreeReaderArray.h>
// 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<ULong64_t> EventID = {fReader, "evID"};
TTreeReaderArray<Float_t> e = {fReader, "e"};
TTreeReaderArray<ULong64_t> e_Timestamp = {fReader, "e_t"};
TTreeReaderArray<Float_t> xf = {fReader, "xf"};
TTreeReaderArray<ULong64_t> xf_Timestamp = {fReader, "xf_t"};
TTreeReaderArray<Float_t> xn = {fReader, "xn"};
TTreeReaderArray<ULong64_t> xn_Timestamp = {fReader, "xn_t"};
TTreeReaderArray<Float_t> rdt = {fReader, "rdt"};
TTreeReaderArray<ULong64_t> rdt_Timestamp = {fReader, "rdt_t"};
TTreeReaderArray<unsigned int> trace_fUniqueID = {fReader, "trace.fUniqueID"};
TTreeReaderArray<unsigned int> trace_fBits = {fReader, "trace.fBits"};
TTreeReaderArray<TString> trace_fName = {fReader, "trace.fName"};
TTreeReaderArray<TString> trace_fTitle = {fReader, "trace.fTitle"};
TTreeReaderArray<Short_t> trace_fLineColor = {fReader, "trace.fLineColor"};
TTreeReaderArray<Short_t> trace_fLineStyle = {fReader, "trace.fLineStyle"};
TTreeReaderArray<Short_t> trace_fLineWidth = {fReader, "trace.fLineWidth"};
TTreeReaderArray<Short_t> trace_fFillColor = {fReader, "trace.fFillColor"};
TTreeReaderArray<Short_t> trace_fFillStyle = {fReader, "trace.fFillStyle"};
TTreeReaderArray<Short_t> trace_fMarkerColor = {fReader, "trace.fMarkerColor"};
TTreeReaderArray<Short_t> trace_fMarkerStyle = {fReader, "trace.fMarkerStyle"};
TTreeReaderArray<Float_t> trace_fMarkerSize = {fReader, "trace.fMarkerSize"};
TTreeReaderArray<Double_t> trace_fMinimum = {fReader, "trace.fMinimum"};
TTreeReaderArray<Double_t> trace_fMaximum = {fReader, "trace.fMaximum"};
TTreeReaderArray<TString> trace_fOption = {fReader, "trace.fOption"};
TTreeReaderArray<Float_t> trace_e = {fReader, "we"};
TTreeReaderArray<Float_t> trace_e_time = {fReader, "weT"};
TTreeReaderArray<Float_t> trace_e_rise = {fReader, "weR"};
TTreeReaderArray<Float_t> trace_xf = {fReader, "wxf"};
TTreeReaderArray<Float_t> trace_xf_time = {fReader, "wxfT"};
TTreeReaderArray<Float_t> trace_xf_rise = {fReader, "wxfR"};
TTreeReaderArray<Float_t> trace_xn = {fReader, "wxn"};
TTreeReaderArray<Float_t> trace_xn_time = {fReader, "wxnT"};
TTreeReaderArray<Float_t> trace_xn_rise = {fReader, "wxnR"};
TTreeReaderArray<Float_t> trace_rdt = {fReader, "wrdt"};
TTreeReaderArray<Float_t> trace_rdt_time = {fReader, "wrdtT"};
TTreeReaderArray<Float_t> 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

View File

@ -61,40 +61,27 @@ TString ezCutFile = "";//"ezCut.root";
//############################################ end of user setting //############################################ 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 // //======= Recoil
TH1F ** heCal; // TH2F * hrdtID;
TH2F ** hxfCalVxnCal; // TH1F ** hrdt; // single recoil
TH2F ** heVxsCal; // raw e vs xf // TH1F ** hrdtg;
TH2F ** heCalVxCal; // eCal vs xCal
TH2F ** heCalVxCalG; // eCal vs xCal
TH2F * heCalID; // e vs id // TH2F ** hrdt2D;
// TH2F ** hrdt2Dg;
//======= Recoil // TH1F * hrdtRate1;
TH2F * hrdtID; // TH1F * hrdtRate2;
TH1F ** hrdt; // single recoil
TH1F ** hrdtg;
TH2F ** hrdt2D; // //======= multi-Hit
TH2F ** hrdt2Dg; // TH2I * hmult;
// TH1I * hmultEZ;
// TH2I * hArrayRDTMatrix;
// TH2I * hArrayRDTMatrixG;
TH1F * hrdtRate1; // //======= ARRAY-RDT time diff
TH1F * hrdtRate2; // TH1I * htdiff;
// TH1I * htdiffg;
//======= multi-Hit
TH2I * hmult;
TH1I * hmultEZ;
TH2I * hArrayRDTMatrix;
TH2I * hArrayRDTMatrixG;
//======= ARRAY-RDT time diff
TH1I * htdiff;
TH1I * htdiffg;
/*************************** /***************************
***************************/ ***************************/
@ -130,7 +117,7 @@ void Monitor::Begin(TTree *tree){
printf("########## SOLARIS Monitors.C #########\n"); printf("########## SOLARIS Monitors.C #########\n");
printf("###########################################################\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 //===================================================== loading parameter
@ -148,9 +135,9 @@ void Monitor::Begin(TTree *tree){
if( (int) corr->rdtCorr.size() < mapping::NRDT ) { printf(" !!!!!!!! size of rdtCorr < NRDT .\n"); } if( (int) corr->rdtCorr.size() < mapping::NRDT ) { printf(" !!!!!!!! size of rdtCorr < NRDT .\n"); }
printf("=====================================================\n"); // printf("=====================================================\n");
printf(" time Range : %5.0f - %5.0f min\n", timeRangeInMin[0], timeRangeInMin[1]); // printf(" time Range : %5.0f - %5.0f min\n", timeRangeInMin[0], timeRangeInMin[1]);
printf("=====================================================\n"); // printf("=====================================================\n");
//================ Get Recoil cuts; //================ Get Recoil cuts;
cutG = new TCutG(); cutG = new TCutG();
@ -166,71 +153,60 @@ void Monitor::Begin(TTree *tree){
gROOT->cd(); 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]); // int startIndex = 0;
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]); // 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]); // 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]);
CreateListOfHist2D(hxfCalVxnCal, 0, mapping::NARRAY, "hxfCalVxnCal", "Corrected XF vs. XN (ch=%d);XF (channel);XN (channel)", 500, 0, rawEnergyRange[1], 500, 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]);
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; // hMultiHit = new TH1F("hMultiHit", "Multi-Hit of Energy", 10, 0, 1);
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]); // //===================== Recoils
hxfVID = new TH2F("hxfVID", "Raw xf vs channel", mapping::NARRAY, 0, mapping::NARRAY, 500, rawEnergyRange[0], rawEnergyRange[1]); // 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]));
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]); // hrdt = new TH1F * [mapping::NRDT];
// hrdtg = new TH1F * [mapping::NRDT];
hMultiHit = new TH1F("hMultiHit", "Multi-Hit of Energy", 10, 0, 1); // hrdt2D = new TH2F * [mapping::NRDT/2];
// // hrdt2Dg = new TH2F * [mapping::NRDT/2];
//===================== Recoils // for (Int_t i = 0; i < mapping::NRDT ; i++) {
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])); // 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]);
hrdt = new TH1F * [mapping::NRDT]; // ///dE vs E
hrdtg = new TH1F * [mapping::NRDT]; // 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]);
// }
// }
hrdt2D = new TH2F * [mapping::NRDT/2]; // hrdtRate1 = new TH1F("hrdtRate1", "recoil rate 1 / min; min; count / 1 min", timeRangeInMin[1] - timeRangeInMin[0], timeRangeInMin[0], timeRangeInMin[1]);
// hrdt2Dg = new TH2F * [mapping::NRDT/2]; // 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);
for (Int_t i = 0; i < mapping::NRDT ; i++) { // //===================== multiplicity
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]); // hmultEZ = new TH1I("hmultEZ", "Filled EZ with coinTime and recoil", 10, 0, 10);
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]); // hmult = new TH2I("hmult", "Array Multiplicity vs Recoil Multiplicity; Array ; Recoil",10, 0, 10, 10, 0, 10);
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]); // hArrayRDTMatrix = new TH2I("hArrayRDTMatrix", "Array ID vs Recoil ID; Array ID; Recoil ID", 30, 0, 30, 8, 0, 8);
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]); // hArrayRDTMatrixG = new TH2I("hArrayRDTMatrixG", "Array ID vs Recoil ID / g; Array ID; Recoil ID", 30, 0, 30, 8, 0, 8);
///dE vs E // //===================== coincident time
if( i % 2 == 0 ) { // htdiff = new TH1I("htdiff" ,"Coincident time (recoil-dE - array); time [ch = 10ns]; count", coinTimeRange[1] - coinTimeRange[0], coinTimeRange[0], coinTimeRange[1]);
int tempID = i / 2; // htdiffg = new TH1I("htdiffg","Coincident time (recoil-dE - array) w/ recoil gated; time [ch = 10ns]; count", coinTimeRange[1] - coinTimeRange[0], coinTimeRange[0], coinTimeRange[1]);
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);
//===================== 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]);
printf("============================================ End of histograms Declaration\n"); 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 ; if( TMath::IsNaN(xn[id]) && TMath::IsNaN(xf[id]) ) continue ;
//@==================== Calibrations go here //@==================== 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->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() ) xfCal[id] = xf[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() ) eCal[id] = e[id] / corr->eCorr[id][0] + corr->eCorr[id][1]; 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; 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]; if ( TMath::IsNaN(xf[id]) && !TMath::IsNaN(xn[id]) ) xCal[id] = 1.0 - xnCal[id]/ e[id];
//@======= Scale xcal from (0,1) //@======= 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; 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]); heVx[id]->Fill(x[id],e[id]);
heCalVxCal[id]->Fill(xCal[id]*detGeo->array[arrayID].detLength, eCal[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 //@=================== Recoil Gate
if( isRDTExist && (cutList1 || cutList2)){ if( isRDTExist && (cutList1 || cutList2)){
@ -460,7 +437,7 @@ Bool_t Monitor::Process(Long64_t entry){
} }
if( coinFlag && (rdtgate1 || rdtgate2) && ezGate){ 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]); 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 ) { if( thetaCM > thetaCMGate ) {
hEx->Fill(Ex); plotter[arrayID]->hEx->Fill(Ex);
plotter[arrayID]->hExThetaCM->Fill(thetaCM, Ex);
hExThetaCM->Fill(thetaCM, Ex);
if( rdtgate1 ) { if( rdtgate1 ) {
hExCut1->Fill(Ex); plotter[arrayID]->hExCut1->Fill(Ex);
hExThetaCM->Fill(thetaCM, Ex); plotter[arrayID]->hExThetaCM->Fill(thetaCM, Ex);
} }
if( rdtgate2 ) { if( rdtgate2 ) {
hExCut2->Fill(Ex); plotter[arrayID]->hExCut2->Fill(Ex);
hExThetaCM->Fill(thetaCM, Ex); plotter[arrayID]->hExThetaCM->Fill(thetaCM, Ex);
} }
hExi[id]->Fill(Ex); plotter[arrayID]->hExi[id]->Fill(Ex);
hExVxCal[id]->Fill(xCal[id], Ex); plotter[arrayID]->hExVxCal[id]->Fill(xCal[id], Ex);
} }
} }
@ -553,10 +529,10 @@ void Monitor::Terminate(){
double yMax = 0; double yMax = 0;
Isotope hRecoil(AnalysisLib::reactionConfig.recoilHeavyA, AnalysisLib::reactionConfig.recoilHeavyZ); // Isotope hRecoil(AnalysisLib::reactionConfig.recoilHeavyA, AnalysisLib::reactionConfig.recoilHeavyZ);
double Sn = hRecoil.CalSp(0,1); // double Sn = hRecoil.CalSp(0,1);
double Sp = hRecoil.CalSp(1,0); // double Sp = hRecoil.CalSp(1,0);
double Sa = hRecoil.CalSp2(4,2); // double Sa = hRecoil.CalSp2(4,2);
for( int i = 0; i < detGeo->numGeo; i++ ){ for( int i = 0; i < detGeo->numGeo; i++ ){
@ -565,49 +541,49 @@ void Monitor::Terminate(){
// cCanvas[i]->Modified(); cCanvas->Update(); // cCanvas[i]->Modified(); cCanvas->Update();
// cCanvas[i]->cd(); cCanvas->Divide(canvasDiv[0],canvasDiv[1]); // cCanvas[i]->cd(); cCanvas->Divide(canvasDiv[0],canvasDiv[1]);
plotter[i]->canvas->cd(); plotter[i]->Plot();
///----------------------------------- Canvas - 1 ///----------------------------------- Canvas - 1
PlotEZ(1); /// raw EZ // PlotEZ(1); /// raw EZ
///----------------------------------- Canvas - 2 ///----------------------------------- Canvas - 2
PlotEZ(0); ///gated EZ // PlotEZ(0); ///gated EZ
///----------------------------------- Canvas - 3 ///----------------------------------- Canvas - 3
PlotTDiff(1, 1); ///with Gated Tdiff, isLog // PlotTDiff(1, 1); ///with Gated Tdiff, isLog
///----------------------------------- Canvas - 4 ///----------------------------------- Canvas - 4
padID++; cCanvas->cd(padID); // padID++; cCanvas->cd(padID);
//hEx->Draw(); // //hEx->Draw();
hExCut1->Draw(""); // hExCut1->Draw("");
hExCut2->Draw("same"); // hExCut2->Draw("same");
DrawLine(hEx, Sn); // DrawLine(hEx, Sn);
DrawLine(hEx, Sa); // DrawLine(hEx, Sa);
if(isTimeGateOn)text.DrawLatex(0.15, 0.8, Form("%d < coinTime < %d", timeGate[0], timeGate[1])); // 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( 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( cutList1 ) text.DrawLatex(0.15, 0.7, "with recoil gated");
///----------------------------------- Canvas - 5 ///----------------------------------- Canvas - 5
padID++; cCanvas->cd(padID); // padID++; cCanvas->cd(padID);
//Draw2DHist(hExThetaCM); // //Draw2DHist(hExThetaCM);
//heVIDG->Draw(); // //heVIDG->Draw();
//text.DrawLatex(0.15, 0.75, Form("#theta_{cm} > %.1f deg", thetaCMGate)); // //text.DrawLatex(0.15, 0.75, Form("#theta_{cm} > %.1f deg", thetaCMGate));
Draw2DHist(hrdt2D[0]); // Draw2DHist(hrdt2D[0]);
// Draw2DHist(hrdt2Dsum[0]); // // Draw2DHist(hrdt2Dsum[0]);
if( cutList1 && cutList1->GetEntries() > 0 ) {cutG = (TCutG *)cutList1->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");} // if( cutList2 && cutList2->GetEntries() > 0 ) {cutG = (TCutG *)cutList2->At(0) ; cutG->Draw("same");}
//helum4D->Draw(); //helum4D->Draw();
//text.DrawLatex(0.25, 0.3, Form("gated from 800 to 1200 ch\n")); //text.DrawLatex(0.25, 0.3, Form("gated from 800 to 1200 ch\n"));
///----------------------------------- Canvas - 6 ///----------------------------------- Canvas - 6
PlotRDT(0,0); // PlotRDT(0,0);
// padID++; cCanvas->cd(padID); // padID++; cCanvas->cd(padID);
// Draw2DHist(hrdtExGated); // Draw2DHist(hrdtExGated);
@ -680,10 +656,10 @@ void Monitor::Terminate(){
///text.SetTextColor(2); ///text.SetTextColor(2);
///----------------------------------- Canvas - 14 ///----------------------------------- Canvas - 14
padID++; cCanvas->cd(padID); // padID++; cCanvas->cd(padID);
hrdtRate1->Draw(""); // hrdtRate1->Draw("");
hrdtRate2->Draw("same"); // hrdtRate2->Draw("same");
///----------------------------------- Canvas - 15 ///----------------------------------- Canvas - 15
//padID++; cCanvas->cd(padID); //padID++; cCanvas->cd(padID);

View File

@ -121,7 +121,7 @@ public :
plotter = new MonPlotter *[detGeo->numGeo]; plotter = new MonPlotter *[detGeo->numGeo];
for( int i = 0; i < detGeo->numGeo; i++ ){ for( int i = 0; i < detGeo->numGeo; i++ ){
plotter[i] = new Monitor(i, detGeo); plotter[i] = new MonPlotter(i, detGeo);
} }
} }
virtual ~Monitor() { virtual ~Monitor() {
@ -168,30 +168,12 @@ public :
void SetCanvasTitle(TString title) {fCanvasTitle = title;} void SetCanvasTitle(TString title) {fCanvasTitle = title;}
TString GetCanvasTitle() const {return fCanvasTitle;} TString GetCanvasTitle() const {return fCanvasTitle;}
void SetStartStopTimes(std::vector<ULong64_t> t1, std::vector<ULong64_t> t2) { // void Draw2DHist(TH2F * hist);
startTime = t1; // void PlotEZ(bool isRaw);
endTime = t2; // void PlotTDiff(bool isGated, bool isLog);
// void PlotRDT(int id, bool isRaw);
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 PlotCRDTPolar(); //void PlotCRDTPolar();
template<typename T> void CreateListOfHist1D(T ** &histList, int startIndex, int size, const char * namePrefix, const char * TitleForm, int binX, float xMin, float xMax);
template<typename T> 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); ClassDef(Monitor,0);
}; };
@ -268,14 +250,14 @@ Bool_t Monitor::Notify(){
return kTRUE; return kTRUE;
} }
void DrawLine(TH1 * hist, double pos){ // void DrawLine(TH1 * hist, double pos){
double yMax = hist->GetMaximum(); // double yMax = hist->GetMaximum();
TLine * line = new TLine(pos, 0, pos, yMax); // TLine * line = new TLine(pos, 0, pos, yMax);
line->SetLineColor(2); // line->SetLineColor(2);
line->Draw(""); // line->Draw("");
} // }
void Monitor::SlaveBegin(TTree * /*tree*/){ void Monitor::SlaveBegin(TTree * /*tree*/){
/// not use, if use, place in Monitor.C /// not use, if use, place in Monitor.C
TString option = GetOption(); TString option = GetOption();
@ -286,56 +268,32 @@ void Monitor::SlaveTerminate(){
/// not use, if use, place in Monitor.C /// not use, if use, place in Monitor.C
} }
template<typename T> 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<typename T> 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 * 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(); // double yMax = hist->GetMaximum();
TBox * box = new TBox (x1, 0, x2, yMax); // TBox * box = new TBox (x1, 0, x2, yMax);
box->SetFillColorAlpha(color, alpha); // box->SetFillColorAlpha(color, alpha);
box->Draw(); // 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){ void Monitor::PlotEZ(bool isRaw){
padID++; cCanvas->cd(padID); padID++; cCanvas->cd(padID);
@ -429,5 +387,6 @@ void Monitor::PlotRDT(int id, bool isRaw){
// cCanvas->cd(padID)->DrawFrame(-50, -50, 50, 50); // cCanvas->cd(padID)->DrawFrame(-50, -50, 50, 50);
// hcrdtPolar->Draw("same colz pol"); // hcrdtPolar->Draw("same colz pol");
//} //}
*/
#endif // #ifdef Monitor_cxx #endif // #ifdef Monitor_cxx

View File

@ -3,6 +3,8 @@
#include "../Cleopatra/ClassHelios.h" #include "../Cleopatra/ClassHelios.h"
#include "../Cleopatra/ClassTransfer.h" #include "../Cleopatra/ClassTransfer.h"
#include "ClassMonPlotter.h"
void test(){ void test(){
// DetGeo haha("detectorGeo.txt"); // DetGeo haha("detectorGeo.txt");
@ -11,17 +13,17 @@ void test(){
// ReactionConfig config("reactionConfig.txt"); // ReactionConfig config("reactionConfig.txt");
// config.Print(); // config.Print();
TransferReaction * transfer = new TransferReaction(); // TransferReaction * transfer = new TransferReaction();
// transfer->SetReactionSimple(32, 14, 2, 1, 1, 1, 8.8); // transfer->SetReactionSimple(32, 14, 2, 1, 1, 1, 8.8);
int ID = 0; // int ID = 0;
transfer->SetReactionFromFile("reactionConfig.txt", ID); // transfer->SetReactionFromFile("reactionConfig.txt", ID);
transfer->PrintReaction(); // transfer->PrintReaction();
transfer->Event(25 * TMath::DegToRad(), 0 * TMath::DegToRad()); // transfer->Event(25 * TMath::DegToRad(), 0 * TMath::DegToRad());
transfer->PrintFourVectors(); // transfer->PrintFourVectors();
// ReactionConfig config2 = transfer->GetRectionConfig(); // ReactionConfig config2 = transfer->GetRectionConfig();
@ -44,6 +46,27 @@ void test(){
// orb.PrintTrajectory(); // orb.PrintTrajectory();
// delete helios; // 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;
} }