CMS 3D CMS Logo

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

#include <MillePedeDQMModule.h>

Inheritance diagram for MillePedeDQMModule:
DQMEDHarvester edm::one::EDProducer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources, edm::EndLuminosityBlockProducer > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
 MillePedeDQMModule (const edm::ParameterSet &)
 
virtual ~MillePedeDQMModule ()
 
- Public Member Functions inherited from DQMEDHarvester
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override final
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 DQMEDHarvester (void)
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endJob () override final
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override final
 
virtual void endRun (edm::Run const &, edm::EventSetup const &) override
 
virtual void produce (edm::Event &, edm::EventSetup const &) override final
 
virtual ~DQMEDHarvester ()=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources, edm::EndLuminosityBlockProducer >
 EDProducer ()=default
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

virtual void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &)
 
void fillExpertHisto (MonitorElement *histo, const std::array< double, 6 > &cut, const std::array< double, 6 > &sigCut, const std::array< double, 6 > &maxMoveCut, const std::array< double, 6 > &maxErrorCut, const std::array< double, 6 > &obs, const std::array< double, 6 > &obsErr)
 
void fillExpertHistos ()
 
int getIndexFromString (const std::string &alignableId)
 
bool setupChanged (const edm::EventSetup &)
 

Private Attributes

MonitorElementh_xPos
 
MonitorElementh_xRot
 
MonitorElementh_yPos
 
MonitorElementh_yRot
 
MonitorElementh_zPos
 
MonitorElementh_zRot
 
std::unique_ptr< MillePedeFileReadermpReader_
 
const edm::ParameterSet mpReaderConfig_
 
std::unique_ptr< AlignableTrackertracker_
 
edm::ESWatcher< IdealGeometryRecordwatchIdealGeometryRcd_
 
edm::ESWatcher< PTrackerParametersRcdwatchPTrackerParametersRcd_
 
edm::ESWatcher< TrackerTopologyRcdwatchTrackerTopologyRcd_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 44 of file MillePedeDQMModule.h.

Constructor & Destructor Documentation

MillePedeDQMModule::MillePedeDQMModule ( const edm::ParameterSet config)

Definition at line 36 of file MillePedeDQMModule.cc.

References ~MillePedeDQMModule().

36  :
38  config.getParameter<edm::ParameterSet>("MillePedeFileReader")
39  )
40 {
41 }
const edm::ParameterSet mpReaderConfig_
T getParameter(std::string const &) const
MillePedeDQMModule::~MillePedeDQMModule ( )
virtual

Definition at line 44 of file MillePedeDQMModule.cc.

References bookHistograms().

Referenced by MillePedeDQMModule().

45 {
46 }

Member Function Documentation

void MillePedeDQMModule::beginRun ( const edm::Run ,
const edm::EventSetup setup 
)
overrideprivatevirtual

Definition at line 92 of file MillePedeDQMModule.cc.

References edm::ParameterSet::addUntrackedParameter(), TrackerGeomBuilderFromGeometricDet::build(), fillExpertHistos(), reco::get(), edm::EventSetup::get(), MillePedeAlignmentAlgorithm_cfi::pedeLabeler, edm::ESHandle< T >::product(), AlignPCLThresholds::setAlignPCLThresholds(), AlCaHLTBitMon_QueryRunRegistry::string, and sistrip::tracker_.

Referenced by dqmEndJob().

92  {
93 
94  if (!setupChanged(setup)) return;
95 
97  setup.get<TrackerTopologyRcd>().get(tTopo);
98  edm::ESHandle<GeometricDet> geometricDet;
99  setup.get<IdealGeometryRecord>().get(geometricDet);
101  setup.get<PTrackerParametersRcd>().get(ptp);
102 
103  // take the thresholds from DB
104  edm::ESHandle<AlignPCLThresholds> thresholdHandle;
105  setup.get<AlignPCLThresholdsRcd>().get(thresholdHandle);
106  auto thresholds_ = thresholdHandle.product();
107 
108  auto myThresholds = std::make_shared<AlignPCLThresholds>();
109  myThresholds->setAlignPCLThresholds(thresholds_->getNrecords(),thresholds_->getThreshold_Map());
110 
112 
113  const auto trackerGeometry = builder.build(&(*geometricDet), *ptp, &(*tTopo));
114  tracker_ = std::make_unique<AlignableTracker>(trackerGeometry, &(*tTopo));
115 
116  const std::string labelerPlugin{"PedeLabeler"};
117  edm::ParameterSet labelerConfig{};
118  labelerConfig.addUntrackedParameter("plugin", labelerPlugin);
119  labelerConfig.addUntrackedParameter("RunRangeSelection", edm::VParameterSet{});
120 
121  std::shared_ptr<PedeLabelerBase> pedeLabeler{
123  ->create(labelerPlugin,
124  PedeLabelerBase::TopLevelAlignables(tracker_.get(), nullptr, nullptr),
125  labelerConfig)
126  };
127 
128 
129  mpReader_ = std::make_unique<MillePedeFileReader>(mpReaderConfig_, pedeLabeler, std::shared_ptr<const AlignPCLThresholds>(myThresholds));
130 
131 }
const edm::ParameterSet mpReaderConfig_
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
bool setupChanged(const edm::EventSetup &)
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:208
void setAlignPCLThresholds(const int &Nrecords, const threshold_map &Thresholds)
const T & get() const
Definition: EventSetup.h:55
std::unique_ptr< AlignableTracker > tracker_
std::unique_ptr< MillePedeFileReader > mpReader_
T const * product() const
Definition: ESHandle.h:86
T get(const Candidate &c)
Definition: component.h:55
void MillePedeDQMModule::bookHistograms ( DQMStore::IBooker booker)
private

