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

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

Definition at line 42 of file TrackerGeomBuilderFromGeometricDet.cc.

References 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, mixOne_simraw_on_sim_cfi::tracker, GeometricDet::unknown, and PTrackerParameters::vpars.

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

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

Definition at line 233 of file TrackerGeomBuilderFromGeometricDet.cc.

References TrackerGeometry::addDet(), TrackerGeometry::addDetId(), TrackerGeometry::detUnitIds(), TrackerGeometry::detUnits(), Exception, TrackerTopology::glued(), mps_fire::i, findQualityFiles::jj, TrackerTopology::partnerDetId(), PlaneBuilderForGluedDet::plane(), TrackerTopology::stack(), and theTopo.

Referenced by build().

233  {
234 
235  PlaneBuilderForGluedDet gluedplaneBuilder;
236  auto const & gdu = tracker->detUnits();
237  auto const & gduId = tracker->detUnitIds();
238 
239  for(u_int32_t i=0;i<gdu.size();i++){
240 
241  tracker->addDet(gdu[i]);
242  tracker->addDetId(gduId[i]);
243  string gduTypeName = gdu[i]->type().name();
244 
245  //this step is time consuming >> TO FIX with a MAP?
246  if( (gduTypeName.find("Ster")!=std::string::npos ||
247  gduTypeName.find("Lower")!=std::string::npos) &&
248  (theTopo->glued(gduId[i])!=0 || theTopo->stack(gduId[i])!=0 )) {
249 
250 
251  int partner_pos=-1;
252  for(u_int32_t jj=0;jj<gduId.size();jj++){
253  if(theTopo->partnerDetId(gduId[i]) == gduId[jj]) {
254  partner_pos=jj;
255  break;
256  }
257  }
258  if(partner_pos==-1){
259  throw cms::Exception("Configuration") <<"Module Type is Stereo or Lower but no partner detector found \n"
260  <<"There is a problem on Tracker geometry configuration\n";
261  }
262 
263  const GeomDetUnit* dus = gdu[i];
264  const GeomDetUnit* dum = gdu[partner_pos];
265  std::vector<const GeomDetUnit *> composed(2);
266  composed[0]=dum;
267  composed[1]=dus;
268  DetId composedDetId;
269  if(gduTypeName.find("Ster")!=std::string::npos){
270 
271  PlaneBuilderForGluedDet::ResultType plane = gluedplaneBuilder.plane(composed);
272  composedDetId = theTopo->glued(gduId[i]);
273  GluedGeomDet* gluedDet = new GluedGeomDet(&(*plane),dum,dus,composedDetId);
274  tracker->addDet((GeomDet*) gluedDet);
275  tracker->addDetId(composedDetId);
276 
277  } else if (gduTypeName.find("Lower")!=std::string::npos){
278 
279  //FIXME::ERICA: the plane builder is built in the middle...
280  PlaneBuilderForGluedDet::ResultType plane = gluedplaneBuilder.plane(composed);
281  composedDetId = theTopo->stack(gduId[i]);
282  StackGeomDet* stackDet = new StackGeomDet(&(*plane),dum,dus,composedDetId);
283  tracker->addDet((GeomDet*) stackDet);
284  tracker->addDetId(composedDetId);
285 
286  }
287 
288  }
289 
290  }
291 }
const DetIdContainer & detUnitIds() const override
Returm a vector of all GeomDetUnit DetIds.
void addDet(GeomDet const *p)
ResultType plane(const std::vector< const GeomDetUnit * > &dets) const
DetId partnerDetId(const DetId &id) const
void addDetId(DetId p)
Definition: DetId.h:18
uint32_t stack(const DetId &id) const
uint32_t glued(const DetId &id) const
const DetUnitContainer & detUnits() const override
Returm a vector of all GeomDetUnit.
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 151 of file TrackerGeomBuilderFromGeometricDet.cc.

References TrackerGeometry::addDetUnit(), TrackerGeometry::addDetUnitId(), TrackerGeometry::addType(), PixelTopologyBuilder::build(), buildPlaneWithMaterial(), mps_fire::i, LogDebug, TrackerGeometry::setEndsetDU(), TrackerGeometry::setOffsetDU(), AlCaHLTBitMon_QueryRunRegistry::string, GeomDetEnumerators::subDetGeom, lumiQTWidget::t, groupFilesInBlocks::temp, and thePixelDetTypeMap.

Referenced by build().

