CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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<>

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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

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

Private Attributes

edm::ESGetToken
< EcalChannelStatus,
EcalChannelStatusRcd
chStatusToken_
 
std::vector< uint32_t > chStatusToSelectTP_
 
bool doBarrel_
 
bool doEndcap_
 
std::set< EcalTrigTowerDetIdinsertedTP_
 
bool skipModule_
 
std::string tpCollection_
 
edm::EDGetTokenT
< EcalTrigPrimDigiCollection
tpInputToken_
 
std::string tpOutputCollection_
 
edm::ESHandle
< EcalTrigTowerConstituentsMap
ttMap_
 
edm::ESGetToken
< EcalTrigTowerConstituentsMap,
IdealGeometryRecord
ttMapToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

produce a subset of TP information

Author
Federico Ferri, CEA/Saclay Irfu/SPP

Definition at line 26 of file EcalTPSkimmer.h.

Constructor & Destructor Documentation

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

Definition at line 19 of file EcalTPSkimmer.cc.

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

19  {
20  skipModule_ = ps.getParameter<bool>("skipModule");
21 
22  doBarrel_ = ps.getParameter<bool>("doBarrel");
23  doEndcap_ = ps.getParameter<bool>("doEndcap");
24 
25  chStatusToSelectTP_ = ps.getParameter<std::vector<uint32_t> >("chStatusToSelectTP");
26 
27  tpOutputCollection_ = ps.getParameter<std::string>("tpOutputCollection");
28  tpInputToken_ = consumes<EcalTrigPrimDigiCollection>(ps.getParameter<edm::InputTag>("tpInputCollection"));
29  ttMapToken_ = esConsumes<EcalTrigTowerConstituentsMap, IdealGeometryRecord>();
30  if (not skipModule_) {
31  chStatusToken_ = esConsumes<EcalChannelStatus, EcalChannelStatusRcd>();
32  }
33  produces<EcalTrigPrimDigiCollection>(tpOutputCollection_);
34 }
edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > chStatusToken_
Definition: EcalTPSkimmer.h:45
std::vector< uint32_t > chStatusToSelectTP_
Definition: EcalTPSkimmer.h:42
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecord > ttMapToken_
Definition: EcalTPSkimmer.h:44
std::string tpOutputCollection_
Definition: EcalTPSkimmer.h:51
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< EcalTrigPrimDigiCollection > tpInputToken_
Definition: EcalTPSkimmer.h:49
EcalTPSkimmer::~EcalTPSkimmer ( )
override

Definition at line 36 of file EcalTPSkimmer.cc.

36 {}

Member Function Documentation

bool EcalTPSkimmer::alreadyInserted ( EcalTrigTowerDetId  ttId)
private

Definition at line 114 of file EcalTPSkimmer.cc.

References insertedTP_.

Referenced by produce().

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

Definition at line 116 of file EcalTPSkimmer.cc.

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

Referenced by produce().

118  {
119  EcalTrigPrimDigiCollection::const_iterator tpIt = tpIn->find(ttId);
120  if (tpIt != tpIn->end()) {
121  tpOut.push_back(*tpIt);
122  insertedTP_.insert(ttId);
123  }
124 }
std::vector< T >::const_iterator const_iterator
std::set< EcalTrigTowerDetId > insertedTP_
Definition: EcalTPSkimmer.h:47
void EcalTPSkimmer::produce ( edm::Event evt,
const edm::EventSetup es 
)
override

Definition at line 38 of file EcalTPSkimmer.cc.

References alreadyInserted(), chStatusToken_, chStatusToSelectTP_, EBDetId::detIdFromDenseIndex(), EEDetId::detIdFromDenseIndex(), doBarrel_, doEndcap_, spr::find(), edm::Event::getByToken(), edm::EventSetup::getHandle(), mps_fire::i, insertedTP_, insertTP(), EBDetId::kSizeForDenseIndexing, EEDetId::kSizeForDenseIndexing, eostools::move(), edm::Event::put(), skipModule_, hgcalTowerProducer_cfi::tower, tpInputToken_, tpOutputCollection_, ttMap_, ttMapToken_, EBDetId::validDenseIndex(), and EEDetId::validDenseIndex().

