CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~AlCaHcalNoiseProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

std::vector< edm::InputTagecalLabels_
 
double JetHCALminEnergyFraction_
 
double JetMinE_
 
double MetCut_
 
int nAnomalousEvents
 
int nEvents
 
edm::EDGetTokenT
< HBHERecHitCollection
tok_hbhe_
 
edm::EDGetTokenT
< HFRecHitCollection
tok_hf_
 
edm::EDGetTokenT
< HORecHitCollection
tok_ho_
 
edm::EDGetTokenT
< reco::CaloJetCollection
tok_jets_
 
edm::EDGetTokenT
< reco::CaloMETCollection
tok_met_
 
edm::EDGetTokenT
< EcalRecHitCollection
tok_ps_
 
edm::EDGetTokenT
< FEDRawDataCollection
tok_raw_
 
edm::EDGetTokenT
< CaloTowerCollection
tok_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
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 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 44 of file AlCaHcalNoiseProducer.h.

Constructor & Destructor Documentation

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

Definition at line 27 of file AlCaHcalNoiseProducer.cc.

References ecalLabels_, edm::ParameterSet::getParameter(), 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_.

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

Definition at line 63 of file AlCaHcalNoiseProducer.cc.

64 {
65 }

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 70 of file AlCaHcalNoiseProducer.cc.

References edm::SortedCollection< T, SORT >::begin(), FEDRawData::data(), data, deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, edm::SortedCollection< T, SORT >::end(), FEDRawDataCollection::FEDData(), edm::Event::getByToken(), i, j, JetHCALminEnergyFraction_, JetMinE_, gen::k, FEDNumbering::MAXFEDID, FEDNumbering::MAXHCALFEDID, caloMETBenchmarkGeneric_cfi::met, MetCut_, FEDNumbering::MINHCALFEDID, nAnomalousEvents, nEvents, edm::Handle< T >::product(), reco::LeafCandidate::pt(), edm::SortedCollection< T, SORT >::push_back(), edm::Event::put(), 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().

