CMS 3D CMS Logo

EcalTPSkimmer.cc
Go to the documentation of this file.
1 
9 
12 
14 
18 
21 
23 
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 }
37 
39 
41  insertedTP_.clear();
42 
43  using namespace edm;
44 
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 }
116 
118 
123  if (tpIt != tpIn->end()) {
124  tpOut.push_back(*tpIt);
125  insertedTP_.insert(ttId);
126  }
127 }
128 
EcalCondObjectContainer::end
const_iterator end() const
Definition: EcalCondObjectContainer.h:76
Handle.h
mps_fire.i
i
Definition: mps_fire.py:355
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
EcalTPSkimmer::tpInputToken_
edm::EDGetTokenT< EcalTrigPrimDigiCollection > tpInputToken_
Definition: EcalTPSkimmer.h:43
EBDetId.h
EEDetId.h
edm::LogInfo
Definition: MessageLogger.h:254
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:3
ecaldqm::ttId
unsigned ttId(DetId const &)
Definition: EcalDQMCommonUtils.cc:101
edm::SortedCollection
Definition: SortedCollection.h:49
EcalTrigTowerDetId
Definition: EcalTrigTowerDetId.h:14
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
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
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
EcalTPSkimmer::doBarrel_
bool doBarrel_
Definition: EcalTPSkimmer.h:35
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
EEDetId::kSizeForDenseIndexing
Definition: EEDetId.h:329
EcalTPSkimmer::~EcalTPSkimmer
~EcalTPSkimmer() override
Definition: EcalTPSkimmer.cc:38
edm::ESHandle
Definition: DTSurvey.h:22
EcalTPSkimmer::alreadyInserted
bool alreadyInserted(EcalTrigTowerDetId ttId)
Definition: EcalTPSkimmer.cc:117
EcalTPSkimmer::insertTP
void insertTP(EcalTrigTowerDetId ttId, edm::Handle< EcalTrigPrimDigiCollection > &in, EcalTrigPrimDigiCollection &out)
Definition: EcalTPSkimmer.cc:119
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:528
EEDetId
Definition: EEDetId.h:14
EcalTrigTowerDetId.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalTPSkimmer::ttMap_
edm::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
Definition: EcalTPSkimmer.h:39
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
EcalTPSkimmer::doEndcap_
bool doEndcap_
Definition: EcalTPSkimmer.h:36
EcalChannelStatusRcd
Definition: EcalChannelStatusRcd.h:5
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
EcalTPSkimmer::tpOutputCollection_
std::string tpOutputCollection_
Definition: EcalTPSkimmer.h:45
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:132
EcalTPSkimmer.h
IdealGeometryRecord.h
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
EcalTPSkimmer::EcalTPSkimmer
EcalTPSkimmer(const edm::ParameterSet &ps)
Definition: EcalTPSkimmer.cc:24
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::ParameterSet::getParameter
T getParameter(std::string const &) const
edm::SortedCollection::find
iterator find(key_type k)
Definition: SortedCollection.h:240
eostools.move
def move(src, dest)
Definition: eostools.py:511
EcalTPSkimmer::chStatusToSelectTP_
std::vector< uint32_t > chStatusToSelectTP_
Definition: EcalTPSkimmer.h:38
EBDetId::kSizeForDenseIndexing
Definition: EBDetId.h:155
EcalCondObjectContainer< EcalChannelStatusCode >::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:40
EcalTPSkimmer
Definition: EcalTPSkimmer.h:22
edm::Event
Definition: Event.h:73
EcalChannelStatus.h
edm::InputTag
Definition: InputTag.h:15
EcalTPSkimmer::insertedTP_
std::set< EcalTrigTowerDetId > insertedTP_
Definition: EcalTPSkimmer.h:41
IdealGeometryRecord
Definition: IdealGeometryRecord.h:27
EcalChannelStatusRcd.h
EcalTPSkimmer::skipModule_
bool skipModule_
Definition: EcalTPSkimmer.h:34