ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
Muon::MuonDQAFitFunc Class Reference

Tool to fit histograms. More...

#include <MuonDQAFitFunc.h>

Inheritance diagram for Muon::MuonDQAFitFunc:
Collaboration diagram for Muon::MuonDQAFitFunc:

Public Member Functions

 MuonDQAFitFunc (const std::string &type, const std::string &name, const IInterface *parent)
 constructor More...
 
virtual ~MuonDQAFitFunc ()
 destructor More...
 
void ZmumuFitHistograms (TH1F *hmass, TH1F *hwidth, TH1F *h1[], int nbins)
 
void MuonEffHisto1D (TH1F *h_Num, TH1F *h_Denom, TProfile *h_Eff) const
 
void MuonEffHisto2D (TH2F *h_Num, TH2F *h_Denom, TProfile2D *h_Eff) const
 
void MinWindow1Set_from_TProf (TProfile *hProf, float windowMin, float windowMax) const
 ================================================================ More...
 
void MinWindow2Set_from_TProf (TProfile2D *hProf, float windowMin, float windowMax) const
 
void FillMeanRmsProj (TH2F *, TH1F *, int) const
 
void FillRMSFromProfile (TProfile *, TH1F *) const
 Fills a histogram with the RMS values of a TProfile. More...
 
void FillRMSFromCharProfile (TProfile *, TH1F *) const
 Fills a histogram with the RMS values of a TProfile, which labeled bins->keeping the labeling for the bins. More...
 
void FillGausMeanOrWidth (TH2F *, TH1F *, float, float, int) const
 
void FillGaussMeanAndWidth (TH2F *, TH1F *, float, float) const
 
void FillGaussMeanAndWidth (TH1F *, TH1F *, int, float, float) const
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 access to tool interface More...
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Protected Attributes

float m_minMuonEffWindow
 
float m_maxMuonEffWindow
 

Static Protected Attributes

static const int NBINS =6
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

double m_ZmumuPDGmass
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Tool to fit histograms.

The tool can be used to:

Definition at line 29 of file MuonDQAFitFunc.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ MuonDQAFitFunc()

Muon::MuonDQAFitFunc::MuonDQAFitFunc ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

constructor

Definition at line 22 of file MuonDQAFitFunc.cxx.

23  : AthAlgTool(ty,na,pa),
24  m_minMuonEffWindow(0.8),
25  m_maxMuonEffWindow(1.05)
26  {
27  declareProperty("ZmumuPDGmass", m_ZmumuPDGmass=Zmass);
28  declareProperty("minMuonEffWindow", m_minMuonEffWindow);
29  declareProperty("maxMuonEffWindow", m_maxMuonEffWindow);
30  declareInterface<MuonDQAFitFunc>(this);
31  }

◆ ~MuonDQAFitFunc()

virtual Muon::MuonDQAFitFunc::~MuonDQAFitFunc ( )
inlinevirtual

destructor

Definition at line 37 of file MuonDQAFitFunc.h.

37 {};

Member Function Documentation

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ FillGausMeanOrWidth()

void Muon::MuonDQAFitFunc::FillGausMeanOrWidth ( TH2F *  h2d,
TH1F *  h1d,
float  MinFit,
float  MaxFit,
int  iopt 
) const

Definition at line 246 of file MuonDQAFitFunc.cxx.

247  {
248 
249 
250  //Makes a Gaussian fit to each bin of a TH2F and fills a TH1F with
251  //the either the mean or width of this Gaussian
252 
253  //calling this means that the histogram bin content is flagged
254  //as being an average and so adding histos from different jobs
255  //will produce weighted mean
256  h1d->SetBit(TH1::kIsAverage);
257 
258  int nBins_2d = h2d->GetNbinsX();
259  int nBins_1d = h1d->GetNbinsX();
260 
261  if(nBins_2d!=nBins_1d) ATH_MSG_DEBUG("Mean/Width Histograms not set up correctly - nBins mismatch");
262 
263  for(int i = 1; i!=nBins_2d+1; i++){
264 
265  TH1F* hProj = (TH1F*)h2d->ProjectionY("Proj",i,i,"e");
266 
267  //do not fill if there are no entries in the bin
268  if(hProj->GetEntries()<=0) {
269  delete hProj;
270  continue;
271  }
272 
273  TF1 *fit = new TF1("fit","gaus",MinFit,MaxFit);
274 
275  hProj->Fit("fit","RQNM");
276  float Mean = fit->GetParameter(1);
277  float MeanSigma = fit->GetParError(1);
278  float Width = fit->GetParameter(2);
279  float WidthSigma = fit->GetParError(2);
280 
281  if(iopt==0){
282  h1d->SetBinContent(i,Mean);
283  h1d->SetBinError(i,MeanSigma);
284  }
285  else if(iopt==1){
286  h1d->SetBinContent(i,Width);
287  h1d->SetBinError(i,WidthSigma);
288  }
289  else ATH_MSG_DEBUG("Incorrect switch in FillGausMeanOrWidth");
290 
291  delete hProj;
292  delete fit;
293  }
294 
295  return;
296 
297  }

◆ FillGaussMeanAndWidth() [1/2]

void Muon::MuonDQAFitFunc::FillGaussMeanAndWidth ( TH1F *  h1,
TH1F *  h2,
int  nbin,
float  MinFit,
float  MaxFit 
) const

Definition at line 359 of file MuonDQAFitFunc.cxx.

360  {
361  // Makes a Gaussian fit to a TH1F and fills the given bin of another TH1F
362  // with the mean of this Gaussian, and the errors with the width.
363 
364  //calling this means that the histogram bin content is flagged
365  //as being an average and so adding histos from different jobs
366  //will produce weighted mean
367  h2->SetBit(TH1::kIsAverage);
368 
369  //do not fill if there are no entries in h1
370  if(h1->GetEntries()<=0) return;
371 
372  TF1 *fit = new TF1("fit","gaus",MinFit,MaxFit);
373  h1->Fit("fit","RQNM");
374  float Mean = fit->GetParameter(1);
375  // float MeanSigma = fit->GetParError(1);
376  float Width = fit->GetParameter(2);
377  // float WidthSigma = fit->GetParError(2);
378 
379  h2->SetBinContent(nbin,Mean);
380  h2->SetBinError(nbin,Width);
381  delete fit;
382  h2->SetEntries(h1->GetEntries());
383  return;
384  }

◆ FillGaussMeanAndWidth() [2/2]

void Muon::MuonDQAFitFunc::FillGaussMeanAndWidth ( TH2F *  h2d,
TH1F *  h1d,
float  MinFit,
float  MaxFit 
) const

Definition at line 301 of file MuonDQAFitFunc.cxx.

302  {
303 
304 
305  //Makes a Gaussian fit to each bin of a TH2F and fills a TH1F,
306  // the mean of this Gaussian, and the errors the width.
307 
308  //calling this means that the histogram bin content is flagged
309  //as being an average and so adding histos from different jobs
310  //will produce weighted mean
311  h1d->SetBit(TH1::kIsAverage);
312 
313  int nBins_2d = h2d->GetNbinsX();
314  int nBins_1d = h1d->GetNbinsX();
315 
316  if(nBins_2d!=nBins_1d) ATH_MSG_DEBUG("Mean/Width Histograms not set up correctly - nBins mismatch");
317 
318  for(int i = 1; i!=nBins_2d+1; i++){
319 
320  TH1F* hProj = (TH1F*)h2d->ProjectionY("Proj",i,i,"e");
321 
322  int numNonEmptyBins = 0;
323  for (int ii = 0; ii < (int)hProj->GetNbinsX()+1; ++ii)
324  {
325  if (hProj->GetBinContent(ii)>0.) ++numNonEmptyBins;
326  }
327 
328  //do not fill if there are no entries in the bin
329  //if(hProj->GetEntries()<=0) {
330  if((hProj->GetEntries()<=0)||(numNonEmptyBins<2)) {
331  delete hProj;
332  continue;
333  }
334 
335  TF1 *fit = new TF1("fit","gaus",MinFit,MaxFit);
336 
337  hProj->Fit("fit","RQNM");
338  float Mean = fit->GetParameter(1);
339  // float MeanSigma = fit->GetParError(1);
340  float Width = fit->GetParameter(2);
341  // float WidthSigma = fit->GetParError(2);
342 
343  h1d->SetBinContent(i,Mean);
344  h1d->SetBinError(i, Width);
345 
346  delete hProj;
347  delete fit;
348  }
349 
350  h1d->SetEntries(h2d->GetEntries());
351  return;
352 
353  }

