ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitHzz4l/Selection/src/applySelection.cc
(Generate patch)

Comparing UserCode/MitHzz4l/Selection/src/applySelection.cc (file contents):
Revision 1.60 by dkralph, Tue Oct 23 11:39:21 2012 UTC vs.
Revision 1.73 by anlevin, Tue Feb 5 09:53:47 2013 UTC

# Line 67 | Line 67 | using namespace std;
67  
68   #include "TriggerUtils.h"
69   #include "PassHLT.h"
70 #include "Angles.h"
70   #include "KinematicsStruct.h"
71   #include "InfoStruct.h"
72   #include "GenInfoStruct.h"
# Line 82 | Line 81 | using namespace std;
81  
82   #include "SimpleLepton.h"
83  
84 + #include "Cintex/Cintex.h"
85 +
86   #ifndef CMSSW_BASE
87   #define CMSSW_BASE "../"
88   #endif
# Line 99 | Line 100 | vector<unsigned> cutvec;
100   vector<vector<unsigned> > zcutvec;
101   vector<vector<unsigned> > zzcutvec;
102   map<unsigned,float>       evtrhoMap;
103 + TrigInfo ti;
104   vector<string> cutstrs;
105   bool passes_HLT;
106   vector<bool>   PFnoPUflag;;
107   map<TString, map<TString,int>* > counts;
108   ElectronMomentumCorrection electron_momentum_correction;
109   MuCorr *muCorr;
110 + void addDummyZ2Lepotons(EventData &ret4l);
111 + void setNtupleVals(ControlFlags &ctrl, EventData &ret4l, InfoStruct &evtinfo, Angles &angles, KinematicsStruct &kine,
112 +                   JetInfoStruct &ji, WeightStruct &weights, EventHeader *info,  Array<Muon> *muonArr, Array<Electron> *electronArr, Array<PFJet> *jetArr, Array<PFMet> *metArr,
113 +                   vector<SimpleLepton> &simpleLeptonJets, FactorizedJetCorrector *fJetCorrector, Array<PileupInfo> *puArr,
114 +                   Array<PileupEnergyDensity> *puDArr, JetIDMVA *fJetIDMVA, Array<Vertex> *vtxArr, bitset<1024> &triggerBits,
115 +                   TriggerTable *hltTable, Array<TriggerObject> *hltObjArr, TriggerObjectsTable *fTrigObjs, AngleTuple *nt);
116   //----------------------------------------------------------------------------
117   void initRunLumiRangeMap(ControlFlags &ctrl)
118   //----------------------------------------------------------------------------
# Line 126 | Line 134 | void initRunLumiRangeMap(ControlFlags &c
134   int main(int argc, char** argv)
135   //----------------------------------------------------------------------------
136   {
137 +
138    vector<TString> cuts;
139    cuts.push_back("start"); // NOTE: is incremented in ReferenceSelection, so if you turn on JSONS be careful
140    cuts.push_back("trigger");
# Line 136 | Line 145 | int main(int argc, char** argv)
145    cuts.push_back("m4l>70");
146    cuts.push_back("mZ2>12");
147    cuts.push_back("m4l>100");
148 +  cuts.push_back("m4l > 100 && >= 1 jets");
149 +  cuts.push_back("m4l > 100 && 2 jets");
150 +  cuts.push_back("m4l > 100 && fisher > 0.4");
151  
152    for(unsigned icut=0; icut<cuts.size(); icut++)
153      counts[cuts[icut]] = new map<TString,int>;
# Line 161 | Line 173 | int main(int argc, char** argv)
173    //--------------------------------------------------------------------------------------------------------------
174    ControlFlags ctrl;
175    parse_args( argc, argv, ctrl );
164  if( ctrl.inputfiles.empty() &&ctrl.inputfile.empty() )
165    {
166      cerr << "usage: applySelection.exe <flags> " << endl;
167      cerr << "\tmandoatory flags : " << endl;
168      cerr << "\t--inputfiles |  file containing a list of ntuples to run over" << endl;
169      cerr << "\t--inputfile |  a file to run over" << endl;
170      cerr << "\t--outputfile | file to store  selected evet" << endl;
171      return 1;
172    }
176    ctrl.dump();
177    cout << "\n\nNOTE: now setting era with arguments... double check this doesnt mess something else up\n\n" << endl;
175  bool doJets = true;//TString(ctrl.mcfmfname).Contains("doJets");
178    assert(ctrl.doFSR);
179  
180    //
# Line 191 | Line 193 | int main(int argc, char** argv)
193        if(fname.find("/store/") != string::npos) fname = "root://eoscms//"+fname;
194        cout << "adding inputfile : " << fname.c_str() << endl;
195        entrymap[string(fname.c_str())] = unskimmedEntries(fname.c_str());
196 <      cout << "unskimmed entries: " << entrymap[string(fname.c_str())] << endl;
196 >      cerr << "unskimmed entries: " << entrymap[string(fname.c_str())] << endl;
197        total_unskimmed += entrymap[string(fname.c_str())];
198        chain->AddFile(fname.c_str());
199        hltchain->AddFile(fname.c_str());
# Line 202 | Line 204 | int main(int argc, char** argv)
204      cout << "adding inputfile : " << ctrl.inputfile.c_str() << endl;
205      unsigned unsk_ents = unskimmedEntries(ctrl.inputfile.c_str());
206      entrymap[string(ctrl.inputfile.c_str())] = unsk_ents;
207 <    cout << "unskimmed entries: " << unsk_ents << endl;
207 >    cerr << "unskimmed entries: " << unsk_ents << endl;
208      total_unskimmed += unsk_ents;
209      chain->AddFile(ctrl.inputfile.c_str());
210      hltchain->AddFile(ctrl.inputfile.c_str());
# Line 222 | Line 224 | int main(int argc, char** argv)
224    string xspath = (cmsswpath+string("/MitPhysics/data/xs.dat"));
225    cout << "xspath: " << xspath.c_str() << endl;
226    SimpleTable xstab(xspath.c_str());
227 +  if(ctrl.mc) {
228 +    if(ctrl.use_xs_weights) getWeight(xstab,entrymap,chain); // test *now* whether we've got the xs in here, so it fails before it creates the output
229 +  }
230 +
231 +  //root will write to this temporary file instead of to memory and the selection will run faster
232  
233    //
234    // Setup
# Line 238 | Line 245 | int main(int argc, char** argv)
245    nt.makeAngleBranch(angles);
246    nt.makeKinematicsBranch(kine);
247    nt.makeInfoBranch(evtinfo);
248 <  if(doJets)
249 <    nt.makeJetInfoBranch(ji);
248 >  nt.makeJetInfoBranch(ji);
249 >  //nt.makeJetAngleBranches("DataStruct/data/jetAngleVars.txt");
250 >
251 >  FOTuple *foTree=0;
252 >  if(ctrl.fakeScheme != "none") {
253 >    foTree = new FOTuple( nt.getFile(), (const char*)"FOtree");
254 >    foTree->makeInfoBranch(evtinfo);
255 >    foTree->makeFailedLeptonBranch(failingLeptons);
256 >    foTree->makePassedLeptonBranch(passingLeptons);
257 >  }
258  
259    int genSampleType(0);
260    if(ctrl.mc) {
# Line 252 | Line 267 | int main(int argc, char** argv)
267        } else
268          nt.makeGenInfoBranch(geninfo);
269      }
270 <    initEfficiencyWeights();
256 <    // initPUWeights();
270 >    if(ctrl.use_eff_weights) initEfficiencyWeights();
271    } else {
272      if(!(ctrl.noJSON) )
273        initRunLumiRangeMap(ctrl);
# Line 261 | Line 275 | int main(int argc, char** argv)
275  
276    initElectronIDMVAV1();
277    initTrigger();
264  TrigInfo ti;
278    initAnalysisTriggers(ti);
279 +  initMela(ctrl);
280 +  initMassErrors();
281 +  ti.dump();
282 +
283 +  TFile tmp_file("tmp_file.root");
284 +
285 +  if(ctrl.do_eregression) {
286 +    string regPath("EGamma/EGammaAnalysisTools/data/eleEnergyRegWeights_V1.root");
287 +    // if(TString(getenv("HOSTNAME")).Contains(TRegexp("t3[bd][te][cs][hk]")))
288 +    regPath = cmsswpath + "/" + regPath;
289 +    electron_momentum_correction.initialize_regression(regPath);
290 +  }
291 +
292    if(ctrl.do_escale) {
267    electron_momentum_correction.initialize_regression("EGamma/EGammaAnalysisTools/data/eleEnergyRegWeights_V1.root");
293      if(ctrl.mc) {
294 <      if(ctrl.era == 2011) assert(0); // don't know which file to use yet
294 >      if(ctrl.era == 2011) ctrl.smearing_scaling_dataset = "Fall11";
295        else                 ctrl.smearing_scaling_dataset = "Summer12_DR53X_HCP2012";
296      } else {
297 <      if(ctrl.era == 2011) assert(0); // don't know which file to use yet
298 <      else                 ctrl.smearing_scaling_dataset = "2012Jul13ReReco";
297 >      if(ctrl.era == 2011) ctrl.smearing_scaling_dataset = "Jan16ReReco";
298 >      else                 ctrl.smearing_scaling_dataset = "Moriond2013";
299      }
300    }
301    if(ctrl.correct_muon_momentum) {
# Line 283 | Line 308 | int main(int argc, char** argv)
308    vector<JetCorrectorParameters> correctionParameters;
309    FactorizedJetCorrector *fJetCorrector;
310    JetIDMVA *fJetIDMVA;
311 <  if(doJets) {
287 <    initJets(ctrl, cmsswpath, fJetCorrParsv, correctionParameters, fJetCorrector, fJetIDMVA);
288 <  }
311 >  initJets(ctrl, cmsswpath, fJetCorrParsv, correctionParameters, fJetCorrector, fJetIDMVA);
312  
313    //
314    // Setup tree I/O
# Line 349 | Line 372 | int main(int argc, char** argv)
372      ctrl.debug = false;
373  
374    int lastHltEntry=-2;
375 <  for(UInt_t ientry=0; ientry<imax; ientry++)
376 <    {
377 <      chain->GetEntry(ientry);
378 <      if(!(ientry%1000)) cerr << "entry: " << ientry << " ( / " << imax << " )" << endl;
379 <
380 <      if( ctrl.debug ) {
381 <        cout << "-----------------------------------------------------------------" << endl;
382 <        cout << "-----------------------------------------------------------------" << endl;
383 <        cout << "Run: " << info->RunNum()
384 <             << "\tEvt: " << info->EvtNum()
385 <             << "\tLumi: " << info->LumiSec()
386 <             << endl;
387 <        cerr << "Run: " << info->RunNum()
388 <             << "\tEvt: " << info->EvtNum()
389 <             << "\tLumi: " << info->LumiSec()
390 <             << endl;
391 <        cout << "-----------------------------------------------------------------" << endl;
392 <      }
375 >  for(UInt_t ientry=0; ientry<imax; ientry++) {
376 >    chain->GetEntry(ientry);
377 >    if(!(ientry%1000)) cerr << "entry: " << ientry << " ( / " << imax << " )" << endl;
378 >
379 >    //if(info->EvtNum() != 217502611) continue;
380 >
381 >    increment(counts,"start");
382 >    if( ctrl.debug ) {
383 >      cout << "-----------------------------------------------------------------" << endl;
384 >      cout << "-----------------------------------------------------------------" << endl;
385 >      cout << "Run: " << info->RunNum()
386 >           << "\tEvt: " << info->EvtNum()
387 >           << "\tLumi: " << info->LumiSec()
388 >           << endl;
389 >      cerr << "Run: " << info->RunNum()
390 >           << "\tEvt: " << info->EvtNum()
391 >           << "\tLumi: " << info->LumiSec()
392 >           << endl;
393 >      cout << "-----------------------------------------------------------------" << endl;
394 >    }
395  
396 <      runchain->GetEvent(info->RunEntry());
397 <      hltchain->GetEntry(runInfo->HltEntry());
398 <      hltTable->Clear();
399 <      fillTriggerNames(hltTable, hltTableStrings );
400 <      if(ctrl.debug && (lastHltEntry != runInfo->HltEntry())) hltTable->Print();
401 <      lastHltEntry = runInfo->HltEntry();
402 <      fillTriggerBits( hltTable, trigMask, triggerBits );
403 <      setHLTObjectRelations( hltObjArr, hltRelsArr, hltTableStrings, hltLabelStrings, fTrigObjs );
404 <      // printTriggerObjs( hltTable, fTrigObjs);
396 >    runchain->GetEvent(info->RunEntry());
397 >    hltchain->GetEntry(runInfo->HltEntry());
398 >    hltTable->Clear();
399 >    fillTriggerNames(hltTable, hltTableStrings );
400 >    // if(ctrl.debug && (lastHltEntry != runInfo->HltEntry())) hltTable->Print();
401 >    lastHltEntry = runInfo->HltEntry();
402 >    fillTriggerBits( hltTable, trigMask, triggerBits );
403 >    setHLTObjectRelations( hltObjArr, hltRelsArr, hltTableStrings, hltLabelStrings, fTrigObjs );
404 >    // printTriggerObjs( hltTable, fTrigObjs);
405        
406 <      string fname = string(chain->GetFile()->GetEndpointUrl()->GetFile());
407 <      if(ctrl.debug) cout << "era is " << ctrl.era << endl;
408 <      if( ctrl.era == 0  ) {
409 <        setEra( fname, ctrl );
410 <        if(ctrl.debug) cout << "era is now " << ctrl.era << endl;
411 <      }
406 >    string fname = string(chain->GetFile()->GetEndpointUrl()->GetFile());
407 >    if(ctrl.debug) cout << "era is " << ctrl.era << endl;
408 >    if( ctrl.era == 0  ) {
409 >      setEra( fname, ctrl );
410 >      if(ctrl.debug) cout << "era is now " << ctrl.era << endl;
411 >    }
412  
413 <      // pfNoPU
414 <      PFnoPUflag.clear();
415 <      int pfnopu_size = makePFnoPUArray( pfArr, PFnoPUflag, vtxArr );
416 <      assert(pfnopu_size == pfArr->GetEntries());
417 <
418 <      // trigger
419 <      if( string(chain->GetFile()->GetEndpointUrl()->GetFile()) != currentFile ) {
420 <        currentFile = string(chain->GetFile()->GetEndpointUrl()->GetFile());
421 <      }
422 <      if( ctrl.debug ) cout << "file is : " << currentFile  << endl;
423 <      passes_HLT = passHLT(ctrl, triggerBits, ti, info->RunNum()); // NOTE: run value is not used if it's MC
413 >    // pfNoPU
414 >    PFnoPUflag.clear();
415 >    int pfnopu_size = makePFnoPUArray( pfArr, PFnoPUflag, vtxArr );
416 >    assert(pfnopu_size == pfArr->GetEntries());
417 >
418 >    // trigger
419 >    if( string(chain->GetFile()->GetEndpointUrl()->GetFile()) != currentFile ) {
420 >      currentFile = string(chain->GetFile()->GetEndpointUrl()->GetFile());
421 >    }
422 >    if( ctrl.debug ) cout << "file is : " << currentFile  << endl;
423 >    passes_HLT = passHLT(ctrl, triggerBits, ti, info->RunNum(), hltTable, fTrigObjs); // NOTE: run value is not used if it's MC
424  
425 <      // data/MC
426 <      if(ctrl.mc) {
427 <        if(ctrl.fillGen) fillGenInfo( mcArr, mcEvtInfo, geninfo, genSampleType, ctrl);
428 <        // NOTE: xs weight and npuw are reset in merge.cc
425 >    // data/MC
426 >    if(ctrl.mc) {
427 >      if(ctrl.fillGen) fillGenInfo( mcArr, mcEvtInfo, geninfo, genSampleType, ctrl);
428 >      // NOTE: xs weight and npuw are reset in merge.cc
429 >      if(ctrl.use_xs_weights)
430          weights.w = getWeight(xstab,entrymap,chain)/ctrl.totalMC;
431 <        if(ctrl.debug) cout ;
432 <        weights.npu = getNPU(puArr, 0);
433 <        weights.npuw = getPUWeight(ctrl.era, fname, weights.npu);
434 <      } else {
435 <        // JSON
436 <        if(!(ctrl.noJSON) ) {
437 <          RunLumiRangeMap::RunLumiPairType rl(info->RunNum(), info->LumiSec());      
438 <          if( !(rlrm.HasRunLumi(rl)) )  {
439 <            if( ctrl.debug ) cout << "fails JSON" << endl;
440 <            continue;
441 <          }
431 >      else
432 >        weights.w = 1;
433 >      weights.npu = getNPU(puArr, 0);
434 >      weights.npuw = getPUWeight(ctrl.era, fname, weights.npu);
435 >    } else {
436 >      // JSON
437 >      if(!(ctrl.noJSON) ) {
438 >        RunLumiRangeMap::RunLumiPairType rl(info->RunNum(), info->LumiSec());      
439 >        if( !(rlrm.HasRunLumi(rl)) )  {
440 >          if( ctrl.debug ) cout << "fails JSON" << endl;
441 >          continue;
442          }
443        }
444 +    }
445  
446 <      //
447 <      // lepton/kinematic selection ...
448 <      //
449 <      failingLeptons.clear();
450 <      passingLeptons.clear();
451 <      EventData ret4l = apply_HZZ4L_reference_selection(ctrl, info,
452 <                                                        vtxArr,
453 <                                                        pfArr,
454 <                                                        puDArr,
455 <                                                        electronArr,
456 <                                                        &electronReferencePreSelection,
457 <                                                        &electronReferenceIDMVASelectionV1, // not used anymore! (Blame the damn regression implementation, not me!)
458 <                                                        &electronReferenceIsoSelection,
459 <                                                        muonArr,
460 <                                                        &muonReferencePreSelection,
461 <                                                        &muonIDPFSelection,
462 <                                                        &muonReferenceIsoSelection);
446 >    //
447 >    // lepton/kinematic selection ...
448 >    //
449 >    failingLeptons.clear();
450 >    passingLeptons.clear();
451 >    EventData ret4l = apply_HZZ4L_reference_selection(ctrl, info,
452 >                                                      vtxArr,
453 >                                                      pfArr,
454 >                                                      puDArr,
455 >                                                      electronArr,
456 >                                                      &electronReferencePreSelection,
457 >                                                      &electronReferenceIDMVASelectionV1, // not used anymore! (Blame the damn regression implementation, not me!)
458 >                                                      &electronReferenceIsoSelection,
459 >                                                      muonArr,
460 >                                                      &muonReferencePreSelection,
461 >                                                      &muonIDPFSelection,
462 >                                                      &muonReferenceIsoSelection);
463        
464 <      if( ctrl.debug ) cout << endl;
438 <
439 <      if( ret4l.status.pass() ) {
440 <        fillAngles(ret4l,angles);
441 <
442 <        fillKinematics(ret4l,kine);
443 <        // fillMassErrors(ret4l,muonArr,electronArr,kine);
464 >    if( ctrl.debug ) cout << endl;
465  
466 <        if(doJets) {
467 <          fillJets(ctrl, jetArr, simpleLeptonJets, fJetCorrector, puDArr, fJetIDMVA, vtxArr, ret4l);
468 <          fillJetInfo(simpleLeptonJets,ji,ctrl);
466 >    if(ctrl.fakeScheme == "none") { // fill angletuple if event passes full selection
467 >      if( ret4l.status.pass() ) {
468 >        setNtupleVals(ctrl, ret4l, evtinfo, angles, kine, ji, weights, info, muonArr, electronArr, jetArr, metArr, simpleLeptonJets, fJetCorrector, puArr, puDArr, fJetIDMVA, vtxArr, triggerBits, hltTable, hltObjArr, fTrigObjs, &nt);
469 >        nt.Fill();
470 >    
471 >        int theZ1type = kine.l1type;
472 >        int theZ2type = kine.l3type;
473 >
474 >        if(ctrl.debug) cout << "simpleLeptonJets.size() = " << simpleLeptonJets.size() << endl;
475 >
476 >        if(kine.m4l > 100){
477 >          if(simpleLeptonJets.size() >= 1) {
478 >            increment(counts,"m4l > 100 && >= 1 jets",theZ1type,theZ2type);
479 >            if(simpleLeptonJets.size() == 2) {
480 >              increment(counts,"m4l > 100 && 2 jets",theZ1type,theZ2type);
481 >              SimpleLepton j1 = simpleLeptonJets[0];
482 >              SimpleLepton j2 = simpleLeptonJets[1];
483 >              double deta = abs(j1.vec.Eta()-j2.vec.Eta());
484 >              double mjj = (j1.vec + j2.vec).M();
485 >              double fisher = 0.09407 * deta  +0.00041581*mjj;
486 >              if(fisher > 0.4) increment(counts, "m4l > 100 && fisher > 0.4",theZ1type,theZ2type);
487 >            }
488 >          }
489          }
490  
450        TLorentzVector pfmet; pfmet.SetPxPyPzE(metArr->At(0)->Mex(),metArr->At(0)->Mey(),0,0);
451        fillEventInfo( info, pfmet, evtinfo, ctrl.mc ? getNPU(puArr) : 0, vtxArr->GetEntries());
452        if( ctrl.mc) {
453          setEfficiencyWeights(ctrl, ctrl.era, ret4l, triggerBits, hltTable, hltObjArr, fTrigObjs, weights);
454          if(ctrl.debug)
455            cout << "w: " << weights.w << "\t" << "npuw: " << weights.npuw << "\t" << "won: " << weights.won << "\t" << "woff: " << weights.woff << endl;
456        }
491          
492 <        nt.Fill();
493 <        
494 <        cerr  << "PASS:: " << "\trun: " << evtinfo.run << "\tevt: " << evtinfo.evt << "\tlumi: " << evtinfo.lumi << "\tchannel: "
495 <              << kine.channel << "\tm4l: " << kine.m4l << "\tmZ1: " << kine.mZ1 << "\tmZ2: " << kine.mZ2 << endl;
496 <        cout  << "PASS:: " << "\trun: " << evtinfo.run << "\tevt: " << evtinfo.evt << "\tlumi: " << evtinfo.lumi << "\tchannel: "
497 <              << kine.channel << "\tm4l: " << kine.m4l << "\tmZ1: " << kine.mZ1 << "\tmZ2: " << kine.mZ2 << endl;
498 <
499 <      } else {
500 <        if(ctrl.debug)
501 <          cout << "failing with code : " << ret4l.status.selectionBits << endl;
492 >      } else {
493 >        if(ctrl.debug) cout << "failing with code : " << ret4l.status.selectionBits << endl;
494 >      }
495 >    } else { // fill FOtuple and angletuple if event has a good Z and one or two extra leptons
496 >      assert(ctrl.fakeScheme=="ZPlusF" || ctrl.fakeScheme=="ZPlusFF");
497 >      if(ret4l.status.selectionBits.test(PASS_GOODZ1) ) {
498 >        unsigned nleps = passingLeptons.size() + failingLeptons.size();
499 >        if( (nleps>=3 && ctrl.fakeScheme=="ZPlusF" ) || (nleps>=4 && ctrl.fakeScheme=="ZPlusFF" ) ) {
500 >          addDummyZ2Lepotons(ret4l);
501 >          setNtupleVals(ctrl, ret4l, evtinfo, angles, kine, ji, weights, info, muonArr, electronArr, jetArr,  metArr, simpleLeptonJets, fJetCorrector, puArr, puDArr, fJetIDMVA, vtxArr, triggerBits, hltTable, hltObjArr, fTrigObjs, &nt);
502 >          nt.Fill();
503 >          foTree->Fill();
504 >        }
505 >      } else {
506 >        if(ctrl.debug) cout << "failing PASS_GOODZ1" << endl;
507        }
508      }
509  
510 +    hltTable->Delete();
511 +
512 +  }
513 +
514 +  if(ctrl.fakeScheme != "none") {
515 +    foTree->getFile()->cd();
516 +    foTree->getTree()->Write();
517 +  }
518    nt.WriteClose();
519  
520    for(unsigned icut=0; icut<cuts.size(); icut++) {
521      map<TString,int> thisCount(*(counts[cuts[icut]]));
522 <    cout << setw(20) << cuts[icut] << "\t" << setw(9) << thisCount["all"] << "  ("
522 >    cerr << setw(25) << cuts[icut] << "\t" << setw(9) << thisCount["all"] << "  ("
523           << setw(9) << thisCount["4e"] << setw(9) << thisCount["4m"] << setw(9) << thisCount["2e2m"] << ")" << endl;
524    }
525 < }
525 >
526 >  tmp_file.Close();
527 >
528 > }
529 > //----------------------------------------------------------------------------------------
530 > void addDummyZ2Lepotons(EventData &ret4l)
531 > // for fake ntuples, we don't know which are the Z2 leptons yet, but need to fill something so we don't seg fault
532 > {
533 >  SimpleLepton dum1,dum2;
534 >  dum1.vec.SetPtEtaPhiM(1,2,3,4);
535 >  dum2.vec.SetPtEtaPhiM(5,6,7,8);
536 >  ret4l.Z2leptons.push_back(dum1);
537 >  ret4l.Z2leptons.push_back(dum2);
538 > }
539 > //----------------------------------------------------------------------------------------
540 > void setNtupleVals(ControlFlags &ctrl, EventData &ret4l, InfoStruct &evtinfo, Angles &angles, KinematicsStruct &kine,
541 >                   JetInfoStruct &ji, WeightStruct &weights, EventHeader *info, Array<Muon> *muonArr, Array<Electron> *electronArr, Array<PFJet> *jetArr, Array<PFMet> *metArr,
542 >                   vector<SimpleLepton> &simpleLeptonJets, FactorizedJetCorrector *fJetCorrector, Array<PileupInfo> *puArr,
543 >                   Array<PileupEnergyDensity> *puDArr, JetIDMVA *fJetIDMVA, Array<Vertex> *vtxArr, bitset<1024> &triggerBits,
544 >                   TriggerTable *hltTable, Array<TriggerObject> *hltObjArr, TriggerObjectsTable *fTrigObjs, AngleTuple *nt)
545 > {
546 >  fillKinematics(ret4l,kine);
547 >
548 >  //the last two arguments are usePt and useY respectively
549 >  fillMela(kine,0,0);
550 >
551 >  fillMassErrors(ctrl,ret4l,muonArr,electronArr,kine);
552 >
553 >  TLorentzVector pfmet; pfmet.SetPxPyPzE(metArr->At(0)->Mex(),metArr->At(0)->Mey(),0,0);
554 >  fillEventInfo( info, pfmet, evtinfo, ctrl.mc ? getNPU(puArr) : 0, vtxArr->GetEntries());
555 >  fillJets(ctrl, jetArr, simpleLeptonJets, fJetCorrector, puDArr, fJetIDMVA, vtxArr, ret4l);
556 >  fillJetInfo(simpleLeptonJets, ji, ctrl);
557 >  //fillJetAngleBranches(ji, ret4l, nt, ctrl);
558 >  evtinfo.status = 0;
559 >  evtinfo.status = setHltBits(ti, triggerBits);
560 >
561 >  if(ctrl.fakeScheme == "none") {
562 >    fillAngles(ret4l,angles);
563 >
564 >    if( ctrl.mc) {
565 >      if(ctrl.use_eff_weights) setEfficiencyWeights(ctrl, ctrl.era, ret4l, triggerBits, hltTable, hltObjArr, fTrigObjs, weights);
566 >      if(ctrl.debug)
567 >        cout << "w: " << weights.w << "\t" << "npuw: " << weights.npuw << "\t" << "won: " << weights.won << "\t" << "woff: " << weights.woff << endl;
568 >    }
569 >
570 >    if(ctrl.debug) {
571 >      stringstream ss;
572 >      ss << "PASS:: " << "\trun: " << evtinfo.run << "\tevt: " << evtinfo.evt << "\tlumi: " << evtinfo.lumi << "\tchannel: "
573 >         << kine.channel << "\tm4l: " << kine.m4l << "\tmZ1: " << kine.mZ1 << "\tmZ2: " << kine.mZ2 << endl;
574 >      cerr << ss.str();
575 >      cout << ss.str();
576 >    }
577 >  } else {
578 >    // fillAngles(ret4l,angles); // at this point we don't know which four leptons will constitute the ZZ system, so doesn't make sense to fill the angles
579 >  }
580 > }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines