Commit f450527d authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Rename TestBeamObject -> Object, remove accidentially committed modules

parent 1312051a
#include "Clipboard.hpp"
#include "objects/TestBeamObject.h"
#include "objects/Object.hpp"
using namespace corryvreckan;
void Clipboard::put(std::string name, TestBeamObjects* objects) {
void Clipboard::put(std::string name, Objects* objects) {
m_dataID.push_back(name);
m_data[name] = objects;
}
void Clipboard::put(std::string name, std::string type, TestBeamObjects* objects) {
void Clipboard::put(std::string name, std::string type, Objects* objects) {
m_dataID.push_back(name + type);
m_data[name + type] = objects;
}
......@@ -17,13 +17,13 @@ void Clipboard::put_persistent(std::string name, double value) {
m_persistent_data[name] = value;
}
TestBeamObjects* Clipboard::get(std::string name) {
Objects* Clipboard::get(std::string name) {
if(m_data.count(name) == 0)
return NULL;
return m_data[name];
}
TestBeamObjects* Clipboard::get(std::string name, std::string type) {
Objects* Clipboard::get(std::string name, std::string type) {
if(m_data.count(name + type) == 0)
return NULL;
return m_data[name + type];
......@@ -35,8 +35,8 @@ double Clipboard::get_persistent(std::string name) {
void Clipboard::clear() {
for(auto& id : m_dataID) {
TestBeamObjects* collection = m_data[id];
for(TestBeamObjects::iterator it = collection->begin(); it != collection->end(); it++)
Objects* collection = m_data[id];
for(Objects::iterator it = collection->begin(); it != collection->end(); it++)
delete(*it);
delete m_data[id];
m_data.erase(id);
......
......@@ -7,11 +7,11 @@
#include <string>
#include "core/utils/log.h"
#include "objects/TestBeamObject.h"
#include "objects/Object.hpp"
//-------------------------------------------------------------------------------
// The Clipboard class is used to transfer information between modules during
// the event processing. Any object inheriting from TestBeamObject can be placed
// the event processing. Any object inheriting from Object can be placed
// on the clipboard, and retrieved by its name. At the end of each event, the
// clipboard is wiped clean.
//-------------------------------------------------------------------------------
......@@ -26,13 +26,13 @@ namespace corryvreckan {
virtual ~Clipboard() {}
// Add objects to clipboard - with name or name + type
void put(std::string name, TestBeamObjects* objects);
void put(std::string name, std::string type, TestBeamObjects* objects);
void put(std::string name, Objects* objects);
void put(std::string name, std::string type, Objects* objects);
void put_persistent(std::string name, double value);
// Get objects from clipboard - with name or name + type
TestBeamObjects* get(std::string name);
TestBeamObjects* get(std::string name, std::string type);
Objects* get(std::string name);
Objects* get(std::string name, std::string type);
double get_persistent(std::string name);
......@@ -44,7 +44,7 @@ namespace corryvreckan {
private:
// Container for data, list of all data held
std::map<std::string, TestBeamObjects*> m_data;
std::map<std::string, Objects*> m_data;
std::vector<std::string> m_dataID;
std::map<std::string, double> m_persistent_data;
};
......
......@@ -170,7 +170,7 @@ StatusCode ATLASpixEventLoader::run(Clipboard* clipboard) {
// Put the data on the clipboard
if(pixels->size() > 0)
clipboard->put(detectorID, "pixels", (TestBeamObjects*)pixels);
clipboard->put(detectorID, "pixels", (Objects*)pixels);
// Fill histograms
hPixelsPerFrame->Fill(pixels->size());
......
......@@ -239,7 +239,7 @@ StatusCode BasicTracking::run(Clipboard* clipboard) {
// Save the tracks on the clipboard
if(tracks->size() > 0) {
clipboard->put("tracks", (TestBeamObjects*)tracks);
clipboard->put("tracks", (Objects*)tracks);
tracksPerEvent->Fill(tracks->size());
}
......
......@@ -126,7 +126,7 @@ StatusCode CLICpixEventLoader::run(Clipboard* clipboard) {
LOG(TRACE) << "Loaded " << npixels << " pixels";
// Put the data on the clipboard
if(pixels->size() > 0)
clipboard->put(detectorID, "pixels", (TestBeamObjects*)pixels);
clipboard->put(detectorID, "pixels", (Objects*)pixels);
// Fill histograms
hPixelsPerFrame->Fill(npixels);
......
......@@ -250,7 +250,7 @@ StatusCode Clicpix2EventLoader::run(Clipboard* clipboard) {
// Put the data on the clipboard
if(!pixels->empty()) {
clipboard->put(detectorID, "pixels", (TestBeamObjects*)pixels);
clipboard->put(detectorID, "pixels", (Objects*)pixels);
}
// Fill histograms
......
......@@ -43,7 +43,7 @@ namespace corryvreckan {
std::vector<std::string> m_objectList;
std::vector<PositionVector3D<Cartesian3D<double>>> v_intercepts;
std::map<std::string, TestBeamObject*> m_objects;
std::map<std::string, Object*> m_objects;
TFile* m_outputFile;
TTree* m_outputTree{};
......
CORRYVRECKAN_ENABLE_DEFAULT(OFF)
# Define module and return the generated name as MODULE_NAME
CORRYVRECKAN_MODULE(MODULE_NAME)
FIND_PACKAGE(EUDAQ2 QUIET)
IF(NOT EUDAQ2_FOUND)
MESSAGE(FATAL_ERROR "Could not find EUDAQ 2, make sure to set the path to your installation using\n"
"$ export EUDAQPATH=/your/path/to/EUDAQ")
ENDIF()
INCLUDE_DIRECTORIES(SYSTEM ${EUDAQ_INCLUDE_DIR})
# Add source files to library
CORRYVRECKAN_MODULE_SOURCES(${MODULE_NAME}
EUDAQ2EventLoader.cpp
)
# Add EUDAQ libraries
TARGET_LINK_LIBRARIES(${MODULE_NAME} ${EUDAQ_LIBRARY})
# Provide standard install target
CORRYVRECKAN_MODULE_INSTALL(${MODULE_NAME})
#include "EUDAQ2EventLoader.h"
#include "eudaq/StandardEvent.hh"
#include "eudaq/StdEventConverter.hh"
using namespace corryvreckan;
using namespace std;
EUDAQ2EventLoader::EUDAQ2EventLoader(Configuration config, std::vector<Detector*> detectors)
: Module(std::move(config), std::move(detectors)) {
m_filename = m_config.get<std::string>("file_name");
}
void EUDAQ2EventLoader::initialise() {
// Initialise histograms per device
for(auto& detector : get_detectors()) {
}
// Create new file reader:
try {
reader = eudaq::Factory<eudaq::FileReader>::MakeUnique(eudaq::str2hash("native"), m_filename);
} catch(...) {
throw ModuleError("Unable to read input file \"" + m_filename + "\"");
}
// Initialise member variables
m_eventNumber = 0;
}
StatusCode EUDAQ2EventLoader::run(Clipboard* clipboard) {
// auto reader_ev =
// auto stdev = std::dynamic_pointer_cast<eudaq::StandardEvent>(reader_ev);
// if(!stdev) {
auto stdev = eudaq::StandardEvent::MakeShared();
eudaq::StdEventConverter::Convert(reader->GetNextEvent(), stdev, nullptr); // no conf
// }
auto& ev = *(stdev.get());
LOG(DEBUG) << "Called onEvent " << ev.GetEventNumber();
LOG(DEBUG) << "Number of Planes " << ev.NumPlanes();
// FIXME store all event tags on clipboard as EUDAQSignals?
// Loop over all contained planes
for(unsigned int p = 0; p < ev.NumPlanes(); p++) {
const eudaq::StandardPlane& plane = ev.GetPlane(p);
LOG(TRACE) << "Plane ID " << plane.ID();
LOG(TRACE) << "Plane Size " << sizeof(plane);
LOG(TRACE) << "Plane Frames " << plane.NumFrames();
for(unsigned int f = 0; f < plane.NumFrames(); f++) {
for(unsigned int index = 0; index < plane.HitPixels(f); index++) {
SimpleStandardHit hit((int)plane.GetX(index, f), (int)plane.GetY(index, f));
hit.setTOT((int)plane.GetPixel(index, f));
hit.setLVL1(f);
}
// Increment event counter
m_eventNumber++;
// Return value telling analysis to keep running
return Success;
}
void EUDAQ2EventLoader::finalise() { LOG(DEBUG) << "Analysed " << m_eventNumber << " events"; }
#ifndef EUDAQ2EventLoader_H
#define EUDAQ2EventLoader_H 1
#include <iostream>
#include "core/module/Module.hpp"
#include "eudaq/FileReader.hh"
#include "objects/Cluster.h"
#include "objects/Pixel.h"
#include "objects/Track.h"
namespace corryvreckan {
/** @ingroup Modules
*/
class EUDAQ2EventLoader : public Module {
public:
// Constructors and destructors
EUDAQ2EventLoader(Configuration config, std::vector<Detector*> detectors);
~EUDAQ2EventLoader() {}
// Functions
void initialise();
StatusCode run(Clipboard* clipboard);
void finalise();
// EUDAQ file reader instance, unique pointer:
eudaq::FileReaderUP reader;
// Member variables
int m_eventNumber;
std::string m_filename{};
};
} // namespace corryvreckan
#endif // EUDAQ2EventLoader_H
## NAME
**Maintainer**: NAME (<EMAIL>)
**Status**: Outdated, Functional, or Work in progress
#### Description
DESCRIPTION
#### Parameters
* `PARAMETERNAME`: EXPLANATION. Default value is `DEFAULT`.
Or No parameters are used from the configuration file.
#### Plots produced
* PLOT or No plots are produced.
For each detector the following plots are produced:
* PLOT
#### Usage
```toml
[NAME]
ALLPARAMETERS = VALUE
```
Parameters to be used in multiple modules can also be defined globally at the top of the configuration file. This is highly encouraged for parameters such as `DUT` and `reference`.
......@@ -82,7 +82,7 @@ StatusCode EUDAQEventLoader::run(Clipboard* clipboard) {
}
// Store on clipboard
clipboard->put(detectorID, "pixels", (TestBeamObjects*)deviceData);
clipboard->put(detectorID, "pixels", (Objects*)deviceData);
}
}
......
......@@ -22,10 +22,10 @@ FileReader::FileReader(Configuration config, std::vector<Detector*> detectors)
This algorithm reads an input file containing trees with data previously
written out by the FileWriter.
Any object which inherits from TestBeamObject can in principle be read
from file. In order to enable this for a new type, the TestBeamObject::Factory
Any object which inherits from Object can in principle be read
from file. In order to enable this for a new type, the Object::Factory
function must know how to return an instantiation of that type (see
TestBeamObject.C file to see how to do this). The new type can then simply
Object.C file to see how to do this). The new type can then simply
be added to the object list and will be read in correctly. This is the same
as for the FileWriter, so if the data has been written then the reading will
run without problems.
......@@ -82,8 +82,8 @@ void FileReader::initialise() {
// Set the branch addresses
m_inputTrees[objectID]->SetBranchAddress("time", &m_time);
// Cast the TestBeamObject as a specific type using a Factory
m_objects[objectID] = TestBeamObject::Factory(detectorType, objectType);
// Cast the Object as a specific type using a Factory
m_objects[objectID] = Object::Factory(detectorType, objectType);
m_inputTrees[objectID]->SetBranchAddress(objectType.c_str(), &m_objects[objectID]);
m_currentPosition[objectID] = 0;
}
......@@ -95,7 +95,7 @@ void FileReader::initialise() {
m_inputTrees[objectType] = (TTree*)gDirectory->Get(treePath.c_str());
// Branch the tree to the timestamp and object
m_inputTrees[objectType]->SetBranchAddress("time", &m_time);
m_objects[objectType] = TestBeamObject::Factory(objectType);
m_objects[objectType] = Object::Factory(objectType);
m_inputTrees[objectType]->SetBranchAddress(objectType.c_str(), &m_objects[objectType]);
}
}
......@@ -137,7 +137,7 @@ StatusCode FileReader::run(Clipboard* clipboard) {
continue;
// Create the container that will go on the clipboard
TestBeamObjects* objectContainer = new TestBeamObjects();
Objects* objectContainer = new Objects();
LOG(DEBUG) << "Looking for " << objectType << " on detector " << detectorID;
// Continue looping over this device while there is still data
......@@ -160,7 +160,7 @@ StatusCode FileReader::run(Clipboard* clipboard) {
// Make a copy of the object from the tree, and place it in the object
// container
TestBeamObject* object = TestBeamObject::Factory(detectorType, objectType, m_objects[objectID]);
Object* object = Object::Factory(detectorType, objectType, m_objects[objectID]);
objectContainer->push_back(object);
}
......@@ -176,7 +176,7 @@ StatusCode FileReader::run(Clipboard* clipboard) {
continue;
// Create the container that will go on the clipboard
TestBeamObjects* objectContainer = new TestBeamObjects();
Objects* objectContainer = new Objects();
LOG(DEBUG) << "Looking for " << objectType;
// Continue looping over this device while there is still data
......@@ -199,7 +199,7 @@ StatusCode FileReader::run(Clipboard* clipboard) {
// Make a copy of the object from the tree, and place it in the object
// container
TestBeamObject* object = TestBeamObject::Factory(objectType, m_objects[objectType]);
Object* object = Object::Factory(objectType, m_objects[objectType]);
objectContainer->push_back(object);
}
......
......@@ -39,7 +39,7 @@ namespace corryvreckan {
// Objects which the trees will point to (when
// the branch address is set
long long int m_time;
std::map<std::string, TestBeamObject*> m_objects;
std::map<std::string, Object*> m_objects;
// List of objects to write out
std::vector<std::string> m_objectList;
......
......@@ -18,10 +18,10 @@ FileWriter::FileWriter(Configuration config, std::vector<Detector*> detectors)
This algorithm writes an output file and fills it with trees containing
the requested data.
Any object which inherits from TestBeamObject can in principle be written
to file. In order to enable this for a new type, the TestBeamObject::Factory
Any object which inherits from Object can in principle be written
to file. In order to enable this for a new type, the Object::Factory
function must know how to return an instantiation of that type (see
TestBeamObject.C file to see how to do this). The new type can then simply
Object.C file to see how to do this). The new type can then simply
be added to the object list and will be written out correctly.
*/
......@@ -70,9 +70,9 @@ void FileWriter::initialise() {
m_outputTrees[objectID] = new TTree(treeName.c_str(), treeName.c_str());
m_outputTrees[objectID]->Branch("time", &m_time);
// Cast the TestBeamObject as a specific type using a Factory
// Cast the Object as a specific type using a Factory
// This will return a Timepix1Pixel*, Timepix3Pixel* etc.
m_objects[objectID] = TestBeamObject::Factory(detectorType, objectType);
m_objects[objectID] = Object::Factory(detectorType, objectType);
m_outputTrees[objectID]->Branch(objectType.c_str(), &m_objects[objectID]);
}
}
......@@ -83,7 +83,7 @@ void FileWriter::initialise() {
m_outputTrees[objectType] = new TTree(treeName.c_str(), treeName.c_str());
// Branch the tree to the timestamp and object
m_outputTrees[objectType]->Branch("time", &m_time);
m_objects[objectType] = TestBeamObject::Factory(objectType);
m_objects[objectType] = Object::Factory(objectType);
m_outputTrees[objectType]->Branch(objectType.c_str(), &m_objects[objectType]);
}
}
......@@ -117,7 +117,7 @@ StatusCode FileWriter::run(Clipboard* clipboard) {
// Get the objects, if they don't exist then continue
LOG(DEBUG) << "Checking for " << objectType << " on device " << detectorID;
TestBeamObjects* objects = clipboard->get(detectorID, objectType);
Objects* objects = clipboard->get(detectorID, objectType);
if(objects == NULL)
continue;
LOG(DEBUG) << "Picked up " << objects->size() << " " << objectType << " from device " << detectorID;
......@@ -138,7 +138,7 @@ StatusCode FileWriter::run(Clipboard* clipboard) {
// Get the objects, if they don't exist then continue
LOG(DEBUG) << "Checking for " << objectType;
TestBeamObjects* objects = clipboard->get(objectType);
Objects* objects = clipboard->get(objectType);
if(objects == NULL)
continue;
LOG(DEBUG) << "Picked up " << objects->size() << " " << objectType;
......
......@@ -38,7 +38,7 @@ namespace corryvreckan {
// Objects which the trees will point to (when
// the branch address is set
long long int m_time;
std::map<std::string, TestBeamObject*> m_objects;
std::map<std::string, Object*> m_objects;
// List of objects to write out
std::vector<std::string> m_objectList;
......
# Define module and return the generated name as MODULE_NAME
CORRYVRECKAN_MODULE(MODULE_NAME)
# Add source files to library
CORRYVRECKAN_MODULE_SOURCES(${MODULE_NAME}
MCPTest.cpp
# ADD SOURCE FILES HERE...
)
# Provide standard install target
CORRYVRECKAN_MODULE_INSTALL(${MODULE_NAME})
#include "MCPTest.h"
using namespace corryvreckan;
using namespace std;
MCPTest::MCPTest(Configuration config, std::vector<Detector*> detectors) : Module(std::move(config), std::move(detectors)) {}
void MCPTest::initialise() {}
StatusCode MCPTest::run(Clipboard* clipboard) {
LOG(DEBUG) << "Running event " << m_eventNumber;
// Loop over all Timepix3 and make plots
for(auto& detector : get_detectors()) {
// Get the pixels
Pixels* pixels = (Pixels*)clipboard->get(detector->name(), "pixels");
if(pixels == NULL) {
LOG(DEBUG) << "Detector " << detector->name() << " does not have any pixels on the clipboard";
continue;
}
LOG(DEBUG) << std::endl << "Picked up " << pixels->size() << " objects from detector " << detector->name();
for(auto& pixel : (*pixels)) {
auto local = detector->getLocalPosition(pixel->m_row, pixel->m_column);
auto global = detector->localToGlobal(local);
LOG(DEBUG) << "Pixel Hit @ (" << pixel->m_column << "," << pixel->m_row << ")" << std::endl
<< " local: " << local << std::endl
<< " global: " << global;
}
}
// Increment event counter
m_eventNumber++;
// Return value telling analysis to keep running
return Success;
}
void MCPTest::finalise() {
LOG(DEBUG) << "Analysed " << m_eventNumber << " events";
}
#ifndef MCPTest_H
#define MCPTest_H 1
#include <iostream>
#include "TCanvas.h"
#include "TH1F.h"
#include "TH2F.h"
#include "core/module/Module.hpp"
#include "objects/Cluster.h"
#include "objects/Pixel.h"
#include "objects/Track.h"
namespace corryvreckan {
/** @ingroup Modules
*/
class MCPTest : public Module {
public:
// Constructors and destructors
MCPTest(Configuration config, std::vector<Detector*> detectors);
~MCPTest() {}
// Functions
void initialise();
StatusCode run(Clipboard* clipboard);
void finalise();
// Member variables
int m_eventNumber{};
};
} // namespace corryvreckan
#endif // MCPTest_H
## NAME
**Maintainer**: NAME (<EMAIL>)
**Status**: Outdated, Functional, or Work in progress
#### Description
DESCRIPTION
#### Parameters
* `PARAMETERNAME`: EXPLANATION. Default value is `DEFAULT`.
Or No parameters are used from the configuration file.
#### Plots produced
* PLOT or No plots are produced.
For each detector the following plots are produced:
* PLOT
#### Usage
```toml
[NAME]
ALLPARAMETERS = VALUE
```
Parameters to be used in multiple modules can also be defined globally at the top of the configuration file. This is highly encouraged for parameters such as `DUT` and `reference`.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment