CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
EcalMIPRecHitFilter Class Reference

#include <Work/EcalMIPRecHitFilter/src/EcalMIPRecHitFilter.cc>

Inheritance diagram for EcalMIPRecHitFilter:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EcalMIPRecHitFilter (const edm::ParameterSet &)
 
 ~EcalMIPRecHitFilter () override
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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 & itemsToGetFrom (BranchType iType) 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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Private Member Functions

bool filter (edm::Event &, edm::EventSetup const &) override
 

Private Attributes

const edm::EDGetTokenT< EcalRecHitCollectionEcalRecHitToken_
 
const std::vector< int > maskedList_
 
const double minAmp1_
 
const double minAmp2_
 
const double minSingleAmp_
 
const int side_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 55 of file EcalMIPRecHitFilter.cc.

Constructor & Destructor Documentation

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

Definition at line 78 of file EcalMIPRecHitFilter.cc.

References side_.

78  :
79  EcalRecHitToken_( consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("EcalRecHitCollection")) ),
80  minAmp1_( iConfig.getUntrackedParameter<double>("AmpMinSeed", 0.063) ),
81  minAmp2_( iConfig.getUntrackedParameter<double>("AmpMin2", 0.045) ),
82  minSingleAmp_( iConfig.getUntrackedParameter<double>("SingleAmpMin", 0.108) ),
83  maskedList_( iConfig.getUntrackedParameter<std::vector<int>>("maskedChannels", std::vector<int>{}) ), // this is using the ashed index
84  side_( iConfig.getUntrackedParameter<int>("side", 3) )
85 {
86  // now do what ever initialization is needed
87 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const edm::EDGetTokenT< EcalRecHitCollection > EcalRecHitToken_
const std::vector< int > maskedList_
EcalMIPRecHitFilter::~EcalMIPRecHitFilter ( )
override

Definition at line 90 of file EcalMIPRecHitFilter.cc.

91 {
92  // do anything here that needs to be done at desctruction time
93  // (e.g. close files, deallocate resources etc.)
94 }

Member Function Documentation

void EcalMIPRecHitFilter::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 217 of file EcalMIPRecHitFilter.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), and DEFINE_FWK_MODULE.