157 {
158  LogDebug("BuildingGeomDetUnits") << " Pixel type. Size of vector: " << gdv.size()
159  << " GeomDetType subdetector: " << det
160  << " logical subdetector: " << GeomDetEnumerators::subDetGeom[det]
161  << " big pix per ROC x: " << BIG_PIX_PER_ROC_X << " y: " << BIG_PIX_PER_ROC_Y
162  << " is upgrade: " << upgradeGeometry;
163 
165 
166  for(auto i : gdv){
167 
168  std::string const & detName = i->name().fullname();
169  if (thePixelDetTypeMap.find(detName) == thePixelDetTypeMap.end()) {
170  std::unique_ptr<const Bounds> bounds(i->bounds());
171 
172  PixelTopology* t =
173  PixelTopologyBuilder().build(&*bounds,
174  upgradeGeometry,
175  i->pixROCRows(),
176  i->pixROCCols(),
177  BIG_PIX_PER_ROC_X,
178  BIG_PIX_PER_ROC_Y,
179  i->pixROCx(), 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  }
192 }
#define LogDebug(id)
void setEndsetDU(SubDetector sid)
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)
void addDetUnit(GeomDetUnit const *p)
void setOffsetDU(SubDetector sid)
PlaneBuilderFromGeometricDet::ResultType buildPlaneWithMaterial(const GeometricDet *gd, double scaleFactor=1.) const
void addType(GeomDetType const *p)
SubDetector subDetGeom[21]
std::map< std::string, const PixelGeomDetType * > thePixelDetTypeMap
void addDetUnitId(DetId p)
PlaneBuilderFromGeometricDet::ResultType TrackerGeomBuilderFromGeometricDet::buildPlaneWithMaterial ( const GeometricDet gd,
double  scaleFactor = 1. 
) const
private

Definition at line 294 of file TrackerGeomBuilderFromGeometricDet.cc.

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

Referenced by buildPixel(), and buildSilicon().

296 {
297  PlaneBuilderFromGeometricDet planeBuilder;
298  PlaneBuilderFromGeometricDet::ResultType plane = planeBuilder.plane(gd);
299  //
300  // set medium properties (if defined)
301  //
302  plane->setMediumProperties(MediumProperties(gd->radLength()*scale,gd->xi()*scale));
303 
304  return plane;
305 }
double radLength() const
Definition: GeometricDet.h:253
ResultType plane(const GeometricDet *gd) const
double xi() const
Definition: GeometricDet.h:257
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 TrackerGeometry::addDetUnit(), TrackerGeometry::addDetUnitId(), TrackerGeometry::addType(), StripTopologyBuilder::build(), buildPlaneWithMaterial(), mps_fire::i, LogDebug, TrackerTopology::partnerDetId(), Scenarios_cff::scale, TrackerGeometry::setEndsetDU(), TrackerGeometry::setOffsetDU(), AlCaHLTBitMon_QueryRunRegistry::string, GeomDetEnumerators::subDetGeom, lumiQTWidget::t, groupFilesInBlocks::temp, theStripDetTypeMap, and theTopo.

Referenced by build().

198 {
199  LogDebug("BuildingGeomDetUnits") << " Strip type. Size of vector: " << gdv.size()
200  << " GeomDetType subdetector: " << det
201  << " logical subdetector: " << GeomDetEnumerators::subDetGeom[det]
202  << " part " << part;
203 
205 
206  for(auto i : gdv){
207 
208  std::string const & detName = i->name().fullname();
209  if (theStripDetTypeMap.find(detName) == theStripDetTypeMap.end()) {
210  std::unique_ptr<const Bounds> bounds(i->bounds());
211  StripTopology* t =
212  StripTopologyBuilder().build(&*bounds,
213  i->siliconAPVNum(),
214  part);
215  theStripDetTypeMap[detName] = new StripGeomDetType( t,detName,det,
216  i->stereo());
217  tracker->addType(theStripDetTypeMap[detName]);
218  }
219 
220  double scale = (theTopo->partnerDetId(i->geographicalID())) ? 0.5 : 1.0 ;
221 
223  GeomDetUnit* temp = new StripGeomDetUnit(&(*plane), theStripDetTypeMap[detName],i->geographicalID());
224 
225  tracker->addDetUnit(temp);
226  tracker->addDetUnitId(i->geographicalID());
227  }
229 
230 }
#define LogDebug(id)
void setEndsetDU(SubDetector sid)
DetId partnerDetId(const DetId &id) const
void addDetUnit(GeomDetUnit const *p)
void setOffsetDU(SubDetector sid)
std::map< std::string, const StripGeomDetType * > theStripDetTypeMap
PlaneBuilderFromGeometricDet::ResultType buildPlaneWithMaterial(const GeometricDet *gd, double scaleFactor=1.) const
void addType(GeomDetType const *p)
SubDetector subDetGeom[21]
part
Definition: HCALResponse.h:20
void addDetUnitId(DetId p)
StripTopology * build(const Bounds *, double, const std::string &)

Member Data Documentation

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

Definition at line 36 of file TrackerGeomBuilderFromGeometricDet.h.

Referenced by build(), and buildPixel().

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

Definition at line 37 of file TrackerGeomBuilderFromGeometricDet.h.

Referenced by build(), and buildSilicon().

const TrackerTopology* TrackerGeomBuilderFromGeometricDet::theTopo
private

Definition at line 38 of file TrackerGeomBuilderFromGeometricDet.h.

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