38  {
39  insertedTP_.clear();
40 
41  using namespace edm;
42 
44 
45  // collection of rechits to put in the event
46  auto tpOut = std::make_unique<EcalTrigPrimDigiCollection>();
47 
48  if (skipModule_) {
49  evt.put(std::move(tpOut), tpOutputCollection_);
50  return;
51  }
52 
54 
56  evt.getByToken(tpInputToken_, tpIn);
57 
58  if (doBarrel_) {
60  uint16_t code = 0;
61  for (int i = 0; i < EBDetId::kSizeForDenseIndexing; ++i) {
63  continue;
65  chit = chStatus->find(id);
66  // check if the channel status means TP to be kept
67  if (chit != chStatus->end()) {
68  code = (*chit).getStatusCode();
69  if (std::find(chStatusToSelectTP_.begin(), chStatusToSelectTP_.end(), code) != chStatusToSelectTP_.end()) {
70  // retrieve the TP DetId
71  EcalTrigTowerDetId ttDetId(((EBDetId)id).tower());
72  // insert the TP if not done already
73  if (!alreadyInserted(ttDetId))
74  insertTP(ttDetId, tpIn, *tpOut);
75  }
76  } else {
77  edm::LogError("EcalDetIdToBeRecoveredProducer") << "No channel status found for xtal " << id.rawId()
78  << "! something wrong with EcalChannelStatus in your DB? ";
79  }
80  }
81  }
82 
83  if (doEndcap_) {
85  uint16_t code = 0;
86  for (int i = 0; i < EEDetId::kSizeForDenseIndexing; ++i) {
88  continue;
90  chit = chStatus->find(id);
91  // check if the channel status means TP to be kept
92  if (chit != chStatus->end()) {
93  code = (*chit).getStatusCode();
94  if (std::find(chStatusToSelectTP_.begin(), chStatusToSelectTP_.end(), code) != chStatusToSelectTP_.end()) {
95  // retrieve the TP DetId
96  EcalTrigTowerDetId ttDetId = ttMap_->towerOf(id);
97  // insert the TP if not done already
98  if (!alreadyInserted(ttDetId))
99  insertTP(ttDetId, tpIn, *tpOut);
100  }
101  } else {
102  edm::LogError("EcalDetIdToBeRecoveredProducer") << "No channel status found for xtal " << id.rawId()
103  << "! something wrong with EcalChannelStatus in your DB? ";
104  }
105  }
106  }
107 
108  // put the collection of reconstructed hits in the event
109  LogInfo("EcalTPSkimmer") << "total # of TP inserted: " << tpOut->size();
110 
111  evt.put(std::move(tpOut), tpOutputCollection_);
112 }
static EEDetId detIdFromDenseIndex(uint32_t din)
Definition: EEDetId.h:220
edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > chStatusToken_
Definition: EcalTPSkimmer.h:45
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
std::vector< uint32_t > chStatusToSelectTP_
Definition: EcalTPSkimmer.h:42
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
std::set< EcalTrigTowerDetId > insertedTP_
Definition: EcalTPSkimmer.h:47
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
static EBDetId detIdFromDenseIndex(uint32_t di)
Definition: EBDetId.h:107
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecord > ttMapToken_
Definition: EcalTPSkimmer.h:44
edm::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
Definition: EcalTPSkimmer.h:43
def move
Definition: eostools.py:511
std::string tpOutputCollection_
Definition: EcalTPSkimmer.h:51
Log< level::Info, false > LogInfo
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
edm::EDGetTokenT< EcalTrigPrimDigiCollection > tpInputToken_
Definition: EcalTPSkimmer.h:49
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
static bool validDenseIndex(uint32_t din)
Definition: EBDetId.h:105

Member Data Documentation

edm::ESGetToken<EcalChannelStatus, EcalChannelStatusRcd> EcalTPSkimmer::chStatusToken_
private

Definition at line 45 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

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

Definition at line 42 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

bool EcalTPSkimmer::doBarrel_
private

Definition at line 39 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

bool EcalTPSkimmer::doEndcap_
private

Definition at line 40 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

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

Definition at line 47 of file EcalTPSkimmer.h.

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

bool EcalTPSkimmer::skipModule_
private

Definition at line 38 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

std::string EcalTPSkimmer::tpCollection_
private

Definition at line 36 of file EcalTPSkimmer.h.

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

Definition at line 49 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

std::string EcalTPSkimmer::tpOutputCollection_
private

Definition at line 51 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

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

Definition at line 43 of file EcalTPSkimmer.h.

Referenced by produce().

Definition at line 44 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().