30 |
|
event = new susy::Event; |
31 |
|
inputTree->SetBranchAddress("susyEvent", &event); |
32 |
|
|
33 |
+ |
// Here the number of proceeded events will be stored. For plotting, simply use L*sigma/eventNumber |
34 |
+ |
eventNumbers = new TH1F("eventNumbers", "Histogram containing number of generated Events", 1, 0, 1); |
35 |
+ |
eventNumbers->GetXaxis()->SetBinLabel(1,"Number of generated Events"); |
36 |
+ |
|
37 |
|
// open the output file |
38 |
|
if (loggingVerbosity_>0) |
39 |
|
std::cout << "Open file " << outputName << " for writing." << std::endl; |
134 |
|
return iso; |
135 |
|
} |
136 |
|
|
137 |
+ |
float d0correction( susy::Electron electron, susy::Event event ) { |
138 |
+ |
TVector3 beamspot = event.vertices[0].position; |
139 |
+ |
susy::Track track = event.tracks[electron.gsfTrackIndex]; |
140 |
+ |
float d0 = track.d0() - beamspot.X()*sin(track.phi()) + beamspot.Y()*cos(track.phi()); |
141 |
+ |
cout << "return " << d0 << endl; |
142 |
+ |
return d0; |
143 |
+ |
} |
144 |
+ |
|
145 |
+ |
float dZcorrection( susy::Electron electron, susy::Event event ) { |
146 |
+ |
TVector3 beamspot = event.vertices[0].position; |
147 |
+ |
susy::Track track = event.tracks[electron.gsfTrackIndex]; |
148 |
+ |
|
149 |
+ |
if(track.momentum.Pt() == 0.) return 1.e6; |
150 |
+ |
float dz = (track.vertex.Z() - beamspot.Z()) - ((track.vertex.X() - beamspot.X())*track.momentum.Px() + (track.vertex.Y() - beamspot.Y())*track.momentum.Py()) / track.momentum.Pt() * (track.momentum.Pz() / track.momentum.Pt()); |
151 |
+ |
return dz; |
152 |
+ |
} |
153 |
+ |
|
154 |
|
float TreeWriter::getPtFromMatchedJet( susy::Photon myPhoton, susy::Event myEvent ) { |
155 |
|
/** |
156 |
|
* \brief Takes jet p_T as photon p_T |
217 |
|
|
218 |
|
// get number of events to be proceeded |
219 |
|
Long64_t nentries = inputTree->GetEntries(); |
220 |
+ |
// store them in histo |
221 |
+ |
eventNumbers->Fill( "Number of generated Events", nentries ); |
222 |
|
if(processNEvents <= 0 || processNEvents > nentries) processNEvents = nentries; |
223 |
|
|
224 |
|
if( loggingVerbosity > 0 ) |
333 |
|
float scale = s_it->second; |
334 |
|
TLorentzVector corrP4 = scale * it->momentum; |
335 |
|
|
336 |
< |
if(std::abs(corrP4.Eta()) > 3.0 && skim ) continue; |
336 |
> |
if(std::fabs(corrP4.Eta()) > 3.0 && skim ) continue; |
337 |
|
if(corrP4.Et() < 30 && skim ) continue; |
338 |
|
thisjet->pt = corrP4.Et(); |
339 |
|
thisjet->eta = corrP4.Eta(); |
386 |
|
if(eleMap == event->electrons.end() && loggingVerbosity > 0) { |
387 |
|
cout << "gsfElectrons not found!" << endl; |
388 |
|
} else { |
389 |
+ |
cout << "now begin electrons " << endl; |
390 |
|
for(vector<susy::Electron>::iterator it = eleMap->second.begin(); it < eleMap->second.end(); ++it) { |
391 |
< |
// for cuts see https://twiki.cern.ch/twiki/bin/viewauth/CMS/EgammaCutBasedIdentification |
391 |
> |
// for cuts see https://twiki.cern.ch/twiki/bin/viewauth/CMS/EgammaCutBasedIdentification for veto electrons |
392 |
> |
if( it->momentum.Pt() < 1 || it->momentum.Pt() > 1e6 ) |
393 |
> |
continue; // spike rejection |
394 |
|
float iso = ( it->chargedHadronIso + max(it->neutralHadronIso+it->photonIso |
395 |
< |
-effectiveAreaElectron(it->momentum.Eta())*event->rho25, (Float_t)0. ) |
395 |
> |
- effectiveAreaElectron(it->momentum.Eta())*event->rho25, (Float_t)0. ) |
396 |
|
) / it->momentum.Pt(); |
397 |
< |
if ( it->isEE() ){ |
397 |
> |
cout << iso << endl; |
398 |
> |
cout << d0correction( *it, *event ) << endl; |
399 |
> |
float test = d0correction( *it, *event ); |
400 |
> |
cout << test << endl; |
401 |
> |
float dZ = std::fabs( dZcorrection( *it, *event ) ); |
402 |
> |
cout <<" find e" << endl; |
403 |
> |
float d0 = 0.; |
404 |
> |
if ( it->isEB() ){ |
405 |
|
if ( fabs(it->deltaEtaSuperClusterTrackAtVtx) > 0.007 |
406 |
< |
|| fabs(it->deltaPhiSuperClusterTrackAtVtx) > 0.15 |
406 |
> |
|| fabs(it->deltaPhiSuperClusterTrackAtVtx) > 0.8 |
407 |
|
|| it->sigmaIetaIeta > 0.01 |
408 |
< |
|| it->hcalOverEcalBc > 0.12 |
409 |
< |
|| it->vertex.Perp() > 0.02 |
410 |
< |
|| it->vertex.Z() > 0.2 |
378 |
< |
|| fabs(1./(it->ecalEnergy) - 1./(it->trackMomentums["AtVtx"].P())) > 0.05 |
379 |
< |
|| it->convFlags() // not official, but perhaps substitude? |
408 |
> |
|| it->hcalOverEcalBc > 0.15 |
409 |
> |
|| d0 > 0.04 |
410 |
> |
|| dZ > 0.2 |
411 |
|
|| iso > 0.15 ) |
412 |
|
continue; |
413 |
|
} |
414 |
< |
else if( it->isEB() ) { |
415 |
< |
if ( fabs(it->deltaEtaSuperClusterTrackAtVtx) > 0.009 |
416 |
< |
|| fabs(it->deltaPhiSuperClusterTrackAtVtx) > 0.10 |
414 |
> |
else if( it->isEE() ) { |
415 |
> |
if ( fabs(it->deltaEtaSuperClusterTrackAtVtx) > 0.01 |
416 |
> |
|| fabs(it->deltaPhiSuperClusterTrackAtVtx) > 0.7 |
417 |
|
|| it->sigmaIetaIeta > 0.03 |
418 |
< |
|| it->hcalOverEcalBc > 0.10 |
419 |
< |
|| it->vertex.Perp() > 0.02 |
389 |
< |
|| it->vertex.Z() > 0.2 |
390 |
< |
|| fabs(1./(it->ecalEnergy) - 1./(it->trackMomentums["AtVtx"].P())) > 0.05 |
391 |
< |
|| it->convFlags() // not official, but perhaps substitude? |
418 |
> |
|| d0 > 0.04 |
419 |
> |
|| dZ > 0.2 |
420 |
|
|| iso > 0.15 ) |
421 |
|
continue; |
422 |
|
} |
424 |
|
continue; |
425 |
|
// TODO: conversion rejection information not implemented yet, see twiki for more details |
426 |
|
|
427 |
< |
thiselectron->pt = it->momentum.Et(); |
427 |
> |
thiselectron->pt = it->momentum.Pt(); |
428 |
|
if( thiselectron->pt < 20 ) |
429 |
|
continue; |
430 |
|
if( loggingVerbosity > 2 ) |
465 |
|
|
466 |
|
|
467 |
|
outFile->cd(); |
468 |
+ |
eventNumbers->Write(); |
469 |
|
tree->Write(); |
470 |
|
outFile->Write(); |
471 |
|
outFile->Close(); |