70 |
|
return vec; |
71 |
|
} |
72 |
|
|
73 |
+ |
float deltaPhi( float phi1, float phi2) { |
74 |
+ |
float result = phi1 - phi2; |
75 |
+ |
while (result > M_PI) result -= 2*M_PI; |
76 |
+ |
while (result <= -M_PI) result += 2*M_PI; |
77 |
+ |
return result; |
78 |
+ |
} |
79 |
+ |
|
80 |
|
// useful functions |
81 |
|
float deltaR( const TLorentzVector& v1, const TLorentzVector& v2 ) { |
82 |
|
// deltaR = sqrt ( deltaEta^2 + deltaPhi^2 ) |
83 |
< |
return sqrt(pow(v1.Eta() - v2.Eta(), 2) + pow(v1.Phi() - v2.Phi(), 2) ); |
83 |
> |
return sqrt(pow(v1.Eta() - v2.Eta(), 2) + pow(deltaPhi(v1.Phi(),v2.Phi()), 2) ); |
84 |
|
} |
85 |
|
|
86 |
|
float effectiveAreaElectron( float eta ) { |
260 |
|
tree->Branch("ht", &ht, "ht/F"); |
261 |
|
tree->Branch("nVertex", &nVertex, "nVertex/I"); |
262 |
|
tree->Branch("pu_weight", &pu_weight, "pu_weight/F"); |
263 |
< |
|
263 |
> |
tree->Branch("genElectron", &genElectron); |
264 |
> |
tree->Branch("genPhoton", &genPhoton); |
265 |
|
|
266 |
|
for (unsigned long jentry=0; jentry < processNEvents; ++jentry) { |
267 |
|
if ( loggingVerbosity>1 || jentry%reportEvery==0 ) |
273 |
|
jet.clear(); |
274 |
|
electron.clear(); |
275 |
|
muon.clear(); |
276 |
+ |
genElectron.clear(); |
277 |
+ |
genPhoton.clear(); |
278 |
|
ht = 0; |
279 |
|
|
280 |
|
// weights |
298 |
|
|
299 |
|
for(std::vector<susy::Photon>::iterator it = photonVector.begin(); |
300 |
|
it != photonVector.end(); ++it ) { |
301 |
< |
if( !(it->isEB() || it->isEE()) && skim ) |
301 |
> |
if( !(it->isEE() || it->isEB()) && it->isEBEtaGap() && it->isEBPhiGap() && it->isEERingGap() && it->isEEDeeGap() && it->isEBEEGap() && skim ) |
302 |
|
continue; |
303 |
|
tree::Photon thisphoton; |
304 |
|
thisphoton.pt = getPtFromMatchedJet( *it, jetVector, loggingVerbosity ); |
322 |
|
&& it->sigmaIetaIeta<0.034 |
323 |
|
&& thisphoton.chargedIso<2.3 |
324 |
|
&& thisphoton.neutralIso<2.9+0.04*thisphoton.pt; |
325 |
+ |
|
326 |
|
if(!(loose_photon_endcap || loose_photon_barrel || thisphoton.pt > 75 ) && skim ) |
327 |
|
continue; |
328 |
|
thisphoton.eta = it->momentum.Eta(); |
358 |
|
scale = it->jecScaleFactors.find("L2L3")->second; |
359 |
|
TLorentzVector corrP4 = scale * it->momentum; |
360 |
|
|
361 |
< |
if(std::abs(corrP4.Eta()) > 3.0 && skim ) continue; |
361 |
> |
// Calculate HT. |
362 |
> |
// The definiton differs from the saved jet, since trigger is described better |
363 |
> |
if( std::abs( corrP4.Eta() ) < 3 && corrP4.Pt() > 40 ) |
364 |
> |
ht += thisjet.pt; |
365 |
> |
|
366 |
> |
if(std::abs(corrP4.Eta()) > 2.6 && skim ) continue; |
367 |
|
if(corrP4.Pt() < 30 && skim ) continue; |
368 |
|
thisjet.pt = corrP4.Pt(); |
369 |
|
thisjet.eta = corrP4.Eta(); |
385 |
|
std::cout << " p_T, jet = " << thisjet.pt << std::endl; |
386 |
|
|
387 |
|
jet.push_back( thisjet ); |
372 |
– |
ht += thisjet.pt; |
388 |
|
}// for jet |
389 |
|
if( jet.size() < 2 && skim ) |
390 |
|
continue; |
392 |
|
if( loggingVerbosity > 1 ) |
393 |
|
std::cout << "Found " << jet.size() << " jets" << std::endl; |
394 |
|
|
395 |
+ |
if( ht < 450 && skim) |
396 |
+ |
continue; |
397 |
+ |
|
398 |
+ |
|
399 |
|
|
400 |
|
// met |
401 |
|
std::map<TString, susy::MET>::iterator met_it = event->metMap.find("pfMet"); |
422 |
|
// use veto electrons |
423 |
|
if( it->momentum.Pt() < 20 || it->momentum.Pt() > 1e6 ) |
424 |
|
continue; // spike rejection |
425 |
< |
float iso = ( it->chargedHadronIso + max(it->neutralHadronIso+it->photonIso |
407 |
< |
- effectiveAreaElectron(it->momentum.Eta())*event->rho25, (Float_t)0. ) |
425 |
> |
float iso = ( it->chargedHadronIso + max(it->neutralHadronIso+it->photonIso - effectiveAreaElectron(it->momentum.Eta())*event->rho25, (float)0. ) |
426 |
|
) / it->momentum.Pt(); |
427 |
|
float d0 = d0correction( *it, *event ); |
428 |
|
float dZ = std::abs( dZcorrection( *it, *event ) ); |
477 |
|
// vertices |
478 |
|
nVertex = event->vertices.size(); |
479 |
|
|
480 |
< |
if( ht < 450 && skim) |
481 |
< |
continue; |
482 |
< |
|
480 |
> |
tree::Particle thisGenParticle; |
481 |
> |
for( std::vector<susy::Particle>::iterator it = event->genParticles.begin(); it != event->genParticles.end(); ++it ) { |
482 |
> |
if( it->momentum.Pt() < 20 ) continue; |
483 |
> |
thisGenParticle.pt = it->momentum.Pt(); |
484 |
> |
thisGenParticle.eta = it->momentum.Eta(); |
485 |
> |
thisGenParticle.phi = it->momentum.Phi(); |
486 |
> |
switch( std::abs(it->pdgId) ) { |
487 |
> |
case 22: // photon |
488 |
> |
genPhoton.push_back( thisGenParticle ); |
489 |
> |
break; |
490 |
> |
case 11: // electron |
491 |
> |
// Demand a W boson as mother particle of electron |
492 |
> |
if( abs(event->genParticles[it->motherIndex].pdgId) == 24 ) |
493 |
> |
genElectron.push_back( thisGenParticle ); |
494 |
> |
break; |
495 |
> |
} |
496 |
> |
} |
497 |
|
|
498 |
|
tree->Fill(); |
499 |
|
} // for jentry |