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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Member Functions

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

Private Attributes

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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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 66 of file HiSpikeCleaner.cc.

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

References etCut_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), outputCollection_, rHInputProducerBToken_, rHInputProducerEToken_, sCInputProducerToken_, AlCaHLTBitMon_QueryRunRegistry::string, swissCutThr_, and TimingCut_.

◆ ~HiSpikeCleaner()

HiSpikeCleaner::~HiSpikeCleaner ( )
override

Definition at line 89 of file HiSpikeCleaner.cc.

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

Member Function Documentation

◆ produce()

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

Definition at line 99 of file HiSpikeCleaner.cc.

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

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

Member Data Documentation

◆ etCut_

double HiSpikeCleaner::etCut_
private

Definition at line 63 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

◆ outputCollection_

std::string HiSpikeCleaner::outputCollection_
private

Definition at line 60 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

◆ rHInputProducerBToken_

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

Definition at line 57 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

◆ rHInputProducerEToken_

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

Definition at line 58 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

◆ sCInputProducerToken_

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

Definition at line 56 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

◆ swissCutThr_

double HiSpikeCleaner::swissCutThr_
private

Definition at line 62 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

◆ TimingCut_

double HiSpikeCleaner::TimingCut_
private

Definition at line 61 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and 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
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:11
edm::Handle
Definition: AssociativeIterator.h:50
HiSpikeCleaner::etCut_
double etCut_
Definition: HiSpikeCleaner.cc:63
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:73
edm::ESHandle< EcalSeverityLevelAlgo >
EcalSeverityLevelAlgoRcd
Definition: EcalSeverityLevelAlgoRcd.h:12
EcalClusterLazyTools
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogError
Definition: MessageLogger.h:183
TrackInfoProducer_cfi.rechits
rechits
Definition: TrackInfoProducer_cfi.py:9
iEvent
int iEvent
Definition: GenABIO.cc:224
get
#define get
edm::Ptr< CaloCluster >
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
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:62
HiSpikeCleaner::TimingCut_
double TimingCut_
Definition: HiSpikeCleaner.cc:61
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:60
edm::InputTag
Definition: InputTag.h:15
SurveyInfoScenario_cff.seed
seed
Definition: SurveyInfoScenario_cff.py:295