Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 10:04:04

0001 #include "catch.hpp"
0002 #include "SimG4CMS/Calo/interface/HFFibre.h"
0003 #include "CLHEP/Units/GlobalPhysicalConstants.h"
0004 
0005 namespace test_hffibre {
0006   HFFibre::Params defaultParams() {
0007     HFFibre::Params fibreParams;
0008     //Taken from values used by IB workflow 250202.181
0009     fibreParams.fractionOfSpeedOfLightInFibre_ = 0.5;
0010     fibreParams.gParHF_ = {{220, 1650, 300, 0, 11150, 3.75, 11370}};
0011     fibreParams.rTableHF_ = {{12.5 * cm,
0012                               16.9 * cm,
0013                               20.1 * cm,
0014                               24 * cm,
0015                               28.6 * cm,
0016                               34 * cm,
0017                               40.6 * cm,
0018                               48.3 * cm,
0019                               57.6 * cm,
0020                               68.6 * cm,
0021                               81.81 * cm,
0022                               197.5 * cm,
0023                               116.2 * cm,
0024                               130 * cm}};
0025     fibreParams.shortFibreLength_ = {{206 * cm,
0026                                       211.881 * cm,
0027                                       220.382 * cm,
0028                                       235.552 * cm,
0029                                       245.62 * cm,
0030                                       253.909 * cm,
0031                                       255.012 * cm,
0032                                       263.007 * cm,
0033                                       264.348 * cm,
0034                                       268.5 * cm,
0035                                       268.5 * cm,
0036                                       270 * cm,
0037                                       273.5 * cm}};
0038     fibreParams.longFibreLength_ = {{227.993 * cm,
0039                                      237.122 * cm,
0040                                      241.701 * cm,
0041                                      256.48 * cm,
0042                                      266.754 * cm,
0043                                      275.988 * cm,
0044                                      276.982 * cm,
0045                                      284.989 * cm,
0046                                      286.307 * cm,
0047                                      290.478 * cm,
0048                                      290.5 * cm,
0049                                      292 * cm,
0050                                      295.5 * cm}};
0051     fibreParams.attenuationLength_ = {
0052         {0.000809654 / cm, 0.000713002 / cm, 0.000654918 / cm, 0.000602767 / cm, 0.000566295 / cm, 0.000541647 / cm,
0053          0.000516175 / cm, 0.000502512 / cm, 0.000504225 / cm, 0.000506212 / cm, 0.000506275 / cm, 0.000487621 / cm,
0054          0.000473034 / cm, 0.000454002 / cm, 0.000442383 / cm, 0.000441043 / cm, 0.00044361 / cm,  0.000433124 / cm,
0055          0.000440188 / cm, 0.000435257 / cm, 0.000439224 / cm, 0.000431385 / cm, 0.00041707 / cm,  0.000415677 / cm,
0056          0.000408389 / cm, 0.000400293 / cm, 0.000400989 / cm, 0.000395417 / cm, 0.00038936 / cm,  0.000383942 / cm}};
0057     fibreParams.lambdaLimits_ = {{300, 600}};
0058     return fibreParams;
0059   }
0060 }  // namespace test_hffibre
0061 
0062 TEST_CASE("test HFFibre", "[HFFibre]") {
0063   HFFibre::Params params = test_hffibre::defaultParams();
0064 
0065   HFFibre fibre(params);
0066   SECTION("Attenuation") {
0067     REQUIRE(params.attenuationLength_[0] == fibre.attLength(0));
0068     REQUIRE(params.attenuationLength_.back() == fibre.attLength(1000));
0069     const auto binSize = (params.lambdaLimits_[1] - params.lambdaLimits_[0]) / params.attenuationLength_.size();
0070     for (std::size_t i = 0; i < params.attenuationLength_.size(); ++i) {
0071       REQUIRE(fibre.attLength(params.lambdaLimits_[0] + binSize * i) == params.attenuationLength_[i]);
0072     }
0073   }
0074 
0075   SECTION("zShift") {
0076     REQUIRE(fibre.zShift({0, 0, 0}, 0) == *(params.longFibreLength_.end() - 1) - 0.5 * params.gParHF_[1]);
0077   }
0078 
0079   SECTION("tShift") {
0080     REQUIRE(fibre.zShift({0, 0, 0}, 0) / (params.fractionOfSpeedOfLightInFibre_ * c_light) ==
0081             fibre.tShift({0, 0, 0}, 0));
0082   }
0083 }