CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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.43 2010/11/19 12:39:16 flucke Exp $
17 //
18 //
19 
20 // system include files
21 #include <memory>
22 #include <map>
23 #include <sstream>
24 #include <math.h>
25 #include <utility>
26 #include <vector>
27 #include <iostream>
28 
29 // ROOT includes
30 #include "TH1.h"
31 #include "TH2.h"
32 #include "TProfile.h"
33 #include "TFile.h"
34 #include "TTree.h"
35 #include "TF1.h"
36 #include "TMath.h"
37 
38 // user include files
47 
57 
60 
64 
67 
73 
76 
77 //
78 // class declaration
79 //
81 public:
84 
86  YResidual, /*NormYResidual, */
90 
91 private:
92 
93  struct ModuleHistos{
94  ModuleHistos() : ResHisto(), NormResHisto(), ResYHisto(), /*NormResYHisto(),*/
97  TH1* ResHisto;
99  TH1* ResYHisto;
100  /* TH1* NormResYHisto; */
105 
106  TH1* LocalX;
107  TH1* LocalY;
108  TProfile* ResXvsXProfile;
109  TProfile* ResXvsYProfile;
110  TProfile* ResYvsXProfile;
111  TProfile* ResYvsYProfile;
112  };
113 
114  // container struct to organize collection of histogramms during endJob
120 
129  };
130 
131 
133  DirectoryWrapper(const DirectoryWrapper& upDir,const std::string& newDir,
134  const std::string& basedir,bool useDqmMode)
135  : tfd(0),
136  dqmMode(useDqmMode),
137  theDbe(0) {
138  if (newDir.length()!=0){
139  if(upDir.directoryString.length()!=0)directoryString=upDir.directoryString+"/"+newDir;
140  else directoryString = newDir;
141  }
142  else
144 
145  if (!dqmMode){
146  if (newDir.length()==0) tfd.reset(&(*upDir.tfd));
147  else
148  tfd.reset(new TFileDirectory(upDir.tfd->mkdir(newDir)));
149  }
150  else {
152  }
153  }
154 
155  DirectoryWrapper(const std::string& newDir,const std::string& basedir,bool useDqmMode)
156  : tfd(0),
157  dqmMode(useDqmMode),
158  theDbe(0) {
159  if (!dqmMode){
161  if (newDir.length()==0){
162  tfd.reset(new TFileDirectory(static_cast<TFileDirectory&>(*fs)));
163  }
164  else {
165  tfd.reset(new TFileDirectory(fs->mkdir(newDir)));
166  directoryString=newDir;
167  }
168  }
169  else {
170  if (newDir.length()!=0){
171  if(basedir.length()!=0)directoryString=basedir+"/"+newDir;
172  else directoryString = newDir;
173  }
174  else directoryString=basedir;
176  }
177  }
178  // Generalization of Histogram Booking; allows switch between TFileService and DQMStore
179  template <typename T> TH1* make(const char* name,const char* title,int nBinX,double minBinX,double maxBinX);
180  template <typename T> TH1* make(const char* name,const char* title,int nBinX,double *xBins);//variable bin size in x for profile histo
181  template <typename T> TH1* make(const char* name,const char* title,int nBinX,double minBinX,double maxBinX,int nBinY,double minBinY,double maxBinY);
182  template <typename T> TH1* make(const char* name,const char* title,int nBinX,double minBinX,double maxBinX,double minBinY,double maxBinY); // at present not used
183 
184  std::auto_ptr<TFileDirectory> tfd;
185  std::string directoryString;
186  const bool dqmMode;
188  };
189 
190 
191  //
192  // ------------- private member function -------------
193  //
194  virtual void analyze(const edm::Event&, const edm::EventSetup&);
195  virtual void endJob();
196 
197  virtual void checkBookHists(const edm::EventSetup& setup);
198 
200  void bookDirHists(DirectoryWrapper& tfd, const Alignable& ali, const AlignableObjectId& aliobjid);
201  void bookHists(DirectoryWrapper& tfd, const Alignable& ali, align::StructureType type, int i,
202  const AlignableObjectId& aliobjid);
203 
204  void collateSummaryHists( DirectoryWrapper& tfd, const Alignable& ali, int i,
205  const AlignableObjectId& aliobjid,
206  std::vector<TrackerOfflineValidation::SummaryContainer>& vLevelProfiles);
207 
208  void fillTree(TTree& tree, const std::map<int, TrackerOfflineValidation::ModuleHistos>& moduleHist_,
209  TkOffTreeVariables& treeMem, const TrackerGeometry& tkgeom);
210 
212  const Alignable& ali,
214  const AlignableObjectId& aliobjid);
215 
217 
218  bool isBarrel(uint32_t subDetId);
219  bool isEndCap(uint32_t subDetId);
220  bool isPixel(uint32_t subDetId);
222 
223  TH1* bookTH1F(bool isTransient, DirectoryWrapper& tfd, const char* histName, const char* histTitle,
224  int nBinsX, double lowX, double highX);
225 
226  TProfile* bookTProfile(bool isTransient, DirectoryWrapper& tfd, const char* histName, const char* histTitle,
227  int nBinsX, double lowX, double highX);
228 
229  TProfile* bookTProfile(bool isTransient, DirectoryWrapper& tfd, const char* histName, const char* histTitle,
230  int nBinsX, double lowX, double highX, double lowY, double highY);
231 
232  void getBinning(uint32_t subDetId, TrackerOfflineValidation::HistogrammType residualtype,
233  int& nBinsX, double& lowerBoundX, double& upperBoundX);
234 
235  void summarizeBinInContainer(int bin, SummaryContainer& targetContainer,
236  SummaryContainer& sourceContainer);
237 
238  void summarizeBinInContainer(int bin, uint32_t subDetId, SummaryContainer& targetContainer,
239  ModuleHistos& sourceContainer);
240 
241  void setSummaryBin(int bin, TH1* targetHist, TH1* sourceHist);
242 
243  float Fwhm(const TH1* hist) const;
244  std::pair<float,float> fitResiduals(TH1* hist) const; //, float meantmp, float rmstmp);
245  float getMedian( const TH1* hist) const;
246 
247  // From MillePedeAlignmentMonitor: Get Index for Arbitary vector<class> by name
248  template <class OBJECT_TYPE> int GetIndex(const std::vector<OBJECT_TYPE*>& vec, const TString& name);
249 
250 
251  // ---------- member data ---------------------------
252 
255  const TrackerGeometry *bareTkGeomPtr_; // ugly hack to book hists only once, but check
256 
257  // parameters from cfg to steer
258  const bool lCoorHistOn_;
261  const bool overlappOn_;
262  const bool stripYResiduals_;
263  const bool useFwhm_;
264  const bool useFit_;
265  const bool useOverflowForRMS_;
266  const bool dqmMode_;
267  const std::string moduleDirectory_;
268 
269  std::map< std::pair<uint32_t, uint32_t>, TH1*> hOverlappResidual;
270 
271  // a vector to keep track which pointers should be deleted at the very end
272  std::vector<TH1*> vDeleteObjects_;
273 
274  std::vector<TH1*> vTrackHistos_;
275  std::vector<TH1*> vTrackProfiles_;
276  std::vector<TH1*> vTrack2DHistos_;
277 
278  std::map<int,TrackerOfflineValidation::ModuleHistos> mPxbResiduals_;
279  std::map<int,TrackerOfflineValidation::ModuleHistos> mPxeResiduals_;
280  std::map<int,TrackerOfflineValidation::ModuleHistos> mTibResiduals_;
281  std::map<int,TrackerOfflineValidation::ModuleHistos> mTidResiduals_;
282  std::map<int,TrackerOfflineValidation::ModuleHistos> mTobResiduals_;
283  std::map<int,TrackerOfflineValidation::ModuleHistos> mTecResiduals_;
284 };
285 
286 
287 //
288 // constants, enums and typedefs
289 //
290 
291 //
292 // static data member definitions
293 //
294 
295 template <class OBJECT_TYPE>
296 int TrackerOfflineValidation::GetIndex(const std::vector<OBJECT_TYPE*> &vec, const TString &name)
297 {
298  int result = 0;
299  for (typename std::vector<OBJECT_TYPE*>::const_iterator iter = vec.begin(), iterEnd = vec.end();
300  iter != iterEnd; ++iter, ++result) {
301  if (*iter && (*iter)->GetName() == name) return result;
302  }
303  edm::LogError("Alignment") << "@SUB=TrackerOfflineValidation::GetIndex" << " could not find " << name;
304  return -1;
305 }
306 
307 
308 template <> TH1* TrackerOfflineValidation::DirectoryWrapper::make<TH1F>(const char* name,const char* title,int nBinX,double minBinX,double maxBinX){
309  if(dqmMode){theDbe->setCurrentFolder(directoryString); return theDbe->book1D(name,title,nBinX,minBinX,maxBinX)->getTH1();}
310  else{return tfd->make<TH1F>(name,title,nBinX,minBinX,maxBinX);}
311 }
312 
313 template <> TH1* TrackerOfflineValidation::DirectoryWrapper::make<TProfile>(const char* name,const char* title,int nBinX,double *xBins){
314  if(dqmMode){
315  theDbe->setCurrentFolder(directoryString);
316  //DQM profile requires y-bins for construction... using TProfile creator by hand...
317  TProfile *tmpProfile=new TProfile(name,title,nBinX,xBins);
318  tmpProfile->SetDirectory(0);
319  return theDbe->bookProfile(name,tmpProfile)->getTH1();
320  }
321  else{return tfd->make<TProfile>(name,title,nBinX,xBins);}
322 }
323 
324 template <> TH1* TrackerOfflineValidation::DirectoryWrapper::make<TProfile>(const char* name,const char* title,int nBinX,double minBinX,double maxBinX){
325  if(dqmMode){
326  theDbe->setCurrentFolder(directoryString);
327  //DQM profile requires y-bins for construction... using TProfile creator by hand...
328  TProfile *tmpProfile=new TProfile(name,title,nBinX,minBinX,maxBinX);
329  tmpProfile->SetDirectory(0);
330  return theDbe->bookProfile(name,tmpProfile)->getTH1();
331  }
332  else{return tfd->make<TProfile>(name,title,nBinX,minBinX,maxBinX);}
333 }
334 
335 template <> TH1* TrackerOfflineValidation::DirectoryWrapper::make<TProfile>(const char* name ,const char* title,int nbinX,double minX ,double maxX,double minY,double maxY){
336  if(dqmMode){
337  theDbe->setCurrentFolder(directoryString);
338  int dummy(0); // DQMProfile wants Y channels... does not use them!
339  return (theDbe->bookProfile(name,title,nbinX,minX,maxX,dummy,minY,maxY)->getTH1());
340  }
341  else{
342  return tfd->make<TProfile>(name,title,nbinX,minX,maxX,minY,maxY);
343  }
344 }
345 
346 template <> TH1* TrackerOfflineValidation::DirectoryWrapper::make<TH2F>(const char* name,const char* title,int nBinX,double minBinX,double maxBinX,int nBinY,double minBinY,double maxBinY){
347  if(dqmMode){theDbe->setCurrentFolder(directoryString); return theDbe->book2D(name,title,nBinX,minBinX,maxBinX,nBinY,minBinY,maxBinY)->getTH1();}
348  else{return tfd->make<TH2F>(name,title,nBinX,minBinX,maxBinX,nBinY,minBinY,maxBinY);}
349 }
350 
351 
352 //
353 // constructors and destructor
354 //
356  : parSet_(iConfig), bareTkGeomPtr_(0), lCoorHistOn_(parSet_.getParameter<bool>("localCoorHistosOn")),
357  moduleLevelHistsTransient_(parSet_.getParameter<bool>("moduleLevelHistsTransient")),
358  moduleLevelProfiles_(parSet_.getParameter<bool>("moduleLevelProfiles")),
359  overlappOn_(parSet_.getParameter<bool>("overlappOn")),
360  stripYResiduals_(parSet_.getParameter<bool>("stripYResiduals")),
361  useFwhm_(parSet_.getParameter<bool>("useFwhm")),
362  useFit_(parSet_.getParameter<bool>("useFit")),
363  useOverflowForRMS_(parSet_.getParameter<bool>("useOverflowForRMS")),
364  dqmMode_(parSet_.getParameter<bool>("useInDqmMode")),
365  moduleDirectory_(parSet_.getParameter<std::string>("moduleDirectoryInOutput"))
366 {
367 }
368 
369 
371 {
372  // do anything here that needs to be done at desctruction time
373  // (e.g. close files, deallocate resources etc.)
374  for( std::vector<TH1*>::const_iterator it = vDeleteObjects_.begin(), itEnd = vDeleteObjects_.end();
375  it != itEnd;
376  ++it) delete *it;
377 }
378 
379 
380 //
381 // member functions
382 //
383 
384 
385 // ------------ method called once each job just before starting event loop ------------
386 void
388 {
390  const TrackerGeometry *newBareTkGeomPtr = &(*tkGeom_);
391  if (newBareTkGeomPtr == bareTkGeomPtr_) return; // already booked hists, nothing changed
392 
393  if (!bareTkGeomPtr_) { // pointer not yet set: called the first time => book hists
394  AlignableObjectId aliobjid;
395 
396  // construct alignable tracker to get access to alignable hierarchy
397  AlignableTracker aliTracker(&(*tkGeom_));
398 
399  edm::LogInfo("TrackerOfflineValidation") << "There are " << newBareTkGeomPtr->detIds().size()
400  << " dets in the Geometry record.\n"
401  << "Out of these "<<newBareTkGeomPtr->detUnitIds().size()
402  <<" are detUnits";
403 
404  // Book Histogramms for global track quantities
405  std::string globDir("GlobalTrackVariables");
406  DirectoryWrapper trackglobal(globDir,moduleDirectory_,dqmMode_);
407  this->bookGlobalHists(trackglobal);
408 
409  // recursively book histogramms on lowest level
411  this->bookDirHists(tfdw, aliTracker, aliobjid);
412  }
413  else { // histograms booked, but changed TrackerGeometry?
414  edm::LogWarning("GeometryChange") << "@SUB=checkBookHists"
415  << "TrackerGeometry changed, but will not re-book hists!";
416  }
417  bareTkGeomPtr_ = newBareTkGeomPtr;
418 }
419 
420 
421 void
423 {
424 
425  vTrackHistos_.push_back(tfd.make<TH1F>("h_tracketa",
426  "Track #eta;#eta_{Track};Number of Tracks",
427  90,-3.,3.));
428  vTrackHistos_.push_back(tfd.make<TH1F>("h_trackphi",
429  "Track #phi;#phi_{Track};Number of Tracks",
430  90,-3.15,3.15));
431  vTrackHistos_.push_back(tfd.make<TH1F>("h_trackNumberOfValidHits",
432  "Track # of valid hits;# of valid hits _{Track};Number of Tracks",
433  40,0.,40.));
434  vTrackHistos_.push_back(tfd.make<TH1F>("h_trackNumberOfLostHits",
435  "Track # of lost hits;# of lost hits _{Track};Number of Tracks",
436  10,0.,10.));
437  vTrackHistos_.push_back(tfd.make<TH1F>("h_curvature",
438  "Curvature #kappa;#kappa_{Track};Number of Tracks",
439  100,-.05,.05));
440  vTrackHistos_.push_back(tfd.make<TH1F>("h_curvature_pos",
441  "Curvature |#kappa| Positive Tracks;|#kappa_{pos Track}|;Number of Tracks",
442  100,.0,.05));
443  vTrackHistos_.push_back(tfd.make<TH1F>("h_curvature_neg",
444  "Curvature |#kappa| Negative Tracks;|#kappa_{neg Track}|;Number of Tracks",
445  100,.0,.05));
446  vTrackHistos_.push_back(tfd.make<TH1F>("h_diff_curvature",
447  "Curvature |#kappa| Tracks Difference;|#kappa_{Track}|;# Pos Tracks - # Neg Tracks",
448  100,.0,.05));
449  vTrackHistos_.push_back(tfd.make<TH1F>("h_chi2",
450  "#chi^{2};#chi^{2}_{Track};Number of Tracks",
451  500,-0.01,500.));
452  vTrackHistos_.push_back(tfd.make<TH1F>("h_chi2Prob",
453  "#chi^{2} probability;#chi^{2}prob_{Track};Number of Tracks",
454  100,0.0,1.));
455  vTrackHistos_.push_back(tfd.make<TH1F>("h_normchi2",
456  "#chi^{2}/ndof;#chi^{2}/ndof;Number of Tracks",
457  100,-0.01,10.));
458  vTrackHistos_.push_back(tfd.make<TH1F>("h_pt",
459  "p_{T}^{track};p_{T}^{track} [GeV];Number of Tracks",
460  250,0.,250));
461  vTrackHistos_.push_back(tfd.make<TH1F>("h_ptResolution",
462  "#delta{p_{T}/p_{T}^{track}};#delta_{p_{T}/p_{T}^{track}};Number of Tracks",
463  100,0.,0.5));
464 
465  vTrackProfiles_.push_back(tfd.make<TProfile>("p_d0_vs_phi",
466  "Transverse Impact Parameter vs. #phi;#phi_{Track};#LT d_{0} #GT [cm]",
467  100,-3.15,3.15));
468  vTrackProfiles_.push_back(tfd.make<TProfile>("p_dz_vs_phi",
469  "Longitudinal Impact Parameter vs. #phi;#phi_{Track};#LT d_{z} #GT [cm]",
470  100,-3.15,3.15));
471  vTrackProfiles_.push_back(tfd.make<TProfile>("p_d0_vs_eta",
472  "Transverse Impact Parameter vs. #eta;#eta_{Track};#LT d_{0} #GT [cm]",
473  100,-3.15,3.15));
474  vTrackProfiles_.push_back(tfd.make<TProfile>("p_dz_vs_eta",
475  "Longitudinal Impact Parameter vs. #eta;#eta_{Track};#LT d_{z} #GT [cm]",
476  100,-3.15,3.15));
477  vTrackProfiles_.push_back(tfd.make<TProfile>("p_chi2_vs_phi",
478  "#chi^{2} vs. #phi;#phi_{Track};#LT #chi^{2} #GT",
479  100,-3.15,3.15));
480  vTrackProfiles_.push_back(tfd.make<TProfile>("p_chi2Prob_vs_phi",
481  "#chi^{2} probablility vs. #phi;#phi_{Track};#LT #chi^{2} probability#GT",
482  100,-3.15,3.15));
483  vTrackProfiles_.push_back(tfd.make<TProfile>("p_normchi2_vs_phi",
484  "#chi^{2}/ndof vs. #phi;#phi_{Track};#LT #chi^{2}/ndof #GT",
485  100,-3.15,3.15));
486  vTrackProfiles_.push_back(tfd.make<TProfile>("p_chi2_vs_eta",
487  "#chi^{2} vs. #eta;#eta_{Track};#LT #chi^{2} #GT",
488  100,-3.15,3.15));
489  //variable binning for chi2/ndof vs. pT
490  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.};
491  vTrackProfiles_.push_back(tfd.make<TProfile>("p_normchi2_vs_pt",
492  "norm #chi^{2} vs. p_{T}_{Track}; p_{T}_{Track};#LT #chi^{2}/ndof #GT",
493  18,xBins));
494 
495  vTrackProfiles_.push_back(tfd.make<TProfile>("p_normchi2_vs_p",
496  "#chi^{2}/ndof vs. p_{Track};p_{Track};#LT #chi^{2}/ndof #GT",
497  18,xBins));
498  vTrackProfiles_.push_back(tfd.make<TProfile>("p_chi2Prob_vs_eta",
499  "#chi^{2} probability vs. #eta;#eta_{Track};#LT #chi^{2} probability #GT",
500  100,-3.15,3.15));
501  vTrackProfiles_.push_back(tfd.make<TProfile>("p_normchi2_vs_eta",
502  "#chi^{2}/ndof vs. #eta;#eta_{Track};#LT #chi^{2}/ndof #GT",
503  100,-3.15,3.15));
504  vTrackProfiles_.push_back(tfd.make<TProfile>("p_kappa_vs_phi",
505  "#kappa vs. #phi;#phi_{Track};#kappa",
506  100,-3.15,3.15));
507  vTrackProfiles_.push_back(tfd.make<TProfile>("p_kappa_vs_eta",
508  "#kappa vs. #eta;#eta_{Track};#kappa",
509  100,-3.15,3.15));
510  vTrackProfiles_.push_back(tfd.make<TProfile>("p_ptResolution_vs_phi",
511  "#delta_{p_{T}}/p_{T}^{track};#phi^{track};#delta_{p_{T}}/p_{T}^{track}",
512  100, -3.15,3.15));
513  vTrackProfiles_.push_back(tfd.make<TProfile>("p_ptResolution_vs_eta",
514  "#delta_{p_{T}}/p_{T}^{track};#eta^{track};#delta_{p_{T}}/p_{T}^{track}",
515  100, -3.15,3.15));
516 
517  vTrack2DHistos_.push_back(tfd.make<TH2F>("h2_d0_vs_phi",
518  "Transverse Impact Parameter vs. #phi;#phi_{Track};d_{0} [cm]",
519  100, -3.15, 3.15, 100,-1.,1.) );
520  vTrack2DHistos_.push_back(tfd.make<TH2F>("h2_dz_vs_phi",
521  "Longitudinal Impact Parameter vs. #phi;#phi_{Track};d_{z} [cm]",
522  100, -3.15, 3.15, 100,-100.,100.));
523  vTrack2DHistos_.push_back(tfd.make<TH2F>("h2_d0_vs_eta",
524  "Transverse Impact Parameter vs. #eta;#eta_{Track};d_{0} [cm]",
525  100, -3.15, 3.15, 100,-1.,1.));
526  vTrack2DHistos_.push_back(tfd.make<TH2F>("h2_dz_vs_eta",
527  "Longitudinal Impact Parameter vs. #eta;#eta_{Track};d_{z} [cm]",
528  100, -3.15, 3.15, 100,-100.,100.));
529  vTrack2DHistos_.push_back(tfd.make<TH2F>("h2_chi2_vs_phi",
530  "#chi^{2} vs. #phi;#phi_{Track};#chi^{2}",
531  100, -3.15, 3.15, 500, 0., 500.));
532  vTrack2DHistos_.push_back(tfd.make<TH2F>("h2_chi2Prob_vs_phi",
533  "#chi^{2} probability vs. #phi;#phi_{Track};#chi^{2} probability",
534  100, -3.15, 3.15, 100, 0., 1.));
535  vTrack2DHistos_.push_back(tfd.make<TH2F>("h2_normchi2_vs_phi",
536  "#chi^{2}/ndof vs. #phi;#phi_{Track};#chi^{2}/ndof",
537  100, -3.15, 3.15, 100, 0., 10.));
538  vTrack2DHistos_.push_back(tfd.make<TH2F>("h2_chi2_vs_eta",
539  "#chi^{2} vs. #eta;#eta_{Track};#chi^{2}",
540  100, -3.15, 3.15, 500, 0., 500.));
541  vTrack2DHistos_.push_back(tfd.make<TH2F>("h2_chi2Prob_vs_eta",
542  "#chi^{2} probaility vs. #eta;#eta_{Track};#chi^{2} probability",
543  100, -3.15, 3.15, 100, 0., 1.));
544  vTrack2DHistos_.push_back(tfd.make<TH2F>("h2_normchi2_vs_eta",
545  "#chi^{2}/ndof vs. #eta;#eta_{Track};#chi^{2}/ndof",
546  100,-3.15,3.15, 100, 0., 10.));
547  vTrack2DHistos_.push_back(tfd.make<TH2F>("h2_kappa_vs_phi",
548  "#kappa vs. #phi;#phi_{Track};#kappa",
549  100,-3.15,3.15, 100, .0,.05));
550  vTrack2DHistos_.push_back(tfd.make<TH2F>("h2_kappa_vs_eta",
551  "#kappa vs. #eta;#eta_{Track};#kappa",
552  100,-3.15,3.15, 100, .0,.05));
553  vTrack2DHistos_.push_back(tfd.make<TH2F>("h2_normchi2_vs_kappa",
554  "#kappa vs. #chi^{2}/ndof;#chi^{2}/ndof;#kappa",
555  100,0.,10, 100,-.03,.03));
556 
557  /****************** Definition of 2-D Histos of ResX vs momenta ****************************/
558  vTrack2DHistos_.push_back(tfd.make<TH2F>("p_vs_resXprime_pixB",
559  "#momentum vs. #resX in pixB;#momentum;#resX",
560  15,0.,15., 200, -0.1,0.1));
561  vTrack2DHistos_.push_back(tfd.make<TH2F>("p_vs_resXprime_pixE",
562  "#momentum vs. #resX in pixE;#momentum;#resX",
563  15,0.,15., 200, -0.1,0.1));
564  vTrack2DHistos_.push_back(tfd.make<TH2F>("p_vs_resXprime_TIB",
565  "#momentum vs. #resX in TIB;#momentum;#resX",
566  15,0.,15., 200, -0.1,0.1));
567  vTrack2DHistos_.push_back(tfd.make<TH2F>("p_vs_resXprime_TID",
568  "#momentum vs. #resX in TID;#momentum;#resX",
569  15,0.,15., 200, -0.1,0.1));
570  vTrack2DHistos_.push_back(tfd.make<TH2F>("p_vs_resXprime_TOB",
571  "#momentum vs. #resX in TOB;#momentum;#resX",
572  15,0.,15., 200, -0.1,0.1));
573  vTrack2DHistos_.push_back(tfd.make<TH2F>("p_vs_resXprime_TEC",
574  "#momentum vs. #resX in TEC;#momentum;#resX",
575  15,0.,15., 200, -0.1,0.1));
576 
577  /****************** Definition of 2-D Histos of ResY vs momenta ****************************/
578  vTrack2DHistos_.push_back(tfd.make<TH2F>("p_vs_resYprime_pixB",
579  "#momentum vs. #resY in pixB;#momentum;#resY",
580  15,0.,15., 200, -0.1,0.1));
581  vTrack2DHistos_.push_back(tfd.make<TH2F>("p_vs_resYprime_pixE",
582  "#momentum vs. #resY in pixE;#momentum;#resY",
583  15,0.,15., 200, -0.1,0.1));
584 
585 }
586 
587 
588 void
590 {
591  std::vector<Alignable*> alivec(ali.components());
592  for(int i=0, iEnd = ali.components().size();i < iEnd; ++i) {
593  std::string structurename = aliobjid.typeToName((alivec)[i]->alignableObjectId());
594  LogDebug("TrackerOfflineValidation") << "StructureName = " << structurename;
595  std::stringstream dirname;
596  dirname << structurename;
597  // add no suffix counter to Strip and Pixel, just aesthetics
598  if (structurename != "Strip" && structurename != "Pixel") dirname << "_" << i+1;
599 
600  if (structurename.find("Endcap",0) != std::string::npos ) {
601  DirectoryWrapper f(tfd,dirname.str(),moduleDirectory_,dqmMode_);
602  bookHists(f, *(alivec)[i], ali.alignableObjectId() , i, aliobjid);
603  bookDirHists( f, *(alivec)[i], aliobjid);
604  } else if( !(this->isDetOrDetUnit( (alivec)[i]->alignableObjectId()) )
605  || alivec[i]->components().size() > 1) {
606  DirectoryWrapper f(tfd,dirname.str(),moduleDirectory_,dqmMode_);
607  bookHists(tfd, *(alivec)[i], ali.alignableObjectId() , i, aliobjid);
608  bookDirHists( f, *(alivec)[i], aliobjid);
609  } else {
610  bookHists(tfd, *(alivec)[i], ali.alignableObjectId() , i, aliobjid);
611  }
612  }
613 }
614 
615 
616 void
618 {
619  TrackerAlignableId aliid;
620  const DetId id = ali.id();
621 
622  // comparing subdetandlayer to subdetIds gives a warning at compile time
623  // -> subdetandlayer could also be pair<uint,uint> but this has to be adapted
624  // in AlignableObjId
625  std::pair<int,int> subdetandlayer = aliid.typeAndLayerFromDetId(id);
626 
628 
629  // are we on or just above det, detunit level respectively?
630  if (type == align::AlignableDetUnit )subtype = type;
631  else if( this->isDetOrDetUnit(ali.alignableObjectId()) ) subtype = ali.alignableObjectId();
632 
633  // construct histogramm title and name
634  std::stringstream histoname, histotitle, normhistoname, normhistotitle,
635  yhistoname, yhistotitle,
636  xprimehistoname, xprimehistotitle, normxprimehistoname, normxprimehistotitle,
637  yprimehistoname, yprimehistotitle, normyprimehistoname, normyprimehistotitle,
638  localxname, localxtitle, localyname, localytitle,
639  resxvsxprofilename, resxvsxprofiletitle, resyvsxprofilename, resyvsxprofiletitle,
640  resxvsyprofilename, resxvsyprofiletitle, resyvsyprofilename, resyvsyprofiletitle;
641 
642  std::string wheel_or_layer;
643 
644  if( this->isEndCap(static_cast<uint32_t>(subdetandlayer.first)) ) wheel_or_layer = "_wheel_";
645  else if ( this->isBarrel(static_cast<uint32_t>(subdetandlayer.first)) ) wheel_or_layer = "_layer_";
646  else edm::LogWarning("TrackerOfflineValidation") << "@SUB=TrackerOfflineValidation::bookHists"
647  << "Unknown subdetid: " << subdetandlayer.first;
648 
649  histoname << "h_residuals_subdet_" << subdetandlayer.first
650  << wheel_or_layer << subdetandlayer.second << "_module_" << id.rawId();
651  yhistoname << "h_y_residuals_subdet_" << subdetandlayer.first
652  << wheel_or_layer << subdetandlayer.second << "_module_" << id.rawId();
653  xprimehistoname << "h_xprime_residuals_subdet_" << subdetandlayer.first
654  << wheel_or_layer << subdetandlayer.second << "_module_" << id.rawId();
655  yprimehistoname << "h_yprime_residuals_subdet_" << subdetandlayer.first
656  << wheel_or_layer << subdetandlayer.second << "_module_" << id.rawId();
657  normhistoname << "h_normresiduals_subdet_" << subdetandlayer.first
658  << wheel_or_layer << subdetandlayer.second << "_module_" << id.rawId();
659  normxprimehistoname << "h_normxprimeresiduals_subdet_" << subdetandlayer.first
660  << wheel_or_layer << subdetandlayer.second << "_module_" << id.rawId();
661  normyprimehistoname << "h_normyprimeresiduals_subdet_" << subdetandlayer.first
662  << wheel_or_layer << subdetandlayer.second << "_module_" << id.rawId();
663  histotitle << "X Residual for module " << id.rawId() << ";x_{tr} - x_{hit} [cm]";
664  yhistotitle << "Y Residual for module " << id.rawId() << ";y_{tr} - y_{hit} [cm]";
665  normhistotitle << "Normalized Residual for module " << id.rawId() << ";x_{tr} - x_{hit}/#sigma";
666  xprimehistotitle << "X' Residual for module " << id.rawId() << ";(x_{tr} - x_{hit})' [cm]";
667  normxprimehistotitle << "Normalized X' Residual for module " << id.rawId() << ";(x_{tr} - x_{hit})'/#sigma";
668  yprimehistotitle << "Y' Residual for module " << id.rawId() << ";(y_{tr} - y_{hit})' [cm]";
669  normyprimehistotitle << "Normalized Y' Residual for module " << id.rawId() << ";(y_{tr} - y_{hit})'/#sigma";
670 
671  if ( moduleLevelProfiles_ ) {
672  localxname << "h_localx_subdet_" << subdetandlayer.first
673  << wheel_or_layer << subdetandlayer.second << "_module_" << id.rawId();
674  localyname << "h_localy_subdet_" << subdetandlayer.first
675  << wheel_or_layer << subdetandlayer.second << "_module_" << id.rawId();
676  localxtitle << "u local for module " << id.rawId() << "; u_{tr,r}";
677  localytitle << "v local for module " << id.rawId() << "; v_{tr,r}";
678 
679  resxvsxprofilename << "p_residuals_x_vs_x_subdet_" << subdetandlayer.first
680  << wheel_or_layer << subdetandlayer.second << "_module_" << id.rawId();
681  resyvsxprofilename << "p_residuals_y_vs_x_subdet_" << subdetandlayer.first
682  << wheel_or_layer << subdetandlayer.second << "_module_" << id.rawId();
683  resxvsyprofilename << "p_residuals_x_vs_y_subdet_" << subdetandlayer.first
684  << wheel_or_layer << subdetandlayer.second << "_module_" << id.rawId();
685  resyvsyprofilename << "p_residuals_y_vs_y_subdet_" << subdetandlayer.first
686  << wheel_or_layer << subdetandlayer.second << "_module_" << id.rawId();
687  resxvsxprofiletitle << "U Residual vs u for module " << id.rawId() << "; u_{tr,r} ;(u_{tr} - u_{hit})/tan#alpha [cm]";
688  resyvsxprofiletitle << "V Residual vs u for module " << id.rawId() << "; u_{tr,r} ;(v_{tr} - v_{hit})/tan#beta [cm]";
689  resxvsyprofiletitle << "U Residual vs v for module " << id.rawId() << "; v_{tr,r} ;(u_{tr} - u_{hit})/tan#alpha [cm]";
690  resyvsyprofiletitle << "V Residual vs v for module " << id.rawId() << "; v_{tr,r} ;(v_{tr} - v_{hit})/tan#beta [cm]";
691  }
692 
693  if( this->isDetOrDetUnit( subtype ) ) {
694  ModuleHistos &histStruct = this->getHistStructFromMap(id);
695  int nbins = 0;
696  double xmin = 0., xmax = 0.;
697  double ymin = -0.1, ymax = 0.1;
698 
699  // do not allow transient hists in DQM mode
700  bool moduleLevelHistsTransient(moduleLevelHistsTransient_);
701  if (dqmMode_) moduleLevelHistsTransient = false;
702 
703  // decide via cfg if hists in local coordinates should be booked
704  if(lCoorHistOn_) {
705  this->getBinning(id.subdetId(), XResidual, nbins, xmin, xmax);
706  histStruct.ResHisto = this->bookTH1F(moduleLevelHistsTransient, tfd,
707  histoname.str().c_str(),histotitle.str().c_str(),
708  nbins, xmin, xmax);
709  this->getBinning(id.subdetId(), NormXResidual, nbins, xmin, xmax);
710  histStruct.NormResHisto = this->bookTH1F(moduleLevelHistsTransient, tfd,
711  normhistoname.str().c_str(),normhistotitle.str().c_str(),
712  nbins, xmin, xmax);
713  }
714  this->getBinning(id.subdetId(), XprimeResidual, nbins, xmin, xmax);
715  histStruct.ResXprimeHisto = this->bookTH1F(moduleLevelHistsTransient, tfd,
716  xprimehistoname.str().c_str(),xprimehistotitle.str().c_str(),
717  nbins, xmin, xmax);
718  this->getBinning(id.subdetId(), NormXprimeResidual, nbins, xmin, xmax);
719  histStruct.NormResXprimeHisto = this->bookTH1F(moduleLevelHistsTransient, tfd,
720  normxprimehistoname.str().c_str(),normxprimehistotitle.str().c_str(),
721  nbins, xmin, xmax);
722 
723  if ( moduleLevelProfiles_ ) {
724  this->getBinning(id.subdetId(), XResidualProfile, nbins, xmin, xmax);
725 
726  histStruct.LocalX = this->bookTH1F(moduleLevelHistsTransient, tfd,
727  localxname.str().c_str(),localxtitle.str().c_str(),
728  nbins, xmin, xmax);
729  histStruct.LocalY = this->bookTH1F(moduleLevelHistsTransient, tfd,
730  localyname.str().c_str(),localytitle.str().c_str(),
731  nbins, xmin, xmax);
732  histStruct.ResXvsXProfile = this->bookTProfile(moduleLevelHistsTransient, tfd,
733  resxvsxprofilename.str().c_str(),resxvsxprofiletitle.str().c_str(),
734  nbins, xmin, xmax, ymin, ymax);
735  histStruct.ResXvsYProfile = this->bookTProfile(moduleLevelHistsTransient, tfd,
736  resxvsyprofilename.str().c_str(),resxvsyprofiletitle.str().c_str(),
737  nbins, xmin, xmax, ymin, ymax);
738  }
739 
740  if( this->isPixel(subdetandlayer.first) || stripYResiduals_ ) {
741  this->getBinning(id.subdetId(), YprimeResidual, nbins, xmin, xmax);
742  histStruct.ResYprimeHisto = this->bookTH1F(moduleLevelHistsTransient, tfd,
743  yprimehistoname.str().c_str(),yprimehistotitle.str().c_str(),
744  nbins, xmin, xmax);
745  if (lCoorHistOn_) { // un-primed y-residual
746  this->getBinning(id.subdetId(), YResidual, nbins, xmin, xmax);
747  histStruct.ResYHisto = this->bookTH1F(moduleLevelHistsTransient, tfd,
748  yhistoname.str().c_str(), yhistotitle.str().c_str(),
749  nbins, xmin, xmax);
750  }
751  this->getBinning(id.subdetId(), NormYprimeResidual, nbins, xmin, xmax);
752  histStruct.NormResYprimeHisto = this->bookTH1F(moduleLevelHistsTransient, tfd,
753  normyprimehistoname.str().c_str(),normyprimehistotitle.str().c_str(),
754  nbins, xmin, xmax);
755  // Here we could add un-primed normalised y-residuals if(lCoorHistOn_)...
756  if ( moduleLevelProfiles_ ) {
757  this->getBinning(id.subdetId(), YResidualProfile, nbins, xmin, xmax);
758 
759  histStruct.ResYvsXProfile = this->bookTProfile(moduleLevelHistsTransient, tfd,
760  resyvsxprofilename.str().c_str(),resyvsxprofiletitle.str().c_str(),
761  nbins, xmin, xmax, ymin, ymax);
762  histStruct.ResYvsYProfile = this->bookTProfile(moduleLevelHistsTransient, tfd,
763  resyvsyprofilename.str().c_str(),resyvsyprofiletitle.str().c_str(),
764  nbins, xmin, xmax, ymin, ymax);
765  }
766  }
767  }
768 }
769 
770 
771 TH1* TrackerOfflineValidation::bookTH1F(bool isTransient, DirectoryWrapper& tfd, const char* histName, const char* histTitle,
772  int nBinsX, double lowX, double highX)
773 {
774  if (isTransient) {
775  vDeleteObjects_.push_back(new TH1F(histName, histTitle, nBinsX, lowX, highX));
776  return vDeleteObjects_.back(); // return last element of vector
777  }
778  else
779  return tfd.make<TH1F>(histName, histTitle, nBinsX, lowX, highX);
780 }
781 
782 TProfile* TrackerOfflineValidation::bookTProfile(bool isTransient, DirectoryWrapper& tfd, const char* histName, const char* histTitle,
783  int nBinsX, double lowX, double highX)
784 {
785  if (isTransient) {
786  TProfile * profile = new TProfile(histName, histTitle, nBinsX, lowX, highX);
787  vDeleteObjects_.push_back(profile);
788  return profile;
789  }
790  else
791  return (TProfile*)tfd.make<TProfile>(histName, histTitle, nBinsX, lowX, highX);
792 }
793 
794 
795 TProfile* TrackerOfflineValidation::bookTProfile(bool isTransient, DirectoryWrapper& tfd, const char* histName, const char* histTitle,
796  int nBinsX, double lowX, double highX, double lowY, double highY)
797 {
798  if (isTransient) {
799  TProfile * profile = new TProfile(histName, histTitle, nBinsX, lowX, highX, lowY, highY);
800  vDeleteObjects_.push_back(profile);
801  return profile;
802  }
803  else
804  return (TProfile*)tfd.make<TProfile>(histName, histTitle, nBinsX, lowX, highX, lowY, highY);
805 }
806 
807 bool TrackerOfflineValidation::isBarrel(uint32_t subDetId)
808 {
809  return (subDetId == StripSubdetector::TIB ||
810  subDetId == StripSubdetector::TOB ||
811  subDetId == PixelSubdetector::PixelBarrel );
812 }
813 
814 
815 bool TrackerOfflineValidation::isEndCap(uint32_t subDetId)
816 {
817  return ( subDetId == StripSubdetector::TID ||
818  subDetId == StripSubdetector::TEC ||
819  subDetId == PixelSubdetector::PixelEndcap );
820 }
821 
822 
823 bool TrackerOfflineValidation::isPixel(uint32_t subDetId)
824 {
825  return (subDetId == PixelSubdetector::PixelBarrel ||
826  subDetId == PixelSubdetector::PixelEndcap );
827 }
828 
829 
831 {
832  return ( type == align::AlignableDet ||
833  type == align::AlignableDetUnit );
834 }
835 
836 
837 void
840  int& nBinsX, double& lowerBoundX, double& upperBoundX)
841 {
842  // determine if
843  const bool isPixel = this->isPixel(subDetId);
844 
845  edm::ParameterSet binningPSet;
846 
847  switch(residualType)
848  {
849  case XResidual :
850  if(isPixel) binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1XResPixelModules");
851  else binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1XResStripModules");
852  break;
853  case NormXResidual :
854  if(isPixel) binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1NormXResPixelModules");
855  else binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1NormXResStripModules");
856  break;
857  case XprimeResidual :
858  if(isPixel) binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1XprimeResPixelModules");
859  else binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1XprimeResStripModules");
860  break;
861  case NormXprimeResidual :
862  if(isPixel) binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1NormXprimeResPixelModules");
863  else binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1NormXprimeResStripModules");
864  break;
865  case YResidual : // borrow y-residual binning from yprime
866  case YprimeResidual :
867  if(isPixel) binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1YResPixelModules");
868  else binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1YResStripModules");
869  break;
870  /* case NormYResidual :*/
871  case NormYprimeResidual :
872  if(isPixel) binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1NormYResPixelModules");
873  else binningPSet = parSet_.getParameter<edm::ParameterSet>("TH1NormYResStripModules");
874  break;
875  case XResidualProfile :
876  if(isPixel) binningPSet = parSet_.getParameter<edm::ParameterSet>("TProfileXResPixelModules");
877  else binningPSet = parSet_.getParameter<edm::ParameterSet>("TProfileXResStripModules");
878  break;
879  case YResidualProfile :
880  if(isPixel) binningPSet = parSet_.getParameter<edm::ParameterSet>("TProfileYResPixelModules");
881  else binningPSet = parSet_.getParameter<edm::ParameterSet>("TProfileYResStripModules");
882  break;
883  }
884  nBinsX = binningPSet.getParameter<int32_t>("Nbinx");
885  lowerBoundX = binningPSet.getParameter<double>("xmin");
886  upperBoundX = binningPSet.getParameter<double>("xmax");
887 }
888 
889 
890 void
891 TrackerOfflineValidation::setSummaryBin(int bin, TH1* targetHist, TH1* sourceHist)
892 {
893  if(targetHist && sourceHist) {
894  targetHist->SetBinContent(bin, sourceHist->GetMean(1));
895  if(useFwhm_) targetHist->SetBinError(bin, Fwhm(sourceHist)/2.);
896  else targetHist->SetBinError(bin, sourceHist->GetRMS(1) );
897  }
898  else return;
899 }
900 
901 
902 void
904  SummaryContainer& sourceContainer)
905 {
906  this->setSummaryBin(bin, targetContainer.summaryXResiduals_, sourceContainer.sumXResiduals_);
907  this->setSummaryBin(bin, targetContainer.summaryNormXResiduals_, sourceContainer.sumNormXResiduals_);
908  // If no y-residual hists, just returns:
909  this->setSummaryBin(bin, targetContainer.summaryYResiduals_, sourceContainer.sumYResiduals_);
910  this->setSummaryBin(bin, targetContainer.summaryNormYResiduals_, sourceContainer.sumNormYResiduals_);
911 }
912 
913 
914 void
916  SummaryContainer& targetContainer,
917  ModuleHistos& sourceContainer)
918 {
919  // takes two summary Containers and sets summaryBins for all histograms
920  this->setSummaryBin(bin, targetContainer.summaryXResiduals_, sourceContainer.ResXprimeHisto);
921  this->setSummaryBin(bin, targetContainer.summaryNormXResiduals_, sourceContainer.NormResXprimeHisto);
922  if( this->isPixel(subDetId) || stripYResiduals_ ) {
923  this->setSummaryBin(bin, targetContainer.summaryYResiduals_, sourceContainer.ResYprimeHisto);
924  this->setSummaryBin(bin, targetContainer.summaryNormYResiduals_, sourceContainer.NormResYprimeHisto);
925  }
926 }
927 
928 
931 {
932  // get a struct with histograms from the respective map
933  // if no object exist, the reference is automatically created by the map
934  // throw exception if non-tracker id is passed
935  uint subdetid = detid.subdetId();
936  if(subdetid == PixelSubdetector::PixelBarrel ) {
937  return mPxbResiduals_[detid.rawId()];
938  } else if (subdetid == PixelSubdetector::PixelEndcap) {
939  return mPxeResiduals_[detid.rawId()];
940  } else if(subdetid == StripSubdetector::TIB) {
941  return mTibResiduals_[detid.rawId()];
942  } else if(subdetid == StripSubdetector::TID) {
943  return mTidResiduals_[detid.rawId()];
944  } else if(subdetid == StripSubdetector::TOB) {
945  return mTobResiduals_[detid.rawId()];
946  } else if(subdetid == StripSubdetector::TEC) {
947  return mTecResiduals_[detid.rawId()];
948  } else {
949  throw cms::Exception("Geometry Error")
950  << "[TrackerOfflineValidation] Error, tried to get reference for non-tracker subdet " << subdetid
951  << " from detector " << detid.det();
952  return mPxbResiduals_[0];
953  }
954 }
955 
956 
957 // ------------ method called to for each event ------------
958 void
960 {
961  if (useOverflowForRMS_)TH1::StatOverflows(kTRUE);
962  this->checkBookHists(iSetup); // check whether hists are booked and do so if not yet done
963 
964  TrackerValidationVariables avalidator_(iSetup,parSet_);
965 
966  std::vector<TrackerValidationVariables::AVTrackStruct> vTrackstruct;
967  avalidator_.fillTrackQuantities(iEvent, vTrackstruct);
968 
969  for (std::vector<TrackerValidationVariables::AVTrackStruct>::const_iterator itT = vTrackstruct.begin();
970  itT != vTrackstruct.end();
971  ++itT) {
972 
973  // Fill 1D track histos
974  static const int etaindex = this->GetIndex(vTrackHistos_,"h_tracketa");
975  vTrackHistos_[etaindex]->Fill(itT->eta);
976  static const int phiindex = this->GetIndex(vTrackHistos_,"h_trackphi");
977  vTrackHistos_[phiindex]->Fill(itT->phi);
978  static const int numOfValidHitsindex = this->GetIndex(vTrackHistos_,"h_trackNumberOfValidHits");
979  vTrackHistos_[numOfValidHitsindex]->Fill(itT->numberOfValidHits);
980  static const int numOfLostHitsindex = this->GetIndex(vTrackHistos_,"h_trackNumberOfLostHits");
981  vTrackHistos_[numOfLostHitsindex]->Fill(itT->numberOfLostHits);
982  static const int kappaindex = this->GetIndex(vTrackHistos_,"h_curvature");
983  vTrackHistos_[kappaindex]->Fill(itT->kappa);
984  static const int kappaposindex = this->GetIndex(vTrackHistos_,"h_curvature_pos");
985  if (itT->charge > 0)
986  vTrackHistos_[kappaposindex]->Fill(fabs(itT->kappa));
987  static const int kappanegindex = this->GetIndex(vTrackHistos_,"h_curvature_neg");
988  if (itT->charge < 0)
989  vTrackHistos_[kappanegindex]->Fill(fabs(itT->kappa));
990  static const int normchi2index = this->GetIndex(vTrackHistos_,"h_normchi2");
991  vTrackHistos_[normchi2index]->Fill(itT->normchi2);
992  static const int chi2index = this->GetIndex(vTrackHistos_,"h_chi2");
993  vTrackHistos_[chi2index]->Fill(itT->chi2);
994  static const int chi2Probindex = this->GetIndex(vTrackHistos_,"h_chi2Prob");
995  vTrackHistos_[chi2Probindex]->Fill(itT->chi2Prob);
996  static const int ptindex = this->GetIndex(vTrackHistos_,"h_pt");
997  vTrackHistos_[ptindex]->Fill(itT->pt);
998  if (itT->ptError != 0.) {
999  static const int ptResolutionindex = this->GetIndex(vTrackHistos_,"h_ptResolution");
1000  vTrackHistos_[ptResolutionindex]->Fill(itT->ptError/itT->pt);
1001  }
1002  // Fill track profiles
1003  static const int d0phiindex = this->GetIndex(vTrackProfiles_,"p_d0_vs_phi");
1004  vTrackProfiles_[d0phiindex]->Fill(itT->phi,itT->d0);
1005  static const int dzphiindex = this->GetIndex(vTrackProfiles_,"p_dz_vs_phi");
1006  vTrackProfiles_[dzphiindex]->Fill(itT->phi,itT->dz);
1007  static const int d0etaindex = this->GetIndex(vTrackProfiles_,"p_d0_vs_eta");
1008  vTrackProfiles_[d0etaindex]->Fill(itT->eta,itT->d0);
1009  static const int dzetaindex = this->GetIndex(vTrackProfiles_,"p_dz_vs_eta");
1010  vTrackProfiles_[dzetaindex]->Fill(itT->eta,itT->dz);
1011  static const int chiphiindex = this->GetIndex(vTrackProfiles_,"p_chi2_vs_phi");
1012  vTrackProfiles_[chiphiindex]->Fill(itT->phi,itT->chi2);
1013  static const int chiProbphiindex = this->GetIndex(vTrackProfiles_,"p_chi2Prob_vs_phi");
1014  vTrackProfiles_[chiProbphiindex]->Fill(itT->phi,itT->chi2Prob);
1015  static const int normchiphiindex = this->GetIndex(vTrackProfiles_,"p_normchi2_vs_phi");
1016  vTrackProfiles_[normchiphiindex]->Fill(itT->phi,itT->normchi2);
1017  static const int chietaindex = this->GetIndex(vTrackProfiles_,"p_chi2_vs_eta");
1018  vTrackProfiles_[chietaindex]->Fill(itT->eta,itT->chi2);
1019  static const int normchiptindex = this->GetIndex(vTrackProfiles_,"p_normchi2_vs_pt");
1020  vTrackProfiles_[normchiptindex]->Fill(itT->pt,itT->normchi2);
1021  static const int normchipindex = this->GetIndex(vTrackProfiles_,"p_normchi2_vs_p");
1022  vTrackProfiles_[normchipindex]->Fill(itT->p,itT->normchi2);
1023  static const int chiProbetaindex = this->GetIndex(vTrackProfiles_,"p_chi2Prob_vs_eta");
1024  vTrackProfiles_[chiProbetaindex]->Fill(itT->eta,itT->chi2Prob);
1025  static const int normchietaindex = this->GetIndex(vTrackProfiles_,"p_normchi2_vs_eta");
1026  vTrackProfiles_[normchietaindex]->Fill(itT->eta,itT->normchi2);
1027  static const int kappaphiindex = this->GetIndex(vTrackProfiles_,"p_kappa_vs_phi");
1028  vTrackProfiles_[kappaphiindex]->Fill(itT->phi,itT->kappa);
1029  static const int kappaetaindex = this->GetIndex(vTrackProfiles_,"p_kappa_vs_eta");
1030  vTrackProfiles_[kappaetaindex]->Fill(itT->eta,itT->kappa);
1031  static const int ptResphiindex = this->GetIndex(vTrackProfiles_,"p_ptResolution_vs_phi");
1032  vTrackProfiles_[ptResphiindex]->Fill(itT->phi,itT->ptError/itT->pt);
1033  static const int ptResetaindex = this->GetIndex(vTrackProfiles_,"p_ptResolution_vs_eta");
1034  vTrackProfiles_[ptResetaindex]->Fill(itT->eta,itT->ptError/itT->pt);
1035 
1036  // Fill 2D track histos
1037  static const int d0phiindex_2d = this->GetIndex(vTrack2DHistos_,"h2_d0_vs_phi");
1038  vTrack2DHistos_[d0phiindex_2d]->Fill(itT->phi,itT->d0);
1039  static const int dzphiindex_2d = this->GetIndex(vTrack2DHistos_,"h2_dz_vs_phi");
1040  vTrack2DHistos_[dzphiindex_2d]->Fill(itT->phi,itT->dz);
1041  static const int d0etaindex_2d = this->GetIndex(vTrack2DHistos_,"h2_d0_vs_eta");
1042  vTrack2DHistos_[d0etaindex_2d]->Fill(itT->eta,itT->d0);
1043  static const int dzetaindex_2d = this->GetIndex(vTrack2DHistos_,"h2_dz_vs_eta");
1044  vTrack2DHistos_[dzetaindex_2d]->Fill(itT->eta,itT->dz);
1045  static const int chiphiindex_2d = this->GetIndex(vTrack2DHistos_,"h2_chi2_vs_phi");
1046  vTrack2DHistos_[chiphiindex_2d]->Fill(itT->phi,itT->chi2);
1047  static const int chiProbphiindex_2d = this->GetIndex(vTrack2DHistos_,"h2_chi2Prob_vs_phi");
1048  vTrack2DHistos_[chiProbphiindex_2d]->Fill(itT->phi,itT->chi2Prob);
1049  static const int normchiphiindex_2d = this->GetIndex(vTrack2DHistos_,"h2_normchi2_vs_phi");
1050  vTrack2DHistos_[normchiphiindex_2d]->Fill(itT->phi,itT->normchi2);
1051  static const int chietaindex_2d = this->GetIndex(vTrack2DHistos_,"h2_chi2_vs_eta");
1052  vTrack2DHistos_[chietaindex_2d]->Fill(itT->eta,itT->chi2);
1053  static const int chiProbetaindex_2d = this->GetIndex(vTrack2DHistos_,"h2_chi2Prob_vs_eta");
1054  vTrack2DHistos_[chiProbetaindex_2d]->Fill(itT->eta,itT->chi2Prob);
1055  static const int normchietaindex_2d = this->GetIndex(vTrack2DHistos_,"h2_normchi2_vs_eta");
1056  vTrack2DHistos_[normchietaindex_2d]->Fill(itT->eta,itT->normchi2);
1057  static const int kappaphiindex_2d = this->GetIndex(vTrack2DHistos_,"h2_kappa_vs_phi");
1058  vTrack2DHistos_[kappaphiindex_2d]->Fill(itT->phi,itT->kappa);
1059  static const int kappaetaindex_2d = this->GetIndex(vTrack2DHistos_,"h2_kappa_vs_eta");
1060  vTrack2DHistos_[kappaetaindex_2d]->Fill(itT->eta,itT->kappa);
1061  static const int normchi2kappa_2d = this->GetIndex(vTrack2DHistos_,"h2_normchi2_vs_kappa");
1062  vTrack2DHistos_[normchi2kappa_2d]->Fill(itT->normchi2,itT->kappa);
1063 
1064  // hit quantities: residuals, normalized residuals
1065  for (std::vector<TrackerValidationVariables::AVHitStruct>::const_iterator itH = itT->hits.begin();
1066  itH != itT->hits.end();
1067  ++itH) {
1068 
1069  DetId detid(itH->rawDetId);
1070  ModuleHistos &histStruct = this->getHistStructFromMap(detid);
1071 
1072  // fill histos in local coordinates if set in cf
1073  if (lCoorHistOn_) {
1074  histStruct.ResHisto->Fill(itH->resX);
1075  if(itH->resErrX != 0) histStruct.NormResHisto->Fill(itH->resX/itH->resErrX);
1076  if (this->isPixel(detid.subdetId()) || stripYResiduals_ ) {
1077  histStruct.ResYHisto->Fill(itH->resY);
1078  // here add un-primed normalised y-residuals if wanted
1079  }
1080  }
1081  if (itH->resXprime != -999.) {
1082  histStruct.ResXprimeHisto->Fill(itH->resXprime);
1083 
1084  /******************************* Fill 2-D histo ResX vs momenta *****************************/
1085  if (detid.subdetId() == PixelSubdetector::PixelBarrel) {
1086  static const int resXvsPindex_2d = this->GetIndex(vTrack2DHistos_,"p_vs_resXprime_pixB");
1087  vTrack2DHistos_[resXvsPindex_2d]->Fill(itT->p,itH->resXprime);
1088  }
1089  if (detid.subdetId() == PixelSubdetector::PixelEndcap) {
1090  static const int resXvsPindex_2d = this->GetIndex(vTrack2DHistos_,"p_vs_resXprime_pixE");
1091  vTrack2DHistos_[resXvsPindex_2d]->Fill(itT->p,itH->resXprime);
1092  }
1093  if (detid.subdetId() == StripSubdetector::TIB) {
1094  static const int resXvsPindex_2d = this->GetIndex(vTrack2DHistos_,"p_vs_resXprime_TIB");
1095  vTrack2DHistos_[resXvsPindex_2d]->Fill(itT->p,itH->resXprime);
1096  }
1097  if (detid.subdetId() == StripSubdetector::TID) {
1098  static const int resXvsPindex_2d = this->GetIndex(vTrack2DHistos_,"p_vs_resXprime_TID");
1099  vTrack2DHistos_[resXvsPindex_2d]->Fill(itT->p,itH->resXprime);
1100  }
1101  if (detid.subdetId() == StripSubdetector::TOB) {
1102  static const int resXvsPindex_2d = this->GetIndex(vTrack2DHistos_,"p_vs_resXprime_TOB");
1103  vTrack2DHistos_[resXvsPindex_2d]->Fill(itT->p,itH->resXprime);
1104  }
1105  if (detid.subdetId() == StripSubdetector::TEC) {
1106  static const int resXvsPindex_2d = this->GetIndex(vTrack2DHistos_,"p_vs_resXprime_TEC");
1107  vTrack2DHistos_[resXvsPindex_2d]->Fill(itT->p,itH->resXprime);
1108  }
1109  /******************************************/
1110 
1111  if ( moduleLevelProfiles_ && itH->inside ) {
1112  float tgalpha = tan(itH->localAlpha);
1113  if ( fabs(tgalpha)!=0 ){
1114  histStruct.LocalX->Fill(itH->localXnorm, tgalpha*tgalpha);
1115  histStruct.LocalY->Fill(itH->localYnorm, tgalpha*tgalpha);
1116  histStruct.ResXvsXProfile->Fill(itH->localXnorm, itH->resX/tgalpha, tgalpha*tgalpha);
1117  histStruct.ResXvsYProfile->Fill(itH->localYnorm, itH->resX/tgalpha, tgalpha*tgalpha);
1118  }
1119  }
1120 
1121  if(itH->resXprimeErr != 0 && itH->resXprimeErr != -999 ) {
1122  histStruct.NormResXprimeHisto->Fill(itH->resXprime/itH->resXprimeErr);
1123  }
1124  }
1125 
1126  if (itH->resYprime != -999.) {
1127  if (this->isPixel(detid.subdetId()) || stripYResiduals_ ) {
1128  histStruct.ResYprimeHisto->Fill(itH->resYprime);
1129 
1130  /******************************* Fill 2-D histo ResY vs momenta *****************************/
1131  if (detid.subdetId() == PixelSubdetector::PixelBarrel) {
1132  static const int resYvsPindex_2d = this->GetIndex(vTrack2DHistos_,"p_vs_resYprime_pixB");
1133  vTrack2DHistos_[resYvsPindex_2d]->Fill(itT->p,itH->resYprime);
1134  }
1135  if (detid.subdetId() == PixelSubdetector::PixelEndcap) {
1136  static const int resYvsPindex_2d = this->GetIndex(vTrack2DHistos_,"p_vs_resYprime_pixE");
1137  vTrack2DHistos_[resYvsPindex_2d]->Fill(itT->p,itH->resYprime);
1138  }
1139  /******************************************/
1140 
1141  if ( moduleLevelProfiles_ && itH->inside ) {
1142  float tgbeta = tan(itH->localBeta);
1143  if ( fabs(tgbeta)!=0 ){
1144  histStruct.ResYvsXProfile->Fill(itH->localXnorm, itH->resY/tgbeta, tgbeta*tgbeta);
1145  histStruct.ResYvsYProfile->Fill(itH->localYnorm, itH->resY/tgbeta, tgbeta*tgbeta);
1146  }
1147  }
1148 
1149  if (itH->resYprimeErr != 0 && itH->resYprimeErr != -999. ) {
1150  histStruct.NormResYprimeHisto->Fill(itH->resYprime/itH->resYprimeErr);
1151  }
1152  }
1153  }
1154 
1155  if (overlappOn_) {
1156  std::pair<uint32_t,uint32_t> tmp_pair(std::make_pair(itH->rawDetId, itH->overlapres.first));
1157  if (itH->overlapres.first != 0) {
1158  if (hOverlappResidual[tmp_pair]) {
1159  hOverlappResidual[tmp_pair]->Fill(itH->overlapres.second);
1160  } else if (hOverlappResidual[std::make_pair(itH->overlapres.first, itH->rawDetId)]) {
1161  hOverlappResidual[std::make_pair( itH->overlapres.first, itH->rawDetId)]->Fill(itH->overlapres.second);
1162  } else {
1163  std::string dirname("OverlappResiduals");
1164  DirectoryWrapper tfd(dirname.c_str(),moduleDirectory_,dqmMode_);
1165  hOverlappResidual[tmp_pair] = tfd.make<TH1F>(Form("hOverlappResidual_%d_%d",tmp_pair.first,tmp_pair.second),
1166  "Overlapp Residuals",100,-50,50);
1167  hOverlappResidual[tmp_pair]->Fill(itH->overlapres.second);
1168  }
1169  }
1170  }
1171 
1172  } // finish loop over hit quantities
1173  } // finish loop over track quantities
1174 
1175  if (useOverflowForRMS_) TH1::StatOverflows(kFALSE);
1176 }
1177 
1178 
1179 // ------------ method called once each job just after ending the event loop ------------
1180 void
1182 {
1183 
1184  if (!tkGeom_.product()) return;
1185 
1186  AlignableTracker aliTracker(&(*tkGeom_));
1187 
1188  AlignableObjectId aliobjid;
1189 
1190  static const int kappadiffindex = this->GetIndex(vTrackHistos_,"h_diff_curvature");
1191  vTrackHistos_[kappadiffindex]->Add(vTrackHistos_[this->GetIndex(vTrackHistos_,"h_curvature_neg")],
1192  vTrackHistos_[this->GetIndex(vTrackHistos_,"h_curvature_pos")],-1,1);
1193 
1194  // Collate Information for Subdetectors
1195  // create summary histogramms recursively
1196  std::vector<TrackerOfflineValidation::SummaryContainer> vTrackerprofiles;
1198  this->collateSummaryHists(f,(aliTracker), 0, aliobjid, vTrackerprofiles);
1199 
1200  if (dqmMode_) return;
1201  // Should be excluded in dqmMode, since TTree is not usable
1202  // In dqmMode tree operations are are sourced out to the additional module TrackerOfflineValidationSummary
1203 
1205  TTree *tree = fs->make<TTree>("TkOffVal","TkOffVal");
1206 
1207  TkOffTreeVariables *treeMemPtr = new TkOffTreeVariables;
1208  // We create branches for all members of 'TkOffTreeVariables' (even if not needed).
1209  // This works because we have a dictionary for 'TkOffTreeVariables'
1210  // (see src/classes_def.xml and src/classes.h):
1211  tree->Branch("TkOffTreeVariables", &treeMemPtr); // address of pointer!
1212 
1213  this->fillTree(*tree, mPxbResiduals_, *treeMemPtr, *tkGeom_);
1214  this->fillTree(*tree, mPxeResiduals_, *treeMemPtr, *tkGeom_);
1215  this->fillTree(*tree, mTibResiduals_, *treeMemPtr, *tkGeom_);
1216  this->fillTree(*tree, mTidResiduals_, *treeMemPtr, *tkGeom_);
1217  this->fillTree(*tree, mTobResiduals_, *treeMemPtr, *tkGeom_);
1218  this->fillTree(*tree, mTecResiduals_, *treeMemPtr, *tkGeom_);
1219 
1220  delete treeMemPtr; treeMemPtr = 0;
1221 }
1222 
1223 
1224 void
1226  const AlignableObjectId& aliobjid,
1227  std::vector<TrackerOfflineValidation::SummaryContainer>& vLevelProfiles)
1228 {
1229  std::vector<Alignable*> alivec(ali.components());
1230  if( this->isDetOrDetUnit((alivec)[0]->alignableObjectId()) ) return;
1231 
1232  for(int iComp=0, iCompEnd = ali.components().size();iComp < iCompEnd; ++iComp) {
1233  std::vector< TrackerOfflineValidation::SummaryContainer > vProfiles;
1234  std::string structurename = aliobjid.typeToName((alivec)[iComp]->alignableObjectId());
1235 
1236  LogDebug("TrackerOfflineValidation") << "StructureName = " << structurename;
1237  std::stringstream dirname;
1238  dirname << structurename;
1239 
1240  // add no suffix counter to strip and pixel -> just aesthetics
1241  if (structurename != "Strip" && structurename != "Pixel") dirname << "_" << iComp+1;
1242 
1243  if( !(this->isDetOrDetUnit( (alivec)[iComp]->alignableObjectId()) )
1244  || (alivec)[0]->components().size() > 1 ) {
1245  DirectoryWrapper f(tfd,dirname.str(),moduleDirectory_,dqmMode_);
1246  this->collateSummaryHists( f, *(alivec)[iComp], i, aliobjid, vProfiles);
1247  vLevelProfiles.push_back(this->bookSummaryHists(tfd, *(alivec[iComp]), ali.alignableObjectId(), iComp+1, aliobjid));
1248  TH1 *hY = vLevelProfiles[iComp].sumYResiduals_;
1249  TH1 *hNormY = vLevelProfiles[iComp].sumNormYResiduals_;
1250  for(uint n = 0; n < vProfiles.size(); ++n) {
1251  this->summarizeBinInContainer(n+1, vLevelProfiles[iComp], vProfiles[n] );
1252  vLevelProfiles[iComp].sumXResiduals_->Add(vProfiles[n].sumXResiduals_);
1253  vLevelProfiles[iComp].sumNormXResiduals_->Add(vProfiles[n].sumNormXResiduals_);
1254  if (hY) hY->Add(vProfiles[n].sumYResiduals_); // only if existing
1255  if (hNormY) hNormY->Add(vProfiles[n].sumNormYResiduals_); // dito (pxl, stripYResiduals_)
1256  }
1257  if(dqmMode_)continue; // No fits in dqmMode
1258  //add fit values to stat box
1259  this->fitResiduals(vLevelProfiles[iComp].sumXResiduals_);
1260  this->fitResiduals(vLevelProfiles[iComp].sumNormXResiduals_);
1261  if (hY) this->fitResiduals(hY); // only if existing (pixel or stripYResiduals_)
1262  if (hNormY) this->fitResiduals(hNormY); // dito
1263  } else {
1264  // nothing to be done for det or detunits
1265  continue;
1266  }
1267  }
1268 }
1269 
1270 
1273  align::StructureType type, int i,
1274  const AlignableObjectId& aliobjid)
1275 {
1276  const uint aliSize = ali.components().size();
1277  const align::StructureType alitype = ali.alignableObjectId();
1278  const align::StructureType subtype = ali.components()[0]->alignableObjectId();
1279  const char *aliTypeName = aliobjid.typeToName(alitype).c_str(); // lifetime of char* OK
1280  const char *aliSubtypeName = aliobjid.typeToName(subtype).c_str();
1281  const char *typeName = aliobjid.typeToName(type).c_str();
1282 
1283  const DetId aliDetId = ali.id();
1284  // y residuals only if pixel or specially requested for strip:
1285  const bool bookResidY = this->isPixel(aliDetId.subdetId()) || stripYResiduals_;
1286 
1287  SummaryContainer sumContainer;
1288 
1289  // Book summary hists with one bin per component,
1290  // but special case for Det with two DetUnit that we want to summarize one level up
1291  // (e.g. in TOBRods with 12 bins for 6 stereo and 6 rphi DetUnit.)
1292  // component of ali is not Det or Det with just one components
1293  const uint subcompSize = ali.components()[0]->components().size();
1294  if (subtype != align::AlignableDet || subcompSize == 1) { // Det with 1 comp. should not exist anymore...
1295  const TString title(Form("Summary for substructures in %s %d;%s;",aliTypeName,i,aliSubtypeName));
1296 
1297  sumContainer.summaryXResiduals_ = tfd.make<TH1F>(Form("h_summaryX%s_%d",aliTypeName,i),
1298  title + "#LT #Delta x' #GT",
1299  aliSize, 0.5, aliSize+0.5);
1300  sumContainer.summaryNormXResiduals_ = tfd.make<TH1F>(Form("h_summaryNormX%s_%d",aliTypeName,i),
1301  title + "#LT #Delta x'/#sigma #GT",
1302  aliSize,0.5,aliSize+0.5);
1303 
1304  if (bookResidY) {
1305  sumContainer.summaryYResiduals_ = tfd.make<TH1F>(Form("h_summaryY%s_%d",aliTypeName,i),
1306  title + "#LT #Delta y' #GT",
1307  aliSize, 0.5, aliSize+0.5);
1308  sumContainer.summaryNormYResiduals_ = tfd.make<TH1F>(Form("h_summaryNormY%s_%d",aliTypeName,i),
1309  title + "#LT #Delta y'/#sigma #GT",
1310  aliSize,0.5,aliSize+0.5);
1311  }
1312 
1313  } else if (subtype == align::AlignableDet && subcompSize > 1) { // fixed: was aliSize before
1314  if (subcompSize != 2) { // strange... expect only 2 DetUnits in DS layers
1315  // this 2 is hardcoded factor 2 in binning below and also assumed later on
1316  edm::LogError("Alignment") << "@SUB=bookSummaryHists"
1317  << "Det with " << subcompSize << " components";
1318  }
1319  // title contains x-title
1320  const TString title(Form("Summary for substructures in %s %d;%s;", aliTypeName, i,
1321  aliobjid.typeToName(ali.components()[0]->components()[0]->alignableObjectId()).c_str()));
1322 
1323  sumContainer.summaryXResiduals_
1324  = tfd.make<TH1F>(Form("h_summaryX%s_%d", aliTypeName, i),
1325  title + "#LT #Delta x' #GT", (2*aliSize), 0.5, 2*aliSize+0.5);
1326  sumContainer.summaryNormXResiduals_
1327  = tfd.make<TH1F>(Form("h_summaryNormX%s_%d", aliTypeName, i),
1328  title + "#LT #Delta x'/#sigma #GT", (2*aliSize), 0.5, 2*aliSize+0.5);
1329 
1330  if (bookResidY) {
1331  sumContainer.summaryYResiduals_
1332  = tfd.make<TH1F>(Form("h_summaryY%s_%d", aliTypeName, i),
1333  title + "#LT #Delta y' #GT", (2*aliSize), 0.5, 2*aliSize+0.5);
1334  sumContainer.summaryNormYResiduals_
1335  = tfd.make<TH1F>(Form("h_summaryNormY%s_%d", aliTypeName, i),
1336  title + "#LT #Delta y'/#sigma #GT", (2*aliSize), 0.5, 2*aliSize+0.5);
1337  }
1338 
1339  } else {
1340  edm::LogError("TrackerOfflineValidation") << "@SUB=TrackerOfflineValidation::bookSummaryHists"
1341  << "No summary histogramm for hierarchy level "
1342  << aliTypeName << " in subdet " << aliDetId.subdetId();
1343  }
1344 
1345  // Now book hists that just sum up the residual histograms from lower levels.
1346  // Axis title is copied from lowest level module of structure.
1347  // Should be safe that y-hists are only touched if non-null pointers...
1348  int nbins = 0;
1349  double xmin = 0., xmax = 0.;
1350  const TString sumTitle(Form("Residual for %s %d in %s;", aliTypeName, i, typeName));
1351  const ModuleHistos &xTitHists = this->getHistStructFromMap(aliDetId); // for x-axis titles
1352  this->getBinning(aliDetId.subdetId(), XprimeResidual, nbins, xmin, xmax);
1353 
1354  sumContainer.sumXResiduals_ = tfd.make<TH1F>(Form("h_Xprime_%s_%d", aliTypeName, i),
1355  sumTitle + xTitHists.ResXprimeHisto->GetXaxis()->GetTitle(),
1356  nbins, xmin, xmax);
1357 
1358  this->getBinning(aliDetId.subdetId(), NormXprimeResidual, nbins, xmin, xmax);
1359  sumContainer.sumNormXResiduals_ = tfd.make<TH1F>(Form("h_NormXprime_%s_%d",aliTypeName,i),
1360  sumTitle + xTitHists.NormResXprimeHisto->GetXaxis()->GetTitle(),
1361  nbins, xmin, xmax);
1362  if (bookResidY) {
1363  this->getBinning(aliDetId.subdetId(), YprimeResidual, nbins, xmin, xmax);
1364  sumContainer.sumYResiduals_ = tfd.make<TH1F>(Form("h_Yprime_%s_%d",aliTypeName,i),
1365  sumTitle + xTitHists.ResYprimeHisto->GetXaxis()->GetTitle(),
1366  nbins, xmin, xmax);
1367 
1368  this->getBinning(aliDetId.subdetId(), NormYprimeResidual, nbins, xmin, xmax);
1369  sumContainer.sumNormYResiduals_ = tfd.make<TH1F>(Form("h_NormYprime_%s_%d",aliTypeName,i),
1370  sumTitle + xTitHists.NormResYprimeHisto->GetXaxis()->GetTitle(),
1371  nbins, xmin, xmax);
1372  }
1373 
1374  // If we are at the lowest level, we already sum up and fill the summary.
1375 
1376  // special case I: For DetUnits and Dets with only one subcomponent start filling summary histos
1377  if( ( subtype == align::AlignableDet && subcompSize == 1) || subtype == align::AlignableDetUnit ) {
1378  for(uint k = 0; k < aliSize; ++k) {
1379  DetId detid = ali.components()[k]->id();
1380  ModuleHistos &histStruct = this->getHistStructFromMap(detid);
1381  this->summarizeBinInContainer(k+1, detid.subdetId() ,sumContainer, histStruct );
1382  sumContainer.sumXResiduals_->Add(histStruct.ResXprimeHisto);
1383  sumContainer.sumNormXResiduals_->Add(histStruct.NormResXprimeHisto);
1384  if( this->isPixel(detid.subdetId()) || stripYResiduals_ ) {
1385  sumContainer.sumYResiduals_->Add(histStruct.ResYprimeHisto);
1386  sumContainer.sumNormYResiduals_->Add(histStruct.NormResYprimeHisto);
1387  }
1388  }
1389  } else if( subtype == align::AlignableDet && subcompSize > 1) { // fixed: was aliSize before
1390  // special case II: Fill summary histos for dets with two detunits
1391  for(uint k = 0; k < aliSize; ++k) {
1392  for(uint j = 0; j < subcompSize; ++j) { // assumes all have same size (as binning does)
1393  DetId detid = ali.components()[k]->components()[j]->id();
1394  ModuleHistos &histStruct = this->getHistStructFromMap(detid);
1395  this->summarizeBinInContainer(2*k+j+1, detid.subdetId() ,sumContainer, histStruct );
1396  sumContainer.sumXResiduals_->Add( histStruct.ResXprimeHisto);
1397  sumContainer.sumNormXResiduals_->Add( histStruct.NormResXprimeHisto);
1398  if( this->isPixel(detid.subdetId()) || stripYResiduals_ ) {
1399  sumContainer.sumYResiduals_->Add( histStruct.ResYprimeHisto);
1400  sumContainer.sumNormYResiduals_->Add( histStruct.NormResYprimeHisto);
1401  }
1402  }
1403  }
1404  }
1405  return sumContainer;
1406 }
1407 
1408 
1409 float
1411 {
1412  float max = hist->GetMaximum();
1413  int left = -1, right = -1;
1414  for(unsigned int i = 1, iEnd = hist->GetNbinsX(); i <= iEnd; ++i) {
1415  if(hist->GetBinContent(i) < max/2. && hist->GetBinContent(i+1) > max/2. && left == -1) {
1416  if(max/2. - hist->GetBinContent(i) < hist->GetBinContent(i+1) - max/2.) {
1417  left = i;
1418  ++i;
1419  } else {
1420  left = i+1;
1421  ++i;
1422  }
1423  }
1424  if(left != -1 && right == -1) {
1425  if(hist->GetBinContent(i) > max/2. && hist->GetBinContent(i+1) < max/2.) {
1426  if( hist->GetBinContent(i) - max/2. < max/2. - hist->GetBinContent(i+1)) {
1427  right = i;
1428  } else {
1429  right = i+1;
1430  }
1431 
1432  }
1433  }
1434  }
1435  return hist->GetXaxis()->GetBinCenter(right) - hist->GetXaxis()->GetBinCenter(left);
1436 }
1437 
1438 
1439 void
1441  const std::map<int, TrackerOfflineValidation::ModuleHistos>& moduleHist_,
1442  TkOffTreeVariables &treeMem, const TrackerGeometry& tkgeom)
1443 {
1444 
1445  for(std::map<int, TrackerOfflineValidation::ModuleHistos>::const_iterator it = moduleHist_.begin(),
1446  itEnd= moduleHist_.end(); it != itEnd;++it ) {
1447  treeMem.clear(); // make empty/default
1448 
1449  //variables concerning the tracker components/hierarchy levels
1450  DetId detId_ = it->first;
1451  treeMem.moduleId = detId_;
1452  treeMem.subDetId = detId_.subdetId();
1453  treeMem.isDoubleSide =0;
1454 
1455  if(treeMem.subDetId == PixelSubdetector::PixelBarrel){
1456  PXBDetId pxbId(detId_);
1457  unsigned int whichHalfBarrel(1), rawId(detId_.rawId()); //DetId does not know about halfBarrels is PXB ...
1458  if( (rawId>=302056964 && rawId<302059300) || (rawId>=302123268 && rawId<302127140) || (rawId>=302189572 && rawId<302194980) )whichHalfBarrel=2;
1459  treeMem.layer = pxbId.layer();
1460  treeMem.half = whichHalfBarrel;
1461  treeMem.rod = pxbId.ladder(); // ... so, ladder is not per halfBarrel-Layer, but per barrel-layer!
1462  treeMem.module = pxbId.module();
1463  } else if(treeMem.subDetId == PixelSubdetector::PixelEndcap){
1464  PXFDetId pxfId(detId_);
1465  unsigned int whichHalfCylinder(1), rawId(detId_.rawId()); //DetId does not kmow about halfCylinders in PXF
1466  if( (rawId>=352394500 && rawId<352406032) || (rawId>=352460036 && rawId<352471568) || (rawId>=344005892 && rawId<344017424) || (rawId>=344071428 && rawId<344082960) )whichHalfCylinder=2;
1467  treeMem.layer = pxfId.disk();
1468  treeMem.side = pxfId.side();
1469  treeMem.half = whichHalfCylinder;
1470  treeMem.blade = pxfId.blade();
1471  treeMem.panel = pxfId.panel();
1472  treeMem.module = pxfId.module();
1473  } else if(treeMem.subDetId == StripSubdetector::TIB){
1474  TIBDetId tibId(detId_);
1475  unsigned int whichHalfShell(1), rawId(detId_.rawId()); //DetId does not kmow about halfShells in TIB
1476  if ( (rawId>=369120484 && rawId<369120688) || (rawId>=369121540 && rawId<369121776) || (rawId>=369136932 && rawId<369137200) || (rawId>=369137988 && rawId<369138288) ||
1477  (rawId>=369153396 && rawId<369153744) || (rawId>=369154436 && rawId<369154800) || (rawId>=369169844 && rawId<369170256) || (rawId>=369170900 && rawId<369171344) ||
1478  (rawId>=369124580 && rawId<369124784) || (rawId>=369125636 && rawId<369125872) || (rawId>=369141028 && rawId<369141296) || (rawId>=369142084 && rawId<369142384) ||
1479  (rawId>=369157492 && rawId<369157840) || (rawId>=369158532 && rawId<369158896) || (rawId>=369173940 && rawId<369174352) || (rawId>=369174996 && rawId<369175440) ) whichHalfShell=2;
1480  treeMem.layer = tibId.layer();
1481  treeMem.side = tibId.string()[0];
1482  treeMem.half = whichHalfShell;
1483  treeMem.rod = tibId.string()[2];
1484  treeMem.outerInner = tibId.string()[1];
1485  treeMem.module = tibId.module();
1486  treeMem.isStereo = tibId.stereo();
1487  treeMem.isDoubleSide = tibId.isDoubleSide();
1488  } else if(treeMem.subDetId == StripSubdetector::TID){
1489  TIDDetId tidId(detId_);
1490  treeMem.layer = tidId.wheel();
1491  treeMem.side = tidId.side();
1492  treeMem.ring = tidId.ring();
1493  treeMem.outerInner = tidId.module()[0];
1494  treeMem.module = tidId.module()[1];
1495  treeMem.isStereo = tidId.stereo();
1496  treeMem.isDoubleSide = tidId.isDoubleSide();
1497  } else if(treeMem.subDetId == StripSubdetector::TOB){
1498  TOBDetId tobId(detId_);
1499  treeMem.layer = tobId.layer();
1500  treeMem.side = tobId.rod()[0];
1501  treeMem.rod = tobId.rod()[1];
1502  treeMem.module = tobId.module();
1503  treeMem.isStereo = tobId.stereo();
1504  treeMem.isDoubleSide = tobId.isDoubleSide();
1505  } else if(treeMem.subDetId == StripSubdetector::TEC) {
1506  TECDetId tecId(detId_);
1507  treeMem.layer = tecId.wheel();
1508  treeMem.side = tecId.side();
1509  treeMem.ring = tecId.ring();
1510  treeMem.petal = tecId.petal()[1];
1511  treeMem.outerInner = tecId.petal()[0];
1512  treeMem.module = tecId.module();
1513  treeMem.isStereo = tecId.stereo();
1514  treeMem.isDoubleSide = tecId.isDoubleSide();
1515  }
1516 
1517  //variables concerning the tracker geometry
1518  const Surface::PositionType &gPModule = tkgeom.idToDet(detId_)->position();
1519  treeMem.posPhi = gPModule.phi();
1520  treeMem.posEta = gPModule.eta();
1521  treeMem.posR = gPModule.perp();
1522  treeMem.posX = gPModule.x();
1523  treeMem.posY = gPModule.y();
1524  treeMem.posZ = gPModule.z();
1525 
1526  const Surface& surface = tkgeom.idToDet(detId_)->surface();
1527 
1528  //global Orientation of local coordinate system of dets/detUnits
1529  LocalPoint lUDirection(1.,0.,0.), lVDirection(0.,1.,0.), lWDirection(0.,0.,1.);
1530  GlobalPoint gUDirection = surface.toGlobal(lUDirection),
1531  gVDirection = surface.toGlobal(lVDirection),
1532  gWDirection = surface.toGlobal(lWDirection);
1533  double dR(999.), dPhi(999.), dZ(999.);
1535  dR = gWDirection.perp() - gPModule.perp();
1536  dPhi = deltaPhi(gUDirection.phi(),gPModule.phi());
1537  dZ = gVDirection.z() - gPModule.z();
1538  if(dZ>=0.)treeMem.rOrZDirection = 1; else treeMem.rOrZDirection = -1;
1539  }else if(treeMem.subDetId==PixelSubdetector::PixelEndcap){
1540  dR = gUDirection.perp() - gPModule.perp();
1541  dPhi = deltaPhi(gVDirection.phi(),gPModule.phi());
1542  dZ = gWDirection.z() - gPModule.z();
1543  if(dR>=0.)treeMem.rOrZDirection = 1; else treeMem.rOrZDirection = -1;
1544  }else if(treeMem.subDetId==StripSubdetector::TID || treeMem.subDetId==StripSubdetector::TEC){
1545  dR = gVDirection.perp() - gPModule.perp();
1546  dPhi = deltaPhi(gUDirection.phi(),gPModule.phi());
1547  dZ = gWDirection.z() - gPModule.z();
1548  if(dR>=0.)treeMem.rOrZDirection = 1; else treeMem.rOrZDirection = -1;
1549  }
1550  if(dR>=0.)treeMem.rDirection = 1; else treeMem.rDirection = -1;
1551  if(dPhi>=0.)treeMem.phiDirection = 1; else treeMem.phiDirection = -1;
1552  if(dZ>=0.)treeMem.zDirection = 1; else treeMem.zDirection = -1;
1553 
1554  //mean and RMS values (extracted from histograms(Xprime on module level)
1555  treeMem.entries = static_cast<UInt_t>(it->second.ResXprimeHisto->GetEntries());
1556  treeMem.meanX = it->second.ResXprimeHisto->GetMean();
1557  treeMem.rmsX = it->second.ResXprimeHisto->GetRMS();
1558  //treeMem.sigmaX = Fwhm(it->second.ResXprimeHisto)/2.355;
1559 
1560  if (useFit_) {
1561  //call fit function which returns mean and sigma from the fit
1562  //for absolute residuals
1563  std::pair<float,float> fitResult1 = this->fitResiduals(it->second.ResXprimeHisto);
1564  treeMem.fitMeanX = fitResult1.first;
1565  treeMem.fitSigmaX = fitResult1.second;
1566  //for normalized residuals
1567  std::pair<float,float> fitResult2 = this->fitResiduals(it->second.NormResXprimeHisto);
1568  treeMem.fitMeanNormX = fitResult2.first;
1569  treeMem.fitSigmaNormX = fitResult2.second;
1570  }
1571 
1572  //get median for absolute residuals
1573  treeMem.medianX = this->getMedian(it->second.ResXprimeHisto);
1574 
1575  int numberOfBins=it->second.ResXprimeHisto->GetNbinsX();
1576  treeMem.numberOfUnderflows = it->second.ResXprimeHisto->GetBinContent(0);
1577  treeMem.numberOfOverflows = it->second.ResXprimeHisto->GetBinContent(numberOfBins+1);
1578  treeMem.numberOfOutliers = it->second.ResXprimeHisto->GetBinContent(0)+it->second.ResXprimeHisto->GetBinContent(numberOfBins+1);
1579 
1580  //mean and RMS values (extracted from histograms(normalized Xprime on module level)
1581  treeMem.meanNormX = it->second.NormResXprimeHisto->GetMean();
1582  treeMem.rmsNormX = it->second.NormResXprimeHisto->GetRMS();
1583 
1584  double stats[20];
1585  it->second.NormResXprimeHisto->GetStats(stats);
1586  // GF treeMem.chi2PerDofX = stats[3]/(stats[0]-1);
1587  if (stats[0]) treeMem.chi2PerDofX = stats[3]/stats[0];
1588 
1589  treeMem.sigmaNormX = Fwhm(it->second.NormResXprimeHisto)/2.355;
1590  treeMem.histNameX = it->second.ResXprimeHisto->GetName();
1591  treeMem.histNameNormX = it->second.NormResXprimeHisto->GetName();
1592 
1593  // fill tree variables in local coordinates if set in cfg
1594  if(lCoorHistOn_) {
1595  treeMem.meanLocalX = it->second.ResHisto->GetMean();
1596  treeMem.rmsLocalX = it->second.ResHisto->GetRMS();
1597  treeMem.meanNormLocalX = it->second.NormResHisto->GetMean();
1598  treeMem.rmsNormLocalX = it->second.NormResHisto->GetRMS();
1599 
1600  treeMem.histNameLocalX = it->second.ResHisto->GetName();
1601  treeMem.histNameNormLocalX = it->second.NormResHisto->GetName();
1602  if (it->second.ResYHisto) treeMem.histNameLocalY = it->second.ResYHisto->GetName();
1603  }
1604 
1605  // mean and RMS values in local y (extracted from histograms(normalized Yprime on module level)
1606  // might exist in pixel only
1607  if (it->second.ResYprimeHisto) {//(stripYResiduals_){
1608  TH1 *h = it->second.ResYprimeHisto;
1609  treeMem.meanY = h->GetMean();
1610  treeMem.rmsY = h->GetRMS();
1611 
1612  if (useFit_) { // fit function which returns mean and sigma from the fit
1613  std::pair<float,float> fitMeanSigma = this->fitResiduals(h);
1614  treeMem.fitMeanY = fitMeanSigma.first;
1615  treeMem.fitSigmaY = fitMeanSigma.second;
1616  }
1617 
1618  //get median for absolute residuals
1619  treeMem.medianY = this->getMedian(h);
1620 
1621  treeMem.histNameY = h->GetName();
1622  }
1623  if (it->second.NormResYprimeHisto) {
1624  TH1 *h = it->second.NormResYprimeHisto;
1625  treeMem.meanNormY = h->GetMean();
1626  treeMem.rmsNormY = h->GetRMS();
1627  h->GetStats(stats); // stats buffer defined above
1628  if (stats[0]) treeMem.chi2PerDofY = stats[3]/stats[0];
1629 
1630  if (useFit_) { // fit function which returns mean and sigma from the fit
1631  std::pair<float,float> fitMeanSigma = this->fitResiduals(h);
1632  treeMem.fitMeanNormY = fitMeanSigma.first;
1633  treeMem.fitSigmaNormY = fitMeanSigma.second;
1634  }
1635  treeMem.histNameNormY = h->GetName();
1636  }
1637  tree.Fill();
1638  }
1639 }
1640 
1641 
1642 std::pair<float,float>
1644 {
1645  std::pair<float,float> fitResult(9999., 9999.);
1646  if (!hist || hist->GetEntries() < 20) return fitResult;
1647 
1648  float mean = hist->GetMean();
1649  float sigma = hist->GetRMS();
1650 
1651  try { // for < CMSSW_2_2_0 since ROOT warnings from fit are converted to exceptions
1652  // Remove the try/catch for more recent CMSSW!
1653  // first fit: two RMS around mean
1654  TF1 func("tmp", "gaus", mean - 2.*sigma, mean + 2.*sigma);
1655  if (0 == hist->Fit(&func,"QNR")) { // N: do not blow up file by storing fit!
1656  mean = func.GetParameter(1);
1657  sigma = func.GetParameter(2);
1658  // second fit: three sigma of first fit around mean of first fit
1659  func.SetRange(mean - 3.*sigma, mean + 3.*sigma);
1660  // I: integral gives more correct results if binning is too wide
1661  // L: Likelihood can treat empty bins correctly (if hist not weighted...)
1662  if (0 == hist->Fit(&func, "Q0LR")) {
1663  if (hist->GetFunction(func.GetName())) { // Take care that it is later on drawn:
1664  hist->GetFunction(func.GetName())->ResetBit(TF1::kNotDraw);
1665  }
1666  fitResult.first = func.GetParameter(1);
1667  fitResult.second = func.GetParameter(2);
1668  }
1669  }
1670  } catch (cms::Exception const & e) {
1671  edm::LogWarning("Alignment") << "@SUB=TrackerOfflineValidation::fitResiduals"
1672  << "Caught this exception during ROOT fit: "
1673  << e.what();
1674  }
1675  return fitResult;
1676 }
1677 
1678 
1679 float
1681 {
1682  float median = 999;
1683  int nbins = histo->GetNbinsX();
1684 
1685  //extract median from histogram
1686  double *x = new double[nbins];
1687  double *y = new double[nbins];
1688  for (int j = 0; j < nbins; j++) {
1689  x[j] = histo->GetBinCenter(j+1);
1690  y[j] = histo->GetBinContent(j+1);
1691  }
1692  median = TMath::Median(nbins, x, y);
1693 
1694  delete[] x; x = 0;
1695  delete [] y; y = 0;
1696 
1697  return median;
1698 
1699 }
1700 //define this as a plug-in
#define LogDebug(id)
const TrackerGeometry * bareTkGeomPtr_
virtual char const * what() const
Definition: Exception.cc:97
type
Definition: HCALResponse.h:22
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
T getParameter(std::string const &) const
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:180
bool isDoubleSide() const
Definition: TECDetId.cc:14
int i
Definition: DBlmapReader.cc:9
unsigned int panel() const
panel id
Definition: PXFDetId.h:52
std::vector< TH1 * > vDeleteObjects_
void bookDirHists(DirectoryWrapper &tfd, const Alignable &ali, const AlignableObjectId &aliobjid)
std::map< int, TrackerOfflineValidation::ModuleHistos > mPxeResiduals_
T perp() const
Definition: PV3DBase.h:66
unsigned int layer() const
layer id
Definition: TOBDetId.h:39
void bookHists(DirectoryWrapper &tfd, const Alignable &ali, align::StructureType type, int i, const AlignableObjectId &aliobjid)
TH1 * make(const char *name, const char *title, int nBinX, double minBinX, double maxBinX)
virtual uint32_t stereo() const
Definition: SiStripDetId.h:150
bool isPixel(uint32_t subDetId)
void fillTree(TTree &tree, const std::map< int, TrackerOfflineValidation::ModuleHistos > &moduleHist_, TkOffTreeVariables &treeMem, const TrackerGeometry &tkgeom)
double deltaPhi(float phi1, float phi2)
Definition: VectorUtil.h:30
bool isDoubleSide() const
Definition: TIBDetId.cc:10
std::vector< TH1 * > vTrack2DHistos_
TH1 * bookTH1F(bool isTransient, DirectoryWrapper &tfd, const char *histName, const char *histTitle, int nBinsX, double lowX, double highX)
std::map< int, TrackerOfflineValidation::ModuleHistos > mTecResiduals_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void analyze(const edm::Event &, const edm::EventSetup &)
container to hold data to be written into TTree
Geom::Phi< T > phi() const
Definition: PV3DBase.h:63
edm::ESHandle< TrackerGeometry > tkGeom_
T y() const
Definition: PV3DBase.h:57
int GetIndex(const std::vector< OBJECT_TYPE * > &vec, const TString &name)
unsigned int ladder() const
ladder id
Definition: PXBDetId.h:39
const std::string & typeToName(align::StructureType type) const
Convert type to name.
tuple histo
Definition: trackerHits.py:12
float getMedian(const TH1 *hist) const
ModuleHistos & getHistStructFromMap(const DetId &detid)
void setSummaryBin(int bin, TH1 *targetHist, TH1 *sourceHist)
virtual Alignables components() const =0
Return vector of all direct components.
std::map< int, TrackerOfflineValidation::ModuleHistos > mTibResiduals_
std::vector< unsigned int > string() const
string id
Definition: TIBDetId.h:53
unsigned int module() const
det id
Definition: TECDetId.h:75
unsigned int layer() const
layer id
Definition: PXBDetId.h:35
unsigned int side() const
positive or negative id
Definition: TECDetId.h:47
std::vector< unsigned int > rod() const
rod id
Definition: TOBDetId.h:49
unsigned int blade() const
blade id
Definition: PXFDetId.h:48
std::map< int, TrackerOfflineValidation::ModuleHistos > mTidResiduals_
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
std::map< std::pair< uint32_t, uint32_t >, TH1 * > hOverlappResidual
virtual const DetIdContainer & detIds() const
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
std::vector< unsigned int > petal() const
petal id
Definition: TECDetId.h:61
int iEvent
Definition: GenABIO.cc:243
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
void getBinning(uint32_t subDetId, TrackerOfflineValidation::HistogrammType residualtype, int &nBinsX, double &lowerBoundX, double &upperBoundX)
const T & max(const T &a, const T &b)
T z() const
Definition: PV3DBase.h:58
tuple result
Definition: query.py:137
unsigned int ring() const
ring id
Definition: TIDDetId.h:55
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
unsigned int module() const
det id
Definition: PXBDetId.h:43
int j
Definition: DBlmapReader.cc:9
Allows conversion between type and name, and vice-versa.
virtual void checkBookHists(const edm::EventSetup &setup)
TProfile * bookTProfile(bool isTransient, DirectoryWrapper &tfd, const char *histName, const char *histTitle, int nBinsX, double lowX, double highX)
double f[11][100]
unsigned int module() const
det id
Definition: PXFDetId.h:56
std::vector< unsigned int > module() const
det id
Definition: TIDDetId.h:64
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
std::string histNameLocalY
virtual const GeomDet * idToDet(DetId) const
unsigned int disk() const
disk id
Definition: PXFDetId.h:43
std::string histNameNormLocalX
int k[5][pyjets_maxn]
bool isDetOrDetUnit(align::StructureType type)
std::map< int, TrackerOfflineValidation::ModuleHistos > mTobResiduals_
DirectoryWrapper(const std::string &newDir, const std::string &basedir, bool useDqmMode)
unsigned int UInt_t
Definition: FUTypes.h:12
Definition: DetId.h:20
void collateSummaryHists(DirectoryWrapper &tfd, const Alignable &ali, int i, const AlignableObjectId &aliobjid, std::vector< TrackerOfflineValidation::SummaryContainer > &vLevelProfiles)
std::pair< float, float > fitResiduals(TH1 *hist) const
unsigned int module() const
detector id
Definition: TIBDetId.h:61
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
unsigned int side() const
positive or negative id
Definition: TIDDetId.h:45
std::string histNameLocalX
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
void summarizeBinInContainer(int bin, SummaryContainer &targetContainer, SummaryContainer &sourceContainer)
void fillTrackQuantities(const edm::Event &, std::vector< AVTrackStruct > &v_avtrackout)
bool isEndCap(uint32_t subDetId)
unsigned int wheel() const
wheel id
Definition: TECDetId.h:52
unsigned int layer() const
layer id
Definition: TIBDetId.h:41
T eta() const
Definition: PV3DBase.h:70
void clear()
set to empty values
void bookGlobalHists(DirectoryWrapper &tfd)
DirectoryWrapper(const DirectoryWrapper &upDir, const std::string &newDir, const std::string &basedir, bool useDqmMode)
virtual const DetIdContainer & detUnitIds() const
Returm a vector of all GeomDetUnit DetIds.
unsigned int ring() const
ring id
Definition: TECDetId.h:71
TrackerOfflineValidation::SummaryContainer bookSummaryHists(DirectoryWrapper &tfd, const Alignable &ali, align::StructureType type, int i, const AlignableObjectId &aliobjid)
T * make() const
make new ROOT object
bool isDoubleSide() const
Definition: TOBDetId.cc:10
unsigned int side() const
positive or negative id
Definition: PXFDetId.h:38
std::vector< TH1 * > vTrackProfiles_
std::pair< int, int > typeAndLayerFromDetId(const DetId &detId) const
unsigned int module() const
detector id
Definition: TOBDetId.h:58
std::map< int, TrackerOfflineValidation::ModuleHistos > mPxbResiduals_
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
Detector det() const
get the detector field from this detid
Definition: DetId.h:37
const edm::ParameterSet parSet_
TrackerOfflineValidation(const edm::ParameterSet &)
T x() const
Definition: PV3DBase.h:56
float Fwhm(const TH1 *hist) const
virtual const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
tuple size
Write out results.
bool isDoubleSide() const
Definition: TIDDetId.cc:10
unsigned int wheel() const
wheel id
Definition: TIDDetId.h:50
bool isBarrel(uint32_t subDetId)