CMS 3D CMS Logo

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::stream::EDProducer<>

Public Member Functions

 HiSpikeCleaner (const edm::ParameterSet &)
 
 ~HiSpikeCleaner () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

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

Private Attributes

const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
 
double etCut_
 
std::string outputCollection_
 
edm::EDGetTokenT< EcalRecHitCollectionrHInputProducerBToken_
 
edm::EDGetTokenT< EcalRecHitCollectionrHInputProducerEToken_
 
edm::EDGetTokenT< reco::SuperClusterCollectionsCInputProducerToken_
 
double swissCutThr_
 
double TimingCut_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 46 of file HiSpikeCleaner.cc.

Constructor & Destructor Documentation

◆ HiSpikeCleaner()

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

Definition at line 67 of file HiSpikeCleaner.cc.

67  : ecalClusterToolsESGetTokens_{consumesCollector()} {
68  //register your products
69  /* Examples
70  produces<ExampleData2>();
71 
72  //if do put with a label
73  produces<ExampleData2>("label");
74 */
75  //now do what ever other initialization is needed
76 
77  rHInputProducerBToken_ = consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("recHitProducerBarrel"));
78  rHInputProducerEToken_ = consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("recHitProducerEndcap"));
79 
81  consumes<reco::SuperClusterCollection>(iConfig.getParameter<edm::InputTag>("originalSuperClusterProducer"));
82  TimingCut_ = iConfig.getUntrackedParameter<double>("TimingCut", 4.0);
83  swissCutThr_ = iConfig.getUntrackedParameter<double>("swissCutThr", 0.95);
84  etCut_ = iConfig.getParameter<double>("etCut");
85 
86  outputCollection_ = iConfig.getParameter<std::string>("outputColl");
87  produces<reco::SuperClusterCollection>(outputCollection_);
88 }

◆ ~HiSpikeCleaner()

HiSpikeCleaner::~HiSpikeCleaner ( )
override

Definition at line 90 of file HiSpikeCleaner.cc.

90  {
91  // do anything here that needs to be done at desctruction time
92  // (e.g. close files, deallocate resources etc.)
93 }

Member Function Documentation

◆ produce()

void HiSpikeCleaner::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 100 of file HiSpikeCleaner.cc.

