ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/AnaTools/plugins/OSUAnalysis.cc
(Generate patch)

Comparing UserCode/OSUT3Analysis/AnaTools/plugins/OSUAnalysis.cc (file contents):
Revision 1.97 by biliu, Tue Jul 9 20:21:51 2013 UTC vs.
Revision 1.98 by ahart, Thu Jul 11 16:21:11 2013 UTC

# Line 78 | Line 78 | OSUAnalysis::OSUAnalysis (const edm::Par
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  
# Line 343 | Line 343 | OSUAnalysis::OSUAnalysis (const edm::Par
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;
# Line 369 | Line 369 | OSUAnalysis::OSUAnalysis (const edm::Par
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  
# Line 468 | Line 468 | OSUAnalysis::OSUAnalysis (const edm::Par
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){
# Line 647 | Line 647 | OSUAnalysis::~OSUAnalysis ()
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  
# Line 721 | Line 721 | OSUAnalysis::produce (edm::Event &event,
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  
# Line 1000 | Line 1000 | OSUAnalysis::produce (edm::Event &event,
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
# Line 1022 | Line 1022 | OSUAnalysis::produce (edm::Event &event,
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;
# Line 1304 | Line 1304 | OSUAnalysis::produce (edm::Event &event,
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());
# Line 1328 | Line 1328 | OSUAnalysis::produce (edm::Event &event,
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  
# Line 1355 | Line 1355 | OSUAnalysis::evaluateComparison (double
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  
# Line 1370 | Line 1370 | OSUAnalysis::evaluateComparison (string
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  
# Line 1380 | Line 1380 | OSUAnalysis::evaluateTriggers (vector<st
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;
# Line 1594 | Line 1594 | OSUAnalysis::valueLookup (const BNjet* o
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  
# Line 1974 | Line 1974 | OSUAnalysis::valueLookup (const BNmuon*
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  
# Line 2149 | Line 2149 | OSUAnalysis::valueLookup (const BNelectr
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        {
# Line 2220 | Line 2222 | OSUAnalysis::valueLookup (const BNelectr
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        {
# Line 2379 | Line 2406 | OSUAnalysis::valueLookup (const BNelectr
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  
# Line 2467 | Line 2494 | OSUAnalysis::valueLookup (const BNevent*
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  
# Line 2575 | Line 2629 | OSUAnalysis::valueLookup (const BNtau* o
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  
# Line 2649 | Line 2703 | OSUAnalysis::valueLookup (const BNmet* o
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  
# Line 2811 | Line 2865 | OSUAnalysis::valueLookup (const BNtrack*
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  
# Line 2841 | Line 2895 | OSUAnalysis::valueLookup (const BNgenjet
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  
# Line 2975 | Line 3029 | OSUAnalysis::valueLookup (const BNmcpart
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  
# Line 3004 | Line 3058 | OSUAnalysis::valueLookup (const BNprimar
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  
# Line 3022 | Line 3076 | OSUAnalysis::valueLookup (const BNbxlumi
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  
# Line 3155 | Line 3209 | OSUAnalysis::valueLookup (const BNphoton
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  
# Line 3179 | Line 3233 | OSUAnalysis::valueLookup (const BNsuperc
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  
# Line 3213 | Line 3267 | OSUAnalysis::valueLookup (const BNtrigob
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  
# Line 3284 | Line 3338 | OSUAnalysis::valueLookup (const BNmuon*
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  
# Line 3331 | Line 3385 | OSUAnalysis::valueLookup (const BNmuon*
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  
# Line 3377 | Line 3431 | OSUAnalysis::valueLookup (const BNelectr
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  
# Line 3433 | Line 3487 | OSUAnalysis::valueLookup (const BNelectr
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  
# Line 3500 | Line 3554 | OSUAnalysis::valueLookup (const BNelectr
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;
# Line 3540 | Line 3594 | OSUAnalysis::valueLookup (const BNelectr
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;
# Line 3576 | Line 3630 | OSUAnalysis::valueLookup (const BNphoton
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;
# Line 3591 | Line 3645 | OSUAnalysis::valueLookup (const BNtrack*
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;
# Line 3608 | Line 3662 | OSUAnalysis::valueLookup (const BNmet* o
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;
# Line 3653 | Line 3707 | OSUAnalysis::valueLookup (const BNmuon*
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;
# Line 3670 | Line 3724 | OSUAnalysis::valueLookup (const BNmuon*
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;
# Line 3705 | Line 3759 | OSUAnalysis::valueLookup (const BNjet* o
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;
# Line 3730 | Line 3784 | OSUAnalysis::valueLookup (const BNelectr
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  
# Line 3758 | Line 3812 | OSUAnalysis::valueLookup (const BNmuon*
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   }
# Line 3780 | Line 3834 | OSUAnalysis::valueLookup (const BNtau* o
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   }
# Line 3802 | Line 3856 | OSUAnalysis::valueLookup (const BNmuon*
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   }
# Line 3817 | Line 3871 | OSUAnalysis::valueLookup (const BNtau* o
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   }
# Line 3837 | Line 3891 | OSUAnalysis::valueLookup (const BNtrack*
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  
# Line 3859 | Line 3913 | OSUAnalysis::valueLookup (const BNelectr
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  
# Line 3875 | Line 3929 | OSUAnalysis::valueLookup (const BNmuon*
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  
# Line 3991 | Line 4045 | OSUAnalysis::valueLookup (const BNstop*
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  
# Line 4053 | Line 4107 | OSUAnalysis::getTrkCaloTotRhoCorr(const
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;
# Line 4075 | Line 4129 | OSUAnalysis::WriteDeadEcal (){
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())
# Line 4090 | Line 4144 | OSUAnalysis::WriteDeadEcal (){
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
# Line 4130 | Line 4184 | OSUAnalysis::applyFunction(string functi
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  
# Line 4356 | Line 4410 | template <class InputCollection>
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;
# Line 4397 | Line 4451 | void OSUAnalysis::fill1DHistogram(TH1* h
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    }
# Line 4549 | Line 4603 | int OSUAnalysis::getGenMatchedParticleIn
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
# Line 4568 | Line 4622 | int OSUAnalysis::getGenMatchedParticleIn
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   }
# Line 4753 | Line 4807 | OSUAnalysis::chosenMuon ()
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);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines