Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions Modules/EMCAL/include/EMCAL/DigitsQcTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,20 @@ class DigitsQcTask final : public TaskInterface
void setThreshold(Double_t threshold) { mCellThreshold = threshold; }

private:
Double_t mCellThreshold = 0.5; ///< energy cell threshold
std::array<TH2*, 2> mDigitAmplitude; ///< Digit amplitude
std::array<TH2*, 2> mDigitTime; ///< Digit time
std::array<TH2*, 2> mDigitAmplitudeCalib; ///< Digit amplitude calibrated
std::array<TH2*, 2> mDigitTimeCalib; ///< Digit time calibrated
TH2* mDigitOccupancy = nullptr; ///< Digit occupancy EMCAL and DCAL
TH2* mDigitOccupancyThr = nullptr; ///< Digit occupancy EMCAL and DCAL with Energy trheshold
TProfile2D* mIntegratedOccupancy = nullptr; ///< Digit integrated occupancy
TH1* mDigitAmplitudeEMCAL = nullptr; ///< Digit amplitude in EMCAL
TH1* mDigitAmplitudeDCAL = nullptr; ///< Digit amplitude in DCAL
TH1* mnumberEvents = nullptr; ///< Number of Events for normalization
o2::emcal::Geometry* mGeometry = nullptr; ///< EMCAL geometry
o2::emcal::BadChannelMap* mBadChannelMap; ///< EMCAL channel map
o2::emcal::TimeCalibrationParams* mTimeCalib; ///< EMCAL time calib
Double_t mCellThreshold = 0.5; ///< energy cell threshold
std::map<std::string, std::array<TH2*, 2>> mDigitAmplitude; ///< Digit amplitude
std::map<std::string, std::array<TH2*, 2>> mDigitTime; ///< Digit time
std::map<std::string, std::array<TH2*, 2>> mDigitAmplitudeCalib; ///< Digit amplitude calibrated
std::map<std::string, std::array<TH2*, 2>> mDigitTimeCalib; ///< Digit time calibrated
TH2* mDigitOccupancy = nullptr; ///< Digit occupancy EMCAL and DCAL
TH2* mDigitOccupancyThr = nullptr; ///< Digit occupancy EMCAL and DCAL with Energy trheshold
TProfile2D* mIntegratedOccupancy = nullptr; ///< Digit integrated occupancy
TH1* mDigitAmplitudeEMCAL = nullptr; ///< Digit amplitude in EMCAL
TH1* mDigitAmplitudeDCAL = nullptr; ///< Digit amplitude in DCAL
TH1* mnumberEvents = nullptr; ///< Number of Events for normalization
o2::emcal::Geometry* mGeometry = nullptr; ///< EMCAL geometry
o2::emcal::BadChannelMap* mBadChannelMap; ///< EMCAL channel map
o2::emcal::TimeCalibrationParams* mTimeCalib; ///< EMCAL time calib
};

} // namespace emcal
Expand Down
30 changes: 15 additions & 15 deletions Modules/EMCAL/include/EMCAL/RawTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,21 @@ class RawTask final : public TaskInterface
TH1* mMessageCounter = nullptr;
TH1* mNumberOfSuperpagesPerMessage;
TH1* mNumberOfPagesPerMessage;
TH1* mSuperpageCounter = nullptr; ///< Counter for number of superpages
TH1* mPageCounter = nullptr; ///< Counter for number of pages (headers)
TH1* mTotalDataVolume = nullptr; ///< Total data volume
std::array<TH1*, 20> mRawAmplitudeEMCAL; ///< Raw amplitude in EMCAL
std::array<TH1*, 20> mRawAmplMaxEMCAL; ///< Max Raw amplitude in EMCAL per cell
std::array<TH1*, 20> mRawAmplMinEMCAL; ///< Min Raw amplitude in EMCAL per cell
std::unique_ptr<o2::emcal::MappingHandler> mMappings; ///< Mappings Hardware address -> Channel
std::array<TProfile2D*, 20> mRMSperSM; ///< ADC rms per SM
std::array<TProfile2D*, 20> mMEANperSM; ///< ADC mean per SM
std::array<TProfile2D*, 20> mMAXperSM; ///< ADC max per SM
std::array<TProfile2D*, 20> mMINperSM; ///< ADC min per SM
TH2F* mErrorTypeAltro = nullptr; ///< Error from AltroDecoder
TH2F* mPayloadSizePerDDL = nullptr; ///< Payload size per ddl
Int_t mNumberOfSuperpages = 0; ///< Simple total superpage counter
Int_t mNumberOfPages = 0; ///< Simple total number of superpages counter
TH1* mSuperpageCounter = nullptr; ///< Counter for number of superpages
TH1* mPageCounter = nullptr; ///< Counter for number of pages (headers)
TH1* mTotalDataVolume = nullptr; ///< Total data volume
std::map<std::string, std::array<TH1*, 20>> mRawAmplitudeEMCAL; /////< Raw amplitude in EMCAL
std::map<std::string, std::array<TH1*, 20>> mRawAmplMaxEMCAL; ///< Max Raw amplitude in EMCAL per cell
std::map<std::string, std::array<TH1*, 20>> mRawAmplMinEMCAL; ///< Min Raw amplitude in EMCAL per cell
std::map<std::string, std::array<TProfile2D*, 20>> mRMSperSM; ///< ADC rms per SM
std::map<std::string, std::array<TProfile2D*, 20>> mMEANperSM; ///< ADC mean per SM
std::map<std::string, std::array<TProfile2D*, 20>> mMAXperSM; ///< ADC max per SM
std::map<std::string, std::array<TProfile2D*, 20>> mMINperSM; ///< ADC min per SM
std::unique_ptr<o2::emcal::MappingHandler> mMappings; ///< Mappings Hardware address -> Channel
TH2F* mErrorTypeAltro = nullptr; ///< Error from AltroDecoder
TH2F* mPayloadSizePerDDL = nullptr; ///< Payload size per ddl
Int_t mNumberOfSuperpages = 0; ///< Simple total superpage counter
Int_t mNumberOfPages = 0; ///< Simple total number of superpages counter
Int_t mNumberOfMessages = 0;
};

