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 edm::ParameterSet &pSet)
 

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 15 of file TrackerGeomBuilderFromGeometricDet.h.

Member Function Documentation

TrackerGeometry * TrackerGeomBuilderFromGeometricDet::build ( const GeometricDet gd,
const edm::ParameterSet pSet 
)

Definition at line 40 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, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), 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, sistripsummary::TEC, GeometricDet::TEC, thePixelDetTypeMap, theStripDetTypeMap, sistripsummary::TIB, GeometricDet::TIB, sistripsummary::TID, GeometricDet::TID, GeomDetEnumerators::tkDetEnum, sistripsummary::TOB, GeometricDet::TOB, patCandidatesForDimuonsSequences_cff::tracker, and GeometricDet::unknown.

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

41 {
42  bool upgradeGeometry = false;
43  int BIG_PIX_PER_ROC_X = 1;
44  int BIG_PIX_PER_ROC_Y = 2;
45 
46  if( pSet.exists( "trackerGeometryConstants" ))
47  {
48  const edm::ParameterSet tkGeomConsts( pSet.getParameter<edm::ParameterSet>( "trackerGeometryConstants" ));
49  upgradeGeometry = tkGeomConsts.getParameter<bool>( "upgradeGeometry" );
50  BIG_PIX_PER_ROC_X = tkGeomConsts.getParameter<int>( "BIG_PIX_PER_ROC_X" );
51  BIG_PIX_PER_ROC_Y = tkGeomConsts.getParameter<int>( "BIG_PIX_PER_ROC_Y" );
52  }
53 
54  thePixelDetTypeMap.clear();
55  theStripDetTypeMap.clear();
56 
58  std::vector<const GeometricDet*> comp;
59  gd->deepComponents(comp);
60 
61  //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
62 
63  std::vector<GeometricDet::GDEnumType> gdsubdetmap(6,GeometricDet::unknown); // hardcoded "6" should not be a surprise...
65 
66  LogDebug("SubDetectorGeometricDetType") << "GeometriDet enumerator values of the subdetectors";
67  for(unsigned int i=0;i<subdetgd.size();++i) {
68  assert(subdetgd[i]->geographicalId().subdetId()>0 && subdetgd[i]->geographicalId().subdetId()<7);
69  gdsubdetmap[subdetgd[i]->geographicalId().subdetId()-1]= subdetgd[i]->type();
70  LogTrace("SubDetectorGeometricDetType") << "subdet " << i
71  << " type " << subdetgd[i]->type()
72  << " detid " << subdetgd[i]->geographicalId()
73  << " subdetid " << subdetgd[i]->geographicalId().subdetId();
74  }
75 
76  std::vector<const GeometricDet*> dets[6];
77  std::vector<const GeometricDet*> & pixB = dets[0]; pixB.reserve(comp.size());
78  std::vector<const GeometricDet*> & pixF = dets[1]; pixF.reserve(comp.size());
79  std::vector<const GeometricDet*> & tib = dets[2]; tib.reserve(comp.size());
80  std::vector<const GeometricDet*> & tid = dets[3]; tid.reserve(comp.size());
81  std::vector<const GeometricDet*> & tob = dets[4]; tob.reserve(comp.size());
82  std::vector<const GeometricDet*> & tec = dets[5]; tec.reserve(comp.size());
83 
84  for(u_int32_t i = 0;i<comp.size();i++)
85  dets[comp[i]->geographicalID().subdetId()-1].push_back(comp[i]);
86 
87  //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 !!
88  // this order is VERY IMPORTANT!!!!! For the moment I (AndreaV) understand that some pieces of code rely on pixel-like being before strip-like
89 
90  // now building the Pixel-like subdetectors
91  for(unsigned int i=0;i<6;++i) {
92  if(gdsubdetmap[i] == GeometricDet::PixelBarrel)
94  upgradeGeometry,
95  BIG_PIX_PER_ROC_X,
96  BIG_PIX_PER_ROC_Y);
97  if(gdsubdetmap[i] == GeometricDet::PixelPhase1Barrel)
99  upgradeGeometry,
100  BIG_PIX_PER_ROC_X,
101  BIG_PIX_PER_ROC_Y);
102  if(gdsubdetmap[i] == GeometricDet::PixelEndCap)
104  upgradeGeometry,
105  BIG_PIX_PER_ROC_X,
106  BIG_PIX_PER_ROC_Y);
107  if(gdsubdetmap[i] == GeometricDet::PixelPhase1EndCap)
109  upgradeGeometry,
110  BIG_PIX_PER_ROC_X,
111  BIG_PIX_PER_ROC_Y);
112  if(gdsubdetmap[i] == GeometricDet::PixelPhase2EndCap)
114  upgradeGeometry,
115  BIG_PIX_PER_ROC_X,
116  BIG_PIX_PER_ROC_Y);
117  if(gdsubdetmap[i] == GeometricDet::OTPhase2Barrel)
119  upgradeGeometry,
120  BIG_PIX_PER_ROC_X,
121  BIG_PIX_PER_ROC_Y);
122  if(gdsubdetmap[i] == GeometricDet::OTPhase2EndCap)
124  upgradeGeometry,
125  BIG_PIX_PER_ROC_X,
126  BIG_PIX_PER_ROC_Y);
127  }
128  //now building Strips
129  for(unsigned int i=0;i<6;++i) {
130  if(gdsubdetmap[i] == GeometricDet::TIB) buildSilicon(dets[i],tracker,GeomDetEnumerators::SubDetector::TIB, "barrel");
131  if(gdsubdetmap[i] == GeometricDet::TID) buildSilicon(dets[i],tracker,GeomDetEnumerators::SubDetector::TID, "endcap");
132  if(gdsubdetmap[i] == GeometricDet::TOB) buildSilicon(dets[i],tracker,GeomDetEnumerators::SubDetector::TOB, "barrel");
133  if(gdsubdetmap[i] == GeometricDet::TEC) buildSilicon(dets[i],tracker,GeomDetEnumerators::SubDetector::TEC, "endcap");
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].size()!=0) throw cms::Exception("NotEmptyUnknownSubDet") << "Subdetector " << i+1 << " is unknown but it is not empty: " << dets[i].size();
139  buildSilicon(dets[i],tracker,GeomDetEnumerators::tkDetEnum[i+1], "barrel"); // "barrel" is used but it is irrelevant
140  }
141  }
142  buildGeomDet(tracker);//"GeomDet"
143 
144  verifyDUinTG(*tracker);
145 
146  return tracker;
147 }
#define LogDebug(id)
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
assert(m_qm.get())
static const int BIG_PIX_PER_ROC_Y
Definition: TrackUtils.cc:64
bool exists(std::string const &parameterName) const
checks if a parameter exists
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:67
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 232 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().

