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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 64 of file TrackerTreeGenerator.cc.

Constructor & Destructor Documentation

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

Definition at line 92 of file TrackerTreeGenerator.cc.

References TFileService::kSharedResource.

93  : createEntryForDoubleSidedModule_(config.getParameter<bool>("createEntryForDoubleSidedModule")), config_(config) {
94  usesResource(TFileService::kSharedResource);
95 }
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 102 of file TrackerTreeGenerator.cc.

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

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

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 263 of file TrackerTreeGenerator.cc.

263 {}
void TrackerTreeGenerator::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 266 of file TrackerTreeGenerator.cc.

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

Referenced by o2olib.O2ORunMgr::executeJob().

266  {
267  UInt_t rawId(999), subdetId(999), layer(999), side(999), half(999), rod(999), ring(999), petal(999), blade(999),
268  panel(999), outerInner(999), module(999), nStrips(999);
269  Bool_t isDoubleSide(false), isRPhi(false), isStereo(false);
270  Int_t uDirection(999), vDirection(999), wDirection(999);
271  Float_t posR(999.F), posPhi(999.F), posEta(999.F), posX(999.F), posY(999.F), posZ(999.F);
272 
274  TFileDirectory treeDir = fileService->mkdir("TrackerTree");
275  auto trackerTree{treeDir.make<TTree>("TrackerTree", "IDs of all modules (ideal geometry)")};
276  trackerTree->Branch("RawId", &rawId, "RawId/i");
277  trackerTree->Branch("SubdetId", &subdetId, "SubdetId/i");
278  trackerTree->Branch("Layer", &layer, "Layer/i"); // Barrel: Layer, Forward: Disk
279  trackerTree->Branch("Side", &side, "Side/i"); // Rod/Ring in +z or -z
280  trackerTree->Branch("Half", &half, "Half/i"); // PXB: HalfBarrel, PXF: HalfCylinder, TIB: HalfShell
281  trackerTree->Branch("Rod", &rod, "Rod/i"); // Barrel (Ladder or String or Rod)
282  trackerTree->Branch("Ring", &ring, "Ring/i"); // Forward
283  trackerTree->Branch("Petal", &petal, "Petal/i"); // TEC
284  trackerTree->Branch("Blade", &blade, "Blade/i"); // PXF
285  trackerTree->Branch("Panel", &panel, "Panel/i"); // PXF
286  trackerTree->Branch("OuterInner", &outerInner, "OuterInner/i"); // front/back String,Ring,Petal
287  trackerTree->Branch("Module", &module, "Module/i"); // Module ID
288  trackerTree->Branch("NStrips", &nStrips, "NStrips/i");
289  trackerTree->Branch("IsDoubleSide", &isDoubleSide, "IsDoubleSide/O");
290  trackerTree->Branch("IsRPhi", &isRPhi, "IsRPhi/O");
291  trackerTree->Branch("IsStereo", &isStereo, "IsStereo/O");
292  trackerTree->Branch("UDirection", &uDirection, "UDirection/I");
293  trackerTree->Branch("VDirection", &vDirection, "VDirection/I");
294  trackerTree->Branch("WDirection", &wDirection, "WDirection/I");
295  trackerTree->Branch("PosR", &posR, "PosR/F");
296  trackerTree->Branch("PosPhi", &posPhi, "PosPhi/F");
297  trackerTree->Branch("PosEta", &posEta, "PosEta/F");
298  trackerTree->Branch("PosX", &posX, "PosX/F");
299  trackerTree->Branch("PosY", &posY, "PosY/F");
300  trackerTree->Branch("PosZ", &posZ, "PosZ/F");
301 
302  for (const auto& iTree : vTkTreeVar_) {
303  rawId = iTree.rawId;
304  subdetId = iTree.subdetId;
305  layer = iTree.layer;
306  side = iTree.side;
307  half = iTree.half;
308  rod = iTree.rod;
309  ring = iTree.ring;
310  petal = iTree.petal;
311  blade = iTree.blade;
312  panel = iTree.panel;
313  outerInner = iTree.outerInner;
314  module = iTree.module;
315  nStrips = iTree.nStrips;
316  isDoubleSide = iTree.isDoubleSide;
317  isRPhi = iTree.isRPhi;
318  isStereo = iTree.isStereo;
319  uDirection = iTree.uDirection;
320  vDirection = iTree.vDirection;
321  wDirection = iTree.wDirection;
322  posR = iTree.posR;
323  posPhi = iTree.posPhi;
324  posEta = iTree.posEta;
325  posX = iTree.posX;
326  posY = iTree.posY;
327  posZ = iTree.posZ;
328 
329  trackerTree->Fill();
330  }
331  edm::LogInfo("TrackerTreeGenerator") << "@SUB=TrackerTreeGenerator::endJob"
332  << "TrackerTree contains " << vTkTreeVar_.size() << " entries overall";
333 }
module()
Definition: vlib.cc:913
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
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:163
Definition: vlib.h:198

Member Data Documentation

edm::ParameterSet TrackerTreeGenerator::config_
private

Definition at line 78 of file TrackerTreeGenerator.cc.

const bool TrackerTreeGenerator::createEntryForDoubleSidedModule_
private

Definition at line 76 of file TrackerTreeGenerator.cc.

Referenced by analyze().

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

Definition at line 77 of file TrackerTreeGenerator.cc.

Referenced by analyze(), and endJob().