Skip to content
Snippets Groups Projects
Commit a77e12cc authored by Francesca Pastore's avatar Francesca Pastore
Browse files

included Tims changes

parents b396e993 ac7d1a9f
No related branches found
No related tags found
No related merge requests found
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/*
* LogLevels.h
* Rivet_i
*
* Created by James Monk on 18/06/2008.
*
* Converts between the Gaudi Logging levels and the Rivet ones
*
*/
#ifndef RIVET_I_LOGLEVELS_H
#define RIVET_I_LOGLEVELS_H
#include "Rivet/Tools/Logging.hh"
#include "GaudiKernel/IMessageSvc.h"
Rivet::Log::Level rivetLevel(MSG::Level gaudiLevel){
switch(gaudiLevel){
case MSG::NIL :
return Rivet::Log::ERROR;
break;
case MSG::VERBOSE :
return Rivet::Log::TRACE;
break;
case MSG::DEBUG :
return Rivet::Log::DEBUG;
break;
case MSG::INFO :
return Rivet::Log::INFO;
break;
case MSG::WARNING :
return Rivet::Log::WARN;
break;
case MSG::ERROR :
return Rivet::Log::ERROR;
break;
case MSG::FATAL :
return Rivet::Log::ERROR;
break;
case MSG::ALWAYS :
return Rivet::Log::TRACE;
break;
default:
return Rivet::Log::INFO;
}
return Rivet::Log::INFO;
}
#endif
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#ifndef RIVET_I_H
#define RIVET_I_H
#include "AthenaBaseComps/AthAlgorithm.h"
#include "GaudiKernel/ServiceHandle.h"
#include "Rivet/AnalysisHandler.hh"
#include <vector>
#include <string>
class ISvcLocator;
//class ITHistSvc;
/// Interface to the Rivet analysis package
/// @author James Monk <jmonk@cern.ch>
/// @author Andy Buckley <andy.buckley@cern.ch>
class Rivet_i : public AthAlgorithm {
public:
/// Standard algorithm constructor
Rivet_i(const std::string &name, ISvcLocator *pSvcLocator);
/// @brief Initialise the Rivet interface and Athena services.
///
/// Pass a list of analyses to the Rivet AnalysisHandler, which dynamically
/// loads the necessary libraries (including user-written analyses).
StatusCode initialize();
/// Run the Rivet analyses on one event, which is retrieved from StoreGate.
StatusCode execute();
/// Finalise each analysis and commit the plots to an AIDA tree and the
/// THistSvc ROOT tree.
StatusCode finalize();
private:
/// Book an AIDA::IDataPointSet into the THistSvc as a TH1D at path @param path
// StatusCode regHist(const AIDA::IDataPointSet& dps, const std::string& path);
/// Book an AIDA::IDataPointSet into the THistSvc as a TGraph at path @param path
// StatusCode regGraph(const AIDA::IDataPointSet& dps, const std::string& path);
// Check and potentially modify events for correct units, beam particles, ...
const HepMC::GenEvent* checkEvent(const HepMC::GenEvent* event);
/// A pointer to the THistSvc
//ServiceHandle<ITHistSvc> m_histSvc;
/// The stream name for storing the output plots under (default "/Rivet")
std::string m_stream;
/// The base file name to write results to.
std::string m_file;
//specify a pre-existing yoda file to initialize from
std::string m_preload;
/// @brief The analysis plugin search path
///
/// This will be used to internally set RIVET_ANALYSIS_PATH, if not already set in the environment.
std::string m_anapath;
/// @brief Whether to avoid the beam consistency checks
///
/// Default is false: checks will be made to ensure that the supplied
/// events have beams of the sort that the analysis was written to expect.
bool m_ignorebeams;
/// @brief Will we convert Rivet's internal histo format into a ROOT histo for streaming with THistSvc?
///
/// The default is yes
/// Currently (03.01.12) there is no conversion for 2D distributions, in which case you
/// want to set this to False
bool m_doRootHistos;
/// The name of the run (prepended to plot paths).
std::string m_runname;
/// The GenEvent StoreGate key (default "GEN_EVENT")
std::string m_genEventKey;
/// A Rivet analysis handler
Rivet::AnalysisHandler* m_analysisHandler;
/// A list of names of the analyses to run (set from the job properties)
std::vector<std::string> m_analysisNames;
/// The cross section for this run of events, set from the job properties.
double m_crossSection;
/// The uncertainity of the cross section for this run of events, set from the job properties.
double m_crossSection_uncert;
/// Flag to determine whether Rivet init has already happened (in execute())
bool m_init;
///Skip variation weights and only run nominal
bool m_skipweights;
///Weight cap to set allowed maximum for weights
double m_weightcap;
};
#endif
...@@ -208,14 +208,15 @@ StatusCode ComboHypo::execute(const EventContext& context ) const { ...@@ -208,14 +208,15 @@ StatusCode ComboHypo::execute(const EventContext& context ) const {
for (const ElementLink<DecisionContainer>& dEL : it->second){ for (const ElementLink<DecisionContainer>& dEL : it->second){
uint32_t featureKey = 0, roiKey = 0; uint32_t featureKey = 0, roiKey = 0;
uint16_t featureIndex = 0, roiIndex = 0; uint16_t featureIndex = 0, roiIndex = 0;
// NOTE: roiKey, roiIndex are only currently used in the discrimination for L1 Decision objects (which don't have a 'feature' link)
// NOTE: We should make it configurable to choose either the feature or the ROI here, as done in the InputMaker base class when merging.
ATH_CHECK( extractFeatureAndRoI(dEL, featureKey, featureIndex, roiKey, roiIndex) ); ATH_CHECK( extractFeatureAndRoI(dEL, featureKey, featureIndex, roiKey, roiIndex) );
const uint32_t uniquenessHash = (featureKey != 0 ? (featureKey + featureIndex) : (roiKey + roiIndex)); const uint32_t uniquenessHash = (featureKey != 0 ? (featureKey + featureIndex) : (roiKey + roiIndex));
if (uniquenessHash == 0) { if (uniquenessHash == 0) {
ATH_MSG_ERROR("Object has no feature, and no initialRoI. Cannot get obtain unique element to avoid double-counting."); ATH_MSG_ERROR("Object has no feature, and no initialRoI. Cannot get obtain unique element to avoid double-counting.");
return StatusCode::FAILURE; return StatusCode::FAILURE;
} }
uniqueDecisionFeatures.insert( uniquenessHash ); uniqueDecisionFeatures.insert( uniquenessHash );
// TODO - do something with the ROI
} }
// save combinations of all legs for the tools // save combinations of all legs for the tools
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment