Changeset 21eab4f in git for modules/SimpleCalorimeter.cc
- Timestamp:
- Aug 26, 2016, 5:17:14 PM (8 years ago)
- Parents:
- ec5e04b (diff), 94cacb6 (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. - git-author:
- AlexandreMertens <alexandre.mertens@…> (08/26/16 17:17:14)
- git-committer:
- GitHub <noreply@…> (08/26/16 17:17:14)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/SimpleCalorimeter.cc
rec5e04b r21eab4f 58 58 fItParticleInputArray(0), fItTrackInputArray(0) 59 59 { 60 Int_t i; 61 60 62 61 fResolutionFormula = new DelphesFormula; 63 64 for(i = 0; i < 2; ++i) 65 { 66 fTowerTrackArray[i] = new TObjArray; 67 fItTowerTrackArray[i] = fTowerTrackArray[i]->MakeIterator(); 68 } 62 fTowerTrackArray = new TObjArray; 63 fItTowerTrackArray = fTowerTrackArray->MakeIterator(); 64 69 65 } 70 66 … … 73 69 SimpleCalorimeter::~SimpleCalorimeter() 74 70 { 75 Int_t i; 76 71 77 72 if(fResolutionFormula) delete fResolutionFormula; 78 79 for(i = 0; i < 2; ++i) 80 { 81 if(fTowerTrackArray[i]) delete fTowerTrackArray[i]; 82 if(fItTowerTrackArray[i]) delete fItTowerTrackArray[i]; 83 } 73 if(fTowerTrackArray) delete fTowerTrackArray; 74 if(fItTowerTrackArray) delete fItTowerTrackArray; 75 84 76 } 85 77 … … 199 191 Double_t energy; 200 192 Double_t sigma; 193 Double_t energyGuess; 194 201 195 Int_t pdgCode; 202 196 … … 340 334 fTowerEnergy = 0.0; 341 335 342 fTrackEnergy [0]= 0.0;343 fTrack Energy[1]= 0.0;336 fTrackEnergy = 0.0; 337 fTrackSigma = 0.0; 344 338 345 339 fTowerTime = 0.0; … … 351 345 fTowerPhotonHits = 0; 352 346 353 fTowerTrackArray[0]->Clear(); 354 fTowerTrackArray[1]->Clear(); 355 } 347 fTowerTrackArray->Clear(); 348 } 356 349 357 350 // check for track hits … … 371 364 if(fTrackFractions[number] > 1.0E-9) 372 365 { 373 sigma = fResolutionFormula->Eval(0.0, fTowerEta, 0.0, momentum.E()); 374 if(sigma/momentum.E() < track->TrackResolution) 375 { 376 fTrackEnergy[0] += energy; 377 fTowerTrackArray[0]->Add(track); 378 } 379 else 380 { 381 fTrackEnergy[1] += energy; 382 fTowerTrackArray[1]->Add(track); 383 } 366 367 // compute total charged energy 368 fTrackEnergy += energy; 369 sigma = fResolutionFormula->Eval(0.0, fTowerEta, 0.0, momentum.E()); 370 if(sigma/momentum.E() < track->TrackResolution) energyGuess = energy; 371 else energyGuess = momentum.E(); 372 373 fTrackSigma += ((track->TrackResolution)*energyGuess)*((track->TrackResolution)*energyGuess); 374 fTowerTrackArray->Add(track); 384 375 } 376 385 377 else 386 378 { … … 403 395 fTowerEnergy += energy; 404 396 405 fTowerTime += TMath::Sqrt(energy)*position.T();406 fTowerTimeWeight += TMath::Sqrt(energy);397 fTowerTime += energy*position.T(); 398 fTowerTimeWeight += energy; 407 399 408 400 fTower->AddCandidate(particle); … … 418 410 { 419 411 Candidate *tower, *track, *mother; 420 Double_t energy, pt, eta, phi;421 Double_t sigma ;412 Double_t energy,neutralEnergy, pt, eta, phi; 413 Double_t sigma, neutralSigma; 422 414 Double_t time; 415 416 Double_t weightTrack, weightCalo, bestEnergyEstimate, rescaleFactor; 423 417 424 418 TLorentzVector momentum; … … 436 430 437 431 if(energy < fEnergyMin || energy < fEnergySignificanceMin*sigma) energy = 0.0; 432 438 433 439 434 if(fSmearTowerCenter) … … 464 459 if(energy > 0.0) fTowerOutputArray->Add(fTower); 465 460 466 // fill e-flow candidates 467 468 energy -= fTrackEnergy[1]; 469 470 fItTowerTrackArray[0]->Reset(); 471 while((track = static_cast<Candidate*>(fItTowerTrackArray[0]->Next()))) 472 { 473 mother = track; 474 track = static_cast<Candidate*>(track->Clone()); 475 track->AddCandidate(mother); 476 477 track->Momentum *= energy/fTrackEnergy[0]; 478 479 fEFlowTrackOutputArray->Add(track); 480 } 481 482 fItTowerTrackArray[1]->Reset(); 483 while((track = static_cast<Candidate*>(fItTowerTrackArray[1]->Next()))) 484 { 485 mother = track; 486 track = static_cast<Candidate*>(track->Clone()); 487 track->AddCandidate(mother); 488 489 fEFlowTrackOutputArray->Add(track); 490 } 491 492 if(fTowerTrackArray[0]->GetEntriesFast() > 0) energy = 0.0; 493 494 sigma = fResolutionFormula->Eval(0.0, fTowerEta, 0.0, energy); 495 if(energy < fEnergyMin || energy < fEnergySignificanceMin*sigma) energy = 0.0; 496 497 // save energy excess as an energy flow tower 498 if(energy > 0.0) 461 462 // e-flow candidates 463 464 //compute neutral excess 465 466 fTrackSigma = TMath::Sqrt(fTrackSigma); 467 neutralEnergy = max( (energy - fTrackEnergy) , 0.0); 468 469 //compute sigma_trk total 470 neutralSigma = neutralEnergy / TMath::Sqrt(fTrackSigma*fTrackSigma+ sigma*sigma); 471 472 // if neutral excess is significant, simply create neutral Eflow tower and clone each track into eflowtrack 473 if(neutralEnergy > fEnergyMin && neutralSigma > fEnergySignificanceMin) 499 474 { 500 475 // create new photon tower 501 476 tower = static_cast<Candidate*>(fTower->Clone()); 502 pt = energy / TMath::CosH(eta); 503 504 tower->Eem = (!fIsEcal) ? 0 : energy; 505 tower->Ehad = (fIsEcal) ? 0 : energy; 477 pt = neutralEnergy / TMath::CosH(eta); 478 479 tower->Eem = (!fIsEcal) ? 0 : neutralEnergy; 480 tower->Ehad = (fIsEcal) ? 0 : neutralEnergy; 481 tower->PID = (fIsEcal) ? 22 : 0; 482 483 tower->Momentum.SetPtEtaPhiE(pt, eta, phi, neutralEnergy); 484 fEFlowTowerOutputArray->Add(tower); 506 485 507 tower->Momentum.SetPtEtaPhiE(pt, eta, phi, energy); 486 fItTowerTrackArray->Reset(); 487 while((track = static_cast<Candidate*>(fItTowerTrackArray->Next()))) 488 { 489 mother = track; 490 track = static_cast<Candidate*>(track->Clone()); 491 track->AddCandidate(mother); 492 493 fEFlowTrackOutputArray->Add(track); 494 } 495 } 508 496 509 tower->PID = (fIsEcal) ? 22 : 0; 510 511 fEFlowTowerOutputArray->Add(tower); 512 } 513 } 497 // if neutral excess is not significant, rescale eflow tracks, such that the total charged equals the best measurement given by the calorimeter and tracking 498 else if (fTrackEnergy > 0.0) 499 { 500 weightTrack = (fTrackSigma > 0.0) ? 1 / (fTrackSigma*fTrackSigma) : 0.0; 501 weightCalo = (sigma > 0.0) ? 1 / (sigma*sigma) : 0.0; 502 503 bestEnergyEstimate = (weightTrack*fTrackEnergy + weightCalo*energy) / (weightTrack + weightCalo); 504 rescaleFactor = bestEnergyEstimate/fTrackEnergy; 505 506 fItTowerTrackArray->Reset(); 507 while((track = static_cast<Candidate*>(fItTowerTrackArray->Next()))) 508 { 509 mother = track; 510 track = static_cast<Candidate*>(track->Clone()); 511 track->AddCandidate(mother); 512 513 track->Momentum *= rescaleFactor; 514 515 fEFlowTrackOutputArray->Add(track); 516 } 517 } 518 519 } 514 520 515 521 //------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.