making progress... need to convert on of helios run to have better test
This commit is contained in:
parent
56285cef62
commit
a80e5e2b64
|
@ -3,20 +3,71 @@
|
||||||
|
|
||||||
//************************************** Correction parameters;
|
//************************************** Correction parameters;
|
||||||
class CorrParas {
|
class CorrParas {
|
||||||
|
private:
|
||||||
|
|
||||||
|
int defaultSize;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CorrParas(){
|
CorrParas(int defaultSize = 100){
|
||||||
xnCorr.clear();
|
is_xn_OK = false;
|
||||||
xScale.clear();
|
is_xfxne_OK = false;
|
||||||
xfxneCorr.clear();
|
is_e_OK = false;
|
||||||
eCorr.clear();
|
is_xScale_OK = false;
|
||||||
rdtCorr.clear();
|
is_rdt_OK = false;
|
||||||
|
|
||||||
|
this->defaultSize = defaultSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void LoadAllCorrections(){
|
||||||
|
LoadXNCorr();
|
||||||
|
LoadXFXN2ECorr();
|
||||||
|
LoadECorr();
|
||||||
|
LoadXScaleCorr();
|
||||||
|
LoadRDTCorr();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CheckCorrParasSize(int arraySize, int rdtSize){
|
||||||
|
printf("------------ Check Correction parameter sizes\n");
|
||||||
|
|
||||||
|
if( is_xn_OK && xnCorr.size() < arraySize ) {
|
||||||
|
printf(" xnCorr [%zu] < array size %d. Set xnCorr[1..99] = 1.0 \n", xnCorr.size(), arraySize);
|
||||||
|
for( int i = 0; i < defaultSize; i++ ) xnCorr.push_back(1.0);
|
||||||
|
is_xn_OK = false;
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
for( int i = 0; i < defaultSize; i++ ) xfxneCorr.push_back({0.0, 1.0});
|
||||||
|
is_xScale_OK = false;
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
for( int i = 0; i < defaultSize; i++ ) eCorr.push_back({1.0, 0.0});
|
||||||
|
is_e_OK = false;
|
||||||
|
}
|
||||||
|
if( is_xScale_OK && xScale.size() < arraySize ) {
|
||||||
|
printf(" xScale [%zu] < array size %d. Set xScale[1..99] = 1.0 \n", xScale.size(), arraySize);
|
||||||
|
for( int i = 0; i < defaultSize; i++ ) xScale.push_back(1.0);
|
||||||
|
is_xScale_OK = false;
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
for( int i = 0; i < defaultSize; i++ ) rdtCorr.push_back({0.0, 1.0});
|
||||||
|
is_rdt_OK = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("------------ Done Check Corr. Para. Size.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_xn_OK;
|
||||||
|
bool is_xfxne_OK;
|
||||||
|
bool is_e_OK;
|
||||||
|
bool is_xScale_OK;
|
||||||
|
bool is_rdt_OK;
|
||||||
|
|
||||||
std::vector<float> xnCorr; //correction of xn to match xf
|
std::vector<float> xnCorr; //correction of xn to match xf
|
||||||
std::vector<float> xScale; // correction of x to be (0,1)
|
|
||||||
std::vector<std::vector<float>> xfxneCorr; //correction of xn and xf to match e
|
std::vector<std::vector<float>> xfxneCorr; //correction of xn and xf to match e
|
||||||
std::vector<std::vector<float>> eCorr; // correction to e, ch -> MeV
|
std::vector<std::vector<float>> eCorr; // correction to e, ch -> MeV
|
||||||
|
std::vector<float> xScale; // correction of x to be (0,1)
|
||||||
std::vector<std::vector<float>> rdtCorr; // correction of rdt, ch -> MeV
|
std::vector<std::vector<float>> rdtCorr; // correction of rdt, ch -> MeV
|
||||||
|
|
||||||
//~========================================= xf = xn correction
|
//~========================================= xf = xn correction
|
||||||
|
@ -29,14 +80,16 @@ public:
|
||||||
float a;
|
float a;
|
||||||
while( file >> a ) xnCorr.push_back(a);
|
while( file >> a ) xnCorr.push_back(a);
|
||||||
printf(".......... done.\n");
|
printf(".......... done.\n");
|
||||||
|
is_xn_OK = true;
|
||||||
}else{
|
}else{
|
||||||
printf(".......... fail.\n");
|
for( int i = 0; i < defaultSize; i++ ) xnCorr.push_back(1.0);
|
||||||
|
printf(".......... fail. xnCorr[1..99] = 1.0\n");
|
||||||
|
is_xn_OK = false;
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
if( verbose ) for(int i = 0; i < (int) xnCorr.size(); i++) printf("%2d | %10.3f\n", i, xnCorr[i]);
|
if( verbose ) for(int i = 0; i < (int) xnCorr.size(); i++) printf("%2d | %10.3f\n", i, xnCorr[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//~========================================= X-Scale correction
|
//~========================================= X-Scale correction
|
||||||
void LoadXScaleCorr(bool verbose = false, const char * fileName = "correction_scaleX.dat"){
|
void LoadXScaleCorr(bool verbose = false, const char * fileName = "correction_scaleX.dat"){
|
||||||
printf(" loading x-Scale correction.");
|
printf(" loading x-Scale correction.");
|
||||||
|
@ -44,11 +97,14 @@ public:
|
||||||
std::ifstream file;
|
std::ifstream file;
|
||||||
file.open(fileName);
|
file.open(fileName);
|
||||||
if( file.is_open() ){
|
if( file.is_open() ){
|
||||||
float a, b;
|
float a;
|
||||||
while( file >> a ) xScale.push_back(a);
|
while( file >> a ) xScale.push_back(a);
|
||||||
printf("........ done.\n");
|
printf("........ done.\n");
|
||||||
|
is_xScale_OK = true;
|
||||||
}else{
|
}else{
|
||||||
printf("........ fail.\n");
|
for( int i = 0; i < defaultSize; i++ ) xScale.push_back(1.0);
|
||||||
|
printf("........ fail. xScale[1..99] = 1.0\n");
|
||||||
|
is_xScale_OK = false;
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
if( verbose ) for(int i = 0; i < (int) xScale.size(); i++) printf("%2d | %10.3f\n", i, xnCorr[i]);
|
if( verbose ) for(int i = 0; i < (int) xScale.size(); i++) printf("%2d | %10.3f\n", i, xnCorr[i]);
|
||||||
|
@ -64,8 +120,11 @@ public:
|
||||||
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.\n");
|
||||||
|
is_xfxne_OK = true;
|
||||||
}else{
|
}else{
|
||||||
printf("........ fail.\n");
|
for( int i = 0; i < defaultSize; i++ ) xfxneCorr.push_back({0.0, 1.0});
|
||||||
|
printf("........ fail. xfxneCorr[1..99] = (0.0, 1.0)\n");
|
||||||
|
is_xfxne_OK = false;
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
if( verbose ) for(int i = 0; i < (int) xfxneCorr.size(); i++) printf("%2d | %10.3f, %10.3f\n", i, xfxneCorr[i][0], xfxneCorr[i][1]);
|
if( verbose ) for(int i = 0; i < (int) xfxneCorr.size(); i++) printf("%2d | %10.3f, %10.3f\n", i, xfxneCorr[i][0], xfxneCorr[i][1]);
|
||||||
|
@ -81,8 +140,11 @@ public:
|
||||||
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.\n");
|
||||||
|
is_e_OK = true;
|
||||||
}else{
|
}else{
|
||||||
printf(".............. fail.\n");
|
for( int i = 0; i < defaultSize; i++ ) eCorr.push_back( {1.0, 0.0} );
|
||||||
|
printf(".............. fail. eCorr[1..99] = (1.0, 0.0) \n");
|
||||||
|
is_e_OK = false;
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
if( verbose ) for(int i = 0; i < (int) eCorr.size(); i++) printf("%2d | %10.3f, %10.3f\n", i, eCorr[i][0], eCorr[i][1]);
|
if( verbose ) for(int i = 0; i < (int) eCorr.size(); i++) printf("%2d | %10.3f, %10.3f\n", i, eCorr[i][0], eCorr[i][1]);
|
||||||
|
@ -98,8 +160,11 @@ public:
|
||||||
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.\n");
|
||||||
|
is_rdt_OK = true;
|
||||||
}else{
|
}else{
|
||||||
printf("............ fail.\n");
|
for( int i = 0; i < defaultSize; i++ ) rdtCorr.push_back( {0.0, 1.0} );
|
||||||
|
printf("............ fail. rdtCorr[1..99] = (0.0, 1.0)\n");
|
||||||
|
is_rdt_OK = false;
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
if( verbose ) for(int i = 0; i < (int) rdtCorr.size(); i++) printf("%2d | %10.3f, %10.3f\n", i, rdtCorr[i][0], rdtCorr[i][1]);
|
if( verbose ) for(int i = 0; i < (int) rdtCorr.size(); i++) printf("%2d | %10.3f, %10.3f\n", i, rdtCorr[i][0], rdtCorr[i][1]);
|
||||||
|
|
|
@ -53,10 +53,12 @@ public:
|
||||||
~MonPlotter();
|
~MonPlotter();
|
||||||
|
|
||||||
void SetUpCanvas(TString title, int padSize, int divX, int divY);
|
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 SetUpHistograms(int * rawEnergyRange, int * energyRange, double * exRange, int * thetaCMRange, int * rdtDERange, int * rdtERange);
|
||||||
|
|
||||||
void Plot();
|
void Plot();
|
||||||
|
|
||||||
|
void PlotRawID();
|
||||||
|
|
||||||
TCanvas * canvas;
|
TCanvas * canvas;
|
||||||
|
|
||||||
//====================== Histograms
|
//====================== Histograms
|
||||||
|
@ -301,13 +303,22 @@ void MonPlotter::Plot(){
|
||||||
for( int i = 0; i < numPad; i++ ){
|
for( int i = 0; i < numPad; i++ ){
|
||||||
canvas->cd(i+1);
|
canvas->cd(i+1);
|
||||||
switch (i){
|
switch (i){
|
||||||
case 0: he_ID->Draw("colz");break;
|
case 0: heCal_z->Draw("colz");break;
|
||||||
case 1: hxf_ID->Draw("colz");break;
|
case 1: heCal_zGC->Draw("colz");break;
|
||||||
case 2: hxn_ID->Draw("colz");break;
|
// case 2: hxn_ID->Draw("colz");break;
|
||||||
default:break;
|
default:break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MonPlotter::PlotRawID(){
|
||||||
|
TCanvas * haha = new TCanvas("haha" + suffix, "Raw ID", 1200, 600);
|
||||||
|
haha->Divide(2,2);
|
||||||
|
|
||||||
|
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
|
|
@ -16,13 +16,15 @@
|
||||||
#include "TTreeReaderValue.h"
|
#include "TTreeReaderValue.h"
|
||||||
#include "TTreeReaderArray.h"
|
#include "TTreeReaderArray.h"
|
||||||
#include "TClonesArray.h"
|
#include "TClonesArray.h"
|
||||||
|
#include "TGraph.h"
|
||||||
#include "TH2.h"
|
#include "TH2.h"
|
||||||
#include "TStyle.h"
|
#include "TStyle.h"
|
||||||
#include "TStopwatch.h"
|
#include "TStopwatch.h"
|
||||||
|
#include "TMath.h"
|
||||||
|
|
||||||
#include "vector"
|
#include "vector"
|
||||||
//^############################################ User setting
|
//^############################################ User setting
|
||||||
int rawEnergyRange[2] = { 100, 4000}; /// share with e, xf, xn
|
int rawEnergyRange[2] = { 100, 60000}; /// 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};
|
||||||
|
@ -35,19 +37,37 @@ double exRange[3] = { 100, -2, 10}; /// bin [keV], low[MeV], high[M
|
||||||
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, 50}; /// lower & higher limit for eCal
|
||||||
|
double xGate = 0.9; ///cut out the edge
|
||||||
|
double thetaCMGate = 10; /// deg
|
||||||
|
|
||||||
std::vector<int> skipDetID = {11, 16, 23} ;//{2, 11, 17}
|
std::vector<int> skipDetID = {11, 16, 23} ;//{2, 11, 17}
|
||||||
|
|
||||||
|
TString rdtCutFile1 = "";
|
||||||
|
TString rdtCutFile2 = "";
|
||||||
|
TString ezCutFile = "";//"ezCut.root";
|
||||||
|
|
||||||
//^############################################ end of user setting
|
//^############################################ end of user setting
|
||||||
|
|
||||||
|
MonPlotter ** plotter = nullptr;
|
||||||
|
int numGeo = 1;
|
||||||
|
|
||||||
void MonAnalyzer(){
|
void MonAnalyzer(){
|
||||||
|
|
||||||
// TFile * file = new TFile("../root_data/gen_run043.root");
|
printf("#####################################################################\n");
|
||||||
|
printf("####################### MonAnalyzer.C #######################\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->Print();
|
TObjArray * fileList = chain->GetListOfFiles();
|
||||||
|
printf("\033[0;31m========================================== Number of Files : %2d\n",fileList->GetEntries());
|
||||||
|
fileList->Print();
|
||||||
|
printf("========================================== Number of Files : %2d\033[0m\n",fileList->GetEntries());
|
||||||
|
|
||||||
|
printf("///////////////////////////////////////////////////////////////////\n");
|
||||||
|
printf(" Total Number of entries : %llu \n", chain->GetEntries());
|
||||||
|
printf("///////////////////////////////////////////////////////////////////\n");
|
||||||
|
|
||||||
TTreeReader reader(chain);
|
TTreeReader reader(chain);
|
||||||
|
|
||||||
|
@ -61,24 +81,34 @@ void MonAnalyzer(){
|
||||||
TTreeReaderArray<ULong64_t> rdt_t = {reader, "rdt_t"};
|
TTreeReaderArray<ULong64_t> rdt_t = {reader, "rdt_t"};
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
// TTreeReaderArray<TClonesArray> array = {reader, "trace"};
|
// TTreeReaderArray<TGraph> array = {reader, "trace"};
|
||||||
|
|
||||||
//*==========================================
|
//*==========================================
|
||||||
ULong64_t NumEntries = chain->GetEntries();
|
ULong64_t NumEntries = chain->GetEntries();
|
||||||
CorrParas * corr = new CorrParas;
|
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");
|
||||||
|
|
||||||
MonPlotter ** plotter = new MonPlotter *[detGeo->numGeo];
|
numGeo = detGeo->numGeo;
|
||||||
for( int i = 0; i < detGeo->numGeo; i++ ) {
|
printf("================== num. of Arrays : %d\n", numGeo);
|
||||||
|
|
||||||
|
plotter = new MonPlotter *[numGeo];
|
||||||
|
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);
|
||||||
plotter[i]->SetUpHistograms(rawEnergyRange, energyRange, exRange, thetaCMRange, rdtDERange, rdtERange);
|
plotter[i]->SetUpHistograms(rawEnergyRange, energyRange, exRange, thetaCMRange, rdtDERange, rdtERange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO make the data class.
|
||||||
double eCal[mapping::NARRAY];
|
double eCal[mapping::NARRAY];
|
||||||
double xfCal[mapping::NARRAY];
|
double xfCal[mapping::NARRAY];
|
||||||
double xnCal[mapping::NARRAY];
|
double xnCal[mapping::NARRAY];
|
||||||
|
double x[mapping::NARRAY];
|
||||||
|
double xCal[mapping::NARRAY];
|
||||||
|
double z[mapping::NARRAY];
|
||||||
|
|
||||||
//^###########################################################
|
//^###########################################################
|
||||||
//^ * Process
|
//^ * Process
|
||||||
|
@ -93,6 +123,13 @@ void MonAnalyzer(){
|
||||||
// printf("%llu | %llu | %lu\n", processedEntries, *evID, e.GetSize());
|
// printf("%llu | %llu | %lu\n", processedEntries, *evID, e.GetSize());
|
||||||
|
|
||||||
//*============================================= Array;
|
//*============================================= Array;
|
||||||
|
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;
|
||||||
|
zMulti[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
for( int id = 0; id < e.GetSize() ; id++ ){
|
for( int id = 0; id < e.GetSize() ; id++ ){
|
||||||
short aID = detGeo->GetArrayID(id);
|
short aID = detGeo->GetArrayID(id);
|
||||||
if( aID < 0 ) continue;
|
if( aID < 0 ) continue;
|
||||||
|
@ -108,33 +145,190 @@ void MonAnalyzer(){
|
||||||
plotter[aID]->hxf_ID->Fill(id, xf[id]);
|
plotter[aID]->hxf_ID->Fill(id, xf[id]);
|
||||||
plotter[aID]->hxn_ID->Fill(id, xn[id]);
|
plotter[aID]->hxn_ID->Fill(id, xn[id]);
|
||||||
|
|
||||||
// //@==================== Basic gate
|
//@==================== Basic gate
|
||||||
|
if( TMath::IsNaN(e[id]) ) continue ;
|
||||||
|
if( TMath::IsNaN(xn[id]) && TMath::IsNaN(xf[id]) ) continue ;
|
||||||
|
|
||||||
|
//@==================== Skip detector
|
||||||
|
bool skipFlag = false;
|
||||||
|
for( unsigned int kk = 0; kk < skipDetID.size() ; kk++){
|
||||||
|
if( id == skipDetID[kk] ) {
|
||||||
|
skipFlag = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (skipFlag ) continue;
|
||||||
|
|
||||||
|
//@==================== When e, xn, or xf is valid.
|
||||||
|
arrayMulti[aID] ++;
|
||||||
|
|
||||||
|
//@==================== 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( eCal[id] < eCalCut[0] || eCalCut[1] < eCal[id] ) continue;
|
||||||
|
|
||||||
|
//@===================== fill Calibrated data
|
||||||
|
plotter[aID]->heCal[id]->Fill(eCal[id]);
|
||||||
|
plotter[aID]->hxfCal_xnCal[id]->Fill(xfCal[id], xnCal[id]);
|
||||||
|
plotter[aID]->he_xsCal[id]->Fill(xnCal[id] + xfCal[id], e[id]);
|
||||||
|
|
||||||
|
//@===================== calculate X
|
||||||
|
if( (xf[id] > 0 || !TMath::IsNaN(xf[id])) && ( xn[id] > 0 || !TMath::IsNaN(xn[id])) ) {
|
||||||
|
///x[id] = 0.5*((xf[id]-xn[id]) / (xf[id]+xn[id]))+0.5;
|
||||||
|
x[id] = 0.5*((xf[id]-xn[id]) / e[id])+0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// range of x is (0, 1)
|
||||||
|
if ( !TMath::IsNaN(xf[id]) && !TMath::IsNaN(xn[id]) ) xCal[id] = 0.5 + 0.5 * (xfCal[id] - xnCal[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];
|
||||||
|
|
||||||
|
//@======= 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( abs(xCal[id] - 0.5) > xGate/2. ) continue;
|
||||||
|
|
||||||
|
//@==================== calculate Z
|
||||||
|
if( aID >= 0 ){
|
||||||
|
int colIndex = id % detGeo->array[aID].colDet;
|
||||||
|
if( detGeo->array[aID].firstPos > 0 ) {
|
||||||
|
z[id] = detGeo->array[aID].detLength*(1.0-xCal[id]) + detGeo->array[aID].detPos[colIndex];
|
||||||
|
}else{
|
||||||
|
z[id] = detGeo->array[aID].detLength*(xCal[id]-1.0) + detGeo->array[aID].detPos[colIndex];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//@===================== When z is calcualted.
|
||||||
|
zMulti[aID] ++;
|
||||||
|
|
||||||
|
//@=================== Array fill
|
||||||
|
plotter[aID]->he_x[id]->Fill(x[id],e[id]);
|
||||||
|
plotter[aID]->heCal_z->Fill(z[id],eCal[id]);
|
||||||
|
|
||||||
|
//@=================== Recoil Gate
|
||||||
|
// if( isRDTExist && (cutList1 || cutList2)){
|
||||||
|
// for(int i = 0 ; i < cutList1->GetEntries() ; i++ ){
|
||||||
|
// cutG = (TCutG *)cutList1->At(i) ;
|
||||||
|
// if(cutG->IsInside(rdt[2*i],rdt[2*i+1])) {
|
||||||
|
// // if(cutG->IsInside(rdt[2*i] + rdt[2*i+1],rdt[2*i+1])) {
|
||||||
|
// rdtgate1= true;
|
||||||
|
// break; /// only one is enough
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// for(int i = 0 ; i < cutList2->GetEntries() ; i++ ){
|
||||||
|
// cutG = (TCutG *)cutList2->At(i) ;
|
||||||
|
// if(cutG->IsInside(rdt[2*i],rdt[2*i+1])) {
|
||||||
|
// //if(cutG->IsInside(rdt[2*i]+ rdt[2*i+1],rdt[2*i+1])) {
|
||||||
|
// rdtgate2= true;
|
||||||
|
// break; /// only one is enough
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }else{
|
||||||
|
// rdtgate1 = true;
|
||||||
|
// rdtgate2 = true;
|
||||||
|
// }
|
||||||
|
|
||||||
|
//@================ coincident with Recoil when z is calculated.
|
||||||
|
// if( !TMath::IsNaN(z[id]) ) {
|
||||||
|
// for( int j = 0; j < mapping::NRDT ; j++){
|
||||||
|
// if( TMath::IsNaN(rdt[j]) ) continue;
|
||||||
|
|
||||||
|
// int tdiff = rdt_t[j] - e_t[id];
|
||||||
|
|
||||||
|
// if( j%2 == 1) {
|
||||||
|
// htdiff->Fill(tdiff);
|
||||||
|
// if((rdtgate1 || rdtgate2) && (eCalCut[1] > eCal[id] && eCal[id]>eCalCut[0])) {
|
||||||
|
// htdiffg->Fill(tdiff);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// hArrayRDTMatrix->Fill(id, j);
|
||||||
|
|
||||||
|
// if( isTimeGateOn && timeGate[0] < tdiff && tdiff < timeGate[1] ) {
|
||||||
|
// if(j % 2 == 0 ) hrdt2Dg[j/2]->Fill(rdt[j],rdt[j+1]); /// x=E, y=dE
|
||||||
|
// ///if(j % 2 == 0 ) hrdt2Dg[j/2]->Fill(rdt[j+1],rdt[j]); /// x=dE, y=E
|
||||||
|
// hArrayRDTMatrixG->Fill(id, j);
|
||||||
|
// ///if( rdtgate1) hArrayRDTMatrixG->Fill(id, j);
|
||||||
|
|
||||||
|
// hrdtg[j]->Fill(rdt[j]);
|
||||||
|
// coinFlag = true;
|
||||||
|
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if( !isTimeGateOn ) coinFlag = true;
|
||||||
|
|
||||||
|
//@================ E-Z gate
|
||||||
|
// if( EZCut ) {
|
||||||
|
// if( EZCut->IsInside(z[id], eCal[id]) ) ezGate = true;
|
||||||
|
// }else{
|
||||||
|
// ezGate = true;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if( coinFlag && (rdtgate1 || rdtgate2) && ezGate){
|
||||||
|
// plotter[arrayID]->heCalVzGC->Fill( z[id] , eCal[id] );
|
||||||
|
|
||||||
|
// heCalVxCalG[id]->Fill(xCal[id]*detGeo->array[arrayID].detLength, eCal[id]);
|
||||||
|
|
||||||
|
// multiEZ ++;
|
||||||
|
// isGoodEventFlag = true;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}//*====== end of array loop
|
||||||
|
|
||||||
|
for( int i = 0 ; i < numGeo ; i++ ) plotter[i]->hArrayMulti->Fill(arrayMulti[i]);
|
||||||
|
|
||||||
|
//*********** RECOILS ***********************************************/
|
||||||
|
// for( int i = 0; i < mapping::NRDT ; i++){
|
||||||
|
// hrdtID->Fill(i, rdt[i]);
|
||||||
|
// hrdt[i]->Fill(rdt[i]);
|
||||||
|
|
||||||
|
// if( i % 2 == 0 ){
|
||||||
|
// recoilMulti++; // when both dE and E are hit
|
||||||
|
// hrdt2D[i/2]->Fill(rdt[i],rdt[i+1]); //E-dE
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
//@*********** Ex and thetaCM ****************************************/
|
||||||
|
// for(Int_t id = 0; id < mapping::NARRAY ; id++){
|
||||||
|
|
||||||
// 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(z[id]) ) continue ;
|
||||||
|
// if( eCal[id] < eCalCut[0] ) continue ;
|
||||||
|
// if( eCal[id] > eCalCut[1] ) continue ;
|
||||||
|
|
||||||
|
// short aID = detGeo->GetArrayID(id);
|
||||||
|
// if( aID < 0 ) continue;
|
||||||
|
|
||||||
|
// std::pair<double, double> ExThetaCM = transfer->CalExThetaCM(eCal[id], z[id], detGeo->Bfield, detGeo->array[aID].detPerpDist);
|
||||||
|
// double Ex = ExThetaCM.first;
|
||||||
|
// double thetaCM = ExThetaCM.second;
|
||||||
|
|
||||||
|
// if( thetaCM > thetaCMGate ) {
|
||||||
|
|
||||||
|
// plotter[aID]->hEx->Fill(Ex);
|
||||||
|
// plotter[aID]->hExThetaCM->Fill(thetaCM, Ex);
|
||||||
|
|
||||||
|
// // if( rdtgate1 ) {
|
||||||
|
// // plotter[arrayID]->hExCut1->Fill(Ex);
|
||||||
|
// // plotter[arrayID]->hExThetaCM->Fill(thetaCM, Ex);
|
||||||
|
// // }
|
||||||
|
// // if( rdtgate2 ) {
|
||||||
|
// // plotter[arrayID]->hExCut2->Fill(Ex);
|
||||||
|
// // plotter[arrayID]->hExThetaCM->Fill(thetaCM, Ex);
|
||||||
|
// // }
|
||||||
|
|
||||||
|
// plotter[arrayID]->hExi[id]->Fill(Ex);
|
||||||
|
// plotter[arrayID]->hExVxCal[id]->Fill(xCal[id], Ex);
|
||||||
|
|
||||||
// //@==================== Skip detector
|
|
||||||
// bool skipFlag = false;
|
|
||||||
// for( unsigned int kk = 0; kk < skipDetID.size() ; kk++){
|
|
||||||
// if( id == skipDetID[kk] ) {
|
|
||||||
// skipFlag = true;
|
|
||||||
// break;
|
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// if (skipFlag ) continue;
|
|
||||||
|
|
||||||
// //@==================== Calibrations go here
|
|
||||||
// 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;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}//*==== end of array
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//*============================================ Progress Bar
|
//*============================================ Progress Bar
|
||||||
processedEntries ++;
|
processedEntries ++;
|
||||||
|
@ -154,5 +348,20 @@ void MonAnalyzer(){
|
||||||
plotter[i]->Plot();
|
plotter[i]->Plot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//^###############################################
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//%=============================================
|
||||||
|
void rawID(int arrayID = -1){
|
||||||
|
|
||||||
|
if( arrayID < 0 ){
|
||||||
|
for( int i = 0; i < numGeo; i++ ) plotter[i]->PlotRawID();
|
||||||
|
}else{
|
||||||
|
if( arrayID < numGeo) plotter[arrayID]->PlotRawID();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,18 @@
|
||||||
#include "../Armory/ClassDetGeo.h"
|
#include "../Armory/ClassDetGeo.h"
|
||||||
#include "../Armory/ClassReactionConfig.h"
|
#include "../Armory/ClassReactionConfig.h"
|
||||||
|
#include "../Armory/ClassCorrParas.h"
|
||||||
#include "../Cleopatra/ClassHelios.h"
|
#include "../Cleopatra/ClassHelios.h"
|
||||||
#include "../Cleopatra/ClassTransfer.h"
|
#include "../Cleopatra/ClassTransfer.h"
|
||||||
|
|
||||||
#include "ClassMonPlotter.h"
|
#include "ClassMonPlotter.h"
|
||||||
|
#include "TFile.h"
|
||||||
|
#include "TChain.h"
|
||||||
|
#include "TH1F.h"
|
||||||
|
#include "TTreeReader.h"
|
||||||
|
#include "TTreeReaderValue.h"
|
||||||
|
#include "TTreeReaderArray.h"
|
||||||
|
#include "TClonesArray.h"
|
||||||
|
#include "TGraph.h"
|
||||||
|
|
||||||
void test(){
|
void test(){
|
||||||
|
|
||||||
|
@ -48,25 +57,48 @@ void test(){
|
||||||
// delete helios;
|
// delete helios;
|
||||||
// delete transfer;root
|
// delete transfer;root
|
||||||
|
|
||||||
DetGeo dd("detectorGeo.txt");
|
// DetGeo dd("detectorGeo.txt");
|
||||||
MonPlotter * pp = new MonPlotter(0, &dd, 8);
|
// MonPlotter * pp = new MonPlotter(0, &dd, 8);
|
||||||
|
|
||||||
pp->SetUpCanvas("haha", 500, 3, 2);
|
// pp->SetUpCanvas("haha", 500, 3, 2);
|
||||||
|
|
||||||
int rawEnergyRange[2] = { 100, 4000}; /// share with e, xf, xn
|
// int rawEnergyRange[2] = { 100, 4000}; /// 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};
|
||||||
|
|
||||||
double exRange[3] = { 100, -2, 10}; /// bin [keV], low[MeV], high[MeV]
|
// double exRange[3] = { 100, -2, 10}; /// bin [keV], low[MeV], high[MeV]
|
||||||
int thetaCMRange[2] = {0, 80};
|
// int thetaCMRange[2] = {0, 80};
|
||||||
|
|
||||||
pp->SetUpHistograms(rawEnergyRange, energyRange, exRange, thetaCMRange, rdtDERange, rdtERange);
|
// pp->SetUpHistograms(rawEnergyRange, energyRange, exRange, thetaCMRange, rdtDERange, rdtERange);
|
||||||
|
|
||||||
pp->Plot();
|
// pp->Plot();
|
||||||
|
|
||||||
delete pp;
|
// delete pp;
|
||||||
|
|
||||||
|
// TChain *chain = new TChain("gen_tree");
|
||||||
|
// chain->Add("../root_data/gen_run043.root");
|
||||||
|
|
||||||
|
// // chain->Print();
|
||||||
|
|
||||||
|
// TTreeReader reader(chain);
|
||||||
|
|
||||||
|
// TTreeReaderArray<TGraph> trace = {reader, "trace"};
|
||||||
|
|
||||||
|
// ULong64_t processedEntries = 0;
|
||||||
|
// while (reader.Next()) {
|
||||||
|
|
||||||
|
// printf("%llu | %lu \n", processedEntries, trace.GetSize());
|
||||||
|
|
||||||
|
// for( int i = 0; i < trace.GetSize(); i++ ){
|
||||||
|
// printf( " %d| %d\n", i, trace.At(i).GetN());
|
||||||
|
// }
|
||||||
|
|
||||||
|
// processedEntries ++;
|
||||||
|
// if( processedEntries > 10 ) break;
|
||||||
|
// }
|
||||||
|
|
||||||
|
CorrParas * corr = new CorrParas();
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user