CMS 3D CMS Logo

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

#include <TrackerGeomBuilderFromGeometricDet.h>

Public Member Functions

TrackerGeometrybuild (const GeometricDet *gd, const PTrackerAdditionalParametersPerDet *ptitp, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
 

Private Member Functions

void buildGeomDet (TrackerGeometry *)
 
void buildPixel (std::vector< const GeometricDet *> const &, const PTrackerAdditionalParametersPerDet *const &, TrackerGeometry *, GeomDetType::SubDetector det, bool upgradeGeometry, int BIG_PIX_PER_ROC_X, int BIG_PIX_PER_ROC_Y)
 
PlaneBuilderFromGeometricDet::ResultType buildPlaneWithMaterial (const GeometricDet *gd, double scaleFactor=1.) const
 
void buildSilicon (std::vector< const GeometricDet *> const &, TrackerGeometry *, GeomDetType::SubDetector det, const std::string &part)
 

Private Attributes

std::map< std::string, const PixelGeomDetType * > thePixelDetTypeMap
 
std::map< std::string, const StripGeomDetType * > theStripDetTypeMap
 
const TrackerTopologytheTopo
 

Detailed Description

Definition at line 18 of file TrackerGeomBuilderFromGeometricDet.h.

Member Function Documentation

◆ build()

TrackerGeometry * TrackerGeomBuilderFromGeometricDet::build ( const GeometricDet gd,
const PTrackerAdditionalParametersPerDet ptitp,
const PTrackerParameters ptp,
const TrackerTopology tTopo 
)

Definition at line 44 of file TrackerGeomBuilderFromGeometricDet.cc.

References cms::cuda::assert(), buildGeomDet(), buildPixel(), buildSilicon(), AlCaHLTBitMon_QueryRunRegistry::comp, GeometricDet::components(), GeometricDet::deepComponents(), relativeConstraints::empty, Exception, mps_fire::i, LogDebug, LogTrace, GeometricDet::OTPhase2Barrel, GeometricDet::OTPhase2EndCap, GeomDetEnumerators::P1PXB, GeomDetEnumerators::P1PXEC, GeomDetEnumerators::P2OTB, GeomDetEnumerators::P2OTEC, GeomDetEnumerators::P2PXB, GeomDetEnumerators::P2PXEC, GeomDetEnumerators::PixelBarrel, GeometricDet::PixelBarrel, GeomDetEnumerators::PixelEndcap, GeometricDet::PixelEndCap, GeometricDet::PixelPhase1Barrel, GeometricDet::PixelPhase1EndCap, GeometricDet::PixelPhase2Barrel, GeometricDet::PixelPhase2EndCap, SectorBuilder_Tec_cff::TEC, GeometricDet::TEC, thePixelDetTypeMap, theStripDetTypeMap, theTopo, SectorBuilder_Tib_cff::TIB, GeometricDet::TIB, SectorBuilder_Tid_cff::TID, GeometricDet::TID, GeomDetEnumerators::tkDetEnum, SectorBuilder_Tob_cff::TOB, GeometricDet::TOB, PbPb_ZMuSkimMuonDPG_cff::tracker, GeometricDet::unknown, and PTrackerParameters::vpars.

Referenced by SurveyInputTrackerFromDB::analyze(), SurveyMisalignmentInput::analyze(), CreateSurveyRcds::analyze(), TrackerSystematicMisalignments::analyze(), TrackerTreeGenerator::analyze(), AlignmentMonitorAsAnalyzer::analyze(), MCMisalignmentScaler::analyze(), TrackerGeometryIntoNtuples::analyze(), MillePedeDQMModule::beginRun(), AlignmentProducerBase::createGeometries(), TrackerGeometryCompare::createROOTGeometry(), TrackerDigiGeometryESModule::produce(), MisalignedTrackerESProducer::produce(), LaserAlignment::produce(), and CreateIdealTkAlRecords::retrieveGeometry().

47  {
48  if (ptp.vpars.size() != 6) {
49  throw cms::Exception("TrackerGeomBuilderFromGeometricDet")
50  << "Tracker parameters block from XMLs called vPars is expected to have 6 entries, but has " << ptp.vpars.size()
51  << " entrie(s).";
52  }
53 
54  const int BIG_PIX_PER_ROC_X = ptp.vpars[2];
55  const int BIG_PIX_PER_ROC_Y = ptp.vpars[3];
56 
57  thePixelDetTypeMap.clear();
58  theStripDetTypeMap.clear();
59 
61  std::vector<const GeometricDet*> comp;
62  gd->deepComponents(comp);
63 
64  if (tTopo)
65  theTopo = tTopo;
66 
67  //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
68 
69  std::vector<GeometricDet::GDEnumType> gdsubdetmap(
70  6, GeometricDet::unknown); // hardcoded "6" should not be a surprise...
72 
73  LogDebug("SubDetectorGeometricDetType") << "GeometriDet enumerator values of the subdetectors";
74  for (unsigned int i = 0; i < subdetgd.size(); ++i) {
75  assert(subdetgd[i]->geographicalId().subdetId() > 0 && subdetgd[i]->geographicalId().subdetId() < 7);
76  gdsubdetmap[subdetgd[i]->geographicalId().subdetId() - 1] = subdetgd[i]->type();
77  LogTrace("SubDetectorGeometricDetType")
78  << "subdet " << i << " type " << subdetgd[i]->type() << " detid " << subdetgd[i]->geographicalId().rawId()
79  << " subdetid " << subdetgd[i]->geographicalId().subdetId();
80  }
81 
82  std::vector<const GeometricDet*> dets[6];
83  std::vector<const GeometricDet*>& pixB = dets[0];
84  pixB.reserve(comp.size());
85  std::vector<const GeometricDet*>& pixF = dets[1];
86  pixF.reserve(comp.size());
87  std::vector<const GeometricDet*>& tib = dets[2];
88  tib.reserve(comp.size());
89  std::vector<const GeometricDet*>& tid = dets[3];
90  tid.reserve(comp.size());
91  std::vector<const GeometricDet*>& tob = dets[4];
92  tob.reserve(comp.size());
93  std::vector<const GeometricDet*>& tec = dets[5];
94  tec.reserve(comp.size());
95 
96  for (auto& i : comp)
97  dets[i->geographicalId().subdetId() - 1].emplace_back(i);
98 
99  //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 GeometricDet must be empty !!
100  // this order is VERY IMPORTANT!!!!! For the moment I (AndreaV) understand that some pieces of code rely on pixel-like being before strip-like
101 
102  // now building the Pixel-like subdetectors
103  for (unsigned int i = 0; i < 6; ++i) {
104  if (gdsubdetmap[i] == GeometricDet::PixelBarrel)
105  buildPixel(dets[i],
106  ptitpx,
107  tracker,
109  false,
110  BIG_PIX_PER_ROC_X,
111  BIG_PIX_PER_ROC_Y);
112  if (gdsubdetmap[i] == GeometricDet::PixelPhase1Barrel)
113  buildPixel(
114  dets[i], ptitpx, tracker, GeomDetEnumerators::SubDetector::P1PXB, false, BIG_PIX_PER_ROC_X, BIG_PIX_PER_ROC_Y);
115  // Phase2 case
116  if (gdsubdetmap[i] == GeometricDet::PixelPhase2Barrel)
117  buildPixel(
118  dets[i], ptitpx, tracker, GeomDetEnumerators::SubDetector::P2PXB, true, BIG_PIX_PER_ROC_X, BIG_PIX_PER_ROC_Y);
119  //
120  if (gdsubdetmap[i] == GeometricDet::PixelEndCap)
121  buildPixel(dets[i],
122  ptitpx,
123  tracker,
125  false,
126  BIG_PIX_PER_ROC_X,
127  BIG_PIX_PER_ROC_Y);
128  if (gdsubdetmap[i] == GeometricDet::PixelPhase1EndCap)
129  buildPixel(dets[i],
130  ptitpx,
131  tracker,
133  false,
134  BIG_PIX_PER_ROC_X,
135  BIG_PIX_PER_ROC_Y);
136  if (gdsubdetmap[i] == GeometricDet::PixelPhase2EndCap)
137  buildPixel(
138  dets[i], ptitpx, tracker, GeomDetEnumerators::SubDetector::P2PXEC, true, BIG_PIX_PER_ROC_X, BIG_PIX_PER_ROC_Y);
139  if (gdsubdetmap[i] == GeometricDet::OTPhase2Barrel)
140  buildPixel(
141  dets[i], ptitpx, tracker, GeomDetEnumerators::SubDetector::P2OTB, true, BIG_PIX_PER_ROC_X, BIG_PIX_PER_ROC_Y);
142  if (gdsubdetmap[i] == GeometricDet::OTPhase2EndCap)
143  buildPixel(
144  dets[i], ptitpx, tracker, GeomDetEnumerators::SubDetector::P2OTEC, true, BIG_PIX_PER_ROC_X, BIG_PIX_PER_ROC_Y);
145  }
146  //now building Strips
147  for (unsigned int i = 0; i < 6; ++i) {
148  if (gdsubdetmap[i] == GeometricDet::TIB)
150  if (gdsubdetmap[i] == GeometricDet::TID)
152  if (gdsubdetmap[i] == GeometricDet::TOB)
154  if (gdsubdetmap[i] == GeometricDet::TEC)
156  }
157  // and finally the "empty" subdetectors (maybe it is not needed)
158  for (unsigned int i = 0; i < 6; ++i) {
159  if (gdsubdetmap[i] == GeometricDet::unknown) {
160  if (!dets[i].empty())
161  throw cms::Exception("NotEmptyUnknownSubDet")
162  << "Subdetector " << i + 1 << " is unknown but it is not empty: " << dets[i].size();
163  buildSilicon(
164  dets[i], tracker, GeomDetEnumerators::tkDetEnum[i + 1], "barrel"); // "barrel" is used but it is irrelevant
165  }
166  }
167  buildGeomDet(tracker); //"GeomDet"
168 
169  verifyDUinTG(*tracker);
170 
171  return tracker;
172 }
std::vector< int > vpars
std::map< std::string, const PixelGeomDetType * > thePixelDetTypeMap
std::map< std::string, const StripGeomDetType * > theStripDetTypeMap
assert(be >=bs)
#define LogTrace(id)
void buildPixel(std::vector< const GeometricDet *> const &, const PTrackerAdditionalParametersPerDet *const &, TrackerGeometry *, GeomDetType::SubDetector det, bool upgradeGeometry, int BIG_PIX_PER_ROC_X, int BIG_PIX_PER_ROC_Y)
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:152
std::vector< GeometricDet const * > ConstGeometricDetContainer
Definition: GeometricDet.h:34
ConstGeometricDetContainer deepComponents() const
void buildSilicon(std::vector< const GeometricDet *> const &, TrackerGeometry *, GeomDetType::SubDetector det, const std::string &part)
constexpr SubDetector tkDetEnum[8]
#define LogDebug(id)

◆ buildGeomDet()

void TrackerGeomBuilderFromGeometricDet::buildGeomDet ( TrackerGeometry tracker)
private

Definition at line 258 of file TrackerGeomBuilderFromGeometricDet.cc.

References Exception, TrackerTopology::glued(), mps_fire::i, findQualityFiles::jj, TrackerTopology::partnerDetId(), PlaneBuilderForGluedDet::plane(), TrackerTopology::stack(), GeomDet::surface(), theTopo, and PbPb_ZMuSkimMuonDPG_cff::tracker.

Referenced by build().

258  {
259  PlaneBuilderForGluedDet gluedplaneBuilder;
260  auto const& gdu = tracker->detUnits();
261  auto const& gduId = tracker->detUnitIds();
262 
263  for (u_int32_t i = 0; i < gdu.size(); i++) {
264  tracker->addDet(gdu[i]);
265  tracker->addDetId(gduId[i]);
266  string gduTypeName = gdu[i]->type().name();
267 
268  //this step is time consuming >> TO FIX with a MAP?
269  if ((gduTypeName.find("Ster") != std::string::npos || gduTypeName.find("Lower") != std::string::npos) &&
270  (theTopo->glued(gduId[i]) != 0 || theTopo->stack(gduId[i]) != 0)) {
271  int partner_pos = -1;
272  for (u_int32_t jj = 0; jj < gduId.size(); jj++) {
273  if (theTopo->partnerDetId(gduId[i]) == gduId[jj]) {
274  partner_pos = jj;
275  break;
276  }
277  }
278  if (partner_pos == -1) {
279  throw cms::Exception("Configuration") << "Module Type is Stereo or Lower but no partner detector found \n"
280  << "There is a problem on Tracker geometry configuration\n";
281  }
282 
283  const GeomDetUnit* dus = gdu[i];
284  const GeomDetUnit* dum = gdu[partner_pos];
285  std::vector<const GeomDetUnit*> composed(2);
286  composed[0] = dum;
287  composed[1] = dus;
288  DetId composedDetId;
289  if (gduTypeName.find("Ster") != std::string::npos) {
290  PlaneBuilderForGluedDet::ResultType plane = gluedplaneBuilder.plane(composed);
291  composedDetId = theTopo->glued(gduId[i]);
292  GluedGeomDet* gluedDet = new GluedGeomDet(&(*plane), dum, dus, composedDetId);
293  tracker->addDet((GeomDet*)gluedDet);
294  tracker->addDetId(composedDetId);
295 
296  } else if (gduTypeName.find("Lower") != std::string::npos) {
297  //The plane is *not* built in the middle, but on the Lower surface
298  Plane* plane = new Plane(dus->surface());
299  composedDetId = theTopo->stack(gduId[i]);
300  StackGeomDet* stackDet = new StackGeomDet(&(*plane), dus, dum, composedDetId);
301  tracker->addDet((GeomDet*)stackDet);
302  tracker->addDetId(composedDetId);
303  }
304  }
305  }
306 }
Definition: Plane.h:16
ResultType plane(const std::vector< const GeomDetUnit *> &dets) const
uint32_t stack(const DetId &id) const
DetId partnerDetId(const DetId &id) const
uint32_t glued(const DetId &id) const
Definition: DetId.h:17
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37

◆ buildPixel()

void TrackerGeomBuilderFromGeometricDet::buildPixel ( std::vector< const GeometricDet *> const &  gdv,
const PTrackerAdditionalParametersPerDet *const &  ptitp,
TrackerGeometry tracker,
GeomDetType::SubDetector  det,
bool  upgradeGeometry,
int  BIG_PIX_PER_ROC_X,
int  BIG_PIX_PER_ROC_Y 
)
private

Definition at line 174 of file TrackerGeomBuilderFromGeometricDet.cc.

References PixelTopologyBuilder::build(), buildPlaneWithMaterial(), PTrackerAdditionalParametersPerDet::getAllBricked(), PTrackerAdditionalParametersPerDet::getAllGeographicalIds(), mps_fire::i, createfilelist::int, LogDebug, AlCaHLTBitMon_QueryRunRegistry::string, GeomDetEnumerators::subDetGeom, submitPVValidationJobs::t, groupFilesInBlocks::temp, thePixelDetTypeMap, and PbPb_ZMuSkimMuonDPG_cff::tracker.

Referenced by build().

182 {
183  LogDebug("BuildingGeomDetUnits") << " Pixel type. Size of vector: " << gdv.size()
184  << " GeomDetType subdetector: " << det
185  << " logical subdetector: " << GeomDetEnumerators::subDetGeom[det]
186  << " big pix per ROC x: " << BIG_PIX_PER_ROC_X << " y: " << BIG_PIX_PER_ROC_Y
187  << " is upgrade: " << upgradeGeometry;
188 
189  tracker->setOffsetDU(GeomDetEnumerators::subDetGeom[det]);
190 
191  std::map<DetId, bool> brickedness_map;
192 
193  std::vector<bool> brickedParams = ptitp->getAllBricked();
194  std::vector<int> geographicalIdParams = ptitp->getAllGeographicalIds();
195 
196  for (unsigned int i = 0; i < geographicalIdParams.size(); i++) {
197  brickedness_map[geographicalIdParams.at(i)] = brickedParams.at(i);
198  }
199 
200  for (auto const& i : gdv) {
201  std::string const& detName = i->name();
202  if (thePixelDetTypeMap.find(detName) == thePixelDetTypeMap.end()) {
203  std::unique_ptr<const Bounds> bounds(i->bounds());
205  upgradeGeometry,
206  brickedness_map[i->geographicalId()],
207  (int)i->pixROCRows(),
208  (int)i->pixROCCols(),
209  BIG_PIX_PER_ROC_X,
210  BIG_PIX_PER_ROC_Y,
211  (int)i->pixROCx(),
212  (int)i->pixROCy());
213 
214  thePixelDetTypeMap[detName] = new PixelGeomDetType(t, detName, det);
215  tracker->addType(thePixelDetTypeMap[detName]);
216  }
217 
219  GeomDetUnit* temp = new PixelGeomDetUnit(&(*plane), thePixelDetTypeMap[detName], i->geographicalId());
220 
221  tracker->addDetUnit(temp);
222  tracker->addDetUnitId(i->geographicalId());
223  }
224  tracker->setEndsetDU(GeomDetEnumerators::subDetGeom[det]);
225 }
PlaneBuilderFromGeometricDet::ResultType buildPlaneWithMaterial(const GeometricDet *gd, double scaleFactor=1.) const
constexpr SubDetector subDetGeom[21]
std::map< std::string, const PixelGeomDetType * > thePixelDetTypeMap
PixelTopology * build(const Bounds *bounds, bool upgradeGeometry, bool isBricked, int ROWS_PER_ROC, int COLS_PER_ROC, int BIG_PIX_PER_ROC_X, int BIG_PIX_PER_ROC_Y, int ROCS_X, int ROCS_Y)
#define LogDebug(id)

