CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
StubKiller Class Reference

#include <StubKiller.h>

Public Member Functions

std::map< DetId, float > getListOfDeadModules ()
 
void initialise (unsigned int killScenario, const TrackerTopology *trackerTopology, const TrackerGeometry *trackerGeometry)
 
bool killStub (const TTStub< Ref_Phase2TrackerDigi_ > *stub, const std::vector< int > layersToKill, const double minPhiToKill, const double maxPhiToKill, const double minZToKill, const double maxZToKill, const double minRToKill, const double maxRToKill, const double fractionOfStubsToKillInLayers, const double fractionOfStubsToKillEverywhere)
 
bool killStub (const TTStub< Ref_Phase2TrackerDigi_ > *stub)
 
bool killStubInDeadModule (const TTStub< Ref_Phase2TrackerDigi_ > *stub)
 
 StubKiller ()
 
 ~StubKiller ()
 

Private Member Functions

void addDeadLayerModulesToDeadModuleList ()
 
void chooseModulesToKill ()
 

Private Attributes

std::map< DetId, float > deadModules_
 
double fractionOfModulesToKillEverywhere_
 
double fractionOfStubsToKillEverywhere_
 
double fractionOfStubsToKillInLayers_
 
unsigned int killScenario_
 
std::vector< int > layersToKill_
 
double maxPhiToKill_
 
double maxRToKill_
 
double maxZToKill_
 
double minPhiToKill_
 
double minRToKill_
 
double minZToKill_
 
const TrackerGeometrytrackerGeometry_
 
const TrackerTopologytrackerTopology_
 

Detailed Description

Definition at line 12 of file StubKiller.h.

Constructor & Destructor Documentation

◆ StubKiller()

StubKiller::StubKiller ( )

Definition at line 5 of file StubKiller.cc.

6  : killScenario_(0),
7  trackerTopology_(nullptr),
8  trackerGeometry_(nullptr),
9  layersToKill_(vector<int>()),
10  minPhiToKill_(0),
11  maxPhiToKill_(0),
12  minZToKill_(0),
13  maxZToKill_(0),
14  minRToKill_(0),
15  maxRToKill_(0),
std::vector< int > layersToKill_
Definition: StubKiller.h:46
double minPhiToKill_
Definition: StubKiller.h:47
double fractionOfStubsToKillInLayers_
Definition: StubKiller.h:53
double minRToKill_
Definition: StubKiller.h:51
const TrackerGeometry * trackerGeometry_
Definition: StubKiller.h:44
double minZToKill_
Definition: StubKiller.h:49
unsigned int killScenario_
Definition: StubKiller.h:42
double maxRToKill_
Definition: StubKiller.h:52
double fractionOfStubsToKillEverywhere_
Definition: StubKiller.h:54
double maxPhiToKill_
Definition: StubKiller.h:48
double maxZToKill_
Definition: StubKiller.h:50
double fractionOfModulesToKillEverywhere_
Definition: StubKiller.h:55
const TrackerTopology * trackerTopology_
Definition: StubKiller.h:43

◆ ~StubKiller()

StubKiller::~StubKiller ( )
inline

Definition at line 15 of file StubKiller.h.

15 {}

Member Function Documentation

◆ addDeadLayerModulesToDeadModuleList()

void StubKiller::addDeadLayerModulesToDeadModuleList ( )
private

Definition at line 157 of file StubKiller.cc.

References deadModules_, TrackerGeometry::detUnits(), spr::find(), fractionOfStubsToKillInLayers_, TrackerTopology::layer(), layersToKill_, maxRToKill_, maxZToKill_, minPhiToKill_, minRToKill_, minZToKill_, Pi, TrackerTopology::side(), DetId::subdetId(), StripSubdetector::TIB, TrackerTopology::tidWheel(), StripSubdetector::TOB, trackerGeometry_, and trackerTopology_.

Referenced by initialise().