232  {
233  PlaneBuilderForGluedDet gluedplaneBuilder;
234  auto const & gdu= tracker->detUnits();
235  auto const & gduId = tracker->detUnitIds();
236 
237  for(u_int32_t i=0;i<gdu.size();i++){
238  StripSubdetector sidet( gduId[i].rawId());
239  tracker->addDet((GeomDet*) gdu[i]);
240  tracker->addDetId(gduId[i]);
241  if(sidet.glued()!=0&&sidet.stereo()==1){
242  int partner_pos=-1;
243  for(u_int32_t jj=0;jj<gduId.size();jj++){
244  if(sidet.partnerDetId()== gduId[jj]) {
245  partner_pos=jj;
246  break;
247  }
248  }
249  const GeomDetUnit* dus = gdu[i];
250  if(partner_pos==-1){
251  throw cms::Exception("Configuration") <<"No partner detector found \n"
252  <<"There is a problem on Tracker geometry configuration\n";
253  }
254  const GeomDetUnit* dum = gdu[partner_pos];
255  std::vector<const GeomDetUnit *> glued(2);
256  glued[0]=dum;
257  glued[1]=dus;
258  PlaneBuilderForGluedDet::ResultType plane = gluedplaneBuilder.plane(glued);
259  GluedGeomDet* gluedDet = new GluedGeomDet(&(*plane),dum,dus);
260  tracker->addDet((GeomDet*) gluedDet);
261  tracker->addDetId(DetId(sidet.glued()));
262  }
263  }
264 }
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 149 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, edmStreamStallGrapher::t, groupFilesInBlocks::temp, and thePixelDetTypeMap.

