Skip to content
Snippets Groups Projects
Commit 6744d28c authored by Kenta Uno's avatar Kenta Uno
Browse files

Merge branch 'dev_NoiseCor' into '21.0'

ATLLARONL-318: Added a summary plot for LAr Noise Correlation

See merge request atlas/athena!15668
Conflicts:

	LArCalorimeter/LArMonTools/src/LArNoiseCorrelationMon.cxx


Former-commit-id: fa386cf027155e3947c34c2e0ce50aecc52d6377
parent 5c2a1487
No related branches found
No related tags found
No related merge requests found
......@@ -78,12 +78,34 @@ private:
int Nchan;
double chan_low,chan_up;
std::string hist_name;
std::string hist_summary_name1;
std::string hist_summary_name2;
std::string hist_title;
/** The FEB map*/
std::map<HWIdentifier,std::pair<TH2F_LW*,std::pair<TH2F_LW*,TProfile_LW*> > > m_FEBhistograms;
std::pair<TH2F_LW*,std::pair<TH2F_LW*,TProfile_LW*> > m_histos; //for handling histograms
/** Summary plot*/
TH2F_LW * h_summary_plot1_EMBA;
TH2F_LW * h_summary_plot1_EMBC;
TH2F_LW * h_summary_plot1_EMECA;
TH2F_LW * h_summary_plot1_EMECC;
TH2F_LW * h_summary_plot1_HECA;
TH2F_LW * h_summary_plot1_HECC;
TH2F_LW * h_summary_plot1_FCALA;
TH2F_LW * h_summary_plot1_FCALC;
TH2F_LW * h_summary_plot2_EMBA;
TH2F_LW * h_summary_plot2_EMBC;
TH2F_LW * h_summary_plot2_EMECA;
TH2F_LW * h_summary_plot2_EMECC;
TH2F_LW * h_summary_plot2_HECA;
TH2F_LW * h_summary_plot2_HECC;
TH2F_LW * h_summary_plot2_FCALA;
TH2F_LW * h_summary_plot2_FCALC;
/** list of FEBs to monitor. FEB names are expected to be of the type LARONLINEID defined in the package atlas/LArCalorimeter/LArMonTools/LArMonTools/LArOnlineIDStrHelper.h e.g. 'BarrelCFT00Slot02' */
std::vector<std::string> m_FEBsToMonitor;
......@@ -100,6 +122,7 @@ private:
/**declaration variables used in joboptions*/
bool m_IsOnline;
bool m_ignoreKnownBadChannels;
bool m_DoSummary;
std::string m_LArDigitContainerKey;
std::string m_larPedestalKey;
......
......@@ -37,6 +37,10 @@
#include <vector>
#include <algorithm>
//ROOT
#include "TPRegexp.h"
#include "TF1.h"
//LAr infos:
#include "Identifier/HWIdentifier.h"
#include "LArMonTools/LArOnlineIDStrHelper.h"
......@@ -89,6 +93,9 @@ LArNoiseCorrelationMon::LArNoiseCorrelationMon(const std::string& type,
declareProperty("LArPedestalKey", m_larPedestalKey="Pedestal");
declareProperty("LArDigitContainerKey", m_LArDigitContainerKey = "FREE");
declareProperty("IsOnline", m_IsOnline=false);
/**bool enable summary plot */
declareProperty("DoSummary", m_DoSummary=true);
}
/*---------------------------------------------------------*/
......@@ -129,7 +136,8 @@ LArNoiseCorrelationMon::initialize()
{
ATH_MSG_INFO( "Initialize LArNoiseCorrelationMon" );
m_evtCounter=0;
StatusCode sc;
/** Get LAr Online Id Helper*/
......@@ -190,6 +198,8 @@ LArNoiseCorrelationMon::bookHistograms()
/**declare strings for histograms title*/
hist_name = "NoiseCorr_";
hist_summary_name1 = "SummaryPlot_maximumCorr";
hist_summary_name2 = "SummaryPlot_maximumCorr_sigma";
hist_title = "LAr Noise Correlation";
m_strHelper = new LArOnlineIDStrHelper(m_LArOnlineIDHelper);
m_strHelper->setDefaultNameType(LArOnlineIDStrHelper::LARONLINEID);
......@@ -409,6 +419,114 @@ StatusCode LArNoiseCorrelationMon::procHistograms()
}
/*---------------------------------------------------------*/
/**Compute correlations and fill in the plots*/
void LArNoiseCorrelationMon::fillInCorrelations()
{
double mean1,mean2;
double sumVar1,sumVar2;
double N;
double cor;
for (auto const& feb_entry : m_FEBhistograms)
{
double tmp_maxcorr = 0.0;
TH1F *hist_tmp_correlation;
hist_tmp_correlation = new TH1F("Tmp_correlation_value", "TMP correlation value", 40, -1.0, 1.0 );
double tmp_RMS = 0.0;
m_histos=feb_entry.second;
for(int i=1;i<=Nchan;i++)
{
mean1=m_histos.second.second->GetBinContent(i);
sumVar1=m_histos.second.first->GetBinContent(i,i);
N=m_histos.second.second->GetBinEntries(i);
if(N==0)
{
ATH_MSG_DEBUG( "Bin " << i << " has 0 entries" );
continue;
}
for(int j=i+1;j<=Nchan;j++)
{
mean2=m_histos.second.second->GetBinContent(j);
sumVar2=m_histos.second.first->GetBinContent(j,j);
if((sumVar1-N*mean1*mean1)*(sumVar2-N*mean2*mean2)==0) {
ATH_MSG_DEBUG( "sigma_i*sigma_j is zero for bin (" << i << "," << j << "). Correlation cannot be computed." );
continue;
}
cor=(m_histos.second.first->GetBinContent(i,j)-N*mean1*mean2)/TMath::Sqrt((sumVar1-N*mean1*mean1)*(sumVar2-N*mean2*mean2));
m_histos.first->SetBinContent(i,j,cor);
m_histos.first->SetBinContent(j,i,cor);
// calculate maximum correlation
// First variable: maximum correlation in the FEB
if ( tmp_maxcorr < std::abs(cor) )
tmp_maxcorr = std::abs(cor);
// Second valiable: RMS value in correlation distribution
hist_tmp_correlation->Fill(cor);
}
}
tmp_RMS = hist_tmp_correlation->GetRMS();
// Fill in summary histogram
TPMERegexp tmp('_');
int nsplit = tmp.Split( m_histos.first->GetTitle() );
if(m_DoSummary){
if(nsplit > 1){
// EMB
if(m_LArOnlineIDHelper->isEMBchannel( feb_entry.first )){
if(m_LArOnlineIDHelper->pos_neg(feb_entry.first) ){
h_summary_plot1_EMBA->SetBinContent( atoi(tmp[0])+1, atoi(tmp[1])+1, tmp_maxcorr);
h_summary_plot2_EMBA->SetBinContent( atoi(tmp[0])+1, atoi(tmp[1])+1, tmp_RMS);
}
else{
h_summary_plot1_EMBC->SetBinContent( atoi(tmp[0])+1, atoi(tmp[1])+1, tmp_maxcorr);
h_summary_plot2_EMBC->SetBinContent( atoi(tmp[0])+1, atoi(tmp[1])+1, tmp_RMS);
}
}
// EMEC
else if(m_LArOnlineIDHelper->isEMECchannel( feb_entry.first )){
if(m_LArOnlineIDHelper->pos_neg(feb_entry.first)){
h_summary_plot1_EMECA->SetBinContent( atoi(tmp[0])+1, atoi(tmp[1])+1, tmp_maxcorr);
h_summary_plot2_EMECA->SetBinContent( atoi(tmp[0])+1, atoi(tmp[1])+1, tmp_RMS);
}
else{
h_summary_plot1_EMECC->SetBinContent( atoi(tmp[0])+1, atoi(tmp[1])+1, tmp_maxcorr);
h_summary_plot2_EMECC->SetBinContent( atoi(tmp[0])+1, atoi(tmp[1])+1, tmp_RMS);
}
}
// HEC
else if(m_LArOnlineIDHelper->isHECchannel( feb_entry.first )){
if(m_LArOnlineIDHelper->pos_neg(feb_entry.first)){
h_summary_plot1_HECA->SetBinContent( atoi(tmp[0])+1, atoi(tmp[1])+1, tmp_maxcorr );
h_summary_plot2_HECA->SetBinContent( atoi(tmp[0])+1, atoi(tmp[1])+1, tmp_RMS );
}
else{
h_summary_plot1_HECC->SetBinContent( atoi(tmp[0])+1, atoi(tmp[1])+1, tmp_maxcorr );
h_summary_plot2_HECC->SetBinContent( atoi(tmp[0])+1, atoi(tmp[1])+1, tmp_RMS );
}
}
// FCAL
else if(m_LArOnlineIDHelper->isFCALchannel( feb_entry.first )){
if(m_LArOnlineIDHelper->pos_neg(feb_entry.first)){
h_summary_plot1_FCALA->SetBinContent( atoi(tmp[0])+1, atoi(tmp[1])+1, tmp_maxcorr );
h_summary_plot2_FCALA->SetBinContent( atoi(tmp[0])+1, atoi(tmp[1])+1, tmp_RMS );
}
else{
h_summary_plot1_FCALC->SetBinContent( atoi(tmp[0])+1, atoi(tmp[1])+1, tmp_maxcorr );
h_summary_plot2_FCALC->SetBinContent( atoi(tmp[0])+1, atoi(tmp[1])+1, tmp_RMS );
}
}
}
}
// Delete them in order to save the memory
delete hist_tmp_correlation;
}
}
/*---------------------------------------------------------*/
/**Loops on selected FEBS to book and define histograms.*/
void LArNoiseCorrelationMon::bookSelectedFEBs(MonGroup& grEMBA,MonGroup& grEMBC,MonGroup& grEMECA,MonGroup& grEMECC,MonGroup& grHECA,MonGroup& grHECC,MonGroup& grFCALA,MonGroup& grFCALC)
......@@ -425,6 +543,41 @@ void LArNoiseCorrelationMon::bookSelectedFEBs(MonGroup& grEMBA,MonGroup& grEMBC,
}
bookThisFEB(febid,grEMBA,grEMBC,grEMECA,grEMECC,grHECA,grHECC,grFCALA,grFCALC);
}
// summary plot
if(m_DoSummary){
h_summary_plot1_EMBA = TH2F_LW::create(hist_summary_name1.c_str(), "Summary1 plot EMBA" ,16, 0, 16, 34, 0, 34);
h_summary_plot1_EMBC = TH2F_LW::create(hist_summary_name1.c_str(), "Summary1 plot EMBC" ,16, 0, 16, 34, 0, 34);
h_summary_plot1_EMECA = TH2F_LW::create(hist_summary_name1.c_str(), "Summary1 plot EMECA" ,16, 0, 16, 34, 0, 34);
h_summary_plot1_EMECC = TH2F_LW::create(hist_summary_name1.c_str(), "Summary1 plot EMECC" ,16, 0, 16, 34, 0, 34);
h_summary_plot1_HECA = TH2F_LW::create(hist_summary_name1.c_str(), "Summary1 plot HECA" ,16, 0, 16, 34, 0, 34);
h_summary_plot1_HECC = TH2F_LW::create(hist_summary_name1.c_str(), "Summary1 plot HECC" ,16, 0, 16, 34, 0, 34);
h_summary_plot1_FCALA = TH2F_LW::create(hist_summary_name1.c_str(), "Summary1 plot FCALA" ,16, 0, 16, 34, 0, 34);
h_summary_plot1_FCALC = TH2F_LW::create(hist_summary_name1.c_str(), "Summary1 plot FCALC" ,16, 0, 16, 34, 0, 34);
h_summary_plot2_EMBA = TH2F_LW::create(hist_summary_name2.c_str(), "Summary2 plot EMBA" ,16, 0, 16, 34, 0, 34);
h_summary_plot2_EMBC = TH2F_LW::create(hist_summary_name2.c_str(), "Summary2 plot EMBC" ,16, 0, 16, 34, 0, 34);
h_summary_plot2_EMECA = TH2F_LW::create(hist_summary_name2.c_str(), "Summary2 plot EMECA" ,16, 0, 16, 34, 0, 34);
h_summary_plot2_EMECC = TH2F_LW::create(hist_summary_name2.c_str(), "Summary2 plot EMECC" ,16, 0, 16, 34, 0, 34);
h_summary_plot2_HECA = TH2F_LW::create(hist_summary_name2.c_str(), "Summary2 plot HECA" ,16, 0, 16, 34, 0, 34);
h_summary_plot2_HECC = TH2F_LW::create(hist_summary_name2.c_str(), "Summary2 plot HECC" ,16, 0, 16, 34, 0, 34);
h_summary_plot2_FCALA = TH2F_LW::create(hist_summary_name2.c_str(), "Summary2 plot FCALA" ,16, 0, 16, 34, 0, 34);
h_summary_plot2_FCALC = TH2F_LW::create(hist_summary_name2.c_str(), "Summary2 plot FCALC" ,16, 0, 16, 34, 0, 34);
grEMBA.regHist(h_summary_plot1_EMBA).ignore();
grEMBC.regHist(h_summary_plot1_EMBC).ignore();
grEMECA.regHist(h_summary_plot1_EMECA).ignore();
grEMECC.regHist(h_summary_plot1_EMECC).ignore();
grHECA.regHist(h_summary_plot1_HECA).ignore();
grHECC.regHist(h_summary_plot1_HECC).ignore();
grFCALA.regHist(h_summary_plot1_FCALA).ignore();
grFCALC.regHist(h_summary_plot1_FCALC).ignore();
grEMBA.regHist(h_summary_plot2_EMBA).ignore();
grEMBC.regHist(h_summary_plot2_EMBC).ignore();
grEMECA.regHist(h_summary_plot2_EMECA).ignore();
grEMECC.regHist(h_summary_plot2_EMECC).ignore();
grHECA.regHist(h_summary_plot2_HECA).ignore();
grHECC.regHist(h_summary_plot2_HECC).ignore();
grFCALA.regHist(h_summary_plot2_FCALA).ignore();
grFCALC.regHist(h_summary_plot2_FCALC).ignore();
}
}
......@@ -440,6 +593,44 @@ void LArNoiseCorrelationMon::bookAllFEBs(MonGroup& grEMBA,MonGroup& grEMBC,MonGr
for ( ; feb_it!=feb_it_e;++feb_it) {
bookThisFEB((*feb_it),grEMBA,grEMBC,grEMECA,grEMECC,grHECA,grHECC,grFCALA,grFCALC);
}
// summary plot
if(m_DoSummary){
h_summary_plot1_EMBA = TH2F_LW::create(hist_summary_name1.c_str(), "Summary1 plot EMBA" ,16, 0, 16, 34, 0, 34);
h_summary_plot1_EMBC = TH2F_LW::create(hist_summary_name1.c_str(), "Summary1 plot EMBC" ,16, 0, 16, 34, 0, 34);
h_summary_plot1_EMECA = TH2F_LW::create(hist_summary_name1.c_str(), "Summary1 plot EMECA" ,16, 0, 16, 34, 0, 34);
h_summary_plot1_EMECC = TH2F_LW::create(hist_summary_name1.c_str(), "Summary1 plot EMECC" ,16, 0, 16, 34, 0, 34);
h_summary_plot1_HECA = TH2F_LW::create(hist_summary_name1.c_str(), "Summary1 plot HECA" ,16, 0, 16, 34, 0, 34);
h_summary_plot1_HECC = TH2F_LW::create(hist_summary_name1.c_str(), "Summary1 plot HECC" ,16, 0, 16, 34, 0, 34);
h_summary_plot1_FCALA = TH2F_LW::create(hist_summary_name1.c_str(), "Summary1 plot FCALA" ,16, 0, 16, 34, 0, 34);
h_summary_plot1_FCALC = TH2F_LW::create(hist_summary_name1.c_str(), "Summary1 plot FCALC" ,16, 0, 16, 34, 0, 34);
h_summary_plot2_EMBA = TH2F_LW::create(hist_summary_name2.c_str(), "Summary2 plot EMBA" ,16, 0, 16, 34, 0, 34);
h_summary_plot2_EMBC = TH2F_LW::create(hist_summary_name2.c_str(), "Summary2 plot EMBC" ,16, 0, 16, 34, 0, 34);
h_summary_plot2_EMECA = TH2F_LW::create(hist_summary_name2.c_str(), "Summary2 plot EMECA" ,16, 0, 16, 34, 0, 34);
h_summary_plot2_EMECC = TH2F_LW::create(hist_summary_name2.c_str(), "Summary2 plot EMECC" ,16, 0, 16, 34, 0, 34);
h_summary_plot2_HECA = TH2F_LW::create(hist_summary_name2.c_str(), "Summary2 plot HECA" ,16, 0, 16, 34, 0, 34);
h_summary_plot2_HECC = TH2F_LW::create(hist_summary_name2.c_str(), "Summary2 plot HECC" ,16, 0, 16, 34, 0, 34);
h_summary_plot2_FCALA = TH2F_LW::create(hist_summary_name2.c_str(), "Summary2 plot FCALA" ,16, 0, 16, 34, 0, 34);
h_summary_plot2_FCALC = TH2F_LW::create(hist_summary_name2.c_str(), "Summary2 plot FCALC" ,16, 0, 16, 34, 0, 34);
grEMBA.regHist(h_summary_plot1_EMBA).ignore();
grEMBC.regHist(h_summary_plot1_EMBC).ignore();
grEMECA.regHist(h_summary_plot1_EMECA).ignore();
grEMECC.regHist(h_summary_plot1_EMECC).ignore();
grHECA.regHist(h_summary_plot1_HECA).ignore();
grHECC.regHist(h_summary_plot1_HECC).ignore();
grFCALA.regHist(h_summary_plot1_FCALA).ignore();
grFCALC.regHist(h_summary_plot1_FCALC).ignore();
grEMBA.regHist(h_summary_plot2_EMBA).ignore();
grEMBC.regHist(h_summary_plot2_EMBC).ignore();
grEMECA.regHist(h_summary_plot2_EMECA).ignore();
grEMECC.regHist(h_summary_plot2_EMECC).ignore();
grHECA.regHist(h_summary_plot2_HECA).ignore();
grHECC.regHist(h_summary_plot2_HECC).ignore();
grFCALA.regHist(h_summary_plot2_FCALA).ignore();
grFCALC.regHist(h_summary_plot2_FCALC).ignore();
}
}
/*---------------------------------------------------------*/
......@@ -447,7 +638,11 @@ void LArNoiseCorrelationMon::bookAllFEBs(MonGroup& grEMBA,MonGroup& grEMBC,MonGr
void LArNoiseCorrelationMon::bookThisFEB(HWIdentifier id,MonGroup& grEMBA,MonGroup& grEMBC,MonGroup& grEMECA,MonGroup& grEMECC,MonGroup& grHECA,MonGroup& grHECC,MonGroup& grFCALA,MonGroup& grFCALC)
{
std::string this_name=m_strHelper->feb_str(id);
TH2F_LW* h_corr = TH2F_LW::create((hist_name+this_name).c_str(), hist_title.c_str(),Nchan,chan_low,chan_up,Nchan,chan_low,chan_up);
int num_slot = m_LArOnlineIDHelper->slot(id);
int num_feedthrough = m_LArOnlineIDHelper->feedthrough(id);
std::string slot_feed_title = std::to_string(num_slot) + "_" + std::to_string(num_feedthrough);
TH2F_LW* h_corr = TH2F_LW::create((hist_name+this_name).c_str(), slot_feed_title.c_str(), Nchan,chan_low,chan_up,Nchan,chan_low,chan_up);
TH2F_LW* h_TMP_sums = TH2F_LW::create((hist_name+this_name+"_TMP_sum").c_str(),(hist_title+" TMP sum").c_str(),Nchan,chan_low,chan_up,Nchan,chan_low,chan_up);
TProfile_LW* h_av = TProfile_LW::create((hist_name+this_name+"_TMP_av").c_str(),(hist_title+" TMP av").c_str(),Nchan,chan_low,chan_up,"s");
m_FEBhistograms[id]=std::make_pair(h_corr,std::make_pair(h_TMP_sums,h_av));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment