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::EDAnalyzer 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::EDAnalyzer
typedef EDAnalyzer 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::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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 &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 bookHarvestingHists ()
 
void collateHarvestingHists (TTree &tree)
 
void endJob () 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::EventSetuplastSetup_
 
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_
 
const bool useFit_
 
std::vector< HarvestingHierarchyvHarvestingHierarchy_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 58 of file TrackerOfflineValidationSummary.cc.

Member Typedef Documentation

Definition at line 60 of file TrackerOfflineValidationSummary.cc.

Constructor & Destructor Documentation

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

Definition at line 155 of file TrackerOfflineValidationSummary.cc.

References dbe_, and Utilities::operator.

156  : parSet_(iConfig),
157  moduleDirectory_(parSet_.getParameter<std::string>("moduleDirectoryInOutput")),
158  useFit_(parSet_.getParameter<bool>("useFit")),
159  dbe_(nullptr),
160  moduleMapsInitialized(false),
161  lastSetup_(nullptr) {
162  //now do what ever initialization is needed
164 }
T getParameter(std::string const &) const
TrackerOfflineValidationSummary::~TrackerOfflineValidationSummary ( )
override

Definition at line 166 of file TrackerOfflineValidationSummary.cc.

166  {
167  // do anything here that needs to be done at desctruction time
168  // (e.g. close files, deallocate resources etc.)
169 }

Member Function Documentation

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

Definition at line 176 of file TrackerOfflineValidationSummary.cc.

References DetId::det(), TrackerGeometry::detIds(), Exception, edm::EventSetup::get(), lastSetup_, 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.

176  {
177  lastSetup_ = &iSetup;
178 
179  // Access of EventSetup is needed to get the list of silicon-modules and their IDs
180  // Since they do not change, it is accessed only once
182  return;
183  iSetup.get<TrackerDigiGeometryRecord>().get(tkGeom_);
184  const TrackerGeometry* bareTkGeomPtr = &(*tkGeom_);
185  const TrackingGeometry::DetIdContainer& detIdContainer = bareTkGeomPtr->detIds();
186  std::vector<DetId>::const_iterator iDet;
187  for (iDet = detIdContainer.begin(); iDet != detIdContainer.end(); ++iDet) {
188  const DetId& detId = *iDet;
189  const uint32_t rawId = detId.rawId();
190  const unsigned int subdetId = detId.subdetId();
191  if (subdetId == PixelSubdetector::PixelBarrel)
192  mPxbResiduals_[rawId];
193  else if (subdetId == PixelSubdetector::PixelEndcap)
194  mPxeResiduals_[rawId];
195  else if (subdetId == StripSubdetector::TIB)
196  mTibResiduals_[rawId];
197  else if (subdetId == StripSubdetector::TID)
198  mTidResiduals_[rawId];
199  else if (subdetId == StripSubdetector::TOB)
200  mTobResiduals_[rawId];
201  else if (subdetId == StripSubdetector::TEC)
202  mTecResiduals_[rawId];
203  else {
204  throw cms::Exception("Geometry Error")
205  << "[TrackerOfflineValidationSummary] Error, tried to get reference for non-tracker subdet " << subdetId
206  << " from detector " << detId.det();
207  }
208  }
209  moduleMapsInitialized = true;
210 }
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mTobResiduals_
static constexpr auto TEC
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
edm::ESHandle< TrackerGeometry > tkGeom_
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
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
static constexpr auto TOB
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mTecResiduals_
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mPxbResiduals_
Definition: DetId.h:17
static constexpr auto TIB
std::vector< DetId > DetIdContainer
T get() const
Definition: EventSetup.h:73
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mPxeResiduals_
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mTidResiduals_
static constexpr auto TID
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
void TrackerOfflineValidationSummary::applyHarvestingHierarchy ( TTree &  treeMem)
private

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

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

Definition at line 484 of file TrackerOfflineValidationSummary.cc.

References TkOffTreeVariables::blade, dbe_, contentValuesFiles::fullPath, dqm::dqmstoreimpl::DQMStore::get(), dqm::legacy::MonitorElement::getTH1(), TkOffTreeVariables::half, L1TStage2EMTFEventInfoClient_cfi::histDir, TkOffTreeVariables::isDoubleSide, PVValHelper::ladder, TkOffTreeVariables::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().

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

Definition at line 777 of file TrackerOfflineValidationSummary.cc.

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

Referenced by applyHarvestingHierarchy().

