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 ( const edm::ParameterSet iConfig)
explicit

Definition at line 66 of file HiSpikeCleaner.cc.

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

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 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::SuperClusterCollection > sCInputProducerToken_
std::string outputCollection_
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducerBToken_
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducerEToken_
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

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

Definition at line 99 of file HiSpikeCleaner.cc.

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

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 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id) const
Evaluate status from id use channelStatus from DB.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
edm::EDGetTokenT< reco::SuperClusterCollection > sCInputProducerToken_
std::vector< EcalRecHit >::const_iterator const_iterator
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
std::string outputCollection_
Definition: DetId.h:17
T const * product() const
Definition: Handle.h:69
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
HLT enums.
T get() const
Definition: EventSetup.h:73
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducerBToken_
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducerEToken_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

double HiSpikeCleaner::etCut_
private

Definition at line 63 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

std::string HiSpikeCleaner::outputCollection_
private

Definition at line 60 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

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

Definition at line 57 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

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

Definition at line 58 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

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

Definition at line 56 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

double HiSpikeCleaner::swissCutThr_
private

Definition at line 62 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

double HiSpikeCleaner::TimingCut_
private

Definition at line 61 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().