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 ()
 
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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

std::vector< edm::InputTagecalLabels_
 
edm::InputTag ecalPSLabel_
 
edm::InputTag hbheLabel_
 
edm::InputTag hfLabel_
 
edm::InputTag hoLabel_
 
double JetHCALminEnergyFraction_
 
double JetMinE_
 
edm::InputTag JetSource_
 
double MetCut_
 
edm::InputTag MetSource_
 
int nAnomalousEvents
 
int nEvents
 
edm::InputTag rawInLabel_
 
edm::InputTag TowerSource_
 
bool useJet_
 
bool useMet_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- 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 37 of file AlCaHcalNoiseProducer.h.

Constructor & Destructor Documentation

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

Definition at line 32 of file AlCaHcalNoiseProducer.cc.

References ecalLabels_, ecalPSLabel_, edm::ParameterSet::getParameter(), hbheLabel_, hfLabel_, hoLabel_, JetHCALminEnergyFraction_, JetMinE_, JetSource_, MetCut_, MetSource_, rawInLabel_, TowerSource_, useJet_, and useMet_.

33 {
34  JetSource_ = iConfig.getParameter<edm::InputTag>("JetSource");
35  MetSource_ = iConfig.getParameter<edm::InputTag>("MetSource");
36  TowerSource_ = iConfig.getParameter<edm::InputTag>("TowerSource");
37  useMet_ = iConfig.getParameter<bool>("UseMET");
38  useJet_ = iConfig.getParameter<bool>("UseJet");
39  MetCut_ = iConfig.getParameter<double>("MetCut");
40  JetMinE_ = iConfig.getParameter<double>("JetMinE");
41  JetHCALminEnergyFraction_ = iConfig.getParameter<double>("JetHCALminEnergyFraction");
42 
43  hoLabel_ = iConfig.getParameter<edm::InputTag>("hoInput");
44  hfLabel_ = iConfig.getParameter<edm::InputTag>("hfInput");
45  hbheLabel_ = iConfig.getParameter<edm::InputTag>("hbheInput");
46  ecalLabels_= iConfig.getParameter<std::vector<edm::InputTag> >("ecalInputs");
47  ecalPSLabel_=iConfig.getParameter<edm::InputTag>("ecalPSInput");
48  rawInLabel_=iConfig.getParameter<edm::InputTag>("rawInput");
49 
50 
51  //register products
52  produces<HBHERecHitCollection>("HBHERecHitCollectionFHN");
53  produces<HORecHitCollection>("HORecHitCollectionFHN");
54  produces<HFRecHitCollection>("HFRecHitCollectionFHN");
55 
56  produces<EcalRecHitCollection>("EcalRecHitCollectionFHN");
57  produces<EcalRecHitCollection>("PSEcalRecHitCollectionFHN");
58 
59  produces<FEDRawDataCollection>("HcalFEDsFHN");
60 
61 }
T getParameter(std::string const &) const
std::vector< edm::InputTag > ecalLabels_
AlCaHcalNoiseProducer::~AlCaHcalNoiseProducer ( )

Definition at line 64 of file AlCaHcalNoiseProducer.cc.

65 {
66 }

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 71 of file AlCaHcalNoiseProducer.cc.

References edm::SortedCollection< T, SORT >::begin(), FEDRawData::data(), data, deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, ecalLabels_, ecalPSLabel_, edm::SortedCollection< T, SORT >::end(), FEDRawDataCollection::FEDData(), edm::Event::getByLabel(), hbheLabel_, hfLabel_, hoLabel_, i, j, JetHCALminEnergyFraction_, JetMinE_, JetSource_, gen::k, FEDNumbering::MAXFEDID, FEDNumbering::MAXHCALFEDID, CaloMET_cfi::met, MetCut_, MetSource_, FEDNumbering::MINHCALFEDID, nAnomalousEvents, nEvents, edm::Handle< T >::product(), reco::LeafCandidate::pt(), edm::SortedCollection< T, SORT >::push_back(), edm::Event::put(), rawInLabel_, FEDRawData::resize(), FEDRawData::size(), findQualityFiles::size, TowerSource_, useJet_, and useMet_.

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

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

Member Data Documentation

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

Definition at line 61 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

edm::InputTag AlCaHcalNoiseProducer::ecalPSLabel_
private

Definition at line 62 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

edm::InputTag AlCaHcalNoiseProducer::hbheLabel_
private

Definition at line 58 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

edm::InputTag AlCaHcalNoiseProducer::hfLabel_
private

Definition at line 60 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

edm::InputTag AlCaHcalNoiseProducer::hoLabel_
private

Definition at line 59 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

double AlCaHcalNoiseProducer::JetHCALminEnergyFraction_
private

Definition at line 54 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

double AlCaHcalNoiseProducer::JetMinE_
private

Definition at line 53 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

edm::InputTag AlCaHcalNoiseProducer::JetSource_
private

Definition at line 47 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

double AlCaHcalNoiseProducer::MetCut_
private

Definition at line 52 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

edm::InputTag AlCaHcalNoiseProducer::MetSource_
private

Definition at line 48 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

int AlCaHcalNoiseProducer::nAnomalousEvents
private

Definition at line 55 of file AlCaHcalNoiseProducer.h.

Referenced by produce().

int AlCaHcalNoiseProducer::nEvents
private

Definition at line 56 of file AlCaHcalNoiseProducer.h.

Referenced by produce().

edm::InputTag AlCaHcalNoiseProducer::rawInLabel_
private

Definition at line 63 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

edm::InputTag AlCaHcalNoiseProducer::TowerSource_
private

Definition at line 49 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

bool AlCaHcalNoiseProducer::useJet_
private

Definition at line 51 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().

bool AlCaHcalNoiseProducer::useMet_
private

Definition at line 50 of file AlCaHcalNoiseProducer.h.

Referenced by AlCaHcalNoiseProducer(), and produce().