CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
AlCaHcalNoiseProducer Class Reference

#include <AlCaHcalNoiseProducer.h>

Inheritance diagram for AlCaHcalNoiseProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 AlCaHcalNoiseProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~AlCaHcalNoiseProducer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

std::vector< edm::InputTagecalLabels_
 
double JetHCALminEnergyFraction_
 
double JetMinE_
 
double MetCut_
 
int nAnomalousEvents
 
int nEvents
 
edm::EDGetTokenT< HBHERecHitCollectiontok_hbhe_
 
edm::EDGetTokenT< HFRecHitCollectiontok_hf_
 
edm::EDGetTokenT< HORecHitCollectiontok_ho_
 
edm::EDGetTokenT< reco::CaloJetCollectiontok_jets_
 
edm::EDGetTokenT< reco::CaloMETCollectiontok_met_
 
edm::EDGetTokenT< EcalRecHitCollectiontok_ps_
 
edm::EDGetTokenT< FEDRawDataCollectiontok_raw_
 
edm::EDGetTokenT< CaloTowerCollectiontok_tower_
 
std::vector< edm::EDGetTokenT< EcalRecHitCollection > > toks_ecal_
 
bool useJet_
 
bool useMet_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 42 of file AlCaHcalNoiseProducer.h.

Constructor & Destructor Documentation

AlCaHcalNoiseProducer::AlCaHcalNoiseProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 25 of file AlCaHcalNoiseProducer.cc.

References ecalLabels_, edm::ParameterSet::getParameter(), mps_fire::i, JetHCALminEnergyFraction_, JetMinE_, MetCut_, tok_hbhe_, tok_hf_, tok_ho_, tok_jets_, tok_met_, tok_ps_, tok_raw_, tok_tower_, toks_ecal_, useJet_, and useMet_.

25  {
26  tok_jets_ = consumes<reco::CaloJetCollection>(iConfig.getParameter<edm::InputTag>("JetSource"));
27  tok_met_ = consumes<reco::CaloMETCollection>(iConfig.getParameter<edm::InputTag>("MetSource"));
28  tok_tower_ = consumes<CaloTowerCollection>(iConfig.getParameter<edm::InputTag>("TowerSource"));
29  useMet_ = iConfig.getParameter<bool>("UseMET");
30  useJet_ = iConfig.getParameter<bool>("UseJet");
31  MetCut_ = iConfig.getParameter<double>("MetCut");
32  JetMinE_ = iConfig.getParameter<double>("JetMinE");
33  JetHCALminEnergyFraction_ = iConfig.getParameter<double>("JetHCALminEnergyFraction");
34 
35  tok_ho_ = consumes<HORecHitCollection>(iConfig.getParameter<edm::InputTag>("hoInput"));
36  tok_hf_ = consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("hfInput"));
37  tok_hbhe_ = consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("hbheInput"));
38  ecalLabels_ = iConfig.getParameter<std::vector<edm::InputTag> >("ecalInputs");
39  tok_ps_ = consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("ecalPSInput"));
40  tok_raw_ = consumes<FEDRawDataCollection>(iConfig.getParameter<edm::InputTag>("rawInput"));
41 
42  const unsigned nLabels = ecalLabels_.size();
43  for (unsigned i = 0; i != nLabels; i++)
44  toks_ecal_.push_back(consumes<EcalRecHitCollection>(ecalLabels_[i]));
45 
46  //register products
47  produces<HBHERecHitCollection>("HBHERecHitCollectionFHN");
48  produces<HORecHitCollection>("HORecHitCollectionFHN");
49  produces<HFRecHitCollection>("HFRecHitCollectionFHN");
50 
51  produces<EcalRecHitCollection>("EcalRecHitCollectionFHN");
52  produces<EcalRecHitCollection>("PSEcalRecHitCollectionFHN");
53 
54  produces<FEDRawDataCollection>("HcalFEDsFHN");
55 }
edm::EDGetTokenT< HFRecHitCollection > tok_hf_
T getParameter(std::string const &) const
edm::EDGetTokenT< HORecHitCollection > tok_ho_
std::vector< edm::EDGetTokenT< EcalRecHitCollection > > toks_ecal_
edm::EDGetTokenT< CaloTowerCollection > tok_tower_
edm::EDGetTokenT< EcalRecHitCollection > tok_ps_
edm::EDGetTokenT< FEDRawDataCollection > tok_raw_
edm::EDGetTokenT< reco::CaloJetCollection > tok_jets_
std::vector< edm::InputTag > ecalLabels_
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
edm::EDGetTokenT< reco::CaloMETCollection > tok_met_
AlCaHcalNoiseProducer::~AlCaHcalNoiseProducer ( )
override

