CMS 3D CMS Logo

EcalLaserCorrFilter.cc
Go to the documentation of this file.
1 
16 
23 
29 
30 
32 
33  public:
34 
35  explicit EcalLaserCorrFilter(const edm::ParameterSet & iConfig);
36  ~EcalLaserCorrFilter() override {}
37 
38  private:
39 
40  bool filter(edm::StreamID, edm::Event & iEvent, const edm::EventSetup & iSetup) const override;
41 
44 
45  // thresholds to laser corr to set kPoorCalib
47  const bool taggingMode_, debug_;
48 };
49 
50 
52  : ebRHSrcToken_ (consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("EBRecHitSource")))
53  , eeRHSrcToken_ (consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("EERecHitSource")))
54  , EBLaserMIN_ (iConfig.getParameter<double>("EBLaserMIN"))
55  , EELaserMIN_ (iConfig.getParameter<double>("EELaserMIN"))
56  , EBLaserMAX_ (iConfig.getParameter<double>("EBLaserMAX"))
57  , EELaserMAX_ (iConfig.getParameter<double>("EELaserMAX"))
58  , EBEnegyMIN_ (iConfig.getParameter<double>("EBEnegyMIN"))
59  , EEEnegyMIN_ (iConfig.getParameter<double>("EEEnegyMIN"))
60  , taggingMode_ (iConfig.getParameter<bool>("taggingMode"))
61  , debug_ (iConfig.getParameter<bool>("Debug"))
62 {
63  produces<bool>();
64 }
65 
66 
68 
69  using namespace edm;
70  using namespace reco;
71  using namespace std;
72 
74  iEvent.getByToken(ebRHSrcToken_, ebRHs);
75 
77  iEvent.getByToken(eeRHSrcToken_, eeRHs);
78 
79  // Laser corrections
81  iSetup.get<EcalLaserDbRecord>().get(laser);
82 
83 
84  bool goodCalib = true;
85 
86  // check EE RecHits
87  for (EcalRecHitCollection::const_iterator eerh = eeRHs->begin(); eerh != eeRHs->end(); ++eerh) {
88 
89  EcalRecHit hit = (*eerh);
90  EEDetId eeDet = hit.id();
91  double energy = eerh->energy();
92  double time = eerh->time();
93  int jx = EEDetId((*eerh).id()).ix();
94  int jy = EEDetId((*eerh).id()).iy();
95  int jz = EEDetId((*eerh).id()).zside();
96 
97  // get laser coefficient
98  float lasercalib = laser->getLaserCorrection( EEDetId(eeDet), iEvent.time());
99 
100  if( energy>EEEnegyMIN_ && (lasercalib < EELaserMIN_ || lasercalib > EELaserMAX_) ) {
101  goodCalib = false;
102  if(debug_) {
103  edm::LogInfo("EcalLaserCorrFilter")
104  << "RecHit EE "
105  << iEvent.id().run()<< ":" << iEvent.luminosityBlock() <<":"<<iEvent.id().event()
106  << " lasercalib " << lasercalib << " rechit ene " << energy << " time " << time
107  << " ix, iy, z = " << jx << " " << jy << " " << jz;
108  }
109  }
110 
111  //if (!goodCalib) break;
112  }
113 
114  // check EB RecHits
115  for (EcalRecHitCollection::const_iterator ebrh = ebRHs->begin(); ebrh != ebRHs->end(); ++ebrh) {
116 
117  EcalRecHit hit = (*ebrh);
118  EBDetId ebDet = hit.id();
119  double energy = ebrh->energy();
120  double time = ebrh->time();
121  int etarec = EBDetId((*ebrh).id()).ieta();
122  int phirec = EBDetId((*ebrh).id()).iphi();
123  int zrec = EBDetId((*ebrh).id()).zside();
124 
125 
126  // get laser coefficient
127  float lasercalib = laser->getLaserCorrection( EBDetId(ebDet), iEvent.time());
128 
129  if (energy>EBEnegyMIN_ && (lasercalib < EBLaserMIN_ || lasercalib > EBLaserMAX_) ) {
130  goodCalib = false;
131  if(debug_) {
132  edm::LogInfo("EcalLaserCorrFilter")
133  << "RecHit EB "
134  << iEvent.id().run()<< ":" << iEvent.luminosityBlock() <<":"<<iEvent.id().event()
135  << " lasercalib " << lasercalib << " rechit ene " << energy << " time " << time
136  << " eta, phi, z = " << etarec << " " << phirec << " " << zrec;
137  }
138  }
139  //if (!goodCalib) break;
140  }
141 
142 
143  bool result = goodCalib;
144 
145  iEvent.put(std::make_unique<bool>(result));
146 
147  return taggingMode_ || result;
148 
149 }
150 
152 
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
float getLaserCorrection(DetId const &xid, edm::Timestamp const &iTime) const
std::vector< EcalRecHit >::const_iterator const_iterator
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:61
int zside(DetId const &)
bool filter(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const edm::EDGetTokenT< EcalRecHitCollection > ebRHSrcToken_
const_iterator end() const
DetId id() const
get the id
Definition: EcalRecHit.h:77
EcalLaserCorrFilter(const edm::ParameterSet &iConfig)
edm::EventID id() const
Definition: EventBase.h:59
fixed size matrix
const edm::EDGetTokenT< EcalRecHitCollection > eeRHSrcToken_
HLT enums.
T get() const
Definition: EventSetup.h:71
edm::Timestamp time() const
Definition: EventBase.h:60
const_iterator begin() const