|
ATLAS Offline Software
|
Go to the documentation of this file.
21 template<
typename ATYPE,
typename HTYPE>
31 template<
typename ATYPE1,
typename ATYPE2,
typename HTYPE>
41 #define scale1 this->m_toGeV1
42 #define scale2 this->m_toGeV2
84 template<
typename T,
typename HTYPE>
86 AttvsAttFiller(
const std::string & att1,
const std::string & att2 , HTYPE*
h,
bool gev1,
bool gev2) :
AccessorAndHisto2<T,T, HTYPE>(att1,att2,
h, gev1, gev2) {}
93 template<
typename T,
typename HTYPE>
95 AttvsVecAttIndexFiller(
const std::string & att1,
const std::string & att2 , HTYPE*
h,
size_t index ,
bool gev1,
bool gev2,
bool swapAxis=
false) :
AccessorAndHisto2<std::vector<T>,T, HTYPE>(att1,att2,
h, gev1, gev2) ,
m_index(
index),
m_swap(swapAxis){}
131 static const std::map< std::string , Supported >
m( { {
"int",
Int}, {
"float",
Float}, {
"vector<float>",
VectFloat}, {
"vector<int>",
VectInt}, } );
132 auto itr =
m.find(
n );
133 return ( itr !=
m.end() ? itr->second :
Unknown );
165 , m_selectedIndex(-1)
166 , m_doTProfile(false)
167 , m_histoFiller(nullptr)
179 if(m_histoFiller)
delete m_histoFiller;
182 CHECK( m_histoDef.retrieve() );
184 if(m_attNames.empty() ) {
186 return StatusCode::FAILURE;
189 if( m_attNames.size() != m_attTypes.size() ){
190 ATH_MSG_ERROR(
"Differing number of attributes names and types ");
191 return StatusCode::FAILURE;
194 m_attGeV.resize(m_attNames.size(),
false);
196 return StatusCode::SUCCESS;
204 if( m_attTypes.size() == 1 ){
205 bool gev1 = m_attGeV[0];
210 bookHisto( m_histoDef->buildTH1F() ), gev1 );
214 bookHisto( m_histoDef->buildTH1F() ), gev1 );
218 if(m_selectedIndex==-1)
220 bookHisto( m_histoDef->buildTH1F() ), gev1 );
223 bookHisto( m_histoDef->buildTH1F() ) , m_selectedIndex , gev1
229 if(m_selectedIndex==-1)
231 bookHisto( m_histoDef->buildTH1F() ), gev1 );
234 bookHisto( m_histoDef->buildTH1F() ) , m_selectedIndex , gev1
240 ATH_MSG_ERROR(
"Do not support attribute type "<< m_attTypes[0] <<
" "<< typ);
246 else if( m_attTypes.size() == 2 ){
247 std::string att1 = m_attTypes[0];
248 std::string att2 = m_attTypes[1];
249 std::string
n1 = m_attNames[0];
250 std::string n2 = m_attNames[1];
251 bool gev1 = m_attGeV[0];
252 bool gev2 = m_attGeV[1];
261 bookHisto( m_histoDef->buildTProfile() ), gev1, gev2 );
264 bookHisto( m_histoDef->buildTH2F() ),gev1, gev2 );
270 if(m_selectedIndex==-1) {
ATH_MSG_ERROR(
"Must select an index >-1 for vector<float> vs float attribute histogramming");
return 1;}
272 if(swapAxis) att1.swap(att2);
275 bookHisto( m_histoDef->buildTProfile() ),
276 m_selectedIndex, gev1, gev2, swapAxis);
280 bookHisto( m_histoDef->buildTH2F() ),
281 m_selectedIndex, gev1, gev2, swapAxis);
286 ATH_MSG_ERROR(
"Do not support attribute types "<< m_attTypes[0] <<
" with "<< m_attTypes[1]);
291 if(m_histoFiller==
nullptr) {
300 m_histoFiller->fill(j,
weight);
305 if (cont.
empty() )
return 0;
307 if ( !m_histoFiller->isValid(*j0) ){
321 if(m_selectedIndex >-1 ) {
322 TString
s=
" (at index ";
s+= m_selectedIndex;
s+=
")";
323 h->SetTitle(
h->GetTitle()+
s);
virtual int buildHistos()
virtual void renameAndRegister(TH1 *h, const std::string &subD="", Interval_t i=all)
Rename an histo according to the tool's path. redefine here to take m_selectedIndex into account.
AttvsVecAttIndexFiller(const std::string &att1, const std::string &att2, HTYPE *h, size_t index, bool gev1, bool gev2, bool swapAxis=false)
JetAttributeHisto(const std::string &t)
virtual void fill(const xAOD::Jet &j, float weight)
Helper class to provide type-safe access to aux data.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
virtual void fill(const xAOD::Jet &j, float weight)
AccessorAndHisto(const std::string &attname, HTYPE *h, bool gev)
std::vector< ALFA_RawDataCollection_p1 > t1
std::vector< bool > m_attGeV
VecAttIndexFiller(const std::string &attname, TH1F *h, size_t index, bool gev1)
virtual ~HistoFiller()=default
std::vector< size_t > vec
virtual int fillHistosFromContainer(const xAOD::JetContainer &cont, float weight)
std::vector< std::string > m_attNames
virtual int fillHistosFromContainer(const xAOD::JetContainer &cont, float weight)
static Supported fromString(const std::string &n1, const std::string &n2)
VecAttFiller(const std::string &attname, TH1F *h, bool gev1)
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
std::vector< std::string > m_attTypes
virtual void fill(const xAOD::Jet &j, float weight)
AttFiller(const std::string &attname, TH1F *h, bool gev1)
virtual bool isValid(const xAOD::Jet &)
Accessor< ATYPE2 > m_accessor2
virtual void fill(const xAOD::Jet &j, float weight)
::StatusCode StatusCode
StatusCode definition for legacy code.
AttvsAttFiller(const std::string &att1, const std::string &att2, HTYPE *h, bool gev1, bool gev2)
#define CHECK(...)
Evaluate an expression and check for errors.
virtual bool isValid(const xAOD::Jet &j)
virtual int fillHistosFromJet(const xAOD::Jet &j, float weight)
AccessorAndHisto2(const std::string &att1, const std::string &att2, HTYPE *h, bool gev1, bool gev2)
static Supported fromString(const std::string &n)
virtual bool isValid(const xAOD::Jet &j)
Interval_t
Redefinition of fill intervals as in ManagedMonitorToolBase.
std::vector< ALFA_RawDataContainer_p1 > t2
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
virtual void fill(const xAOD::Jet &, float)
virtual bool isValid(const xAOD::Jet &j)
Accessor< ATYPE > m_accessor
virtual ~JetAttributeHisto()
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
virtual void renameAndRegister(TH1 *h, const std::string &subD="", Interval_t ityp=useToolInterval)
Rename an histo according to the tool's path.
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
virtual bool isValid(const xAOD::Jet &j)
ToolHandle< HistoDefinitionTool > m_histoDef
bool empty() const noexcept
Returns true if the collection is empty.
virtual void fill(const xAOD::Jet &j, float weight)
virtual bool isValid(const xAOD::Jet &j)