-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
transition Trigger from submodule to subdirectory
- Loading branch information
Showing
84 changed files
with
14,065 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
[submodule "docs/doxygen.conf/doxygen-awesome-css"] | ||
path = docs/doxygen.conf/doxygen-awesome-css | ||
url = https://github.com/jothepro/doxygen-awesome-css | ||
[submodule "Trigger"] | ||
path = Trigger | ||
url = https://github.com/LDMX-Software/Trigger.git | ||
[submodule "SimCore/G4DarkBreM"] | ||
path = SimCore/G4DarkBreM | ||
url = https://github.com/LDMX-Software/G4DarkBreM.git | ||
[submodule "Tracking/acts"] | ||
path = Tracking/acts | ||
url = https://github.com/acts-project/acts | ||
[submodule "Trigger/HLS_arbitrary_Precision_Types"] | ||
path = Trigger/HLS_arbitrary_Precision_Types | ||
url = https://github.com/Xilinx/HLS_arbitrary_Precision_Types.git | ||
[submodule "Trigger/ruckus"] | ||
path = Trigger/ruckus | ||
url = https://github.com/slaclab/ruckus |
Submodule Trigger
deleted from
c5731f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.cproject | ||
.project | ||
.settings | ||
.pydevproject | ||
/docs/doxygen.conf | ||
*~ | ||
*# | ||
*.pyc | ||
/bin | ||
/lib | ||
/data | ||
/build* | ||
/install* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[submodule "submodules/HLS_arbitrary_Precision_Types"] | ||
path = HLS_arbitrary_Precision_Types | ||
url = https://github.com/Xilinx/HLS_arbitrary_Precision_Types.git | ||
[submodule "submodules/ruckus"] | ||
path = ruckus | ||
url = https://github.com/slaclab/ruckus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Set the minimum version of CMake that's required | ||
cmake_minimum_required(VERSION 3.12) | ||
|
||
# Set the project name | ||
project(Trigger VERSION 0.1.0 | ||
DESCRIPTION "Module for trigger algorithms." | ||
LANGUAGES CXX | ||
) | ||
|
||
# Search and configure ROOT | ||
find_package(ROOT CONFIG REQUIRED) | ||
|
||
option(BUILD_EVENT_ONLY "Build the event library." ON) | ||
if(BUILD_EVENT_ONLY) | ||
|
||
register_event_object( module_path "Trigger/Event" namespace "trigger" | ||
class "TrigEnergySum" type "collection" ) | ||
register_event_object( module_path "Trigger/Event" namespace "trigger" | ||
class "TrigCaloHit" type "collection" ) | ||
register_event_object( module_path "Trigger/Event" namespace "trigger" | ||
class "TrigCaloCluster" type "collection" ) | ||
register_event_object( module_path "Trigger/Event" namespace "trigger" | ||
class "TrigParticle" type "collection" ) | ||
|
||
# Generate the files needed to build the event classes. | ||
setup_library(module Trigger name Event | ||
dependencies ROOT::Core | ||
Recon::Event | ||
register_target) | ||
|
||
return() | ||
|
||
endif() | ||
|
||
setup_library(module Trigger | ||
dependencies Framework::Framework Recon::Event DetDescr::DetDescr | ||
Tools::Tools SimCore::Event Ecal::Ecal Hcal::Hcal | ||
) | ||
target_include_directories(Trigger PUBLIC ../HLS_arbitrary_Precision_Types/include) | ||
|
||
setup_python(package_name ${PYTHON_PACKAGE_NAME}/Trigger) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Software Emulation of Trigger Algorithms | ||
|
||
This directory is the ldmx-sw module and should be included | ||
by the central ldmx-sw `CMakeLists.txt`. The HLS implementations | ||
alongside this directory should also be compiled so that we can | ||
emulate the algorithms that would be compiled into the firmware. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#ifndef DISCRETEINPUTS_H | ||
#define DISCRETEINPUTS_H | ||
|
||
#include <stdint.h> | ||
#include <stdio.h> | ||
#include <vector> | ||
|
||
namespace trigger { | ||
|
||
namespace ldmx_int { | ||
|
||
struct EcalTP { | ||
uint32_t tid; | ||
uint32_t tp; // store linear version | ||
// uint8_t tp; | ||
|
||
bool operator<(const EcalTP &other) const { return tp > other.tp; } | ||
void fill(int _tid, float _tp) { | ||
tid = _tid; | ||
tp = _tp; | ||
} | ||
void writeToFile(FILE *file) const { | ||
fwrite(&tid, sizeof(uint32_t), 1, file); | ||
fwrite(&tp, sizeof(uint32_t), 1, file); | ||
} | ||
void readFromFile(FILE *file) { | ||
fread(&tid, sizeof(uint32_t), 1, file); | ||
fread(&tp, sizeof(uint32_t), 1, file); | ||
} | ||
}; | ||
|
||
template <typename T> | ||
void writeManyToFile(const std::vector<T> &objs, FILE *file) { | ||
uint32_t number = objs.size(); | ||
fwrite(&number, 4, 1, file); | ||
for (uint32_t i = 0; i < number; ++i) objs[i].writeToFile(file); | ||
} | ||
|
||
template <typename T> | ||
void readManyFromFile(std::vector<T> &objs, FILE *file) { | ||
uint32_t number; | ||
fread(&number, 4, 1, file); | ||
objs.resize(number); | ||
for (uint32_t i = 0; i < number; ++i) objs[i].readFromFile(file); | ||
} | ||
|
||
} // namespace ldmx_int | ||
|
||
} // namespace trigger | ||
|
||
#endif /* DISCRETEINPUTS_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#ifndef DISCRETEINPUTS_IO | ||
#define DISCRETEINPUTS_IO | ||
|
||
#include <vector> | ||
|
||
#include "../../../Algo_HLS/Ecal/src/data.h" | ||
#include "DiscreteInputs.h" | ||
|
||
namespace trigger { | ||
|
||
struct EventDump { | ||
uint64_t event; | ||
std::vector<ldmx_int::EcalTP> EcalTPs; | ||
|
||
EventDump() : event(0), EcalTPs() {} | ||
bool readFromFile(FILE *file) { | ||
if (!fread(&event, sizeof(uint64_t), 1, file)) return false; | ||
ldmx_int::readManyFromFile(EcalTPs, file); | ||
return true; | ||
} | ||
bool writeToFile(FILE *file) { | ||
fwrite(&event, sizeof(uint64_t), 1, file); | ||
ldmx_int::writeManyToFile(EcalTPs, file); | ||
return true; | ||
} | ||
}; | ||
|
||
class DiscreteInputs { | ||
public: | ||
DiscreteInputs(const char *fileName) : file_(fopen(fileName, "rb")) { | ||
if (!file_) { | ||
std::cout << "ERROR: cannot read '" << fileName << "'" << std::endl; | ||
} | ||
assert(file_); | ||
} | ||
~DiscreteInputs() { fclose(file_); } | ||
|
||
bool nextEvent() { | ||
if (feof(file_)) return false; | ||
if (!event_.readFromFile(file_)) return false; | ||
printf("Beginning of event %lu (%lu TPs) \n", event_.event, | ||
event_.EcalTPs.size()); | ||
return true; | ||
} | ||
const EventDump &event() { return event_; } | ||
|
||
private: | ||
FILE *file_; | ||
EventDump event_; | ||
}; | ||
|
||
} // namespace trigger | ||
|
||
#endif /* DISCRETEINPUTS_IO */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/** | ||
* @file DumpFileWriter.h | ||
* @brief Write objects to a file for standalone | ||
* @author Christian Herwig, Fermilab | ||
*/ | ||
|
||
#ifndef DUMPFILEWRITER_H | ||
#define DUMPFILEWRITER_H | ||
|
||
// LDMX Framework | ||
#include "TrigUtilities.h" | ||
#include "DiscreteInputs.h" | ||
#include "DiscreteInputs_IO.h" | ||
#include "Ecal/EcalTriggerGeometry.h" | ||
#include "Framework/Configure/Parameters.h" // Needed to import parameters from configuration file | ||
#include "Framework/Event.h" | ||
#include "Framework/EventProcessor.h" //Needed to declare processor | ||
#include "ap_fixed.h" | ||
#include "ap_int.h" | ||
|
||
namespace trigger { | ||
|
||
/** | ||
* @class DumpFileWriter | ||
* @brief | ||
*/ | ||
class DumpFileWriter : public framework::Analyzer { | ||
public: | ||
DumpFileWriter(const std::string& name, framework::Process& process) | ||
: framework::Analyzer(name, process) {} | ||
|
||
virtual void configure(framework::config::Parameters& ps); | ||
|
||
virtual void analyze(const framework::Event& event); | ||
|
||
virtual void onFileOpen(); | ||
|
||
virtual void onFileClose(); | ||
|
||
virtual void onProcessStart(); | ||
|
||
virtual void onProcessEnd(); | ||
|
||
typedef ap_ufixed<16, 14> e_t; // [MeV] (Up to at least 8 GeV) | ||
|
||
private: | ||
// specific verbosity | ||
int verbose_{0}; | ||
|
||
// From: | ||
// Tools/python/HgcrocEmulator.py | ||
// ECal/python/digi.py | ||
// ECal/src/EcalRecProducer.cxx | ||
/* float gain = 320. / 0.1 / 1024; // mV/ADC */ | ||
/* float mVtoMeV = 0.130 / (37000.0 * (0.162 / 1000.) * (1. / 0.1)); // MeV/mV */ | ||
/* std::vector<float> layerWeights = { */ | ||
/* 1.675, 2.724, 4.398, 6.039, 7.696, 9.077, 9.630, 9.630, 9.630, */ | ||
/* 9.630, 9.630, 9.630, 9.630, 9.630, 9.630, 9.630, 9.630, 9.630, */ | ||
/* 9.630, 9.630, 9.630, 9.630, 9.630, 13.497, 17.364, 17.364, 17.364, */ | ||
/* 17.364, 17.364, 17.364, 17.364, 17.364, 17.364, 8.990}; */ | ||
/* float secondOrderEnergyCorrection = 4000. / 4010.; */ | ||
/* float mipSiEnergy = 0.130; */ | ||
|
||
// ClusterGeometry myGeo; | ||
|
||
std::string dumpFileName = "dummy.dump"; | ||
EventDump myEvent; | ||
FILE* file = 0; | ||
unsigned long evtNo = 0; | ||
}; | ||
} // namespace trigger | ||
|
||
#endif /* DUMPFILEWRITER_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/** | ||
* @file EcalTPSelector.h | ||
* @brief ECal clustering algorithm | ||
* @author Christian Herwig, Fermilab | ||
*/ | ||
|
||
#ifndef ECALTPSELECTOR_H | ||
#define ECALTPSELECTOR_H | ||
|
||
// LDMX Framework | ||
#include "TrigUtilities.h" | ||
#include "Ecal/EcalTriggerGeometry.h" | ||
#include "Framework/Configure/Parameters.h" // Needed to import parameters from configuration file | ||
#include "Trigger/Event/TrigCaloHit.h" | ||
#include "Trigger/Event/TrigEnergySum.h" | ||
|
||
#include "DetDescr/EcalGeometry.h" | ||
#include "Recon/Event/HgcrocDigiCollection.h" | ||
#include "Recon/Event/HgcrocTrigDigi.h" | ||
|
||
#include "Framework/Event.h" | ||
#include "Framework/EventProcessor.h" //Needed to declare processor | ||
|
||
namespace trigger { | ||
|
||
/** | ||
* @class EcalTPSelector | ||
* @brief | ||
*/ | ||
class EcalTPSelector : public framework::Producer { | ||
public: | ||
EcalTPSelector(const std::string& name, framework::Process& process) | ||
: framework::Producer(name, process) {} | ||
|
||
virtual void configure(framework::config::Parameters& ps); | ||
|
||
virtual void produce(framework::Event& event); | ||
|
||
virtual void onFileOpen(); | ||
|
||
virtual void onFileClose(); | ||
|
||
virtual void onProcessStart(); | ||
|
||
virtual void onProcessEnd(); | ||
|
||
// helpers | ||
void decodeTP(ldmx::HgcrocTrigDigi tp, double &x, double &y, double &z, double &e); | ||
/* double primitiveToEnergy(int tp, int layer); */ | ||
|
||
private: | ||
// specific verbosity of this producer | ||
int verbose_{0}; | ||
|
||
// name of collection for EcalTPs to be passed as input | ||
std::string tpCollName_; | ||
// name of output collection | ||
std::string passCollName_; | ||
|
||
unsigned int maxCentralTPs_{12}; | ||
unsigned int maxOuterTPs_{8}; | ||
|
||
// From: | ||
// Tools/python/HgcrocEmulator.py | ||
// ECal/python/digi.py | ||
// ECal/src/EcalRecProducer.cxx | ||
/* float gain_ = 320. / 0.1 / 1024; // mV/ADC */ | ||
/* float mVtoMeV_ = 0.130 / (37000.0 * (0.1602 / 1000.) * (1. / 0.1)); // MeV/mV */ | ||
/* std::vector<float> layerWeights = { */ | ||
/* 2.312, 4.312, 6.522, 7.490, 8.595, 10.253, 10.915, 10.915, 10.915, 10.915, 10.915, */ | ||
/* 10.915, 10.915, 10.915, 10.915, 10.915, 10.915, 10.915, 10.915, 10.915, 10.915, */ | ||
/* 10.915, 10.915, 14.783, 18.539, 18.539, 18.539, 18.539, 18.539, 18.539, 18.539, */ | ||
/* 18.539, 18.539, 9.938}; */ | ||
/* float secondOrderEnergyCorrection_ = 4000. / 3940.5; */ | ||
/* float mipSiEnergy_ = 0.130; */ | ||
/* float adHoc_ = 1.0; // my adhoc correction factor, to match v14 :( */ | ||
/* int hgc_compression_factor_ = 8; */ | ||
|
||
}; | ||
} // namespace trigger | ||
|
||
#endif /* ECALTPSELECTOR_H */ |
Oops, something went wrong.