72 ATH_CHECK( detStore()->retrieve(larPedestal) );
75 ATH_MSG_DEBUG (
"Retrieving channel phases and amplituides " );
77 ATH_CHECK( detStore()->retrieve(larH6Oscillations) );
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();
104 const Identifier id = cabling->cnvToIdentifier(chid);
112 float DBpedestalRMS=larPedestal->
pedestalRMS(chid,gain);
114 ATH_MSG_DEBUG (
"No pedestal RMS found for this cell. Exiting ...." );
115 return StatusCode::FAILURE;
117 const double& DBchannelPhase=larH6Oscillations->
channelPhase(chid);
120 if( DBpedestalRMS > 0 && DBchannelAmplitude>0 ) {
121 theRMSValues.push_back(DBpedestalRMS);
122 theSamples.push_back(samples);
123 theChannelPhases.push_back(DBchannelPhase);
124 theChannelAmplitudes.push_back(DBchannelAmplitude);
125 float DBpedestal=larPedestal->
pedestal(chid,gain);
127 thePedestals.push_back(DBpedestal);
129 ATH_MSG_DEBUG (
"No valid pedestal found for this cell. Exiting ...." );
130 return StatusCode::FAILURE;
140 for(
double myEventPhase = -
M_PI; myEventPhase<
M_PI; myEventPhase+=0.1) {
142 for (
unsigned int i=0;i<iHECChan;i++) {
143 unsigned int nSamples = theSamples[i].size();
144 for(
unsigned int j=0;j<nSamples;j++) {
147 if ( j == 0 || (std::abs(theSamples[i][j] - theSamples[i][0]) <=
m_nSigma*theRMSValues[i]
148 && ( j <= 0 || std::abs(theSamples[i][j-1] - theSamples[i][0]) <=
m_nSigma*theRMSValues[i])
149 && ( j >= nSamples-1 || std::abs(theSamples[i][j+1] - theSamples[i][0]) <=
m_nSigma*theRMSValues[i])) ) {
153 lchitest +=
pow((theSamples[i][j] - thePedestals[i]
154 - theChannelAmplitudes[i]*sin(j*25*ns*
m_omega
155 +theChannelPhases[i]+myEventPhase))
160 if ( lchitest < lchimin || lchimin < 0 ) {
166 ATH_MSG_DEBUG (
"Ending eventphase calculation. Phase = <" <<
m_eventPhase <<
">, Number of Channels used = <" << iHECChan <<
">, Average Number of Samples Used = <"
167 << (iHECChan > 0 ? (
double)nTotSamples/iHECChan : 0)
169 return StatusCode::SUCCESS;
179 ATH_CHECK( detStore()->retrieve(larH6Oscillations) );
181 std::vector<double> theChannelAmplitudes;
182 std::vector<double> theChannelPhases;
191 return StatusCode::FAILURE;
194 for (
unsigned int i=0;i<theDC.
size();i++) {
197 const std::vector<short>& samples = theDigit->
samples();
198 unsigned int nSamples = samples.size();
203 const Identifier id = cabling->cnvToIdentifier(chid);
211 const double& DBchannelPhase=larH6Oscillations->
channelPhase(chid);
214 <<
", the offline Id is " <<
m_hecId->show_to_string(
id,
nullptr,
'/')
215 <<
", the ChannelAmplitude is " << DBchannelAmplitude
216 <<
", the ChannelPhase is " << DBchannelPhase );
218 if( DBchannelAmplitude>0 ) {
219 std::vector<short> new_samples(nSamples);
220 for(
unsigned int j=0;j<nSamples;j++)
221 new_samples[j] = (
short)(samples[j] + 0.5
226 theDC[i] = theNewDigit;
230 return StatusCode::SUCCESS;
virtual float pedestalRMS(const HWIdentifier &id, int gain) const =0
access to RMS of Pedestal index by Identifier, and gain setting