Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:49

0001 #ifndef L1Trigger_TrackFindingTMTT_StubKiller_h
0002 #define L1Trigger_TrackFindingTMTT_StubKiller_h
0003 
0004 // Kill some stubs to emulate dead tracker modules.
0005 // Author: Emyr Clement (2018)
0006 // Tidy up: Ian Tomalin (2020)
0007 
0008 #include "FWCore/Framework/interface/Event.h"
0009 #include "DataFormats/L1TrackTrigger/interface/TTTypes.h"
0010 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0011 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0012 #include "Geometry/CommonTopologies/interface/PixelGeomDetUnit.h"
0013 #include "Geometry/CommonTopologies/interface/PixelTopology.h"
0014 #include "FWCore/ServiceRegistry/interface/Service.h"
0015 #include "FWCore/Utilities/interface/RandomNumberGenerator.h"
0016 #include "CLHEP/Random/RandomEngine.h"
0017 
0018 namespace tmtt {
0019 
0020   class StubKiller {
0021   public:
0022     enum class KillOptions { none = 0, layer5 = 1, layer1 = 2, layer1layer2 = 3, layer1disk1 = 4, random = 5 };
0023 
0024     StubKiller(KillOptions killScenario,
0025                const TrackerTopology* trackerTopology,
0026                const TrackerGeometry* trackerGeometry,
0027                const edm::Event& iEvent);
0028 
0029     // Indicate if given stub was killed by dead tracker module, based on dead module scenario.
0030     bool killStub(const TTStub<Ref_Phase2TrackerDigi_>* stub) const;
0031 
0032     // Indicate if given stub was killed by dead tracker module, based on dead regions specified here,
0033     // and ignoring dead module scenario.
0034     bool killStub(const TTStub<Ref_Phase2TrackerDigi_>* stub,
0035                   const std::vector<int>& layersToKill,
0036                   const double minPhiToKill,
0037                   const double maxPhiToKill,
0038                   const double minZToKill,
0039                   const double maxZToKill,
0040                   const double minRToKill,
0041                   const double maxRToKill,
0042                   const double fractionOfStubsToKillInLayers,
0043                   const double fractionOfStubsToKillEverywhere) const;
0044 
0045     // Indicate if given stub was in (partially) dead tracker module, based on dead module scenario.
0046     bool killStubInDeadModule(const TTStub<Ref_Phase2TrackerDigi_>* stub) const;
0047 
0048     // List of all modules declared as (partially) dead, with fractional deadness of each.
0049     const std::map<DetId, float>& listOfDeadModules() const { return deadModules_; }
0050 
0051   private:
0052     // Identify modules to be killed, chosen randomly from those in the whole tracker.
0053     void chooseModulesToKill();
0054     //  Identify modules to be killed, chosen based on location in tracker.
0055     void addDeadLayerModulesToDeadModuleList();
0056 
0057     KillOptions killScenario_;
0058     const TrackerTopology* trackerTopology_;
0059     const TrackerGeometry* trackerGeometry_;
0060 
0061     std::vector<int> layersToKill_;
0062     double minPhiToKill_;
0063     double maxPhiToKill_;
0064     double minZToKill_;
0065     double maxZToKill_;
0066     double minRToKill_;
0067     double maxRToKill_;
0068     double fractionOfStubsToKillInLayers_;
0069     double fractionOfStubsToKillEverywhere_;
0070     double fractionOfModulesToKillEverywhere_;
0071 
0072     std::map<DetId, float> deadModules_;
0073 
0074     edm::Service<edm::RandomNumberGenerator> rndmService_;
0075     CLHEP::HepRandomEngine* rndmEngine_;
0076   };
0077 
0078 };  // namespace tmtt
0079 
0080 #endif