CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
TrackerOfflineValidationSummary Class Reference

#include <Alignment/TrackerOfflineValidationSummary/src/TrackerOfflineValidationSummary.cc>

Inheritance diagram for TrackerOfflineValidationSummary:
edm::one::EDAnalyzer< edm::one::WatchRuns > edm::one::EDAnalyzerBase edm::EDConsumerBase

Classes

struct  HarvestingHierarchy
 
struct  HarvestingHistos
 Put here the histograms created during harvesting. More...
 
struct  ModuleHistos
 

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 TrackerOfflineValidationSummary (const edm::ParameterSet &)
 
 ~TrackerOfflineValidationSummary () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &evt, const edm::EventSetup &) override
 
void applyHarvestingHierarchy (TTree &treeMem)
 
const std::string associateModuleHistsWithTree (const TkOffTreeVariables &treeMem, TrackerOfflineValidationSummary::ModuleHistos &moduleHists, std::map< std::string, std::string > &substructureName)
 
void beginRun (const edm::Run &, const edm::EventSetup &iSetup) override
 
void bookHarvestingHists ()
 
void collateHarvestingHists (TTree &tree)
 
void endJob () override
 
void endRun (const edm::Run &, const edm::EventSetup &iSetup) override
 
void fillHarvestingHists (TTree &tree)
 
void fillTree (TTree &tree, std::map< int, TrackerOfflineValidationSummary::ModuleHistos > &moduleHist, TkOffTreeVariables &treeMem, const TrackerGeometry &tkgeom, std::map< std::string, std::string > &substructureName, const TrackerTopology *tTopo)
 
std::pair< float, float > fitResiduals (TH1 *hist) const
 
void getBinning (const std::string &binningPSetName, int &nBinsX, double &lowerBoundX, double &upperBoundX) const
 
float getMedian (const TH1 *hist) const
 

Private Attributes

DQMStoredbe_
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordgeomToken_
 
const std::string moduleDirectory_
 
bool moduleMapsInitialized
 
std::map< int, TrackerOfflineValidationSummary::ModuleHistosmPxbResiduals_
 
std::map< int, TrackerOfflineValidationSummary::ModuleHistosmPxeResiduals_
 
std::map< int, TrackerOfflineValidationSummary::ModuleHistosmTecResiduals_
 
std::map< int, TrackerOfflineValidationSummary::ModuleHistosmTibResiduals_
 
std::map< int, TrackerOfflineValidationSummary::ModuleHistosmTidResiduals_
 
std::map< int, TrackerOfflineValidationSummary::ModuleHistosmTobResiduals_
 
const edm::ParameterSet parSet_
 
edm::ESHandle< TrackerGeometrytkGeom_
 
std::unique_ptr< TrackerTopologytTopo_
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtTopoToken_
 
const bool useFit_
 
std::vector< HarvestingHierarchyvHarvestingHierarchy_
 

Additional Inherited Members

- 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)
 
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 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<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 58 of file TrackerOfflineValidationSummary.cc.

Member Typedef Documentation

◆ DQMStore

Definition at line 60 of file TrackerOfflineValidationSummary.cc.

Constructor & Destructor Documentation

◆ TrackerOfflineValidationSummary()

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

Definition at line 151 of file TrackerOfflineValidationSummary.cc.

References dbe_, and Utilities::operator.

