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