Commit dbca354d authored by Sarah Seif El Nasr's avatar Sarah Seif El Nasr
Browse files

Added OTCommonNoise calibration skeleton

parent 068197c5
#include "../DQMUtils/DQMHistogramOTCommonNoise.h"
#include "../RootUtils/RootContainerFactory.h"
#include "../Utils/Container.h"
#include "../Utils/ContainerFactory.h"
#include "../Utils/ContainerStream.h"
#include "TFile.h"
//========================================================================================================================
DQMHistogramOTCommonNoise::DQMHistogramOTCommonNoise() {}
//========================================================================================================================
DQMHistogramOTCommonNoise::~DQMHistogramOTCommonNoise() {}
//========================================================================================================================
void DQMHistogramOTCommonNoise::book(TFile* theOutputFile, DetectorContainer& theDetectorStructure, const Ph2_System::SettingsMap& pSettingsMap)
{
// SoC utilities only - BEGIN
// THIS PART IT IS JUST TO SHOW HOW DATA ARE DECODED FROM THE TCP STREAM WHEN WE WILL GO ON THE SOC
// IF YOU DO NOT WANT TO GO INTO THE SOC WITH YOUR CALIBRATION YOU DO NOT NEED THE FOLLOWING COMMENTED LINES
// make fDetectorData ready to receive the information fromm the stream
ContainerFactory::copyStructure(theDetectorStructure, fDetectorData);
// SoC utilities only - END
}
//========================================================================================================================
void DQMHistogramOTCommonNoise::process()
{
// This step it is not necessary, unless you want to format / draw histograms,
// otherwise they will be automatically saved
}
//========================================================================================================================
void DQMHistogramOTCommonNoise::reset(void)
{
// Clear histograms if needed
}
//========================================================================================================================
bool DQMHistogramOTCommonNoise::fill(std::vector<char>& dataBuffer)
{
// SoC utilities only - BEGIN
// THIS PART IT IS JUST TO SHOW HOW DATA ARE DECODED FROM THE TCP STREAM WHEN WE WILL GO ON THE SOC
// IF YOU DO NOT WANT TO GO INTO THE SOC WITH YOUR CALIBRATION YOU DO NOT NEED THE FOLLOWING COMMENTED LINES
// As example, I'm expecting to receive a data stream from an uint32_t contained from calibration "OTCommonNoise"
// ChannelContainerStream<uint32_t> theHitStreamer("OTCommonNoise");
// Try to see if the char buffer matched what I'm expection (container of uint32_t from OTCommonNoise
// procedure)
// if(theHitStreamer.attachBuffer(&dataBuffer))
// {
// // It matched! Decoding chip data
// theHitStreamer.decodeChipData(fDetectorData);
// // Filling the histograms
// fillOTCommonNoisePlots(fDetectorData);
// // Cleaning the data container to be ready for the next TCP string
// fDetectorData.cleanDataStored();
// return true;
// }
// the stream does not match, the expected (DQM interface will try to check if other DQM istogrammers are looking
// for this stream)
return false;
// SoC utilities only - END
}
/*!
\file DQMHistogramOTCommonNoise.h
\brief DQM class for OTCommonNoise
\author Fabio Ravera
\date 17/09/21
*/
#ifndef DQMHistogramOTCommonNoise_h_
#define DQMHistogramOTCommonNoise_h_
#include "../DQMUtils/DQMHistogramBase.h"
#include "../Utils/Container.h"
#include "../Utils/DataContainer.h"
class TFile;
/*!
* \class DQMHistogramOTCommonNoise
* \brief Class for OTCommonNoise monitoring histograms
*/
class DQMHistogramOTCommonNoise : public DQMHistogramBase
{
public:
/*!
* constructor
*/
DQMHistogramOTCommonNoise();
/*!
* destructor
*/
~DQMHistogramOTCommonNoise();
/*!
* \brief Book histograms
* \param theOutputFile : where histograms will be saved
* \param theDetectorStructure : Detector container as obtained after file parsing, used to create histograms for
* all board/chip/hybrid/channel \param pSettingsMap : setting as for Tool setting map in case coe informations are
* needed (i.e. FitSCurve)
*/
void book(TFile* theOutputFile, DetectorContainer& theDetectorStructure, const Ph2_System::SettingsMap& pSettingsMap) override;
/*!
* \brief fill : fill histograms from TCP stream, need to be overwritten to avoid compilation errors, but it is not
* needed if you do not fo into the SoC \param dataBuffer : vector of char with the TCP datastream
*/
bool fill(std::vector<char>& dataBuffer) override;
/*!
* \brief process : do something with the histogram like colors, fit, drawing canvases, etc
*/
void process() override;
/*!
* \brief Reset histogram
*/
void reset(void) override;
private:
DetectorDataContainer fDetectorData;
};
#endif
#include "../tools/OTCommonNoise.h"
using namespace Ph2_HwDescription;
using namespace Ph2_HwInterface;
using namespace Ph2_System;
OTCommonNoise::OTCommonNoise() : Tool() {}
OTCommonNoise::~OTCommonNoise() {}
void OTCommonNoise::Initialise(void)
{
#ifdef __USE_ROOT__ // to disable and anable ROOT by command
// Calibration is not running on the SoC: plots are booked during initialization
fDQMHistogramOTCommonNoise.book(fResultFile, *fDetectorContainer, fSettingsMap);
#endif
}
void OTCommonNoise::ConfigureCalibration()
{
}
void OTCommonNoise::Running()
{
LOG(INFO) << "Starting OTCommonNoise measurement.";
Initialise();
LOG(INFO) << "Done with OTCommonNoise.";
}
void OTCommonNoise::Stop(void)
{
LOG(INFO) << "Stopping OTCommonNoise measurement.";
#ifdef __USE_ROOT__
// Calibration is not running on the SoC: processing the histograms
fDQMHistogramOTCommonNoise.process();
#endif
dumpConfigFiles();
SaveResults();
closeFileHandler();
LOG(INFO) << "OTCommonNoise stopped.";
}
void OTCommonNoise::Pause()
{
}
void OTCommonNoise::Resume()
{
}
/*!
*
* \file OTCommonNoise.h
* \brief OTCommonNoise class
* \author Fabio Ravera
* \date 17/09/21
*
*/
#ifndef OTCommonNoise_h__
#define OTCommonNoise_h__
#include "Tool.h"
#include <map>
#ifdef __USE_ROOT__
// Calibration is not running on the SoC: I need to instantiate the DQM histrgrammer here
#include "../DQMUtils/DQMHistogramOTCommonNoise.h"
#endif
class OTCommonNoise : public Tool
{
public:
OTCommonNoise();
~OTCommonNoise();
void Initialise(void);
// State machine
void Running() override;
void Stop() override;
void ConfigureCalibration() override;
void Pause() override;
void Resume() override;
void Reset();
private:
//
#ifdef __USE_ROOT__
// Calibration is not running on the SoC: Histogrammer is handeld by the calibration itself
DQMHistogramOTCommonNoise fDQMHistogramOTCommonNoise;
#endif
};
#endif
Supports Markdown
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