777  {
778  edm::LogInfo("TrackerOfflineValidationSummary") << "Harvesting histograms will be booked for "
779  << vHarvestingHierarchy_.size() << " different hierarchy selections";
780  for (std::vector<HarvestingHierarchy>::iterator iHier = vHarvestingHierarchy_.begin();
781  iHier != vHarvestingHierarchy_.end();
782  ++iHier) {
783  std::stringstream dmrXprimeHistoName, dmrYprimeHistoName, dmrXprimeHistoTitle, dmrYprimeHistoTitle;
784  dmrXprimeHistoName << "h_DmrXprime_" << iHier->hierarchyName;
785  dmrYprimeHistoName << "h_DmrYprime_" << iHier->hierarchyName;
786  dmrXprimeHistoTitle << "DMR for " << iHier->hierarchyName << ";<#DeltaX> [cm];# modules";
787  dmrYprimeHistoTitle << "DMR for " << iHier->hierarchyName << ";<#DeltaY> [cm];# modules";
788 
789  std::string directoryString(moduleDirectory_);
790  if (directoryString.length() != 0)
791  directoryString += "/";
792  directoryString += iHier->componentName;
793  dbe_->setCurrentFolder(directoryString);
794 
795  int nBinsX(0);
796  double xMin(0.), xMax(0.);
797  if (iHier->componentName == "Pixel") {
798  this->getBinning("TH1DmrXprimePixelModules", nBinsX, xMin, xMax);
799  iHier->harvestingHistos.DmrXprime =
800  dbe_->book1D(dmrXprimeHistoName.str(), dmrXprimeHistoTitle.str(), nBinsX, xMin, xMax)->getTH1();
801  this->getBinning("TH1DmrYprimePixelModules", nBinsX, xMin, xMax);
802  iHier->harvestingHistos.DmrYprime =
803  dbe_->book1D(dmrYprimeHistoName.str(), dmrYprimeHistoTitle.str(), nBinsX, xMin, xMax)->getTH1();
804  } else if (iHier->componentName == "Strip") {
805  this->getBinning("TH1DmrXprimeStripModules", nBinsX, xMin, xMax);
806  iHier->harvestingHistos.DmrXprime =
807  dbe_->book1D(dmrXprimeHistoName.str(), dmrXprimeHistoTitle.str(), nBinsX, xMin, xMax)->getTH1();
808  if (!parSet_.getParameter<bool>("stripYDmrs"))
809  continue;
810  this->getBinning("TH1DmrYprimeStripModules", nBinsX, xMin, xMax);
811  iHier->harvestingHistos.DmrYprime =
812  dbe_->book1D(dmrYprimeHistoName.str(), dmrYprimeHistoTitle.str(), nBinsX, xMin, xMax)->getTH1();
813  }
814  }
815 }
T getParameter(std::string const &) const
std::vector< HarvestingHierarchy > vHarvestingHierarchy_
void getBinning(const std::string &binningPSetName, int &nBinsX, double &lowerBoundX, double &upperBoundX) const
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:639
MonitorElement * book1D(char_string const &name, char_string const &title, int const nchX, double const lowX, double const highX)
Book 1D histogram.
Definition: DQMStore.cc:1121
void TrackerOfflineValidationSummary::collateHarvestingHists ( TTree &  tree)
private

Definition at line 725 of file TrackerOfflineValidationSummary.cc.

References applyHarvestingHierarchy(), and fillHarvestingHists().

Referenced by endJob().

725  {
727  this->fillHarvestingHists(tree);
728 }
Definition: tree.py:1
void TrackerOfflineValidationSummary::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 213 of file TrackerOfflineValidationSummary.cc.

References collateHarvestingHists(), fillTree(), edm::EventSetup::get(), lastSetup_, mPxbResiduals_, mPxeResiduals_, mTecResiduals_, mTibResiduals_, mTidResiduals_, mTobResiduals_, edm::ESHandle< T >::product(), tkGeom_, and MainPageGenerator::tree.

Referenced by o2olib.O2ORunMgr::executeJob().

213  {
214  //Retrieve tracker topology from geometry
215  edm::ESHandle<TrackerTopology> tTopoHandle;
216  lastSetup_->get<TrackerTopologyRcd>().get(tTopoHandle);
217  const TrackerTopology* const tTopo = tTopoHandle.product();
218 
219  AlignableTracker aliTracker(&(*tkGeom_), tTopo);
220 
221  TTree* tree = new TTree("TkOffVal", "TkOffVal");
222 
223  TkOffTreeVariables* treeMemPtr = new TkOffTreeVariables;
224  // We create branches for all members of 'TkOffTreeVariables' (even if not needed).
225  // This works because we have a dictionary for 'TkOffTreeVariables'
226  // (see src/classes_def.xml and src/classes.h):
227  tree->Branch("TkOffTreeVariables", &treeMemPtr); // address of pointer!
228  // second branch needed for assigning names and titles to harvesting histograms consistent to others
229  std::map<std::string, std::string>* substructureName = new std::map<std::string, std::string>;
230  tree->Branch("SubstructureName", &substructureName, 32000, 00); // SplitLevel must be set to zero
231 
232  this->fillTree(*tree, mPxbResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo);
233  this->fillTree(*tree, mPxeResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo);
234  this->fillTree(*tree, mTibResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo);
235  this->fillTree(*tree, mTidResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo);
236  this->fillTree(*tree, mTobResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo);
237  this->fillTree(*tree, mTecResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo);
238 
239  //dbe_->showDirStructure();
240  //dbe_->save("dqmOut.root");
241 
242  // Method for filling histograms which show summarized values (mean, rms, median ...)
243  // of the module-based histograms from TrackerOfflineValidation
244  this->collateHarvestingHists(*tree);
245 
246  delete tree;
247  tree = nullptr;
248  delete treeMemPtr;
249  treeMemPtr = nullptr;
250  delete substructureName;
251  substructureName = nullptr;
252 }
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_
T get() const
Definition: EventSetup.h:73
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)
T const * product() const
Definition: ESHandle.h:86
void TrackerOfflineValidationSummary::fillHarvestingHists ( TTree &  tree)
private

