|  | ATLAS Offline Software
    | 
 
 
 
Go to the documentation of this file.
   18 #include "CLHEP/Vector/LorentzVector.h" 
   40     return StatusCode::SUCCESS;
 
   48       return StatusCode::SUCCESS;
 
   55         return(StatusCode::FAILURE);
 
   58                             << 
" run: " << 
evt->runNumber()
 
   59                             << 
" hasBeamSpotWeight: "<< 
evt->hasBeamSpotWeight()
 
   60                             << 
" beamSpotWeight: "<< 
evt->beamSpotWeight()  );
 
   65     if(!h_inputMcEventCollection.
isValid()) {
 
   66       ATH_MSG_FATAL(
"No input McEventCollection called " << h_inputMcEventCollection.
name() << 
" in StoreGate.");
 
   67       return StatusCode::FAILURE;
 
   71     for (
const auto currentGenEvent : *h_inputMcEventCollection) {
 
   73       if ( !currentGenEvent ) {
 
   75         ATH_MSG_WARNING(
"No first event found in the McEventCollection input collection, use default weight="<<
weight);
 
   83         float z=signalVertex->position().z();
 
   85         float beamz=beamSpotHandle->beamPos().z();
 
   86         float newsigmaz=beamSpotHandle->beamSigma(2);
 
   88         float pullnew=(
z-beamz)/newsigmaz;
 
   92         if(std::abs(pullold)<10 && std::abs(pullnew)<10) {
 
   98           ATH_MSG_WARNING(
"Large pull of beamspot: Beamspot z="<<beamz<<
", z="<<
z<<
"; old sigma_z="<<
m_input_beam_sigma_z<<
", old pull="<<pullold<<
"; new sigma_z="<<newsigmaz<<
", new pull="<<pullnew<<
" => use default weight="<<
weight);
 
  111       return StatusCode::FAILURE;
 
  114       BeamSpotWeight(0) = 
weight;
 
  119       if (!
evt.isValid()) {
 
  121         return(StatusCode::FAILURE);
 
  124                             << 
" run: " << 
evt->runNumber()
 
  125                             << 
" hasBeamSpotWeight: "<< 
evt->hasBeamSpotWeight()
 
  126                             << 
" beamSpotWeight: "<< 
evt->beamSpotWeight()  );
 
  129     return StatusCode::SUCCESS;
 
  137       if (!ge.vertices().empty()) {
 
  138         ATH_MSG_DEBUG(
"No signal_process_vertex found - using the first GenVertex in the event.");
 
  139         auto signalVertex = ge.vertices().front();
 
  143         if (!ge.vertices().empty()) {
 
  144           ATH_MSG_ERROR(
"Failed to set signal_process_vertex for GenEvent!!");
 
  156     if( !ge.signal_process_vertex() ) {
 
  157       if (!ge.vertices_empty()) {
 
  158         ATH_MSG_DEBUG(
"No signal_process_vertex found - using the first GenVertex in the event.");
 
  159         HepMC::GenVertex *signalVertex = *(ge.vertices_begin());
 
  162       if( !ge.signal_process_vertex() ) { 
 
  163         if (!ge.vertices_empty()) {
 
  164           ATH_MSG_ERROR(
"Failed to set signal_process_vertex for GenEvent!!");
 
  173       return ge.signal_process_vertex();
 
  
virtual StatusCode execute(const EventContext &ctx) const override final
Athena algorithm's interface method execute()
bool isAvailable()
Test to see if this variable exists in the store, for the referenced object.
const std::string & name() const
Return the StoreGate ID for the referenced object.
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
bool msgLvl(const MSG::Level lvl) const
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo
HepMC::ConstGenVertexPtr GetSignalProcessVertex(const HepMC::GenEvent &ge) const
Ensure that the GenEvent::signal_process_vertex has been set.
An algorithm that can be simultaneously executed in multiple threads.
Handle class for recording to StoreGate.
virtual StatusCode initialize() override final
Athena algorithm's interface method initialize()
BeamSpotReweightingAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadHandleKey< McEventCollection > m_inputMcEventCollection
::StatusCode StatusCode
StatusCode definition for legacy code.
Handle class for adding a decoration to an object.
Handle class for adding a decoration to an object.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
StatusCode initialize(bool used=true)
Gaudi::Property< float > m_input_beam_sigma_z
SG::WriteDecorHandleKey< xAOD::EventInfo > m_beamSpotWeight
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
#define ATH_MSG_WARNING(x)
const HepMC::GenVertex * ConstGenVertexPtr
Handle class for reading from StoreGate.
bool isPresent() const
Is the referenced container present in SG?
GenVertex * signal_process_vertex(const GenEvent *e)