217  {
219 
220  desc.add<edm::InputTag>("EcalRecHitCollection", edm::InputTag("ecalRecHit","EcalRecHitsEB"));
221  desc.addUntracked<double>("AmpMinSeed", 0.045);
222  desc.addUntracked<double>("AmpMin2", 0.045);
223  desc.addUntracked<double>("SingleAmpMin", 0.108);
224  desc.addUntracked<std::vector<int>>("maskedChannels", std::vector<int>{});
225  desc.addUntracked<int>("side", 3);
226 
227  descriptions.add("ecalMIPRecHitFilter", desc);
228 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool EcalMIPRecHitFilter::filter ( edm::Event iEvent,
edm::EventSetup const &  iSetup 
)
overrideprivatevirtual

LASER and CALIB constants from the DB //PUT THRESHOLDS IN ADC... AGAIN.

LASER and CALIB constants from the DB

Implements edm::EDFilter.

Definition at line 103 of file EcalMIPRecHitFilter.cc.

References edm::SortedCollection< T, SORT >::begin(), EcalRecHitToken_, EcalCondObjectContainer< T >::end(), edm::SortedCollection< T, SORT >::end(), EcalRecHit::energy(), spr::find(), EcalCondObjectContainer< T >::find(), edm::SortedCollection< T, SORT >::find(), edm::EventSetup::get(), edm::Event::getByToken(), EcalADCToGeVConstant::getEBValue(), EcalLaserDbService::getLaserCorrection(), EcalCondObjectContainer< T >::getMap(), CaloTopology::getWindow(), ecalpyutils::hashedIndex(), EcalRecHit::id(), tablePrinter::labels, edm::EDConsumerBase::labelsForToken(), maskedList_, minAmp1_, minAmp2_, minSingleAmp_, edm::ProductLabels::module, edm::ProductLabels::process, edm::ESHandle< T >::product(), edm::ProductLabels::productInstance, mps_fire::result, side_, and edm::EventBase::time().

104 {
105  using namespace edm;
106 
107  // getting very basic uncalRH
109  if (not iEvent.getByToken(EcalRecHitToken_, recHits))
110  {
113  LogWarning("EcalMIPRecHitFilter") << "InputTag: label = \"" << labels.module << "\", instance = \"" << labels.productInstance << "\", process = \"" << labels.process << "\" is not available";
114  return false;
115  }
116 
118  iSetup.get<CaloTopologyRecord>().get(caloTopo);
119 
120  // Intercalib constants
122  iSetup.get<EcalIntercalibConstantsRcd>().get(pIcal);
123  const EcalIntercalibConstants* ical = pIcal.product();
124  const EcalIntercalibConstantMap& icalMap=ical->getMap();
125 
127  iSetup.get<EcalLaserDbRecord>().get( pLaser );
128 
130  iSetup.get<EcalADCToGeVConstantRcd>().get(pAgc);
131  const EcalADCToGeVConstant* agc = pAgc.product();
132  //std::cout << "Global EB ADC->GeV scale: " << agc->getEBValue() << " GeV/ADC count" ;
133  float adcconst = agc->getEBValue();
134 
135  bool thereIsSignal = false;
136  // loop on rechits
137  for ( auto hitItr = recHits->begin(); hitItr != recHits->end(); ++hitItr ) {
138 
139  EcalRecHit const & hit = *hitItr;
140 
141  // masking noisy channels //KEEP this for now, just in case a few show up
142  auto result = std::find( maskedList_.begin(), maskedList_.end(), EBDetId(hit.id()).hashedIndex() );
143  if (result != maskedList_.end())
144  // LogWarning("EcalFilter") << "skipping uncalRecHit for channel: " << ic << " with amplitude " << ampli_ ;
145  continue;
146 
147  float ampli_ = hit.energy();
148  EBDetId ebDet = hit.id();
149 
150  // find intercalib constant for this xtal
151  auto icalit=icalMap.find(ebDet);
152  EcalIntercalibConstant icalconst = 1.;
153  if( icalit!=icalMap.end() ){
154  icalconst = (*icalit);
155  //LogDebug("EcalRecHitDebug") << "Found intercalib for xtal " << EBDetId(it->id()).ic() << " " << icalconst ;
156  } else {
157  //edm::LogError("EcalRecHitError") << "No intercalib const found for xtal " << EBDetId(ebDet) << "! something wrong with EcalIntercalibConstants in your DB? " ;
158  }
159  float lasercalib = pLaser->getLaserCorrection( EBDetId(ebDet), iEvent.time() );
160 
161  ampli_ /= (icalconst * lasercalib * adcconst);
162  // seeking channels with signal and displaced jitter
163  if (ampli_ >= minSingleAmp_ )
164  {
165  //std::cout << " THIS AMPLITUDE WORKS " << ampli_ << std::endl;
166  thereIsSignal = true;
167  // LogWarning("EcalFilter") << "at evet: " << iEvent.id().event()
168  // << " and run: " << iEvent.id().run()
169  // << " there is OUT OF TIME signal at chanel: " << ic
170  // << " with amplitude " << ampli_ << " and max at: " << jitter_;
171  break;
172  }
173 
174  //Check for more robust selection other than just single crystal cosmics
175  if (ampli_ >= minAmp1_)
176  {
177  //std::cout << " THIS AMPLITUDE WORKS " << ampli_ << std::endl;
178  std::vector<DetId> neighbors = caloTopo->getWindow(ebDet,side_,side_);
179  float secondMin = 0.;
180  for(std::vector<DetId>::const_iterator detitr = neighbors.begin(); detitr != neighbors.end(); ++detitr)
181  {
182  auto thishit = recHits->find((*detitr));
183  if (thishit == recHits->end())
184  {
185  //LogWarning("EcalMIPRecHitFilter") << "No RecHit available, for "<< EBDetId(*detitr);
186  continue;
187  }
188  if ((*thishit).id() != ebDet)
189  {
190  float thisamp = (*thishit).energy();
191  // find intercalib constant for this xtal
192  auto icalit2=icalMap.find((*thishit).id());
193  EcalIntercalibConstant icalconst2 = 1.;
194  if( icalit2!=icalMap.end() ){
195  icalconst2 = (*icalit2);
196  // LogDebug("EcalRecHitDebug") << "Found intercalib for xtal " << EBDetId(it->id()).ic() << " " << icalconst ;
197  } else {
198  //edm::LogError("EcalRecHitError") << "No intercalib const found for xtal " << EBDetId(ebDet) << "! something wrong with EcalIntercalibConstants in your DB? " ;
199  }
200  float lasercalib2 = pLaser->getLaserCorrection( EBDetId((*thishit).id()), iEvent.time() );
201  thisamp /= (icalconst2 * lasercalib2 * adcconst);
202  if (thisamp > secondMin) secondMin = thisamp;
203  }
204  }
205 
206  if (secondMin > minAmp2_ )
207  {
208  thereIsSignal = true;
209  break;
210  }
211  }
212  }
213  //std::cout << " Ok is There one of THEM " << thereIsSignal << std::endl;
214  return thereIsSignal;
215 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
const self & getMap() const
float getLaserCorrection(DetId const &xid, edm::Timestamp const &iTime) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
const edm::EDGetTokenT< EcalRecHitCollection > EcalRecHitToken_
char const * process
Definition: ProductLabels.h:7
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:42
std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
Get the neighbors of the given cell in a window of given size.
Definition: CaloTopology.cc:67
float energy() const
Definition: EcalRecHit.h:68
const std::vector< int > maskedList_
char const * module
Definition: ProductLabels.h:5
const_iterator end() const
DetId id() const
get the id
Definition: EcalRecHit.h:77
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
char const * productInstance
Definition: ProductLabels.h:6
iterator find(key_type k)
HLT enums.
const_iterator find(uint32_t rawId) const
const_iterator end() const
T const * product() const
Definition: ESHandle.h:86
edm::Timestamp time() const
Definition: EventBase.h:60
const_iterator begin() const
float EcalIntercalibConstant

Member Data Documentation

const edm::EDGetTokenT<EcalRecHitCollection> EcalMIPRecHitFilter::EcalRecHitToken_
private

Definition at line 66 of file EcalMIPRecHitFilter.cc.

Referenced by filter().

const std::vector<int> EcalMIPRecHitFilter::maskedList_
private

Definition at line 70 of file EcalMIPRecHitFilter.cc.

Referenced by filter().

const double EcalMIPRecHitFilter::minAmp1_
private

Definition at line 67 of file EcalMIPRecHitFilter.cc.

Referenced by filter().

const double EcalMIPRecHitFilter::minAmp2_
private

Definition at line 68 of file EcalMIPRecHitFilter.cc.

Referenced by filter().

const double EcalMIPRecHitFilter::minSingleAmp_
private

Definition at line 69 of file EcalMIPRecHitFilter.cc.

Referenced by filter().

const int EcalMIPRecHitFilter::side_
private

Definition at line 71 of file EcalMIPRecHitFilter.cc.

Referenced by EcalMIPRecHitFilter(), and filter().