◆ FillMeanRmsProj()

void Muon::MuonDQAFitFunc::FillMeanRmsProj ( TH2F *  h2d,
TH1F *  h1d,
int  MeanRms 
) const

Definition at line 140 of file MuonDQAFitFunc.cxx.

141  {
142 
143  // fills a 1-D histogram with either the mean or RMS of the residual distribution for each layer in the barrel.
144  // Does this by projecting a 2-D histo of residual vs layer.
145 
146  int nBins_2d = h2d->GetNbinsX();
147  int nBins_1d = h1d->GetNbinsX();
148 
149  if(nBins_2d!=nBins_1d) ATH_MSG_DEBUG("Mean/RMS Histograms not set up correctly - nBins mismatch");
150 
151  //calling this means that the histogram bin content is flagged
152  //as being an average and so adding histos from different jobs
153  //will produce weighted mean
154 
155  h1d->SetBit(TH1::kIsAverage);
156 
157  for(int j = 1; j!=nBins_2d+1; j++){
158 
159  TH1F* hproj = (TH1F*)h2d->ProjectionY("Proj",j,j,"e");
160 
161  //do not fill if there are no entries in the bin
162  if(hproj->GetEntries()<=0) {
163  delete hproj;
164  continue;
165  }
166 
167  if(MeanRms==0){
168  h1d->SetBinContent(j,hproj->GetMean());
169  h1d->SetBinError(j,hproj->GetMeanError());
170 
171  }
172  else if(MeanRms==1){
173  h1d->SetBinContent(j,hproj->GetRMS());
174  h1d->SetBinError(j,hproj->GetRMSError());
175  }
176  else ATH_MSG_DEBUG("Incorrect switch in MeanRMSProjectionsBarrel()");
177 
178  delete hproj;
179  }
180 
181  return;
182  }

◆ FillRMSFromCharProfile()

void Muon::MuonDQAFitFunc::FillRMSFromCharProfile ( TProfile *  hProf_char,
TH1F *  hRms_char 
) const

Fills a histogram with the RMS values of a TProfile, which labeled bins->keeping the labeling for the bins.

Definition at line 213 of file MuonDQAFitFunc.cxx.

214  {
215 
216  //Uses the spread information in an already filled TProfile (with character bins)
217  //to fill a second TH1F with the (correctly weigthed by N events) RMS of each bin
218 
219  int nBins = hProf_char->GetNbinsX();
220 
221  for(int j = 1; j!=nBins+1; j++){
222 
223  //float bincentre = (float)hProf->GetBinCenter(j);
224  const char* BinLabel_char = hProf_char->GetXaxis()->GetBinLabel(j);
225 
226  //By default this is RMS/sqrt(N)
227  float binerr = (float)hProf_char->GetBinError(j);
228 
229  //getting binentries
230  float binentries = (float)hProf_char->GetBinEntries(j);
231 
232  //calculating the RMS from the above quantities
233  float rms = (float)binerr*(std::sqrt(binentries));
234 
235  hRms_char->SetCanExtend(TH1::kAllAxes);
236  hRms_char->Fill(BinLabel_char,rms);
237 
238  } // Loop over bins
239 
240  hRms_char->LabelsDeflate("X");
241  if (hRms_char->GetEntries() > 0) hRms_char->LabelsOption("v");
242  return;
243  }

◆ FillRMSFromProfile()

void Muon::MuonDQAFitFunc::FillRMSFromProfile ( TProfile *  hProf,
TH1F *  hRms 
) const

Fills a histogram with the RMS values of a TProfile.

Definition at line 185 of file MuonDQAFitFunc.cxx.

186  {
187  //Uses the spread information in an already filled TProfile
188  //to fill a second TH1F with the (correctly weigthed by N events) RMS of each bin
189 
190  int nBins = hProf->GetNbinsX();
191 
192  for(int j = 1; j!=nBins+1; j++){
193 
194  float bincentre = (float)hProf->GetBinCenter(j);
195 
196  //By default this is RMS/sqrt(N)
197  float binerr = (float)hProf->GetBinError(j);
198 
199  //getting binentries
200  float binentries = (float)hProf->GetBinEntries(j);
201 
202  //calculating the RMS from the above quantities
203  float rms = (float)binerr*(std::sqrt(binentries));
204 
205  hRms->Fill(bincentre,rms);
206  } // Loop over bins
207 
208  return;
209  }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

