test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 assert(), fireworks::BIG_PIX_PER_ROC_X, fireworks::BIG_PIX_PER_ROC_Y, buildGeomDet(), buildPixel(), buildSilicon(), AlCaHLTBitMon_QueryRunRegistry::comp, GeometricDet::components(), GeometricDet::deepComponents(), Exception, i, LogDebug, LogTrace, GeometricDet::OTPhase2Barrel, GeometricDet::OTPhase2EndCap, GeomDetEnumerators::P1PXB, GeomDetEnumerators::P1PXEC, GeomDetEnumerators::P2OTB, GeomDetEnumerators::P2OTEC, GeomDetEnumerators::P2PXEC, GeomDetEnumerators::PixelBarrel, GeometricDet::PixelBarrel, GeomDetEnumerators::PixelEndcap, GeometricDet::PixelEndCap, GeometricDet::PixelPhase1Barrel, GeometricDet::PixelPhase1EndCap, GeometricDet::PixelPhase2EndCap, findQualityFiles::size, 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, patCandidatesForDimuonsSequences_cff::tracker, GeometricDet::unknown, and PTrackerParameters::vpars.

Referenced by CreateSurveyRcds::analyze(), SurveyInputTrackerFromDB::analyze(), SurveyMisalignmentInput::analyze(), TrackerSystematicMisalignments::analyze(), AlignmentMonitorAsAnalyzer::analyze(), TrackerTreeGenerator::analyze(), TrackerGeometryIntoNtuples::analyze(), PCLTrackerAlProducer::createGeometries(), AlignmentProducer::createGeometries_(), TrackerGeometryCompare::createROOTGeometry(), TrackerDigiGeometryESModule::produce(), MisalignedTrackerESProducer::produce(), and LaserAlignment::produce().

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()
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(u_int32_t i = 0;i<comp.size();i++)
80  dets[comp[i]->geographicalID().subdetId()-1].push_back(comp[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  true,
95  BIG_PIX_PER_ROC_X,
96  BIG_PIX_PER_ROC_Y);
97  if(gdsubdetmap[i] == GeometricDet::PixelEndCap)
99  false,
100  BIG_PIX_PER_ROC_X,
101  BIG_PIX_PER_ROC_Y);
102  if(gdsubdetmap[i] == GeometricDet::PixelPhase1EndCap)
104  true,
105  BIG_PIX_PER_ROC_X,
106  BIG_PIX_PER_ROC_Y);
107  if(gdsubdetmap[i] == GeometricDet::PixelPhase2EndCap)
109  true,
110  BIG_PIX_PER_ROC_X,
111  BIG_PIX_PER_ROC_Y);
112  if(gdsubdetmap[i] == GeometricDet::OTPhase2Barrel)
114  true,
115  BIG_PIX_PER_ROC_X,
116  BIG_PIX_PER_ROC_Y);
117  if(gdsubdetmap[i] == GeometricDet::OTPhase2EndCap)
119  true,
120  BIG_PIX_PER_ROC_X,
121  BIG_PIX_PER_ROC_Y);
122  }
123  //now building Strips
124  for(unsigned int i=0;i<6;++i) {
125  if(gdsubdetmap[i] == GeometricDet::TIB) buildSilicon(dets[i],tracker,GeomDetEnumerators::SubDetector::TIB, "barrel");
126  if(gdsubdetmap[i] == GeometricDet::TID) buildSilicon(dets[i],tracker,GeomDetEnumerators::SubDetector::TID, "endcap");
127  if(gdsubdetmap[i] == GeometricDet::TOB) buildSilicon(dets[i],tracker,GeomDetEnumerators::SubDetector::TOB, "barrel");
128  if(gdsubdetmap[i] == GeometricDet::TEC) buildSilicon(dets[i],tracker,GeomDetEnumerators::SubDetector::TEC, "endcap");
129  }
130  // and finally the "empty" subdetectors (maybe it is not needed)
131  for(unsigned int i=0;i<6;++i) {
132  if(gdsubdetmap[i] == GeometricDet::unknown) {
133  if(dets[i].size()!=0) throw cms::Exception("NotEmptyUnknownSubDet") << "Subdetector " << i+1 << " is unknown but it is not empty: " << dets[i].size();
134  buildSilicon(dets[i],tracker,GeomDetEnumerators::tkDetEnum[i+1], "barrel"); // "barrel" is used but it is irrelevant
135  }
136  }
137  buildGeomDet(tracker);//"GeomDet"
138 
139  verifyDUinTG(*tracker);
140 
141  return tracker;
142 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::vector< int > vpars
assert(m_qm.get())
static const int BIG_PIX_PER_ROC_Y
Definition: TrackUtils.cc:66
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:174
static const int BIG_PIX_PER_ROC_X
Definition: TrackUtils.cc:69
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
tuple size
Write out results.
void TrackerGeomBuilderFromGeometricDet::buildGeomDet ( TrackerGeometry tracker)
private

Definition at line 226 of file TrackerGeomBuilderFromGeometricDet.cc.

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

Referenced by build().

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

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

Referenced by build().

