- Timestamp:
- Jun 30, 2015, 2:38:29 PM (9 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- c627b07
- Parents:
- 6153fb0
- Location:
- modules
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/BTagging.cc
r6153fb0 r1180bc1 34 34 #include "classes/DelphesFormula.h" 35 35 36 #include "ExRootAnalysis/ExRootResult.h"37 #include "ExRootAnalysis/ExRootFilter.h"38 #include "ExRootAnalysis/ExRootClassifier.h"39 40 36 #include "TMath.h" 41 37 #include "TString.h" … … 55 51 //------------------------------------------------------------------------------ 56 52 57 class BTaggingPartonClassifier : public ExRootClassifier 53 BTagging::BTagging() : 54 fItJetInputArray(0) 58 55 { 59 public:60 61 BTaggingPartonClassifier() {}62 63 Int_t GetCategory(TObject *object);64 65 Double_t fEtaMax, fPTMin;66 };67 68 //------------------------------------------------------------------------------69 70 Int_t BTaggingPartonClassifier::GetCategory(TObject *object)71 {72 Candidate *parton = static_cast<Candidate*>(object);73 const TLorentzVector &momentum = parton->Momentum;74 Int_t pdgCode;75 76 if(momentum.Pt() <= fPTMin || TMath::Abs(momentum.Eta()) > fEtaMax) return -1;77 78 pdgCode = TMath::Abs(parton->PID);79 if(pdgCode != 21 && pdgCode > 5) return -1;80 81 return 0;82 }83 84 //------------------------------------------------------------------------------85 86 BTagging::BTagging() :87 fClassifier(0), fFilter(0),88 fItPartonInputArray(0), fItJetInputArray(0)89 {90 fClassifier = new BTaggingPartonClassifier;91 56 } 92 57 … … 95 60 BTagging::~BTagging() 96 61 { 97 if(fClassifier) delete fClassifier;98 62 } 99 63 … … 108 72 109 73 fBitNumber = GetInt("BitNumber", 0); 110 111 fDeltaR = GetDouble("DeltaR", 0.5);112 113 fClassifier->fPTMin = GetDouble("PartonPTMin", 1.0);114 fClassifier->fEtaMax = GetDouble("PartonEtaMax", 2.5);115 74 116 75 // read efficiency formulas … … 139 98 // import input array(s) 140 99 141 fPartonInputArray = ImportArray(GetString("PartonInputArray", "Delphes/partons"));142 fItPartonInputArray = fPartonInputArray->MakeIterator();143 144 fFilter = new ExRootFilter(fPartonInputArray);145 146 100 fJetInputArray = ImportArray(GetString("JetInputArray", "FastJetFinder/jets")); 147 101 fItJetInputArray = fJetInputArray->MakeIterator(); … … 155 109 DelphesFormula *formula; 156 110 157 if(fFilter) delete fFilter;158 111 if(fItJetInputArray) delete fItJetInputArray; 159 if(fItPartonInputArray) delete fItPartonInputArray;160 112 161 113 for(itEfficiencyMap = fEfficiencyMap.begin(); itEfficiencyMap != fEfficiencyMap.end(); ++itEfficiencyMap) … … 172 124 Candidate *jet; 173 125 Double_t pt, eta, phi, e; 174 TObjArray *partonArray;175 126 map< Int_t, DelphesFormula * >::iterator itEfficiencyMap; 176 127 DelphesFormula *formula; 177 178 // select quark and gluons179 fFilter->Reset();180 partonArray = fFilter->GetSubArray(fClassifier, 0);181 182 if(partonArray == 0) return;183 184 TIter itPartonArray(partonArray);185 128 186 129 // loop over all input jets -
modules/BTagging.h
r6153fb0 r1180bc1 37 37 class DelphesFormula; 38 38 39 class ExRootFilter;40 class BTaggingPartonClassifier;41 42 39 class BTagging: public DelphesModule 43 40 { … … 55 52 Int_t fBitNumber; 56 53 57 Double_t fDeltaR;58 59 54 #if !defined(__CINT__) && !defined(__CLING__) 60 55 std::map< Int_t, DelphesFormula * > fEfficiencyMap; //! 61 56 #endif 62 57 63 BTaggingPartonClassifier *fClassifier; //!64 65 ExRootFilter *fFilter;66 67 TIterator *fItPartonInputArray; //!68 69 58 TIterator *fItJetInputArray; //! 70 71 const TObjArray *fPartonInputArray; //!72 59 73 60 const TObjArray *fJetInputArray; //! -
modules/JetFlavorAssociation.cc
r6153fb0 r1180bc1 151 151 fPartonInputArray = ImportArray(GetString("PartonInputArray", "Delphes/partons")); 152 152 fItPartonInputArray = fPartonInputArray->MakeIterator(); 153 fPartonFilter = new ExRootFilter(fPartonInputArray); 153 154 154 155 fParticleInputArray = ImportArray(GetString("ParticleInputArray", "Delphes/allParticles")); 155 156 fItParticleInputArray = fParticleInputArray->MakeIterator(); 156 157 157 fParticleLHEFInputArray = ImportArray(GetString("ParticleLHEFInputArray", "Delphes/allParticlesLHEF")); 158 fItParticleLHEFInputArray = fParticleLHEFInputArray->MakeIterator(); 159 160 fPartonFilter = new ExRootFilter(fPartonInputArray); 161 fParticleLHEFFilter = new ExRootFilter(fParticleLHEFInputArray); 158 try 159 { 160 fParticleLHEFInputArray = ImportArray(GetString("ParticleLHEFInputArray", "Delphes/allParticlesLHEF")); 161 } 162 catch(runtime_error &e) 163 { 164 fParticleLHEFInputArray = 0; 165 } 166 167 if(fParticleLHEFInputArray) 168 { 169 fItParticleLHEFInputArray = fParticleLHEFInputArray->MakeIterator(); 170 fParticleLHEFFilter = new ExRootFilter(fParticleLHEFInputArray); 171 } 162 172 163 173 fJetInputArray = ImportArray(GetString("JetInputArray", "FastJetFinder/jets")); … … 183 193 184 194 Candidate *jet; 185 TObjArray *partonArray ;186 TObjArray *partonLHEFArray ;187 188 // select quark &&gluons195 TObjArray *partonArray = 0; 196 TObjArray *partonLHEFArray = 0; 197 198 // select quark and gluons 189 199 fPartonFilter->Reset(); 190 200 partonArray = fPartonFilter->GetSubArray(fPartonClassifier, 0); // get the filtered parton array 191 192 201 if(partonArray == 0) return; 193 TIter itPartonArray(partonArray); 194 195 fParticleLHEFFilter->Reset(); 196 partonLHEFArray = fParticleLHEFFilter->GetSubArray(fParticleLHEFClassifier, 0); // get the filtered parton array 197 198 if(partonLHEFArray == 0) return; 199 TIter itPartonLHEFArray(partonLHEFArray); 200 202 203 if(fParticleLHEFInputArray) 204 { 205 fParticleLHEFFilter->Reset(); 206 partonLHEFArray = fParticleLHEFFilter->GetSubArray(fParticleLHEFClassifier, 0); // get the filtered parton array 207 } 201 208 // loop over all input jets 202 209 fItJetInputArray->Reset(); … … 204 211 { 205 212 // get standard flavor 206 GetAlgoFlavor(jet, itPartonArray, itPartonLHEFArray);207 GetPhysicsFlavor(jet, itPartonArray, itPartonLHEFArray);213 GetAlgoFlavor(jet, partonArray, partonLHEFArray); 214 if(fParticleLHEFInputArray) GetPhysicsFlavor(jet, partonArray, partonLHEFArray); 208 215 } 209 216 } … … 213 220 // https://cmssdt.cern.ch/SDT/lxr/source/PhysicsTools/JetMCAlgos/plugins/JetPartonMatcher.cc?v=CMSSW_7_3_0_pre1 214 221 215 void JetFlavorAssociation::GetAlgoFlavor(Candidate *jet, T Iter &itPartonArray, TIter &itPartonLHEFArray)222 void JetFlavorAssociation::GetAlgoFlavor(Candidate *jet, TObjArray *partonArray, TObjArray *partonLHEFArray) 216 223 { 217 224 float maxPt = 0; 218 bool isGoodParton = true;219 225 int daughterCounter = 0; 220 226 Candidate *parton, *partonLHEF; 221 227 Candidate *tempParton = 0, *tempPartonHighestPt = 0; 222 228 int pdgCode, pdgCodeMax = -1; 229 230 TIter itPartonArray(partonArray); 231 TIter itPartonLHEFArray(partonLHEFArray); 223 232 224 233 itPartonArray.Reset(); … … 232 241 if(pdgCodeMax < pdgCode) pdgCodeMax = pdgCode; 233 242 } 234 235 isGoodParton = true; 243 244 if(!fParticleLHEFInputArray) continue; 245 236 246 itPartonLHEFArray.Reset(); 237 247 while((partonLHEF = static_cast<Candidate *>(itPartonLHEFArray.Next()))) … … 240 250 parton->PID == partonLHEF->PID && 241 251 partonLHEF->Charge == parton->Charge) 242 { 243 isGoodParton = false; 252 { 244 253 break; 245 254 } 246 247 if(!isGoodParton) continue;248 255 249 256 // check the daugheter … … 285 292 //------------------------------------------------------------------------------ 286 293 287 void JetFlavorAssociation::GetPhysicsFlavor(Candidate *jet, T Iter &itPartonArray, TIter &itPartonLHEFArray)294 void JetFlavorAssociation::GetPhysicsFlavor(Candidate *jet, TObjArray *partonArray, TObjArray *partonLHEFArray) 288 295 { 289 296 int partonCounter = 0; … … 298 305 vector<Candidate *>::iterator itContaminations; 299 306 307 TIter itPartonArray(partonArray); 308 TIter itPartonLHEFArray(partonLHEFArray); 309 300 310 contaminations.clear(); 301 311 -
modules/JetFlavorAssociation.h
r6153fb0 r1180bc1 50 50 void Finish(); 51 51 52 void GetAlgoFlavor(Candidate *jet, T Iter &itPartonArray, TIter &itPartonLHEFArray);53 void GetPhysicsFlavor(Candidate *jet, T Iter &itPartonArray, TIter &itPartonLHEFArray);52 void GetAlgoFlavor(Candidate *jet, TObjArray *partonArray, TObjArray *partonLHEFArray); 53 void GetPhysicsFlavor(Candidate *jet, TObjArray *partonArray, TObjArray *partonLHEFArray); 54 54 55 55 private:
Note:
See TracChangeset
for help on using the changeset viewer.