Fork me on GitHub

Changeset 72 in svn


Ignore:
Timestamp:
Dec 3, 2008, 12:01:04 PM (16 years ago)
Author:
severine ovyn
Message:

final trigger

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Delphes.cpp

    r71 r72  
    9595
    9696  //Trigger information
    97   //Trigger *TRIG = new Trigger();
    98   //TRIG->TriggerReader("data/trigger.dat");
     97  TriggerTable *TRIGT = new TriggerTable();
     98  TRIGT->TriggerCardReader("data/trigger.dat");
     99  TRIGT->PrintTriggerTable(LogName);
    99100
    100101  //Propagation of tracks in the B field
     
    336337
    337338      //*****************************
    338       treeWriter->Fill();
    339339     
    340340      sorted_jets=JETRUN->RunJets(input_particles);
     
    344344      // Add here the trigger
    345345      // Should test all the trigger table on the event, based on reconstructed objects
    346      
     346      treeWriter->Fill();
     347   
    347348    } // Loop over all events
    348349
    349350  treeWriter->Write();
    350  
     351  delete treeWriter;
     352
     353  if(DET->DOTRIGGER == 1)
     354    {
     355      TChain chainT("Analysis");
     356      chainT.Add(outputfilename.c_str());
     357      ExRootTreeReader *treeReaderT = new ExRootTreeReader(&chainT);
     358
     359      TClonesArray *branchElecTrig = treeReaderT->UseBranch("Electron");
     360      TClonesArray *branchMuonTrig = treeReaderT->UseBranch("Muon");
     361      TClonesArray *branchJetTrig = treeReaderT->UseBranch("Jet");
     362      TClonesArray *branchTauJetTrig = treeReaderT->UseBranch("TauJet");
     363      TClonesArray *branchPhotonTrig = treeReaderT->UseBranch("Photon");
     364      TClonesArray *branchETmisTrig = treeReaderT->UseBranch("ETmis");
     365
     366      ExRootTreeWriter *treeWriterT = new ExRootTreeWriter(outputfilename, "Trigger");
     367      ExRootTreeBranch *branchTrigger = treeWriterT->NewBranch("TrigResult", TRootTrigger::Class());
     368
     369      Long64_t entryT, allEntriesT = treeReaderT->GetEntries();
     370      cout << "** Chain contains " << allEntriesT << " events" << endl;
     371      for(entryT = 0; entryT < allEntriesT; ++entryT)
     372        {
     373          treeWriterT->Clear();
     374          treeReaderT->ReadEntry(entryT);
     375          TRIGT->GetGlobalResult(branchElecTrig, branchMuonTrig,branchJetTrig, branchTauJetTrig,branchPhotonTrig, branchETmisTrig,branchTrigger);
     376          treeWriterT->Fill();
     377        }
     378
     379      treeWriterT->Write();
     380      delete treeWriterT;
     381    }
     382
    351383  cout << "** Exiting..." << endl;
    352384 
    353   delete treeWriter;
    354385  delete treeReader;
    355386  delete DET;
  • trunk/Utilities/ExRootAnalysis/interface/BlockClasses.h

    r70 r72  
    1313 *  present in the data members of the Block TRoot class.
    1414 *
    15  *  $Date: 2008-12-02 19:50:30 $
    16  *  $Revision: 1.5 $
     15 *  $Date: 2008-12-03 11:01:04 $
     16 *  $Revision: 1.6 $
    1717 *
    1818 * 
     
    292292  TRootTrigger() {};
    293293
    294   bool Accepted; // -1 or 1
     294  int Accepted;
    295295
    296296  static TCompare *fgCompare; //!
  • trunk/data/DataCardDet.dat

    r71 r72  
    6262MISTAGGING_L     1
    6363
     64#Trigger flag
     65DOTRIGGER        1                       //1 to run the trigger else 0
     66
    6467#DeltaR cone definition
    6568CONERADIUS      0.7
  • trunk/data/trigger.dat

    r52 r72  
    11# list of trigger algorithms
    22# trigger_name  algorithm                       comments
    3 SingleElec  >> ELEC1_PT: '20' & ELEC2_PT: '10' & ELEC3_PT: '3' & MUON1_PT '10'                      # requires at least 1 muon with p_t > 3
     3SingleElec  >> ELEC1_PT: '10'                  # requires at least 1 muon with p_t > 3
     4SingleJet   >> JET1_PT: '10'                  # requires at least 1 muon with p_t > 3
     5DoubleElec  >> ELEC1_PT: '10' && ELEC2_PT: '10'                  # requires at least 1 muon with p_t > 3
  • trunk/interface/SmearUtil.h

    r71 r72  
    9898  int MISTAGGING_L;
    9999 
     100  //trigger flag
     101  int DOTRIGGER;
     102
    100103  double CONERADIUS;
    101104  int JETALGO;
  • trunk/interface/TriggerUtil.h

    r63 r72  
    1414#include <vector>
    1515#include "TLorentzVector.h"
     16#include "TClonesArray.h"
    1617
    1718#include "Utilities/ExRootAnalysis/interface/BlockClasses.h"
    1819#include "Utilities/ExRootAnalysis/interface/TSimpleArray.h"
     20#include "Utilities/ExRootAnalysis/interface/ExRootTreeBranch.h"
    1921
    2022using namespace std;
     
    3133  void PrintTrigCondition(string LogName,int i);
    3234
    33   bool GetResult() {
    34     if(!has_been_evaluated) Evaluate(event_i);
    35     return Result;
    36   };
     35  bool GetResult(TClonesArray *branchElecTrig, TClonesArray *branchMuonTrig,
     36      TClonesArray *branchJetTrig, TClonesArray *branchTauJetTrig,
     37      TClonesArray *branchPhotonTrig,  TClonesArray *branchETmisTrig);
    3738
    3839 private:
    39   bool Evaluate(int event_i); // <- à la fin, mettre has_been_evaluated=true;
    40 
     40 
    4141  vector<float> GetCuts(const vector<string> &Sequences);
    4242  vector<float> ElecValues;
     
    4747  vector<float> GammaValues;
    4848  bool Result;
    49   int event_i;
    50   bool has_been_evaluated;
    5149};
    5250
     
    6866  // appelle la méthode TriggerBit::PriniTrigCondition
    6967 
    70 
    71   bool GetGlobalResult() {
    72     if (! has_been_evaluated) Evaluate(event_i);
    73     return GlobalResult;
    74   }
     68  bool GetGlobalResult(TClonesArray *branchElecTrig, TClonesArray *branchMuonTrig,
     69      TClonesArray *branchJetTrig, TClonesArray *branchTauJetTrig,
     70      TClonesArray *branchPhotonTrig, TClonesArray *branchETmisTrig,ExRootTreeBranch *branchTrigger);
    7571
    7672  void WriteResult();
  • trunk/src/SmearUtil.cc

    r71 r72  
    8686MISTAGGING_L =    1;
    8787
     88//Trigger flag
     89DOTRIGGER    =     1;
    8890
    8991CONERADIUS   = 0.7;     // generic jet radius ; not for tau's !!!
     
    178180    else if(strstr(temp_string.c_str(),"TAUJET_pt")){curstring >> varname >> value; TAUJET_pt = value;}
    179181    else if(strstr(temp_string.c_str(),"NTOWERS")){curstring >> varname >> ivalue; NTOWERS = ivalue;}
     182    else if(strstr(temp_string.c_str(),"DOTRIGGER")){curstring >> varname >> ivalue; DOTRIGGER = ivalue;}
    180183    else if(strstr(temp_string.c_str(),"TOWER_ETA_EDGES")){
    181184        curstring >> varname;   for(unsigned int i=0; i<NTOWERS+1; i++) {curstring >> value; TOWER_ETA_EDGES[i] = value;} }
  • trunk/src/TriggerUtil.cc

    r63 r72  
    6565}
    6666
     67bool TriggerTable::GetGlobalResult(TClonesArray *branchElecTrig, TClonesArray *branchMuonTrig,
     68      TClonesArray *branchJetTrig, TClonesArray *branchTauJetTrig,
     69      TClonesArray *branchPhotonTrig,  TClonesArray *branchETmisTrig, ExRootTreeBranch *branchTrigger) {
     70
     71  TRootTrigger *elementTrigger;
     72  GlobalResult=false;
     73  for(unsigned int i=0; i < list_of_trigger_bits.size(); i++) {
     74  if(list_of_trigger_bits[i].GetResult(branchElecTrig, branchMuonTrig,  branchJetTrig, branchTauJetTrig, branchPhotonTrig, branchETmisTrig))
     75    {
     76       GlobalResult=true;
     77       int flag=i+1;
     78       elementTrigger = (TRootTrigger*) branchTrigger->NewEntry();
     79       elementTrigger->Accepted=flag;
     80    }
     81  }
     82  if(GlobalResult)
     83    {
     84      elementTrigger = (TRootTrigger*) branchTrigger->NewEntry();
     85      elementTrigger->Accepted=0;
     86    }
     87    return GlobalResult;
     88
     89}
     90
    6791//*************************************************************************
    68 
    6992TriggerBit::TriggerBit() {
    70  has_been_evaluated=false;
     93}
     94
     95bool TriggerBit::GetResult(TClonesArray *branchElecTrig, TClonesArray *branchMuonTrig,
     96      TClonesArray *branchJetTrig, TClonesArray *branchTauJetTrig,
     97      TClonesArray *branchPhotonTrig,  TClonesArray *branchETmisTrig)
     98{
     99  int elec_size = ElecValues.size();
     100  int muon_size = MuonValues.size();
     101  int jet_size = JetValues.size();
     102  int taujet_size = TauJetValues.size();
     103  int gamma_size = GammaValues.size();
     104  int etmis_size = EtmisValues.size();
     105
     106  Result=false;
     107  if(
     108     (branchElecTrig->GetEntries() >= elec_size )
     109      && (branchMuonTrig->GetEntries() >= muon_size )
     110      && (branchJetTrig->GetEntries() >= jet_size )
     111      && (branchTauJetTrig->GetEntries() >= taujet_size )
     112      && (branchPhotonTrig->GetEntries() >= gamma_size )
     113    )
     114    {
     115      Result=true;
     116      if(elec_size!=0){
     117        TRootElectron *electron;
     118        for(int i=0;i<elec_size;i++){
     119           electron = (TRootElectron*)branchElecTrig->At(i);
     120           if(electron->PT < ElecValues[i])Result=false;}}
     121
     122      if(muon_size!=0){
     123        TRootMuon *muon;
     124        for(int i=0;i<muon_size;i++){
     125           muon = (TRootMuon*)branchMuonTrig->At(i);
     126           if(muon->PT < MuonValues[i])Result=false;}}
     127
     128      if(jet_size!=0){
     129        TRootJet *jet;
     130        for(int i=0;i<jet_size;i++){
     131           jet = (TRootJet*)branchJetTrig->At(i);
     132           if(jet->PT < JetValues[i])Result=false;}}
     133
     134      if(taujet_size!=0){
     135        TRootTauJet *taujet;
     136        for(int i=0;i<taujet_size;i++){
     137           taujet = (TRootTauJet*)branchTauJetTrig->At(i);
     138           if(taujet->PT < TauJetValues[i])Result=false;}}
     139
     140      if(gamma_size!=0){
     141        TRootPhoton *gamma;
     142        for(int i=0;i<gamma_size;i++){
     143           gamma = (TRootPhoton*)branchPhotonTrig->At(i);
     144           if(gamma->PT < GammaValues[i])Result=false;}}
     145
     146
     147      if(etmis_size!=0){
     148        TRootETmis *etmis = (TRootETmis*)branchETmisTrig->At(0);
     149           if(etmis->ET < EtmisValues[0])Result=false;}
     150   
     151   }
     152  return Result;
    71153}
    72154
Note: See TracChangeset for help on using the changeset viewer.