Project CMSSW displayed by LXR

File indexing completed on 2024-04-06 12:11:20

```0001 //FAMOS header
0003 #include "FastSimulation/Utilities/interface/RandomEngineAndDistribution.h"
0004
0005 #include <cmath>
0006
0008     : theR(RC), theNumberOfSpots(nSpots), theSpotEnergy(energy), random(engine) {
0010   currentEnergyFraction = 0.;
0011   currentUlim = 0.;
0012   nInter = 0;
0013 }
0014
0019     enFrac = 1.;
0020   double energyFrac = enFrac - currentEnergyFraction;
0021   currentEnergyFraction = enFrac;
0022   //  std::cout << " Rad " << nInter << " Energy frac " << energyFrac << std::endl;
0023
0024   // Calculates the number of spots. Add binomial fluctuations
0025   double dspot =
0026       random->gaussShoot(theNumberOfSpots * energyFrac, sqrt(energyFrac * (1. - energyFrac) * theNumberOfSpots));
0027   //  std::cout << " Normal : " << theNumberOfSpots*energyFrac << " "<< dspot << std::endl;
0028   unsigned nspot = (unsigned)(dspot * spotf + 0.5);
0029   //  if(nspot<100)
0030   //    {
0031   //      spotf=1.;
0032   //      nspot=(unsigned)(theNumberOfSpots*energyFrac+0.5);
0033   //    }
0034
0035   dspotsunscaled.push_back(dspot);
0036   spotfraction.push_back(spotf);
0037
0038   double spotEnergy = theSpotEnergy / spotf;
0039   //  std::cout << " The number of spots " << theNumberOfSpots << " " << nspot << std::endl;
0040
0041   // This is not correct for the last interval, but will be overriden later
0042   nspots.push_back(nspot);
0043   spotE.push_back(spotEnergy);
0044   // computes the limits
0046   if (radius > 10) {
0047     umax = 1.;
0048   }
0049
0050   // Stores the limits
0051   uMax.push_back(umax);
0052   uMin.push_back(currentUlim);
0053   currentUlim = umax;
0054
0055   // Stores the energy
0056   //  std::cout << " SpotE " << theSpotEnergy<< " " << spotf << " " << theSpotEnergy/spotf<< std::endl;
0057
0058   ++nInter;
0059 }
0060
0062   double rm2 = rm * rm;
0063   return (rm2 / (rm2 + theR * theR));
0064 }
0065
0067   //  std::cout << " The number of Spots " << theNumberOfSpots << std::endl;
0068   //  std::cout << " Size : " << nInter << " " << nspots.size() << " " << dspotsunscaled.size() << std::endl;
0069   double ntotspots = 0.;