Skip to content

Commit 64bc2fc

Browse files
authored
Merge pull request #355 from rest-for-physics/jgalan_sensitivity
Implementation of experimental sensitivity classes
2 parents f53257d + 4ed69d3 commit 64bc2fc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3739
-102
lines changed

CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,27 @@ else ()
188188
set(REST_MPFR OFF)
189189
endif (${REST_MPFR} MATCHES "ON")
190190

191+
if (((${REST_ALL_LIBS} MATCHES "ON") AND (NOT DEFINED RESTLIB_AXION))
192+
OR (${RESTLIB_AXION} MATCHES "ON"))
193+
# GSL #### Find GSL
194+
find_package(GSL REQUIRED)
195+
196+
# Include GSL directories
197+
set(external_include_dirs ${external_include_dirs} ${GSL_INCLUDE_DIRS})
198+
199+
# Link GSL libraries
200+
set(external_libs ${external_libs};${GSL_LIBRARIES})
201+
202+
message(STATUS "Found GSL libraries : ${GSL_LIBRARIES}")
203+
message(STATUS "GSL headers : ${GSL_INCLUDE_DIRS}")
204+
205+
set(REST_GSL ON)
206+
else ()
207+
set(REST_GSL OFF)
208+
message(STATUS "GSL libraries not required")
209+
endif (((${REST_ALL_LIBS} MATCHES "ON") AND (NOT DEFINED RESTLIB_AXION))
210+
OR (${RESTLIB_AXION} MATCHES "ON"))
211+
191212
# CURL #####
192213
find_library(CURL_LIB curl)
193214
if (NOT ${CURL_LIB} STREQUAL "CURL_LIB-NOTFOUND")
273 KB
Loading
182 KB
Loading

macros/REST_AddComponentDataSet.C

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#include "TRestComponent.h"
2+
#include "TRestTask.h"
3+
4+
#ifndef RestTask_AddComponent
5+
#define RestTask_AddComponent
6+
7+
//*******************************************************************************************************
8+
//*** Description: This macro will load from an RML the component chosen in the arguments and it
9+
//*** will write it inside the file given as outputFile
10+
//***
11+
//*** --------------
12+
//*** Usage: restManager AddComponentDataSet components.rml sectionName [outputFile] [componentName] [update]
13+
//***
14+
//*** Arguments description:
15+
//***
16+
//*** - cfgFile: The RML configuration file where the component definition can be found.
17+
//*** - sectionName: The section name used to select a component inside the RML file.
18+
//*** - outputFile: The file where the component is written, by default is components.root.
19+
//*** - componentName: This argument allows to change the component name stored in the output file.
20+
//*** By default it will take the same value as section name.
21+
//*** - update: If disabled it will create a new file erasing any other previously added components.
22+
//*** It is enabled by default.
23+
//***
24+
//*******************************************************************************************************
25+
26+
Int_t REST_AddComponentDataSet(std::string cfgFile, std::string sectionName,
27+
std::string outputFile = "components.root", std::string componentName = "",
28+
Bool_t update = true) {
29+
TRestComponentDataSet comp(cfgFile.c_str(), sectionName.c_str());
30+
comp.Initialize();
31+
32+
TFile* f;
33+
if (update)
34+
f = TFile::Open(outputFile.c_str(), "UPDATE");
35+
else
36+
f = TFile::Open(outputFile.c_str(), "RECREATE");
37+
38+
if (componentName == "") componentName = sectionName;
39+
40+
comp.Write(componentName.c_str());
41+
42+
f->Close();
43+
44+
return 0;
45+
}
46+
#endif

macros/REST_AddComponentFormula.C

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#include "TRestComponent.h"
2+
#include "TRestTask.h"
3+
4+
#ifndef RestTask_AddComponentFormula
5+
#define RestTask_AddComponentFormula
6+
7+
//*******************************************************************************************************
8+
//*** Description: This macro will load from an RML the component chosen in the arguments and it
9+
//*** will write it inside the file given as outputFile
10+
//***
11+
//*** --------------
12+
//*** Usage: restManager AddComponentFormula components.rml sectionName [outputFile] [componentName] [update]
13+
//***
14+
//*** Arguments description:
15+
//***
16+
//*** - cfgFile: The RML configuration file where the component definition can be found.
17+
//*** - sectionName: The section name used to select a component inside the RML file.
18+
//*** - outputFile: The file where the component is written, by default is components.root.
19+
//*** - componentName: This argument allows to change the component name stored in the output file.
20+
//*** By default it will take the same value as section name.
21+
//*** - update: If disabled it will create a new file erasing any other previously added components.
22+
//*** It is enabled by default.
23+
//***
24+
//*******************************************************************************************************
25+
26+
Int_t REST_AddComponentFormula(std::string cfgFile, std::string sectionName,
27+
std::string outputFile = "components.root", std::string componentName = "",
28+
Bool_t update = true) {
29+
TRestComponentFormula comp(cfgFile.c_str(), sectionName.c_str());
30+
comp.Initialize();
31+
32+
TFile* f;
33+
if (update)
34+
f = TFile::Open(outputFile.c_str(), "UPDATE");
35+
else
36+
f = TFile::Open(outputFile.c_str(), "RECREATE");
37+
38+
if (componentName == "") componentName = sectionName;
39+
40+
comp.Write(componentName.c_str());
41+
42+
f->Close();
43+
44+
return 0;
45+
}
46+
#endif

