CMS 3D CMS Logo

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

#include <Alignment/APEEstimation/src/ApeTreeCreateDefault.cc>

Inheritance diagram for ApeTreeCreateDefault:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 ApeTreeCreateDefault (const edm::ParameterSet &)
 
 ~ApeTreeCreateDefault () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept 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 noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
bool checkIntervalsForSectors (const unsigned int sectorCounter, const std::vector< double > &) const
 
bool checkModuleBools (const bool, const std::vector< unsigned int > &) const
 
bool checkModuleDirections (const int, const std::vector< int > &) const
 
bool checkModuleIds (const unsigned int, const std::vector< unsigned int > &) const
 
bool checkModulePositions (const float, const std::vector< double > &) const
 
void endJob () override
 
void sectorBuilder ()
 

Private Attributes

const edm::ESGetToken< AlignmentErrorsExtended, TrackerAlignmentErrorExtendedRcdalignmentErrorToken_
 
std::map< unsigned int, TrackerSectorStructm_tkSector_
 
std::map< unsigned int, ReducedTrackerTreeVariablesm_tkTreeVar_
 
unsigned int noSectors
 
const std::string resultFile_
 
const std::vector< edm::ParameterSetsectors_
 
const std::string trackerTreeFile_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 63 of file ApeTreeCreateDefault.cc.

Constructor & Destructor Documentation

◆ ApeTreeCreateDefault()

ApeTreeCreateDefault::ApeTreeCreateDefault ( const edm::ParameterSet iConfig)
explicit

Definition at line 104 of file ApeTreeCreateDefault.cc.

106  resultFile_(iConfig.getParameter<std::string>("resultFile")),
107  trackerTreeFile_(iConfig.getParameter<std::string>("trackerTreeFile")),
108  sectors_(iConfig.getParameter<std::vector<edm::ParameterSet>>("sectors")) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const std::vector< edm::ParameterSet > sectors_
const std::string trackerTreeFile_
const edm::ESGetToken< AlignmentErrorsExtended, TrackerAlignmentErrorExtendedRcd > alignmentErrorToken_
const std::string resultFile_

◆ ~ApeTreeCreateDefault()

ApeTreeCreateDefault::~ApeTreeCreateDefault ( )
override

Definition at line 110 of file ApeTreeCreateDefault.cc.

110 {}

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 399 of file ApeTreeCreateDefault.cc.

References alignmentErrorToken_, edm::EventSetup::getData(), mps_fire::i, AlignmentErrorsExtended::m_alignError, m_tkSector_, resultFile_, and AlCaHLTBitMon_QueryRunRegistry::string.