71 {
72  bool acceptEvent=false;
73 
74  // filtering basing on HLTrigger/special/src/HLTHcalNoiseFilter.cc:
75 
76  bool isAnomalous_BasedOnMET = false;
77  bool isAnomalous_BasedOnEnergyFraction=false;
78 
79  if (useMet_)
80  {
82  iEvent.getByToken(tok_met_, metHandle);
83  const reco::CaloMETCollection *metCol = metHandle.product();
84  const reco::CaloMET met = metCol->front();
85 
86  if(met.pt() > MetCut_) isAnomalous_BasedOnMET=true;
87  }
88 
89  if (useJet_)
90  {
92  iEvent.getByToken(tok_jets_,calojetHandle);
93 
95  iEvent.getByToken(tok_tower_, towerHandle);
96 
97  std::vector<CaloTower> TowerContainer;
98  std::vector<reco::CaloJet> JetContainer;
99  TowerContainer.clear();
100  JetContainer.clear();
101  CaloTower seedTower;
102  nEvents++;
103  for(reco::CaloJetCollection::const_iterator calojetIter = calojetHandle->begin();calojetIter != calojetHandle->end();++calojetIter) {
104  if( ((calojetIter->et())*cosh(calojetIter->eta()) > JetMinE_) && (calojetIter->energyFractionHadronic() > JetHCALminEnergyFraction_) ) {
105  JetContainer.push_back(*calojetIter);
106  double maxTowerE = 0.0;
107  for(CaloTowerCollection::const_iterator kal = towerHandle->begin(); kal != towerHandle->end(); kal++) {
108  double dR = deltaR((*calojetIter).eta(),(*calojetIter).phi(),(*kal).eta(),(*kal).phi());
109  if( (dR < 0.50) && (kal->p() > maxTowerE) ) {
110  maxTowerE = kal->p();
111  seedTower = *kal;
112  }
113  }
114  TowerContainer.push_back(seedTower);
115  }
116 
117  }
118  if(JetContainer.size() > 0) {
120  isAnomalous_BasedOnEnergyFraction = true;
121  }
122  }
123 
124  acceptEvent=((useMet_&&isAnomalous_BasedOnMET)||(useJet_&&isAnomalous_BasedOnEnergyFraction));
125 
127 
128  //Create empty output collections
129 
130  std::auto_ptr<HBHERecHitCollection> miniHBHERecHitCollection(new HBHERecHitCollection);
131  std::auto_ptr<HORecHitCollection> miniHORecHitCollection(new HORecHitCollection);
132  std::auto_ptr<HFRecHitCollection> miniHFRecHitCollection(new HFRecHitCollection);
133 
134  std::auto_ptr<EcalRecHitCollection> outputEColl(new EcalRecHitCollection);
135  std::auto_ptr<EcalRecHitCollection> outputESColl(new EcalRecHitCollection);
136 
137  std::auto_ptr<FEDRawDataCollection> outputFEDs(new FEDRawDataCollection);
138 
139 
140  // if good event get and save all colletions
141  if (acceptEvent)
142  {
146 
147  iEvent.getByToken(tok_hbhe_,hbhe);
148  iEvent.getByToken(tok_ho_,ho);
149  iEvent.getByToken(tok_hf_,hf);
150 
152  iEvent.getByToken(tok_ps_,pRecHits);
153 
154  // temporary collection of EB+EE recHits
155 
156  std::auto_ptr<EcalRecHitCollection> tmpEcalRecHitCollection(new EcalRecHitCollection);
157 
158  std::vector<edm::EDGetTokenT<EcalRecHitCollection> >::const_iterator i;
159  for (i=toks_ecal_.begin(); i!=toks_ecal_.end(); i++)
160  {
162  iEvent.getByToken(*i,ec);
163  for(EcalRecHitCollection::const_iterator recHit = (*ec).begin(); recHit != (*ec).end(); ++recHit)
164  {
165  tmpEcalRecHitCollection->push_back(*recHit);
166  }
167  }
168 
170 
172  const HBHERecHitCollection Hithbhe = *(hbhe.product());
173  for(HBHERecHitCollection::const_iterator hbheItr=Hithbhe.begin(); hbheItr!=Hithbhe.end(); hbheItr++)
174  {
175  miniHBHERecHitCollection->push_back(*hbheItr);
176  }
177  const HORecHitCollection Hitho = *(ho.product());
178  for(HORecHitCollection::const_iterator hoItr=Hitho.begin(); hoItr!=Hitho.end(); hoItr++)
179  {
180  miniHORecHitCollection->push_back(*hoItr);
181  }
182 
183  const HFRecHitCollection Hithf = *(hf.product());
184  for(HFRecHitCollection::const_iterator hfItr=Hithf.begin(); hfItr!=Hithf.end(); hfItr++)
185  {
186  miniHFRecHitCollection->push_back(*hfItr);
187  }
189 
191  for (std::vector<EcalRecHit>::const_iterator ehit=tmpEcalRecHitCollection->begin(); ehit!=tmpEcalRecHitCollection->end(); ehit++)
192  {
193  outputEColl->push_back(*ehit);
194  }
196 
197  // write PS
198  const EcalRecHitCollection& psrechits = *(pRecHits.product());
199 
200  for(EcalRecHitCollection::const_iterator i=psrechits.begin(); i!=psrechits.end(); i++)
201  {
202  outputESColl->push_back( *i );
203  }
204 
205 
206  // get HCAL FEDs
208  iEvent.getByToken(tok_raw_,rawIn);
209 
210  std::vector<int> selFEDs;
212  {
213  selFEDs.push_back(i);
214  }
216 
217  // Copying FEDs :
218  const FEDRawDataCollection *rdc=rawIn.product();
219 
220  // if ( ( rawData[i].provenance()->processName() != e.processHistory().rbegin()->processName() ) )
221  // continue ; // skip all raw collections not produced by the current process
222 
223  for ( int j=0; j< FEDNumbering::MAXFEDID; ++j )
224  {
225  bool rightFED=false;
226  for (uint32_t k=0; k<selFEDs.size(); k++)
227  {
228  if (j==selFEDs[k])
229  {
230  rightFED=true;
231  }
232  }
233  if (!rightFED) continue;
234  const FEDRawData & fedData = rdc->FEDData(j);
235  size_t size=fedData.size();
236 
237  if ( size > 0 )
238  {
239  // this fed has data -- lets copy it
240  FEDRawData & fedDataProd = outputFEDs->FEDData(j);
241  if ( fedDataProd.size() != 0 ) {
242  // std::cout << " More than one FEDRawDataCollection with data in FED ";
243  // std::cout << j << " Skipping the 2nd\n";
244  continue;
245  }
246  fedDataProd.resize(size);
247  unsigned char *dataProd=fedDataProd.data();
248  const unsigned char *data=fedData.data();
249  for ( unsigned int k=0; k<size; ++k ) {
250  dataProd[k]=data[k];
251  }
252  }
253  }
255  }
256 
257  //Put selected information in the event
258  iEvent.put( miniHBHERecHitCollection, "HBHERecHitCollectionFHN");
259  iEvent.put( miniHORecHitCollection, "HORecHitCollectionFHN");
260  iEvent.put( miniHFRecHitCollection, "HFRecHitCollectionFHN");
261  iEvent.put( outputEColl, "EcalRecHitCollectionFHN");
262  iEvent.put( outputESColl, "PSEcalRecHitCollectionFHN");
263  iEvent.put( outputFEDs, "HcalFEDsFHN");
264 }
edm::EDGetTokenT< HFRecHitCollection > tok_hf_
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< HORecHitCollection > tok_ho_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
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)
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:47
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void resize(size_t newsize)
Definition: FEDRawData.cc:32
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
int j
Definition: DBlmapReader.cc:9
int k[5][pyjets_maxn]
const_iterator end() const
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
T const * product() const
Definition: Handle.h:81
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
virtual float pt() const GCC11_FINAL
transverse momentum
tuple size
Write out results.
edm::EDGetTokenT< reco::CaloMETCollection > tok_met_
const_iterator begin() const

Member Data Documentation

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

Definition at line 62 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer().

double AlCaHcalNoiseProducer::JetHCALminEnergyFraction_
private

Definition at line 58 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

double AlCaHcalNoiseProducer::JetMinE_
private

Definition at line 57 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

double AlCaHcalNoiseProducer::MetCut_
private

Definition at line 56 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

int AlCaHcalNoiseProducer::nAnomalousEvents
private

Definition at line 59 of file AlCaHcalNoiseProducer.h.

Referenced by produce().

int AlCaHcalNoiseProducer::nEvents
private

Definition at line 60 of file AlCaHcalNoiseProducer.h.

Referenced by produce().

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

Definition at line 68 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

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

Definition at line 70 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

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

Definition at line 69 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

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

Definition at line 64 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

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

Definition at line 65 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

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

Definition at line 72 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

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

Definition at line 73 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

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

Definition at line 66 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

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

Definition at line 74 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

bool AlCaHcalNoiseProducer::useJet_
private

Definition at line 55 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

bool AlCaHcalNoiseProducer::useMet_
private

Definition at line 54 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().