macros/REST_CheckValidRuns.C

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,14 @@ namespace fs = std::filesystem;
3737
//*** CAUTION: Be aware that any non-REST file in the list will be removed if you use purge=1
3838
//***
3939
//*******************************************************************************************************
40-
Int_t REST_CheckValidRuns(TString namePattern, Bool_t purge = false) {
40+
Int_t REST_CheckValidRuns(std::string namePattern, Bool_t purge = false) {
4141
TGeoManager::SetVerboseLevel(0);
4242

4343
vector<std::string> filesNotWellClosed;
4444

4545
TRestStringOutput RESTLog;
4646

47-
string a = TRestTools::Execute((string)("ls -d -1 " + namePattern));
48-
vector<string> b = Split(a, "\n");
47+
std::vector<std::string> b = TRestTools::GetFilesMatchingPattern(namePattern, true);
4948

5049
Double_t totalTime = 0;
5150
int cont = 0;
@@ -76,11 +75,12 @@ Int_t REST_CheckValidRuns(TString namePattern, Bool_t purge = false) {
7675
}
7776

7877
RESTLog << "Run time (hours) : " << run->GetRunLength() / 3600. << RESTendl;
79-
if (run->GetRunLength() > 0) totalTime += run->GetRunLength() / 3600.;
78+
RESTLog << "Entries : " << run->GetEntries() << RESTendl;
8079

81-
if (run->GetEndTimestamp() == 0 || run->GetRunLength() < 0) {
80+
if (run->GetEndTimestamp() == 0 || run->GetRunLength() < 0 || run->GetEntries() == 0) {
8281
filesNotWellClosed.push_back(filename);
83-
}
82+
} else if (run->GetRunLength() > 0)
83+
totalTime += run->GetRunLength() / 3600.;
8484

8585
delete run;
8686

@@ -100,7 +100,6 @@ Int_t REST_CheckValidRuns(TString namePattern, Bool_t purge = false) {
100100
if (purge) {
101101
RESTLog << "---------------------------" << RESTendl;
102102
RESTLog << "The files have been removed" << RESTendl;
103-
RESTLog << "---------------------------" << RESTendl;
104103
}
105104
}
106105

macros/REST_OpenInputFile.C

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ void REST_OpenInputFile(const std::string& fileName) {
4646
printf("\n%s\n", " - dSet->PrintMetadata()");
4747
printf("%s\n", " - dSet->GetDataFrame().GetColumnNames()");
4848
printf("%s\n\n", " - dSet->GetTree()->GetEntries()");
49+
printf("%s\n", " - dSet->GetDataFrame().Display(\"\")->Print()");
4950
printf("%s\n\n", " - dSet->GetDataFrame().Display({\"colName1,colName2\"})->Print()");
5051
if (dSet) delete dSet;
5152
dSet = new TRestDataSet();

pipeline/panda-x/P3AutoChain.rml

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
2-
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
32
<!--In this example, when launching the analysis, we are doing following operations inside TRestManager:
43
1. Initialize TRestRun
54
1.1 set input and output file for TRestRun(here input and output is in "globals")
@@ -13,25 +12,17 @@
1312
2.4.1 add additional observables in the process
1413
3. Add a task to call TRestProcessRunner to run
1514
-->
16-
1715
<TRestManager name="CoBoDataAnalysis" title="Example" verboseLevel="info">
18-
19-
<TRestRun name="SJTU_Proto">
20-
<parameter name="runNumber" value="auto"/>//change this value to "auto" to enable database
21-
<parameter name="inputFileName" value="auto"/>
22-
</TRestRun>
23-
16+
<TRestRun name="SJTU_Proto"><parameter name="runNumber" value="auto"/>//change this value to "auto" to enable database
17+
<parameter name="inputFileName" value="auto"/></TRestRun>
2418
<TRestProcessRunner name="Processor" verboseLevel="info">
2519
<parameter name="eventsToProcess" value="0"/>
2620
<parameter name="threadNumber" value="2"/>
27-
2821
<parameter name="inputAnalysisStorage" value="on"/>
2922
<parameter name="inputEventStorage" value="off"/>
3023
<parameter name="outputEventStorage" value="on"/>
31-
3224
<addProcess type="TRestRawMultiCoBoAsAdToSignalProcess" name="virtualDAQ" value="ON"/>
33-
<addProcess type="TRestRawSignalAnalysisProcess" name="sAna" value="ON">
34-
<parameter name="pointsOverThreshold" value="3"/>
25+
<addProcess type="TRestRawSignalAnalysisProcess" name="sAna" value="ON"><parameter name="pointsOverThreshold" value="3"/>
3526
/// We define all observables except MinValue because it is not yet in validation chain
3627
<observable name="BaseLineMean" value="ON"/>
3728
<observable name="BaseLineSigmaMean" value="ON"/>
@@ -61,31 +52,20 @@
6152
<parameter name="zeroSuppression" value="true"/>
6253
<parameter name="nPointsOverThreshold" value="3"/>
6354
</addProcess>
64-
6555
<addProcess type="TRestRealTimeDrawingProcess" name="rD" value="ON" drawInterval="1000">
6656
<TRestAnalysisPlot name="TriggerRatePlot" previewPlot="false">
6757
<canvas size="(1000,800)" save="TriggerRate.png"/>
68-
<plot name="TriggerRate" title="Trigger Rate" xlabel="Seconds From Start" ylabel="Counts" value="ON"
69-
stats="ON">
58+
<plot name="TriggerRate" title="Trigger Rate" xlabel="Seconds From Start" ylabel="Counts" value="ON" stats="ON">
7059
<variable name="rateAna_SecondsFromStart" range="auto" nbins="100"/>
7160
</plot>
7261
</TRestAnalysisPlot>
7362
</addProcess>
74-
75-
7663
</TRestProcessRunner>
77-
7864
<addTask type="processEvents" value="ON"/>
79-
80-
8165
<globals>
8266
<searchPath value="$ENV{REST_INPUTDATA}/definitions/"/>
8367
<parameter name="mainDataPath" value=""/>
84-
8568
<parameter name="pointThreshold" value="3"/>
8669
</globals>
87-
8870
</TRestManager>
89-
90-
91-
<!--parameter here is accessible to all the classes-->
71+
<!--parameter here is accessible to all the classes-->

source/bin/restRoot.cxx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ int main(int argc, char* argv[]) {
6161
printf("\n");
6262
printf(" restRoot --m [0,1]\n");
6363
printf("\n");
64-
printf(" Option 0 will disable macro loading. Option 1 is the default.\n");
64+
printf(" Option 0 will disable macro loading. Option 0 is the default.\n");
6565
printf("\n");
6666
exit(0);
6767
}
@@ -81,7 +81,18 @@ int main(int argc, char* argv[]) {
8181
gROOT->ProcessLine("#include <TRestPhysics.h>");
8282
gROOT->ProcessLine("#include <TRestSystemOfUnits.h>");
8383
if (loadMacros) {
84-
if (!silent) printf("= Loading macros ...\n");
84+
if (!silent) {
85+
printf("= Loading macros ...\n");
86+
printf(
87+
"= HINT. Loading all macros may require a long time till you get access to the interactive "
88+
"shell\n");
89+
printf("= HINT. You may use `restListMacros` outside `restRoot` to check the available macros\n");
90+
printf(
91+
"= HINT. Then, you may execute the macro externally by using: `restManager MacroName "
92+
"[ARGUMENTS]\n");
93+
printf("= HINT. `MacroName` is the name of the macro after removing the macro name header\n");
94+
printf("= HINT. E.g. REST_Detector_XYZ(arg1,arg2) may be called as: restManager XYZ arg1 arg2\n");
95+
}
8596
vector<string> macroFiles;
8697
const vector<string> patterns = {
8798
REST_PATH + "/macros/REST_*.C", // framework

source/framework/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ link_libraries("-fPIC")
44

55
add_subdirectory(external)
66

7-
set(contents external/tinyxml tools core analysis masks)
7+
set(contents external/tinyxml tools core analysis masks sensitivity)
88

99
file(GLOB_RECURSE addon_src "tiny*cpp" "startup.cpp")
1010

0 commit comments

Comments
 (0)