157  {
158  for (const GeomDetUnit* gd : trackerGeometry_->detUnits()) {
159  float moduleR = gd->position().perp();
160  float moduleZ = gd->position().z();
161  float modulePhi = gd->position().phi();
162  DetId geoDetId = gd->geographicalId();
163  bool isInBarrel = geoDetId.subdetId() == StripSubdetector::TOB || geoDetId.subdetId() == StripSubdetector::TIB;
164 
165  int layerID = 0;
166  if (isInBarrel) {
167  layerID = trackerTopology_->layer(geoDetId);
168  } else {
169  layerID = 10 * trackerTopology_->side(geoDetId) + trackerTopology_->tidWheel(geoDetId);
170  }
171 
172  if (find(layersToKill_.begin(), layersToKill_.end(), layerID) != layersToKill_.end()) {
173  if (modulePhi < -1.0 * TMath::Pi())
174  modulePhi += 2.0 * TMath::Pi();
175  else if (modulePhi > TMath::Pi())
176  modulePhi -= 2.0 * TMath::Pi();
177 
178  if (modulePhi > minPhiToKill_ && modulePhi < maxPhiToKill_ && moduleZ > minZToKill_ && moduleZ < maxZToKill_ &&
179  moduleR > minRToKill_ && moduleR < maxRToKill_) {
180  if (deadModules_.find(gd->geographicalId()) == deadModules_.end()) {
181  deadModules_[gd->geographicalId()] = fractionOfStubsToKillInLayers_;
182  }
183  }
184  }
185  }
186 }
const double Pi
std::vector< int > layersToKill_
Definition: StubKiller.h:46
std::map< DetId, float > deadModules_
Definition: StubKiller.h:57
unsigned int tidWheel(const DetId &id) const
double minPhiToKill_
Definition: StubKiller.h:47
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
unsigned int side(const DetId &id) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
double fractionOfStubsToKillInLayers_
Definition: StubKiller.h:53
unsigned int layer(const DetId &id) const
double minRToKill_
Definition: StubKiller.h:51
const TrackerGeometry * trackerGeometry_
Definition: StubKiller.h:44
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static constexpr auto TOB
double minZToKill_
Definition: StubKiller.h:49
Definition: DetId.h:17
static constexpr auto TIB
double maxRToKill_
Definition: StubKiller.h:52
double maxZToKill_
Definition: StubKiller.h:50
const TrackerTopology * trackerTopology_
Definition: StubKiller.h:43

◆ chooseModulesToKill()

void StubKiller::chooseModulesToKill ( )
private

Definition at line 144 of file StubKiller.cc.

References deadModules_, TrackerGeometry::detUnits(), fractionOfModulesToKillEverywhere_, TrackerTopology::isLower(), trackerGeometry_, and trackerTopology_.

Referenced by initialise().

144  {
145  TRandom3* randomGenerator = new TRandom3();
146  randomGenerator->SetSeed(0);
147 
148  for (const GeomDetUnit* gd : trackerGeometry_->detUnits()) {
149  if (!trackerTopology_->isLower(gd->geographicalId()))
150  continue;
151  if (randomGenerator->Uniform(0.0, 1.0) < fractionOfModulesToKillEverywhere_) {
152  deadModules_[gd->geographicalId()] = 1;
153  }
154  }
155 }
std::map< DetId, float > deadModules_
Definition: StubKiller.h:57
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
const TrackerGeometry * trackerGeometry_
Definition: StubKiller.h:44
bool isLower(const DetId &id) const
double fractionOfModulesToKillEverywhere_
Definition: StubKiller.h:55
const TrackerTopology * trackerTopology_
Definition: StubKiller.h:43

◆ getListOfDeadModules()

std::map<DetId, float> StubKiller::getListOfDeadModules ( )
inline

Definition at line 36 of file StubKiller.h.

References deadModules_.

36 { return deadModules_; }
std::map< DetId, float > deadModules_
Definition: StubKiller.h:57

◆ initialise()

void StubKiller::initialise ( unsigned int  killScenario,
const TrackerTopology trackerTopology,
const TrackerGeometry trackerGeometry 
)

Definition at line 20 of file StubKiller.cc.

References addDeadLayerModulesToDeadModuleList(), chooseModulesToKill(), deadModules_, fractionOfModulesToKillEverywhere_, fractionOfStubsToKillEverywhere_, fractionOfStubsToKillInLayers_, killScenario_, layersToKill_, maxPhiToKill_, maxRToKill_, maxZToKill_, minPhiToKill_, minRToKill_, minZToKill_, trackerGeometry_, and trackerTopology_.

Referenced by L1FPGATrackProducer::produce().

22  {
23  killScenario_ = killScenario;
24  trackerTopology_ = trackerTopology;
25  trackerGeometry_ = trackerGeometry;
26 
27  switch (killScenario_) {
28  // kill layer 5 in one quadrant + 5% random module loss to connect to what was done before
29  case 1:
30  layersToKill_ = {5};
31  minPhiToKill_ = 0.0;
32  maxPhiToKill_ = TMath::PiOver2();
33  minZToKill_ = -1000.0;
34  maxZToKill_ = 0.0;
35  minRToKill_ = 0.0;
36  maxRToKill_ = 1000.0;
40  break;
41 
42  // kill layer 1 in one quadrant + 5% random module loss
43  case 2:
44  layersToKill_ = {1};
45  minPhiToKill_ = 0.0;
46  maxPhiToKill_ = TMath::PiOver2();
47  minZToKill_ = -1000.0;
48  maxZToKill_ = 0.0;
49  minRToKill_ = 0.0;
50  maxRToKill_ = 1000.0;
54  break;
55 
56  // kill layer 1 + layer 2, both in same quadrant
57  case 3:
58  layersToKill_ = {1, 2};
59  minPhiToKill_ = 0.0;
60  maxPhiToKill_ = TMath::PiOver2();
61  minZToKill_ = -1000.0;
62  maxZToKill_ = 0.0;
63  minRToKill_ = 0.0;
64  maxRToKill_ = 1000.0;
68  break;
69 
70  // kill layer 1 and disk 1, both in same quadrant
71  case 4:
72  layersToKill_ = {1, 11};
73  minPhiToKill_ = 0.0;
74  maxPhiToKill_ = TMath::PiOver2();
75  minZToKill_ = -1000.0;
76  maxZToKill_ = 0.0;
77  minRToKill_ = 0.0;
78  maxRToKill_ = 66.5;
82  break;
83 
84  // 5% random module loss throughout tracker
85  case 5:
86  layersToKill_ = {};
90  break;
91 
92  // 1% random module loss throughout tracker
93  case 6:
94  layersToKill_ = {};
98  break;
99 
100  // kill layer 5 in one quadrant + 1% random module loss
101  case 7:
102  layersToKill_ = {5};
103  minPhiToKill_ = 0.0;
104  maxPhiToKill_ = TMath::PiOver2();
105  minZToKill_ = -1000.0;
106  maxZToKill_ = 0.0;
107  minRToKill_ = 0.0;
108  maxRToKill_ = 1000.0;
112  break;
113 
114  // kill layer 1 in one quadrant +1 % random module loss
115  case 8:
116  layersToKill_ = {1};
117  minPhiToKill_ = 0.0;
118  maxPhiToKill_ = TMath::PiOver2();
119  minZToKill_ = -1000.0;
120  maxZToKill_ = 0.0;
121  minRToKill_ = 0.0;
122  maxRToKill_ = 1000.0;
126  break;
127 
128  // 10% random module loss throughout tracker
129  case 9:
130  layersToKill_ = {};
134  break;
135  }
136 
137  deadModules_.clear();
139  this->chooseModulesToKill();
140  }
142 }
std::vector< int > layersToKill_
Definition: StubKiller.h:46
std::map< DetId, float > deadModules_
Definition: StubKiller.h:57
double minPhiToKill_
Definition: StubKiller.h:47
double fractionOfStubsToKillInLayers_
Definition: StubKiller.h:53
double minRToKill_
Definition: StubKiller.h:51
const TrackerGeometry * trackerGeometry_
Definition: StubKiller.h:44
double minZToKill_
Definition: StubKiller.h:49
unsigned int killScenario_
Definition: StubKiller.h:42
double maxRToKill_
Definition: StubKiller.h:52
void chooseModulesToKill()
Definition: StubKiller.cc:144
double fractionOfStubsToKillEverywhere_
Definition: StubKiller.h:54
void addDeadLayerModulesToDeadModuleList()
Definition: StubKiller.cc:157
double maxPhiToKill_
Definition: StubKiller.h:48
double maxZToKill_
Definition: StubKiller.h:50
double fractionOfModulesToKillEverywhere_
Definition: StubKiller.h:55
const TrackerTopology * trackerTopology_
Definition: StubKiller.h:43

◆ killStub() [1/2]

bool StubKiller::killStub ( const TTStub< Ref_Phase2TrackerDigi_ > *  stub,
const std::vector< int >  layersToKill,
const double  minPhiToKill,
const double  maxPhiToKill,
const double  minZToKill,
const double  maxZToKill,
const double  minRToKill,
const double  maxRToKill,
const double  fractionOfStubsToKillInLayers,
const double  fractionOfStubsToKillEverywhere 
)

Definition at line 212 of file StubKiller.cc.

References TTStub< T >::clusterRef(), spr::find(), TTStub< T >::getDetId(), TrackerGeometry::idToDetUnit(), TrackerTopology::layer(), Topology::localPosition(), Pi, DetId::rawId(), TrackerTopology::side(), PixelGeomDetUnit::specificTopology(), DetId::subdetId(), GeomDet::surface(), StripSubdetector::TIB, TrackerTopology::tidWheel(), StripSubdetector::TOB, Surface::toGlobal(), trackerGeometry_, and trackerTopology_.

Referenced by killStub(), and L1FPGATrackProducer::produce().

221  {
222  // Only kill stubs in specified layers
223  if (!layersToKill.empty()) {
224  // Get the layer the stub is in, and check if it's in the layer you want to kill
225  DetId stackDetid = stub->getDetId();
226  DetId geoDetId(stackDetid.rawId() + 1);
227 
228  bool isInBarrel = geoDetId.subdetId() == StripSubdetector::TOB || geoDetId.subdetId() == StripSubdetector::TIB;
229 
230  int layerID = 0;
231  if (isInBarrel) {
232  layerID = trackerTopology_->layer(geoDetId);
233  } else {
234  layerID = 10 * trackerTopology_->side(geoDetId) + trackerTopology_->tidWheel(geoDetId);
235  }
236 
237  if (find(layersToKill.begin(), layersToKill.end(), layerID) != layersToKill.end()) {
238  // Get the phi and z of stub, and check if it's in the region you want to kill
239  const GeomDetUnit* det0 = trackerGeometry_->idToDetUnit(geoDetId);
240  const PixelGeomDetUnit* theGeomDet = dynamic_cast<const PixelGeomDetUnit*>(det0);
241  const PixelTopology* topol = dynamic_cast<const PixelTopology*>(&(theGeomDet->specificTopology()));
242  MeasurementPoint measurementPoint = stub->clusterRef(0)->findAverageLocalCoordinatesCentered();
243  LocalPoint clustlp = topol->localPosition(measurementPoint);
244  GlobalPoint pos = theGeomDet->surface().toGlobal(clustlp);
245 
246  // Just in case phi is outside of -pi -> pi
247  double stubPhi = pos.phi();
248  if (stubPhi < -1.0 * TMath::Pi())
249  stubPhi += 2.0 * TMath::Pi();
250  else if (stubPhi > TMath::Pi())
251  stubPhi -= 2.0 * TMath::Pi();
252 
253  if (stubPhi > minPhiToKill && stubPhi < maxPhiToKill && pos.z() > minZToKill && pos.z() < maxZToKill &&
254  pos.perp() > minRToKill && pos.perp() < maxRToKill) {
255  // Kill fraction of stubs
256  if (fractionOfStubsToKillInLayers == 1) {
257  return true;
258  } else {
259  static TRandom randomGenerator;
260  if (randomGenerator.Rndm() < fractionOfStubsToKillInLayers) {
261  return true;
262  }
263  }
264  }
265  }
266  }
267 
268  // Kill fraction of stubs throughout tracker
269  if (fractionOfStubsToKillEverywhere > 0) {
270  static TRandom randomGenerator;
271  if (randomGenerator.Rndm() < fractionOfStubsToKillEverywhere) {
272  return true;
273  }
274  }
275 
276  return false;
277 }
const edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > & clusterRef(unsigned int hitStackMember) const
Clusters composing the Stub – see https://twiki.cern.ch/twiki/bin/viewauth/CMS/SLHCTrackerTriggerSWT...
Definition: TTStub.h:150
const double Pi
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
unsigned int tidWheel(const DetId &id) const
unsigned int side(const DetId &id) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
DetId getDetId() const
Detector element.
Definition: TTStub.h:44
unsigned int layer(const DetId &id) const
const TrackerGeometry * trackerGeometry_
Definition: StubKiller.h:44
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static constexpr auto TOB
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
Definition: DetId.h:17
static constexpr auto TIB
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
const TrackerTopology * trackerTopology_
Definition: StubKiller.h:43

◆ killStub() [2/2]

bool StubKiller::killStub ( const TTStub< Ref_Phase2TrackerDigi_ > *  stub)

Definition at line 188 of file StubKiller.cc.

References fractionOfStubsToKillEverywhere_, fractionOfStubsToKillInLayers_, killScenario_, killStub(), killStubInDeadModule(), layersToKill_, maxPhiToKill_, maxRToKill_, maxZToKill_, minPhiToKill_, minRToKill_, and minZToKill_.

188  {
189  if (killScenario_ == 0)
190  return false;
191  else {
192  bool killStubRandomly = killStub(stub,
196  minZToKill_,
197  maxZToKill_,
198  minRToKill_,
199  maxRToKill_,
202  bool killStubInDeadModules = killStubInDeadModule(stub);
203  return killStubRandomly || killStubInDeadModules;
204  }
205 }
std::vector< int > layersToKill_
Definition: StubKiller.h:46
bool killStubInDeadModule(const TTStub< Ref_Phase2TrackerDigi_ > *stub)
Definition: StubKiller.cc:279
double minPhiToKill_
Definition: StubKiller.h:47
double fractionOfStubsToKillInLayers_
Definition: StubKiller.h:53
double minRToKill_
Definition: StubKiller.h:51
bool killStub(const TTStub< Ref_Phase2TrackerDigi_ > *stub, const std::vector< int > layersToKill, const double minPhiToKill, const double maxPhiToKill, const double minZToKill, const double maxZToKill, const double minRToKill, const double maxRToKill, const double fractionOfStubsToKillInLayers, const double fractionOfStubsToKillEverywhere)
Definition: StubKiller.cc:212
double minZToKill_
Definition: StubKiller.h:49
unsigned int killScenario_
Definition: StubKiller.h:42
double maxRToKill_
Definition: StubKiller.h:52
double fractionOfStubsToKillEverywhere_
Definition: StubKiller.h:54
double maxPhiToKill_
Definition: StubKiller.h:48
double maxZToKill_
Definition: StubKiller.h:50

◆ killStubInDeadModule()

bool StubKiller::killStubInDeadModule ( const TTStub< Ref_Phase2TrackerDigi_ > *  stub)

Definition at line 279 of file StubKiller.cc.

References deadModules_, TTStub< T >::getDetId(), and DetId::rawId().

Referenced by killStub().

279  {
280  if (!deadModules_.empty()) {
281  DetId stackDetid = stub->getDetId();
282  DetId geoDetId(stackDetid.rawId() + 1);
283  if (deadModules_.find(geoDetId) != deadModules_.end())
284  return true;
285  }
286 
287  return false;
288 }
std::map< DetId, float > deadModules_
Definition: StubKiller.h:57
DetId getDetId() const
Detector element.
Definition: TTStub.h:44
Definition: DetId.h:17
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57

Member Data Documentation

◆ deadModules_

std::map<DetId, float> StubKiller::deadModules_
private

◆ fractionOfModulesToKillEverywhere_

double StubKiller::fractionOfModulesToKillEverywhere_
private

Definition at line 55 of file StubKiller.h.

Referenced by chooseModulesToKill(), and initialise().

◆ fractionOfStubsToKillEverywhere_

double StubKiller::fractionOfStubsToKillEverywhere_
private

Definition at line 54 of file StubKiller.h.

Referenced by initialise(), and killStub().

◆ fractionOfStubsToKillInLayers_

double StubKiller::fractionOfStubsToKillInLayers_
private

Definition at line 53 of file StubKiller.h.

Referenced by addDeadLayerModulesToDeadModuleList(), initialise(), and killStub().

◆ killScenario_

unsigned int StubKiller::killScenario_
private

Definition at line 42 of file StubKiller.h.

Referenced by initialise(), and killStub().

◆ layersToKill_

std::vector<int> StubKiller::layersToKill_
private

Definition at line 46 of file StubKiller.h.

Referenced by addDeadLayerModulesToDeadModuleList(), initialise(), and killStub().

◆ maxPhiToKill_

double StubKiller::maxPhiToKill_
private

Definition at line 48 of file StubKiller.h.

Referenced by initialise(), and killStub().

◆ maxRToKill_

double StubKiller::maxRToKill_
private

Definition at line 52 of file StubKiller.h.

Referenced by addDeadLayerModulesToDeadModuleList(), initialise(), and killStub().

◆ maxZToKill_

double StubKiller::maxZToKill_
private

Definition at line 50 of file StubKiller.h.

Referenced by addDeadLayerModulesToDeadModuleList(), initialise(), and killStub().

◆ minPhiToKill_

double StubKiller::minPhiToKill_
private

Definition at line 47 of file StubKiller.h.

Referenced by addDeadLayerModulesToDeadModuleList(), initialise(), and killStub().

◆ minRToKill_

double StubKiller::minRToKill_
private

Definition at line 51 of file StubKiller.h.

Referenced by addDeadLayerModulesToDeadModuleList(), initialise(), and killStub().

◆ minZToKill_

double StubKiller::minZToKill_
private

Definition at line 49 of file StubKiller.h.

Referenced by addDeadLayerModulesToDeadModuleList(), initialise(), and killStub().

◆ trackerGeometry_

const TrackerGeometry* StubKiller::trackerGeometry_
private

◆ trackerTopology_

const TrackerTopology* StubKiller::trackerTopology_
private