Definition at line 57 of file AlCaHcalNoiseProducer.cc.

57 {}

Member Function Documentation

void AlCaHcalNoiseProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 60 of file AlCaHcalNoiseProducer.cc.

References edm::SortedCollection< T, SORT >::begin(), FEDRawData::data(), data, PbPb_ZMuSkimMuonDPG_cff::deltaR, HGC3DClusterGenMatchSelector_cfi::dR, RecoEcal_EventContent_cff::ec, edm::SortedCollection< T, SORT >::end(), FEDRawDataCollection::FEDData(), edm::Event::getByToken(), photonIsolationHIProducer_cfi::hbhe, photonIsolationHIProducer_cfi::hf, photonIsolationHIProducer_cfi::ho, mps_fire::i, dqmiolumiharvest::j, JetHCALminEnergyFraction_, JetMinE_, dqmdumpme::k, FEDNumbering::MAXFEDID, FEDNumbering::MAXHCALFEDID, BTaggingMonitor_cfi::met, MetCut_, FEDNumbering::MINHCALFEDID, eostools::move(), nAnomalousEvents, nEvents, edm::Handle< T >::product(), reco::LeafCandidate::pt(), edm::SortedCollection< T, SORT >::push_back(), edm::Event::put(), rpcPointValidation_cfi::recHit, FEDRawData::resize(), FEDRawData::size(), findQualityFiles::size, tok_hbhe_, tok_hf_, tok_ho_, tok_jets_, tok_met_, tok_ps_, tok_raw_, tok_tower_, toks_ecal_, useJet_, and useMet_.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

