Changes in modules/UniqueObjectFinder.cc [93da593:77e9ae1] in git
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/UniqueObjectFinder.cc
r93da593 r77e9ae1 17 17 */ 18 18 19 20 19 /** \class UniqueObjectFinder 21 20 * … … 32 31 #include "classes/DelphesFormula.h" 33 32 33 #include "ExRootAnalysis/ExRootClassifier.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 34 35 #include "ExRootAnalysis/ExRootResult.h" 35 #include "ExRootAnalysis/ExRootFilter.h"36 #include "ExRootAnalysis/ExRootClassifier.h"37 36 37 #include "TDatabasePDG.h" 38 #include "TFormula.h" 39 #include "TLorentzVector.h" 38 40 #include "TMath.h" 41 #include "TObjArray.h" 42 #include "TRandom3.h" 39 43 #include "TString.h" 40 #include "TFormula.h"41 #include "TRandom3.h"42 #include "TObjArray.h"43 #include "TDatabasePDG.h"44 #include "TLorentzVector.h"45 44 46 #include <algorithm> 47 #include <stdexcept> 45 #include <algorithm> 48 46 #include <iostream> 49 47 #include <sstream> 48 #include <stdexcept> 50 49 51 50 using namespace std; … … 67 66 void UniqueObjectFinder::Init() 68 67 { 68 // use GetUniqueID algorithm to find unique objects (faster than the default Overlaps method) 69 fUseUniqueID = GetBool("UseUniqueID", false); 70 69 71 // import arrays with output from other modules 70 72 … … 77 79 78 80 size = param.GetSize(); 79 for(i = 0; i < size /2; ++i)81 for(i = 0; i < size / 2; ++i) 80 82 { 81 array = ImportArray(param[i *2].GetString());83 array = ImportArray(param[i * 2].GetString()); 82 84 iterator = array->MakeIterator(); 83 85 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()))); 85 87 } 86 88 } … … 90 92 void UniqueObjectFinder::Finish() 91 93 { 92 vector< pair< TIterator *, TObjArray *> >::iterator itInputMap;94 vector<pair<TIterator *, TObjArray *> >::iterator itInputMap; 93 95 TIterator *iterator; 94 96 … … 106 108 { 107 109 Candidate *candidate; 108 vector< pair< TIterator *, TObjArray *> >::iterator itInputMap;110 vector<pair<TIterator *, TObjArray *> >::iterator itInputMap; 109 111 TIterator *iterator; 110 112 TObjArray *array; … … 118 120 // loop over all candidates 119 121 iterator->Reset(); 120 while((candidate = static_cast<Candidate *>(iterator->Next())))122 while((candidate = static_cast<Candidate *>(iterator->Next()))) 121 123 { 122 124 if(Unique(candidate, itInputMap)) … … 130 132 //------------------------------------------------------------------------------ 131 133 132 Bool_t UniqueObjectFinder::Unique(Candidate *candidate, vector< pair< TIterator *, TObjArray *> >::iterator itInputMap)134 Bool_t UniqueObjectFinder::Unique(Candidate *candidate, vector<pair<TIterator *, TObjArray *> >::iterator itInputMap) 133 135 { 134 136 Candidate *previousCandidate; 135 vector< pair< TIterator *, TObjArray *> >::iterator previousItInputMap;137 vector<pair<TIterator *, TObjArray *> >::iterator previousItInputMap; 136 138 TObjArray *array; 137 139 … … 144 146 // loop over all candidates 145 147 iterator.Reset(); 146 while((previousCandidate = static_cast<Candidate *>(iterator.Next())))148 while((previousCandidate = static_cast<Candidate *>(iterator.Next()))) 147 149 { 148 if( candidate->Overlaps(previousCandidate))150 if(fUseUniqueID) 149 151 { 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 } 151 163 } 152 164 }
Note:
See TracChangeset
for help on using the changeset viewer.