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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HiSpikeCleaner (const edm::ParameterSet &)
 
 ~HiSpikeCleaner ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

virtual 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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 70 of file HiSpikeCleaner.cc.

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

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

Definition at line 94 of file HiSpikeCleaner.cc.

95 {
96  // do anything here that needs to be done at desctruction time
97  // (e.g. close files, deallocate resources etc.)
98 }

Member Function Documentation

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

Definition at line 107 of file HiSpikeCleaner.cc.

References DEFINE_FWK_MODULE, etCut_, funct::false, 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_.

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

Member Data Documentation

double HiSpikeCleaner::etCut_
private

Definition at line 67 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

std::string HiSpikeCleaner::outputCollection_
private

Definition at line 64 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

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

Definition at line 61 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

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

Definition at line 62 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

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

Definition at line 60 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

double HiSpikeCleaner::swissCutThr_
private

Definition at line 66 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

double HiSpikeCleaner::TimingCut_
private

Definition at line 65 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().