MonAnalyzer: finished array. need to do RDT

This commit is contained in:
Ryan@Home 2024-07-09 17:13:28 -04:00
parent a80e5e2b64
commit 9c2f52009a
5 changed files with 233 additions and 71 deletions

1
.gitignore vendored
View File

@ -15,6 +15,7 @@ root_data
*.out *.out
*.txt *.txt
*.csv *.csv
*.dat
Cleopatra/ExtractXSec Cleopatra/ExtractXSec
Cleopatra/ExtractXSecFromText Cleopatra/ExtractXSecFromText

View File

@ -26,31 +26,31 @@ public:
LoadRDTCorr(); LoadRDTCorr();
} }
void CheckCorrParasSize(int arraySize, int rdtSize){ void CheckCorrParasSize(size_t arraySize, size_t rdtSize){
printf("------------ Check Correction parameter sizes\n"); printf("------------ Check Correction parameter sizes\n");
if( is_xn_OK && xnCorr.size() < arraySize ) { if( is_xn_OK && xnCorr.size() < arraySize ) {
printf(" xnCorr [%zu] < array size %d. Set xnCorr[1..99] = 1.0 \n", xnCorr.size(), arraySize); printf(" xnCorr [%zu] < array size %zu. Set xnCorr[1..99] = 1.0 \n", xnCorr.size(), arraySize);
for( int i = 0; i < defaultSize; i++ ) xnCorr.push_back(1.0); for( int i = 0; i < defaultSize; i++ ) xnCorr.push_back(1.0);
is_xn_OK = false; is_xn_OK = false;
} }
if( is_xfxne_OK && xfxneCorr.size() < arraySize ) { if( is_xfxne_OK && xfxneCorr.size() < arraySize ) {
printf(" xfxneCorr [%zu] < array size %d. Set xfxneCorr[1..99] = (0.0, 1.0) \n", xfxneCorr.size(), arraySize); printf(" xfxneCorr [%zu] < array size %zu. Set xfxneCorr[1..99] = (0.0, 1.0) \n", xfxneCorr.size(), arraySize);
for( int i = 0; i < defaultSize; i++ ) xfxneCorr.push_back({0.0, 1.0}); for( int i = 0; i < defaultSize; i++ ) xfxneCorr.push_back({0.0, 1.0});
is_xScale_OK = false; is_xScale_OK = false;
} }
if( is_e_OK && eCorr.size() < arraySize ) { if( is_e_OK && eCorr.size() < arraySize ) {
printf(" eCorr [%zu] < array size %d. Set eCorr[1..99] = (1.0, 0.0) \n", xnCorr.size(), arraySize); printf(" eCorr [%zu] < array size %zu. Set eCorr[1..99] = (1.0, 0.0) \n", xnCorr.size(), arraySize);
for( int i = 0; i < defaultSize; i++ ) eCorr.push_back({1.0, 0.0}); for( int i = 0; i < defaultSize; i++ ) eCorr.push_back({1.0, 0.0});
is_e_OK = false; is_e_OK = false;
} }
if( is_xScale_OK && xScale.size() < arraySize ) { if( is_xScale_OK && xScale.size() < arraySize ) {
printf(" xScale [%zu] < array size %d. Set xScale[1..99] = 1.0 \n", xScale.size(), arraySize); printf(" xScale [%zu] < array size %zu. Set xScale[1..99] = 1.0 \n", xScale.size(), arraySize);
for( int i = 0; i < defaultSize; i++ ) xScale.push_back(1.0); for( int i = 0; i < defaultSize; i++ ) xScale.push_back(1.0);
is_xScale_OK = false; is_xScale_OK = false;
} }
if( is_rdt_OK && rdtCorr.size() < rdtSize ) { if( is_rdt_OK && rdtCorr.size() < rdtSize ) {
printf(" rdtCorr [%zu] < array size %d. Set rdtScale[1..99] = (0.0, 1.0) \n", rdtCorr.size(), arraySize); printf(" rdtCorr [%zu] < array size %zu. Set rdtScale[1..99] = (0.0, 1.0) \n", rdtCorr.size(), arraySize);
for( int i = 0; i < defaultSize; i++ ) rdtCorr.push_back({0.0, 1.0}); for( int i = 0; i < defaultSize; i++ ) rdtCorr.push_back({0.0, 1.0});
is_rdt_OK = false; is_rdt_OK = false;
} }
@ -79,7 +79,7 @@ public:
if( file.is_open() ){ if( file.is_open() ){
float a; float a;
while( file >> a ) xnCorr.push_back(a); while( file >> a ) xnCorr.push_back(a);
printf(".......... done.\n"); printf(".......... done. size:%zu\n", xnCorr.size());
is_xn_OK = true; is_xn_OK = true;
}else{ }else{
for( int i = 0; i < defaultSize; i++ ) xnCorr.push_back(1.0); for( int i = 0; i < defaultSize; i++ ) xnCorr.push_back(1.0);
@ -99,7 +99,7 @@ public:
if( file.is_open() ){ if( file.is_open() ){
float a; float a;
while( file >> a ) xScale.push_back(a); while( file >> a ) xScale.push_back(a);
printf("........ done.\n"); printf("........ done. size:%zu\n", xScale.size());
is_xScale_OK = true; is_xScale_OK = true;
}else{ }else{
for( int i = 0; i < defaultSize; i++ ) xScale.push_back(1.0); for( int i = 0; i < defaultSize; i++ ) xScale.push_back(1.0);
@ -119,7 +119,7 @@ public:
if( file.is_open() ){ if( file.is_open() ){
float a, b; float a, b;
while( file >> a >> b) xfxneCorr.push_back({a, b}); while( file >> a >> b) xfxneCorr.push_back({a, b});
printf("........ done.\n"); printf("........ done. size:%zu\n", xfxneCorr.size());
is_xfxne_OK = true; is_xfxne_OK = true;
}else{ }else{
for( int i = 0; i < defaultSize; i++ ) xfxneCorr.push_back({0.0, 1.0}); for( int i = 0; i < defaultSize; i++ ) xfxneCorr.push_back({0.0, 1.0});
@ -139,7 +139,7 @@ public:
if( file.is_open() ){ if( file.is_open() ){
float a, b; float a, b;
while( file >> a >> b) eCorr.push_back( {a, b} ); // 1/a1, a0 , e' = e * a1 + a0 while( file >> a >> b) eCorr.push_back( {a, b} ); // 1/a1, a0 , e' = e * a1 + a0
printf(".............. done.\n"); printf(".............. done. size:%zu\n", eCorr.size());
is_e_OK = true; is_e_OK = true;
}else{ }else{
for( int i = 0; i < defaultSize; i++ ) eCorr.push_back( {1.0, 0.0} ); for( int i = 0; i < defaultSize; i++ ) eCorr.push_back( {1.0, 0.0} );
@ -159,7 +159,7 @@ public:
if( file.is_open() ){ if( file.is_open() ){
float a, b; float a, b;
while( file >> a >> b) rdtCorr.push_back({a, b}); while( file >> a >> b) rdtCorr.push_back({a, b});
printf("............ done.\n"); printf("............ done. size:%zu\n", rdtCorr.size());
is_rdt_OK = true; is_rdt_OK = true;
}else{ }else{
for( int i = 0; i < defaultSize; i++ ) rdtCorr.push_back( {0.0, 1.0} ); for( int i = 0; i < defaultSize; i++ ) rdtCorr.push_back( {0.0, 1.0} );

View File

@ -124,7 +124,7 @@ public:
std::vector<Array> array; std::vector<Array> array;
std::vector<Auxillary> aux; std::vector<Auxillary> aux;
void Print( bool printArray = false) ; void Print( int printArray = 0) ; // 0 = no print, -1 = print all, 1 = print only enabled
short GetArrayID(int id){ short GetArrayID(int id){
int detCount = 0; int detCount = 0;
@ -244,7 +244,7 @@ inline bool DetGeo::LoadDetectorGeo(TMacro * macro, bool verbose){
} }
inline void DetGeo::Print(bool printArray){ inline void DetGeo::Print(int printArray){
printf("#####################################################\n"); printf("#####################################################\n");
printf(" B-field : %8.2f T, %s\n", Bfield, Bfield > 0 ? "out of plan" : "into plan"); printf(" B-field : %8.2f T, %s\n", Bfield, Bfield > 0 ? "out of plan" : "into plan");
@ -253,8 +253,9 @@ inline void DetGeo::Print(bool printArray){
printf(" z-Min : %8.2f mm\n", zMin); printf(" z-Min : %8.2f mm\n", zMin);
printf(" z-Max : %8.2f mm\n", zMax); printf(" z-Max : %8.2f mm\n", zMax);
if( printArray ) { if( printArray != 0 ) {
for( size_t i = 0; i < array.size() ; i++){ for( size_t i = 0; i < array.size() ; i++){
if( printArray > 0 && !array[i].enable ) continue;
printf("================================= %zu-th Detector Info (%s)\n", i, array[i].enable ? "enabled" : "disabled"); printf("================================= %zu-th Detector Info (%s)\n", i, array[i].enable ? "enabled" : "disabled");
array[i].Print(); array[i].Print();
aux[i].Print(); aux[i].Print();

View File

@ -9,6 +9,8 @@
#include "TH1.h" #include "TH1.h"
#include "TH2.h" #include "TH2.h"
#include "TCanvas.h" #include "TCanvas.h"
#include "TLine.h"
#include "TStyle.h"
/****************************************************************** /******************************************************************
* This is Plotter for Monitor.C. It contains * This is Plotter for Monitor.C. It contains
@ -57,7 +59,10 @@ public:
void Plot(); void Plot();
void PlotRawID(); void PlotRaw(bool isLog = false);
void PlotCal();
void PlotEZ();
// void PlotEx();
TCanvas * canvas; TCanvas * canvas;
@ -75,6 +80,7 @@ public:
TH2F ** hxfCal_xnCal; TH2F ** hxfCal_xnCal;
TH2F ** he_xsCal; // raw e vs xf TH2F ** he_xsCal; // raw e vs xf
TH2F ** he_x; // raw e vs x TH2F ** he_x; // raw e vs x
TH2F * heCal_ID;
//===== eCal V z //===== eCal V z
TH2F * heCal_z; TH2F * heCal_z;
@ -107,6 +113,7 @@ private:
float recoilOutter; float recoilOutter;
double zRange[2] ; // zMin, zMax double zRange[2] ; // zMin, zMax
TString canvasTitle;
TString suffix; TString suffix;
int numPad; int numPad;
@ -145,11 +152,13 @@ MonPlotter::~MonPlotter(){
delete hxn_ID; delete hxn_ID;
delete hArrayMulti; delete hArrayMulti;
delete heCal_ID;
delete heCal_zGC;
delete heCal_z; delete heCal_z;
delete hEx_ThetaCM; delete hEx_ThetaCM;
delete hExCut1; delete hExCut1;
delete hExCut2; delete hExCut2;
delete heCal_zGC;
delete hrdt_ID; delete hrdt_ID;
@ -191,9 +200,10 @@ MonPlotter::~MonPlotter(){
void MonPlotter::SetUpCanvas(TString title, int padSize, 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, divX * padSize, divY * padSize); canvas = new TCanvas("canavs" + suffix, title, 500 * aID, 0, divX * padSize, divY * padSize);
canvas->Divide(divX, divY); canvas->Divide(divX, divY);
numPad = divX * divY; numPad = divX * divY;
canvasTitle = title;
} }
@ -239,16 +249,16 @@ void MonPlotter::SetUpHistograms(int * rawEnergyRange, int * energyRange, double
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(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]); 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(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);
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(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_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); CreateListOfHist1D(heCal, numDet, "heCal", "Corrected e (ch=%d); e (MeV); count", 2000, energyRange[0], energyRange[1]);
//====================== E-Z plot //====================== E-Z plot
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_ID = new TH2F("heCal_ID" + suffix , "E vs. ID; ID;E (MeV)" , numDet, 0, numDet, 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]); 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]);
//===================== Recoil //===================== Recoil
int rdtRange[2]; int rdtRange[2];
@ -311,14 +321,115 @@ void MonPlotter::Plot(){
} }
} }
void MonPlotter::PlotRawID(){ void MonPlotter::PlotRaw(bool isLog){
TCanvas * haha = new TCanvas("haha" + suffix, "Raw ID", 1200, 600);
haha->Divide(2,2); TCanvas * cRawID = new TCanvas("cRawID", Form("Raw e, Ring, xf, xn vs ID | %s", canvasTitle.Data()), 100 + 500 * aID, 100, 1200, 800);
cRawID->Clear(); cRawID->Divide(2,2);
cRawID->cd(1); he_ID->Draw("colz");
cRawID->cd(2); hArrayMulti->Draw();
cRawID->cd(3); hxf_ID->Draw("colz");
cRawID->cd(4); hxn_ID->Draw("colz");
int padSize = 200;
int canvasSize[2] = {padSize * colDet, padSize * rowDet};
TCanvas * cRawE = new TCanvas("cRawE" + suffix,Form("E raw | %s", canvasTitle.Data()), 200 + 500 * aID, 200, canvasSize[0], canvasSize[1]);
cRawE->Clear(); cRawE->Divide(colDet,rowDet);
for (Int_t i=0; i < numDet; i++) {
cRawE->cd(i+1);
cRawE->cd(i+1)->SetGrid();
if( isLog ) cRawE->cd(i+1)->SetLogy();
he[i]->Draw("");
}
TCanvas *cRawXf = new TCanvas("cRawXf" + suffix,Form("Xf raw | %s", canvasTitle.Data()), 300 + 500 * aID, 300, canvasSize[0], canvasSize[1]);
cRawXf->Clear(); cRawXf->Divide(colDet,rowDet);
for (Int_t i=0; i<numDet; i++) {
cRawXf->cd(i+1);
cRawXf->cd(i+1)->SetGrid();
if( isLog ) cRawXf->cd(i+1)->SetLogy();
hxf[i]->Draw("");
}
TCanvas *cRawXn = new TCanvas("cRawXn" + suffix,Form("Xn raw | %s", canvasTitle.Data()), 400 + 500 * aID, 400, canvasSize[0], canvasSize[1]);
cRawXn->Clear();cRawXn->Divide(colDet,rowDet);
for (Int_t i=0; i<numDet; i++) {
cRawXn->cd(i+1);
cRawXn->cd(i+1)->SetGrid();
if( isLog ) cRawXn->cd(i+1)->SetLogy();
hxn[i]->Draw("");
}
TCanvas *cxfxn = new TCanvas("cxfxn" + suffix,Form("XF vs. XN | %s", canvasTitle.Data()), 500 + 500 * aID, 500, canvasSize[0], canvasSize[1]);
cxfxn->Clear(); cxfxn->Divide(colDet,rowDet);
for (Int_t i=0;i<numDet;i++) {
cxfxn->cd(i+1);
cxfxn->cd(i+1)->SetGrid();
hxf_xn[i]->Draw("col");
}
TCanvas *cxfxne = new TCanvas("cxfxne" + suffix,Form("E - XF+XN | %s", canvasTitle.Data()), 600 + 500 * aID, 600, canvasSize[0], canvasSize[1]);
cxfxne->Clear(); cxfxne->Divide(colDet,rowDet);
TLine line(0,0, 4000, 4000); line.SetLineColor(2);
for (Int_t i=0;i<numDet;i++) {
cxfxne->cd(i+1);
cxfxne->cd(i+1)->SetGrid();
he_xs[i]->Draw("col");
line.Draw("same");
}
}
void MonPlotter::PlotCal(){
int padSize = 200;
int canvasSize[2] = {padSize * colDet, padSize * rowDet};
TCanvas *ceVx = new TCanvas("ceVx" + suffix, Form("E vs. X = (xf-xn)/e | %s", canvasTitle.Data()), 100 + 500 * aID, 100, canvasSize[0], canvasSize[1]);
ceVx->Clear(); ceVx->Divide(colDet,rowDet);
for (Int_t i=0;i<numDet;i++) {
ceVx->cd(i+1); he_x[i]->Draw("col");
}
TCanvas *cxfxneC = new TCanvas("cxfxneC" + suffix,Form("Raw E - Corrected XF+XN | %s", canvasTitle.Data()), 200 + 500 * aID, 200, canvasSize[0], canvasSize[1]);
cxfxneC->Clear(); cxfxneC->Divide(colDet,rowDet);
TLine line(0,0, 4000, 4000); line.SetLineColor(2);
for (Int_t i=0;i<numDet;i++) {
cxfxneC->cd(i+1);
cxfxneC->cd(i+1)->SetGrid();
he_xsCal[i]->Draw("col");
line.Draw("same");
}
TCanvas *cEC = new TCanvas("cEC" + suffix,Form("E corrected | %s", canvasTitle.Data()), 300 + 500 * aID, 300, canvasSize[0], canvasSize[1]);
cEC->Clear();cEC->Divide(colDet,rowDet);
for (Int_t i=0; i<numDet; i++) {
cEC->cd(i+1);
cEC->cd(i+1)->SetGrid();
heCal[i]->Draw("");
}
TCanvas *cEC2 = new TCanvas("cEC2" + suffix,Form("E corrected | %s", canvasTitle.Data()), 400 + 500 * aID, 400, canvasSize[0], canvasSize[1]);
cEC2->Clear();
heCal_ID->Draw("colz");
TCanvas *cxfxnC = new TCanvas("cxfxnC" + suffix,Form("XF vs XN corrected | %s", canvasTitle.Data()), 500 + 500 * aID, 500, canvasSize[0], canvasSize[1]);
cxfxnC->Clear(); cxfxnC->Divide(colDet,rowDet);
for (Int_t i=0;i<numDet;i++) {
cxfxnC->cd(i+1);
cxfxnC->cd(i+1)->SetGrid();
hxfCal_xnCal[i]->Draw("col");
}
}
void MonPlotter::PlotEZ(){
TCanvas *cecalVz = new TCanvas("cevalVz",Form("ECALVZ : %s", canvasTitle.Data()),1000, 650);
cecalVz->Clear(); cecalVz->Divide(2,1);
gStyle->SetOptStat("neiou");
cecalVz->cd(1);heCal_z->Draw("col");
cecalVz->cd(2);heCal_zGC->Draw("col");
haha->cd(1); he_ID->Draw("colz");
haha->cd(2); hArrayMulti->Draw();
haha->cd(3); hxf_ID->Draw("colz");
haha->cd(4); hxn_ID->Draw("colz");
} }
#endif #endif

View File

@ -24,7 +24,7 @@
#include "vector" #include "vector"
//^############################################ User setting //^############################################ User setting
int rawEnergyRange[2] = { 100, 60000}; /// share with e, xf, xn int rawEnergyRange[2] = { 0, 3000}; /// share with e, xf, xn
int energyRange[2] = { 0, 10}; /// in the E-Z plot int energyRange[2] = { 0, 10}; /// in the E-Z plot
int rdtDERange[2] = { 0, 80}; int rdtDERange[2] = { 0, 80};
int rdtERange[2] = { 0, 80}; int rdtERange[2] = { 0, 80};
@ -36,11 +36,11 @@ double exRange[3] = { 100, -2, 10}; /// bin [keV], low[MeV], high[M
//---Gate //---Gate
bool isTimeGateOn = true; bool isTimeGateOn = true;
int timeGate[2] = {-20, 12}; /// min, max, 1 ch = 10 ns int timeGate[2] = {-20, 12}; /// min, max, 1 ch = 10 ns
double eCalCut[2] = {0.5, 50}; /// lower & higher limit for eCal double eCalCut[2] = {0.5, 20}; /// lower & higher limit for eCal
double xGate = 0.9; ///cut out the edge double xGate = 0.9; ///cut out the edge
double thetaCMGate = 10; /// deg double thetaCMGate = 10; /// deg
std::vector<int> skipDetID = {11, 16, 23} ;//{2, 11, 17} std::vector<int> skipDetID = {11} ;
TString rdtCutFile1 = ""; TString rdtCutFile1 = "";
TString rdtCutFile2 = ""; TString rdtCutFile2 = "";
@ -58,7 +58,8 @@ void MonAnalyzer(){
printf("#####################################################################\n"); printf("#####################################################################\n");
TChain *chain = new TChain("gen_tree"); TChain *chain = new TChain("gen_tree");
chain->Add("../root_data/gen_run043.root"); //chain->Add("../root_data/gen_run043.root");
chain->Add("../root_data/trace_run029.root");
TObjArray * fileList = chain->GetListOfFiles(); TObjArray * fileList = chain->GetListOfFiles();
printf("\033[0;31m========================================== Number of Files : %2d\n",fileList->GetEntries()); printf("\033[0;31m========================================== Number of Files : %2d\n",fileList->GetEntries());
@ -85,30 +86,36 @@ void MonAnalyzer(){
//*========================================== //*==========================================
ULong64_t NumEntries = chain->GetEntries(); ULong64_t NumEntries = chain->GetEntries();
CorrParas * corr = new CorrParas;
corr->LoadAllCorrections();
corr->CheckCorrParasSize(mapping::NARRAY, mapping::NRDT);
DetGeo * detGeo = new DetGeo("detectorGeo.txt"); DetGeo * detGeo = new DetGeo("detectorGeo.txt");
// TransferReaction * transfer = new TransferReaction("reactionConfig.txt"); // TransferReaction * transfer = new TransferReaction("reactionConfig.txt");
numGeo = detGeo->numGeo; numGeo = detGeo->numGeo;
printf("================== num. of Arrays : %d\n", numGeo); printf("================== num. of Arrays : %d\n", numGeo);
int numTotArray = 0;
detGeo->Print(1);
for( size_t i = 0; i < detGeo->array.size(); i++ ){
if( detGeo->array[i].enable ) numTotArray += detGeo->array[i].numDet;
}
CorrParas * corr = new CorrParas;
corr->LoadAllCorrections();
corr->CheckCorrParasSize(numTotArray, mapping::NRDT);
plotter = new MonPlotter *[numGeo]; plotter = new MonPlotter *[numGeo];
for( int i = 0; i < numGeo; i++ ) { for( int i = 0; i < numGeo; i++ ) {
plotter[i] = new MonPlotter(i, detGeo, mapping::NRDT); plotter[i] = new MonPlotter(i, detGeo, mapping::NRDT);
plotter[i]->SetUpCanvas("haha", 500, 3, 2); plotter[i]->SetUpCanvas("haha", 500, 3, 2); //TODO canvaseTitle
plotter[i]->SetUpHistograms(rawEnergyRange, energyRange, exRange, thetaCMRange, rdtDERange, rdtERange); plotter[i]->SetUpHistograms(rawEnergyRange, energyRange, exRange, thetaCMRange, rdtDERange, rdtERange);
} }
//TODO make the data class. //TODO make the data class.
double eCal[mapping::NARRAY]; std::vector<double>eCal (numTotArray);
double xfCal[mapping::NARRAY]; std::vector<double>xfCal (numTotArray);
double xnCal[mapping::NARRAY]; std::vector<double>xnCal (numTotArray);
double x[mapping::NARRAY]; std::vector<double>x (numTotArray);
double xCal[mapping::NARRAY]; std::vector<double>xCal (numTotArray);
double z[mapping::NARRAY]; std::vector<double>z (numTotArray);
//^########################################################### //^###########################################################
//^ * Process //^ * Process
@ -120,31 +127,25 @@ void MonAnalyzer(){
while (reader.Next()) { while (reader.Next()) {
// printf("%llu | %llu | %lu\n", processedEntries, *evID, e.GetSize());
//*============================================= Array; //*============================================= Array;
int arrayMulti[numGeo] ; //array multiplicity, when any is calculated. int arrayMulti[numGeo] ; //array multiplicity, when any is calculated.
int zMulti[numGeo] ; //array multiplicity, when z is calculated. for( int i = 0; i < numGeo; i++ ) arrayMulti[i] = 0;
for( int i = 0; i < numGeo; i++ ) {
arrayMulti[i] = 0;
zMulti[i] = 0;
}
for( int id = 0; id < e.GetSize() ; id++ ){ for( int id = 0; id < (int) e.GetSize() ; id++ ){
short aID = detGeo->GetArrayID(id); short aID = detGeo->GetArrayID(id);
if( aID < 0 ) continue; if( aID < 0 ) continue;
//@================== Filling raw data //@================== Filling raw data
plotter[aID]->he_ID->Fill(id, e[id]);
plotter[aID]->hxf_ID->Fill(id, xf[id]);
plotter[aID]->hxn_ID->Fill(id, xn[id]);
plotter[aID]->he[id]->Fill(e[id]); plotter[aID]->he[id]->Fill(e[id]);
plotter[aID]->hxf[id]->Fill(xf[id]); plotter[aID]->hxf[id]->Fill(xf[id]);
plotter[aID]->hxn[id]->Fill(xn[id]); plotter[aID]->hxn[id]->Fill(xn[id]);
plotter[aID]->hxf_xn[id]->Fill(xf[id],xn[id]); plotter[aID]->hxf_xn[id]->Fill(xf[id],xn[id]);
plotter[aID]->he_xs[id]->Fill(xf[id]+xn[id], e[id]); plotter[aID]->he_xs[id]->Fill(xf[id]+xn[id], e[id]);
plotter[aID]->he_ID->Fill(id, e[id]);
plotter[aID]->hxf_ID->Fill(id, xf[id]);
plotter[aID]->hxn_ID->Fill(id, xn[id]);
//@==================== Basic gate //@==================== Basic gate
if( TMath::IsNaN(e[id]) ) continue ; if( TMath::IsNaN(e[id]) ) continue ;
if( TMath::IsNaN(xn[id]) && TMath::IsNaN(xf[id]) ) continue ; if( TMath::IsNaN(xn[id]) && TMath::IsNaN(xf[id]) ) continue ;
@ -185,8 +186,13 @@ void MonAnalyzer(){
if ( !TMath::IsNaN(xf[id]) && TMath::IsNaN(xn[id]) ) xCal[id] = xfCal[id]/ e[id]; if ( !TMath::IsNaN(xf[id]) && TMath::IsNaN(xn[id]) ) xCal[id] = xfCal[id]/ e[id];
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];
//@=================== Fill in histogram
plotter[aID]->he_x[id]->Fill(x[id],e[id]);
plotter[aID]->hxfCal_xnCal[id]->Fill(xfCal[id],xnCal[id]);
plotter[aID]->he_xsCal[id]->Fill(e[id],xnCal[id] + xfCal[id]);
//@======= Scale xcal from (0,1) //@======= Scale xcal from (0,1)
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( 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( abs(xCal[id] - 0.5) > xGate/2. ) continue; if( abs(xCal[id] - 0.5) > xGate/2. ) continue;
@ -200,11 +206,9 @@ void MonAnalyzer(){
} }
} }
//@===================== When z is calcualted. //@=================== Fill histogram
zMulti[aID] ++; plotter[aID]->heCal[id]->Fill(eCal[id]);
plotter[aID]->heCal_ID->Fill(id, eCal[id]);
//@=================== Array fill
plotter[aID]->he_x[id]->Fill(x[id],e[id]);
plotter[aID]->heCal_z->Fill(z[id],eCal[id]); plotter[aID]->heCal_z->Fill(z[id],eCal[id]);
//@=================== Recoil Gate //@=================== Recoil Gate
@ -343,25 +347,70 @@ void MonAnalyzer(){
if( processedEntries > 1000 ) break; if( processedEntries > 1000 ) break;
}//^############################################## End of Process }//^############################################## End of Process
gStyle->SetOptStat("neiou");
gStyle->GetAttDate()->SetTextSize(0.02);
gStyle->SetOptDate(1);
gStyle->SetDateX(0);
gStyle->SetDateY(0);
for( int i = 0; i < detGeo->numGeo ; i++){ for( int i = 0; i < detGeo->numGeo ; i++){
plotter[i]->Plot(); plotter[i]->Plot();
} }
//^############################################### //^###############################################
printf("------------------- List of Plots -------------------\n");
// printf(" newCanvas() - Create a new Canvas\n");
// printf("-----------------------------------------------------\n");
printf(" raw() - Raw data\n");
printf(" cal() - Calibrated data\n");
printf("-----------------------------------------------------\n");
printf(" ez() - Energy vs. Z\n");
// printf(" recoils() - Raw DE vs. E Recoil spectra\n");
//printf(" elum() - Luminosity Energy Spectra\n");
//printf(" ic() - Ionization Chamber Spectra\n");
// printf("-----------------------------------------------------\n");
// printf(" eCalVzRow() - Energy vs. Z for each row\n");
// printf(" excite() - Excitation Energy\n");
// printf(" ExThetaCM() - Ex vs ThetaCM\n");
// printf(" ExVxCal() - Ex vs X for all %d detectors\n", numDet);
// printf("-----------------------------------------------------\n");
// printf(" ShowFitMethod() - Shows various fitting methods \n");
// printf(" RDTCutCreator() - Create RDT Cuts [May need to edit]\n");
// printf(" Check_rdtGate() - Check RDT Cuts. \n");
// printf(" readTrace() - read trace from gen_runXXX.root \n");
// printf(" readRawTrace() - read trace from runXXX.root \n");
// printf(" Check1D() - Count Integral within a range\n");
// printf("-----------------------------------------------------\n");
// printf(" %s\n", canvasTitle.Data());
printf("-----------------------------------------------------\n");
} }
//%============================================= //%=============================================
void rawID(int arrayID = -1){ void raw(bool isLog = false, int arrayID = -1){
if( arrayID < 0 ){ if( arrayID < 0 ){
for( int i = 0; i < numGeo; i++ ) plotter[i]->PlotRawID(); for( int i = 0; i < numGeo; i++ ) plotter[i]->PlotRaw(isLog);
}else{ }else{
if( arrayID < numGeo) plotter[arrayID]->PlotRawID(); if( arrayID < numGeo) plotter[arrayID]->PlotRaw(isLog);
} }
} }
void cal(int arrayID = -1){
if( arrayID < 0 ){
for( int i = 0; i < numGeo; i++ ) plotter[i]->PlotCal();
}else{
if( arrayID < numGeo) plotter[arrayID]->PlotCal();
}
}
void ez(int arrayID = -1){
if( arrayID < 0 ){
for( int i = 0; i < numGeo; i++ ) plotter[i]->PlotEZ();
}else{
if( arrayID < numGeo) plotter[arrayID]->PlotEZ();
}
}