Referenced by build().

155 {
156  LogDebug("BuildingGeomDetUnits") << " Pixel type. Size of vector: " << gdv.size()
157  << " GeomDetType subdetector: " << det
158  << " logical subdetector: " << GeomDetEnumerators::subDetGeom[det]
159  << " big pix per ROC x: " << BIG_PIX_PER_ROC_X << " y: " << BIG_PIX_PER_ROC_Y
160  << " is upgrade: " << upgradeGeometry;
161 
163 
164  for(u_int32_t i=0; i<gdv.size(); i++){
165 
166  std::string const & detName = gdv[i]->name().fullname();
167  if (thePixelDetTypeMap.find(detName) == thePixelDetTypeMap.end()) {
168  std::unique_ptr<const Bounds> bounds(gdv[i]->bounds());
169 
170  PixelTopology* t =
171  PixelTopologyBuilder().build(&*bounds,
172  upgradeGeometry,
173  gdv[i]->pixROCRows(),
174  gdv[i]->pixROCCols(),
177  gdv[i]->pixROCx(), gdv[i]->pixROCy());
178 
179  thePixelDetTypeMap[detName] = new PixelGeomDetType(t,detName,det);
180  tracker->addType(thePixelDetTypeMap[detName]);
181  }
182 
184  GeomDetUnit* temp = new PixelGeomDetUnit(&(*plane),thePixelDetTypeMap[detName],gdv[i]->geographicalID());
185 
186  tracker->addDetUnit(temp);
187  tracker->addDetUnitId(gdv[i]->geographicalID());
188  }
190 }
#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:64
void addDetUnit(GeomDetUnit const *p)
static const int BIG_PIX_PER_ROC_X
Definition: TrackUtils.cc:67
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 267 of file TrackerGeomBuilderFromGeometricDet.cc.

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

Referenced by buildPixel(), and buildSilicon().

269 {
270  PlaneBuilderFromGeometricDet planeBuilder;
271  PlaneBuilderFromGeometricDet::ResultType plane = planeBuilder.plane(gd);
272  //
273  // set medium properties (if defined)
274  //
275  plane->setMediumProperties(MediumProperties(gd->radLength()*scale,gd->xi()*scale));
276 
277  return plane;
278 }
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 192 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, edmStreamStallGrapher::t, groupFilesInBlocks::temp, and theStripDetTypeMap.

Referenced by build().

196 {
197  LogDebug("BuildingGeomDetUnits") << " Strip type. Size of vector: " << gdv.size()
198  << " GeomDetType subdetector: " << det
199  << " logical subdetector: " << GeomDetEnumerators::subDetGeom[det]
200  << " part " << part;
201 
203 
204  for(u_int32_t i=0;i<gdv.size();i++){
205 
206  std::string const & detName = gdv[i]->name().fullname();
207  if (theStripDetTypeMap.find(detName) == theStripDetTypeMap.end()) {
208  std::unique_ptr<const Bounds> bounds(gdv[i]->bounds());
209  StripTopology* t =
210  StripTopologyBuilder().build(&*bounds,
211  gdv[i]->siliconAPVNum(),
212  part);
213  theStripDetTypeMap[detName] = new StripGeomDetType( t,detName,det,
214  gdv[i]->stereo());
215  tracker->addType(theStripDetTypeMap[detName]);
216  }
217 
218  StripSubdetector sidet( gdv[i]->geographicalID());
219  double scale = (sidet.partnerDetId()) ? 0.5 : 1.0 ;
220 
222  GeomDetUnit* temp = new StripGeomDetUnit(&(*plane), theStripDetTypeMap[detName],gdv[i]->geographicalID());
223 
224  tracker->addDetUnit(temp);
225  tracker->addDetUnitId(gdv[i]->geographicalID());
226  }
228 
229 }
#define LogDebug(id)
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 34 of file TrackerGeomBuilderFromGeometricDet.h.

Referenced by build(), and buildPixel().

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

Definition at line 35 of file TrackerGeomBuilderFromGeometricDet.h.

Referenced by build(), and buildSilicon().