152  : geomToken_(esConsumes()),
153  tTopoToken_(esConsumes<edm::Transition::EndRun>()),
154  parSet_(iConfig),
155  tTopo_(nullptr),
156  moduleDirectory_(parSet_.getParameter<std::string>("moduleDirectoryInOutput")),
157  useFit_(parSet_.getParameter<bool>("useFit")),
158  dbe_(nullptr),
159  moduleMapsInitialized(false) {
160  //now do what ever initialization is needed
162 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
std::unique_ptr< TrackerTopology > tTopo_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_

◆ ~TrackerOfflineValidationSummary()

TrackerOfflineValidationSummary::~TrackerOfflineValidationSummary ( )
overridedefault

Member Function Documentation

◆ analyze()

void TrackerOfflineValidationSummary::analyze ( const edm::Event evt,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 170 of file TrackerOfflineValidationSummary.cc.

References DetId::det(), TrackerGeometry::detIds(), Exception, geomToken_, edm::EventSetup::getHandle(), moduleMapsInitialized, mPxbResiduals_, mPxeResiduals_, mTecResiduals_, mTibResiduals_, mTidResiduals_, mTobResiduals_, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, DetId::rawId(), DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, tkGeom_, and StripSubdetector::TOB.

170  {
171  // Access of EventSetup is needed to get the list of silicon-modules and their IDs
172  // Since they do not change, it is accessed only once
174  return;
175  tkGeom_ = iSetup.getHandle(geomToken_);
176  const TrackerGeometry* bareTkGeomPtr = &(*tkGeom_);
177 
178  const TrackingGeometry::DetIdContainer& detIdContainer = bareTkGeomPtr->detIds();
179  std::vector<DetId>::const_iterator iDet;
180  for (iDet = detIdContainer.begin(); iDet != detIdContainer.end(); ++iDet) {
181  const DetId& detId = *iDet;
182  const uint32_t rawId = detId.rawId();
183  const unsigned int subdetId = detId.subdetId();
184  if (subdetId == PixelSubdetector::PixelBarrel)
185  mPxbResiduals_[rawId];
186  else if (subdetId == PixelSubdetector::PixelEndcap)
187  mPxeResiduals_[rawId];
188  else if (subdetId == StripSubdetector::TIB)
189  mTibResiduals_[rawId];
190  else if (subdetId == StripSubdetector::TID)
191  mTidResiduals_[rawId];
192  else if (subdetId == StripSubdetector::TOB)
193  mTobResiduals_[rawId];
194  else if (subdetId == StripSubdetector::TEC)
195  mTecResiduals_[rawId];
196  else {
197  throw cms::Exception("Geometry Error")
198  << "[TrackerOfflineValidationSummary] Error, tried to get reference for non-tracker subdet " << subdetId
199  << " from detector " << detId.det();
200  }
201  }
202  moduleMapsInitialized = true;
203 }
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mTobResiduals_
static constexpr auto TEC
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
edm::ESHandle< TrackerGeometry > tkGeom_
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mTibResiduals_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static constexpr auto TOB
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mTecResiduals_
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mPxbResiduals_
Definition: DetId.h:17
static constexpr auto TIB
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::vector< DetId > DetIdContainer
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mPxeResiduals_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mTidResiduals_
static constexpr auto TID

◆ applyHarvestingHierarchy()

void TrackerOfflineValidationSummary::applyHarvestingHierarchy ( TTree &  treeMem)
private

Definition at line 724 of file TrackerOfflineValidationSummary.cc.

References bookHarvestingHists(), TkOffTreeVariables::isDoubleSide, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, TkOffTreeVariables::side, AlCaHLTBitMon_QueryRunRegistry::string, TkOffTreeVariables::subDetId, StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, and vHarvestingHierarchy_.

Referenced by collateHarvestingHists().

724  {
725  TkOffTreeVariables* treeMemPtr = nullptr;
726  std::map<std::string, std::string>* substructureName = nullptr;
727  tree.SetBranchAddress("TkOffTreeVariables", &treeMemPtr);
728  tree.SetBranchAddress("SubstructureName", &substructureName);
729 
730  // Loop over modules to select accumulation criteria for harvesting plots
731  for (unsigned int iSubdet = 1; iSubdet < 7; ++iSubdet) {
732  std::string hierarchyName("");
733  std::string componentName("");
734  std::vector<unsigned int> treeEntries;
735  for (unsigned int iSide = 1; iSide < 3; ++iSide) {
736  // Set up only one collection for Barrels, not separated for side
737  if (iSide == 1 && (iSubdet == PixelSubdetector::PixelBarrel || iSubdet == StripSubdetector::TIB ||
738  iSubdet == StripSubdetector::TOB))
739  continue;
740  for (int iTree = 0; iTree < tree.GetEntries(); ++iTree) {
741  tree.GetEntry(iTree);
742  // Do not use glued Dets
743  if (treeMemPtr->isDoubleSide)
744  continue;
745  if (treeMemPtr->subDetId == iSubdet) {
746  if (iSide != treeMemPtr->side && (iSubdet == PixelSubdetector::PixelEndcap ||
747  iSubdet == StripSubdetector::TID || iSubdet == StripSubdetector::TEC))
748  continue;
749  treeEntries.push_back(iTree);
750  if (hierarchyName.length() == 0) {
751  hierarchyName = (*substructureName)["subdet"];
752  componentName = (*substructureName)["component"];
753  }
754  }
755  }
756  HarvestingHierarchy harvestingHierarchy(hierarchyName, componentName, treeEntries);
757  vHarvestingHierarchy_.push_back(harvestingHierarchy);
758  hierarchyName = "";
759  componentName = "";
760  treeEntries.clear();
761  }
762  }
763  // Here could be a further separation of the HarvestingHierarchy.
764  // E.g. separate the existing ones by layer and add them to the vector without deleting any element from the vector.
765  // The existing hists will stay and the new ones are added
766 
767  // Now, book the corresponding histos
768  this->bookHarvestingHists();
769 }
static constexpr auto TEC
container to hold data to be written into TTree
std::vector< HarvestingHierarchy > vHarvestingHierarchy_
static constexpr auto TOB
static constexpr auto TIB
Definition: tree.py:1
static constexpr auto TID

◆ associateModuleHistsWithTree()

const std::string TrackerOfflineValidationSummary::associateModuleHistsWithTree ( const TkOffTreeVariables treeMem,
TrackerOfflineValidationSummary::ModuleHistos moduleHists,
std::map< std::string, std::string > &  substructureName 
)
private

Definition at line 478 of file TrackerOfflineValidationSummary.cc.

References TkOffTreeVariables::blade, dbe_, contentValuesFiles::fullPath, dqm::implementation::IGetter::get(), dqm::legacy::MonitorElement::getTH1(), TkOffTreeVariables::half, L1TStage2EMTFEventInfoClient_cfi::histDir, TkOffTreeVariables::isDoubleSide, PVValHelper::ladder, TkOffTreeVariables::layer, phase1PixelTopology::layer, TkOffTreeVariables::module, moduleDirectory_, TkOffTreeVariables::moduleId, TrackerOfflineValidationSummary::ModuleHistos::NormResHisto, TrackerOfflineValidationSummary::ModuleHistos::NormResXprimeHisto, TrackerOfflineValidationSummary::ModuleHistos::NormResYprimeHisto, TkOffTreeVariables::outerInner, TkOffTreeVariables::panel, TkOffTreeVariables::petal, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, TrackerOfflineValidationSummary::ModuleHistos::ResHisto, TrackerOfflineValidationSummary::ModuleHistos::ResXprimeHisto, TrackerOfflineValidationSummary::ModuleHistos::ResYprimeHisto, TkOffTreeVariables::ring, relativeConstraints::ring, TkOffTreeVariables::rod, TkOffTreeVariables::side, AlCaHLTBitMon_QueryRunRegistry::string, TkOffTreeVariables::subDetId, StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, and StripSubdetector::TOB.

Referenced by fillTree().

481  {
482  std::stringstream histDir, sSubdetName;
483  std::string componentName;
484  if (moduleDirectory_.length() != 0)
485  histDir << moduleDirectory_ << "/";
486  std::string wheelOrLayer("_layer_");
487  if (treeMem.subDetId == PixelSubdetector::PixelBarrel) {
488  unsigned int half(treeMem.half), layer(treeMem.layer), ladder(0);
489  if (layer == 1) {
490  if (half == 2)
491  ladder = treeMem.rod - 5;
492  else if (treeMem.rod > 15)
493  ladder = treeMem.rod - 10;
494  else
495  ladder = treeMem.rod;
496  } else if (layer == 2) {
497  if (half == 2)
498  ladder = treeMem.rod - 8;
499  else if (treeMem.rod > 24)
500  ladder = treeMem.rod - 16;
501  else
502  ladder = treeMem.rod;
503  } else if (layer == 3) {
504  if (half == 2)
505  ladder = treeMem.rod - 11;
506  else if (treeMem.rod > 33)
507  ladder = treeMem.rod - 22;
508  else
509  ladder = treeMem.rod;
510  }
511  componentName = "Pixel";
512  sSubdetName << "TPBBarrel_1";
513  histDir << componentName << "/" << sSubdetName.str() << "/TPBHalfBarrel_" << treeMem.half << "/TPBLayer_"
514  << treeMem.layer << "/TPBLadder_" << ladder;
515  } else if (treeMem.subDetId == PixelSubdetector::PixelEndcap) {
516  unsigned int side(treeMem.side), half(treeMem.half), blade(0);
517  if (side == 1)
518  side = 3;
519  if (half == 2)
520  blade = treeMem.blade - 6;
521  else if (treeMem.blade > 18)
522  blade = treeMem.blade - 12;
523  else
524  blade = treeMem.blade;
525  componentName = "Pixel";
526  sSubdetName << "TPEEndcap_" << side;
527  histDir << componentName << "/" << sSubdetName.str() << "/TPEHalfCylinder_" << treeMem.half << "/TPEHalfDisk_"
528  << treeMem.layer << "/TPEBlade_" << blade << "/TPEPanel_" << treeMem.panel;
529  wheelOrLayer = "_wheel_";
530  } else if (treeMem.subDetId == StripSubdetector::TIB) {
531  unsigned int half(treeMem.half), layer(treeMem.layer), surface(treeMem.outerInner), string(0);
532  if (half == 2) {
533  if (layer == 1) {
534  if (surface == 1)
535  string = treeMem.rod - 13;
536  else if (surface == 2)
537  string = treeMem.rod - 15;
538  }
539  if (layer == 2) {
540  if (surface == 1)
541  string = treeMem.rod - 17;
542  else if (surface == 2)
543  string = treeMem.rod - 19;
544  }
545  if (layer == 3) {
546  if (surface == 1)
547  string = treeMem.rod - 22;
548  else if (surface == 2)
549  string = treeMem.rod - 23;
550  }
551  if (layer == 4) {
552  if (surface == 1)
553  string = treeMem.rod - 26;
554  else if (surface == 2)
555  string = treeMem.rod - 28;
556  }
557  } else
558  string = treeMem.rod;
559  std::stringstream detString;
560  if (treeMem.layer < 3 && !treeMem.isDoubleSide)
561  detString << "/Det_" << treeMem.module;
562  else
563  detString << "";
564  componentName = "Strip";
565  sSubdetName << "TIBBarrel_1";
566  histDir << componentName << "/" << sSubdetName.str() << "/TIBHalfBarrel_" << treeMem.side << "/TIBLayer_"
567  << treeMem.layer << "/TIBHalfShell_" << treeMem.half << "/TIBSurface_" << treeMem.outerInner
568  << "/TIBString_" << string << detString.str();
569  } else if (treeMem.subDetId == StripSubdetector::TID) {
570  unsigned int side(treeMem.side), outerInner(0);
571  if (side == 1)
572  side = 3;
573  if (treeMem.outerInner == 1)
574  outerInner = 2;
575  else if (treeMem.outerInner == 2)
576  outerInner = 1;
577  std::stringstream detString;
578  if (treeMem.ring < 3 && !treeMem.isDoubleSide)
579  detString << "/Det_" << treeMem.module;
580  else
581  detString << "";
582  componentName = "Strip";
583  sSubdetName << "TIDEndcap_" << side;
584  histDir << componentName << "/" << sSubdetName.str() << "/TIDDisk_" << treeMem.layer << "/TIDRing_" << treeMem.ring
585  << "/TIDSide_" << outerInner << detString.str();
586  wheelOrLayer = "_wheel_";
587  } else if (treeMem.subDetId == StripSubdetector::TOB) {
588  std::stringstream detString;
589  if (treeMem.layer < 3 && !treeMem.isDoubleSide)
590  detString << "/Det_" << treeMem.module;
591  else
592  detString << "";
593  componentName = "Strip";
594  sSubdetName << "TOBBarrel_4";
595  histDir << componentName << "/" << sSubdetName.str() << "/TOBHalfBarrel_" << treeMem.side << "/TOBLayer_"
596  << treeMem.layer << "/TOBRod_" << treeMem.rod << detString.str();
597  } else if (treeMem.subDetId == StripSubdetector::TEC) {
598  unsigned int side(0), outerInner(0), ring(0);
599  if (treeMem.side == 1)
600  side = 6;
601  else if (treeMem.side == 2)
602  side = 5;
603  if (treeMem.outerInner == 1)
604  outerInner = 2;
605  else if (treeMem.outerInner == 2)
606  outerInner = 1;
607  if (treeMem.layer > 3 && treeMem.layer < 7)
608  ring = treeMem.ring - 1;
609  else if (treeMem.layer == 7 || treeMem.layer == 8)
610  ring = treeMem.ring - 2;
611  else if (treeMem.layer == 9)
612  ring = treeMem.ring - 3;
613  else
614  ring = treeMem.ring;
615  std::stringstream detString;
616  if ((treeMem.ring < 3 || treeMem.ring == 5) && !treeMem.isDoubleSide)
617  detString << "/Det_" << treeMem.module;
618  else
619  detString << "";
620  componentName = "Strip";
621  sSubdetName << "TECEndcap_" << side;
622  histDir << componentName << "/" << sSubdetName.str() << "/TECDisk_" << treeMem.layer << "/TECSide_" << outerInner
623  << "/TECPetal_" << treeMem.petal << "/TECRing_" << ring << detString.str();
624  wheelOrLayer = "_wheel_";
625  }
626 
627  substructureName["component"] = componentName;
628  substructureName["subdet"] = sSubdetName.str();
629 
630  std::stringstream histName;
631  histName << "residuals_subdet_" << treeMem.subDetId << wheelOrLayer << treeMem.layer << "_module_"
632  << treeMem.moduleId;
633 
635  fullPath = histDir.str() + "/h_xprime_" + histName.str();
636  if (dbe_->get(fullPath))
637  moduleHists.ResXprimeHisto = dbe_->get(fullPath)->getTH1();
638  else {
639  edm::LogError("TrackerOfflineValidationSummary")
640  << "Problem with names in input file produced in TrackerOfflineValidation ...\n"
641  << "This histogram should exist in every configuration, "
642  << "but no histogram with name " << fullPath << " is found!";
643  return "";
644  }
645  fullPath = histDir.str() + "/h_normxprime" + histName.str();
646  if (dbe_->get(fullPath))
647  moduleHists.NormResXprimeHisto = dbe_->get(fullPath)->getTH1();
648  fullPath = histDir.str() + "/h_yprime_" + histName.str();
649  if (dbe_->get(fullPath))
650  moduleHists.ResYprimeHisto = dbe_->get(fullPath)->getTH1();
651  fullPath = histDir.str() + "/h_normyprime" + histName.str();
652  if (dbe_->get(fullPath))
653  moduleHists.NormResYprimeHisto = dbe_->get(fullPath)->getTH1();
654  fullPath = histDir.str() + "/h_" + histName.str();
655  if (dbe_->get(fullPath))
656  moduleHists.ResHisto = dbe_->get(fullPath)->getTH1();
657  fullPath = histDir.str() + "/h_norm" + histName.str();
658  if (dbe_->get(fullPath))
659  moduleHists.NormResHisto = dbe_->get(fullPath)->getTH1();
660 
661  return histDir.str();
662 }
static constexpr auto TEC
Log< level::Error, false > LogError
constexpr std::array< uint8_t, layerIndexSize > layer
static constexpr auto TOB
histDir
Location of output EventInfo/reportSummaryContents.
static constexpr auto TIB
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:673
virtual TH1 * getTH1() const
static constexpr auto TID

◆ beginRun()

void TrackerOfflineValidationSummary::beginRun ( const edm::Run ,
const edm::EventSetup iSetup 
)
inlineoverrideprivate

Definition at line 99 of file TrackerOfflineValidationSummary.cc.

99 {};

◆ bookHarvestingHists()

void TrackerOfflineValidationSummary::bookHarvestingHists ( )
private

Definition at line 771 of file TrackerOfflineValidationSummary.cc.

References dqm::implementation::IBooker::book1D(), dbe_, getBinning(), edm::ParameterSet::getParameter(), moduleDirectory_, parSet_, dqm::implementation::DQMStore::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, vHarvestingHierarchy_, multiplicitycorr_cfi::xMax, and photonAnalyzer_cfi::xMin.

Referenced by applyHarvestingHierarchy().

771  {
772  edm::LogInfo("TrackerOfflineValidationSummary") << "Harvesting histograms will be booked for "
773  << vHarvestingHierarchy_.size() << " different hierarchy selections";
774  for (std::vector<HarvestingHierarchy>::iterator iHier = vHarvestingHierarchy_.begin();
775  iHier != vHarvestingHierarchy_.end();
776  ++iHier) {
777  std::stringstream dmrXprimeHistoName, dmrYprimeHistoName, dmrXprimeHistoTitle, dmrYprimeHistoTitle;
778  dmrXprimeHistoName << "h_DmrXprime_" << iHier->hierarchyName;
779  dmrYprimeHistoName << "h_DmrYprime_" << iHier->hierarchyName;
780  dmrXprimeHistoTitle << "DMR for " << iHier->hierarchyName << ";<#DeltaX> [cm];# modules";
781  dmrYprimeHistoTitle << "DMR for " << iHier->hierarchyName << ";<#DeltaY> [cm];# modules";
782 
783  std::string directoryString(moduleDirectory_);
784  if (directoryString.length() != 0)
785  directoryString += "/";
786  directoryString += iHier->componentName;
787  dbe_->setCurrentFolder(directoryString);
788 
789  int nBinsX(0);
790  double xMin(0.), xMax(0.);
791  if (iHier->componentName == "Pixel") {
792  this->getBinning("TH1DmrXprimePixelModules", nBinsX, xMin, xMax);
793  iHier->harvestingHistos.DmrXprime =
794  dbe_->book1D(dmrXprimeHistoName.str(), dmrXprimeHistoTitle.str(), nBinsX, xMin, xMax)->getTH1();
795  this->getBinning("TH1DmrYprimePixelModules", nBinsX, xMin, xMax);
796  iHier->harvestingHistos.DmrYprime =
797  dbe_->book1D(dmrYprimeHistoName.str(), dmrYprimeHistoTitle.str(), nBinsX, xMin, xMax)->getTH1();
798  } else if (iHier->componentName == "Strip") {
799  this->getBinning("TH1DmrXprimeStripModules", nBinsX, xMin, xMax);
800  iHier->harvestingHistos.DmrXprime =
801  dbe_->book1D(dmrXprimeHistoName.str(), dmrXprimeHistoTitle.str(), nBinsX, xMin, xMax)->getTH1();
802  if (!parSet_.getParameter<bool>("stripYDmrs"))
803  continue;
804  this->getBinning("TH1DmrYprimeStripModules", nBinsX, xMin, xMax);
805  iHier->harvestingHistos.DmrYprime =
806  dbe_->book1D(dmrYprimeHistoName.str(), dmrYprimeHistoTitle.str(), nBinsX, xMin, xMax)->getTH1();
807  }
808  }
809 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:646
std::vector< HarvestingHierarchy > vHarvestingHierarchy_
void getBinning(const std::string &binningPSetName, int &nBinsX, double &lowerBoundX, double &upperBoundX) const
Log< level::Info, false > LogInfo
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ collateHarvestingHists()

void TrackerOfflineValidationSummary::collateHarvestingHists ( TTree &  tree)
private

Definition at line 719 of file TrackerOfflineValidationSummary.cc.

References applyHarvestingHierarchy(), and fillHarvestingHists().

Referenced by endJob().

719  {
721  this->fillHarvestingHists(tree);
722 }
Definition: tree.py:1

◆ endJob()

void TrackerOfflineValidationSummary::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 213 of file TrackerOfflineValidationSummary.cc.

References collateHarvestingHists(), fillTree(), mPxbResiduals_, mPxeResiduals_, mTecResiduals_, mTibResiduals_, mTidResiduals_, mTobResiduals_, tkGeom_, MainPageGenerator::tree, and tTopo_.

Referenced by o2olib.O2ORunMgr::executeJob().

213  {
214  AlignableTracker aliTracker(&(*tkGeom_), tTopo_.get());
215 
216  TTree* tree = new TTree("TkOffVal", "TkOffVal");
217 
218  TkOffTreeVariables* treeMemPtr = new TkOffTreeVariables;
219  // We create branches for all members of 'TkOffTreeVariables' (even if not needed).
220  // This works because we have a dictionary for 'TkOffTreeVariables'
221  // (see src/classes_def.xml and src/classes.h):
222  tree->Branch("TkOffTreeVariables", &treeMemPtr); // address of pointer!
223  // second branch needed for assigning names and titles to harvesting histograms consistent to others
224  std::map<std::string, std::string>* substructureName = new std::map<std::string, std::string>;
225  tree->Branch("SubstructureName", &substructureName, 32000, 00); // SplitLevel must be set to zero
226 
227  this->fillTree(*tree, mPxbResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo_.get());
228  this->fillTree(*tree, mPxeResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo_.get());
229  this->fillTree(*tree, mTibResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo_.get());
230  this->fillTree(*tree, mTidResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo_.get());
231  this->fillTree(*tree, mTobResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo_.get());
232  this->fillTree(*tree, mTecResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo_.get());
233 
234  //dbe_->save("dqmOut.root");
235 
236  // Method for filling histograms which show summarized values (mean, rms, median ...)
237  // of the module-based histograms from TrackerOfflineValidation
238  this->collateHarvestingHists(*tree);
239 
240  delete tree;
241  tree = nullptr;
242  delete treeMemPtr;
243  treeMemPtr = nullptr;
244  delete substructureName;
245  substructureName = nullptr;
246 }
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mTobResiduals_
container to hold data to be written into TTree
edm::ESHandle< TrackerGeometry > tkGeom_
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mTibResiduals_
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mTecResiduals_
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mPxbResiduals_
std::unique_ptr< TrackerTopology > tTopo_
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mPxeResiduals_
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mTidResiduals_
Definition: tree.py:1
void fillTree(TTree &tree, std::map< int, TrackerOfflineValidationSummary::ModuleHistos > &moduleHist, TkOffTreeVariables &treeMem, const TrackerGeometry &tkgeom, std::map< std::string, std::string > &substructureName, const TrackerTopology *tTopo)

◆ endRun()

void TrackerOfflineValidationSummary::endRun ( const edm::Run ,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 206 of file TrackerOfflineValidationSummary.cc.

References edm::EventSetup::getData(), tTopo_, and tTopoToken_.

206  {
207  if (!tTopo_) {
208  tTopo_ = std::make_unique<TrackerTopology>(iSetup.getData(tTopoToken_));
209  }
210 }
bool getData(T &iHolder) const
Definition: EventSetup.h:122
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
std::unique_ptr< TrackerTopology > tTopo_

◆ fillHarvestingHists()

void TrackerOfflineValidationSummary::fillHarvestingHists ( TTree &  tree)
private

Definition at line 821 of file TrackerOfflineValidationSummary.cc.

References TkOffTreeVariables::entries, edm::ParameterSet::getParameter(), TkOffTreeVariables::medianX, TkOffTreeVariables::medianY, parSet_, and vHarvestingHierarchy_.

Referenced by collateHarvestingHists().

821  {
822  TkOffTreeVariables* treeMemPtr = nullptr;
823  std::map<std::string, std::string>* substructureName = nullptr;
824  tree.SetBranchAddress("TkOffTreeVariables", &treeMemPtr);
825  tree.SetBranchAddress("SubstructureName", &substructureName);
826 
827  const unsigned int minEntriesPerModule(parSet_.getParameter<unsigned int>("minEntriesPerModuleForDmr"));
828  edm::LogInfo("TrackerOfflineValidationSummary")
829  << "Median of a module is added to DMR plots if it contains at least " << minEntriesPerModule << " hits";
830 
831  for (std::vector<HarvestingHierarchy>::iterator iHier = vHarvestingHierarchy_.begin();
832  iHier != vHarvestingHierarchy_.end();
833  ++iHier) {
834  for (std::vector<unsigned int>::const_iterator iTreeEntries = iHier->treeEntries.begin();
835  iTreeEntries != iHier->treeEntries.end();
836  ++iTreeEntries) {
837  tree.GetEntry(*iTreeEntries);
838  if (treeMemPtr->entries < minEntriesPerModule)
839  continue;
840  iHier->harvestingHistos.DmrXprime->Fill(treeMemPtr->medianX);
841  if (iHier->harvestingHistos.DmrYprime)
842  iHier->harvestingHistos.DmrYprime->Fill(treeMemPtr->medianY);
843  }
844  }
845 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
container to hold data to be written into TTree
std::vector< HarvestingHierarchy > vHarvestingHierarchy_
Log< level::Info, false > LogInfo
Definition: tree.py:1

◆ fillTree()

void TrackerOfflineValidationSummary::fillTree ( TTree &  tree,
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > &  moduleHist,
TkOffTreeVariables treeMem,
const TrackerGeometry tkgeom,
std::map< std::string, std::string > &  substructureName,
const TrackerTopology tTopo 
)
private

Definition at line 248 of file TrackerOfflineValidationSummary.cc.

References associateModuleHistsWithTree(), PV3DBase< T, PVType, FrameType >::barePhi(), TkOffTreeVariables::blade, TkOffTreeVariables::chi2PerDofX, TkOffTreeVariables::chi2PerDofY, TkOffTreeVariables::clear(), SiPixelRawToDigiRegional_cfi::deltaPhi, HLT_2022v11_cff::dPhi, HGC3DClusterGenMatchSelector_cfi::dR, TkOffTreeVariables::entries, PV3DBase< T, PVType, FrameType >::eta(), TkOffTreeVariables::fitMeanNormX, TkOffTreeVariables::fitMeanNormY, TkOffTreeVariables::fitMeanX, TkOffTreeVariables::fitMeanY, fitResiduals(), TkOffTreeVariables::fitSigmaNormX, TkOffTreeVariables::fitSigmaNormY, TkOffTreeVariables::fitSigmaX, TkOffTreeVariables::fitSigmaY, getMedian(), h, TkOffTreeVariables::half, L1TStage2EMTFEventInfoClient_cfi::histDir, TkOffTreeVariables::histNameLocalX, TkOffTreeVariables::histNameNormLocalX, TkOffTreeVariables::histNameNormX, TkOffTreeVariables::histNameNormY, TkOffTreeVariables::histNameX, TkOffTreeVariables::histNameY, TrackerGeometry::idToDet(), TkOffTreeVariables::isDoubleSide, TkOffTreeVariables::isStereo, TkOffTreeVariables::layer, TkOffTreeVariables::meanLocalX, TkOffTreeVariables::meanNormLocalX, TkOffTreeVariables::meanNormX, TkOffTreeVariables::meanNormY, TkOffTreeVariables::meanX, TkOffTreeVariables::meanY, TkOffTreeVariables::medianX, TkOffTreeVariables::medianY, TkOffTreeVariables::module, TkOffTreeVariables::moduleId, spclusmultinvestigator_cfi::numberOfBins, TkOffTreeVariables::numberOfOutliers, TkOffTreeVariables::numberOfOverflows, TkOffTreeVariables::numberOfUnderflows, TkOffTreeVariables::outerInner, TkOffTreeVariables::panel, PV3DBase< T, PVType, FrameType >::perp(), TkOffTreeVariables::petal, PV3DBase< T, PVType, FrameType >::phi(), TkOffTreeVariables::phiDirection, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, TkOffTreeVariables::posEta, GeomDet::position(), TkOffTreeVariables::posPhi, TkOffTreeVariables::posR, TkOffTreeVariables::posX, TkOffTreeVariables::posY, TkOffTreeVariables::posZ, TrackerTopology::pxbLadder(), TrackerTopology::pxbLayer(), TrackerTopology::pxbModule(), TrackerTopology::pxfBlade(), TrackerTopology::pxfDisk(), TrackerTopology::pxfModule(), TrackerTopology::pxfPanel(), TrackerTopology::pxfSide(), DetId::rawId(), TkOffTreeVariables::rDirection, TkOffTreeVariables::ring, TkOffTreeVariables::rmsLocalX, TkOffTreeVariables::rmsNormLocalX, TkOffTreeVariables::rmsNormX, TkOffTreeVariables::rmsNormY, TkOffTreeVariables::rmsX, TkOffTreeVariables::rmsY, TkOffTreeVariables::rod, TkOffTreeVariables::rOrZDirection, TkOffTreeVariables::side, dqmMemoryStats::stats, AlCaHLTBitMon_QueryRunRegistry::string, DetId::subdetId(), TkOffTreeVariables::subDetId, GeomDet::surface(), StripSubdetector::TEC, TrackerTopology::tecIsDoubleSide(), TrackerTopology::tecModule(), TrackerTopology::tecPetalInfo(), TrackerTopology::tecRing(), TrackerTopology::tecSide(), TrackerTopology::tecStereo(), TrackerTopology::tecWheel(), StripSubdetector::TIB, TrackerTopology::tibIsDoubleSide(), TrackerTopology::tibLayer(), TrackerTopology::tibModule(), TrackerTopology::tibStereo(), TrackerTopology::tibStringInfo(), StripSubdetector::TID, TrackerTopology::tidIsDoubleSide(), TrackerTopology::tidModuleInfo(), TrackerTopology::tidRing(), TrackerTopology::tidSide(), TrackerTopology::tidStereo(), TrackerTopology::tidWheel(), StripSubdetector::TOB, TrackerTopology::tobIsDoubleSide(), TrackerTopology::tobLayer(), TrackerTopology::tobModule(), TrackerTopology::tobRodInfo(), TrackerTopology::tobStereo(), Surface::toGlobal(), useFit_, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and TkOffTreeVariables::zDirection.

Referenced by endJob(), and core.AutoFillTreeProducer.AutoFillTreeProducer::process().

253  {
254  for (std::map<int, TrackerOfflineValidationSummary::ModuleHistos>::iterator it = moduleHist.begin(),
255  itEnd = moduleHist.end();
256  it != itEnd;
257  ++it) {
258  treeMem.clear(); // make empty/default
259 
260  //variables concerning the tracker components/hierarchy levels
261  const DetId detId = it->first;
262  treeMem.moduleId = detId;
263  treeMem.subDetId = detId.subdetId();
264 
265  if (treeMem.subDetId == PixelSubdetector::PixelBarrel) {
266  unsigned int whichHalfBarrel(1), rawId(detId.rawId()); //DetId does not know about halfBarrels is PXB ...
267  if ((rawId >= 302056964 && rawId < 302059300) || (rawId >= 302123268 && rawId < 302127140) ||
268  (rawId >= 302189572 && rawId < 302194980))
269  whichHalfBarrel = 2;
270  treeMem.layer = tTopo->pxbLayer(detId);
271  treeMem.half = whichHalfBarrel;
272  treeMem.rod = tTopo->pxbLadder(
273  detId); // ... so, ladder is not per halfBarrel-Layer, but per barrel-layer! Needs complicated calculation in associateModuleHistsWithTree()
274  treeMem.module = tTopo->pxbModule(detId);
275  } else if (treeMem.subDetId == PixelSubdetector::PixelEndcap) {
276  unsigned int whichHalfCylinder(1), rawId(detId.rawId()); //DetId does not kmow about halfCylinders in PXF
277  if ((rawId >= 352394500 && rawId < 352406032) || (rawId >= 352460036 && rawId < 352471568) ||
278  (rawId >= 344005892 && rawId < 344017424) || (rawId >= 344071428 && rawId < 344082960))
279  whichHalfCylinder = 2;
280  treeMem.layer = tTopo->pxfDisk(detId);
281  treeMem.side = tTopo->pxfSide(detId);
282  treeMem.half = whichHalfCylinder;
283  treeMem.blade = tTopo->pxfBlade(detId);
284  treeMem.panel = tTopo->pxfPanel(detId);
285  treeMem.module = tTopo->pxfModule(detId);
286  } else if (treeMem.subDetId == StripSubdetector::TIB) {
287  unsigned int whichHalfShell(1), rawId(detId.rawId()); //DetId does not kmow about halfShells in TIB
288  if ((rawId >= 369120484 && rawId < 369120688) || (rawId >= 369121540 && rawId < 369121776) ||
289  (rawId >= 369136932 && rawId < 369137200) || (rawId >= 369137988 && rawId < 369138288) ||
290  (rawId >= 369153396 && rawId < 369153744) || (rawId >= 369154436 && rawId < 369154800) ||
291  (rawId >= 369169844 && rawId < 369170256) || (rawId >= 369170900 && rawId < 369171344) ||
292  (rawId >= 369124580 && rawId < 369124784) || (rawId >= 369125636 && rawId < 369125872) ||
293  (rawId >= 369141028 && rawId < 369141296) || (rawId >= 369142084 && rawId < 369142384) ||
294  (rawId >= 369157492 && rawId < 369157840) || (rawId >= 369158532 && rawId < 369158896) ||
295  (rawId >= 369173940 && rawId < 369174352) || (rawId >= 369174996 && rawId < 369175440))
296  whichHalfShell = 2;
297  treeMem.layer = tTopo->tibLayer(detId);
298  treeMem.side = tTopo->tibStringInfo(detId)[0];
299  treeMem.half = whichHalfShell;
300  treeMem.rod = tTopo->tibStringInfo(detId)[2];
301  treeMem.outerInner = tTopo->tibStringInfo(detId)[1];
302  treeMem.module = tTopo->tibModule(detId);
303  treeMem.isStereo = tTopo->tibStereo(detId);
304  treeMem.isDoubleSide = tTopo->tibIsDoubleSide(detId);
305  } else if (treeMem.subDetId == StripSubdetector::TID) {
306  treeMem.layer = tTopo->tidWheel(detId);
307  treeMem.side = tTopo->tidSide(detId);
308  treeMem.ring = tTopo->tidRing(detId);
309  treeMem.outerInner = tTopo->tidModuleInfo(detId)[0];
310  treeMem.module = tTopo->tidModuleInfo(detId)[1];
311  treeMem.isStereo = tTopo->tidStereo(detId);
312  treeMem.isDoubleSide = tTopo->tidIsDoubleSide(detId);
313  } else if (treeMem.subDetId == StripSubdetector::TOB) {
314  treeMem.layer = tTopo->tobLayer(detId);
315  treeMem.side = tTopo->tobRodInfo(detId)[0];
316  treeMem.rod = tTopo->tobRodInfo(detId)[1];
317  treeMem.module = tTopo->tobModule(detId);
318  treeMem.isStereo = tTopo->tobStereo(detId);
319  treeMem.isDoubleSide = tTopo->tobIsDoubleSide(detId);
320  } else if (treeMem.subDetId == StripSubdetector::TEC) {
321  treeMem.layer = tTopo->tecWheel(detId);
322  treeMem.side = tTopo->tecSide(detId);
323  treeMem.ring = tTopo->tecRing(detId);
324  treeMem.petal = tTopo->tecPetalInfo(detId)[1];
325  treeMem.outerInner = tTopo->tecPetalInfo(detId)[0];
326  treeMem.module = tTopo->tecModule(detId);
327  treeMem.isStereo = tTopo->tecStereo(detId);
328  treeMem.isDoubleSide = tTopo->tecIsDoubleSide(detId);
329  }
330 
331  //variables concerning the tracker geometry
332 
333  const Surface::PositionType& gPModule = tkgeom.idToDet(detId)->position();
334  treeMem.posPhi = gPModule.phi();
335  treeMem.posEta = gPModule.eta();
336  treeMem.posR = gPModule.perp();
337  treeMem.posX = gPModule.x();
338  treeMem.posY = gPModule.y();
339  treeMem.posZ = gPModule.z();
340 
341  const Surface& surface = tkgeom.idToDet(detId)->surface();
342 
343  //global Orientation of local coordinate system of dets/detUnits
344  LocalPoint lUDirection(1., 0., 0.), lVDirection(0., 1., 0.), lWDirection(0., 0., 1.);
345  GlobalPoint gUDirection = surface.toGlobal(lUDirection), gVDirection = surface.toGlobal(lVDirection),
346  gWDirection = surface.toGlobal(lWDirection);
347  double dR(999.), dPhi(999.), dZ(999.);
349  treeMem.subDetId == StripSubdetector::TOB) {
350  dR = gWDirection.perp() - gPModule.perp();
351  dPhi = deltaPhi(gUDirection.barePhi(), gPModule.barePhi());
352  dZ = gVDirection.z() - gPModule.z();
353  if (dZ >= 0.)
354  treeMem.rOrZDirection = 1;
355  else
356  treeMem.rOrZDirection = -1;
357  } else if (treeMem.subDetId == PixelSubdetector::PixelEndcap) {
358  dR = gUDirection.perp() - gPModule.perp();
359  dPhi = deltaPhi(gVDirection.barePhi(), gPModule.barePhi());
360  dZ = gWDirection.z() - gPModule.z();
361  if (dR >= 0.)
362  treeMem.rOrZDirection = 1;
363  else
364  treeMem.rOrZDirection = -1;
365  } else if (treeMem.subDetId == StripSubdetector::TID || treeMem.subDetId == StripSubdetector::TEC) {
366  dR = gVDirection.perp() - gPModule.perp();
367  dPhi = deltaPhi(gUDirection.barePhi(), gPModule.barePhi());
368  dZ = gWDirection.z() - gPModule.z();
369  if (dR >= 0.)
370  treeMem.rOrZDirection = 1;
371  else
372  treeMem.rOrZDirection = -1;
373  }
374  if (dR >= 0.)
375  treeMem.rDirection = 1;
376  else
377  treeMem.rDirection = -1;
378  if (dPhi >= 0.)
379  treeMem.phiDirection = 1;
380  else
381  treeMem.phiDirection = -1;
382  if (dZ >= 0.)
383  treeMem.zDirection = 1;
384  else
385  treeMem.zDirection = -1;
386 
387  // Assign histos from first step (TrackerOfflineValidation) to the module's entry in the TTree for retrieving mean, rms, median ...
388  const std::string histDir = associateModuleHistsWithTree(treeMem, it->second, substructureName);
389 
390  //mean and RMS values (extracted from histograms Xprime on module level)
391  treeMem.entries = static_cast<UInt_t>(it->second.ResXprimeHisto->GetEntries());
392  treeMem.meanX = it->second.ResXprimeHisto->GetMean();
393  treeMem.rmsX = it->second.ResXprimeHisto->GetRMS();
394  //treeMem.sigmaX = Fwhm(it->second.ResXprimeHisto)/2.355;
395  if (useFit_) {
396  //call fit function which returns mean and sigma from the fit
397  //for absolute residuals
398  std::pair<float, float> fitResult1 = this->fitResiduals(it->second.ResXprimeHisto);
399  treeMem.fitMeanX = fitResult1.first;
400  treeMem.fitSigmaX = fitResult1.second;
401  //for normalized residuals
402  std::pair<float, float> fitResult2 = this->fitResiduals(it->second.NormResXprimeHisto);
403  treeMem.fitMeanNormX = fitResult2.first;
404  treeMem.fitSigmaNormX = fitResult2.second;
405  }
406 
407  //get median for absolute residuals
408  treeMem.medianX = this->getMedian(it->second.ResXprimeHisto);
409 
410  int numberOfBins = it->second.ResXprimeHisto->GetNbinsX();
411  treeMem.numberOfUnderflows = it->second.ResXprimeHisto->GetBinContent(0);
412  treeMem.numberOfOverflows = it->second.ResXprimeHisto->GetBinContent(numberOfBins + 1);
413  treeMem.numberOfOutliers =
414  it->second.ResXprimeHisto->GetBinContent(0) + it->second.ResXprimeHisto->GetBinContent(numberOfBins + 1);
415  //mean and RMS values (extracted from histograms(normalized Xprime on module level)
416  treeMem.meanNormX = it->second.NormResXprimeHisto->GetMean();
417  treeMem.rmsNormX = it->second.NormResXprimeHisto->GetRMS();
418 
419  double stats[20];
420  it->second.NormResXprimeHisto->GetStats(stats);
421  // GF treeMem.chi2PerDofX = stats[3]/(stats[0]-1);
422  if (stats[0])
423  treeMem.chi2PerDofX = stats[3] / stats[0];
424 
425  //treeMem.sigmaNormX = Fwhm(it->second.NormResXprimeHisto)/2.355;
426  treeMem.histNameX = it->second.ResXprimeHisto->GetName();
427  treeMem.histNameNormX = it->second.NormResXprimeHisto->GetName();
428 
429  // fill tree variables in local coordinates if set in cfg of TrackerOfllineValidation
430  if (it->second.ResHisto && it->second.NormResHisto) { // if(lCoorHistOn_) {
431  treeMem.meanLocalX = it->second.ResHisto->GetMean();
432  treeMem.rmsLocalX = it->second.ResHisto->GetRMS();
433  treeMem.meanNormLocalX = it->second.NormResHisto->GetMean();
434  treeMem.rmsNormLocalX = it->second.NormResHisto->GetRMS();
435  treeMem.histNameLocalX = it->second.ResHisto->GetName();
436  treeMem.histNameNormLocalX = it->second.NormResHisto->GetName();
437  }
438 
439  // mean and RMS values in local y (extracted from histograms Yprime on module level)
440  // might exist in pixel only
441  if (it->second.ResYprimeHisto) { //(stripYResiduals_){
442  TH1* h = it->second.ResYprimeHisto;
443  treeMem.meanY = h->GetMean();
444  treeMem.rmsY = h->GetRMS();
445 
446  if (useFit_) { // fit function which returns mean and sigma from the fit
447  std::pair<float, float> fitMeanSigma = this->fitResiduals(h);
448  treeMem.fitMeanY = fitMeanSigma.first;
449  treeMem.fitSigmaY = fitMeanSigma.second;
450  }
451 
452  //get median for absolute residuals
453  treeMem.medianY = this->getMedian(h);
454 
455  treeMem.histNameY = h->GetName();
456  }
457 
458  if (it->second.NormResYprimeHisto) {
459  TH1* h = it->second.NormResYprimeHisto;
460  treeMem.meanNormY = h->GetMean();
461  treeMem.rmsNormY = h->GetRMS();
462  h->GetStats(stats); // stats buffer defined above
463  if (stats[0])
464  treeMem.chi2PerDofY = stats[3] / stats[0];
465 
466  if (useFit_) { // fit function which returns mean and sigma from the fit
467  std::pair<float, float> fitMeanSigma = this->fitResiduals(h);
468  treeMem.fitMeanNormY = fitMeanSigma.first;
469  treeMem.fitSigmaNormY = fitMeanSigma.second;
470  }
471  treeMem.histNameNormY = h->GetName();
472  }
473 
474  tree.Fill();
475  }
476 }
static constexpr auto TEC
bool tibIsDoubleSide(const DetId &id) const
bool tecIsDoubleSide(const DetId &id) const
bool tidIsDoubleSide(const DetId &id) const
unsigned int tobLayer(const DetId &id) const
unsigned int pxbLayer(const DetId &id) const
T perp() const
Definition: PV3DBase.h:69
std::vector< unsigned int > tidModuleInfo(const DetId &id) const
unsigned int pxfBlade(const DetId &id) const
T z() const
Definition: PV3DBase.h:61
uint32_t tidStereo(const DetId &id) const
unsigned int tibModule(const DetId &id) const
unsigned int tidSide(const DetId &id) const
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
unsigned int pxfModule(const DetId &id) const
std::vector< unsigned int > tecPetalInfo(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
T eta() const
Definition: PV3DBase.h:73
unsigned int pxbLadder(const DetId &id) const
unsigned int tecRing(const DetId &id) const
ring id
bool tobIsDoubleSide(const DetId &id) const
T barePhi() const
Definition: PV3DBase.h:65
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
unsigned int tecModule(const DetId &id) const
uint32_t tobStereo(const DetId &id) const
unsigned int tecSide(const DetId &id) const
const std::string associateModuleHistsWithTree(const TkOffTreeVariables &treeMem, TrackerOfflineValidationSummary::ModuleHistos &moduleHists, std::map< std::string, std::string > &substructureName)
unsigned int pxfDisk(const DetId &id) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static constexpr auto TOB
histDir
Location of output EventInfo/reportSummaryContents.
std::pair< float, float > fitResiduals(TH1 *hist) const
const TrackerGeomDet * idToDet(DetId) const override
std::string histNameNormLocalX
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
unsigned int pxfPanel(const DetId &id) const
Definition: DetId.h:17
unsigned int pxfSide(const DetId &id) const
std::vector< unsigned int > tibStringInfo(const DetId &id) const
static constexpr auto TIB
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::string histNameLocalX
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
std::vector< unsigned int > tobRodInfo(const DetId &id) const
void clear()
set to empty values
unsigned int tidRing(const DetId &id) const
uint32_t tecStereo(const DetId &id) const
unsigned int tibLayer(const DetId &id) const
unsigned int tobModule(const DetId &id) const
Definition: tree.py:1
unsigned int pxbModule(const DetId &id) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
static constexpr auto TID
uint32_t tibStereo(const DetId &id) const

◆ fitResiduals()

std::pair< float, float > TrackerOfflineValidationSummary::fitResiduals ( TH1 *  hist) const
private

Definition at line 664 of file TrackerOfflineValidationSummary.cc.

References MillePedeFileConverter_cfg::e, EcalMonitorTask_cff::func, gpuVertexFinder::hist, and SiStripPI::mean.

Referenced by fillTree().

664  {
665  std::pair<float, float> fitResult(9999., 9999.);
666  if (!hist || hist->GetEntries() < 20)
667  return fitResult;
668 
669  float mean = hist->GetMean();
670  float sigma = hist->GetRMS();
671 
672  try { // for < CMSSW_2_2_0 since ROOT warnings from fit are converted to exceptions
673  // Remove the try/catch for more recent CMSSW!
674  // first fit: two RMS around mean
675  TF1 func("tmp", "gaus", mean - 2. * sigma, mean + 2. * sigma);
676  if (0 == hist->Fit(&func, "QNR")) { // N: do not blow up file by storing fit!
677  mean = func.GetParameter(1);
678  sigma = func.GetParameter(2);
679  // second fit: three sigma of first fit around mean of first fit
680  func.SetRange(mean - 3. * sigma, mean + 3. * sigma);
681  // I: integral gives more correct results if binning is too wide
682  // L: Likelihood can treat empty bins correctly (if hist not weighted...)
683  if (0 == hist->Fit(&func, "Q0LR")) {
684  if (hist->GetFunction(func.GetName())) { // Take care that it is later on drawn:
685  hist->GetFunction(func.GetName())->ResetBit(TF1::kNotDraw);
686  }
687  fitResult.first = func.GetParameter(1);
688  fitResult.second = func.GetParameter(2);
689  }
690  }
691  } catch (cms::Exception const& e) {
692  edm::LogWarning("Alignment") << "@SUB=TrackerOfflineValidation::fitResiduals"
693  << "Caught this exception during ROOT fit: " << e.what();
694  }
695  return fitResult;
696 }
__shared__ Hist hist
Log< level::Warning, false > LogWarning

◆ getBinning()

void TrackerOfflineValidationSummary::getBinning ( const std::string &  binningPSetName,
int &  nBinsX,
double &  lowerBoundX,
double &  upperBoundX 
) const
private

Definition at line 811 of file TrackerOfflineValidationSummary.cc.

References edm::ParameterSet::getParameter(), and parSet_.

Referenced by bookHarvestingHists().

814  {
815  const edm::ParameterSet& binningPSet = parSet_.getParameter<edm::ParameterSet>(binningPSetName);
816  nBinsX = binningPSet.getParameter<int>("Nbinx");
817  lowerBoundX = binningPSet.getParameter<double>("xmin");
818  upperBoundX = binningPSet.getParameter<double>("xmax");
819 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303

◆ getMedian()

float TrackerOfflineValidationSummary::getMedian ( const TH1 *  hist) const
private

Definition at line 698 of file TrackerOfflineValidationSummary.cc.

References timingPdfMaker::histo, dqmiolumiharvest::j, median(), LaserClient_cfi::nbins, x, and y.

Referenced by fillTree().

698  {
699  float median = 999;
700  const int nbins = histo->GetNbinsX();
701 
702  //extract median from histogram
703  double* x = new double[nbins];
704  double* y = new double[nbins];
705  for (int j = 0; j < nbins; j++) {
706  x[j] = histo->GetBinCenter(j + 1);
707  y[j] = histo->GetBinContent(j + 1);
708  }
709  median = TMath::Median(nbins, x, y);
710 
711  delete[] x;
712  x = nullptr;
713  delete[] y;
714  y = nullptr;
715 
716  return median;
717 }
T median(std::vector< T > values)
Definition: median.h:16

Member Data Documentation

◆ dbe_

DQMStore* TrackerOfflineValidationSummary::dbe_
private

◆ geomToken_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> TrackerOfflineValidationSummary::geomToken_
private

Definition at line 65 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze().

◆ moduleDirectory_

const std::string TrackerOfflineValidationSummary::moduleDirectory_
private

◆ moduleMapsInitialized

bool TrackerOfflineValidationSummary::moduleMapsInitialized
private

Definition at line 136 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze().

◆ mPxbResiduals_

std::map<int, TrackerOfflineValidationSummary::ModuleHistos> TrackerOfflineValidationSummary::mPxbResiduals_
private

Definition at line 138 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

◆ mPxeResiduals_

std::map<int, TrackerOfflineValidationSummary::ModuleHistos> TrackerOfflineValidationSummary::mPxeResiduals_
private

Definition at line 139 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

◆ mTecResiduals_

std::map<int, TrackerOfflineValidationSummary::ModuleHistos> TrackerOfflineValidationSummary::mTecResiduals_
private

Definition at line 143 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

◆ mTibResiduals_

std::map<int, TrackerOfflineValidationSummary::ModuleHistos> TrackerOfflineValidationSummary::mTibResiduals_
private

Definition at line 140 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

◆ mTidResiduals_

std::map<int, TrackerOfflineValidationSummary::ModuleHistos> TrackerOfflineValidationSummary::mTidResiduals_
private

Definition at line 141 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

◆ mTobResiduals_

std::map<int, TrackerOfflineValidationSummary::ModuleHistos> TrackerOfflineValidationSummary::mTobResiduals_
private

Definition at line 142 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

◆ parSet_

const edm::ParameterSet TrackerOfflineValidationSummary::parSet_
private

◆ tkGeom_

edm::ESHandle<TrackerGeometry> TrackerOfflineValidationSummary::tkGeom_
private

Definition at line 127 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

◆ tTopo_

std::unique_ptr<TrackerTopology> TrackerOfflineValidationSummary::tTopo_
private

Definition at line 128 of file TrackerOfflineValidationSummary.cc.

Referenced by endJob(), and endRun().

◆ tTopoToken_

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> TrackerOfflineValidationSummary::tTopoToken_
private

Definition at line 66 of file TrackerOfflineValidationSummary.cc.

Referenced by endRun().

◆ useFit_

const bool TrackerOfflineValidationSummary::useFit_
private

Definition at line 132 of file TrackerOfflineValidationSummary.cc.

Referenced by fillTree().

◆ vHarvestingHierarchy_

std::vector<HarvestingHierarchy> TrackerOfflineValidationSummary::vHarvestingHierarchy_
private