Changeset 00e8dca in git
- Timestamp:
- Oct 8, 2015, 1:05:51 PM (9 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- cdeea24
- Parents:
- e2dd4c5
- Location:
- modules
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/Calorimeter.cc
re2dd4c5 r00e8dca 56 56 Calorimeter::Calorimeter() : 57 57 fECalResolutionFormula(0), fHCalResolutionFormula(0), 58 fItParticleInputArray(0), fItTrackInputArray(0), 59 fTowerTrackArray(0), fItTowerTrackArray(0) 58 fItParticleInputArray(0), fItTrackInputArray(0) 60 59 { 60 Int_t i; 61 61 62 fECalResolutionFormula = new DelphesFormula; 62 63 fHCalResolutionFormula = new DelphesFormula; 63 64 64 fTowerTrackArray = new TObjArray; 65 fItTowerTrackArray = fTowerTrackArray->MakeIterator(); 65 for(i = 0; i < 2; ++i) 66 { 67 fECalTowerTrackArray[i] = new TObjArray; 68 fItECalTowerTrackArray[i] = fECalTowerTrackArray[i]->MakeIterator(); 69 70 fHCalTowerTrackArray[i] = new TObjArray; 71 fItHCalTowerTrackArray[i] = fHCalTowerTrackArray[i]->MakeIterator(); 72 } 66 73 } 67 74 … … 70 77 Calorimeter::~Calorimeter() 71 78 { 79 Int_t i; 80 72 81 if(fECalResolutionFormula) delete fECalResolutionFormula; 73 82 if(fHCalResolutionFormula) delete fHCalResolutionFormula; 74 83 75 if(fTowerTrackArray) delete fTowerTrackArray; 76 if(fItTowerTrackArray) delete fItTowerTrackArray; 84 for(i = 0; i < 2; ++i) 85 { 86 if(fECalTowerTrackArray[i]) delete fECalTowerTrackArray[i]; 87 if(fItECalTowerTrackArray[i]) delete fItECalTowerTrackArray[i]; 88 89 if(fHCalTowerTrackArray[i]) delete fHCalTowerTrackArray[i]; 90 if(fItHCalTowerTrackArray[i]) delete fItHCalTowerTrackArray[i]; 91 } 77 92 } 78 93 … … 203 218 Double_t ecalFraction, hcalFraction; 204 219 Double_t ecalEnergy, hcalEnergy; 220 Double_t ecalSigma, hcalSigma; 205 221 Int_t pdgCode; 206 222 … … 215 231 DelphesFactory *factory = GetFactory(); 216 232 fTowerHits.clear(); 217 f TowerECalFractions.clear();218 f TowerHCalFractions.clear();219 f TrackECalFractions.clear();220 f TrackHCalFractions.clear();233 fECalTowerFractions.clear(); 234 fHCalTowerFractions.clear(); 235 fECalTrackFractions.clear(); 236 fHCalTrackFractions.clear(); 221 237 222 238 // loop over all particles … … 239 255 hcalFraction = itFractionMap->second.second; 240 256 241 f TowerECalFractions.push_back(ecalFraction);242 f TowerHCalFractions.push_back(hcalFraction);257 fECalTowerFractions.push_back(ecalFraction); 258 fHCalTowerFractions.push_back(hcalFraction); 243 259 244 260 if(ecalFraction < 1.0E-9 && hcalFraction < 1.0E-9) continue; … … 285 301 hcalFraction = itFractionMap->second.second; 286 302 287 f TrackECalFractions.push_back(ecalFraction);288 f TrackHCalFractions.push_back(hcalFraction);303 fECalTrackFractions.push_back(ecalFraction); 304 fHCalTrackFractions.push_back(hcalFraction); 289 305 290 306 // find eta bin [1, fEtaBins.size - 1] … … 349 365 fTowerEdges[3] = (*phiBins)[phiBin]; 350 366 351 fTowerECalEnergy = 0.0; 352 fTowerHCalEnergy = 0.0; 353 354 fTrackECalEnergy = 0.0; 355 fTrackHCalEnergy = 0.0; 367 fECalTowerEnergy = 0.0; 368 fHCalTowerEnergy = 0.0; 369 370 fECalTrackEnergy[0] = 0.0; 371 fECalTrackEnergy[1] = 0.0; 372 373 fHCalTrackEnergy[0] = 0.0; 374 fHCalTrackEnergy[1] = 0.0; 356 375 357 376 fTowerTrackHits = 0; 358 377 fTowerPhotonHits = 0; 359 378 360 fTowerTrackArray->Clear(); 379 fECalTowerTrackArray[0]->Clear(); 380 fECalTowerTrackArray[1]->Clear(); 381 382 fHCalTowerTrackArray[0]->Clear(); 383 fHCalTowerTrackArray[1]->Clear(); 361 384 } 362 385 … … 370 393 position = track->Position; 371 394 372 ecalEnergy = momentum.E() * fTrackECalFractions[number]; 373 hcalEnergy = momentum.E() * fTrackHCalFractions[number]; 374 375 fTrackECalEnergy += ecalEnergy; 376 fTrackHCalEnergy += hcalEnergy; 395 ecalEnergy = momentum.E() * fECalTrackFractions[number]; 396 hcalEnergy = momentum.E() * fHCalTrackFractions[number]; 377 397 378 398 if(ecalEnergy > fTimingEnergyMin && fTower) … … 384 404 } 385 405 386 fTowerTrackArray->Add(track); 406 if(fECalTrackFractions[number] > 1.0E-9 && fHCalTrackFractions[number] < 1.0E-9 ) 407 { 408 ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, momentum.E()); 409 if(ecalSigma/momentum.E() < track->TrackResolution) 410 { 411 fECalTrackEnergy[0] += ecalEnergy; 412 fECalTowerTrackArray[0]->Add(track); 413 } 414 else 415 { 416 fECalTrackEnergy[1] += ecalEnergy; 417 fECalTowerTrackArray[1]->Add(track); 418 } 419 } 420 else if(fECalTrackFractions[number] < 1.0E-9 && fHCalTrackFractions[number] > 1.0E-9 ) 421 { 422 hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, momentum.E()); 423 if(hcalSigma/momentum.E() < track->TrackResolution) 424 { 425 fHCalTrackEnergy[0] += hcalEnergy; 426 fHCalTowerTrackArray[0]->Add(track); 427 } 428 else 429 { 430 fHCalTrackEnergy[1] += hcalEnergy; 431 fHCalTowerTrackArray[1]->Add(track); 432 } 433 } 387 434 388 435 continue; … … 397 444 398 445 // fill current tower 399 ecalEnergy = momentum.E() * f TowerECalFractions[number];400 hcalEnergy = momentum.E() * f TowerHCalFractions[number];401 402 f TowerECalEnergy += ecalEnergy;403 f TowerHCalEnergy += hcalEnergy;446 ecalEnergy = momentum.E() * fECalTowerFractions[number]; 447 hcalEnergy = momentum.E() * fHCalTowerFractions[number]; 448 449 fECalTowerEnergy += ecalEnergy; 450 fHCalTowerEnergy += hcalEnergy; 404 451 405 452 if(ecalEnergy > fTimingEnergyMin && fTower) … … 426 473 Double_t ecalEnergy, hcalEnergy; 427 474 Double_t ecalSigma, hcalSigma; 428 Double_t ecalTrkSigma, hcalTrkSigma; 429 Double_t ecalFraction, hcalFraction; 430 431 Int_t pdgCode; 475 432 476 TLorentzVector momentum; 433 477 TFractionMap::iterator itFractionMap; … … 438 482 439 483 440 ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, f TowerECalEnergy);441 hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, f TowerHCalEnergy);442 443 ecalEnergy = LogNormal(f TowerECalEnergy, ecalSigma);444 hcalEnergy = LogNormal(f TowerHCalEnergy, hcalSigma);484 ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fECalTowerEnergy); 485 hcalSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fHCalTowerEnergy); 486 487 ecalEnergy = LogNormal(fECalTowerEnergy, ecalSigma); 488 hcalEnergy = LogNormal(fHCalTowerEnergy, hcalSigma); 445 489 446 490 ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, ecalEnergy); … … 509 553 // fill energy flow candidates 510 554 511 // save as eflowtracks only tracks that have better resolution than calo 512 513 fItTowerTrackArray->Reset(); 514 while((track = static_cast<Candidate*>(fItTowerTrackArray->Next()))) 515 { 516 pdgCode = TMath::Abs(track->PID); 517 518 itFractionMap = fFractionMap.find(pdgCode); 519 if(itFractionMap == fFractionMap.end()) 520 { 521 itFractionMap = fFractionMap.find(0); 522 } 523 524 ecalFraction = itFractionMap->second.first; 525 hcalFraction = itFractionMap->second.second; 526 555 ecalEnergy -= fECalTrackEnergy[1]; 556 hcalEnergy -= fHCalTrackEnergy[1]; 557 558 fItECalTowerTrackArray[0]->Reset(); 559 while((track = static_cast<Candidate*>(fItECalTowerTrackArray[0]->Next()))) 560 { 527 561 mother = track; 528 562 track = static_cast<Candidate*>(track->Clone()); 529 563 track->AddCandidate(mother); 530 momentum = track->Momentum; 531 532 if(ecalFraction > 1.0E-9 && hcalFraction < 1.0E-9 ) 533 { 534 ecalTrkSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, momentum.E()); 535 if(ecalTrkSigma/momentum.E() < track->TrackResolution) 536 { 537 momentum *= ecalEnergy/fTrackECalEnergy; 538 } 539 } 540 else if(ecalFraction < 1.0E-9 && hcalFraction > 1.0E-9 ) 541 { 542 hcalTrkSigma = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, momentum.E()); 543 if(hcalTrkSigma/momentum.E() < track->TrackResolution) 544 { 545 momentum *= hcalEnergy/fTrackHCalEnergy; 546 } 547 } 564 565 track->Momentum *= ecalEnergy/fECalTrackEnergy[0]; 548 566 549 567 fEFlowTrackOutputArray->Add(track); 550 568 } 551 569 552 ecalEnergy -= fTrackECalEnergy; 553 hcalEnergy -= fTrackHCalEnergy; 570 fItECalTowerTrackArray[1]->Reset(); 571 while((track = static_cast<Candidate*>(fItECalTowerTrackArray[1]->Next()))) 572 { 573 mother = track; 574 track = static_cast<Candidate*>(track->Clone()); 575 track->AddCandidate(mother); 576 577 fEFlowTrackOutputArray->Add(track); 578 } 579 580 fItHCalTowerTrackArray[0]->Reset(); 581 while((track = static_cast<Candidate*>(fItHCalTowerTrackArray[0]->Next()))) 582 { 583 mother = track; 584 track = static_cast<Candidate*>(track->Clone()); 585 track->AddCandidate(mother); 586 587 track->Momentum *= ecalEnergy/fECalTrackEnergy[0]; 588 589 fEFlowTrackOutputArray->Add(track); 590 } 591 592 fItHCalTowerTrackArray[1]->Reset(); 593 while((track = static_cast<Candidate*>(fItHCalTowerTrackArray[1]->Next()))) 594 { 595 mother = track; 596 track = static_cast<Candidate*>(track->Clone()); 597 track->AddCandidate(mother); 598 599 fEFlowTrackOutputArray->Add(track); 600 } 554 601 555 602 ecalSigma = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, ecalEnergy); -
modules/Calorimeter.h
re2dd4c5 r00e8dca 57 57 Candidate *fTower; 58 58 Double_t fTowerEta, fTowerPhi, fTowerEdges[4]; 59 Double_t f TowerECalEnergy, fTowerHCalEnergy;60 Double_t f TrackECalEnergy, fTrackHCalEnergy;59 Double_t fECalTowerEnergy, fHCalTowerEnergy; 60 Double_t fECalTrackEnergy[2], fHCalTrackEnergy[2]; 61 61 62 62 Double_t fTimingEnergyMin; … … 81 81 std::vector < Long64_t > fTowerHits; 82 82 83 std::vector < Double_t > f TowerECalFractions;84 std::vector < Double_t > f TowerHCalFractions;83 std::vector < Double_t > fECalTowerFractions; 84 std::vector < Double_t > fHCalTowerFractions; 85 85 86 std::vector < Double_t > f TrackECalFractions;87 std::vector < Double_t > f TrackHCalFractions;86 std::vector < Double_t > fECalTrackFractions; 87 std::vector < Double_t > fHCalTrackFractions; 88 88 89 89 DelphesFormula *fECalResolutionFormula; //! … … 103 103 TObjArray *fEFlowNeutralHadronOutputArray; //! 104 104 105 TObjArray *fTowerTrackArray; //! 106 TIterator *fItTowerTrackArray; //! 105 TObjArray *fECalTowerTrackArray[2]; //! 106 TIterator *fItECalTowerTrackArray[2]; //! 107 108 TObjArray *fHCalTowerTrackArray[2]; //! 109 TIterator *fItHCalTowerTrackArray[2]; //! 107 110 108 111 void FinalizeTower();
Note:
See TracChangeset
for help on using the changeset viewer.