test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::auto_ptr
< CaloTowerConstituentsMap
ReturnType
 
- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair
< DataKey,
edm::propagate_const
< std::shared_ptr< DataProxy > > > > 
KeyedProxies
 
typedef std::vector
< EventSetupRecordKey
Keys
 
typedef std::map
< EventSetupRecordKey,
KeyedProxies
RecordProxies
 

Public Member Functions

 CaloTowerConstituentsMapBuilder (const edm::ParameterSet &)
 
ReturnType produce (const CaloGeometryRecord &)
 
 ~CaloTowerConstituentsMapBuilder ()
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
virtual ~ESProducer ()
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
virtual void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval)
 overrides DataProxyProvider method More...
 
virtual ~ESProxyFactoryProducer ()
 
- 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 ()
 

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

std::string mapFile_
 

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::auto_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::auto_ptr< eventsetup::ProxyFactoryBase > &iFactory, const std::string &iLabel=std::string())
 
virtual void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList)
 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 41 of file CaloTowerConstituentsMapBuilder.h.

Member Typedef Documentation

Definition at line 46 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  //the following line is needed to tell the framework what
38  // data is being produced
39  setWhatProduced(this);
40 
41 //now do what ever other initialization is needed
42 }
T getUntrackedParameter(std::string const &, T const &) const
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
CaloTowerConstituentsMapBuilder::~CaloTowerConstituentsMapBuilder ( )

Definition at line 45 of file CaloTowerConstituentsMapBuilder.cc.

45 {}

Member Function Documentation

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

Definition at line 119 of file CaloTowerConstituentsMapBuilder.cc.

References CaloTowerConstituentsMap::assign(), CaloTowerTopology::convertHcaltoCT(), DetId::Ecal, EcalEndcap, CaloCellGeometry::getPosition(), CaloGeometry::getSubdetectorGeometry(), DetId::Hcal, HcalEndcap, and NULL.

Referenced by produce().

119  {
120  //get EE and HE geometries
122  if(geomEE==NULL) return; // if no EE is defined don't know where it is used
123 
125 
126  //get list of EE detids
127  const std::vector<DetId>& vec(geomEE->getValidDetIds());
128  //loop over EE detids
129  for(std::vector<DetId>::const_iterator detId_itr =vec.begin();
130  detId_itr != vec.end(); detId_itr++){
131  //get detid position
132  const CaloCellGeometry* cellGeometry = geomEE->getGeometry(*detId_itr);
133  const GlobalPoint gp ( cellGeometry->getPosition() ) ;
134 
135  //find closest HE cell
136  const HcalDetId closestCell ( geomHE->getClosestCell( gp ) ) ;
137 
138  //assign to appropriate CaloTower
139  CaloTowerDetId tid(cttopo->convertHcaltoCT(closestCell.ietaAbs(),closestCell.subdet())*closestCell.zside(), closestCell.iphi());
140  theMap.assign(*detId_itr,tid);
141  }
142 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
int convertHcaltoCT(int hcal_ieta, HcalSubdetector subdet) const
#define NULL
Definition: scimark2.h:8
void assign(const DetId &cell, const CaloTowerDetId &tower)
set the association between a DetId and a tower
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
void CaloTowerConstituentsMapBuilder::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 53 of file CaloTowerConstituentsMapBuilder.cc.

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

54 {
56  desc.addUntracked<std::string>( "MapFile", "" );
57  descriptions.add( "caloTowerConstituents", desc );
58 }
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 96 of file CaloTowerConstituentsMapBuilder.cc.

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

Referenced by produce().

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

Definition at line 62 of file CaloTowerConstituentsMapBuilder.cc.

References assignEEtoHE(), geometry, edm::eventsetup::EventSetupRecord::get(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), mapFile_, parseTextMap(), parseEventContent::prod, and edm::ESHandle< class >::product().

63 {
65  iRecord.getRecord<HcalRecNumberingRecord>().get(hcaltopo);
66 
68  iRecord.getRecord<HcalRecNumberingRecord>().get(cttopo);
69 
70  std::auto_ptr<CaloTowerConstituentsMap> prod( new CaloTowerConstituentsMap( &*hcaltopo, &*cttopo ));
71 
72 //std::auto_ptr<CaloTowerConstituentsMap> prod( new CaloTowerConstituentsMap( &*hcaltopo ));
73 
74  //keep geometry pointer as member for alternate EE->HE mapping
76  iRecord.get(pG);
77  const CaloGeometry* geometry = pG.product();
78 
79  prod->useStandardHB(true);
80  prod->useStandardHE(true);
81  prod->useStandardHF(true);
82  prod->useStandardHO(true);
83  prod->useStandardEB(true);
84 
85  if (!mapFile_.empty()) {
87  } else {
88  assignEEtoHE(geometry, *prod, &*cttopo);
89  }
90  prod->sort();
91 
92  return prod;
93 }
void get(HolderT &iHolder) const
T const * product() const
Definition: ESHandle.h:86
ESHandle< TrackerGeometry > geometry
void assignEEtoHE(const CaloGeometry *geometry, CaloTowerConstituentsMap &theMap, const CaloTowerTopology *cttopo)
void parseTextMap(const std::string &filename, CaloTowerConstituentsMap &theMap)

Member Data Documentation

std::string CaloTowerConstituentsMapBuilder::mapFile_
private

Definition at line 54 of file CaloTowerConstituentsMapBuilder.h.

Referenced by produce().