CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
TrackerTreeGenerator Class Reference

#include <Alignment/TrackerAlignment/plugins/TrackerTreeGenerator.cc>

Inheritance diagram for TrackerTreeGenerator:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 TrackerTreeGenerator (const edm::ParameterSet &)
 
 ~TrackerTreeGenerator ()=default
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob () override
 
virtual void endJob () override
 

Private Attributes

edm::ParameterSet config_
 
const bool createEntryForDoubleSidedModule_
 
std::vector< TrackerTreeVariablesvTkTreeVar_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: <one line="" class="" summary>=""> Implementation: <Notes on="" implementation>="">

Definition at line 66 of file TrackerTreeGenerator.cc.

Constructor & Destructor Documentation

TrackerTreeGenerator::TrackerTreeGenerator ( const edm::ParameterSet config)
explicit

Definition at line 94 of file TrackerTreeGenerator.cc.

References TFileService::kSharedResource.

94  :
95  createEntryForDoubleSidedModule_(config.getParameter<bool>("createEntryForDoubleSidedModule")),
96  config_(config)
97 {
98  usesResource(TFileService::kSharedResource);
99 }
static const std::string kSharedResource
Definition: TFileService.h:76
T getParameter(std::string const &) const
edm::ParameterSet config_
const bool createEntryForDoubleSidedModule_
TrackerTreeGenerator::~TrackerTreeGenerator ( )
default

Member Function Documentation

void TrackerTreeGenerator::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Definition at line 108 of file TrackerTreeGenerator.cc.

