Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-10 02:21:17

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