Definition at line 53 of file MillePedeDQMModule.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::cd(), dqmEndJob(), and DQMStore::IBooker::setCurrentFolder().

Referenced by ~MillePedeDQMModule().

54 {
55  edm::LogInfo("MillePedeDQMModule") << "Booking histograms";
56 
57  booker.cd();
58  booker.setCurrentFolder("AlCaReco/SiPixelAli/");
59 
60  h_xPos = booker.book1D("Xpos", "Alignment fit #DeltaX;;#mum", 36, 0., 36.);
61  h_xRot = booker.book1D("Xrot", "Alignment fit #Delta#theta_{X};;#murad", 36, 0., 36.);
62  h_yPos = booker.book1D("Ypos", "Alignment fit #DeltaY;;#mum", 36, 0., 36.);
63  h_yRot = booker.book1D("Yrot", "Alignment fit #Delta#theta_{Y};;#murad", 36, 0., 36.);
64  h_zPos = booker.book1D("Zpos", "Alignment fit #DeltaZ;;#mum", 36, 0., 36.);
65  h_zRot = booker.book1D("Zrot", "Alignment fit #Delta#theta_{Z};;#murad", 36, 0., 36.);
66 
67  booker.cd();
68 }
void cd(void)
Definition: DQMStore.cc:269
MonitorElement * h_zPos
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
MonitorElement * h_xPos
MonitorElement * h_yPos
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
MonitorElement * h_xRot
MonitorElement * h_zRot
MonitorElement * h_yRot
void MillePedeDQMModule::dqmEndJob ( DQMStore::IBooker booker,
DQMStore::IGetter  
)
overridevirtual

Implements DQMEDHarvester.

Definition at line 72 of file MillePedeDQMModule.cc.

References beginRun(), bookHistograms(), and Exception.

Referenced by bookHistograms().

73 {
74  bookHistograms(booker);
75  if (mpReader_) {
76  mpReader_->read();
77  } else {
78  throw cms::Exception("LogicError")
79  << "@SUB=MillePedeDQMModule::dqmEndJob\n"
80  << "Try to read MillePede results before initializing MillePedeFileReader";
81  }
83 }
void bookHistograms(DQMStore::IBooker &)
std::unique_ptr< MillePedeFileReader > mpReader_
void MillePedeDQMModule::fillExpertHisto ( MonitorElement histo,
const std::array< double, 6 > &  cut,
const std::array< double, 6 > &  sigCut,
const std::array< double, 6 > &  maxMoveCut,
const std::array< double, 6 > &  maxErrorCut,
const std::array< double, 6 > &  obs,
const std::array< double, 6 > &  obsErr 
)
private

Definition at line 202 of file MillePedeDQMModule.cc.

References MonitorElement::getTH1F(), mps_fire::i, and setupChanged().

Referenced by fillExpertHistos().

206 {
207  TH1F* histo_0 = histo->getTH1F();
208 
209  double max_ = *std::max_element(maxMoveCut.begin(),maxMoveCut.end());
210 
211  histo_0->SetMinimum(-(max_));
212  histo_0->SetMaximum( max_);
213 
214  // Schematics of the bin contents
215  //
216  // XX XX XX XX XX XX OO OO OO OO II II II II
217  // |--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|
218  // | 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|15|16|17| ...
219  //
220  // |-----------------| |-----------| |-----------|
221  // |observed movement| |thresholds1| |thresholds2|
222 
223  for (size_t i = 0; i < obs.size(); ++i) {
224 
225  // fist obs.size() bins for observed movements
226  histo_0->SetBinContent(i+1, obs[i]);
227  histo_0->SetBinError(i+1, obsErr[i]);
228 
229  // then at bin 8,8+5,8+10,... for cutoffs
230  // 5 bins is the space allocated for the 4 other thresholds + 1 empty separation bin
231  histo_0->SetBinContent(8+i*5 , cut[i]);
232 
233  // then at bin 9,9+5,9+10,... for significances
234  histo_0->SetBinContent(9+i*5 , sigCut[i]);
235 
236  // then at bin 10,10+5,10+10,... for maximum movements
237  histo_0->SetBinContent(10+i*5, maxMoveCut[i]);
238 
239  // then at bin 11,11+5,11+10,... for maximum errors
240  histo_0->SetBinContent(11+i*5, maxErrorCut[i]);
241 
242  }
243 }
TH1F * getTH1F(void) const
void MillePedeDQMModule::fillExpertHistos ( )
private

