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 PTrackerParameters &ptp, const TrackerTopology *tTopo)
 

Private Member Functions

void buildGeomDet (TrackerGeometry *)
 
void buildPixel (std::vector< const GeometricDet *> 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 17 of file TrackerGeomBuilderFromGeometricDet.h.

Member Function Documentation

◆ build()

TrackerGeometry * TrackerGeomBuilderFromGeometricDet::build ( const GeometricDet gd,
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().

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

◆ buildGeomDet()

void TrackerGeomBuilderFromGeometricDet::buildGeomDet ( TrackerGeometry tracker)
private

Definition at line 226 of file TrackerGeomBuilderFromGeometricDet.cc.

References TrackerTopology::doubleSensor(), 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().

226  {
227  PlaneBuilderForGluedDet gluedplaneBuilder;
228  auto const& gdu = tracker->detUnits();
229  auto const& gduId = tracker->detUnitIds();
230 
231  for (u_int32_t i = 0; i < gdu.size(); i++) {
232  tracker->addDet(gdu[i]);
233  tracker->addDetId(gduId[i]);
234  string gduTypeName = gdu[i]->type().name();
235 
236  //this step is time consuming >> TO FIX with a MAP?
237  if ((gduTypeName.find("Ster") != std::string::npos || gduTypeName.find("Lower") != std::string::npos ||
238  gduTypeName.find("One") != std::string::npos) &&
239  (theTopo->glued(gduId[i]) != 0 || theTopo->stack(gduId[i]) != 0 || theTopo->doubleSensor(gduId[i]))) {
240  int partner_pos = -1;
241  for (u_int32_t jj = 0; jj < gduId.size(); jj++) {
242  if (theTopo->partnerDetId(gduId[i]) == gduId[jj]) {
243  partner_pos = jj;
244  break;
245  }
246  }
247  if (partner_pos == -1) {
248  throw cms::Exception("Configuration") << "Module Type is Stereo or Lower but no partner detector found \n"
249  << "There is a problem on Tracker geometry configuration\n";
250  }
251 
252  const GeomDetUnit* dus = gdu[i];
253  const GeomDetUnit* dum = gdu[partner_pos];
254  std::vector<const GeomDetUnit*> composed(2);
255  composed[0] = dum;
256  composed[1] = dus;
257  DetId composedDetId;
258  if (gduTypeName.find("Ster") != std::string::npos) {
259  PlaneBuilderForGluedDet::ResultType plane = gluedplaneBuilder.plane(composed);
260  composedDetId = theTopo->glued(gduId[i]);
261  GluedGeomDet* gluedDet = new GluedGeomDet(&(*plane), dum, dus, composedDetId);
262  tracker->addDet((GeomDet*)gluedDet);
263  tracker->addDetId(composedDetId);
264 
265  } else if (gduTypeName.find("Lower") != std::string::npos) {
266  //The plane is *not* built in the middle, but on the Lower surface
267  Plane* plane = new Plane(dus->surface());
268  composedDetId = theTopo->stack(gduId[i]);
269  StackGeomDet* stackDet = new StackGeomDet(&(*plane), dus, dum, composedDetId);
270  tracker->addDet((GeomDet*)stackDet);
271  tracker->addDetId(composedDetId);
272  } else if (gduTypeName.find("One") != std::string::npos) {
273  //The plane is *not* built in the middle, but on the First surface
274  Plane* plane = new Plane(dus->surface());
275  composedDetId = theTopo->doubleSensor(gduId[i]);
276  DoubleSensGeomDet* doubleSensDet = new DoubleSensGeomDet(&(*plane), dus, dum, composedDetId);
277  tracker->addDet((GeomDet*)doubleSensDet);
278  tracker->addDetId(composedDetId);
279  }
280  }
281  }
282 }
Definition: Plane.h:16
uint32_t doubleSensor(const DetId &id) const
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,
TrackerGeometry tracker,
GeomDetType::SubDetector  det,
bool  upgradeGeometry,
int  BIG_PIX_PER_ROC_X,
int  BIG_PIX_PER_ROC_Y 
)
private

Definition at line 153 of file TrackerGeomBuilderFromGeometricDet.cc.

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

Referenced by build().

160 {
161  LogDebug("BuildingGeomDetUnits") << " Pixel type. Size of vector: " << gdv.size()
162  << " GeomDetType subdetector: " << det
163  << " logical subdetector: " << GeomDetEnumerators::subDetGeom[det]
164  << " big pix per ROC x: " << BIG_PIX_PER_ROC_X << " y: " << BIG_PIX_PER_ROC_Y
165  << " is upgrade: " << upgradeGeometry;
166 
167  tracker->setOffsetDU(GeomDetEnumerators::subDetGeom[det]);
168 
169  for (auto const& i : gdv) {
170  std::string const& detName = i->name();
171  if (thePixelDetTypeMap.find(detName) == thePixelDetTypeMap.end()) {
172  std::unique_ptr<const Bounds> bounds(i->bounds());
174  upgradeGeometry,
175  (int)i->pixROCRows(),
176  (int)i->pixROCCols(),
177  BIG_PIX_PER_ROC_X,
178  BIG_PIX_PER_ROC_Y,
179  (int)i->pixROCx(),
180  (int)i->pixROCy());
181 
182  thePixelDetTypeMap[detName] = new PixelGeomDetType(t, detName, det);
183  tracker->addType(thePixelDetTypeMap[detName]);
184  }
185 
187  GeomDetUnit* temp = new PixelGeomDetUnit(&(*plane), thePixelDetTypeMap[detName], i->geographicalId());
188 
189  tracker->addDetUnit(temp);
190  tracker->addDetUnitId(i->geographicalId());
191  }
192  tracker->setEndsetDU(GeomDetEnumerators::subDetGeom[det]);
193 }
PlaneBuilderFromGeometricDet::ResultType buildPlaneWithMaterial(const GeometricDet *gd, double scaleFactor=1.) const
PixelTopology * build(const Bounds *bounds, bool upgradeGeometry, 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)
constexpr SubDetector subDetGeom[21]
std::map< std::string, const PixelGeomDetType * > thePixelDetTypeMap
#define LogDebug(id)

