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 43 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().

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

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

Definition at line 152 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().

159 {
160  LogDebug("BuildingGeomDetUnits") << " Pixel type. Size of vector: " << gdv.size()
161  << " GeomDetType subdetector: " << det
162  << " logical subdetector: " << GeomDetEnumerators::subDetGeom[det]
163  << " big pix per ROC x: " << BIG_PIX_PER_ROC_X << " y: " << BIG_PIX_PER_ROC_Y
164  << " is upgrade: " << upgradeGeometry;
165 
166  tracker->setOffsetDU(GeomDetEnumerators::subDetGeom[det]);
167 
168  for (auto const& i : gdv) {
169  std::string const& detName = i->name();
170  if (thePixelDetTypeMap.find(detName) == thePixelDetTypeMap.end()) {
171  std::unique_ptr<const Bounds> bounds(i->bounds());
173  upgradeGeometry,
174  (int)i->pixROCRows(),
175  (int)i->pixROCCols(),
176  BIG_PIX_PER_ROC_X,
177  BIG_PIX_PER_ROC_Y,
178  (int)i->pixROCx(),
179  (int)i->pixROCy());
180 
181  thePixelDetTypeMap[detName] = new PixelGeomDetType(t, detName, det);
182  tracker->addType(thePixelDetTypeMap[detName]);
183  }
184 
186  GeomDetUnit* temp = new PixelGeomDetUnit(&(*plane), thePixelDetTypeMap[detName], i->geographicalId());
187 
188  tracker->addDetUnit(temp);
189  tracker->addDetUnitId(i->geographicalId());
190  }
191  tracker->setEndsetDU(GeomDetEnumerators::subDetGeom[det]);
192 }
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 275 of file TrackerGeomBuilderFromGeometricDet.cc.

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

Referenced by buildPixel(), and buildSilicon().

276  {
277  PlaneBuilderFromGeometricDet planeBuilder;
278  PlaneBuilderFromGeometricDet::ResultType plane = planeBuilder.plane(gd);
279  //
280  // set medium properties (if defined)
281  //
282  plane->setMediumProperties(MediumProperties(gd->radLength() * scale, gd->xi() * scale));
283 
284  return plane;
285 }
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 194 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().

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