CMS 3D CMS Logo

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

#include <EcalTPSkimmer.h>

Inheritance diagram for EcalTPSkimmer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EcalTPSkimmer (const edm::ParameterSet &ps)
 
void produce (edm::Event &evt, const edm::EventSetup &es) override
 
 ~EcalTPSkimmer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () 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)
 
virtual ~ProducerBase () noexcept(false)
 
- 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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

bool alreadyInserted (EcalTrigTowerDetId ttId)
 
void insertTP (EcalTrigTowerDetId ttId, edm::Handle< EcalTrigPrimDigiCollection > &in, EcalTrigPrimDigiCollection &out)
 

Private Attributes

std::vector< uint32_t > chStatusToSelectTP_
 
bool doBarrel_
 
bool doEndcap_
 
std::set< EcalTrigTowerDetIdinsertedTP_
 
bool skipModule_
 
std::string tpCollection_
 
edm::EDGetTokenT< EcalTrigPrimDigiCollectiontpInputToken_
 
std::string tpOutputCollection_
 
edm::ESHandle< EcalTrigTowerConstituentsMapttMap_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase 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::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 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

produce a subset of TP information

Author
Federico Ferri, CEA/Saclay Irfu/SPP

Definition at line 22 of file EcalTPSkimmer.h.

Constructor & Destructor Documentation

EcalTPSkimmer::EcalTPSkimmer ( const edm::ParameterSet ps)
explicit

Definition at line 24 of file EcalTPSkimmer.cc.

References chStatusToSelectTP_, doBarrel_, doEndcap_, edm::ParameterSet::getParameter(), skipModule_, AlCaHLTBitMon_QueryRunRegistry::string, tpInputToken_, and tpOutputCollection_.

25 {
26  skipModule_ = ps.getParameter<bool>("skipModule");
27 
28  doBarrel_ = ps.getParameter<bool>("doBarrel");
29  doEndcap_ = ps.getParameter<bool>("doEndcap");
30 
31  chStatusToSelectTP_ = ps.getParameter<std::vector<uint32_t> >("chStatusToSelectTP");
32 
33  tpOutputCollection_ = ps.getParameter<std::string>("tpOutputCollection");
34  tpInputToken_ = consumes<EcalTrigPrimDigiCollection>(ps.getParameter<edm::InputTag>("tpInputCollection"));
35 
36  produces< EcalTrigPrimDigiCollection >(tpOutputCollection_);
37 }
T getParameter(std::string const &) const
std::vector< uint32_t > chStatusToSelectTP_
Definition: EcalTPSkimmer.h:40
std::string tpOutputCollection_
Definition: EcalTPSkimmer.h:47
edm::EDGetTokenT< EcalTrigPrimDigiCollection > tpInputToken_
Definition: EcalTPSkimmer.h:45
EcalTPSkimmer::~EcalTPSkimmer ( )
override

Definition at line 39 of file EcalTPSkimmer.cc.

40 {
41 }

Member Function Documentation

bool EcalTPSkimmer::alreadyInserted ( EcalTrigTowerDetId  ttId)
private

Definition at line 124 of file EcalTPSkimmer.cc.

References insertedTP_.

Referenced by produce().

125 {
126  return ( insertedTP_.find( ttId ) != insertedTP_.end() );
127 }
std::set< EcalTrigTowerDetId > insertedTP_
Definition: EcalTPSkimmer.h:43
void EcalTPSkimmer::insertTP ( EcalTrigTowerDetId  ttId,
edm::Handle< EcalTrigPrimDigiCollection > &  in,
EcalTrigPrimDigiCollection out 
)
private

Definition at line 130 of file EcalTPSkimmer.cc.

References DEFINE_FWK_MODULE, edm::SortedCollection< T, SORT >::end(), edm::SortedCollection< T, SORT >::find(), insertedTP_, and edm::SortedCollection< T, SORT >::push_back().

Referenced by produce().

131 {
132  EcalTrigPrimDigiCollection::const_iterator tpIt = tpIn->find( ttId );
133  if ( tpIt != tpIn->end() ) {
134  tpOut.push_back( *tpIt );
135  insertedTP_.insert( ttId );
136  }
137 }
std::vector< EcalTriggerPrimitiveDigi >::const_iterator const_iterator
std::set< EcalTrigTowerDetId > insertedTP_
Definition: EcalTPSkimmer.h:43
void EcalTPSkimmer::produce ( edm::Event evt,
const edm::EventSetup es 
)
override

Definition at line 44 of file EcalTPSkimmer.cc.

References alreadyInserted(), chStatusToSelectTP_, EBDetId::detIdFromDenseIndex(), EEDetId::detIdFromDenseIndex(), doBarrel_, doEndcap_, EcalCondObjectContainer< T >::end(), spr::find(), EcalCondObjectContainer< T >::find(), edm::EventSetup::get(), edm::Event::getByToken(), mps_fire::i, insertedTP_, insertTP(), EBDetId::kSizeForDenseIndexing, EEDetId::kSizeForDenseIndexing, eostools::move(), edm::Event::put(), skipModule_, EcalTrigTowerConstituentsMap::towerOf(), tpInputToken_, tpOutputCollection_, ttMap_, EBDetId::validDenseIndex(), and EEDetId::validDenseIndex().

