Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/UniqueObjectFinder.cc

    r93da593 r77e9ae1  
    1717 */
    1818
    19 
    2019/** \class UniqueObjectFinder
    2120 *
     
    3231#include "classes/DelphesFormula.h"
    3332
     33#include "ExRootAnalysis/ExRootClassifier.h"
     34#include "ExRootAnalysis/ExRootFilter.h"
    3435#include "ExRootAnalysis/ExRootResult.h"
    35 #include "ExRootAnalysis/ExRootFilter.h"
    36 #include "ExRootAnalysis/ExRootClassifier.h"
    3736
     37#include "TDatabasePDG.h"
     38#include "TFormula.h"
     39#include "TLorentzVector.h"
    3840#include "TMath.h"
     41#include "TObjArray.h"
     42#include "TRandom3.h"
    3943#include "TString.h"
    40 #include "TFormula.h"
    41 #include "TRandom3.h"
    42 #include "TObjArray.h"
    43 #include "TDatabasePDG.h"
    44 #include "TLorentzVector.h"
    4544
    46 #include <algorithm>
    47 #include <stdexcept>
     45#include <algorithm>
    4846#include <iostream>
    4947#include <sstream>
     48#include <stdexcept>
    5049
    5150using namespace std;
     
    6766void UniqueObjectFinder::Init()
    6867{
     68  // use GetUniqueID algorithm to find unique objects (faster than the default Overlaps method)
     69  fUseUniqueID = GetBool("UseUniqueID", false);
     70
    6971  // import arrays with output from other modules
    7072
     
    7779
    7880  size = param.GetSize();
    79   for(i = 0; i < size/2; ++i)
     81  for(i = 0; i < size / 2; ++i)
    8082  {
    81     array = ImportArray(param[i*2].GetString());
     83    array = ImportArray(param[i * 2].GetString());
    8284    iterator = array->MakeIterator();
    8385
    84     fInputMap.push_back(make_pair(iterator, ExportArray(param[i*2 + 1].GetString())));
     86    fInputMap.push_back(make_pair(iterator, ExportArray(param[i * 2 + 1].GetString())));
    8587  }
    8688}
     
    9092void UniqueObjectFinder::Finish()
    9193{
    92   vector< pair< TIterator *, TObjArray * > >::iterator itInputMap;
     94  vector<pair<TIterator *, TObjArray *> >::iterator itInputMap;
    9395  TIterator *iterator;
    9496
     
    106108{
    107109  Candidate *candidate;
    108   vector< pair< TIterator *, TObjArray * > >::iterator itInputMap;
     110  vector<pair<TIterator *, TObjArray *> >::iterator itInputMap;
    109111  TIterator *iterator;
    110112  TObjArray *array;
     
    118120    // loop over all candidates
    119121    iterator->Reset();
    120     while((candidate = static_cast<Candidate*>(iterator->Next())))
     122    while((candidate = static_cast<Candidate *>(iterator->Next())))
    121123    {
    122124      if(Unique(candidate, itInputMap))
     
    130132//------------------------------------------------------------------------------
    131133
    132 Bool_t UniqueObjectFinder::Unique(Candidate *candidate, vector< pair< TIterator *, TObjArray * > >::iterator itInputMap)
     134Bool_t UniqueObjectFinder::Unique(Candidate *candidate, vector<pair<TIterator *, TObjArray *> >::iterator itInputMap)
    133135{
    134136  Candidate *previousCandidate;
    135   vector< pair< TIterator *, TObjArray * > >::iterator previousItInputMap;
     137  vector<pair<TIterator *, TObjArray *> >::iterator previousItInputMap;
    136138  TObjArray *array;
    137139
     
    144146    // loop over all candidates
    145147    iterator.Reset();
    146     while((previousCandidate = static_cast<Candidate*>(iterator.Next())))
     148    while((previousCandidate = static_cast<Candidate *>(iterator.Next())))
    147149    {
    148       if(candidate->Overlaps(previousCandidate))
     150      if(fUseUniqueID)
    149151      {
    150         return kFALSE;
     152        if(candidate->GetUniqueID() == previousCandidate->GetUniqueID())
     153        {
     154          return kFALSE;
     155        }
     156      }
     157      else
     158      {
     159        if(candidate->Overlaps(previousCandidate))
     160        {
     161          return kFALSE;
     162        }
    151163      }
    152164    }
Note: See TracChangeset for help on using the changeset viewer.