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 " = 3 trapezoid(not implemented)"
|
||||
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 ""
|
||||
echo " * negative option = force."
|
||||
|
@ -54,8 +51,12 @@ fi
|
|||
|
||||
nWorker=$((nWorker % 100 ));
|
||||
|
||||
runNum=${RUN#0} #remove zero
|
||||
RUN=$(printf '%03d' $runNum) ##add back the zero
|
||||
if [ "$RUN" == "lastRun" ]; then
|
||||
RUN=$runID
|
||||
fi
|
||||
|
||||
RUN=${RUN##*(0)} #remove zero
|
||||
RUN=$(printf '%03d' $RUN) ##add back the zero
|
||||
|
||||
################################### Setting display
|
||||
echo "#################################################"
|
||||
|
@ -91,7 +92,7 @@ fi
|
|||
if [ $isMonitor -eq 0 ]; then
|
||||
echo -e "${LRED}>>>>>>>>>>>>>>>>>>>>> Monitor Skipped by user. ${NC}"
|
||||
elif [ $isMonitor -eq 1 ]; then
|
||||
root -l "ChainMonitors.C($runNum)"
|
||||
root -l "ChainMonitors.C($RUN)"
|
||||
elif [ $isMonitor -eq 2 ]; then
|
||||
root -l "ChainMonitors.C"
|
||||
fi
|
||||
|
|
|
@ -2,36 +2,107 @@
|
|||
#include "TObjArray.h"
|
||||
#include "TFile.h"
|
||||
#include "TMacro.h"
|
||||
#include "TChain.h"
|
||||
|
||||
TChain *gen_tree = nullptr;
|
||||
std::string create_range_string(const std::vector<int>& nums);
|
||||
|
||||
void ChainMonitors(int RUNNUM = -1, int RUNNUM2 = -1) {
|
||||
///default saveCanvas = false, no save Cavas
|
||||
/// = true, save Canvas
|
||||
|
||||
gen_tree = new TChain("gen_tree");
|
||||
TChain * chain = new TChain("gen_tree");
|
||||
if( RUNNUM == -1){
|
||||
/// this list only for manual Chain sort
|
||||
///********** 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.
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
TString fileName;
|
||||
int endRUNNUM = RUNNUM2;
|
||||
if( RUNNUM2 == -1) endRUNNUM = RUNNUM;
|
||||
|
||||
|
||||
for( int i = RUNNUM ; i <= endRUNNUM ; i++){
|
||||
fileName.Form("../root_data/gen_run%03d.root", i);
|
||||
gen_tree->Add(fileName);
|
||||
chain->Add(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
//^============== should have other things, like calibrations.
|
||||
Monitor(gen_tree);
|
||||
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("---------------------------------- 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(){
|
||||
|
||||
//TODO a more user-friendly way.
|
||||
|
@ -368,7 +367,6 @@ void MonPlotter::Plot(){
|
|||
}
|
||||
}
|
||||
|
||||
//^#######################################################
|
||||
void MonPlotter::LoadRDTGate(TString rdtCutFile){
|
||||
|
||||
if( rdtCutFile == "" ) return ;
|
||||
|
|
|
@ -51,13 +51,18 @@ std::vector<TString> rdtCutFile1 = {"", ""}; /// {reaction-0, reaction-1}, can a
|
|||
|
||||
MonPlotter ** plotter = nullptr;
|
||||
int numGeo = 1;
|
||||
TChain *gen_tree = nullptr;
|
||||
|
||||
void Monitor(TChain *gen_tree){
|
||||
void MonAnalyzer(){
|
||||
|
||||
printf("#####################################################################\n");
|
||||
printf("####################### Monitor.C #######################\n");
|
||||
printf("####################### MonAnalyzer.C #######################\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();
|
||||
printf("\033[0;31m========================================== Number of Files : %2d\n",fileList->GetEntries());
|
||||
fileList->Print();
|
||||
|
@ -66,44 +71,7 @@ void Monitor(TChain *gen_tree){
|
|||
printf("///////////////////////////////////////////////////////////////////\n");
|
||||
printf(" Total Number of entries : %llu \n", gen_tree->GetEntries());
|
||||
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);
|
||||
|
||||
TTreeReaderValue<ULong64_t> evID = {reader, "evID"};
|
||||
|
@ -147,7 +115,7 @@ void Monitor(TChain *gen_tree){
|
|||
plotter = new MonPlotter *[numGeo];
|
||||
for( int i = 0; i < numGeo; i++ ) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -430,11 +398,15 @@ void Monitor(TChain *gen_tree){
|
|||
printf(" raw() - Raw data\n");
|
||||
printf(" cal() - Calibrated data\n");
|
||||
printf(" rdt() - Raw RDT data\n");
|
||||
//printf(" elum() - Luminosity Energy Spectra\n");
|
||||
printf("-----------------------------------------------------\n");
|
||||
printf(" ez() - Energy vs. Z\n");
|
||||
printf("-----------------------------------------------------\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(" ShowFitMethod() - Shows various fitting methods \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(" readRawTrace() - read trace from runXXX.root \n");
|
||||
// printf(" Check1D() - Count Integral within a range\n");
|
||||
printf("-----------------------------------------------------\n");
|
||||
printf(" %s\n", title.Data());
|
||||
// printf("-----------------------------------------------------\n");
|
||||
// printf(" %s\n", canvasTitle.Data());
|
||||
printf("-----------------------------------------------------\n");
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user