Fork me on GitHub

Changeset 39022b6 in git for modules/Calorimeter.cc


Ignore:
Timestamp:
Jun 25, 2013, 2:43:27 PM (11 years ago)
Author:
pavel <pavel@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
be42bf4
Parents:
6085382
Message:

use log normal for calorimeter resolution

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/Calorimeter.cc

    r6085382 r39022b6  
    155155  fEFlowTrackOutputArray = ExportArray(GetString("EFlowTrackOutputArray", "eflowTracks"));
    156156  fEFlowTowerOutputArray = ExportArray(GetString("EFlowTowerOutputArray", "eflowTowers"));
     157
     158 
     159
    157160}
    158161
     
    373376  Double_t energy, pt, eta, phi;
    374377  Double_t ecalEnergy, hcalEnergy;
    375 
     378  Double_t sE,mE,sH,mH,SE=0,ME=0,SH=0,MH=0;
     379 
    376380  if(!fTower) return;
    377381
    378   ecalEnergy = gRandom->Gaus(fTowerECalEnergy, fECalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerECalEnergy));
     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//  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 
    379409  if(ecalEnergy < 0.0) ecalEnergy = 0.0;
    380410
    381   hcalEnergy = gRandom->Gaus(fTowerHCalEnergy, fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy));
     411  hcalEnergy = (MH != 0.0 ? Draw_lognormal(MH,SH) : 0.0);
     412  //hcalEnergy = gRandom->Gaus(fTowerHCalEnergy, fHCalResolutionFormula->Eval(0.0, fTowerEta, 0.0, fTowerHCalEnergy));
    382413  if(hcalEnergy < 0.0) hcalEnergy = 0.0;
    383414
     415//  cout<<hcalEnergy<<endl;
     416   
    384417  energy = ecalEnergy + hcalEnergy;
    385418
    386   // eta = fTowerEta;
    387   // phi = fTowerPhi;
     419 // eta = fTowerEta;
     420 // phi = fTowerPhi;
    388421
    389422  eta = gRandom->Uniform(fTowerEdges[0], fTowerEdges[1]);
     
    468501
    469502//------------------------------------------------------------------------------
     503
     504Double_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  }
Note: See TracChangeset for help on using the changeset viewer.