Changeset d77b51d in git for modules/Calorimeter.cc
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note:
See TracChangeset
for help on using the changeset viewer.