150 {
151  LogDebug("BuildingGeomDetUnits") << " Pixel type. Size of vector: " << gdv.size()
152  << " GeomDetType subdetector: " << det
153  << " logical subdetector: " << GeomDetEnumerators::subDetGeom[det]
154  << " big pix per ROC x: " << BIG_PIX_PER_ROC_X << " y: " << BIG_PIX_PER_ROC_Y
155  << " is upgrade: " << upgradeGeometry;
156 
158 
159  for(u_int32_t i=0; i<gdv.size(); i++){
160 
161  std::string const & detName = gdv[i]->name().fullname();
162  if (thePixelDetTypeMap.find(detName) == thePixelDetTypeMap.end()) {
163  std::unique_ptr<const Bounds> bounds(gdv[i]->bounds());
164 
165  PixelTopology* t =
166  PixelTopologyBuilder().build(&*bounds,
167  upgradeGeometry,
168  gdv[i]->pixROCRows(),
169  gdv[i]->pixROCCols(),
172  gdv[i]->pixROCx(), gdv[i]->pixROCy());
173 
174  thePixelDetTypeMap[detName] = new PixelGeomDetType(t,detName,det);
175  tracker->addType(thePixelDetTypeMap[detName]);
176  }
177 
179  GeomDetUnit* temp = new PixelGeomDetUnit(&(*plane),thePixelDetTypeMap[detName],gdv[i]->geographicalID());
180 
181  tracker->addDetUnit(temp);
182  tracker->addDetUnitId(gdv[i]->geographicalID());
183  }
185 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
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)
static const int BIG_PIX_PER_ROC_Y
Definition: TrackUtils.cc:66
void addDetUnit(GeomDetUnit const *p)
static const int BIG_PIX_PER_ROC_X
Definition: TrackUtils.cc:69
void setOffsetDU(SubDetector sid)
PlaneBuilderFromGeometricDet::ResultType buildPlaneWithMaterial(const GeometricDet *gd, double scaleFactor=1.) const
void addType(GeomDetType const *p)
std::map< std::string, const PixelGeomDetType * > thePixelDetTypeMap
SubDetector subDetGeom[18]
void addDetUnitId(DetId p)
PlaneBuilderFromGeometricDet::ResultType TrackerGeomBuilderFromGeometricDet::buildPlaneWithMaterial ( const GeometricDet gd,
double  scaleFactor = 1. 
) const
private

Definition at line 287 of file TrackerGeomBuilderFromGeometricDet.cc.

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

Referenced by buildPixel(), and buildSilicon().

289 {
290  PlaneBuilderFromGeometricDet planeBuilder;
291  PlaneBuilderFromGeometricDet::ResultType plane = planeBuilder.plane(gd);
292  //
293  // set medium properties (if defined)
294  //
295  plane->setMediumProperties(MediumProperties(gd->radLength()*scale,gd->xi()*scale));
296 
297  return plane;
298 }
double radLength() const
Definition: GeometricDet.h:251
ResultType plane(const GeometricDet *gd) const
double xi() const
Definition: GeometricDet.h:255
void TrackerGeomBuilderFromGeometricDet::buildSilicon ( std::vector< const GeometricDet * > const &  gdv,
TrackerGeometry tracker,
GeomDetType::SubDetector  det,
const std::string &  part 
)
private

Definition at line 187 of file TrackerGeomBuilderFromGeometricDet.cc.

References TrackerGeometry::addDetUnit(), TrackerGeometry::addDetUnitId(), TrackerGeometry::addType(), StripTopologyBuilder::build(), buildPlaneWithMaterial(), i, LogDebug, TrackerTopology::partnerDetId(), pileupReCalc_HLTpaths::scale, TrackerGeometry::setEndsetDU(), TrackerGeometry::setOffsetDU(), AlCaHLTBitMon_QueryRunRegistry::string, GeomDetEnumerators::subDetGeom, lumiQTWidget::t, groupFilesInBlocks::temp, theStripDetTypeMap, and theTopo.

Referenced by build().

191 {
192  LogDebug("BuildingGeomDetUnits") << " Strip type. Size of vector: " << gdv.size()
193  << " GeomDetType subdetector: " << det
194  << " logical subdetector: " << GeomDetEnumerators::subDetGeom[det]
195  << " part " << part;
196 
198 
199  for(u_int32_t i=0;i<gdv.size();i++){
200 
201  std::string const & detName = gdv[i]->name().fullname();
202  if (theStripDetTypeMap.find(detName) == theStripDetTypeMap.end()) {
203  std::unique_ptr<const Bounds> bounds(gdv[i]->bounds());
204  StripTopology* t =
205  StripTopologyBuilder().build(&*bounds,
206  gdv[i]->siliconAPVNum(),
207  part);
208  theStripDetTypeMap[detName] = new StripGeomDetType( t,detName,det,
209  gdv[i]->stereo());
210  tracker->addType(theStripDetTypeMap[detName]);
211  }
212 
213  double scale = (theTopo->partnerDetId(gdv[i]->geographicalID())) ? 0.5 : 1.0 ;
214 
216  GeomDetUnit* temp = new StripGeomDetUnit(&(*plane), theStripDetTypeMap[detName],gdv[i]->geographicalID());
217 
218  tracker->addDetUnit(temp);
219  tracker->addDetUnitId(gdv[i]->geographicalID());
220  }
222 
223 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
StripTopology * build(const Bounds *, double, std::string)
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[18]
part
Definition: HCALResponse.h:20
void addDetUnitId(DetId p)

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