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 () override=default
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 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 & itemsToGetFrom (BranchType iType) 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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
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 65 of file TrackerTreeGenerator.cc.

Constructor & Destructor Documentation

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

Definition at line 93 of file TrackerTreeGenerator.cc.

References TFileService::kSharedResource.

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

Member Function Documentation

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

Definition at line 107 of file TrackerTreeGenerator.cc.

References PV3DBase< T, PVType, FrameType >::barePhi(), TrackerTreeVariables::blade, TrackerGeomBuilderFromGeometricDet::build(), createEntryForDoubleSidedModule_, hiPixelPairStep_cff::deltaPhi, TrackerGeometry::detIds(), TrackerGeometry::detUnitIds(), 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().

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

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 285 of file TrackerTreeGenerator.cc.

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

Reimplemented from edm::one::EDAnalyzerBase.

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

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

const bool TrackerTreeGenerator::createEntryForDoubleSidedModule_
private

Definition at line 77 of file TrackerTreeGenerator.cc.

Referenced by analyze().

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

Definition at line 78 of file TrackerTreeGenerator.cc.

Referenced by analyze(), and endJob().