◆ buildPlaneWithMaterial()

PlaneBuilderFromGeometricDet::ResultType TrackerGeomBuilderFromGeometricDet::buildPlaneWithMaterial ( const GeometricDet gd,
double  scaleFactor = 1. 
) const
private

Definition at line 308 of file TrackerGeomBuilderFromGeometricDet.cc.

References PlaneBuilderFromGeometricDet::plane(), GeometricDet::radLength(), L1EGammaClusterEmuProducer_cfi::scale, and GeometricDet::xi().

Referenced by buildPixel(), and buildSilicon().

309  {
310  PlaneBuilderFromGeometricDet planeBuilder;
311  PlaneBuilderFromGeometricDet::ResultType plane = planeBuilder.plane(gd);
312  //
313  // set medium properties (if defined)
314  //
315  plane->setMediumProperties(MediumProperties(gd->radLength() * scale, gd->xi() * scale));
316 
317  return plane;
318 }
ResultType plane(const GeometricDet *gd) const
double xi() const
Definition: GeometricDet.h:129
double radLength() const
Definition: GeometricDet.h:128

◆ buildSilicon()

void TrackerGeomBuilderFromGeometricDet::buildSilicon ( std::vector< const GeometricDet *> const &  gdv,
TrackerGeometry tracker,
GeomDetType::SubDetector  det,
const std::string &  part 
)
private

