Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hcal Parameters ES Producer #9688

Merged
merged 2 commits into from Jun 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Geometry/HcalTowerAlgo/plugins/BuildFile.xml
Expand Up @@ -3,6 +3,7 @@
<use name="FWCore/ParameterSet"/>
<use name="Geometry/Records"/>
<use name="Geometry/HcalTowerAlgo"/>
<use name="CondFormats/GeometryObjects"/>
<use name="boost"/>
<flags EDM_PLUGIN="1"/>
</library>
45 changes: 45 additions & 0 deletions Geometry/HcalTowerAlgo/plugins/HcalParametersESModule.cc
@@ -0,0 +1,45 @@
#include "HcalParametersESModule.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Framework/interface/ModuleFactory.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/ESTransientHandle.h"
#include "DetectorDescription/Core/interface/DDCompactView.h"
#include "Geometry/Records/interface/IdealGeometryRecord.h"
#include "Geometry/Records/interface/PHcalParametersRcd.h"
#include "Geometry/HcalTowerAlgo/interface/HcalParametersFromDD.h"
#include "CondFormats/GeometryObjects/interface/PHcalParameters.h"

HcalParametersESModule::HcalParametersESModule( const edm::ParameterSet& )
{
edm::LogInfo("HCAL") << "HcalParametersESModule::HcalParametersESModule";

setWhatProduced(this);
}

HcalParametersESModule::~HcalParametersESModule()
{}

void
HcalParametersESModule::fillDescriptions( edm::ConfigurationDescriptions & descriptions )
{
edm::ParameterSetDescription desc;
descriptions.add( "hcalParameters", desc );
}

HcalParametersESModule::ReturnType
HcalParametersESModule::produce( const PHcalParametersRcd& iRecord )
{
//edm::LogInfo("HcalParametersESModule")
std::cout << "HcalParametersESModule::produce(const PHcalParametersRcd& iRecord)" << std::endl;
edm::ESTransientHandle<DDCompactView> cpv;
iRecord.getRecord<IdealGeometryRecord>().get( cpv );

PHcalParameters* ptp = new PHcalParameters();
HcalParametersFromDD builder;
builder.build( &(*cpv), *ptp );

return ReturnType( ptp ) ;
}

DEFINE_FWK_EVENTSETUP_MODULE( HcalParametersESModule);
28 changes: 28 additions & 0 deletions Geometry/HcalTowerAlgo/plugins/HcalParametersESModule.h
@@ -0,0 +1,28 @@
#ifndef Geometry_HcalTowerAlgo_HcalParametersESModule_H
#define Geometry_HcalTowerAlgo_HcalParametersESModule_H

#include "FWCore/Framework/interface/ESProducer.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "Geometry/Records/interface/IdealGeometryRecord.h"
#include <boost/shared_ptr.hpp>

namespace edm {
class ConfigurationDescriptions;
}
class PHcalParameters;
class PHcalParametersRcd;

class HcalParametersESModule : public edm::ESProducer
{
public:
HcalParametersESModule( const edm::ParameterSet & );
~HcalParametersESModule( void );

typedef boost::shared_ptr<PHcalParameters> ReturnType;

static void fillDescriptions( edm::ConfigurationDescriptions & );

ReturnType produce( const PHcalParametersRcd & );
};

#endif
17 changes: 17 additions & 0 deletions Geometry/HcalTowerAlgo/test/runHcalParametersFromDDAnalyzer_cfg.py
@@ -0,0 +1,17 @@
import FWCore.ParameterSet.Config as cms
process = cms.Process("HcalParametersTest")

process.load('Configuration.Geometry.GeometryExtended2015_cff')
process.load('Geometry.HcalTowerAlgo.hcalParameters_cfi')

process.source = cms.Source("EmptySource")
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(1)
)

process.hpa = cms.EDAnalyzer("HcalParametersAnalyzer")

process.Timing = cms.Service("Timing")
process.SimpleMemoryCheck = cms.Service("SimpleMemoryCheck")

process.p1 = cms.Path(process.hpa)
7 changes: 5 additions & 2 deletions Geometry/Records/interface/PHcalParametersRcd.h
@@ -1,8 +1,11 @@
#ifndef Geometry_Records_PHcalParametersRcd_H
#define Geometry_Records_PHcalParametersRcd_H

#include "FWCore/Framework/interface/EventSetupRecordImplementation.h"
#include "FWCore/Framework/interface/DependentRecordImplementation.h"
#include "Geometry/Records/interface/IdealGeometryRecord.h"
#include "boost/mpl/vector.hpp"

class PHcalParametersRcd : public edm::eventsetup::EventSetupRecordImplementation<PHcalParametersRcd> {};
class PHcalParametersRcd : public edm::eventsetup::DependentRecordImplementation<PHcalParametersRcd,
boost::mpl::vector<IdealGeometryRecord> > {};

#endif // Geometry_Records_PHcalParameters_H