CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

double etCut_
 
std::string outputCollection_
 
edm::EDGetTokenT
< EcalRecHitCollection
rHInputProducerBToken_
 
edm::EDGetTokenT
< EcalRecHitCollection
rHInputProducerEToken_
 
edm::EDGetTokenT
< reco::SuperClusterCollection
sCInputProducerToken_
 
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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
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

Implements edm::stream::EDProducerBase.

Definition at line 107 of file HiSpikeCleaner.cc.

References etCut_, edm::false, edm::EventSetup::get(), edm::Event::getByToken(), outputCollection_, edm::Event::put(), HI_PhotonSkim_cff::rechits, rHInputProducerBToken_, rHInputProducerEToken_, sCInputProducerToken_, fileCollector::seed, 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  std::auto_ptr<reco::SuperClusterCollection> corrClusters(new 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(corrClusters, outputCollection_);
209 
210 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
edm::EDGetTokenT< reco::SuperClusterCollection > sCInputProducerToken_
std::vector< EcalRecHit >::const_iterator const_iterator
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
std::string outputCollection_
Definition: DetId.h:18
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
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducerBToken_
volatile std::atomic< bool > shutdown_flag false
edm::EDGetTokenT< EcalRecHitCollection > rHInputProducerEToken_

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().