Definition at line 227 of file TrackerGeomBuilderFromGeometricDet.cc.

References StripTopologyBuilder::build(), buildPlaneWithMaterial(), mps_fire::i, LogDebug, TrackerTopology::partnerDetId(), L1EGammaClusterEmuProducer_cfi::scale, AlCaHLTBitMon_QueryRunRegistry::string, GeomDetEnumerators::subDetGeom, submitPVValidationJobs::t, groupFilesInBlocks::temp, theStripDetTypeMap, theTopo, and PbPb_ZMuSkimMuonDPG_cff::tracker.

Referenced by build().

230  {
231  LogDebug("BuildingGeomDetUnits") << " Strip type. Size of vector: " << gdv.size()
232  << " GeomDetType subdetector: " << det
233  << " logical subdetector: " << GeomDetEnumerators::subDetGeom[det] << " part "
234  << part;
235 
236  tracker->setOffsetDU(GeomDetEnumerators::subDetGeom[det]);
237 
238  for (auto const& i : gdv) {
239  std::string const& detName = i->name();
240  if (theStripDetTypeMap.find(detName) == theStripDetTypeMap.end()) {
241  std::unique_ptr<const Bounds> bounds(i->bounds());
242  StripTopology* t = StripTopologyBuilder().build(bounds.get(), i->siliconAPVNum(), part);
243  theStripDetTypeMap[detName] = new StripGeomDetType(t, detName, det, i->stereo());
244  tracker->addType(theStripDetTypeMap[detName]);
245  }
246 
247  double scale = (theTopo->partnerDetId(i->geographicalId())) ? 0.5 : 1.0;
248 
250  GeomDetUnit* temp = new StripGeomDetUnit(&(*plane), theStripDetTypeMap[detName], i->geographicalId());
251 
252  tracker->addDetUnit(temp);
253  tracker->addDetUnitId(i->geographicalId());
254  }
255  tracker->setEndsetDU(GeomDetEnumerators::subDetGeom[det]);
256 }
PlaneBuilderFromGeometricDet::ResultType buildPlaneWithMaterial(const GeometricDet *gd, double scaleFactor=1.) const
constexpr SubDetector subDetGeom[21]
std::map< std::string, const StripGeomDetType * > theStripDetTypeMap
DetId partnerDetId(const DetId &id) const
part
Definition: HCALResponse.h:20
StripTopology * build(const Bounds *, double, const std::string &)
#define LogDebug(id)

Member Data Documentation

◆ thePixelDetTypeMap

std::map<std::string, const PixelGeomDetType*> TrackerGeomBuilderFromGeometricDet::thePixelDetTypeMap
private

Definition at line 42 of file TrackerGeomBuilderFromGeometricDet.h.

Referenced by build(), and buildPixel().

◆ theStripDetTypeMap

std::map<std::string, const StripGeomDetType*> TrackerGeomBuilderFromGeometricDet::theStripDetTypeMap
private

Definition at line 43 of file TrackerGeomBuilderFromGeometricDet.h.

Referenced by build(), and buildSilicon().

◆ theTopo

const TrackerTopology* TrackerGeomBuilderFromGeometricDet::theTopo
private

Definition at line 44 of file TrackerGeomBuilderFromGeometricDet.h.

Referenced by build(), buildGeomDet(), and buildSilicon().