45 {
46  insertedTP_.clear();
47 
48  using namespace edm;
49 
50  es.get<IdealGeometryRecord>().get(ttMap_);
51 
52  // collection of rechits to put in the event
53  auto tpOut = std::make_unique<EcalTrigPrimDigiCollection>();
54 
55  if ( skipModule_ ) {
56  evt.put(std::move(tpOut), tpOutputCollection_);
57  return;
58  }
59 
61  es.get<EcalChannelStatusRcd>().get(chStatus);
62 
64  evt.getByToken(tpInputToken_, tpIn);
65 
66 
67  if ( doBarrel_ ) {
69  uint16_t code = 0;
70  for ( int i = 0; i < EBDetId::kSizeForDenseIndexing; ++i )
71  {
72  if ( ! EBDetId::validDenseIndex( i ) ) continue;
74  chit = chStatus->find( id );
75  // check if the channel status means TP to be kept
76  if ( chit != chStatus->end() ) {
77  code = (*chit).getStatusCode();
78  if ( std::find( chStatusToSelectTP_.begin(), chStatusToSelectTP_.end(), code ) != chStatusToSelectTP_.end() ) {
79  // retrieve the TP DetId
80  EcalTrigTowerDetId ttDetId( ((EBDetId)id).tower() );
81  // insert the TP if not done already
82  if ( ! alreadyInserted( ttDetId ) ) insertTP( ttDetId, tpIn, *tpOut );
83  }
84  } else {
85  edm::LogError("EcalDetIdToBeRecoveredProducer") << "No channel status found for xtal "
86  << id.rawId()
87  << "! something wrong with EcalChannelStatus in your DB? ";
88  }
89  }
90  }
91 
92  if ( doEndcap_ ) {
94  uint16_t code = 0;
95  for ( int i = 0; i < EEDetId::kSizeForDenseIndexing; ++i )
96  {
97  if ( ! EEDetId::validDenseIndex( i ) ) continue;
99  chit = chStatus->find( id );
100  // check if the channel status means TP to be kept
101  if ( chit != chStatus->end() ) {
102  code = (*chit).getStatusCode() ;
103  if ( std::find( chStatusToSelectTP_.begin(), chStatusToSelectTP_.end(), code ) != chStatusToSelectTP_.end() ) {
104  // retrieve the TP DetId
105  EcalTrigTowerDetId ttDetId = ttMap_->towerOf( id );
106  // insert the TP if not done already
107  if ( ! alreadyInserted( ttDetId ) ) insertTP( ttDetId, tpIn, *tpOut );
108  }
109  } else {
110  edm::LogError("EcalDetIdToBeRecoveredProducer") << "No channel status found for xtal "
111  << id.rawId()
112  << "! something wrong with EcalChannelStatus in your DB? ";
113  }
114  }
115  }
116 
117  // put the collection of reconstructed hits in the event
118  LogInfo("EcalTPSkimmer") << "total # of TP inserted: " << tpOut->size();
119 
120  evt.put(std::move(tpOut), tpOutputCollection_);
121 }
static EEDetId detIdFromDenseIndex(uint32_t din)
Definition: EEDetId.h:220
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
std::vector< uint32_t > chStatusToSelectTP_
Definition: EcalTPSkimmer.h:40
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
std::set< EcalTrigTowerDetId > insertedTP_
Definition: EcalTPSkimmer.h:43
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
EcalTrigTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
static EBDetId detIdFromDenseIndex(uint32_t di)
Definition: EBDetId.h:111
edm::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
Definition: EcalTPSkimmer.h:41
std::string tpOutputCollection_
Definition: EcalTPSkimmer.h:47
const T & get() const
Definition: EventSetup.h:55
std::vector< Item >::const_iterator const_iterator
bool alreadyInserted(EcalTrigTowerDetId ttId)
void insertTP(EcalTrigTowerDetId ttId, edm::Handle< EcalTrigPrimDigiCollection > &in, EcalTrigPrimDigiCollection &out)
static bool validDenseIndex(uint32_t din)
Definition: EEDetId.h:213
HLT enums.
edm::EDGetTokenT< EcalTrigPrimDigiCollection > tpInputToken_
Definition: EcalTPSkimmer.h:45
const_iterator find(uint32_t rawId) const
const_iterator end() const
def move(src, dest)
Definition: eostools.py:510
static bool validDenseIndex(uint32_t din)
Definition: EBDetId.h:109

Member Data Documentation

std::vector<uint32_t> EcalTPSkimmer::chStatusToSelectTP_
private

Definition at line 40 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

bool EcalTPSkimmer::doBarrel_
private

Definition at line 37 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

bool EcalTPSkimmer::doEndcap_
private

Definition at line 38 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

std::set<EcalTrigTowerDetId> EcalTPSkimmer::insertedTP_
private

Definition at line 43 of file EcalTPSkimmer.h.

Referenced by alreadyInserted(), insertTP(), and produce().

bool EcalTPSkimmer::skipModule_
private

Definition at line 36 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

std::string EcalTPSkimmer::tpCollection_
private

Definition at line 34 of file EcalTPSkimmer.h.

edm::EDGetTokenT<EcalTrigPrimDigiCollection> EcalTPSkimmer::tpInputToken_
private

Definition at line 45 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

std::string EcalTPSkimmer::tpOutputCollection_
private

Definition at line 47 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

edm::ESHandle<EcalTrigTowerConstituentsMap> EcalTPSkimmer::ttMap_
private

Definition at line 41 of file EcalTPSkimmer.h.

Referenced by produce().