10#include <framework/core/HistoModule.h>
11#include <top/modules/TOPWaveformQualityPlotter/TOPWaveformQualityPlotterModule.h>
17#include "TDirectory.h"
19#include "TGraphErrors.h"
44 "histogram directory in ROOT file",
string(
"TOP"));
53 TDirectory* oldDir = gDirectory;
56 m_samples =
new TH1F(
"ADCvalues",
"ADC values ", 100, -50, 50);
57 m_samples->GetXaxis()->SetTitle(
"ADC Value");
58 m_samples->GetYaxis()->SetTitle(
"Number of Samples");
59 m_scrod_id =
new TH1F(
"scrodID",
"scrodID", 100, 0, 100);
60 m_asic =
new TH1F(
"IRSX",
"IRSX", 4, 0, 4);
61 m_carrier =
new TH1F(
"carrier",
"asic col", 4, 0, 4);
62 m_asic_ch =
new TH1F(
"asicCh",
"channel", 8, 0, 8);
63 m_errorFlag =
new TH1F(
"errorFlag",
"errorFlag", 1000, 0, 1000);
64 m_asic_win =
new TH1F(
"window",
"window", 4, 0, 4);
65 m_entries =
new TH1F(
"entries",
"entries", 100, 0, 2600);
66 m_moduleID =
new TH1F(
"moduleID",
"moduleID", 16, 1, 17);
67 m_pixelID =
new TH1F(
"pixelID",
"pixelID", 512, 1, 513);
97 m_hitmap[scrodid] =
new TH2F((
string(
"scrod ") + to_string(scrodid) +
string(
"Hitmap")).c_str(),
98 (
string(
"scrod ") + to_string(scrodid) +
string(
"carrier vs. asic;asic;carrier")).c_str(), 4, 0, 4, 4, 0, 4);
100 m_hitmap[scrodid]->Fill(asicid, carrierid);
102 if (waveform.empty()) {
105 for (
short adc : waveform) {
114 if (waveform.empty()) {
125 string gname = string(
"scrod_") + to_string(scrodid) + string(
"_carrier") + to_string(carrierNumber) + string(
"_asic") + to_string(
126 asicNumber) + to_string(iChannel);
127 if (
m_waveformHists[scrodid][carrierNumber][asicNumber].find(iChannel) ==
130 auto h =
new TProfile(gname.c_str(), gname.c_str(), 256, 0, 256);
135 for (
size_t i = 0; i < 256; ++i) {
137 if (i >= waveform.size()) {
140 m_waveformHists[scrodid][carrierNumber][asicNumber][iChannel]->Fill(i + 0.5, iChannel * 1500 + waveform[i]);
158 auto channelID = evtwave.getChannel();
159 const vector<short> v_samples = evtwave.getWaveform();
160 size_t nsamples = v_samples.size();
162 string idName = string(
"noise_") + to_string(channelID);
163 m_channelNoiseMap.insert(make_pair(channelID,
new TH1F(idName.c_str(), idName.c_str(), 200, -100, 100)));
168 for (
size_t s = 0; s < nsamples; s++) {
169 double adc = v_samples.at(s);
171 if (s < nsamples - 1) {
172 noise->Fill(v_samples[s + 1] - adc);
190 int scrodid = scrod_it.first;
191 string name = string(
"scrod_") + to_string(scrodid);
192 TCanvas* c =
new TCanvas(name.c_str(), name.c_str());
195 for (
auto carrier_it : scrod_it.second) {
196 int carrierNumber = carrier_it.first;
197 for (
auto asic_it : carrier_it.second) {
198 int asicNumber = asic_it.first;
200 string gname = string(
"scrod_") + to_string(scrodid) + string(
"_carrier") + to_string(carrierNumber) + string(
"_asic") + to_string(
202 TMultiGraph* mg =
new TMultiGraph(gname.c_str(), gname.c_str());
203 for (
auto channel_it : asic_it.second) {
205 TGraphErrors* g =
new TGraphErrors(channel_it.second);
206 g->SetMarkerStyle(7);
210 TH2F* h =
new TH2F(gname.c_str(), gname.c_str(), 256, 0, 256, 8, -500, -500 + 8 * 1500);
211 for (
int ibin = 0; ibin < 8; ibin++) {
212 h->GetYaxis()->SetBinLabel(ibin + 1, to_string(ibin).c_str());
214 h->GetYaxis()->SetTickSize(0);
215 h->GetYaxis()->SetTickLength(0);
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
void setDescription(const std::string &description)
Sets the description of the module.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
void initialize() override
Module initialization, calls defineHisto and gets waveform.
TOPWaveformQualityPlotterModule()
Constructor.
void event() override
Event processor.
void endRun() override
End-of-run action.
void basicDebuggingPlots(const TOPRawWaveform &rawwave)
Fills the debugging 1D histograms and hitmaps.
void drawWaveforms(const TOPRawWaveform &rawwave)
Draws the full waveforms onto the TProfiles.
void defineHisto() override
Books the empty histograms.
Abstract base class for different kinds of events.