Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HCAL: bug fixed in DPGAnalysis/HcalTools for 2023 Run3 #40732

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
61 changes: 29 additions & 32 deletions DPGAnalysis/HcalTools/plugins/CMTRawAnalyzer.cc
@@ -1,6 +1,5 @@
// -*- C++ -*-
//
//
// Package: CMTRawAnalyzer
//
#include <fstream>
Expand All @@ -9,7 +8,6 @@
#include <iosfwd>
#include <bitset>
#include <memory>

#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/PluginManager/interface/ModuleDef.h"
Expand All @@ -18,7 +16,6 @@
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include "CommonTools/UtilAlgos/interface/TFileService.h"
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
#include "DataFormats/HcalDetId/interface/HcalElectronicsId.h"
Expand Down Expand Up @@ -67,8 +64,8 @@
#include "TF1.h"

#define NUMADCS 256
double adc2fC_QIE10[NUMADCS] = {
// - - - - - - - range 0 - - - - - - - -
double const adc2fC_QIE10[NUMADCS] = {
// - - - - - - - - - - range 0 - - - - - - - - - - -
//subrange0
1.58,
4.73,
Expand Down Expand Up @@ -8821,23 +8818,23 @@ void CMTRawAnalyzer::fillDigiAmplitude(HBHEDigiCollection::const_iterator& digiI
pedestalaver4 /= c4;
pedestalwaver9 = sqrt(pedestalwaver9 / TSsize);
pedestalwaver4 = sqrt(pedestalwaver4 / c4);
if (ts_with_max_signal > -1 && ts_with_max_signal < 10)
if (ts_with_max_signal > 0 && ts_with_max_signal < TSsize)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why here and in the following you have "> 0" and you have "> -1" in all other cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in principle, it does not matter, but -1 is more correct, Thank you !

ampl = tool[ts_with_max_signal];
if (ts_with_max_signal + 2 > -1 && ts_with_max_signal + 2 < 10)
if (ts_with_max_signal + 2 > 0 && ts_with_max_signal + 2 < TSsize)
ampl += tool[ts_with_max_signal + 2];
if (ts_with_max_signal + 1 > -1 && ts_with_max_signal + 1 < 10)
if (ts_with_max_signal + 1 > -1 && ts_with_max_signal + 1 < TSsize)
ampl += tool[ts_with_max_signal + 1];
if (ts_with_max_signal - 1 > -1 && ts_with_max_signal - 1 < 10)
if (ts_with_max_signal - 1 > -1 && ts_with_max_signal - 1 < TSsize)
ampl += tool[ts_with_max_signal - 1];

///---------------------------------------------------------------------------------------------------- for raddam:
if (ts_with_max_signal > -1 && ts_with_max_signal < 10)
if (ts_with_max_signal > -1 && ts_with_max_signal < TSsize)
linamplitudewithoutPedSubtr = lintoolwithoutPedSubtr[ts_with_max_signal];
if (ts_with_max_signal + 2 > -1 && ts_with_max_signal + 2 < 10)
if (ts_with_max_signal + 2 > -1 && ts_with_max_signal + 2 < TSsize)
linamplitudewithoutPedSubtr += lintoolwithoutPedSubtr[ts_with_max_signal + 2];
if (ts_with_max_signal + 1 > -1 && ts_with_max_signal + 1 < 10)
if (ts_with_max_signal + 1 > -1 && ts_with_max_signal + 1 < TSsize)
linamplitudewithoutPedSubtr += lintoolwithoutPedSubtr[ts_with_max_signal + 1];
if (ts_with_max_signal - 1 > -1 && ts_with_max_signal - 1 < 10)
if (ts_with_max_signal - 1 > -1 && ts_with_max_signal - 1 < TSsize)
linamplitudewithoutPedSubtr += lintoolwithoutPedSubtr[ts_with_max_signal - 1];

double ratio = 0.;
Expand Down Expand Up @@ -9521,13 +9518,13 @@ void CMTRawAnalyzer::fillDigiAmplitude(HBHEDigiCollection::const_iterator& digiI
double amplitudewithPedSubtr = 0.;

//for cut on A_channel:
if (ts_with_max_signal > -1 && ts_with_max_signal < 10)
if (ts_with_max_signal > -1 && ts_with_max_signal < TSsize)
amplitudewithPedSubtr = toolwithPedSubtr[ts_with_max_signal];
if (ts_with_max_signal + 2 > -1 && ts_with_max_signal + 2 < 10)
if (ts_with_max_signal + 2 > -1 && ts_with_max_signal + 2 < TSsize)
amplitudewithPedSubtr += toolwithPedSubtr[ts_with_max_signal + 2];
if (ts_with_max_signal + 1 > -1 && ts_with_max_signal + 1 < 10)
if (ts_with_max_signal + 1 > -1 && ts_with_max_signal + 1 < TSsize)
amplitudewithPedSubtr += toolwithPedSubtr[ts_with_max_signal + 1];
if (ts_with_max_signal - 1 > -1 && ts_with_max_signal - 1 < 10)
if (ts_with_max_signal - 1 > -1 && ts_with_max_signal - 1 < TSsize)
amplitudewithPedSubtr += toolwithPedSubtr[ts_with_max_signal - 1];

h_AamplitudewithPedSubtr_RADDAM_HE->Fill(amplitudewithPedSubtr);
Expand Down Expand Up @@ -9662,7 +9659,7 @@ void CMTRawAnalyzer::fillDigiAmplitudeQIE11(QIE11DataFrame qie11df) {
double amplitude345 = 0.;
double ampl = 0.;
double ampl3ts = 0.;
double amplmaxts = 0.;
// double amplmaxts = 0.;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove the commented out code with these useless variables, here and below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, these commented lines can be removed - thanks.

double timew = 0.;
double timeww = 0.;
double max_signal = -100.;
Expand Down Expand Up @@ -9786,20 +9783,20 @@ void CMTRawAnalyzer::fillDigiAmplitudeQIE11(QIE11DataFrame qie11df) {
pedestalwaver4 = sqrt(pedestalwaver4 / c4);

// ------------ to get signal in TS: -2 max +1 ------------
if (ts_with_max_signal > -1 && ts_with_max_signal < 10) {
if (ts_with_max_signal > -1 && ts_with_max_signal < TSsize) {
ampl = tool[ts_with_max_signal];
ampl3ts = tool[ts_with_max_signal];
amplmaxts = tool[ts_with_max_signal];
// amplmaxts = tool[ts_with_max_signal];
}
if (ts_with_max_signal - 1 > -1 && ts_with_max_signal - 1 < 10) {
if (ts_with_max_signal - 1 > -1 && ts_with_max_signal - 1 < TSsize) {
ampl += tool[ts_with_max_signal - 1];
ampl3ts += tool[ts_with_max_signal - 1];
}
if (ts_with_max_signal + 1 > -1 && ts_with_max_signal + 1 < 10) {
if (ts_with_max_signal + 1 > -1 && ts_with_max_signal + 1 < TSsize) {
ampl += tool[ts_with_max_signal + 1];
ampl3ts += tool[ts_with_max_signal + 1];
}
if (ts_with_max_signal + 2 > -1 && ts_with_max_signal + 2 < 10) {
if (ts_with_max_signal + 2 > -1 && ts_with_max_signal + 2 < TSsize) {
ampl += tool[ts_with_max_signal + 2];
}
// HE charge correction for SiPMs:
Expand All @@ -9809,7 +9806,7 @@ void CMTRawAnalyzer::fillDigiAmplitudeQIE11(QIE11DataFrame qie11df) {
double xb = ampl / 40.;
double xc = amplitude345 / 40.;
double xd = ampl3ts / 40.;
double xe = amplmaxts / 40.;
// double xe = amplmaxts / 40.;
double txa = tocampl / 40.;
// ADDI case:
if (((ieta == -16 || ieta == 15) && mdepth == 4) ||
Expand All @@ -9822,15 +9819,15 @@ void CMTRawAnalyzer::fillDigiAmplitudeQIE11(QIE11DataFrame qie11df) {
double corrforxb = a2 * xb * xb + b1 * xb + c0;
double corrforxc = a2 * xc * xc + b1 * xc + c0;
double corrforxd = a2 * xd * xd + b1 * xd + c0;
double corrforxe = a2 * xe * xe + b1 * xe + c0;
// double corrforxe = a2 * xe * xe + b1 * xe + c0;
double corrfortxa = a2 * txa * txa + b1 * txa + c0;
h_corrforxaADDI_HE->Fill(amplitude, corrforxa);
h_corrforxaADDI0_HE->Fill(amplitude, 1.);
amplitude *= corrforxa;
ampl *= corrforxb;
amplitude345 *= corrforxc;
ampl3ts *= corrforxd;
amplmaxts *= corrforxe;
// amplmaxts *= corrforxe;
tocampl *= corrfortxa;
}
// MAIN case:
Expand All @@ -9842,15 +9839,15 @@ void CMTRawAnalyzer::fillDigiAmplitudeQIE11(QIE11DataFrame qie11df) {
double corrforxb = a2 * xb * xb + b1 * xb + c0;
double corrforxc = a2 * xc * xc + b1 * xc + c0;
double corrforxd = a2 * xd * xd + b1 * xd + c0;
double corrforxe = a2 * xe * xe + b1 * xe + c0;
// double corrforxe = a2 * xe * xe + b1 * xe + c0;
double corrfortxa = a2 * txa * txa + b1 * txa + c0;
h_corrforxaMAIN_HE->Fill(amplitude, corrforxa);
h_corrforxaMAIN0_HE->Fill(amplitude, 1.);
amplitude *= corrforxa;
ampl *= corrforxb;
amplitude345 *= corrforxc;
ampl3ts *= corrforxd;
amplmaxts *= corrforxe;
// amplmaxts *= corrforxe;
tocampl *= corrfortxa;
}
} // sub == 2 HE charge correction end
Expand Down Expand Up @@ -11933,13 +11930,13 @@ void CMTRawAnalyzer::fillDigiAmplitudeHO(HODigiCollection::const_iterator& digiI
pedestalaver4 /= c4;
pedestalwaver9 = sqrt(pedestalwaver9 / TSsize);
pedestalwaver4 = sqrt(pedestalwaver4 / c4);
if (ts_with_max_signal > -1 && ts_with_max_signal < 10)
if (ts_with_max_signal > -1 && ts_with_max_signal < TSsize)
ampl = tool[ts_with_max_signal];
if (ts_with_max_signal + 2 > -1 && ts_with_max_signal + 2 < 10)
if (ts_with_max_signal + 2 > -1 && ts_with_max_signal + 2 < TSsize)
ampl += tool[ts_with_max_signal + 2];
if (ts_with_max_signal + 1 > -1 && ts_with_max_signal + 1 < 10)
if (ts_with_max_signal + 1 > -1 && ts_with_max_signal + 1 < TSsize)
ampl += tool[ts_with_max_signal + 1];
if (ts_with_max_signal - 1 > -1 && ts_with_max_signal - 1 < 10)
if (ts_with_max_signal - 1 > -1 && ts_with_max_signal - 1 < TSsize)
ampl += tool[ts_with_max_signal - 1];
double ratio = 0.;
if (amplitude != 0.)
Expand Down