CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
CaloTowerConstituentsMapBuilder Class Reference

#include <tmp/CaloTowerConstituentsMapBuilder/interface/CaloTowerConstituentsMapBuilder.h>

Inheritance diagram for CaloTowerConstituentsMapBuilder:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Types

typedef std::unique_ptr< CaloTowerConstituentsMapReturnType
 
- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair< DataKey, edm::propagate_const< std::shared_ptr< DataProxy > > > > KeyedProxies
 
typedef std::vector< EventSetupRecordKeyKeys
 
typedef std::map< EventSetupRecordKey, KeyedProxiesRecordProxies
 

Public Member Functions

 CaloTowerConstituentsMapBuilder (const edm::ParameterSet &)
 
ReturnType produce (const CaloGeometryRecord &)
 
 ~CaloTowerConstituentsMapBuilder () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ~ESProducer ()(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval) override
 overrides DataProxyProvider method More...
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 

Private Member Functions

void assignEEtoHE (const CaloGeometry *geometry, CaloTowerConstituentsMap &theMap, const CaloTowerTopology *cttopo)
 
void parseTextMap (const std::string &filename, CaloTowerConstituentsMap &theMap)
 

Private Attributes

bool mapAuto_
 
std::string mapFile_
 
bool skipHE_
 

Additional Inherited Members

- Protected Member Functions inherited from edm::ESProducer
template<typename T >
void setWhatProduced (T *iThis, const es::Label &iLabel=es::Label())
 
template<typename T >
void setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
void setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
void setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel=es::Label())
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList) override
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 40 of file CaloTowerConstituentsMapBuilder.h.

Member Typedef Documentation

Definition at line 45 of file CaloTowerConstituentsMapBuilder.h.

Constructor & Destructor Documentation

CaloTowerConstituentsMapBuilder::CaloTowerConstituentsMapBuilder ( const edm::ParameterSet iConfig)

Definition at line 35 of file CaloTowerConstituentsMapBuilder.cc.

References edm::ESProducer::setWhatProduced().

35  :
36  mapFile_(iConfig.getUntrackedParameter<std::string>("MapFile","")),
37  mapAuto_(iConfig.getUntrackedParameter<bool>("MapAuto",false)),
38  skipHE_(iConfig.getUntrackedParameter<bool>("SkipHE",false)) {
39  //the following line is needed to tell the framework what
40  // data is being produced
41  setWhatProduced(this);
42 
43 //now do what ever other initialization is needed
44 }
T getUntrackedParameter(std::string const &, T const &) const
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
CaloTowerConstituentsMapBuilder::~CaloTowerConstituentsMapBuilder ( )
override

Definition at line 47 of file CaloTowerConstituentsMapBuilder.cc.

47 {}

Member Function Documentation

void CaloTowerConstituentsMapBuilder::assignEEtoHE ( const CaloGeometry geometry,
CaloTowerConstituentsMap theMap,
const CaloTowerTopology cttopo 
)
private

Definition at line 123 of file CaloTowerConstituentsMapBuilder.cc.

References CaloTowerConstituentsMap::assign(), CaloTowerTopology::convertHcaltoCT(), DetId::Ecal, EcalEndcap, CaloSubdetectorGeometry::getClosestCell(), CaloSubdetectorGeometry::getGeometry(), CaloGeometry::getSubdetectorGeometry(), CaloSubdetectorGeometry::getValidDetIds(), runTauDisplay::gp, DetId::Hcal, and HcalEndcap.

Referenced by produce().