static const InterfaceID& Muon::MuonDQAFitFunc::interfaceID ( )
inlinestatic

access to tool interface

Definition at line 40 of file MuonDQAFitFunc.h.

40 { return IID_MuonDQAFitFunc; }

◆ MinWindow1Set_from_TProf()

void Muon::MuonDQAFitFunc::MinWindow1Set_from_TProf ( TProfile *  hProf,
float  windowMin,
float  windowMax 
) const

================================================================

Establishes a minimim window for the TProfile

Definition at line 115 of file MuonDQAFitFunc.cxx.

116  {
117  float min=hProf->GetMinimum();
118  float max=hProf->GetMaximum();
119  float margin=0.05*(max-min);
120  if(min > windowMin) min=windowMin-margin;
121  if(max < windowMax) max=windowMax+margin;
122  hProf->SetMinimum(min);
123  hProf->SetMaximum(max);
124 
125  }

◆ MinWindow2Set_from_TProf()

void Muon::MuonDQAFitFunc::MinWindow2Set_from_TProf ( TProfile2D *  hProf,
float  windowMin,
float  windowMax 
) const

Definition at line 128 of file MuonDQAFitFunc.cxx.

129  {
130  float min=hProf->GetMinimum();
131  float max=hProf->GetMaximum();
132  float margin=0.05*(max-min);
133  if(min > windowMin) min=windowMin-margin;
134  if(max < windowMax) max=windowMax+margin;
135  hProf->SetMinimum(min);
136  hProf->SetMaximum(max);
137  }

