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, V, H > &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, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &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 30 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 24 of file MuonDQAFitFunc.cxx.

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

◆ ~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, V, H > &  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, V, H > &  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, V, H > &  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, V, H > &  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, V, H > &  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 248 of file MuonDQAFitFunc.cxx.

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

◆ FillGaussMeanAndWidth() [1/2]

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

Definition at line 361 of file MuonDQAFitFunc.cxx.

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

◆ FillGaussMeanAndWidth() [2/2]

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

Definition at line 303 of file MuonDQAFitFunc.cxx.

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

◆ FillMeanRmsProj()

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

Definition at line 142 of file MuonDQAFitFunc.cxx.

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

◆ 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 215 of file MuonDQAFitFunc.cxx.

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

◆ FillRMSFromProfile()

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

Fills a histogram with the RMS values of a TProfile.

Definition at line 187 of file MuonDQAFitFunc.cxx.

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

◆ 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 117 of file MuonDQAFitFunc.cxx.

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

◆ MinWindow2Set_from_TProf()

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

Definition at line 130 of file MuonDQAFitFunc.cxx.

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

◆ 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 70 of file MuonDQAFitFunc.cxx.

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

◆ MuonEffHisto2D()

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

Definition at line 90 of file MuonDQAFitFunc.cxx.

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

◆ 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 36 of file MuonDQAFitFunc.cxx.

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

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 67 of file MuonDQAFitFunc.h.

◆ m_minMuonEffWindow

float Muon::MuonDQAFitFunc::m_minMuonEffWindow
protected

Definition at line 66 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 70 of file MuonDQAFitFunc.h.

◆ NBINS

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

Definition at line 65 of file MuonDQAFitFunc.h.


The documentation for this class was generated from the following files:
Base_Fragment.mass
mass
Definition: Sherpa_i/share/common/Base_Fragment.py:59
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
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:4025
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
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
Trk::binY
@ binY
Definition: BinningType.h:48
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
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:70
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition: AthCommonDataStore.h:145
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:130
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
Muon::MuonDQAFitFunc::m_maxMuonEffWindow
float m_maxMuonEffWindow
Definition: MuonDQAFitFunc.h:67
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:240
plotBeamSpotVxVal.bin
int bin
Definition: plotBeamSpotVxVal.py:82
a
TList * a
Definition: liststreamerinfos.cxx:10
y
#define y
h
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
beamspotnt.rms
rms
Definition: bin/beamspotnt.py:1265
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:629
Muon::MuonDQAFitFunc::m_minMuonEffWindow
float m_minMuonEffWindow
Definition: MuonDQAFitFunc.h:66
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:801
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:117
LArMonTransforms.Mean
def Mean(inputs)
Definition: LArMonTransforms.py:438
fitman.k
k
Definition: fitman.py:528
beamspotman.fail
def fail(message)
Definition: beamspotman.py:197
python.LArMinBiasAlgConfig.float
float
Definition: LArMinBiasAlgConfig.py:65