Definition at line 827 of file TrackerOfflineValidationSummary.cc.

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

Referenced by collateHarvestingHists().

827  {
828  TkOffTreeVariables* treeMemPtr = nullptr;
829  std::map<std::string, std::string>* substructureName = nullptr;
830  tree.SetBranchAddress("TkOffTreeVariables", &treeMemPtr);
831  tree.SetBranchAddress("SubstructureName", &substructureName);
832 
833  const unsigned int minEntriesPerModule(parSet_.getParameter<unsigned int>("minEntriesPerModuleForDmr"));
834  edm::LogInfo("TrackerOfflineValidationSummary")
835  << "Median of a module is added to DMR plots if it contains at least " << minEntriesPerModule << " hits";
836 
837  for (std::vector<HarvestingHierarchy>::iterator iHier = vHarvestingHierarchy_.begin();
838  iHier != vHarvestingHierarchy_.end();
839  ++iHier) {
840  for (std::vector<unsigned int>::const_iterator iTreeEntries = iHier->treeEntries.begin();
841  iTreeEntries != iHier->treeEntries.end();
842  ++iTreeEntries) {
843  tree.GetEntry(*iTreeEntries);
844  if (treeMemPtr->entries < minEntriesPerModule)
845  continue;
846  iHier->harvestingHistos.DmrXprime->Fill(treeMemPtr->medianX);
847  if (iHier->harvestingHistos.DmrYprime)
848  iHier->harvestingHistos.DmrYprime->Fill(treeMemPtr->medianY);
849  }
850  }
851 }
T getParameter(std::string const &) const
container to hold data to be written into TTree
std::vector< HarvestingHierarchy > vHarvestingHierarchy_
Definition: tree.py:1
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 254 of file TrackerOfflineValidationSummary.cc.

References associateModuleHistsWithTree(), PV3DBase< T, PVType, FrameType >::barePhi(), TkOffTreeVariables::blade, TkOffTreeVariables::chi2PerDofX, TkOffTreeVariables::chi2PerDofY, TkOffTreeVariables::clear(), SiPixelRawToDigiRegional_cfi::deltaPhi, HLT_2018_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().

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

Definition at line 670 of file TrackerOfflineValidationSummary.cc.

References MillePedeFileConverter_cfg::e, TrackCollections2monitor_cff::func, SiStripPI::mean, and cms::Exception::what().

Referenced by fillTree().

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

Definition at line 817 of file TrackerOfflineValidationSummary.cc.

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

Referenced by bookHarvestingHists().

820  {
821  const edm::ParameterSet& binningPSet = parSet_.getParameter<edm::ParameterSet>(binningPSetName);
822  nBinsX = binningPSet.getParameter<int>("Nbinx");
823  lowerBoundX = binningPSet.getParameter<double>("xmin");
824  upperBoundX = binningPSet.getParameter<double>("xmax");
825 }
T getParameter(std::string const &) const
float TrackerOfflineValidationSummary::getMedian ( const TH1 *  hist) const
private

Definition at line 704 of file TrackerOfflineValidationSummary.cc.

References dqmiolumiharvest::j, pfDeepBoostedJetPreprocessParams_cfi::median, LaserClient_cfi::nbins, x, and y.

Referenced by fillTree().

704  {
705  float median = 999;
706  const int nbins = histo->GetNbinsX();
707 
708  //extract median from histogram
709  double* x = new double[nbins];
710  double* y = new double[nbins];
711  for (int j = 0; j < nbins; j++) {
712  x[j] = histo->GetBinCenter(j + 1);
713  y[j] = histo->GetBinContent(j + 1);
714  }
715  median = TMath::Median(nbins, x, y);
716 
717  delete[] x;
718  x = nullptr;
719  delete[] y;
720  y = nullptr;
721 
722  return median;
723 }

Member Data Documentation

DQMStore* TrackerOfflineValidationSummary::dbe_
private
const edm::EventSetup* TrackerOfflineValidationSummary::lastSetup_
private

Definition at line 141 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

const std::string TrackerOfflineValidationSummary::moduleDirectory_
private
bool TrackerOfflineValidationSummary::moduleMapsInitialized
private

Definition at line 130 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze().

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

Definition at line 132 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

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

Definition at line 133 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

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

Definition at line 137 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

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

Definition at line 134 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

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

Definition at line 135 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

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

Definition at line 136 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

const edm::ParameterSet TrackerOfflineValidationSummary::parSet_
private
edm::ESHandle<TrackerGeometry> TrackerOfflineValidationSummary::tkGeom_
private

Definition at line 122 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

const bool TrackerOfflineValidationSummary::useFit_
private

Definition at line 126 of file TrackerOfflineValidationSummary.cc.

Referenced by fillTree().

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