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_
 
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcdecalSevLvlAlgoToken_
 
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 45 of file HiSpikeCleaner.cc.

Constructor & Destructor Documentation

◆ HiSpikeCleaner()

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

Definition at line 67 of file HiSpikeCleaner.cc.

69  //register your products
70  /* Examples
71  produces<ExampleData2>();
72 
73  //if do put with a label
74  produces<ExampleData2>("label");
75 */
76  //now do what ever other initialization is needed
77 
78  rHInputProducerBToken_ = consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("recHitProducerBarrel"));
79  rHInputProducerEToken_ = consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("recHitProducerEndcap"));
80 
82  consumes<reco::SuperClusterCollection>(iConfig.getParameter<edm::InputTag>("originalSuperClusterProducer"));
83  TimingCut_ = iConfig.getUntrackedParameter<double>("TimingCut", 4.0);
84  swissCutThr_ = iConfig.getUntrackedParameter<double>("swissCutThr", 0.95);
85  etCut_ = iConfig.getParameter<double>("etCut");
86 
87  outputCollection_ = iConfig.getParameter<std::string>("outputColl");
88  produces<reco::SuperClusterCollection>(outputCollection_);
89 }
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > ecalSevLvlAlgoToken_
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< reco::SuperClusterCollection > sCInputProducerToken_
T getUntrackedParameter(std::string const &, T const &) const
std::string outputCollection_
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducerBToken_
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducerEToken_

◆ ~HiSpikeCleaner()

HiSpikeCleaner::~HiSpikeCleaner ( )
override

Definition at line 91 of file HiSpikeCleaner.cc.

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

Member Function Documentation

◆ produce()

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

Definition at line 101 of file HiSpikeCleaner.cc.

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

101  {
102  using namespace edm;
103 
104  // Get raw SuperClusters from the event
105  Handle<reco::SuperClusterCollection> pRawSuperClusters;
106  iEvent.getByToken(sCInputProducerToken_, pRawSuperClusters);
107 
108  // Get the RecHits from the event
110  iEvent.getByToken(rHInputProducerBToken_, pRecHitsB);
111 
112  // Get the RecHits from the event
114  iEvent.getByToken(rHInputProducerEToken_, pRecHitsE);
115 
116  // get the channel status from the DB
117  // edm::ESHandle<EcalChannelStatus> chStatus;
118  // iSetup.get<EcalChannelStatusRcd>().get(chStatus);
119 
120  auto const& ecalSevLvlAlgo = iSetup.getData(ecalSevLvlAlgoToken_);
121 
122  // Create a pointer to the RecHits and raw SuperClusters
123  const reco::SuperClusterCollection* rawClusters = pRawSuperClusters.product();
124 
125  EcalClusterLazyTools lazyTool(
127 
128  // Define a collection of corrected SuperClusters to put back into the event
129  auto corrClusters = std::make_unique<reco::SuperClusterCollection>();
130 
131  // Loop over raw clusters and make corrected ones
132  reco::SuperClusterCollection::const_iterator aClus;
133  for (aClus = rawClusters->begin(); aClus != rawClusters->end(); aClus++) {
134  double theEt = aClus->energy() / cosh(aClus->eta());
135  // std::cout << " et of SC = " << theEt << std::endl;
136 
137  if (theEt < etCut_)
138  continue; // cut off low pT superclusters
139 
140  bool flagS = true;
141  float swissCrx(0);
142 
143  const reco::CaloClusterPtr seed = aClus->seed();
144  DetId id = lazyTool.getMaximum(*seed).first;
145  const EcalRecHitCollection& rechits = *pRecHitsB;
147 
148  if (it != rechits.end()) {
149  ecalSevLvlAlgo.severityLevel(id, rechits);
150  swissCrx = EcalTools::swissCross(id, rechits, 0., true);
151  // std::cout << "swissCross = " << swissCrx <<std::endl;
152  // std::cout << " timing = " << it->time() << std::endl;
153  }
154 
155  if (fabs(it->time()) > TimingCut_) {
156  flagS = false;
157  // std::cout << " timing = " << it->time() << std::endl;
158  // std::cout << " timing is bad........" << std::endl;
159  }
160  if (swissCrx > (float)swissCutThr_) {
161  flagS = false; // swissCross cut
162  // std::cout << "swissCross = " << swissCrx <<std::endl;
163  // std::cout << " removed by swiss cross cut" << std::endl;
164  }
165  // - kGood --> good channel
166  // - kProblematic --> problematic (e.g. noisy)
167  // - kRecovered --> recovered (e.g. an originally dead or saturated)
168  // - kTime --> the channel is out of time (e.g. spike)
169  // - kWeird --> weird (e.g. spike)
170  // - kBad --> bad, not suitable to be used in the reconstruction
171  // enum EcalSeverityLevel { kGood=0, kProblematic, kRecovered, kTime, kWeird, kBad };
172 
173  reco::SuperCluster newClus;
174  if (flagS == true)
175  newClus = *aClus;
176  else
177  continue;
178  corrClusters->push_back(newClus);
179  }
180 
181  // Put collection of corrected SuperClusters into the event
182  iEvent.put(std::move(corrClusters), outputCollection_);
183 }
edm::ESGetToken< EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd > ecalSevLvlAlgoToken_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::EDGetTokenT< reco::SuperClusterCollection > sCInputProducerToken_
T const * product() const
Definition: Handle.h:70
std::vector< EcalRecHit >::const_iterator const_iterator
ESData get(edm::EventSetup const &eventSetup) const
int iEvent
Definition: GenABIO.cc:224
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
std::string outputCollection_
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
Definition: DetId.h:17
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
HLT enums.
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducerBToken_
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducerEToken_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ ecalClusterToolsESGetTokens_

const EcalClusterLazyTools::ESGetTokens HiSpikeCleaner::ecalClusterToolsESGetTokens_
private

Definition at line 59 of file HiSpikeCleaner.cc.

Referenced by produce().

◆ ecalSevLvlAlgoToken_

edm::ESGetToken<EcalSeverityLevelAlgo, EcalSeverityLevelAlgoRcd> HiSpikeCleaner::ecalSevLvlAlgoToken_
private

Definition at line 58 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 56 of file HiSpikeCleaner.cc.

Referenced by produce().

◆ rHInputProducerEToken_

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

Definition at line 57 of file HiSpikeCleaner.cc.

Referenced by produce().

◆ sCInputProducerToken_

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

Definition at line 55 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().