Expand Down
124 changes: 90 additions & 34 deletions Modules/EMCAL/src/DigitsQcTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "EMCALCalib/BadChannelMap.h"
#include "EMCALCalib/TimeCalibrationParams.h"
#include <Framework/InputRecord.h>
#include <CommonConstants/Triggers.h>

namespace o2
{
Expand All @@ -27,17 +28,25 @@ namespace emcal

DigitsQcTask::~DigitsQcTask()
{
for (auto h : mDigitAmplitude) {
delete h;
for (auto& [trg, histos] : mDigitAmplitude) {
for (auto h : histos) {
delete h;
}
}
for (auto h : mDigitTime) {
delete h;
for (auto& [trg, histos] : mDigitTime) {
for (auto h : histos) {
delete h;
}
}
for (auto h : mDigitAmplitudeCalib) {
delete h;
for (auto& [trg, histos] : mDigitAmplitudeCalib) {
for (auto h : histos) {
delete h;
}
}
for (auto h : mDigitTimeCalib) {
delete h;
for (auto& [trg, histos] : mDigitTimeCalib) {
for (auto h : histos) {
delete h;
}
}
if (mDigitAmplitudeEMCAL)
delete mDigitAmplitudeEMCAL;
Expand All @@ -48,40 +57,68 @@ void DigitsQcTask::initialize(o2::framework::InitContext& /*ctx*/)
{
QcInfoLogger::GetInstance() << "initialize DigitsQcTask" << AliceO2::InfoLogger::InfoLogger::endm;
//define histograms
mDigitAmplitude[0] = new TH2F("digitAmplitudeHG", "Digit Amplitude (High gain)", 100, 0, 100, 20000, 0., 20000.);
mDigitAmplitude[1] = new TH2F("digitAmplitudeLG", "Digit Amplitude (Low gain)", 100, 0, 100, 20000, 0., 20000.);
mDigitAmplitudeCalib[0] = new TH2F("digitAmplitudeHGCalib", "Digit Amplitude Calib (High gain)", 100, 0, 100, 20000, 0., 20000.);
mDigitAmplitudeCalib[1] = new TH2F("digitAmplitudeLGCalib", "Digit Amplitude Calib (Low gain)", 100, 0, 100, 20000, 0., 20000.);

std::array<std::string, 2> triggers = { { "CAL", "PHYS" } };
for (const auto& trg : triggers) {

std::array<TH2*, 2> histosDigitAmplitude;
std::array<TH2*, 2> histosDigitAmplitudeCalib;
std::array<TH2*, 2> histosDigitTime;
std::array<TH2*, 2> histosDigitTimeCalib;

histosDigitAmplitude[0] = new TH2F(Form("digitAmplitudeHG_%s", trg.data()), Form("Digit Amplitude (High gain) %s", trg.data()), 100, 0, 100, 20000, 0., 20000.);
histosDigitAmplitude[1] = new TH2F(Form("digitAmplitudeHG_%s", trg.data()), Form("Digit Amplitude (Low gain) %s", trg.data()), 100, 0, 100, 20000, 0., 20000.);

histosDigitAmplitudeCalib[0] = new TH2F(Form("digitAmplitudeHG_%s", trg.data()), Form("Digit Amplitude (High gain) %s", trg.data()), 100, 0, 100, 20000, 0., 20000.);
histosDigitAmplitudeCalib[1] = new TH2F(Form("digitAmplitudeLG_%s", trg.data()), Form("Digit Amplitude (Low gain) %s", trg.data()), 100, 0, 100, 20000, 0., 20000.);

histosDigitTime[0] = new TH2F(Form("digitTimeHG_%s", trg.data()), Form("Digit Time (High gain) %s", trg.data()), 2000, -200, 200, 20000, 0., 20000.);
histosDigitTime[1] = new TH2F(Form("digitTimeLG_%s", trg.data()), Form("Digit Time (Low gain) %s", trg.data()), 2000, -200, 200, 20000, 0., 20000.);

histosDigitTimeCalib[0] = new TH2F(Form("digitTimeHGCalib_%s", trg.data()), Form("Digit Time Calib (High gain) %s", trg.data()), 2000, -200, 200, 20000, 0., 20000.);
histosDigitTimeCalib[1] = new TH2F(Form("digitTimeLGCalib_%s", trg.data()), Form("Digit Time Calib (Low gain) %s", trg.data()), 2000, -200, 200, 20000, 0., 20000.);

mDigitAmplitude[trg] = histosDigitAmplitude;
mDigitAmplitude[trg] = histosDigitAmplitudeCalib;
mDigitTime[trg] = histosDigitTime;
mDigitTimeCalib[trg] = histosDigitTimeCalib;
} //trigger type

mDigitOccupancy = new TH2F("digitOccupancyEMC", "Digit Occupancy EMCAL", 96, -0.5, 95.5, 208, -0.5, 207.5);
mDigitOccupancyThr = new TH2F("digitOccupancyEMCwThr", "Digit Occupancy EMCAL with E>0.5 GeV/c", 96, -0.5, 95.5, 208, -0.5, 207.5);

mIntegratedOccupancy = new TProfile2D("digitOccupancyInt", "Digit Occupancy Integrated", 96, -0.5, 95.5, 208, -0.5, 207.5);
mIntegratedOccupancy->GetXaxis()->SetTitle("col");
mIntegratedOccupancy->GetYaxis()->SetTitle("row");

mDigitTime[0] = new TH2F("digitTimeHG", "Digit Time (High gain)", 2000, -200, 200, 20000, 0., 20000.);
mDigitTime[1] = new TH2F("digitTimeLG", "Digit Time (Low gain)", 2000, -200, 200, 20000, 0., 20000.);
mDigitTimeCalib[0] = new TH2F("digitTimeHGCalib", "Digit Time Calib (High gain)", 2000, -200, 200, 20000, 0., 20000.);
mDigitTimeCalib[1] = new TH2F("digitTimeLGCalib", "Digit Time Calib (Low gain)", 2000, -200, 200, 20000, 0., 20000.);
// 1D histograms for showing the integrated spectrum

mDigitAmplitudeEMCAL = new TH1F("digitAmplitudeEMCAL", "Digit amplitude in EMCAL", 100, 0., 100.);
mDigitAmplitudeDCAL = new TH1F("digitAmplitudeDCAL", "Digit amplitude in DCAL", 100, 0., 100.);
mnumberEvents = new TH1F("NumberOfEvents", "Number Of Events", 1, 0.5, 1.5);

//Puglishing histograms
for (auto h : mDigitAmplitude)
getObjectsManager()->startPublishing(h);

for (auto h : mDigitTime)
getObjectsManager()->startPublishing(h);
for (auto& [trg, histos] : mDigitAmplitude) {
for (auto h : histos) {
getObjectsManager()->startPublishing(h);
}
}

for (auto h : mDigitAmplitudeCalib)
getObjectsManager()->startPublishing(h);
for (auto& [trg, histos] : mDigitTime) {
for (auto h : histos) {
getObjectsManager()->startPublishing(h);
}
}
for (auto& [trg, histos] : mDigitAmplitudeCalib) {
for (auto h : histos) {
getObjectsManager()->startPublishing(h);
}
}

for (auto h : mDigitTimeCalib)
getObjectsManager()->startPublishing(h);
for (auto& [trg, histos] : mDigitTimeCalib) {
for (auto h : histos) {
getObjectsManager()->startPublishing(h);
}
}

getObjectsManager()->startPublishing(mDigitAmplitudeEMCAL);
getObjectsManager()->startPublishing(mDigitAmplitudeDCAL);
Expand Down Expand Up @@ -142,21 +179,34 @@ void DigitsQcTask::monitorData(o2::framework::ProcessingContext& ctx)
//gsl::span<const o2::emcal::Digit> eventdigits(digitcontainer.data() + trg.getFirstEntry(), trg.getNumberOfObjects());
gsl::span<const o2::emcal::Cell> eventdigits(digitcontainer.data() + trg.getFirstEntry(), trg.getNumberOfObjects());

//trigger type
auto triggertype = trg.getTriggerBits();
bool isPhysTrigger = triggertype & o2::trigger::PhT, isCalibTrigger = triggertype & o2::trigger::Cal;
std::string trgClass;
if (isPhysTrigger)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we recommend to always add curvy braces.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, we take this as recommendation :)

trgClass = "PHYS";
else if (isCalibTrigger)
trgClass = "CAL";
else {
QcInfoLogger::GetInstance() << QcInfoLogger::Error << " Unmonitored trigger class requested " << AliceO2::InfoLogger::InfoLogger::endm;
continue;
}

for (auto digit : eventdigits) {
int index = digit.getHighGain() ? 0 : (digit.getLowGain() ? 1 : -1);
if (index < 0)
continue;
auto cellindices = mGeometry->GetCellIndex(digit.getTower());

mDigitAmplitude[index]->Fill(digit.getEnergy(), digit.getTower());
mDigitAmplitude[trgClass][index]->Fill(digit.getEnergy(), digit.getTower());

auto timeoffset = mTimeCalib->getTimeCalibParam(digit.getTower(), digit.getLowGain());

if ((mBadChannelMap->getChannelStatus(digit.getTower()) == MaskType_t::GOOD_CELL)) {
mDigitAmplitudeCalib[index]->Fill(digit.getEnergy(), digit.getTower());
mDigitTimeCalib[index]->Fill(digit.getTimeStamp() - timeoffset, digit.getTower());
mDigitAmplitudeCalib[trgClass][index]->Fill(digit.getEnergy(), digit.getTower());
mDigitTimeCalib[trgClass][index]->Fill(digit.getTimeStamp() - timeoffset, digit.getTower());
}
mDigitTime[index]->Fill(digit.getTimeStamp(), digit.getTower());
mDigitTime[trgClass][index]->Fill(digit.getTimeStamp(), digit.getTower());

// get the supermodule for filling EMCAL/DCAL spectra

Expand Down Expand Up @@ -200,10 +250,16 @@ void DigitsQcTask::reset()
// clean all the monitor objects here

QcInfoLogger::GetInstance() << "Resetting the histogram" << AliceO2::InfoLogger::InfoLogger::endm;
for (auto h : mDigitAmplitude)
h->Reset();
for (auto h : mDigitTime)
h->Reset();
for (auto& [trg, histos] : mDigitAmplitude) {
for (auto h : histos) {
h->Reset();
}
}
for (auto& [trg, histos] : mDigitTime) {
for (auto h : histos) {
h->Reset();
}
}

mDigitAmplitudeEMCAL->Reset();
mDigitAmplitudeDCAL->Reset();
Expand Down
Loading