Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:23:49

0001 #include "SimCalorimetry/HcalSimAlgos/interface/HPDIonFeedbackSim.h"
0002 #include "SimCalorimetry/HcalSimAlgos/interface/HcalShapes.h"
0003 #include "SimCalorimetry/CaloSimAlgos/interface/CaloShapeIntegrator.h"
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "CLHEP/Random/JamesRandom.h"
0006 #include <iostream>
0007 
0008 int main() {
0009   edm::ParameterSet pset;
0010 
0011   HcalShapes* theShapes = new HcalShapes();
0012   HPDIonFeedbackSim* feedbackSim = new HPDIonFeedbackSim(pset, theShapes);
0013 
0014   //  HPDIonFeedbackSim feedbackSim(pset, theShapes);
0015   CLHEP::HepJamesRandom engine;
0016   HcalDetId detId(HcalBarrel, 1, 1, 1);
0017 
0018   int nRuns = 1000;
0019 
0020   for (double e = 0; e < 100; e += 10) {
0021     double originalCharge = e * 6;
0022     double chargeSum = 0;
0023     for (int i = 0; i < nRuns; ++i) {
0024       chargeSum += feedbackSim->getIonFeedback(detId, originalCharge, 0., true, false, &engine);
0025     }
0026     if (e > 1.e-20)
0027       std::cout << "ENERGY " << e << " FACTOR " << chargeSum / nRuns / 6 / e * 100 << "%" << std::endl;
0028   }
0029 
0030   // test thermal noise
0031 
0032   for (int i = 0; i < 100; ++i) {
0033     CaloSamples samples(detId, 10);
0034     feedbackSim->addThermalNoise(samples, &engine);
0035     if (samples[7] > 1.e-20)
0036       std::cout << samples << std::endl;
0037   }
0038 }