78 |
|
// Parse the tree variable definitions. |
79 |
|
for (uint iBranchSet = 0; !useEDMFormat_ && iBranchSet<treeBranchSets_.size(); iBranchSet++) { |
80 |
|
string tempInputCollection = treeBranchSets_.at(iBranchSet).getParameter<string> ("inputCollection"); |
81 |
< |
if(tempInputCollection.find("pairs")!=string::npos) { cout << "Warning: tree filling is not configured for pairs of objects, so will not work for collection: " << tempInputCollection << endl; } |
81 |
> |
if(tempInputCollection.find("pairs")!=string::npos) { clog << "Warning: tree filling is not configured for pairs of objects, so will not work for collection: " << tempInputCollection << endl; } |
82 |
|
objectsToGet.push_back(tempInputCollection); |
83 |
|
objectsToFlag.push_back(tempInputCollection); |
84 |
|
|
343 |
|
string cutString = cuts_.at(currentCut).getParameter<string> ("cutString"); |
344 |
|
vector<string> cutStringVector = splitString(cutString); |
345 |
|
if(cutStringVector.size()!=3 && cutStringVector.size() % 4 !=3){ |
346 |
< |
cout << "Error: Didn't find the expected number elements in the following cut string: '" << cutString << "'\n"; |
346 |
> |
clog << "Error: Didn't find the expected number elements in the following cut string: '" << cutString << "'\n"; |
347 |
|
exit(0); |
348 |
|
} |
349 |
|
tempCut.numSubcuts = (cutStringVector.size()+1)/4; |
369 |
|
string numberRequiredString = cuts_.at(currentCut).getParameter<string> ("numberRequired"); |
370 |
|
vector<string> numberRequiredVector = splitString(numberRequiredString); |
371 |
|
if(numberRequiredVector.size()!=2){ |
372 |
< |
cout << "Error: Didn't find two elements in the following number requirement string: '" << numberRequiredString << "'\n"; |
372 |
> |
clog << "Error: Didn't find two elements in the following number requirement string: '" << numberRequiredString << "'\n"; |
373 |
|
exit(0); |
374 |
|
} |
375 |
|
|
468 |
|
} |
469 |
|
} |
470 |
|
if(numBinsElements != 3 && numBinsElements !=6){ |
471 |
< |
cout << "Error: Didn't find correct number of bin specifications for histogram named '" << currentHistogram.name << "'\n"; |
471 |
> |
clog << "Error: Didn't find correct number of bin specifications for histogram named '" << currentHistogram.name << "'\n"; |
472 |
|
exit(0); |
473 |
|
} |
474 |
|
else if((numBinsElements == 3 && numInputVariables !=1) || (numBinsElements == 6 && numInputVariables!=2)){ |
475 |
< |
cout << "Error: Didn't find correct number of input variables for histogram named '" << currentHistogram.name << "'\n"; |
475 |
> |
clog << "Error: Didn't find correct number of input variables for histogram named '" << currentHistogram.name << "'\n"; |
476 |
|
exit(0); |
477 |
|
} |
478 |
|
else if(numBinsElements == 3){ |
647 |
|
delete cutFlows_.at(currentChannel); |
648 |
|
} |
649 |
|
|
650 |
< |
cout << "=============================================" << endl; |
651 |
< |
cout << "Successfully completed OSUAnalysis." << endl; |
652 |
< |
cout << "=============================================" << endl; |
650 |
> |
clog << "=============================================" << endl; |
651 |
> |
clog << "Successfully completed OSUAnalysis." << endl; |
652 |
> |
clog << "=============================================" << endl; |
653 |
|
|
654 |
|
} |
655 |
|
|
721 |
|
//get pile-up event weight |
722 |
|
if (doPileupReweighting_ && datasetType_ != "data") { |
723 |
|
//for "data" datasets, the numTruePV is always set to -1 |
724 |
< |
if (events->at(0).numTruePV < 0) cout << "WARNING[OSUAnalysis::analyze]: Event has numTruePV<0. Turning off pile-up reweighting." << endl; |
724 |
> |
if (events->at(0).numTruePV < 0) clog << "WARNING[OSUAnalysis::analyze]: Event has numTruePV<0. Turning off pile-up reweighting." << endl; |
725 |
|
else masterScaleFactor *= puWeight_->at (events->at (0).numTruePV); |
726 |
|
} |
727 |
|
|
1000 |
|
|
1001 |
|
if (printEventInfo_) { |
1002 |
|
// Write information about event to screen, for testing purposes. |
1003 |
< |
cout << "Event passed all cuts in channel " << currentChannel.name |
1003 |
> |
clog << "Event passed all cuts in channel " << currentChannel.name |
1004 |
|
<< ": run=" << events->at(0).run |
1005 |
|
<< " lumi=" << events->at(0).lumi |
1006 |
|
<< " event=" << events->at(0).evt |
1022 |
|
for (uint histogramIndex = 0; histogramIndex != histograms.size(); histogramIndex++){ |
1023 |
|
histogram currentHistogram = histograms.at(histogramIndex); |
1024 |
|
|
1025 |
< |
if (cumulativeFlags.count(currentHistogram.inputCollection) == 0) cout << "Error: no flags found for collection: " << currentHistogram.inputCollection << ", will cause a seg fault" << endl; |
1025 |
> |
if (cumulativeFlags.count(currentHistogram.inputCollection) == 0) clog << "Error: no flags found for collection: " << currentHistogram.inputCollection << ", will cause a seg fault" << endl; |
1026 |
|
|
1027 |
|
if(currentHistogram.inputVariables.size() == 1){ |
1028 |
|
TH1D* histo; |
1304 |
|
for (uint iBranch = 0; iBranch != treeBranches_.size(); iBranch++) { |
1305 |
|
BranchSpecs brSpecs = treeBranches_.at(iBranch); |
1306 |
|
string coll = brSpecs.inputCollection; |
1307 |
< |
if (cumulativeFlags.count(coll) == 0) cout << "Error: no flags found for collection: " << coll << ", will cause a seg fault" << endl; |
1307 |
> |
if (cumulativeFlags.count(coll) == 0) clog << "Error: no flags found for collection: " << coll << ", will cause a seg fault" << endl; |
1308 |
|
|
1309 |
|
if (coll == "jets") assignTreeBranch(brSpecs,jets.product(), cumulativeFlags.at(coll).back()); |
1310 |
|
else if(coll == "secondary jets") assignTreeBranch(brSpecs,jets.product(), cumulativeFlags.at(coll).back()); |
1328 |
|
&& datasetType_ == "signalMC") assignTreeBranch(brSpecs,stops.product(), cumulativeFlags.at(coll).back()); |
1329 |
|
} // end loop over branches |
1330 |
|
|
1331 |
< |
if (!BNTrees_.at(currentChannelIndex)) { cout << "ERROR: Undefined BNTree. Will likely seg fault." << endl; } |
1331 |
> |
if (!BNTrees_.at(currentChannelIndex)) { clog << "ERROR: Undefined BNTree. Will likely seg fault." << endl; } |
1332 |
|
BNTrees_.at(currentChannelIndex)->Fill(); // only fill if event has passed cuts |
1333 |
|
} |
1334 |
|
|
1355 |
|
else if(comparison == "==") return testValue == cutValue; |
1356 |
|
else if(comparison == "=") return testValue == cutValue; |
1357 |
|
else if(comparison == "!=") return testValue != cutValue; |
1358 |
< |
else {cout << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;} |
1358 |
> |
else {clog << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;} |
1359 |
|
|
1360 |
|
} |
1361 |
|
|
1370 |
|
else if(comparison == "==") return testValue == cutValue; |
1371 |
|
else if(comparison == "=") return testValue == cutValue; |
1372 |
|
else if(comparison == "!=") return testValue != cutValue; |
1373 |
< |
else {cout << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;} |
1373 |
> |
else {clog << "WARNING: invalid comparison operator '" << comparison << "'\n"; return false;} |
1374 |
|
|
1375 |
|
} |
1376 |
|
|
1380 |
|
//initialize to false until a chosen trigger is passed |
1381 |
|
bool triggerDecision = false; |
1382 |
|
|
1383 |
< |
if (printAllTriggers_) cout << "Printing list of all available triggers (which this event may or may not pass):" << endl; |
1383 |
> |
if (printAllTriggers_) clog << "Printing list of all available triggers (which this event may or may not pass):" << endl; |
1384 |
|
//loop over all triggers defined in the event |
1385 |
|
for (BNtriggerCollection::const_iterator trigger = triggerCollection->begin (); trigger != triggerCollection->end (); trigger++){ |
1386 |
|
|
1387 |
< |
if (printAllTriggers_) cout << " " << trigger->name << endl; |
1387 |
> |
if (printAllTriggers_) clog << " " << trigger->name << endl; |
1388 |
|
|
1389 |
|
//we're only interested in triggers that actually passed |
1390 |
|
if(trigger->pass != 1) continue; |
1594 |
|
} |
1595 |
|
|
1596 |
|
|
1597 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1597 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1598 |
|
|
1599 |
|
value = applyFunction(function, value); |
1600 |
|
|
1974 |
|
|
1975 |
|
|
1976 |
|
|
1977 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1977 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
1978 |
|
|
1979 |
|
value = applyFunction(function, value); |
1980 |
|
|
2149 |
|
else if(variable == "correctedD0VertexSig") value = object->correctedD0Vertex / hypot (object->tkD0err, hypot (chosenVertex ()->xError, chosenVertex ()->yError)); |
2150 |
|
else if(variable == "detIso") value = (object->trackIso) / object->pt; |
2151 |
|
else if(variable == "relPFrhoIso") value = ( object->chargedHadronIsoDR03 + max(0.0, object->neutralHadronIsoDR03 + object->photonIsoDR03 - object->AEffDr03*object->rhoPrime) ) / object->pt; |
2152 |
+ |
else if(variable == "relPFrhoIsoEB") value = object->isEB ? ( object->chargedHadronIsoDR03 + max(0.0, object->neutralHadronIsoDR03 + object->photonIsoDR03 - object->AEffDr03*object->rhoPrime) ) / object->pt : -999; |
2153 |
+ |
else if(variable == "relPFrhoIsoEE") value = object->isEE ? ( object->chargedHadronIsoDR03 + max(0.0, object->neutralHadronIsoDR03 + object->photonIsoDR03 - object->AEffDr03*object->rhoPrime) ) / object->pt : -999; |
2154 |
|
else if(variable == "metMT") { |
2155 |
|
if (const BNmet *met = chosenMET ()) |
2156 |
|
{ |
2222 |
|
else value = -999; |
2223 |
|
} |
2224 |
|
|
2225 |
+ |
else if(variable == "looseID"){ |
2226 |
+ |
if (object->isEB) |
2227 |
+ |
{ |
2228 |
+ |
value = fabs(object->delEtaIn) < 0.007 \ |
2229 |
+ |
&& fabs (object->delPhiIn) < 0.15 \ |
2230 |
+ |
&& object->scSigmaIEtaIEta < 0.01 \ |
2231 |
+ |
&& object->hadOverEm < 0.12 \ |
2232 |
+ |
&& fabs (object->correctedD0Vertex) < 0.02 \ |
2233 |
+ |
&& fabs (object->correctedDZ) < 0.2 \ |
2234 |
+ |
&& object->absInvEMinusInvPin < 0.05 \ |
2235 |
+ |
&& object->passConvVeto; |
2236 |
+ |
} |
2237 |
+ |
else |
2238 |
+ |
{ |
2239 |
+ |
value = fabs(object->delEtaIn) < 0.009 \ |
2240 |
+ |
&& fabs (object->delPhiIn) < 0.10 \ |
2241 |
+ |
&& object->scSigmaIEtaIEta < 0.03 \ |
2242 |
+ |
&& object->hadOverEm < 0.10 \ |
2243 |
+ |
&& fabs (object->correctedD0Vertex) < 0.02 \ |
2244 |
+ |
&& fabs (object->correctedDZ) < 0.2 \ |
2245 |
+ |
&& object->absInvEMinusInvPin < 0.05 \ |
2246 |
+ |
&& object->passConvVeto; |
2247 |
+ |
} |
2248 |
+ |
} |
2249 |
+ |
|
2250 |
|
else if(variable == "tightID"){ |
2251 |
|
if (object->isEB) |
2252 |
|
{ |
2406 |
|
|
2407 |
|
|
2408 |
|
|
2409 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2409 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2410 |
|
|
2411 |
|
value = applyFunction(function, value); |
2412 |
|
|
2494 |
|
else if(variable == "electronScaleFactor") value = electronScaleFactor_; |
2495 |
|
else if(variable == "stopCTauScaleFactor") value = stopCTauScaleFactor_; |
2496 |
|
else if(variable == "bTagScaleFactor") value = bTagScaleFactor_; |
2497 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2497 |
> |
else if(variable == "ht") value = chosenHT (); |
2498 |
> |
else if(variable == "leadMuPairInvMass"){ |
2499 |
> |
pair<const BNmuon *, const BNmuon *> muPair = leadMuonPair (); |
2500 |
> |
TLorentzVector p0 (muPair.first->px, muPair.first->py, muPair.first->pz, muPair.first->energy), |
2501 |
> |
p1 (muPair.second->px, muPair.second->py, muPair.second->pz, muPair.second->energy); |
2502 |
> |
value = (p0 + p1).M (); |
2503 |
> |
} |
2504 |
> |
else if(variable == "leadMuPairPt"){ |
2505 |
> |
pair<const BNmuon *, const BNmuon *> muPair = leadMuonPair (); |
2506 |
> |
TVector2 pt0 (muPair.first->px, muPair.first->py), |
2507 |
> |
pt1 (muPair.second->px, muPair.second->py); |
2508 |
> |
pt0 += pt1; |
2509 |
> |
value = pt0.Mod (); |
2510 |
> |
} |
2511 |
> |
else if(variable == "leadElPairInvMass"){ |
2512 |
> |
pair<const BNelectron *, const BNelectron *> muPair = leadElectronPair (); |
2513 |
> |
TLorentzVector p0 (muPair.first->px, muPair.first->py, muPair.first->pz, muPair.first->energy), |
2514 |
> |
p1 (muPair.second->px, muPair.second->py, muPair.second->pz, muPair.second->energy); |
2515 |
> |
value = (p0 + p1).M (); |
2516 |
> |
} |
2517 |
> |
else if(variable == "leadElPairPt"){ |
2518 |
> |
pair<const BNelectron *, const BNelectron *> muPair = leadElectronPair (); |
2519 |
> |
TVector2 pt0 (muPair.first->px, muPair.first->py), |
2520 |
> |
pt1 (muPair.second->px, muPair.second->py); |
2521 |
> |
pt0 += pt1; |
2522 |
> |
value = pt0.Mod (); |
2523 |
> |
} |
2524 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2525 |
|
|
2526 |
|
value = applyFunction(function, value); |
2527 |
|
|
2629 |
|
} |
2630 |
|
|
2631 |
|
|
2632 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2632 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2633 |
|
|
2634 |
|
value = applyFunction(function, value); |
2635 |
|
|
2703 |
|
else if(variable == "pfT1jet10pt") value = object->pfT1jet10pt; |
2704 |
|
else if(variable == "pfT1jet10phi") value = object->pfT1jet10phi; |
2705 |
|
|
2706 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2706 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2707 |
|
|
2708 |
|
value = applyFunction(function, value); |
2709 |
|
|
2865 |
|
|
2866 |
|
|
2867 |
|
|
2868 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2868 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2869 |
|
|
2870 |
|
value = applyFunction(function, value); |
2871 |
|
|
2895 |
|
else if(variable == "charge") value = object->charge; |
2896 |
|
|
2897 |
|
|
2898 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2898 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
2899 |
|
|
2900 |
|
value = applyFunction(function, value); |
2901 |
|
|
3029 |
|
} |
3030 |
|
|
3031 |
|
|
3032 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3032 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3033 |
|
|
3034 |
|
value = applyFunction(function, value); |
3035 |
|
|
3058 |
|
else if(variable == "isGood") value = object->isGood; |
3059 |
|
|
3060 |
|
|
3061 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3061 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3062 |
|
|
3063 |
|
value = applyFunction(function, value); |
3064 |
|
|
3076 |
|
else if(variable == "bx_LUMI_now") value = object->bx_LUMI_now; |
3077 |
|
|
3078 |
|
|
3079 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3079 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3080 |
|
|
3081 |
|
value = applyFunction(function, value); |
3082 |
|
|
3209 |
|
} |
3210 |
|
|
3211 |
|
|
3212 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3212 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3213 |
|
|
3214 |
|
value = applyFunction(function, value); |
3215 |
|
|
3233 |
|
else if(variable == "theta") value = object->theta; |
3234 |
|
|
3235 |
|
|
3236 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3236 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3237 |
|
|
3238 |
|
value = applyFunction(function, value); |
3239 |
|
|
3267 |
|
stringValue = "none"; // stringValue should only be empty if value is filled |
3268 |
|
} |
3269 |
|
|
3270 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3270 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3271 |
|
|
3272 |
|
value = applyFunction(function, value); |
3273 |
|
|
3338 |
|
value = object2->correctedD0; |
3339 |
|
} |
3340 |
|
|
3341 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3341 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3342 |
|
|
3343 |
|
value = applyFunction(function, value); |
3344 |
|
|
3385 |
|
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3386 |
|
value = (pi-threeVector1.Angle(threeVector2)); |
3387 |
|
} |
3388 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3388 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3389 |
|
|
3390 |
|
value = applyFunction(function, value); |
3391 |
|
|
3431 |
|
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3432 |
|
value = (pi-threeVector1.Angle(threeVector2)); |
3433 |
|
} |
3434 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3434 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3435 |
|
|
3436 |
|
value = applyFunction(function, value); |
3437 |
|
|
3487 |
|
value = object2->correctedD0; |
3488 |
|
} |
3489 |
|
|
3490 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3490 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3491 |
|
|
3492 |
|
value = applyFunction(function, value); |
3493 |
|
|
3554 |
|
else if(variable == "muonRelPFdBetaIso"){ |
3555 |
|
value = (object2->pfIsoR04SumChargedHadronPt + max(0.0, object2->pfIsoR04SumNeutralHadronEt + object2->pfIsoR04SumPhotonEt - 0.5*object2->pfIsoR04SumPUPt)) / object2->pt; |
3556 |
|
} |
3557 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3557 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3558 |
|
value = applyFunction(function, value); |
3559 |
|
|
3560 |
|
return value; |
3594 |
|
value = object1->charge*object2->charge; |
3595 |
|
} |
3596 |
|
|
3597 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3597 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3598 |
|
value = applyFunction(function, value); |
3599 |
|
|
3600 |
|
return value; |
3630 |
|
TVector3 threeVector2(object2->px, object2->py, object2->pz); |
3631 |
|
value = (threeVector1.Angle(threeVector2)); |
3632 |
|
} |
3633 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3633 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3634 |
|
value = applyFunction(function, value); |
3635 |
|
|
3636 |
|
return value; |
3645 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3646 |
|
else if(variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3647 |
|
|
3648 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3648 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3649 |
|
value = applyFunction(function, value); |
3650 |
|
|
3651 |
|
return value; |
3662 |
|
|
3663 |
|
if(variable == "deltaPhi") value = fabs(deltaPhi(object1->phi,object2->phi)); |
3664 |
|
|
3665 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3665 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3666 |
|
value = applyFunction(function, value); |
3667 |
|
|
3668 |
|
return value; |
3707 |
|
value = object1->charge*object2->charge; |
3708 |
|
} |
3709 |
|
|
3710 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3710 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3711 |
|
value = applyFunction(function, value); |
3712 |
|
|
3713 |
|
return value; |
3724 |
|
else if(variable == "muonPhi") value = object1->phi; |
3725 |
|
else if(variable == "pthat") value = object2->pthat; |
3726 |
|
else if(variable == "relPFdBetaIso") value = (object1->pfIsoR04SumChargedHadronPt + max(0.0, object1->pfIsoR04SumNeutralHadronEt + object1->pfIsoR04SumPhotonEt - 0.5*object1->pfIsoR04SumPUPt)) / object1->pt; |
3727 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3727 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3728 |
|
value = applyFunction(function, value); |
3729 |
|
|
3730 |
|
return value; |
3759 |
|
value = object1->charge*object2->charge; |
3760 |
|
} |
3761 |
|
|
3762 |
< |
else{cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3762 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3763 |
|
value = applyFunction(function, value); |
3764 |
|
|
3765 |
|
return value; |
3784 |
|
else if(variable == "chargeProduct"){ |
3785 |
|
value = object1->charge*object2->charge; |
3786 |
|
} |
3787 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3787 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3788 |
|
value = applyFunction(function, value); |
3789 |
|
return value; |
3790 |
|
|
3812 |
|
value = object1->charge*object2->charge; |
3813 |
|
} |
3814 |
|
|
3815 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3815 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3816 |
|
value = applyFunction(function, value); |
3817 |
|
return value; |
3818 |
|
} |
3834 |
|
value = object1->charge*object2->charge; |
3835 |
|
} |
3836 |
|
|
3837 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3837 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3838 |
|
value = applyFunction(function, value); |
3839 |
|
return value; |
3840 |
|
} |
3856 |
|
value = object1->charge*object2->charge; |
3857 |
|
} |
3858 |
|
|
3859 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3859 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3860 |
|
value = applyFunction(function, value); |
3861 |
|
return value; |
3862 |
|
} |
3871 |
|
value = object1->charge*object2->charge; |
3872 |
|
} |
3873 |
|
|
3874 |
< |
else{std::cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3874 |
> |
else{clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999;} |
3875 |
|
value = applyFunction(function, value); |
3876 |
|
return value; |
3877 |
|
} |
3891 |
|
else if (variable == "caloTotDeltaRp5_RhoCorr") value = getTrkCaloTotRhoCorr(object1); |
3892 |
|
else if (variable == "caloTotDeltaRp5ByP_RhoCorr") value = getTrkCaloTotRhoCorr(object1) / pMag; |
3893 |
|
|
3894 |
< |
else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3894 |
> |
else { clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3895 |
|
|
3896 |
|
value = applyFunction(function, value); |
3897 |
|
|
3913 |
|
stringValue = "none"; |
3914 |
|
} |
3915 |
|
|
3916 |
< |
else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3916 |
> |
else { clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3917 |
|
|
3918 |
|
value = applyFunction(function, value); |
3919 |
|
|
3929 |
|
|
3930 |
|
if (variable == "deltaR") value = deltaR(object1->eta,object1->phi,object2->eta,object2->phi); |
3931 |
|
|
3932 |
< |
else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3932 |
> |
else { clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
3933 |
|
|
3934 |
|
value = applyFunction(function, value); |
3935 |
|
|
4045 |
|
|
4046 |
|
|
4047 |
|
|
4048 |
< |
else { cout << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
4048 |
> |
else { clog << "WARNING: invalid variable '" << variable << "'\n"; value = -999; } |
4049 |
|
|
4050 |
|
value = applyFunction(function, value); |
4051 |
|
|
4107 |
|
// Return the pile-up (rho) corrected isolation energy, i.e., the total calorimeter energy around the candidate track. |
4108 |
|
if (!useTrackCaloRhoCorr_) return -99; |
4109 |
|
// if (!rhokt6CaloJetsHandle_) { |
4110 |
< |
// cout << "ERROR [getTrkCaloTotRhoCorr]: The collection rhokt6CaloJetsHandle is not available!" << endl; |
4110 |
> |
// clog << "ERROR [getTrkCaloTotRhoCorr]: The collection rhokt6CaloJetsHandle is not available!" << endl; |
4111 |
|
// return -99; |
4112 |
|
// } |
4113 |
|
double radDeltaRCone = 0.5; |
4129 |
|
double etaEcal, phiEcal; |
4130 |
|
ifstream DeadEcalFile(deadEcalFile_); |
4131 |
|
if(!DeadEcalFile) { |
4132 |
< |
cout << "Error: DeadEcalFile has not been found." << endl; |
4132 |
> |
clog << "Error: DeadEcalFile has not been found." << endl; |
4133 |
|
return; |
4134 |
|
} |
4135 |
|
if(DeadEcalVec.size()!= 0){ |
4136 |
< |
cout << "Error: DeadEcalVec has a nonzero size" << endl; |
4136 |
> |
clog << "Error: DeadEcalVec has a nonzero size" << endl; |
4137 |
|
return; |
4138 |
|
} |
4139 |
|
while(!DeadEcalFile.eof()) |
4144 |
|
newChan.phiEcal = phiEcal; |
4145 |
|
DeadEcalVec.push_back(newChan); |
4146 |
|
} |
4147 |
< |
if(DeadEcalVec.size() == 0) cout << "Warning: No dead Ecal channels have been found." << endl; |
4147 |
> |
if(DeadEcalVec.size() == 0) clog << "Warning: No dead Ecal channels have been found." << endl; |
4148 |
|
} |
4149 |
|
|
4150 |
|
//if a track is found within dR<0.05 of a dead Ecal channel value = 1, otherwise value = 0 |
4184 |
|
else if(function == "log") value = log10(value); |
4185 |
|
|
4186 |
|
else if(function == "") value = value; |
4187 |
< |
else{cout << "WARNING: invalid function '" << function << "'\n";} |
4187 |
> |
else{clog << "WARNING: invalid function '" << function << "'\n";} |
4188 |
|
|
4189 |
|
return value; |
4190 |
|
|
4410 |
|
void OSUAnalysis::assignTreeBranch(BranchSpecs parameters, InputCollection inputCollection, flagPair flags){ |
4411 |
|
// This function is similar to fill1DHistogram(), but instead of filling a histogram it assigns a value to a variable for the BNTree |
4412 |
|
|
4413 |
< |
if (BNTreeBranchVals_.count(parameters.name)==0) cout << "Error[assignTreeBranch]: trying to assign value to " << parameters.name << " that does not have a branch set up. Will likely seg fault." << endl; |
4413 |
> |
if (BNTreeBranchVals_.count(parameters.name)==0) clog << "Error[assignTreeBranch]: trying to assign value to " << parameters.name << " that does not have a branch set up. Will likely seg fault." << endl; |
4414 |
|
for (uint object = 0; object != inputCollection->size(); object++) { |
4415 |
|
|
4416 |
|
if (!plotAllObjectsInPassingEvents_ && !flags.at(object).second) continue; |
4451 |
|
|
4452 |
|
if (printEventInfo_) { |
4453 |
|
// Write information about event to screen, for testing purposes. |
4454 |
< |
cout << " Info for event: value for histogram " << histo->GetName() << ": " << value << endl; |
4454 |
> |
clog << " Info for event: value for histogram " << histo->GetName() << ": " << value << endl; |
4455 |
|
} |
4456 |
|
|
4457 |
|
} |
4603 |
|
|
4604 |
|
double currentDeltaR = deltaR(object->eta,object->phi,mcparticle->eta,mcparticle->phi); |
4605 |
|
if(currentDeltaR > 0.05) continue; |
4606 |
< |
// cout << setprecision(3) << setw(20) |
4606 |
> |
// clog << setprecision(3) << setw(20) |
4607 |
|
// << "\tcurrentParticle: eta = " << mcparticles->at(mcparticle - mcparticles->begin()).eta |
4608 |
|
// << setw(20) |
4609 |
|
// << "\tphi = " << mcparticles->at(mcparticle - mcparticles->begin()).phi |
4622 |
|
} |
4623 |
|
|
4624 |
|
} |
4625 |
< |
// if(bestMatchDeltaR != 999) cout << "bestMatch: deltaR = " << bestMatchDeltaR << " id = " << mcparticles->at(bestMatchIndex).id << " motherId = " << mcparticles->at(bestMatchIndex).motherId << endl; |
4626 |
< |
// else cout << "no match found..." << endl; |
4625 |
> |
// if(bestMatchDeltaR != 999) clog << "bestMatch: deltaR = " << bestMatchDeltaR << " id = " << mcparticles->at(bestMatchIndex).id << " motherId = " << mcparticles->at(bestMatchIndex).motherId << endl; |
4626 |
> |
// else clog << "no match found..." << endl; |
4627 |
|
return bestMatchIndex; |
4628 |
|
|
4629 |
|
} |
4807 |
|
return chosenMuon; |
4808 |
|
} |
4809 |
|
|
4810 |
+ |
double |
4811 |
+ |
OSUAnalysis::chosenHT () |
4812 |
+ |
{ |
4813 |
+ |
double chosenHT = 0.0; |
4814 |
+ |
if(cumulativeFlags.find ("jets") != cumulativeFlags.end ()){ |
4815 |
+ |
flagPair jetFlags; |
4816 |
+ |
for (int i = cumulativeFlags.at("jets").size() - 1; i >= 0; i--){ |
4817 |
+ |
if (cumulativeFlags.at("jets").at(i).size()){ |
4818 |
+ |
jetFlags = cumulativeFlags.at("jets").at(i); |
4819 |
+ |
break; |
4820 |
+ |
} |
4821 |
+ |
} |
4822 |
+ |
for (uint jetIndex = 0; jetIndex != jetFlags.size(); jetIndex++){ |
4823 |
+ |
if(!jetFlags.at(jetIndex).first) continue; |
4824 |
+ |
chosenHT += jets->at(jetIndex).pt; |
4825 |
+ |
} |
4826 |
+ |
} |
4827 |
+ |
|
4828 |
+ |
return chosenHT; |
4829 |
+ |
} |
4830 |
+ |
|
4831 |
+ |
pair<const BNmuon *, const BNmuon *> |
4832 |
+ |
OSUAnalysis::leadMuonPair () |
4833 |
+ |
{ |
4834 |
+ |
pair<const BNmuon *, const BNmuon *> leadMuonPair; |
4835 |
+ |
leadMuonPair.first = leadMuonPair.second = 0; |
4836 |
+ |
|
4837 |
+ |
if(cumulativeFlags.find ("muons") != cumulativeFlags.end ()){ |
4838 |
+ |
flagPair muonFlags; |
4839 |
+ |
for (int i = cumulativeFlags.at("muons").size() - 1; i >= 0; i--){ |
4840 |
+ |
if (cumulativeFlags.at("muons").at(i).size()){ |
4841 |
+ |
muonFlags = cumulativeFlags.at("muons").at(i); |
4842 |
+ |
break; |
4843 |
+ |
} |
4844 |
+ |
} |
4845 |
+ |
for (uint muonIndex0 = 0; muonIndex0 != muonFlags.size(); muonIndex0++){ |
4846 |
+ |
if(!muonFlags.at(muonIndex0).first) continue; |
4847 |
+ |
for (uint muonIndex1 = muonIndex0 + 1; muonIndex1 < muonFlags.size(); muonIndex1++){ |
4848 |
+ |
if(!muonFlags.at(muonIndex1).first) continue; |
4849 |
+ |
const BNmuon *mu0 = & muons->at(muonIndex0); |
4850 |
+ |
const BNmuon *mu1 = & muons->at(muonIndex1); |
4851 |
+ |
if(leadMuonPair.first == 0 || leadMuonPair.second == 0){ |
4852 |
+ |
leadMuonPair.first = mu0; |
4853 |
+ |
leadMuonPair.second = mu1; |
4854 |
+ |
} |
4855 |
+ |
else{ |
4856 |
+ |
TVector2 newPt0 (mu0->px, mu0->py), |
4857 |
+ |
newPt1 (mu1->px, mu1->py), |
4858 |
+ |
oldPt0 (leadMuonPair.first->px, leadMuonPair.first->py), |
4859 |
+ |
oldPt1 (leadMuonPair.second->px, leadMuonPair.second->py); |
4860 |
+ |
newPt0 += newPt1; |
4861 |
+ |
oldPt0 += oldPt1; |
4862 |
+ |
if(newPt0.Mod() > oldPt0.Mod()) |
4863 |
+ |
{ |
4864 |
+ |
leadMuonPair.first = mu0; |
4865 |
+ |
leadMuonPair.second = mu1; |
4866 |
+ |
} |
4867 |
+ |
} |
4868 |
+ |
} |
4869 |
+ |
} |
4870 |
+ |
} |
4871 |
+ |
|
4872 |
+ |
return leadMuonPair; |
4873 |
+ |
} |
4874 |
+ |
|
4875 |
+ |
pair<const BNelectron *, const BNelectron *> |
4876 |
+ |
OSUAnalysis::leadElectronPair () |
4877 |
+ |
{ |
4878 |
+ |
pair<const BNelectron *, const BNelectron *> leadElectronPair; |
4879 |
+ |
leadElectronPair.first = leadElectronPair.second = 0; |
4880 |
+ |
if(cumulativeFlags.find ("electrons") != cumulativeFlags.end ()){ |
4881 |
+ |
flagPair electronFlags; |
4882 |
+ |
for (int i = cumulativeFlags.at("electrons").size() - 1; i >= 0; i--){ |
4883 |
+ |
if (cumulativeFlags.at("electrons").at(i).size()){ |
4884 |
+ |
electronFlags = cumulativeFlags.at("electrons").at(i); |
4885 |
+ |
break; |
4886 |
+ |
} |
4887 |
+ |
} |
4888 |
+ |
for (uint electronIndex0 = 0; electronIndex0 != electronFlags.size(); electronIndex0++){ |
4889 |
+ |
if(!electronFlags.at(electronIndex0).first) continue; |
4890 |
+ |
for (uint electronIndex1 = electronIndex0 + 1; electronIndex1 < electronFlags.size(); electronIndex1++){ |
4891 |
+ |
if(!electronFlags.at(electronIndex1).first) continue; |
4892 |
+ |
const BNelectron *el0 = & electrons->at(electronIndex0); |
4893 |
+ |
const BNelectron *el1 = & electrons->at(electronIndex1); |
4894 |
+ |
if(leadElectronPair.first == 0 || leadElectronPair.second == 0){ |
4895 |
+ |
leadElectronPair.first = el0; |
4896 |
+ |
leadElectronPair.second = el1; |
4897 |
+ |
} |
4898 |
+ |
else{ |
4899 |
+ |
TVector2 newPt0 (el0->px, el0->py), |
4900 |
+ |
newPt1 (el1->px, el1->py), |
4901 |
+ |
oldPt0 (leadElectronPair.first->px, leadElectronPair.first->py), |
4902 |
+ |
oldPt1 (leadElectronPair.second->px, leadElectronPair.second->py); |
4903 |
+ |
newPt0 += newPt1; |
4904 |
+ |
oldPt0 += oldPt1; |
4905 |
+ |
if(newPt0.Mod() > oldPt0.Mod()) |
4906 |
+ |
{ |
4907 |
+ |
leadElectronPair.first = el0; |
4908 |
+ |
leadElectronPair.second = el1; |
4909 |
+ |
} |
4910 |
+ |
} |
4911 |
+ |
} |
4912 |
+ |
} |
4913 |
+ |
} |
4914 |
+ |
|
4915 |
+ |
return leadElectronPair; |
4916 |
+ |
} |
4917 |
|
|
4918 |
|
DEFINE_FWK_MODULE(OSUAnalysis); |