Commit 31df74a0 authored by Lennart Huth's avatar Lennart Huth Committed by Lennart Huth
Browse files

Added a global Module Frame to load MuPix8 DAQ data. Functionality to be...

Added a global Module Frame to load MuPix8 DAQ data. Functionality to be added. Module is switched off per default
parent ee4ca1a7
CORRYVRECKAN_ENABLE_DEFAULT(OFF)
# Define module and return the generated name as MODULE_NAME
CORRYVRECKAN_GLOBAL_MODULE(MODULE_NAME)
FIND_PACKAGE(MUPIX8DAQ)
IF(NOT MUPIX8DAQ_FOUND)
MESSAGE(FATAL_ERROR "Could not find MuPix-telescope. You need to do: \n export MUPIX8DAQ=/path/to/repo")
ENDIF()
INCLUDE_DIRECTORIES(SYSTEM ${MUPIX8DAQ_INCLUDE_DIR})
# Add source files to library
CORRYVRECKAN_MODULE_SOURCES(${MODULE_NAME}
EventLoaderMuPixTelescope.cpp
# ADD SOURCE FILES HERE...
)
TARGET_LINK_LIBRARIES(${MODULE_NAME} ${MUPIX8DAQ_LIBRARY})
# Provide standard install target
CORRYVRECKAN_MODULE_INSTALL(${MODULE_NAME})
/**
* @file
* @brief Implementation of [EventLoaderMuPixTelescope] module
* @copyright Copyright (c) 2017 CERN and the Allpix Squared authors.
* This software is distributed under the terms of the MIT License, copied verbatim in the file "LICENSE.md".
* In applying this license, CERN does not waive the privileges and immunities granted to it by virtue of its status as an
* Intergovernmental Organization or submit itself to any jurisdiction.
*/
#include "EventLoaderMuPixTelescope.h"
#include "dirent.h"
using namespace corryvreckan;
using namespace std;
EventLoaderMuPixTelescope::EventLoaderMuPixTelescope(Configuration config, std::vector<std::shared_ptr<Detector>> detectors)
: Module(std::move(config), std::move(detectors)), m_blockFile(nullptr) {
m_filePath = m_config.getPath("input_directory");
m_runNumber = m_config.get<int>("Run", -1); // meaningless default runnumber
m_isSorted = m_config.get<bool>("isSorted", false);
m_ts2IsGray = m_config.get<bool>("ts2IsGray", false);
// We need to check for the config files in case of scans... TBI
}
void EventLoaderMuPixTelescope::initialise() {
for(auto& detector : get_detectors()) {
LOG(DEBUG) << "Initialise for detector " + detector->name();
}
// Need to check if the files do exist
DIR* directory = opendir(m_filePath.c_str());
if(directory == nullptr) {
LOG(ERROR) << "Directory " << m_filePath << " does not exist";
return;
}
// check the entries and if the correct file exists - seems to be inefficient
dirent* entry;
bool foundFile = false;
while((entry = readdir(directory))) {
if(entry->d_name == string("telescope_run_000115.blck")) {
foundFile = true;
break;
}
}
if(!foundFile) {
LOG(ERROR) << "Requested run not existing ";
return;
}
BlockFile bf("bf.blck");
bf.open_read();
// m_blockFile = new BlockFile(to_string(m_filePath+"/"+entry->d_name));
// Initialise member variables
m_eventNumber = 0;
}
StatusCode EventLoaderMuPixTelescope::run(std::shared_ptr<Clipboard>) {
// Loop over all detectors
for(auto& detector : get_detectors()) {
// Get the detector name
std::string detectorName = detector->name();
LOG(DEBUG) << "Detector with name " << detectorName;
}
// Increment event counter
m_eventNumber++;
// Return value telling analysis to keep running
return StatusCode::Success;
}
void EventLoaderMuPixTelescope::finalise() {
LOG(DEBUG) << "Analysed " << m_eventNumber << " events";
}
/**
* @file
* @brief Definition of [EventLoaderMuPixTelescope] module
* @copyright Copyright (c) 2017 CERN and the Allpix Squared authors.
* This software is distributed under the terms of the MIT License, copied verbatim in the file "LICENSE.md".
* In applying this license, CERN does not waive the privileges and immunities granted to it by virtue of its status as an
* Intergovernmental Organization or submit itself to any jurisdiction.
*
* Contains minimal dummy module to use as a start for the development of your own module
*
* Refer to the User's Manual for more details.
*/
#include <TCanvas.h>
#include <TH1F.h>
#include <TH2F.h>
#include <iostream>
#include "core/module/Module.hpp"
#include "library/blockfile.hpp"
#include "library/telescope_frame.hpp"
#include "objects/Cluster.hpp"
#include "objects/Pixel.hpp"
#include "objects/Track.hpp"
namespace corryvreckan {
/** @ingroup Modules
* @brief Module to do function
*
* More detailed explanation of module
*/
class EventLoaderMuPixTelescope : public Module {
public:
/**
* @brief Constructor for this unique module
* @param config Configuration object for this module as retrieved from the steering file
* @param detectors Vector of pointers to the detectors
*/
EventLoaderMuPixTelescope(Configuration config, std::vector<std::shared_ptr<Detector>> detectors);
/**
* @brief [Initialise this module]
*/
void initialise();
/**
* @brief [Run the function of this module]
*/
StatusCode run(std::shared_ptr<Clipboard> clipboard);
/**
* @brief [Finalise module]
*/
void finalise();
private:
int m_eventNumber;
std::string m_filePath;
bool m_isSorted;
bool m_ts2IsGray;
int m_runNumber;
BlockFile* m_blockFile;
TelescopeFrame m_tf;
};
} // namespace corryvreckan
# EventLoaderMuPixTelescope
**Maintainer**: Lennart Huth (huth@phsi.uni-heidelberg.de)
**Module Type**: *GLOBAL*
**Status**: Immature
### Description
This is a demonstrator module only, taking data every detector on the clipboard and plots the pixel hit positions.
It serves as template to create new modules.
### Parameters
No parameters are used from the configuration file.
### Plots produced
* Histogram of event numbers
For each detector the following plots are produced:
* 2D histogram of pixel hit positions
### Usage
```toml
[EventLoaderMuPixTelescope]
```
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