- Timestamp:
- Jun 25, 2013, 4:24:34 PM (11 years ago)
- Location:
- trunk/modules
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/Calorimeter.cc
r1142 r1145 155 155 fEFlowTrackOutputArray = ExportArray(GetString("EFlowTrackOutputArray", "eflowTracks")); 156 156 fEFlowTowerOutputArray = ExportArray(GetString("EFlowTowerOutputArray", "eflowTowers")); 157 158 159 160 157 } 161 158 … … 376 373 Double_t energy, pt, eta, phi; 377 374 Double_t ecalEnergy, hcalEnergy; 378 Double_t sE,mE,sH,mH,SE=0,ME=0,SH=0,MH=0; 379 375 380 376 if(!fTower) return; 381 377 382 // cout<<"new tower -----------------------"<<endl;383 384 385 sE = fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy);386 mE = fTowerECalEnergy;387 388 sH = fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy);389 mH = fTowerHCalEnergy;390 391 // cout<<sE<<","<<mE<<endl;392 // cout<<sH<<","<<mH<<endl;393 // cout<<"---"<<endl;394 395 if(mE>0)SE = TMath::Sqrt(TMath::Log((1+(sE*sE)/(mE*mE))));396 if(mE>0)ME = TMath::Log(mE)-0.5*SE*SE;397 398 if(mH>0)SH = TMath::Sqrt(TMath::Log((1+(sH*sH)/(mH*mH))));399 if(mH>0)MH = TMath::Log(mH)-0.5*SH*SH;400 401 // cout<<SE<<","<<ME<<endl;402 // cout<<SH<<","<<MH<<endl;403 // cout<<"---"<<endl;404 405 378 // ecalEnergy = gRandom->Gaus(fTowerECalEnergy, fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy)); 406 ecalEnergy = (ME != 0.0 ? Draw_lognormal(ME,SE) : 0.0); 407 // cout<<ecalEnergy<<endl; 408 409 if(ecalEnergy < 0.0) ecalEnergy = 0.0; 410 411 hcalEnergy = (MH != 0.0 ? Draw_lognormal(MH,SH) : 0.0); 412 //hcalEnergy = gRandom->Gaus(fTowerHCalEnergy, fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy)); 413 if(hcalEnergy < 0.0) hcalEnergy = 0.0; 414 415 // cout<<hcalEnergy<<endl; 416 379 // if(ecalEnergy < 0.0) ecalEnergy = 0.0; 380 381 ecalEnergy = LogNormal(fTowerECalEnergy, fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy)); 382 383 // hcalEnergy = gRandom->Gaus(fTowerHCalEnergy, fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy)); 384 // if(hcalEnergy < 0.0) hcalEnergy = 0.0; 385 386 hcalEnergy = LogNormal(fTowerHCalEnergy, fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy)); 387 417 388 energy = ecalEnergy + hcalEnergy; 418 389 419 //eta = fTowerEta;420 //phi = fTowerPhi;390 // eta = fTowerEta; 391 // phi = fTowerPhi; 421 392 422 393 eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]); … … 502 473 //------------------------------------------------------------------------------ 503 474 504 Double_t Calorimeter::Draw_lognormal(Double_t mu, Double_t sigma) 505 { 506 Double_t g = gRandom->Gaus(0, 1); 507 return TMath::Exp(mu + sigma * g); 508 } 475 Double_t Calorimeter::LogNormal(Double_t mean, Double_t sigma) 476 { 477 Double_t a, b; 478 479 if(mean > 0.0) 480 { 481 b = TMath::Sqrt(TMath::Log((1.0 + (sigma*sigma)/(mean*mean)))); 482 a = TMath::Log(mean) - 0.5*b*b; 483 484 return TMath::Exp(a + b*gRandom->Gaus(0, 1)); 485 } 486 else 487 { 488 return 0.0; 489 } 490 } -
trunk/modules/Calorimeter.h
r1142 r1145 35 35 void Process(); 36 36 void Finish(); 37 Double_t Draw_lognormal(Double_t mu, Double_t sigma); 37 38 38 private: 39 39 … … 80 80 81 81 void FinalizeTower(); 82 82 Double_t LogNormal(Double_t mean, Double_t sigma); 83 83 84 ClassDef(Calorimeter, 1) 84 85 };
Note:
See TracChangeset
for help on using the changeset viewer.