Definition at line 135 of file MillePedeDQMModule.cc.

References fillExpertHisto().

Referenced by beginRun().

136 {
137 
138  std::array<double, 6> Xcut_, sigXcut_, maxMoveXcut_, maxErrorXcut_;
139  std::array<double, 6> tXcut_, sigtXcut_, maxMovetXcut_, maxErrortXcut_;
140 
141  std::array<double, 6> Ycut_, sigYcut_, maxMoveYcut_, maxErrorYcut_;
142  std::array<double, 6> tYcut_, sigtYcut_, maxMovetYcut_, maxErrortYcut_;
143 
144  std::array<double, 6> Zcut_, sigZcut_, maxMoveZcut_, maxErrorZcut_;
145  std::array<double, 6> tZcut_, sigtZcut_, maxMovetZcut_, maxErrortZcut_;
146 
147  auto myMap = mpReader_->getThresholdMap();
148 
149  std::vector<std::string> alignablesList;
150  for(auto it = myMap.begin(); it != myMap.end() ; ++it){
151  alignablesList.push_back(it->first);
152  }
153 
154  for (auto &alignable : alignablesList){
155 
156  int detIndex = getIndexFromString(alignable);
157 
158  Xcut_[detIndex] = myMap[alignable].getXcut() ;
159  sigXcut_[detIndex] = myMap[alignable].getSigXcut() ;
160  maxMoveXcut_[detIndex] = myMap[alignable].getMaxMoveXcut() ;
161  maxErrorXcut_[detIndex] = myMap[alignable].getErrorXcut() ;
162 
163  Ycut_[detIndex] = myMap[alignable].getYcut() ;
164  sigYcut_[detIndex] = myMap[alignable].getSigYcut() ;
165  maxMoveYcut_[detIndex] = myMap[alignable].getMaxMoveYcut() ;
166  maxErrorYcut_[detIndex] = myMap[alignable].getErrorYcut() ;
167 
168  Zcut_[detIndex] = myMap[alignable].getZcut() ;
169  sigZcut_[detIndex] = myMap[alignable].getSigZcut() ;
170  maxMoveZcut_[detIndex] = myMap[alignable].getMaxMoveZcut() ;
171  maxErrorZcut_[detIndex] = myMap[alignable].getErrorZcut() ;
172 
173  tXcut_[detIndex] = myMap[alignable].getThetaXcut() ;
174  sigtXcut_[detIndex] = myMap[alignable].getSigThetaXcut() ;
175  maxMovetXcut_[detIndex] = myMap[alignable].getMaxMoveThetaXcut() ;
176  maxErrortXcut_[detIndex] = myMap[alignable].getErrorThetaXcut() ;
177 
178  tYcut_[detIndex] = myMap[alignable].getThetaYcut() ;
179  sigtYcut_[detIndex] = myMap[alignable].getSigThetaYcut() ;
180  maxMovetYcut_[detIndex] = myMap[alignable].getMaxMoveThetaYcut() ;
181  maxErrortYcut_[detIndex] = myMap[alignable].getErrorThetaYcut() ;
182 
183  tZcut_[detIndex] = myMap[alignable].getThetaZcut() ;
184  sigtZcut_[detIndex] = myMap[alignable].getSigThetaYcut() ;
185  maxMovetZcut_[detIndex] = myMap[alignable].getMaxMoveThetaYcut() ;
186  maxErrortZcut_[detIndex] = myMap[alignable].getErrorThetaYcut() ;
187 
188  }
189 
190  fillExpertHisto(h_xPos, Xcut_, sigXcut_, maxMoveXcut_, maxErrorXcut_, mpReader_->getXobs(), mpReader_->getXobsErr());
191  fillExpertHisto(h_xRot, tXcut_, sigtXcut_, maxMovetXcut_, maxErrortXcut_, mpReader_->getTXobs(), mpReader_->getTXobsErr());
192 
193  fillExpertHisto(h_yPos, Ycut_, sigYcut_, maxMoveYcut_, maxErrorYcut_, mpReader_->getYobs(), mpReader_->getYobsErr());
194  fillExpertHisto(h_yRot, tYcut_, sigtYcut_, maxMovetYcut_, maxErrortYcut_, mpReader_->getTYobs(), mpReader_->getTYobsErr());
195 
196  fillExpertHisto(h_zPos, Zcut_, sigZcut_, maxMoveZcut_, maxErrorZcut_, mpReader_->getZobs(), mpReader_->getZobsErr());
197  fillExpertHisto(h_zRot, tZcut_, sigtZcut_, maxMovetZcut_, maxErrortZcut_, mpReader_->getTZobs(), mpReader_->getTZobsErr());
198 
199 }
MonitorElement * h_zPos
MonitorElement * h_xPos
void fillExpertHisto(MonitorElement *histo, const std::array< double, 6 > &cut, const std::array< double, 6 > &sigCut, const std::array< double, 6 > &maxMoveCut, const std::array< double, 6 > &maxErrorCut, const std::array< double, 6 > &obs, const std::array< double, 6 > &obsErr)
MonitorElement * h_yPos
MonitorElement * h_xRot
std::unique_ptr< MillePedeFileReader > mpReader_
int getIndexFromString(const std::string &alignableId)
MonitorElement * h_zRot
MonitorElement * h_yRot
int MillePedeDQMModule::getIndexFromString ( const std::string &  alignableId)
private

