added CanvasTile in ChainMonitor.C
This commit is contained in:
parent
8a60ae29de
commit
f9c9363944
12
.vscode/c_cpp_properties.json
vendored
12
.vscode/c_cpp_properties.json
vendored
|
@ -27,6 +27,18 @@
|
||||||
"cStandard": "gnu17",
|
"cStandard": "gnu17",
|
||||||
"cppStandard": "gnu++17",
|
"cppStandard": "gnu++17",
|
||||||
"intelliSenseMode": "linux-gcc-x64"
|
"intelliSenseMode": "linux-gcc-x64"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "WinLinux",
|
||||||
|
"includePath": [
|
||||||
|
"${workspaceFolder}/**",
|
||||||
|
"/home/ryan/Downloads/root/include/**"
|
||||||
|
],
|
||||||
|
"defines": [],
|
||||||
|
"compilerPath": "/usr/bin/gcc",
|
||||||
|
"cStandard": "gnu17",
|
||||||
|
"cppStandard": "gnu++17",
|
||||||
|
"intelliSenseMode": "linux-gcc-x64"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"version": 4
|
"version": 4
|
||||||
|
|
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -204,5 +204,6 @@
|
||||||
"bold": false,
|
"bold": false,
|
||||||
"italic": false
|
"italic": false
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"C_Cpp.errorSquiggles": "disabled"
|
||||||
}
|
}
|
|
@ -1,7 +1,36 @@
|
||||||
#include "Monitors.C+" // the plus sign mean compilation
|
#include "Monitor.C+" // the plus sign mean compilation
|
||||||
|
#include "TObjArray.h"
|
||||||
|
#include "TFile.h"
|
||||||
|
#include "TMacro.h"
|
||||||
|
|
||||||
|
|
||||||
|
std::string create_range_string(const std::vector<int>& nums) {
|
||||||
|
char range_str[100]; // buffer to hold the range string
|
||||||
|
int pos = 0; // current position in the buffer
|
||||||
|
int start = 0; // start of the current range
|
||||||
|
int end = 0; // end of the current range
|
||||||
|
for (int i = 1; i <= nums.size(); i++) {
|
||||||
|
if (i == nums.size() || nums[i] != nums[i-1]+1) {
|
||||||
|
end = i-1;
|
||||||
|
if (start == end) {
|
||||||
|
pos += std::sprintf(range_str+pos, "%d", nums[start]);
|
||||||
|
} else if (end == start+1) {
|
||||||
|
pos += std::sprintf(range_str+pos, "%d_%d", nums[start], nums[end]);
|
||||||
|
} else {
|
||||||
|
pos += std::sprintf(range_str+pos, "%d-%d", nums[start], nums[end]);
|
||||||
|
}
|
||||||
|
if (i < nums.size()) {
|
||||||
|
pos += std::sprintf(range_str+pos, "_");
|
||||||
|
}
|
||||||
|
start = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return std::string(range_str, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChainMonitors(int RUNNUM = -1, int RUNNUM2 = -1) {
|
||||||
|
|
||||||
|
|
||||||
void ChainMonitors(int RUNNUM = -1, int RUNNUM2 = -1, bool saveCanvas = false, bool isTraceON = false) {
|
|
||||||
|
|
||||||
///default saveCanvas = false, no save Cavas
|
///default saveCanvas = false, no save Cavas
|
||||||
/// = true, save Canvas
|
/// = true, save Canvas
|
||||||
|
|
||||||
|
@ -11,7 +40,7 @@ void ChainMonitors(int RUNNUM = -1, int RUNNUM2 = -1, bool saveCanvas = false, b
|
||||||
/// this list only for manual Chain sort
|
/// this list only for manual Chain sort
|
||||||
///********** start Marker for AutoCalibration.
|
///********** start Marker for AutoCalibration.
|
||||||
|
|
||||||
///chain->Add("../root_data/gen_run135.root");
|
chain->Add("../root_data/gen_run005.root");
|
||||||
///chain->Add("../root_data/trace_run135.root");
|
///chain->Add("../root_data/trace_run135.root");
|
||||||
|
|
||||||
///********** end Marker for AutoCalibration.
|
///********** end Marker for AutoCalibration.
|
||||||
|
@ -24,25 +53,54 @@ void ChainMonitors(int RUNNUM = -1, int RUNNUM2 = -1, bool saveCanvas = false, b
|
||||||
if( RUNNUM2 == -1) endRUNNUM = RUNNUM;
|
if( RUNNUM2 == -1) endRUNNUM = RUNNUM;
|
||||||
|
|
||||||
for( int i = RUNNUM ; i <= endRUNNUM ; i++){
|
for( int i = RUNNUM ; i <= endRUNNUM ; i++){
|
||||||
|
fileName.Form("../root_data/gen_run%03d.root", i);
|
||||||
if( isTraceON == false )fileName.Form("../root_data/gen_run%03d.root", i);
|
|
||||||
if( isTraceON == true ) fileName.Form("../root_data/trace_run%03d.root", i);
|
|
||||||
chain->Add(fileName);
|
chain->Add(fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TObjArray * fileList = chain->GetListOfFiles();
|
||||||
|
|
||||||
printf("\033[0;31m========================================== Number of Files : %2d\n",chain->GetListOfFiles()->GetEntries());
|
printf("\033[0;31m========================================== Number of Files : %2d\n",fileList->GetEntries());
|
||||||
chain->GetListOfFiles()->Print();
|
fileList->Print();
|
||||||
printf("========================================== Number of Files : %2d\033[0m\n",chain->GetListOfFiles()->GetEntries());
|
printf("========================================== Number of Files : %2d\033[0m\n",fileList->GetEntries());
|
||||||
printf(" number of entries : %llu \n", chain->GetEntries());
|
printf(" number of entries : %llu \n", chain->GetEntries());
|
||||||
|
|
||||||
|
double totDuration = 0;
|
||||||
|
std::vector<ULong64_t> startTime;
|
||||||
|
std::vector<ULong64_t> stopTime;
|
||||||
|
std::vector<int> runList;
|
||||||
|
|
||||||
//Simple call TSelector
|
for( int i = 0; i < fileList->GetEntries(); i++){
|
||||||
//chain->Process("Monitors.C+");
|
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.) ;
|
||||||
|
|
||||||
|
printf("%s\n", title.Data());
|
||||||
|
|
||||||
//Some input to TSelector
|
//Some input to TSelector
|
||||||
Monitors * selector = new Monitors();
|
Monitor * selector = new Monitor();
|
||||||
if( saveCanvas ) selector->printControl(0); //quit after terminated
|
selector->SetCanvasTitle(title);
|
||||||
chain->Process(selector, "");
|
chain->Process(selector, "");
|
||||||
|
|
||||||
}
|
}
|
|
@ -780,17 +780,17 @@ void Monitor::Terminate(){
|
||||||
/************************************/
|
/************************************/
|
||||||
StpWatch.Start(kFALSE);
|
StpWatch.Start(kFALSE);
|
||||||
|
|
||||||
//gROOT->ProcessLine(".L ../Armory/Monitor_Util.C"); //TODO some pointer is empty
|
//gROOT->ProcessLine(".L ../armory/Monitor_Util.C"); //TODO some pointer is empty
|
||||||
//printf("=============== loaded Monitor_Utils.C\n");
|
//printf("=============== loaded Monitor_Utils.C\n");
|
||||||
gROOT->ProcessLine(".L ../Armory/AutoFit.C");
|
gROOT->ProcessLine(".L ../armory/AutoFit.C");
|
||||||
printf("=============== loaded Armory/AutoFit.C\n");
|
printf("=============== loaded armory/AutoFit.C\n");
|
||||||
// gROOT->ProcessLine(".L ../Armory/RDTCutCreator.C");
|
// gROOT->ProcessLine(".L ../armory/RDTCutCreator.C");
|
||||||
// printf("=============== loaded Armory/RDTCutCreator.C\n");
|
// printf("=============== loaded armory/RDTCutCreator.C\n");
|
||||||
// gROOT->ProcessLine(".L ../Armory/Check_rdtGate.C");
|
// gROOT->ProcessLine(".L ../armory/Check_rdtGate.C");
|
||||||
// printf("=============== loaded Armory/Check_rdtGate.C\n");
|
// printf("=============== loaded armory/Check_rdtGate.C\n");
|
||||||
// gROOT->ProcessLine(".L ../Armory/readTrace.C");
|
// gROOT->ProcessLine(".L ../armory/readTrace.C");
|
||||||
// printf("=============== loaded Armory/readTrace.C\n");
|
// printf("=============== loaded Armory/readTrace.C\n");
|
||||||
// gROOT->ProcessLine(".L ../Armory/readRawTrace.C");
|
// gROOT->ProcessLine(".L ../armory/readRawTrace.C");
|
||||||
// printf("=============== loaded Armory/readRawTrace.C\n");
|
// printf("=============== loaded Armory/readRawTrace.C\n");
|
||||||
// gROOT->ProcessLine("listDraws()");
|
// gROOT->ProcessLine("listDraws()");
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,9 @@ public :
|
||||||
|
|
||||||
padID = 0;
|
padID = 0;
|
||||||
|
|
||||||
|
timeRange[0] = 0;
|
||||||
|
timeRange[1] = 100;
|
||||||
|
|
||||||
}
|
}
|
||||||
virtual ~Monitor() {
|
virtual ~Monitor() {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user