ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
dqm_algorithms::DivideReference_BinContentComp Struct Reference

#include <DivideReference_BinContentComp.h>

Inheritance diagram for dqm_algorithms::DivideReference_BinContentComp:
Collaboration diagram for dqm_algorithms::DivideReference_BinContentComp:

Public Member Functions

 DivideReference_BinContentComp ()
 
DivideReferenceclone ()
 
void printDescription (std::ostream &out)
 
dqm_core::Resultexecute (const std::string &, const TObject &, const dqm_core::AlgorithmConfig &)
 

Private Attributes

std::string m_name
 

Detailed Description

Definition at line 16 of file DivideReference_BinContentComp.h.

Constructor & Destructor Documentation

◆ DivideReference_BinContentComp()

dqm_algorithms::DivideReference_BinContentComp::DivideReference_BinContentComp ( )
inline

Definition at line 18 of file DivideReference_BinContentComp.h.

18 : DivideReference("BinContentComp") {};

Member Function Documentation

◆ clone()

dqm_algorithms::DivideReference * dqm_algorithms::DivideReference::clone ( )
inherited

Definition at line 37 of file DivideReference.cxx.

38 {
39  return new DivideReference(m_name);
40 }

◆ execute()

dqm_core::Result * dqm_algorithms::DivideReference::execute ( const std::string &  name,
const TObject &  object,
const dqm_core::AlgorithmConfig &  config 
)
inherited

Definition at line 43 of file DivideReference.cxx.

44 {
45  TH1 * histogram;
46 
47  if( object.IsA()->InheritsFrom( "TH1" ) ) {
48  histogram = (TH1*)(object.Clone());
49  } else {
50  throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
51  }
52 
53  const double minstat = dqm_algorithms::tools::GetFirstFromMap( "MinStat", config.getParameters(), -1);
54 
55  if (histogram->GetEffectiveEntries() < minstat ) {
57  result->tags_["InsufficientEffectiveEntries"] = histogram->GetEffectiveEntries();
58  delete histogram;
59  return result;
60  }
61 
62 
63  TObject* ro = config.getReference();
64  const TObject* firstReference=0;
65  TObject* secondReference=0;
66  try {
67  dqm_algorithms::tools::handleReference( *ro , firstReference , secondReference );
68  }
69  catch ( dqm_core::Exception & ex ) {
70  throw dqm_core::BadRefHist(ERS_HERE,name," Could not retreive reference");
71  }
72  //Check the reference
73  const TH1* refhist = dynamic_cast<const TH1*>(firstReference);
74  if ( refhist==0 )
75  {
76  throw dqm_core::BadRefHist( ERS_HERE, "Dimension", name );
77  }
78  if ((histogram->GetDimension() != refhist->GetDimension()) ||
79  (histogram->GetNbinsX() != refhist->GetNbinsX()) ||
80  (histogram->GetNbinsY() != refhist->GetNbinsY()) ||
81  refhist->GetNbinsZ() != histogram->GetNbinsZ() )
82  {
83  throw dqm_core::BadRefHist( ERS_HERE, "number of bins", name );
84  }
85  //Configuration done, prepare input histogram
86  histogram->Divide(refhist);
87  //Now prepare to run the real algorithm...
88  ERS_DEBUG(2,"Running algorithm: "<<m_name);
89  dqm_core::Algorithm* subalgorithm;
90  try {
91  subalgorithm = dqm_core::AlgorithmManager::instance().getAlgorithm( m_name );
92  }
93  catch ( dqm_core::AlgorithmNotFound& ex )
94  {
95  ERS_DEBUG(2,"Cannot find algorithm:"+m_name);
96  throw dqm_core::BadConfig(ERS_HERE,name,"Cannot Find sub-algorithm:"+m_name);
97  }
98  //Copy configuration and update reference
100  newConf.setReference( secondReference );
101  dqm_core::Result* result = subalgorithm->execute( name , *histogram , newConf);
102  ERS_DEBUG(2,"Sub algorithm returns:"<<*result);
103  //Add modified histogram to result
104  TObject* robject = result->getObject();
105  if ( !robject ) //No object defined, add the modified histogram
106  {
107  ERS_DEBUG(2,"Adding modified histogram in result");
108  result->object_.reset(histogram);
109  }
110  else //Transform the object_ in TObjArray (if needed) and add this result
111  {
112  ERS_DEBUG(2,"Result already have an associated TObject, appending modified histogram");
113  if ( robject->IsA()->InheritsFrom("TCollection") ) //It is already an array add it...
114  {
115  static_cast<TCollection*>(robject)->Add( histogram );
116  }
117  else
118  {
119  TObjArray* array = new TObjArray( 2 );
120  array->AddAt( robject->Clone() , 0 );
121  array->AddAt( histogram , 1 );
122  //Check in again
123  result->object_.reset( array );
124  }
125  ERS_DEBUG(2,"Result now have a TObjArray of size:"<<static_cast<TObjArray*>(result->getObject())->GetEntries());
126  }
127  return result;
128 }

◆ printDescription()

void dqm_algorithms::DivideReference::printDescription ( std::ostream &  out)
inherited

Definition at line 131 of file DivideReference.cxx.

131  {
132  out<<"DivideReference_"+m_name+" : Performs the "+m_name+" algorithm after dividing the input histogram by the reference. I.e. performing: histogram /= Reference (see TH1::Divide). Adds to the output TObject list the modified input histogram."<<std::endl;
133  out<<"Optional Parameter : MinStat : Minimum histogram statistics needed to perform Algorithm"<<std::endl;
134 
135 
136 }

Member Data Documentation

◆ m_name

std::string dqm_algorithms::DivideReference::m_name
privateinherited

Definition at line 26 of file DivideReference.h.


The documentation for this struct was generated from the following file:
Undefined
@ Undefined
Definition: MaterialTypes.h:8
get_generator_info.result
result
Definition: get_generator_info.py:21
IsA
#define IsA
Declare the TObject style functions.
Definition: xAODTEventBranch.h:59
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
Result
ICscStripFitter::Result Result
Definition: CalibCscStripFitter.cxx:13
dqm_algorithms::tools::SimpleAlgorithmConfig
This class provides a simple implementation of the DQMF abstract AlgorithmConfig interface which can ...
Definition: SimpleAlgorithmConfig.h:22
lumiFormat.array
array
Definition: lumiFormat.py:91
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
dqm_algorithms::DivideReference::m_name
std::string m_name
Definition: DivideReference.h:26
dqm_algorithms::DivideReference::DivideReference
DivideReference(const std::string &name)
Definition: DivideReference.cxx:31
dqm_algorithms::tools::handleReference
void handleReference(const TObject &inputReference, const TObject *&firstReference, TObject *&secondReference)
Helper function used to handle complex reference histograms This function gets as input a reference o...
Definition: AlgorithmHelper.cxx:828
dqm_algorithms::tools::GetFirstFromMap
double GetFirstFromMap(const std::string &paramName, const std::map< std::string, double > &params)
Definition: AlgorithmHelper.cxx:339
histogram
std::string histogram
Definition: chains.cxx:52