399  {
400  // Same procedure as in ApeEstimatorSummary.cc minus reading of baseline tree
401 
402  // Load APEs from the GT and write them to root files similar to the ones from calculateAPE()
403  const AlignmentErrorsExtended* alignmentErrors = &iSetup.getData(alignmentErrorToken_);
404 
405  // Set up root file for default APE values
406  const std::string defaultFileName(resultFile_);
407  TFile* defaultFile = new TFile(defaultFileName.c_str(), "RECREATE");
408 
409  // Naming in the root files has to be iterTreeX to be consistent for the plotting tool
410  TTree* defaultTreeX(nullptr);
411  TTree* defaultTreeY(nullptr);
412  defaultFile->GetObject("iterTreeX;1", defaultTreeX);
413  defaultFile->GetObject("iterTreeY;1", defaultTreeY);
414  // The same for TTree containing the names of the sectors (no additional check, since always handled exactly as defaultTree)
415  TTree* sectorNameTree(nullptr);
416  defaultFile->GetObject("nameTree;1", sectorNameTree);
417 
418  edm::LogInfo("DefaultAPETree") << "APE Tree is being created";
419  defaultTreeX = new TTree("iterTreeX", "Tree for default APE x values from GT");
420  defaultTreeY = new TTree("iterTreeY", "Tree for default APE y values from GT");
421  sectorNameTree = new TTree("nameTree", "Tree with names of sectors");
422 
423  // Assign the information stored in the trees to arrays
424  std::vector<double*> a_defaultSectorX;
425  std::vector<double*> a_defaultSectorY;
426 
427  std::vector<std::string*> a_sectorName;
428  for (auto const& i_sector : m_tkSector_) {
429  const unsigned int iSector(i_sector.first);
430  const bool pixelSector(i_sector.second.isPixel);
431 
432  a_defaultSectorX.push_back(new double(-99.));
433  a_defaultSectorY.push_back(new double(-99.));
434  a_sectorName.push_back(new std::string(i_sector.second.name));
435 
436  std::stringstream ss_sector;
437  std::stringstream ss_sectorSuffixed;
438  ss_sector << "Ape_Sector_" << iSector;
439 
440  ss_sectorSuffixed << ss_sector.str() << "/D";
441  defaultTreeX->Branch(ss_sector.str().c_str(), &(*a_defaultSectorX[iSector - 1]), ss_sectorSuffixed.str().c_str());
442 
443  if (pixelSector) {
444  defaultTreeY->Branch(ss_sector.str().c_str(), &(*a_defaultSectorY[iSector - 1]), ss_sectorSuffixed.str().c_str());
445  }
446  sectorNameTree->Branch(ss_sector.str().c_str(), &(*a_sectorName[iSector - 1]), 32000, 00);
447  }
448 
449  // Loop over sectors for getting default APE
450 
451  for (auto& i_sector : m_tkSector_) {
452  double defaultApeX(0.);
453  double defaultApeY(0.);
454  unsigned int nModules(0);
455  for (auto const& i_rawId : i_sector.second.v_rawId) {
456  std::vector<AlignTransformErrorExtended> alignErrors = alignmentErrors->m_alignError;
457  for (auto const& i_alignError : alignErrors) {
458  if (i_rawId == i_alignError.rawId()) {
459  CLHEP::HepSymMatrix errMatrix = i_alignError.matrix();
460  defaultApeX += errMatrix[0][0];
461  defaultApeY += errMatrix[1][1];
462  nModules++;
463  }
464  }
465  }
466  *a_defaultSectorX[i_sector.first - 1] = defaultApeX / nModules;
467  *a_defaultSectorY[i_sector.first - 1] = defaultApeY / nModules;
468  }
469 
470  sectorNameTree->Fill();
471  sectorNameTree->Write("nameTree");
472  defaultTreeX->Fill();
473  defaultTreeX->Write("iterTreeX");
474  defaultTreeY->Fill();
475  defaultTreeY->Write("iterTreeY");
476 
477  defaultFile->Close();
478  delete defaultFile;
479  for (unsigned int i = 0; i < a_defaultSectorX.size(); i++) {
480  delete a_defaultSectorX[i];
481  delete a_defaultSectorY[i];
482  delete a_sectorName[i];
483  }
484 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::map< unsigned int, TrackerSectorStruct > m_tkSector_
const edm::ESGetToken< AlignmentErrorsExtended, TrackerAlignmentErrorExtendedRcd > alignmentErrorToken_
Log< level::Info, false > LogInfo
std::vector< AlignTransformErrorExtended > m_alignError
const std::string resultFile_

◆ beginJob()

void ApeTreeCreateDefault::beginJob ( )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 487 of file ApeTreeCreateDefault.cc.

References sectorBuilder().

487 { this->sectorBuilder(); }

◆ checkIntervalsForSectors()

bool ApeTreeCreateDefault::checkIntervalsForSectors ( const unsigned int  sectorCounter,
const std::vector< double > &  v_id 
) const
private

Definition at line 324 of file ApeTreeCreateDefault.cc.

References mps_splice::entry.

Referenced by sectorBuilder().

325  {
326  if (v_id.empty())
327  return true;
328  if (v_id.size() % 2 == 1) {
329  edm::LogError("SectorBuilder")
330  << "Incorrect Sector Definition: Position Vectors need even number of arguments (Intervals)"
331  << "\n... sector selection is not applied, sector " << sectorCounter << " is not built";
332  return false;
333  }
334  int entry(0);
335  double intervalBegin(999.);
336  for (auto const& i_id : v_id) {
337  ++entry;
338  if (entry % 2 == 1)
339  intervalBegin = i_id;
340  if (entry % 2 == 0 && intervalBegin > i_id) {
341  edm::LogError("SectorBuilder") << "Incorrect Sector Definition (Position Vector Intervals): \t" << intervalBegin
342  << " is bigger than " << i_id << " but is expected to be smaller"
343  << "\n... sector selection is not applied, sector " << sectorCounter
344  << " is not built";
345  return false;
346  }
347  }
348  return true;
349 }
Log< level::Error, false > LogError

◆ checkModuleBools()

bool ApeTreeCreateDefault::checkModuleBools ( const bool  id,
const std::vector< unsigned int > &  v_id 
) const
private

Definition at line 361 of file ApeTreeCreateDefault.cc.

Referenced by sectorBuilder().

361  {
362  if (v_id.empty())
363  return true;
364  for (auto const& i_id : v_id) {
365  if (1 == i_id && id)
366  return true;
367  if (2 == i_id && !id)
368  return true;
369  }
370  return false;
371 }

◆ checkModuleDirections()

bool ApeTreeCreateDefault::checkModuleDirections ( const int  id,
const std::vector< int > &  v_id 
) const
private

Definition at line 373 of file ApeTreeCreateDefault.cc.

Referenced by sectorBuilder().

373  {
374  if (v_id.empty())
375  return true;
376  for (auto const& i_id : v_id) {
377  if (id == i_id)
378  return true;
379  }
380  return false;
381 }

◆ checkModuleIds()

bool ApeTreeCreateDefault::checkModuleIds ( const unsigned int  id,
const std::vector< unsigned int > &  v_id 
) const
private

Definition at line 351 of file ApeTreeCreateDefault.cc.

Referenced by sectorBuilder().

351  {
352  if (v_id.empty())
353  return true;
354  for (auto const& i_id : v_id) {
355  if (id == i_id)
356  return true;
357  }
358  return false;
359 }

◆ checkModulePositions()

bool ApeTreeCreateDefault::checkModulePositions ( const float  id,
const std::vector< double > &  v_id 
) const
private

Definition at line 383 of file ApeTreeCreateDefault.cc.

References mps_splice::entry.

Referenced by sectorBuilder().

383  {
384  if (v_id.empty())
385  return true;
386  int entry(0);
387  double intervalBegin(999.);
388  for (auto const& i_id : v_id) {
389  ++entry;
390  if (entry % 2 == 1)
391  intervalBegin = i_id;
392  if (entry % 2 == 0 && id >= intervalBegin && id < i_id)
393  return true;
394  }
395  return false;
396 }

◆ endJob()

void ApeTreeCreateDefault::endJob ( )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 490 of file ApeTreeCreateDefault.cc.

Referenced by o2olib.O2ORunMgr::executeJob().

490 {}

◆ fillDescriptions()

void ApeTreeCreateDefault::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 492 of file ApeTreeCreateDefault.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, nano_mu_digi_cff::sector, and AlCaHLTBitMon_QueryRunRegistry::string.

492  {
495 
496  std::vector<unsigned> emptyUnsignedIntVector;
497  std::vector<int> emptyIntVector;
498  std::vector<double> emptyDoubleVector;
499  sector.add<std::string>("name", "default");
500  sector.add<std::vector<unsigned>>("rawId", emptyUnsignedIntVector);
501  sector.add<std::vector<unsigned>>("subdetId", emptyUnsignedIntVector);
502  sector.add<std::vector<unsigned>>("layer", emptyUnsignedIntVector);
503  sector.add<std::vector<unsigned>>("side", emptyUnsignedIntVector);
504  sector.add<std::vector<unsigned>>("half", emptyUnsignedIntVector);
505  sector.add<std::vector<unsigned>>("rod", emptyUnsignedIntVector);
506  sector.add<std::vector<unsigned>>("ring", emptyUnsignedIntVector);
507  sector.add<std::vector<unsigned>>("petal", emptyUnsignedIntVector);
508  sector.add<std::vector<unsigned>>("blade", emptyUnsignedIntVector);
509  sector.add<std::vector<unsigned>>("panel", emptyUnsignedIntVector);
510  sector.add<std::vector<unsigned>>("outerInner", emptyUnsignedIntVector);
511  sector.add<std::vector<unsigned>>("module", emptyUnsignedIntVector);
512  sector.add<std::vector<unsigned>>("nStrips", emptyUnsignedIntVector);
513  sector.add<std::vector<unsigned>>("isDoubleSide", emptyUnsignedIntVector);
514  sector.add<std::vector<unsigned>>("isRPhi", emptyUnsignedIntVector);
515  sector.add<std::vector<unsigned>>("isStereo", emptyUnsignedIntVector);
516  sector.add<std::vector<int>>("uDirection", emptyIntVector);
517  sector.add<std::vector<int>>("vDirection", emptyIntVector);
518  sector.add<std::vector<int>>("wDirection", emptyIntVector);
519  sector.add<std::vector<double>>("posR", emptyDoubleVector);
520  sector.add<std::vector<double>>("posPhi", emptyDoubleVector);
521  sector.add<std::vector<double>>("posEta", emptyDoubleVector);
522  sector.add<std::vector<double>>("posX", emptyDoubleVector);
523  sector.add<std::vector<double>>("posY", emptyDoubleVector);
524  sector.add<std::vector<double>>("posZ", emptyDoubleVector);
525 
526  desc.add<std::string>("resultFile", "defaultAPE.root");
527  desc.add<std::string>("trackerTreeFile");
528  desc.addVPSet("sectors", sector);
529 
530  descriptions.add("apeTreeCreateDefault", desc);
531 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ sectorBuilder()

void ApeTreeCreateDefault::sectorBuilder ( )
private

Definition at line 115 of file ApeTreeCreateDefault.cc.

References checkIntervalsForSectors(), checkModuleBools(), checkModuleDirections(), checkModuleIds(), checkModulePositions(), F(), fastTrackerRecHitType::isPixel(), TrackerSectorStruct::isPixel, nano_mu_digi_cff::layer, m_tkSector_, m_tkTreeVar_, callgraph::module, TrackerSectorStruct::name, noSectors, ReducedTrackerTreeVariables::nStrips, me0TriggerPseudoDigis_cff::nStrips, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, RecoTauValidation_cfi::posX, RecoTauValidation_cfi::posY, nano_mu_digi_cff::rawId, relativeConstraints::ring, sectors_, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::side(), AlCaHLTBitMon_QueryRunRegistry::string, ReducedTrackerTreeVariables::subdetId, StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, trackerTreeFile_, ReducedTrackerTreeVariables::uDirection, TrackerSectorStruct::v_rawId, ReducedTrackerTreeVariables::vDirection, and ReducedTrackerTreeVariables::wDirection.

Referenced by beginJob().

115  {
116  // Same procedure as in ApeEstimator.cc
117  TFile* tkTreeFile(TFile::Open(trackerTreeFile_.c_str()));
118  if (tkTreeFile) {
119  edm::LogInfo("SectorBuilder") << "TrackerTreeFile OK";
120  } else {
121  edm::LogError("SectorBuilder") << "TrackerTreeFile not found";
122  return;
123  }
124  TTree* tkTree(nullptr);
125  tkTreeFile->GetObject("TrackerTreeGenerator/TrackerTree/TrackerTree", tkTree);
126  if (tkTree) {
127  edm::LogInfo("SectorBuilder") << "TrackerTree OK";
128  } else {
129  edm::LogError("SectorBuilder") << "TrackerTree not found in file";
130  return;
131  }
132 
133  unsigned int rawId(999), subdetId(999), layer(999), side(999), half(999), rod(999), ring(999), petal(999), blade(999),
134  panel(999), outerInner(999), module(999), nStrips(999);
135  bool isDoubleSide(false), isRPhi(false), isStereo(false);
136  int uDirection(999), vDirection(999), wDirection(999);
137  float posR(999.F), posPhi(999.F), posEta(999.F), posX(999.F), posY(999.F), posZ(999.F);
138 
139  tkTree->SetBranchAddress("RawId", &rawId);
140  tkTree->SetBranchAddress("SubdetId", &subdetId);
141  tkTree->SetBranchAddress("Layer", &layer);
142  tkTree->SetBranchAddress("Side", &side);
143  tkTree->SetBranchAddress("Half", &half);
144  tkTree->SetBranchAddress("Rod", &rod);
145  tkTree->SetBranchAddress("Ring", &ring);
146  tkTree->SetBranchAddress("Petal", &petal);
147  tkTree->SetBranchAddress("Blade", &blade);
148  tkTree->SetBranchAddress("Panel", &panel);
149  tkTree->SetBranchAddress("OuterInner", &outerInner);
150  tkTree->SetBranchAddress("Module", &module);
151  tkTree->SetBranchAddress("NStrips", &nStrips);
152  tkTree->SetBranchAddress("IsDoubleSide", &isDoubleSide);
153  tkTree->SetBranchAddress("IsRPhi", &isRPhi);
154  tkTree->SetBranchAddress("IsStereo", &isStereo);
155  tkTree->SetBranchAddress("UDirection", &uDirection);
156  tkTree->SetBranchAddress("VDirection", &vDirection);
157  tkTree->SetBranchAddress("WDirection", &wDirection);
158  tkTree->SetBranchAddress("PosR", &posR);
159  tkTree->SetBranchAddress("PosPhi", &posPhi);
160  tkTree->SetBranchAddress("PosEta", &posEta);
161  tkTree->SetBranchAddress("PosX", &posX);
162  tkTree->SetBranchAddress("PosY", &posY);
163  tkTree->SetBranchAddress("PosZ", &posZ);
164 
165  int nModules(tkTree->GetEntries());
166  TrackerSectorStruct allSectors;
167 
168  //Loop over all Sectors
169  unsigned int sectorCounter(0);
170  std::vector<edm::ParameterSet> v_sectorDef(sectors_);
171  edm::LogInfo("SectorBuilder") << "There are " << v_sectorDef.size() << " Sectors defined";
172 
173  for (auto const& parSet : v_sectorDef) {
174  ++sectorCounter;
175  const std::string& sectorName(parSet.getParameter<std::string>("name"));
176  std::vector<unsigned int> v_rawId(parSet.getParameter<std::vector<unsigned int>>("rawId")),
177  v_subdetId(parSet.getParameter<std::vector<unsigned int>>("subdetId")),
178  v_layer(parSet.getParameter<std::vector<unsigned int>>("layer")),
179  v_side(parSet.getParameter<std::vector<unsigned int>>("side")),
180  v_half(parSet.getParameter<std::vector<unsigned int>>("half")),
181  v_rod(parSet.getParameter<std::vector<unsigned int>>("rod")),
182  v_ring(parSet.getParameter<std::vector<unsigned int>>("ring")),
183  v_petal(parSet.getParameter<std::vector<unsigned int>>("petal")),
184  v_blade(parSet.getParameter<std::vector<unsigned int>>("blade")),
185  v_panel(parSet.getParameter<std::vector<unsigned int>>("panel")),
186  v_outerInner(parSet.getParameter<std::vector<unsigned int>>("outerInner")),
187  v_module(parSet.getParameter<std::vector<unsigned int>>("module")),
188  v_nStrips(parSet.getParameter<std::vector<unsigned int>>("nStrips")),
189  v_isDoubleSide(parSet.getParameter<std::vector<unsigned int>>("isDoubleSide")),
190  v_isRPhi(parSet.getParameter<std::vector<unsigned int>>("isRPhi")),
191  v_isStereo(parSet.getParameter<std::vector<unsigned int>>("isStereo"));
192  std::vector<int> v_uDirection(parSet.getParameter<std::vector<int>>("uDirection")),
193  v_vDirection(parSet.getParameter<std::vector<int>>("vDirection")),
194  v_wDirection(parSet.getParameter<std::vector<int>>("wDirection"));
195  std::vector<double> v_posR(parSet.getParameter<std::vector<double>>("posR")),
196  v_posPhi(parSet.getParameter<std::vector<double>>("posPhi")),
197  v_posEta(parSet.getParameter<std::vector<double>>("posEta")),
198  v_posX(parSet.getParameter<std::vector<double>>("posX")),
199  v_posY(parSet.getParameter<std::vector<double>>("posY")),
200  v_posZ(parSet.getParameter<std::vector<double>>("posZ"));
201 
202  if (!this->checkIntervalsForSectors(sectorCounter, v_posR) ||
203  !this->checkIntervalsForSectors(sectorCounter, v_posPhi) ||
204  !this->checkIntervalsForSectors(sectorCounter, v_posEta) ||
205  !this->checkIntervalsForSectors(sectorCounter, v_posX) ||
206  !this->checkIntervalsForSectors(sectorCounter, v_posY) ||
207  !this->checkIntervalsForSectors(sectorCounter, v_posZ)) {
208  continue;
209  }
210 
211  TrackerSectorStruct tkSector;
212  tkSector.name = sectorName;
213 
214  ReducedTrackerTreeVariables tkTreeVar;
215 
216  //Loop over all Modules
217  for (int module = 0; module < nModules; ++module) {
218  tkTree->GetEntry(module);
219 
220  if (sectorCounter == 1) {
221  tkTreeVar.subdetId = subdetId;
222  tkTreeVar.nStrips = nStrips;
223  tkTreeVar.uDirection = uDirection;
224  tkTreeVar.vDirection = vDirection;
225  tkTreeVar.wDirection = wDirection;
226  m_tkTreeVar_[rawId] = tkTreeVar;
227  }
228  //Check if modules from Sector builder equal those from TrackerTree
229  if (!this->checkModuleIds(rawId, v_rawId))
230  continue;
231  if (!this->checkModuleIds(subdetId, v_subdetId))
232  continue;
233  if (!this->checkModuleIds(layer, v_layer))
234  continue;
235  if (!this->checkModuleIds(side, v_side))
236  continue;
237  if (!this->checkModuleIds(half, v_half))
238  continue;
239  if (!this->checkModuleIds(rod, v_rod))
240  continue;
241  if (!this->checkModuleIds(ring, v_ring))
242  continue;
243  if (!this->checkModuleIds(petal, v_petal))
244  continue;
245  if (!this->checkModuleIds(blade, v_blade))
246  continue;
247  if (!this->checkModuleIds(panel, v_panel))
248  continue;
249  if (!this->checkModuleIds(outerInner, v_outerInner))
250  continue;
251  if (!this->checkModuleIds(module, v_module))
252  continue;
253  if (!this->checkModuleIds(nStrips, v_nStrips))
254  continue;
255  if (!this->checkModuleBools(isDoubleSide, v_isDoubleSide))
256  continue;
257  if (!this->checkModuleBools(isRPhi, v_isRPhi))
258  continue;
259  if (!this->checkModuleBools(isStereo, v_isStereo))
260  continue;
261  if (!this->checkModuleDirections(uDirection, v_uDirection))
262  continue;
263  if (!this->checkModuleDirections(vDirection, v_vDirection))
264  continue;
265  if (!this->checkModuleDirections(wDirection, v_wDirection))
266  continue;
267  if (!this->checkModulePositions(posR, v_posR))
268  continue;
269  if (!this->checkModulePositions(posPhi, v_posPhi))
270  continue;
271  if (!this->checkModulePositions(posEta, v_posEta))
272  continue;
273  if (!this->checkModulePositions(posX, v_posX))
274  continue;
275  if (!this->checkModulePositions(posY, v_posY))
276  continue;
277  if (!this->checkModulePositions(posZ, v_posZ))
278  continue;
279 
280  tkSector.v_rawId.push_back(rawId);
281  bool moduleSelected(false);
282  for (auto const& i_rawId : allSectors.v_rawId) {
283  if (rawId == i_rawId)
284  moduleSelected = true;
285  }
286  if (!moduleSelected)
287  allSectors.v_rawId.push_back(rawId);
288  }
289 
290  // Stops you from combining pixel and strip detector into one sector
291  bool isPixel(false);
292  bool isStrip(false);
293  for (auto const& i_rawId : tkSector.v_rawId) {
294  switch (m_tkTreeVar_[i_rawId].subdetId) {
297  isPixel = true;
298  break;
303  isStrip = true;
304  break;
305  }
306  }
307 
308  if (isPixel && isStrip) {
309  edm::LogError("SectorBuilder")
310  << "Incorrect Sector Definition: there are pixel and strip modules within one sector"
311  << "\n... sector selection is not applied, sector " << sectorCounter << " is not built";
312  continue;
313  }
314  tkSector.isPixel = isPixel;
315 
316  m_tkSector_[sectorCounter] = tkSector;
317  edm::LogInfo("SectorBuilder") << "There are " << tkSector.v_rawId.size() << " Modules in Sector " << sectorCounter;
318  }
319  noSectors = sectorCounter;
320  return;
321 }
static constexpr auto TEC
const std::vector< edm::ParameterSet > sectors_
std::map< unsigned int, ReducedTrackerTreeVariables > m_tkTreeVar_
std::map< unsigned int, TrackerSectorStruct > m_tkSector_
Log< level::Error, false > LogError
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
bool checkModuleDirections(const int, const std::vector< int > &) const
const std::string trackerTreeFile_
static constexpr auto TOB
bool checkIntervalsForSectors(const unsigned int sectorCounter, const std::vector< double > &) const
Log< level::Info, false > LogInfo
static constexpr auto TIB
bool checkModuleBools(const bool, const std::vector< unsigned int > &) const
bool isPixel(HitType hitType)
bool checkModuleIds(const unsigned int, const std::vector< unsigned int > &) const
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
bool checkModulePositions(const float, const std::vector< double > &) const
static constexpr auto TID
std::vector< unsigned int > v_rawId

Member Data Documentation

◆ alignmentErrorToken_

const edm::ESGetToken<AlignmentErrorsExtended, TrackerAlignmentErrorExtendedRcd> ApeTreeCreateDefault::alignmentErrorToken_
private

Definition at line 83 of file ApeTreeCreateDefault.cc.

Referenced by analyze().

◆ m_tkSector_

std::map<unsigned int, TrackerSectorStruct> ApeTreeCreateDefault::m_tkSector_
private

Definition at line 88 of file ApeTreeCreateDefault.cc.

Referenced by analyze(), and sectorBuilder().

◆ m_tkTreeVar_

std::map<unsigned int, ReducedTrackerTreeVariables> ApeTreeCreateDefault::m_tkTreeVar_
private

Definition at line 89 of file ApeTreeCreateDefault.cc.

Referenced by sectorBuilder().

◆ noSectors

unsigned int ApeTreeCreateDefault::noSectors
private

Definition at line 90 of file ApeTreeCreateDefault.cc.

Referenced by sectorBuilder().

◆ resultFile_

const std::string ApeTreeCreateDefault::resultFile_
private

Definition at line 84 of file ApeTreeCreateDefault.cc.

Referenced by analyze().

◆ sectors_

const std::vector<edm::ParameterSet> ApeTreeCreateDefault::sectors_
private

Definition at line 86 of file ApeTreeCreateDefault.cc.

Referenced by sectorBuilder().

◆ trackerTreeFile_

const std::string ApeTreeCreateDefault::trackerTreeFile_
private

Definition at line 85 of file ApeTreeCreateDefault.cc.

Referenced by sectorBuilder().