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 ()
 
ModuleDescription const & moduleDescription () const
 
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
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 beginJob () override
 
virtual void endJob () override
 
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::EDProducer
typedef EDProducer ModuleType
 
- 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::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 49 of file HiSpikeCleaner.cc.

Constructor & Destructor Documentation

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

Definition at line 71 of file HiSpikeCleaner.cc.

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

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

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

Member Function Documentation

void HiSpikeCleaner::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 215 of file HiSpikeCleaner.cc.

216 {
217 }
void HiSpikeCleaner::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 221 of file HiSpikeCleaner.cc.

221  {
222 }
void HiSpikeCleaner::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 108 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_.

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

Referenced by HiSpikeCleaner(), and produce().

std::string HiSpikeCleaner::outputCollection_
private

Definition at line 65 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

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

Definition at line 62 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

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

Definition at line 63 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

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

Definition at line 61 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

double HiSpikeCleaner::swissCutThr_
private

Definition at line 67 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().

double HiSpikeCleaner::TimingCut_
private

Definition at line 66 of file HiSpikeCleaner.cc.

Referenced by HiSpikeCleaner(), and produce().