![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
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),
35 m_emId(nullptr), m_fcalId(nullptr), m_hecId(nullptr), m_lar_on_id(nullptr)
37 declareInterface<ILArDigitOscillationCorrTool>(
this);
45 ATH_MSG_DEBUG (
"LArDigitOscillationCorrTool initialize() begin" );
57 IIncidentSvc* incSvc =
nullptr;
58 ATH_CHECK( service(
"IncidentSvc", incSvc) );
61 incSvc->addListener(
this,
"BeginRun",
m_priority);
63 ATH_MSG_DEBUG (
"LArDigitOscillationCorrTool initialize() end" );
64 return StatusCode::SUCCESS;
77 ATH_MSG_DEBUG (
"Retrieving channel phases and amplituides " );
80 unsigned int iHECChan(0);
81 std::vector<std::vector<short> > theSamples;
82 std::vector<float> thePedestals;
83 std::vector<double> theChannelAmplitudes;
84 std::vector<double> theChannelPhases;
85 std::vector<float> theRMSValues;
94 return StatusCode::FAILURE;
98 for (
unsigned int i=0;
i<theDC.
size();
i++) {
116 ATH_MSG_DEBUG (
"No pedestal RMS found for this cell. Exiting ...." );
117 return StatusCode::FAILURE;
120 const double& DBchannelPhase=larH6Oscillations->
channelPhase(chid);
124 if( DBpedestalRMS > 0 && DBchannelAmplitude>0 ) {
125 theRMSValues.push_back(DBpedestalRMS);
127 theChannelPhases.push_back(DBchannelPhase);
128 theChannelAmplitudes.push_back(DBchannelAmplitude);
131 thePedestals.push_back(DBpedestal);
133 ATH_MSG_DEBUG (
"No valid pedestal found for this cell. Exiting ...." );
134 return StatusCode::FAILURE;
144 for(
double myEventPhase = -
M_PI; myEventPhase<
M_PI; myEventPhase+=0.1) {
146 for (
unsigned int i=0;
i<iHECChan;
i++) {
147 unsigned int nSamples = theSamples[
i].size();
148 for(
unsigned int j=0;j<
nSamples;j++) {
151 if ( j == 0 || (std::abs(theSamples[
i][j] - theSamples[
i][0]) <=
m_nSigma*theRMSValues[
i]
152 && ( j <= 0 || std::abs(theSamples[
i][j-1] - theSamples[
i][0]) <=
m_nSigma*theRMSValues[
i])
153 && ( j >=
nSamples-1 || std::abs(theSamples[
i][j+1] - theSamples[
i][0]) <=
m_nSigma*theRMSValues[
i])) ) {
157 lchitest +=
pow((theSamples[
i][j] - thePedestals[
i]
159 +theChannelPhases[
i]+myEventPhase))
164 if ( lchitest < lchimin || lchimin < 0 ) {
170 ATH_MSG_DEBUG (
"Ending eventphase calculation. Phase = <" <<
m_eventPhase <<
">, Number of Channels used = <" << iHECChan <<
">, Average Number of Samples Used = <"
171 << (iHECChan > 0 ? (
double)nTotSamples/iHECChan : 0)
173 return StatusCode::SUCCESS;
185 std::vector<double> theChannelAmplitudes;
186 std::vector<double> theChannelPhases;
195 return StatusCode::FAILURE;
198 for (
unsigned int i=0;
i<theDC.
size();
i++) {
215 const double& DBchannelPhase=larH6Oscillations->
channelPhase(chid);
219 <<
", the ChannelAmplitude is " << DBchannelAmplitude
220 <<
", the ChannelPhase is " << DBchannelPhase );
222 if( DBchannelAmplitude>0 ) {
223 std::vector<short> new_samples(
nSamples);
224 for(
unsigned int j=0;j<
nSamples;j++)
225 new_samples[j] = (
short)(
samples[j] + 0.5
230 theDC[
i] = theNewDigit;
234 return StatusCode::SUCCESS;
249 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
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
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
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
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
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