|
ATLAS Offline Software
|
Go to the documentation of this file.
7 #include "GaudiKernel/MsgStream.h"
8 #include "GaudiKernel/IIncidentSvc.h"
9 #include "CLHEP/Units/SystemOfUnits.h"
28 const std::string&
name,
34 m_omega(1.024e6*
hertz)
36 declareProperty(
"BeginRunPriority",
m_priority);
37 declareProperty(
"SignalCutInSigma",
m_nSigma);
38 declareProperty(
"Omega",
m_omega);
43 ATH_MSG_DEBUG (
"LArDigitOscillationCorrTool initialize() begin" );
55 SmartIF<IIncidentSvc> incSvc{Gaudi::svcLocator()->service(
"IncidentSvc")};
59 incSvc->addListener(
this,
"BeginRun",
m_priority);
61 ATH_MSG_DEBUG (
"LArDigitOscillationCorrTool initialize() end" );
62 return StatusCode::SUCCESS;
75 ATH_MSG_DEBUG (
"Retrieving channel phases and amplituides " );
78 unsigned int iHECChan(0);
79 std::vector<std::vector<short> > theSamples;
80 std::vector<float> thePedestals;
81 std::vector<double> theChannelAmplitudes;
82 std::vector<double> theChannelPhases;
83 std::vector<float> theRMSValues;
92 return StatusCode::FAILURE;
96 for (
unsigned int i=0;
i<theDC.
size();
i++) {
99 const std::vector<short>& samples = theDigit->
samples();
114 ATH_MSG_DEBUG (
"No pedestal RMS found for this cell. Exiting ...." );
115 return StatusCode::FAILURE;
118 const double& DBchannelPhase=larH6Oscillations->
channelPhase(chid);
122 if( DBpedestalRMS > 0 && DBchannelAmplitude>0 ) {
123 theRMSValues.push_back(DBpedestalRMS);
124 theSamples.push_back(samples);
125 theChannelPhases.push_back(DBchannelPhase);
126 theChannelAmplitudes.push_back(DBchannelAmplitude);
129 thePedestals.push_back(DBpedestal);
131 ATH_MSG_DEBUG (
"No valid pedestal found for this cell. Exiting ...." );
132 return StatusCode::FAILURE;
142 for(
double myEventPhase = -
M_PI; myEventPhase<
M_PI; myEventPhase+=0.1) {
144 for (
unsigned int i=0;
i<iHECChan;
i++) {
145 unsigned int nSamples = theSamples[
i].size();
146 for(
unsigned int j=0;j<
nSamples;j++) {
149 if ( j == 0 || (std::abs(theSamples[
i][j] - theSamples[
i][0]) <=
m_nSigma*theRMSValues[
i]
150 && ( j <= 0 || std::abs(theSamples[
i][j-1] - theSamples[
i][0]) <=
m_nSigma*theRMSValues[
i])
151 && ( j >=
nSamples-1 || std::abs(theSamples[
i][j+1] - theSamples[
i][0]) <=
m_nSigma*theRMSValues[
i])) ) {
155 lchitest +=
pow((theSamples[
i][j] - thePedestals[
i]
157 +theChannelPhases[
i]+myEventPhase))
162 if ( lchitest < lchimin || lchimin < 0 ) {
168 ATH_MSG_DEBUG (
"Ending eventphase calculation. Phase = <" <<
m_eventPhase <<
">, Number of Channels used = <" << iHECChan <<
">, Average Number of Samples Used = <"
169 << (iHECChan > 0 ? (
double)nTotSamples/iHECChan : 0)
171 return StatusCode::SUCCESS;
183 std::vector<double> theChannelAmplitudes;
184 std::vector<double> theChannelPhases;
193 return StatusCode::FAILURE;
196 for (
unsigned int i=0;
i<theDC.
size();
i++) {
199 const std::vector<short>& samples = theDigit->
samples();
200 unsigned int nSamples = samples.size();
213 const double& DBchannelPhase=larH6Oscillations->
channelPhase(chid);
217 <<
", the ChannelAmplitude is " << DBchannelAmplitude
218 <<
", the ChannelPhase is " << DBchannelPhase );
220 if( DBchannelAmplitude>0 ) {
221 std::vector<short> new_samples(
nSamples);
222 for(
unsigned int j=0;j<
nSamples;j++)
223 new_samples[j] = (
short)(samples[j] + 0.5
228 theDC[
i] = theNewDigit;
232 return StatusCode::SUCCESS;
247 return StatusCode::SUCCESS;
def retrieve(aClass, aKey=None)
virtual float pedestal(const HWIdentifier &id, int gain) const =0
const LArEM_ID * em_idHelper() const
access to EM idHelper
const std::vector< short > & samples() const
const std::string & key() const
Return the StoreGate ID for the referenced object.
const LArHEC_ID * hec_idHelper() const
access to HEC idHelper
Liquid Argon digit base class.
::StatusCode StatusCode
StatusCode definition for legacy code.
bool is_lar_hec(Identifier id) const
Helper class for offline cell identifiers.
virtual const double & channelAmplitude(const HWIdentifier &id) const =0
access to channel amplitude index by Identifier
StatusCode initialize(bool used=true)
CaloGain::CaloGain gain() const
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
virtual const double & channelPhase(const HWIdentifier &id) const =0
Container class for LArDigit.
const HWIdentifier & channelID() const
constexpr int pow(int base, int exp) noexcept
virtual float pedestalRMS(const HWIdentifier &id, int gain) const =0
access to RMS of Pedestal index by Identifier, and gain setting
size_type size() const noexcept
Returns the number of elements in the collection.
const LArFCAL_ID * fcal_idHelper() const
access to FCAL idHelper