◆ buildPlaneWithMaterial()

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

Definition at line 284 of file TrackerGeomBuilderFromGeometricDet.cc.

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

Referenced by buildPixel(), and buildSilicon().

285  {
286  PlaneBuilderFromGeometricDet planeBuilder;
287  PlaneBuilderFromGeometricDet::ResultType plane = planeBuilder.plane(gd);
288  //
289  // set medium properties (if defined)
290  //
291  plane->setMediumProperties(MediumProperties(gd->radLength() * scale, gd->xi() * scale));
292 
293  return plane;
294 }
ResultType plane(const GeometricDet *gd) const
double xi() const
Definition: GeometricDet.h:130
double radLength() const
Definition: GeometricDet.h:129

◆ buildSilicon()

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

Definition at line 195 of file TrackerGeomBuilderFromGeometricDet.cc.

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

Referenced by build().

198  {
199  LogDebug("BuildingGeomDetUnits") << " Strip type. Size of vector: " << gdv.size()
200  << " GeomDetType subdetector: " << det
201  << " logical subdetector: " << GeomDetEnumerators::subDetGeom[det] << " part "
202  << part;
203 
204  tracker->setOffsetDU(GeomDetEnumerators::subDetGeom[det]);
205 
206  for (auto const& i : gdv) {
207  std::string const& detName = i->name();
208  if (theStripDetTypeMap.find(detName) == theStripDetTypeMap.end()) {
209  std::unique_ptr<const Bounds> bounds(i->bounds());
210  StripTopology* t = StripTopologyBuilder().build(bounds.get(), i->siliconAPVNum(), part);
211  theStripDetTypeMap[detName] = new StripGeomDetType(t, detName, det, i->stereo());
212  tracker->addType(theStripDetTypeMap[detName]);
213  }
214 
215  double scale = (theTopo->partnerDetId(i->geographicalId())) ? 0.5 : 1.0;
216 
218  GeomDetUnit* temp = new StripGeomDetUnit(&(*plane), theStripDetTypeMap[detName], i->geographicalId());
219 
220  tracker->addDetUnit(temp);
221  tracker->addDetUnitId(i->geographicalId());
222  }
223  tracker->setEndsetDU(GeomDetEnumerators::subDetGeom[det]);
224 }
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 37 of file TrackerGeomBuilderFromGeometricDet.h.

Referenced by build(), and buildPixel().

◆ theStripDetTypeMap

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

Definition at line 38 of file TrackerGeomBuilderFromGeometricDet.h.

Referenced by build(), and buildSilicon().

◆ theTopo

const TrackerTopology* TrackerGeomBuilderFromGeometricDet::theTopo
private

Definition at line 39 of file TrackerGeomBuilderFromGeometricDet.h.

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