32 |
|
using namespace edm; |
33 |
|
|
34 |
|
CheckEventContent::CheckEventContent(const edm::ParameterSet& iConfig){ |
35 |
+ |
std::cout << "=======>: CheckEventContent::CheckEventContent()" << std::endl; |
36 |
|
} |
37 |
|
|
38 |
|
|
39 |
|
CheckEventContent::~CheckEventContent() |
40 |
|
{ |
41 |
+ |
std::cout << "=======>: CheckEventContent::~CheckEventContent()" << std::endl; |
42 |
|
} |
43 |
|
|
44 |
|
|
45 |
|
void |
46 |
|
CheckEventContent::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) |
47 |
|
{ |
48 |
+ |
std::cout << "=======>: CheckEventContent::analyze()" << std::endl; |
49 |
+ |
// |
50 |
+ |
//_____ event book keeping |
51 |
+ |
// |
52 |
+ |
unsigned int irun = (unsigned int)iEvent.id().run(); |
53 |
+ |
// this will work starting with CMSSW_340: |
54 |
+ |
//unsigned int ilumi = (unsigned int)iEvent.id().luminosityBlock(); |
55 |
+ |
unsigned int ilumi = (unsigned int)iEvent.getLuminosityBlock().luminosityBlock(); |
56 |
+ |
unsigned int ievent = (unsigned int)iEvent.id().event(); |
57 |
+ |
cout << std::endl << "===> Provenance: " << std::endl; |
58 |
+ |
cout << "Run, lumi, event: " << irun << ", " << ilumi << ", "<< ievent << std::endl; |
59 |
|
// |
60 |
|
//_____ check trigger |
61 |
|
// |
78 |
|
cout << std::endl << "===> Check PAT muons: " << std::endl; |
79 |
|
Handle< vector< pat::Muon > > muons; |
80 |
|
iEvent . getByLabel( "selectedLayer1Muons", muons ); |
81 |
< |
for ( vector<pat::Muon>::const_iterator mu = muons -> begin(); mu != muons -> end(); mu++){ |
82 |
< |
cout << "Global muon selector: " << mu->isGlobalMuon() << std::endl; |
81 |
> |
int muon_coll_size = muons->size(); |
82 |
> |
cout << "muon collection size: "<< muon_coll_size << endl; |
83 |
> |
if (muon_coll_size>0){ |
84 |
> |
cout << "Global muon selector: " << (*muons)[0].isGlobalMuon() << std::endl; |
85 |
> |
double _pt = (*muons)[0].pt(); |
86 |
> |
double _eta = (*muons)[0].eta(); |
87 |
> |
double _d0 = (*muons)[0].dB(); // global track |
88 |
> |
double _chi2ndof = (*muons)[0].normChi2(); |
89 |
> |
int _nhits = (*muons)[0].numberOfValidHits(); |
90 |
> |
cout << "pT= " << _pt << ", eta=" << _eta << std::endl; |
91 |
> |
cout << "PAT d0= " << _d0 << ", PAT norm chi2=" << _chi2ndof << std::endl; |
92 |
> |
cout << "PAT n of hits on track= " << _nhits << std::endl; |
93 |
> |
// |
94 |
> |
//_____ check that there is a track |
95 |
> |
reco::TrackRef _track = (*muons)[0].track(); |
96 |
> |
reco::TrackRef _innertrack = (*muons)[0].innerTrack(); |
97 |
> |
if(_track.isNull()){ |
98 |
> |
cout << "there is no pat::muon::track()" << endl; |
99 |
> |
} |
100 |
> |
else{ |
101 |
> |
cout << "there is a pat::muon::track()" << endl; |
102 |
> |
} |
103 |
> |
if(_innertrack.isNull()){ |
104 |
> |
cout << "there is no pat::muon::innerTrack()" << endl; |
105 |
> |
} |
106 |
> |
else{ |
107 |
> |
cout << "there is a pat::muon::innerTrack()" << endl; |
108 |
> |
} |
109 |
> |
// |
110 |
> |
//_____ check isolation |
111 |
> |
if ( !((*muons)[0].isIsolationValid()) ) { |
112 |
> |
cout << "Isolation info is invalid" << endl; |
113 |
> |
} |
114 |
> |
else{ |
115 |
> |
cout << "Isolation info is valid..." << endl; |
116 |
> |
double _emveto = (*muons)[0].isolationR03().emVetoEt; |
117 |
> |
double _hadveto = (*muons)[0].isolationR03().hadVetoEt; |
118 |
> |
double _trackiso = (*muons)[0].isolationR03().sumPt; |
119 |
> |
double _emcaloiso = (*muons)[0].isolationR03().emEt; |
120 |
> |
double _hadcaloiso = (*muons)[0].isolationR03().hadEt; |
121 |
> |
cout << "EM veto= " << _emveto << ", Had veto=" << _hadveto << std::endl; |
122 |
> |
cout << "Track iso= " << _trackiso << std::endl; |
123 |
> |
cout << "EM calo iso= " << _emcaloiso << ", Had calo iso=" << _hadcaloiso << std::endl; |
124 |
> |
} |
125 |
|
} |
126 |
|
// |
127 |
|
//_____ check Beam spot _____________________________________________________ |
139 |
|
<< "No beam spot available in the event \n"; |
140 |
|
} |
141 |
|
cout << beamSpot.x0() << " " << beamSpot.y0() << " " << beamSpot.z0() << std::endl; |
142 |
+ |
cout << "beamSpot.BeamWidth X,Y: " << beamSpot.BeamWidthX() << ", " << beamSpot.BeamWidthY() << std::endl; |
143 |
+ |
// |
144 |
+ |
//_____ check PAT electrons _______________________________________________ |
145 |
+ |
// |
146 |
+ |
std::cout << std::endl << "===> Check PAT electrons: " << std::endl; |
147 |
+ |
Handle< vector< pat::Electron > > electrons; |
148 |
+ |
iEvent . getByLabel( "selectedLayer1Electrons", electrons ); |
149 |
+ |
int electron_coll_size = electrons->size(); |
150 |
+ |
cout << "electron collection size: "<< electron_coll_size << endl; |
151 |
+ |
if (electron_coll_size>0){ |
152 |
+ |
cout << "Robust tight electron selector: " << (*electrons)[0].electronID("eidRobustTight") << std::endl; |
153 |
+ |
/* |
154 |
+ |
double _pt = (*electrons)[0].pt(); |
155 |
+ |
double _eta = (*electrons)[0].eta(); |
156 |
+ |
double _d0 = (*electrons)[0].dB(); |
157 |
+ |
cout << "pT= " << _pt << ", eta=" << _eta << std::endl; |
158 |
+ |
cout << "PAT d0= " << _d0 << std::endl; |
159 |
+ |
// |
160 |
+ |
//_____ check that there is a track |
161 |
+ |
reco::TrackRef _track = (*electrons)[0].track(); |
162 |
+ |
if(_track.isNull()){ |
163 |
+ |
cout << "there is no pat::electron::track()" << endl; |
164 |
+ |
} |
165 |
+ |
else{ |
166 |
+ |
cout << "there is a pat::electron::track()" << endl; |
167 |
+ |
} |
168 |
+ |
reco::GsfTrackRef _gsfTrack = (*electrons)[0].gsfTrack(); |
169 |
+ |
if(_gsfTrack.isNull()){ |
170 |
+ |
cout << "there is no pat::electron::gsfTrack()" << endl; |
171 |
+ |
} |
172 |
+ |
else{ |
173 |
+ |
cout << "there is a pat::electron::gsfTrack()" << endl; |
174 |
+ |
} |
175 |
+ |
*/ |
176 |
+ |
const pat::Electron & ele = (*electrons)[0]; |
177 |
+ |
//reco::GsfTrackRef _gsfTrack = ele.gsfTrack(); |
178 |
+ |
// |
179 |
+ |
//_____ check isolation |
180 |
+ |
cout << "Isolation info is valid..." << endl; |
181 |
+ |
double _trackiso = (*electrons)[0].trackIso(); |
182 |
+ |
double _emcaloiso = (*electrons)[0].ecalIso(); |
183 |
+ |
double _hadcaloiso = (*electrons)[0].hcalIso(); |
184 |
+ |
double _caloiso = (*electrons)[0].caloIso(); |
185 |
+ |
cout << "Track iso= " << _trackiso << std::endl; |
186 |
+ |
cout << "EM calo iso= " << _emcaloiso << ", Had calo iso=" << _hadcaloiso << std::endl; |
187 |
+ |
cout << "Calo iso= " << _caloiso << std::endl; |
188 |
+ |
} |
189 |
+ |
// |
190 |
+ |
//_____ check PAT jets _______________________________________________ |
191 |
+ |
// |
192 |
+ |
std::cout << std::endl << "===> Check PAT jets: " << std::endl; |
193 |
+ |
Handle< vector< pat::Jet > > jets; |
194 |
+ |
iEvent . getByLabel( "selectedLayer1Jets", jets ); |
195 |
+ |
int jet_coll_size = jets->size(); |
196 |
+ |
cout << "jet collection size: "<< jet_coll_size << endl; |
197 |
+ |
if (jet_coll_size>0){ |
198 |
+ |
double _pt = (*jets)[0].pt(); |
199 |
+ |
double _eta = (*jets)[0].eta(); |
200 |
+ |
//float _bDiscriminator = (*jets)[0].bDiscriminator(""); |
201 |
+ |
const std::vector<std::pair<std::string, float> > & btag = (*jets)[0].getPairDiscri(); |
202 |
+ |
cout << "B-tagging discriminators: " << endl; |
203 |
+ |
for (std::vector<std::pair<std::string, float> >::const_iterator _d = btag.begin(); |
204 |
+ |
_d != btag.end(); |
205 |
+ |
++_d){ |
206 |
+ |
cout << _d->first << " = " << _d->second << endl; |
207 |
+ |
} |
208 |
+ |
cout << "pT= " << _pt << ", eta=" << _eta << std::endl; |
209 |
+ |
} |
210 |
+ |
// |
211 |
+ |
//_____ check PAT MET ________________________________________________ |
212 |
+ |
// |
213 |
+ |
std::cout << std::endl << "===> Check PAT mets: " << std::endl; |
214 |
+ |
Handle< vector< pat::MET > > mets; |
215 |
+ |
iEvent . getByLabel( "layer1METs", mets ); |
216 |
+ |
int met_coll_size = mets->size(); |
217 |
+ |
cout << "met collection size: "<< met_coll_size << endl; |
218 |
+ |
if (met_coll_size>0){ |
219 |
+ |
double _pt = (*mets)[0].pt(); |
220 |
+ |
double _eta = (*mets)[0].eta(); |
221 |
+ |
double _phi = (*mets)[0].phi(); |
222 |
+ |
cout << "pT= " << _pt << ", eta=" << _eta << ", phi=" << _phi << std::endl; |
223 |
+ |
} |
224 |
|
} |
225 |
|
|
226 |
|
|
227 |
|
void |
228 |
|
CheckEventContent::beginJob() |
229 |
|
{ |
230 |
+ |
std::cout << "=======>: CheckEventContent::beginJob()" << std::endl; |
231 |
|
} |
232 |
|
|
233 |
|
|
234 |
|
void |
235 |
|
CheckEventContent::endJob() { |
236 |
+ |
std::cout << "=======>: CheckEventContent::endJob()" << std::endl; |
237 |
|
} |
238 |
|
|
239 |
|
|
101 |
– |
/* |
102 |
– |
bool CheckEventContent::is_muon(std::string mLabel, |
103 |
– |
double mPt, |
104 |
– |
double mEta, |
105 |
– |
int mNHits, |
106 |
– |
double mD0, |
107 |
– |
double mChi2Ndof, |
108 |
– |
double mEmVeto, |
109 |
– |
double mHadVeto, |
110 |
– |
double mRelIso, |
111 |
– |
const edm::Event& iEvent){ |
112 |
– |
bool result = false; |
113 |
– |
//cout << "Cut Flow: passed stage 1 (mu+jets) or stage 2 (e+jets): "; |
114 |
– |
Handle< vector< pat::Muon > > muons; |
115 |
– |
iEvent . getByLabel( "selectedLayer1Muons", muons ); |
116 |
– |
// |
117 |
– |
//_____ loop over muons _______________________________________________ |
118 |
– |
// |
119 |
– |
double _pt = 0.0; |
120 |
– |
double _abseta = 0.0; |
121 |
– |
int _nhits = 0; |
122 |
– |
double _d0 = 0.0; |
123 |
– |
double _chi2ndof = 0.0; |
124 |
– |
double _emveto = 10000.0; |
125 |
– |
double _hadveto = 10000.0; |
126 |
– |
double _trackiso = 10000.0; |
127 |
– |
double _caloiso = 10000.0; |
128 |
– |
double _reliso = 10000.0; |
129 |
– |
MeanCounter passed_muons(""); |
130 |
– |
for ( vector<pat::Muon>::const_iterator mu = muons -> begin(); mu != muons -> end(); mu++){ |
131 |
– |
//_____ check that the muon is global |
132 |
– |
if( !(mu->isGlobalMuon()) ) continue; |
133 |
– |
_pt = mu->pt(); |
134 |
– |
_abseta = fabs(mu->eta()); |
135 |
– |
//_d0 = mu->dB(); // global track |
136 |
– |
_d0 = -(mu->innerTrack()->dxy(_bs)); |
137 |
– |
_chi2ndof = mu->normChi2(); |
138 |
– |
_nhits = mu->numberOfValidHits(); |
139 |
– |
reco::TrackRef _track = mu->track(); |
140 |
– |
//_____ check that there is a track |
141 |
– |
if(_track.isNull()) continue; |
142 |
– |
//_nhits = _track->numberOfValidHits(); |
143 |
– |
//_d0 = -(_track->dxy(_bs)); |
144 |
– |
//_chi2ndof = _track->normalizedChi2(); |
145 |
– |
//_chi2ndof = (_track->chi2())/(_track->ndof()); |
146 |
– |
//_____ check that isolation is valid |
147 |
– |
if ( !(mu->isIsolationValid()) ) continue; |
148 |
– |
_emveto = mu->isolationR03().emVetoEt; |
149 |
– |
_hadveto = mu->isolationR03().hadVetoEt; |
150 |
– |
_trackiso = mu->isolationR03().sumPt; |
151 |
– |
_caloiso = mu->isolationR03().emEt + mu->isolationR03().hadEt; |
152 |
– |
_reliso = (_trackiso + _caloiso)/_pt; |
153 |
– |
if (_pt > mPt && |
154 |
– |
_abseta < mEta && |
155 |
– |
_nhits >= mNHits && |
156 |
– |
fabs(_d0) < mD0 && |
157 |
– |
_chi2ndof < mChi2Ndof && |
158 |
– |
fabs(_emveto) < mEmVeto && |
159 |
– |
fabs(_hadveto) < mHadVeto && |
160 |
– |
fabs(_reliso) < mRelIso |
161 |
– |
){ |
162 |
– |
passed_muons.count(); |
163 |
– |
muon_index = (int)(mu - muons->begin()); |
164 |
– |
if (passed_muons.getCount()==1){ |
165 |
– |
cout << _pt << ", "; |
166 |
– |
cout << _abseta << ", "; |
167 |
– |
cout << _nhits << ", "; |
168 |
– |
cout << _d0 << ", "; |
169 |
– |
cout << _chi2ndof << ", "; |
170 |
– |
cout << _emveto << ", "; |
171 |
– |
cout << _hadveto << ", "; |
172 |
– |
cout << _trackiso << ", "; |
173 |
– |
cout << _caloiso << ", "; |
174 |
– |
cout << _reliso; |
175 |
– |
//cout << std::endl; |
176 |
– |
} |
177 |
– |
} |
178 |
– |
} |
179 |
– |
cout << "Number of good muons: " << passed_muons.getCount(); |
180 |
– |
result = passed_muons.getCount()==1; |
181 |
– |
return result; |
182 |
– |
} |
183 |
– |
|
184 |
– |
|
185 |
– |
bool CheckEventContent::is_jets(std::string mLabel, |
186 |
– |
double mPt, |
187 |
– |
double mEta, |
188 |
– |
const edm::Event& iEvent){ |
189 |
– |
bool result = false; |
190 |
– |
|
191 |
– |
//cout << "Cut Flow: passed stage 2: "; |
192 |
– |
|
193 |
– |
Handle< vector< pat::Jet > > jets; |
194 |
– |
iEvent . getByLabel( mLabel, jets ); |
195 |
– |
MeanCounter c_jets(""); |
196 |
– |
MeanCounter passed_jets(""); |
197 |
– |
for ( vector<pat::Jet>::const_iterator jet = jets -> begin(); jet != jets -> end(); jet++ ){ |
198 |
– |
c_jets.count(); |
199 |
– |
double _pt = jet->pt(); |
200 |
– |
double _eta = jet->eta(); |
201 |
– |
if ( |
202 |
– |
( fabs( _eta ) < mEta ) && |
203 |
– |
( _pt > mPt ) |
204 |
– |
) |
205 |
– |
{ |
206 |
– |
passed_jets.count(); |
207 |
– |
} |
208 |
– |
if (c_jets.getCount()<=4){ |
209 |
– |
cout << _pt << ", "; |
210 |
– |
cout << _eta; |
211 |
– |
} |
212 |
– |
} |
213 |
– |
//cout << std::endl; |
214 |
– |
result = passed_jets.getCount() >=4; |
215 |
– |
return result; |
216 |
– |
} |
217 |
– |
|
218 |
– |
|
219 |
– |
bool CheckEventContent::no_loose_muon(std::string mLabel, |
220 |
– |
double mEta, |
221 |
– |
double mPt, |
222 |
– |
double mRelIso, |
223 |
– |
const edm::Event& iEvent){ |
224 |
– |
bool result = false; |
225 |
– |
//cout << "Cut Flow: passed stage 3: "; |
226 |
– |
Handle< vector< pat::Muon > > muons; |
227 |
– |
iEvent . getByLabel( "selectedLayer1Muons", muons ); |
228 |
– |
// |
229 |
– |
//_____ loop over muons _______________________________________________ |
230 |
– |
// |
231 |
– |
double _pt = 0.0; |
232 |
– |
double _abseta = 0.0; |
233 |
– |
double _trackiso = 10000.0; |
234 |
– |
double _caloiso = 10000.0; |
235 |
– |
double _reliso = 10000.0; |
236 |
– |
MeanCounter passed_muons(""); |
237 |
– |
for ( vector<pat::Muon>::const_iterator mu = muons -> begin(); mu != muons -> end(); mu++){ |
238 |
– |
//_____ check that the muon is global |
239 |
– |
if( !(mu->isGlobalMuon()) ) continue; |
240 |
– |
_pt = mu->pt(); |
241 |
– |
_abseta = fabs(mu->eta()); |
242 |
– |
//_____ check that isolation is valid |
243 |
– |
if ( !(mu->isIsolationValid()) ) continue; |
244 |
– |
_trackiso = mu->isolationR03().sumPt; |
245 |
– |
_caloiso = mu->isolationR03().emEt + mu->isolationR03().hadEt; |
246 |
– |
_reliso = (_trackiso + _caloiso)/_pt; |
247 |
– |
int _index = (int)(mu - muons->begin()); |
248 |
– |
if (_pt > mPt && |
249 |
– |
_abseta < mEta && |
250 |
– |
_reliso < mRelIso && |
251 |
– |
_index != muon_index |
252 |
– |
){ |
253 |
– |
passed_muons.count(); |
254 |
– |
} |
255 |
– |
} |
256 |
– |
result = passed_muons.getCount()==0; |
257 |
– |
//cout << std::endl; |
258 |
– |
return result; |
259 |
– |
} |
260 |
– |
|
261 |
– |
|
262 |
– |
bool CheckEventContent::no_loose_electron(std::string mLabel, |
263 |
– |
double mEta, |
264 |
– |
double mPt, |
265 |
– |
double mRelIso, |
266 |
– |
const edm::Event& iEvent){ |
267 |
– |
bool result = false; |
268 |
– |
//cout << "Cut Flow: passed stage 4: "; |
269 |
– |
Handle< vector< pat::Electron > > electrons; |
270 |
– |
iEvent . getByLabel( "selectedLayer1Electrons", electrons ); |
271 |
– |
// |
272 |
– |
//_____ loop over electrons _______________________________________________ |
273 |
– |
// |
274 |
– |
double _pt = 0.0; |
275 |
– |
double _abseta = 0.0; |
276 |
– |
double _trackiso = 10000.0; |
277 |
– |
double _caloiso = 10000.0; |
278 |
– |
double _reliso = 10000.0; |
279 |
– |
MeanCounter passed_electrons(""); |
280 |
– |
for ( vector<pat::Electron>::const_iterator e = electrons -> begin(); e != electrons -> end(); e++){ |
281 |
– |
_pt = e->pt(); |
282 |
– |
_abseta = fabs(e->eta()); |
283 |
– |
_trackiso = e->dr03IsolationVariables().tkSumPt; |
284 |
– |
_caloiso = e->dr03IsolationVariables().ecalRecHitSumEt + e->dr03IsolationVariables().hcalDepth1TowerSumEt + e->dr03IsolationVariables().hcalDepth2TowerSumEt; |
285 |
– |
_reliso = (_trackiso + _caloiso)/_pt; |
286 |
– |
int _index = (int)(e - electrons->begin()); |
287 |
– |
if (_pt > mPt && |
288 |
– |
_abseta < mEta && |
289 |
– |
_reliso < mRelIso && |
290 |
– |
_index != electron_index |
291 |
– |
){ |
292 |
– |
passed_electrons.count(); |
293 |
– |
} |
294 |
– |
} |
295 |
– |
result = passed_electrons.getCount()==0; |
296 |
– |
//cout << std::endl; |
297 |
– |
return result; |
298 |
– |
} |
299 |
– |
|
300 |
– |
|
301 |
– |
bool CheckEventContent::has_electron(std::string mLabel, |
302 |
– |
const edm::Event& iEvent){ |
303 |
– |
bool result = false; |
304 |
– |
Handle< vector< pat::Electron > > electrons; |
305 |
– |
iEvent . getByLabel( mLabel, electrons ); |
306 |
– |
result = electrons->size()>0; |
307 |
– |
return result; |
308 |
– |
} |
309 |
– |
|
310 |
– |
|
311 |
– |
bool CheckEventContent::is_electron(std::string mLabel, |
312 |
– |
double mPt, |
313 |
– |
double mEta, |
314 |
– |
double mD0, |
315 |
– |
double mRelIso, |
316 |
– |
const edm::Event& iEvent){ |
317 |
– |
bool result = false; |
318 |
– |
//cout << "Cut Flow: passed stage 1: "; |
319 |
– |
Handle< vector< pat::Electron > > electrons; |
320 |
– |
iEvent . getByLabel( "selectedLayer1Electrons", electrons ); |
321 |
– |
Handle< reco::BeamSpot > beamSpotHandle; |
322 |
– |
iEvent . getByLabel( "offlineBeamSpot", beamSpotHandle); |
323 |
– |
// |
324 |
– |
//_____ Beam spot _____________________________________________________ |
325 |
– |
// |
326 |
– |
reco::BeamSpot beamSpot; |
327 |
– |
if ( beamSpotHandle.isValid() ){ |
328 |
– |
beamSpot = *beamSpotHandle; |
329 |
– |
} |
330 |
– |
else{ |
331 |
– |
edm::LogInfo("TtLJetsAnalyzer") |
332 |
– |
<< "No beam spot available from EventSetup \n"; |
333 |
– |
} |
334 |
– |
const reco::BeamSpot::Point _bs(beamSpot.x0(), beamSpot.y0(),beamSpot.z0()); |
335 |
– |
// |
336 |
– |
//_____ loop over electrons _______________________________________________ |
337 |
– |
// |
338 |
– |
double _pt = 0.0; |
339 |
– |
double _abseta = 0.0; |
340 |
– |
double _d0 = 0.0; |
341 |
– |
double _d0_pat = 0.0; |
342 |
– |
double _trackiso = 10000.0; |
343 |
– |
double _ecaloiso = 10000.0; |
344 |
– |
double _ecaloiso2 = 10000.0; |
345 |
– |
double _pat_ecaloiso = 10000.0; |
346 |
– |
double _hcaloiso1 = 10000.0; |
347 |
– |
double _hcaloiso2 = 10000.0; |
348 |
– |
double _caloiso = 10000.0; |
349 |
– |
double _reliso = 10000.0; |
350 |
– |
MeanCounter passed_electrons(""); |
351 |
– |
for ( vector<pat::Electron>::const_iterator e = electrons -> begin(); e != electrons -> end(); e++){ |
352 |
– |
//_____ check that the electron is robust-tight |
353 |
– |
if( !(e->electronID("eidRobustTight")) ) continue; |
354 |
– |
_pt = e->pt(); |
355 |
– |
_abseta = fabs(e->eta()); |
356 |
– |
_d0_pat = e->dB(); |
357 |
– |
_d0 = -(e->gsfTrack()->dxy(_bs)); |
358 |
– |
_trackiso = e->dr03IsolationVariables().tkSumPt; |
359 |
– |
_ecaloiso = e->dr04IsolationVariables().ecalRecHitSumEt; |
360 |
– |
_ecaloiso2 = e->dr03IsolationVariables().ecalRecHitSumEt; |
361 |
– |
_pat_ecaloiso = e->isolation(pat::ECalIso); |
362 |
– |
_hcaloiso1 = e->dr04IsolationVariables().hcalDepth1TowerSumEt; |
363 |
– |
_hcaloiso2 = e->dr04IsolationVariables().hcalDepth2TowerSumEt; |
364 |
– |
_caloiso = _ecaloiso + _hcaloiso1 + _hcaloiso2; |
365 |
– |
//_caloiso = _pat_ecaloiso +_hcaloiso1 + _hcaloiso2; |
366 |
– |
_reliso = (_trackiso + _caloiso)/_pt; |
367 |
– |
if (_pt > mPt && |
368 |
– |
_abseta < mEta && |
369 |
– |
fabs(_d0) < mD0 && |
370 |
– |
fabs(_reliso) < mRelIso |
371 |
– |
){ |
372 |
– |
passed_electrons.count(); |
373 |
– |
electron_index = (int)(e - electrons->begin()); |
374 |
– |
if (passed_electrons.getCount()==1){ |
375 |
– |
cout << "pt=" << _pt << ", abseta="; |
376 |
– |
cout << _abseta << ", d0="; |
377 |
– |
cout << _d0 << ", trackiso="; |
378 |
– |
cout << _trackiso << ", ecaloiso04="; |
379 |
– |
cout << _ecaloiso << ", ecaloiso03="; |
380 |
– |
cout << _ecaloiso2 << ", pat_ecaloiso="; |
381 |
– |
cout << _pat_ecaloiso << ", hcaloiso1="; |
382 |
– |
cout << _hcaloiso1 << ", hcaloiso2="; |
383 |
– |
cout << _hcaloiso2 << ", caloiso04="; |
384 |
– |
cout << _caloiso << ", reliso="; |
385 |
– |
cout << _reliso; |
386 |
– |
//cout << std::endl; |
387 |
– |
} |
388 |
– |
} |
389 |
– |
} |
390 |
– |
//cout << "Number of good electrons: " << passed_electrons.getCount(); |
391 |
– |
result = passed_electrons.getCount()==1; |
392 |
– |
return result; |
393 |
– |
} |
394 |
– |
|
395 |
– |
|
396 |
– |
int CheckEventContent::count_jets(std::string jLabel, |
397 |
– |
double jPt, |
398 |
– |
double jEta, |
399 |
– |
std::string lLabel, |
400 |
– |
double lPt, |
401 |
– |
double lEta, |
402 |
– |
double lD0, |
403 |
– |
double lDR, |
404 |
– |
const edm::Event & iEvent){ |
405 |
– |
MeanCounter _njets(""); |
406 |
– |
Handle< vector< pat::Jet > > jets; |
407 |
– |
iEvent . getByLabel( jLabel, jets ); |
408 |
– |
Handle< vector< pat::Electron > > electrons; |
409 |
– |
iEvent . getByLabel( lLabel, electrons ); |
410 |
– |
Handle< reco::BeamSpot > beamSpotHandle; |
411 |
– |
iEvent . getByLabel( "offlineBeamSpot", beamSpotHandle); |
412 |
– |
// |
413 |
– |
//_____ Beam spot _____________________________________________________ |
414 |
– |
// |
415 |
– |
reco::BeamSpot beamSpot; |
416 |
– |
if ( beamSpotHandle.isValid() ){ |
417 |
– |
beamSpot = *beamSpotHandle; |
418 |
– |
} |
419 |
– |
else{ |
420 |
– |
edm::LogInfo("TtLJetsAnalyzer") |
421 |
– |
<< "No beam spot available from EventSetup \n"; |
422 |
– |
} |
423 |
– |
const reco::BeamSpot::Point _bs(beamSpot.x0(), beamSpot.y0(),beamSpot.z0()); |
424 |
– |
// |
425 |
– |
//_____ loop over jets _______________________________________________ |
426 |
– |
// |
427 |
– |
double j_pt = 0.0; |
428 |
– |
double j_eta = 0.0; |
429 |
– |
for ( vector<pat::Jet>::const_iterator jet = jets -> begin(); jet != jets -> end(); ++jet){ |
430 |
– |
j_pt = jet->pt(); |
431 |
– |
j_eta = jet->eta(); |
432 |
– |
// |
433 |
– |
//_____ loop over electrons _______________________________________________ |
434 |
– |
// |
435 |
– |
double e_pt = 0.0; |
436 |
– |
double e_abseta = 0.0; |
437 |
– |
double e_d0 = 0.0; |
438 |
– |
double e_dr = 0.0; |
439 |
– |
bool jet_removed = false; |
440 |
– |
for ( vector<pat::Electron>::const_iterator e = electrons -> begin(); e != electrons -> end(); e++){ |
441 |
– |
//_____ check that the electron is robust-tight |
442 |
– |
if( !(e->electronID("eidRobustTight")) ) continue; |
443 |
– |
e_pt = e->pt(); |
444 |
– |
e_abseta = fabs(e->eta()); |
445 |
– |
e_d0 = -(e->gsfTrack()->dxy(_bs)); |
446 |
– |
e_dr = reco::deltaR(*jet, *e); |
447 |
– |
if ( e_pt > lPt && e_abseta < lEta && fabs(e_d0)<lD0 && e_dr<lDR){ |
448 |
– |
jet_removed = true; |
449 |
– |
} |
450 |
– |
} |
451 |
– |
if (j_pt>jPt && fabs(j_eta)<jEta && !jet_removed) _njets.count(); |
452 |
– |
} |
453 |
– |
cout << "Number of jets after cleaning: " << _njets.getCount(); |
454 |
– |
return _njets.getCount(); |
455 |
– |
} |
456 |
– |
|
457 |
– |
*/ |
240 |
|
|
241 |
|
//define this as a plug-in |
242 |
|
DEFINE_FWK_MODULE(CheckEventContent); |