CMS 3D CMS Logo

TrackerOfflineValidation.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: TrackerOfflineValidation
4 // Class: TrackerOfflineValidation
5 //
13 //
14 // Original Author: Erik Butz
15 // Created: Tue Dec 11 14:03:05 CET 2007
16 // $Id: TrackerOfflineValidation.cc,v 1.55 2012/09/28 20:48:06 flucke Exp $
17 //
18 //
19 
20 // system include files
21 #include <memory>
22 #include <map>
23 #include <sstream>
24 #include <cmath>
25 #include <tuple>
26 #include <utility>
27 #include <vector>
28 #include <iostream>
29 
30 // ROOT includes
31 #include "TH1.h"
32 #include "TH2.h"
33 #include "TProfile.h"
34 #include "TFile.h"
35 #include "TTree.h"
36 #include "TF1.h"
37 #include "TMath.h"
38 
39 // user include files
49 
55 
58 
63 
65 
71 
74 
75 //
76 // class declaration
77 //
79 public:
82  ~TrackerOfflineValidation() override;
83 
87  YResidual, /*NormYResidual, */
94  };
95 
96 private:
97  struct ModuleHistos {
99  : ResHisto(),
100  NormResHisto(),
101  ResYHisto(), /*NormResYHisto(),*/
102  ResXprimeHisto(),
104  ResYprimeHisto(),
106  ResXvsXProfile(),
107  ResXvsYProfile(),
108  ResYvsXProfile(),
109  ResYvsYProfile(),
110  LocalX(),
111  LocalY() {}
112  TH1* ResHisto;
114  TH1* ResYHisto;
115  /* TH1* NormResYHisto; */
120 
121  TProfile* ResXvsXProfile;
122  TProfile* ResXvsYProfile;
123  TProfile* ResYvsXProfile;
124  TProfile* ResYvsYProfile;
125 
126  TH1* LocalX;
127  TH1* LocalY;
128  };
129 
130  // container struct to organize collection of histograms during endJob
133  : sumXResiduals_(),
137  sumYResiduals_(),
144  sumResYvsYProfile_() {}
145 
154 
159  };
160 
163  const std::string& newDir,
164  const std::string& basedir,
165  bool useDqmMode)
166  : tfd(nullptr), dqmMode(useDqmMode), theDbe(nullptr) {
167  if (newDir.length() != 0) {
168  if (upDir.directoryString.length() != 0)
169  directoryString = upDir.directoryString + "/" + newDir;
170  else
171  directoryString = newDir;
172  } else
174 
175  if (!dqmMode) {
176  if (newDir.length() == 0)
177  tfd.reset(&(*upDir.tfd));
178  else
179  tfd.reset(new TFileDirectory(upDir.tfd->mkdir(newDir)));
180  } else {
181  theDbe = edm::Service<DQMStore>().operator->();
182  }
183  }
184 
185  DirectoryWrapper(const std::string& newDir, const std::string& basedir, bool useDqmMode)
186  : tfd(nullptr), dqmMode(useDqmMode), theDbe(nullptr) {
187  if (!dqmMode) {
189  if (newDir.length() == 0) {
190  tfd.reset(new TFileDirectory(fs->tFileDirectory()));
191  } else {
192  tfd.reset(new TFileDirectory(fs->mkdir(newDir)));
193  directoryString = newDir;
194  }
195  } else {
196  if (newDir.length() != 0) {
197  if (basedir.length() != 0)
198  directoryString = basedir + "/" + newDir;
199  else
200  directoryString = newDir;
201  } else
203  theDbe = edm::Service<DQMStore>().operator->();
204  }
205  }
206  // Generalization of Histogram Booking; allows switch between TFileService and DQMStore
207  template <typename T>
208  TH1* make(const char* name, const char* title, int nBinX, double minBinX, double maxBinX);
209  template <typename T>
210  TH1* make(const char* name, const char* title, int nBinX, double* xBins); //variable bin size in x for profile histo
211  template <typename T>
212  TH1* make(const char* name,
213  const char* title,
214  int nBinX,
215  double minBinX,
216  double maxBinX,
217  int nBinY,
218  double minBinY,
219  double maxBinY);
220  template <typename T>
221  TH1* make(const char* name,
222  const char* title,
223  int nBinX,
224  double minBinX,
225  double maxBinX,
226  double minBinY,
227  double maxBinY); // at present not used
228 
229  std::unique_ptr<TFileDirectory> tfd;
231  const bool dqmMode;
233  };
234 
235  //
236  // ------------- private member function -------------
237  //
238  void analyze(const edm::Event&, const edm::EventSetup&) override;
239  void endJob() override;
240 
241  virtual void checkBookHists(const edm::EventSetup& setup);
242 
244  void bookDirHists(DirectoryWrapper& tfd, const Alignable& ali, const TrackerTopology* tTopo);
245  void bookHists(
246  DirectoryWrapper& tfd, const Alignable& ali, const TrackerTopology* tTopo, align::StructureType type, int i);
247 
249  const Alignable& ali,
250  std::vector<TrackerOfflineValidation::SummaryContainer>& vLevelProfiles);
251  void collateSummaryHists();
252 
253  void setUpTreeMembers(const std::map<int, TrackerOfflineValidation::ModuleHistos>& moduleHist_,
254  const TrackerGeometry& tkgeom,
255  const TrackerTopology* tTopo);
256  void fillTree(TTree& tree,
257  TkOffTreeVariables& treeMem,
258  const std::map<int, TrackerOfflineValidation::ModuleHistos>& moduleHist_);
259 
261  const Alignable& ali,
263  int i);
264 
265  ModuleHistos& getHistStructFromMap(const DetId& detid);
266 
267  bool isBarrel(uint32_t subDetId);
268  bool isEndCap(uint32_t subDetId);
269  bool isPixel(uint32_t subDetId);
271 
272  TH1* bookTH1F(bool isTransient,
273  DirectoryWrapper& tfd,
274  const char* histName,
275  const char* histTitle,
276  int nBinsX,
277  double lowX,
278  double highX);
279 
280  TProfile* bookTProfile(bool isTransient,
281  DirectoryWrapper& tfd,
282  const char* histName,
283  const char* histTitle,
284  int nBinsX,
285  double lowX,
286  double highX);
287 
288  TProfile* bookTProfile(bool isTransient,
289  DirectoryWrapper& tfd,
290  const char* histName,
291  const char* histTitle,
292  int nBinsX,
293  double lowX,
294  double highX,
295  double lowY,
296  double highY);
297 
298  void getBinning(uint32_t subDetId,
300  int& nBinsX,
301  double& lowerBoundX,
302  double& upperBoundX);
303 
304  void summarizeBinInContainer(int bin, SummaryContainer& targetContainer, SummaryContainer& sourceContainer);
305 
306  void summarizeBinInContainer(int bin,
307  uint32_t subDetId,
308  SummaryContainer& targetContainer,
309  ModuleHistos& sourceContainer);
310 
311  void setSummaryBin(int bin, TH1* targetHist, TH1* sourceHist);
312 
313  float Fwhm(const TH1* hist) const;
314  std::pair<float, float> fitResiduals(TH1* hist) const; //, float meantmp, float rmstmp);
315  float getMedian(const TH1* hist) const;
316 
317  // From MillePedeAlignmentMonitor: Get Index for Arbitary vector<class> by name
318  template <class OBJECT_TYPE>
319  int GetIndex(const std::vector<OBJECT_TYPE*>& vec, const TString& name);
320 
321  // ---------- member data ---------------------------
322 
325  const TrackerGeometry* bareTkGeomPtr_; // ugly hack to book hists only once, but check
326  std::unique_ptr<AlignableTracker> alignableTracker_;
327 
328  // parameters from cfg to steer
329  const bool lCoorHistOn_;
332  const bool stripYResiduals_;
333  const bool useFwhm_;
334  const bool useFit_;
335  const bool useOverflowForRMS_;
336  const bool dqmMode_;
338 
339  const int chargeCut_;
340 
341  // a vector to keep track which pointers should be deleted at the very end
342  std::vector<TH1*> vDeleteObjects_;
343 
344  std::vector<TH1*> vTrackHistos_;
345  std::vector<TH1*> vTrackProfiles_;
346  std::vector<TH1*> vTrack2DHistos_;
347 
348  std::map<int, TrackerOfflineValidation::ModuleHistos> mPxbResiduals_;
349  std::map<int, TrackerOfflineValidation::ModuleHistos> mPxeResiduals_;
350  std::map<int, TrackerOfflineValidation::ModuleHistos> mTibResiduals_;
351  std::map<int, TrackerOfflineValidation::ModuleHistos> mTidResiduals_;
352  std::map<int, TrackerOfflineValidation::ModuleHistos> mTobResiduals_;
353  std::map<int, TrackerOfflineValidation::ModuleHistos> mTecResiduals_;
354 
355  std::map<int, TkOffTreeVariables> mTreeMembers_;
356 
357  //There are two types of summary histograms. The first contains, for each component, a bin per subcomponent.
358  //These are set up through summarizeBinInContainer(). The second type is just the sum of the lower level histograms.
359  //Prepare the filling of both types at the beginning, when the tracker topology is available through the eventsetup.
360  //They are not actually filled until the end, but at that time eventsetup is no longer accessible.
361 
362  //To fill the summary hists, store the arguments of setSummaryBin()
363  //At the end, call the function
364  std::vector<std::tuple<int, TH1*, TH1*> > summaryBins_;
365  //To fill the sum hists, just store pairs of TH1*. At the end, first->Add(second).
366  std::vector<std::pair<TH1*, TH1*> > sumHistStructure_;
367  //sum hists are fit at the end using fitResiduals()
368  std::vector<TH1*> toFit_;
369 
370  unsigned long long nTracks_;
371  const unsigned long long maxTracks_;
372 
374 };
375 
376 //
377 // constants, enums and typedefs
378 //
379 
380 //
381 // static data member definitions
382 //
383 
384 template <class OBJECT_TYPE>
385 int TrackerOfflineValidation::GetIndex(const std::vector<OBJECT_TYPE*>& vec, const TString& name) {
386  int result = 0;
387  for (typename std::vector<OBJECT_TYPE*>::const_iterator iter = vec.begin(), iterEnd = vec.end(); iter != iterEnd;
388  ++iter, ++result) {
389  if (*iter && (*iter)->GetName() == name)
390  return result;
391  }
392  edm::LogError("Alignment") << "@SUB=TrackerOfflineValidation::GetIndex"
393  << " could not find " << name;
394  return -1;
395 }
396 
397 template <>
398 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TH1F>(
399  const char* name, const char* title, int nBinX, double minBinX, double maxBinX) {
400  if (dqmMode) {
402  return theDbe->book1D(name, title, nBinX, minBinX, maxBinX)->getTH1();
403  } else {
404  return tfd->make<TH1F>(name, title, nBinX, minBinX, maxBinX);
405  }
406 }
407 
408 template <>
409 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TProfile>(const char* name,
410  const char* title,
411  int nBinX,
412  double* xBins) {
413  if (dqmMode) {
414  theDbe->setCurrentFolder(directoryString);
415  //DQM profile requires y-bins for construction... using TProfile creator by hand...
416  TProfile* tmpProfile = new TProfile(name, title, nBinX, xBins);
417  tmpProfile->SetDirectory(nullptr);
418  return theDbe->bookProfile(name, tmpProfile)->getTH1();
419  } else {
420  return tfd->make<TProfile>(name, title, nBinX, xBins);
421  }
422 }
423 
424 template <>
425 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TProfile>(
426  const char* name, const char* title, int nBinX, double minBinX, double maxBinX) {
427  if (dqmMode) {
428  theDbe->setCurrentFolder(directoryString);
429  //DQM profile requires y-bins for construction... using TProfile creator by hand...
430  TProfile* tmpProfile = new TProfile(name, title, nBinX, minBinX, maxBinX);
431  tmpProfile->SetDirectory(nullptr);
432  return theDbe->bookProfile(name, tmpProfile)->getTH1();
433  } else {
434  return tfd->make<TProfile>(name, title, nBinX, minBinX, maxBinX);
435  }
436 }
437 
438 template <>
439 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TProfile>(
440  const char* name, const char* title, int nbinX, double minX, double maxX, double minY, double maxY) {
441  if (dqmMode) {
442  theDbe->setCurrentFolder(directoryString);
443  int dummy(0); // DQMProfile wants Y channels... does not use them!
444  return (theDbe->bookProfile(name, title, nbinX, minX, maxX, dummy, minY, maxY)->getTH1());
445  } else {
446  return tfd->make<TProfile>(name, title, nbinX, minX, maxX, minY, maxY);
447  }
448 }
449 
450 template <>
451 TH1* TrackerOfflineValidation::DirectoryWrapper::make<TH2F>(const char* name,
452  const char* title,
453  int nBinX,
454  double minBinX,
455  double maxBinX,
456  int nBinY,
457  double minBinY,
458  double maxBinY) {
459  if (dqmMode) {
460  theDbe->setCurrentFolder(directoryString);
461  return theDbe->book2D(name, title, nBinX, minBinX, maxBinX, nBinY, minBinY, maxBinY)->getTH1();
462  } else {
463  return tfd->make<TH2F>(name, title, nBinX, minBinX, maxBinX, nBinY, minBinY, maxBinY);
464  }
465 }
466 
467 //
468 // constructors and destructor
469 //
471  : parSet_(iConfig),
472  bareTkGeomPtr_(nullptr),
473  lCoorHistOn_(parSet_.getParameter<bool>("localCoorHistosOn")),
474  moduleLevelHistsTransient_(parSet_.getParameter<bool>("moduleLevelHistsTransient")),
475  moduleLevelProfiles_(parSet_.getParameter<bool>("moduleLevelProfiles")),
476  stripYResiduals_(parSet_.getParameter<bool>("stripYResiduals")),
477  useFwhm_(parSet_.getParameter<bool>("useFwhm")),
478  useFit_(parSet_.getParameter<bool>("useFit")),
479  useOverflowForRMS_(parSet_.getParameter<bool>("useOverflowForRMS")),
480  dqmMode_(parSet_.getParameter<bool>("useInDqmMode")),
481  moduleDirectory_(parSet_.getParameter<std::string>("moduleDirectoryInOutput")),
482  chargeCut_(parSet_.getParameter<int>("chargeCut")),
483  nTracks_(0),
484  maxTracks_(parSet_.getParameter<unsigned long long>("maxTracks")),
485  avalidator_(iConfig, consumesCollector()) {}
486 
488  // do anything here that needs to be done at desctruction time
489  // (e.g. close files, deallocate resources etc.)
490  for (std::vector<TH1*>::const_iterator it = vDeleteObjects_.begin(), itEnd = vDeleteObjects_.end(); it != itEnd; ++it)
491  delete *it;
492 }
493 
494 //
495 // member functions
496 //
497 
498 // ------------ method called once each job just before starting event loop ------------
501  const TrackerGeometry* newBareTkGeomPtr = &(*tkGeom_);
502  if (newBareTkGeomPtr == bareTkGeomPtr_)
503  return; // already booked hists, nothing changed
504 
505  if (!bareTkGeomPtr_) { // pointer not yet set: called the first time => book hists
506 
507  //Retrieve tracker topology from geometry
508  edm::ESHandle<TrackerTopology> tTopoHandle;
509  es.get<TrackerTopologyRcd>().get(tTopoHandle);
510  const TrackerTopology* const tTopo = tTopoHandle.product();
511 
512  // construct alignable tracker to get access to alignable hierarchy
513  alignableTracker_ = std::make_unique<AlignableTracker>(&(*tkGeom_), tTopo);
514 
515  edm::LogInfo("TrackerOfflineValidation")
516  << "There are " << newBareTkGeomPtr->detIds().size() << " dets in the Geometry record.\n"
517  << "Out of these " << newBareTkGeomPtr->detUnitIds().size() << " are detUnits";
518 
519  // Book histograms for global track quantities
520  std::string globDir("GlobalTrackVariables");
521  DirectoryWrapper trackglobal(globDir, moduleDirectory_, dqmMode_);
522  this->bookGlobalHists(trackglobal);
523 
524  // recursively book histograms on lowest level
526  this->bookDirHists(tfdw, *alignableTracker_, tTopo);
527  // and prepare the higher level histograms
528  std::vector<TrackerOfflineValidation::SummaryContainer> vTrackerprofiles;
529  this->prepareSummaryHists(tfdw, *alignableTracker_, vTrackerprofiles);
530 
531  setUpTreeMembers(mPxbResiduals_, *newBareTkGeomPtr, tTopo);
532  setUpTreeMembers(mPxeResiduals_, *newBareTkGeomPtr, tTopo);
533  setUpTreeMembers(mTibResiduals_, *newBareTkGeomPtr, tTopo);
534  setUpTreeMembers(mTidResiduals_, *newBareTkGeomPtr, tTopo);
535  setUpTreeMembers(mTobResiduals_, *newBareTkGeomPtr, tTopo);
536  setUpTreeMembers(mTecResiduals_, *newBareTkGeomPtr, tTopo);
537  } else { // histograms booked, but changed TrackerGeometry?
538  edm::LogWarning("GeometryChange") << "@SUB=checkBookHists"
539  << "TrackerGeometry changed, but will not re-book hists!";
540  }
541  bareTkGeomPtr_ = newBareTkGeomPtr;
542 }
543 
545  vTrackHistos_.push_back(tfd.make<TH1F>("h_tracketa", "Track #eta;#eta_{Track};Number of Tracks", 90, -3., 3.));
546  vTrackHistos_.push_back(tfd.make<TH1F>("h_trackphi", "Track #phi;#phi_{Track};Number of Tracks", 90, -3.15, 3.15));
547  vTrackHistos_.push_back(tfd.make<TH1F>(
548  "h_trackNumberOfValidHits", "Track # of valid hits;# of valid hits _{Track};Number of Tracks", 40, 0., 40.));
549  vTrackHistos_.push_back(tfd.make<TH1F>(
550  "h_trackNumberOfLostHits", "Track # of lost hits;# of lost hits _{Track};Number of Tracks", 10, 0., 10.));
551  vTrackHistos_.push_back(
552  tfd.make<TH1F>("h_curvature", "Curvature #kappa;#kappa_{Track};Number of Tracks", 100, -.05, .05));
553  vTrackHistos_.push_back(tfd.make<TH1F>(
554  "h_curvature_pos", "Curvature |#kappa| Positive Tracks;|#kappa_{pos Track}|;Number of Tracks", 100, .0, .05));
555  vTrackHistos_.push_back(tfd.make<TH1F>(
556  "h_curvature_neg", "Curvature |#kappa| Negative Tracks;|#kappa_{neg Track}|;Number of Tracks", 100, .0, .05));
557  vTrackHistos_.push_back(
558  tfd.make<TH1F>("h_diff_curvature",
559  "Curvature |#kappa| Tracks Difference;|#kappa_{Track}|;# Pos Tracks - # Neg Tracks",
560  100,
561  .0,
562  .05));
563  vTrackHistos_.push_back(tfd.make<TH1F>("h_chi2", "#chi^{2};#chi^{2}_{Track};Number of Tracks", 500, -0.01, 500.));
564  vTrackHistos_.push_back(
565  tfd.make<TH1F>("h_chi2Prob", "#chi^{2} probability;#chi^{2}prob_{Track};Number of Tracks", 100, 0.0, 1.));
566  vTrackHistos_.push_back(
567  tfd.make<TH1F>("h_normchi2", "#chi^{2}/ndof;#chi^{2}/ndof;Number of Tracks", 100, -0.01, 10.));
568  vTrackHistos_.push_back(tfd.make<TH1F>("h_pt", "p_{T}^{track};p_{T}^{track} [GeV];Number of Tracks", 250, 0., 250));
569  vTrackHistos_.push_back(tfd.make<TH1F>(
570  "h_ptResolution", "#delta_{p_{T}}/p_{T}^{track};#delta_{p_{T}}/p_{T}^{track};Number of Tracks", 100, 0., 0.5));
571  vTrackProfiles_.push_back(tfd.make<TProfile>(
572  "p_d0_vs_phi", "Transverse Impact Parameter vs. #phi;#phi_{Track};#LT d_{0} #GT [cm]", 100, -3.15, 3.15));
573  vTrackProfiles_.push_back(tfd.make<TProfile>(
574  "p_dz_vs_phi", "Longitudinal Impact Parameter vs. #phi;#phi_{Track};#LT d_{z} #GT [cm]", 100, -3.15, 3.15));
575  vTrackProfiles_.push_back(tfd.make<TProfile>(
576  "p_d0_vs_eta", "Transverse Impact Parameter vs. #eta;#eta_{Track};#LT d_{0} #GT [cm]", 100, -3.15, 3.15));
577  vTrackProfiles_.push_back(tfd.make<TProfile>(
578  "p_dz_vs_eta", "Longitudinal Impact Parameter vs. #eta;#eta_{Track};#LT d_{z} #GT [cm]", 100, -3.15, 3.15));
579  vTrackProfiles_.push_back(
580  tfd.make<TProfile>("p_chi2_vs_phi", "#chi^{2} vs. #phi;#phi_{Track};#LT #chi^{2} #GT", 100, -3.15, 3.15));
581  vTrackProfiles_.push_back(tfd.make<TProfile>(
582  "p_chi2Prob_vs_phi", "#chi^{2} probablility vs. #phi;#phi_{Track};#LT #chi^{2} probability#GT", 100, -3.15, 3.15));
583  vTrackProfiles_.push_back(tfd.make<TProfile>(
584  "p_chi2Prob_vs_d0", "#chi^{2} probablility vs. |d_{0}|;|d_{0}|[cm];#LT #chi^{2} probability#GT", 100, 0, 80));
585  vTrackProfiles_.push_back(tfd.make<TProfile>(
586  "p_normchi2_vs_phi", "#chi^{2}/ndof vs. #phi;#phi_{Track};#LT #chi^{2}/ndof #GT", 100, -3.15, 3.15));
587  vTrackProfiles_.push_back(
588  tfd.make<TProfile>("p_chi2_vs_eta", "#chi^{2} vs. #eta;#eta_{Track};#LT #chi^{2} #GT", 100, -3.15, 3.15));
589  //variable binning for chi2/ndof vs. pT
590  double xBins[19] = {0., 0.15, 0.5, 1., 1.5, 2., 2.5, 3., 3.5, 4., 4.5, 5., 7., 10., 15., 25., 40., 100., 200.};
591  vTrackProfiles_.push_back(tfd.make<TProfile>(
592  "p_normchi2_vs_pt", "norm #chi^{2} vs. p_{T}_{Track}; p_{T}_{Track};#LT #chi^{2}/ndof #GT", 18, xBins));
593 
594  vTrackProfiles_.push_back(
595  tfd.make<TProfile>("p_normchi2_vs_p", "#chi^{2}/ndof vs. p_{Track};p_{Track};#LT #chi^{2}/ndof #GT", 18, xBins));
596  vTrackProfiles_.push_back(tfd.make<TProfile>(
597  "p_chi2Prob_vs_eta", "#chi^{2} probability vs. #eta;#eta_{Track};#LT #chi^{2} probability #GT", 100, -3.15, 3.15));
598  vTrackProfiles_.push_back(tfd.make<TProfile>(
599  "p_normchi2_vs_eta", "#chi^{2}/ndof vs. #eta;#eta_{Track};#LT #chi^{2}/ndof #GT", 100, -3.15, 3.15));
600  vTrackProfiles_.push_back(
601  tfd.make<TProfile>("p_kappa_vs_phi", "#kappa vs. #phi;#phi_{Track};#kappa", 100, -3.15, 3.15));
602  vTrackProfiles_.push_back(
603  tfd.make<TProfile>("p_kappa_vs_eta", "#kappa vs. #eta;#eta_{Track};#kappa", 100, -3.15, 3.15));
604  vTrackProfiles_.push_back(tfd.make<TProfile>("p_ptResolution_vs_phi",
605  "#delta_{p_{T}}/p_{T}^{track};#phi^{track};#delta_{p_{T}}/p_{T}^{track}",
606  100,
607  -3.15,
608  3.15));
609  vTrackProfiles_.push_back(tfd.make<TProfile>("p_ptResolution_vs_eta",
610  "#delta_{p_{T}}/p_{T}^{track};#eta^{track};#delta_{p_{T}}/p_{T}^{track}",
611  100,
612  -3.15,
613  3.15));
614 
615  vTrack2DHistos_.push_back(tfd.make<TH2F>(
616  "h2_d0_vs_phi", "Transverse Impact Parameter vs. #phi;#phi_{Track};d_{0} [cm]", 100, -3.15, 3.15, 100, -1., 1.));
617  vTrack2DHistos_.push_back(tfd.make<TH2F>("h2_dz_vs_phi",
618  "Longitudinal Impact Parameter vs. #phi;#phi_{Track};d_{z} [cm]",
619  100,
620  -3.15,
621  3.15,
622  100,
623  -100.,
624  100.));
625  vTrack2DHistos_.push_back(tfd.make<TH2F>(
626  "h2_d0_vs_eta", "Transverse Impact Parameter vs. #eta;#eta_{Track};d_{0} [cm]", 100, -3.15, 3.15, 100, -1., 1.));
627  vTrack2DHistos_.push_back(tfd.make<TH2F>("h2_dz_vs_eta",
628  "Longitudinal Impact Parameter vs. #eta;#eta_{Track};d_{z} [cm]",
629  100,
630  -3.15,
631  3.15,
632  100,
633  -100.,
634  100.));
635  vTrack2DHistos_.push_back(
636  tfd.make<TH2F>("h2_chi2_vs_phi", "#chi^{2} vs. #phi;#phi_{Track};#chi^{2}", 100, -3.15, 3.15, 500, 0., 500.));
637  vTrack2DHistos_.push_back(tfd.make<TH2F>("h2_chi2Prob_vs_phi",
638  "#chi^{2} probability vs. #phi;#phi_{Track};#chi^{2} probability",
639  100,
640  -3.15,
641  3.15,
642  100,
643  0.,
644  1.));
645  vTrack2DHistos_.push_back(tfd.make<TH2F>("h2_chi2Prob_vs_d0",
646  "#chi^{2} probability vs. |d_{0}|;|d_{0}| [cm];#chi^{2} probability",
647  100,
648  0,
649  80,
650  100,
651  0.,
652  1.));
653  vTrack2DHistos_.push_back(tfd.make<TH2F>(
654  "h2_normchi2_vs_phi", "#chi^{2}/ndof vs. #phi;#phi_{Track};#chi^{2}/ndof", 100, -3.15, 3.15, 100, 0., 10.));
655  vTrack2DHistos_.push_back(
656  tfd.make<TH2F>("h2_chi2_vs_eta", "#chi^{2} vs. #eta;#eta_{Track};#chi^{2}", 100, -3.15, 3.15, 500, 0., 500.));
657  vTrack2DHistos_.push_back(tfd.make<TH2F>("h2_chi2Prob_vs_eta",
658  "#chi^{2} probaility vs. #eta;#eta_{Track};#chi^{2} probability",
659  100,
660  -3.15,
661  3.15,
662  100,
663  0.,
664  1.));
665  vTrack2DHistos_.push_back(tfd.make<TH2F>(
666  "h2_normchi2_vs_eta", "#chi^{2}/ndof vs. #eta;#eta_{Track};#chi^{2}/ndof", 100, -3.15, 3.15, 100, 0., 10.));
667  vTrack2DHistos_.push_back(
668  tfd.make<TH2F>("h2_kappa_vs_phi", "#kappa vs. #phi;#phi_{Track};#kappa", 100, -3.15, 3.15, 100, .0, .05));
669  vTrack2DHistos_.push_back(
670  tfd.make<TH2F>("h2_kappa_vs_eta", "#kappa vs. #eta;#eta_{Track};#kappa", 100, -3.15, 3.15, 100, .0, .05));
671  vTrack2DHistos_.push_back(tfd.make<TH2F>(
672  "h2_normchi2_vs_kappa", "#kappa vs. #chi^{2}/ndof;#chi^{2}/ndof;#kappa", 100, 0., 10, 100, -.03, .03));
673 
674  /****************** Definition of 2-D Histos of ResX vs momenta ****************************/
675  vTrack2DHistos_.push_back(tfd.make<TH2F>(
676  "p_vs_resXprime_pixB", "res_{x'} vs momentum in BPix;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
677  vTrack2DHistos_.push_back(tfd.make<TH2F>(
678  "p_vs_resXprime_pixE", "res_{x'} vs momentum in FPix;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
679  vTrack2DHistos_.push_back(tfd.make<TH2F>(
680  "p_vs_resXprime_TIB", "res_{x'} vs momentum in TIB;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
681  vTrack2DHistos_.push_back(tfd.make<TH2F>(
682  "p_vs_resXprime_TID", "res_{x'} vs momentum in TID;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
683  vTrack2DHistos_.push_back(tfd.make<TH2F>(
684  "p_vs_resXprime_TOB", "res_{x'} vs momentum in TOB;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
685  vTrack2DHistos_.push_back(tfd.make<TH2F>(
686  "p_vs_resXprime_TEC", "res_{x'} vs momentum in TEC;p [GeV]; res_{x'}", 15, 0., 15., 200, -0.1, 0.1));
687 
688  /****************** Definition of 2-D Histos of ResY vs momenta ****************************/
689  vTrack2DHistos_.push_back(tfd.make<TH2F>(
690  "p_vs_resYprime_pixB", "res_{y'} vs momentum in BPix;p [GeV]; res_{y'}", 15, 0., 15., 200, -0.1, 0.1));
691  vTrack2DHistos_.push_back(tfd.make<TH2F>(
692  "p_vs_resYprime_pixE", "res_{y'} vs momentum in FPix;p [GeV]; res_{y'}", 15, 0., 15., 200, -0.1, 0.1));
693 }
694 
696  const auto& alivec = ali.components();
697  for (int i = 0, iEnd = ali.components().size(); i < iEnd; ++i) {
698  std::string structurename = alignableTracker_->objectIdProvider().idToString((alivec)[i]->alignableObjectId());
699  LogDebug("TrackerOfflineValidation") << "StructureName = " << structurename;
700  std::stringstream dirname;
701  dirname << structurename;
702  // add no suffix counter to Strip and Pixel, just aesthetics
703  if (structurename != "Strip" && structurename != "Pixel")
704  dirname << "_" << i + 1;
705 
706  if (structurename.find("Endcap", 0) != std::string::npos) {
708  bookHists(f, *(alivec)[i], tTopo, ali.alignableObjectId(), i);
709  bookDirHists(f, *(alivec)[i], tTopo);
710  } else if (!(this->isDetOrDetUnit((alivec)[i]->alignableObjectId())) || alivec[i]->components().size() > 1) {
712  bookHists(tfd, *(alivec)[i], tTopo, ali.alignableObjectId(), i);
713  bookDirHists(f, *(alivec)[i], tTopo);
714  } else {
715  bookHists(tfd, *(alivec)[i], tTopo, ali.alignableObjectId(), i);
716  }
717  }
718 }
719 
721  DirectoryWrapper& tfd, const Alignable& ali, const TrackerTopology* tTopo, align::StructureType type, int i) {
722  TrackerAlignableId aliid;
723  const DetId id = ali.id();
724 
725  // comparing subdetandlayer to subdetIds gives a warning at compile time
726  // -> subdetandlayer could also be pair<uint,uint> but this has to be adapted
727  // in AlignableObjId
728  std::pair<int, int> subdetandlayer = aliid.typeAndLayerFromDetId(id, tTopo);
729 
731 
732  // are we on or just above det, detunit level respectively?
734  subtype = type;
735  else if (this->isDetOrDetUnit(ali.alignableObjectId()))
736  subtype = ali.alignableObjectId();
737 
738  // construct histogram title and name
739  std::stringstream histoname, histotitle, normhistoname, normhistotitle, yhistoname, yhistotitle, xprimehistoname,
740  xprimehistotitle, normxprimehistoname, normxprimehistotitle, yprimehistoname, yprimehistotitle,
741  normyprimehistoname, normyprimehistotitle, localxname, localxtitle, localyname, localytitle, resxvsxprofilename,
742  resxvsxprofiletitle, resyvsxprofilename, resyvsxprofiletitle, resxvsyprofilename, resxvsyprofiletitle,
743  resyvsyprofilename, resyvsyprofiletitle;
744 
745  std::string wheel_or_layer;
746 
747  if (this->isEndCap(static_cast<uint32_t>(subdetandlayer.first)))
748  wheel_or_layer = "_wheel_";
749  else if (this->isBarrel(static_cast<uint32_t>(subdetandlayer.first)))
750  wheel_or_layer = "_layer_";
751  else
752  edm::LogWarning("TrackerOfflineValidation") << "@SUB=TrackerOfflineValidation::bookHists"
753  << "Unknown subdetid: " << subdetandlayer.first;
754 
755  histoname << "h_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second << "_module_"
756  << id.rawId();
757  yhistoname << "h_y_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second << "_module_"
758  << id.rawId();
759  xprimehistoname << "h_xprime_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second
760  << "_module_" << id.rawId();
761  yprimehistoname << "h_yprime_residuals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second
762  << "_module_" << id.rawId();
763  normhistoname << "h_normresiduals_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second
764  << "_module_" << id.rawId();
765  normxprimehistoname << "h_normxprimeresiduals_subdet_" << subdetandlayer.first << wheel_or_layer
766  << subdetandlayer.second << "_module_" << id.rawId();
767  normyprimehistoname << "h_normyprimeresiduals_subdet_" << subdetandlayer.first << wheel_or_layer
768  << subdetandlayer.second << "_module_" << id.rawId();
769  histotitle << "X Residual for module " << id.rawId() << ";x_{tr} - x_{hit} [cm]";
770  yhistotitle << "Y Residual for module " << id.rawId() << ";y_{tr} - y_{hit} [cm]";
771  normhistotitle << "Normalized Residual for module " << id.rawId() << ";x_{tr} - x_{hit}/#sigma";
772  xprimehistotitle << "X' Residual for module " << id.rawId() << ";(x_{tr} - x_{hit})' [cm]";
773  normxprimehistotitle << "Normalized X' Residual for module " << id.rawId() << ";(x_{tr} - x_{hit})'/#sigma";
774  yprimehistotitle << "Y' Residual for module " << id.rawId() << ";(y_{tr} - y_{hit})' [cm]";
775  normyprimehistotitle << "Normalized Y' Residual for module " << id.rawId() << ";(y_{tr} - y_{hit})'/#sigma";
776 
777  if (moduleLevelProfiles_) {
778  localxname << "h_localx_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second << "_module_"
779  << id.rawId();
780  localyname << "h_localy_subdet_" << subdetandlayer.first << wheel_or_layer << subdetandlayer.second << "_module_"
781  << id.rawId();
782  localxtitle << "u local for module " << id.rawId() << "; u_{tr,r}";
783  localytitle << "v local for module " << id.rawId() << "; v_{tr,r}";
784 
785  resxvsxprofilename << "p_residuals_x_vs_x_subdet_" << subdetandlayer.first << wheel_or_layer
786  << subdetandlayer.second << "_module_" << id.rawId();
787  resyvsxprofilename << "p_residuals_y_vs_x_subdet_" << subdetandlayer.first << wheel_or_layer
788  << subdetandlayer.second << "_module_" << id.rawId();
789  resxvsyprofilename << "p_residuals_x_vs_y_subdet_" << subdetandlayer.first << wheel_or_layer
790  << subdetandlayer.second << "_module_" << id.rawId();
791  resyvsyprofilename << "p_residuals_y_vs_y_subdet_" << subdetandlayer.first << wheel_or_layer
792  << subdetandlayer.second << "_module_" << id.rawId();
793  resxvsxprofiletitle << "U Residual vs u for module " << id.rawId()
794  << "; u_{tr,r} ;(u_{tr} - u_{hit})/tan#alpha [cm]";
795  resyvsxprofiletitle << "V Residual vs u for module " << id.rawId()
796  << "; u_{tr,r} ;(v_{tr} - v_{hit})/tan#beta [cm]";
797  resxvsyprofiletitle << "U Residual vs v for module " << id.rawId()
798  << "; v_{tr,r} ;(u_{tr} - u_{hit})/tan#alpha [cm]";
799  resyvsyprofiletitle << "V Residual vs v for module " << id.rawId()
800  << "; v_{tr,r} ;(v_{tr} - v_{hit})/tan#beta [cm]";
801  }
802 
803  if (this->isDetOrDetUnit(subtype)) {
804  ModuleHistos& histStruct = this->getHistStructFromMap(id);
805  int nbins = 0;
806  double xmin = 0., xmax = 0.;
807  double ymin = -0.1, ymax = 0.1;
808 
809  // do not allow transient hists in DQM mode
811  if (dqmMode_)
812  moduleLevelHistsTransient = false;
813 
814  // decide via cfg if hists in local coordinates should be booked
815  if (lCoorHistOn_) {
816  this->getBinning(id.subdetId(), XResidual, nbins, xmin, xmax);
817  histStruct.ResHisto = this->bookTH1F(
818  moduleLevelHistsTransient, tfd, histoname.str().c_str(), histotitle.str().c_str(), nbins, xmin, xmax);
819  this->getBinning(id.subdetId(), NormXResidual, nbins, xmin, xmax);
820  histStruct.NormResHisto = this->bookTH1F(
821  moduleLevelHistsTransient, tfd, normhistoname.str().c_str(), normhistotitle.str().c_str(), nbins, xmin, xmax);
822  }
823  this->getBinning(id.subdetId(), XprimeResidual, nbins, xmin, xmax);
824  histStruct.ResXprimeHisto = this->bookTH1F(moduleLevelHistsTransient,
825  tfd,
826  xprimehistoname.str().c_str(),
827  xprimehistotitle.str().c_str(),
828  nbins,
829  xmin,
830  xmax);
831  this->getBinning(id.subdetId(), NormXprimeResidual, nbins, xmin, xmax);
832  histStruct.NormResXprimeHisto = this->bookTH1F(moduleLevelHistsTransient,
833  tfd,
834  normxprimehistoname.str().c_str(),
835  normxprimehistotitle.str().c_str(),
836  nbins,
837  xmin,
838  xmax);
839 
840  if (moduleLevelProfiles_) {
841  this->getBinning(id.subdetId(), XResidualProfile, nbins, xmin, xmax);
842 
843  histStruct.LocalX = this->bookTH1F(
844  moduleLevelHistsTransient, tfd, localxname.str().c_str(), localxtitle.str().c_str(), nbins, xmin, xmax);
845  histStruct.LocalY = this->bookTH1F(
846  moduleLevelHistsTransient, tfd, localyname.str().c_str(), localytitle.str().c_str(), nbins, xmin, xmax);
847  histStruct.ResXvsXProfile = this->bookTProfile(moduleLevelHistsTransient,
848  tfd,
849  resxvsxprofilename.str().c_str(),
850  resxvsxprofiletitle.str().c_str(),
851  nbins,
852  xmin,
853  xmax,
854  ymin,
855  ymax);
856  histStruct.ResXvsXProfile->Sumw2(); // to be filled with weights, so uncertainties need sum of square of weights
857  histStruct.ResXvsYProfile = this->bookTProfile(moduleLevelHistsTransient,
858  tfd,
859  resxvsyprofilename.str().c_str(),
860  resxvsyprofiletitle.str().c_str(),
861  nbins,
862  xmin,
863  xmax,
864  ymin,
865  ymax);
866  histStruct.ResXvsYProfile->Sumw2(); // to be filled with weights, so uncertainties need sum of square of weights
867  }
868 
869  if (this->isPixel(subdetandlayer.first) || stripYResiduals_) {
870  this->getBinning(id.subdetId(), YprimeResidual, nbins, xmin, xmax);
871  histStruct.ResYprimeHisto = this->bookTH1F(moduleLevelHistsTransient,
872  tfd,
873  yprimehistoname.str().c_str(),
874  yprimehistotitle.str().c_str(),
875  nbins,
876  xmin,
877  xmax);
878  if (lCoorHistOn_) { // un-primed y-residual
879  this->getBinning(id.subdetId(), YResidual, nbins, xmin, xmax);
880  histStruct.ResYHisto = this->bookTH1F(
881  moduleLevelHistsTransient, tfd, yhistoname.str().c_str(), yhistotitle.str().c_str(), nbins, xmin, xmax);
882  }
883  this->getBinning(id.subdetId(), NormYprimeResidual, nbins, xmin, xmax);
884  histStruct.NormResYprimeHisto = this->bookTH1F(moduleLevelHistsTransient,
885  tfd,
886  normyprimehistoname.str().c_str(),
887  normyprimehistotitle.str().c_str(),
888  nbins,
889  xmin,
890  xmax);
891  // Here we could add un-primed normalised y-residuals if(lCoorHistOn_)...
892  if (moduleLevelProfiles_) {
893  this->getBinning(id.subdetId(), YResidualProfile, nbins, xmin, xmax);
894 
895  histStruct.ResYvsXProfile = this->bookTProfile(moduleLevelHistsTransient,
896  tfd,
897  resyvsxprofilename.str().c_str(),
898  resyvsxprofiletitle.str().c_str(),
899  nbins,
900  xmin,
901  xmax,
902  ymin,
903  ymax);
904  histStruct.ResYvsXProfile->Sumw2(); // to be filled with weights, so uncertainties need sum of square of weights
905  histStruct.ResYvsYProfile = this->bookTProfile(moduleLevelHistsTransient,
906  tfd,
907  resyvsyprofilename.str().c_str(),
908  resyvsyprofiletitle.str().c_str(),
909  nbins,
910  xmin,
911  xmax,
912  ymin,
913  ymax);
914  histStruct.ResYvsYProfile->Sumw2(); // to be filled with weights, so uncertainties need sum of square of weights
915  }
916  }
917  }
918 }
919 
921  DirectoryWrapper& tfd,
922  const char* histName,
923  const char* histTitle,
924  int nBinsX,
925  double lowX,
926  double highX) {
927  if (isTransient) {
928  vDeleteObjects_.push_back(new TH1F(histName, histTitle, nBinsX, lowX, highX));
929  return vDeleteObjects_.back(); // return last element of vector
930  } else
931  return tfd.make<TH1F>(histName, histTitle, nBinsX, lowX, highX);
932 }
933 
934 TProfile* TrackerOfflineValidation::bookTProfile(bool isTransient,
935  DirectoryWrapper& tfd,
936  const char* histName,
937  const char* histTitle,
938  int nBinsX,
939  double lowX,
940  double highX) {
941  if (isTransient) {
942  TProfile* profile = new TProfile(histName, histTitle, nBinsX, lowX, highX);
943  vDeleteObjects_.push_back(profile);
944  return profile;
945  } else
946  return (TProfile*)tfd.make<TProfile>(histName, histTitle, nBinsX, lowX, highX);
947 }
948 
949 TProfile* TrackerOfflineValidation::bookTProfile(bool isTransient,
950  DirectoryWrapper& tfd,
951  const char* histName,
952  const char* histTitle,
953  int nBinsX,
954  double lowX,
955  double highX,
956  double lowY,
957  double highY) {
958  if (isTransient) {
959  TProfile* profile = new TProfile(histName, histTitle, nBinsX, lowX, highX, lowY, highY);
960  vDeleteObjects_.push_back(profile);
961  return profile;
962  } else
963  return (TProfile*)tfd.make<TProfile>(histName, histTitle, nBinsX, lowX, highX, lowY, highY);
964 }
965 
969 }
970 
974 }
975 
978 }
979 
982 }
983 
986  int& nBinsX,
987  double& lowerBoundX,
988  double& upperBoundX) {
989  // determine if
990  const bool isPixel = this->isPixel(subDetId);
991 
992  edm::ParameterSet binningPSet;
993 
994  switch (residualType) {
995  case XResidual:
996  if (isPixel)
997  binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1XResPixelModules");
998  else
999  binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1XResStripModules");
1000  break;
1001  case NormXResidual:
1002  if (isPixel)
1003  binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1NormXResPixelModules");
1004  else
1005  binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1NormXResStripModules");
1006  break;
1007  case XprimeResidual:
1008  if (isPixel)
1009  binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1XprimeResPixelModules");
1010  else
1011  binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1XprimeResStripModules");
1012  break;
1013  case NormXprimeResidual:
1014  if (isPixel)
1015  binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1NormXprimeResPixelModules");
1016  else
1017  binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1NormXprimeResStripModules");
1018  break;
1019  case YResidual: // borrow y-residual binning from yprime
1020  case YprimeResidual:
1021  if (isPixel)
1022  binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1YResPixelModules");
1023  else
1024  binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1YResStripModules");
1025  break;
1026  /* case NormYResidual :*/
1027  case NormYprimeResidual:
1028  if (isPixel)
1029  binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1NormYResPixelModules");
1030  else
1031  binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1NormYResStripModules");
1032  break;
1033  case XResidualProfile:
1034  if (isPixel)
1035  binningPSet = parSet_.getParameter<edm::ParameterSet>("TProfileXResPixelModules");
1036  else
1037  binningPSet = parSet_.getParameter<edm::ParameterSet>("TProfileXResStripModules");
1038  break;
1039  case YResidualProfile:
1040  if (isPixel)
1041  binningPSet = parSet_.getParameter<edm::ParameterSet>("TProfileYResPixelModules");
1042  else
1043  binningPSet = parSet_.getParameter<edm::ParameterSet>("TProfileYResStripModules");
1044  break;
1045  }
1046  nBinsX = binningPSet.getParameter<int32_t>("Nbinx");
1047  lowerBoundX = binningPSet.getParameter<double>("xmin");
1048  upperBoundX = binningPSet.getParameter<double>("xmax");
1049 }
1050 
1051 void TrackerOfflineValidation::setSummaryBin(int bin, TH1* targetHist, TH1* sourceHist) {
1052  if (targetHist && sourceHist) {
1053  targetHist->SetBinContent(bin, sourceHist->GetMean(1));
1054  if (useFwhm_)
1055  targetHist->SetBinError(bin, Fwhm(sourceHist) / 2.);
1056  else
1057  targetHist->SetBinError(bin, sourceHist->GetRMS(1));
1058  } else
1059  return;
1060 }
1061 
1063  SummaryContainer& targetContainer,
1064  SummaryContainer& sourceContainer) {
1065  summaryBins_.emplace_back(bin, targetContainer.summaryXResiduals_, sourceContainer.sumXResiduals_);
1066  summaryBins_.emplace_back(bin, targetContainer.summaryNormXResiduals_, sourceContainer.sumNormXResiduals_);
1067  // If no y-residual hists, just returns:
1068  summaryBins_.emplace_back(bin, targetContainer.summaryYResiduals_, sourceContainer.sumYResiduals_);
1069  summaryBins_.emplace_back(bin, targetContainer.summaryNormYResiduals_, sourceContainer.sumNormYResiduals_);
1070 }
1071 
1073  uint32_t subDetId,
1074  SummaryContainer& targetContainer,
1075  ModuleHistos& sourceContainer) {
1076  // takes two summary Containers and sets summaryBins for all histograms
1077  summaryBins_.emplace_back(bin, targetContainer.summaryXResiduals_, sourceContainer.ResXprimeHisto);
1078  summaryBins_.emplace_back(bin, targetContainer.summaryNormXResiduals_, sourceContainer.NormResXprimeHisto);
1079  if (this->isPixel(subDetId) || stripYResiduals_) {
1080  summaryBins_.emplace_back(bin, targetContainer.summaryYResiduals_, sourceContainer.ResYprimeHisto);
1081  summaryBins_.emplace_back(bin, targetContainer.summaryNormYResiduals_, sourceContainer.NormResYprimeHisto);
1082  }
1083 }
1084 
1086  // get a struct with histograms from the respective map
1087  // if no object exist, the reference is automatically created by the map
1088  // throw exception if non-tracker id is passed
1089  uint subdetid = detid.subdetId();
1090  if (subdetid == PixelSubdetector::PixelBarrel) {
1091  return mPxbResiduals_[detid.rawId()];
1092  } else if (subdetid == PixelSubdetector::PixelEndcap) {
1093  return mPxeResiduals_[detid.rawId()];
1094  } else if (subdetid == StripSubdetector::TIB) {
1095  return mTibResiduals_[detid.rawId()];
1096  } else if (subdetid == StripSubdetector::TID) {
1097  return mTidResiduals_[detid.rawId()];
1098  } else if (subdetid == StripSubdetector::TOB) {
1099  return mTobResiduals_[detid.rawId()];
1100  } else if (subdetid == StripSubdetector::TEC) {
1101  return mTecResiduals_[detid.rawId()];
1102  } else {
1103  throw cms::Exception("Geometry Error")
1104  << "[TrackerOfflineValidation] Error, tried to get reference for non-tracker subdet " << subdetid
1105  << " from detector " << detid.det();
1106  return mPxbResiduals_[0];
1107  }
1108 }
1109 
1110 // ------------ method called to for each event ------------
1112  if (maxTracks_ > 0 && nTracks_ >= maxTracks_)
1113  return; //don't do anything after hitting the max number of tracks
1114  //(could just rely on break below, but this way saves fillTrackQuantities)
1115 
1116  if (useOverflowForRMS_)
1117  TH1::StatOverflows(kTRUE);
1118  this->checkBookHists(iSetup); // check whether hists are booked and do so if not yet done
1119 
1120  std::vector<TrackerValidationVariables::AVTrackStruct> vTrackstruct;
1121  avalidator_.fillTrackQuantities(iEvent, iSetup, vTrackstruct);
1122 
1123  for (std::vector<TrackerValidationVariables::AVTrackStruct>::const_iterator itT = vTrackstruct.begin();
1124  itT != vTrackstruct.end();
1125  ++itT) {
1126  if (itT->charge * chargeCut_ < 0)
1127  continue;
1128 
1129  if (maxTracks_ > 0 && nTracks_++ >= maxTracks_)
1130  break; //exit the loop after hitting the max number of tracks
1131  // Fill 1D track histos
1132  static const int etaindex = this->GetIndex(vTrackHistos_, "h_tracketa");
1133  vTrackHistos_[etaindex]->Fill(itT->eta);
1134  static const int phiindex = this->GetIndex(vTrackHistos_, "h_trackphi");
1135  vTrackHistos_[phiindex]->Fill(itT->phi);
1136  static const int numOfValidHitsindex = this->GetIndex(vTrackHistos_, "h_trackNumberOfValidHits");
1137  vTrackHistos_[numOfValidHitsindex]->Fill(itT->numberOfValidHits);
1138  static const int numOfLostHitsindex = this->GetIndex(vTrackHistos_, "h_trackNumberOfLostHits");
1139  vTrackHistos_[numOfLostHitsindex]->Fill(itT->numberOfLostHits);
1140  static const int kappaindex = this->GetIndex(vTrackHistos_, "h_curvature");
1141  vTrackHistos_[kappaindex]->Fill(itT->kappa);
1142  static const int kappaposindex = this->GetIndex(vTrackHistos_, "h_curvature_pos");
1143  if (itT->charge > 0)
1144  vTrackHistos_[kappaposindex]->Fill(fabs(itT->kappa));
1145  static const int kappanegindex = this->GetIndex(vTrackHistos_, "h_curvature_neg");
1146  if (itT->charge < 0)
1147  vTrackHistos_[kappanegindex]->Fill(fabs(itT->kappa));
1148  static const int normchi2index = this->GetIndex(vTrackHistos_, "h_normchi2");
1149  vTrackHistos_[normchi2index]->Fill(itT->normchi2);
1150  static const int chi2index = this->GetIndex(vTrackHistos_, "h_chi2");
1151  vTrackHistos_[chi2index]->Fill(itT->chi2);
1152  static const int chi2Probindex = this->GetIndex(vTrackHistos_, "h_chi2Prob");
1153  vTrackHistos_[chi2Probindex]->Fill(itT->chi2Prob);
1154  static const int ptindex = this->GetIndex(vTrackHistos_, "h_pt");
1155  vTrackHistos_[ptindex]->Fill(itT->pt);
1156  if (itT->ptError != 0.) {
1157  static const int ptResolutionindex = this->GetIndex(vTrackHistos_, "h_ptResolution");
1158  vTrackHistos_[ptResolutionindex]->Fill(itT->ptError / itT->pt);
1159  }
1160  // Fill track profiles
1161  static const int d0phiindex = this->GetIndex(vTrackProfiles_, "p_d0_vs_phi");
1162  vTrackProfiles_[d0phiindex]->Fill(itT->phi, itT->d0);
1163  static const int dzphiindex = this->GetIndex(vTrackProfiles_, "p_dz_vs_phi");
1164  vTrackProfiles_[dzphiindex]->Fill(itT->phi, itT->dz);
1165  static const int d0etaindex = this->GetIndex(vTrackProfiles_, "p_d0_vs_eta");
1166  vTrackProfiles_[d0etaindex]->Fill(itT->eta, itT->d0);
1167  static const int dzetaindex = this->GetIndex(vTrackProfiles_, "p_dz_vs_eta");
1168  vTrackProfiles_[dzetaindex]->Fill(itT->eta, itT->dz);
1169  static const int chiphiindex = this->GetIndex(vTrackProfiles_, "p_chi2_vs_phi");
1170  vTrackProfiles_[chiphiindex]->Fill(itT->phi, itT->chi2);
1171  static const int chiProbphiindex = this->GetIndex(vTrackProfiles_, "p_chi2Prob_vs_phi");
1172  vTrackProfiles_[chiProbphiindex]->Fill(itT->phi, itT->chi2Prob);
1173  static const int chiProbabsd0index = this->GetIndex(vTrackProfiles_, "p_chi2Prob_vs_d0");
1174  vTrackProfiles_[chiProbabsd0index]->Fill(fabs(itT->d0), itT->chi2Prob);
1175  static const int normchiphiindex = this->GetIndex(vTrackProfiles_, "p_normchi2_vs_phi");
1176  vTrackProfiles_[normchiphiindex]->Fill(itT->phi, itT->normchi2);
1177  static const int chietaindex = this->GetIndex(vTrackProfiles_, "p_chi2_vs_eta");
1178  vTrackProfiles_[chietaindex]->Fill(itT->eta, itT->chi2);
1179  static const int normchiptindex = this->GetIndex(vTrackProfiles_, "p_normchi2_vs_pt");
1180  vTrackProfiles_[normchiptindex]->Fill(itT->pt, itT->normchi2);
1181  static const int normchipindex = this->GetIndex(vTrackProfiles_, "p_normchi2_vs_p");
1182  vTrackProfiles_[normchipindex]->Fill(itT->p, itT->normchi2);
1183  static const int chiProbetaindex = this->GetIndex(vTrackProfiles_, "p_chi2Prob_vs_eta");
1184  vTrackProfiles_[chiProbetaindex]->Fill(itT->eta, itT->chi2Prob);
1185  static const int normchietaindex = this->GetIndex(vTrackProfiles_, "p_normchi2_vs_eta");
1186  vTrackProfiles_[normchietaindex]->Fill(itT->eta, itT->normchi2);
1187  static const int kappaphiindex = this->GetIndex(vTrackProfiles_, "p_kappa_vs_phi");
1188  vTrackProfiles_[kappaphiindex]->Fill(itT->phi, itT->kappa);
1189  static const int kappaetaindex = this->GetIndex(vTrackProfiles_, "p_kappa_vs_eta");
1190  vTrackProfiles_[kappaetaindex]->Fill(itT->eta, itT->kappa);
1191  static const int ptResphiindex = this->GetIndex(vTrackProfiles_, "p_ptResolution_vs_phi");
1192  vTrackProfiles_[ptResphiindex]->Fill(itT->phi, itT->ptError / itT->pt);
1193  static const int ptResetaindex = this->GetIndex(vTrackProfiles_, "p_ptResolution_vs_eta");
1194  vTrackProfiles_[ptResetaindex]->Fill(itT->eta, itT->ptError / itT->pt);
1195 
1196  // Fill 2D track histos
1197  static const int d0phiindex_2d = this->GetIndex(vTrack2DHistos_, "h2_d0_vs_phi");
1198  vTrack2DHistos_[d0phiindex_2d]->Fill(itT->phi, itT->d0);
1199  static const int dzphiindex_2d = this->GetIndex(vTrack2DHistos_, "h2_dz_vs_phi");
1200  vTrack2DHistos_[dzphiindex_2d]->Fill(itT->phi, itT->dz);
1201  static const int d0etaindex_2d = this->GetIndex(vTrack2DHistos_, "h2_d0_vs_eta");
1202  vTrack2DHistos_[d0etaindex_2d]->Fill(itT->eta, itT->d0);
1203  static const int dzetaindex_2d = this->GetIndex(vTrack2DHistos_, "h2_dz_vs_eta");
1204  vTrack2DHistos_[dzetaindex_2d]->Fill(itT->eta, itT->dz);
1205  static const int chiphiindex_2d = this->GetIndex(vTrack2DHistos_, "h2_chi2_vs_phi");
1206  vTrack2DHistos_[chiphiindex_2d]->Fill(itT->phi, itT->chi2);
1207  static const int chiProbphiindex_2d = this->GetIndex(vTrack2DHistos_, "h2_chi2Prob_vs_phi");
1208  vTrack2DHistos_[chiProbphiindex_2d]->Fill(itT->phi, itT->chi2Prob);
1209  static const int chiProbabsd0index_2d = this->GetIndex(vTrack2DHistos_, "h2_chi2Prob_vs_d0");
1210  vTrack2DHistos_[chiProbabsd0index_2d]->Fill(fabs(itT->d0), itT->chi2Prob);
1211  static const int normchiphiindex_2d = this->GetIndex(vTrack2DHistos_, "h2_normchi2_vs_phi");
1212  vTrack2DHistos_[normchiphiindex_2d]->Fill(itT->phi, itT->normchi2);
1213  static const int chietaindex_2d = this->GetIndex(vTrack2DHistos_, "h2_chi2_vs_eta");
1214  vTrack2DHistos_[chietaindex_2d]->Fill(itT->eta, itT->chi2);
1215  static const int chiProbetaindex_2d = this->GetIndex(vTrack2DHistos_, "h2_chi2Prob_vs_eta");
1216  vTrack2DHistos_[chiProbetaindex_2d]->Fill(itT->eta, itT->chi2Prob);
1217  static const int normchietaindex_2d = this->GetIndex(vTrack2DHistos_, "h2_normchi2_vs_eta");
1218  vTrack2DHistos_[normchietaindex_2d]->Fill(itT->eta, itT->normchi2);
1219  static const int kappaphiindex_2d = this->GetIndex(vTrack2DHistos_, "h2_kappa_vs_phi");
1220  vTrack2DHistos_[kappaphiindex_2d]->Fill(itT->phi, itT->kappa);
1221  static const int kappaetaindex_2d = this->GetIndex(vTrack2DHistos_, "h2_kappa_vs_eta");
1222  vTrack2DHistos_[kappaetaindex_2d]->Fill(itT->eta, itT->kappa);
1223  static const int normchi2kappa_2d = this->GetIndex(vTrack2DHistos_, "h2_normchi2_vs_kappa");
1224  vTrack2DHistos_[normchi2kappa_2d]->Fill(itT->normchi2, itT->kappa);
1225 
1226  // hit quantities: residuals, normalized residuals
1227  for (std::vector<TrackerValidationVariables::AVHitStruct>::const_iterator itH = itT->hits.begin();
1228  itH != itT->hits.end();
1229  ++itH) {
1230  DetId detid(itH->rawDetId);
1231  ModuleHistos& histStruct = this->getHistStructFromMap(detid);
1232 
1233  // fill histos in local coordinates if set in cf
1234  if (lCoorHistOn_) {
1235  histStruct.ResHisto->Fill(itH->resX);
1236  if (itH->resErrX != 0)
1237  histStruct.NormResHisto->Fill(itH->resX / itH->resErrX);
1238  if (this->isPixel(detid.subdetId()) || stripYResiduals_) {
1239  histStruct.ResYHisto->Fill(itH->resY);
1240  // here add un-primed normalised y-residuals if wanted
1241  }
1242  }
1243  if (itH->resXprime != -999.) {
1244  histStruct.ResXprimeHisto->Fill(itH->resXprime);
1245 
1246  /******************************* Fill 2-D histo ResX vs momenta *****************************/
1247  if (detid.subdetId() == PixelSubdetector::PixelBarrel) {
1248  static const int resXvsPindex_2d = this->GetIndex(vTrack2DHistos_, "p_vs_resXprime_pixB");
1249  vTrack2DHistos_[resXvsPindex_2d]->Fill(itT->p, itH->resXprime);
1250  }
1251  if (detid.subdetId() == PixelSubdetector::PixelEndcap) {
1252  static const int resXvsPindex_2d = this->GetIndex(vTrack2DHistos_, "p_vs_resXprime_pixE");
1253  vTrack2DHistos_[resXvsPindex_2d]->Fill(itT->p, itH->resXprime);
1254  }
1255  if (detid.subdetId() == StripSubdetector::TIB) {
1256  static const int resXvsPindex_2d = this->GetIndex(vTrack2DHistos_, "p_vs_resXprime_TIB");
1257  vTrack2DHistos_[resXvsPindex_2d]->Fill(itT->p, itH->resXprime);
1258  }
1259  if (detid.subdetId() == StripSubdetector::TID) {
1260  static const int resXvsPindex_2d = this->GetIndex(vTrack2DHistos_, "p_vs_resXprime_TID");
1261  vTrack2DHistos_[resXvsPindex_2d]->Fill(itT->p, itH->resXprime);
1262  }
1263  if (detid.subdetId() == StripSubdetector::TOB) {
1264  static const int resXvsPindex_2d = this->GetIndex(vTrack2DHistos_, "p_vs_resXprime_TOB");
1265  vTrack2DHistos_[resXvsPindex_2d]->Fill(itT->p, itH->resXprime);
1266  }
1267  if (detid.subdetId() == StripSubdetector::TEC) {
1268  static const int resXvsPindex_2d = this->GetIndex(vTrack2DHistos_, "p_vs_resXprime_TEC");
1269  vTrack2DHistos_[resXvsPindex_2d]->Fill(itT->p, itH->resXprime);
1270  }
1271  /******************************************/
1272 
1273  if (moduleLevelProfiles_ && itH->inside) {
1274  float tgalpha = tan(itH->localAlpha);
1275  if (fabs(tgalpha) != 0) {
1276  histStruct.LocalX->Fill(itH->localXnorm, tgalpha * tgalpha);
1277  histStruct.LocalY->Fill(itH->localYnorm, tgalpha * tgalpha);
1278  /* if (this->isEndCap(detid.subdetId()) && !this->isPixel(detid.subdetId())) {
1279  if((itH->resX)*(itH->resXprime)>0){
1280  histStruct.ResXvsXProfile->Fill(itH->localXnorm, itH->resXatTrkY/tgalpha, tgalpha*tgalpha);
1281  histStruct.ResXvsYProfile->Fill(itH->localYnorm, itH->resXatTrkY/tgalpha, tgalpha*tgalpha);
1282  } else {
1283  histStruct.ResXvsXProfile->Fill(itH->localXnorm, (-1)*itH->resXatTrkY/tgalpha, tgalpha*tgalpha);
1284  histStruct.ResXvsYProfile->Fill(itH->localYnorm, (-1)*itH->resXatTrkY/tgalpha, tgalpha*tgalpha);
1285  }
1286 
1287  }else {
1288 */
1289  histStruct.ResXvsXProfile->Fill(itH->localXnorm, itH->resXatTrkY / tgalpha, tgalpha * tgalpha);
1290  histStruct.ResXvsYProfile->Fill(itH->localYnorm, itH->resXatTrkY / tgalpha, tgalpha * tgalpha);
1291 
1292  // }
1293  }
1294  }
1295 
1296  if (itH->resXprimeErr != 0 && itH->resXprimeErr != -999) {
1297  histStruct.NormResXprimeHisto->Fill(itH->resXprime / itH->resXprimeErr);
1298  }
1299  }
1300 
1301  if (itH->resYprime != -999.) {
1302  if (this->isPixel(detid.subdetId()) || stripYResiduals_) {
1303  histStruct.ResYprimeHisto->Fill(itH->resYprime);
1304 
1305  /******************************* Fill 2-D histo ResY vs momenta *****************************/
1306  if (detid.subdetId() == PixelSubdetector::PixelBarrel) {
1307  static const int resYvsPindex_2d = this->GetIndex(vTrack2DHistos_, "p_vs_resYprime_pixB");
1308  vTrack2DHistos_[resYvsPindex_2d]->Fill(itT->p, itH->resYprime);
1309  }
1310  if (detid.subdetId() == PixelSubdetector::PixelEndcap) {
1311  static const int resYvsPindex_2d = this->GetIndex(vTrack2DHistos_, "p_vs_resYprime_pixE");
1312  vTrack2DHistos_[resYvsPindex_2d]->Fill(itT->p, itH->resYprime);
1313  }
1314  /******************************************/
1315 
1316  if (moduleLevelProfiles_ && itH->inside) {
1317  float tgbeta = tan(itH->localBeta);
1318  if (fabs(tgbeta) != 0) {
1319  /* if (this->isEndCap(detid.subdetId()) && !this->isPixel(detid.subdetId())) {
1320 
1321  if((itH->resY)*(itH->resYprime)>0){
1322  histStruct.ResYvsXProfile->Fill(itH->localXnorm, itH->resYprime/tgbeta, tgbeta*tgbeta);
1323  histStruct.ResYvsYProfile->Fill(itH->localYnorm, itH->resYprime/tgbeta, tgbeta*tgbeta);
1324  } else {
1325  histStruct.ResYvsXProfile->Fill(itH->localXnorm, (-1)*itH->resYprime/tgbeta, tgbeta*tgbeta);
1326  histStruct.ResYvsYProfile->Fill(itH->localYnorm, (-1)*itH->resYprime/tgbeta, tgbeta*tgbeta);
1327  }
1328 
1329  }else {
1330 */
1331  histStruct.ResYvsXProfile->Fill(itH->localXnorm, itH->resY / tgbeta, tgbeta * tgbeta);
1332  histStruct.ResYvsYProfile->Fill(itH->localYnorm, itH->resY / tgbeta, tgbeta * tgbeta);
1333  // }
1334  }
1335  }
1336 
1337  if (itH->resYprimeErr != 0 && itH->resYprimeErr != -999.) {
1338  histStruct.NormResYprimeHisto->Fill(itH->resYprime / itH->resYprimeErr);
1339  }
1340  }
1341  }
1342 
1343  } // finish loop over hit quantities
1344  } // finish loop over track quantities
1345 
1346  if (useOverflowForRMS_)
1347  TH1::StatOverflows(kFALSE);
1348 }
1349 
1350 // ------------ method called once each job just after ending the event loop ------------
1352  if (!tkGeom_.product())
1353  return;
1354 
1355  static const int kappadiffindex = this->GetIndex(vTrackHistos_, "h_diff_curvature");
1356  vTrackHistos_[kappadiffindex]->Add(vTrackHistos_[this->GetIndex(vTrackHistos_, "h_curvature_neg")],
1357  vTrackHistos_[this->GetIndex(vTrackHistos_, "h_curvature_pos")],
1358  -1,
1359  1);
1360 
1361  // Collate Information for Subdetectors
1362  // create summary histograms recursively
1363  this->collateSummaryHists();
1364 
1365  if (dqmMode_)
1366  return;
1367  // Should be excluded in dqmMode, since TTree is not usable
1368  // In dqmMode tree operations are are sourced out to the additional module TrackerOfflineValidationSummary
1369 
1371  TTree* tree = fs->make<TTree>("TkOffVal", "TkOffVal");
1372 
1373  TkOffTreeVariables* treeMemPtr = new TkOffTreeVariables;
1374  // We create branches for all members of 'TkOffTreeVariables' (even if not needed).
1375  // This works because we have a dictionary for 'TkOffTreeVariables'
1376  // (see src/classes_def.xml and src/classes.h):
1377  tree->Branch("TkOffTreeVariables", &treeMemPtr); // address of pointer!
1378 
1379  this->fillTree(*tree, *treeMemPtr, mPxbResiduals_);
1380  this->fillTree(*tree, *treeMemPtr, mPxeResiduals_);
1381  this->fillTree(*tree, *treeMemPtr, mTibResiduals_);
1382  this->fillTree(*tree, *treeMemPtr, mTidResiduals_);
1383  this->fillTree(*tree, *treeMemPtr, mTobResiduals_);
1384  this->fillTree(*tree, *treeMemPtr, mTecResiduals_);
1385 
1386  delete treeMemPtr;
1387  treeMemPtr = nullptr;
1388 }
1389 
1391  DirectoryWrapper& tfd,
1392  const Alignable& ali,
1393  std::vector<TrackerOfflineValidation::SummaryContainer>& vLevelProfiles) {
1394  const auto& alivec = ali.components();
1395  if (this->isDetOrDetUnit((alivec)[0]->alignableObjectId()))
1396  return;
1397 
1398  for (int iComp = 0, iCompEnd = ali.components().size(); iComp < iCompEnd; ++iComp) {
1399  std::vector<TrackerOfflineValidation::SummaryContainer> vProfiles;
1400  std::string structurename = alignableTracker_->objectIdProvider().idToString((alivec)[iComp]->alignableObjectId());
1401 
1402  LogDebug("TrackerOfflineValidation") << "StructureName = " << structurename;
1403  std::stringstream dirname;
1404  dirname << structurename;
1405 
1406  // add no suffix counter to strip and pixel -> just aesthetics
1407  if (structurename != "Strip" && structurename != "Pixel")
1408  dirname << "_" << iComp + 1;
1409 
1410  if (!(this->isDetOrDetUnit((alivec)[iComp]->alignableObjectId())) || (alivec)[0]->components().size() > 1) {
1412  this->prepareSummaryHists(f, *(alivec)[iComp], vProfiles);
1413  vLevelProfiles.push_back(this->bookSummaryHists(tfd, *(alivec[iComp]), ali.alignableObjectId(), iComp + 1));
1414  TH1* hX = vLevelProfiles[iComp].sumXResiduals_;
1415  TH1* hNormX = vLevelProfiles[iComp].sumNormXResiduals_;
1416  TH1* hY = vLevelProfiles[iComp].sumYResiduals_;
1417  TH1* hNormY = vLevelProfiles[iComp].sumNormYResiduals_;
1418  TH1* pXX = vLevelProfiles[iComp].sumResXvsXProfile_;
1419  TH1* pXY = vLevelProfiles[iComp].sumResXvsYProfile_;
1420  TH1* pYX = vLevelProfiles[iComp].sumResYvsXProfile_;
1421  TH1* pYY = vLevelProfiles[iComp].sumResYvsYProfile_;
1422  for (uint n = 0; n < vProfiles.size(); ++n) {
1423  this->summarizeBinInContainer(n + 1, vLevelProfiles[iComp], vProfiles[n]);
1424  sumHistStructure_.emplace_back(hX, vProfiles[n].sumXResiduals_);
1425  sumHistStructure_.emplace_back(hNormX, vProfiles[n].sumNormXResiduals_);
1426  if (hY)
1427  sumHistStructure_.emplace_back(hY, vProfiles[n].sumYResiduals_); // only if existing
1428  if (hNormY)
1429  sumHistStructure_.emplace_back(hNormY, vProfiles[n].sumNormYResiduals_); // ditto (pxl, stripYResiduals_)
1430  if (pXX)
1431  sumHistStructure_.emplace_back(pXX, vProfiles[n].sumResXvsXProfile_);
1432  if (pXY)
1433  sumHistStructure_.emplace_back(pXY, vProfiles[n].sumResXvsYProfile_);
1434  if (pYX)
1435  sumHistStructure_.emplace_back(pYX, vProfiles[n].sumResYvsXProfile_);
1436  if (pYY)
1437  sumHistStructure_.emplace_back(pYY, vProfiles[n].sumResYvsYProfile_);
1438  }
1439  if (dqmMode_)
1440  continue; // No fits in dqmMode
1441  //add fit values to stat box
1442  toFit_.push_back(vLevelProfiles[iComp].sumXResiduals_);
1443  toFit_.push_back(vLevelProfiles[iComp].sumNormXResiduals_);
1444  if (hY)
1445  toFit_.push_back(hY); // only if existing (pixel or stripYResiduals_)
1446  if (hNormY)
1447  toFit_.push_back(hNormY); // ditto
1448  } else {
1449  // nothing to be done for det or detunits
1450  continue;
1451  }
1452  }
1453 }
1454 
1456  for (std::vector<std::pair<TH1*, TH1*> >::const_iterator it = sumHistStructure_.begin();
1457  it != sumHistStructure_.end();
1458  ++it)
1459  it->first->Add(it->second);
1460 
1461  for (std::vector<std::tuple<int, TH1*, TH1*> >::const_iterator it = summaryBins_.begin(); it != summaryBins_.end();
1462  ++it)
1463  setSummaryBin(std::get<0>(*it), std::get<1>(*it), std::get<2>(*it));
1464 
1465  for (std::vector<TH1*>::const_iterator it = toFit_.begin(); it != toFit_.end(); ++it)
1466  fitResiduals(*it);
1467 }
1468 
1470  const Alignable& ali,
1472  int i) {
1473  const uint aliSize = ali.components().size();
1474  const align::StructureType alitype = ali.alignableObjectId();
1475  const align::StructureType subtype = ali.components()[0]->alignableObjectId();
1476  const char* aliTypeName = alignableTracker_->objectIdProvider().idToString(alitype); // lifetime of char* OK
1477  const char* aliSubtypeName = alignableTracker_->objectIdProvider().idToString(subtype);
1478  const char* typeName = alignableTracker_->objectIdProvider().idToString(type);
1479 
1480  const DetId aliDetId = ali.id();
1481  // y residuals only if pixel or specially requested for strip:
1482  const bool bookResidY = this->isPixel(aliDetId.subdetId()) || stripYResiduals_;
1483 
1484  SummaryContainer sumContainer;
1485 
1486  // Book summary hists with one bin per component,
1487  // but special case for Det with two DetUnit that we want to summarize one level up
1488  // (e.g. in TOBRods with 12 bins for 6 stereo and 6 rphi DetUnit.)
1489  // component of ali is not Det or Det with just one components
1490  const uint subcompSize = ali.components()[0]->components().size();
1491  if (subtype != align::AlignableDet || subcompSize == 1) { // Det with 1 comp. should not exist anymore...
1492  const TString title(Form("Summary for substructures in %s %d;%s;", aliTypeName, i, aliSubtypeName));
1493 
1494  sumContainer.summaryXResiduals_ = tfd.make<TH1F>(
1495  Form("h_summaryX%s_%d", aliTypeName, i), title + "#LT #Delta x' #GT", aliSize, 0.5, aliSize + 0.5);
1496  sumContainer.summaryNormXResiduals_ = tfd.make<TH1F>(
1497  Form("h_summaryNormX%s_%d", aliTypeName, i), title + "#LT #Delta x'/#sigma #GT", aliSize, 0.5, aliSize + 0.5);
1498 
1499  if (bookResidY) {
1500  sumContainer.summaryYResiduals_ = tfd.make<TH1F>(
1501  Form("h_summaryY%s_%d", aliTypeName, i), title + "#LT #Delta y' #GT", aliSize, 0.5, aliSize + 0.5);
1502  sumContainer.summaryNormYResiduals_ = tfd.make<TH1F>(
1503  Form("h_summaryNormY%s_%d", aliTypeName, i), title + "#LT #Delta y'/#sigma #GT", aliSize, 0.5, aliSize + 0.5);
1504  }
1505 
1506  } else if (subtype == align::AlignableDet && subcompSize > 1) { // fixed: was aliSize before
1507  if (subcompSize != 2) { // strange... expect only 2 DetUnits in DS layers
1508  // this 2 is hardcoded factor 2 in binning below and also assumed later on
1509  edm::LogError("Alignment") << "@SUB=bookSummaryHists"
1510  << "Det with " << subcompSize << " components";
1511  }
1512  // title contains x-title
1513  const TString title(Form(
1514  "Summary for substructures in %s %d;%s;",
1515  aliTypeName,
1516  i,
1517  alignableTracker_->objectIdProvider().idToString(ali.components()[0]->components()[0]->alignableObjectId())));
1518 
1519  sumContainer.summaryXResiduals_ = tfd.make<TH1F>(
1520  Form("h_summaryX%s_%d", aliTypeName, i), title + "#LT #Delta x' #GT", (2 * aliSize), 0.5, 2 * aliSize + 0.5);
1521  sumContainer.summaryNormXResiduals_ = tfd.make<TH1F>(Form("h_summaryNormX%s_%d", aliTypeName, i),
1522  title + "#LT #Delta x'/#sigma #GT",
1523  (2 * aliSize),
1524  0.5,
1525  2 * aliSize + 0.5);
1526 
1527  if (bookResidY) {
1528  sumContainer.summaryYResiduals_ = tfd.make<TH1F>(
1529  Form("h_summaryY%s_%d", aliTypeName, i), title + "#LT #Delta y' #GT", (2 * aliSize), 0.5, 2 * aliSize + 0.5);
1530  sumContainer.summaryNormYResiduals_ = tfd.make<TH1F>(Form("h_summaryNormY%s_%d", aliTypeName, i),
1531  title + "#LT #Delta y'/#sigma #GT",
1532  (2 * aliSize),
1533  0.5,
1534  2 * aliSize + 0.5);
1535  }
1536 
1537  } else {
1538  edm::LogError("TrackerOfflineValidation")
1539  << "@SUB=TrackerOfflineValidation::bookSummaryHists"
1540  << "No summary histogram for hierarchy level " << aliTypeName << " in subdet " << aliDetId.subdetId();
1541  }
1542 
1543  // Now book hists that just sum up the residual histograms from lower levels.
1544  // Axis title is copied from lowest level module of structure.
1545  // Should be safe that y-hists are only touched if non-null pointers...
1546  int nbins = 0;
1547  double xmin = 0., xmax = 0.;
1548  const TString sumTitle(Form("Residual for %s %d in %s;", aliTypeName, i, typeName));
1549  const ModuleHistos& xTitHists = this->getHistStructFromMap(aliDetId); // for x-axis titles
1550  this->getBinning(aliDetId.subdetId(), XprimeResidual, nbins, xmin, xmax);
1551 
1552  sumContainer.sumXResiduals_ = tfd.make<TH1F>(Form("h_Xprime_%s_%d", aliTypeName, i),
1553  sumTitle + xTitHists.ResXprimeHisto->GetXaxis()->GetTitle(),
1554  nbins,
1555  xmin,
1556  xmax);
1557 
1558  this->getBinning(aliDetId.subdetId(), NormXprimeResidual, nbins, xmin, xmax);
1559  sumContainer.sumNormXResiduals_ = tfd.make<TH1F>(Form("h_NormXprime_%s_%d", aliTypeName, i),
1560  sumTitle + xTitHists.NormResXprimeHisto->GetXaxis()->GetTitle(),
1561  nbins,
1562  xmin,
1563  xmax);
1564 
1565  if (moduleLevelProfiles_) {
1566  this->getBinning(aliDetId.subdetId(), XResidualProfile, nbins, xmin, xmax);
1567  sumContainer.sumResXvsXProfile_ = tfd.make<TProfile>(Form("p_resXX_%s_%d", aliTypeName, i),
1568  sumTitle + xTitHists.ResXvsXProfile->GetXaxis()->GetTitle() +
1569  ";" + xTitHists.ResXvsXProfile->GetYaxis()->GetTitle(),
1570  nbins,
1571  xmin,
1572  xmax);
1573  sumContainer.sumResXvsXProfile_->Sumw2();
1574  sumContainer.sumResXvsYProfile_ = tfd.make<TProfile>(Form("p_resXY_%s_%d", aliTypeName, i),
1575  sumTitle + xTitHists.ResXvsYProfile->GetXaxis()->GetTitle() +
1576  ";" + xTitHists.ResXvsYProfile->GetYaxis()->GetTitle(),
1577  nbins,
1578  xmin,
1579  xmax);
1580  sumContainer.sumResXvsYProfile_->Sumw2();
1581  }
1582 
1583  if (bookResidY) {
1584  this->getBinning(aliDetId.subdetId(), YprimeResidual, nbins, xmin, xmax);
1585  sumContainer.sumYResiduals_ = tfd.make<TH1F>(Form("h_Yprime_%s_%d", aliTypeName, i),
1586  sumTitle + xTitHists.ResYprimeHisto->GetXaxis()->GetTitle(),
1587  nbins,
1588  xmin,
1589  xmax);
1590 
1591  this->getBinning(aliDetId.subdetId(), NormYprimeResidual, nbins, xmin, xmax);
1592  sumContainer.sumNormYResiduals_ = tfd.make<TH1F>(Form("h_NormYprime_%s_%d", aliTypeName, i),
1593  sumTitle + xTitHists.NormResYprimeHisto->GetXaxis()->GetTitle(),
1594  nbins,
1595  xmin,
1596  xmax);
1597 
1598  if (moduleLevelProfiles_) {
1599  this->getBinning(aliDetId.subdetId(), YResidualProfile, nbins, xmin, xmax);
1600  sumContainer.sumResYvsXProfile_ = tfd.make<TProfile>(Form("p_resYX_%s_%d", aliTypeName, i),
1601  sumTitle + xTitHists.ResYvsXProfile->GetXaxis()->GetTitle() +
1602  ";" + xTitHists.ResYvsXProfile->GetYaxis()->GetTitle(),
1603  nbins,
1604  xmin,
1605  xmax);
1606  sumContainer.sumResYvsXProfile_->Sumw2();
1607  sumContainer.sumResYvsYProfile_ = tfd.make<TProfile>(Form("p_resYY_%s_%d", aliTypeName, i),
1608  sumTitle + xTitHists.ResYvsYProfile->GetXaxis()->GetTitle() +
1609  ";" + xTitHists.ResYvsYProfile->GetYaxis()->GetTitle(),
1610  nbins,
1611  xmin,
1612  xmax);
1613  sumContainer.sumResYvsYProfile_->Sumw2();
1614  }
1615  }
1616 
1617  // If we are at the lowest level, we already sum up and fill the summary.
1618 
1619  // special case I: For DetUnits and Dets with only one subcomponent start filling summary histos
1620  if ((subtype == align::AlignableDet && subcompSize == 1) || subtype == align::AlignableDetUnit) {
1621  for (uint k = 0; k < aliSize; ++k) {
1622  DetId detid = ali.components()[k]->id();
1623  ModuleHistos& histStruct = this->getHistStructFromMap(detid);
1624  this->summarizeBinInContainer(k + 1, detid.subdetId(), sumContainer, histStruct);
1625  sumHistStructure_.emplace_back(sumContainer.sumXResiduals_, histStruct.ResXprimeHisto);
1626  sumHistStructure_.emplace_back(sumContainer.sumNormXResiduals_, histStruct.NormResXprimeHisto);
1627  if (moduleLevelProfiles_) {
1628  sumHistStructure_.emplace_back(sumContainer.sumResXvsXProfile_, histStruct.ResXvsXProfile);
1629  sumHistStructure_.emplace_back(sumContainer.sumResXvsYProfile_, histStruct.ResXvsYProfile);
1630  }
1631  if (this->isPixel(detid.subdetId()) || stripYResiduals_) {
1632  sumHistStructure_.emplace_back(sumContainer.sumYResiduals_, histStruct.ResYprimeHisto);
1633  sumHistStructure_.emplace_back(sumContainer.sumNormYResiduals_, histStruct.NormResYprimeHisto);
1634  if (moduleLevelProfiles_) {
1635  sumHistStructure_.emplace_back(sumContainer.sumResYvsXProfile_, histStruct.ResYvsXProfile);
1636  sumHistStructure_.emplace_back(sumContainer.sumResYvsYProfile_, histStruct.ResYvsYProfile);
1637  }
1638  }
1639  }
1640  } else if (subtype == align::AlignableDet && subcompSize > 1) { // fixed: was aliSize before
1641  // special case II: Fill summary histos for dets with two detunits
1642  for (uint k = 0; k < aliSize; ++k) {
1643  for (uint j = 0; j < subcompSize; ++j) { // assumes all have same size (as binning does)
1644  DetId detid = ali.components()[k]->components()[j]->id();
1645  ModuleHistos& histStruct = this->getHistStructFromMap(detid);
1646  this->summarizeBinInContainer(2 * k + j + 1, detid.subdetId(), sumContainer, histStruct);
1647  sumHistStructure_.emplace_back(sumContainer.sumXResiduals_, histStruct.ResXprimeHisto);
1648  sumHistStructure_.emplace_back(sumContainer.sumNormXResiduals_, histStruct.NormResXprimeHisto);
1649  if (moduleLevelProfiles_) {
1650  sumHistStructure_.emplace_back(sumContainer.sumResXvsXProfile_, histStruct.ResXvsXProfile);
1651  sumHistStructure_.emplace_back(sumContainer.sumResXvsYProfile_, histStruct.ResXvsYProfile);
1652  }
1653  if (this->isPixel(detid.subdetId()) || stripYResiduals_) {
1654  sumHistStructure_.emplace_back(sumContainer.sumYResiduals_, histStruct.ResYprimeHisto);
1655  sumHistStructure_.emplace_back(sumContainer.sumNormYResiduals_, histStruct.NormResYprimeHisto);
1656  if (moduleLevelProfiles_) {
1657  sumHistStructure_.emplace_back(sumContainer.sumResYvsXProfile_, histStruct.ResYvsXProfile);
1658  sumHistStructure_.emplace_back(sumContainer.sumResYvsYProfile_, histStruct.ResYvsYProfile);
1659  }
1660  }
1661  }
1662  }
1663  }
1664  return sumContainer;
1665 }
1666 
1667 float TrackerOfflineValidation::Fwhm(const TH1* hist) const {
1668  float max = hist->GetMaximum();
1669  int left = -1, right = -1;
1670  for (unsigned int i = 1, iEnd = hist->GetNbinsX(); i <= iEnd; ++i) {
1671  if (hist->GetBinContent(i) < max / 2. && hist->GetBinContent(i + 1) > max / 2. && left == -1) {
1672  if (max / 2. - hist->GetBinContent(i) < hist->GetBinContent(i + 1) - max / 2.) {
1673  left = i;
1674  ++i;
1675  } else {
1676  left = i + 1;
1677  ++i;
1678  }
1679  }
1680  if (left != -1 && right == -1) {
1681  if (hist->GetBinContent(i) > max / 2. && hist->GetBinContent(i + 1) < max / 2.) {
1682  if (hist->GetBinContent(i) - max / 2. < max / 2. - hist->GetBinContent(i + 1)) {
1683  right = i;
1684  } else {
1685  right = i + 1;
1686  }
1687  }
1688  }
1689  }
1690  return hist->GetXaxis()->GetBinCenter(right) - hist->GetXaxis()->GetBinCenter(left);
1691 }
1692 
1693 void TrackerOfflineValidation::setUpTreeMembers(const std::map<int, TrackerOfflineValidation::ModuleHistos>& moduleHist_,
1694  const TrackerGeometry& tkgeom,
1695  const TrackerTopology* tTopo) {
1696  for (std::map<int, TrackerOfflineValidation::ModuleHistos>::const_iterator it = moduleHist_.begin(),
1697  itEnd = moduleHist_.end();
1698  it != itEnd;
1699  ++it) {
1700  TkOffTreeVariables& treeMem = mTreeMembers_[it->first];
1701 
1702  //variables concerning the tracker components/hierarchy levels
1703  DetId detId_ = it->first;
1704  treeMem.moduleId = detId_;
1705  treeMem.subDetId = detId_.subdetId();
1706  treeMem.isDoubleSide = false;
1707 
1708  if (treeMem.subDetId == PixelSubdetector::PixelBarrel) {
1709  unsigned int whichHalfBarrel(1), rawId(detId_.rawId()); //DetId does not know about halfBarrels is PXB ...
1710  if ((rawId >= 302056964 && rawId < 302059300) || (rawId >= 302123268 && rawId < 302127140) ||
1711  (rawId >= 302189572 && rawId < 302194980))
1712  whichHalfBarrel = 2;
1713  treeMem.layer = tTopo->pxbLayer(detId_);
1714  treeMem.half = whichHalfBarrel;
1715  treeMem.rod = tTopo->pxbLadder(detId_); // ... so, ladder is not per halfBarrel-Layer, but per barrel-layer!
1716  treeMem.module = tTopo->pxbModule(detId_);
1717  } else if (treeMem.subDetId == PixelSubdetector::PixelEndcap) {
1718  unsigned int whichHalfCylinder(1), rawId(detId_.rawId()); //DetId does not kmow about halfCylinders in PXF
1719  if ((rawId >= 352394500 && rawId < 352406032) || (rawId >= 352460036 && rawId < 352471568) ||
1720  (rawId >= 344005892 && rawId < 344017424) || (rawId >= 344071428 && rawId < 344082960))
1721  whichHalfCylinder = 2;
1722  treeMem.layer = tTopo->pxfDisk(detId_);
1723  treeMem.side = tTopo->pxfSide(detId_);
1724  treeMem.half = whichHalfCylinder;
1725  treeMem.blade = tTopo->pxfBlade(detId_);
1726  treeMem.panel = tTopo->pxfPanel(detId_);
1727  treeMem.module = tTopo->pxfModule(detId_);
1728  } else if (treeMem.subDetId == StripSubdetector::TIB) {
1729  unsigned int whichHalfShell(1), rawId(detId_.rawId()); //DetId does not kmow about halfShells in TIB
1730  if ((rawId >= 369120484 && rawId < 369120688) || (rawId >= 369121540 && rawId < 369121776) ||
1731  (rawId >= 369136932 && rawId < 369137200) || (rawId >= 369137988 && rawId < 369138288) ||
1732  (rawId >= 369153396 && rawId < 369153744) || (rawId >= 369154436 && rawId < 369154800) ||
1733  (rawId >= 369169844 && rawId < 369170256) || (rawId >= 369170900 && rawId < 369171344) ||
1734  (rawId >= 369124580 && rawId < 369124784) || (rawId >= 369125636 && rawId < 369125872) ||
1735  (rawId >= 369141028 && rawId < 369141296) || (rawId >= 369142084 && rawId < 369142384) ||
1736  (rawId >= 369157492 && rawId < 369157840) || (rawId >= 369158532 && rawId < 369158896) ||
1737  (rawId >= 369173940 && rawId < 369174352) || (rawId >= 369174996 && rawId < 369175440))
1738  whichHalfShell = 2;
1739  treeMem.layer = tTopo->tibLayer(detId_);
1740  treeMem.side = tTopo->tibStringInfo(detId_)[0];
1741  treeMem.half = whichHalfShell;
1742  treeMem.rod = tTopo->tibStringInfo(detId_)[2];
1743  treeMem.outerInner = tTopo->tibStringInfo(detId_)[1];
1744  treeMem.module = tTopo->tibModule(detId_);
1745  treeMem.isStereo = tTopo->tibStereo(detId_);
1746  treeMem.isDoubleSide = tTopo->tibIsDoubleSide(detId_);
1747  } else if (treeMem.subDetId == StripSubdetector::TID) {
1748  treeMem.layer = tTopo->tidWheel(detId_);
1749  treeMem.side = tTopo->tidSide(detId_);
1750  treeMem.ring = tTopo->tidRing(detId_);
1751  treeMem.outerInner = tTopo->tidModuleInfo(detId_)[0];
1752  treeMem.module = tTopo->tidModuleInfo(detId_)[1];
1753  treeMem.isStereo = tTopo->tidStereo(detId_);
1754  treeMem.isDoubleSide = tTopo->tidIsDoubleSide(detId_);
1755  } else if (treeMem.subDetId == StripSubdetector::TOB) {
1756  treeMem.layer = tTopo->tobLayer(detId_);
1757  treeMem.side = tTopo->tobRodInfo(detId_)[0];
1758  treeMem.rod = tTopo->tobRodInfo(detId_)[1];
1759  treeMem.module = tTopo->tobModule(detId_);
1760  treeMem.isStereo = tTopo->tobStereo(detId_);
1761  treeMem.isDoubleSide = tTopo->tobIsDoubleSide(detId_);
1762  } else if (treeMem.subDetId == StripSubdetector::TEC) {
1763  treeMem.layer = tTopo->tecWheel(detId_);
1764  treeMem.side = tTopo->tecSide(detId_);
1765  treeMem.ring = tTopo->tecRing(detId_);
1766  treeMem.petal = tTopo->tecPetalInfo(detId_)[1];
1767  treeMem.outerInner = tTopo->tecPetalInfo(detId_)[0];
1768  treeMem.module = tTopo->tecModule(detId_);
1769  treeMem.isStereo = tTopo->tecStereo(detId_);
1770  treeMem.isDoubleSide = tTopo->tecIsDoubleSide(detId_);
1771  }
1772 
1773  //variables concerning the tracker geometry
1774  const Surface::PositionType& gPModule = tkgeom.idToDet(detId_)->position();
1775  treeMem.posPhi = gPModule.phi();
1776  treeMem.posEta = gPModule.eta();
1777  treeMem.posR = gPModule.perp();
1778  treeMem.posX = gPModule.x();
1779  treeMem.posY = gPModule.y();
1780  treeMem.posZ = gPModule.z();
1781 
1782  const Surface& surface = tkgeom.idToDet(detId_)->surface();
1783 
1784  //global Orientation of local coordinate system of dets/detUnits
1785  LocalPoint lUDirection(1., 0., 0.), lVDirection(0., 1., 0.), lWDirection(0., 0., 1.);
1786  GlobalPoint gUDirection = surface.toGlobal(lUDirection), gVDirection = surface.toGlobal(lVDirection),
1787  gWDirection = surface.toGlobal(lWDirection);
1788  double dR(999.), dPhi(999.), dZ(999.);
1790  treeMem.subDetId == StripSubdetector::TOB) {
1791  dR = gWDirection.perp() - gPModule.perp();
1792  dPhi = deltaPhi(gUDirection.barePhi(), gPModule.barePhi());
1793  dZ = gVDirection.z() - gPModule.z();
1794  if (dZ >= 0.)
1795  treeMem.rOrZDirection = 1;
1796  else
1797  treeMem.rOrZDirection = -1;
1798  } else if (treeMem.subDetId == PixelSubdetector::PixelEndcap) {
1799  dR = gUDirection.perp() - gPModule.perp();
1800  dPhi = deltaPhi(gVDirection.barePhi(), gPModule.barePhi());
1801  dZ = gWDirection.z() - gPModule.z();
1802  if (dR >= 0.)
1803  treeMem.rOrZDirection = 1;
1804  else
1805  treeMem.rOrZDirection = -1;
1806  } else if (treeMem.subDetId == StripSubdetector::TID || treeMem.subDetId == StripSubdetector::TEC) {
1807  dR = gVDirection.perp() - gPModule.perp();
1808  dPhi = deltaPhi(gUDirection.barePhi(), gPModule.barePhi());
1809  dZ = gWDirection.z() - gPModule.z();
1810  if (dR >= 0.)
1811  treeMem.rOrZDirection = 1;
1812  else
1813  treeMem.rOrZDirection = -1;
1814  }
1815  if (dR >= 0.)
1816  treeMem.rDirection = 1;
1817  else
1818  treeMem.rDirection = -1;
1819  if (dPhi >= 0.)
1820  treeMem.phiDirection = 1;
1821  else
1822  treeMem.phiDirection = -1;
1823  if (dZ >= 0.)
1824  treeMem.zDirection = 1;
1825  else
1826  treeMem.zDirection = -1;
1827  }
1828 }
1829 
1831  TkOffTreeVariables& treeMem,
1832  const std::map<int, TrackerOfflineValidation::ModuleHistos>& moduleHist_) {
1833  for (std::map<int, TrackerOfflineValidation::ModuleHistos>::const_iterator it = moduleHist_.begin(),
1834  itEnd = moduleHist_.end();
1835  it != itEnd;
1836  ++it) {
1837  treeMem = mTreeMembers_[it->first];
1838 
1839  //mean and RMS values (extracted from histograms(Xprime on module level)
1840  treeMem.entries = static_cast<UInt_t>(it->second.ResXprimeHisto->GetEntries());
1841  treeMem.meanX = it->second.ResXprimeHisto->GetMean();
1842  treeMem.rmsX = it->second.ResXprimeHisto->GetRMS();
1843  //treeMem.sigmaX = Fwhm(it->second.ResXprimeHisto)/2.355;
1844 
1845  if (useFit_) {
1846  //call fit function which returns mean and sigma from the fit
1847  //for absolute residuals
1848  std::pair<float, float> fitResult1 = this->fitResiduals(it->second.ResXprimeHisto);
1849  treeMem.fitMeanX = fitResult1.first;
1850  treeMem.fitSigmaX = fitResult1.second;
1851  //for normalized residuals
1852  std::pair<float, float> fitResult2 = this->fitResiduals(it->second.NormResXprimeHisto);
1853  treeMem.fitMeanNormX = fitResult2.first;
1854  treeMem.fitSigmaNormX = fitResult2.second;
1855  }
1856 
1857  //get median for absolute residuals
1858  treeMem.medianX = this->getMedian(it->second.ResXprimeHisto);
1859 
1860  int numberOfBins = it->second.ResXprimeHisto->GetNbinsX();
1861  treeMem.numberOfUnderflows = it->second.ResXprimeHisto->GetBinContent(0);
1862  treeMem.numberOfOverflows = it->second.ResXprimeHisto->GetBinContent(numberOfBins + 1);
1863  treeMem.numberOfOutliers =
1864  it->second.ResXprimeHisto->GetBinContent(0) + it->second.ResXprimeHisto->GetBinContent(numberOfBins + 1);
1865 
1866  //mean and RMS values (extracted from histograms(normalized Xprime on module level)
1867  treeMem.meanNormX = it->second.NormResXprimeHisto->GetMean();
1868  treeMem.rmsNormX = it->second.NormResXprimeHisto->GetRMS();
1869 
1870  double stats[20];
1871  it->second.NormResXprimeHisto->GetStats(stats);
1872  // GF treeMem.chi2PerDofX = stats[3]/(stats[0]-1);
1873  if (stats[0])
1874  treeMem.chi2PerDofX = stats[3] / stats[0];
1875 
1876  treeMem.sigmaNormX = Fwhm(it->second.NormResXprimeHisto) / 2.355;
1877  treeMem.histNameX = it->second.ResXprimeHisto->GetName();
1878  treeMem.histNameNormX = it->second.NormResXprimeHisto->GetName();
1879 
1880  // fill tree variables in local coordinates if set in cfg
1881  if (lCoorHistOn_) {
1882  treeMem.meanLocalX = it->second.ResHisto->GetMean();
1883  treeMem.rmsLocalX = it->second.ResHisto->GetRMS();
1884  treeMem.meanNormLocalX = it->second.NormResHisto->GetMean();
1885  treeMem.rmsNormLocalX = it->second.NormResHisto->GetRMS();
1886 
1887  treeMem.histNameLocalX = it->second.ResHisto->GetName();
1888  treeMem.histNameNormLocalX = it->second.NormResHisto->GetName();
1889  if (it->second.ResYHisto)
1890  treeMem.histNameLocalY = it->second.ResYHisto->GetName();
1891  }
1892 
1893  // mean and RMS values in local y (extracted from histograms(normalized Yprime on module level)
1894  // might exist in pixel only
1895  if (it->second.ResYprimeHisto) { //(stripYResiduals_)
1896  TH1* h = it->second.ResYprimeHisto;
1897  treeMem.meanY = h->GetMean();
1898  treeMem.rmsY = h->GetRMS();
1899 
1900  if (useFit_) { // fit function which returns mean and sigma from the fit
1901  std::pair<float, float> fitMeanSigma = this->fitResiduals(h);
1902  treeMem.fitMeanY = fitMeanSigma.first;
1903  treeMem.fitSigmaY = fitMeanSigma.second;
1904  }
1905 
1906  //get median for absolute residuals
1907  treeMem.medianY = this->getMedian(h);
1908 
1909  treeMem.histNameY = h->GetName();
1910  }
1911  if (it->second.NormResYprimeHisto) {
1912  TH1* h = it->second.NormResYprimeHisto;
1913  treeMem.meanNormY = h->GetMean();
1914  treeMem.rmsNormY = h->GetRMS();
1915  h->GetStats(stats); // stats buffer defined above
1916  if (stats[0])
1917  treeMem.chi2PerDofY = stats[3] / stats[0];
1918 
1919  if (useFit_) { // fit function which returns mean and sigma from the fit
1920  std::pair<float, float> fitMeanSigma = this->fitResiduals(h);
1921  treeMem.fitMeanNormY = fitMeanSigma.first;
1922  treeMem.fitSigmaNormY = fitMeanSigma.second;
1923  }
1924  treeMem.histNameNormY = h->GetName();
1925  }
1926 
1927  if (moduleLevelProfiles_) {
1928  if (it->second.ResXvsXProfile) {
1929  TH1* h = it->second.ResXvsXProfile;
1930  treeMem.meanResXvsX = h->GetMean();
1931  treeMem.rmsResXvsX = h->GetRMS();
1932  treeMem.profileNameResXvsX = h->GetName();
1933  }
1934  if (it->second.ResXvsYProfile) {
1935  TH1* h = it->second.ResXvsYProfile;
1936  treeMem.meanResXvsY = h->GetMean();
1937  treeMem.rmsResXvsY = h->GetRMS();
1938  treeMem.profileNameResXvsY = h->GetName();
1939  }
1940  if (it->second.ResYvsXProfile) {
1941  TH1* h = it->second.ResYvsXProfile;
1942  treeMem.meanResYvsX = h->GetMean();
1943  treeMem.rmsResYvsX = h->GetRMS();
1944  treeMem.profileNameResYvsX = h->GetName();
1945  }
1946  if (it->second.ResYvsYProfile) {
1947  TH1* h = it->second.ResYvsYProfile;
1948  treeMem.meanResYvsY = h->GetMean();
1949  treeMem.rmsResYvsY = h->GetRMS();
1950  treeMem.profileNameResYvsY = h->GetName();
1951  }
1952  }
1953 
1954  tree.Fill();
1955  }
1956 }
1957 
1958 std::pair<float, float> TrackerOfflineValidation::fitResiduals(TH1* hist) const {
1959  std::pair<float, float> fitResult(9999., 9999.);
1960  if (!hist || hist->GetEntries() < 20)
1961  return fitResult;
1962 
1963  float mean = hist->GetMean();
1964  float sigma = hist->GetRMS();
1965 
1966  try { // for < CMSSW_2_2_0 since ROOT warnings from fit are converted to exceptions
1967  // Remove the try/catch for more recent CMSSW!
1968  // first fit: two RMS around mean
1969  TF1 func("tmp", "gaus", mean - 2. * sigma, mean + 2. * sigma);
1970  if (0 == hist->Fit(&func, "QNR")) { // N: do not blow up file by storing fit!
1971  mean = func.GetParameter(1);
1972  sigma = func.GetParameter(2);
1973  // second fit: three sigma of first fit around mean of first fit
1974  func.SetRange(mean - 3. * sigma, mean + 3. * sigma);
1975  // I: integral gives more correct results if binning is too wide
1976  // L: Likelihood can treat empty bins correctly (if hist not weighted...)
1977  if (0 == hist->Fit(&func, "Q0LR")) {
1978  if (hist->GetFunction(func.GetName())) { // Take care that it is later on drawn:
1979  hist->GetFunction(func.GetName())->ResetBit(TF1::kNotDraw);
1980  }
1981  fitResult.first = func.GetParameter(1);
1982  fitResult.second = func.GetParameter(2);
1983  }
1984  }
1985  } catch (cms::Exception const& e) {
1986  edm::LogWarning("Alignment") << "@SUB=TrackerOfflineValidation::fitResiduals"
1987  << "Caught this exception during ROOT fit: " << e.what();
1988  }
1989  return fitResult;
1990 }
1991 
1993  float median = 999;
1994  int nbins = histo->GetNbinsX();
1995 
1996  //extract median from histogram
1997  double* x = new double[nbins];
1998  double* y = new double[nbins];
1999  for (int j = 0; j < nbins; j++) {
2000  x[j] = histo->GetBinCenter(j + 1);
2001  y[j] = histo->GetBinContent(j + 1);
2002  }
2003  median = TMath::Median(nbins, x, y);
2004 
2005  delete[] x;
2006  x = nullptr;
2007  delete[] y;
2008  y = nullptr;
2009 
2010  return median;
2011 }
2012 //define this as a plug-in
GeomDet::position
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
TrackerGeometry::idToDet
const TrackerGeomDet * idToDet(DetId) const override
Definition: TrackerGeometry.cc:193
TrackerOfflineValidation::XprimeResidual
Definition: TrackerOfflineValidation.cc:88
TrackerTopology::tobIsDoubleSide
bool tobIsDoubleSide(const DetId &id) const
Definition: TrackerTopology.h:245
TkOffTreeVariables::meanY
Float_t meanY
Definition: TkOffTreeVariables.h:50
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
TrackerValidationVariables.h
DDAxes::y
TrackerOfflineValidation::setSummaryBin
void setSummaryBin(int bin, TH1 *targetHist, TH1 *sourceHist)
Definition: TrackerOfflineValidation.cc:1051
electrons_cff.bool
bool
Definition: electrons_cff.py:372
mps_fire.i
i
Definition: mps_fire.py:355
TrackerOfflineValidation::isBarrel
bool isBarrel(uint32_t subDetId)
Definition: TrackerOfflineValidation.cc:966
TrackerOfflineValidation::mTibResiduals_
std::map< int, TrackerOfflineValidation::ModuleHistos > mTibResiduals_
Definition: TrackerOfflineValidation.cc:350
TrackerOfflineValidation::mPxeResiduals_
std::map< int, TrackerOfflineValidation::ModuleHistos > mPxeResiduals_
Definition: TrackerOfflineValidation.cc:349
PixelSubdetector.h
TrackerOfflineValidation::vDeleteObjects_
std::vector< TH1 * > vDeleteObjects_
Definition: TrackerOfflineValidation.cc:342
TrackerOfflineValidation::TrackerOfflineValidation
TrackerOfflineValidation(const edm::ParameterSet &)
Definition: TrackerOfflineValidation.cc:470
TkOffTreeVariables::medianX
Float_t medianX
Definition: TkOffTreeVariables.h:50
SiStripPI::mean
Definition: SiStripPayloadInspectorHelper.h:169
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
TrackerGeometry.h
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
TrackerOfflineValidation::summarizeBinInContainer
void summarizeBinInContainer(int bin, SummaryContainer &targetContainer, SummaryContainer &sourceContainer)
Definition: TrackerOfflineValidation.cc:1062
TrackerOfflineValidation::DQMStore
dqm::legacy::DQMStore DQMStore
Definition: TrackerOfflineValidation.cc:80
TrackerOfflineValidation::~TrackerOfflineValidation
~TrackerOfflineValidation() override
Definition: TrackerOfflineValidation.cc:487
TrackerOfflineValidation::mPxbResiduals_
std::map< int, TrackerOfflineValidation::ModuleHistos > mPxbResiduals_
Definition: TrackerOfflineValidation.cc:348
TkOffTreeVariables::medianY
Float_t medianY
Definition: TkOffTreeVariables.h:50
ESHandle.h
TrackerOfflineValidation::DirectoryWrapper::DirectoryWrapper
DirectoryWrapper(const DirectoryWrapper &upDir, const std::string &newDir, const std::string &basedir, bool useDqmMode)
Definition: TrackerOfflineValidation.cc:162
TrackerOfflineValidation::ModuleHistos::NormResXprimeHisto
TH1 * NormResXprimeHisto
Definition: TrackerOfflineValidation.cc:117
TkOffTreeVariables::petal
UInt_t petal
Definition: TkOffTreeVariables.h:59
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
TrackerTopology::pxfSide
unsigned int pxfSide(const DetId &id) const
Definition: TrackerTopology.h:192
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
TrackerOfflineValidation::SummaryContainer::sumYResiduals_
TH1 * sumYResiduals_
Definition: TrackerOfflineValidation.cc:150
TkOffTreeVariables::rmsLocalX
Float_t rmsLocalX
Definition: TkOffTreeVariables.h:50
TrackerOfflineValidation::mTreeMembers_
std::map< int, TkOffTreeVariables > mTreeMembers_
Definition: TrackerOfflineValidation.cc:355
TrackerOfflineValidation::stripYResiduals_
const bool stripYResiduals_
Definition: TrackerOfflineValidation.cc:332
TkOffTreeVariables::rDirection
Float_t rDirection
Definition: TkOffTreeVariables.h:50
TrackerTopology
Definition: TrackerTopology.h:16
tree
Definition: tree.py:1
TrackerTopology::tecIsDoubleSide
bool tecIsDoubleSide(const DetId &id) const
Definition: TrackerTopology.h:246
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
TrackerOfflineValidation::bookDirHists
void bookDirHists(DirectoryWrapper &tfd, const Alignable &ali, const TrackerTopology *tTopo)
Definition: TrackerOfflineValidation.cc:695
TrackerTopology::tidIsDoubleSide
bool tidIsDoubleSide(const DetId &id) const
Definition: TrackerTopology.h:250
TrackerTopology::pxbLadder
unsigned int pxbLadder(const DetId &id) const
Definition: TrackerTopology.h:155
Alignable
Definition: Alignable.h:27
TrackerOfflineValidation::SummaryContainer::summaryNormYResiduals_
TH1 * summaryNormYResiduals_
Definition: TrackerOfflineValidation.cc:153
TkOffTreeVariables::phiDirection
Float_t phiDirection
Definition: TkOffTreeVariables.h:50
TkOffTreeVariables::rmsResXvsY
Float_t rmsResXvsY
Definition: TkOffTreeVariables.h:71
TkOffTreeVariables::fitMeanY
Float_t fitMeanY
Definition: TkOffTreeVariables.h:50
edm::LogInfo
Definition: MessageLogger.h:254
TrackerValidationVariables::fillTrackQuantities
void fillTrackQuantities(const edm::Event &, const edm::EventSetup &, std::vector< AVTrackStruct > &v_avtrackout)
Definition: TrackerValidationVariables.cc:423
TrackerOfflineValidation::bookHists
void bookHists(DirectoryWrapper &tfd, const Alignable &ali, const TrackerTopology *tTopo, align::StructureType type, int i)
Definition: TrackerOfflineValidation.cc:720
TFileService::tFileDirectory
TFileDirectory & tFileDirectory()
Definition: TFileService.h:42
timingPdfMaker.histo
histo
Definition: timingPdfMaker.py:279
TrackerOfflineValidation::ModuleHistos::LocalY
TH1 * LocalY
Definition: TrackerOfflineValidation.cc:127
TkOffTreeVariables::rmsResXvsX
Float_t rmsResXvsX
Definition: TkOffTreeVariables.h:71
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:71
Surface
Definition: Surface.h:36
DQMStore.h
TrackerValidationVariables
Definition: TrackerValidationVariables.h:22
TrackerOfflineValidation::GetIndex
int GetIndex(const std::vector< OBJECT_TYPE * > &vec, const TString &name)
Definition: TrackerOfflineValidation.cc:385
TrackerOfflineValidation::bookTProfile
TProfile * bookTProfile(bool isTransient, DirectoryWrapper &tfd, const char *histName, const char *histTitle, int nBinsX, double lowX, double highX)
Definition: TrackerOfflineValidation.cc:934
TrackerOfflineValidation::HistogramType
HistogramType
Definition: TrackerOfflineValidation.cc:84
TrackerOfflineValidation::getHistStructFromMap
ModuleHistos & getHistStructFromMap(const DetId &detid)
Definition: TrackerOfflineValidation.cc:1085
EDAnalyzer.h
TrackerOfflineValidation::DirectoryWrapper::theDbe
DQMStore * theDbe
Definition: TrackerOfflineValidation.cc:232
DDAxes::x
TFileDirectory
Definition: TFileDirectory.h:24
TrackerOfflineValidation::SummaryContainer::summaryYResiduals_
TH1 * summaryYResiduals_
Definition: TrackerOfflineValidation.cc:151
TkOffTreeVariables.h
TkOffTreeVariables::rod
UInt_t rod
Definition: TkOffTreeVariables.h:59
TkOffTreeVariables::meanResXvsY
Float_t meanResXvsY
Definition: TkOffTreeVariables.h:70
TkOffTreeVariables::outerInner
UInt_t outerInner
Definition: TkOffTreeVariables.h:59
TrackerOfflineValidation::maxTracks_
const unsigned long long maxTracks_
Definition: TrackerOfflineValidation.cc:371
TrackerOfflineValidation::getBinning
void getBinning(uint32_t subDetId, TrackerOfflineValidation::HistogramType residualtype, int &nBinsX, double &lowerBoundX, double &upperBoundX)
Definition: TrackerOfflineValidation.cc:984
TkOffTreeVariables::meanNormY
Float_t meanNormY
Definition: TkOffTreeVariables.h:50
tools.TF1
TF1
Definition: tools.py:23
parallelization.uint
uint
Definition: parallelization.py:124
TrackerOfflineValidation::ModuleHistos::ResYHisto
TH1 * ResYHisto
Definition: TrackerOfflineValidation.cc:114
HGVHistoProducerAlgoBlock_cfi.minX
minX
Definition: HGVHistoProducerAlgoBlock_cfi.py:153
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
TrackerOfflineValidation::mTobResiduals_
std::map< int, TrackerOfflineValidation::ModuleHistos > mTobResiduals_
Definition: TrackerOfflineValidation.cc:352
TkOffTreeVariables::histNameLocalX
std::string histNameLocalX
Definition: TkOffTreeVariables.h:67
TrackerTopology::tidRing
unsigned int tidRing(const DetId &id) const
Definition: TrackerTopology.h:218
TrackerOfflineValidation::SummaryContainer::sumXResiduals_
TH1 * sumXResiduals_
Definition: TrackerOfflineValidation.cc:146
TrackerOfflineValidation::bookSummaryHists
TrackerOfflineValidation::SummaryContainer bookSummaryHists(DirectoryWrapper &tfd, const Alignable &ali, align::StructureType type, int i)
Definition: TrackerOfflineValidation.cc:1469
TrackerTopology::tobStereo
uint32_t tobStereo(const DetId &id) const
Definition: TrackerTopology.h:275
edm::EDAnalyzer
Definition: EDAnalyzer.h:29
TkOffTreeVariables::fitMeanNormY
Float_t fitMeanNormY
Definition: TkOffTreeVariables.h:50
TrackerTopology::tidWheel
unsigned int tidWheel(const DetId &id) const
Definition: TrackerTopology.h:201
TrackerOfflineValidation::alignableTracker_
std::unique_ptr< AlignableTracker > alignableTracker_
Definition: TrackerOfflineValidation.cc:326
TrackerTopology::pxbLayer
unsigned int pxbLayer(const DetId &id) const
Definition: TrackerTopology.h:144
TFileDirectory.h
TkOffTreeVariables::numberOfOverflows
Float_t numberOfOverflows
Definition: TkOffTreeVariables.h:50
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
TrackerTopology::pxfPanel
unsigned int pxfPanel(const DetId &id) const
Definition: TrackerTopology.h:450
TrackerOfflineValidation::checkBookHists
virtual void checkBookHists(const edm::EventSetup &setup)
Definition: TrackerOfflineValidation.cc:499
BTVHLTOfflineSource_cfi.dirname
dirname
Definition: BTVHLTOfflineSource_cfi.py:7
TkOffTreeVariables::fitSigmaNormX
Float_t fitSigmaNormX
Definition: TkOffTreeVariables.h:50
TrackerOfflineValidation::ModuleHistos::ResXvsYProfile
TProfile * ResXvsYProfile
Definition: TrackerOfflineValidation.cc:122
TrackerOfflineValidation::SummaryContainer::summaryXResiduals_
TH1 * summaryXResiduals_
Definition: TrackerOfflineValidation.cc:147
TkOffTreeVariables::rmsX
Float_t rmsX
Definition: TkOffTreeVariables.h:50
TkOffTreeVariables::posR
Float_t posR
Definition: TkOffTreeVariables.h:50
DetId
Definition: DetId.h:17
TrackerTopology::tobRodInfo
std::vector< unsigned int > tobRodInfo(const DetId &id) const
Definition: TrackerTopology.h:226
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
MakerMacros.h
TkOffTreeVariables::posPhi
Float_t posPhi
Definition: TkOffTreeVariables.h:50
TrackerTopology.h
TrackerOfflineValidation::nTracks_
unsigned long long nTracks_
Definition: TrackerOfflineValidation.cc:370
TrackerTopology::tibStringInfo
std::vector< unsigned int > tibStringInfo(const DetId &id) const
Definition: TrackerTopology.h:421
TkOffTreeVariables::meanResYvsX
Float_t meanResYvsX
Definition: TkOffTreeVariables.h:70
TrackerOfflineValidation::bookTH1F
TH1 * bookTH1F(bool isTransient, DirectoryWrapper &tfd, const char *histName, const char *histTitle, int nBinsX, double lowX, double highX)
Definition: TrackerOfflineValidation.cc:920
TrackerTopology::tidModuleInfo
std::vector< unsigned int > tidModuleInfo(const DetId &id) const
Definition: TrackerTopology.h:434
TrackerOfflineValidation::bareTkGeomPtr_
const TrackerGeometry * bareTkGeomPtr_
Definition: TrackerOfflineValidation.cc:325
TrackerTopologyRcd.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
L1TOccupancyClient_cfi.ymax
ymax
Definition: L1TOccupancyClient_cfi.py:43
dqm::legacy::DQMStore
Definition: DQMStore.h:727
TrackerOfflineValidation::DirectoryWrapper::DirectoryWrapper
DirectoryWrapper(const std::string &newDir, const std::string &basedir, bool useDqmMode)
Definition: TrackerOfflineValidation.cc:185
TkOffTreeVariables::profileNameResXvsY
std::string profileNameResXvsY
Definition: TkOffTreeVariables.h:73
TkOffTreeVariables::panel
UInt_t panel
Definition: TkOffTreeVariables.h:59
compare.hist
hist
Definition: compare.py:376
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
TkOffTreeVariables::profileNameResYvsX
std::string profileNameResYvsX
Definition: TkOffTreeVariables.h:73
TrackerOfflineValidation::SummaryContainer::SummaryContainer
SummaryContainer()
Definition: TrackerOfflineValidation.cc:132
TrackerOfflineValidation::isPixel
bool isPixel(uint32_t subDetId)
Definition: TrackerOfflineValidation.cc:976
TrackerOfflineValidation::ModuleHistos::ResYvsYProfile
TProfile * ResYvsYProfile
Definition: TrackerOfflineValidation.cc:124
Alignable::alignableObjectId
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
TkOffTreeVariables::histNameX
std::string histNameX
Definition: TkOffTreeVariables.h:68
TkOffTreeVariables::layer
UInt_t layer
Definition: TkOffTreeVariables.h:59
Service.h
TkOffTreeVariables::posY
Float_t posY
Definition: TkOffTreeVariables.h:50
TrackerOfflineValidation::vTrack2DHistos_
std::vector< TH1 * > vTrack2DHistos_
Definition: TrackerOfflineValidation.cc:346
TrackerOfflineValidation::ModuleHistos::LocalX
TH1 * LocalX
Definition: TrackerOfflineValidation.cc:126
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
TrackerOfflineValidation::SummaryContainer::sumResXvsYProfile_
TH1 * sumResXvsYProfile_
Definition: TrackerOfflineValidation.cc:156
TkOffTreeVariables::entries
UInt_t entries
Definition: TkOffTreeVariables.h:58
TrackerOfflineValidation::moduleDirectory_
const std::string moduleDirectory_
Definition: TrackerOfflineValidation.cc:337
TkOffTreeVariables::numberOfUnderflows
Float_t numberOfUnderflows
Definition: TkOffTreeVariables.h:50
TrackerOfflineValidation::useFit_
const bool useFit_
Definition: TrackerOfflineValidation.cc:334
Surface::toGlobal
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
HLT_2018_cff.dPhi
dPhi
Definition: HLT_2018_cff.py:12290
edm::ESHandle< TrackerGeometry >
LaserClient_cfi.nbins
nbins
Definition: LaserClient_cfi.py:51
TrackerOfflineValidation::mTecResiduals_
std::map< int, TrackerOfflineValidation::ModuleHistos > mTecResiduals_
Definition: TrackerOfflineValidation.cc:353
dqm::implementation::DQMStore::setCurrentFolder
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:569
multiplicitycorr_cfi.xBins
xBins
Definition: multiplicitycorr_cfi.py:5
StripSubdetector::TIB
static constexpr auto TIB
Definition: StripSubdetector.h:16
TrackerOfflineValidation::ModuleHistos::ResXprimeHisto
TH1 * ResXprimeHisto
Definition: TrackerOfflineValidation.cc:116
TrackerOfflineValidation::summaryBins_
std::vector< std::tuple< int, TH1 *, TH1 * > > summaryBins_
Definition: TrackerOfflineValidation.cc:364
TrackerOfflineValidation::toFit_
std::vector< TH1 * > toFit_
Definition: TrackerOfflineValidation.cc:368
h
dqmdumpme.k
k
Definition: dqmdumpme.py:60
TkOffTreeVariables::fitSigmaY
Float_t fitSigmaY
Definition: TkOffTreeVariables.h:50
Point3DBase< float, GlobalTag >
makeHippyCampaign.basedir
basedir
Definition: makeHippyCampaign.py:14
TkOffTreeVariables::histNameNormY
std::string histNameNormY
Definition: TkOffTreeVariables.h:68
dqm::legacy::MonitorElement::getTH1
virtual TH1 * getTH1() const
Definition: MonitorElement.h:474
TrackerOfflineValidation::fillTree
void fillTree(TTree &tree, TkOffTreeVariables &treeMem, const std::map< int, TrackerOfflineValidation::ModuleHistos > &moduleHist_)
Definition: TrackerOfflineValidation.cc:1830
TkOffTreeVariables::moduleId
UInt_t moduleId
Definition: TkOffTreeVariables.h:59
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
TrackerAlignableId::typeAndLayerFromDetId
std::pair< int, int > typeAndLayerFromDetId(const DetId &detId, const TrackerTopology *tTopo) const
Definition: TrackerAlignableId.cc:17
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
align::StructureType
StructureType
Definition: StructureType.h:16
TkOffTreeVariables::rOrZDirection
Float_t rOrZDirection
Definition: TkOffTreeVariables.h:50
TrackerTopology::tibStereo
uint32_t tibStereo(const DetId &id) const
Definition: TrackerTopology.h:279
TrackerOfflineValidation::Fwhm
float Fwhm(const TH1 *hist) const
Definition: TrackerOfflineValidation.cc:1667
PostProcessor_cff.profile
profile
Definition: PostProcessor_cff.py:38
TkOffTreeVariables::meanNormLocalX
Float_t meanNormLocalX
Definition: TkOffTreeVariables.h:50
edm::LogWarning
Definition: MessageLogger.h:141
TFileService.h
TrackerOfflineValidation::ModuleHistos::NormResHisto
TH1 * NormResHisto
Definition: TrackerOfflineValidation.cc:113
TkOffTreeVariables::profileNameResXvsX
std::string profileNameResXvsX
Definition: TkOffTreeVariables.h:73
TkOffTreeVariables::posZ
Float_t posZ
Definition: TkOffTreeVariables.h:50
TrackerOfflineValidation::YprimeResidual
Definition: TrackerOfflineValidation.cc:90
TFileService::mkdir
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
TkOffTreeVariables::fitSigmaNormY
Float_t fitSigmaNormY
Definition: TkOffTreeVariables.h:50
dqmiodumpindices.typeName
typeName
Definition: dqmiodumpindices.py:33
TrackerDigiGeometryRecord.h
align::AlignableDetUnit
Definition: StructureType.h:19
TrackerOfflineValidation::endJob
void endJob() override
Definition: TrackerOfflineValidation.cc:1351
anotherprimaryvertexanalyzer_cfi.nBinY
nBinY
Definition: anotherprimaryvertexanalyzer_cfi.py:13
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
TrackerOfflineValidation::avalidator_
TrackerValidationVariables avalidator_
Definition: TrackerOfflineValidation.cc:373
Event.h
TrackerOfflineValidation::chargeCut_
const int chargeCut_
Definition: TrackerOfflineValidation.cc:339
align::invalid
Definition: StructureType.h:18
B2GTnPMonitor_cfi.histTitle
histTitle
Definition: B2GTnPMonitor_cfi.py:112
PV3DBase::barePhi
T barePhi() const
Definition: PV3DBase.h:65
TrackerOfflineValidation::sumHistStructure_
std::vector< std::pair< TH1 *, TH1 * > > sumHistStructure_
Definition: TrackerOfflineValidation.cc:366
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
TkOffTreeVariables::rmsNormX
Float_t rmsNormX
Definition: TkOffTreeVariables.h:50
TrackerOfflineValidation::tkGeom_
edm::ESHandle< TrackerGeometry > tkGeom_
Definition: TrackerOfflineValidation.cc:324
Alignable::id
align::ID id() const
Return the ID of Alignable, i.e. DetId of 'first' component GeomDet(Unit).
Definition: Alignable.h:180
TkOffTreeVariables::zDirection
Float_t zDirection
Definition: TkOffTreeVariables.h:50
HGVHistoProducerAlgoBlock_cfi.minY
minY
Definition: HGVHistoProducerAlgoBlock_cfi.py:158
TrackerOfflineValidation::DirectoryWrapper::directoryString
std::string directoryString
Definition: TrackerOfflineValidation.cc:230
PV3DBase::eta
T eta() const
Definition: PV3DBase.h:73
TrackerOfflineValidation::lCoorHistOn_
const bool lCoorHistOn_
Definition: TrackerOfflineValidation.cc:329
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
TrackerTopology::tidStereo
uint32_t tidStereo(const DetId &id) const
Definition: TrackerTopology.h:283
TrackerTopology::tibModule
unsigned int tibModule(const DetId &id) const
Definition: TrackerTopology.h:172
TrackerTopology::tidSide
unsigned int tidSide(const DetId &id) const
Definition: TrackerTopology.h:190
TrackerOfflineValidation::ModuleHistos::ResHisto
TH1 * ResHisto
Definition: TrackerOfflineValidation.cc:112
edm::Service
Definition: Service.h:30
pfParticleNetPreprocessParams_cfi.median
median
Definition: pfParticleNetPreprocessParams_cfi.py:16
createfilelist.int
int
Definition: createfilelist.py:10
TkOffTreeVariables::meanX
Float_t meanX
Definition: TkOffTreeVariables.h:50
TkOffTreeVariables::blade
UInt_t blade
Definition: TkOffTreeVariables.h:59
iEvent
int iEvent
Definition: GenABIO.cc:224
TrackerOfflineValidation::isDetOrDetUnit
bool isDetOrDetUnit(align::StructureType type)
Definition: TrackerOfflineValidation.cc:980
TrackerTopology::tecRing
unsigned int tecRing(const DetId &id) const
ring id
Definition: TrackerTopology.h:217
TrackerTopology::pxfModule
unsigned int pxfModule(const DetId &id) const
Definition: TrackerTopology.h:163
TrackerTopology::pxfDisk
unsigned int pxfDisk(const DetId &id) const
Definition: TrackerTopology.h:446
PVValHelper::residualType
residualType
Definition: PVValidationHelpers.h:46
TkOffTreeVariables::rmsNormY
Float_t rmsNormY
Definition: TkOffTreeVariables.h:50
Utilities.h
TrackerOfflineValidation::SummaryContainer::sumNormXResiduals_
TH1 * sumNormXResiduals_
Definition: TrackerOfflineValidation.cc:148
TrackerOfflineValidation::DirectoryWrapper::make
TH1 * make(const char *name, const char *title, int nBinX, double minBinX, double maxBinX)
dqmMemoryStats.stats
stats
Definition: dqmMemoryStats.py:134
edm::EventSetup
Definition: EventSetup.h:57
TkOffTreeVariables::fitMeanX
Float_t fitMeanX
Definition: TkOffTreeVariables.h:50
TrackerOfflineValidation::SummaryContainer::summaryNormXResiduals_
TH1 * summaryNormXResiduals_
Definition: TrackerOfflineValidation.cc:149
TkOffTreeVariables::side
UInt_t side
Definition: TkOffTreeVariables.h:59
TrackerOfflineValidation::YResidual
Definition: TrackerOfflineValidation.cc:87
TkOffTreeVariables::half
UInt_t half
Definition: TkOffTreeVariables.h:59
TrackCollections2monitor_cff.func
func
Definition: TrackCollections2monitor_cff.py:359
TrackerOfflineValidation_Standalone_cff.moduleLevelHistsTransient
moduleLevelHistsTransient
Definition: TrackerOfflineValidation_Standalone_cff.py:82
get
#define get
TrackerOfflineValidation::DirectoryWrapper
Definition: TrackerOfflineValidation.cc:161
TrackerOfflineValidation::collateSummaryHists
void collateSummaryHists()
Definition: TrackerOfflineValidation.cc:1455
TrackerOfflineValidation::DirectoryWrapper::tfd
std::unique_ptr< TFileDirectory > tfd
Definition: TrackerOfflineValidation.cc:229
TkOffTreeVariables::meanNormX
Float_t meanNormX
Definition: TkOffTreeVariables.h:50
TrackerOfflineValidation::DirectoryWrapper::dqmMode
const bool dqmMode
Definition: TrackerOfflineValidation.cc:231
TrackerOfflineValidation::ModuleHistos
Definition: TrackerOfflineValidation.cc:97
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
overlapproblemtsosanalyzer_cfi.title
title
Definition: overlapproblemtsosanalyzer_cfi.py:7
TrackerOfflineValidation::YResidualProfile
Definition: TrackerOfflineValidation.cc:93
TkOffTreeVariables::subDetId
UInt_t subDetId
Definition: TkOffTreeVariables.h:59
TkOffTreeVariables::profileNameResYvsY
std::string profileNameResYvsY
Definition: TkOffTreeVariables.h:73
TkOffTreeVariables::isDoubleSide
Bool_t isDoubleSide
Definition: TkOffTreeVariables.h:64
AlignableObjectId.h
align::AlignableDet
Definition: StructureType.h:20
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
TrackerOfflineValidation::XResidualProfile
Definition: TrackerOfflineValidation.cc:92
TrackerOfflineValidation::ModuleHistos::ModuleHistos
ModuleHistos()
Definition: TrackerOfflineValidation.cc:98
TkOffTreeVariables::posX
Float_t posX
Definition: TkOffTreeVariables.h:50
TkOffTreeVariables::meanResYvsY
Float_t meanResYvsY
Definition: TkOffTreeVariables.h:70
GeomDet.h
TrackerOfflineValidation::bookGlobalHists
void bookGlobalHists(DirectoryWrapper &tfd)
Definition: TrackerOfflineValidation.cc:544
TrackerTopology::tobLayer
unsigned int tobLayer(const DetId &id) const
Definition: TrackerTopology.h:147
TrackerAlignableId
Definition: TrackerAlignableId.h:22
type
type
Definition: HCALResponse.h:21
TrackerOfflineValidation::NormXResidual
Definition: TrackerOfflineValidation.cc:86
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
StripSubdetector::TEC
static constexpr auto TEC
Definition: StripSubdetector.h:19
TrackerTopology::tobModule
unsigned int tobModule(const DetId &id) const
Definition: TrackerTopology.h:166
L1TOccupancyClient_cfi.ymin
ymin
Definition: L1TOccupancyClient_cfi.py:43
TkOffTreeVariables::rmsResYvsX
Float_t rmsResYvsX
Definition: TkOffTreeVariables.h:71
TrackerTopology::pxbModule
unsigned int pxbModule(const DetId &id) const
Definition: TrackerTopology.h:160
TrackerTopology::tibIsDoubleSide
bool tibIsDoubleSide(const DetId &id) const
Definition: TrackerTopology.h:249
TkOffTreeVariables::ring
UInt_t ring
Definition: TkOffTreeVariables.h:59
TkOffTreeVariables::fitSigmaX
Float_t fitSigmaX
Definition: TkOffTreeVariables.h:50
DetId.h
Frameworkfwd.h
makeMuonMisalignmentScenario.components
string components
Definition: makeMuonMisalignmentScenario.py:58
TkOffTreeVariables::rmsResYvsY
Float_t rmsResYvsY
Definition: TkOffTreeVariables.h:71
TkOffTreeVariables::chi2PerDofX
Float_t chi2PerDofX
Definition: TkOffTreeVariables.h:50
TrackerOfflineValidation_Dqm_cff.xmax
xmax
Definition: TrackerOfflineValidation_Dqm_cff.py:11
HGVHistoProducerAlgoBlock_cfi.maxY
maxY
Definition: HGVHistoProducerAlgoBlock_cfi.py:159
TkOffTreeVariables::meanResXvsX
Float_t meanResXvsX
Definition: TkOffTreeVariables.h:70
Exception
Definition: hltDiff.cc:246
TrackerOfflineValidation::setUpTreeMembers
void setUpTreeMembers(const std::map< int, TrackerOfflineValidation::ModuleHistos > &moduleHist_, const TrackerGeometry &tkgeom, const TrackerTopology *tTopo)
Definition: TrackerOfflineValidation.cc:1693
TkOffTreeVariables::chi2PerDofY
Float_t chi2PerDofY
Definition: TkOffTreeVariables.h:50
anotherprimaryvertexanalyzer_cfi.nBinX
nBinX
Definition: anotherprimaryvertexanalyzer_cfi.py:12
TrackerOfflineValidation::parSet_
const edm::ParameterSet parSet_
Definition: TrackerOfflineValidation.cc:323
TrackerOfflineValidation::ModuleHistos::ResXvsXProfile
TProfile * ResXvsXProfile
Definition: TrackerOfflineValidation.cc:121
GeomDetEnumerators::subDetId
constexpr unsigned int subDetId[21]
Definition: GeomDetEnumerators.h:34
Alignable.h
StripSubdetector::TOB
static constexpr auto TOB
Definition: StripSubdetector.h:18
TkOffTreeVariables::histNameY
std::string histNameY
Definition: TkOffTreeVariables.h:68
TrackerOfflineValidation::prepareSummaryHists
void prepareSummaryHists(DirectoryWrapper &tfd, const Alignable &ali, std::vector< TrackerOfflineValidation::SummaryContainer > &vLevelProfiles)
Definition: TrackerOfflineValidation.cc:1390
TrackerOfflineValidation
Definition: TrackerOfflineValidation.cc:78
TrackerOfflineValidation::getMedian
float getMedian(const TH1 *hist) const
Definition: TrackerOfflineValidation.cc:1992
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
EventSetup.h
TrackerOfflineValidation::vTrackProfiles_
std::vector< TH1 * > vTrackProfiles_
Definition: TrackerOfflineValidation.cc:345
TrackerGeometry::detIds
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
Definition: TrackerGeometry.h:64
TrackerTopology::tecModule
unsigned int tecModule(const DetId &id) const
Definition: TrackerTopology.h:169
TrackerOfflineValidation::SummaryContainer
Definition: TrackerOfflineValidation.cc:131
TkOffTreeVariables::histNameNormX
std::string histNameNormX
Definition: TkOffTreeVariables.h:68
TkOffTreeVariables::histNameNormLocalX
std::string histNameNormLocalX
Definition: TkOffTreeVariables.h:67
TrackerOfflineValidation::SummaryContainer::sumNormYResiduals_
TH1 * sumNormYResiduals_
Definition: TrackerOfflineValidation.cc:152
TrackerOfflineValidation::vTrackHistos_
std::vector< TH1 * > vTrackHistos_
Definition: TrackerOfflineValidation.cc:344
TrackerTopology::pxfBlade
unsigned int pxfBlade(const DetId &id) const
Definition: TrackerTopology.h:447
TrackerTopology::tecPetalInfo
std::vector< unsigned int > tecPetalInfo(const DetId &id) const
Definition: TrackerTopology.h:407
TrackerOfflineValidation::NormXprimeResidual
Definition: TrackerOfflineValidation.cc:89
TkOffTreeVariables::posEta
Float_t posEta
Definition: TkOffTreeVariables.h:50
mps_fire.result
result
Definition: mps_fire.py:303
AlignableTracker.h
ConsumesCollector.h
cms::Exception
Definition: Exception.h:70
TrackerOfflineValidation::useOverflowForRMS_
const bool useOverflowForRMS_
Definition: TrackerOfflineValidation.cc:335
TrackerOfflineValidation::moduleLevelHistsTransient_
const bool moduleLevelHistsTransient_
Definition: TrackerOfflineValidation.cc:330
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
ParameterSet.h
dummy
Definition: DummySelector.h:38
TkOffTreeVariables::meanLocalX
Float_t meanLocalX
Definition: TkOffTreeVariables.h:50
spclusmultinvestigator_cfi.numberOfBins
numberOfBins
Definition: spclusmultinvestigator_cfi.py:17
TrackerOfflineValidation_Dqm_cff.xmin
xmin
Definition: TrackerOfflineValidation_Dqm_cff.py:10
TkOffTreeVariables::fitMeanNormX
Float_t fitMeanNormX
Definition: TkOffTreeVariables.h:50
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
TrackerGeometry::detUnitIds
const DetIdContainer & detUnitIds() const override
Returm a vector of all GeomDetUnit DetIds.
Definition: TrackerGeometry.h:63
TrackerOfflineValidation::SummaryContainer::sumResYvsYProfile_
TH1 * sumResYvsYProfile_
Definition: TrackerOfflineValidation.cc:158
edm::Event
Definition: Event.h:73
TkOffTreeVariables::module
UInt_t module
Definition: TkOffTreeVariables.h:59
TkOffTreeVariables::sigmaNormX
Float_t sigmaNormX
Definition: TkOffTreeVariables.h:50
TkOffTreeVariables::rmsNormLocalX
Float_t rmsNormLocalX
Definition: TkOffTreeVariables.h:50
Alignable::components
virtual const Alignables & components() const =0
Return vector of all direct components.
TrackerTopology::tecWheel
unsigned int tecWheel(const DetId &id) const
Definition: TrackerTopology.h:198
TrackerOfflineValidation::dqmMode_
const bool dqmMode_
Definition: TrackerOfflineValidation.cc:336
TkOffTreeVariables::isStereo
Bool_t isStereo
Definition: TkOffTreeVariables.h:65
TrackerOfflineValidation::mTidResiduals_
std::map< int, TrackerOfflineValidation::ModuleHistos > mTidResiduals_
Definition: TrackerOfflineValidation.cc:351
TrackerOfflineValidation::ModuleHistos::NormResYprimeHisto
TH1 * NormResYprimeHisto
Definition: TrackerOfflineValidation.cc:119
StripSubdetector.h
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
TrackerOfflineValidation::XResidual
Definition: TrackerOfflineValidation.cc:85
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
TkOffTreeVariables::rmsY
Float_t rmsY
Definition: TkOffTreeVariables.h:50
TrackerOfflineValidation::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: TrackerOfflineValidation.cc:1111
StripSubdetector::TID
static constexpr auto TID
Definition: StripSubdetector.h:17
TrackerOfflineValidation::SummaryContainer::sumResYvsXProfile_
TH1 * sumResYvsXProfile_
Definition: TrackerOfflineValidation.cc:157
deltaPhi.h
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64
TrackerOfflineValidation::ModuleHistos::ResYprimeHisto
TH1 * ResYprimeHisto
Definition: TrackerOfflineValidation.cc:118
TrackerOfflineValidation::useFwhm_
const bool useFwhm_
Definition: TrackerOfflineValidation.cc:333
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
TrackerOfflineValidation::ModuleHistos::ResYvsXProfile
TProfile * ResYvsXProfile
Definition: TrackerOfflineValidation.cc:123
TrackerOfflineValidation::moduleLevelProfiles_
const bool moduleLevelProfiles_
Definition: TrackerOfflineValidation.cc:331
TrackerTopology::tecStereo
uint32_t tecStereo(const DetId &id) const
Definition: TrackerTopology.h:287
HGVHistoProducerAlgoBlock_cfi.maxX
maxX
Definition: HGVHistoProducerAlgoBlock_cfi.py:154
TkOffTreeVariables::histNameLocalY
std::string histNameLocalY
Definition: TkOffTreeVariables.h:67
TrackerOfflineValidation::SummaryContainer::sumResXvsXProfile_
TH1 * sumResXvsXProfile_
Definition: TrackerOfflineValidation.cc:155
TrackerOfflineValidation::NormYprimeResidual
Definition: TrackerOfflineValidation.cc:91
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
TrackerTopology::tibLayer
unsigned int tibLayer(const DetId &id) const
Definition: TrackerTopology.h:150
TrackerGeometry
Definition: TrackerGeometry.h:14
TkOffTreeVariables
container to hold data to be written into TTree
Definition: TkOffTreeVariables.h:9
TrackerAlignableId.h
TrackerTopology::tecSide
unsigned int tecSide(const DetId &id) const
Definition: TrackerTopology.h:184
TkOffTreeVariables::numberOfOutliers
Float_t numberOfOutliers
Definition: TkOffTreeVariables.h:50
TrackerOfflineValidation::fitResiduals
std::pair< float, float > fitResiduals(TH1 *hist) const
Definition: TrackerOfflineValidation.cc:1958
TrackerOfflineValidation::isEndCap
bool isEndCap(uint32_t subDetId)
Definition: TrackerOfflineValidation.cc:971