- Timestamp:
- Sep 29, 2015, 2:08:10 PM (9 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- a98c7ef
- Parents:
- d870fc5 (diff), 06ec139 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- modules
- Files:
-
- 10 added
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/AngularSmearing.cc
rd870fc5 rd77b51d 100 100 { 101 101 Candidate *candidate, *mother; 102 Double_t pt, eta, phi ;102 Double_t pt, eta, phi, e; 103 103 104 104 fItInputArray->Reset(); … … 110 110 phi = candidatePosition.Phi(); 111 111 pt = candidateMomentum.Pt(); 112 e = candidateMomentum.E(); 112 113 113 114 // apply smearing formula for eta,phi 114 115 115 eta = gRandom->Gaus(eta, fFormulaEta->Eval(pt, eta ));116 phi = gRandom->Gaus(phi, fFormulaPhi->Eval(pt, eta ));116 eta = gRandom->Gaus(eta, fFormulaEta->Eval(pt, eta, phi, e)); 117 phi = gRandom->Gaus(phi, fFormulaPhi->Eval(pt, eta, phi, e)); 117 118 118 119 if(pt <= 0.0) continue; -
modules/BTagging.cc
rd870fc5 rd77b51d 22 22 * Determines origin of jet, 23 23 * applies b-tagging efficiency (miss identification rate) formulas 24 * and sets b-tagging flags 24 * and sets b-tagging flags 25 25 * 26 26 * \author P. Demin - UCL, Louvain-la-Neuve … … 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" … … 46 42 #include "TLorentzVector.h" 47 43 48 #include <algorithm> 44 #include <algorithm> 49 45 #include <stdexcept> 50 46 #include <iostream> … … 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 … … 109 73 fBitNumber = GetInt("BitNumber", 0); 110 74 111 fDeltaR = GetDouble("DeltaR", 0.5);112 113 fClassifier->fPTMin = GetDouble("PartonPTMin", 1.0);114 fClassifier->fEtaMax = GetDouble("PartonEtaMax", 2.5);115 116 75 // read efficiency formulas 117 76 param = GetParam("EfficiencyFormula"); 118 77 size = param.GetSize(); 119 78 120 79 fEfficiencyMap.clear(); 121 80 for(i = 0; i < size/2; ++i) … … 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) … … 170 122 void BTagging::Process() 171 123 { 172 Candidate *jet, *parton; 173 Double_t pt, eta, phi; 174 TObjArray *partonArray; 124 Candidate *jet; 125 Double_t pt, eta, phi, e; 175 126 map< Int_t, DelphesFormula * >::iterator itEfficiencyMap; 176 127 DelphesFormula *formula; 177 Int_t pdgCode, pdgCodeMax;178 128 179 // select quark and gluons180 fFilter->Reset();181 partonArray = fFilter->GetSubArray(fClassifier, 0);182 183 if(partonArray == 0) return;184 185 TIter itPartonArray(partonArray);186 187 129 // loop over all input jets 188 130 fItJetInputArray->Reset(); … … 190 132 { 191 133 const TLorentzVector &jetMomentum = jet->Momentum; 192 pdgCodeMax = -1;193 134 eta = jetMomentum.Eta(); 194 135 phi = jetMomentum.Phi(); 195 136 pt = jetMomentum.Pt(); 137 e = jetMomentum.E(); 196 138 197 // loop over all input partons 198 itPartonArray.Reset(); 199 while((parton = static_cast<Candidate*>(itPartonArray.Next()))) 200 { 201 pdgCode = TMath::Abs(parton->PID); 202 if(pdgCode == 21) pdgCode = 0; 203 if(jetMomentum.DeltaR(parton->Momentum) <= fDeltaR) 204 { 205 if(pdgCodeMax < pdgCode) pdgCodeMax = pdgCode; 206 } 207 } 208 if(pdgCodeMax == 0) pdgCodeMax = 21; 209 if(pdgCodeMax == -1) pdgCodeMax = 0; 210 211 // find an efficency formula 212 itEfficiencyMap = fEfficiencyMap.find(pdgCodeMax); 139 // find an efficiency formula 140 itEfficiencyMap = fEfficiencyMap.find(jet->Flavor); 213 141 if(itEfficiencyMap == fEfficiencyMap.end()) 214 142 { … … 217 145 formula = itEfficiencyMap->second; 218 146 219 // apply an efficency formula 220 jet->BTag |= (gRandom->Uniform() <= formula->Eval(pt, eta)) << fBitNumber; 147 // apply an efficiency formula 148 jet->BTag |= (gRandom->Uniform() <= formula->Eval(pt, eta, phi, e)) << fBitNumber; 149 150 // find an efficiency formula for algo flavor definition 151 itEfficiencyMap = fEfficiencyMap.find(jet->FlavorAlgo); 152 if(itEfficiencyMap == fEfficiencyMap.end()) 153 { 154 itEfficiencyMap = fEfficiencyMap.find(0); 155 } 156 formula = itEfficiencyMap->second; 157 158 // apply an efficiency formula 159 jet->BTagAlgo |= (gRandom->Uniform() <= formula->Eval(pt, eta, phi, e)) << fBitNumber; 160 161 // find an efficiency formula for phys flavor definition 162 itEfficiencyMap = fEfficiencyMap.find(jet->FlavorPhys); 163 if(itEfficiencyMap == fEfficiencyMap.end()) 164 { 165 itEfficiencyMap = fEfficiencyMap.find(0); 166 } 167 formula = itEfficiencyMap->second; 168 169 // apply an efficiency formula 170 jet->BTagPhys |= (gRandom->Uniform() <= formula->Eval(pt, eta, phi, e)) << fBitNumber; 221 171 } 222 172 } -
modules/BTagging.h
rd870fc5 rd77b51d 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/CMakeLists.txt
rd870fc5 rd77b51d 7 7 file(GLOB sources *.cc) 8 8 file(GLOB headers *.h) 9 list(REMOVE_ITEM headers ${CMAKE_CURRENT_SOURCE_DIR}/FastJetLinkDef.h) 9 10 list(REMOVE_ITEM headers ${CMAKE_CURRENT_SOURCE_DIR}/ModulesLinkDef.h) 10 11 list(REMOVE_ITEM headers ${CMAKE_CURRENT_SOURCE_DIR}/Pythia8LinkDef.h) 11 12 13 DELPHES_GENERATE_DICTIONARY(FastJetDict ${headers} LINKDEF FastJetLinkDef.h) 12 14 DELPHES_GENERATE_DICTIONARY(ModulesDict ${headers} LINKDEF ModulesLinkDef.h) 13 15 … … 15 17 list(REMOVE_ITEM sources ${CMAKE_CURRENT_SOURCE_DIR}/PileUpMergerPythia8.cc) 16 18 17 add_library(modules OBJECT ${sources} ModulesDict.cxx)19 add_library(modules OBJECT ${sources} FastJetDict.cxx ModulesDict.cxx) -
modules/Calorimeter.cc
rd870fc5 rd77b51d 142 142 } 143 143 144 /* 145 TFractionMap::iterator itFractionMap; 146 for(itFractionMap = fFractionMap.begin(); itFractionMap != fFractionMap.end(); ++itFractionMap) 147 { 148 cout << itFractionMap->first << " " << itFractionMap->second.first << " " << itFractionMap->second.second << endl; 149 } 150 */ 144 // read min E value for timing measurement in ECAL 145 fTimingEnergyMin = GetDouble("TimingEnergyMin",4.); 146 // For timing 147 // So far this flag needs to be false 148 // Curved extrapolation not supported 149 fElectronsFromTrack = false; 151 150 152 151 // read min E value for towers to be saved … … 158 157 159 158 // switch on or off the dithering of the center of calorimeter towers 160 f DitherTowerCenter = GetBool("DitherTowerCenter", true);159 fSmearTowerCenter = GetBool("SmearTowerCenter", true); 161 160 162 161 // read resolution formulas … … 356 355 fTrackHCalEnergy = 0.0; 357 356 358 fTowerECalTime = 0.0;359 fTowerHCalTime = 0.0;360 361 fTrackECalTime = 0.0;362 fTrackHCalTime = 0.0;363 364 fTowerECalTimeWeight = 0.0;365 fTowerHCalTimeWeight = 0.0;366 367 357 fTowerTrackHits = 0; 368 358 fTowerPhotonHits = 0; … … 380 370 position = track->Position; 381 371 382 383 372 ecalEnergy = momentum.E() * fTrackECalFractions[number]; 384 373 hcalEnergy = momentum.E() * fTrackHCalFractions[number]; … … 387 376 fTrackHCalEnergy += hcalEnergy; 388 377 389 fTrackECalTime += TMath::Sqrt(ecalEnergy)*position.T(); 390 fTrackHCalTime += TMath::Sqrt(hcalEnergy)*position.T(); 391 392 fTrackECalTimeWeight += TMath::Sqrt(ecalEnergy); 393 fTrackHCalTimeWeight += TMath::Sqrt(hcalEnergy); 378 if(ecalEnergy > fTimingEnergyMin && fTower) 379 { 380 if(fElectronsFromTrack) 381 { 382 fTower->ECalEnergyTimePairs.push_back(make_pair<Float_t, Float_t>(ecalEnergy, track->Position.T())); 383 } 384 } 394 385 395 386 fTowerTrackArray->Add(track); … … 412 403 fTowerHCalEnergy += hcalEnergy; 413 404 414 fTowerECalTime += TMath::Sqrt(ecalEnergy)*position.T(); 415 fTowerHCalTime += TMath::Sqrt(hcalEnergy)*position.T(); 416 417 fTowerECalTimeWeight += TMath::Sqrt(ecalEnergy); 418 fTowerHCalTimeWeight += TMath::Sqrt(hcalEnergy); 419 405 if(ecalEnergy > fTimingEnergyMin && fTower) 406 { 407 if (abs(particle->PID) != 11 || !fElectronsFromTrack) 408 { 409 fTower->ECalEnergyTimePairs.push_back(make_pair<Float_t, Float_t>(ecalEnergy, particle->Position.T())); 410 } 411 } 420 412 421 413 fTower->AddCandidate(particle); … … 434 426 Double_t ecalEnergy, hcalEnergy; 435 427 Double_t ecalSigma, hcalSigma; 436 Double_t ecalTime, hcalTime, time;428 Float_t weight, sumWeightedTime, sumWeight; 437 429 438 430 if(!fTower) return; … … 444 436 hcalEnergy = LogNormal(fTowerHCalEnergy, hcalSigma); 445 437 446 ecalTime = (fTowerECalTimeWeight < 1.0E-09 ) ? 0.0 : fTowerECalTime/fTowerECalTimeWeight;447 hcalTime = (fTowerHCalTimeWeight < 1.0E-09 ) ? 0.0 : fTowerHCalTime/fTowerHCalTimeWeight;448 449 438 ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, ecalEnergy); 450 439 hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, hcalEnergy); … … 454 443 455 444 energy = ecalEnergy + hcalEnergy; 456 time = (TMath::Sqrt(ecalEnergy)*ecalTime + TMath::Sqrt(hcalEnergy)*hcalTime)/(TMath::Sqrt(ecalEnergy) + TMath::Sqrt(hcalEnergy)); 457 458 if(fDitherTowerCenter) 445 446 if(fSmearTowerCenter) 459 447 { 460 448 eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]); … … 469 457 pt = energy / TMath::CosH(eta); 470 458 471 fTower->Position.SetPtEtaPhiE(1.0, eta, phi, time); 459 // Time calculation for tower 460 fTower->NTimeHits = 0; 461 sumWeightedTime = 0.0; 462 sumWeight = 0.0; 463 464 for(size_t i = 0; i < fTower->ECalEnergyTimePairs.size(); ++i) 465 { 466 weight = TMath::Sqrt(fTower->ECalEnergyTimePairs[i].first); 467 sumWeightedTime += weight * fTower->ECalEnergyTimePairs[i].second; 468 sumWeight += weight; 469 fTower->NTimeHits++; 470 } 471 472 if(sumWeight > 0.0) 473 { 474 fTower->Position.SetPtEtaPhiE(1.0, eta, phi, sumWeightedTime/sumWeight); 475 } 476 else 477 { 478 fTower->Position.SetPtEtaPhiE(1.0, eta, phi, 999999.9); 479 } 480 481 472 482 fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy); 473 483 fTower->Eem = ecalEnergy; -
modules/Calorimeter.h
rd870fc5 rd77b51d 60 60 Double_t fTrackECalEnergy, fTrackHCalEnergy; 61 61 62 Double_t fTowerECalTime, fTowerHCalTime; 63 Double_t fTrackECalTime, fTrackHCalTime; 64 65 Double_t fTowerECalTimeWeight, fTowerHCalTimeWeight; 66 Double_t fTrackECalTimeWeight, fTrackHCalTimeWeight; 62 Double_t fTimingEnergyMin; 63 Bool_t fElectronsFromTrack; 67 64 68 65 Int_t fTowerTrackHits, fTowerPhotonHits; … … 74 71 Double_t fHCalEnergySignificanceMin; 75 72 76 Bool_t f DitherTowerCenter;73 Bool_t fSmearTowerCenter; 77 74 78 75 TFractionMap fFractionMap; //! -
modules/Efficiency.cc
rd870fc5 rd77b51d 96 96 { 97 97 Candidate *candidate; 98 Double_t pt, eta, phi ;98 Double_t pt, eta, phi, e; 99 99 100 100 fItInputArray->Reset(); … … 106 106 phi = candidatePosition.Phi(); 107 107 pt = candidateMomentum.Pt(); 108 e = candidateMomentum.E(); 108 109 109 110 // apply an efficency formula 110 if(gRandom->Uniform() > fFormula->Eval(pt, eta )) continue;111 if(gRandom->Uniform() > fFormula->Eval(pt, eta, phi, e)) continue; 111 112 112 113 fOutputArray->Add(candidate); -
modules/EnergyScale.cc
rd870fc5 rd77b51d 104 104 momentum = candidate->Momentum; 105 105 106 scale = fFormula->Eval(momentum.Pt(), momentum.Eta() );106 scale = fFormula->Eval(momentum.Pt(), momentum.Eta(), momentum.Phi(), momentum.E()); 107 107 108 108 if(scale > 0.0) momentum *= scale; -
modules/EnergySmearing.cc
rd870fc5 rd77b51d 96 96 { 97 97 Candidate *candidate, *mother; 98 Double_t energy, eta, phi;98 Double_t pt, energy, eta, phi; 99 99 100 100 fItInputArray->Reset(); … … 103 103 const TLorentzVector &candidatePosition = candidate->Position; 104 104 const TLorentzVector &candidateMomentum = candidate->Momentum; 105 106 pt = candidatePosition.Pt(); 105 107 eta = candidatePosition.Eta(); 106 108 phi = candidatePosition.Phi(); … … 108 110 109 111 // apply smearing formula 110 energy = gRandom->Gaus(energy, fFormula->Eval( 0.0, eta, 0.0, energy));112 energy = gRandom->Gaus(energy, fFormula->Eval(pt, eta, phi, energy)); 111 113 112 114 if(energy <= 0.0) continue; -
modules/FastJetFinder.cc
rd870fc5 rd77b51d 66 66 #include "fastjet/contribs/Nsubjettiness/WinnerTakeAllRecombiner.hh" 67 67 68 #include "fastjet/tools/Filter.hh" 69 #include "fastjet/tools/Pruner.hh" 70 #include "fastjet/contribs/RecursiveTools/SoftDrop.hh" 71 68 72 using namespace std; 69 73 using namespace fastjet; … … 92 96 JetDefinition::Plugin *plugin = 0; 93 97 JetDefinition::Recombiner *recomb = 0; 94 NjettinessPlugin *njetPlugin = 0; 95 96 // read eta ranges 97 98 ExRootConfParam param = GetParam("RhoEtaRange"); 98 ExRootConfParam param; 99 99 Long_t i, size; 100 101 fEtaRangeMap.clear(); 102 size = param.GetSize(); 103 for(i = 0; i < size/2; ++i) 104 { 105 fEtaRangeMap[param[i*2].GetDouble()] = param[i*2 + 1].GetDouble(); 106 } 100 Double_t etaMin, etaMax; 101 TEstimatorStruct estimatorStruct; 107 102 108 103 // define algorithm … … 130 125 fN = GetInt("N", 2); // used only if Njettiness is used as jet clustering algo (case 8) 131 126 127 //-- Trimming parameters -- 128 129 fComputeTrimming = GetBool("ComputeTrimming", false); 130 fRTrim = GetDouble("RTrim", 0.2); 131 fPtFracTrim = GetDouble("PtFracTrim", 0.05); 132 133 134 //-- Pruning parameters -- 135 136 fComputePruning = GetBool("ComputePruning", false); 137 fZcutPrun = GetDouble("ZcutPrun", 0.1); 138 fRcutPrun = GetDouble("RcutPrun", 0.5); 139 fRPrun = GetDouble("RPrun", 0.8); 140 141 //-- SoftDrop parameters -- 142 143 fComputeSoftDrop = GetBool("ComputeSoftDrop", false); 144 fBetaSoftDrop = GetDouble("BetaSoftDrop", 0.0); 145 fSymmetryCutSoftDrop = GetDouble("SymmetryCutSoftDrop", 0.1); 146 fR0SoftDrop= GetDouble("R0SoftDrop=", 0.8); 147 148 132 149 // --- Jet Area Parameters --- 133 150 fAreaAlgorithm = GetInt("AreaAlgorithm", 0); … … 197 214 break; 198 215 case 8: 199 njetPlugin = new NjettinessPlugin(fN, Njettiness::wta_kt_axes, Njettiness::unnormalized_cutoff_measure, fBeta, fRcutOff);200 fDefinition = new JetDefinition( njetPlugin);216 fNjettinessPlugin = new NjettinessPlugin(fN, Njettiness::wta_kt_axes, Njettiness::unnormalized_cutoff_measure, fBeta, fRcutOff); 217 fDefinition = new JetDefinition(fNjettinessPlugin); 201 218 break; 202 219 } … … 204 221 fPlugin = plugin; 205 222 fRecomb = recomb; 206 fNjettinessPlugin = njetPlugin;207 223 208 224 ClusterSequence::print_banner(); 225 226 if(fComputeRho && fAreaDefinition) 227 { 228 // read eta ranges 229 230 param = GetParam("RhoEtaRange"); 231 size = param.GetSize(); 232 233 fEstimators.clear(); 234 for(i = 0; i < size/2; ++i) 235 { 236 etaMin = param[i*2].GetDouble(); 237 etaMax = param[i*2 + 1].GetDouble(); 238 estimatorStruct.estimator = new JetMedianBackgroundEstimator(SelectorEtaRange(etaMin, etaMax), *fDefinition, *fAreaDefinition); 239 estimatorStruct.etaMin = etaMin; 240 estimatorStruct.etaMax = etaMax; 241 fEstimators.push_back(estimatorStruct); 242 } 243 } 209 244 210 245 // import input array … … 223 258 void FastJetFinder::Finish() 224 259 { 260 vector< TEstimatorStruct >::iterator itEstimators; 261 262 for(itEstimators = fEstimators.begin(); itEstimators != fEstimators.end(); ++itEstimators) 263 { 264 if(itEstimators->estimator) delete itEstimators->estimator; 265 } 266 225 267 if(fItInputArray) delete fItInputArray; 226 268 if(fDefinition) delete fDefinition; … … 241 283 Double_t time, timeWeight; 242 284 Int_t number; 285 Int_t charge; 243 286 Double_t rho = 0.0; 244 287 PseudoJet jet, area; 245 vector<PseudoJet> inputList, outputList;246 288 ClusterSequence *sequence; 247 map< Double_t, Double_t >::iterator itEtaRangeMap; 289 vector< PseudoJet > inputList, outputList, subjets; 290 vector< PseudoJet >::iterator itInputList, itOutputList; 291 vector< TEstimatorStruct >::iterator itEstimators; 248 292 249 293 DelphesFactory *factory = GetFactory(); … … 276 320 if(fComputeRho && fAreaDefinition) 277 321 { 278 for(itEtaRangeMap = fEtaRangeMap.begin(); itEtaRangeMap != fEtaRangeMap.end(); ++itEtaRangeMap) 279 { 280 Selector select_rapidity = SelectorAbsRapRange(itEtaRangeMap->first, itEtaRangeMap->second); 281 JetMedianBackgroundEstimator estimator(select_rapidity, *fDefinition, *fAreaDefinition); 282 estimator.set_particles(inputList); 283 rho = estimator.rho(); 322 for(itEstimators = fEstimators.begin(); itEstimators != fEstimators.end(); ++itEstimators) 323 { 324 itEstimators->estimator->set_particles(inputList); 325 rho = itEstimators->estimator->rho(); 284 326 285 327 candidate = factory->NewCandidate(); 286 328 candidate->Momentum.SetPtEtaPhiE(rho, 0.0, 0.0, rho); 287 candidate->Edges[0] = itE taRangeMap->first;288 candidate->Edges[1] = itE taRangeMap->second;329 candidate->Edges[0] = itEstimators->etaMin; 330 candidate->Edges[1] = itEstimators->etaMax; 289 331 fRhoOutputArray->Add(candidate); 290 332 } … … 298 340 detaMax = 0.0; 299 341 dphiMax = 0.0; 300 vector<PseudoJet>::iterator itInputList, itOutputList;301 342 for(itOutputList = outputList.begin(); itOutputList != outputList.end(); ++itOutputList) 302 343 { … … 314 355 timeWeight = 0.0; 315 356 357 charge = 0; 358 316 359 inputList.clear(); 317 360 inputList = sequence->constituents(*itOutputList); … … 319 362 for(itInputList = inputList.begin(); itInputList != inputList.end(); ++itInputList) 320 363 { 364 if(itInputList->user_index() < 0) continue; 321 365 constituent = static_cast<Candidate*>(fInputArray->At(itInputList->user_index())); 322 366 … … 329 373 timeWeight += TMath::Sqrt(constituent->Momentum.E()); 330 374 375 charge += constituent->Charge; 376 331 377 candidate->AddCandidate(constituent); 332 378 } … … 338 384 candidate->DeltaEta = detaMax; 339 385 candidate->DeltaPhi = dphiMax; 340 386 candidate->Charge = charge; 387 //------------------------------------ 388 // Trimming 389 //------------------------------------ 390 391 if(fComputeTrimming) 392 { 393 394 fastjet::Filter trimmer(fastjet::JetDefinition(fastjet::kt_algorithm,fRTrim),fastjet::SelectorPtFractionMin(fPtFracTrim)); 395 fastjet::PseudoJet trimmed_jet = trimmer(*itOutputList); 396 397 trimmed_jet = join(trimmed_jet.constituents()); 398 399 candidate->TrimmedP4[0].SetPtEtaPhiM(trimmed_jet.pt(), trimmed_jet.eta(), trimmed_jet.phi(), trimmed_jet.m()); 400 401 // four hardest subjets 402 subjets.clear(); 403 subjets = trimmed_jet.pieces(); 404 subjets = sorted_by_pt(subjets); 405 406 candidate->NSubJetsTrimmed = subjets.size(); 407 408 for (size_t i = 0; i < subjets.size() and i < 4; i++){ 409 if(subjets.at(i).pt() < 0) continue ; 410 candidate->TrimmedP4[i+1].SetPtEtaPhiM(subjets.at(i).pt(), subjets.at(i).eta(), subjets.at(i).phi(), subjets.at(i).m()); 411 } 412 } 413 414 415 //------------------------------------ 416 // Pruning 417 //------------------------------------ 418 419 420 if(fComputePruning) 421 { 422 423 fastjet::Pruner pruner(fastjet::JetDefinition(fastjet::cambridge_algorithm,fRPrun),fZcutPrun,fRcutPrun); 424 fastjet::PseudoJet pruned_jet = pruner(*itOutputList); 425 426 candidate->PrunedP4[0].SetPtEtaPhiM(pruned_jet.pt(), pruned_jet.eta(), pruned_jet.phi(), pruned_jet.m()); 427 428 // four hardest subjet 429 subjets.clear(); 430 subjets = pruned_jet.pieces(); 431 subjets = sorted_by_pt(subjets); 432 433 candidate->NSubJetsPruned = subjets.size(); 434 435 for (size_t i = 0; i < subjets.size() and i < 4; i++){ 436 if(subjets.at(i).pt() < 0) continue ; 437 candidate->PrunedP4[i+1].SetPtEtaPhiM(subjets.at(i).pt(), subjets.at(i).eta(), subjets.at(i).phi(), subjets.at(i).m()); 438 } 439 440 } 441 442 //------------------------------------ 443 // SoftDrop 444 //------------------------------------ 445 446 if(fComputeSoftDrop) 447 { 448 449 contrib::SoftDrop softDrop(fBetaSoftDrop,fSymmetryCutSoftDrop,fR0SoftDrop); 450 fastjet::PseudoJet softdrop_jet = softDrop(*itOutputList); 451 452 candidate->SoftDroppedP4[0].SetPtEtaPhiM(softdrop_jet.pt(), softdrop_jet.eta(), softdrop_jet.phi(), softdrop_jet.m()); 453 454 // four hardest subjet 455 456 subjets.clear(); 457 subjets = softdrop_jet.pieces(); 458 subjets = sorted_by_pt(subjets); 459 candidate->NSubJetsSoftDropped = softdrop_jet.pieces().size(); 460 461 for (size_t i = 0; i < subjets.size() and i < 4; i++){ 462 if(subjets.at(i).pt() < 0) continue ; 463 candidate->SoftDroppedP4[i+1].SetPtEtaPhiM(subjets.at(i).pt(), subjets.at(i).eta(), subjets.at(i).phi(), subjets.at(i).m()); 464 } 465 } 466 341 467 // --- compute N-subjettiness with N = 1,2,3,4,5 ---- 342 468 … … 377 503 } 378 504 379 380 505 fOutputArray->Add(candidate); 381 506 } -
modules/FastJetFinder.h
rd870fc5 rd77b51d 30 30 #include "classes/DelphesModule.h" 31 31 32 #include < map>32 #include <vector> 33 33 34 34 class TObjArray; … … 38 38 class JetDefinition; 39 39 class AreaDefinition; 40 class Selector;40 class JetMedianBackgroundEstimator; 41 41 namespace contrib { 42 42 class NjettinessPlugin; … … 83 83 Int_t fN ; 84 84 85 //-- Trimming parameters -- 86 87 Bool_t fComputeTrimming; 88 Double_t fRTrim; 89 Double_t fPtFracTrim; 90 91 //-- Pruning parameters -- 92 93 Bool_t fComputePruning; 94 Double_t fZcutPrun; 95 Double_t fRcutPrun; 96 Double_t fRPrun; 97 98 //-- SoftDrop parameters -- 99 100 Bool_t fComputeSoftDrop; 101 Double_t fBetaSoftDrop; 102 Double_t fSymmetryCutSoftDrop; 103 Double_t fR0SoftDrop; 104 85 105 // --- FastJet Area method -------- 86 106 … … 100 120 Double_t fEffectiveRfact; 101 121 102 std::map< Double_t, Double_t > fEtaRangeMap; //! 122 #if !defined(__CINT__) && !defined(__CLING__) 123 struct TEstimatorStruct 124 { 125 fastjet::JetMedianBackgroundEstimator *estimator; 126 Double_t etaMin, etaMax; 127 }; 128 129 std::vector< TEstimatorStruct > fEstimators; //! 130 #endif 103 131 104 132 TIterator *fItInputArray; //! -
modules/FastJetLinkDef.h
rd870fc5 rd77b51d 28 28 #include "modules/FastJetFinder.h" 29 29 #include "modules/FastJetGridMedianEstimator.h" 30 #include "modules/RunPUPPI.h" 30 31 31 32 #ifdef __CINT__ … … 37 38 #pragma link C++ class FastJetFinder+; 38 39 #pragma link C++ class FastJetGridMedianEstimator+; 40 #pragma link C++ class RunPUPPI+; 39 41 40 42 #endif -
modules/IdentificationMap.cc
rd870fc5 rd77b51d 69 69 void IdentificationMap::Init() 70 70 { 71 // read efficiency formula72 73 74 71 TMisIDMap::iterator itEfficiencyMap; 75 72 ExRootConfParam param; … … 87 84 formula->Compile(param[i*3 + 2].GetString()); 88 85 pdg = param[i*3].GetInt(); 89 fEfficiencyMap.insert(make_pair(pdg,make_pair(param[i*3 + 1].GetInt(),formula))); 90 91 // cout<<param[i*3].GetInt()<<","<<param[i*3+1].GetInt()<<","<<param[i*3 + 2].GetString()<<endl; 92 86 fEfficiencyMap.insert(make_pair(pdg, make_pair(param[i*3 + 1].GetInt(), formula))); 93 87 } 94 88 … … 100 94 formula->Compile("1.0"); 101 95 102 fEfficiencyMap.insert(make_pair(0, make_pair(0,formula)));96 fEfficiencyMap.insert(make_pair(0, make_pair(0, formula))); 103 97 } 104 98 … … 126 120 if(formula) delete formula; 127 121 } 128 129 122 } 130 123 … … 134 127 { 135 128 Candidate *candidate; 136 Double_t pt, eta, phi ;129 Double_t pt, eta, phi, e; 137 130 TMisIDMap::iterator itEfficiencyMap; 138 131 pair <TMisIDMap::iterator, TMisIDMap::iterator> range; 139 132 DelphesFormula *formula; 140 Int_t pdg In, pdgOut, charge;133 Int_t pdgCodeIn, pdgCodeOut, charge; 141 134 142 Double_t P, Pi; 143 144 // cout<<"------------ New Event ------------"<<endl; 135 Double_t p, r, total; 145 136 146 137 fItInputArray->Reset(); … … 152 143 phi = candidatePosition.Phi(); 153 144 pt = candidateMomentum.Pt(); 154 pdgIn = candidate->PID; 145 e = candidateMomentum.E(); 146 147 pdgCodeIn = candidate->PID; 155 148 charge = candidate->Charge; 156 149 157 // cout<<"------------ New Candidate ------------"<<endl;158 // cout<<candidate->PID<<" "<<pt<<","<<eta<<","<<phi<<endl;150 // first check that PID of this particle is specified in the map 151 // otherwise, look for PID = 0 159 152 160 P = 1.0;153 itEfficiencyMap = fEfficiencyMap.find(pdgCodeIn); 161 154 162 //first check that PID of this particle is specified in cfg, if not set look for PID=0 163 164 itEfficiencyMap = fEfficiencyMap.find(pdgIn); 165 166 range = fEfficiencyMap.equal_range(pdgIn); 167 if(range.first == range.second) range = fEfficiencyMap.equal_range(-pdgIn); 155 range = fEfficiencyMap.equal_range(pdgCodeIn); 156 if(range.first == range.second) range = fEfficiencyMap.equal_range(-pdgCodeIn); 168 157 if(range.first == range.second) range = fEfficiencyMap.equal_range(0); 169 158 170 //loop over submap for this pid 171 for (TMisIDMap::iterator it=range.first; it!=range.second; ++it) 159 r = gRandom->Uniform(); 160 total = 0.0; 161 162 // loop over sub-map for this PID 163 for(TMisIDMap::iterator it = range.first; it != range.second; ++it) 172 164 { 165 formula = (it->second).second; 166 pdgCodeOut = (it->second).first; 173 167 174 formula = (it->second).second; 175 pdgOut = (it->second).first; 168 p = formula->Eval(pt, eta, phi, e); 176 169 177 Pi = formula->Eval(pt, eta); 178 179 // check that sum of probabilities does not exceed 1. 180 P = (P - Pi)/P; 181 182 if( P < 0.0 ) continue; 183 else 170 if(total <= r && r < total + p) 184 171 { 185 186 //randomly assign a PID to particle according to map 187 Double_t rndm = gRandom->Uniform(); 188 189 if(rndm > P) 190 { 191 //change PID of particle 192 if(pdgOut != 0) candidate->PID = charge*pdgOut; 193 fOutputArray->Add(candidate); 194 break; 195 } 172 // change PID of particle 173 if(pdgCodeOut != 0) candidate->PID = charge*pdgCodeOut; 174 fOutputArray->Add(candidate); 175 break; 196 176 } 197 177 178 total += p; 198 179 } 199 200 } 201 180 } 202 181 } 203 182 -
modules/IdentificationMap.h
rd870fc5 rd77b51d 49 49 private: 50 50 51 typedef std::multimap< Int_t, std::pair< Int_t, DelphesFormula * > > TMisIDMap; //!51 typedef std::multimap< Int_t, std::pair< Int_t, DelphesFormula * > > TMisIDMap; //! 52 52 53 TMisIDMap fEfficiencyMap; 53 TMisIDMap fEfficiencyMap; //! 54 54 55 55 TIterator *fItInputArray; //! -
modules/ImpactParameterSmearing.cc
rd870fc5 rd77b51d 97 97 Candidate *candidate, *particle, *mother; 98 98 Double_t xd, yd, zd, dxy, sx, sy, sz, ddxy; 99 Double_t pt, eta, px, py ;99 Double_t pt, eta, px, py, phi, e; 100 100 101 101 fItInputArray->Reset(); … … 110 110 eta = candidateMomentum.Eta(); 111 111 pt = candidateMomentum.Pt(); 112 phi = candidateMomentum.Phi(); 113 e = candidateMomentum.E(); 114 112 115 px = candidateMomentum.Px(); 113 116 py = candidateMomentum.Py(); … … 119 122 120 123 // calculate smeared values 121 sx = gRandom->Gaus(0.0, fFormula->Eval(pt, eta ));122 sy = gRandom->Gaus(0.0, fFormula->Eval(pt, eta ));123 sz = gRandom->Gaus(0.0, fFormula->Eval(pt, eta ));124 sx = gRandom->Gaus(0.0, fFormula->Eval(pt, eta, phi, e)); 125 sy = gRandom->Gaus(0.0, fFormula->Eval(pt, eta, phi, e)); 126 sz = gRandom->Gaus(0.0, fFormula->Eval(pt, eta, phi, e)); 124 127 125 128 xd += sx; … … 130 133 dxy = (xd*py - yd*px)/pt; 131 134 132 ddxy = gRandom->Gaus(0.0, fFormula->Eval(pt, eta ));135 ddxy = gRandom->Gaus(0.0, fFormula->Eval(pt, eta, phi, e)); 133 136 134 137 // fill smeared values in candidate -
modules/Isolation.cc
rd870fc5 rd77b51d 25 25 * the transverse momenta fraction within (PTRatioMin, PTRatioMax]. 26 26 * 27 * \author P. Demin - UCL, Louvain-la-Neuve27 * \author P. Demin, M. Selvaggi, R. Gerosa - UCL, Louvain-la-Neuve 28 28 * 29 29 */ … … 153 153 Candidate *candidate, *isolation, *object; 154 154 TObjArray *isolationArray; 155 Double_t sum , ratio;155 Double_t sumCharged, sumNeutral, sumAllParticles, sumChargedPU, sumDBeta, ratioDBeta, sumRhoCorr, ratioRhoCorr; 156 156 Int_t counter; 157 157 Double_t eta = 0.0; 158 158 Double_t rho = 0.0; 159 160 if(fRhoInputArray && fRhoInputArray->GetEntriesFast() > 0)161 {162 candidate = static_cast<Candidate*>(fRhoInputArray->At(0));163 rho = candidate->Momentum.Pt();164 }165 159 166 160 // select isolation objects … … 178 172 const TLorentzVector &candidateMomentum = candidate->Momentum; 179 173 eta = TMath::Abs(candidateMomentum.Eta()); 180 181 // loop over all input tracks182 sum = 0.0;183 counter = 0;184 itIsolationArray.Reset();185 while((isolation = static_cast<Candidate*>(itIsolationArray.Next())))186 {187 const TLorentzVector &isolationMomentum = isolation->Momentum;188 189 if(candidateMomentum.DeltaR(isolationMomentum) <= fDeltaRMax &&190 candidate->GetUniqueID() != isolation->GetUniqueID())191 {192 sum += isolationMomentum.Pt();193 ++counter;194 }195 }196 174 197 175 // find rho … … 209 187 } 210 188 211 // correct sum for pile-up contamination 212 sum = sum - rho*fDeltaRMax*fDeltaRMax*TMath::Pi(); 213 214 ratio = sum/candidateMomentum.Pt(); 215 if((fUsePTSum && sum > fPTSumMax) || ratio > fPTRatioMax) continue; 216 189 // loop over all input tracks 190 191 sumNeutral = 0.0; 192 sumCharged = 0.0; 193 sumChargedPU = 0.0; 194 sumAllParticles = 0.0; 195 196 counter = 0; 197 itIsolationArray.Reset(); 198 199 while((isolation = static_cast<Candidate*>(itIsolationArray.Next()))) 200 { 201 const TLorentzVector &isolationMomentum = isolation->Momentum; 202 203 if(candidateMomentum.DeltaR(isolationMomentum) <= fDeltaRMax && 204 candidate->GetUniqueID() != isolation->GetUniqueID()) 205 { 206 sumAllParticles += isolationMomentum.Pt(); 207 if(isolation->Charge !=0) 208 { 209 sumCharged += isolationMomentum.Pt(); 210 if(isolation->IsRecoPU != 0) sumChargedPU += isolationMomentum.Pt(); 211 } 212 else 213 { 214 sumNeutral += isolationMomentum.Pt(); 215 } 216 ++counter; 217 } 218 } 219 220 // find rho 221 rho = 0.0; 222 if(fRhoInputArray) 223 { 224 fItRhoInputArray->Reset(); 225 while((object = static_cast<Candidate*>(fItRhoInputArray->Next()))) 226 { 227 if(eta >= object->Edges[0] && eta < object->Edges[1]) 228 { 229 rho = object->Momentum.Pt(); 230 } 231 } 232 } 233 234 // correct sum for pile-up contamination 235 sumDBeta = sumCharged + TMath::Max(sumNeutral-0.5*sumChargedPU,0.0); 236 sumRhoCorr = sumCharged + TMath::Max(sumNeutral-TMath::Max(rho,0.0)*fDeltaRMax*fDeltaRMax*TMath::Pi(),0.0); 237 ratioDBeta = sumDBeta/candidateMomentum.Pt(); 238 ratioRhoCorr = sumRhoCorr/candidateMomentum.Pt(); 239 240 candidate->IsolationVar = ratioDBeta; 241 candidate->IsolationVarRhoCorr = ratioRhoCorr; 242 candidate->SumPtCharged = sumCharged; 243 candidate->SumPtNeutral = sumNeutral; 244 candidate->SumPtChargedPU = sumChargedPU; 245 candidate->SumPt = sumAllParticles; 246 247 if((fUsePTSum && sumDBeta > fPTSumMax) || (!fUsePTSum && ratioDBeta > fPTRatioMax)) continue; 217 248 fOutputArray->Add(candidate); 218 249 } -
modules/JetPileUpSubtractor.cc
rd870fc5 rd77b51d 109 109 momentum = candidate->Momentum; 110 110 area = candidate->Area; 111 eta = TMath::Abs(momentum.Eta());111 eta = momentum.Eta(); 112 112 113 113 // find rho -
modules/ModulesLinkDef.h
rd870fc5 rd77b51d 29 29 30 30 #include "modules/AngularSmearing.h" 31 #include "modules/PhotonConversions.h" 31 32 #include "modules/ParticlePropagator.h" 32 33 #include "modules/Efficiency.h" … … 50 51 #include "modules/JetPileUpSubtractor.h" 51 52 #include "modules/TrackPileUpSubtractor.h" 53 #include "modules/TaggingParticlesSkimmer.h" 52 54 #include "modules/PileUpJetID.h" 53 55 #include "modules/ConstituentFilter.h" … … 57 59 #include "modules/Weighter.h" 58 60 #include "modules/Hector.h" 61 #include "modules/JetFlavorAssociation.h" 62 #include "modules/JetFakeParticle.h" 59 63 #include "modules/ExampleModule.h" 60 64 … … 68 72 69 73 #pragma link C++ class AngularSmearing+; 74 #pragma link C++ class PhotonConversions+; 70 75 #pragma link C++ class ParticlePropagator+; 71 76 #pragma link C++ class Efficiency+; … … 89 94 #pragma link C++ class JetPileUpSubtractor+; 90 95 #pragma link C++ class TrackPileUpSubtractor+; 96 #pragma link C++ class TaggingParticlesSkimmer+; 91 97 #pragma link C++ class PileUpJetID+; 92 98 #pragma link C++ class ConstituentFilter+; … … 96 102 #pragma link C++ class Weighter+; 97 103 #pragma link C++ class Hector+; 104 #pragma link C++ class JetFlavorAssociation+; 105 #pragma link C++ class JetFakeParticle+; 98 106 #pragma link C++ class ExampleModule+; 99 107 -
modules/MomentumSmearing.cc
rd870fc5 rd77b51d 96 96 { 97 97 Candidate *candidate, *mother; 98 Double_t pt, eta, phi ;98 Double_t pt, eta, phi, e; 99 99 100 100 fItInputArray->Reset(); … … 106 106 phi = candidatePosition.Phi(); 107 107 pt = candidateMomentum.Pt(); 108 e = candidateMomentum.E(); 108 109 109 110 // apply smearing formula 110 pt = gRandom->Gaus(pt, fFormula->Eval(pt, eta ) * pt);111 pt = gRandom->Gaus(pt, fFormula->Eval(pt, eta, phi, e) * pt); 111 112 112 113 if(pt <= 0.0) continue; -
modules/PdgCodeFilter.cc
rd870fc5 rd77b51d 74 74 fPTMin = GetDouble("PTMin", 0.0); 75 75 76 fInvertPdg = GetBool("InvertPdg", false); 77 78 fRequireStatus = GetBool("RequireStatus", false); 79 fStatus = GetInt("Status", 1); 80 76 81 // import input array 77 82 fInputArray = ImportArray(GetString("InputArray", "Delphes/allParticles")); … … 109 114 Double_t pt; 110 115 116 const Bool_t requireStatus = fRequireStatus; 117 const Bool_t invertPdg = fInvertPdg; 118 const int reqStatus = fStatus; 119 111 120 fItInputArray->Reset(); 112 121 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) … … 116 125 pt = candidateMomentum.Pt(); 117 126 127 if(pt < fPTMin) continue; 128 if(requireStatus && (candidate->Status != reqStatus)) continue; 129 118 130 pass = kTRUE; 119 120 if(pt < fPTMin) pass = kFALSE;121 131 if(find(fPdgCodes.begin(), fPdgCodes.end(), pdgCode) != fPdgCodes.end()) pass = kFALSE; 122 132 133 if (invertPdg) pass = !pass; 123 134 if(pass) fOutputArray->Add(candidate); 124 135 } -
modules/PdgCodeFilter.h
rd870fc5 rd77b51d 50 50 51 51 Double_t fPTMin; //! 52 Bool_t fInvertPdg; //! 53 Bool_t fRequireStatus; //! 54 Int_t fStatus; //! 52 55 53 56 std::vector<Int_t> fPdgCodes; -
modules/PileUpJetID.cc
rd870fc5 rd77b51d 1 /*2 * Delphes: a framework for fast simulation of a generic collider experiment3 * Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium4 *5 * This program is free software: you can redistribute it and/or modify6 * it under the terms of the GNU General Public License as published by7 * the Free Software Foundation, either version 3 of the License, or8 * (at your option) any later version.9 *10 * This program is distributed in the hope that it will be useful,11 * but WITHOUT ANY WARRANTY; without even the implied warranty of12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * GNU General Public License for more details.14 *15 * You should have received a copy of the GNU General Public License16 * along with this program. If not, see <http://www.gnu.org/licenses/>.17 */18 19 1 20 2 /** \class PileUpJetID 21 3 * 22 * CMS PileUp Jet ID Variables , based on http://cds.cern.ch/record/15815834 * CMS PileUp Jet ID Variables 23 5 * 24 * \author S. Zenz , December 20136 * \author S. Zenz 25 7 * 26 8 */ … … 41 23 #include "TRandom3.h" 42 24 #include "TObjArray.h" 43 #include "TDatabasePDG.h"25 //#include "TDatabasePDG.h" 44 26 #include "TLorentzVector.h" 45 27 … … 54 36 55 37 PileUpJetID::PileUpJetID() : 56 fItJetInputArray(0),fTrackInputArray(0),fNeutralInputArray(0) ,fItVertexInputArray(0)38 fItJetInputArray(0),fTrackInputArray(0),fNeutralInputArray(0) 57 39 { 58 40 … … 70 52 void PileUpJetID::Init() 71 53 { 54 72 55 fJetPTMin = GetDouble("JetPTMin", 20.0); 73 56 fParameterR = GetDouble("ParameterR", 0.5); 74 57 fUseConstituents = GetInt("UseConstituents", 0); 75 58 59 fMeanSqDeltaRMaxBarrel = GetDouble("MeanSqDeltaRMaxBarrel",0.1); 60 fBetaMinBarrel = GetDouble("BetaMinBarrel",0.1); 61 fMeanSqDeltaRMaxEndcap = GetDouble("MeanSqDeltaRMaxEndcap",0.1); 62 fBetaMinEndcap = GetDouble("BetaMinEndcap",0.1); 63 fMeanSqDeltaRMaxForward = GetDouble("MeanSqDeltaRMaxForward",0.1); 64 fJetPTMinForNeutrals = GetDouble("JetPTMinForNeutrals", 20.0); 65 fNeutralPTMin = GetDouble("NeutralPTMin", 2.0); 66 76 67 fAverageEachTower = false; // for timing 77 68 … … 81 72 fItJetInputArray = fJetInputArray->MakeIterator(); 82 73 83 fTrackInputArray = ImportArray(GetString("TrackInputArray", " Calorimeter/eflowTracks"));74 fTrackInputArray = ImportArray(GetString("TrackInputArray", "ParticlePropagator/tracks")); 84 75 fItTrackInputArray = fTrackInputArray->MakeIterator(); 85 76 86 fNeutralInputArray = ImportArray(GetString("NeutralInputArray", " Calorimeter/eflowTowers"));77 fNeutralInputArray = ImportArray(GetString("NeutralInputArray", "ParticlePropagator/tracks")); 87 78 fItNeutralInputArray = fNeutralInputArray->MakeIterator(); 88 79 89 fVertexInputArray = ImportArray(GetString("VertexInputArray", "PileUpMerger/vertices"));90 fItVertexInputArray = fVertexInputArray->MakeIterator();91 92 fZVertexResolution = GetDouble("ZVertexResolution", 0.005)*1.0E3;93 94 80 // create output array(s) 95 81 96 82 fOutputArray = ExportArray(GetString("OutputArray", "jets")); 83 84 fNeutralsInPassingJets = ExportArray(GetString("NeutralsInPassingJets","eflowtowers")); 85 97 86 } 98 87 … … 101 90 void PileUpJetID::Finish() 102 91 { 92 // cout << "In finish" << endl; 93 103 94 if(fItJetInputArray) delete fItJetInputArray; 104 95 if(fItTrackInputArray) delete fItTrackInputArray; 105 96 if(fItNeutralInputArray) delete fItNeutralInputArray; 106 if(fItVertexInputArray) delete fItVertexInputArray; 97 107 98 } 108 99 … … 113 104 Candidate *candidate, *constituent; 114 105 TLorentzVector momentum, area; 115 Int_t i, nc, nn; 116 Double_t sumpt, sumptch, sumptchpv, sumptchpu, sumdrsqptsq, sumptsq; 117 Double_t dr, pt, pt_ann[5]; 118 Double_t zvtx = 0.0; 119 120 Candidate *track; 121 122 // find z position of primary vertex 123 124 fItVertexInputArray->Reset(); 125 while((candidate = static_cast<Candidate*>(fItVertexInputArray->Next()))) 126 { 127 if(!candidate->IsPU) 128 { 129 zvtx = candidate->Position.Z(); 130 break; 131 } 132 } 106 107 Candidate *trk; 133 108 134 109 // loop over all input candidates … … 139 114 area = candidate->Area; 140 115 141 sumpt = 0.0; 142 sumptch = 0.0; 143 sumptchpv = 0.0; 144 sumptchpu = 0.0; 145 sumdrsqptsq = 0.0; 146 sumptsq = 0.0; 147 nc = 0; 148 nn = 0; 149 150 for(i = 0; i < 5; ++i) 151 { 152 pt_ann[i] = 0.0; 153 } 154 155 if(fUseConstituents) 156 { 116 float sumT0 = 0.; 117 float sumT1 = 0.; 118 float sumT10 = 0.; 119 float sumT20 = 0.; 120 float sumT30 = 0.; 121 float sumT40 = 0.; 122 float sumWeightsForT = 0.; 123 candidate->NTimeHits = 0; 124 125 float sumpt = 0.; 126 float sumptch = 0.; 127 float sumptchpv = 0.; 128 float sumptchpu = 0.; 129 float sumdrsqptsq = 0.; 130 float sumptsq = 0.; 131 int nc = 0; 132 int nn = 0; 133 float pt_ann[5]; 134 135 for (int i = 0 ; i < 5 ; i++) { 136 pt_ann[i] = 0.; 137 } 138 139 if (fUseConstituents) { 157 140 TIter itConstituents(candidate->GetCandidates()); 158 while((constituent = static_cast<Candidate*>(itConstituents.Next()))) 159 { 160 pt = constituent->Momentum.Pt(); 161 dr = candidate->Momentum.DeltaR(constituent->Momentum); 162 sumpt += pt; 163 sumdrsqptsq += dr*dr*pt*pt; 164 sumptsq += pt*pt; 165 if(constituent->Charge == 0) 166 { 167 // neutrals 168 ++nn; 169 } 170 else 171 { 172 // charged 173 if(constituent->IsPU && TMath::Abs(constituent->Position.Z()-zvtx) > fZVertexResolution) 174 { 175 sumptchpu += pt; 176 } 177 else 178 { 179 sumptchpv += pt; 180 } 181 sumptch += pt; 182 ++nc; 183 } 184 for(i = 0; i < 5; ++i) 185 { 186 if(dr > 0.1*i && dr < 0.1*(i + 1)) 187 { 188 pt_ann[i] += pt; 189 } 190 } 191 } 192 } 193 else 194 { 141 while((constituent = static_cast<Candidate*>(itConstituents.Next()))) { 142 float pt = constituent->Momentum.Pt(); 143 float dr = candidate->Momentum.DeltaR(constituent->Momentum); 144 // cout << " There exists a constituent with dr=" << dr << endl; 145 sumpt += pt; 146 sumdrsqptsq += dr*dr*pt*pt; 147 sumptsq += pt*pt; 148 if (constituent->Charge == 0) { 149 nn++; 150 } else { 151 if (constituent->IsRecoPU) { 152 sumptchpu += pt; 153 } else { 154 sumptchpv += pt; 155 } 156 sumptch += pt; 157 nc++; 158 } 159 for (int i = 0 ; i < 5 ; i++) { 160 if (dr > 0.1*i && dr < 0.1*(i+1)) { 161 pt_ann[i] += pt; 162 } 163 } 164 float tow_sumT = 0; 165 float tow_sumW = 0; 166 for (int i = 0 ; i < constituent->ECalEnergyTimePairs.size() ; i++) { 167 float w = TMath::Sqrt(constituent->ECalEnergyTimePairs[i].first); 168 if (fAverageEachTower) { 169 tow_sumT += w*constituent->ECalEnergyTimePairs[i].second; 170 tow_sumW += w; 171 } else { 172 sumT0 += w*constituent->ECalEnergyTimePairs[i].second; 173 sumT1 += w*gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second,0.001); 174 sumT10 += w*gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second,0.010); 175 sumT20 += w*gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second,0.020); 176 sumT30 += w*gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second,0.030); 177 sumT40 += w*gRandom->Gaus(constituent->ECalEnergyTimePairs[i].second,0.040); 178 sumWeightsForT += w; 179 candidate->NTimeHits++; 180 } 181 } 182 if (fAverageEachTower && tow_sumW > 0.) { 183 sumT0 += tow_sumT; 184 sumT1 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.001); 185 sumT10 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.0010); 186 sumT20 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.0020); 187 sumT30 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.0030); 188 sumT40 += tow_sumW*gRandom->Gaus(tow_sumT/tow_sumW,0.0040); 189 sumWeightsForT += tow_sumW; 190 candidate->NTimeHits++; 191 } 192 } 193 } else { 195 194 // Not using constituents, using dr 196 195 fItTrackInputArray->Reset(); 197 while((track = static_cast<Candidate*>(fItTrackInputArray->Next()))) 198 { 199 if(track->Momentum.DeltaR(candidate->Momentum) < fParameterR) 200 { 201 pt = track->Momentum.Pt(); 202 sumpt += pt; 203 sumptch += pt; 204 if(track->IsPU && TMath::Abs(track->Position.Z()-zvtx) > fZVertexResolution) 205 { 206 sumptchpu += pt; 207 } 208 else 209 { 210 sumptchpv += pt; 211 } 212 dr = candidate->Momentum.DeltaR(track->Momentum); 213 sumdrsqptsq += dr*dr*pt*pt; 214 sumptsq += pt*pt; 215 nc++; 216 for(i = 0; i < 5; ++i) 217 { 218 if(dr > 0.1*i && dr < 0.1*(i + 1)) 219 { 220 pt_ann[i] += pt; 221 } 222 } 223 } 224 } 225 196 while ((trk = static_cast<Candidate*>(fItTrackInputArray->Next()))) { 197 if (trk->Momentum.DeltaR(candidate->Momentum) < fParameterR) { 198 float pt = trk->Momentum.Pt(); 199 sumpt += pt; 200 sumptch += pt; 201 if (trk->IsRecoPU) { 202 sumptchpu += pt; 203 } else { 204 sumptchpv += pt; 205 } 206 float dr = candidate->Momentum.DeltaR(trk->Momentum); 207 sumdrsqptsq += dr*dr*pt*pt; 208 sumptsq += pt*pt; 209 nc++; 210 for (int i = 0 ; i < 5 ; i++) { 211 if (dr > 0.1*i && dr < 0.1*(i+1)) { 212 pt_ann[i] += pt; 213 } 214 } 215 } 216 } 226 217 fItNeutralInputArray->Reset(); 227 while ((constituent = static_cast<Candidate*>(fItNeutralInputArray->Next()))) 228 { 229 if(constituent->Momentum.DeltaR(candidate->Momentum) < fParameterR) 230 { 231 pt = constituent->Momentum.Pt(); 232 sumpt += pt; 233 dr = candidate->Momentum.DeltaR(constituent->Momentum); 234 sumdrsqptsq += dr*dr*pt*pt; 235 sumptsq += pt*pt; 236 nn++; 237 for(i = 0; i < 5; ++i) 238 { 239 if(dr > 0.1*i && dr < 0.1*(i + 1)) 240 { 241 pt_ann[i] += pt; 242 } 243 } 244 } 245 } 246 } 247 248 if(sumptch > 0.0) 249 { 250 candidate->Beta = sumptchpu/sumptch; 251 candidate->BetaStar = sumptchpv/sumptch; 252 } 253 else 254 { 255 candidate->Beta = -999.0; 256 candidate->BetaStar = -999.0; 257 } 258 if(sumptsq > 0.0) 259 { 218 while ((constituent = static_cast<Candidate*>(fItNeutralInputArray->Next()))) { 219 if (constituent->Momentum.DeltaR(candidate->Momentum) < fParameterR) { 220 float pt = constituent->Momentum.Pt(); 221 sumpt += pt; 222 float dr = candidate->Momentum.DeltaR(constituent->Momentum); 223 sumdrsqptsq += dr*dr*pt*pt; 224 sumptsq += pt*pt; 225 nn++; 226 for (int i = 0 ; i < 5 ; i++) { 227 if (dr > 0.1*i && dr < 0.1*(i+1)) { 228 pt_ann[i] += pt; 229 } 230 } 231 } 232 } 233 } 234 235 if (sumptch > 0.) { 236 candidate->Beta = sumptchpv/sumptch; 237 candidate->BetaStar = sumptchpu/sumptch; 238 } else { 239 candidate->Beta = -999.; 240 candidate->BetaStar = -999.; 241 } 242 if (sumptsq > 0.) { 260 243 candidate->MeanSqDeltaR = sumdrsqptsq/sumptsq; 261 } 262 else 263 { 264 candidate->MeanSqDeltaR = -999.0; 244 } else { 245 candidate->MeanSqDeltaR = -999.; 265 246 } 266 247 candidate->NCharged = nc; 267 248 candidate->NNeutrals = nn; 268 if(sumpt > 0.0) 269 { 249 if (sumpt > 0.) { 270 250 candidate->PTD = TMath::Sqrt(sumptsq) / sumpt; 271 for(i = 0; i < 5; ++i) 272 { 251 for (int i = 0 ; i < 5 ; i++) { 273 252 candidate->FracPt[i] = pt_ann[i]/sumpt; 274 253 } 275 } 276 else 277 { 278 candidate->PTD = -999.0; 279 for(i = 0; i < 5; ++i) 280 { 281 candidate->FracPt[i] = -999.0; 254 } else { 255 candidate->PTD = -999.; 256 for (int i = 0 ; i < 5 ; i++) { 257 candidate->FracPt[i] = -999.; 282 258 } 283 259 } 284 260 285 261 fOutputArray->Add(candidate); 262 263 // New stuff 264 /* 265 fMeanSqDeltaRMaxBarrel = GetDouble("MeanSqDeltaRMaxBarrel",0.1); 266 fBetaMinBarrel = GetDouble("BetaMinBarrel",0.1); 267 fMeanSqDeltaRMaxEndcap = GetDouble("MeanSqDeltaRMaxEndcap",0.1); 268 fBetaMinEndcap = GetDouble("BetaMinEndcap",0.1); 269 fMeanSqDeltaRMaxForward = GetDouble("MeanSqDeltaRMaxForward",0.1); 270 */ 271 272 bool passId = false; 273 if (candidate->Momentum.Pt() > fJetPTMinForNeutrals && candidate->MeanSqDeltaR > -0.1) { 274 if (fabs(candidate->Momentum.Eta())<1.5) { 275 passId = ((candidate->Beta > fBetaMinBarrel) && (candidate->MeanSqDeltaR < fMeanSqDeltaRMaxBarrel)); 276 } else if (fabs(candidate->Momentum.Eta())<4.0) { 277 passId = ((candidate->Beta > fBetaMinEndcap) && (candidate->MeanSqDeltaR < fMeanSqDeltaRMaxEndcap)); 278 } else { 279 passId = (candidate->MeanSqDeltaR < fMeanSqDeltaRMaxForward); 280 } 281 } 282 283 // cout << " Pt Eta MeanSqDeltaR Beta PassId " << candidate->Momentum.Pt() 284 // << " " << candidate->Momentum.Eta() << " " << candidate->MeanSqDeltaR << " " << candidate->Beta << " " << passId << endl; 285 286 if (passId) { 287 if (fUseConstituents) { 288 TIter itConstituents(candidate->GetCandidates()); 289 while((constituent = static_cast<Candidate*>(itConstituents.Next()))) { 290 if (constituent->Charge == 0 && constituent->Momentum.Pt() > fNeutralPTMin) { 291 fNeutralsInPassingJets->Add(constituent); 292 // cout << " Constitutent added Pt Eta Charge " << constituent->Momentum.Pt() << " " << constituent->Momentum.Eta() << " " << constituent->Charge << endl; 293 } 294 } 295 } else { // use DeltaR 296 fItNeutralInputArray->Reset(); 297 while ((constituent = static_cast<Candidate*>(fItNeutralInputArray->Next()))) { 298 if (constituent->Momentum.DeltaR(candidate->Momentum) < fParameterR && constituent->Momentum.Pt() > fNeutralPTMin) { 299 fNeutralsInPassingJets->Add(constituent); 300 // cout << " Constitutent added Pt Eta Charge " << constituent->Momentum.Pt() << " " << constituent->Momentum.Eta() << " " << constituent->Charge << endl; 301 } 302 } 303 } 304 } 305 306 286 307 } 287 308 } 288 309 289 310 //------------------------------------------------------------------------------ 290 -
modules/PileUpJetID.h
rd870fc5 rd77b51d 1 /*2 * Delphes: a framework for fast simulation of a generic collider experiment3 * Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium4 *5 * This program is free software: you can redistribute it and/or modify6 * it under the terms of the GNU General Public License as published by7 * the Free Software Foundation, either version 3 of the License, or8 * (at your option) any later version.9 *10 * This program is distributed in the hope that it will be useful,11 * but WITHOUT ANY WARRANTY; without even the implied warranty of12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * GNU General Public License for more details.14 *15 * You should have received a copy of the GNU General Public License16 * along with this program. If not, see <http://www.gnu.org/licenses/>.17 */18 19 1 #ifndef PileUpJetID_h 20 2 #define PileUpJetID_h … … 22 4 /** \class PileUpJetID 23 5 * 24 * CMS PileUp Jet ID Variables , based on http://cds.cern.ch/record/15815836 * CMS PileUp Jet ID Variables 25 7 * 26 * \author S. Zenz , December 20138 * \author S. Zenz 27 9 * 28 10 */ … … 34 16 35 17 class TObjArray; 18 class DelphesFormula; 36 19 37 20 class PileUpJetID: public DelphesModule … … 51 34 Double_t fParameterR; 52 35 36 Double_t fMeanSqDeltaRMaxBarrel; // |eta| < 1.5 37 Double_t fBetaMinBarrel; // |eta| < 2.5 38 Double_t fMeanSqDeltaRMaxEndcap; // 1.5 < |eta| < 4.0 39 Double_t fBetaMinEndcap; // 1.5 < |eta| < 4.0 40 Double_t fMeanSqDeltaRMaxForward; // |eta| > 4.0 41 42 Double_t fNeutralPTMin; 43 Double_t fJetPTMinForNeutrals; 44 45 /* 46 JAY 47 --- 48 49 |Eta|<1.5 50 51 meanSqDeltaR betaStar SigEff BgdEff 52 0.13 0.92 96% 8% 53 0.13 0.95 97% 16% 54 0.13 0.97 98% 27% 55 56 |Eta|>1.5 57 58 meanSqDeltaR betaStar SigEff BgdEff 59 0.14 0.91 95% 15% 60 0.14 0.94 97% 19% 61 0.14 0.97 98% 29% 62 63 BRYAN 64 ----- 65 66 Barrel (MeanSqDR, Beta, sig eff, bg eff): 67 0.10, 0.08, 90%, 8% 68 0.11, 0.12, 90%, 6% 69 0.13, 0.16, 89%, 5% 70 71 Endcap (MeanSqDR, Beta, sig eff, bg eff): 72 0.07, 0.06, 89%, 4% 73 0.08, 0.08, 92%, 6% 74 0.09, 0.08, 95%, 10% 75 0.10, 0.08, 97%, 13% 76 77 SETH GUESSES FOR |eta| > 4.0 78 ---------------------------- 79 80 MeanSqDeltaR 81 0.07 82 0.10 83 0.14 84 0.2 85 */ 86 53 87 // If set to true, may have weird results for PFCHS 54 88 // If set to false, uses everything within dR < fParameterR even if in other jets &c. 55 89 // Results should be very similar for PF 56 Int_t fUseConstituents; 90 Int_t fUseConstituents; 57 91 58 92 Bool_t fAverageEachTower; … … 62 96 const TObjArray *fJetInputArray; //! 63 97 64 const TObjArray *fTrackInputArray; // !65 const TObjArray *fNeutralInputArray; //!98 const TObjArray *fTrackInputArray; // SCZ 99 const TObjArray *fNeutralInputArray; 66 100 67 TIterator *fItTrackInputArray; // !68 TIterator *fItNeutralInputArray; // !101 TIterator *fItTrackInputArray; // SCZ 102 TIterator *fItNeutralInputArray; // SCZ 69 103 70 104 TObjArray *fOutputArray; //! 105 TObjArray *fNeutralsInPassingJets; // SCZ 71 106 72 TIterator *fItVertexInputArray; //!73 const TObjArray *fVertexInputArray; //!74 107 75 Double_t fZVertexResolution; 76 77 ClassDef(PileUpJetID, 1) 108 ClassDef(PileUpJetID, 2) 78 109 }; 79 110 80 111 #endif 81 -
modules/PileUpMerger.cc
rd870fc5 rd77b51d 80 80 fTVertexSpread = GetDouble("TVertexSpread", 1.5E-09); 81 81 82 fInputBeamSpotX = GetDouble("InputBeamSpotX", 0.0); 83 fInputBeamSpotY = GetDouble("InputBeamSpotY", 0.0); 84 fOutputBeamSpotX = GetDouble("OutputBeamSpotX", 0.0); 85 fOutputBeamSpotY = GetDouble("OutputBeamSpotY", 0.0); 86 82 87 // read vertex smearing formula 83 88 … … 111 116 TParticlePDG *pdgParticle; 112 117 Int_t pid; 113 Float_t x, y, z, t ;118 Float_t x, y, z, t, vx, vy; 114 119 Float_t px, py, pz, e; 115 120 Double_t dz, dphi, dt; 116 Int_t numberOfEvents, event ;121 Int_t numberOfEvents, event, numberOfParticles; 117 122 Long64_t allEntries, entry; 118 Candidate *candidate, *vertex candidate;123 Candidate *candidate, *vertex; 119 124 DelphesFactory *factory; 120 125 … … 123 128 fItInputArray->Reset(); 124 129 125 // --- Deal with Primary vertex first ------130 // --- Deal with primary vertex first ------ 126 131 127 132 fFunction->GetRandom2(dz, dt); … … 129 134 dt *= c_light*1.0E3; // necessary in order to make t in mm/c 130 135 dz *= 1.0E3; // necessary in order to make z in mm 131 136 vx = 0.0; 137 vy = 0.0; 138 numberOfParticles = fInputArray->GetEntriesFast(); 132 139 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 133 140 { 141 vx += candidate->Position.X(); 142 vy += candidate->Position.Y(); 134 143 z = candidate->Position.Z(); 135 144 t = candidate->Position.T(); … … 139 148 } 140 149 150 if(numberOfParticles > 0) 151 { 152 vx /= numberOfParticles; 153 vy /= numberOfParticles; 154 } 155 141 156 factory = GetFactory(); 142 157 143 vertex candidate= factory->NewCandidate();144 vertex candidate->Position.SetXYZT(0.0, 0.0, dz, dt);145 fVertexOutputArray->Add(vertex candidate);158 vertex = factory->NewCandidate(); 159 vertex->Position.SetXYZT(vx, vy, dz, dt); 160 fVertexOutputArray->Add(vertex); 146 161 147 162 // --- Then with pile-up vertices ------ … … 181 196 dphi = gRandom->Uniform(-TMath::Pi(), TMath::Pi()); 182 197 183 vertexcandidate = factory->NewCandidate(); 184 vertexcandidate->Position.SetXYZT(0.0, 0.0, dz, dt); 185 vertexcandidate->IsPU = 1; 186 187 fVertexOutputArray->Add(vertexcandidate); 188 198 vx = 0.0; 199 vy = 0.0; 200 numberOfParticles = 0; 189 201 while(fReader->ReadParticle(pid, x, y, z, t, px, py, pz, e)) 190 202 { … … 204 216 candidate->Momentum.RotateZ(dphi); 205 217 218 x -= fInputBeamSpotX; 219 y -= fInputBeamSpotY; 206 220 candidate->Position.SetXYZT(x, y, z + dz, t + dt); 207 221 candidate->Position.RotateZ(dphi); 222 candidate->Position += TLorentzVector(fOutputBeamSpotX, fOutputBeamSpotY, 0.0, 0.0); 223 224 vx += candidate->Position.X(); 225 vy += candidate->Position.Y(); 226 ++numberOfParticles; 208 227 209 228 fParticleOutputArray->Add(candidate); 210 229 } 211 } 212 } 213 214 //------------------------------------------------------------------------------ 215 230 231 if(numberOfParticles > 0) 232 { 233 vx /= numberOfParticles; 234 vy /= numberOfParticles; 235 } 236 237 vertex = factory->NewCandidate(); 238 vertex->Position.SetXYZT(vx, vy, dz, dt); 239 vertex->IsPU = 1; 240 241 fVertexOutputArray->Add(vertex); 242 } 243 } 244 245 //------------------------------------------------------------------------------ -
modules/PileUpMerger.h
rd870fc5 rd77b51d 53 53 Double_t fTVertexSpread; 54 54 55 Double_t fInputBeamSpotX; 56 Double_t fInputBeamSpotY; 57 Double_t fOutputBeamSpotX; 58 Double_t fOutputBeamSpotY; 59 55 60 DelphesTF2 *fFunction; //! 56 61 -
modules/PileUpMergerPythia8.cc
rd870fc5 rd77b51d 21 21 * Merges particles from pile-up sample into event 22 22 * 23 * \author P. Selvaggi - UCL, Louvain-la-Neuve23 * \author M. Selvaggi - UCL, Louvain-la-Neuve 24 24 * 25 25 */ … … 29 29 #include "classes/DelphesClasses.h" 30 30 #include "classes/DelphesFactory.h" 31 #include "classes/Delphes Formula.h"31 #include "classes/DelphesTF2.h" 32 32 #include "classes/DelphesPileUpReader.h" 33 33 … … 56 56 57 57 PileUpMergerPythia8::PileUpMergerPythia8() : 58 fPythia(0), fItInputArray(0) 59 { 58 fFunction(0), fPythia(0), fItInputArray(0) 59 { 60 fFunction = new DelphesTF2; 60 61 } 61 62 … … 64 65 PileUpMergerPythia8::~PileUpMergerPythia8() 65 66 { 67 delete fFunction; 66 68 } 67 69 … … 72 74 const char *fileName; 73 75 76 fPileUpDistribution = GetInt("PileUpDistribution", 0); 77 74 78 fMeanPileUp = GetDouble("MeanPileUp", 10); 75 fZVertexSpread = GetDouble("ZVertexSpread", 0.05)*1.0E3; 79 80 fZVertexSpread = GetDouble("ZVertexSpread", 0.15); 81 fTVertexSpread = GetDouble("TVertexSpread", 1.5E-09); 82 83 fInputBeamSpotX = GetDouble("InputBeamSpotX", 0.0); 84 fInputBeamSpotY = GetDouble("InputBeamSpotY", 0.0); 85 fOutputBeamSpotX = GetDouble("OutputBeamSpotX", 0.0); 86 fOutputBeamSpotY = GetDouble("OutputBeamSpotY", 0.0); 76 87 77 88 fPTMin = GetDouble("PTMin", 0.0); 89 90 fFunction->Compile(GetString("VertexDistributionFormula", "0.0")); 91 fFunction->SetRange(-fZVertexSpread, -fTVertexSpread, fZVertexSpread, fTVertexSpread); 78 92 79 93 fileName = GetString("ConfigFile", "MinBias.cmnd"); … … 86 100 87 101 // create output arrays 88 fOutputArray = ExportArray(GetString("OutputArray", "stableParticles")); 102 fParticleOutputArray = ExportArray(GetString("ParticleOutputArray", "stableParticles")); 103 fVertexOutputArray = ExportArray(GetString("VertexOutputArray", "vertices")); 89 104 } 90 105 … … 102 117 TDatabasePDG *pdg = TDatabasePDG::Instance(); 103 118 TParticlePDG *pdgParticle; 104 Int_t pid ;105 Float_t x, y, z, t ;119 Int_t pid, status; 120 Float_t x, y, z, t, vx, vy; 106 121 Float_t px, py, pz, e; 107 Double_t dz, dphi ;108 Int_t poisson, event, i;109 Candidate *candidate ;122 Double_t dz, dphi, dt; 123 Int_t numberOfEvents, event, numberOfParticles, i; 124 Candidate *candidate, *vertex; 110 125 DelphesFactory *factory; 111 126 127 const Double_t c_light = 2.99792458E8; 128 112 129 fItInputArray->Reset(); 130 131 // --- Deal with primary vertex first ------ 132 133 fFunction->GetRandom2(dz, dt); 134 135 dt *= c_light*1.0E3; // necessary in order to make t in mm/c 136 dz *= 1.0E3; // necessary in order to make z in mm 137 vx = 0.0; 138 vy = 0.0; 139 numberOfParticles = fInputArray->GetEntriesFast(); 113 140 while((candidate = static_cast<Candidate*>(fItInputArray->Next()))) 114 141 { 115 fOutputArray->Add(candidate); 142 vx += candidate->Position.X(); 143 vy += candidate->Position.Y(); 144 z = candidate->Position.Z(); 145 t = candidate->Position.T(); 146 candidate->Position.SetZ(z + dz); 147 candidate->Position.SetT(t + dt); 148 fParticleOutputArray->Add(candidate); 149 } 150 151 if(numberOfParticles > 0) 152 { 153 vx /= numberOfParticles; 154 vy /= numberOfParticles; 116 155 } 117 156 118 157 factory = GetFactory(); 119 158 120 poisson = gRandom->Poisson(fMeanPileUp); 121 122 for(event = 0; event < poisson; ++event) 159 vertex = factory->NewCandidate(); 160 vertex->Position.SetXYZT(vx, vy, dz, dt); 161 fVertexOutputArray->Add(vertex); 162 163 // --- Then with pile-up vertices ------ 164 165 switch(fPileUpDistribution) 166 { 167 case 0: 168 numberOfEvents = gRandom->Poisson(fMeanPileUp); 169 break; 170 case 1: 171 numberOfEvents = gRandom->Integer(2*fMeanPileUp + 1); 172 break; 173 default: 174 numberOfEvents = gRandom->Poisson(fMeanPileUp); 175 break; 176 } 177 178 for(event = 0; event < numberOfEvents; ++event) 123 179 { 124 180 while(!fPythia->next()); 125 181 126 dz = gRandom->Gaus(0.0, fZVertexSpread); 182 // --- Pile-up vertex smearing 183 184 fFunction->GetRandom2(dz, dt); 185 186 dt *= c_light*1.0E3; // necessary in order to make t in mm/c 187 dz *= 1.0E3; // necessary in order to make z in mm 188 127 189 dphi = gRandom->Uniform(-TMath::Pi(), TMath::Pi()); 128 190 129 for(i = 1; i < fPythia->event.size(); ++i) 191 vx = 0.0; 192 vy = 0.0; 193 numberOfParticles = fPythia->event.size(); 194 for(i = 1; i < numberOfParticles; ++i) 130 195 { 131 196 Pythia8::Particle &particle = fPythia->event[i]; 132 197 133 if(particle.status() != 1 || !particle.isVisible() || particle.pT() <= fPTMin) continue; 198 status = particle.statusHepMC(); 199 200 if(status != 1 || !particle.isVisible() || particle.pT() <= fPTMin) continue; 134 201 135 202 pid = particle.id(); … … 152 219 candidate->Momentum.RotateZ(dphi); 153 220 154 candidate->Position.SetXYZT(x, y, z + dz, t); 221 x -= fInputBeamSpotX; 222 y -= fInputBeamSpotY; 223 candidate->Position.SetXYZT(x, y, z + dz, t + dt); 155 224 candidate->Position.RotateZ(dphi); 156 157 fOutputArray->Add(candidate); 225 candidate->Position += TLorentzVector(fOutputBeamSpotX, fOutputBeamSpotY, 0.0, 0.0); 226 227 vx += candidate->Position.X(); 228 vy += candidate->Position.Y(); 229 230 fParticleOutputArray->Add(candidate); 158 231 } 159 } 160 } 161 162 //------------------------------------------------------------------------------ 163 232 233 if(numberOfParticles > 0) 234 { 235 vx /= numberOfParticles; 236 vy /= numberOfParticles; 237 } 238 239 vertex = factory->NewCandidate(); 240 vertex->Position.SetXYZT(vx, vy, dz, dt); 241 vertex->IsPU = 1; 242 243 fVertexOutputArray->Add(vertex); 244 } 245 } 246 247 //------------------------------------------------------------------------------ -
modules/PileUpMergerPythia8.h
rd870fc5 rd77b51d 31 31 32 32 class TObjArray; 33 class DelphesTF2; 33 34 34 35 namespace Pythia8 … … 50 51 private: 51 52 53 Int_t fPileUpDistribution; 52 54 Double_t fMeanPileUp; 55 53 56 Double_t fZVertexSpread; 57 Double_t fTVertexSpread; 58 59 Double_t fInputBeamSpotX; 60 Double_t fInputBeamSpotY; 61 Double_t fOutputBeamSpotX; 62 Double_t fOutputBeamSpotY; 63 54 64 Double_t fPTMin; 65 66 DelphesTF2 *fFunction; //! 55 67 56 68 Pythia8::Pythia *fPythia; //! … … 60 72 const TObjArray *fInputArray; //! 61 73 62 TObjArray *fOutputArray; //! 74 TObjArray *fParticleOutputArray; //! 75 TObjArray *fVertexOutputArray; //! 63 76 64 77 ClassDef(PileUpMergerPythia8, 1) -
modules/SimpleCalorimeter.cc
rd870fc5 rd77b51d 150 150 fEnergySignificanceMin = GetDouble("EnergySignificanceMin", 0.0); 151 151 152 // flag that says if current calo is Ecal of Hcal (will then fill correct values of Eem and Ehad) 153 fIsEcal = GetBool("IsEcal", false); 154 152 155 // switch on or off the dithering of the center of calorimeter towers 153 f DitherTowerCenter = GetBool("DitherTowerCenter", true);156 fSmearTowerCenter = GetBool("SmearTowerCenter", true); 154 157 155 158 // read resolution formulas … … 409 412 if(energy < fEnergyMin || energy < fEnergySignificanceMin*sigma) energy = 0.0; 410 413 411 if(f DitherTowerCenter)414 if(fSmearTowerCenter) 412 415 { 413 416 eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]); … … 424 427 fTower->Position.SetPtEtaPhiE(1.0, eta, phi, time); 425 428 fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy); 429 430 fTower->Eem = (!fIsEcal) ? 0 : energy; 431 fTower->Ehad = (fIsEcal) ? 0 : energy; 426 432 427 433 fTower->Edges[0] = fTowerEdges[0]; … … 447 453 pt = energy / TMath::CosH(eta); 448 454 455 tower->Eem = (!fIsEcal) ? 0 : energy; 456 tower->Ehad = (fIsEcal) ? 0 : energy; 457 449 458 tower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy); 450 459 fEFlowTowerOutputArray->Add(tower); -
modules/SimpleCalorimeter.h
rd870fc5 rd77b51d 1 1 2 /* 2 3 * Delphes: a framework for fast simulation of a generic collider experiment … … 72 73 Double_t fEnergySignificanceMin; 73 74 74 Bool_t fDitherTowerCenter; 75 Bool_t fSmearTowerCenter; 76 77 Bool_t fIsEcal; //! 75 78 76 79 TFractionMap fFractionMap; //! -
modules/TauTagging.cc
rd870fc5 rd77b51d 33 33 #include "classes/DelphesFactory.h" 34 34 #include "classes/DelphesFormula.h" 35 36 #include "ExRootAnalysis/ExRootResult.h"37 #include "ExRootAnalysis/ExRootFilter.h"38 #include "ExRootAnalysis/ExRootClassifier.h"39 35 40 36 #include "TMath.h" … … 53 49 using namespace std; 54 50 55 //------------------------------------------------------------------------------56 57 class TauTaggingPartonClassifier : public ExRootClassifier58 {59 public:60 61 TauTaggingPartonClassifier(const TObjArray *array);62 63 Int_t GetCategory(TObject *object);64 65 Double_t fEtaMax, fPTMin;66 67 const TObjArray *fParticleInputArray;68 };69 51 70 52 //------------------------------------------------------------------------------ … … 79 61 { 80 62 Candidate *tau = static_cast<Candidate *>(object); 81 Candidate *daughter = 0; 63 Candidate *daughter1 = 0; 64 Candidate *daughter2 = 0; 65 82 66 const TLorentzVector &momentum = tau->Momentum; 83 Int_t pdgCode, i ;67 Int_t pdgCode, i, j; 84 68 85 69 pdgCode = TMath::Abs(tau->PID); … … 90 74 if(tau->D1 < 0) return -1; 91 75 76 if(tau->D2 < tau->D1) return -1; 77 92 78 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || 93 79 tau->D2 >= fParticleInputArray->GetEntriesFast()) … … 98 84 for(i = tau->D1; i <= tau->D2; ++i) 99 85 { 100 daughter = static_cast<Candidate *>(fParticleInputArray->At(i)); 101 pdgCode = TMath::Abs(daughter->PID); 102 if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15 || pdgCode == 24) return -1; 86 daughter1 = static_cast<Candidate *>(fParticleInputArray->At(i)); 87 pdgCode = TMath::Abs(daughter1->PID); 88 if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15) return -1; 89 else if(pdgCode == 24) 90 { 91 if(daughter1->D1 < 0) return -1; 92 for(j = daughter1->D1; j <= daughter1->D2; ++j) 93 { 94 daughter2 = static_cast<Candidate*>(fParticleInputArray->At(j)); 95 pdgCode = TMath::Abs(daughter2->PID); 96 if(pdgCode == 11 || pdgCode == 13) return -1; 97 } 98 99 } 103 100 } 104 101 … … 206 203 tauArray = fFilter->GetSubArray(fClassifier, 0); 207 204 208 if(tauArray == 0) return;209 210 TIter itTauArray(tauArray);211 212 205 // loop over all input jets 213 206 fItJetInputArray->Reset(); … … 222 215 223 216 // loop over all input taus 224 itTauArray.Reset(); 225 while((tau = static_cast<Candidate *>(itTauArray.Next()))) 226 { 227 if(tau->D1 < 0) continue; 228 229 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || 230 tau->D2 >= fParticleInputArray->GetEntriesFast()) 217 if(tauArray){ 218 TIter itTauArray(tauArray); 219 while((tau = static_cast<Candidate *>(itTauArray.Next()))) 231 220 { 232 throw runtime_error("tau's daughter index is greater than the ParticleInputArray size"); 233 } 234 235 tauMomentum.SetPxPyPzE(0.0, 0.0, 0.0, 0.0); 236 237 for(i = tau->D1; i <= tau->D2; ++i) 238 { 239 daughter = static_cast<Candidate *>(fParticleInputArray->At(i)); 240 if(TMath::Abs(daughter->PID) == 16) continue; 241 tauMomentum += daughter->Momentum; 242 } 243 244 if(jetMomentum.DeltaR(tauMomentum) <= fDeltaR) 245 { 246 pdgCode = 15; 247 charge = tau->Charge; 221 if(tau->D1 < 0) continue; 222 223 if(tau->D1 >= fParticleInputArray->GetEntriesFast() || 224 tau->D2 >= fParticleInputArray->GetEntriesFast()) 225 { 226 throw runtime_error("tau's daughter index is greater than the ParticleInputArray size"); 227 } 228 229 tauMomentum.SetPxPyPzE(0.0, 0.0, 0.0, 0.0); 230 231 for(i = tau->D1; i <= tau->D2; ++i) 232 { 233 daughter = static_cast<Candidate *>(fParticleInputArray->At(i)); 234 if(TMath::Abs(daughter->PID) == 16) continue; 235 tauMomentum += daughter->Momentum; 236 } 237 238 if(jetMomentum.DeltaR(tauMomentum) <= fDeltaR) 239 { 240 pdgCode = 15; 241 charge = tau->Charge; 242 } 248 243 } 249 244 } -
modules/TauTagging.h
rd870fc5 rd77b51d 31 31 32 32 #include "classes/DelphesModule.h" 33 #include "ExRootAnalysis/ExRootResult.h" 34 #include "ExRootAnalysis/ExRootFilter.h" 35 #include "ExRootAnalysis/ExRootClassifier.h" 33 36 34 37 #include <map> … … 76 79 }; 77 80 81 82 //------------------------------------------------------------------------------ 83 84 class TauTaggingPartonClassifier : public ExRootClassifier 85 { 86 public: 87 88 TauTaggingPartonClassifier(const TObjArray *array); 89 90 Int_t GetCategory(TObject *object); 91 92 Double_t fEtaMax, fPTMin; 93 94 const TObjArray *fParticleInputArray; 95 }; 96 97 78 98 #endif -
modules/TrackPileUpSubtractor.cc
rd870fc5 rd77b51d 74 74 fZVertexResolution = GetDouble("ZVertexResolution", 0.005)*1.0E3; 75 75 76 fPTMin = GetDouble("PTMin", 0.); 76 77 // import arrays with output from other modules 77 78 78 79 ExRootConfParam param = GetParam("InputArray"); 79 80 Long_t i, size; … … 147 148 // assume perfect pile-up subtraction for tracks outside fZVertexResolution 148 149 149 if(candidate->IsPU && TMath::Abs(z-zvtx) > fZVertexResolution) continue; 150 151 array->Add(candidate); 150 if(candidate->IsPU && TMath::Abs(z-zvtx) > fZVertexResolution) candidate->IsRecoPU = 1; 151 else 152 { 153 candidate->IsRecoPU = 0; 154 if( candidate->Momentum.Pt() > fPTMin) array->Add(candidate); 155 } 152 156 } 153 157 } -
modules/TrackPileUpSubtractor.h
rd870fc5 rd77b51d 50 50 Double_t fZVertexResolution; 51 51 52 Double_t fPTMin; 53 52 54 std::map< TIterator *, TObjArray * > fInputMap; //! 53 55 -
modules/TreeWriter.cc
rd870fc5 rd77b51d 291 291 entry->ZOuter = position.Z(); 292 292 entry->TOuter = position.T()*1.0E-3/c_light; 293 293 294 294 entry->Dxy = candidate->Dxy; 295 295 entry->SDxy = candidate->SDxy ; … … 297 297 entry->Yd = candidate->Yd; 298 298 entry->Zd = candidate->Zd; 299 299 300 300 const TLorentzVector &momentum = candidate->Momentum; 301 301 … … 362 362 363 363 entry->T = position.T()*1.0E-3/c_light; 364 entry->NTimeHits = candidate->NTimeHits; 364 365 365 366 FillParticles(candidate, &entry->Particles); … … 403 404 entry->T = position.T()*1.0E-3/c_light; 404 405 406 // Isolation variables 407 408 entry->IsolationVar = candidate->IsolationVar; 409 entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr ; 410 entry->SumPtCharged = candidate->SumPtCharged ; 411 entry->SumPtNeutral = candidate->SumPtNeutral ; 412 entry->SumPtChargedPU = candidate->SumPtChargedPU ; 413 entry->SumPt = candidate->SumPt ; 414 405 415 entry->EhadOverEem = candidate->Eem > 0.0 ? candidate->Ehad/candidate->Eem : 999.9; 406 416 … … 442 452 entry->T = position.T()*1.0E-3/c_light; 443 453 454 // Isolation variables 455 456 entry->IsolationVar = candidate->IsolationVar; 457 entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr ; 458 entry->SumPtCharged = candidate->SumPtCharged ; 459 entry->SumPtNeutral = candidate->SumPtNeutral ; 460 entry->SumPtChargedPU = candidate->SumPtChargedPU ; 461 entry->SumPt = candidate->SumPt ; 462 463 444 464 entry->Charge = candidate->Charge; 445 465 … … 469 489 const TLorentzVector &momentum = candidate->Momentum; 470 490 const TLorentzVector &position = candidate->Position; 471 472 491 473 492 pt = momentum.Pt(); … … 488 507 entry->T = position.T()*1.0E-3/c_light; 489 508 509 // Isolation variables 510 511 entry->IsolationVar = candidate->IsolationVar; 512 entry->IsolationVarRhoCorr = candidate->IsolationVarRhoCorr ; 513 entry->SumPtCharged = candidate->SumPtCharged ; 514 entry->SumPtNeutral = candidate->SumPtNeutral ; 515 entry->SumPtChargedPU = candidate->SumPtChargedPU ; 516 entry->SumPt = candidate->SumPt ; 517 490 518 entry->Charge = candidate->Charge; 491 519 … … 504 532 Double_t ecalEnergy, hcalEnergy; 505 533 const Double_t c_light = 2.99792458E8; 534 Int_t i; 506 535 507 536 array->Sort(); … … 532 561 entry->Mass = momentum.M(); 533 562 563 entry->Area = candidate->Area; 564 534 565 entry->DeltaEta = candidate->DeltaEta; 535 566 entry->DeltaPhi = candidate->DeltaPhi; 536 567 568 entry->Flavor = candidate->Flavor; 569 entry->FlavorAlgo = candidate->FlavorAlgo; 570 entry->FlavorPhys = candidate->FlavorPhys; 571 537 572 entry->BTag = candidate->BTag; 573 574 entry->BTagAlgo = candidate->BTagAlgo; 575 entry->BTagPhys = candidate->BTagPhys; 576 538 577 entry->TauTag = candidate->TauTag; 539 578 … … 561 600 entry->MeanSqDeltaR = candidate->MeanSqDeltaR; 562 601 entry->PTD = candidate->PTD; 563 entry->FracPt[0] = candidate->FracPt[0]; 564 entry->FracPt[1] = candidate->FracPt[1]; 565 entry->FracPt[2] = candidate->FracPt[2]; 566 entry->FracPt[3] = candidate->FracPt[3]; 567 entry->FracPt[4] = candidate->FracPt[4]; 568 569 //--- N-subjettiness variables ---- 570 571 entry->Tau1 = candidate->Tau[0]; 572 entry->Tau2 = candidate->Tau[1]; 573 entry->Tau3 = candidate->Tau[2]; 574 entry->Tau4 = candidate->Tau[3]; 575 entry->Tau5 = candidate->Tau[4]; 576 602 603 //--- Sub-structure variables ---- 604 605 entry->NSubJetsTrimmed = candidate->NSubJetsTrimmed; 606 entry->NSubJetsPruned = candidate->NSubJetsPruned; 607 entry->NSubJetsSoftDropped = candidate->NSubJetsSoftDropped; 608 609 for(i = 0; i < 5; i++) 610 { 611 entry->FracPt[i] = candidate -> FracPt[i]; 612 entry->Tau[i] = candidate -> Tau[i]; 613 entry->TrimmedP4[i] = candidate -> TrimmedP4[i]; 614 entry->PrunedP4[i] = candidate -> PrunedP4[i]; 615 entry->SoftDroppedP4[i] = candidate -> SoftDroppedP4[i]; 616 } 617 577 618 FillParticles(candidate, &entry->Particles); 578 619 } -
modules/UniqueObjectFinder.cc
rd870fc5 rd77b51d 74 74 TIterator *iterator; 75 75 76 fInputMap.clear(); 77 76 78 size = param.GetSize(); 77 79 for(i = 0; i < size/2; ++i) … … 80 82 iterator = array->MakeIterator(); 81 83 82 fInputMap [iterator] = ExportArray(param[i*2 + 1].GetString());84 fInputMap.push_back(make_pair(iterator, ExportArray(param[i*2 + 1].GetString()))); 83 85 } 84 86 } … … 88 90 void UniqueObjectFinder::Finish() 89 91 { 90 map< TIterator *, TObjArray *>::iterator itInputMap;92 vector< pair< TIterator *, TObjArray * > >::iterator itInputMap; 91 93 TIterator *iterator; 92 94 … … 104 106 { 105 107 Candidate *candidate; 106 map< TIterator *, TObjArray *>::iterator itInputMap;108 vector< pair< TIterator *, TObjArray * > >::iterator itInputMap; 107 109 TIterator *iterator; 108 110 TObjArray *array; … … 128 130 //------------------------------------------------------------------------------ 129 131 130 Bool_t UniqueObjectFinder::Unique(Candidate *candidate, map< TIterator *, TObjArray *>::iterator itInputMap)132 Bool_t UniqueObjectFinder::Unique(Candidate *candidate, vector< pair< TIterator *, TObjArray * > >::iterator itInputMap) 131 133 { 132 134 Candidate *previousCandidate; 133 map< TIterator *, TObjArray *>::iterator previousItInputMap;135 vector< pair< TIterator *, TObjArray * > >::iterator previousItInputMap; 134 136 TObjArray *array; 135 137 -
modules/UniqueObjectFinder.h
rd870fc5 rd77b51d 30 30 #include "classes/DelphesModule.h" 31 31 32 #include <map> 32 #include <vector> 33 #include <utility> 33 34 34 35 class TIterator; … … 49 50 private: 50 51 51 Bool_t Unique(Candidate *candidate, std:: map< TIterator *, TObjArray *>::iterator itInputMap);52 Bool_t Unique(Candidate *candidate, std::vector< std::pair< TIterator *, TObjArray * > >::iterator itInputMap); 52 53 53 std:: map< TIterator *, TObjArray *> fInputMap; //!54 std::vector< std::pair< TIterator *, TObjArray * > > fInputMap; //! 54 55 55 56 ClassDef(UniqueObjectFinder, 1)
Note:
See TracChangeset
for help on using the changeset viewer.