- Timestamp:
- Dec 9, 2021, 7:52:15 AM (3 years ago)
- Children:
- 29b722a
- Parents:
- a5af1df (diff), 0c0c9af (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:
-
- 12 added
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/AngularSmearing.cc
ra5af1df rd612dec 98 98 { 99 99 Candidate *candidate, *mother; 100 Double_t pt, eta, phi, e ;100 Double_t pt, eta, phi, e, m; 101 101 102 102 fItInputArray->Reset(); 103 103 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 104 104 { 105 const TLorentzVector &candidatePosition = candidate->Position;106 105 const TLorentzVector &candidateMomentum = candidate->Momentum; 107 eta = candidate Position.Eta();108 phi = candidate Position.Phi();106 eta = candidateMomentum.Eta(); 107 phi = candidateMomentum.Phi(); 109 108 pt = candidateMomentum.Pt(); 110 109 e = candidateMomentum.E(); 110 m = candidateMomentum.M(); 111 111 112 112 // apply smearing formula for eta,phi 113 114 eta = gRandom->Gaus(eta, fFormulaEta->Eval(pt, eta, phi, e)); 115 phi = gRandom->Gaus(phi, fFormulaPhi->Eval(pt, eta, phi, e)); 113 eta = gRandom->Gaus(eta, fFormulaEta->Eval(pt, eta, phi, e, candidate)); 114 phi = gRandom->Gaus(phi, fFormulaPhi->Eval(pt, eta, phi, e, candidate)); 116 115 117 116 if(pt <= 0.0) continue; … … 119 118 mother = candidate; 120 119 candidate = static_cast<Candidate *>(candidate->Clone()); 121 eta = candidateMomentum.Eta(); 122 phi = candidateMomentum.Phi(); 123 candidate->Momentum.SetPtEtaPhiE(pt, eta, phi, pt * TMath::CosH(eta)); 120 candidate->Momentum.SetPtEtaPhiM(pt, eta, phi, m); 124 121 candidate->AddCandidate(mother); 125 122 -
modules/Calorimeter.cc
ra5af1df rd612dec 231 231 fItParticleInputArray->Reset(); 232 232 number = -1; 233 fTowerRmax=0.; 233 234 while((particle = static_cast<Candidate *>(fItParticleInputArray->Next()))) 234 235 { 235 236 const TLorentzVector &particlePosition = particle->Position; 236 237 ++number; 238 239 // compute maximum radius (needed in FinalizeTower to assess whether barrel or endcap tower) 240 if (particlePosition.Perp() > fTowerRmax) 241 fTowerRmax=particlePosition.Perp(); 237 242 238 243 pdgCode = TMath::Abs(particle->PID); … … 450 455 451 456 fTower->AddCandidate(particle); 457 fTower->Position = position; 452 458 } 453 459 … … 461 467 { 462 468 Candidate *track, *tower, *mother; 463 Double_t energy, pt, eta, phi ;469 Double_t energy, pt, eta, phi, r; 464 470 Double_t ecalEnergy, hcalEnergy; 465 471 Double_t ecalNeutralEnergy, hcalNeutralEnergy; … … 511 517 for(size_t i = 0; i < fTower->ECalEnergyTimePairs.size(); ++i) 512 518 { 513 weight = TMath:: Sqrt(fTower->ECalEnergyTimePairs[i].first);519 weight = TMath::Power((fTower->ECalEnergyTimePairs[i].first),2); 514 520 sumWeightedTime += weight * fTower->ECalEnergyTimePairs[i].second; 515 521 sumWeight += weight; … … 517 523 } 518 524 525 // check whether barrel or endcap tower 526 if (fTower->Position.Perp() < fTowerRmax && TMath::Abs(eta) > 0.) 527 r = fTower->Position.Z()/TMath::SinH(eta); 528 else 529 r = fTower->Position.Pt(); 530 519 531 if(sumWeight > 0.0) 520 532 { 521 fTower->Position.SetPtEtaPhiE( 1.0, eta, phi, sumWeightedTime / sumWeight);533 fTower->Position.SetPtEtaPhiE(r, eta, phi, sumWeightedTime / sumWeight); 522 534 } 523 535 else 524 536 { 525 fTower->Position.SetPtEtaPhiE( 1.0, eta, phi, 999999.9);537 fTower->Position.SetPtEtaPhiE(r, eta, phi, 999999.9); 526 538 } 527 539 … … 559 571 if(ecalNeutralEnergy > fECalEnergyMin && ecalNeutralSigma > fECalEnergySignificanceMin) 560 572 { 561 // create new photon tower 573 // create new photon tower assuming null mass 562 574 tower = static_cast<Candidate *>(fTower->Clone()); 563 575 pt = ecalNeutralEnergy / TMath::CosH(eta); … … 646 658 track = static_cast<Candidate *>(track->Clone()); 647 659 track->AddCandidate(mother); 648 649 660 track->Momentum *= rescaleFactor; 661 track->Momentum.SetPtEtaPhiM(track->Momentum.Pt()*rescaleFactor, track->Momentum.Eta(), track->Momentum.Phi(), track->Momentum.M()); 650 662 651 663 fEFlowTrackOutputArray->Add(track); -
modules/Calorimeter.h
ra5af1df rd612dec 60 60 Double_t fTimingEnergyMin; 61 61 Bool_t fElectronsFromTrack; 62 Double_t fTowerRmax; 62 63 63 64 Int_t fTowerTrackHits, fTowerPhotonHits; -
modules/Delphes.cc
ra5af1df rd612dec 61 61 fFactory(0) 62 62 { 63 TFolder *folder = new TFolder(name, ""); 63 TFolder *folder; 64 64 65 fFactory = new DelphesFactory("ObjectFactory"); 66 67 folder = new TFolder(name, ""); 65 68 66 69 SetName(name); … … 80 83 if(folder) 81 84 { 85 gROOT->GetListOfBrowsables()->Remove(folder); 82 86 folder->Clear(); 83 87 delete folder; -
modules/DenseTrackFilter.cc
ra5af1df rd612dec 237 237 238 238 Candidate *candidate, *track; 239 Double_t pt, eta, phi ;239 Double_t pt, eta, phi, m; 240 240 Int_t numberOfCandidates; 241 241 … … 251 251 eta = candidate->Momentum.Eta(); 252 252 phi = candidate->Momentum.Phi(); 253 m = candidate->Momentum.M(); 254 253 255 eta = gRandom->Gaus(eta, fEtaPhiRes); 254 256 phi = gRandom->Gaus(phi, fEtaPhiRes); 255 candidate->Momentum.SetPtEtaPhi E(pt, eta, phi, pt * TMath::CosH(eta));257 candidate->Momentum.SetPtEtaPhiM(pt, eta, phi, m); 256 258 candidate->AddCandidate(track); 257 259 -
modules/DualReadoutCalorimeter.cc
ra5af1df rd612dec 24 24 // This implementation of dual calorimetry relies on several approximations: 25 25 // - If hadronic energy is found in the tower the energy resolution then the full tower enrgy is smeared according to hadronic resolution (pessimistic for (e,n) or (pi+,gamma)) 26 // - While e+ vs pi+ (or gamma vs n) separation is in principle possible for single particles (using C/S, PMT timing, lateral shower profile) it is not obvious it can be done overlapping particles. 26 // - While e+ vs pi+ (or gamma vs n) separation is in principle possible for single particles (using C/S, PMT timing, lateral shower profile) it is not obvious it can be done overlapping particles. 27 27 // Now we assume that regarless of the number of particle hits per tower we can always distinguish e+ vs pi+, which is probably not true in the case (e+,n) vs (pi+,gamma) without longitudinal segmentation. 28 28 … … 63 63 fItParticleInputArray(0), fItTrackInputArray(0) 64 64 { 65 65 66 66 fECalResolutionFormula = new DelphesFormula; 67 67 fHCalResolutionFormula = new DelphesFormula; … … 75 75 fTowerTrackArray = new TObjArray; 76 76 fItTowerTrackArray = fTowerTrackArray->MakeIterator(); 77 77 78 78 } 79 79 … … 82 82 DualReadoutCalorimeter::~DualReadoutCalorimeter() 83 83 { 84 84 85 85 if(fECalResolutionFormula) delete fECalResolutionFormula; 86 86 if(fHCalResolutionFormula) delete fHCalResolutionFormula; … … 94 94 if(fTowerTrackArray) delete fTowerTrackArray; 95 95 if(fItTowerTrackArray) delete fItTowerTrackArray; 96 96 97 97 } 98 98 … … 172 172 fECalEnergyMin = GetDouble("ECalEnergyMin", 0.0); 173 173 fHCalEnergyMin = GetDouble("HCalEnergyMin", 0.0); 174 fEnergyMin = GetDouble("EnergyMin", 0.0); 174 175 175 176 fECalEnergySignificanceMin = GetDouble("ECalEnergySignificanceMin", 0.0); 176 177 fHCalEnergySignificanceMin = GetDouble("HCalEnergySignificanceMin", 0.0); 178 fEnergySignificanceMin = GetDouble("EnergySignificanceMin", 0.0); 177 179 178 180 // switch on or off the dithering of the center of DualReadoutCalorimeter towers … … 245 247 fItParticleInputArray->Reset(); 246 248 number = -1; 249 fTowerRmax=0.; 250 251 //cout<<"--------- new event ---------- "<<endl; 252 247 253 while((particle = static_cast<Candidate*>(fItParticleInputArray->Next()))) 248 254 { 249 255 const TLorentzVector &particlePosition = particle->Position; 250 256 ++number; 257 258 // compute maximum radius (needed in FinalizeTower to assess whether barrel or endcap tower) 259 if (particlePosition.Perp() > fTowerRmax) 260 fTowerRmax=particlePosition.Perp(); 251 261 252 262 pdgCode = TMath::Abs(particle->PID); … … 377 387 fHCalTrackEnergy = 0.0; 378 388 fTrackEnergy = 0.0; 379 389 380 390 fECalTrackSigma = 0.0; 381 391 fHCalTrackSigma = 0.0; 382 392 fTrackSigma = 0.0; 383 393 384 394 fTowerTrackHits = 0; 385 395 fTowerPhotonHits = 0; 396 397 fTowerTime = 0.0; 398 fTowerTimeWeight = 0.0; 386 399 387 400 fECalTowerTrackArray->Clear(); 388 401 fHCalTowerTrackArray->Clear(); 389 402 fTowerTrackArray->Clear(); 390 403 391 404 } 392 405 … … 412 425 } 413 426 414 415 /*416 if(fECalTrackFractions[number] > 1.0E-9 && fHCalTrackFractions[number] < 1.0E-9)417 {418 fECalTrackEnergy += ecalEnergy;419 ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, momentum.E());420 if(ecalSigma/momentum.E() < track->TrackResolution) energyGuess = ecalEnergy;421 else energyGuess = momentum.E();422 423 fECalTrackSigma += (track->TrackResolution)*energyGuess*(track->TrackResolution)*energyGuess;424 fECalTowerTrackArray->Add(track);425 }426 427 else if(fECalTrackFractions[number] < 1.0E-9 && fHCalTrackFractions[number] > 1.0E-9)428 {429 fHCalTrackEnergy += hcalEnergy;430 hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, momentum.E());431 if(hcalSigma/momentum.E() < track->TrackResolution) energyGuess = hcalEnergy;432 else energyGuess = momentum.E();433 434 fHCalTrackSigma += (track->TrackResolution)*energyGuess*(track->TrackResolution)*energyGuess;435 fHCalTowerTrackArray->Add(track);436 }437 438 // muons439 else if(fECalTrackFractions[number] < 1.0E-9 && fHCalTrackFractions[number] < 1.0E-9)440 {441 fEFlowTrackOutputArray->Add(track);442 }443 */444 445 427 // in Dual Readout we do not care if tracks are ECAL of HCAL 446 428 if(fECalTrackFractions[number] > 1.0E-9 || fHCalTrackFractions[number] > 1.0E-9) 447 { 429 { 448 430 fTrackEnergy += energy; 449 // this sigma will be used to determine whether neutral excess is significant. We choose the resolution according to bthe higest deposited fraction (in practice had for charged hadrons and em for electrons) 431 // this sigma will be used to determine whether neutral excess is significant. We choose the resolution according to bthe higest deposited fraction (in practice had for charged hadrons and em for electrons) 450 432 sigma = 0.0; 451 433 if(fHCalTrackFractions[number] > 0) … … 453 435 else 454 436 sigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, momentum.E()); 455 456 if(sigma/momentum.E() < track->TrackResolution) 457 energyGuess = ecalEnergy + hcalEnergy; 437 438 if(sigma/momentum.E() < track->TrackResolution) 439 energyGuess = ecalEnergy + hcalEnergy; 458 440 else 459 441 energyGuess = momentum.E(); 460 442 461 443 fTrackSigma += (track->TrackResolution)*energyGuess*(track->TrackResolution)*energyGuess; 462 444 fTowerTrackArray->Add(track); 463 464 445 } 465 446 else … … 478 459 position = particle->Position; 479 460 461 480 462 // fill current tower 481 463 ecalEnergy = momentum.E() * fECalTowerFractions[number]; … … 485 467 fHCalTowerEnergy += hcalEnergy; 486 468 487 if(ecalEnergy > fTimingEnergyMin && fTower) 488 { 489 if (abs(particle->PID) != 11 || !fElectronsFromTrack) 490 { 491 fTower->ECalEnergyTimePairs.push_back(make_pair<Float_t, Float_t>(ecalEnergy, particle->Position.T())); 492 } 493 } 469 // assume combined timing measurements in ECAL/HCAL sections 470 fTowerTime += (ecalEnergy + hcalEnergy) * position.T(); //sigma_t ~ 1/sqrt(E) 471 fTowerTimeWeight += ecalEnergy + hcalEnergy; 494 472 495 473 fTower->AddCandidate(particle); 474 fTower->Position = position; 496 475 } 497 476 … … 506 485 507 486 Candidate *track, *tower, *mother; 508 Double_t energy, pt, eta, phi ;487 Double_t energy, pt, eta, phi, r, time; 509 488 Double_t ecalEnergy, hcalEnergy; 510 489 Double_t ecalNeutralEnergy, hcalNeutralEnergy, neutralEnergy; 511 490 512 491 Double_t ecalSigma, hcalSigma, sigma; 513 492 Double_t ecalNeutralSigma, hcalNeutralSigma, neutralSigma; 514 493 515 494 Double_t weightTrack, weightCalo, bestEnergyEstimate, rescaleFactor; 516 495 517 496 TLorentzVector momentum; 518 497 TFractionMap::iterator itFractionMap; … … 522 501 if(!fTower) return; 523 502 524 525 //if (fHCalTowerEnergy < 30 && fECalTowerEnergy < 30) return; 526 //cout<<"----------- New tower ---------"<<endl; 527 528 529 // here we change behaviour w.r.t to standard calorimeter. Start with worse case scenario. If fHCalTowerEnergy > 0, assume total energy smeared by HCAL resolution. 530 // For example, if overlapping charged pions and photons take hadronic resolution as combined measurement 531 532 // if no hadronic fraction at all, then use ECAL resolution 533 534 //cout<<"fECalTowerEnergy: "<<fECalTowerEnergy<<", fHCalTowerEnergy: "<<fHCalTowerEnergy<<", Eta: "<<fTowerEta<<endl; 535 536 // if no hadronic energy, use ECAL resolution 503 // if no hadronic energy, use ECAL resolution 537 504 if (fHCalTowerEnergy <= fHCalEnergyMin) 538 505 { 539 506 energy = fECalTowerEnergy; 540 507 sigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, energy); 541 //cout<<"em energy"<<energy<<", sigma: "<<sigma<<endl; 542 } 543 544 // if hadronic fraction > 0, use HCAL resolution 508 } 509 510 // if hadronic fraction > 0, use HCAL resolution 545 511 else 546 512 { 547 513 energy = fECalTowerEnergy + fHCalTowerEnergy; 548 514 sigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, energy); 549 //cout<<"had energy: "<<energy<<", sigma: "<<sigma<<endl;550 515 } 551 516 552 517 energy = LogNormal(energy, sigma); 553 //cout<<energy<<","<<ecalEnergy<<","<<hcalEnergy<<endl; 554 518 555 519 if(energy < fEnergyMin || energy < fEnergySignificanceMin*sigma) energy = 0.0; 556 520 … … 562 526 hcalEnergy = LogNormal(fHCalTowerEnergy, hcalSigma); 563 527 528 time = (fTowerTimeWeight < 1.0E-09) ? 0.0 : fTowerTime / fTowerTimeWeight; 529 564 530 ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, ecalEnergy); 565 531 hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, hcalEnergy); … … 568 534 if(hcalEnergy < fHCalEnergyMin || hcalEnergy < fHCalEnergySignificanceMin*hcalSigma) hcalEnergy = 0.0; 569 535 570 //cout<<"Measured energy: "<<energy<<endl;571 572 536 if(fSmearTowerCenter) 573 537 { … … 583 547 pt = energy / TMath::CosH(eta); 584 548 585 // Time calculation for tower 586 fTower->NTimeHits = 0; 587 sumWeightedTime = 0.0; 588 sumWeight = 0.0; 589 590 for(size_t i = 0; i < fTower->ECalEnergyTimePairs.size(); ++i) 591 { 592 weight = TMath::Sqrt(fTower->ECalEnergyTimePairs[i].first); 593 sumWeightedTime += weight * fTower->ECalEnergyTimePairs[i].second; 594 sumWeight += weight; 595 fTower->NTimeHits++; 596 } 597 598 if(sumWeight > 0.0) 599 { 600 fTower->Position.SetPtEtaPhiE(1.0, eta, phi, sumWeightedTime/sumWeight); 601 } 602 else 603 { 604 fTower->Position.SetPtEtaPhiE(1.0, eta, phi, 999999.9); 605 } 549 // check whether barrel or endcap tower 550 551 // endcap 552 if (TMath::Abs(fTower->Position.Pt() - fTowerRmax) > 1.e-06 && TMath::Abs(eta) > 0.){ 553 r = fTower->Position.Z()/TMath::SinH(eta); 554 } 555 // barrel 556 else { 557 r = fTower->Position.Pt(); 558 } 559 560 fTower->Position.SetPtEtaPhiE(r, eta, phi, time); 561 fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy); 562 fTower->L = fTower->Position.Vect().Mag(); 606 563 607 564 fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy); 608 565 fTower->Eem = ecalEnergy; 609 566 fTower->Ehad = hcalEnergy; 610 567 fTower->Etrk = fTrackEnergy; 611 568 fTower->Edges[0] = fTowerEdges[0]; 612 569 fTower->Edges[1] = fTowerEdges[1]; … … 624 581 625 582 // fill energy flow candidates 626 583 627 584 fTrackSigma = TMath::Sqrt(fTrackSigma); 628 585 neutralEnergy = max( (energy - fTrackEnergy) , 0.0); 629 586 neutralSigma = neutralEnergy / TMath::Sqrt(fTrackSigma*fTrackSigma + sigma*sigma); 630 587 631 //cout<<"trackEnergy: "<<fTrackEnergy<<", trackSigma: "<<fTrackSigma<<", Ntracks: "<<fTowerTrackArray->GetEntries()<<endl;632 633 //cout<<"neutralEnergy: "<<neutralEnergy<<", neutralSigma: "<<neutralSigma<<endl;634 635 // For now, if neutral excess is significant, simply create neutral EflowPhoton tower and clone each track into eflowtrack !!! -> Creating only photons !! EFlowNeutralHadron collection will be empy!!! TO BE FIXED636 588 if(neutralEnergy > fEnergyMin && neutralSigma > fEnergySignificanceMin) 637 589 { 638 639 //cout<<"significant neutral excess found:"<<endl;640 590 // create new photon tower 641 591 tower = static_cast<Candidate*>(fTower->Clone()); 642 pt = neutralEnergy / TMath::CosH(eta); 643 //cout<<"Creating tower with Pt, Eta, Phi, Energy: "<<pt<<","<<eta<<","<<phi<<","<<neutralEnergy<<endl; 592 pt = neutralEnergy / TMath::CosH(eta); 644 593 tower->Momentum.SetPtEtaPhiE(pt, eta, phi, neutralEnergy); 645 tower->Eem = neutralEnergy; 646 tower->Ehad = 0.0; 647 tower->PID = 22; 648 649 fEFlowPhotonOutputArray->Add(tower); 650 594 595 // if no hadronic energy, use ECAL resolution 596 if (fHCalTowerEnergy <= fHCalEnergyMin) 597 { 598 tower->Eem = neutralEnergy; 599 tower->Ehad = 0.0; 600 tower->PID = 22; 601 fEFlowPhotonOutputArray->Add(tower); 602 } 603 // if hadronic fraction > 0, use HCAL resolution 604 else 605 { 606 tower->Eem = 0; 607 tower->Ehad = neutralEnergy; 608 tower->PID = 130; 609 fEFlowNeutralHadronOutputArray->Add(tower); 610 } 651 611 652 612 //clone tracks … … 654 614 while((track = static_cast<Candidate*>(fItTowerTrackArray->Next()))) 655 615 { 656 //cout<<"looping over tracks"<<endl;657 616 mother = track; 658 617 track = static_cast<Candidate*>(track->Clone()); … … 662 621 } 663 622 664 623 665 624 // if neutral excess is not significant, rescale eflow tracks, such that the total charged equals the best measurement given by the DualReadoutCalorimeter and tracking 666 625 else if(fTrackEnergy > 0.0) … … 670 629 weightCalo = (sigma > 0.0) ? 1 / (sigma*sigma) : 0.0; 671 630 672 bestEnergyEstimate = (weightTrack*fTrackEnergy + weightCalo*energy) / (weightTrack + weightCalo); 631 bestEnergyEstimate = (weightTrack*fTrackEnergy + weightCalo*energy) / (weightTrack + weightCalo); 673 632 rescaleFactor = bestEnergyEstimate/fTrackEnergy; 674 633 … … 676 635 fItTowerTrackArray->Reset(); 677 636 while((track = static_cast<Candidate*>(fItTowerTrackArray->Next()))) 678 { 637 { 679 638 mother = track; 680 track = static_cast<Candidate *>(track->Clone());639 track = static_cast<Candidate *>(track->Clone()); 681 640 track->AddCandidate(mother); 682 683 track->Momentum *= rescaleFactor; 684 641 track->Momentum.SetPtEtaPhiM(track->Momentum.Pt()*rescaleFactor, track->Momentum.Eta(), track->Momentum.Phi(), track->Momentum.M()); 685 642 fEFlowTrackOutputArray->Add(track); 686 643 } 687 644 } 688 689 690 /* 691 // fill energy flow candidates 692 fECalTrackSigma = TMath::Sqrt(fECalTrackSigma); 693 fHCalTrackSigma = TMath::Sqrt(fHCalTrackSigma); 694 695 //compute neutral excesses 696 ecalNeutralEnergy = max( (ecalEnergy - fECalTrackEnergy) , 0.0); 697 hcalNeutralEnergy = max( (hcalEnergy - fHCalTrackEnergy) , 0.0); 698 699 ecalNeutralSigma = ecalNeutralEnergy / TMath::Sqrt(fECalTrackSigma*fECalTrackSigma + ecalSigma*ecalSigma); 700 hcalNeutralSigma = hcalNeutralEnergy / TMath::Sqrt(fHCalTrackSigma*fHCalTrackSigma + hcalSigma*hcalSigma); 701 702 // if ecal neutral excess is significant, simply create neutral EflowPhoton tower and clone each track into eflowtrack 703 if(ecalNeutralEnergy > fECalEnergyMin && ecalNeutralSigma > fECalEnergySignificanceMin) 704 { 705 // create new photon tower 706 tower = static_cast<Candidate*>(fTower->Clone()); 707 pt = ecalNeutralEnergy / TMath::CosH(eta); 708 709 tower->Momentum.SetPtEtaPhiE(pt, eta, phi, ecalNeutralEnergy); 710 tower->Eem = ecalNeutralEnergy; 711 tower->Ehad = 0.0; 712 tower->PID = 22; 713 714 fEFlowPhotonOutputArray->Add(tower); 715 716 //clone tracks 717 fItECalTowerTrackArray->Reset(); 718 while((track = static_cast<Candidate*>(fItECalTowerTrackArray->Next()))) 719 { 720 mother = track; 721 track = static_cast<Candidate*>(track->Clone()); 722 track->AddCandidate(mother); 723 724 fEFlowTrackOutputArray->Add(track); 725 } 726 727 } 728 729 // if neutral excess is not significant, rescale eflow tracks, such that the total charged equals the best measurement given by the DualReadoutCalorimeter and tracking 730 else if(fECalTrackEnergy > 0.0) 731 { 732 weightTrack = (fECalTrackSigma > 0.0) ? 1 / (fECalTrackSigma*fECalTrackSigma) : 0.0; 733 weightCalo = (ecalSigma > 0.0) ? 1 / (ecalSigma*ecalSigma) : 0.0; 734 735 bestEnergyEstimate = (weightTrack*fECalTrackEnergy + weightCalo*ecalEnergy) / (weightTrack + weightCalo); 736 rescaleFactor = bestEnergyEstimate/fECalTrackEnergy; 737 738 //rescale tracks 739 fItECalTowerTrackArray->Reset(); 740 while((track = static_cast<Candidate*>(fItECalTowerTrackArray->Next()))) 741 { 742 mother = track; 743 track = static_cast<Candidate*>(track->Clone()); 744 track->AddCandidate(mother); 745 746 track->Momentum *= rescaleFactor; 747 748 fEFlowTrackOutputArray->Add(track); 749 } 750 } 751 752 753 // if hcal neutral excess is significant, simply create neutral EflowNeutralHadron tower and clone each track into eflowtrack 754 if(hcalNeutralEnergy > fHCalEnergyMin && hcalNeutralSigma > fHCalEnergySignificanceMin) 755 { 756 // create new photon tower 757 tower = static_cast<Candidate*>(fTower->Clone()); 758 pt = hcalNeutralEnergy / TMath::CosH(eta); 759 760 tower->Momentum.SetPtEtaPhiE(pt, eta, phi, hcalNeutralEnergy); 761 tower->Ehad = hcalNeutralEnergy; 762 tower->Eem = 0.0; 763 764 fEFlowNeutralHadronOutputArray->Add(tower); 765 766 //clone tracks 767 fItHCalTowerTrackArray->Reset(); 768 while((track = static_cast<Candidate*>(fItHCalTowerTrackArray->Next()))) 769 { 770 mother = track; 771 track = static_cast<Candidate*>(track->Clone()); 772 track->AddCandidate(mother); 773 774 fEFlowTrackOutputArray->Add(track); 775 } 776 777 } 778 779 // if neutral excess is not significant, rescale eflow tracks, such that the total charged equals the best measurement given by the DualReadoutCalorimeter and tracking 780 else if(fHCalTrackEnergy > 0.0) 781 { 782 weightTrack = (fHCalTrackSigma > 0.0) ? 1 / (fHCalTrackSigma*fHCalTrackSigma) : 0.0; 783 weightCalo = (hcalSigma > 0.0) ? 1 / (hcalSigma*hcalSigma) : 0.0; 784 785 bestEnergyEstimate = (weightTrack*fHCalTrackEnergy + weightCalo*hcalEnergy) / (weightTrack + weightCalo); 786 rescaleFactor = bestEnergyEstimate / fHCalTrackEnergy; 787 788 //rescale tracks 789 fItHCalTowerTrackArray->Reset(); 790 while((track = static_cast<Candidate*>(fItHCalTowerTrackArray->Next()))) 791 { 792 mother = track; 793 track = static_cast<Candidate*>(track->Clone()); 794 track->AddCandidate(mother); 795 796 track->Momentum *= rescaleFactor; 797 798 fEFlowTrackOutputArray->Add(track); 799 } 800 } 801 802 */ 645 646 803 647 } 804 648 -
modules/DualReadoutCalorimeter.h
ra5af1df rd612dec 60 60 Double_t fECalTrackEnergy, fHCalTrackEnergy; 61 61 Double_t fTrackEnergy; 62 Double_t fTowerRmax; 62 63 63 64 Double_t fTimingEnergyMin; … … 77 78 Double_t fHCalTrackSigma; 78 79 Double_t fTrackSigma; 80 81 Double_t fTowerTime; 82 Double_t fTowerTimeWeight; 79 83 80 84 Bool_t fSmearTowerCenter; -
modules/Efficiency.cc
ra5af1df rd612dec 78 78 fItInputArray = fInputArray->MakeIterator(); 79 79 80 // switch to compute efficiency based on momentum vector eta, phi 81 fUseMomentumVector = GetBool("UseMomentumVector", false); 82 80 83 // create output array 81 84 … … 95 98 { 96 99 Candidate *candidate; 97 Double_t pt, eta, phi, e, d0, dz, ctgTheta; 100 Double_t pt, eta, phi, e; 101 98 102 99 103 fItInputArray->Reset(); … … 104 108 eta = candidatePosition.Eta(); 105 109 phi = candidatePosition.Phi(); 110 111 if (fUseMomentumVector){ 112 eta = candidateMomentum.Eta(); 113 phi = candidateMomentum.Phi(); 114 } 115 106 116 pt = candidateMomentum.Pt(); 107 117 e = candidateMomentum.E(); 108 d0 = candidate->D0;109 dz = candidate->DZ;110 ctgTheta = candidate->CtgTheta;111 118 112 119 // apply an efficency formula 113 if(gRandom->Uniform() > fFormula->Eval(pt, eta, phi, e, d0, dz, ctgTheta)) continue;120 if(gRandom->Uniform() > fFormula->Eval(pt, eta, phi, e, candidate)) continue; 114 121 115 122 fOutputArray->Add(candidate); -
modules/Efficiency.h
ra5af1df rd612dec 53 53 TObjArray *fOutputArray; //! 54 54 55 Double_t fUseMomentumVector; //! 56 55 57 ClassDef(Efficiency, 1) 56 58 }; -
modules/EnergySmearing.cc
ra5af1df rd612dec 95 95 { 96 96 Candidate *candidate, *mother; 97 Double_t pt, energy, eta, phi ;97 Double_t pt, energy, eta, phi, m; 98 98 99 99 fItInputArray->Reset(); … … 107 107 phi = candidatePosition.Phi(); 108 108 energy = candidateMomentum.E(); 109 m = candidateMomentum.M(); 109 110 110 111 // apply smearing formula … … 117 118 eta = candidateMomentum.Eta(); 118 119 phi = candidateMomentum.Phi(); 119 candidate->Momentum.SetPtEtaPhiE(energy / TMath::CosH(eta), eta, phi, energy); 120 pt = (energy > m) ? TMath::Sqrt(energy*energy - m*m)/TMath::CosH(eta) : 0; 121 candidate->Momentum.SetPtEtaPhiE(pt, eta, phi, energy); 120 122 candidate->TrackResolution = fFormula->Eval(pt, eta, phi, energy) / candidateMomentum.E(); 121 123 candidate->AddCandidate(mother); -
modules/FastJetFinder.cc
ra5af1df rd612dec 104 104 fJetAlgorithm = GetInt("JetAlgorithm", 6); 105 105 fParameterR = GetDouble("ParameterR", 0.5); 106 fParameterP = GetDouble("ParameterP", -1.0); 106 107 107 108 fConeRadius = GetDouble("ConeRadius", 0.5); … … 247 248 fDefinition = new JetDefinition(fValenciaPlugin); 248 249 break; 250 case 10: 251 fDefinition = new JetDefinition(ee_genkt_algorithm,fParameterR,fParameterP); 252 break; 253 249 254 } 250 255 … … 316 321 Double_t deta, dphi, detaMax, dphiMax; 317 322 Double_t time, timeWeight; 323 Double_t neutralEnergyFraction, chargedEnergyFraction; 324 318 325 Int_t number, ncharged, nneutrals; 319 326 Int_t charge; … … 418 425 nneutrals = 0; 419 426 427 neutralEnergyFraction =0.; 428 chargedEnergyFraction =0.; 429 420 430 inputList.clear(); 421 431 inputList = sequence->constituents(*itOutputList); … … 432 442 433 443 if(constituent->Charge == 0) 444 { 434 445 nneutrals++; 446 neutralEnergyFraction += constituent->Momentum.E(); 447 } 435 448 else 449 { 436 450 ncharged++; 437 451 chargedEnergyFraction += constituent->Momentum.E(); 452 } 453 438 454 time += TMath::Sqrt(constituent->Momentum.E()) * (constituent->Position.T()); 439 455 timeWeight += TMath::Sqrt(constituent->Momentum.E()); … … 455 471 candidate->NCharged = ncharged; 456 472 473 candidate->NeutralEnergyFraction = (momentum.E() > 0 ) ? neutralEnergyFraction/momentum.E() : 0.0; 474 candidate->ChargedEnergyFraction = (momentum.E() > 0 ) ? chargedEnergyFraction/momentum.E() : 0.0; 475 457 476 //for exclusive clustering, access y_n,n+1 as exclusive_ymerge (fNJets); 458 477 candidate->ExclYmerge23 = excl_ymerge23; … … 470 489 fastjet::Filter trimmer(fastjet::JetDefinition(fastjet::kt_algorithm, fRTrim), fastjet::SelectorPtFractionMin(fPtFracTrim)); 471 490 fastjet::PseudoJet trimmed_jet = trimmer(*itOutputList); 472 473 trimmed_jet = join(trimmed_jet.constituents()); 474 491 475 492 candidate->TrimmedP4[0].SetPtEtaPhiM(trimmed_jet.pt(), trimmed_jet.eta(), trimmed_jet.phi(), trimmed_jet.m()); 476 493 -
modules/FastJetFinder.h
ra5af1df rd612dec 72 72 Int_t fJetAlgorithm; 73 73 Double_t fParameterR; 74 Double_t fParameterP; 74 75 75 76 Double_t fJetPTMin; -
modules/IdentificationMap.cc
ra5af1df rd612dec 170 170 { 171 171 // change PID of particle 172 candidate = static_cast<Candidate *>(candidate->Clone()); 172 173 if(pdgCodeOut != 0) candidate->PID = charge * pdgCodeOut; 173 174 fOutputArray->Add(candidate); -
modules/JetFakeParticle.cc
ra5af1df rd612dec 146 146 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 147 147 { 148 const TLorentzVector &candidatePosition = candidate->Position;149 148 const TLorentzVector &candidateMomentum = candidate->Momentum; 150 eta = candidate Position.Eta();151 phi = candidate Position.Phi();149 eta = candidateMomentum.Eta(); 150 phi = candidateMomentum.Phi(); 152 151 pt = candidateMomentum.Pt(); 153 152 e = candidateMomentum.E(); -
modules/ModulesLinkDef.h
ra5af1df rd612dec 36 36 #include "modules/MomentumSmearing.h" 37 37 #include "modules/TrackSmearing.h" 38 #include "modules/TrackCovariance.h" 39 #include "modules/ClusterCounting.h" 38 40 #include "modules/ImpactParameterSmearing.h" 39 41 #include "modules/TimeSmearing.h" 42 #include "modules/TimeOfFlight.h" 40 43 #include "modules/SimpleCalorimeter.h" 41 44 #include "modules/DenseTrackFilter.h" … … 72 75 #include "modules/VertexFinder.h" 73 76 #include "modules/VertexFinderDA4D.h" 77 #include "modules/DecayFilter.h" 78 #include "modules/ParticleDensity.h" 79 #include "modules/TruthVertexFinder.h" 74 80 #include "modules/ExampleModule.h" 75 81 #include "modules/LLPFilter.h" … … 93 99 #pragma link C++ class MomentumSmearing+; 94 100 #pragma link C++ class TrackSmearing+; 101 #pragma link C++ class TrackCovariance+; 102 #pragma link C++ class ClusterCounting+; 95 103 #pragma link C++ class ImpactParameterSmearing+; 96 104 #pragma link C++ class TimeSmearing+; 105 #pragma link C++ class TimeOfFlight+; 97 106 #pragma link C++ class SimpleCalorimeter+; 98 107 #pragma link C++ class DenseTrackFilter+; … … 129 138 #pragma link C++ class VertexFinder+; 130 139 #pragma link C++ class VertexFinderDA4D+; 140 #pragma link C++ class DecayFilter+; 141 #pragma link C++ class ParticleDensity+; 142 #pragma link C++ class TruthVertexFinder+; 131 143 #pragma link C++ class ExampleModule+; 132 144 #pragma link C++ class LLPFilter+; -
modules/MomentumSmearing.cc
ra5af1df rd612dec 78 78 fItInputArray = fInputArray->MakeIterator(); 79 79 80 // switch to compute momentum smearing based on momentum vector eta, phi 81 fUseMomentumVector = GetBool("UseMomentumVector", false); 82 80 83 // create output array 81 84 … … 95 98 { 96 99 Candidate *candidate, *mother; 97 Double_t pt, eta, phi, e, res;100 Double_t pt, eta, phi, e, m, res; 98 101 99 102 fItInputArray->Reset(); … … 104 107 eta = candidatePosition.Eta(); 105 108 phi = candidatePosition.Phi(); 109 110 if (fUseMomentumVector){ 111 eta = candidateMomentum.Eta(); 112 phi = candidateMomentum.Phi(); 113 } 114 106 115 pt = candidateMomentum.Pt(); 107 116 e = candidateMomentum.E(); 108 res = fFormula->Eval(pt, eta, phi, e); 117 m = candidateMomentum.M(); 118 res = fFormula->Eval(pt, eta, phi, e, candidate); 109 119 110 120 // apply smearing formula … … 121 131 eta = candidateMomentum.Eta(); 122 132 phi = candidateMomentum.Phi(); 123 candidate->Momentum.SetPtEtaPhi E(pt, eta, phi, pt * TMath::CosH(eta));133 candidate->Momentum.SetPtEtaPhiM(pt, eta, phi, m); 124 134 //candidate->TrackResolution = fFormula->Eval(pt, eta, phi, e); 125 135 candidate->TrackResolution = res; -
modules/MomentumSmearing.h
ra5af1df rd612dec 55 55 TObjArray *fOutputArray; //! 56 56 57 Double_t fUseMomentumVector; //! 58 57 59 ClassDef(MomentumSmearing, 1) 58 60 }; -
modules/ParticlePropagator.cc
ra5af1df rd612dec 125 125 TLorentzVector particlePosition, particleMomentum, beamSpotPosition; 126 126 Double_t px, py, pz, pt, pt2, e, q; 127 Double_t x, y, z, t, r, phi; 128 Double_t x_c, y_c, r_c, phi_c, phi_0; 129 Double_t x_t, y_t, z_t, r_t; 130 Double_t t1, t2, t3, t4, t5, t6; 131 Double_t t_z, t_r, t_ra, t_rb; 132 Double_t tmp, discr, discr2; 133 Double_t delta, gammam, omega, asinrho; 134 Double_t rcu, rc2, xd, yd, zd; 135 Double_t l, d0, dz, p, ctgTheta, phip, etap, alpha; 127 Double_t x, y, z, t, r; 128 Double_t x_c, y_c, r_c, phi_0; 129 Double_t x_t, y_t, z_t, r_t, phi_t; 130 Double_t t_r, t_z; 131 Double_t tmp; 132 Double_t gammam, omega; 133 Double_t xd, yd, zd; 134 Double_t l, d0, dz, ctgTheta, alpha; 136 135 Double_t bsx, bsy, bsz; 136 Double_t td, pio, phid, vz; 137 137 138 138 const Double_t c_light = 2.99792458E8; 139 139 140 140 if(!fBeamSpotInputArray || fBeamSpotInputArray->GetSize() == 0) 141 { 141 142 beamSpotPosition.SetXYZT(0.0, 0.0, 0.0, 0.0); 143 } 142 144 else 143 145 { … … 160 162 particlePosition = particle->Position; 161 163 particleMomentum = particle->Momentum; 164 162 165 x = particlePosition.X() * 1.0E-3; 163 166 y = particlePosition.Y() * 1.0E-3; … … 206 209 // solve pt2*t^2 + 2*(px*x + py*y)*t - (fRadius2 - x*x - y*y) = 0 207 210 tmp = px * y - py * x; 208 discr2 = pt2 * fRadius2 - tmp * tmp; 209 210 if(discr2 < 0.0) 211 { 212 // no solutions 213 continue; 214 } 215 216 tmp = px * x + py * y; 217 discr = TMath::Sqrt(discr2); 218 t1 = (-tmp + discr) / pt2; 219 t2 = (-tmp - discr) / pt2; 220 t = (t1 < 0.0) ? t2 : t1; 221 222 z_t = z + pz * t; 223 if(TMath::Abs(z_t) > fHalfLength) 224 { 225 t3 = (+fHalfLength - z) / pz; 226 t4 = (-fHalfLength - z) / pz; 227 t = (t3 < 0.0) ? t4 : t3; 228 } 211 t_r = (TMath::Sqrt(pt2 * fRadius2 - tmp * tmp) - px * x - py * y) / pt2; 212 213 t_z = (TMath::Sign(fHalfLength, pz) - z) / pz; 214 215 t = TMath::Min(t_r, t_z); 229 216 230 217 x_t = x + px * t; … … 245 232 246 233 fOutputArray->Add(candidate); 234 247 235 if(TMath::Abs(q) > 1.0E-9) 248 236 { … … 267 255 { 268 256 269 // 1. 270 // initial transverse momentum direction phi_0 = -atan(p_X0/p_Y0)271 // relativistic gamma: gamma = E/mc^2; gammam = gamma * m272 // gyration frequency omega = q/(gamma m) fBz273 // helix radius r = p_{T0} / (omega gammam)257 // 1. initial transverse momentum p_{T0}: Part->pt 258 // initial transverse momentum direction phi_0 = -atan(p_{X0} / p_{Y0}) 259 // relativistic gamma: gamma = E / mc^2; gammam = gamma * m 260 // gyration frequency omega = q * Bz / (gammam) 261 // helix radius r = p_{T0} / (omega * gammam) 274 262 275 263 gammam = e * 1.0E9 / (c_light * c_light); // gammam in [eV/c^2] 276 omega = q * fBz / (gammam); // omega is here in [89875518/s]264 omega = q * fBz / gammam; // omega is here in [89875518/s] 277 265 r = pt / (q * fBz) * 1.0E9 / c_light; // in [m] 278 266 … … 283 271 y_c = y - r * TMath::Cos(phi_0); 284 272 r_c = TMath::Hypot(x_c, y_c); 285 phi_c = TMath::ATan2(y_c, x_c); 286 phi = phi_c; 287 if(x_c < 0.0) phi += TMath::Pi(); 288 289 rcu = TMath::Abs(r); 290 rc2 = r_c * r_c; 291 292 // calculate coordinates of closest approach to track circle in transverse plane xd, yd, zd 293 xd = x_c * x_c * x_c - x_c * rcu * r_c + x_c * y_c * y_c; 294 xd = (rc2 > 0.0) ? xd / rc2 : -999; 295 yd = y_c * (-rcu * r_c + rc2); 296 yd = (rc2 > 0.0) ? yd / rc2 : -999; 297 zd = z + (TMath::Sqrt(xd * xd + yd * yd) - TMath::Sqrt(x * x + y * y)) * pz / pt; 298 299 // use perigee momentum rather than original particle 300 // momentum, since the orignal particle momentum isn't known 301 302 px = TMath::Sign(1.0, r) * pt * (-y_c / r_c); 303 py = TMath::Sign(1.0, r) * pt * (x_c / r_c); 304 etap = particleMomentum.Eta(); 305 phip = TMath::ATan2(py, px); 306 307 particleMomentum.SetPtEtaPhiE(pt, etap, phip, particleMomentum.E()); 273 274 // time of closest approach 275 td = (phi_0 + TMath::ATan2(x_c, y_c)) / omega; 276 277 // remove all the modulo pi that might have come from the atan 278 pio = TMath::Abs(TMath::Pi() / omega); 279 while(TMath::Abs(td) > 0.5 * pio) 280 { 281 td -= TMath::Sign(1.0, td) * pio; 282 } 283 284 vz = pz * c_light / e; 285 286 // calculate coordinates of closest approach to z axis 287 phid = phi_0 - omega * td; 288 xd = x_c - r * TMath::Sin(phid); 289 yd = y_c + r * TMath::Cos(phid); 290 zd = z + vz * td; 291 292 // momentum at closest approach 293 px = pt * TMath::Cos(phid); 294 py = pt * TMath::Sin(phid); 295 296 particleMomentum.SetPtEtaPhiE(pt, particleMomentum.Eta(), phid, particleMomentum.E()); 308 297 309 298 // calculate additional track parameters (correct for beamspot position) 310 311 d0 = ((x - bsx) * py - (y - bsy) * px) / pt; 312 dz = z - ((x - bsx) * px + (y - bsy) * py) / pt * (pz / pt); 313 p = particleMomentum.P(); 299 d0 = ((xd - bsx) * py - (yd - bsy) * px) / pt; 300 dz = zd - bsz; 314 301 ctgTheta = 1.0 / TMath::Tan(particleMomentum.Theta()); 315 302 … … 317 304 // t_r : time to exit from the sides 318 305 // t_z : time to exit from the front or the back 319 t_r = 0.0; // in [ns] 320 int sign_pz = (pz > 0.0) ? 1 : -1; 321 if(pz == 0.0) 322 t_z = 1.0E99; 323 else 324 t_z = gammam / (pz * 1.0E9 / c_light) * (-z + fHalfLength * sign_pz); 306 t_z = (vz == 0.0) ? 1.0E99 : (TMath::Sign(fHalfLength, pz) - z) / vz; 325 307 326 308 if(r_c + TMath::Abs(r) < fRadius) … … 331 313 else 332 314 { 333 asinrho = TMath::ASin((fRadius * fRadius - r_c * r_c - r * r) / (2 * TMath::Abs(r) * r_c)); 334 delta = phi_0 - phi; 335 if(delta < -TMath::Pi()) delta += 2 * TMath::Pi(); 336 if(delta > TMath::Pi()) delta -= 2 * TMath::Pi(); 337 t1 = (delta + asinrho) / omega; 338 t2 = (delta + TMath::Pi() - asinrho) / omega; 339 t3 = (delta + TMath::Pi() + asinrho) / omega; 340 t4 = (delta - asinrho) / omega; 341 t5 = (delta - TMath::Pi() - asinrho) / omega; 342 t6 = (delta - TMath::Pi() + asinrho) / omega; 343 344 if(t1 < 0.0) t1 = 1.0E99; 345 if(t2 < 0.0) t2 = 1.0E99; 346 if(t3 < 0.0) t3 = 1.0E99; 347 if(t4 < 0.0) t4 = 1.0E99; 348 if(t5 < 0.0) t5 = 1.0E99; 349 if(t6 < 0.0) t6 = 1.0E99; 350 351 t_ra = TMath::Min(t1, TMath::Min(t2, t3)); 352 t_rb = TMath::Min(t4, TMath::Min(t5, t6)); 353 t_r = TMath::Min(t_ra, t_rb); 315 alpha = TMath::ACos((r * r + r_c * r_c - fRadius * fRadius) / (2 * TMath::Abs(r) * r_c)); 316 t_r = td + TMath::Abs(alpha / omega); 317 354 318 t = TMath::Min(t_r, t_z); 355 319 } 356 320 357 321 // 4. position in terms of x(t), y(t), z(t) 358 x_t = x_c + r * TMath::Sin(omega * t - phi_0); 359 y_t = y_c + r * TMath::Cos(omega * t - phi_0); 360 z_t = z + pz * 1.0E9 / c_light / gammam * t; 322 phi_t = phi_0 - omega * t; 323 x_t = x_c - r * TMath::Sin(phi_t); 324 y_t = y_c + r * TMath::Cos(phi_t); 325 z_t = z + vz * t; 361 326 r_t = TMath::Hypot(x_t, y_t); 362 327 363 // compute path length for an helix 364 365 alpha = pz * 1.0E9 / c_light / gammam; 366 l = t * TMath::Sqrt(alpha * alpha + r * r * omega * omega); 328 // lenght of the path from production to tracker 329 l = t * TMath::Hypot(vz, r * omega); 367 330 368 331 if(r_t > 0.0) 369 332 { 370 371 333 // store these variables before cloning 372 334 if(particle == candidate) … … 374 336 particle->D0 = d0 * 1.0E3; 375 337 particle->DZ = dz * 1.0E3; 376 particle->P = p ;338 particle->P = particleMomentum.P(); 377 339 particle->PT = pt; 378 340 particle->CtgTheta = ctgTheta; 379 particle->Phi = p hip;341 particle->Phi = particleMomentum.Phi(); 380 342 } 381 343 -
modules/SimpleCalorimeter.cc
ra5af1df rd612dec 208 208 fItParticleInputArray->Reset(); 209 209 number = -1; 210 fTowerRmax=0.; 210 211 while((particle = static_cast<Candidate *>(fItParticleInputArray->Next()))) 211 212 { 212 213 const TLorentzVector &particlePosition = particle->Position; 213 214 ++number; 215 216 // compute maximum radius (needed in FinalizeTower to assess whether barrel or endcap tower) 217 if (particlePosition.Perp() > fTowerRmax) 218 fTowerRmax=particlePosition.Perp(); 214 219 215 220 pdgCode = TMath::Abs(particle->PID); … … 394 399 fTowerEnergy += energy; 395 400 396 fTowerTime += energy * position.T();397 fTowerTimeWeight += energy ;401 fTowerTime += energy * energy * position.T(); //sigma_t ~ 1/E 402 fTowerTimeWeight += energy * energy; 398 403 399 404 fTower->AddCandidate(particle); 405 fTower->Position = position; 406 400 407 } 401 408 … … 409 416 { 410 417 Candidate *tower, *track, *mother; 411 Double_t energy, neutralEnergy, pt, eta, phi ;418 Double_t energy, neutralEnergy, pt, eta, phi, r; 412 419 Double_t sigma, neutralSigma; 413 420 Double_t time; … … 443 450 pt = energy / TMath::CosH(eta); 444 451 445 fTower->Position.SetPtEtaPhiE(1.0, eta, phi, time); 452 // endcap 453 if (TMath::Abs(fTower->Position.Pt() - fTowerRmax) > 1.e-06 && TMath::Abs(eta) > 0.){ 454 r = fTower->Position.Z()/TMath::SinH(eta); 455 } 456 // barrel 457 else { 458 r = fTower->Position.Pt(); 459 } 460 461 fTower->Position.SetPtEtaPhiE(r, eta, phi, time); 446 462 fTower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy); 463 fTower->L = fTower->Position.Vect().Mag(); 447 464 448 465 fTower->Eem = (!fIsEcal) ? 0 : energy; 449 466 fTower->Ehad = (fIsEcal) ? 0 : energy; 467 fTower->Etrk = fTrackEnergy; 450 468 451 469 fTower->Edges[0] = fTowerEdges[0]; … … 507 525 track = static_cast<Candidate *>(track->Clone()); 508 526 track->AddCandidate(mother); 509 510 track->Momentum *= rescaleFactor; 511 527 track->Momentum.SetPtEtaPhiM(track->Momentum.Pt()*rescaleFactor, track->Momentum.Eta(), track->Momentum.Phi(), track->Momentum.M()); 512 528 fEFlowTrackOutputArray->Add(track); 513 529 } -
modules/SimpleCalorimeter.h
ra5af1df rd612dec 62 62 Double_t fTrackTime; 63 63 64 Double_t fTowerRmax; 65 64 66 Double_t fTowerTimeWeight; 65 67 Double_t fTrackTimeWeight; -
modules/TauTagging.cc
ra5af1df rd612dec 83 83 daughter1 = static_cast<Candidate *>(fParticleInputArray->At(i)); 84 84 pdgCode = TMath::Abs(daughter1->PID); 85 if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15)86 return -1;87 elseif(pdgCode == 24)85 //if(pdgCode == 11 || pdgCode == 13 || pdgCode == 15) 86 // return -1; 87 if(pdgCode == 24) 88 88 { 89 89 if(daughter1->D1 < 0) return -1; … … 96 96 } 97 97 } 98 99 98 return 0; 100 99 } … … 190 189 void TauTagging::Process() 191 190 { 192 Candidate *jet, *tau, *daughter ;191 Candidate *jet, *tau, *daughter, *part; 193 192 TLorentzVector tauMomentum; 194 193 Double_t pt, eta, phi, e, eff; … … 204 203 // loop over all input jets 205 204 fItJetInputArray->Reset(); 205 206 206 while((jet = static_cast<Candidate *>(fItJetInputArray->Next()))) 207 207 { 208 208 209 const TLorentzVector &jetMomentum = jet->Momentum; 209 210 pdgCode = 0; … … 243 244 } 244 245 } 246 247 // fake electrons and muons 248 249 if (pdgCode == 0) 250 { 251 252 Double_t drMin = fDeltaR; 253 fItPartonInputArray->Reset(); 254 while((part = static_cast<Candidate *>(fItPartonInputArray->Next()))) 255 { 256 if(TMath::Abs(part->PID) == 11 || TMath::Abs(part->PID) == 13) 257 { 258 tauMomentum = part->Momentum; 259 if (tauMomentum.Pt() < fClassifier->fPTMin) continue; 260 if (TMath::Abs(tauMomentum.Eta()) > fClassifier->fEtaMax) continue; 261 262 Double_t dr = jetMomentum.DeltaR(tauMomentum); 263 if( dr < drMin) 264 { 265 drMin = dr; 266 pdgCode = TMath::Abs(part->PID); 267 charge = part->Charge; 268 } 269 } 270 } 271 } 272 245 273 // find an efficency formula 246 274 itEfficiencyMap = fEfficiencyMap.find(pdgCode); -
modules/TimeSmearing.cc
ra5af1df rd612dec 19 19 /** \class TimeSmearing 20 20 * 21 * Performs t ransverse momentum resolutionsmearing.21 * Performs time smearing. 22 22 * 23 * \author P. Demin - UCL, Louvain-la-Neuve23 * \author M. Selvaggi - CERN 24 24 * 25 25 */ … … 49 49 50 50 using namespace std; 51 52 51 //------------------------------------------------------------------------------ 53 52 54 53 TimeSmearing::TimeSmearing() : 55 fItInputArray(0) 54 fItInputArray(0), fResolutionFormula(0) 56 55 { 56 fResolutionFormula = new DelphesFormula; 57 57 } 58 58 … … 61 61 TimeSmearing::~TimeSmearing() 62 62 { 63 if(fResolutionFormula) delete fResolutionFormula; 63 64 } 64 65 … … 69 70 // read resolution formula 70 71 71 fTimeResolution = GetDouble("TimeResolution", 1.0E-10);72 // import input array72 // read time resolution formula in seconds 73 fResolutionFormula->Compile(GetString("TimeResolution", "30e-12")); 73 74 75 // import track input array 74 76 fInputArray = ImportArray(GetString("InputArray", "MuonMomentumSmearing/muons")); 75 77 fItInputArray = fInputArray->MakeIterator(); 76 78 79 77 80 // create output array 78 79 fOutputArray = ExportArray(GetString("OutputArray", "muons")); 81 fOutputArray = ExportArray(GetString("OutputArray", "tracks")); 80 82 } 81 83 … … 92 94 { 93 95 Candidate *candidate, *mother; 94 Double_t ti, tf_smeared, tf; 96 Double_t tf_smeared, tf; 97 Double_t eta, energy; 98 Double_t timeResolution; 99 95 100 const Double_t c_light = 2.99792458E8; 96 101 … … 98 103 while((candidate = static_cast<Candidate *>(fItInputArray->Next()))) 99 104 { 100 const TLorentzVector &candidateInitialPosition = candidate->InitialPosition; 105 101 106 const TLorentzVector &candidateFinalPosition = candidate->Position; 107 const TLorentzVector &candidateMomentum = candidate->Momentum; 102 108 103 ti = candidateInitialPosition.T() * 1.0E-3 / c_light;104 109 tf = candidateFinalPosition.T() * 1.0E-3 / c_light; 105 110 111 eta = candidateMomentum.Eta(); 112 energy = candidateMomentum.E(); 113 106 114 // apply smearing formula 107 tf_smeared = gRandom->Gaus(tf, fTimeResolution); 108 ti = ti + tf_smeared - tf; 109 tf = tf_smeared; 115 timeResolution = fResolutionFormula->Eval(0.0, eta, 0.0, energy); 116 tf_smeared = gRandom->Gaus(tf, timeResolution); 110 117 111 118 mother = candidate; 112 119 candidate = static_cast<Candidate *>(candidate->Clone()); 113 candidate->InitialPosition.SetT(ti * 1.0E3 * c_light);114 candidate->Position.SetT(tf * 1.0E3 * c_light);115 120 116 candidate->ErrorT = fTimeResolution * 1.0E3 * c_light; 121 candidate->Position.SetT(tf_smeared * 1.0E3 * c_light); 122 candidate->ErrorT = timeResolution * 1.0E3 * c_light; 117 123 118 124 candidate->AddCandidate(mother); 119 120 125 fOutputArray->Add(candidate); 121 126 } 122 127 } 123 124 //------------------------------------------------------------------------------ -
modules/TimeSmearing.h
ra5af1df rd612dec 22 22 /** \class TimeSmearing 23 23 * 24 * Performs t ransverse time smearing.24 * Performs time smearing. 25 25 * 26 * \author Michele Selvaggi - UCL, Louvain-la-Neuve26 * \author Michele Selvaggi - CERN 27 27 * 28 28 */ … … 32 32 class TIterator; 33 33 class TObjArray; 34 class DelphesFormula; 34 35 35 36 class TimeSmearing: public DelphesModule … … 44 45 45 46 private: 46 Double_t fTimeResolution; 47 48 DelphesFormula *fResolutionFormula; 49 Int_t fVertexTimeMode; 47 50 48 51 TIterator *fItInputArray; //! -
modules/TrackSmearing.cc
ra5af1df rd612dec 158 158 TLorentzVector beamSpotPosition; 159 159 Candidate *candidate, *mother; 160 Double_t pt, eta, d0, d0Error, trueD0, dz, dzError, trueDZ, p, pError, trueP, ctgTheta, ctgThetaError, trueCtgTheta, phi, phiError, truePhi;160 Double_t pt, eta, e, m, d0, d0Error, trueD0, dz, dzError, trueDZ, p, pError, trueP, ctgTheta, ctgThetaError, trueCtgTheta, phi, phiError, truePhi; 161 161 Double_t x, y, z, t, px, py, pz, theta; 162 162 Double_t q, r; … … 223 223 pt = momentum.Pt(); 224 224 eta = momentum.Eta(); 225 e = momentum.E(); 226 m = momentum.M(); 225 227 226 228 d0 = trueD0 = candidate->D0; … … 232 234 233 235 if(fUseD0Formula) 234 d0Error = fD0Formula->Eval(pt, eta );236 d0Error = fD0Formula->Eval(pt, eta, phi, e, candidate); 235 237 else 236 238 { … … 247 249 248 250 if(fUseDZFormula) 249 dzError = fDZFormula->Eval(pt, eta );251 dzError = fDZFormula->Eval(pt, eta, phi, e, candidate); 250 252 else 251 253 { … … 262 264 263 265 if(fUsePFormula) 264 pError = fPFormula->Eval(pt, eta ) * p;266 pError = fPFormula->Eval(pt, eta, phi, e, candidate) * p; 265 267 else 266 268 { … … 277 279 278 280 if(fUseCtgThetaFormula) 279 ctgThetaError = fCtgThetaFormula->Eval(pt, eta );281 ctgThetaError = fCtgThetaFormula->Eval(pt, eta, phi, e, candidate); 280 282 else 281 283 { … … 292 294 293 295 if(fUsePhiFormula) 294 phiError = fPhiFormula->Eval(pt, eta );296 phiError = fPhiFormula->Eval(pt, eta, phi, e, candidate); 295 297 else 296 298 { … … 331 333 candidate->Momentum.SetPy(p * TMath::Sin(phi) * TMath::Sin(theta)); 332 334 candidate->Momentum.SetPz(p * TMath::Cos(theta)); 333 candidate->Momentum.SetE( candidate->Momentum.Pt() * TMath::CosH(eta));335 candidate->Momentum.SetE(TMath::Sqrt(p*p + m*m)); 334 336 candidate->PT = candidate->Momentum.Pt(); 335 337 -
modules/TreeWriter.cc
ra5af1df rd612dec 72 72 fClassMap[Track::Class()] = &TreeWriter::ProcessTracks; 73 73 fClassMap[Tower::Class()] = &TreeWriter::ProcessTowers; 74 fClassMap[ParticleFlowCandidate::Class()] = &TreeWriter::ProcessParticleFlowCandidates; 74 75 fClassMap[Photon::Class()] = &TreeWriter::ProcessPhotons; 75 76 fClassMap[Electron::Class()] = &TreeWriter::ProcessElectrons; … … 123 124 fBranchMap.insert(make_pair(branch, make_pair(itClassMap->second, array))); 124 125 } 126 127 param = GetParam("Info"); 128 TString infoName; 129 Double_t infoValue; 130 131 size = param.GetSize(); 132 for(i = 0; i < size / 2; ++i) 133 { 134 infoName = param[i * 2].GetString(); 135 infoValue = param[i * 2 + 1].GetDouble(); 136 137 AddInfo(infoName, infoValue); 138 } 125 139 } 126 140 … … 138 152 it1.Reset(); 139 153 array->Clear(); 154 140 155 while((candidate = static_cast<Candidate *>(it1.Next()))) 141 156 { … … 215 230 entry->Pz = momentum.Pz(); 216 231 217 entry->D0 = candidate->D0;218 entry->DZ = candidate->DZ;219 entry->P = momentum.P();220 entry->PT = candidate->PT;221 entry->CtgTheta = candidate->CtgTheta;222 entry->Phi = candidate->Phi;223 224 232 entry->Eta = eta; 225 233 entry->Phi = momentum.Phi(); … … 322 330 Candidate *particle = 0; 323 331 Track *entry = 0; 324 Double_t pt, signz, cosTheta, eta, rapidity, p, ctgTheta, phi ;332 Double_t pt, signz, cosTheta, eta, rapidity, p, ctgTheta, phi, m; 325 333 const Double_t c_light = 2.99792458E8; 326 334 … … 356 364 357 365 entry->D0 = candidate->D0; 358 entry->ErrorD0 = candidate->ErrorD0;359 366 entry->DZ = candidate->DZ; 360 entry->ErrorDZ = candidate->ErrorDZ; 367 entry->Nclusters = candidate->Nclusters; 368 entry->dNdx = candidate->dNdx; 361 369 362 370 entry->ErrorP = candidate->ErrorP; 363 371 entry->ErrorPT = candidate->ErrorPT; 372 373 // diagonal covariance matrix terms 374 entry->ErrorD0 = candidate->ErrorD0; 375 entry->ErrorC = candidate->ErrorC; 376 entry->ErrorPhi = candidate->ErrorPhi; 377 entry->ErrorDZ = candidate->ErrorDZ; 364 378 entry->ErrorCtgTheta = candidate->ErrorCtgTheta; 365 entry->ErrorPhi = candidate->ErrorPhi; 379 380 // add some offdiagonal covariance matrix elements 381 entry->ErrorD0Phi = candidate->TrackCovariance(0,1); 382 entry->ErrorD0C = candidate->TrackCovariance(0,2); 383 entry->ErrorD0DZ = candidate->TrackCovariance(0,3); 384 entry->ErrorD0CtgTheta = candidate->TrackCovariance(0,4); 385 entry->ErrorPhiC = candidate->TrackCovariance(1,2); 386 entry->ErrorPhiDZ = candidate->TrackCovariance(1,3); 387 entry->ErrorPhiCtgTheta = candidate->TrackCovariance(1,4); 388 entry->ErrorCDZ = candidate->TrackCovariance(2,3); 389 entry->ErrorCCtgTheta = candidate->TrackCovariance(2,4); 390 entry->ErrorDZCtgTheta = candidate->TrackCovariance(3,4); 366 391 367 392 entry->Xd = candidate->Xd; … … 374 399 p = momentum.P(); 375 400 phi = momentum.Phi(); 401 m = momentum.M(); 376 402 ctgTheta = (TMath::Tan(momentum.Theta()) != 0) ? 1 / TMath::Tan(momentum.Theta()) : 1e10; 377 403 … … 386 412 entry->Phi = phi; 387 413 entry->CtgTheta = ctgTheta; 414 entry->C = candidate->C; 415 entry->Mass = m; 388 416 389 417 particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0)); 390 const TLorentzVector &initialPosition = particle->Position; 418 //const TLorentzVector &initialPosition = particle->Position; 419 const TLorentzVector &initialPosition = candidate->InitialPosition; 391 420 392 421 entry->X = initialPosition.X(); … … 394 423 entry->Z = initialPosition.Z(); 395 424 entry->T = initialPosition.T() * 1.0E-3 / c_light; 425 entry->ErrorT =candidate-> ErrorT * 1.0E-3 / c_light; 396 426 397 427 entry->Particle = particle; … … 435 465 entry->Eem = candidate->Eem; 436 466 entry->Ehad = candidate->Ehad; 467 entry->Etrk = candidate->Etrk; 437 468 entry->Edges[0] = candidate->Edges[0]; 438 469 entry->Edges[1] = candidate->Edges[1]; … … 444 475 445 476 FillParticles(candidate, &entry->Particles); 477 } 478 } 479 480 //------------------------------------------------------------------------------ 481 482 void TreeWriter::ProcessParticleFlowCandidates(ExRootTreeBranch *branch, TObjArray *array) 483 { 484 485 TIter iterator(array); 486 Candidate *candidate = 0; 487 Candidate *particle = 0; 488 ParticleFlowCandidate *entry = 0; 489 Double_t e, pt, signz, cosTheta, eta, rapidity, p, ctgTheta, phi, m; 490 const Double_t c_light = 2.99792458E8; 491 492 // loop over all tracks 493 iterator.Reset(); 494 while((candidate = static_cast<Candidate *>(iterator.Next()))) 495 { 496 const TLorentzVector &position = candidate->Position; 497 498 cosTheta = TMath::Abs(position.CosTheta()); 499 signz = (position.Pz() >= 0.0) ? 1.0 : -1.0; 500 eta = (cosTheta == 1.0 ? signz * 999.9 : position.Eta()); 501 rapidity = (cosTheta == 1.0 ? signz * 999.9 : position.Rapidity()); 502 503 entry = static_cast<ParticleFlowCandidate *>(branch->NewEntry()); 504 505 entry->SetBit(kIsReferenced); 506 entry->SetUniqueID(candidate->GetUniqueID()); 507 508 entry->PID = candidate->PID; 509 510 entry->Charge = candidate->Charge; 511 512 entry->EtaOuter = eta; 513 entry->PhiOuter = position.Phi(); 514 515 entry->XOuter = position.X(); 516 entry->YOuter = position.Y(); 517 entry->ZOuter = position.Z(); 518 entry->TOuter = position.T() * 1.0E-3 / c_light; 519 520 entry->L = candidate->L; 521 522 entry->D0 = candidate->D0; 523 entry->DZ = candidate->DZ; 524 entry->Nclusters = candidate->Nclusters; 525 entry->dNdx = candidate->dNdx; 526 527 entry->ErrorP = candidate->ErrorP; 528 entry->ErrorPT = candidate->ErrorPT; 529 entry->ErrorCtgTheta = candidate->ErrorCtgTheta; 530 531 532 // diagonal covariance matrix terms 533 534 entry->ErrorD0 = candidate->ErrorD0; 535 entry->ErrorC = candidate->ErrorC; 536 entry->ErrorPhi = candidate->ErrorPhi; 537 entry->ErrorDZ = candidate->ErrorDZ; 538 entry->ErrorCtgTheta = candidate->ErrorCtgTheta; 539 540 // add some offdiagonal covariance matrix elements 541 entry->ErrorD0Phi = candidate->TrackCovariance(0,1); 542 entry->ErrorD0C = candidate->TrackCovariance(0,2); 543 entry->ErrorD0DZ = candidate->TrackCovariance(0,3); 544 entry->ErrorD0CtgTheta = candidate->TrackCovariance(0,4); 545 entry->ErrorPhiC = candidate->TrackCovariance(1,2); 546 entry->ErrorPhiDZ = candidate->TrackCovariance(1,3); 547 entry->ErrorPhiCtgTheta = candidate->TrackCovariance(1,4); 548 entry->ErrorCDZ = candidate->TrackCovariance(2,3); 549 entry->ErrorCCtgTheta = candidate->TrackCovariance(2,4); 550 entry->ErrorDZCtgTheta = candidate->TrackCovariance(3,4); 551 552 entry->Xd = candidate->Xd; 553 entry->Yd = candidate->Yd; 554 entry->Zd = candidate->Zd; 555 556 const TLorentzVector &momentum = candidate->Momentum; 557 558 e = momentum.E(); 559 pt = momentum.Pt(); 560 p = momentum.P(); 561 phi = momentum.Phi(); 562 m = momentum.M(); 563 ctgTheta = (TMath::Tan(momentum.Theta()) != 0) ? 1 / TMath::Tan(momentum.Theta()) : 1e10; 564 565 entry->E = e; 566 entry->P = p; 567 entry->PT = pt; 568 entry->Eta = eta; 569 entry->Phi = phi; 570 entry->CtgTheta = ctgTheta; 571 entry->C = candidate->C; 572 entry->Mass = m; 573 574 particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0)); 575 //const TLorentzVector &initialPosition = particle->Position; 576 const TLorentzVector &initialPosition = candidate->InitialPosition; 577 578 entry->X = initialPosition.X(); 579 entry->Y = initialPosition.Y(); 580 entry->Z = initialPosition.Z(); 581 entry->T = initialPosition.T() * 1.0E-3 / c_light; 582 entry->ErrorT = candidate-> ErrorT * 1.0E-3 / c_light; 583 584 entry->VertexIndex = candidate->ClusterIndex; 585 586 entry->Eem = candidate->Eem; 587 entry->Ehad = candidate->Ehad; 588 entry->Etrk = candidate->Etrk; 589 entry->Edges[0] = candidate->Edges[0]; 590 entry->Edges[1] = candidate->Edges[1]; 591 entry->Edges[2] = candidate->Edges[2]; 592 entry->Edges[3] = candidate->Edges[3]; 593 594 //entry->T = position.T() * 1.0E-3 / c_light; 595 entry->NTimeHits = candidate->NTimeHits; 596 597 FillParticles(candidate, &entry->Particles); 598 446 599 } 447 600 } … … 687 840 entry->NCharged = candidate->NCharged; 688 841 entry->NNeutrals = candidate->NNeutrals; 842 843 entry->NeutralEnergyFraction = candidate->NeutralEnergyFraction; 844 entry->ChargedEnergyFraction = candidate->ChargedEnergyFraction; 689 845 entry->Beta = candidate->Beta; 690 846 entry->BetaStar = candidate->BetaStar; -
modules/TreeWriter.h
ra5af1df rd612dec 56 56 void ProcessTracks(ExRootTreeBranch *branch, TObjArray *array); 57 57 void ProcessTowers(ExRootTreeBranch *branch, TObjArray *array); 58 void ProcessParticleFlowCandidates(ExRootTreeBranch *branch, TObjArray *array); 58 59 void ProcessPhotons(ExRootTreeBranch *branch, TObjArray *array); 59 60 void ProcessElectrons(ExRootTreeBranch *branch, TObjArray *array); … … 79 80 #endif 80 81 81 ClassDef(TreeWriter, 1)82 ClassDef(TreeWriter, 2) 82 83 }; 83 84
Note:
See TracChangeset
for help on using the changeset viewer.