CMS 3D CMS Logo

EcalTPSkimmer.cc
Go to the documentation of this file.
1 
9 
12 
14 
18 
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 }
35 
37 
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 }
113 
115 
120  if (tpIt != tpIn->end()) {
121  tpOut.push_back(*tpIt);
122  insertedTP_.insert(ttId);
123  }
124 }
125 
EcalCondObjectContainer::end
const_iterator end() const
Definition: EcalCondObjectContainer.h:74
Handle.h
mps_fire.i
i
Definition: mps_fire.py:428
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
MessageLogger.h
ESHandle.h
EBDetId
Definition: EBDetId.h:17
edm
HLT enums.
Definition: AlignableModifier.h:19
ecaldqm::ttId
unsigned ttId(DetId const &, EcalElectronicsMapping const *)
Definition: EcalDQMCommonUtils.cc:99
EcalTPSkimmer::tpInputToken_
edm::EDGetTokenT< EcalTrigPrimDigiCollection > tpInputToken_
Definition: EcalTPSkimmer.h:49
EBDetId.h
EEDetId.h
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:4
edm::SortedCollection
Definition: SortedCollection.h:49
EcalTrigTowerDetId
Definition: EcalTrigTowerDetId.h:14
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::Handle
Definition: AssociativeIterator.h:50
edm::SortedCollection::push_back
void push_back(T const &t)
Definition: SortedCollection.h:188
EcalTPSkimmer::ttMapToken_
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecord > ttMapToken_
Definition: EcalTPSkimmer.h:44
EEDetId::detIdFromDenseIndex
static EEDetId detIdFromDenseIndex(uint32_t din)
Definition: EEDetId.h:220
MakerMacros.h
EEDetId::validDenseIndex
static bool validDenseIndex(uint32_t din)
Definition: EEDetId.h:213
EcalTPSkimmer::doBarrel_
bool doBarrel_
Definition: EcalTPSkimmer.h:39
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
EcalTPSkimmer::~EcalTPSkimmer
~EcalTPSkimmer() override
Definition: EcalTPSkimmer.cc:36
EEDetId::kSizeForDenseIndexing
Definition: EEDetId.h:329
edm::ESHandle
Definition: DTSurvey.h:22
EcalTPSkimmer::alreadyInserted
bool alreadyInserted(EcalTrigTowerDetId ttId)
Definition: EcalTPSkimmer.cc:114
EcalTPSkimmer::insertTP
void insertTP(EcalTrigTowerDetId ttId, edm::Handle< EcalTrigPrimDigiCollection > &in, EcalTrigPrimDigiCollection &out)
Definition: EcalTPSkimmer.cc:116
EcalCondObjectContainer::find
const_iterator find(uint32_t rawId) const
Definition: EcalCondObjectContainer.h:53
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
EEDetId
Definition: EEDetId.h:14
EcalTrigTowerDetId.h
EcalTPSkimmer::ttMap_
edm::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
Definition: EcalTPSkimmer.h:43
edm::ParameterSet
Definition: ParameterSet.h:47
EcalTPSkimmer::doEndcap_
bool doEndcap_
Definition: EcalTPSkimmer.h:40
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
EcalTPSkimmer::tpOutputCollection_
std::string tpOutputCollection_
Definition: EcalTPSkimmer.h:51
EBDetId::detIdFromDenseIndex
static EBDetId detIdFromDenseIndex(uint32_t di)
Definition: EBDetId.h:107
EBDetId::validDenseIndex
static bool validDenseIndex(uint32_t din)
Definition: EBDetId.h:105
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
EcalTPSkimmer.h
edm::EventSetup
Definition: EventSetup.h:58
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
EcalTPSkimmer::EcalTPSkimmer
EcalTPSkimmer(const edm::ParameterSet &ps)
Definition: EcalTPSkimmer.cc:19
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalTPSkimmer::chStatusToken_
edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > chStatusToken_
Definition: EcalTPSkimmer.h:45
EcalTrigTowerConstituentsMap::towerOf
EcalTrigTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
Definition: EcalTrigTowerConstituentsMap.cc:11
edm::SortedCollection::find
iterator find(key_type k)
Definition: SortedCollection.h:240
eostools.move
def move(src, dest)
Definition: eostools.py:511
EBDetId::kSizeForDenseIndexing
Definition: EBDetId.h:155
EcalTPSkimmer::chStatusToSelectTP_
std::vector< uint32_t > chStatusToSelectTP_
Definition: EcalTPSkimmer.h:42
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EcalCondObjectContainer::const_iterator
std::vector< Item >::const_iterator const_iterator
Definition: EcalCondObjectContainer.h:19
EcalTPSkimmer::produce
void produce(edm::Event &evt, const edm::EventSetup &es) override
Definition: EcalTPSkimmer.cc:38
EcalTPSkimmer
Definition: EcalTPSkimmer.h:26
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
EcalTPSkimmer::insertedTP_
std::set< EcalTrigTowerDetId > insertedTP_
Definition: EcalTPSkimmer.h:47
EcalTPSkimmer::skipModule_
bool skipModule_
Definition: EcalTPSkimmer.h:38