100  {
101  using namespace edm;
102 
103  // Get raw SuperClusters from the event
104  Handle<reco::SuperClusterCollection> pRawSuperClusters;
105  try {
106  iEvent.getByToken(sCInputProducerToken_, pRawSuperClusters);
107  } catch (cms::Exception& ex) {
108  edm::LogError("EgammaSCCorrectionMakerError") << "Error! can't get the rawSuperClusters ";
109  }
110 
111  // Get the RecHits from the event
113  try {
114  iEvent.getByToken(rHInputProducerBToken_, pRecHitsB);
115  } catch (cms::Exception& ex) {
116  edm::LogError("EgammaSCCorrectionMakerError") << "Error! can't get the RecHits ";
117  }
118 
119  // Get the RecHits from the event
121  try {
122  iEvent.getByToken(rHInputProducerEToken_, pRecHitsE);
123  } catch (cms::Exception& ex) {
124  edm::LogError("EgammaSCCorrectionMakerError") << "Error! can't get the RecHits ";
125  }
126 
127  // get the channel status from the DB
128  // edm::ESHandle<EcalChannelStatus> chStatus;
129  // iSetup.get<EcalChannelStatusRcd>().get(chStatus);
130 
131  edm::ESHandle<EcalSeverityLevelAlgo> ecalSevLvlAlgoHndl;
132  iSetup.get<EcalSeverityLevelAlgoRcd>().get(ecalSevLvlAlgoHndl);
133 
134  // Create a pointer to the RecHits and raw SuperClusters
135  const reco::SuperClusterCollection* rawClusters = pRawSuperClusters.product();
136 
137  EcalClusterLazyTools lazyTool(
139 
140  // Define a collection of corrected SuperClusters to put back into the event
141  auto corrClusters = std::make_unique<reco::SuperClusterCollection>();
142 
143  // Loop over raw clusters and make corrected ones
144  reco::SuperClusterCollection::const_iterator aClus;
145  for (aClus = rawClusters->begin(); aClus != rawClusters->end(); aClus++) {
146  double theEt = aClus->energy() / cosh(aClus->eta());
147  // std::cout << " et of SC = " << theEt << std::endl;
148 
149  if (theEt < etCut_)
150  continue; // cut off low pT superclusters
151 
152  bool flagS = true;
153  float swissCrx(0);
154 
155  const reco::CaloClusterPtr seed = aClus->seed();
156  DetId id = lazyTool.getMaximum(*seed).first;
157  const EcalRecHitCollection& rechits = *pRecHitsB;
159 
160  if (it != rechits.end()) {
161  ecalSevLvlAlgoHndl->severityLevel(id, rechits);
162  swissCrx = EcalTools::swissCross(id, rechits, 0., true);
163  // std::cout << "swissCross = " << swissCrx <<std::endl;
164  // std::cout << " timing = " << it->time() << std::endl;
165  }
166 
167  if (fabs(it->time()) > TimingCut_) {
168  flagS = false;
169  // std::cout << " timing = " << it->time() << std::endl;
170  // std::cout << " timing is bad........" << std::endl;
171  }
172  if (swissCrx > (float)swissCutThr_) {
173  flagS = false; // swissCross cut
174  // std::cout << "swissCross = " << swissCrx <<std::endl;
175  // std::cout << " removed by swiss cross cut" << std::endl;
176  }
177  // - kGood --> good channel
178  // - kProblematic --> problematic (e.g. noisy)
179  // - kRecovered --> recovered (e.g. an originally dead or saturated)
180  // - kTime --> the channel is out of time (e.g. spike)
181  // - kWeird --> weird (e.g. spike)
182  // - kBad --> bad, not suitable to be used in the reconstruction
183  // enum EcalSeverityLevel { kGood=0, kProblematic, kRecovered, kTime, kWeird, kBad };
184 
185  reco::SuperCluster newClus;
186  if (flagS == true)
187  newClus = *aClus;
188  else
189  continue;
190  corrClusters->push_back(newClus);
191  }
192 
193  // Put collection of corrected SuperClusters into the event
194  iEvent.put(std::move(corrClusters), outputCollection_);
195 }

References ecalClusterToolsESGetTokens_, etCut_, EcalClusterLazyToolsBase::ESGetTokens::get(), edm::EventSetup::get(), get, iEvent, eostools::move(), outputCollection_, edm::Handle< T >::product(), HI_PhotonSkim_cff::rechits, rHInputProducerBToken_, rHInputProducerEToken_, sCInputProducerToken_, fileCollector::seed, EcalSeverityLevelAlgo::severityLevel(), EcalTools::swissCross(), swissCutThr_, and TimingCut_.

Member Data Documentation

◆ ecalClusterToolsESGetTokens_

const EcalClusterLazyTools::ESGetTokens HiSpikeCleaner::ecalClusterToolsESGetTokens_
private

Definition at line 59 of file HiSpikeCleaner.cc.

Referenced by produce().

◆ etCut_

double HiSpikeCleaner::etCut_
private

Definition at line 64 of file HiSpikeCleaner.cc.

Referenced by produce().

◆ outputCollection_

std::string HiSpikeCleaner::outputCollection_
private

Definition at line 61 of file HiSpikeCleaner.cc.

Referenced by produce().

◆ rHInputProducerBToken_

edm::EDGetTokenT<EcalRecHitCollection> HiSpikeCleaner::rHInputProducerBToken_
private

Definition at line 57 of file HiSpikeCleaner.cc.

Referenced by produce().

◆ rHInputProducerEToken_

edm::EDGetTokenT<EcalRecHitCollection> HiSpikeCleaner::rHInputProducerEToken_
private

Definition at line 58 of file HiSpikeCleaner.cc.

Referenced by produce().

◆ sCInputProducerToken_

edm::EDGetTokenT<reco::SuperClusterCollection> HiSpikeCleaner::sCInputProducerToken_
private

Definition at line 56 of file HiSpikeCleaner.cc.

Referenced by produce().

◆ swissCutThr_

double HiSpikeCleaner::swissCutThr_
private

Definition at line 63 of file HiSpikeCleaner.cc.

Referenced by produce().

◆ TimingCut_

double HiSpikeCleaner::TimingCut_
private

Definition at line 62 of file HiSpikeCleaner.cc.

Referenced by produce().

edm::SortedCollection< EcalRecHit >::const_iterator
std::vector< EcalRecHit >::const_iterator const_iterator
Definition: SortedCollection.h:80
edm::Handle::product
T const * product() const
Definition: Handle.h:70
EcalSeverityLevelAlgo::severityLevel
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id) const
Evaluate status from id use channelStatus from DB.
Definition: EcalSeverityLevelAlgo.cc:85
reco::SuperCluster
Definition: SuperCluster.h:18
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::SortedCollection< EcalRecHit >
HiSpikeCleaner::rHInputProducerBToken_
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducerBToken_
Definition: HiSpikeCleaner.cc:57
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
HiSpikeCleaner::ecalClusterToolsESGetTokens_
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
Definition: HiSpikeCleaner.cc:59
EcalTools::swissCross
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:9
edm::Handle
Definition: AssociativeIterator.h:50
HiSpikeCleaner::etCut_
double etCut_
Definition: HiSpikeCleaner.cc:64
fileCollector.seed
seed
Definition: fileCollector.py:127
reco::SuperClusterCollection
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
Definition: SuperClusterFwd.h:9
DetId
Definition: DetId.h:17
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
edm::ESHandle< EcalSeverityLevelAlgo >
EcalSeverityLevelAlgoRcd
Definition: EcalSeverityLevelAlgoRcd.h:12
HI_PhotonSkim_cff.rechits
rechits
Definition: HI_PhotonSkim_cff.py:76
EcalClusterLazyTools
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
get
#define get
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalClusterLazyToolsBase::ESGetTokens::get
ESData get(edm::EventSetup const &eventSetup) const
Definition: EcalClusterLazyTools.h:64
edm::Ptr< CaloCluster >
HiSpikeCleaner::rHInputProducerEToken_
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducerEToken_
Definition: HiSpikeCleaner.cc:58
eostools.move
def move(src, dest)
Definition: eostools.py:511
HiSpikeCleaner::swissCutThr_
double swissCutThr_
Definition: HiSpikeCleaner.cc:63
HiSpikeCleaner::TimingCut_
double TimingCut_
Definition: HiSpikeCleaner.cc:62
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HiSpikeCleaner::sCInputProducerToken_
edm::EDGetTokenT< reco::SuperClusterCollection > sCInputProducerToken_
Definition: HiSpikeCleaner.cc:56
cms::Exception
Definition: Exception.h:70
HiSpikeCleaner::outputCollection_
std::string outputCollection_
Definition: HiSpikeCleaner.cc:61
edm::InputTag
Definition: InputTag.h:15