CMS 3D CMS Logo

EcalSimpleUncalibRecHitFilter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EcalSimpleUncalibRecHitFilter
4 // Class: EcalSimpleUncalibRecHitFilter
5 //
13 //
14 // Original Author: Giovanni FRANZONI
15 // Created: Wed Sep 19 16:21:29 CEST 2007
16 //
17 //
18 
19 
20 // system include files
21 #include <memory>
22 
23 // user include files
27 
31 
33 
37 
38 //
39 // class declaration
40 //
41 
43 public:
46 
47  static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
48 
49 private:
50  bool filter(edm::Event &, edm::EventSetup const &) override;
51 
52  // ----------member data ---------------------------
54  const double minAdc_;
55  const std::vector<int> maskedList_;
56 
57 };
58 
59 //
60 // constructors and destructor
61 //
63  EcalUncalibRecHitToken_( consumes<EcalUncalibratedRecHitCollection>(iConfig.getParameter<edm::InputTag>("EcalUncalibRecHitCollection")) ),
64  minAdc_( iConfig.getUntrackedParameter<double>("adcCut", 12) ),
65  maskedList_( iConfig.getUntrackedParameter<std::vector<int>>("maskedChannels", std::vector<int>{}) ) // this is using the ashed index
66 {
67  // now do what ever initialization is needed
68 }
69 
70 
72 {
73  // do anything here that needs to be done at desctruction time
74  // (e.g. close files, deallocate resources etc.)
75 }
76 
77 
78 //
79 // member functions
80 //
81 
82 // ------------ method called on each new Event ------------
83 bool
85 {
86  using namespace edm;
87 
88  // getting very basic uncalRH
90  if (not iEvent.getByToken(EcalUncalibRecHitToken_, crudeHits))
91  {
94  LogWarning("EcalSimpleUncalibRecHitFilter") << "InputTag: label = \"" << labels.module << "\", instance = \"" << labels.productInstance << "\", process = \"" << labels.process << "\" is not available";
95  return false;
96  }
97 
98 
99  bool thereIsSignal = false;
100  // loop on crude rechits
101  for (auto hit : *crudeHits) {
102 
103  // masking noisy channels
104  auto result = std::find( maskedList_.begin(), maskedList_.end(), EBDetId(hit.id()).hashedIndex() );
105  if (result != maskedList_.end())
106  // LogWarning("EcalFilter") << "skipping uncalRecHit for channel: " << ic << " with amplitude " << ampli_ ;
107  continue;
108 
109  float ampli_ = hit.amplitude();
110 
111  // seeking channels with signal and displaced jitter
112  if (ampli_ >= minAdc_ )
113  {
114  thereIsSignal = true;
115  // LogWarning("EcalFilter") << "at evet: " << iEvent.id().event()
116  // << " and run: " << iEvent.id().run()
117  // << " there is OUT OF TIME signal at chanel: " << ic
118  // << " with amplitude " << ampli_ << " and max at: " << jitter_;
119  break;
120  }
121 
122  }
123 
124  return thereIsSignal;
125 }
126 
129 
130  desc.add<edm::InputTag>("EcalUncalibRecHitCollection", edm::InputTag("ecalWeightUncalibRecHit","EcalUncalibRecHitsEB"));
131  desc.addUntracked<double>("adcCut", 12.);
132  desc.addUntracked<std::vector<int>>("maskedChannels", std::vector<int>{});
133 
134  descriptions.add("ecalSimpleUncalibRecHitFilter", desc);
135 }
136 
137 
138 // declare this class as a framework plugin
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
const edm::EDGetTokenT< EcalUncalibratedRecHitCollection > EcalUncalibRecHitToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
char const * process
Definition: ProductLabels.h:7
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:42
bool filter(edm::Event &, edm::EventSetup const &) override
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ParameterDescriptionBase * add(U const &iLabel, T const &value)
char const * module
Definition: ProductLabels.h:5
unsigned int id
EcalSimpleUncalibRecHitFilter(const edm::ParameterSet &)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
char const * productInstance
Definition: ProductLabels.h:6
HLT enums.