CMS 3D CMS Logo

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

#include <RecoLocalCalo/Castor/src/CastorCellProducer.cc>

Inheritance diagram for CastorCellProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 CastorCellProducer (const edm::ParameterSet &)
 
 ~CastorCellProducer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef std::vector< reco::CastorCellCastorCellCollection
 
typedef ROOT::Math::RhoZPhiPoint CellPoint
 
typedef math::XYZPointD Point
 

Private Member Functions

void beginJob () override
 
void endJob () override
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::EDGetTokenT< CastorRecHitCollectiontok_input_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ESProduct , Transition Tr = Transition::Event>
auto esConsumes (eventsetup::EventSetupRecordKey const &, ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: CastorCell Reconstruction Producer. Produce CastorCells from CastorRecHits. Implementation:

Definition at line 44 of file CastorCellProducer.cc.

Member Typedef Documentation

Definition at line 57 of file CastorCellProducer.cc.

typedef ROOT::Math::RhoZPhiPoint CastorCellProducer::CellPoint
private

Definition at line 56 of file CastorCellProducer.cc.

Definition at line 55 of file CastorCellProducer.cc.

Constructor & Destructor Documentation

CastorCellProducer::CastorCellProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 75 of file CastorCellProducer.cc.

References edm::ParameterSet::getUntrackedParameter(), AlCaHLTBitMon_QueryRunRegistry::string, and tok_input_.

76 {
77  tok_input_ = consumes<CastorRecHitCollection>(edm::InputTag(iConfig.getUntrackedParameter<std::string>("inputprocess","castorreco")));
78  // register your products
79  produces<CastorCellCollection>();
80  // now do what ever other initialization is needed
81 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< CastorRecHitCollection > tok_input_
CastorCellProducer::~CastorCellProducer ( )
override

Definition at line 84 of file CastorCellProducer.cc.

85 {
86  // do anything here that needs to be done at desctruction time
87  // (e.g. close files, deallocate resources etc.)
88 }

Member Function Documentation

void CastorCellProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 179 of file CastorCellProducer.cc.

References LogDebug.

179  {
180  LogDebug("CastorCellProducer")
181  <<"Starting CastorCellProducer";
182 }
#define LogDebug(id)
void CastorCellProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 185 of file CastorCellProducer.cc.

References DEFINE_FWK_MODULE, and LogDebug.

185  {
186  LogDebug("CastorCellProducer")
187  <<"Ending CastorCellProducer";
188 }
#define LogDebug(id)
void CastorCellProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 97 of file CastorCellProducer.cc.

References CaloRecHit::energy(), edm::Event::getByToken(), mps_fire::i, CastorRecHit::id(), LogDebug, HcalCastorDetId::module(), eostools::move(), MYR2D, edm::Event::put(), HcalCastorDetId::sector(), edm::SortedCollection< T, SORT >::size(), tok_input_, HcalCastorDetId::zside(), and ecaldqm::zside().

97  {
98 
99  using namespace edm;
100  using namespace reco;
101  using namespace TMath;
102 
103  // Produce CastorCells from CastorRecHits
104 
106  iEvent.getByToken(tok_input_, InputRecHits);
107 
108  auto OutputCells = std::make_unique<CastorCellCollection>();
109 
110  // looping over all CastorRecHits
111 
112  LogDebug("CastorCellProducer")
113  <<"1. entering CastorCellProducer ";
114 
115  for (size_t i = 0; i < InputRecHits->size(); ++i) {
116  const CastorRecHit & rh = (*InputRecHits)[i];
117  int sector = rh.id().sector();
118  int module = rh.id().module();
119  double energy = rh.energy();
120  int zside = rh.id().zside();
121 
122  // define CastorCell properties
123  double zCell=0.;
124  double phiCell;
125  double rhoCell;
126 
127  // set z position of the cell
128  if (module < 3) {
129  // starting in EM section
130  if (module == 1) zCell = 14415;
131  if (module == 2) zCell = 14464;
132  } else {
133  // starting in HAD section
134  zCell = 14534 + (module - 3)*92;
135  }
136 
137  // set phi position of the cell
138  double castorphi[16];
139  for (int j = 0; j < 16; j++) {
140  castorphi[j] = -2.94524 + j*0.3927;
141  }
142  if (sector > 8) {
143  phiCell = castorphi[sector - 9];
144  } else {
145  phiCell = castorphi[sector + 7];
146  }
147 
148  // add condition to select in eta sides
149  if (zside <= 0) zCell = -1*zCell;
150 
151  // set rho position of the cell (inner radius 3.7cm, outer radius 14cm)
152  rhoCell = 88.5;
153 
154  // store cell position
155  CellPoint tempcellposition(rhoCell,zCell,phiCell);
156  Point cellposition(tempcellposition);
157 
158  LogDebug("CastorCellProducer")
159  <<"cell number: "<<i+1<<std::endl
160  <<"rho: "<<cellposition.rho()<<" phi: "<<cellposition.phi()*MYR2D<<" eta: "<<cellposition.eta()<<std::endl
161  <<"x: "<<cellposition.x()<<" y: "<<cellposition.y()<<" z: "<<cellposition.z();
162 
163  if (energy > 0.) {
164  CastorCell newCell(energy,cellposition);
165  OutputCells->push_back(newCell);
166  }
167 
168  } // end loop over CastorRecHits
169 
170  LogDebug("CastorCellProducer")
171  <<"total number of cells in the event: "<<InputRecHits->size();
172 
173  iEvent.put(std::move(OutputCells));
174 
175 
176 }
#define LogDebug(id)
constexpr float energy() const
Definition: CaloRecHit.h:31
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
int sector() const
get the sector (1-16)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
int module() const
get the module (1-2 for EM, 1-12 for HAD)
int zside(DetId const &)
HcalCastorDetId id() const
get the id
Definition: CastorRecHit.h:15
edm::EDGetTokenT< CastorRecHitCollection > tok_input_
math::XYZPoint Point
int zside() const
get the z-side of the cell (1/-1)
const double MYR2D
fixed size matrix
HLT enums.
size_type size() const
Definition: vlib.h:208
ROOT::Math::RhoZPhiPoint CellPoint
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

edm::EDGetTokenT<CastorRecHitCollection> CastorCellProducer::tok_input_
private

Definition at line 58 of file CastorCellProducer.cc.

Referenced by CastorCellProducer(), and produce().