ATLAS Offline Software
DetAnnealingMaker.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /*********************************************************************
6  DetAnnealingMaker.cxx - Description in header file
7 *********************************************************************/
8 
10 #include <cmath>
11 
12 namespace {
13  double gauss(const double value2, const double error2) {
14  return exp(-1./2.*value2/error2);
15  }
16 }
17 
18 
19 namespace Trk
20 {
21 
22  DetAnnealingMaker::DetAnnealingMaker(const std::string& t, const std::string& n, const IInterface* p) :
23  base_class(t,n,p),
24  m_SetOfTemperatures(1,3),
25  m_cutoff(9.)
26  {
27  declareProperty("SetOfTemperatures", m_SetOfTemperatures);
28  declareProperty("Cutoff", m_cutoff);
29  }
30 
32  {
33  ATH_MSG_DEBUG( "Initialize successful" );
34  return StatusCode::SUCCESS;
35  }
36 
38  {
39  ATH_MSG_DEBUG( "Finalize successful" );
40  return StatusCode::SUCCESS;
41  }
42 
43  void DetAnnealingMaker::reset(AnnealingState& state) const
44  {
45  state = 0;
46  ATH_MSG_DEBUG( "Annealing reset" );
47  }
48 
49  void DetAnnealingMaker::anneal(AnnealingState& state) const {
50 
51 //check if there are some temperatures
52  if (m_SetOfTemperatures.empty())
53  {
54  ATH_MSG_ERROR( "The vector SetOfTemperatures for the annealing is empty" );
55  }
56  //go one step further
57  ++state;
58  }
59 
60  double DetAnnealingMaker::getWeight(const AnnealingState& state,
61  double chisq,
62  const std::vector<double>& allchisq) const
63  {
64  double temp = actualTemp (state);
65  double allweight(0.);
66  for (double ch : allchisq) {
67  allweight+=gauss(ch,temp);
68  }
69  double actualweight(gauss(chisq,temp));
70  return actualweight/(gauss(m_cutoff,temp)+allweight);
71  }
72 
73  double DetAnnealingMaker::getWeight(const AnnealingState& state,
74  double chisq) const
75  {
76  double temp = actualTemp (state);
77  return gauss(chisq,temp)/(gauss(m_cutoff,temp)+gauss(chisq,temp));
78  }
79 
80 }
81 
82 
Trk::DetAnnealingMaker::DetAnnealingMaker
DetAnnealingMaker(const std::string &t, const std::string &n, const IInterface *p)
Default constructor due to Athena interface.
Definition: DetAnnealingMaker.cxx:22
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
Trk::DetAnnealingMaker::finalize
virtual StatusCode finalize() override
Definition: DetAnnealingMaker.cxx:37
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
Trk::temp
Definition: V0VertexDict.h:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
beamspotman.n
n
Definition: beamspotman.py:731
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
Trk::DetAnnealingMaker::m_SetOfTemperatures
std::vector< double > m_SetOfTemperatures
A vector of temperatures, you will start from SetOfTemperature[0] and Anneal towards SetOfTemperature...
Definition: DetAnnealingMaker.h:80
Trk::DetAnnealingMaker::anneal
virtual void anneal(AnnealingState &state) const override
One more annealing step.
Definition: DetAnnealingMaker.cxx:49
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
DetAnnealingMaker.h
Trk::DetAnnealingMaker::actualTemp
virtual double actualTemp(const AnnealingState &state) const override
Access to the actual temperature value.
Definition: DetAnnealingMaker.h:67
Trk::DetAnnealingMaker::reset
virtual void reset(AnnealingState &state) const override
Resets the annealing process to its beginning.
Definition: DetAnnealingMaker.cxx:43
Trk::DetAnnealingMaker::getWeight
virtual double getWeight(const AnnealingState &state, double chisq, const std::vector< double > &allchisq) const override
Weight access method.
Definition: DetAnnealingMaker.cxx:60
python.SystemOfUnits.gauss
int gauss
Definition: SystemOfUnits.py:230
Trk::DetAnnealingMaker::initialize
virtual StatusCode initialize() override
Definition: DetAnnealingMaker.cxx:31
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
Trk::DetAnnealingMaker::m_cutoff
double m_cutoff
Weight will be insensitive to chi2 at order of magnitude of the cutoff...
Definition: DetAnnealingMaker.h:85