Skip to content
Snippets Groups Projects
Commit f577c50e authored by Atlas-Software Librarian's avatar Atlas-Software Librarian Committed by Graeme Stewart
Browse files

'CMakeLists.txt' (LUCID_Digitization-00-10-01)

	* Clean up clang warnings ATLASSIM-2661.
	* src/LUCID_PileUpTool.h  remove unused variable m_digitContainer
	* tagged as LUCID_Digitization-00-10-01

2016-01-29  John Chapman  <John.Chapman@cern.ch>

	* cmt/requirements - add use statement for xAODEventInfo.
	* src/LUCID_PileUpTool.cxx,
	src/LUCID_PileUpTool.h (processBunchXing): update interface to use
	xAODEventInfo rather than PileUpEventInfo. ATLASSIM-2241. Requires
	PileUpTools-01-18-00 or later. (release 21 onwards) ATLASSIM-2122
	* tagged as LUCID_Digitization-00-10-00
parent 2df67096
No related merge requests found
################################################################################
# Package: LUCID_Digitization
################################################################################
# Declare the package name:
atlas_subdir( LUCID_Digitization )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PRIVATE
Control/AthenaBaseComps
Control/AthenaKernel
Control/PileUpTools
Event/xAOD/xAODEventInfo
ForwardDetectors/LUCID/LUCID_RawEvent
ForwardDetectors/LUCID/LUCID_SimUtils/LUCID_SimEvent
GaudiKernel
Generators/GeneratorObjects
Simulation/HitManagement )
# External dependencies:
find_package( CLHEP )
find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
# Component(s) in the package:
atlas_add_component( LUCID_Digitization
src/*.cxx
src/components/*.cxx
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps AthenaKernel PileUpToolsLib xAODEventInfo LUCID_RawEvent LUCID_SimEvent GaudiKernel GeneratorObjects HitManagement )
# Install files from the package:
atlas_install_headers( LUCID_Digitization )
atlas_install_python_modules( python/*.py )
atlas_install_joboptions( share/*.py )
......@@ -3,24 +3,23 @@ package LUCID_Digitization
author Jacob Groth-Jensen <jacob.groth-jensen@hep.lu.se>
author Antonello Sbrizzi <antonio.sbrizzi@bo.infn.it>
use AtlasPolicy AtlasPolicy-*
use AtlasPolicy AtlasPolicy-*
private
use AthenaBaseComps AthenaBaseComps-* Control
use AthenaBaseComps AthenaBaseComps-* Control
use AthenaKernel AthenaKernel-* Control
use AtlasCLHEP AtlasCLHEP-* External
use AtlasROOT AtlasROOT-* External
use EventInfo EventInfo-* Event
use GaudiInterface GaudiInterface-* External
use GeneratorObjects GeneratorObjects-* Generators
use GaudiInterface GaudiInterface-* External
use GeneratorObjects GeneratorObjects-* Generators
use HitManagement HitManagement-* Simulation
use LUCID_RawEvent LUCID_RawEvent-* ForwardDetectors/LUCID
use LUCID_SimEvent LUCID_SimEvent-* ForwardDetectors/LUCID/LUCID_SimUtils
use LUCID_RawEvent LUCID_RawEvent-* ForwardDetectors/LUCID
use LUCID_SimEvent LUCID_SimEvent-* ForwardDetectors/LUCID/LUCID_SimUtils
use PileUpTools PileUpTools-* Control
use xAODEventInfo xAODEventInfo-* Event/xAOD
public
library LUCID_Digitization *.cxx components/*.cxx
apply_pattern declare_joboptions files="*.py"
apply_pattern declare_python_modules files="*.py"
apply_pattern declare_python_modules files="*.py"
apply_pattern component_library
......@@ -3,25 +3,24 @@
*/
#include "LUCID_PileUpTool.h"
#include "AthenaKernel/errorcheck.h"
#include "AthenaKernel/IAtRndmGenSvc.h"
#include "CLHEP/Random/RandFlat.h"
#include "CLHEP/Random/RandGaussQ.h"
#include "GeneratorObjects/HepMcParticleLink.h"
#include "PileUpTools/PileUpMergeSvc.h"
#include "GaudiKernel/ITHistSvc.h"
#include "AthenaBaseComps/AthMsgStreamMacros.h"
#include <map>
#include <algorithm>
#include "EventInfo/EventInfo.h"
#include "EventInfo/EventID.h"
/// ----------------------------------------------------------------------------------------------------
LUCID_PileUpTool::LUCID_PileUpTool(const std::string& type,
const std::string& name,
const IInterface* parent) :
LUCID_PileUpTool::LUCID_PileUpTool(const std::string& type,
const std::string& name,
const IInterface* parent) :
PileUpToolBase (type, name, parent),
m_atRndmGenSvc ("AtDSFMTGenSvc", name),
m_mergeSvc ("PileUpMergeSvc", name),
m_mergeSvc ("PileUpMergeSvc", name),
m_numTubes (40),
m_qdcChannelsPerPE (15.0),
m_qdcPedestal (150.0),
......@@ -41,221 +40,196 @@ LUCID_PileUpTool::LUCID_PileUpTool(const std::string& type,
m_fillRootTree (false)
{
declareInterface<IPileUpTool>(this);
m_SimHitCollectionName = "LucidSimHitsVector";
m_digitsContainerName = "LucidDigitsCnt";
m_digitsContainerName = "LucidDigitsCnt";
m_key_digitCnt = "Lucid_Digits";
declareProperty("SimHitCollection" , m_SimHitCollectionName, "Name of the input Collection of simulated hits");
declareProperty("LucidDigitsContainer", m_digitsContainerName , "Name of the Container to hold the output from the digitization");
declareProperty("RndmSvc" , m_atRndmGenSvc , "Random Number Service used in LUCID digitization" );
declareProperty("mergeSvc" , m_mergeSvc , "Store to hold the pile-ups");
declareProperty("numTubes" , m_numTubes);
declareProperty("qdcChannelsPerPE" , m_qdcChannelsPerPE);
declareProperty("qdcPedestal" , m_qdcPedestal);
declareProperty("qdcFedNoiseFactor" , m_qdcFedNoiseFactor);
declareProperty("tdcPmtNoiseFactor" , m_tdcPmtNoiseFactor);
declareProperty("tdcFedNoiseFactor" , m_tdcFedNoiseFactor);
declareProperty("TotalPMTgain" , m_TotalPMTgain);
declareProperty("AmpFactor" , m_AmpFactor);
declareProperty("Q1bin" , m_Q1bin);
declareProperty("NoiseCharge" , m_NoiseCharge);
declareProperty("numDyinodes" , m_numDyinodes);
declareProperty("dynodeGammaFactor" , m_dynodeGammaFactor);
declareProperty("pmtSmearing" , m_pmtSmearing);
declareProperty("pmtScaling" , m_pmtScaling);
declareProperty("gasScaling" , m_gasScaling);
declareProperty("npeThreshold" , m_npeThreshold);
declareProperty("fillRootTree" , m_fillRootTree);
declareProperty("fillRootTree" , m_fillRootTree);
}
StatusCode LUCID_PileUpTool::initialize() {
StatusCode LUCID_PileUpTool::initialize()
{
ATH_MSG_DEBUG ( "LUCID_PileUpTool::initialize() called " );
ATH_MSG_DEBUG ( " numTubes : " << m_numTubes << endreq
<< " qdcChannelsPerPE : " << m_qdcChannelsPerPE << endreq
<< " qdcPedestal : " << m_qdcPedestal << endreq
<< " qdcFedNoiseFactor: " << m_qdcFedNoiseFactor << endreq
<< " tdcPmtNoiseFactor: " << m_tdcPmtNoiseFactor << endreq
<< " tdcFedNoiseFactor: " << m_tdcFedNoiseFactor << endreq
<< " fillRootTree : " << m_fillRootTree );
StatusCode sc = m_atRndmGenSvc.retrieve();
if (sc.isFailure()) { ATH_MSG_FATAL ( "Could not retrieve RandomNumber Service!" ); return sc; }
else ATH_MSG_DEBUG ( "Retrieved RandomNumber Service" );
m_digitToolBox = new LUCID_DigitizationToolBox(m_numTubes,
m_qdcChannelsPerPE,
m_qdcPedestal,
m_qdcFedNoiseFactor,
m_tdcPmtNoiseFactor,
m_tdcFedNoiseFactor,
m_TotalPMTgain,
m_AmpFactor,
m_Q1bin,
m_NoiseCharge,
m_numDyinodes,
m_dynodeGammaFactor,
m_pmtSmearing,
m_pmtScaling,
m_gasScaling,
m_npeThreshold,
m_fillRootTree);
<< " qdcChannelsPerPE : " << m_qdcChannelsPerPE << endreq
<< " qdcPedestal : " << m_qdcPedestal << endreq
<< " qdcFedNoiseFactor: " << m_qdcFedNoiseFactor << endreq
<< " tdcPmtNoiseFactor: " << m_tdcPmtNoiseFactor << endreq
<< " tdcFedNoiseFactor: " << m_tdcFedNoiseFactor << endreq
<< " fillRootTree : " << m_fillRootTree );
CHECK(m_atRndmGenSvc.retrieve());
ATH_MSG_DEBUG ( "Retrieved RandomNumber Service" );
m_digitToolBox = new LUCID_DigitizationToolBox(m_numTubes,
m_qdcChannelsPerPE,
m_qdcPedestal,
m_qdcFedNoiseFactor,
m_tdcPmtNoiseFactor,
m_tdcFedNoiseFactor,
m_TotalPMTgain,
m_AmpFactor,
m_Q1bin,
m_NoiseCharge,
m_numDyinodes,
m_dynodeGammaFactor,
m_pmtSmearing,
m_pmtScaling,
m_gasScaling,
m_npeThreshold,
m_fillRootTree);
m_mergedhitList = new LUCID_SimHitCollection();
if (m_fillRootTree) {
sc = service("THistSvc", m_digitHistSvc);
if (sc.isFailure()) { ATH_MSG_FATAL ( "Could not retrieve Histogram Service!" ); return sc; }
else ATH_MSG_DEBUG ( "Retrieved Histogram Service" );
sc = m_digitToolBox->setDebugTree(m_digitHistSvc);
if (sc.isFailure()) { ATH_MSG_FATAL ( "Could not to retrieve ROOT tree" ); return sc; }
else ATH_MSG_DEBUG ( "Retrieved ROOT tree" );
}
if (m_fillRootTree)
{
CHECK(service("THistSvc", m_digitHistSvc));
ATH_MSG_DEBUG ( "Retrieved Histogram Service" );
CHECK(m_digitToolBox->setDebugTree(m_digitHistSvc));
ATH_MSG_DEBUG ( "Retrieved ROOT tree" );
}
return StatusCode::SUCCESS;
}
/// ----------------------------------------------------------------------------------------------------
StatusCode LUCID_PileUpTool::prepareEvent(const unsigned int nInputEvents){
ATH_MSG_DEBUG ( "LUCID_PileUpTool::prepareEvent() called for " << nInputEvents << " input events" );
StatusCode sc = m_digitToolBox->recordContainers(this->evtStore(), m_key_digitCnt);
if (sc.isFailure()) { ATH_MSG_FATAL ( " Could not record the empty digit container in StoreGate " ); return sc; }
else ATH_MSG_DEBUG ( " Digit container is recorded in StoreGate " );
StatusCode LUCID_PileUpTool::prepareEvent(const unsigned int nInputEvents)
{
ATH_MSG_DEBUG ( "prepareEvent() called for " << nInputEvents << " input events" );
CHECK(m_digitToolBox->recordContainers(this->evtStore(), m_key_digitCnt));
ATH_MSG_DEBUG ( " Digit container is recorded in StoreGate " );
m_mergedhitList->clear();
return StatusCode::SUCCESS;
}
/// ----------------------------------------------------------------------------------------------------
StatusCode LUCID_PileUpTool::processBunchXing(int bunchXing,
PileUpEventInfo::SubEvent::const_iterator bSubEvents,
PileUpEventInfo::SubEvent::const_iterator eSubEvents) {
SubEventIterator bSubEvents,
SubEventIterator eSubEvents)
{
ATH_MSG_DEBUG ( "LUCID_PileUpTool::processBunchXing() " << bunchXing );
PileUpEventInfo::SubEvent::const_iterator iEvt = bSubEvents;
for (; iEvt!=eSubEvents; ++iEvt) {
StoreGateSvc& seStore = *iEvt->pSubEvtSG;
const EventInfo* pEI = 0;
if (seStore.retrieve(pEI).isSuccess()) {
SubEventIterator iEvt = bSubEvents;
for (; iEvt!=eSubEvents; ++iEvt)
{
StoreGateSvc& seStore = *iEvt->ptr()->evtStore();
ATH_MSG_VERBOSE ( "SubEvt EventInfo from StoreGate " << seStore.name() << " :"
<< " bunch crossing : " << bunchXing
<< " time offset : " << iEvt->time()
<< " event number : " << pEI->event_ID()->event_number()
<< " run number : " << pEI->event_ID()->run_number()
);
}
const LUCID_SimHitCollection* tmpColl = 0;
if (!seStore.retrieve(tmpColl,m_SimHitCollectionName).isSuccess()) {
ATH_MSG_ERROR ( "SubEvent BCM SiHitCollection not found in StoreGate " << seStore.name() );
return StatusCode::FAILURE;
<< " bunch crossing : " << bunchXing
<< " time offset : " << iEvt->time()
<< " event number : " << iEvt->ptr()->eventNumber()
<< " run number : " << iEvt->ptr()->runNumber()
);
const LUCID_SimHitCollection* tmpColl = 0;
if (!seStore.retrieve(tmpColl,m_SimHitCollectionName).isSuccess())
{
ATH_MSG_ERROR ( "SubEvent BCM SiHitCollection not found in StoreGate " << seStore.name() );
return StatusCode::FAILURE;
}
ATH_MSG_DEBUG ( "LUCID_SimHitCollection found with " << tmpColl->size() << " hits" );
LUCID_SimHitCollection::const_iterator i = tmpColl->begin();
LUCID_SimHitCollection::const_iterator e = tmpColl->end();
for (; i!=e; ++i) m_mergedhitList->push_back((*i));
m_rndEngine = m_atRndmGenSvc->GetEngine("LUCIDRndEng");
}
ATH_MSG_DEBUG ( "LUCID_SimHitCollection found with " << tmpColl->size() << " hits" );
LUCID_SimHitCollection::const_iterator i = tmpColl->begin();
LUCID_SimHitCollection::const_iterator e = tmpColl->end();
for (; i!=e; ++i) m_mergedhitList->push_back((*i));
m_rndEngine = m_atRndmGenSvc->GetEngine("LUCIDRndEng");
}
return StatusCode::SUCCESS;
}
/// ----------------------------------------------------------------------------------------------------
StatusCode LUCID_PileUpTool::mergeEvent(){
StatusCode sc = m_digitToolBox->fillDigitContainer(m_mergedhitList, m_rndEngine);
if (sc.isFailure()) { ATH_MSG_FATAL ( " LUCID_DigitContainer could not be registered in StoreGate " ); return sc; }
else { ATH_MSG_DEBUG ( " LUCID_DigitContainer successfully registered in StoreGate " ); }
StatusCode LUCID_PileUpTool::mergeEvent()
{
CHECK(m_digitToolBox->fillDigitContainer(m_mergedhitList, m_rndEngine));
ATH_MSG_DEBUG ( " LUCID_DigitContainer successfully registered in StoreGate " );
return StatusCode::SUCCESS;
}
/// ----------------------------------------------------------------------------------------------------
StatusCode LUCID_PileUpTool::processAllSubEvents()
StatusCode LUCID_PileUpTool::processAllSubEvents()
{
ATH_MSG_VERBOSE ( "processAllSubEvents()" );
if(!m_mergeSvc) {
if (!(m_mergeSvc.retrieve()).isSuccess())
{
msg(MSG::ERROR) << "initialize: Can not find PileUpMergeSvc" << endreq;
return StatusCode::FAILURE;
}
}
if(!m_mergeSvc)
{
CHECK(m_mergeSvc.retrieve());
}
typedef PileUpMergeSvc::TimedList<LUCID_SimHitCollection>::type TimedHitCollList;
TimedHitCollList hitCollList;
if (m_mergeSvc->retrieveSubEvtsData(m_SimHitCollectionName, hitCollList).isFailure())
{
ATH_MSG_FATAL ( "Could not fill TimedHitCollList" );
return StatusCode::FAILURE;
}
else ATH_MSG_DEBUG ( "Retrieved TimedHitCollList" );
CHECK(m_mergeSvc->retrieveSubEvtsData(m_SimHitCollectionName, hitCollList));
ATH_MSG_DEBUG ( "Retrieved TimedHitCollList" );
ATH_MSG_DEBUG ( " PileUp: Merge " << hitCollList.size() << " LUCID_SimHitCollection with key " << m_SimHitCollectionName );
TimedHitCollection<LUCID_SimHit> thpclucid;
TimedHitCollList::iterator iColl (hitCollList.begin());
TimedHitCollList::iterator endColl(hitCollList.end());
while (iColl != endColl) {
const LUCID_SimHitCollection* tmpColl(iColl->second);
thpclucid.insert(iColl->first, tmpColl);
ATH_MSG_DEBUG ( " LUCID_SimHitCollection found with " << tmpColl->size() << " hits " << iColl->first );
++iColl;
}
m_rndEngine = m_atRndmGenSvc->GetEngine("LUCIDRndEng");
if (m_digitToolBox->recordContainers(this->evtStore(), m_key_digitCnt).isFailure())
{
ATH_MSG_FATAL ( " Could not record the empty digit container in StoreGate " );
return StatusCode::FAILURE;
}
else ATH_MSG_DEBUG ( " Digit container is recorded in StoreGate " );
if (m_digitToolBox->fillDigitContainer(thpclucid, m_rndEngine).isFailure())
{
ATH_MSG_FATAL ( " Could not fill the digit container " );
return StatusCode::FAILURE;
while (iColl != endColl)
{
const LUCID_SimHitCollection* tmpColl(iColl->second);
thpclucid.insert(iColl->first, tmpColl);
ATH_MSG_DEBUG ( " LUCID_SimHitCollection found with " << tmpColl->size() << " hits " << iColl->first );
++iColl;
}
else ATH_MSG_DEBUG ( " Digit container was filled successfully " );
m_rndEngine = m_atRndmGenSvc->GetEngine("LUCIDRndEng");
CHECK(m_digitToolBox->recordContainers(this->evtStore(), m_key_digitCnt));
ATH_MSG_DEBUG ( " Digit container is recorded in StoreGate " );
CHECK(m_digitToolBox->fillDigitContainer(thpclucid, m_rndEngine));
ATH_MSG_DEBUG ( " Digit container was filled successfully " );
return StatusCode::SUCCESS;
}
/// ----------------------------------------------------------------------------------------------------
StatusCode LUCID_PileUpTool::finalize() { return StatusCode::SUCCESS; }
StatusCode LUCID_PileUpTool::finalize()
{
return StatusCode::SUCCESS;
}
......@@ -6,13 +6,18 @@
#define LUCID_DIGITIZATION_TOOL_H
#include "PileUpTools/PileUpToolBase.h"
#include "LUCID_DigitizationToolBox.h"
#include "EventInfo/PileUpEventInfo.h" /*SubEvent*/
#include "GaudiKernel/Property.h"
#include "GaudiKernel/ServiceHandle.h"
#include "LUCID_SimEvent/LUCID_SimHitCollection.h"
#include "LUCID_RawEvent/LUCID_DigitContainer.h"
#include "xAODEventInfo/EventInfo.h" // SubEventIterator
#include "xAODEventInfo/EventAuxInfo.h"// SubEventIterator
#include "GaudiKernel/Property.h"
#include "GaudiKernel/ServiceHandle.h"
#include <vector>
#include <utility> /* pair */
......@@ -23,34 +28,34 @@ class IHistSvc;
class LUCID_PileUpTool: public PileUpToolBase, public LUCID_DigitizationToolBox {
public:
public:
LUCID_PileUpTool(const std::string& type,
const std::string& name,
const IInterface* parent);
virtual StatusCode initialize();
virtual StatusCode finalize();
const std::string& name,
const IInterface* parent);
virtual StatusCode initialize() override final;
virtual StatusCode finalize() override final;
/// called before the subevts loop. Not (necessarily) able to access SubEvents
virtual StatusCode prepareEvent(const unsigned int nInputEvents);
virtual StatusCode prepareEvent(const unsigned int nInputEvents) override final;
/// called for each active bunch-crossing to process current SubEvents bunchXing is in ns
virtual StatusCode processBunchXing(int bunchXing,
PileUpEventInfo::SubEvent::const_iterator bSubEvents,
PileUpEventInfo::SubEvent::const_iterator eSubEvents);
virtual StatusCode processBunchXing(int bunchXing,
SubEventIterator bSubEvents,
SubEventIterator eSubEvents) override final;
/// return false if not interested in certain xing times (in ns)
/// implemented by default in PileUpToolBase as FirstXing<=bunchXing<=LastXing
// virtual bool toProcess(int bunchXing) const;
// virtual bool toProcess(int bunchXing) const override final;
/// called at the end of the subevts loop. Not (necessarily) able to access SubEvents
virtual StatusCode mergeEvent();
virtual StatusCode mergeEvent() override final;
/// perform the digitization - used by LUCID_DigiTop::execute
virtual StatusCode processAllSubEvents();
virtual StatusCode processAllSubEvents() override final;
private:
private:
ServiceHandle<IAtRndmGenSvc> m_atRndmGenSvc;
ServiceHandle<PileUpMergeSvc> m_mergeSvc;
......@@ -62,12 +67,12 @@ class LUCID_PileUpTool: public PileUpToolBase, public LUCID_DigitizationToolBox
LUCID_DigitizationToolBox *m_digitToolBox;
CLHEP::HepRandomEngine *m_rndEngine;
LUCID_DigitContainer *m_digitContainer;
//LUCID_DigitContainer *m_digitContainer;
ITHistSvc *m_digitHistSvc;
LUCID_SimHitCollection* m_mergedhitList;
int m_numTubes;
int m_numTubes;
double m_qdcChannelsPerPE;
double m_qdcPedestal;
double m_qdcFedNoiseFactor;
......@@ -85,8 +90,8 @@ class LUCID_PileUpTool: public PileUpToolBase, public LUCID_DigitizationToolBox
std::vector<double> m_pmtScaling;
std::vector<double> m_gasScaling;
std::vector<double> m_npeThreshold;
bool m_fillRootTree;
};
#endif
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