60  {
61  bool acceptEvent = false;
62 
63  // filtering basing on HLTrigger/special/src/HLTHcalNoiseFilter.cc:
64 
65  bool isAnomalous_BasedOnMET = false;
66  bool isAnomalous_BasedOnEnergyFraction = false;
67 
68  if (useMet_) {
70  iEvent.getByToken(tok_met_, metHandle);
71  const reco::CaloMETCollection* metCol = metHandle.product();
72  const reco::CaloMET met = metCol->front();
73 
74  if (met.pt() > MetCut_)
75  isAnomalous_BasedOnMET = true;
76  }
77 
78  if (useJet_) {
80  iEvent.getByToken(tok_jets_, calojetHandle);
81 
83  iEvent.getByToken(tok_tower_, towerHandle);
84 
85  std::vector<CaloTower> TowerContainer;
86  std::vector<reco::CaloJet> JetContainer;
87  TowerContainer.clear();
88  JetContainer.clear();
89  CaloTower seedTower;
90  nEvents++;
91  for (reco::CaloJetCollection::const_iterator calojetIter = calojetHandle->begin();
92  calojetIter != calojetHandle->end();
93  ++calojetIter) {
94  if (((calojetIter->et()) * cosh(calojetIter->eta()) > JetMinE_) &&
95  (calojetIter->energyFractionHadronic() > JetHCALminEnergyFraction_)) {
96  JetContainer.push_back(*calojetIter);
97  double maxTowerE = 0.0;
98  for (CaloTowerCollection::const_iterator kal = towerHandle->begin(); kal != towerHandle->end(); kal++) {
99  double dR = deltaR((*calojetIter).eta(), (*calojetIter).phi(), (*kal).eta(), (*kal).phi());
100  if ((dR < 0.50) && (kal->p() > maxTowerE)) {
101  maxTowerE = kal->p();
102  seedTower = *kal;
103  }
104  }
105  TowerContainer.push_back(seedTower);
106  }
107  }
108  if (!JetContainer.empty()) {
110  isAnomalous_BasedOnEnergyFraction = true;
111  }
112  }
113 
114  acceptEvent = ((useMet_ && isAnomalous_BasedOnMET) || (useJet_ && isAnomalous_BasedOnEnergyFraction));
115 
117 
118  //Create empty output collections
119 
120  auto miniHBHERecHitCollection = std::make_unique<HBHERecHitCollection>();
121  auto miniHORecHitCollection = std::make_unique<HORecHitCollection>();
122  auto miniHFRecHitCollection = std::make_unique<HFRecHitCollection>();
123 
124  auto outputEColl = std::make_unique<EcalRecHitCollection>();
125  auto outputESColl = std::make_unique<EcalRecHitCollection>();
126 
127  auto outputFEDs = std::make_unique<FEDRawDataCollection>();
128 
129  // if good event get and save all colletions
130  if (acceptEvent) {
134 
135  iEvent.getByToken(tok_hbhe_, hbhe);
136  iEvent.getByToken(tok_ho_, ho);
137  iEvent.getByToken(tok_hf_, hf);
138 
140  iEvent.getByToken(tok_ps_, pRecHits);
141 
142  // temporary collection of EB+EE recHits
143 
144  auto tmpEcalRecHitCollection = std::make_unique<EcalRecHitCollection>();
145 
146  std::vector<edm::EDGetTokenT<EcalRecHitCollection> >::const_iterator i;
147  for (i = toks_ecal_.begin(); i != toks_ecal_.end(); i++) {
149  iEvent.getByToken(*i, ec);
150  for (EcalRecHitCollection::const_iterator recHit = (*ec).begin(); recHit != (*ec).end(); ++recHit) {
151  tmpEcalRecHitCollection->push_back(*recHit);
152  }
153  }
154 
156 
158  const HBHERecHitCollection Hithbhe = *(hbhe.product());
159  for (HBHERecHitCollection::const_iterator hbheItr = Hithbhe.begin(); hbheItr != Hithbhe.end(); hbheItr++) {
160  miniHBHERecHitCollection->push_back(*hbheItr);
161  }
162  const HORecHitCollection Hitho = *(ho.product());
163  for (HORecHitCollection::const_iterator hoItr = Hitho.begin(); hoItr != Hitho.end(); hoItr++) {
164  miniHORecHitCollection->push_back(*hoItr);
165  }
166 
167  const HFRecHitCollection Hithf = *(hf.product());
168  for (HFRecHitCollection::const_iterator hfItr = Hithf.begin(); hfItr != Hithf.end(); hfItr++) {
169  miniHFRecHitCollection->push_back(*hfItr);
170  }
172 
174  for (std::vector<EcalRecHit>::const_iterator ehit = tmpEcalRecHitCollection->begin();
175  ehit != tmpEcalRecHitCollection->end();
176  ehit++) {
177  outputEColl->push_back(*ehit);
178  }
180 
181  // write PS
182  const EcalRecHitCollection& psrechits = *(pRecHits.product());
183 
184  for (EcalRecHitCollection::const_iterator i = psrechits.begin(); i != psrechits.end(); i++) {
185  outputESColl->push_back(*i);
186  }
187 
188  // get HCAL FEDs
190  iEvent.getByToken(tok_raw_, rawIn);
191 
192  std::vector<int> selFEDs;
193  for (int i = FEDNumbering::MINHCALFEDID; i <= FEDNumbering::MAXHCALFEDID; i++) {
194  selFEDs.push_back(i);
195  }
197 
198  // Copying FEDs :
199  const FEDRawDataCollection* rdc = rawIn.product();
200 
201  // if ( ( rawData[i].provenance()->processName() != e.processHistory().rbegin()->processName() ) )
202  // continue ; // skip all raw collections not produced by the current process
203 
204  for (int j = 0; j < FEDNumbering::MAXFEDID; ++j) {
205  bool rightFED = false;
206  for (uint32_t k = 0; k < selFEDs.size(); k++) {
207  if (j == selFEDs[k]) {
208  rightFED = true;
209  }
210  }
211  if (!rightFED)
212  continue;
213  const FEDRawData& fedData = rdc->FEDData(j);
214  size_t size = fedData.size();
215 
216  if (size > 0) {
217  // this fed has data -- lets copy it
218  FEDRawData& fedDataProd = outputFEDs->FEDData(j);
219  if (fedDataProd.size() != 0) {
220  // std::cout << " More than one FEDRawDataCollection with data in FED ";
221  // std::cout << j << " Skipping the 2nd\n";
222  continue;
223  }
224  fedDataProd.resize(size);
225  unsigned char* dataProd = fedDataProd.data();
226  const unsigned char* data = fedData.data();
227  for (unsigned int k = 0; k < size; ++k) {
228  dataProd[k] = data[k];
229  }
230  }
231  }
233  }
234 
235  //Put selected information in the event
236  iEvent.put(std::move(miniHBHERecHitCollection), "HBHERecHitCollectionFHN");
237  iEvent.put(std::move(miniHORecHitCollection), "HORecHitCollectionFHN");
238  iEvent.put(std::move(miniHFRecHitCollection), "HFRecHitCollectionFHN");
239  iEvent.put(std::move(outputEColl), "EcalRecHitCollectionFHN");
240  iEvent.put(std::move(outputESColl), "PSEcalRecHitCollectionFHN");
241  iEvent.put(std::move(outputFEDs), "HcalFEDsFHN");
242 }
edm::EDGetTokenT< HFRecHitCollection > tok_hf_
size
Write out results.
edm::EDGetTokenT< HORecHitCollection > tok_ho_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
std::vector< CaloTower >::const_iterator const_iterator
std::vector< edm::EDGetTokenT< EcalRecHitCollection > > toks_ecal_
edm::EDGetTokenT< CaloTowerCollection > tok_tower_
void push_back(T const &t)
double pt() const final
transverse momentum
edm::EDGetTokenT< EcalRecHitCollection > tok_ps_
edm::EDGetTokenT< FEDRawDataCollection > tok_raw_
edm::EDGetTokenT< reco::CaloJetCollection > tok_jets_
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void resize(size_t newsize)
Definition: FEDRawData.cc:28
const_iterator end() const
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
T const * product() const
Definition: Handle.h:69
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< reco::CaloMETCollection > tok_met_
const_iterator begin() const