◆ msg() [1/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ MuonEffHisto1D()

void Muon::MuonDQAFitFunc::MuonEffHisto1D ( TH1F *  h_Num,
TH1F *  h_Denom,
TProfile *  h_Eff 
) const

Definition at line 68 of file MuonDQAFitFunc.cxx.

69  {
70  int nBins;
71  nBins = h_Num->GetNbinsX();
72  for (int bin=0; bin!=nBins; ++bin) {
73  int nPass = int(h_Num->GetBinContent(bin+1));
74  int nFail = int(h_Denom->GetBinContent(bin+1)) - nPass;
75  double x = h_Denom->GetBinCenter(bin+1);
76  for (int pass=0; pass!=nPass; ++pass) {
77  h_Eff->Fill(x,1.);
78  }
79  for (int fail=0; fail!=nFail; ++fail) {
80  h_Eff->Fill(x,0.);
81  }
82  }
84 
85  }

◆ MuonEffHisto2D()

void Muon::MuonDQAFitFunc::MuonEffHisto2D ( TH2F *  h_Num,
TH2F *  h_Denom,
TProfile2D *  h_Eff 
) const

Definition at line 88 of file MuonDQAFitFunc.cxx.

89  {
90  int nBins;
91  int nBinsY;
92  nBins = h_Num->GetNbinsX();
93  nBinsY = h_Num->GetNbinsY();
94  for (int bin=0; bin!=nBins; ++bin) {
95  for (int binY=0; binY!=nBinsY; ++binY) {
96  int nPass = int(h_Num->GetBinContent(bin+1,binY+1));
97  int nFail = int(h_Denom->GetBinContent(bin+1,binY+1)) - nPass;
98  double x = h_Denom->GetXaxis()->GetBinCenter(bin+1);
99  double y = h_Denom->GetYaxis()->GetBinCenter(binY+1);
100  for (int pass=0; pass!=nPass; ++pass) {
101  h_Eff->Fill(x,y,1.);
102  }
103  for (int fail=0; fail!=nFail; ++fail) {
104  h_Eff->Fill(x,y,0.);
105  }
106  }
107  }
109 
110  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

◆ ZmumuFitHistograms()

void Muon::MuonDQAFitFunc::ZmumuFitHistograms ( TH1F *  hmass,
TH1F *  hwidth,
TH1F *  h1[],
int  nbins 
)

Definition at line 34 of file MuonDQAFitFunc.cxx.

35  {
36  double mass=0.;
37  double mass_error=0.;
38  double width=0.;
39  double width_error=0.;
40  double maxmass=0;
41  double maxwidth=0;
42  TF1 *ZmumFit = new TF1("ZmumFit","gaus",89.,93.);
43  for (int i=0; i<nbins; i++) {
44  if (h1[i]->GetEntries()>50) {
45  ZmumFit->SetParameter(1,3.097);
46  ZmumFit->SetParameter(2,0.05);
47  h1[i]->Fit("ZmumFit","RQNM");
48  mass=ZmumFit->GetParameter(1)-m_ZmumuPDGmass;
49  mass_error=ZmumFit->GetParError(1);
50  width=ZmumFit->GetParameter(2);
51  width_error=ZmumFit->GetParError(2);
52  hmass->SetBinContent(i+1,mass);
53  hmass->SetBinError(i+1,mass_error);
54  hwidth->SetBinContent(i+1,width);
55  hwidth->SetBinError(i+1,width_error);
56  if( (std::abs(mass)+mass_error)>maxmass ) maxmass=std::abs(mass)+mass_error;
57  if( (std::abs(width)+width_error)>maxwidth ) maxwidth=std::abs(width)+width_error;
58  }
59  }
60  if (maxmass>0.1) maxmass=0.1;
61  if (maxwidth>0.2) maxwidth=0.2;
62  hmass->SetAxisRange(-maxmass,maxmass,"Y");
63  hwidth->SetAxisRange(0.,maxwidth,"Y");
64 
65  delete ZmumFit;
66  }

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_maxMuonEffWindow

float Muon::MuonDQAFitFunc::m_maxMuonEffWindow
protected

Definition at line 68 of file MuonDQAFitFunc.h.

◆ m_minMuonEffWindow

float Muon::MuonDQAFitFunc::m_minMuonEffWindow
protected

Definition at line 67 of file MuonDQAFitFunc.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ m_ZmumuPDGmass

double Muon::MuonDQAFitFunc::m_ZmumuPDGmass
private

Definition at line 71 of file MuonDQAFitFunc.h.

◆ NBINS

const int Muon::MuonDQAFitFunc::NBINS =6
staticprotected

Definition at line 66 of file MuonDQAFitFunc.h.


The documentation for this class was generated from the following files:
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
Base_Fragment.mass
mass
Definition: Sherpa_i/share/common/Base_Fragment.py:59
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
bin
Definition: BinsDiffFromStripMedian.h:43
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
GetEntries
TGraphErrors * GetEntries(TH2F *histo)
Definition: TRTCalib_makeplots.cxx:4019
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
read_hist_ntuple.h1
h1
Definition: read_hist_ntuple.py:21
x
#define x
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
Trk::binY
@ binY
Definition: BinningType.h:48
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
Muon::MuonDQAFitFunc::m_ZmumuPDGmass
double m_ZmumuPDGmass
Definition: MuonDQAFitFunc.h:71
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
Muon::MuonDQAFitFunc::MinWindow2Set_from_TProf
void MinWindow2Set_from_TProf(TProfile2D *hProf, float windowMin, float windowMax) const
Definition: MuonDQAFitFunc.cxx:128
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
Muon::MuonDQAFitFunc::m_maxMuonEffWindow
float m_maxMuonEffWindow
Definition: MuonDQAFitFunc.h:68
MuonValidation_CreateResolutionProfiles.fit
def fit(h, emin, emax)
Definition: MuonValidation_CreateResolutionProfiles.py:69
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
dumpTgcDigiJitter.nBins
list nBins
Definition: dumpTgcDigiJitter.py:29
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
plotBeamSpotVxVal.bin
int bin
Definition: plotBeamSpotVxVal.py:83
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
a
TList * a
Definition: liststreamerinfos.cxx:10
y
#define y
h
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
beamspotnt.rms
rms
Definition: bin/beamspotnt.py:1266
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
Muon::MuonDQAFitFunc::m_minMuonEffWindow
float m_minMuonEffWindow
Definition: MuonDQAFitFunc.h:67
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
Muon::MuonDQAFitFunc::MinWindow1Set_from_TProf
void MinWindow1Set_from_TProf(TProfile *hProf, float windowMin, float windowMax) const
================================================================
Definition: MuonDQAFitFunc.cxx:115
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
readCCLHist.float
float
Definition: readCCLHist.py:83
LArMonTransforms.Mean
def Mean(inputs)
Definition: LArMonTransforms.py:438
fitman.k
k
Definition: fitman.py:528
beamspotman.fail
def fail(message)
Definition: beamspotman.py:201