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

Public Member Functions

 HiSpikeCleaner (const edm::ParameterSet &)
 
 ~HiSpikeCleaner ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

double etCut_
 
std::string outputCollection_
 
edm::InputTag rHInputProducerB_
 
edm::InputTag rHInputProducerE_
 
edm::InputTag sCInputProducer_
 
double swissCutThr_
 
double TimingCut_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 50 of file HiSpikeCleaner.cc.

Constructor & Destructor Documentation

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

Definition at line 85 of file HiSpikeCleaner.cc.

References etCut_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), outputCollection_, rHInputProducerB_, rHInputProducerE_, sCInputProducer_, AlCaHLTBitMon_QueryRunRegistry::string, swissCutThr_, and TimingCut_.

86 {
87  //register your products
88 /* Examples
89  produces<ExampleData2>();
90 
91  //if do put with a label
92  produces<ExampleData2>("label");
93 */
94  //now do what ever other initialization is needed
95 
96  rHInputProducerB_ = iConfig.getParameter<edm::InputTag>("recHitProducerBarrel");
97  rHInputProducerE_ = iConfig.getParameter<edm::InputTag>("recHitProducerEndcap");
98 
99  sCInputProducer_ = iConfig.getParameter<edm::InputTag>("originalSuperClusterProducer");
100  TimingCut_ = iConfig.getUntrackedParameter<double> ("TimingCut",4.0);
101  swissCutThr_ = iConfig.getUntrackedParameter<double>("swissCutThr",0.95);
102  etCut_ = iConfig.getParameter<double>("etCut");
103 
104  outputCollection_ = iConfig.getParameter<std::string>("outputColl");
105  produces<reco::SuperClusterCollection>(outputCollection_);
106 
107 
108 
109 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag rHInputProducerE_
edm::InputTag sCInputProducer_
std::string outputCollection_
edm::InputTag rHInputProducerB_
HiSpikeCleaner::~HiSpikeCleaner ( )

Definition at line 112 of file HiSpikeCleaner.cc.

113 {
114  // do anything here that needs to be done at desctruction time
115  // (e.g. close files, deallocate resources etc.)
116 }

Member Function Documentation

void HiSpikeCleaner::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 235 of file HiSpikeCleaner.cc.

236 {
237 }
void HiSpikeCleaner::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 241 of file HiSpikeCleaner.cc.

241  {
242 }
void HiSpikeCleaner::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 125 of file HiSpikeCleaner.cc.

References etCut_, funct::false, edm::EventSetup::get(), edm::Event::getByLabel(), EcalClusterLazyTools::getMaximum(), edm::InputTag::label(), outputCollection_, edm::Event::put(), HI_PhotonSkim_cff::rechits, rHInputProducerB_, rHInputProducerE_, sCInputProducer_, EcalTools::swissCross(), swissCutThr_, and TimingCut_.

126 {
127  using namespace edm;
128 
129 
130  // Get raw SuperClusters from the event
131  Handle<reco::SuperClusterCollection> pRawSuperClusters;
132  try {
133  iEvent.getByLabel(sCInputProducer_, pRawSuperClusters);
134  } catch ( cms::Exception& ex ) {
135  edm::LogError("EgammaSCCorrectionMakerError")
136  << "Error! can't get the rawSuperClusters "
137  << sCInputProducer_.label() ;
138  }
139 
140  // Get the RecHits from the event
142  try {
143  iEvent.getByLabel(rHInputProducerB_, pRecHitsB);
144  } catch ( cms::Exception& ex ) {
145  edm::LogError("EgammaSCCorrectionMakerError")
146  << "Error! can't get the RecHits "
148  }
149  // Get the RecHits from the event
151  try {
152  iEvent.getByLabel(rHInputProducerE_, pRecHitsE);
153  } catch ( cms::Exception& ex ) {
154  edm::LogError("EgammaSCCorrectionMakerError")
155  << "Error! can't get the RecHits "
157  }
158 
159 
160  // get the channel status from the DB
161  // edm::ESHandle<EcalChannelStatus> chStatus;
162  // iSetup.get<EcalChannelStatusRcd>().get(chStatus);
163 
164  edm::ESHandle<EcalSeverityLevelAlgo> ecalSevLvlAlgoHndl;
165  iSetup.get<EcalSeverityLevelAlgoRcd>().get(ecalSevLvlAlgoHndl);
166 
167 
168  // Create a pointer to the RecHits and raw SuperClusters
169  const reco::SuperClusterCollection *rawClusters = pRawSuperClusters.product();
170 
171 
172  EcalClusterLazyTools lazyTool(iEvent, iSetup, rHInputProducerB_,rHInputProducerE_);
173 
174  // Define a collection of corrected SuperClusters to put back into the event
175  std::auto_ptr<reco::SuperClusterCollection> corrClusters(new reco::SuperClusterCollection);
176 
177  // Loop over raw clusters and make corrected ones
178  reco::SuperClusterCollection::const_iterator aClus;
179  for(aClus = rawClusters->begin(); aClus != rawClusters->end(); aClus++)
180  {
181  double theEt = aClus->energy()/cosh( aClus->eta() ) ;
182  // std::cout << " et of SC = " << theEt << std::endl;
183 
184  if ( theEt < etCut_ ) continue; // cut off low pT superclusters
185 
186  bool flagS = true;
187  float swissCrx(0);
188 
189  const reco::CaloClusterPtr seed = aClus->seed();
190  DetId id = lazyTool.getMaximum(*seed).first;
191  const EcalRecHitCollection & rechits = *pRecHitsB;
193 
194  if( it != rechits.end() ) {
195  ecalSevLvlAlgoHndl->severityLevel(id, rechits);
196  swissCrx = EcalTools::swissCross (id, rechits, 0.,true);
197  // std::cout << "swissCross = " << swissCrx <<std::endl;
198  // std::cout << " timing = " << it->time() << std::endl;
199  }
200 
201  if ( fabs(it->time()) > TimingCut_ ) {
202  flagS = false;
203  // std::cout << " timing = " << it->time() << std::endl;
204  // std::cout << " timing is bad........" << std::endl;
205  }
206  if ( swissCrx > (float)swissCutThr_ ) {
207  flagS = false ; // swissCross cut
208  // std::cout << "swissCross = " << swissCrx <<std::endl;
209  // std::cout << " removed by swiss cross cut" << std::endl;
210  }
211  // - kGood --> good channel
212  // - kProblematic --> problematic (e.g. noisy)
213  // - kRecovered --> recovered (e.g. an originally dead or saturated)
214  // - kTime --> the channel is out of time (e.g. spike)
215  // - kWeird --> weird (e.g. spike)
216  // - kBad --> bad, not suitable to be used in the reconstruction
217  // enum EcalSeverityLevel { kGood=0, kProblematic, kRecovered, kTime, kWeird, kBad };
218 
219 
220  reco::SuperCluster newClus;
221  if ( flagS == true)
222  newClus=*aClus;
223  else
224  continue;
225  corrClusters->push_back(newClus);
226  }
227 
228  // Put collection of corrected SuperClusters into the event
229  iEvent.put(corrClusters, outputCollection_);
230 
231 }
edm::InputTag rHInputProducerE_
std::vector< EcalRecHit >::const_iterator const_iterator
edm::InputTag sCInputProducer_
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
std::string outputCollection_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
Definition: DetId.h:20
const T & get() const
Definition: EventSetup.h:55
std::string const & label() const
Definition: InputTag.h:42
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:12
edm::InputTag rHInputProducerB_

Member Data Documentation

double HiSpikeCleaner::etCut_
private

Definition at line 69 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

std::string HiSpikeCleaner::outputCollection_
private

Definition at line 66 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

edm::InputTag HiSpikeCleaner::rHInputProducerB_
private

Definition at line 63 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

edm::InputTag HiSpikeCleaner::rHInputProducerE_
private

Definition at line 64 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

edm::InputTag HiSpikeCleaner::sCInputProducer_
private

Definition at line 62 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

double HiSpikeCleaner::swissCutThr_
private

Definition at line 68 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

double HiSpikeCleaner::TimingCut_
private

Definition at line 67 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().