Member Data Documentation

std::vector<edm::InputTag> AlCaHcalNoiseProducer::ecalLabels_
private

Definition at line 60 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer().

double AlCaHcalNoiseProducer::JetHCALminEnergyFraction_
private

Definition at line 56 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

double AlCaHcalNoiseProducer::JetMinE_
private

Definition at line 55 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

double AlCaHcalNoiseProducer::MetCut_
private

Definition at line 54 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

int AlCaHcalNoiseProducer::nAnomalousEvents
private

Definition at line 57 of file AlCaHcalNoiseProducer.h.

Referenced by produce().

int AlCaHcalNoiseProducer::nEvents
private

Definition at line 58 of file AlCaHcalNoiseProducer.h.

Referenced by looper.Looper::loop(), and produce().

edm::EDGetTokenT<HBHERecHitCollection> AlCaHcalNoiseProducer::tok_hbhe_
private

Definition at line 66 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

edm::EDGetTokenT<HFRecHitCollection> AlCaHcalNoiseProducer::tok_hf_
private

Definition at line 68 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

edm::EDGetTokenT<HORecHitCollection> AlCaHcalNoiseProducer::tok_ho_
private

Definition at line 67 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

edm::EDGetTokenT<reco::CaloJetCollection> AlCaHcalNoiseProducer::tok_jets_
private

Definition at line 62 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

edm::EDGetTokenT<reco::CaloMETCollection> AlCaHcalNoiseProducer::tok_met_
private

Definition at line 63 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

edm::EDGetTokenT<EcalRecHitCollection> AlCaHcalNoiseProducer::tok_ps_
private

Definition at line 70 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

edm::EDGetTokenT<FEDRawDataCollection> AlCaHcalNoiseProducer::tok_raw_
private

Definition at line 71 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

edm::EDGetTokenT<CaloTowerCollection> AlCaHcalNoiseProducer::tok_tower_
private

Definition at line 64 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

std::vector<edm::EDGetTokenT<EcalRecHitCollection> > AlCaHcalNoiseProducer::toks_ecal_
private

Definition at line 72 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

bool AlCaHcalNoiseProducer::useJet_
private

Definition at line 53 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

bool AlCaHcalNoiseProducer::useMet_
private

Definition at line 52 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().