Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event Process Update #189

Merged
merged 43 commits into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
0b1225a
global refactoring with non-functional changes only
lobis Apr 26, 2022
36c6fe2
Made many methods const, fix typos, minor changes
lobis Apr 26, 2022
40d6bad
global formatting (clang-format)
lobis Apr 26, 2022
7c62362
TRestEventProcess - Unified `GetProcessName`, made it pure virtual
lobis Apr 27, 2022
2c2e66c
Addressing https://github.com/rest-for-physics/framework/pull/189#dis…
lobis Apr 27, 2022
d0a4d31
Revert "Addressing https://github.com/rest-for-physics/framework/pull…
lobis Apr 27, 2022
fdb2f29
Replaced `char*` by `const char*` in many function arguments
lobis Apr 27, 2022
8ce217a
fix typo in `Constructor`
lobis Apr 27, 2022
d84b079
Addressing https://github.com/rest-for-physics/framework/pull/189#dis…
lobis Apr 27, 2022
f2ac73e
TRestEventProcess - `GetProcessName` marked override in implementations
lobis Apr 27, 2022
a00b197
Addressing override warnings while adding ClassDefOverride and using …
juanangp Apr 27, 2022
310b6c7
minor style updates
lobis Apr 27, 2022
e3b18a7
made `loadConfig` from many process arguments use const reference
lobis Apr 27, 2022
a8f10dd
TRestMetadata.cxx - simplified destructor
lobis Apr 27, 2022
c9d0477
renamed `ProcessEvent` argument as `inputEvent` in all processes
lobis Apr 27, 2022
39eaa9c
marked many methods override whenever applicable
lobis Apr 27, 2022
f95e67b
Adressing override warnings
juanangp Apr 28, 2022
b83bb4e
Added new validation python script to pipeline
lobis Apr 28, 2022
673255b
fix typo in comment
lobis Apr 28, 2022
94ce4b2
pipeline/analysisProcesses - added noise, modified process to add set…
lobis Apr 28, 2022
9628d0e
Merge remote-tracking branch 'origin/lobis-process-update' into lobis…
lobis Apr 28, 2022
240ab81
clang-format
lobis Apr 28, 2022
3ceb269
temporary remove Garfield from testing to check pipeline
lobis Apr 28, 2022
a6ab921
fixed deprecation warning in pipeline
lobis Apr 28, 2022
d84cc26
testing changes in pipeline
lobis Apr 28, 2022
cc32b67
disabled Garfield in testing
lobis Apr 28, 2022
9844a64
updated test container
lobis Apr 28, 2022
cd10a41
Merge remote-tracking branch 'origin/master' into lobis-process-update
lobis May 5, 2022
7d2a695
normalized configuration file parameter name to `configFilename`
lobis May 5, 2022
296b49c
TRestTools.cxx - added header conditionaly for curl
lobis May 5, 2022
1dec73f
fixed some english typos
lobis May 5, 2022
10508c5
TRestMetadata.h - made deleted methods public
lobis May 5, 2022
003b89a
TRestMetadata - using `TFormula.h` instead of `v5/TFormula.h`
lobis May 5, 2022
7a3efe4
TRestMetadata::LoadConfigFromFile now takes const ref parameters, sim…
lobis May 5, 2022
d8de235
english typos
lobis May 5, 2022
b430e58
Removing unnecesary stuff in Testing.cmake
juanangp May 6, 2022
958e13a
Replacing gtest_discover_tests by gtest_add_tests to avoid errors dur…
juanangp May 6, 2022
b1beeb1
Bug fix loadG4 macro while generating thisREST.sh
juanangp May 6, 2022
de79e9c
.gitlab-ci.yml - attempt to remove PCM errors
lobis May 6, 2022
3720447
Merge remote-tracking branch 'origin/lobis-process-update' into lobis…
lobis May 6, 2022
a6be9eb
.gitlab-ci.yml - ctest using `--output-on-failure` instead of `--verb…
lobis May 6, 2022
ed5755f
merge with master and fix conflicts
lobis May 12, 2022
05dfcae
fix conflicts and merge with master
lobis May 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ else ()
message(FATAL_ERROR "Minimum C++ standard version is 17,
while the root version is compiled with an older
C++ standard, check root-config --cflags ${ROOT_CFLAGS}"
)
)
endif ()

set(external_include_dirs ${external_include_dirs} ${ROOT_INCLUDE_DIRS})
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ The framework exploits the Git tagging system to produce its own versioning syst
## Versioning

Any **metadata** object written with REST **will be stamped** with few metadata members that will allow to identify the state of the code when the object was produced. Those data members are:
- *fVersion*: A string containning the human version number.
- *fVersion*: A string containing the human version number.
- *fCommit*: The latest commit hash value when the compilation took place.
- *fLibraryVersion*: The human version library. It is fixed by CMakeLists at the library submodules.
- *fOfficialRelease*: It will be true if the commit was tagged at the repository.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ These working examples can be launched with *restG4* command. In these examples,

The restG4 command receives up to two arguments,

1. the RML file containning the TRestGeant4Metadata, TRestRun and TRestPhysicsLists sections,
1. the RML file containing the TRestGeant4Metadata, TRestRun and TRestPhysicsLists sections,
2. and the name of the TRestGeant4Metadata section to be used.

The execution of *restG4* follows this scheme,
Expand Down Expand Up @@ -120,7 +120,7 @@ restG4 restG4.rml MuonShower
restG4 restG4.rml Cd109
~~~

After, the proper execution of the *restG4* command we will find our results file, containning TRestGeant4Event data, inside the directory *REST_DATAPATH* we have defined in our system.
After, the proper execution of the *restG4* command we will find our results file, containing TRestGeant4Event data, inside the directory *REST_DATAPATH* we have defined in our system.

You can visualize the generated Geant4 events, that produced an energy deposit in the sensitive volume of the detector using the `REST_VIEWER_G4Event` script available when launching *restG4*, or print detailed event information using `REST_UTILS_PrintG4Event`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This document will show you step by step to write new processes/metadata classes

## Compiling and installing the example included in REST

Inside the REST repository you will find a directory named *example*. This directory is a *dummy* library containning a *dummy* TRestSignalEvent process (mySignalProcess) and a *dummy* TRestMetadata structure (myMetadata). This is a fully working example, therefore you can just compile it, and install to verify how the integration with REST is done.
Inside the REST repository you will find a directory named *example*. This directory is a *dummy* library containing a *dummy* TRestSignalEvent process (mySignalProcess) and a *dummy* TRestMetadata structure (myMetadata). This is a fully working example, therefore you can just compile it, and install to verify how the integration with REST is done.

The following code shows how to compile and install the library, we assume the working directory is now *REST_v2*.

Expand Down Expand Up @@ -168,7 +168,7 @@ One last step is required to define the name of the new library. Just open the *
set( MY_LIBRARY "MyRESTLibrary" )
\endcode

by the name of your library containning REST, or Rest, inside its name. For example,
by the name of your library containing REST, or Rest, inside its name. For example,

\code
set( MY_LIBRARY "MyProjectRESTLibrary" )
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorials/List of REST Processes.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ TRestRawAFTERToSignalProcess | rawdata | TRestRa
TRestCoBoAsAdToSignalProcess | rawdata | TRestRawSignalEvent | Transforms CoBoAsAd data into raw signal event.
TRestRawMultiCoBoAsAdToSignalProcess | rawdata | TRestRawSignalEvent | Transforms CoBoAsAd data into raw signal event. General version using several CoBoAsAd cards. Event data might be splitted between different data files. The process receives a list of all the files in a given run.
TRestFEMINOSToSignalProcess | rawdata | TRestRawSignalEvent | Transforms FEMINOS data into SignalEvent.
TRestRawMultiFEMINOSToSignalProcess | rawdata | TRestRawSignalEvent | Transforms FEMINOS data into SignalEvent. General version using several Feminos cards. Full event data is containned in one single file.
TRestRawMultiFEMINOSToSignalProcess | rawdata | TRestRawSignalEvent | Transforms FEMINOS data into SignalEvent. General version using several Feminos cards. Full event data is contained in one single file.

## Viewer processes

Expand Down
4 changes: 2 additions & 2 deletions doc/tutorials/List of REST Programs.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This is just an indexing list of existing programs included with REST compilatio

**restPrintRunInfo** : It prints the metadata information inside a REST file.

**restPrintAllMetadata** : It prints on screen all the metadata information containned in a REST file. TRestRun metadata, readout, gas, processes metadata, etc.
**restPrintAllMetadata** : It prints on screen all the metadata information contained in a REST file. TRestRun metadata, readout, gas, processes metadata, etc.

**restPrintFileContents** : It prints on screen the ROOT objects stored in a REST file.

Expand All @@ -34,4 +34,4 @@ This is just an indexing list of existing programs included with REST compilatio

**restDrawEvents** : It draws the events one by one, using the specific TRestEvent::Draw method implemented in the specific event data type found inside the REST file.

**restG4PrintParticles** : It prints the name of all the different particles registered inside a REST file containning a TRestGeant4Event data type.
**restG4PrintParticles** : It prints the name of all the different particles registered inside a REST file containing a TRestGeant4Event data type.
6 changes: 3 additions & 3 deletions macros/REST_MakeMetadata.C
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Int_t REST_MakeMetadata(TString name) {
headerFile << " void PrintMetadata();" << endl;
headerFile << endl;
headerFile << " " << name << "();" << endl;
headerFile << " " << name << "(const char* cfgFileName, std::string name = \"\");" << endl;
headerFile << " " << name << "(const char* configFilename, std::string name = \"\")" << endl;
headerFile << " ~" << name << "();" << endl;
headerFile << endl;
headerFile << " // REMOVE COMMENT. ROOT class definition helper. Increase the number in it every time"
Expand Down Expand Up @@ -196,12 +196,12 @@ Int_t REST_MakeMetadata(TString name) {
sourceFile << "/// The default behaviour is that the config file must be specified with" << endl;
sourceFile << "/// full path, absolute or relative." << endl;
sourceFile << "///" << endl;
sourceFile << "/// \\param cfgFileName A const char* giving the path to an RML file." << endl;
sourceFile << "/// \\param configFilename A const char* giving the path to an RML file." << endl;
sourceFile << "/// \\param name The name of the specific metadata. It will be used to find the" << endl;
sourceFile << "/// corresponding TRestAxionMagneticField section inside the RML." << endl;
sourceFile << "///" << endl;
sourceFile << name << "::" << name
<< "(const char* cfgFileName, std::string name) : TRestMetadata(cfgFileName) {" << endl;
<< "(const char* configFilename, std::string name) : TRestMetadata(configFilename) {" << endl;
sourceFile << " LoadConfigFromFile(fConfigFileName, name);" << endl;
sourceFile << "" << endl;
sourceFile << " if (GetVerboseLevel() >= REST_Info) PrintMetadata();" << endl;
Expand Down
14 changes: 7 additions & 7 deletions miscellaneous/CHANGELOG_OLD
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ TRestEvent changes :
TRestRun changes :
------------------

* New members have been added containning a vector of event ids `fEventIDs` and a vector of sub-event ids `fSubEventIDs`.
* New members have been added containing a vector of event ids `fEventIDs` and a vector of sub-event ids `fSubEventIDs`.
- These vectors contain the same entries as the analysis and event tree.
- They are used for quick search of events with an specific event and subevent id.

Expand Down Expand Up @@ -199,7 +199,7 @@ Added TRestReadoutPlane:
TRestG4Event changes:
---------------------

* Added member `fTotalDepositedEnergy` containning the total energy deposited in the event.
* Added member `fTotalDepositedEnergy` containing the total energy deposited in the event.

* Added a new vector member `fVolumeDepositedEnergy` to store the energy deposited in each of the active volumes.
- We can access it through the method `GetEnergyDepositedInVolume( Int_t id )`. The id is related to the volume list stored in `TRestG4Metadata`.
Expand Down Expand Up @@ -297,11 +297,11 @@ Example :

* Now `restG4` main will import the GDML geometry `TGeoManager::Import(GDMLfile)` and append it to the ROOT file generated.

* The `subEventID` definition has changed. Now a new parameter `subEventTimeDelay` has been added to `TRestG4Metadata`. If this parameter is not defined it will take by default 1 second. Events with timeStamp containned inside the `subEventTimeDelay` will be considered as a single `subEventID`.
* The `subEventID` definition has changed. Now a new parameter `subEventTimeDelay` has been added to `TRestG4Metadata`. If this parameter is not defined it will take by default 1 second. Events with timeStamp contained inside the `subEventTimeDelay` will be considered as a single `subEventID`.

# Changes on data

* data/definitions : New directory containning common definitions : `readouts.rml`, `materials.xml`, `gases.rml`
* data/definitions : New directory containing common definitions : `readouts.rml`, `materials.xml`, `gases.rml`
In order to implement materials.xml in specific configurations we just use a symbolic link.
materials.xml symlink has been added to the different geometries in the configuration directories.

Expand All @@ -312,7 +312,7 @@ Example:
<section gas nameref="Gas name" file="{REST_PATH}/data/definitions/gases.rml" >
---

* data/distributions : Added `HighEnergyGammaBiasing.root` distribution containning the resulting gamma after biasing in a water tank (see README).
* data/distributions : Added `HighEnergyGammaBiasing.root` distribution containing the resulting gamma after biasing in a water tank (see README).


# Changes in restcore
Expand Down Expand Up @@ -520,7 +520,7 @@ Merge : #36
== RESTPROCESSES ==

- TRestElectronDiffusionProcess.
+ fGas is properly initialized to NULL solving problem of segmentation fault when we use a TBrowser to open a file containning this process.
+ fGas is properly initialized to NULL solving problem of segmentation fault when we use a TBrowser to open a file containing this process.

- TRestPathMinimizationProcess.
+ Added error handling in case Heldkarp minimization method fails.
Expand Down Expand Up @@ -595,7 +595,7 @@ Author : Javier Galan
Merge : #30
==========================================================

- TRestRun. Added time measurement for event processing, writting and reading. The time measurement will print out on screen after it has finished processing all the events. It can be deactivated by commenting out the line #define TIME_MEASUREMENT. In future this might be given as an option for the compiler.
- TRestRun. Added time measurement for event processing, writing and reading. The time measurement will print out on screen after it has finished processing all the events. It can be deactivated by commenting out the line #define TIME_MEASUREMENT. In future this might be given as an option for the compiler.

- TRestEvent. Added a new member, fOK. This member is initialized to true by the original input process (restG4 or restAGET, ...). The processes may set the status of the event to a BAD state using this member in case something went wrong processing that event.

Expand Down
6 changes: 3 additions & 3 deletions miscellaneous/rest.log
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Major upgrade of restcore libraries. Classes added or implemented.
- TRestG4Track : It is used to store the information of a Geant4 track. It contains at TRestHits.
- TRestParticleSource : A helper class to define a Geant4 particle source. Implemented inside TRestG4Metadata.
- TRestTemplate : A class for copy/paste and produce a new empty class.
- TRestRun : TRestRun has been implemented. It contains a generic TRestEvent and a TRestMetadata. Those must be specified during program execution. We need to include yet file management for openning, closing, writting and reading files.
- TRestRun : TRestRun has been implemented. It contains a generic TRestEvent and a TRestMetadata. Those must be specified during program execution. We need to include yet file management for openning, closing, writing and reading files.

A restG4 REST Geant4 package has been implemented from scratch. There was some issues/problems on the radiactive decay generation that I could only solve starting from scratch. Some funcionalities from the original restG4 (that has been moved to restG4_old) are still missing in the new version. Specially the generation of primary events using an input file (TODO).

Expand All @@ -77,7 +77,7 @@ Author : J. Galan
=================
Revision 78
-----------------
-> Implemented in restG4 the writting of output files.
-> Implemented in restG4 the writing of output files.
-> Implemented in TRestRun the formatting of output files.
-> Added to TRestG4Track the origin of the track using a TVector3
-> Added several scripts to help reading ROOT files generated by restG4
Expand Down Expand Up @@ -231,7 +231,7 @@ Revision 110 - librestcore.so.2.1.0
+ Added TRestG4PrimaryGenerator class. Now TRestG4Metadata stores a TRestG4EventGenerator that includes TRestParticleSource and a TRestParticle storage.
+ Added TRestParticleCollection class. It stores a vector of TRestParticles.

+ Added data folder containning generators, distributions and gas files
+ Added data folder containing generators, distributions and gas files

=================
10-Aug-2015
Expand Down
79 changes: 79 additions & 0 deletions pipeline/analysisProcesses/toRawSignal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import numpy as np
import ROOT


def load_REST():
import ROOT
ROOT.gSystem.Load("libRestFramework.so")
ROOT.gSystem.Load("libRestConnectors.so")
ROOT.gSystem.Load("libRestDetector.so")
ROOT.gSystem.Load("libRestRaw.so")
ROOT.gSystem.Load("libRestTrack.so")
ROOT.gSystem.Load("libRestGeant4.so")


load_REST()


# Create a fake detector event

def generate_random_detector_event() -> ROOT.TRestDetectorSignalEvent:
event = ROOT.TRestDetectorSignalEvent()
time_range = (0.0, 100.0 * 1000) # ns
energy_range = (1.0, 500.0) # keV
for signal_id in range(4):
n_hits = np.random.randint(20, 50)
time = np.random.rand(n_hits) * (time_range[1] - time_range[0]) + time_range[0]
energy = np.random.rand(n_hits) * (energy_range[1] - energy_range[0]) + energy_range[0]

for i in range(n_hits):
event.AddChargeToSignal(signal_id, time[i], energy[i])

event.SortSignals()
return event


if __name__ == "__main__":
np.random.seed(1)

event = generate_random_detector_event()
# event.PrintEvent()

sampling_time = 100.0 # ns
shaping_time = 1500.0 # ns

detectorSignalToRawSignalProcess = ROOT.TRestDetectorSignalToRawSignalProcess()

detectorSignalToRawSignalProcess.SetSampling(sampling_time)
detectorSignalToRawSignalProcess.SetGain(5.0)

detectorSignalToRawSignalProcess.PrintMetadata()

event = detectorSignalToRawSignalProcess.ProcessEvent(event)

# event.PrintEvent()
# event.DrawEvent()

rawSignalShapingProcess = ROOT.TRestRawSignalShapingProcess()

rawSignalShapingProcess.SetShapingTime(shaping_time / sampling_time)

rawSignalShapingProcess.PrintMetadata()

event = rawSignalShapingProcess.ProcessEvent(event)

# event.PrintEvent()
# event.DrawEvent()

rawSignalAddNoiseProcess = ROOT.TRestRawSignalAddNoiseProcess()

rawSignalAddNoiseProcess.SetNoiseLevel(5.0)

rawSignalAddNoiseProcess.PrintMetadata()

event = rawSignalAddNoiseProcess.ProcessEvent(event)

# event.PrintEvent()
# event.DrawEvent()

input()
22 changes: 11 additions & 11 deletions pipeline/pandaxiii_MC/Xe136bb0n.rml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@
</TRestRun>

<TRestGeant4Metadata name="restG4 Simulation run" title="Simulation of Xe136bb0n decay from gas.">
<!-- <parameter name="nEvents" value="1000000"/>-->
<parameter name="nEvents" value="500"/>
<parameter name="gdmlFile" value="geometry/main.gdml"/>
<parameter name="subEventTimeDelay" value="100us" />
<parameter name="seed" value="1" />
<!-- <parameter name="nEvents" value="1000000"/>-->
<parameter name="nEvents" value="500"/>
<parameter name="gdmlFile" value="geometry/main.gdml"/>
<parameter name="subEventTimeDelay" value="100us"/>
<parameter name="seed" value="1"/>

<generator type="volume" from="Gas" >
<source use="Xe136bb0n.dat">
</source>
</generator>
<generator type="volume" from="Gas">
<source use="Xe136bb0n.dat">
</source>
</generator>

<storage sensitiveVolume="Gas">
<parameter name="energyRange" value="(0,10)MeV" />
<storage sensitiveVolume="Gas">
<parameter name="energyRange" value="(0,10)MeV"/>
<activeVolume name="Gas" chance="1" maxStepSize="200um" />
</storage>

Expand Down
10 changes: 5 additions & 5 deletions pipeline/pandaxiii_MC/geometry/Th232_SS_01.rml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@

<parameter name="nEvents" value="4000000"/>
<parameter name="gdmlFile" value="/home/zhoubugao/REST/geometry_bgzou/main.gdml"/>
<parameter name="maxTargetStepSize" value="500" units="um" />
<parameter name="subEventTimeDelay" value="100" units="us" />
<parameter name="maxTargetStepSize" value="500" units="um"/>
<parameter name="subEventTimeDelay" value="100" units="us"/>

<generator type="volume" from="VesselWall" >
<generator type="volume" from="VesselWall">
<source particle="Th232" fullChain="on">
<angularDist type="isotropic" />
<energyDist type="mono" energy="0" units="keV" />
<angularDist type="isotropic"/>
<energyDist type="mono" energy="0" units="keV"/>
</source>
</generator>

Expand Down
2 changes: 1 addition & 1 deletion pipeline/trex/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The following scripts are used to validate the TREX-DM processing chain being read with Feminos cards in TCM mode.

The following RML config files, aqs and readout.root are used to generate a result.root file containning a basic TTree.
The following RML config files, aqs and readout.root are used to generate a result.root file containing a basic TTree.

The generated TTree inside results.root contains the double observables extracted from the analysisTree from the last ROOT file generated in the RML processing chain.

Expand Down
8 changes: 4 additions & 4 deletions quarantine/TRestAnalysisHistogramViewerProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ ClassImp(TRestAnalysisHistogramViewerProcess)
}

//______________________________________________________________________________
TRestAnalysisHistogramViewerProcess::TRestAnalysisHistogramViewerProcess(char* cfgFileName) {
TRestAnalysisHistogramViewerProcess::TRestAnalysisHistogramViewerProcess(const char* configFilename) {
Initialize();

if (LoadConfigFromFile(cfgFileName)) LoadDefaultConfig();
if (LoadConfigFromFile(configFilename)) LoadDefaultConfig();
}

//______________________________________________________________________________
Expand All @@ -45,8 +45,8 @@ void TRestAnalysisHistogramViewerProcess::Initialize() {
fOutputTrackEvent = new TRestTrackEvent();
}

void TRestAnalysisHistogramViewerProcess::LoadConfig(std::string cfgFilename, std::string name) {
if (LoadConfigFromFile(cfgFilename, name)) LoadDefaultConfig();
void TRestAnalysisHistogramViewerProcess::LoadConfig(std::string configFilename, std::string name) {
if (LoadConfigFromFile(configFilename, name)) LoadDefaultConfig();
}

//______________________________________________________________________________
Expand Down
Loading