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 Member Functions | Private Attributes
HiSpikeCleaner Class Reference

#include <RecoHI/HiSpikeCleaner/src/HiSpikeCleaner.cc>

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

Public Member Functions

 HiSpikeCleaner (const edm::ParameterSet &)
 
 ~HiSpikeCleaner ()
 
- 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginJob () override
 
virtual void endJob () override
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

double etCut_
 
std::string outputCollection_
 
edm::InputTag rHInputProducerB_
 
edm::InputTag rHInputProducerE_
 
edm::InputTag sCInputProducer_
 
double swissCutThr_
 
double TimingCut_
 

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

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 49 of file HiSpikeCleaner.cc.

Constructor & Destructor Documentation

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

Definition at line 84 of file HiSpikeCleaner.cc.

References etCut_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), outputCollection_, rHInputProducerB_, rHInputProducerE_, sCInputProducer_, AlCaHLTBitMon_QueryRunRegistry::string, swissCutThr_, and TimingCut_.

85 {
86  //register your products
87 /* Examples
88  produces<ExampleData2>();
89 
90  //if do put with a label
91  produces<ExampleData2>("label");
92 */
93  //now do what ever other initialization is needed
94 
95  rHInputProducerB_ = iConfig.getParameter<edm::InputTag>("recHitProducerBarrel");
96  rHInputProducerE_ = iConfig.getParameter<edm::InputTag>("recHitProducerEndcap");
97 
98  sCInputProducer_ = iConfig.getParameter<edm::InputTag>("originalSuperClusterProducer");
99  TimingCut_ = iConfig.getUntrackedParameter<double> ("TimingCut",4.0);
100  swissCutThr_ = iConfig.getUntrackedParameter<double>("swissCutThr",0.95);
101  etCut_ = iConfig.getParameter<double>("etCut");
102 
103  outputCollection_ = iConfig.getParameter<std::string>("outputColl");
104  produces<reco::SuperClusterCollection>(outputCollection_);
105 
106 
107 
108 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag rHInputProducerE_
edm::InputTag sCInputProducer_
std::string outputCollection_
edm::InputTag rHInputProducerB_
HiSpikeCleaner::~HiSpikeCleaner ( )

Definition at line 111 of file HiSpikeCleaner.cc.

112 {
113  // do anything here that needs to be done at desctruction time
114  // (e.g. close files, deallocate resources etc.)
115 }

Member Function Documentation

void HiSpikeCleaner::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 234 of file HiSpikeCleaner.cc.

235 {
236 }
void HiSpikeCleaner::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 240 of file HiSpikeCleaner.cc.

240  {
241 }
void HiSpikeCleaner::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 124 of file HiSpikeCleaner.cc.

References etCut_, edm::false, edm::EventSetup::get(), edm::Event::getByLabel(), EcalClusterLazyTools::getMaximum(), edm::InputTag::label(), outputCollection_, edm::Event::put(), HI_PhotonSkim_cff::rechits, rHInputProducerB_, rHInputProducerE_, sCInputProducer_, EcalTools::swissCross(), swissCutThr_, and TimingCut_.

125 {
126  using namespace edm;
127 
128 
129  // Get raw SuperClusters from the event
130  Handle<reco::SuperClusterCollection> pRawSuperClusters;
131  try {
132  iEvent.getByLabel(sCInputProducer_, pRawSuperClusters);
133  } catch ( cms::Exception& ex ) {
134  edm::LogError("EgammaSCCorrectionMakerError")
135  << "Error! can't get the rawSuperClusters "
136  << sCInputProducer_.label() ;
137  }
138 
139  // Get the RecHits from the event
141  try {
142  iEvent.getByLabel(rHInputProducerB_, pRecHitsB);
143  } catch ( cms::Exception& ex ) {
144  edm::LogError("EgammaSCCorrectionMakerError")
145  << "Error! can't get the RecHits "
147  }
148  // Get the RecHits from the event
150  try {
151  iEvent.getByLabel(rHInputProducerE_, pRecHitsE);
152  } catch ( cms::Exception& ex ) {
153  edm::LogError("EgammaSCCorrectionMakerError")
154  << "Error! can't get the RecHits "
156  }
157 
158 
159  // get the channel status from the DB
160  // edm::ESHandle<EcalChannelStatus> chStatus;
161  // iSetup.get<EcalChannelStatusRcd>().get(chStatus);
162 
163  edm::ESHandle<EcalSeverityLevelAlgo> ecalSevLvlAlgoHndl;
164  iSetup.get<EcalSeverityLevelAlgoRcd>().get(ecalSevLvlAlgoHndl);
165 
166 
167  // Create a pointer to the RecHits and raw SuperClusters
168  const reco::SuperClusterCollection *rawClusters = pRawSuperClusters.product();
169 
170 
171  EcalClusterLazyTools lazyTool(iEvent, iSetup, rHInputProducerB_,rHInputProducerE_);
172 
173  // Define a collection of corrected SuperClusters to put back into the event
174  std::auto_ptr<reco::SuperClusterCollection> corrClusters(new reco::SuperClusterCollection);
175 
176  // Loop over raw clusters and make corrected ones
177  reco::SuperClusterCollection::const_iterator aClus;
178  for(aClus = rawClusters->begin(); aClus != rawClusters->end(); aClus++)
179  {
180  double theEt = aClus->energy()/cosh( aClus->eta() ) ;
181  // std::cout << " et of SC = " << theEt << std::endl;
182 
183  if ( theEt < etCut_ ) continue; // cut off low pT superclusters
184 
185  bool flagS = true;
186  float swissCrx(0);
187 
188  const reco::CaloClusterPtr seed = aClus->seed();
189  DetId id = lazyTool.getMaximum(*seed).first;
190  const EcalRecHitCollection & rechits = *pRecHitsB;
192 
193  if( it != rechits.end() ) {
194  ecalSevLvlAlgoHndl->severityLevel(id, rechits);
195  swissCrx = EcalTools::swissCross (id, rechits, 0.,true);
196  // std::cout << "swissCross = " << swissCrx <<std::endl;
197  // std::cout << " timing = " << it->time() << std::endl;
198  }
199 
200  if ( fabs(it->time()) > TimingCut_ ) {
201  flagS = false;
202  // std::cout << " timing = " << it->time() << std::endl;
203  // std::cout << " timing is bad........" << std::endl;
204  }
205  if ( swissCrx > (float)swissCutThr_ ) {
206  flagS = false ; // swissCross cut
207  // std::cout << "swissCross = " << swissCrx <<std::endl;
208  // std::cout << " removed by swiss cross cut" << std::endl;
209  }
210  // - kGood --> good channel
211  // - kProblematic --> problematic (e.g. noisy)
212  // - kRecovered --> recovered (e.g. an originally dead or saturated)
213  // - kTime --> the channel is out of time (e.g. spike)
214  // - kWeird --> weird (e.g. spike)
215  // - kBad --> bad, not suitable to be used in the reconstruction
216  // enum EcalSeverityLevel { kGood=0, kProblematic, kRecovered, kTime, kWeird, kBad };
217 
218 
219  reco::SuperCluster newClus;
220  if ( flagS == true)
221  newClus=*aClus;
222  else
223  continue;
224  corrClusters->push_back(newClus);
225  }
226 
227  // Put collection of corrected SuperClusters into the event
228  iEvent.put(corrClusters, outputCollection_);
229 
230 }
edm::InputTag rHInputProducerE_
std::vector< EcalRecHit >::const_iterator const_iterator
edm::InputTag sCInputProducer_
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
std::string outputCollection_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
Definition: DetId.h:18
const T & get() const
Definition: EventSetup.h:55
std::string const & label() const
Definition: InputTag.h:42
static float swissCross(const DetId &id, const EcalRecHitCollection &recHits, float recHitThreshold, bool avoidIeta85=true)
the good old 1-e4/e1. Ignore hits below recHitThreshold
Definition: EcalTools.cc:11
edm::InputTag rHInputProducerB_
volatile std::atomic< bool > shutdown_flag false

Member Data Documentation

double HiSpikeCleaner::etCut_
private

Definition at line 68 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

std::string HiSpikeCleaner::outputCollection_
private

Definition at line 65 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

edm::InputTag HiSpikeCleaner::rHInputProducerB_
private

Definition at line 62 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

edm::InputTag HiSpikeCleaner::rHInputProducerE_
private

Definition at line 63 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

edm::InputTag HiSpikeCleaner::sCInputProducer_
private

Definition at line 61 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

double HiSpikeCleaner::swissCutThr_
private

Definition at line 67 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

double HiSpikeCleaner::TimingCut_
private

Definition at line 66 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().