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)
 

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
 

Detailed Description

Definition at line 16 of file TrackerGeomBuilderFromGeometricDet.h.

Member Function Documentation

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

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

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

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

Referenced by build().

224  {
225  PlaneBuilderForGluedDet gluedplaneBuilder;
226  auto const & gdu= tracker->detUnits();
227  auto const & gduId = tracker->detUnitIds();
228 
229  for(u_int32_t i=0;i<gdu.size();i++){
230  StripSubdetector sidet( gduId[i].rawId());
231  tracker->addDet((GeomDet*) gdu[i]);
232  tracker->addDetId(gduId[i]);
233  if(sidet.glued()!=0&&sidet.stereo()==1){
234  int partner_pos=-1;
235  for(u_int32_t jj=0;jj<gduId.size();jj++){
236  if(sidet.partnerDetId()== gduId[jj]) {
237  partner_pos=jj;
238  break;
239  }
240  }
241  const GeomDetUnit* dus = gdu[i];
242  if(partner_pos==-1){
243  throw cms::Exception("Configuration") <<"No partner detector found \n"
244  <<"There is a problem on Tracker geometry configuration\n";
245  }
246  const GeomDetUnit* dum = gdu[partner_pos];
247  std::vector<const GeomDetUnit *> glued(2);
248  glued[0]=dum;
249  glued[1]=dus;
250  PlaneBuilderForGluedDet::ResultType plane = gluedplaneBuilder.plane(glued);
251  GluedGeomDet* gluedDet = new GluedGeomDet(&(*plane),dum,dus);
252  tracker->addDet((GeomDet*) gluedDet);
253  tracker->addDetId(DetId(sidet.glued()));
254  }
255  }
256 }
int i
Definition: DBlmapReader.cc:9
void addDet(GeomDet const *p)
ResultType plane(const std::vector< const GeomDetUnit * > &dets) const
void addDetId(DetId p)
virtual const DetUnitContainer & detUnits() const
Returm a vector of all GeomDetUnit.
Definition: DetId.h:18
virtual const DetIdContainer & detUnitIds() const
Returm a vector of all GeomDetUnit DetIds.
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 141 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, tree::t, groupFilesInBlocks::temp, and thePixelDetTypeMap.

Referenced by build().

147 {
148  LogDebug("BuildingGeomDetUnits") << " Pixel type. Size of vector: " << gdv.size()
149  << " GeomDetType subdetector: " << det
150  << " logical subdetector: " << GeomDetEnumerators::subDetGeom[det]
151  << " big pix per ROC x: " << BIG_PIX_PER_ROC_X << " y: " << BIG_PIX_PER_ROC_Y
152  << " is upgrade: " << upgradeGeometry;
153 
155 
156  for(u_int32_t i=0; i<gdv.size(); i++){
157 
158  std::string const & detName = gdv[i]->name().fullname();
159  if (thePixelDetTypeMap.find(detName) == thePixelDetTypeMap.end()) {
160  std::unique_ptr<const Bounds> bounds(gdv[i]->bounds());
161 
162  PixelTopology* t =
163  PixelTopologyBuilder().build(&*bounds,
164  upgradeGeometry,
165  gdv[i]->pixROCRows(),
166  gdv[i]->pixROCCols(),
169  gdv[i]->pixROCx(), gdv[i]->pixROCy());
170 
171  thePixelDetTypeMap[detName] = new PixelGeomDetType(t,detName,det);
172  tracker->addType(thePixelDetTypeMap[detName]);
173  }
174 
176  GeomDetUnit* temp = new PixelGeomDetUnit(&(*plane),thePixelDetTypeMap[detName],gdv[i]->geographicalID());
177 
178  tracker->addDetUnit(temp);
179  tracker->addDetUnitId(gdv[i]->geographicalID());
180  }
182 }
#define LogDebug(id)
tuple t
Definition: tree.py:139
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 259 of file TrackerGeomBuilderFromGeometricDet.cc.

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

Referenced by buildPixel(), and buildSilicon().

261 {
262  PlaneBuilderFromGeometricDet planeBuilder;
263  PlaneBuilderFromGeometricDet::ResultType plane = planeBuilder.plane(gd);
264  //
265  // set medium properties (if defined)
266  //
267  plane->setMediumProperties(MediumProperties(gd->radLength()*scale,gd->xi()*scale));
268 
269  return plane;
270 }
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 184 of file TrackerGeomBuilderFromGeometricDet.cc.

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

Referenced by build().

188 {
189  LogDebug("BuildingGeomDetUnits") << " Strip type. Size of vector: " << gdv.size()
190  << " GeomDetType subdetector: " << det
191  << " logical subdetector: " << GeomDetEnumerators::subDetGeom[det]
192  << " part " << part;
193 
195 
196  for(u_int32_t i=0;i<gdv.size();i++){
197 
198  std::string const & detName = gdv[i]->name().fullname();
199  if (theStripDetTypeMap.find(detName) == theStripDetTypeMap.end()) {
200  std::unique_ptr<const Bounds> bounds(gdv[i]->bounds());
201  StripTopology* t =
202  StripTopologyBuilder().build(&*bounds,
203  gdv[i]->siliconAPVNum(),
204  part);
205  theStripDetTypeMap[detName] = new StripGeomDetType( t,detName,det,
206  gdv[i]->stereo());
207  tracker->addType(theStripDetTypeMap[detName]);
208  }
209 
210  StripSubdetector sidet( gdv[i]->geographicalID());
211  double scale = (sidet.partnerDetId()) ? 0.5 : 1.0 ;
212 
214  GeomDetUnit* temp = new StripGeomDetUnit(&(*plane), theStripDetTypeMap[detName],gdv[i]->geographicalID());
215 
216  tracker->addDetUnit(temp);
217  tracker->addDetUnitId(gdv[i]->geographicalID());
218  }
220 
221 }
#define LogDebug(id)
tuple t
Definition: tree.py:139
int i
Definition: DBlmapReader.cc:9
StripTopology * build(const Bounds *, double, std::string)
void setEndsetDU(SubDetector sid)
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 35 of file TrackerGeomBuilderFromGeometricDet.h.

Referenced by build(), and buildPixel().

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

Definition at line 36 of file TrackerGeomBuilderFromGeometricDet.h.

Referenced by build(), and buildSilicon().