References PV3DBase< T, PVType, FrameType >::barePhi(), TrackerTreeVariables::blade, TrackerGeomBuilderFromGeometricDet::build(), createEntryForDoubleSidedModule_, MuonCkfTrajectoryBuilder_cfi::deltaPhi, TrackerGeometry::detIds(), TrackerGeometry::detUnitIds(), dPhi(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, PV3DBase< T, PVType, FrameType >::eta(), edm::EventSetup::get(), TrackerTreeVariables::half, TrackerGeometry::idToDet(), TrackerTreeVariables::isDoubleSide, TrackerTreeVariables::isRPhi, TrackerTreeVariables::isStereo, TrackerTreeVariables::layer, TrackerTreeVariables::module, TrackerTreeVariables::nStrips, TrackerTreeVariables::outerInner, TrackerTreeVariables::panel, PV3DBase< T, PVType, FrameType >::perp(), TrackerTreeVariables::petal, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, TrackerTreeVariables::posEta, TrackerTreeVariables::posPhi, TrackerTreeVariables::posR, TrackerTreeVariables::posX, TrackerTreeVariables::posY, TrackerTreeVariables::posZ, edm::ESHandle< T >::product(), TrackerTreeVariables::rawId, TrackerTreeVariables::ring, TrackerTreeVariables::rod, TrackerTreeVariables::side, TrackerTreeVariables::subdetId, GeomDet::surface(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, Surface::toGlobal(), TrackerTreeVariables::uDirection, TrackerTreeVariables::vDirection, vTkTreeVar_, TrackerTreeVariables::wDirection, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

109 {
110  //iSetup.get<TrackerDigiGeometryRecord>().get(tkGeom);
111  // now try to take directly the ideal geometry independent of used geometry in Global Tag
112  edm::ESHandle<GeometricDet> geometricDet;
113  iSetup.get<IdealGeometryRecord>().get(geometricDet);
114 
115  //Retrieve tracker topology from geometry
116  edm::ESHandle<TrackerTopology> tTopoHandle;
117  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
118  const TrackerTopology* const tTopo = tTopoHandle.product();
119 
121  iSetup.get<PTrackerParametersRcd>().get(ptp);
122  TrackerGeomBuilderFromGeometricDet trackerBuilder;
123  const TrackerGeometry* tkGeom = trackerBuilder.build(&(*geometricDet), *ptp, tTopo);
124  AlignableTracker alignableTracker{tkGeom, tTopo};
125  const auto& ns = alignableTracker.trackerNameSpace();
126 
127  edm::LogInfo("TrackerTreeGenerator")
128  << "@SUB=TrackerTreeGenerator::analyze"
129  << "There are " << tkGeom->detIds().size()
130  << " dets and "<<tkGeom->detUnitIds().size()
131  <<" detUnits in the Geometry Record";
132 
134  edm::LogInfo("TrackerTreeGenerator")
135  << "@SUB=TrackerTreeGenerator::analyze"
136  << "Create entry for each module AND one entry for virtual "
137  << "double-sided module in addition";
138  } else {
139  edm::LogInfo("TrackerTreeGenerator")
140  << "@SUB=TrackerTreeGenerator::analyze"
141  << "Create one entry for each physical module, do NOT create additional "
142  << "entry for virtual double-sided module";
143  }
144 
145  for (const auto& detId: tkGeom->detIds()){
146 
147  const GeomDet& geomDet = *tkGeom->idToDet(detId);
148  const Surface& surface = geomDet.surface();
149 
150  TrackerTreeVariables tkTreeVar;
151  const auto rawId = detId.rawId();
152  tkTreeVar.rawId = rawId;
153  tkTreeVar.subdetId = detId.subdetId();
154 
155  switch (tkTreeVar.subdetId) {
157  tkTreeVar.layer = tTopo->pxbLayer(detId);
158  tkTreeVar.half = ns.tpb().halfBarrelNumber(rawId);
159  tkTreeVar.rod = tTopo->pxbLadder(detId); // ... so, ladder is not per halfBarrel-Layer, but per barrel-layer!
160  tkTreeVar.module = tTopo->pxbModule(detId);
161  break;
163  tkTreeVar.layer = tTopo->pxfDisk(detId);
164  tkTreeVar.side = tTopo->pxfSide(detId);
165  tkTreeVar.half = ns.tpe().halfCylinderNumber(rawId);
166  tkTreeVar.blade = tTopo->pxfBlade(detId);
167  tkTreeVar.panel = tTopo->pxfPanel(detId);
168  tkTreeVar.module = tTopo->pxfModule(detId);
169  break;
171  tkTreeVar.layer = tTopo->tibLayer(detId);
172  tkTreeVar.side = tTopo->tibStringInfo(detId)[0];
173  tkTreeVar.half = ns.tib().halfShellNumber(rawId);
174  tkTreeVar.rod = tTopo->tibStringInfo(detId)[2];
175  tkTreeVar.outerInner = tTopo->tibStringInfo(detId)[1];
176  tkTreeVar.module = tTopo->tibModule(detId);
177  tkTreeVar.isDoubleSide = tTopo->tibIsDoubleSide(detId);
178  tkTreeVar.isRPhi = tTopo->tibIsRPhi(detId);
179  tkTreeVar.isStereo = tTopo->tibIsStereo(detId);
180  break;
182  tkTreeVar.layer = tTopo->tidWheel(detId);
183  tkTreeVar.side = tTopo->tidSide(detId);
184  tkTreeVar.ring = tTopo->tidRing(detId);
185  tkTreeVar.outerInner = tTopo->tidModuleInfo(detId)[0];
186  tkTreeVar.module = tTopo->tidModuleInfo(detId)[1];
187  tkTreeVar.isDoubleSide = tTopo->tidIsDoubleSide(detId);
188  tkTreeVar.isRPhi = tTopo->tidIsRPhi(detId);
189  tkTreeVar.isStereo = tTopo->tidIsStereo(detId);
190  break;
192  tkTreeVar.layer = tTopo->tobLayer(detId);
193  tkTreeVar.side = tTopo->tobRodInfo(detId)[0];
194  tkTreeVar.rod = tTopo->tobRodInfo(detId)[1];
195  tkTreeVar.module = tTopo->tobModule(detId);
196  tkTreeVar.isDoubleSide = tTopo->tobIsDoubleSide(detId);
197  tkTreeVar.isRPhi = tTopo->tobIsRPhi(detId);
198  tkTreeVar.isStereo = tTopo->tobIsStereo(detId);
199  break;
201  tkTreeVar.layer = tTopo->tecWheel(detId);
202  tkTreeVar.side = tTopo->tecSide(detId);
203  tkTreeVar.ring = tTopo->tecRing(detId);
204  tkTreeVar.petal = tTopo->tecPetalInfo(detId)[1];
205  tkTreeVar.outerInner = tTopo->tecPetalInfo(detId)[0];
206  tkTreeVar.module = tTopo->tecModule(detId);
207  tkTreeVar.isDoubleSide = tTopo->tecIsDoubleSide(detId);
208  tkTreeVar.isRPhi = tTopo->tecIsRPhi(detId);
209  tkTreeVar.isStereo = tTopo->tecIsStereo(detId);
210  break;
211  }
212 
213 
214  LocalPoint lPModule(0.,0.,0.),
215  lUDirection(1.,0.,0.),
216  lVDirection(0.,1.,0.),
217  lWDirection(0.,0.,1.);
218  GlobalPoint gPModule = surface.toGlobal(lPModule),
219  gUDirection = surface.toGlobal(lUDirection),
220  gVDirection = surface.toGlobal(lVDirection),
221  gWDirection = surface.toGlobal(lWDirection);
222  double dR(999.), dPhi(999.), dZ(999.);
223  switch (tkTreeVar.subdetId) {
227  dR = gWDirection.perp() - gPModule.perp();
228  dPhi = deltaPhi(gUDirection.barePhi(),gPModule.barePhi());
229  dZ = gVDirection.z() - gPModule.z();
230  tkTreeVar.uDirection = dPhi>0. ? 1 : -1;
231  tkTreeVar.vDirection = dZ>0. ? 1 : -1;
232  tkTreeVar.wDirection = dR>0. ? 1 : -1;
233  break;
235  dR = gUDirection.perp() - gPModule.perp();
236  dPhi = deltaPhi(gVDirection.barePhi(),gPModule.barePhi());
237  dZ = gWDirection.z() - gPModule.z();
238  tkTreeVar.uDirection = dR>0. ? 1 : -1;
239  tkTreeVar.vDirection = dPhi>0. ? 1 : -1;
240  tkTreeVar.wDirection = dZ>0. ? 1 : -1;
241  break;
244  dR = gVDirection.perp() - gPModule.perp();
245  dPhi = deltaPhi(gUDirection.barePhi(),gPModule.barePhi());
246  dZ = gWDirection.z() - gPModule.z();
247  tkTreeVar.uDirection = dPhi>0. ? 1 : -1;
248  tkTreeVar.vDirection = dR>0. ? 1 : -1;
249  tkTreeVar.wDirection = dZ>0. ? 1 : -1;
250  break;
251  }
252  tkTreeVar.posR = gPModule.perp();
253  tkTreeVar.posPhi = gPModule.barePhi(); // = gPModule.barePhi().degrees();
254  tkTreeVar.posEta = gPModule.eta();
255  tkTreeVar.posX = gPModule.x();
256  tkTreeVar.posY = gPModule.y();
257  tkTreeVar.posZ = gPModule.z();
258 
259 
260  if(auto stripGeomDetUnit = dynamic_cast<const StripGeomDetUnit*>(&geomDet)){ //is it a single physical module?
261  switch (tkTreeVar.subdetId) {
266  auto& topol =
267  dynamic_cast<const StripTopology&>(stripGeomDetUnit->specificTopology());
268  tkTreeVar.nStrips = topol.nstrips();
269  break;
270  }
271  }
272 
273 
275  // do so only for individual modules and not also one entry for the combined doubleSided Module
276  if (tkTreeVar.isDoubleSide) continue;
277  }
278  vTkTreeVar_.push_back(tkTreeVar);
279  }
280 
281 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
T perp() const
Definition: PV3DBase.h:72
T y() const
Definition: PV3DBase.h:63
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
T barePhi() const
Definition: PV3DBase.h:68
const DetIdContainer & detUnitIds() const
Returm a vector of all GeomDetUnit DetIds.
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
T z() const
Definition: PV3DBase.h:64
const T & get() const
Definition: EventSetup.h:56
T eta() const
Definition: PV3DBase.h:76
const DetIdContainer & detIds() const
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
const bool createEntryForDoubleSidedModule_
std::vector< TrackerTreeVariables > vTkTreeVar_
T x() const
Definition: PV3DBase.h:62
T const * product() const
Definition: ESHandle.h:86
const TrackerGeomDet * idToDet(DetId) const
void TrackerTreeGenerator::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 286 of file TrackerTreeGenerator.cc.

287 {
288 }
void TrackerTreeGenerator::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 293 of file TrackerTreeGenerator.cc.

References DEFINE_FWK_MODULE, F(), fileService, TFileDirectory::make(), TFileService::mkdir(), python.rootplot.argparse::module, module::module(), RecoTauValidation_cfi::posX, RecoTauValidation_cfi::posY, relativeConstraints::ring, and vTkTreeVar_.

Referenced by o2olib.O2ORunMgr::executeJob().

293  {
294  UInt_t rawId(999), subdetId(999), layer(999), side(999), half(999), rod(999),
295  ring(999), petal(999), blade(999), panel(999), outerInner(999),
296  module(999), nStrips(999);
297  Bool_t isDoubleSide(false), isRPhi(false), isStereo(false);
298  Int_t uDirection(999), vDirection(999), wDirection(999);
299  Float_t posR(999.F), posPhi(999.F), posEta(999.F),
300  posX(999.F), posY(999.F), posZ(999.F);
301 
303  TFileDirectory treeDir = fileService->mkdir("TrackerTree");
304  auto trackerTree{treeDir.make<TTree>("TrackerTree",
305  "IDs of all modules (ideal geometry)")};
306  trackerTree->Branch("RawId", &rawId, "RawId/i");
307  trackerTree->Branch("SubdetId", &subdetId, "SubdetId/i");
308  trackerTree->Branch("Layer", &layer, "Layer/i"); // Barrel: Layer, Forward: Disk
309  trackerTree->Branch("Side", &side, "Side/i"); // Rod/Ring in +z or -z
310  trackerTree->Branch("Half", &half, "Half/i"); // PXB: HalfBarrel, PXF: HalfCylinder, TIB: HalfShell
311  trackerTree->Branch("Rod", &rod, "Rod/i"); // Barrel (Ladder or String or Rod)
312  trackerTree->Branch("Ring", &ring, "Ring/i"); // Forward
313  trackerTree->Branch("Petal", &petal, "Petal/i"); // TEC
314  trackerTree->Branch("Blade", &blade, "Blade/i"); // PXF
315  trackerTree->Branch("Panel", &panel, "Panel/i"); // PXF
316  trackerTree->Branch("OuterInner", &outerInner, "OuterInner/i"); // front/back String,Ring,Petal
317  trackerTree->Branch("Module", &module, "Module/i"); // Module ID
318  trackerTree->Branch("NStrips", &nStrips, "NStrips/i");
319  trackerTree->Branch("IsDoubleSide", &isDoubleSide, "IsDoubleSide/O");
320  trackerTree->Branch("IsRPhi", &isRPhi, "IsRPhi/O");
321  trackerTree->Branch("IsStereo", &isStereo, "IsStereo/O");
322  trackerTree->Branch("UDirection", &uDirection, "UDirection/I");
323  trackerTree->Branch("VDirection", &vDirection, "VDirection/I");
324  trackerTree->Branch("WDirection", &wDirection, "WDirection/I");
325  trackerTree->Branch("PosR", &posR, "PosR/F");
326  trackerTree->Branch("PosPhi", &posPhi, "PosPhi/F");
327  trackerTree->Branch("PosEta", &posEta, "PosEta/F");
328  trackerTree->Branch("PosX", &posX, "PosX/F");
329  trackerTree->Branch("PosY", &posY, "PosY/F");
330  trackerTree->Branch("PosZ", &posZ, "PosZ/F");
331 
332  for(const auto& iTree: vTkTreeVar_){
333  rawId = iTree.rawId;
334  subdetId = iTree.subdetId;
335  layer = iTree.layer;
336  side = iTree.side;
337  half = iTree.half;
338  rod = iTree.rod;
339  ring = iTree.ring;
340  petal = iTree.petal;
341  blade = iTree.blade;
342  panel = iTree.panel;
343  outerInner = iTree.outerInner;
344  module = iTree.module;
345  nStrips = iTree.nStrips;
346  isDoubleSide = iTree.isDoubleSide;
347  isRPhi = iTree.isRPhi;
348  isStereo = iTree.isStereo;
349  uDirection = iTree.uDirection;
350  vDirection = iTree.vDirection;
351  wDirection = iTree.wDirection;
352  posR = iTree.posR;
353  posPhi = iTree.posPhi;
354  posEta = iTree.posEta;
355  posX = iTree.posX;
356  posY = iTree.posY;
357  posZ = iTree.posZ;
358 
359  trackerTree->Fill();
360  }
361  edm::LogInfo("TrackerTreeGenerator")
362  << "@SUB=TrackerTreeGenerator::endJob"
363  << "TrackerTree contains "<< vTkTreeVar_.size() <<" entries overall";
364 }
module()
Definition: vlib.cc:994
T * make(const Args &...args) const
make new ROOT object
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
edm::Service< TFileService > fileService
std::vector< TrackerTreeVariables > vTkTreeVar_
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
Definition: vlib.h:208

Member Data Documentation

edm::ParameterSet TrackerTreeGenerator::config_
private

Definition at line 80 of file TrackerTreeGenerator.cc.

const bool TrackerTreeGenerator::createEntryForDoubleSidedModule_
private

Definition at line 78 of file TrackerTreeGenerator.cc.

Referenced by analyze().

std::vector<TrackerTreeVariables> TrackerTreeGenerator::vTkTreeVar_
private

Definition at line 79 of file TrackerTreeGenerator.cc.

Referenced by analyze(), and endJob().