Compare commits
No commits in common. "bba74763f00a2c248ebfd9aa21a76e4c177b16fc" and "08577871ee5c89ae9cc2fa80a180b82f5ec0d83d" have entirely different histories.
bba74763f0
...
08577871ee
|
@ -339,31 +339,6 @@ std::vector<std::vector<double>> FindMatchingPair(std::vector<double> enX, std::
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string create_range_string(const std::vector<int>& nums) {
|
|
||||||
std::string range_str;
|
|
||||||
int lastNum = nums[0];
|
|
||||||
int rangeStart = lastNum;
|
|
||||||
for (int i = 1; i < (int) nums.size(); i++) {
|
|
||||||
if (nums[i] == lastNum + 1) {
|
|
||||||
lastNum = nums[i];
|
|
||||||
} else {
|
|
||||||
if (rangeStart == lastNum) {
|
|
||||||
range_str += std::to_string(rangeStart) + "_";
|
|
||||||
} else {
|
|
||||||
range_str += std::to_string(rangeStart) + "-" + std::to_string(lastNum) + "_";
|
|
||||||
}
|
|
||||||
rangeStart = lastNum = nums[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Add the last range
|
|
||||||
if (rangeStart == lastNum) {
|
|
||||||
range_str += std::to_string(rangeStart);
|
|
||||||
} else {
|
|
||||||
range_str += std::to_string(rangeStart) + "-" + std::to_string(lastNum);
|
|
||||||
}
|
|
||||||
return range_str;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,6 @@ if [ $# -eq 0 ] || [ $1 == "-help" ]; then
|
||||||
echo " = 2 WS fit"
|
echo " = 2 WS fit"
|
||||||
echo " = 3 trapezoid(not implemented)"
|
echo " = 3 trapezoid(not implemented)"
|
||||||
echo " e.g. 208 = WS trace with 8 workers"
|
echo " e.g. 208 = WS trace with 8 workers"
|
||||||
|
|
||||||
#======== change Monitor to Action.
|
|
||||||
|
|
||||||
echo " Monitor = 2/1/0 || 1 = single run, 2 = using the list in ChainMonitors.C"
|
echo " Monitor = 2/1/0 || 1 = single run, 2 = using the list in ChainMonitors.C"
|
||||||
echo ""
|
echo ""
|
||||||
echo " * negative option = force."
|
echo " * negative option = force."
|
||||||
|
@ -54,8 +51,12 @@ fi
|
||||||
|
|
||||||
nWorker=$((nWorker % 100 ));
|
nWorker=$((nWorker % 100 ));
|
||||||
|
|
||||||
runNum=${RUN#0} #remove zero
|
if [ "$RUN" == "lastRun" ]; then
|
||||||
RUN=$(printf '%03d' $runNum) ##add back the zero
|
RUN=$runID
|
||||||
|
fi
|
||||||
|
|
||||||
|
RUN=${RUN##*(0)} #remove zero
|
||||||
|
RUN=$(printf '%03d' $RUN) ##add back the zero
|
||||||
|
|
||||||
################################### Setting display
|
################################### Setting display
|
||||||
echo "#################################################"
|
echo "#################################################"
|
||||||
|
@ -91,7 +92,7 @@ fi
|
||||||
if [ $isMonitor -eq 0 ]; then
|
if [ $isMonitor -eq 0 ]; then
|
||||||
echo -e "${LRED}>>>>>>>>>>>>>>>>>>>>> Monitor Skipped by user. ${NC}"
|
echo -e "${LRED}>>>>>>>>>>>>>>>>>>>>> Monitor Skipped by user. ${NC}"
|
||||||
elif [ $isMonitor -eq 1 ]; then
|
elif [ $isMonitor -eq 1 ]; then
|
||||||
root -l "ChainMonitors.C($runNum)"
|
root -l "ChainMonitors.C($RUN)"
|
||||||
elif [ $isMonitor -eq 2 ]; then
|
elif [ $isMonitor -eq 2 ]; then
|
||||||
root -l "ChainMonitors.C"
|
root -l "ChainMonitors.C"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -2,23 +2,24 @@
|
||||||
#include "TObjArray.h"
|
#include "TObjArray.h"
|
||||||
#include "TFile.h"
|
#include "TFile.h"
|
||||||
#include "TMacro.h"
|
#include "TMacro.h"
|
||||||
#include "TChain.h"
|
std::string create_range_string(const std::vector<int>& nums);
|
||||||
|
|
||||||
TChain *gen_tree = nullptr;
|
|
||||||
|
|
||||||
void ChainMonitors(int RUNNUM = -1, int RUNNUM2 = -1) {
|
void ChainMonitors(int RUNNUM = -1, int RUNNUM2 = -1) {
|
||||||
///default saveCanvas = false, no save Cavas
|
///default saveCanvas = false, no save Cavas
|
||||||
/// = true, save Canvas
|
/// = true, save Canvas
|
||||||
|
|
||||||
gen_tree = new TChain("gen_tree");
|
TChain * chain = new TChain("gen_tree");
|
||||||
if( RUNNUM == -1){
|
if( RUNNUM == -1){
|
||||||
/// this list only for manual Chain sort
|
/// this list only for manual Chain sort
|
||||||
///********** start Marker for AutoCalibration.
|
///********** start Marker for AutoCalibration.
|
||||||
|
|
||||||
gen_tree->Add("../root_data/trace_run033.root");
|
chain->Add("../root_data/gen_run005.root");
|
||||||
|
chain->Add("../root_data/gen_run003.root");
|
||||||
|
///chain->Add("../root_data/trace_run135.root");
|
||||||
|
|
||||||
///********** end Marker for AutoCalibration.
|
///********** end Marker for AutoCalibration.
|
||||||
|
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
TString fileName;
|
TString fileName;
|
||||||
|
@ -27,11 +28,81 @@ void ChainMonitors(int RUNNUM = -1, int RUNNUM2 = -1) {
|
||||||
|
|
||||||
for( int i = RUNNUM ; i <= endRUNNUM ; i++){
|
for( int i = RUNNUM ; i <= endRUNNUM ; i++){
|
||||||
fileName.Form("../root_data/gen_run%03d.root", i);
|
fileName.Form("../root_data/gen_run%03d.root", i);
|
||||||
gen_tree->Add(fileName);
|
chain->Add(fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//^============== should have other things, like calibrations.
|
TObjArray * fileList = chain->GetListOfFiles();
|
||||||
Monitor(gen_tree);
|
|
||||||
|
printf("\033[0;31m========================================== Number of Files : %2d\n",fileList->GetEntries());
|
||||||
|
fileList->Print();
|
||||||
|
printf("========================================== Number of Files : %2d\033[0m\n",fileList->GetEntries());
|
||||||
|
printf("---------------------------------- Total Number of entries : %llu \n", chain->GetEntries());
|
||||||
|
|
||||||
|
double totDuration = 0;
|
||||||
|
std::vector<ULong64_t> startTime;
|
||||||
|
std::vector<ULong64_t> stopTime;
|
||||||
|
std::vector<int> runList;
|
||||||
|
|
||||||
|
for( int i = 0; i < fileList->GetEntries(); i++){
|
||||||
|
TString fileName = fileList->At(i)->GetTitle();
|
||||||
|
TFile file(fileName);
|
||||||
|
TMacro * timeStamp = (TMacro*) file.FindObjectAny("timeStamp");
|
||||||
|
//timeStamp->Print();
|
||||||
|
|
||||||
|
TString haha = timeStamp->GetListOfLines()->At(0)->GetName();
|
||||||
|
ULong64_t t1 = haha.Atoll();
|
||||||
|
|
||||||
|
haha = timeStamp->GetListOfLines()->At(1)->GetName();
|
||||||
|
ULong64_t t2 = haha.Atoll();
|
||||||
|
|
||||||
|
haha = timeStamp->GetListOfLines()->At(2)->GetName();
|
||||||
|
int RunID = haha.Atoi();
|
||||||
|
|
||||||
|
totDuration += (t2-t1)*8./1e9;
|
||||||
|
startTime.push_back(t1);
|
||||||
|
stopTime.push_back(t2);
|
||||||
|
runList.push_back(RunID);
|
||||||
|
}
|
||||||
|
|
||||||
|
//======== format CanvasTitle
|
||||||
|
std::sort(runList.begin(), runList.end());
|
||||||
|
TString title = "Run:" + create_range_string(runList);
|
||||||
|
title += Form(" | %.0f min", totDuration/60.) ;
|
||||||
|
|
||||||
|
//Some input to TSelector
|
||||||
|
Monitor * selector = new Monitor();
|
||||||
|
selector->SetCanvasTitle(title);
|
||||||
|
selector->SetStartStopTimes(startTime, stopTime);
|
||||||
|
chain->Process(selector, "");
|
||||||
|
|
||||||
|
delete chain;
|
||||||
|
delete selector;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string create_range_string(const std::vector<int>& nums) {
|
||||||
|
std::string range_str;
|
||||||
|
int lastNum = nums[0];
|
||||||
|
int rangeStart = lastNum;
|
||||||
|
for (int i = 1; i < nums.size(); i++) {
|
||||||
|
if (nums[i] == lastNum + 1) {
|
||||||
|
lastNum = nums[i];
|
||||||
|
} else {
|
||||||
|
if (rangeStart == lastNum) {
|
||||||
|
range_str += std::to_string(rangeStart) + "_";
|
||||||
|
} else {
|
||||||
|
range_str += std::to_string(rangeStart) + "-" + std::to_string(lastNum) + "_";
|
||||||
|
}
|
||||||
|
rangeStart = lastNum = nums[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Add the last range
|
||||||
|
if (rangeStart == lastNum) {
|
||||||
|
range_str += std::to_string(rangeStart);
|
||||||
|
} else {
|
||||||
|
range_str += std::to_string(rangeStart) + "-" + std::to_string(lastNum);
|
||||||
|
}
|
||||||
|
return range_str;
|
||||||
|
}
|
|
@ -347,7 +347,6 @@ void MonPlotter::SetUpHistograms(int * rawEnergyRange,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//^####################################################### Plot
|
|
||||||
void MonPlotter::Plot(){
|
void MonPlotter::Plot(){
|
||||||
|
|
||||||
//TODO a more user-friendly way.
|
//TODO a more user-friendly way.
|
||||||
|
@ -368,7 +367,6 @@ void MonPlotter::Plot(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//^#######################################################
|
|
||||||
void MonPlotter::LoadRDTGate(TString rdtCutFile){
|
void MonPlotter::LoadRDTGate(TString rdtCutFile){
|
||||||
|
|
||||||
if( rdtCutFile == "" ) return ;
|
if( rdtCutFile == "" ) return ;
|
||||||
|
|
|
@ -51,13 +51,18 @@ std::vector<TString> rdtCutFile1 = {"", ""}; /// {reaction-0, reaction-1}, can a
|
||||||
|
|
||||||
MonPlotter ** plotter = nullptr;
|
MonPlotter ** plotter = nullptr;
|
||||||
int numGeo = 1;
|
int numGeo = 1;
|
||||||
|
TChain *gen_tree = nullptr;
|
||||||
|
|
||||||
void Monitor(TChain *gen_tree){
|
void MonAnalyzer(){
|
||||||
|
|
||||||
printf("#####################################################################\n");
|
printf("#####################################################################\n");
|
||||||
printf("####################### Monitor.C #######################\n");
|
printf("####################### MonAnalyzer.C #######################\n");
|
||||||
printf("#####################################################################\n");
|
printf("#####################################################################\n");
|
||||||
|
|
||||||
|
gen_tree = new TChain("gen_tree");
|
||||||
|
//gen_tree->Add("../root_data/gen_run043.root");
|
||||||
|
gen_tree->Add("../root_data/trace_run033.root");
|
||||||
|
|
||||||
TObjArray * fileList = gen_tree->GetListOfFiles();
|
TObjArray * fileList = gen_tree->GetListOfFiles();
|
||||||
printf("\033[0;31m========================================== Number of Files : %2d\n",fileList->GetEntries());
|
printf("\033[0;31m========================================== Number of Files : %2d\n",fileList->GetEntries());
|
||||||
fileList->Print();
|
fileList->Print();
|
||||||
|
@ -67,43 +72,6 @@ void Monitor(TChain *gen_tree){
|
||||||
printf(" Total Number of entries : %llu \n", gen_tree->GetEntries());
|
printf(" Total Number of entries : %llu \n", gen_tree->GetEntries());
|
||||||
printf("///////////////////////////////////////////////////////////////////\n");
|
printf("///////////////////////////////////////////////////////////////////\n");
|
||||||
|
|
||||||
if( gen_tree->GetEntries() == 0 ) {
|
|
||||||
printf("========= no events. Abort.\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
double totDuration = 0;
|
|
||||||
std::vector<ULong64_t> startTime;
|
|
||||||
std::vector<ULong64_t> stopTime;
|
|
||||||
std::vector<int> runList;
|
|
||||||
|
|
||||||
for( int i = 0; i < fileList->GetEntries(); i++){
|
|
||||||
TString fileName = fileList->At(i)->GetTitle();
|
|
||||||
TFile file(fileName);
|
|
||||||
TMacro * timeStamp = (TMacro*) file.FindObjectAny("timeStamp");
|
|
||||||
//timeStamp->Print();
|
|
||||||
|
|
||||||
TString haha = timeStamp->GetListOfLines()->At(0)->GetName();
|
|
||||||
ULong64_t t1 = haha.Atoll();
|
|
||||||
|
|
||||||
haha = timeStamp->GetListOfLines()->At(1)->GetName();
|
|
||||||
ULong64_t t2 = haha.Atoll();
|
|
||||||
|
|
||||||
haha = timeStamp->GetListOfLines()->At(2)->GetName();
|
|
||||||
int RunID = haha.Atoi();
|
|
||||||
|
|
||||||
totDuration += (t2-t1)*8./1e9;
|
|
||||||
startTime.push_back(t1);
|
|
||||||
stopTime.push_back(t2);
|
|
||||||
runList.push_back(RunID);
|
|
||||||
}
|
|
||||||
|
|
||||||
//======== format CanvasTitle
|
|
||||||
std::sort(runList.begin(), runList.end());
|
|
||||||
TString title = "Run:" + AnalysisLib::create_range_string(runList);
|
|
||||||
title += Form(" | %.0f min", totDuration/60.) ;
|
|
||||||
|
|
||||||
//*===========================================================
|
|
||||||
TTreeReader reader(gen_tree);
|
TTreeReader reader(gen_tree);
|
||||||
|
|
||||||
TTreeReaderValue<ULong64_t> evID = {reader, "evID"};
|
TTreeReaderValue<ULong64_t> evID = {reader, "evID"};
|
||||||
|
@ -147,7 +115,7 @@ void Monitor(TChain *gen_tree){
|
||||||
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(title, 500, 3, 2);
|
plotter[i]->SetUpCanvas("haha", 500, 3, 2); //TODO canvaseTitle
|
||||||
plotter[i]->SetUpHistograms(rawEnergyRange, energyRange, exRange, thetaCMRange, rdtDERange, rdtERange, coinTimeRange);
|
plotter[i]->SetUpHistograms(rawEnergyRange, energyRange, exRange, thetaCMRange, rdtDERange, rdtERange, coinTimeRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,11 +398,15 @@ void Monitor(TChain *gen_tree){
|
||||||
printf(" raw() - Raw data\n");
|
printf(" raw() - Raw data\n");
|
||||||
printf(" cal() - Calibrated data\n");
|
printf(" cal() - Calibrated data\n");
|
||||||
printf(" rdt() - Raw RDT data\n");
|
printf(" rdt() - Raw RDT data\n");
|
||||||
//printf(" elum() - Luminosity Energy Spectra\n");
|
|
||||||
printf("-----------------------------------------------------\n");
|
printf("-----------------------------------------------------\n");
|
||||||
printf(" ez() - Energy vs. Z\n");
|
printf(" ez() - Energy vs. Z\n");
|
||||||
printf("-----------------------------------------------------\n");
|
printf("-----------------------------------------------------\n");
|
||||||
printf(" excite() - Excitation Energy\n");
|
printf(" excite() - Excitation Energy\n");
|
||||||
|
//printf(" elum() - Luminosity Energy Spectra\n");
|
||||||
|
//printf(" ic() - Ionization Chamber Spectra\n");
|
||||||
|
// printf(" eCalVzRow() - Energy vs. Z for each row\n");
|
||||||
|
// printf(" ExThetaCM() - Ex vs ThetaCM\n");
|
||||||
|
// printf(" ExVxCal() - Ex vs X for all %d detectors\n", numDet);
|
||||||
// printf("-----------------------------------------------------\n");
|
// printf("-----------------------------------------------------\n");
|
||||||
// printf(" ShowFitMethod() - Shows various fitting methods \n");
|
// printf(" ShowFitMethod() - Shows various fitting methods \n");
|
||||||
// printf(" RDTCutCreator() - Create RDT Cuts [May need to edit]\n");
|
// printf(" RDTCutCreator() - Create RDT Cuts [May need to edit]\n");
|
||||||
|
@ -442,8 +414,8 @@ void Monitor(TChain *gen_tree){
|
||||||
// printf(" readTrace() - read trace from gen_runXXX.root \n");
|
// printf(" readTrace() - read trace from gen_runXXX.root \n");
|
||||||
// printf(" readRawTrace() - read trace from runXXX.root \n");
|
// printf(" readRawTrace() - read trace from runXXX.root \n");
|
||||||
// printf(" Check1D() - Count Integral within a range\n");
|
// printf(" Check1D() - Count Integral within a range\n");
|
||||||
printf("-----------------------------------------------------\n");
|
// printf("-----------------------------------------------------\n");
|
||||||
printf(" %s\n", title.Data());
|
// printf(" %s\n", canvasTitle.Data());
|
||||||
printf("-----------------------------------------------------\n");
|
printf("-----------------------------------------------------\n");
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user