Definition at line 259 of file MillePedeDQMModule.cc.

References Exception.

Referenced by setupChanged().

260 {
261 
262  if(alignableId == "TPBHalfBarrelXminus"){
263  return 3;
264  } else if(alignableId == "TPBHalfBarrelXplus"){
265  return 2;
266  } else if(alignableId == "TPEHalfCylinderXminusZminus") {
267  return 1;
268  } else if(alignableId == "TPEHalfCylinderXplusZminus") {
269  return 0;
270  } else if(alignableId == "TPEHalfCylinderXminusZplus") {
271  return 5;
272  } else if(alignableId == "TPEHalfCylinderXplusZplus") {
273  return 4;
274  } else{
275  throw cms::Exception("LogicError")
276  << "@SUB=MillePedeDQMModule::getIndexFromString\n"
277  << "Retrieving conversion for not supported Alignable partition"
278  << alignableId;
279  }
280 }
bool MillePedeDQMModule::setupChanged ( const edm::EventSetup setup)
private

Definition at line 246 of file MillePedeDQMModule.cc.

References getIndexFromString().

Referenced by fillExpertHisto().

247 {
248  bool changed{false};
249 
250  if (watchIdealGeometryRcd_.check(setup)) changed = true;
251  if (watchTrackerTopologyRcd_.check(setup)) changed = true;
252  if (watchPTrackerParametersRcd_.check(setup)) changed = true;
253 
254  return changed;
255 }
edm::ESWatcher< IdealGeometryRecord > watchIdealGeometryRcd_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
edm::ESWatcher< TrackerTopologyRcd > watchTrackerTopologyRcd_
edm::ESWatcher< PTrackerParametersRcd > watchPTrackerParametersRcd_

Member Data Documentation

MonitorElement* MillePedeDQMModule::h_xPos
private

Definition at line 86 of file MillePedeDQMModule.h.

MonitorElement* MillePedeDQMModule::h_xRot
private

Definition at line 87 of file MillePedeDQMModule.h.

MonitorElement* MillePedeDQMModule::h_yPos
private

Definition at line 88 of file MillePedeDQMModule.h.

MonitorElement* MillePedeDQMModule::h_yRot
private

Definition at line 89 of file MillePedeDQMModule.h.

MonitorElement* MillePedeDQMModule::h_zPos
private

Definition at line 90 of file MillePedeDQMModule.h.

MonitorElement* MillePedeDQMModule::h_zRot
private

Definition at line 91 of file MillePedeDQMModule.h.

std::unique_ptr<MillePedeFileReader> MillePedeDQMModule::mpReader_
private

Definition at line 79 of file MillePedeDQMModule.h.

const edm::ParameterSet MillePedeDQMModule::mpReaderConfig_
private

Definition at line 77 of file MillePedeDQMModule.h.

std::unique_ptr<AlignableTracker> MillePedeDQMModule::tracker_
private

Definition at line 78 of file MillePedeDQMModule.h.

edm::ESWatcher<IdealGeometryRecord> MillePedeDQMModule::watchIdealGeometryRcd_
private

Definition at line 82 of file MillePedeDQMModule.h.

edm::ESWatcher<PTrackerParametersRcd> MillePedeDQMModule::watchPTrackerParametersRcd_
private

Definition at line 83 of file MillePedeDQMModule.h.

edm::ESWatcher<TrackerTopologyRcd> MillePedeDQMModule::watchTrackerTopologyRcd_
private

Definition at line 81 of file MillePedeDQMModule.h.