Commit 775c4d0e authored by Atlas-Software Librarian's avatar Atlas-Software Librarian Committed by Graeme Stewart
Browse files

'CMakeLists.txt' (BCM_ZeroSuppression-00-00-08)

parent 554ca592
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef BCM_ZEROSUPPRESSION_H
#define BCM_ZEROSUPPRESSION_H
#include "AthenaBaseComps/AthAlgorithm.h"
#include "InDetBCM_RawData/BCM_RDO_Container.h"
/** @class BCM_ZeroSuppression
@author Bilge M. Demirkoz <demirkoz@cern.ch>
This algorithm takes the BCM RDO and zero-suppresses it
providing a smaller object to go into the AOD.
*/
class BCM_ZeroSuppression : public AthAlgorithm {
public:
BCM_ZeroSuppression(const std::string& name, ISvcLocator* pSvcLocator);
~BCM_ZeroSuppression();
StatusCode initialize();
StatusCode execute();
StatusCode finalize();
private:
/** A data member to contain a pointer to the Bcm RDO
that contains the input BCM information. */
const BCM_RDO_Container* m_bcmRDO;
/** A data member to contain a pointer to the compact BCM RDO
that contains the output BCM information that will go into the AOD. */
BCM_RDO_Container* m_bcmCompactDO;
/** A data member to contain the name of the BCM RDO
that contains the input BCM information. This data member is
used as a job option property.
*/
std::string m_bcmContainerName;
std::string m_bcmOutputName;
BCM_RDO_Collection* my_collection;
};
#endif
################################################################################
# Package: BCM_ZeroSuppression
################################################################################
# Declare the package name:
atlas_subdir( BCM_ZeroSuppression )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PUBLIC
Control/AthenaBaseComps
GaudiKernel
InnerDetector/InDetRawEvent/InDetBCM_RawData )
# Component(s) in the package:
atlas_add_component( BCM_ZeroSuppression
src/*.cxx
src/components/*.cxx
LINK_LIBRARIES AthenaBaseComps GaudiKernel InDetBCM_RawData )
# Install files from the package:
atlas_install_headers( BCM_ZeroSuppression )
package BCM_ZeroSuppression
author B. Demirkoz <demirkoz@cern.ch>
use AtlasPolicy AtlasPolicy-*
use GaudiInterface GaudiInterface-* External
use AthenaBaseComps AthenaBaseComps-* Control
# BCM Raw data
use InDetBCM_RawData InDetBCM_RawData-* InnerDetector/InDetRawEvent
library BCM_ZeroSuppression *.cxx -s=components *.cxx
apply_pattern component_library
apply_pattern declare_joboptions files="*.py"
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "GaudiKernel/StatusCode.h"
#include "BCM_ZeroSuppression/BCM_ZeroSuppression.h"
#include "InDetBCM_RawData/BCM_RawData.h"
#include "InDetBCM_RawData/BCM_RDO_Collection.h"
#include <vector>
using namespace std;
BCM_ZeroSuppression::BCM_ZeroSuppression(const std::string& name,
ISvcLocator* pSvcLocator): AthAlgorithm(name, pSvcLocator),
m_bcmContainerName("BCM_RDOs")
{
declareProperty("BcmContainerName", m_bcmContainerName = "BCM_RDOs");
declareProperty("BcmOutputContainerName", m_bcmOutputName = "BCM_CompactDOs");
}
BCM_ZeroSuppression::~BCM_ZeroSuppression()
{
}
StatusCode BCM_ZeroSuppression::initialize() {
msg(MSG::INFO) << "Initialising" << endreq;
if (AthAlgorithm::initialize().isFailure()) {
msg(MSG::ERROR) << "Couldn't initialize Algorithm base class." << endreq;
return StatusCode::FAILURE;
}
return StatusCode::SUCCESS;
}
StatusCode BCM_ZeroSuppression::execute() {
msg(MSG::DEBUG) << "execute()" << endreq;
StatusCode sc;
// Check for BCM RDO
sc=evtStore()->contains<BCM_RDO_Container>(m_bcmContainerName);
if( sc.isFailure() ) {
msg(MSG::DEBUG) << m_bcmContainerName << " not found" << endreq;
return StatusCode::SUCCESS;
}
else {
msg(MSG::DEBUG) << m_bcmContainerName << " container exists in StoreGate "
<< endreq;
}
// Retrieve BCM RDO
m_bcmRDO = 0;
sc=evtStore()->retrieve( m_bcmRDO, m_bcmContainerName);
if( sc.isFailure() || !m_bcmRDO ) {
// There is a warning from StoreGate anyways at this point.
return StatusCode::SUCCESS;
}
else {
msg(MSG::DEBUG) << m_bcmContainerName << " not found in StoreGate "
<< endreq;
}
// Create output RDO container and record it to StoreGate
try {
m_bcmCompactDO = new BCM_RDO_Container();
} catch (std::bad_alloc) {
msg(MSG::FATAL) << "Could not create a new BCM RawDataContainer!" << endreq;
return StatusCode::FAILURE;
}
sc = evtStore()->record(m_bcmCompactDO, m_bcmOutputName);
if (sc.isFailure()) {
msg(MSG::FATAL) << "Container '" << m_bcmOutputName << "' could not be registered in StoreGate" << endreq;
return sc;
} else {
if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Container '" << m_bcmOutputName << "' registered in StoreGate" << endreq;
}
// check if the collection exists if in the original container and loop over it
// and copy only those which have information in them
BCM_RDO_Container::const_iterator BCM_RDO_itr = m_bcmRDO->begin();
BCM_RDO_Container::const_iterator BCM_RDO_itr_end = m_bcmRDO->end();
for (; BCM_RDO_itr!=BCM_RDO_itr_end; ++BCM_RDO_itr) {
my_collection = new BCM_RDO_Collection();
bool contains_hit = false;
if ((*BCM_RDO_itr)->size() != 0){
BCM_RDO_Collection::const_iterator RDO_element = (*BCM_RDO_itr)->begin();
BCM_RDO_Collection::const_iterator RDO_element_last = (*BCM_RDO_itr)->end();
for (; RDO_element != RDO_element_last; ++RDO_element){
int bcm_pulse1width = (*RDO_element)->getPulse1Width();
int bcm_pulse2width = (*RDO_element)->getPulse2Width();
if ((bcm_pulse1width != 0) || (bcm_pulse2width !=0)) {
contains_hit = true;
my_collection->push_back((new BCM_RawData(**RDO_element)));
}
}//end of collection loop
}
if (contains_hit) {
msg(MSG::VERBOSE) << "Container '" << m_bcmOutputName << "' is being filled" << endreq;
m_bcmCompactDO->push_back(my_collection);
} else {
delete my_collection;
}
}//end of container loop
return StatusCode::SUCCESS;
}
StatusCode BCM_ZeroSuppression::finalize() {
return StatusCode::SUCCESS;
}
#include "GaudiKernel/DeclareFactoryEntries.h"
#include "BCM_ZeroSuppression/BCM_ZeroSuppression.h"
DECLARE_ALGORITHM_FACTORY( BCM_ZeroSuppression )
DECLARE_FACTORY_ENTRIES(BCM_ZeroSuppression) {
DECLARE_ALGORITHM(BCM_ZeroSuppression)
}
#include "GaudiKernel/LoadFactoryEntries.h"
LOAD_FACTORY_ENTRIES(BCM_ZeroSuppression)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment