CMS 3D CMS Logo

MTDGeomBuilderFromGeometricTimingDet.cc
Go to the documentation of this file.
13 
14 #include <cfloat>
15 #include <cassert>
16 using std::string;
17 using std::vector;
18 
19 namespace {
20  void verifyDUinTG(MTDGeometry const& tg) {
21  int off = 0;
22  int end = 0;
23  for (int i = 1; i != 2; i++) {
24  auto det = i - 1;
25  off = tg.offsetDU(det);
26  end = tg.endsetDU(det);
27  assert(end >= off); // allow empty subdetectors. Needed for upgrade
28  for (int j = off; j != end; ++j) {
29  assert(tg.detUnits()[j]->geographicalId().subdetId() == i);
30  assert(tg.detUnits()[j]->index() == j);
31  }
32  }
33  }
34 } // namespace
35 
37  const PMTDParameters& ptp,
38  const MTDTopology* tTopo) {
39  theMTDDetTypeMap.clear();
40 
41  MTDGeometry* tracker = new MTDGeometry(gd);
42  std::vector<const GeometricTimingDet*> comp;
43  gd->deepComponents(comp);
44 
45  if (tTopo)
46  theTopo = tTopo;
47 
48  //define a vector which associate to the detid subdetector index -1 (from 0 to 5) the GeometridDet enumerator to be able to know which type of subdetector it is
49 
50  std::vector<GeometricTimingDet::GTDEnumType> gdsubdetmap(
51  2, GeometricTimingDet::unknown); // hardcoded "2" should not be a surprise...
53 
54  LogDebug("SubDetectorGeometricTimingDetType") << "MTD GeometricTimingDet enumerator values of the subdetectors";
55  for (unsigned int i = 0; i < subdetgd.size(); ++i) {
56  MTDDetId mtdid(subdetgd[i]->geographicalId());
57  assert(mtdid.mtdSubDetector() > 0 && mtdid.mtdSubDetector() < 3);
58  gdsubdetmap[mtdid.mtdSubDetector() - 1] = subdetgd[i]->type();
59  LogTrace("SubDetectorGeometricTimingDetType") << "MTD subdet " << i << " type " << subdetgd[i]->type() << " detid "
60  << std::hex << subdetgd[i]->geographicalId().rawId() << std::dec
61  << " subdetid " << subdetgd[i]->geographicalId().subdetId();
62  }
63 
64  std::vector<const GeometricTimingDet*> dets[2];
65  std::vector<const GeometricTimingDet*>& btl = dets[0];
66  btl.reserve(comp.size());
67  std::vector<const GeometricTimingDet*>& etl = dets[1];
68  etl.reserve(comp.size());
69 
70  for (auto& i : comp) {
71  MTDDetId mtdid(i->geographicalId());
72  dets[mtdid.mtdSubDetector() - 1].emplace_back(i);
73  }
74 
75  //loop on all the six elements of dets and firstly check if they are from pixel-like detector and call buildPixel, then loop again and check if they are strip and call buildSilicon. "unknown" can be filled either way but the vector of GeometricTimingDet must be empty !!
76  // this order is VERY IMPORTANT!!!!! For the moment I (AndreaV) understand that some pieces of code rely on pixel-like being before strip-like
77 
78  // now building the Pixel-like subdetectors
79  for (unsigned int i = 0; i < 2; ++i) {
80  if (gdsubdetmap[i] == GeometricTimingDet::BTL)
82  if (gdsubdetmap[i] == GeometricTimingDet::ETL)
84  }
85 
86  buildGeomDet(tracker); //"GeomDet"
87 
88  verifyDUinTG(*tracker);
89 
90  return tracker;
91 }
92 
94  std::vector<const GeometricTimingDet*> const& gdv,
97  const PMTDParameters& ptp) // in y direction, cols. BIG_PIX_PER_ROC_Y = 0 for SLHC
98 {
99  LogDebug("BuildingGeomDetUnits") << " MTD Pixel type. Size of vector: " << gdv.size()
100  << " GeomDetType subdetector: " << det
101  << " logical subdetector: " << GeomDetEnumerators::subDetGeom[det]
102  << " big pix per ROC x: " << 0 << " y: " << 0 << " is upgrade: " << true;
103 
104  // this is a hack while we put things into the DDD
105  int ROCrows(0), ROCcols(0), ROCSx(0), ROCSy(0);
106  int GAPxInterpad(0), GAPxBorder(0), GAPyInterpad(0), GAPyBorder(0);
107  switch (det) {
109  GAPxInterpad = ptp.vitems_[0].vpars_[4]; // Value given in microns
110  GAPxBorder = ptp.vitems_[0].vpars_[5]; // Value given in microns
111  GAPyInterpad = ptp.vitems_[0].vpars_[6]; // Value given in microns
112  GAPyBorder = ptp.vitems_[0].vpars_[7]; // Value given in microns
113  ROCrows = ptp.vitems_[0].vpars_[8];
114  ROCcols = ptp.vitems_[0].vpars_[9];
115  ROCSx = ptp.vitems_[0].vpars_[10];
116  ROCSy = ptp.vitems_[0].vpars_[11];
117  break;
119  GAPxInterpad = ptp.vitems_[1].vpars_[4];
120  GAPxBorder = ptp.vitems_[1].vpars_[5];
121  GAPyInterpad = ptp.vitems_[1].vpars_[6];
122  GAPyBorder = ptp.vitems_[1].vpars_[7];
123  ROCrows = ptp.vitems_[1].vpars_[8];
124  ROCcols = ptp.vitems_[1].vpars_[9];
125  ROCSx = ptp.vitems_[1].vpars_[10];
126  ROCSy = ptp.vitems_[1].vpars_[11];
127  break;
128  break;
129  default:
130  throw cms::Exception("UnknownDet") << "MTDGeomBuilderFromGeometricTimingDet got a weird detector: " << det;
131  }
132 
133  switch (det) {
135  tracker->setOffsetDU(0);
136  break;
138  tracker->setOffsetDU(1);
139  break;
140  default:
141  throw cms::Exception("MTDGeomBuilderFromGeometricTimingDet") << det << " is not a timing detector!";
142  }
143 
144  for (auto i : gdv) {
145  std::string const& detName = i->name();
146  if (theMTDDetTypeMap.find(detName) == theMTDDetTypeMap.end()) {
147  std::unique_ptr<const Bounds> bounds(i->bounds());
148 
150  &*bounds, ROCrows, ROCcols, ROCSx, ROCSy, GAPxInterpad, GAPxBorder, GAPyInterpad, GAPyBorder);
151 
152  theMTDDetTypeMap[detName] = new MTDGeomDetType(t, detName, det);
153  tracker->addType(theMTDDetTypeMap[detName]);
154  }
155 
157  GeomDetUnit* temp = new MTDGeomDetUnit(&(*plane), theMTDDetTypeMap[detName], i->geographicalID());
158 
159  tracker->addDetUnit(temp);
160  tracker->addDetUnitId(i->geographicalID());
161  }
162  switch (det) {
164  tracker->setEndsetDU(0);
165  break;
167  tracker->setEndsetDU(1);
168  break;
169  default:
170  throw cms::Exception("MTDGeomBuilderFromGeometricTimingDet") << det << " is not a timing detector!";
171  }
172 }
173 
175  auto const& gdu = tracker->detUnits();
176  auto const& gduId = tracker->detUnitIds();
177 
178  for (u_int32_t i = 0; i < gdu.size(); i++) {
179  tracker->addDet(gdu[i]);
180  tracker->addDetId(gduId[i]);
181  string gduTypeName = gdu[i]->type().name();
182  }
183 }
184 
186  const GeometricTimingDet* gd, double scale) const {
188  PlaneBuilderFromGeometricTimingDet::ResultType plane = planeBuilder.plane(gd);
189  //
190  // set medium properties (if defined)
191  //
192  plane->setMediumProperties(MediumProperties(gd->radLength() * scale, gd->xi() * scale));
193 
194  return plane;
195 }
PMTDParameters
Definition: PMTDParameters.h:6
GeomDetEnumerators::SubDetector
SubDetector
Definition: GeomDetEnumerators.h:10
MTDGeomBuilderFromGeometricTimingDet::theMTDDetTypeMap
std::map< std::string, const MTDGeomDetType * > theMTDDetTypeMap
Definition: MTDGeomBuilderFromGeometricTimingDet.h:30
AlCaHLTBitMon_QueryRunRegistry.comp
string comp
Definition: AlCaHLTBitMon_QueryRunRegistry.py:249
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
MTDGeomBuilderFromGeometricTimingDet.h
GeomDet
Definition: GeomDet.h:27
L1EGammaCrystalsEmulatorProducer_cfi.scale
scale
Definition: L1EGammaCrystalsEmulatorProducer_cfi.py:10
PMTDParameters::vitems_
std::vector< Item > vitems_
Definition: PMTDParameters.h:18
MTDPixelTopologyBuilder::build
PixelTopology * build(const Bounds *bounds, int ROWS_PER_ROC, int COLS_PER_ROC, int ROCS_X, int ROCS_Y, int GAPxInterpad, int GAPxBorder, int GAPyInterpad, int GAPyBorder)
Definition: MTDPixelTopologyBuilder.cc:12
MTDGeometry.h
MTDGeomDetUnit.h
MTDGeomBuilderFromGeometricTimingDet::buildPlaneWithMaterial
PlaneBuilderFromGeometricTimingDet::ResultType buildPlaneWithMaterial(const GeometricTimingDet *gd, double scaleFactor=1.) const
Definition: MTDGeomBuilderFromGeometricTimingDet.cc:185
cms::cuda::assert
assert(be >=bs)
GeometricTimingDet::ConstGeometricTimingDetContainer
std::vector< GeometricTimingDet const * > ConstGeometricTimingDetContainer
Definition: GeometricTimingDet.h:32
ReferenceCountingPointer
Definition: ReferenceCounted.h:60
PlaneBuilderFromGeometricTimingDet
Definition: PlaneBuilderFromGeometricTimingDet.h:11
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
MTDGeomBuilderFromGeometricTimingDet::theTopo
const MTDTopology * theTopo
Definition: MTDGeomBuilderFromGeometricTimingDet.h:31
MTDGeomDetType
Definition: MTDGeomDetType.h:11
mps_fire.end
end
Definition: mps_fire.py:242
MTDGeometry::detUnits
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
Definition: MTDGeometry.h:27
GeomDetEnumerators::TimingBarrel
Definition: GeomDetEnumerators.h:29
MTDGeomBuilderFromGeometricTimingDet::buildGeomDet
void buildGeomDet(MTDGeometry *)
Definition: MTDGeomBuilderFromGeometricTimingDet.cc:174
MTDPixelTopologyBuilder
Definition: MTDPixelTopologyBuilder.h:12
MediumProperties.h
GeometricTimingDet::radLength
double radLength() const
Definition: GeometricTimingDet.h:151
PixelTopology
Definition: PixelTopology.h:10
MTDGeomBuilderFromGeometricTimingDet::buildPixel
void buildPixel(std::vector< const GeometricTimingDet * > const &, MTDGeometry *, GeomDetType::SubDetector det, const PMTDParameters &ptp)
Definition: MTDGeomBuilderFromGeometricTimingDet.cc:93
MTDDetId::mtdSubDetector
int mtdSubDetector() const
Definition: MTDDetId.h:56
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
MTDTopology
Definition: MTDTopology.h:13
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
MTDGeomBuilderFromGeometricTimingDet::build
MTDGeometry * build(const GeometricTimingDet *gd, const PMTDParameters &ptp, const MTDTopology *tTopo)
Definition: MTDGeomBuilderFromGeometricTimingDet.cc:36
MTDGeometry::endsetDU
unsigned int endsetDU(unsigned sid) const
Definition: MTDGeometry.h:39
GeometricTimingDet::components
ConstGeometricTimingDetContainer & components()
Definition: GeometricTimingDet.h:120
GeometricTimingDet
Definition: GeometricTimingDet.h:29
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
MTDGeomDetType.h
PlaneBuilderFromGeometricTimingDet::plane
ResultType plane(const GeometricTimingDet *gd) const
Definition: PlaneBuilderFromGeometricTimingDet.cc:23
GeomDetEnumerators::TimingEndcap
Definition: GeomDetEnumerators.h:30
MTDGeomDetUnit
Definition: MTDGeomDetUnit.h:15
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MTDGeometry
Definition: MTDGeometry.h:14
GeomDet.h
MediumProperties
Definition: MediumProperties.h:12
GeomDetEnumerators::subDetGeom
constexpr SubDetector subDetGeom[21]
Definition: GeomDetEnumerators.h:40
DetId.h
MTDDetId
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
Exception
Definition: hltDiff.cc:245
MTDGeometry::offsetDU
unsigned int offsetDU(unsigned sid) const
Definition: MTDGeometry.h:38
PMTDParameters.h
MTDPixelTopologyBuilder.h
Exception.h
GeometricTimingDet::deepComponents
ConstGeometricTimingDetContainer deepComponents() const
Definition: GeometricTimingDet.cc:191
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
GeometricTimingDet::xi
double xi() const
Definition: GeometricTimingDet.h:152
MTDTopology.h
susybsm::HSCParticleType::unknown
Definition: HSCParticle.h:20