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.52 by khahn, Wed Jul 11 18:24:39 2012 UTC vs.
Revision 1.53 by dkralph, Tue Jul 24 11:54:17 2012 UTC

# Line 91 | Line 91 | vector<vector<unsigned> > zcutvec;
91   vector<vector<unsigned> > zzcutvec;
92   map<unsigned,float>       evtrhoMap;
93   vector<string> cutstrs;
94 < bool passes_HLT_MC;
94 > bool passes_HLT_MC,passes_HLT;
95   vector<bool>   PFnoPUflag;;
96  
97   //
# Line 166 | Line 166 | int main(int argc, char** argv)
166    //--------------------------------------------------------------------------------------------------------------
167    TChain * chain = new TChain("Events");
168    TChain * hltchain = new TChain("HLT");
169 +  TChain * runchain = new TChain(Names::gkRunTreeName);
170  
171    string fname;
172    unsigned total_unskimmed=0;
# Line 179 | Line 180 | int main(int argc, char** argv)
180        total_unskimmed += entrymap[string(fname.c_str())];
181        chain->AddFile(fname.c_str());
182        hltchain->AddFile(fname.c_str());
183 +      runchain->AddFile(fname.c_str());
184      }
185    } else {
186      cout << "adding inputfile : " << ctrl.inputfile.c_str() << endl;
# Line 188 | Line 190 | int main(int argc, char** argv)
190      total_unskimmed += unsk_ents;
191      chain->AddFile(ctrl.inputfile.c_str());
192      hltchain->AddFile(ctrl.inputfile.c_str());
193 +    runchain->AddFile(ctrl.inputfile.c_str());
194    }
195    // // write the total number of unskimmed events that went into making this output file to a text file
196 <  // writeEntries(ctrl,total_unskimmed);
196 >  writeEntries(ctrl,total_unskimmed);
197  
198    const char * ofname;
199    if( strcmp( ctrl.outputfile.c_str(), "") ) {
# Line 249 | Line 252 | int main(int argc, char** argv)
252    //  initMuonIDMVA();
253    initElectronIDMVAV1();
254    initTrigger();
255 +  TrigInfo ti;
256 +  initAnalysisTriggers(ti);
257  
258    //
259    // Setup tree I/O
# Line 258 | Line 263 | int main(int argc, char** argv)
263    string currentFile("");
264  
265    UInt_t fNMaxTriggers = 1024;
266 <  mithep::EventHeader *info    = new mithep::EventHeader();
266 >  mithep::EventHeader                         *info          = new mithep::EventHeader();
267    mithep::Array<mithep::PFMet>                *metArr        = new mithep::Array<mithep::PFMet>();
268    mithep::Array<mithep::Electron>             *electronArr   = new mithep::Array<mithep::Electron>();
269    mithep::Array<mithep::Muon>                 *muonArr       = new mithep::Array<mithep::Muon>();
# Line 279 | Line 284 | int main(int argc, char** argv)
284    std::vector<std::string>                    *hltLab        = new vector<string>();
285    TriggerObjectsTable                         *fTrigObjs     = new TriggerObjectsTable(hltTable,fNMaxTriggers);
286  
287 +  RunInfo                                     *runInfo       = new RunInfo();
288  
289    TString fElectronName(Names::gkElectronBrn);
290    TString fMuonName(Names::gkMuonBrn);
# Line 328 | Line 334 | int main(int argc, char** argv)
334    hltchain->SetBranchAddress(fTriggerTableName, &hltTableStrings);
335    hltchain->SetBranchAddress(fTriggerLabelName, &hltLabelStrings);
336  
337 +  runchain->SetBranchAddress(Names::gkRunInfoBrn, &runInfo);
338 +
339    mithep::Vertex              vtx;          // best primary vertex in the event
340  
341    //  ginfo = NULL;
# Line 348 | Line 356 | int main(int argc, char** argv)
356    //
357    // Loop !!!!!!!!!
358    //--------------------------------------------------------------------------------------------------------------
359 +  int lastHltEntry=-2;
360    for(UInt_t ientry=0; ientry<imax; ientry++)
361      {
362        chain->GetEntry(ientry);
# Line 360 | Line 369 | int main(int argc, char** argv)
369               << "\tEvt: " << info->EvtNum()
370               << "\tLumi: " << info->LumiSec()
371               << endl;
372 +        cerr << "Run: " << info->RunNum()
373 +             << "\tEvt: " << info->EvtNum()
374 +             << "\tLumi: " << info->LumiSec()
375 +             << endl;
376          cout << "-----------------------------------------------------------------" << endl;
377        }
378  
379 <
379 >      runchain->GetEvent(info->RunEntry());
380 >      hltchain->GetEntry(runInfo->HltEntry());
381 >      hltTable->Clear();
382 >      fillTriggerNames(hltTable, hltTableStrings );
383 >      if(ctrl.debug && (lastHltEntry != runInfo->HltEntry())) hltTable->Print();
384 >      lastHltEntry = runInfo->HltEntry();
385 >      fillTriggerBits( hltTable, trigMask, triggerBits );
386 >      setHLTObjectRelations( hltObjArr, hltRelsArr, hltTableStrings, hltLabelStrings, fTrigObjs );
387 >      // printTriggerObjs( hltTable, fTrigObjs);
388 >      
389        string fname = string(chain->GetFile()->GetEndpointUrl()->GetFile());
390        if(ctrl.debug) cout << "era is " << ctrl.era << endl;
391        if( ctrl.era == 0  ) {
# Line 380 | Line 402 | int main(int argc, char** argv)
402        assert(pfnopu_size == pfArr->GetEntries());
403  
404        //
405 +      // trigger
406 +      //
407 +      if( string(chain->GetFile()->GetEndpointUrl()->GetFile()) != currentFile ) {
408 +        currentFile = string(chain->GetFile()->GetEndpointUrl()->GetFile());
409 +      }
410 +      if( ctrl.debug ) cout << "file is : " << currentFile  << endl;
411 +
412 +      //
413        // data/MC
414        //
415        if(ctrl.mc) {
# Line 411 | Line 441 | int main(int argc, char** argv)
441            }
442          }
443  
444 <        //
415 <        // trigger
416 <        //
417 <        if( string(chain->GetFile()->GetEndpointUrl()->GetFile()) != currentFile ) {
418 <          currentFile = string(chain->GetFile()->GetEndpointUrl()->GetFile());
419 <          hltchain->SetBranchAddress(fTriggerTableName, &hltTableStrings);
420 <          hltchain->SetBranchAddress(fTriggerLabelName, &hltLabelStrings);
421 <          hltchain->GetEntry(0);
422 <          hltTable->Clear();
423 <          fillTriggerNames(hltTable, hltTableStrings );
424 <          hltTable->Print();
425 <        }
426 <        if( ctrl.debug ) cout << "file is : " << currentFile  << endl;
427 <        fillTriggerBits( hltTable, trigMask, triggerBits );
444 >        // trigger
445          passes_HLT_MC = true; // passed to apply as extern global, just for sync
446          if( !passHLTMC(triggerBits, info->RunNum(), info->EvtNum(), k2012_MC ) ) {
447            passes_HLT_MC = false;
448          }
449  
433        setHLTObjectRelations( hltObjArr, hltRelsArr, hltTableStrings, hltLabelStrings, fTrigObjs );
434
450        } else {
451          //
452          // JSON
# Line 444 | Line 459 | int main(int argc, char** argv)
459            }
460          }
461          
447        //
462          // trigger
463 <        //
464 <        if( string(chain->GetFile()->GetEndpointUrl()->GetFile()) != currentFile ) {
465 <          currentFile = string(chain->GetFile()->GetEndpointUrl()->GetFile());
452 <          hltchain->SetBranchAddress(fTriggerTableName, &hltTableStrings);
453 <          hltchain->SetBranchAddress(fTriggerLabelName, &hltLabelStrings);
454 <          hltchain->GetEntry(0);
455 <          hltTable->Clear();
456 <          fillTriggerNames(hltTable, hltTableStrings );
463 >        passes_HLT = true;
464 >        if( !passHLT(ctrl, triggerBits,ti,info->RunNum()) ) {
465 >          passes_HLT = false;
466          }
467  
459      setHLTObjectRelations( hltObjArr, hltRelsArr, hltTableStrings, hltLabelStrings, fTrigObjs );
460
461        if( ctrl.debug ) cout << "file is : " << currentFile  << endl;
462        /*
463        fillTriggerBits( hltTable, trigMask, triggerBits );
464        if( !passHLT(triggerBits, info->RunNum(), info->EvtNum() ) ) {
465          if( ctrl.debug ) cout << "\tfails trigger ... " << endl;
466          continue;
467        }
468        */
468        }
469  
470        //
# Line 553 | Line 552 | int main(int argc, char** argv)
552          if(ctrl.debug)
553            cout << "failing with some other code : " << ret4l.status.selectionBits << endl;
554        }
555 <    }  
555 >      if(ctrl.debug)
556 >        cout << "passes HLT: " << passes_HLT << endl;
557 >    }
558  
559    
560    foTree.getFile()->cd();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines