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<>

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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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
 

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_.

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

Definition at line 38 of file EcalTPSkimmer.cc.

38 {}

Member Function Documentation

bool EcalTPSkimmer::alreadyInserted ( EcalTrigTowerDetId  ttId)
private

Definition at line 117 of file EcalTPSkimmer.cc.

References insertedTP_.

Referenced by produce().

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

Definition at line 119 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().

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

Definition at line 40 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_, hgcalTowerProducer_cfi::tower, EcalTrigTowerConstituentsMap::towerOf(), tpInputToken_, tpOutputCollection_, ttMap_, EBDetId::validDenseIndex(), and EEDetId::validDenseIndex().

40  {
41  insertedTP_.clear();
42 
43  using namespace edm;
44 
45  es.get<IdealGeometryRecord>().get(ttMap_);
46 
47  // collection of rechits to put in the event
48  auto tpOut = std::make_unique<EcalTrigPrimDigiCollection>();
49 
50  if (skipModule_) {
51  evt.put(std::move(tpOut), tpOutputCollection_);
52  return;
53  }
54 
56  es.get<EcalChannelStatusRcd>().get(chStatus);
57 
59  evt.getByToken(tpInputToken_, tpIn);
60 
61  if (doBarrel_) {
63  uint16_t code = 0;
64  for (int i = 0; i < EBDetId::kSizeForDenseIndexing; ++i) {
66  continue;
68  chit = chStatus->find(id);
69  // check if the channel status means TP to be kept
70  if (chit != chStatus->end()) {
71  code = (*chit).getStatusCode();
72  if (std::find(chStatusToSelectTP_.begin(), chStatusToSelectTP_.end(), code) != chStatusToSelectTP_.end()) {
73  // retrieve the TP DetId
74  EcalTrigTowerDetId ttDetId(((EBDetId)id).tower());
75  // insert the TP if not done already
76  if (!alreadyInserted(ttDetId))
77  insertTP(ttDetId, tpIn, *tpOut);
78  }
79  } else {
80  edm::LogError("EcalDetIdToBeRecoveredProducer") << "No channel status found for xtal " << id.rawId()
81  << "! something wrong with EcalChannelStatus in your DB? ";
82  }
83  }
84  }
85 
86  if (doEndcap_) {
88  uint16_t code = 0;
89  for (int i = 0; i < EEDetId::kSizeForDenseIndexing; ++i) {
91  continue;
93  chit = chStatus->find(id);
94  // check if the channel status means TP to be kept
95  if (chit != chStatus->end()) {
96  code = (*chit).getStatusCode();
97  if (std::find(chStatusToSelectTP_.begin(), chStatusToSelectTP_.end(), code) != chStatusToSelectTP_.end()) {
98  // retrieve the TP DetId
99  EcalTrigTowerDetId ttDetId = ttMap_->towerOf(id);
100  // insert the TP if not done already
101  if (!alreadyInserted(ttDetId))
102  insertTP(ttDetId, tpIn, *tpOut);
103  }
104  } else {
105  edm::LogError("EcalDetIdToBeRecoveredProducer") << "No channel status found for xtal " << id.rawId()
106  << "! something wrong with EcalChannelStatus in your DB? ";
107  }
108  }
109  }
110 
111  // put the collection of reconstructed hits in the event
112  LogInfo("EcalTPSkimmer") << "total # of TP inserted: " << tpOut->size();
113 
114  evt.put(std::move(tpOut), tpOutputCollection_);
115 }
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:131
std::vector< uint32_t > chStatusToSelectTP_
Definition: EcalTPSkimmer.h:38
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
std::set< EcalTrigTowerDetId > insertedTP_
Definition: EcalTPSkimmer.h:41
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::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
Definition: EcalTPSkimmer.h:39
std::string tpOutputCollection_
Definition: EcalTPSkimmer.h:45
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.
T get() const
Definition: EventSetup.h:73
edm::EDGetTokenT< EcalTrigPrimDigiCollection > tpInputToken_
Definition: EcalTPSkimmer.h:43
const_iterator find(uint32_t rawId) const
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

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

Definition at line 38 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

bool EcalTPSkimmer::doBarrel_
private

Definition at line 35 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

bool EcalTPSkimmer::doEndcap_
private

Definition at line 36 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

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

Definition at line 41 of file EcalTPSkimmer.h.

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

bool EcalTPSkimmer::skipModule_
private

Definition at line 34 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

std::string EcalTPSkimmer::tpCollection_
private

Definition at line 32 of file EcalTPSkimmer.h.

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

Definition at line 43 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

std::string EcalTPSkimmer::tpOutputCollection_
private

Definition at line 45 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

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

Definition at line 39 of file EcalTPSkimmer.h.

Referenced by produce().