123  {
124  //get EE and HE geometries
126  if(geomEE==nullptr) return; // if no EE is defined don't know where it is used
127 
129 
130  //get list of EE detids
131  const std::vector<DetId>& vec(geomEE->getValidDetIds());
132  //loop over EE detids
133  for(auto detId_itr : vec){
134  //get detid position
135  auto cellGeometry = geomEE->getGeometry(detId_itr);
136  const GlobalPoint& gp (cellGeometry->getPosition()) ;
137 
138  //find closest HE cell
139  HcalDetId closestCell (geomHE->getClosestCell(gp)) ;
140 
141  //assign to appropriate CaloTower
142  CaloTowerDetId tid(cttopo->convertHcaltoCT(closestCell.ietaAbs(),closestCell.subdet())*closestCell.zside(), closestCell.iphi());
143  theMap.assign(detId_itr,tid);
144  }
145 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:44
int convertHcaltoCT(int hcal_ieta, HcalSubdetector subdet) const
virtual const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const
Get a list of valid detector ids (for the given subdetector)
void assign(const DetId &cell, const CaloTowerDetId &tower)
set the association between a DetId and a tower
virtual DetId getClosestCell(const GlobalPoint &r) const
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
void CaloTowerConstituentsMapBuilder::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 55 of file CaloTowerConstituentsMapBuilder.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addUntracked(), funct::false, and AlCaHLTBitMon_QueryRunRegistry::string.

56 {
58  desc.addUntracked<std::string>( "MapFile", "" );
59  desc.addUntracked<bool>( "MapAuto", false );
60  desc.addUntracked<bool>( "SkipHE", false );
61  descriptions.add( "caloTowerConstituents", desc );
62 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void CaloTowerConstituentsMapBuilder::parseTextMap ( const std::string &  filename,
CaloTowerConstituentsMap theMap 
)
private

Definition at line 100 of file CaloTowerConstituentsMapBuilder.cc.

References CaloTowerConstituentsMap::assign(), edm::FileInPath::fullPath(), geometryCSVtoXML::line, and nullptr.

Referenced by produce().

100  {
101 
102  edm::FileInPath eff( filename );
103 
104  gzFile gzed = gzopen( eff.fullPath().c_str(), "rb" );
105 
106  while( !gzeof( gzed )) {
107  char line[1024];
108  int ieta, iphi, rawid;
109  if( nullptr != gzgets( gzed, line, 1023 )) {
110  if( index( line, '#' ) != nullptr )*( index( line, '#' )) = 0;
111  int ct = sscanf( line, "%i %d %d", &rawid, &ieta, &iphi );
112  if( ct == 3 ) {
113  DetId detid( rawid );
114  CaloTowerDetId tid( ieta, iphi );
115  theMap.assign( detid, tid );
116  }
117  }
118  }
119  gzclose( gzed );
120 }
#define nullptr
void assign(const DetId &cell, const CaloTowerDetId &tower)
set the association between a DetId and a tower
Definition: DetId.h:18
CaloTowerConstituentsMapBuilder::ReturnType CaloTowerConstituentsMapBuilder::produce ( const CaloGeometryRecord iRecord)

Definition at line 66 of file CaloTowerConstituentsMapBuilder.cc.

References assignEEtoHE(), edm::eventsetup::EventSetupRecord::get(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), mapAuto_, mapFile_, parseTextMap(), parseEventContent::prod, and skipHE_.

67 {
69  iRecord.getRecord<HcalRecNumberingRecord>().get(hcaltopo);
70 
72  iRecord.getRecord<HcalRecNumberingRecord>().get(cttopo);
73 
74  auto prod = std::make_unique<CaloTowerConstituentsMap>( &*hcaltopo, &*cttopo );
75 
76 //auto prod = std::make_unique<CaloTowerConstituentsMap>( &*hcaltopo );
77 
78  //keep geometry pointer as member for alternate EE->HE mapping
80  iRecord.get(pG);
81  const CaloGeometry* geometry = pG.product();
82 
83  prod->useStandardHB(true);
84  if(!skipHE_) prod->useStandardHE(true);
85  prod->useStandardHF(true);
86  prod->useStandardHO(true);
87  prod->useStandardEB(true);
88 
89  if (!mapFile_.empty()) {
91  } else if (mapAuto_ && !skipHE_) {
92  assignEEtoHE(geometry, *prod, &*cttopo);
93  }
94  prod->sort();
95 
96  return prod;
97 }
void get(HolderT &iHolder) const
void assignEEtoHE(const CaloGeometry *geometry, CaloTowerConstituentsMap &theMap, const CaloTowerTopology *cttopo)
void parseTextMap(const std::string &filename, CaloTowerConstituentsMap &theMap)

Member Data Documentation

bool CaloTowerConstituentsMapBuilder::mapAuto_
private

Definition at line 54 of file CaloTowerConstituentsMapBuilder.h.

Referenced by produce().

std::string CaloTowerConstituentsMapBuilder::mapFile_
private

Definition at line 53 of file CaloTowerConstituentsMapBuilder.h.

Referenced by produce().

bool CaloTowerConstituentsMapBuilder::skipHE_
private

Definition at line 54 of file CaloTowerConstituentsMapBuilder.h.

Referenced by produce().