CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
EcalTPSkimmer Class Reference
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, EcalChannelStatusRcdchStatusToken_
 
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_
 
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecordttMapToken_
 

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 25 of file EcalTPSkimmer.cc.

Constructor & Destructor Documentation

◆ EcalTPSkimmer()

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

Definition at line 53 of file EcalTPSkimmer.cc.

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

53  {
54  skipModule_ = ps.getParameter<bool>("skipModule");
55 
56  doBarrel_ = ps.getParameter<bool>("doBarrel");
57  doEndcap_ = ps.getParameter<bool>("doEndcap");
58 
59  chStatusToSelectTP_ = ps.getParameter<std::vector<uint32_t> >("chStatusToSelectTP");
60 
61  tpOutputCollection_ = ps.getParameter<std::string>("tpOutputCollection");
62  tpInputToken_ = consumes<EcalTrigPrimDigiCollection>(ps.getParameter<edm::InputTag>("tpInputCollection"));
63  ttMapToken_ = esConsumes<EcalTrigTowerConstituentsMap, IdealGeometryRecord>();
64  if (not skipModule_) {
65  chStatusToken_ = esConsumes<EcalChannelStatus, EcalChannelStatusRcd>();
66  }
67  produces<EcalTrigPrimDigiCollection>(tpOutputCollection_);
68 }
edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > chStatusToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< uint32_t > chStatusToSelectTP_
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecord > ttMapToken_
std::string tpOutputCollection_
edm::EDGetTokenT< EcalTrigPrimDigiCollection > tpInputToken_

◆ ~EcalTPSkimmer()

EcalTPSkimmer::~EcalTPSkimmer ( )
override

Definition at line 70 of file EcalTPSkimmer.cc.

70 {}

Member Function Documentation

◆ alreadyInserted()

bool EcalTPSkimmer::alreadyInserted ( EcalTrigTowerDetId  ttId)
private

Definition at line 148 of file EcalTPSkimmer.cc.

References insertedTP_, and ecaldqm::ttId().

Referenced by produce().

148 { return (insertedTP_.find(ttId) != insertedTP_.end()); }
std::set< EcalTrigTowerDetId > insertedTP_
unsigned ttId(DetId const &, EcalElectronicsMapping const *)

◆ insertTP()

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

Definition at line 150 of file EcalTPSkimmer.cc.

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

Referenced by produce().

152  {
154  if (tpIt != tpIn->end()) {
155  tpOut.push_back(*tpIt);
156  insertedTP_.insert(ttId);
157  }
158 }
std::vector< T >::const_iterator const_iterator
std::set< EcalTrigTowerDetId > insertedTP_
unsigned ttId(DetId const &, EcalElectronicsMapping const *)

◆ produce()

void EcalTPSkimmer::produce ( edm::Event evt,
const edm::EventSetup es 
)
override

Definition at line 72 of file EcalTPSkimmer.cc.

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

72  {
73  insertedTP_.clear();
74 
75  using namespace edm;
76 
78 
79  // collection of rechits to put in the event
80  auto tpOut = std::make_unique<EcalTrigPrimDigiCollection>();
81 
82  if (skipModule_) {
83  evt.put(std::move(tpOut), tpOutputCollection_);
84  return;
85  }
86 
88 
90  evt.getByToken(tpInputToken_, tpIn);
91 
92  if (doBarrel_) {
94  uint16_t code = 0;
95  for (int i = 0; i < EBDetId::kSizeForDenseIndexing; ++i) {
97  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(((EBDetId)id).tower());
106  // insert the TP if not done already
107  if (!alreadyInserted(ttDetId))
108  insertTP(ttDetId, tpIn, *tpOut);
109  }
110  } else {
111  edm::LogError("EcalDetIdToBeRecoveredProducer") << "No channel status found for xtal " << id.rawId()
112  << "! something wrong with EcalChannelStatus in your DB? ";
113  }
114  }
115  }
116 
117  if (doEndcap_) {
119  uint16_t code = 0;
120  for (int i = 0; i < EEDetId::kSizeForDenseIndexing; ++i) {
122  continue;
124  chit = chStatus->find(id);
125  // check if the channel status means TP to be kept
126  if (chit != chStatus->end()) {
127  code = (*chit).getStatusCode();
128  if (std::find(chStatusToSelectTP_.begin(), chStatusToSelectTP_.end(), code) != chStatusToSelectTP_.end()) {
129  // retrieve the TP DetId
130  EcalTrigTowerDetId ttDetId = ttMap_->towerOf(id);
131  // insert the TP if not done already
132  if (!alreadyInserted(ttDetId))
133  insertTP(ttDetId, tpIn, *tpOut);
134  }
135  } else {
136  edm::LogError("EcalDetIdToBeRecoveredProducer") << "No channel status found for xtal " << id.rawId()
137  << "! something wrong with EcalChannelStatus in your DB? ";
138  }
139  }
140  }
141 
142  // put the collection of reconstructed hits in the event
143  LogInfo("EcalTPSkimmer") << "total # of TP inserted: " << tpOut->size();
144 
145  evt.put(std::move(tpOut), tpOutputCollection_);
146 }
static EEDetId detIdFromDenseIndex(uint32_t din)
Definition: EEDetId.h:220
edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > chStatusToken_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
std::vector< uint32_t > chStatusToSelectTP_
std::set< EcalTrigTowerDetId > insertedTP_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:536
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
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:107
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecord > ttMapToken_
edm::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
std::string tpOutputCollection_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
const_iterator find(uint32_t rawId) const
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
HLT enums.
edm::EDGetTokenT< EcalTrigPrimDigiCollection > tpInputToken_
const_iterator end() const
def move(src, dest)
Definition: eostools.py:511
static bool validDenseIndex(uint32_t din)
Definition: EBDetId.h:105

Member Data Documentation

◆ chStatusToken_

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

Definition at line 44 of file EcalTPSkimmer.cc.

Referenced by EcalTPSkimmer(), and produce().

◆ chStatusToSelectTP_

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

Definition at line 41 of file EcalTPSkimmer.cc.

Referenced by EcalTPSkimmer(), and produce().

◆ doBarrel_

bool EcalTPSkimmer::doBarrel_
private

Definition at line 38 of file EcalTPSkimmer.cc.

Referenced by EcalTPSkimmer(), and produce().

◆ doEndcap_

bool EcalTPSkimmer::doEndcap_
private

Definition at line 39 of file EcalTPSkimmer.cc.

Referenced by EcalTPSkimmer(), and produce().

◆ insertedTP_

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

Definition at line 46 of file EcalTPSkimmer.cc.

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

◆ skipModule_

bool EcalTPSkimmer::skipModule_
private

Definition at line 37 of file EcalTPSkimmer.cc.

Referenced by EcalTPSkimmer(), and produce().

◆ tpCollection_

std::string EcalTPSkimmer::tpCollection_
private

Definition at line 35 of file EcalTPSkimmer.cc.

◆ tpInputToken_

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

Definition at line 48 of file EcalTPSkimmer.cc.

Referenced by EcalTPSkimmer(), and produce().

◆ tpOutputCollection_

std::string EcalTPSkimmer::tpOutputCollection_
private

Definition at line 50 of file EcalTPSkimmer.cc.

Referenced by EcalTPSkimmer(), and produce().

◆ ttMap_

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

Definition at line 42 of file EcalTPSkimmer.cc.

Referenced by produce().

◆ ttMapToken_

Definition at line 43 of file EcalTPSkimmer.cc.

Referenced by EcalTPSkimmer(), and produce().