ATLAS Offline Software
LArWFParamTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
12 
13 #include <cmath>
14 #ifndef __APPLE__
15 #include <values.h>
16 #else
17 #include <float.h>
18 #endif
19 #include <cassert>
20 
21 #ifndef LAR_MAX_DOUBLE
22 #ifndef __APPLE__
23 #define LAR_MAX_DOUBLE MAXDOUBLE
24 #else
25 #define LAR_MAX_DOUBLE __DBL_MAX__
26 #endif
27 #endif
28 
29 const double LArWFParamTool::m_DEFAULT = -1;
30 const double LArWFParamTool::m_TINY=2.22045e-16;
31 const double LArWFParamTool::m_SQRT_EPSILON=1.49012e-08;
32 const double LArWFParamTool::m_EPSILON=2.22045e-16;
33 
34 //double fminbr(double a, double b, double (*f)(double), double tol);
35 
36 LArWFParamTool::LArWFParamTool ( const std::string& type, const std::string& name,const IInterface* parent )
38  m_NBaseline(0),
39  m_ShiftToStart(false),
40  m_SubtractBaseline(false),
41  m_UseOmegaScanHelper(false)
42 {
43 
44  // Declare additional interface
45  declareInterface<LArWFParamTool>(this);
46 
47  declareProperty("NBaseline", m_NBaseline);
48  declareProperty("ShiftToStart", m_ShiftToStart);
49  declareProperty("SubtractBaseline", m_SubtractBaseline);
50  declareProperty("isSC", m_isSC = false);
51 
52  m_DeltaTtail.resize(3);
53  int default_deltattail[3] = { 100, 50, 0 } ;
54  for ( unsigned i=0; i<3; ++i )
55  m_DeltaTtail[i] = default_deltattail[i] ;
56  declareProperty("DeltaTtail", m_DeltaTtail);
57 
58  m_TtailMin.resize(4);
59  m_TtailMax.resize(4);
60  int default_ttailmin[4] = { 0, 0, 0, 0 };
61  int default_ttailmax[4] = { 0, 0, 0, 0 };
62  for ( unsigned i=0; i<4; ++i ) {
63  m_TtailMin[i] = default_ttailmin[i];
64  m_TtailMax[i] = default_ttailmax[i];
65  }
66  declareProperty("TtailMin", m_TtailMin);
67  declareProperty("TtailMax", m_TtailMax);
68 
69  // flags to force cos resp scan:
70  m_cosRespScan.resize(4) ;
71  bool defaults[4] = { false , true , false , true } ;
72  for ( unsigned i=0 ; i<4 ; ++i )
74  declareProperty("CosRespScan", m_cosRespScan ) ;
75 
76 
77  // omega0 intervals and granularities:
78  //float default_omegamin[4] = { 0.01 , 0.47 , 0.10 , 0.30 } ;
79  //float default_omegamax[4] = { 1.00 , 0.48 , 0.30 , 0.60 } ;
80  //unsigned default_npoints[4] = { 100 , 50 , 100 , 100 } ;
81  float default_omegamin[4] = { 0.01 , 0.10 , 0.10 , 0.10 };
82  float default_omegamax[4] = { 1.00 , 0.33 , 0.20 , 0.33 };
83  unsigned default_npoints[4] = { 100 , 100 , 100 , 100 };
84  m_omegamin.resize(4) ;
85  m_omegamax.resize(4) ;
86  m_npoints.resize(4) ;
87  for ( unsigned i=0 ; i<4 ; ++i ) {
88  m_omegamin[i] = default_omegamin[i] ;
89  m_omegamax[i] = default_omegamax[i] ;
90  m_npoints[i] = default_npoints[i] ;
91  }
92  declareProperty("Omega0Min", m_omegamin);
93  declareProperty("Omega0Max", m_omegamax);
94  declareProperty("NpointScan", m_npoints );
95  declareProperty("UseOmegaScanHelper", m_UseOmegaScanHelper );
96 
97  // flags to save residual oscillation
98  m_storeResOscill.resize(4,false) ;
99  declareProperty("StoreResOscill", m_storeResOscill) ;
100 
101  declareProperty("TShaper", m_Tshaper=15.) ;
102 }
103 
104 // destructor
106 = default;
107 
108 //const InterfaceID& LArWFParamTool::interfaceID( )
109 //{ return IID_ILArWFParamTool; }
110 
111 
113 {
114  std::string layerName[4] = { "PS" , "Strips" , "Middle" , "Back" } ;
115 
116  ATH_MSG_INFO( "TShaper set to " << m_Tshaper << " ns" ) ;
117 
118  ATH_MSG_INFO( "Step response (Fstep) -> Ttail = Tmin + " << m_DeltaTtail[0] << " steps" ) ;
119 
121  ATH_MSG_INFO( "Cosine response (Omega0) -> Ttail = Tmin + " << m_DeltaTtail[1] << " steps" ) ;
122  else
123  ATH_MSG_INFO( "Cosine response (Omega0) -> Will use OmegaScanHelper() to dynamically select settings" );
124 
125  ATH_MSG_INFO( "Residual oscillations (Taur) -> Ttail = Tmin + " << m_DeltaTtail[2] << " steps" ) ;
126 
127  for ( unsigned layer=0 ; layer<4 ; ++layer ) {
128  ATH_MSG_INFO( "options for Layer " << layer << " (" << layerName[layer] << ")" ) ;
129 
130  ATH_MSG_INFO( " perform cos resp scan: " );
132  ATH_MSG_INFO( "YES (" << m_npoints[layer] << " points)" ) ;
134  ATH_MSG_INFO( "NO" ) ;
135  if ( m_UseOmegaScanHelper )
136  ATH_MSG_INFO( "Will use OmegaScanHelper() to dynamically select settings" ) ;
137 
138  if (!m_UseOmegaScanHelper) {
139  ATH_MSG_INFO( " search interval: [ " << m_omegamin[layer] << " ; " << m_omegamax[layer] << " ]" ) ;
140  if ( m_omegamin[layer] >= m_omegamax[layer] ) {
141  ATH_MSG_ERROR( "Omega0Min >= Omega0Max in layer " << layer << " -- exit!" ) ;
142  return StatusCode::FAILURE ;
143  }
144  }
145 
146  ATH_MSG_INFO( " store residual oscillation wave:" );
147  if ( m_storeResOscill[layer] ) {
148  ATH_MSG_INFO( "YES" ) ;
149  } else {
150  ATH_MSG_INFO( "NO" ) ;
151  }
152 
153  }
154 
155 
156  StatusCode sc;
157  if ( m_isSC ) {
158  const LArOnline_SuperCellID* ll;
159  ATH_CHECK(detStore()->retrieve(ll, "LArOnline_SuperCellID"));
160  m_onlineHelper = static_cast<const LArOnlineID_Base*>(ll);
161  ATH_MSG_DEBUG("Found the LArOnlineID helper");
162 
163  } else { // m_isSC
164  const LArOnlineID* ll;
165  ATH_CHECK(detStore()->retrieve(ll, "LArOnlineID") );
166  m_onlineHelper = static_cast<const LArOnlineID_Base*>(ll);
167  ATH_MSG_DEBUG(" Found the LArOnlineID helper. ");
168 
169  }
170 
171 
172  const CaloIdManager *caloIdMgr=nullptr;
173  ATH_CHECK( detStore()->retrieve(caloIdMgr));
174  if(!caloIdMgr){
175  ATH_MSG_ERROR( "Could not access CaloIdManager" );
176  return StatusCode::FAILURE;
177  }
178  if ( m_isSC ) {
179  m_emId=caloIdMgr->getEM_SuperCell_ID();
180  } else {
181  m_emId=caloIdMgr->getEM_ID();
182  }
183  if (!m_emId) {
184  ATH_MSG_ERROR( "Could not access lar EM ID helper" );
185  return StatusCode::FAILURE;
186  }
187 
188 
189  return StatusCode::SUCCESS;
190 }
191 
192 
194  const HWIdentifier chid,
195  const CaloGain::CaloGain gain,
196  LArWFParams& wfParams,
197  const LArOnOffIdMapping *cabling,
198  std::optional<LArCaliWave>& omegaScanWave,
199  std::optional<LArCaliWave>& resOscill0,
200  std::optional<LArCaliWave>& resOscill1) const
201 {
202 
203 
204  wfParams.setTshaper(m_Tshaper);
205  LArCaliWave gCali=larCaliWave; //down-cast to LArWave + deep copy (we'll modify the wave)
206 
207  // find m_Tstart, m_Tpeak, m_Tcross, m_Tmin, m_Amplitude
208  WaveTiming_t waveTiming=timeExtr(gCali);
209 
210  // find m_Tcal
211  if ( wfParams.tcal() == DoExtract ) {
212  const double Tcal = expTail(gCali,waveTiming) ;
213  if ( Tcal < 0 ) {
214  ATH_MSG_WARNING( "Could not extract Tcal for " << m_onlineHelper->channel_name(chid)
215  << " gain=" << (int)gain ) ;
216  wfParams.setTcal(FailExtract);
217  return StatusCode::FAILURE;
218  }
219  else {
220  wfParams.setTcal(Tcal);
221  }
222  ATH_MSG_VERBOSE( "set Tcal = " << wfParams.tcal()) ;
223  }
224 
225  // find m_Fstep
226  if ( wfParams.fstep() == DoExtract ) {
227  StatusCode sc = GetFstep(gCali,wfParams,waveTiming);
228  if ( sc.isFailure() ) {
229  ATH_MSG_WARNING( "Could not extract Fstep for " << m_onlineHelper->channel_name(chid)
230  << " gain=" << (int)gain );
231  wfParams.setFstep(FailExtract);
232  return sc ;
233  }
234  } else {
235  ATH_MSG_VERBOSE( "set Fstep = " <<wfParams.fstep() );
236  }
237 
238  // find m_Omega0 using RTM
239  if ( wfParams.omega0() == DoExtract ) {
240  StatusCode sc = RTM_Omega0(gCali,chid,wfParams,waveTiming,cabling,omegaScanWave);
241  if ( sc.isFailure() ) {
242  ATH_MSG_WARNING( "Could not extract Omega0 for " << m_onlineHelper->channel_name(chid)
243  << " gain=" << (int)gain );
244  wfParams.setOmega0(FailExtract) ;
245  return sc ;
246  }
247  } else {
248  ATH_MSG_VERBOSE( "set Omega0 = " << wfParams.omega0());
249  }
250 
251 
252  const Identifier id = cabling->cnvToIdentifier(chid);
253  const unsigned layer=m_emId->sampling(id);
254  if ( m_storeResOscill[ layer ] && resOscill0) {
255  LArWave injres0 = injRespRes(gCali,wfParams.omega0(),0);
256  *resOscill0 = LArCaliWave(injres0.getWave(),gCali.getDt(),gCali.getDAC(), 0x1,LArWave::unknown);
257  }
258 
259  // find m_Taur using RTM
260  if ( wfParams.taur() == DoExtract ) {
261  StatusCode sc = RTM_Taur(gCali, wfParams,waveTiming ) ;
262  if ( sc.isFailure() ) {
263  ATH_MSG_WARNING( "Could not extract Taur for ChID=" << chid.get_compact()
264  << " gain=" << (int)gain ) ;
265  wfParams.setTaur(FailExtract);
266  return sc ;
267  }
268  ATH_MSG_VERBOSE( "set Taur = " << wfParams.taur() );
269  }
270 
271  wfParams.setFlag( 0 ) ; // this should contain the method used to find parameters and the gain
272 
273  if ( m_storeResOscill[ layer ] && resOscill1) {
274  LArWave injres1 = injRespRes(gCali,wfParams.omega0(),wfParams.taur());
275  *resOscill1 = LArCaliWave(injres1.getWave(),gCali.getDt(),gCali.getDAC(), 0x1, LArWave::unknown);
276  }
277 
278  return( StatusCode::SUCCESS );
279 }
280 
281 
282 
284 {
285  WaveTiming_t wt{}; //return object
286 
287  wt.Tstart = m_wHelper.getStart(gCali);
288 
289  const unsigned NBaseline= m_NBaseline==0 ? wt.Tstart : m_NBaseline ;
290 
291  const double baseline = m_wHelper.getBaseline(gCali,NBaseline);
292 
293  if ( m_ShiftToStart ) // move the wave to the start
294  gCali = m_wHelper.translate(gCali, -wt.Tstart, baseline);
295 
296  if ( m_SubtractBaseline ) // remove the baseline
297  gCali = gCali + (-baseline);
298 
299  wt.Tpeak = m_wHelper.getMax(gCali);
300 
301  wt.Amplitude = gCali.getSample(wt.Tpeak);
302 
303  wt.Tmin = m_wHelper.getMin(gCali);
304 
305  wt.Tcross = m_wHelper.getZeroCross(gCali);
306 
307  return wt;
308 }
309 
310 
311 double LArWFParamTool::expTail(const LArWave& gCali, const WaveTiming_t& wt) const
312 {
313  unsigned int t1;
314  unsigned int t2;
315  if ( m_TtailMin[0]!=0 && m_TtailMax[0]!=0 && m_TtailMin[0]<m_TtailMax[0] ) {
316  t1 = m_TtailMin[0];
317  t2 = m_TtailMax[0];
318  } else {
319  const unsigned nAfterMin = 150;
320  const unsigned nBeforeEnd = 125;
321  t1 = wt.Tmin + nAfterMin;
322  t2 = gCali.getSize() - nBeforeEnd ; // last points rejected because sometimes are crazy!
323  }
324  ATH_MSG_VERBOSE( "exp-fitting between " << t1 << " and " << t2 ) ;
325 
326  double A, rho ;
327  std::vector<double> fitPars = m_wHelper.expfit(gCali,t1,t2,rho) ; // fit to B*exp(A*t) function
328  if (fitPars.size() == 2 ) {
329  A = fitPars[1];
330  //B = fitPars[0];
331  } else {
332  return -1;
333  }
334 
335  const double Tcal = -1./A ;
336  if ( Tcal < 0 ) {
337  ATH_MSG_WARNING( "Exponential fit yielded negative Tcal " << Tcal );
338  }
339  ATH_MSG_VERBOSE( "*** Exponential fit\t--> m_Tcal = " << Tcal ) ;
340 
341  return Tcal;
342 }
343 
344 StatusCode LArWFParamTool::GetFstep(const LArWave& gCali, LArWFParams& wfParams, const WaveTiming_t& wt) const
345 {
346  // step response
347  const unsigned Ttail = wt.Tmin + m_DeltaTtail[0];
348  //m_Fstep = 0.; // starting point for iterations
349  const double fstep1=0.0;
350  const double Tcal=wfParams.tcal();
351  wfParams.setFstep(fstepMin(gCali,fstep1,Tcal,Ttail) );
352  //ATH_MSG_VERBOSE( "*** Step response\t--> m_Fstep = " << m_Fstep ) ;
353  return StatusCode::SUCCESS ;
354 }
355 
356 double LArWFParamTool::fstepMin (const LArWave& gCali, double fstep, const double Tc, const unsigned Ttail) const {
357  int niter = 0;
358  //double dfstep;
359  while (1) {
360  niter++ ;
361  const double dfstep = dFstep(gCali,fstep,Tc,Ttail) ;
362  fstep += dfstep ;
363  if ( niter > 50 || fstep < 0. ) {
364  fstep = 0.;
365  break;
366  }
367  if ( fabs( dfstep ) <= m_TINY ) break;
368  }
369  return fstep;
370 }
371 
372 double LArWFParamTool::dFstep (const LArWave& gCali, const double fstep, const double Tc, const unsigned Ttail) const {
373  LArWave stepResp1 = stepResp(gCali, fstep, Tc) ;
374  LArWave dstepRespDfstep1 = dstepRespDfstep(gCali,fstep,Tc) ;
375  //LArWaveHelper wHelper;
376  double a,b;
377  if ( m_TtailMin[1]!=0 && m_TtailMax[1]!=0 && m_TtailMin[1]<m_TtailMax[1] ) {
378  b = m_wHelper.getSumRegion( stepResp1 * dstepRespDfstep1,m_TtailMin[1],m_TtailMax[1]);
379  a = m_wHelper.getSumSquareRegion( dstepRespDfstep1,m_TtailMin[1],m_TtailMax[1]);
380  } else {
381  b = m_wHelper.getSumTail( stepResp1 * dstepRespDfstep1,Ttail);
382  a = m_wHelper.getSumSquareTail( dstepRespDfstep1,Ttail);
383  }
384  return -b/a ;
385 }
386 
387 LArWave LArWFParamTool::stepResp (const LArWave& gCali, const double fstep, const double Tc) {
388  //return m_gCali + m_gCali % stepCorr() ;
389  LArWave result = gCali % stepCorr(gCali, fstep, Tc);
390  result+=gCali;
391  return result;
392 }
393 
394 LArWave LArWFParamTool::stepCorr(const LArWave& gCali, const double& fstep, const double& Tc) {
395  const unsigned N = gCali.getSize() ;
396  const double dt = gCali.getDt() ;
397 
398  LArWave w(N,dt);
399  const double A=(1.-fstep)/Tc;
400  for ( unsigned i=0 ; i<N ; i++ ) {
401  w.setSample(i,A*exp(-fstep*i*dt/Tc));
402  }
403  return w ;
404 }
405 
406 LArWave LArWFParamTool::dstepRespDfstep (const LArWave& gCali, const double& fstep, const double& Tc) const {
407  return gCali % dstepCorrDfstep(gCali,fstep,Tc);
408 }
409 
410 double LArWFParamTool::dstepCorrDfstep (const double t, const double& fstep, const double& Tc ) {
411  return (-1./Tc)*(1.+((1.-fstep)/Tc)*t)*exp(-fstep*t/Tc);
412 }
413 
414 LArWave LArWFParamTool::dstepCorrDfstep(const LArWave& gCali, const double& fstep, const double& Tcal ) {
415  const unsigned N = gCali.getSize() ;
416  const double dt = gCali.getDt() ;
417  LArWave w(N,dt);
418  for ( unsigned i=0 ; i<N ; i++ ) w.setSample(i,dstepCorrDfstep(i*dt,fstep,Tcal)) ;
419  return w ;
420 }
421 
422 StatusCode LArWFParamTool::RTM_Omega0(const LArWave& gCali, const HWIdentifier chid, LArWFParams& wfParams, const WaveTiming_t& wt, const LArOnOffIdMapping *cabling, std::optional<LArCaliWave>& omegaScanWave) const
423 {
424  /* begin of the COSINE RESPONSE analysis */
425 
426  const Identifier id = cabling->cnvToIdentifier(chid);
427  // Define the (raw) minimum research interval (if the Layer card is not set,
428  // uses the wider interval, and default value for the first minimum scan)
429 
430  omegaScanParams_t OSParams{};
431 
432  // defaults (e.g. to be used in case cosRespScan=true)
433  OSParams.cosRespScan = true ;
434  OSParams.omegamin = 0.01 ;
435  OSParams.omegamax = 1. ;
436  OSParams.Npoint = 100 ;
437  OSParams.DeltaOmega = 0.01 ; // GHz
438  OSParams.range.min=m_TtailMin[2];
439  OSParams.range.max=m_TtailMax[2];
440 
441  if ( !m_UseOmegaScanHelper) {
442  const unsigned layer=m_emId->sampling(id);
443  OSParams.cosRespScan = m_cosRespScan[ layer ] ;
444  OSParams.omegamin = m_omegamin[ layer ] ;
445  OSParams.omegamax = m_omegamax[ layer ] ;
446  OSParams.Npoint = m_npoints[ layer ] ;
447  OSParams.DeltaOmega = 0.02 ;
448  //DeltaOmega = 0.001 ;
449  } else {
450  OSParams=OmegaScanHelper(id,wt);
451  }
452 
453  waveRange_t range=OSParams.range;
454 //if (m_TtailMin[2]==0 || m_TtailMax[2]==0 || m_TtailMin[2]>=m_TtailMax[2]) {
455  if (range.min==0 || range.max==0 || range.min>=range.max) {
456  range.min=wt.Tmin + m_DeltaTtail[1];
457  range.max=gCali.getSize();
458  }
459 
460  if ( OSParams.cosRespScan ){
461  // makes a raw scan of the cosresp chi2 logarithm
462  const double dOmega = (OSParams.omegamax-OSParams.omegamin)/OSParams.Npoint;
463  const unsigned vectSize = (unsigned) ceil ( OSParams.omegamax/dOmega );
464  const unsigned indexmin = (unsigned) floor( OSParams.omegamin/dOmega );
465  if (omegaScanWave) omegaScanWave->setSize(vectSize);
466  double chi2min = LAR_MAX_DOUBLE, omega0raw = LAR_MAX_DOUBLE;
467  for (int i=0;i<OSParams.Npoint;i++) {
468  const double omega = OSParams.omegamin+dOmega*i ;
469  const double chi2 = logChi2CosRespShaper(omega, gCali, wfParams, range);
470  if (omegaScanWave) omegaScanWave->setSample(i+indexmin,chi2);
471  if ( chi2 < chi2min ) {
472  chi2min = chi2;
473  omega0raw = omega;
474  }
475  }
476 
477  OSParams.omegamin = omega0raw - OSParams.DeltaOmega ;
478  OSParams.omegamax = omega0raw + OSParams.DeltaOmega ;
479  }
480 
481  if ( OSParams.omegamin == OSParams.omegamax ) { // skip cosine response calculation
482  wfParams.setOmega0(0.); // this will force no injection point correction in LArPhysWavePredictor
483  ATH_MSG_VERBOSE( "*** Cosine response skipped\t--> m_Omega0 = " << wfParams.omega0() ) ;
484  } else { // numerical (Brent) log(chi2) minimization
485  wfParams.setOmega0(omega0MinNum ( OSParams.omegamin, OSParams.omegamax, m_EPSILON, gCali, wfParams, range) );
486  ATH_MSG_VERBOSE( "*** Cosine response\t--> m_Omega0 = " <<wfParams.omega0() ) ;
487  }
488 
489  /* end of the COSINE RESPONSE analysis */
490  return StatusCode::SUCCESS ;
491 }
492 
493 
495 
496  omegaScanParams_t ret{};
497 
498  // this is a skeleton of the final function: use at your own risk! M.D. & C.G.
499  // EMEC part modified by L. March - 7 April 2011
500 
501  const unsigned layer=m_emId->sampling(id);
502 
503  ret.range.min = m_TtailMin[2];
504  ret.range.max = m_TtailMax[2];
505  ret.cosRespScan = m_cosRespScan[ (unsigned)layer ] ;
506  ret.omegamin = m_omegamin[ (unsigned)layer ] ;
507  ret.omegamax = m_omegamax[ (unsigned)layer ] ;
508  ret.Npoint = m_npoints[ (unsigned)layer ] ;
509  ret.DeltaOmega = 0.02 ;
510  //DeltaOmega = 0.001 ;
511 
512  //if ( m_BarrelEC==0 ) { // Barrel
513  if (m_emId->is_em_barrel(id)) {
514 
515  if ( layer==0 ) { // PS
516  ret.range.min = wt.Tstart;
517  ret.range.max = wt.Tcross;
518  ret.cosRespScan = m_cosRespScan[ (unsigned)layer ];
519  ret.omegamin = 0.240;
520  ret.omegamax = 0.330;
521  ret.Npoint = 900;
522  }
523 
524  if ( layer==1 ) { // Strips
525  ret.range.min = wt.Tstart;
526  ret.range.max = wt.Tcross;
527  ret.cosRespScan = true;
528  // Strips interval 1
529  //ret.omegamin = 0.150;
530  //ret.omegamax = 0.220;
531  //ret.Npoint = 700;
532  // Strips interval 2
533  ret.omegamin = 0.220;
534  ret.omegamax = 0.310;
535  ret.Npoint = 900;
536  // Strips interval 3
537  //omegamin = 0.310;
538  //omegamax = 0.390;
539  //Npoint = 1400;
540  }
541 
542  if ( layer==2 ) { // Middle
543  ret.range.min = wt.Tstart;
544  ret.range.max = wt.Tmin + m_DeltaTtail[1];
545  ret.cosRespScan = false;
546  ret.omegamin = 0.060;
547  ret.omegamax = 0.215;
548  //Npoint = 315;
549  }
550 
551  if ( layer==3 ) { // Back
552  ret.range.min = wt.Tstart;
553  ret.range.max = wt.Tcross;
554  ret.cosRespScan = false;
555  ret.omegamin = 0.100;
556  ret.omegamax = 0.700;
557  ret.Npoint = 120;
558  }
559 
560  }
561  else {
562  //if ( m_BarrelEC==1 ) { // EndCap
563 
564  // use pulse peak to perform cosine response tranformation minimization
565  //ret.range.min = m_Tstart;
566  //ret.range.max = m_Tcross;
567  ret.range.min = 0.;
568  ret.range.max = 0.;
569 
570  ret.DeltaOmega = 0.001 ;
571 
572  //(*m_log) << MSG::WARNING << " m_Tstart= " << m_Tstart << " m_Tcross=" << m_Tcross ) ;
573 
574  const bool IsEMECInnerWheel = m_emId->is_em_endcap_inner(id);//m_onlineHelper->isEMECinHECchannel(m_chID);
575  const int eta=m_emId->eta(id);
576  if ( IsEMECInnerWheel ) { // EMEC Inner Wheel
577 
578  if ( layer==1 ) {
579  //omegamin = 0.10 ;
580  //omegamax = 0.20 ;
581  ret.omegamin = 0.12 ;
582  if(eta>=0 && eta<=3)
583  {
584  ret.omegamin = 0.12 ;
585  //omegamax = 0.165 ;
586  ret.omegamax = 0.16 ;
587  ret.Npoint=100;
588  }
589  if(eta>=4 && eta<=6)
590  {
591  ret.omegamin = 0.14 ;
592  ret.omegamax = 0.18 ;
593  ret.Npoint=100;
594  }
595  } else
596  if ( layer == 2 ) { // don't extract Omega0
597  /*
598  cosRespScan = false;
599  omegamin = 0.;
600  omegamax = 0.;
601  Npoint = 0;
602  DeltaOmega = 0.;
603  */
604  ret.cosRespScan = true;
605  ret.omegamin = 0.12;
606  ret.omegamax = 0.35;
607  ret.Npoint = 100;
608  } else { // don't extract Omega0
609  ret.cosRespScan = false;
610  ret.omegamin = 0.;
611  ret.omegamax = 0.;
612  ret.Npoint = 0;
613  ret.DeltaOmega = 0.;
614  }
615 
616  } else { // EMEC Outer Whell
617 
618  if ( layer==1 ) { // don't extract Omega0
619  ret.cosRespScan = false;
620  ret.omegamin = 0.;
621  ret.omegamax = 0.;
622  ret.Npoint = 0;
623  ret.DeltaOmega = 0.;
624  } else
625  if ( layer == 2 ) {
626  ret.cosRespScan = true;
627  ret.Npoint =100;
628  ret.omegamin=0.1;
629  if(eta==0) {
630  ret.omegamax = 0.140 ;
631  }
632  if(eta==1) {
633  ret.omegamax = 0.135 ;
634  }
635  if(eta==2) {
636  ret.omegamax = 0.15 ;
637  }
638  if(eta==3) {
639  ret.omegamin = 0.10;
640  ret.omegamax = 0.16;
641  }
642  if(eta>=4 && eta<11 ) {
643  ret.omegamin = 0.12 ;
644  ret.omegamax = 0.20 ;
645  }
646  if(eta==11) {
647  ret.omegamin = 0.12 ;
648  ret.omegamax = 0.22 ;
649  }
650  if(eta>=12 && eta<28) {
651  ret.omegamin = 0.12 ;
652  ret.omegamax = 0.24 ;
653  }
654  if(eta>=28 && eta<39) {
655  ret.omegamin = 0.12 ;
656  ret.omegamax = 0.245 ;
657  }
658  if(eta>=39 && eta<43) {
659  //ret.omegamin = 0.12 ;
660  ret.omegamin = 0.24 ;
661  ret.omegamax = 0.32 ;
662  }
663  } else { // don't extract Omega0
664  ret.cosRespScan = false;
665  ret.omegamin = 0.;
666  ret.omegamax = 0.;
667  ret.Npoint = 0;
668  ret.DeltaOmega = 0.;
669  }
670 
671  } // end of EMEC Outer Wheel
672 
673  } // end of EMEC
674 
675  return ret;
676 }
677 
678 
680 {
681  /* begin of the INJECTION POINT CORRECTION RESIDUAL OSCILLATION analysis */
682 
683  // m_Taur minimum search interval...
684  double taurmin = 0.; // ns
685  //double taurmax = 4.; // ns
686  double taurmax = 100.; // ns
687 
688  if ( wf.omega0()==0) {
689  wf.setTaur(0);
690  ATH_MSG_VERBOSE( "*** Injection point skipped\t--> m_Taur = " << wf.taur() ) ;
691  } else {
692  // numerical (Brent) log(chi2) minimization
693  waveRange_t range{};
694  if ( m_TtailMin[3]!=0 && m_TtailMax[3]!=0 && m_TtailMin[3]<m_TtailMax[3]) {
695  range.min=m_TtailMin[3];
696  range.max=m_TtailMax[3];
697  }
698  else {
699  range.min= wt.Tmin + m_DeltaTtail[2];
700  range.max=gCali.getSize();
701  }
702 
703  wf.setTaur(taurMinNum ( taurmin, taurmax, m_EPSILON, gCali, wf, range));
704  ATH_MSG_VERBOSE( "*** Injection point\t--> m_Taur = " << wf.taur()) ;
705  }
706 
707  /* end of the INJECTION POINT CORRECTION RESIDUAL OSCILLATION analysis */
708 
709  return StatusCode::SUCCESS ;
710 }
711 
712 double LArWFParamTool::logChi2CosRespShaper (const double omega, const LArWave& gCali, const LArWFParams& wfParams, const waveRange_t& range) const {
713  return log(m_wHelper.getSumSquareRegion(cosRespShaper(gCali,wfParams.fstep(),wfParams.tcal(),omega,wfParams.tshaper()),range.min,range.max)) ;
714 }
715 
716 LArWave LArWFParamTool::cosRespShaper (const LArWave& gCali, const double& fstep, const double& tcal, const double& w, const double& tsh ) const {
717  return cosResp(gCali,fstep,tcal, w) * ( pow((1.+ w*w*tsh*tsh),1.5)/(w*tsh));
718 }
719 
720 /******************************************************************
721  * Cosine response
722  *****************************************************************/
723 LArWave LArWFParamTool::cosResp (const LArWave& gCali, const double& fstep, const double& tcal, const double& omega) {
724 
725  LArWave result=gCali % cosCorr(gCali.getSize(),gCali.getDt(),fstep, tcal, omega);
726  result+=gCali;
727  return result;
728 }
729 
730 /* =================================================================
731  * Function: Cosine response correction function
732  * ============================================================== */
733 LArWave LArWFParamTool::cosCorr(const unsigned N, const double dt, const double fstep, const double Tc, const double omega) {
734  LArWave w(N,dt);
735  const double C1=(fstep*fstep-fstep*fstep*fstep)/Tc;
736  const double C2=(fstep+omega*omega*Tc*Tc);
737  const double C3=(fstep-1.)*omega*Tc;
738  const double C4=( fstep*fstep+omega*omega*Tc*Tc );
739  for ( unsigned i=0 ; i<N ; i++ ) {
740  const double t=i*dt;
741  //const double p=((fstep*fstep-fstep*fstep*fstep)/Tc*exp(-fstep*t/Tc) - omega*((fstep+omega*omega*Tc*Tc)*sin(omega*t)+(fstep-1.)*omega*Tc*cos(omega*t)) ) / ( fstep*fstep+omega*omega*Tc*Tc ) ;
742  const double p=(C1*exp(-fstep*t/Tc) - omega*(C2*sin(omega*t) + C3*cos(omega*t))) / C4 ;
743  w.setSample(i,p);
744  }
745  return w ;
746 }
747 
748 
749 /* ================================================================
750  * log of the chi2 built on the tail of the injection point correction
751  * residual oscillation, to be used in numerical minimisation.
752  * ============================================================== */
753 double LArWFParamTool::logChi2InjRespRes (const double taur, const LArWave& gCali, const LArWFParams& wf, const waveRange_t& range) const {
754  return m_wHelper.getSumSquareRegion(injRespRes(gCali,wf.omega0(),taur), range.min, range.max);
755 }
756 
757 LArWave LArWFParamTool::injRespRes (const LArWave& w, const double omega0, const double taur) {
758  return w - ( w % injCorr(w.getSize(),w.getDt(),omega0,taur) );
759 }
760 
761 LArWave LArWFParamTool::injCorr(const unsigned N, const double dt,const double omega0, const double taur) {
762 
763  LArWave w(N,dt);
764 
765  const double tau0 = 1./omega0;
766  const double Delta = taur*taur - 4*tau0*tau0;
767  if ( Delta > 0 ) {
768  const double sqrtDelta = sqrt(Delta) ;
769  const double taup = 0.5*( taur + sqrtDelta ) ;
770  const double taum = 0.5*( taur - sqrtDelta ) ;
771  for ( unsigned i=0 ; i<N ; i++ ) {
772  const double t=i*dt;
773  w.setSample(i, (exp(-t/taup) - exp(-t/taum) ) / (taup - taum));
774  }
775  //return ( exp(-t/taup) - exp(-t/taum) ) / ( taup - taum ) ;
776  } else if ( Delta < 0 ) {
777  const double T = sqrt(-Delta) ;
778  const double A = 2 * taur / ( (taur*taur) - Delta ) ;
779  const double B = 2 * T / ( (taur*taur) - Delta );
780  for ( unsigned i=0 ; i<N ; i++ ) {
781  const double t=i*dt;
782  w.setSample(i, 2 * exp(-A*t) * sin(B*t) / T);
783  }
784  //return 2 * exp(-A*t) * sin(B*t) / T ;
785  } else { //Delta==0
786  const double tau = 0.5 * taur ;
787  // return exp(-t/tau) * t / pow(tau,2) ;
788  for ( unsigned i=0 ; i<N ; i++ ) {
789  const double t=i*dt;
790  w.setSample(i,exp(-t/tau) * t / (tau*tau)) ;
791  }
792  //return exp(-t/tau) * t / (tau*tau) ;
793  } //end else
794  return w;
795 }
796 
797 double LArWFParamTool::omega0MinNum (double omegaMin, double omegaMax, const double tol, const LArWave& gCali, const LArWFParams& wf, const waveRange_t& range) const {
798  return fminbr ( omegaMin, omegaMax, tol, &LArWFParamTool::logChi2CosRespShaper, gCali, wf, range);
799 }
800 
801 
802 
803 
804 
805 
806 double LArWFParamTool::taurMinNum (const double taurmin, const double taurmax, const double tol, const LArWave& gCali, const LArWFParams& wf, const waveRange_t& range ) const {
807  return fminbr ( taurmin, taurmax, tol, &LArWFParamTool::logChi2InjRespRes, gCali, wf, range );
808 }
809 
810 /*
811  ************************************************************************
812  * C math library
813  * function FMINBR - one-dimensional search for a function minimum
814  * over the given range
815  *
816  * Input
817  * double fminbr(a,b,f,tol)
818  * double a; Minimum will be seeked for over
819  * double b; a range [a,b], a being < b.
820  * double (*f)(double x); Name of the function whose minimum
821  * will be seeked for
822  * double tol; Acceptable tolerance for the minimum
823  * location. It have to be positive
824  * (e.g. may be specified as m_EPSILON)
825  *
826  * Output
827  * Fminbr returns an estimate for the minimum location with accuracy
828  * 3*m_SQRT_EPSILON*abs(x) + tol.
829  * The function always obtains a local minimum which coincides with
830  * the global one only if a function under investigation being
831  * unimodular.
832  * If a function being examined possesses no local minimum within
833  * the given range, Fminbr returns 'a' (if f(a) < f(b)), otherwise
834  * it returns the right range boundary value b.
835  *
836  * Algorithm
837  * G.Forsythe, M.Malcolm, C.Moler, Computer methods for mathematical
838  * computations. M., Mir, 1980, p.202 of the Russian edition
839  *
840  * The function makes use of the "gold section" procedure combined with
841  * the parabolic interpolation.
842  * At every step program operates three abscissae - x,v, and w.
843  * x - the last and the best approximation to the minimum location,
844  * i.e. f(x) <= f(a) or/and f(x) <= f(b)
845  * (if the function f has a local minimum in (a,b), then the both
846  * conditions are fulfiled after one or two steps).
847  * v,w are previous approximations to the minimum location. They may
848  * coincide with a, b, or x (although the algorithm tries to make all
849  * u, v, and w distinct). Points x, v, and w are used to construct
850  * interpolating parabola whose minimum will be treated as a new
851  * approximation to the minimum location if the former falls within
852  * [a,b] and reduces the range enveloping minimum more efficient than
853  * the gold section procedure.
854  * When f(x) has a second derivative positive at the minimum location
855  * (not coinciding with a or b) the procedure converges superlinearly
856  * at a rate order about 1.324
857  *
858  ************************************************************************
859  */
860 
861 //#include "fminbr.h"
862 //#include "small_nums.h"
863 
864 double LArWFParamTool::fminbr(double a, double b, const double tol, double (LArWFParamTool::*f)(double, const LArWave&, const LArWFParams&, const waveRange_t&) const,
865  const LArWave& gCali, const LArWFParams& wf, const waveRange_t& waverange) const
866 /* fminbr(a,b,f,tol) An estimate to the min location
867  a; Left border | of the range
868  b; Right border | the min is seeked
869  (*f)(double x) Function under investigation
870  tol; Acceptable tolerance */
871 
872 {
873  double x,v,w; /* Abscissae, descr. see above */
874  double fx; /* f(x) */
875  double fv; /* f(v) */
876  double fw; /* f(w) */
877  const double r = (3.-sqrt(5.0))/2; /* Gold section ratio */
878 
879  assert( tol > 0 && b > a );
880 
881  v = a + r*(b-a); fv = (this->*f)(v,gCali,wf,waverange); /* First step - always gold section*/
882  x = v; w = v;
883  fx=fv; fw=fv;
884 
885  for(;;) /* Main iteration loop */
886  {
887  double range = b-a; /* Range over which the minimum */
888  /* is seeked for */
889  double middle_range = (a+b)/2;
890  double tol_act = /* Actual tolerance */
891  m_SQRT_EPSILON*fabs(x) + tol/3;
892  double new_step; /* Step at this iteration */
893 
894  if( fabs(x-middle_range) + range/2 <= 2*tol_act )
895  return x; /* Acceptable approx. is found */
896 
897  /* Obtain the gold section step */
898  new_step = r * ( x<middle_range ? b-x : a-x );
899 
900 
901  /* Decide if the interpolation can be tried */
902  if( fabs(x-w) >= tol_act ) /* If x and w are distinct */
903  { /* interpolatiom may be tried */
904  double p; /* Interpolation step is calcula-*/
905  double q; /* ted as p/q; division operation*/
906  /* is delayed until last moment */
907  double t;
908 
909  t = (x-w) * (fx-fv);
910  q = (x-v) * (fx-fw);
911  p = (x-v)*q - (x-w)*t;
912  q = 2*(q-t);
913 
914  if( q>(double)0 ) /* q was calculated with the op-*/
915  p = -p; /* posite sign; make q positive */
916  else /* and assign possible minus to */
917  q = -q; /* p */
918 
919  if( fabs(p) < fabs(new_step*q) && /* If x+p/q falls in [a,b]*/
920  p > q*(a-x+2*tol_act) && /* not too close to a and */
921  p < q*(b-x-2*tol_act) ) /* b, and isn't too large */
922  new_step = p/q; /* it is accepted */
923  /* If p/q is too large then the */
924  /* gold section procedure can */
925  /* reduce [a,b] range to more */
926  /* extent */
927  }
928 
929  if( fabs(new_step) < tol_act ) { /* Adjust the step to be not less*/
930  if( new_step > (double)0 ) /* than tolerance */
931  new_step = tol_act;
932  else
933  new_step = -tol_act;
934  }
935 
936  /* Obtain the next approximation to min */
937  { /* and reduce the enveloping range */
938  double t = x + new_step; /* Tentative point for the min */
939  double ft = (this->*f)(t,gCali,wf,waverange);
940  if( ft <= fx )
941  { /* t is a better approximation */
942  if( t < x ) /* Reduce the range so that */
943  b = x; /* t would fall within it */
944  else
945  a = x;
946 
947  v = w; w = x; x = t; /* Assign the best approx to x */
948  fv=fw; fw=fx; fx=ft;
949  }
950  else /* x remains the better approx */
951  {
952  if( t < x ) /* Reduce the range enclosing x */
953  a = t;
954  else
955  b = t;
956 
957  if( ft <= fw || w==x )
958  {
959  v = w; w = t;
960  fv=fw; fw=ft;
961  }
962  else if( ft<=fv || v==x || v==w )
963  {
964  v = t;
965  fv=ft;
966  }
967  }
968  } /* ----- end-of-block ----- */
969  } /* ===== End of loop ===== */
970 }
971 
972 
973 
974 
975 unsigned LArWFParamTool::checkStatus(const LArCaliWave &larCaliWave) const
976 {
977  // this is supposed to be a quick test on cali waves, to flags those
978  // clearly problematic. but cuts must be tuned, so for the time being
979  // don't call this method!
980 
981  //MsgStream log(msgSvc(), name());
982 
983  unsigned length ;
984  if ( (length=larCaliWave.getSize()) < 750 ) {
985  ATH_MSG_WARNING( "Calibration wave is too short!" ) ;
986  return TooShort ;
987  }
988 
989  const unsigned range = 2 ;
990  unsigned nMax = 0 ;
991  double tremble = 0 ;
992  double maxSample = -9.E+10 ;
993  for ( unsigned i=0 ; i<length ; i++ ) {
994  if ( larCaliWave.getError(i) < 0 || larCaliWave.getTrigger(i) < 0 ) {
995  ATH_MSG_WARNING( "Calibration wave probably not completely filled" ) ;
996  return NotFilled ;
997  }
998  if ( larCaliWave.getTrigger(i) < 50 ) {
999  ATH_MSG_WARNING( "Calibration wave with low statistics" ) ;
1000  return LowStat ;
1001  }
1002  double thisSample = larCaliWave.getTrigger(i) ;
1003  if ( thisSample > maxSample ) maxSample = thisSample ;
1004  if ( i>=range && i<length-range ) {
1005  bool max = true ;
1006  double loc_tremble = 0 ;
1007  for ( unsigned k=i-range ; k<=i+range ; k++ ) {
1008  double delta = thisSample - larCaliWave.getSample(k) ;
1009  loc_tremble += delta*delta;// pow(delta,2) ;
1010  if ( delta < 0 ) max = false ;
1011  }
1012  if ( max ) nMax ++ ;
1013  tremble += loc_tremble / (2*range) ;
1014  }
1015  }
1016  if ( sqrt(tremble/length)/maxSample > 0.1 ) {
1017  ATH_MSG_WARNING( "Calibration wave is noisy " << sqrt(tremble/length)/maxSample ) ;
1018  return Noisy ;
1019  }
1020  if ( nMax > 1 ) {
1021  ATH_MSG_WARNING( "Calibration wave oscillates" ) ;
1022  return Oscillating ;
1023  }
1024 
1025  return OK ;
1026 }
LArWave
Definition: LArWave.h:31
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
LArWFParamTool::cosCorr
static LArWave cosCorr(const unsigned N, const double dt, const double fstep, const double tcal, const double omega)
Definition: LArWFParamTool.cxx:733
LArWFParams::taur
double taur() const
Definition: LArWFParams.h:271
beamspotman.r
def r
Definition: beamspotman.py:674
LArWFParamTool::TooShort
@ TooShort
Definition: LArWFParamTool.h:69
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:215
LArWFParamTool::timeExtr
WaveTiming_t timeExtr(LArWave &gCali) const
Definition: LArWFParamTool.cxx:283
LArWFParamTool::WaveTiming_t::Tmin
unsigned Tmin
Definition: LArWFParamTool.h:88
LArWFParamTool::m_storeResOscill
std::vector< bool > m_storeResOscill
Definition: LArWFParamTool.h:107
LArWave::unknown
@ unknown
Definition: LArWave.h:137
PlotCalibFromCool.ft
ft
Definition: PlotCalibFromCool.py:329
LArWFParamTool::omega0MinNum
double omega0MinNum(double omegaMin, double omegaMax, const double tol, const LArWave &gCali, const LArWFParams &wf, const waveRange_t &) const
Definition: LArWFParamTool.cxx:797
LArWaveHelper::getSumRegion
double getSumRegion(const LArWave &theWave, unsigned iFirst, unsigned iLast) const
Definition: LArWaveHelper.cxx:374
LArEM_ID.h
LArWFParamTool::m_omegamin
std::vector< double > m_omegamin
Definition: LArWFParamTool.h:102
get_generator_info.result
result
Definition: get_generator_info.py:21
detail::ll
long long ll
Definition: PrimitiveHelpers.h:47
LArWave::getSize
size_t getSize() const
number of time samples
Definition: LArWave.h:62
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LArWFParamTool::injCorr
static LArWave injCorr(const unsigned N, const double dt, const double omega0, const double taur)
Definition: LArWFParamTool.cxx:761
LArWaveHelper::getStart
unsigned getStart(const LArWave &theWave) const
Definition: LArWaveHelper.cxx:413
LArWFParams::tshaper
double tshaper() const
Definition: LArWFParams.h:272
LArWFParams::setTcal
void setTcal(double tcal)
Definition: LArWFParams.h:226
LArWFParams::setFstep
void setFstep(double fstep)
Definition: LArWFParams.h:227
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
LArWFParamTool::m_ShiftToStart
bool m_ShiftToStart
Definition: LArWFParamTool.h:109
LArWFParamTool::taurMinNum
double taurMinNum(const double taurmin, const double taurmax, const double tol, const LArWave &gCali, const LArWFParams &wf, const waveRange_t &) const
Definition: LArWFParamTool.cxx:806
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
LArWFParamTool::m_TtailMax
std::vector< int > m_TtailMax
Definition: LArWFParamTool.h:114
LArWFParamTool::DoExtract
@ DoExtract
Definition: LArWFParamTool.h:35
LArWave::getWave
const std::vector< double > & getWave() const
Wave parameters.
Definition: LArWave.h:167
LArWaveHelper::getBaseline
double getBaseline(const LArWave &theWave, unsigned nBase) const
Definition: LArWaveHelper.cxx:351
CaloIdManager::getEM_ID
const LArEM_ID * getEM_ID(void) const
Definition: CaloIdManager.cxx:80
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
ALFA_EventTPCnv_Dict::t1
std::vector< ALFA_RawDataCollection_p1 > t1
Definition: ALFA_EventTPCnvDict.h:43
LArWave::getDt
const double & getDt() const
delta time
Definition: LArWave.h:50
LArWFParamTool::stepCorr
static LArWave stepCorr(const LArWave &gCali, const double &fstep, const double &Tc)
Definition: LArWFParamTool.cxx:394
LArWFParamTool::dFstep
double dFstep(const LArWave &gCali, const double fstep, const double Tc, const unsigned Ttail) const
Definition: LArWFParamTool.cxx:372
LArWaveHelper::translate
LArWave translate(const LArWave &theWave, int nShift, double baseline=0.) const
Definition: LArWaveHelper.cxx:11
LArWFParamTool::getLArWaveParams
StatusCode getLArWaveParams(const LArCaliWave &larCaliWave, const HWIdentifier chid, const CaloGain::CaloGain gain, LArWFParams &wfParams, const LArOnOffIdMapping *cabling, std::optional< LArCaliWave > &omegaScan, std::optional< LArCaliWave > &resOscill0, std::optional< LArCaliWave > &resOscill1) const
Definition: LArWFParamTool.cxx:193
LArWFParamTool::dstepRespDfstep
LArWave dstepRespDfstep(const LArWave &gCali, const double &fstep, const double &Tc) const
Definition: LArWFParamTool.cxx:406
Identifier::get_compact
value_type get_compact() const
Get the compact id.
LArWFParamTool::stepResp
static LArWave stepResp(const LArWave &gCali, const double fstep, const double Tc)
Definition: LArWFParamTool.cxx:387
LArCaliWave::getDAC
int getDAC() const
DAC value.
Definition: LArCaliWave.h:156
LArWFParamTool::OK
@ OK
Definition: LArWFParamTool.h:68
LArEM_Base_ID::sampling
int sampling(const Identifier id) const
return sampling according to :
LArWFParams
Definition: LArWFParams.h:20
LArWFParamTool::OmegaScanHelper
omegaScanParams_t OmegaScanHelper(const Identifier id, const WaveTiming_t &wt) const
Definition: LArWFParamTool.cxx:494
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
LArWFParamTool::m_omegamax
std::vector< double > m_omegamax
Definition: LArWFParamTool.h:103
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
LArWaveHelper::getMax
unsigned int getMax(const LArWave &theWave) const
return index of maximum sample
Definition: LArWaveHelper.cxx:89
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
LArWFParamTool::m_cosRespScan
std::vector< bool > m_cosRespScan
Definition: LArWFParamTool.h:101
HWIdentifier
Definition: HWIdentifier.h:13
LArWFParamTool::m_npoints
std::vector< unsigned > m_npoints
Definition: LArWFParamTool.h:104
x
#define x
LArWFParamTool::WaveTiming_t::Tcross
unsigned Tcross
Definition: LArWFParamTool.h:87
xAOD::unsigned
unsigned
Definition: RingSetConf_v1.cxx:662
LArEM_SuperCell_ID.h
Helper class for LArEM offline identifiers for supercells.
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
LArWFParamTool::injRespRes
static LArWave injRespRes(const LArWave &w, const double omega0, const double taur)
Definition: LArWFParamTool.cxx:757
LArEM_Base_ID::eta
int eta(const Identifier id) const
return eta according to :
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
LArWFParams::setTshaper
void setTshaper(double tsh)
Definition: LArWFParams.h:231
LArWFParamTool::Oscillating
@ Oscillating
Definition: LArWFParamTool.h:73
dqt_zlumi_alleff_HIST.A
A
Definition: dqt_zlumi_alleff_HIST.py:110
LArWFParams::tcal
double tcal() const
Definition: LArWFParams.h:267
LArWFParams::fstep
double fstep() const
Definition: LArWFParams.h:268
LArWave::getSample
const double & getSample(const unsigned int i) const
Amplitude per time bin.
Definition: LArWave.h:53
A
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
LArCaliWave
Definition: LArCaliWave.h:44
LArOnOffIdMapping.h
LArWaveHelper::getSumTail
double getSumTail(const LArWave &theWave, unsigned iFirst) const
Definition: LArWaveHelper.cxx:359
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CaloIdManager
This class initializes the Calo (LAr and Tile) offline identifiers.
Definition: CaloIdManager.h:45
LArWFParamTool::NotFilled
@ NotFilled
Definition: LArWFParamTool.h:70
LArWFParamTool::m_SQRT_EPSILON
static const double m_SQRT_EPSILON
Definition: LArWFParamTool.h:80
lumiFormat.i
int i
Definition: lumiFormat.py:85
LArWFParams::setFlag
void setFlag(unsigned flag)
Definition: LArWFParams.h:224
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
LArWFParamTool::GetFstep
StatusCode GetFstep(const LArWave &gCali, LArWFParams &wfParams, const WaveTiming_t &wt) const
Definition: LArWFParamTool.cxx:344
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition: AthCommonDataStore.h:145
CaloNoise_fillDB.dt
dt
Definition: CaloNoise_fillDB.py:56
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
LArWFParams::setTaur
void setTaur(double taur)
Definition: LArWFParams.h:230
LArWFParamTool::cosRespShaper
LArWave cosRespShaper(const LArWave &gCali, const double &fstep, const double &tcal, const double &w, const double &tsh) const
Definition: LArWFParamTool.cxx:716
LArWaveHelper::getSumSquareRegion
double getSumSquareRegion(const LArWave &theWave, unsigned iFirst, unsigned iLast) const
Definition: LArWaveHelper.cxx:396
baseline
@ baseline
Definition: SUSYToolsTester.cxx:94
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:525
LArWFParamTool::WaveTiming_t::Tstart
unsigned Tstart
Definition: LArWFParamTool.h:85
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:194
LArWFParamTool::dstepCorrDfstep
static double dstepCorrDfstep(const double t, const double &fstep, const double &Tc)
Definition: LArWFParamTool.cxx:410
test_pyathena.parent
parent
Definition: test_pyathena.py:15
LArWFParamTool::fminbr
double fminbr(double a, double b, const double tol, double(LArWFParamTool::*f)(double, const LArWave &, const LArWFParams &, const waveRange_t &) const, const LArWave &gCali, const LArWFParams &wf, const waveRange_t &range) const
Definition: LArWFParamTool.cxx:864
LArWFParamTool::m_SubtractBaseline
bool m_SubtractBaseline
Definition: LArWFParamTool.h:110
LArWFParamTool::FailExtract
@ FailExtract
Definition: LArWFParamTool.h:34
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
hist_file_dump.f
f
Definition: hist_file_dump.py:140
LArWFParamTool::m_isSC
bool m_isSC
Definition: LArWFParamTool.h:112
LArWFParamTool::LArWFParamTool
LArWFParamTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: LArWFParamTool.cxx:36
LAR_MAX_DOUBLE
#define LAR_MAX_DOUBLE
Definition: LArWFParamTool.cxx:23
LArWFParams::omega0
double omega0() const
Definition: LArWFParams.h:270
LArWFParamTool::fstepMin
double fstepMin(const LArWave &gCali, double fstep, const double Tc, const unsigned Ttail) const
Definition: LArWFParamTool.cxx:356
LArWFParamTool::logChi2CosRespShaper
double logChi2CosRespShaper(const double omega, const LArWave &gCali, const LArWFParams &wf, const waveRange_t &range) const
Definition: LArWFParamTool.cxx:712
LArWFParamTool::WaveTiming_t
Definition: LArWFParamTool.h:84
LArWFParamTool::expTail
double expTail(const LArWave &gCali, const WaveTiming_t &wt) const
Definition: LArWFParamTool.cxx:311
LArWFParamTool::RTM_Taur
StatusCode RTM_Taur(const LArWave &gCali, LArWFParams &wfParams, const WaveTiming_t &wt) const
Definition: LArWFParamTool.cxx:679
LArWFParamTool::m_EPSILON
static const double m_EPSILON
Definition: LArWFParamTool.h:81
LArWFParamTool
Definition: LArWFParamTool.h:29
LArOnlineID_Base
Helper for the Liquid Argon Calorimeter cell identifiers.
Definition: LArOnlineID_Base.h:105
LArWaveHelper::getSumSquareTail
double getSumSquareTail(const LArWave &theWave, unsigned iFirst) const
Definition: LArWaveHelper.cxx:391
LArWaveHelper::getZeroCross
unsigned getZeroCross(const LArWave &theWave) const
Definition: LArWaveHelper.cxx:425
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:76
LArWFParamTool::m_onlineHelper
const LArOnlineID_Base * m_onlineHelper
Definition: LArWFParamTool.h:94
dqt_zlumi_alleff_HIST.B
B
Definition: dqt_zlumi_alleff_HIST.py:110
LArOnlineID
Definition: LArOnlineID.h:20
Base_Fragment.defaults
dictionary defaults
This includes now the top quark, the leptons and the bosons.
Definition: GeneratorFilters/share/common/Base_Fragment.py:79
LArOnline_SuperCellID
Definition: LArOnline_SuperCellID.h:20
LArEM_Base_ID::is_em_endcap_inner
bool is_em_endcap_inner(const Identifier id) const
test if the id belongs to the EM Endcap inner wheel
LArWFParamTool::LowStat
@ LowStat
Definition: LArWFParamTool.h:71
CaloGain::CaloGain
CaloGain
Definition: CaloGain.h:11
LArWFParamTool::m_UseOmegaScanHelper
bool m_UseOmegaScanHelper
Definition: LArWFParamTool.h:111
LArWFParamTool::checkStatus
unsigned checkStatus(const LArCaliWave &larCaliWave) const
Definition: LArWFParamTool.cxx:975
LArWFParamTool::~LArWFParamTool
virtual ~LArWFParamTool()
python.PyAthena.v
v
Definition: PyAthena.py:154
ReadCellNoiseFromCool.indexmin
indexmin
Definition: ReadCellNoiseFromCool.py:226
ALFA_EventTPCnv_Dict::t2
std::vector< ALFA_RawDataContainer_p1 > t2
Definition: ALFA_EventTPCnvDict.h:44
LArWFParamTool::omegaScanParams_t
Definition: LArWFParamTool.h:124
LArWFParamTool::m_TtailMin
std::vector< int > m_TtailMin
Definition: LArWFParamTool.h:113
LArWaveHelper::getMin
unsigned int getMin(const LArWave &theWave) const
return index of minimum sample
Definition: LArWaveHelper.cxx:74
a
TList * a
Definition: liststreamerinfos.cxx:10
LArWFParamTool::Noisy
@ Noisy
Definition: LArWFParamTool.h:72
LArEM_Base_ID::is_em_barrel
bool is_em_barrel(const Identifier id) const
test if the id belongs to the EM barrel
LArWFParams::setOmega0
void setOmega0(double omega0)
Definition: LArWFParams.h:229
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
LArWFParamTool::omegaScanParams_t::cosRespScan
bool cosRespScan
Definition: LArWFParamTool.h:125
LArWFParamTool::waveRange_t
Definition: LArWFParamTool.h:119
LArWaveCumul::getError
double getError(unsigned i) const
error per time bin
Definition: LArWaveCumul.h:143
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
LArWFParamTool::m_Tshaper
double m_Tshaper
Definition: LArWFParamTool.h:99
LArWFParamTool.h
extractSporadic.q
list q
Definition: extractSporadic.py:97
LArOnline_SuperCellID.h
LArWFParamTool::m_TINY
static const double m_TINY
Definition: LArWFParamTool.h:79
LArWFParamTool::m_DeltaTtail
std::vector< int > m_DeltaTtail
Definition: LArWFParamTool.h:115
CaloIdManager.h
CaloIdManager::getEM_SuperCell_ID
const LArEM_SuperCell_ID * getEM_SuperCell_ID(void) const
Definition: CaloIdManager.cxx:115
LArWFParamTool::m_DEFAULT
static const double m_DEFAULT
Definition: LArWFParamTool.h:78
LArWFParamTool::logChi2InjRespRes
double logChi2InjRespRes(const double taur, const LArWave &gCali, const LArWFParams &wf, const waveRange_t &range) const
Definition: LArWFParamTool.cxx:753
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
LArWFParamTool::m_wHelper
LArWaveHelper m_wHelper
Definition: LArWFParamTool.h:96
AthAlgTool
Definition: AthAlgTool.h:26
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:198
LArOnlineID_Base::channel_name
std::string channel_name(const HWIdentifier id) const
Return a string corresponding to a feedthrough name given an identifier.
Definition: LArOnlineID_Base.cxx:221
LArWFParamTool::m_NBaseline
unsigned int m_NBaseline
Definition: LArWFParamTool.h:108
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
LArWFParamTool::m_emId
const LArEM_Base_ID * m_emId
Definition: LArWFParamTool.h:93
LArWFParamTool::initialize
virtual StatusCode initialize()
Definition: LArWFParamTool.cxx:112
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
LArWaveHelper::expfit
std::vector< double > expfit(const LArWave &theWave, unsigned iFirst, unsigned iLast, double &rho) const
Definition: LArWaveHelper.cxx:479
fitman.rho
rho
Definition: fitman.py:532
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
fitman.k
k
Definition: fitman.py:528
LArOnlineID.h
LArWaveCumul::getTrigger
int getTrigger(unsigned i) const
trigger per time bin
Definition: LArWaveCumul.h:157
LArWFParamTool::RTM_Omega0
StatusCode RTM_Omega0(const LArWave &gCali, const HWIdentifier chid, LArWFParams &wfParams, const WaveTiming_t &wt, const LArOnOffIdMapping *cabling, std::optional< LArCaliWave > &omegaScan) const
Definition: LArWFParamTool.cxx:422
LArOnOffIdMapping
Definition: LArOnOffIdMapping.h:20
LArWFParamTool::cosResp
static LArWave cosResp(const LArWave &gCali, const double &fstep, const double &tcal, const double &omega)
Definition: LArWFParamTool.cxx:723
Identifier
Definition: IdentifierFieldParser.cxx:14