CMS 3D CMS Logo

ApeEstimator.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: ApeEstimator
4 // Class: ApeEstimator
5 //
13 //
14 // Original Author: Johannes Hauk
15 // Created: Tue Jan 6 15:02:09 CET 2009
16 // Modified by: Christian Schomakers (RWTH Aachen)
17 // $Id: ApeEstimator.cc,v 1.27 2012/06/26 09:42:33 hauk Exp $
18 //
19 //
20 
21 
22 // system include files
23 #include <memory>
24 #include <sstream>
25 #include <fstream>
26 
27 // user include files
38 
41 
61 
69 
73 //added by Ajay 6Nov 2014
74 //.......................
77 
79 
80 //...............
81 //
82 
85 
87 
89 
94 
95 
96 #include "TH1.h"
97 #include "TH2.h"
98 #include "TProfile.h"
99 #include "TFile.h"
100 #include "TTree.h"
101 #include "TF1.h"
102 #include "TString.h"
103 #include "TMath.h"
104 
105 
108 
111 //ADDED BY LOIC QUERTENMONT
124 
125 //
126 // class decleration
127 //
128 
130  public:
131  explicit ApeEstimator(const edm::ParameterSet&);
132  ~ApeEstimator() override;
133 
134 
135  private:
137  PositionAndError2(): posX(-999.F), posY(-999.F), errX2(-999.F), errY2(-999.F) {};
138  PositionAndError2(float x, float y, float eX, float eY): posX(x), posY(y), errX2(eX), errY2(eY) {};
139  float posX;
140  float posY;
141  float errX2;
142  float errY2;
143  };
144  typedef std::pair<TrackStruct::HitState,PositionAndError2> StatePositionAndError2;
145 
146  void beginJob() override ;
147  void analyze(const edm::Event&, const edm::EventSetup&) override;
148  void endJob() override;
149 
150  bool isHit2D(const TrackingRecHit&)const;
151 
152  void sectorBuilder();
153  bool checkIntervalsForSectors(const unsigned int sectorCounter, const std::vector<double>&)const;
154  bool checkModuleIds(const unsigned int, const std::vector<unsigned int>&)const;
155  bool checkModuleBools(const bool, const std::vector<unsigned int>&)const;
156  bool checkModuleDirections(const int, const std::vector<int>&)const;
157  bool checkModulePositions(const float, const std::vector<double>&)const;
158  void statistics(const TrackerSectorStruct&, const int)const;
159 
160  void residualErrorBinning();
161 
164  void bookTrackHists();
165 
168 
169  StatePositionAndError2 positionAndError2(const LocalPoint&, const LocalError&, const TransientTrackingRecHit&);
172 
173  void hitSelection();
174  void setHitSelectionMap(const std::string&);
175  void setHitSelectionMapUInt(const std::string&);
177  bool inDoubleInterval(const std::vector<double>&, const float)const;
178  bool inUintInterval(const std::vector<unsigned int>&, const unsigned int, const unsigned int =999)const;
179 
184 
185  void calculateAPE();
186 
187  // ----------member data ---------------------------
189  std::map<unsigned int, TrackerSectorStruct> m_tkSector_;
191 
194 
195 
196  std::map<unsigned int, std::pair<double,double> > m_resErrBins_;
197  std::map<unsigned int, ReducedTrackerTreeVariables> m_tkTreeVar_;
198 
199  std::map<std::string,std::vector<double> > m_hitSelection_;
200  std::map<std::string,std::vector<unsigned int> > m_hitSelectionUInt_;
201 
202  bool trackCut_;
203 
204  const unsigned int maxTracksPerEvent_;
205  const unsigned int minGoodHitsPerTrack_;
206 
207  const bool analyzerMode_;
208 
209  const bool calculateApe_;
210 
212 
213 };
214 
215 //
216 // constants, enums and typedefs
217 //
218 
219 //
220 // static data member definitions
221 //
222 
223 //
224 // constructors and destructor
225 //
227  parameterSet_(iConfig),
228  tjTagToken_(consumes<TrajTrackAssociationCollection>(parameterSet_.getParameter<edm::InputTag>("tjTkAssociationMapTag"))),
229  offlinebeamSpot_(consumes<reco::BeamSpot>(edm::InputTag("offlineBeamSpot"))),
230  trackCut_(false), maxTracksPerEvent_(parameterSet_.getParameter<unsigned int>("maxTracksPerEvent")),
231  minGoodHitsPerTrack_(parameterSet_.getParameter<unsigned int>("minGoodHitsPerTrack")),
232  analyzerMode_(parameterSet_.getParameter<bool>("analyzerMode")),
233  calculateApe_(parameterSet_.getParameter<bool>("calculateApe"))
234 {
236 }
237 
238 
240 {
241 }
242 
243 
244 //
245 // member functions
246 //
247 
248 // -----------------------------------------------------------------------------------------------------------
249 
250 void
252 
253  TFile* tkTreeFile(TFile::Open((parameterSet_.getParameter<std::string>("TrackerTreeFile")).c_str()));
254  if(tkTreeFile){
255  edm::LogInfo("SectorBuilder")<<"TrackerTreeFile OK";
256  }else{
257  edm::LogError("SectorBuilder")<<"TrackerTreeFile not found";
258  return;
259  }
260  TTree* tkTree(nullptr);
261  tkTreeFile->GetObject("TrackerTreeGenerator/TrackerTree/TrackerTree",tkTree);
262  if(tkTree){
263  edm::LogInfo("SectorBuilder")<<"TrackerTree OK";
264  }else{
265  edm::LogError("SectorBuilder")<<"TrackerTree not found in file";
266  return;
267  }
268  unsigned int rawId(999), subdetId(999), layer(999), side(999), half(999), rod(999), ring(999), petal(999),
269  blade(999), panel(999), outerInner(999), module(999), nStrips(999);
270  bool isDoubleSide(false), isRPhi(false), isStereo(false);
271  int uDirection(999), vDirection(999), wDirection(999);
272  float posR(999.F), posPhi(999.F), posEta(999.F), posX(999.F), posY(999.F), posZ(999.F);
273 
274  tkTree->SetBranchAddress("RawId", &rawId);
275  tkTree->SetBranchAddress("SubdetId", &subdetId);
276  tkTree->SetBranchAddress("Layer", &layer);
277  tkTree->SetBranchAddress("Side", &side);
278  tkTree->SetBranchAddress("Half", &half);
279  tkTree->SetBranchAddress("Rod", &rod);
280  tkTree->SetBranchAddress("Ring", &ring);
281  tkTree->SetBranchAddress("Petal", &petal);
282  tkTree->SetBranchAddress("Blade", &blade);
283  tkTree->SetBranchAddress("Panel", &panel);
284  tkTree->SetBranchAddress("OuterInner", &outerInner);
285  tkTree->SetBranchAddress("Module", &module);
286  tkTree->SetBranchAddress("NStrips", &nStrips);
287  tkTree->SetBranchAddress("IsDoubleSide", &isDoubleSide);
288  tkTree->SetBranchAddress("IsRPhi", &isRPhi);
289  tkTree->SetBranchAddress("IsStereo", &isStereo);
290  tkTree->SetBranchAddress("UDirection", &uDirection);
291  tkTree->SetBranchAddress("VDirection", &vDirection);
292  tkTree->SetBranchAddress("WDirection", &wDirection);
293  tkTree->SetBranchAddress("PosR", &posR);
294  tkTree->SetBranchAddress("PosPhi", &posPhi);
295  tkTree->SetBranchAddress("PosEta", &posEta);
296  tkTree->SetBranchAddress("PosX", &posX);
297  tkTree->SetBranchAddress("PosY", &posY);
298  tkTree->SetBranchAddress("PosZ", &posZ);
299 
300  int nModules(tkTree->GetEntries());
301  TrackerSectorStruct allSectors;
302 
303  //Loop over all Sectors
304  unsigned int sectorCounter(0);
305  std::vector<edm::ParameterSet> v_sectorDef(parameterSet_.getParameter<std::vector<edm::ParameterSet> >("Sectors"));
306  edm::LogInfo("SectorBuilder")<<"There are "<<v_sectorDef.size()<<" Sectors definded";
307  for(auto const & parSet : v_sectorDef){
308  ++sectorCounter;
309  const std::string& sectorName(parSet.getParameter<std::string>("name"));
310  std::vector<unsigned int> v_rawId(parSet.getParameter<std::vector<unsigned int> >("rawId")),
311  v_subdetId(parSet.getParameter<std::vector<unsigned int> >("subdetId")),
312  v_layer(parSet.getParameter<std::vector<unsigned int> >("layer")),
313  v_side(parSet.getParameter<std::vector<unsigned int> >("side")),
314  v_half(parSet.getParameter<std::vector<unsigned int> >("half")),
315  v_rod(parSet.getParameter<std::vector<unsigned int> >("rod")),
316  v_ring(parSet.getParameter<std::vector<unsigned int> >("ring")),
317  v_petal(parSet.getParameter<std::vector<unsigned int> >("petal")),
318  v_blade(parSet.getParameter<std::vector<unsigned int> >("blade")),
319  v_panel(parSet.getParameter<std::vector<unsigned int> >("panel")),
320  v_outerInner(parSet.getParameter<std::vector<unsigned int> >("outerInner")),
321  v_module(parSet.getParameter<std::vector<unsigned int> >("module")),
322  v_nStrips(parSet.getParameter<std::vector<unsigned int> >("nStrips")),
323  v_isDoubleSide(parSet.getParameter<std::vector<unsigned int> >("isDoubleSide")),
324  v_isRPhi(parSet.getParameter<std::vector<unsigned int> >("isRPhi")),
325  v_isStereo(parSet.getParameter<std::vector<unsigned int> >("isStereo"));
326  std::vector<int> v_uDirection(parSet.getParameter<std::vector<int> >("uDirection")),
327  v_vDirection(parSet.getParameter<std::vector<int> >("vDirection")),
328  v_wDirection(parSet.getParameter<std::vector<int> >("wDirection"));
329  std::vector<double> v_posR(parSet.getParameter<std::vector<double> >("posR")),
330  v_posPhi(parSet.getParameter<std::vector<double> >("posPhi")),
331  v_posEta(parSet.getParameter<std::vector<double> >("posEta")),
332  v_posX(parSet.getParameter<std::vector<double> >("posX")),
333  v_posY(parSet.getParameter<std::vector<double> >("posY")),
334  v_posZ(parSet.getParameter<std::vector<double> >("posZ"));
335 
336  if(!this->checkIntervalsForSectors(sectorCounter,v_posR) || !this->checkIntervalsForSectors(sectorCounter,v_posPhi) ||
337  !this->checkIntervalsForSectors(sectorCounter,v_posEta) || !this->checkIntervalsForSectors(sectorCounter,v_posX) ||
338  !this->checkIntervalsForSectors(sectorCounter,v_posY) || !this->checkIntervalsForSectors(sectorCounter,v_posZ))continue;
339 
340 
341  TrackerSectorStruct tkSector;
342  tkSector.name = sectorName;
343 
344  ReducedTrackerTreeVariables tkTreeVar;
345 
346  //Loop over all Modules
347  for(int module = 0; module < nModules; ++module){
348  tkTree->GetEntry(module);
349 
350  if(sectorCounter==1){
351  tkTreeVar.subdetId = subdetId;
352  tkTreeVar.nStrips = nStrips;
353  tkTreeVar.uDirection = uDirection;
354  tkTreeVar.vDirection = vDirection;
355  tkTreeVar.wDirection = wDirection;
356  m_tkTreeVar_[rawId] = tkTreeVar;
357  }
358 
359  if(!this->checkModuleIds(rawId,v_rawId))continue;
360  if(!this->checkModuleIds(subdetId,v_subdetId))continue;
361  if(!this->checkModuleIds(layer,v_layer))continue;
362  if(!this->checkModuleIds(side,v_side))continue;
363  if(!this->checkModuleIds(half,v_half))continue;
364  if(!this->checkModuleIds(rod,v_rod))continue;
365  if(!this->checkModuleIds(ring,v_ring))continue;
366  if(!this->checkModuleIds(petal,v_petal))continue;
367  if(!this->checkModuleIds(blade,v_blade))continue;
368  if(!this->checkModuleIds(panel,v_panel))continue;
369  if(!this->checkModuleIds(outerInner,v_outerInner))continue;
370  if(!this->checkModuleIds(module,v_module))continue;
371  if(!this->checkModuleIds(nStrips,v_nStrips))continue;
372  if(!this->checkModuleBools(isDoubleSide,v_isDoubleSide))continue;
373  if(!this->checkModuleBools(isRPhi,v_isRPhi))continue;
374  if(!this->checkModuleBools(isStereo,v_isStereo))continue;
375  if(!this->checkModuleDirections(uDirection,v_uDirection))continue;
376  if(!this->checkModuleDirections(vDirection,v_vDirection))continue;
377  if(!this->checkModuleDirections(wDirection,v_wDirection))continue;
378  if(!this->checkModulePositions(posR,v_posR))continue;
379  if(!this->checkModulePositions(posPhi,v_posPhi))continue;
380  if(!this->checkModulePositions(posEta,v_posEta))continue;
381  if(!this->checkModulePositions(posX,v_posX))continue;
382  if(!this->checkModulePositions(posY,v_posY))continue;
383  if(!this->checkModulePositions(posZ,v_posZ))continue;
384 
385  tkSector.v_rawId.push_back(rawId);
386  bool moduleSelected(false);
387  for(auto const & i_rawId : allSectors.v_rawId){
388  if(rawId == i_rawId)moduleSelected = true;
389  }
390  if(!moduleSelected)allSectors.v_rawId.push_back(rawId);
391  }
392 
393  bool isPixel(false);
394  bool isStrip(false);
395  for(auto const & i_rawId : tkSector.v_rawId){
396  switch (m_tkTreeVar_[i_rawId].subdetId) {
399  isPixel = true;
400  break;
405  isStrip = true;
406  break;
407  }
408  }
409 
410  if(isPixel && isStrip){
411  edm::LogError("SectorBuilder")<<"Incorrect Sector Definition: there are pixel and strip modules within one sector"
412  <<"\n... sector selection is not applied, sector "<<sectorCounter<<" is not built";
413  continue;
414  }
415  tkSector.isPixel = isPixel;
416 
417  m_tkSector_[sectorCounter] = tkSector;
418  edm::LogInfo("SectorBuilder")<<"There are "<<tkSector.v_rawId.size()<<" Modules in Sector "<<sectorCounter;
419  }
420  this->statistics(allSectors, nModules);
421  return;
422 }
423 
424 
425 
426 // -----------------------------------------------------------------------------------------------------------
427 
428 
429 bool
430 ApeEstimator::checkIntervalsForSectors(const unsigned int sectorCounter, const std::vector<double>& v_id)const
431 {
432 
433  if(v_id.empty())return true;
434  if(v_id.size()%2==1){
435  edm::LogError("SectorBuilder")<<"Incorrect Sector Definition: Position Vectors need even number of arguments (Intervals)"
436  <<"\n... sector selection is not applied, sector "<<sectorCounter<<" is not built";
437  return false;
438  }
439  int entry(0); double intervalBegin(999.);
440  for(auto const & i_id : v_id){
441  ++entry;
442  if(entry%2==1) intervalBegin = i_id;
443  if(entry%2==0 && intervalBegin > i_id){
444  edm::LogError("SectorBuilder")<<"Incorrect Sector Definition (Position Vector Intervals): \t"
445  <<intervalBegin<<" is bigger than "<<i_id<<" but is expected to be smaller"
446  <<"\n... sector selection is not applied, sector "<<sectorCounter<<" is not built";
447  return false;
448  }
449  }
450  return true;
451 }
452 
453 bool
454 ApeEstimator::checkModuleIds(const unsigned int id, const std::vector<unsigned int>& v_id)const
455 {
456 
457  if(v_id.empty())return true;
458  for(auto const & i_id : v_id){
459  if(id==i_id)return true;
460  }
461  return false;
462 }
463 
464 bool
465 ApeEstimator::checkModuleBools(const bool id, const std::vector<unsigned int>& v_id)const
466 {
467 
468  if(v_id.empty())return true;
469  for(auto const & i_id : v_id){
470  if(1==i_id && id)return true;
471  if(2==i_id && !id)return true;
472  }
473  return false;
474 }
475 
476 bool
477 ApeEstimator::checkModuleDirections(const int id, const std::vector<int>& v_id)const
478 {
479 
480  if(v_id.empty())return true;
481  for(auto const & i_id : v_id){
482  if(id==i_id)return true;
483  }
484  return false;
485 }
486 
487 bool
488 ApeEstimator::checkModulePositions(const float id, const std::vector<double>& v_id)const
489 {
490 
491  if(v_id.empty())return true;
492  int entry(0); double intervalBegin(999.);
493  for(auto const & i_id : v_id){
494  ++entry;
495  if(entry%2==1)intervalBegin = i_id;
496  if(entry%2==0 && id>=intervalBegin && id<i_id)return true;
497  }
498  return false;
499 }
500 
501 void
502 ApeEstimator::statistics(const TrackerSectorStruct& allSectors, const int nModules)const{
503  bool commonModules(false);
504  for(std::map<unsigned int,TrackerSectorStruct>::const_iterator i_sector = m_tkSector_.begin(); i_sector != m_tkSector_.end(); ++i_sector){
505  std::map<unsigned int,TrackerSectorStruct>::const_iterator i_sector2(i_sector);
506  for(++i_sector2; i_sector2 != m_tkSector_.end(); ++i_sector2){
507  unsigned int nCommonModules(0);
508  for(auto const & i_module : (*i_sector).second.v_rawId){
509  for(auto const & i_module2 : (*i_sector2).second.v_rawId){
510  if(i_module2 == i_module) ++nCommonModules;
511  }
512  }
513  if(nCommonModules==0)
514  ;//edm::LogInfo("SectorBuilder")<<"Sector "<<(*i_sector).first<<" and Sector "<<(*i_sector2).first<< " have ZERO Modules in common";
515  else{
516  edm::LogError("SectorBuilder")<<"Sector "<<(*i_sector).first<<" and Sector "<<(*i_sector2).first<< " have "<<nCommonModules<<" Modules in common";
517  commonModules = true;
518  }
519  }
520  }
521  if(static_cast<int>(allSectors.v_rawId.size())==nModules)
522  edm::LogInfo("SectorBuilder")<<"ALL Tracker Modules are contained in the Sectors";
523  else
524  edm::LogWarning("SectorBuilder")<<"There are "<<allSectors.v_rawId.size()<<" Modules in all Sectors"
525  <<" out of "<<nModules<<" Tracker Modules";
526  if(!commonModules)
527  edm::LogInfo("SectorBuilder")<<"There are ZERO modules associated to different sectors, no ambiguities exist";
528  else
529  edm::LogError("SectorBuilder")<<"There are modules associated to different sectors, APE value cannot be assigned reasonably";
530 }
531 
532 
533 // -----------------------------------------------------------------------------------------------------------
534 
535 
536 void
538  std::vector<double> v_residualErrorBinning(parameterSet_.getParameter<std::vector<double> >("residualErrorBinning"));
539  if(v_residualErrorBinning.size()==1){
540  edm::LogError("ResidualErrorBinning")<<"Incorrect selection of Residual Error Bins (used for APE calculation): \t"
541  <<"Only one argument passed, so no interval is specified"
542  <<"\n... delete whole bin selection"; //m_resErrBins_ remains empty
543  return;
544  }
545  double xMin(0.), xMax(0.);
546  unsigned int binCounter(-1);
547  for(auto const & i_binning : v_residualErrorBinning){
548  ++binCounter;
549  if(binCounter == 0){
550  xMin = i_binning;
551  continue;
552  }
553  xMax = i_binning;
554  if(xMax<=xMin){
555  edm::LogError("ResidualErrorBinning")<<"Incorrect selection of Residual Error Bins (used for APE calculation): \t"
556  <<xMin<<" is bigger than "<<xMax<<" but is expected to be smaller"
557  <<"\n... delete whole bin selection";
558  m_resErrBins_.clear();
559  return;
560  }
561  m_resErrBins_[binCounter].first = xMin;
562  m_resErrBins_[binCounter].second = xMax;
563  xMin = xMax;
564  }
565  edm::LogInfo("ResidualErrorBinning")<<m_resErrBins_.size()<<" Intervals of residual errors used for separate APE calculation sucessfully set";
566 }
567 
568 
569 
570 // -----------------------------------------------------------------------------------------------------------
571 
572 
573 
574 void
576  std::vector<unsigned int> v_errHists(parameterSet_.getParameter<std::vector<unsigned int> >("vErrHists"));
577  for(std::vector<unsigned int>::iterator i_errHists = v_errHists.begin(); i_errHists != v_errHists.end(); ++i_errHists){
578  for(std::vector<unsigned int>::iterator i_errHists2 = i_errHists; i_errHists2 != v_errHists.end();){
579  ++i_errHists2;
580  if(*i_errHists==*i_errHists2){
581  edm::LogError("BookSectorHists")<<"Value of vErrHists in config exists twice: "<<*i_errHists<<"\n... delete one of both";
582  v_errHists.erase(i_errHists2);
583  }
584  }
585  }
586 
587 
588  for(auto & i_sector : m_tkSector_){
589  bool zoomHists(parameterSet_.getParameter<bool>("zoomHists"));
590 
591  double widthMax = zoomHists ? 20. : 200.;
592  double chargePixelMax = zoomHists ? 200000. : 2000000.;
593  double chargeStripMax = zoomHists ? 1000. : 10000.;
594  double sOverNMax = zoomHists ? 200. : 2000.;
595  double logClusterProbMin = zoomHists ? -5. : -15.;
596 
597  double resXAbsMax = zoomHists ? 0.5 : 5.;
598  double norResXAbsMax = zoomHists ? 10. : 50.;
599  double probXMin = zoomHists ? -0.01 : -0.1;
600  double probXMax = zoomHists ? 0.11 : 1.1;
601  double sigmaXMin = zoomHists ? 0. : -0.05;
602  double sigmaXMax = zoomHists ? 0.02 : 1.;
603  double sigmaX2Max = sigmaXMax*sigmaXMax;
604  double sigmaXHitMax = zoomHists ? 0.02 : 1.;
605  double phiSensXMax = zoomHists ? 31. : 93.;
606 
607  double norChi2Max = zoomHists ? 5. : 1000.;
608  double d0Max = zoomHists ? 0.02 : 40.; // cosmics: 100.|100.
609  double dzMax = zoomHists ? 15. : 100.; // cosmics: 200.|600.
610  double pMax = zoomHists ? 200. : 2000.;
611  double invPMax = zoomHists ? 0.05 : 10.; //begins at 20GeV, 0.1GeV
612 
613 
615  if(!fileService){
617  "TFileService is not registered in cfg file" );
618  }
619 
620  std::stringstream sector; sector << "Sector_" << i_sector.first;
621  TFileDirectory secDir = fileService->mkdir(sector.str());
622 
623  // Dummy histo containing the sector name as title
624  i_sector.second.Name = secDir.make<TH1F>("z_name",i_sector.second.name.c_str(),1,0,1);
625 
626  // Do not book histos for empty sectors
627  if(i_sector.second.v_rawId.empty()){
628  continue;
629  }
630  // Set parameters for correlationHists
631  i_sector.second.setCorrHistParams(&secDir,norResXAbsMax,sigmaXHitMax,sigmaXMax);
632 
633 
634  // Book pixel or strip specific hists
635  const bool pixelSector(i_sector.second.isPixel);
636 
637 
638  // Cluster Parameters
639  i_sector.second.m_correlationHistsX["WidthX"] = i_sector.second.bookCorrHistsX("WidthX","cluster width","w_{cl,x}","[# channels]",static_cast<int>(widthMax),static_cast<int>(widthMax),0.,widthMax,"nph");
640  i_sector.second.m_correlationHistsX["BaryStripX"] = i_sector.second.bookCorrHistsX("BaryStripX","barycenter of cluster charge","b_{cl,x}","[# channels]",800,100,-10.,790.,"nph");
641 
642  if(pixelSector){
643  i_sector.second.m_correlationHistsY["WidthY"] = i_sector.second.bookCorrHistsY("WidthY","cluster width","w_{cl,y}","[# channels]",static_cast<int>(widthMax),static_cast<int>(widthMax),0.,widthMax,"nph");
644  i_sector.second.m_correlationHistsY["BaryStripY"] = i_sector.second.bookCorrHistsY("BaryStripY","barycenter of cluster charge","b_{cl,y}","[# channels]",800,100,-10.,790.,"nph");
645 
646  i_sector.second.m_correlationHistsX["ChargePixel"] = i_sector.second.bookCorrHistsX("ChargePixel","cluster charge","c_{cl}","[e]",100,50,0.,chargePixelMax,"nph");
647  i_sector.second.m_correlationHistsX["ClusterProbXY"] = i_sector.second.bookCorrHistsX("ClusterProbXY","cluster probability xy","prob_{cl,xy}","",100,50,0.,1.,"nph");
648  i_sector.second.m_correlationHistsX["ClusterProbQ"] = i_sector.second.bookCorrHistsX("ClusterProbQ","cluster probability q","prob_{cl,q}","",100,50,0.,1.,"nph");
649  i_sector.second.m_correlationHistsX["ClusterProbXYQ"] = i_sector.second.bookCorrHistsX("ClusterProbXYQ","cluster probability xyq","prob_{cl,xyq}","",100,50,0.,1.,"nph");
650  i_sector.second.m_correlationHistsX["LogClusterProb"] = i_sector.second.bookCorrHistsX("LogClusterProb","cluster probability xy","log(prob_{cl,xy})","",60,30,logClusterProbMin,0.,"nph");
651  i_sector.second.m_correlationHistsX["IsOnEdge"] = i_sector.second.bookCorrHistsX("IsOnEdge","IsOnEdge","isOnEdge","",2,2,0,2,"nph");
652  i_sector.second.m_correlationHistsX["HasBadPixels"] = i_sector.second.bookCorrHistsX("HasBadPixels","HasBadPixels","hasBadPixels","",2,2,0,2,"nph");
653  i_sector.second.m_correlationHistsX["SpansTwoRoc"] = i_sector.second.bookCorrHistsX("SpansTwoRoc","SpansTwoRoc","spansTwoRoc","",2,2,0,2,"nph");
654  i_sector.second.m_correlationHistsX["QBin"] = i_sector.second.bookCorrHistsX("QBin","q bin","q bin","",8,8,0,8,"nph");
655 
656  i_sector.second.m_correlationHistsY["ChargePixel"] = i_sector.second.bookCorrHistsY("ChargePixel","cluster charge","c_{cl}","[e]",100,50,0.,chargePixelMax,"nph");
657  i_sector.second.m_correlationHistsY["ClusterProbXY"] = i_sector.second.bookCorrHistsY("ClusterProbXY","cluster probability xy","prob_{cl,xy}","",100,50,0.,1.,"nph");
658  i_sector.second.m_correlationHistsY["ClusterProbQ"] = i_sector.second.bookCorrHistsY("ClusterProbQ","cluster probability q","prob_{cl,q}","",100,50,0.,1.,"nph");
659  i_sector.second.m_correlationHistsY["ClusterProbXYQ"] = i_sector.second.bookCorrHistsY("ClusterProbXYQ","cluster probability xyq","prob_{cl,xyq}","",100,50,0.,1.,"nph");
660  i_sector.second.m_correlationHistsY["LogClusterProb"] = i_sector.second.bookCorrHistsY("LogClusterProb","cluster probability xy","log(prob_{cl,xy})","",60,30,logClusterProbMin,0.,"nph");
661  i_sector.second.m_correlationHistsY["IsOnEdge"] = i_sector.second.bookCorrHistsY("IsOnEdge","IsOnEdge","isOnEdge","",2,2,0,2,"nph");
662  i_sector.second.m_correlationHistsY["HasBadPixels"] = i_sector.second.bookCorrHistsY("HasBadPixels","HasBadPixels","hasBadPixels","",2,2,0,2,"nph");
663  i_sector.second.m_correlationHistsY["SpansTwoRoc"] = i_sector.second.bookCorrHistsY("SpansTwoRoc","SpansTwoRoc","spansTwoRoc","",2,2,0,2,"nph");
664  i_sector.second.m_correlationHistsY["QBin"] = i_sector.second.bookCorrHistsY("QBin","q bin","q bin","",8,8,0,8,"nph");
665  }
666 
667  else{
668  i_sector.second.m_correlationHistsX["ChargeStrip"] = i_sector.second.bookCorrHistsX("ChargeStrip","cluster charge","c_{cl}","[APV counts]",100,50,0.,chargeStripMax,"nph");
669  i_sector.second.m_correlationHistsX["MaxStrip"] = i_sector.second.bookCorrHistsX("MaxStrip","strip with max. charge","n_{cl,max}","[# strips]",800,800,-10.,790.,"npht");
670  i_sector.second.m_correlationHistsX["MaxCharge"] = i_sector.second.bookCorrHistsX("MaxCharge","charge of strip with max. charge","c_{cl,max}","[APV counts]",300,75,-10.,290.,"nph");
671  i_sector.second.m_correlationHistsX["MaxIndex"] = i_sector.second.bookCorrHistsX("MaxIndex","cluster-index of strip with max. charge","i_{cl,max}","[# strips]",10,10,0.,10.,"nph");
672  i_sector.second.m_correlationHistsX["ChargeOnEdges"] = i_sector.second.bookCorrHistsX("ChargeOnEdges","fraction of charge on edge strips","(c_{st,L}+c_{st,R})/c_{cl}","",60,60,-0.1,1.1,"nph");
673  i_sector.second.m_correlationHistsX["ChargeAsymmetry"] = i_sector.second.bookCorrHistsX("ChargeAsymmetry","asymmetry of charge on edge strips","(c_{st,L}-c_{st,R})/c_{cl}","",110,55,-1.1,1.1,"nph");
674  i_sector.second.m_correlationHistsX["ChargeLRplus"] = i_sector.second.bookCorrHistsX("ChargeLRplus","fraction of charge not on maxStrip","(c_{cl,L}+c_{cl,R})/c_{cl}","",60,60,-0.1,1.1,"nph");
675  i_sector.second.m_correlationHistsX["ChargeLRminus"] = i_sector.second.bookCorrHistsX("ChargeLRminus","asymmetry of charge L and R of maxStrip","(c_{cl,L}-c_{cl,R})/c_{cl}","",110,55,-1.1,1.1,"nph");
676  i_sector.second.m_correlationHistsX["SOverN"] = i_sector.second.bookCorrHistsX("SOverN","signal over noise","s/N","",100,50,0,sOverNMax,"nph");
677  i_sector.second.m_correlationHistsX["WidthProj"] = i_sector.second.bookCorrHistsX("WidthProj","projected width","w_{p}","[# strips]",200,20,0.,widthMax,"nph");
678  i_sector.second.m_correlationHistsX["WidthDiff"] = i_sector.second.bookCorrHistsX("WidthDiff","width difference","w_{p} - w_{cl}","[# strips]",200,20,-widthMax/2.,widthMax/2.,"nph");
679 
680  i_sector.second.WidthVsWidthProjected = secDir.make<TH2F>("h2_widthVsWidthProj","w_{cl} vs. w_{p};w_{p} [# strips];w_{cl} [# strips]",static_cast<int>(widthMax),0,widthMax,static_cast<int>(widthMax),0,widthMax);
681  i_sector.second.PWidthVsWidthProjected = secDir.make<TProfile>("p_widthVsWidthProj","w_{cl} vs. w_{p};w_{p} [# strips];w_{cl} [# strips]",static_cast<int>(widthMax),0,widthMax);
682 
683  i_sector.second.WidthDiffVsMaxStrip = secDir.make<TH2F>("h2_widthDiffVsMaxStrip","(w_{p} - w_{cl}) vs. n_{cl,max};n_{cl,max};w_{p} - w_{cl} [# strips]",800,-10.,790.,static_cast<int>(widthMax),-widthMax/2.,widthMax/2.);
684  i_sector.second.PWidthDiffVsMaxStrip = secDir.make<TProfile>("p_widthDiffVsMaxStrip","(w_{p} - w_{cl}) vs. n_{cl,max};n_{cl,max};w_{p} - w_{cl} [# strips]",800,-10.,790.);
685 
686  i_sector.second.WidthDiffVsSigmaXHit = secDir.make<TH2F>("h2_widthDiffVsSigmaXHit","(w_{p} - w_{cl}) vs. #sigma_{hit,x};#sigma_{hit,x} [cm];w_{p} - w_{cl} [# strips]",100,0.,sigmaXMax,100,-10.,10.);
687  i_sector.second.PWidthDiffVsSigmaXHit = secDir.make<TProfile>("p_widthDiffVsSigmaXHit","(w_{p} - w_{cl}) vs. #sigma_{hit,x};#sigma_{hit,x} [cm];w_{p} - w_{cl} [# strips]",100,0.,sigmaXMax);
688 
689  i_sector.second.WidthVsPhiSensX = secDir.make<TH2F>("h2_widthVsPhiSensX","w_{cl} vs. #phi_{module,x};#phi_{module,x} [ ^{o}];w_{cl} [# strips]",93,-93,93,static_cast<int>(widthMax),0,widthMax);
690  i_sector.second.PWidthVsPhiSensX = secDir.make<TProfile>("p_widthVsPhiSensX","w_{cl} vs. #phi_{module,x};#phi_{module,x} [ ^{o}];w_{cl} [# strips]",93,-93,93);
691  }
692 
693 
694  // Hit Parameters (transform errors and residuals from [cm] in [mum])
695  i_sector.second.m_correlationHistsX["SigmaXHit"] = i_sector.second.bookCorrHistsX("SigmaXHit","hit error","#sigma_{hit,x}","[#mum]",105,20,sigmaXMin*10000.,sigmaXMax*10000.,"np");
696  i_sector.second.m_correlationHistsX["SigmaXTrk"] = i_sector.second.bookCorrHistsX("SigmaXTrk","track error","#sigma_{trk,x}","[#mum]",105,20,sigmaXMin*10000.,sigmaXMax*10000.,"np");
697  i_sector.second.m_correlationHistsX["SigmaX"] = i_sector.second.bookCorrHistsX("SigmaX","residual error","#sigma_{r,x}","[#mum]",105,20,sigmaXMin*10000.,sigmaXMax*10000.,"np");
698  i_sector.second.m_correlationHistsX["PhiSens"] = i_sector.second.bookCorrHistsX("PhiSens","track angle on sensor","#phi_{module}","[ ^{o}]",96,48,-3,93,"nphtr");
699  i_sector.second.m_correlationHistsX["PhiSensX"] = i_sector.second.bookCorrHistsX("PhiSensX","track angle on sensor","#phi_{module,x}","[ ^{o}]",186,93,-phiSensXMax,phiSensXMax,"nphtr");
700  i_sector.second.m_correlationHistsX["PhiSensY"] = i_sector.second.bookCorrHistsX("PhiSensY","track angle on sensor","#phi_{module,y}","[ ^{o}]",186,93,-93,93,"nphtr");
701 
702  i_sector.second.XHit = secDir.make<TH1F>("h_XHit"," hit measurement x_{hit};x_{hit} [cm];# hits",100,-20,20);
703  i_sector.second.XTrk = secDir.make<TH1F>("h_XTrk","track prediction x_{trk};x_{trk} [cm];# hits",100,-20,20);
704  i_sector.second.SigmaX2 = secDir.make<TH1F>("h_SigmaX2","squared residual error #sigma_{r,x}^{2};#sigma_{r,x}^{2} [#mum^{2}];# hits",105,sigmaXMin*10000.,sigmaX2Max*10000.*10000.); //no mistake !
705  i_sector.second.ResX = secDir.make<TH1F>("h_ResX","residual r_{x};x_{trk}-x_{hit} [#mum];# hits",100,-resXAbsMax*10000.,resXAbsMax*10000.);
706  i_sector.second.NorResX = secDir.make<TH1F>("h_NorResX","normalized residual r_{x}/#sigma_{r,x};(x_{trk}-x_{hit})/#sigma_{r,x};# hits",100,-norResXAbsMax,norResXAbsMax);
707  i_sector.second.ProbX = secDir.make<TH1F>("h_ProbX","residual probability;prob(r_{x}^{2}/#sigma_{r,x}^{2},1);# hits",60,probXMin,probXMax);
708 
709  i_sector.second.PhiSensXVsBarycentreX = secDir.make<TH2F>("h2_phiSensXVsBarycentreX","#phi_{module,x} vs. b_{cl,x};b_{cl,x} [# channels];#phi_{module,x} [ ^{o}]",200,-10.,790.,93,-93,93);
710  i_sector.second.PPhiSensXVsBarycentreX = secDir.make<TProfile>("p_phiSensXVsBarycentreX","#phi_{module,x} vs. b_{cl,x};b_{cl,x} [# channels];#phi_{module,x} [ ^{o}]",200,-10.,790.);
711 
712  if(pixelSector){
713  i_sector.second.m_correlationHistsY["SigmaYHit"] = i_sector.second.bookCorrHistsY("SigmaYHit","hit error","#sigma_{hit,y}","[#mum]",105,20,sigmaXMin*10000.,sigmaXMax*10000.,"np");
714  i_sector.second.m_correlationHistsY["SigmaYTrk"] = i_sector.second.bookCorrHistsY("SigmaYTrk","track error","#sigma_{trk,y}","[#mum]",105,20,sigmaXMin*10000.,sigmaXMax*10000.,"np");
715  i_sector.second.m_correlationHistsY["SigmaY"] = i_sector.second.bookCorrHistsY("SigmaY","residual error","#sigma_{r,y}","[#mum]",105,20,sigmaXMin*10000.,sigmaXMax*10000.,"np");
716  i_sector.second.m_correlationHistsY["PhiSens"] = i_sector.second.bookCorrHistsY("PhiSens","track angle on sensor","#phi_{module}","[ ^{o}]",96,48,-3,93,"nphtr");
717  i_sector.second.m_correlationHistsY["PhiSensX"] = i_sector.second.bookCorrHistsY("PhiSensX","track angle on sensor","#phi_{module,x}","[ ^{o}]",186,93,-phiSensXMax,phiSensXMax,"nphtr");
718  i_sector.second.m_correlationHistsY["PhiSensY"] = i_sector.second.bookCorrHistsY("PhiSensY","track angle on sensor","#phi_{module,y}","[ ^{o}]",186,93,-93,93,"nphtr");
719 
720  i_sector.second.YHit = secDir.make<TH1F>("h_YHit"," hit measurement y_{hit};y_{hit} [cm];# hits",100,-20,20);
721  i_sector.second.YTrk = secDir.make<TH1F>("h_YTrk","track prediction y_{trk};y_{trk} [cm];# hits",100,-20,20);
722  i_sector.second.SigmaY2 = secDir.make<TH1F>("h_SigmaY2","squared residual error #sigma_{r,y}^{2};#sigma_{r,y}^{2} [#mum^{2}];# hits",105,sigmaXMin*10000.,sigmaX2Max*10000.*10000.); //no mistake !
723  i_sector.second.ResY = secDir.make<TH1F>("h_ResY","residual r_{y};y_{trk}-y_{hit} [#mum];# hits",100,-resXAbsMax*10000.,resXAbsMax*10000.);
724  i_sector.second.NorResY = secDir.make<TH1F>("h_NorResY","normalized residual r_{y}/#sigma_{r,y};(y_{trk}-y_{hit})/#sigma_{r,y};# hits",100,-norResXAbsMax,norResXAbsMax);
725  i_sector.second.ProbY = secDir.make<TH1F>("h_ProbY","residual probability;prob(r_{y}^{2}/#sigma_{r,y}^{2},1);# hits",60,probXMin,probXMax);
726 
727  i_sector.second.PhiSensYVsBarycentreY = secDir.make<TH2F>("h2_phiSensYVsBarycentreY","#phi_{module,y} vs. b_{cl,y};b_{cl,y} [# channels];#phi_{module,y} [ ^{o}]",200,-10.,790.,93,-93,93);
728  i_sector.second.PPhiSensYVsBarycentreY = secDir.make<TProfile>("p_phiSensYVsBarycentreY","#phi_{module,y} vs. b_{cl,y};b_{cl,y} [# channels];#phi_{module,y} [ ^{o}]",200,-10.,790.);
729  }
730 
731 
732  // Track Parameters
733  i_sector.second.m_correlationHistsX["HitsValid"] = i_sector.second.bookCorrHistsX("HitsValid","# hits","[valid]",50,0,50,"npt");
734  i_sector.second.m_correlationHistsX["HitsInvalid"] = i_sector.second.bookCorrHistsX("HitsInvalid","# hits","[invalid]",20,0,20,"npt");
735  i_sector.second.m_correlationHistsX["Hits2D"] = i_sector.second.bookCorrHistsX("Hits2D","# hits","[2D]",20,0,20,"npt");
736  i_sector.second.m_correlationHistsX["LayersMissed"] = i_sector.second.bookCorrHistsX("LayersMissed","# layers","[missed]",10,0,10,"npt");
737  i_sector.second.m_correlationHistsX["HitsPixel"] = i_sector.second.bookCorrHistsX("HitsPixel","# hits","[pixel]",10,0,10,"npt");
738  i_sector.second.m_correlationHistsX["HitsStrip"] = i_sector.second.bookCorrHistsX("HitsStrip","# hits","[strip]",40,0,40,"npt");
739  i_sector.second.m_correlationHistsX["HitsGood"] = i_sector.second.bookCorrHistsX("HitsGood","# hits","[good]",50,0,50,"npt");
740  i_sector.second.m_correlationHistsX["NorChi2"] = i_sector.second.bookCorrHistsX("NorChi2","#chi^{2}/f","",50,0,norChi2Max,"npr");
741  i_sector.second.m_correlationHistsX["Theta"] = i_sector.second.bookCorrHistsX("Theta","#theta","[ ^{o}]",40,-10,190,"npt");
742  i_sector.second.m_correlationHistsX["Phi"] = i_sector.second.bookCorrHistsX("Phi","#phi","[ ^{o}]",76,-190,190,"npt");
743  i_sector.second.m_correlationHistsX["D0Beamspot"] = i_sector.second.bookCorrHistsX("D0Beamspot","d_{0, BS}","[cm]",40,-d0Max,d0Max,"npt");
744  i_sector.second.m_correlationHistsX["Dz"] = i_sector.second.bookCorrHistsX("Dz","d_{z}","[cm]",40,-dzMax,dzMax,"npt");
745  i_sector.second.m_correlationHistsX["Pt"] = i_sector.second.bookCorrHistsX("Pt","p_{t}","[GeV]",50,0,pMax,"npt");
746  i_sector.second.m_correlationHistsX["P"] = i_sector.second.bookCorrHistsX("P","|p|","[GeV]",50,0,pMax,"npt");
747  i_sector.second.m_correlationHistsX["InvP"] = i_sector.second.bookCorrHistsX("InvP","1/|p|","[GeV^{-1}]",25,0,invPMax,"t");
748  i_sector.second.m_correlationHistsX["MeanAngle"] = i_sector.second.bookCorrHistsX("MeanAngle","<#phi_{module}>","[ ^{o}]",25,-5,95,"npt");
749  //i_sector.second.m_correlationHistsX[""] = i_sector.second.bookCorrHistsX("","","",,,,"nphtr");
750 
751  if(pixelSector){
752  i_sector.second.m_correlationHistsY["HitsValid"] = i_sector.second.bookCorrHistsY("HitsValid","# hits","[valid]",50,0,50,"npt");
753  i_sector.second.m_correlationHistsY["HitsInvalid"] = i_sector.second.bookCorrHistsY("HitsInvalid","# hits","[invalid]",20,0,20,"npt");
754  i_sector.second.m_correlationHistsY["Hits2D"] = i_sector.second.bookCorrHistsY("Hits2D","# hits","[2D]",20,0,20,"npt");
755  i_sector.second.m_correlationHistsY["LayersMissed"] = i_sector.second.bookCorrHistsY("LayersMissed","# layers","[missed]",10,0,10,"npt");
756  i_sector.second.m_correlationHistsY["HitsPixel"] = i_sector.second.bookCorrHistsY("HitsPixel","# hits","[pixel]",10,0,10,"npt");
757  i_sector.second.m_correlationHistsY["HitsStrip"] = i_sector.second.bookCorrHistsY("HitsStrip","# hits","[strip]",40,0,40,"npt");
758  i_sector.second.m_correlationHistsY["HitsGood"] = i_sector.second.bookCorrHistsY("HitsGood","# hits","[good]",50,0,50,"npt");
759  i_sector.second.m_correlationHistsY["NorChi2"] = i_sector.second.bookCorrHistsY("NorChi2","#chi^{2}/f","",50,0,norChi2Max,"npr");
760  i_sector.second.m_correlationHistsY["Theta"] = i_sector.second.bookCorrHistsY("Theta","#theta","[ ^{o}]",40,-10,190,"npt");
761  i_sector.second.m_correlationHistsY["Phi"] = i_sector.second.bookCorrHistsY("Phi","#phi","[ ^{o}]",76,-190,190,"npt");
762  i_sector.second.m_correlationHistsY["D0Beamspot"] = i_sector.second.bookCorrHistsY("D0Beamspot","d_{0, BS}","[cm]",40,-d0Max,d0Max,"npt");
763  i_sector.second.m_correlationHistsY["Dz"] = i_sector.second.bookCorrHistsY("Dz","d_{z}","[cm]",40,-dzMax,dzMax,"npt");
764  i_sector.second.m_correlationHistsY["Pt"] = i_sector.second.bookCorrHistsY("Pt","p_{t}","[GeV]",50,0,pMax,"npt");
765  i_sector.second.m_correlationHistsY["P"] = i_sector.second.bookCorrHistsY("P","|p|","[GeV]",50,0,pMax,"npt");
766  i_sector.second.m_correlationHistsY["InvP"] = i_sector.second.bookCorrHistsY("InvP","1/|p|","[GeV^{-1}]",25,0,invPMax,"t");
767  i_sector.second.m_correlationHistsY["MeanAngle"] = i_sector.second.bookCorrHistsY("MeanAngle","<#phi_{module}>","[ ^{o}]",25,-5,95,"npt");
768  }
769 
770 
771  // (transform errors and residuals from [cm] in [mum])
772  for(auto const & i_errHists : v_errHists){
773  double xMin(0.01*(i_errHists-1)), xMax(0.01*(i_errHists));
774  std::stringstream sigmaXHit, sigmaXTrk, sigmaX;
775  sigmaXHit << "h_sigmaXHit_" << i_errHists;
776  sigmaXTrk << "h_sigmaXTrk_" << i_errHists;
777  sigmaX << "h_sigmaX_" << i_errHists;
778  i_sector.second.m_sigmaX["sigmaXHit"].push_back(secDir.make<TH1F>(sigmaXHit.str().c_str(),"hit error #sigma_{hit,x};#sigma_{hit,x} [#mum];# hits",100,xMin*10000.,xMax*10000.));
779  i_sector.second.m_sigmaX["sigmaXTrk"].push_back(secDir.make<TH1F>(sigmaXTrk.str().c_str(),"track error #sigma_{trk,x};#sigma_{trk,x} [#mum];# hits",100,xMin*10000.,xMax*10000.));
780  i_sector.second.m_sigmaX["sigmaX" ].push_back(secDir.make<TH1F>(sigmaX.str().c_str(),"residual error #sigma_{r,x};#sigma_{r,x} [#mum];# hits",100,xMin*10000.,xMax*10000.));
781  if(pixelSector){
782  std::stringstream sigmaYHit, sigmaYTrk, sigmaY;
783  sigmaYHit << "h_sigmaYHit_" << i_errHists;
784  sigmaYTrk << "h_sigmaYTrk_" << i_errHists;
785  sigmaY << "h_sigmaY_" << i_errHists;
786  i_sector.second.m_sigmaY["sigmaYHit"].push_back(secDir.make<TH1F>(sigmaYHit.str().c_str(),"hit error #sigma_{hit,y};#sigma_{hit,y} [#mum];# hits",100,xMin*10000.,xMax*10000.));
787  i_sector.second.m_sigmaY["sigmaYTrk"].push_back(secDir.make<TH1F>(sigmaYTrk.str().c_str(),"track error #sigma_{trk,y};#sigma_{trk,y} [#mum];# hits",100,xMin*10000.,xMax*10000.));
788  i_sector.second.m_sigmaY["sigmaY" ].push_back(secDir.make<TH1F>(sigmaY.str().c_str(),"residual error #sigma_{r,y};#sigma_{r,y} [#mum];# hits",100,xMin*10000.,xMax*10000.));
789  }
790  }
791 
792  }
793 }
794 
795 
796 
797 void
799  std::vector<unsigned int> v_errHists(parameterSet_.getParameter<std::vector<unsigned int> >("vErrHists"));
800  for(std::vector<unsigned int>::iterator i_errHists = v_errHists.begin(); i_errHists != v_errHists.end(); ++i_errHists){
801  for(std::vector<unsigned int>::iterator i_errHists2 = i_errHists; i_errHists2 != v_errHists.end();){
802  ++i_errHists2;
803  if(*i_errHists==*i_errHists2){
804  edm::LogError("BookSectorHists")<<"Value of vErrHists in config exists twice: "<<*i_errHists<<"\n... delete one of both";
805  v_errHists.erase(i_errHists2);
806  }
807  }
808  }
809 
810  for(auto &i_sector : m_tkSector_){
812  if(!fileService){
814  "TFileService is not registered in cfg file" );
815  }
816 
817  std::stringstream sector; sector << "Sector_" << i_sector.first;
818  TFileDirectory secDir = fileService->mkdir(sector.str());
819 
820  // Dummy histo containing the sector name as title
821  i_sector.second.Name = secDir.make<TH1F>("z_name",i_sector.second.name.c_str(),1,0,1);
822 
823  // Do not book histos for empty sectors
824  if(i_sector.second.v_rawId.empty()){
825  continue;
826  }
827 
828 
829  // Distributions in each interval (stay in [cm], to have all calculations in [cm])
830  if(m_resErrBins_.empty()){ // default if no selection taken into account: calculate APE with one bin with residual error 0-100um
831  m_resErrBins_[1].first = 0.;
832  m_resErrBins_[1].second = 0.01;
833  }
834  for(auto const & i_errBins : m_resErrBins_){
835  std::stringstream interval; interval << "Interval_" << i_errBins.first;
836  TFileDirectory intDir = secDir.mkdir(interval.str());
837  i_sector.second.m_binnedHists[i_errBins.first]["sigmaX"] = intDir.make<TH1F>("h_sigmaX","residual resolution #sigma_{x};#sigma_{x} [cm];# hits",100,0.,0.01);
838  i_sector.second.m_binnedHists[i_errBins.first]["norResX"] = intDir.make<TH1F>("h_norResX","normalized residual r_{x}/#sigma_{r,x};(x_{trk}-x_{hit})/#sigma_{r,x};# hits",100,-10,10);
839  if(i_sector.second.isPixel){
840  i_sector.second.m_binnedHists[i_errBins.first]["sigmaY"] = intDir.make<TH1F>("h_sigmaY","residual resolution #sigma_{y};#sigma_{y} [cm];# hits",100,0.,0.01);
841  i_sector.second.m_binnedHists[i_errBins.first]["norResY"] = intDir.make<TH1F>("h_norResY","normalized residual r_{y}/#sigma_{r,y};(y_{trk}-y_{hit})/#sigma_{r,y};# hits",100,-10,10);
842  }
843  }
844 
845 
846  TFileDirectory resDir = secDir.mkdir("Results");
847 
848  // TTree containing rawIds of all modules in sector
849  unsigned int rawId(0);
850  i_sector.second.RawId = resDir.make<TTree>("rawIdTree","Tree containing rawIds of all modules in sector");
851  i_sector.second.RawId->Branch("RawId", &rawId, "RawId/i");
852  for(auto const & i_rawId : i_sector.second.v_rawId){
853  rawId = i_rawId;
854  i_sector.second.RawId->Fill();
855  }
856 
857  // Result plots (one hist per sector containing one bin per interval)
858  // (transform errors and residuals from [cm] in [mum])
859  std::vector<double> v_binX(parameterSet_.getParameter<std::vector<double> >("residualErrorBinning"));
860  for(auto & i_binX : v_binX){
861  i_binX *= 10000.;
862  }
863  i_sector.second.EntriesX = resDir.make<TH1F>("h_entriesX","# hits used;#sigma_{x} [#mum];# hits",v_binX.size()-1,&(v_binX[0]));
864  if(i_sector.second.isPixel){
865  i_sector.second.EntriesY = resDir.make<TH1F>("h_entriesY","# hits used;#sigma_{y} [#mum];# hits",v_binX.size()-1,&(v_binX[0]));
866  }
867 
868  // In fact these are un-needed Analyzer plots, but I want to have them always for every sector visible
869  // (transform errors and residuals from [cm] in [mum])
870  i_sector.second.ResX = resDir.make<TH1F>("h_ResX","residual r_{x};x_{trk}-x_{hit} [#mum];# hits",100,-0.03*10000.,0.03*10000.);
871  i_sector.second.NorResX = resDir.make<TH1F>("h_NorResX","normalized residual r_{x}/#sigma_{r,x};(x_{trk}-x_{hit})/#sigma_{r,x};# hits",100,-5.,5.);
872  if(i_sector.second.isPixel){
873  i_sector.second.ResY = resDir.make<TH1F>("h_ResY","residual r_{y};y_{trk}-y_{hit} [#mum];# hits",100,-0.03*10000.,0.03*10000.);
874  i_sector.second.NorResY = resDir.make<TH1F>("h_NorResY","normalized residual r_{y}/#sigma_{r,y};(y_{trk}-y_{hit})/#sigma_{r,y};# hits",100,-5.,5.);
875  }
876  }
877 }
878 
879 
880 // -----------------------------------------------------------------------------------------------------------
881 
882 void
884  bool zoomHists(parameterSet_.getParameter<bool>("zoomHists"));
885 
886  int trackSizeBins = zoomHists ? 6 : 201;
887  double trackSizeMax = trackSizeBins -1;
888 
889  double chi2Max = zoomHists ? 100. : 2000.;
890  double norChi2Max = zoomHists ? 5. : 1000.;
891  double d0max = zoomHists ? 0.02 : 40.; // cosmics: 100.|100.
892  double dzmax = zoomHists ? 15. : 100.; // cosmics: 200.|600.
893  double pMax = zoomHists ? 200. : 2000.;
894 
896  TFileDirectory evtDir = fileService->mkdir("EventVariables");
897  tkDetector_.TrkSize = evtDir.make<TH1F>("h_trackSize","# tracks [all];# tracks;# events",trackSizeBins,-1,trackSizeMax);
898  tkDetector_.TrkSizeGood = evtDir.make<TH1F>("h_trackSizeGood","# tracks [good];# tracks;# events",trackSizeBins,-1,trackSizeMax);
899  TFileDirectory trkDir = fileService->mkdir("TrackVariables");
900  tkDetector_.HitsSize = trkDir.make<TH1F>("h_hitsSize","# hits;# hits;# tracks",51,-1,50);
901  tkDetector_.HitsValid = trkDir.make<TH1F>("h_hitsValid","# hits [valid];# hits [valid];# tracks",51,-1,50);
902  tkDetector_.HitsInvalid = trkDir.make<TH1F>("h_hitsInvalid","# hits [invalid];# hits [invalid];# tracks",21,-1,20);
903  tkDetector_.Hits2D = trkDir.make<TH1F>("h_hits2D","# hits [2D];# hits [2D];# tracks",21,-1,20);
904  tkDetector_.LayersMissed = trkDir.make<TH1F>("h_layersMissed","# layers [missed];# layers [missed];# tracks",11,-1,10);
905  tkDetector_.HitsPixel = trkDir.make<TH1F>("h_hitsPixel","# hits [pixel];# hits [pixel];# tracks",11,-1,10);
906  tkDetector_.HitsStrip = trkDir.make<TH1F>("h_hitsStrip","# hits [strip];# hits [strip];# tracks",41,-1,40);
907  tkDetector_.Charge = trkDir.make<TH1F>("h_charge","charge q;q [e];# tracks",5,-2,3);
908  tkDetector_.Chi2 = trkDir.make<TH1F>("h_chi2"," #chi^{2};#chi^{2};# tracks",100,0,chi2Max);
909  tkDetector_.Ndof = trkDir.make<TH1F>("h_ndof","# degrees of freedom f;f;# tracks",101,-1,100);
910  tkDetector_.NorChi2 = trkDir.make<TH1F>("h_norChi2","normalized #chi^{2};#chi^{2}/f;# tracks",200,0,norChi2Max);
911  tkDetector_.Prob = trkDir.make<TH1F>("h_prob"," #chi^{2} probability;prob(#chi^{2},f);# tracks",50,0,1);
912  tkDetector_.Eta = trkDir.make<TH1F>("h_eta","pseudorapidity #eta;#eta;# tracks",100,-5,5);
913  tkDetector_.EtaErr = trkDir.make<TH1F>("h_etaErr","Error of #eta;#sigma(#eta);# tracks",100,0,0.001);
914  tkDetector_.EtaSig = trkDir.make<TH1F>("h_etaSig","Significance of #eta;#eta/#sigma(#eta);# tracks",100,-20000,20000);
915  tkDetector_.Theta = trkDir.make<TH1F>("h_theta","polar angle #theta;#theta [ ^{o}];# tracks",100,-10,190);
916  tkDetector_.Phi = trkDir.make<TH1F>("h_phi","azimuth angle #phi;#phi [ ^{o}];# tracks",190,-190,190);
917  tkDetector_.PhiErr = trkDir.make<TH1F>("h_phiErr","Error of #phi;#sigma(#phi) [ ^{o}];# tracks",100,0,0.04);
918  tkDetector_.PhiSig = trkDir.make<TH1F>("h_phiSig","Significance of #phi;#phi/#sigma(#phi) [ ^{o}];# tracks",100,-50000,50000);
919  tkDetector_.D0Beamspot = trkDir.make<TH1F>("h_d0Beamspot","Closest approach d_{0} wrt. beamspot;d_{0, BS} [cm];# tracks",200,-d0max,d0max);
920  tkDetector_.D0BeamspotErr = trkDir.make<TH1F>("h_d0BeamspotErr","Error of d_{0, BS};#sigma(d_{0, BS}) [cm];# tracks",200,0,0.01);
921  tkDetector_.D0BeamspotSig = trkDir.make<TH1F>("h_d0BeamspotSig","Significance of d_{0, BS};d_{0, BS}/#sigma(d_{0, BS});# tracks",100,-5,5);
922  tkDetector_.Dz = trkDir.make<TH1F>("h_dz","Closest approach d_{z};d_{z} [cm];# tracks",200,-dzmax,dzmax);
923  tkDetector_.DzErr = trkDir.make<TH1F>("h_dzErr","Error of d_{z};#sigma(d_{z}) [cm];# tracks",200,0,0.01);
924  tkDetector_.DzSig = trkDir.make<TH1F>("h_dzSig","Significance of d_{z};d_{z}/#sigma(d_{z});# tracks",100,-10000,10000);
925  tkDetector_.Pt = trkDir.make<TH1F>("h_pt","transverse momentum p_{t};p_{t} [GeV];# tracks",100,0,pMax);
926  tkDetector_.PtErr = trkDir.make<TH1F>("h_ptErr","Error of p_{t};#sigma(p_{t}) [GeV];# tracks",100,0,1.6);
927  tkDetector_.PtSig = trkDir.make<TH1F>("h_ptSig","Significance of p_{t};p_{t}/#sigma(p_{t});# tracks",100,0,200);
928  tkDetector_.P = trkDir.make<TH1F>("h_p","momentum magnitude |p|;|p| [GeV];# tracks",100,0,pMax);
929  tkDetector_.MeanAngle = trkDir.make<TH1F>("h_meanAngle","mean angle on module <#phi_{module}>;<#phi_{module}> [ ^{o}];# tracks",100,-5,95);
930  tkDetector_.HitsGood = trkDir.make<TH1F>("h_hitsGood","# hits [good];# hits [good];# tracks",51,-1,50);
931 
932  tkDetector_.MeanAngleVsHits = trkDir.make<TH2F>("h2_meanAngleVsHits","<#phi_{module}> vs. # hits;# hits;<#phi_{module}> [ ^{o}]",51,-1,50,50,-5,95);
933  tkDetector_.HitsGoodVsHitsValid = trkDir.make<TH2F>("h2_hitsGoodVsHitsValid","# hits [good] vs. # hits [valid];# hits [valid];# hits [good]",51,-1,50,51,-1,50);
934  tkDetector_.HitsPixelVsEta = trkDir.make<TH2F>("h2_hitsPixelVsEta","# hits [pixel] vs. #eta;#eta;# hits [pixel]",60,-3,3,11,-1,10);
935  tkDetector_.HitsPixelVsTheta = trkDir.make<TH2F>("h2_hitsPixelVsTheta","# hits [pixel] vs. #theta;#theta;# hits [pixel]",100,-10,190,11,-1,10);
936  tkDetector_.HitsStripVsEta = trkDir.make<TH2F>("h2_hitsStripVsEta","# hits [strip] vs. #eta;#eta;# hits [strip]",60,-3,3,31,-1,40);
937  tkDetector_.HitsStripVsTheta = trkDir.make<TH2F>("h2_hitsStripVsTheta","# hits [strip] vs. #theta;#theta;# hits [strip]",100,-10,190,31,-1,40);
938  tkDetector_.PtVsEta = trkDir.make<TH2F>("h2_ptVsEta","p_{t} vs. #eta;#eta;p_{t} [GeV]",60,-3,3,100,0,pMax);
939  tkDetector_.PtVsTheta = trkDir.make<TH2F>("h2_ptVsTheta","p_{t} vs. #theta;#theta;p_{t} [GeV]",100,-10,190,100,0,pMax);
940 
941  tkDetector_.PMeanAngleVsHits = trkDir.make<TProfile>("p_meanAngleVsHits","<#phi_{module}> vs. # hits;# hits;<#phi_{module}> [ ^{o}]",51,-1,50);
942  tkDetector_.PHitsGoodVsHitsValid = trkDir.make<TProfile>("p_hitsGoodVsHitsValid","# hits [good] vs. # hits [valid];# hits [valid];# hits [good]",51,-1,50);
943  tkDetector_.PHitsPixelVsEta = trkDir.make<TProfile>("p_hitsPixelVsEta","# hits [pixel] vs. #eta;#eta;# hits [pixel]",60,-3,3);
944  tkDetector_.PHitsPixelVsTheta = trkDir.make<TProfile>("p_hitsPixelVsTheta","# hits [pixel] vs. #theta;#theta;# hits [pixel]",100,-10,190);
945  tkDetector_.PHitsStripVsEta = trkDir.make<TProfile>("p_hitsStripVsEta","# hits [strip] vs. #eta;#eta;# hits [strip]",60,-3,3);
946  tkDetector_.PHitsStripVsTheta = trkDir.make<TProfile>("p_hitsStripVsTheta","# hits [strip] vs. #theta;#theta;# hits [strip]",100,-10,190);
947  tkDetector_.PPtVsEta = trkDir.make<TProfile>("p_ptVsEta","p_{t} vs. #eta;#eta;p_{t} [GeV]",60,-3,3);
948  tkDetector_.PPtVsTheta = trkDir.make<TProfile>("p_ptVsTheta","p_{t} vs. #theta;#theta;p_{t} [GeV]",100,-10,190);
949 }
950 
951 
952 
953 // -----------------------------------------------------------------------------------------------------------
954 
955 
958  const math::XYZPoint beamPoint(beamSpot.x0(),beamSpot.y0(), beamSpot.z0());
959  double d0BeamspotErr = std::sqrt( track.d0Error()*track.d0Error() + 0.5*beamSpot.BeamWidthX()*beamSpot.BeamWidthX() + 0.5*beamSpot.BeamWidthY()*beamSpot.BeamWidthY() );
960 
961  const static TrajectoryStateCombiner tsoscomb;
962 
963  const reco::HitPattern& hitPattern(track.hitPattern());
964 
966 
967  trkParams.hitsSize = track.recHitsSize();
968  trkParams.hitsValid = track.found(); // invalid is every hit from every single module that expects a hit
969  trkParams.hitsInvalid = trkParams.hitsSize-trkParams.hitsValid;
970  trkParams.layersMissed = track.lost(); // lost hit means, that a crossed layer doesn't contain a hit (can be more than one invalid hit)
971  trkParams.hitsPixel = hitPattern.numberOfValidPixelHits();
972  trkParams.hitsStrip = hitPattern.numberOfValidStripHits();
973  trkParams.charge = track.charge();
974  trkParams.chi2 = track.chi2();
975  trkParams.ndof = track.ndof();
976  trkParams.norChi2 = trkParams.chi2/trkParams.ndof;
977  trkParams.prob = TMath::Prob(trkParams.chi2,trkParams.ndof);
978  trkParams.eta = track.eta();
979  trkParams.etaErr = track.etaError();
980  trkParams.theta = track.theta();
981  trkParams.phi = track.phi();
982  trkParams.phiErr = track.phiError();
983  trkParams.d0 = track.d0();
984  trkParams.d0Beamspot = -1.*track.dxy(beamPoint);
985  trkParams.d0BeamspotErr = d0BeamspotErr;
986  trkParams.dz = track.dz();
987  trkParams.dzErr = track.dzError();
988  trkParams.dzBeamspot = track.dz(beamPoint);
989  trkParams.p = track.p();
990  trkParams.pt = track.pt();
991  trkParams.ptErr = track.ptError();
992 
993  const std::vector<TrajectoryMeasurement>& v_meas = traj.measurements();
994 
995  int count2D(0); float meanPhiSensToNorm(0.F);
996  for(auto const & i_meas : v_meas){
997  const TrajectoryMeasurement& meas = i_meas;
998  const TransientTrackingRecHit& hit = *meas.recHit();
999  const TrackingRecHit& recHit = *hit.hit();
1000  if(this->isHit2D(recHit)) ++count2D;
1001 
1003  const align::LocalVector mom(tsos.localDirection());
1004  meanPhiSensToNorm += atan(fabs(sqrt(mom.x()*mom.x()+mom.y()*mom.y())/mom.z()));
1005  }
1006  meanPhiSensToNorm *= (1./static_cast<float>(trkParams.hitsSize));
1007 
1008  trkParams.hits2D = count2D;
1009  trkParams.meanPhiSensToNorm = meanPhiSensToNorm;
1010 
1011  if(parameterSet_.getParameter<bool>("applyTrackCuts")){
1012  trackCut_ = false;
1013  if(trkParams.hitsStrip<11 || trkParams.hits2D<2 || trkParams.hitsPixel<2 || //trkParams.hitsInvalid>2 ||
1014  trkParams.hitsStrip>35 || trkParams.hitsPixel>7 ||
1015  trkParams.norChi2>5. ||
1016  trkParams.pt<25. || trkParams.pt>150. ||
1017  std::abs(trkParams.d0Beamspot)>0.02 || std::abs(trkParams.dz)>15.)trackCut_ = true;
1018  }
1019  else{
1020  trackCut_ = false;
1021  }
1022 
1023  return trkParams;
1024 }
1025 
1026 
1027 
1031 
1032  const static TrajectoryStateCombiner tsoscomb;
1033 
1034  const TrajectoryMeasurement& meas = i_meas;
1035  const TransientTrackingRecHit& hit = *meas.recHit();
1036  const TrackingRecHit& recHit = *hit.hit();
1037  const TrajectoryStateOnSurface& tsos = tsoscomb(meas.forwardPredictedState(),meas.backwardPredictedState());
1038 
1039  const DetId& detId(hit.geographicalId());
1040  const DetId::Detector& detector = detId.det(); if(detector != DetId::Tracker){hitParams.hitState = TrackStruct::notInTracker; return hitParams;}
1041  const uint32_t rawId(detId.rawId());
1042 
1043  for(auto & i_sector : m_tkSector_){
1044  for(auto const & i_rawId : i_sector.second.v_rawId){
1045  if(rawId==i_rawId){hitParams.v_sector.push_back(i_sector.first); break;}
1046  }
1047  }
1048 
1049  const align::LocalVector& mom(tsos.localDirection());
1050  int xMomentum(0), yMomentum(0), zMomentum(0);
1051  xMomentum = mom.x()>0. ? 1 : -1;
1052  yMomentum = mom.y()>0. ? 1 : -1;
1053  zMomentum = mom.z()>0. ? 1 : -1;
1054  float phiSensX = std::atan(std::fabs(mom.x()/mom.z()))*static_cast<float>(m_tkTreeVar_[rawId].vDirection); // check for orientation of E- and B- Field (thoughts for barrel)
1055  float phiSensY = std::atan(std::fabs(mom.y()/mom.z()))*static_cast<float>(m_tkTreeVar_[rawId].vDirection);
1056  hitParams.phiSens = std::atan(std::fabs(std::sqrt(mom.x()*mom.x()+mom.y()*mom.y())/mom.z()));
1057  hitParams.phiSensX = (xMomentum==zMomentum ? phiSensX : -phiSensX );
1058  hitParams.phiSensY = (yMomentum==zMomentum ? phiSensY : -phiSensY );
1059 
1060  if(!hit.isValid()){
1061  hitParams.hitState = TrackStruct::invalid;
1062  return hitParams;
1063  }
1064 
1065  // Get local positions and errors of hit and track
1066  const LocalPoint& lPHit = hit.localPosition();
1067  const LocalPoint& lPTrk = tsos.localPosition();
1068 
1069  // use APE also for the hit error, while APE is automatically included in tsos error
1070  //
1071  // no need to add APE to hitError anymore by Ajay 27 Oct 2014
1072  const LocalError& errHitApe = hit.localPositionError(); // now sum of CPE+APE as said by MARCO?
1073  LocalError errorWithoutAPE;
1074 
1075  bool Pixel(false);
1076  bool Strip(false);
1077 
1079  Pixel = true;
1080  }else if( m_tkTreeVar_[rawId].subdetId==StripSubdetector::TIB || m_tkTreeVar_[rawId].subdetId==StripSubdetector::TOB ||
1081  m_tkTreeVar_[rawId].subdetId==StripSubdetector::TID || m_tkTreeVar_[rawId].subdetId==StripSubdetector::TEC){
1082  Strip = true;
1083  }else{
1084  edm::LogWarning("FillHitVariables")<<"cant identify wether hit is from pixel or strip";
1085  hitParams.hitState = TrackStruct::invalid; return hitParams;
1086  }
1087 
1088  if(!hit.detUnit()){
1089  hitParams.hitState = TrackStruct::invalid;
1090  return hitParams;
1091  } // is it a single physical module?
1092  const GeomDetUnit& detUnit = *hit.detUnit();
1093 
1094  if(Pixel){
1095  if(!dynamic_cast<const PixelTopology*>(&detUnit.type().topology())){
1096  hitParams.hitState = TrackStruct::invalid;
1097  return hitParams;
1098  }
1099  const PixelGeomDetUnit * pixelDet = (const PixelGeomDetUnit*)(&detUnit);
1100  const LocalError& lape = pixelDet->localAlignmentError();
1101  if (lape.valid()){
1102  errorWithoutAPE = LocalError(errHitApe.xx() -lape.xx(), errHitApe.xy()- lape.xy(), errHitApe.yy()-lape.yy());
1103  }
1104  }
1105  if(Strip){
1106  if(!dynamic_cast<const StripTopology*>(&detUnit.type().topology())){
1107  hitParams.hitState = TrackStruct::invalid;
1108  return hitParams;
1109  }
1110  const StripGeomDetUnit * stripDet = (const StripGeomDetUnit*)(&detUnit);
1111  const LocalError& lape = stripDet->localAlignmentError();
1112  if (lape.valid())
1113  { errorWithoutAPE = LocalError(errHitApe.xx() -lape.xx(), errHitApe.xy()- lape.xy(), errHitApe.yy()-lape.yy());
1114  }
1115  }
1116 
1117 
1118  const LocalError& errHitWoApe = errorWithoutAPE;
1119  const LocalError& errTrk = tsos.localError().positionError();
1120 
1121  const StatePositionAndError2 positionAndError2Hit = this->positionAndError2(lPHit, errHitApe, hit);
1122  const StatePositionAndError2 positionAndError2HitWoApe = this->positionAndError2(lPHit, errHitWoApe, hit);
1123  edm::LogInfo("CalculateAPE")<<"errHitWoApe "<<errHitWoApe<<"errHitApe "<<errHitApe;
1124 
1125  const StatePositionAndError2 positionAndError2Trk = this->positionAndError2(lPTrk, errTrk, hit);
1126 
1127  const TrackStruct::HitState& stateHit(positionAndError2Hit.first);
1128  const TrackStruct::HitState& stateHitWoApe(positionAndError2HitWoApe.first);
1129  const TrackStruct::HitState& stateTrk(positionAndError2Trk.first);
1130 
1131  if(stateHit==TrackStruct::invalid || stateHitWoApe==TrackStruct::invalid || stateTrk==TrackStruct::invalid){
1132  hitParams.hitState = TrackStruct::invalid;
1133  return hitParams;
1134  }else if(stateHit==TrackStruct::negativeError || stateHitWoApe==TrackStruct::negativeError || stateTrk==TrackStruct::negativeError){
1135  ++counter1;
1136  // Do not print error message by default
1137  //std::stringstream ss_error;
1138  //ss_error<<"Upper values belong to: ";
1139  //if(stateHit==TrackStruct::negativeError)ss_error<<"Hit without APE, ";
1140  //if(stateHitWoApe==TrackStruct::negativeError)ss_error<<"Hit with APE, ";
1141  //if(stateTrk==TrackStruct::negativeError)ss_error<<"Track,";
1142  //edm::LogError("Negative error Value")<<"@SUB=ApeEstimator::fillHitVariables"<<ss_error.str();
1144  return hitParams;
1145  }
1146 
1147 
1148  // Calculate residuals
1149 
1150  const float xHit = positionAndError2Hit.second.posX;
1151  const float xTrk = positionAndError2Trk.second.posX;
1152  const float yHit = positionAndError2Hit.second.posY;
1153  const float yTrk = positionAndError2Trk.second.posY;
1154 
1155  const float errXHit2(positionAndError2Hit.second.errX2);
1156  const float errXHitWoApe2(positionAndError2HitWoApe.second.errX2);
1157  const float errXTrk2(positionAndError2Trk.second.errX2);
1158  const float errYHit2(positionAndError2Hit.second.errY2);
1159  const float errYHitWoApe2(positionAndError2HitWoApe.second.errY2);
1160  const float errYTrk2(positionAndError2Trk.second.errY2);
1161 
1162  const float errXHit = std::sqrt(positionAndError2Hit.second.errX2);
1163  const float errXHitWoApe = std::sqrt(positionAndError2HitWoApe.second.errX2);
1164  const float errXTrk = std::sqrt(positionAndError2Trk.second.errX2);
1165  const float errYHit = std::sqrt(positionAndError2Hit.second.errY2);
1166  const float errYHitWoApe = std::sqrt(positionAndError2HitWoApe.second.errY2);
1167  const float errYTrk = std::sqrt(positionAndError2Trk.second.errY2);
1168 
1169  const float resX = xTrk - xHit;
1170  const float resY = yTrk - yHit;
1171 
1172  const float errX = std::sqrt(errXHit2 + errXTrk2);
1173  const float errXWoApe2 = errXHitWoApe2 + errXTrk2;
1174  const float errXWoApe = std::sqrt(errXWoApe2);
1175  const float errY = std::sqrt(errYHit2 + errYTrk2);
1176  const float errYWoApe2 = errYHitWoApe2 + errYTrk2;
1177  const float errYWoApe = std::sqrt(errYWoApe2);
1178 
1179  const float norResX = resX/errX;
1180  const float norResY = resY/errY;
1181 
1182 
1183  // Take global orientation into account for residuals (sign is not important for errors)
1184 
1185  float resXprime(999.F), resYprime(999.F), norResXprime(999.F), norResYprime(999.F);
1186  if(m_tkTreeVar_[rawId].uDirection == 1){
1187  resXprime = resX;
1188  norResXprime = norResX;
1189  }else if(m_tkTreeVar_[rawId].uDirection == -1){
1190  resXprime = -resX;
1191  norResXprime = -norResX;
1192  }else{
1193  edm::LogError("FillHitVariables")<<"Incorrect value of uDirection, which gives global module orientation";
1194  hitParams.hitState = TrackStruct::invalid;
1195  return hitParams;
1196  }
1197  if(m_tkTreeVar_[rawId].vDirection == 1){
1198  resYprime = resY;
1199  norResYprime = norResY;
1200  }else if(m_tkTreeVar_[rawId].vDirection == -1){
1201  resYprime = -resY;
1202  norResYprime = -norResY;
1203  }else{
1204  edm::LogError("FillHitVariables")<<"Incorrect value of vDirection, which gives global module orientation";
1205  hitParams.hitState = TrackStruct::invalid;
1206  return hitParams;
1207  }
1208 
1209  hitParams.xHit = xHit;
1210  hitParams.xTrk = xTrk;
1211 
1212  hitParams.errXHit = errXHit;
1213  hitParams.errXHitWoApe = errXHitWoApe;
1214  hitParams.errXTrk = errXTrk;
1215 
1216  hitParams.errX2 = errX*errX;
1217  hitParams.errX = errX;
1218  hitParams.errXWoApe = errXWoApe;
1219 
1220  hitParams.resX = resXprime;
1221  hitParams.norResX = norResXprime;
1222 
1223  const float norResX2(norResXprime*norResXprime);
1224  hitParams.probX = TMath::Prob(norResX2,1);
1225 
1226 
1227  hitParams.yHit = yHit;
1228  hitParams.yTrk = yTrk;
1229 
1230  hitParams.errYHit = errYHit;
1231  hitParams.errYHitWoApe = errYHitWoApe;
1232  hitParams.errYTrk = errYTrk;
1233 
1234  hitParams.errY2 = errY*errY;
1235  hitParams.errY = errY;
1236  hitParams.errYWoApe = errYWoApe;
1237 
1238  hitParams.resY = resYprime;
1239  hitParams.norResY = norResYprime;
1240 
1241  const float norResY2(norResYprime*norResYprime);
1242  hitParams.probY = TMath::Prob(norResY2,1);
1243 
1244 
1245  // Cluster parameters
1246 
1248  const SiPixelRecHit& pixelHit = dynamic_cast<const SiPixelRecHit&>(recHit);
1249  const SiPixelCluster& pixelCluster = *pixelHit.cluster();
1250 
1251  hitParams.chargePixel = pixelCluster.charge();
1252  hitParams.widthX = pixelCluster.sizeX();
1253  hitParams.baryStripX = pixelCluster.x();
1254  hitParams.widthY = pixelCluster.sizeY();
1255  hitParams.baryStripY = pixelCluster.y();
1256 
1257  hitParams.clusterProbabilityXY = pixelHit.clusterProbability(0);
1258  hitParams.clusterProbabilityQ = pixelHit.clusterProbability(2);
1259  hitParams.clusterProbabilityXYQ = pixelHit.clusterProbability(1);
1260  hitParams.logClusterProbability = std::log10(hitParams.clusterProbabilityXY);
1261 
1262  hitParams.isOnEdge = pixelHit.isOnEdge();
1263  hitParams.hasBadPixels = pixelHit.hasBadPixels();
1264  hitParams.spansTwoRoc = pixelHit.spansTwoROCs();
1265  hitParams.qBin = pixelHit.qBin();
1266 
1267  hitParams.isPixelHit = true;
1268  }else if( m_tkTreeVar_[rawId].subdetId==StripSubdetector::TIB || m_tkTreeVar_[rawId].subdetId==StripSubdetector::TOB ||
1269  m_tkTreeVar_[rawId].subdetId==StripSubdetector::TID || m_tkTreeVar_[rawId].subdetId==StripSubdetector::TEC){
1270  if(!(dynamic_cast<const SiStripRecHit2D*>(&recHit) || dynamic_cast<const SiStripRecHit1D*>(&recHit))){
1271  edm::LogError("FillHitVariables")<<"RecHit in Strip is 'Matched' or 'Projected', but here all should be monohits per module";
1272  hitParams.hitState = TrackStruct::invalid; return hitParams;
1273  }
1274  const SiStripCluster* clusterPtr(nullptr);
1275  if( m_tkTreeVar_[rawId].subdetId==StripSubdetector::TIB || m_tkTreeVar_[rawId].subdetId==StripSubdetector::TOB){
1276  if(dynamic_cast<const SiStripRecHit1D*>(&recHit)){
1277  const SiStripRecHit1D& stripHit = dynamic_cast<const SiStripRecHit1D&>(recHit);
1278  clusterPtr = &(*stripHit.cluster());
1279  }else if(dynamic_cast<const SiStripRecHit2D*>(&recHit)){
1280  edm::LogWarning("FillHitVariables")<<"Data has TIB/TOB hits as SiStripRecHit2D and not 1D. Probably data is processed with CMSSW<34X. Nevertheless everything should work fine";
1281  const SiStripRecHit2D& stripHit = dynamic_cast<const SiStripRecHit2D&>(recHit);
1282  clusterPtr = &(*stripHit.cluster());
1283  }
1284  }else if( m_tkTreeVar_[rawId].subdetId==StripSubdetector::TID || m_tkTreeVar_[rawId].subdetId==StripSubdetector::TEC){
1285  const SiStripRecHit2D& stripHit = dynamic_cast<const SiStripRecHit2D&>(recHit);
1286  clusterPtr = &(*stripHit.cluster());
1287  }
1288  if(!clusterPtr){
1289  edm::LogError("FillHitVariables")<<"Pointer to cluster not valid!!! This should never happen...";
1290  hitParams.hitState = TrackStruct::invalid; return hitParams;
1291  }
1292  const SiStripCluster& stripCluster(*clusterPtr);
1293 
1294  const SiStripClusterInfo clusterInfo =SiStripClusterInfo(stripCluster,iSetup,rawId,std::string(""));
1295 
1296  const std::vector<uint8_t>::const_iterator stripChargeL(clusterInfo.stripCharges().begin());
1297  const std::vector<uint8_t>::const_iterator stripChargeR(--(clusterInfo.stripCharges().end()));
1298  const std::pair<uint16_t, uint16_t> stripChargeLR = std::make_pair(*stripChargeL,*stripChargeR);
1299 
1300  hitParams.chargeStrip = clusterInfo.charge();
1301  hitParams.widthX = clusterInfo.width();
1302  hitParams.baryStripX = clusterInfo.baryStrip() +1.;
1303  hitParams.isModuleUsable = clusterInfo.IsModuleUsable();
1304  hitParams.maxStrip = clusterInfo.maxStrip() +1;
1305  hitParams.maxStripInv = m_tkTreeVar_[rawId].nStrips - hitParams.maxStrip +1;
1306  hitParams.maxCharge = clusterInfo.maxCharge();
1307  hitParams.maxIndex = clusterInfo.maxIndex();
1308  hitParams.chargeOnEdges = static_cast<float>(stripChargeLR.first + stripChargeLR.second)/static_cast<float>(hitParams.chargeStrip);
1309  hitParams.chargeAsymmetry = static_cast<float>(stripChargeLR.first - stripChargeLR.second)/static_cast<float>(stripChargeLR.first + stripChargeLR.second);
1310  hitParams.chargeLRplus = static_cast<float>(clusterInfo.chargeLR().first + clusterInfo.chargeLR().second)/static_cast<float>(hitParams.chargeStrip);
1311  hitParams.chargeLRminus = static_cast<float>(clusterInfo.chargeLR().first - clusterInfo.chargeLR().second)/static_cast<float>(hitParams.chargeStrip);
1312  hitParams.sOverN = clusterInfo.signalOverNoise();
1313 
1314 
1315  // Calculate projection length corrected by drift
1316  if(!hit.detUnit()){
1317  hitParams.hitState = TrackStruct::invalid;
1318  return hitParams;
1319  } // is it a single physical module?
1320  const GeomDetUnit& detUnit = *hit.detUnit();
1321  if(!dynamic_cast<const StripTopology*>(&detUnit.type().topology())){
1322  hitParams.hitState = TrackStruct::invalid;
1323  return hitParams;
1324  }
1325 
1326 
1327  edm::ESHandle<MagneticField> magFieldHandle;
1328  iSetup.get<IdealMagneticFieldRecord>().get(magFieldHandle);
1329 
1330  edm::ESHandle<SiStripLorentzAngle> lorentzAngleHandle;
1331  iSetup.get<SiStripLorentzAngleDepRcd>().get(lorentzAngleHandle); //MODIFIED BY LOIC QUERTENMONT
1332 
1333 
1334  const StripGeomDetUnit * stripDet = (const StripGeomDetUnit*)(&detUnit);
1335  const MagneticField * magField(magFieldHandle.product());
1336  LocalVector bField = (stripDet->surface()).toLocal(magField->inTesla(stripDet->surface().position()));
1337  const SiStripLorentzAngle * lorentzAngle(lorentzAngleHandle.product());
1338  float tanLorentzAnglePerTesla = lorentzAngle->getLorentzAngle(stripDet->geographicalId().rawId());
1339 
1340  float dirX = -tanLorentzAnglePerTesla * bField.y();
1341  float dirY = tanLorentzAnglePerTesla * bField.x();
1342  float dirZ = 1.; // E field always in z direction
1343  LocalVector driftDirection(dirX,dirY,dirZ);
1344 
1345 
1346  const Bounds& bounds = stripDet->specificSurface().bounds();
1347  float maxLength = std::sqrt(std::pow(bounds.length(),2)+std::pow(bounds.width(),2));
1348  float thickness = bounds.thickness();
1349 
1350 
1351 
1352  const StripTopology& topol = dynamic_cast<const StripTopology&>(detUnit.type().topology());
1353  LocalVector momentumDir(tsos.localDirection());
1354  LocalPoint momentumPos(tsos.localPosition());
1355  LocalVector scaledMomentumDir(momentumDir);
1356  if(momentumDir.z() > 0.)scaledMomentumDir *= std::fabs(thickness/momentumDir.z());
1357  else if(momentumDir.z() < 0.)scaledMomentumDir *= -std::fabs(thickness/momentumDir.z());
1358  else scaledMomentumDir *= maxLength/momentumDir.mag();
1359 
1360  float projEdge1 = topol.measurementPosition(momentumPos - 0.5*scaledMomentumDir).x();
1361  if(projEdge1 < 0.)projEdge1 = 0.;
1362  else if(projEdge1 > m_tkTreeVar_[rawId].nStrips)projEdge1 = m_tkTreeVar_[rawId].nStrips;
1363  float projEdge2 = topol.measurementPosition(momentumPos + 0.5*scaledMomentumDir).x();
1364  if(projEdge2 < 0.)projEdge1 = 0.;
1365  else if(projEdge2 > m_tkTreeVar_[rawId].nStrips)projEdge1 = m_tkTreeVar_[rawId].nStrips;
1366 
1367 
1368  float coveredStrips = std::fabs(projEdge2 - projEdge1);
1369 
1370  hitParams.projWidth = coveredStrips;
1371 
1372 
1373  }
1374  else{
1375  edm::LogError("FillHitVariables")<<"Incorrect subdetector ID, hit not associated to tracker";
1376  hitParams.hitState = TrackStruct::notInTracker; return hitParams;
1377  }
1378 
1379 
1380  if(!hitParams.isModuleUsable){
1381  hitParams.hitState = TrackStruct::invalid;
1382  return hitParams;
1383  }
1384 
1385  if(hitParams.v_sector.empty()){
1387  return hitParams;
1388  }
1389 
1390  return hitParams;
1391 //}
1392 }
1393 
1394 
1395 
1399 
1400  const DetId& detId(hit.geographicalId());
1401  const uint32_t& rawId(detId.rawId());
1402  const unsigned int& subdetId(m_tkTreeVar_[rawId].subdetId);
1403 
1404  if(localError.xx()<0. || localError.yy()<0.){
1405  // Do not print error message by default
1406  //edm::LogError("Negative error Value")<<"@SUB=ApeEstimator::fillHitVariables"
1407  // <<"One of the squared error methods gives negative result\n"
1408  // <<"\tSubdetector\tlocalError.xx()\tlocalError.yy()\n"
1409  // <<"\t"<<subdetId<<"\t\t"<<localError.xx()<<"\t"<<localError.yy();
1410  vPE2.first = TrackStruct::negativeError;
1411  return vPE2;
1412  }
1413 
1415  subdetId==StripSubdetector::TIB || subdetId==StripSubdetector::TOB){
1416  // Cartesian coordinates
1417  vPE2 = std::make_pair(TrackStruct::ok, this->rectangularPositionAndError2(localPoint, localError));
1418  }
1419  else if(subdetId==StripSubdetector::TID || subdetId==StripSubdetector::TEC){
1420  // Local x in radial coordinates
1421  if(!hit.detUnit())return vPE2; // is it a single physical module?
1422  const GeomDetUnit& detUnit = *hit.detUnit();
1423 
1424  if(!dynamic_cast<const RadialStripTopology*>(&detUnit.type().topology()))return vPE2;
1425  const RadialStripTopology& topol = dynamic_cast<const RadialStripTopology&>(detUnit.type().topology());
1426 
1427  MeasurementError measError = topol.measurementError(localPoint,localError);
1428  if(measError.uu()<0. || measError.vv()<0.){
1429  // Do not print error message by default
1430  //edm::LogError("Negative error Value")<<"@SUB=ApeEstimator::fillHitVariables"
1431  // <<"One of the squared error methods gives negative result\n"
1432  // <<"\tmeasError.uu()\tmeasError.vv()\n"
1433  // <<"\t"<<measError.uu()<<"\t"<<measError.vv()
1434  // <<"\n\nOriginalValues:\n"
1435  // <<localPoint.x()<<" "<<localPoint.y()<<"\n"
1436  // <<localError.xx()<<" "<<localError.yy()<<"\n"
1437  // <<"Subdet: "<<subdetId;
1438  vPE2.first = TrackStruct::negativeError;
1439  return vPE2;
1440  }
1441  vPE2 = std::make_pair(TrackStruct::ok, this->radialPositionAndError2(localPoint, localError, topol));
1442  }else{
1443  edm::LogError("FillHitVariables")<<"Incorrect subdetector ID, hit not associated to tracker";
1444  }
1445 
1446  return vPE2;
1447 }
1448 
1449 
1450 
1453  const float x(lP.x());
1454  const float y(lP.y());
1455  const float errX2(lE.xx());
1456  const float errY2(lE.yy());
1457 
1458  return PositionAndError2(x, y, errX2, errY2);
1459 }
1460 
1461 
1462 
1465  MeasurementPoint measPos = topol.measurementPosition(lP);
1466  MeasurementError measErr = topol.measurementError(lP,lE);
1467 
1468  const float r_0 = topol.originToIntersection();
1469  const float stripLength = topol.localStripLength(lP);
1470  const float phi = topol.stripAngle(measPos.x());
1471 
1472  float x(-999.F);
1473  float y(-999.F);
1474  float errX2(-999.F);
1475  float errY2(-999.F);
1476 
1477  x = phi*r_0;
1478  // Radial y (not symmetric around 0; radial distance with minimum at middle strip at lower edge [0, yMax])
1479  const float l_0 = r_0 - topol.detHeight()/2;
1480  const float cosPhi(std::cos(phi));
1481  y = measPos.y()*stripLength - 0.5*stripLength + l_0*(1./cosPhi - 1.);
1482 
1483  const float angularWidth2(topol.angularWidth()*topol.angularWidth());
1484  const float errPhi2(measErr.uu()*angularWidth2);
1485 
1486  errX2 = errPhi2*r_0*r_0;
1487  // Radial y (not symmetric around 0, real radial distance from intersection point)
1488  const float cosPhi4(std::pow(cosPhi,4)), sinPhi2(std::sin(phi)*std::sin(phi));
1489  const float helpSummand = l_0*l_0*(sinPhi2/cosPhi4*errPhi2);
1490  errY2 = measErr.vv()*stripLength*stripLength + helpSummand;
1491 
1492  return PositionAndError2(x, y, errX2, errY2);
1493 }
1494 
1495 
1496 
1497 
1498 
1499 // -----------------------------------------------------------------------------------------------------------
1500 
1501 void
1503  this->setHitSelectionMapUInt("width");
1504  this->setHitSelectionMap("widthProj");
1505  this->setHitSelectionMap("widthDiff");
1506  this->setHitSelectionMap("charge");
1507  this->setHitSelectionMapUInt("edgeStrips");
1508  this->setHitSelectionMap("maxCharge");
1509  this->setHitSelectionMapUInt("maxIndex");
1510  this->setHitSelectionMap("chargeOnEdges");
1511  this->setHitSelectionMap("chargeAsymmetry");
1512  this->setHitSelectionMap("chargeLRplus");
1513  this->setHitSelectionMap("chargeLRminus");
1514  this->setHitSelectionMap("sOverN");
1515 
1516  this->setHitSelectionMap("chargePixel");
1517  this->setHitSelectionMapUInt("widthX");
1518  this->setHitSelectionMapUInt("widthY");
1519 
1520  this->setHitSelectionMap("baryStripX");
1521  this->setHitSelectionMap("baryStripY");
1522  this->setHitSelectionMap("clusterProbabilityXY");
1523  this->setHitSelectionMap("clusterProbabilityQ");
1524  this->setHitSelectionMap("clusterProbabilityXYQ");
1525  this->setHitSelectionMap("logClusterProbability");
1526  this->setHitSelectionMapUInt("isOnEdge");
1527  this->setHitSelectionMapUInt("hasBadPixels");
1528  this->setHitSelectionMapUInt("spansTwoRoc");
1529  this->setHitSelectionMapUInt("qBin");
1530 
1531  this->setHitSelectionMap("phiSens");
1532  this->setHitSelectionMap("phiSensX");
1533  this->setHitSelectionMap("phiSensY");
1534  this->setHitSelectionMap("resX");
1535  this->setHitSelectionMap("norResX");
1536  this->setHitSelectionMap("probX");
1537  this->setHitSelectionMap("errXHit");
1538  this->setHitSelectionMap("errXTrk");
1539  this->setHitSelectionMap("errX");
1540  this->setHitSelectionMap("errX2");
1541 
1542  this->setHitSelectionMap("resY");
1543  this->setHitSelectionMap("norResY");
1544  this->setHitSelectionMap("probY");
1545  this->setHitSelectionMap("errYHit");
1546  this->setHitSelectionMap("errYTrk");
1547  this->setHitSelectionMap("errY");
1548  this->setHitSelectionMap("errY2");
1549 
1550  edm::LogInfo("HitSelector")<<"applying hit cuts ...";
1551  bool emptyMap(true);
1552  for(auto & i_hitSelection : m_hitSelection_){
1553  if(!i_hitSelection.second.empty()){
1554  int entry(1); double intervalBegin(999.);
1555  for(std::vector<double>::iterator i_hitInterval = i_hitSelection.second.begin(); i_hitInterval != i_hitSelection.second.end(); ++entry){
1556  if(entry%2==1){
1557  intervalBegin = *i_hitInterval; ++i_hitInterval;
1558  }else{
1559  if(intervalBegin > *i_hitInterval){
1560  edm::LogError("HitSelector")<<"INVALID Interval selected for "<<i_hitSelection.first<<":\t"<<intervalBegin<<" > "<<(*i_hitInterval)
1561  <<"\n ... delete Selection for "<<i_hitSelection.first;
1562  i_hitSelection.second.clear(); i_hitInterval = i_hitSelection.second.begin(); //emptyMap = true; i_hitSelection = m_hitSelection_.begin();
1563  }else{
1564  edm::LogInfo("HitSelector")<<"Interval selected for "<<i_hitSelection.first<<":\t"<<intervalBegin<<", "<<(*i_hitInterval);
1565  ++i_hitInterval;
1566  }
1567  }
1568  }
1569  if(!i_hitSelection.second.empty())emptyMap = false;
1570  }
1571  }
1572 
1573 
1574  bool emptyMapUInt(true);
1575  for(auto & i_hitSelection : m_hitSelectionUInt_){
1576  if(!i_hitSelection.second.empty()){
1577  int entry(1); unsigned int intervalBegin(999);
1578  for(std::vector<unsigned int>::iterator i_hitInterval = i_hitSelection.second.begin(); i_hitInterval != i_hitSelection.second.end(); ++entry){
1579  if(entry%2==1){
1580  intervalBegin = *i_hitInterval;
1581  ++i_hitInterval;
1582  }else{
1583  if(intervalBegin > *i_hitInterval){
1584  edm::LogError("HitSelector")<<"INVALID Interval selected for "<<i_hitSelection.first<<":\t"<<intervalBegin<<" > "<<(*i_hitInterval)
1585  <<"\n ... delete Selection for "<<i_hitSelection.first;
1586  i_hitSelection.second.clear(); i_hitInterval = i_hitSelection.second.begin(); //emptyMap = true; i_hitSelection = m_hitSelection_.begin();
1587  }else{
1588  edm::LogInfo("HitSelector")<<"Interval selected for "<<i_hitSelection.first<<":\t"<<intervalBegin<<", "<<(*i_hitInterval);
1589  ++i_hitInterval;
1590  }
1591  }
1592  }
1593  if(!i_hitSelection.second.empty())emptyMapUInt = false;
1594  }
1595  }
1596 
1597  if(emptyMap && emptyMapUInt){
1598  m_hitSelection_.clear();
1599  m_hitSelectionUInt_.clear();
1600  edm::LogInfo("HitSelector")<<"NO hit cuts applied";
1601  }
1602  return;
1603 }
1604 
1605 
1606 
1607 void
1610  std::vector<double> v_cutVariable(parSet.getParameter<std::vector<double> >(cutVariable));
1611  if(v_cutVariable.size()%2==1){
1612  edm::LogError("HitSelector")<<"Invalid Hit Selection for "<<cutVariable<<": need even number of arguments (intervals)"
1613  <<"\n ... delete Selection for "<<cutVariable;
1614  v_cutVariable.clear();
1615  m_hitSelection_[cutVariable] = v_cutVariable;
1616  return;
1617  }
1618  m_hitSelection_[cutVariable] = v_cutVariable;
1619  return;
1620 }
1621 
1622 
1623 void
1626  std::vector<unsigned int> v_cutVariable(parSet.getParameter<std::vector<unsigned int> >(cutVariable));
1627  if(v_cutVariable.size()%2==1){
1628  edm::LogError("HitSelector")<<"Invalid Hit Selection for "<<cutVariable<<": need even number of arguments (intervals)"
1629  <<"\n ... delete Selection for "<<cutVariable;
1630  v_cutVariable.clear();
1631  m_hitSelectionUInt_[cutVariable] = v_cutVariable;
1632  return;
1633  }
1634  m_hitSelectionUInt_[cutVariable] = v_cutVariable;
1635  return;
1636 }
1637 
1638 
1639 
1640 // -----------------------------------------------------------------------------------------------------------
1641 
1642 bool
1644  if(hitParams.hitState == TrackStruct::notInTracker)return false;
1645  if(hitParams.hitState == TrackStruct::invalid || hitParams.hitState == TrackStruct::negativeError)return false;
1646 
1647  bool isGoodHit(true);
1648  bool isGoodHitX(true);
1649  bool isGoodHitY(true);
1650 
1651  for(auto & i_hitSelection : m_hitSelection_){
1652  const std::string& hitSelection(i_hitSelection.first);
1653  const std::vector<double>& v_hitSelection(i_hitSelection.second);
1654  if(v_hitSelection.empty())continue;
1655 
1656  // For pixel and strip sectors in common
1657  if (hitSelection == "phiSens") {if(!this->inDoubleInterval(v_hitSelection, hitParams.phiSens))isGoodHit = false;}
1658  else if(hitSelection == "phiSensX") {if(!this->inDoubleInterval(v_hitSelection, hitParams.phiSensX))isGoodHit = false;}
1659  else if(hitSelection == "phiSensY") {if(!this->inDoubleInterval(v_hitSelection, hitParams.phiSensY))isGoodHit = false;}
1660 
1661  else if(hitSelection == "resX") {if(!this->inDoubleInterval(v_hitSelection, hitParams.resX))isGoodHitX = false;}
1662  else if(hitSelection == "norResX") {if(!this->inDoubleInterval(v_hitSelection, hitParams.norResX))isGoodHitX = false;}
1663  else if(hitSelection == "probX") {if(!this->inDoubleInterval(v_hitSelection, hitParams.probX))isGoodHitX = false;}
1664  else if(hitSelection == "errXHit") {if(!this->inDoubleInterval(v_hitSelection, hitParams.errXHit))isGoodHitX = false;}
1665  else if(hitSelection == "errXTrk") {if(!this->inDoubleInterval(v_hitSelection, hitParams.errXTrk))isGoodHitX = false;}
1666  else if(hitSelection == "errX") {if(!this->inDoubleInterval(v_hitSelection, hitParams.errX))isGoodHitX = false;}
1667  else if(hitSelection == "errX2") {if(!this->inDoubleInterval(v_hitSelection, hitParams.errX2))isGoodHitX = false;}
1668 
1669  // For pixel only
1670  if(hitParams.isPixelHit){
1671  if (hitSelection == "chargePixel") {if(!this->inDoubleInterval(v_hitSelection, hitParams.chargePixel))isGoodHit = false;}
1672  else if(hitSelection == "clusterProbabilityXY") {if(!this->inDoubleInterval(v_hitSelection, hitParams.clusterProbabilityXY))isGoodHit = false;}
1673  else if(hitSelection == "clusterProbabilityQ") {if(!this->inDoubleInterval(v_hitSelection, hitParams.clusterProbabilityQ))isGoodHit = false;}
1674  else if(hitSelection == "clusterProbabilityXYQ"){if(!this->inDoubleInterval(v_hitSelection, hitParams.clusterProbabilityXYQ))isGoodHit = false;}
1675  else if(hitSelection == "logClusterProbability"){if(!this->inDoubleInterval(v_hitSelection, hitParams.logClusterProbability))isGoodHit = false;}
1676 
1677  else if(hitSelection == "baryStripX") {if(!this->inDoubleInterval(v_hitSelection, hitParams.baryStripX))isGoodHitX = false;}
1678  else if(hitSelection == "baryStripY") {if(!this->inDoubleInterval(v_hitSelection, hitParams.baryStripY))isGoodHitY = false;}
1679 
1680 
1681 
1682  else if(hitSelection == "resY") {if(!this->inDoubleInterval(v_hitSelection, hitParams.resY))isGoodHitY = false;}
1683  else if(hitSelection == "norResY") {if(!this->inDoubleInterval(v_hitSelection, hitParams.norResY))isGoodHitY = false;}
1684  else if(hitSelection == "probY") {if(!this->inDoubleInterval(v_hitSelection, hitParams.probY))isGoodHitY = false;}
1685  else if(hitSelection == "errYHit") {if(!this->inDoubleInterval(v_hitSelection, hitParams.errYHit))isGoodHitY = false;}
1686  else if(hitSelection == "errYTrk") {if(!this->inDoubleInterval(v_hitSelection, hitParams.errYTrk))isGoodHitY = false;}
1687  else if(hitSelection == "errY") {if(!this->inDoubleInterval(v_hitSelection, hitParams.errY))isGoodHitY = false;}
1688  else if(hitSelection == "errY2") {if(!this->inDoubleInterval(v_hitSelection, hitParams.errY2))isGoodHitY = false;}
1689  }else{ // For strip only
1690  if (hitSelection == "widthProj") {if(!this->inDoubleInterval(v_hitSelection, hitParams.projWidth))isGoodHit = false;}
1691  else if(hitSelection == "widthDiff") {if(!this->inDoubleInterval(v_hitSelection, hitParams.projWidth-static_cast<float>(hitParams.widthX)))isGoodHit = false;}
1692  else if(hitSelection == "charge") {if(!this->inDoubleInterval(v_hitSelection, hitParams.chargeStrip))isGoodHit = false;}
1693  else if(hitSelection == "maxCharge") {if(!this->inDoubleInterval(v_hitSelection, hitParams.maxCharge))isGoodHit = false;}
1694  else if(hitSelection == "chargeOnEdges") {if(!this->inDoubleInterval(v_hitSelection, hitParams.chargeOnEdges))isGoodHit = false;}
1695  else if(hitSelection == "chargeAsymmetry"){if(!this->inDoubleInterval(v_hitSelection, hitParams.chargeAsymmetry))isGoodHit = false;}
1696  else if(hitSelection == "chargeLRplus") {if(!this->inDoubleInterval(v_hitSelection, hitParams.chargeLRplus))isGoodHit = false;}
1697  else if(hitSelection == "chargeLRminus") {if(!this->inDoubleInterval(v_hitSelection, hitParams.chargeLRminus))isGoodHit = false;}
1698  else if(hitSelection == "sOverN") {if(!this->inDoubleInterval(v_hitSelection, hitParams.sOverN))isGoodHit = false;}
1699  }
1700  }
1701 
1702  for(auto & i_hitSelection : m_hitSelectionUInt_){
1703  const std::string& hitSelection(i_hitSelection.first);
1704  const std::vector<unsigned int>& v_hitSelection(i_hitSelection.second);
1705  if(v_hitSelection.empty())continue;
1706 
1707  // For pixel and strip sectors in common
1708 
1709  // For pixel only
1710  if(hitParams.isPixelHit){
1711  if(hitSelection == "isOnEdge") {if(!this->inUintInterval(v_hitSelection, hitParams.isOnEdge))isGoodHit = false;}
1712  else if(hitSelection == "hasBadPixels") {if(!this->inUintInterval(v_hitSelection, hitParams.hasBadPixels))isGoodHit = false;}
1713  else if(hitSelection == "spansTwoRoc") {if(!this->inUintInterval(v_hitSelection, hitParams.spansTwoRoc))isGoodHit = false;}
1714  else if(hitSelection == "qBin") {if(!this->inUintInterval(v_hitSelection, hitParams.qBin))isGoodHit = false;}
1715 
1716  else if(hitSelection == "widthX") {if(!this->inUintInterval(v_hitSelection, hitParams.widthX))isGoodHitX = false;}
1717  else if(hitSelection == "widthY") {if(!this->inUintInterval(v_hitSelection, hitParams.widthY))isGoodHitY = false;}
1718  }else{ // For strip only
1719  if (hitSelection == "width") {if(!this->inUintInterval(v_hitSelection, hitParams.widthX))isGoodHit = false;}
1720  else if(hitSelection == "edgeStrips"){if(!this->inUintInterval(v_hitSelection, hitParams.maxStrip, hitParams.maxStripInv))isGoodHit = false;}
1721  else if(hitSelection == "maxIndex") {if(!this->inUintInterval(v_hitSelection, hitParams.maxIndex))isGoodHit = false;}
1722  }
1723  }
1724 
1725  if(hitParams.isPixelHit){
1726  hitParams.goodXMeasurement = isGoodHit && isGoodHitX;
1727  hitParams.goodYMeasurement = isGoodHit && isGoodHitY;
1728  }else{
1729  hitParams.goodXMeasurement = isGoodHit && isGoodHitX;
1730  hitParams.goodYMeasurement = false;
1731  }
1732 
1733  if(!hitParams.goodXMeasurement && !hitParams.goodYMeasurement)return false;
1734  else return true;
1735 }
1736 
1737 
1738 bool
1739 ApeEstimator::inDoubleInterval(const std::vector<double>& v_hitSelection, const float variable)const{
1740  int entry(0); double intervalBegin(999.);
1741  bool isSelected(false);
1742  for(auto const & i_hitInterval : v_hitSelection){
1743  ++entry;
1744  if(entry%2==1)intervalBegin = i_hitInterval;
1745  else if(variable>=intervalBegin && variable<i_hitInterval)isSelected = true;
1746  }
1747  return isSelected;
1748 }
1749 
1750 
1751 bool
1752 ApeEstimator::inUintInterval(const std::vector<unsigned int>& v_hitSelection, const unsigned int variable, const unsigned int variable2)const{
1753  int entry(0); unsigned int intervalBegin(999);
1754  bool isSelected(false);
1755  for(auto i_hitInterval : v_hitSelection ){
1756  ++entry;
1757  if(entry%2==1)intervalBegin = i_hitInterval;
1758  else if(variable>=intervalBegin && variable<=i_hitInterval){
1759  if(variable2==999 || (variable2>=intervalBegin && variable2<=i_hitInterval))isSelected = true;
1760  }
1761  }
1762  return isSelected;
1763 }
1764 
1765 
1766 
1767 // -----------------------------------------------------------------------------------------------------------
1768 
1769 
1770 void
1772  unsigned int goodHitsPerTrack(trackStruct.v_hitParams.size());
1773  tkDetector_.HitsGood->Fill(goodHitsPerTrack);
1774  tkDetector_.HitsGoodVsHitsValid->Fill(trackStruct.trkParams.hitsValid,goodHitsPerTrack);
1775  tkDetector_.PHitsGoodVsHitsValid->Fill(trackStruct.trkParams.hitsValid,goodHitsPerTrack);
1776 
1777  if(parameterSet_.getParameter<bool>("applyTrackCuts")){
1778  // which tracks to take? need min. nr. of selected hits?
1779  if(goodHitsPerTrack < minGoodHitsPerTrack_)return;
1780  }
1781 
1782  tkDetector_.HitsSize ->Fill(trackStruct.trkParams.hitsSize);
1783  tkDetector_.HitsValid ->Fill(trackStruct.trkParams.hitsValid);
1784  tkDetector_.HitsInvalid ->Fill(trackStruct.trkParams.hitsInvalid);
1785  tkDetector_.Hits2D ->Fill(trackStruct.trkParams.hits2D);
1786  tkDetector_.LayersMissed ->Fill(trackStruct.trkParams.layersMissed);
1787  tkDetector_.HitsPixel ->Fill(trackStruct.trkParams.hitsPixel);
1788  tkDetector_.HitsStrip ->Fill(trackStruct.trkParams.hitsStrip);
1789  tkDetector_.Charge ->Fill(trackStruct.trkParams.charge);
1790  tkDetector_.Chi2 ->Fill(trackStruct.trkParams.chi2);
1791  tkDetector_.Ndof ->Fill(trackStruct.trkParams.ndof);
1792  tkDetector_.NorChi2 ->Fill(trackStruct.trkParams.norChi2);
1793  tkDetector_.Prob ->Fill(trackStruct.trkParams.prob);
1794  tkDetector_.Eta ->Fill(trackStruct.trkParams.eta);
1795  tkDetector_.EtaErr ->Fill(trackStruct.trkParams.etaErr);
1796  tkDetector_.EtaSig ->Fill(trackStruct.trkParams.eta/trackStruct.trkParams.etaErr);
1797  tkDetector_.Theta ->Fill(trackStruct.trkParams.theta*180./M_PI);
1798  tkDetector_.Phi ->Fill(trackStruct.trkParams.phi*180./M_PI);
1799  tkDetector_.PhiErr ->Fill(trackStruct.trkParams.phiErr*180./M_PI);
1800  tkDetector_.PhiSig ->Fill(trackStruct.trkParams.phi/trackStruct.trkParams.phiErr);
1801  tkDetector_.D0Beamspot ->Fill(trackStruct.trkParams.d0Beamspot);
1802  tkDetector_.D0BeamspotErr->Fill(trackStruct.trkParams.d0BeamspotErr);
1803  tkDetector_.D0BeamspotSig->Fill(trackStruct.trkParams.d0Beamspot/trackStruct.trkParams.d0BeamspotErr);
1804  tkDetector_.Dz ->Fill(trackStruct.trkParams.dz);
1805  tkDetector_.DzErr ->Fill(trackStruct.trkParams.dzErr);
1806  tkDetector_.DzSig ->Fill(trackStruct.trkParams.dz/trackStruct.trkParams.dzErr);
1807  tkDetector_.P ->Fill(trackStruct.trkParams.p);
1808  tkDetector_.Pt ->Fill(trackStruct.trkParams.pt);
1809  tkDetector_.PtErr ->Fill(trackStruct.trkParams.ptErr);
1810  tkDetector_.PtSig ->Fill(trackStruct.trkParams.pt/trackStruct.trkParams.ptErr);
1811  tkDetector_.MeanAngle ->Fill(trackStruct.trkParams.meanPhiSensToNorm*180./M_PI);
1812 
1813  tkDetector_.MeanAngleVsHits ->Fill(trackStruct.trkParams.hitsSize,trackStruct.trkParams.meanPhiSensToNorm*180./M_PI);
1814  tkDetector_.HitsPixelVsEta ->Fill(trackStruct.trkParams.eta,trackStruct.trkParams.hitsPixel);
1815  tkDetector_.HitsPixelVsTheta->Fill(trackStruct.trkParams.theta*180./M_PI,trackStruct.trkParams.hitsPixel);
1816  tkDetector_.HitsStripVsEta ->Fill(trackStruct.trkParams.eta,trackStruct.trkParams.hitsStrip);
1817  tkDetector_.HitsStripVsTheta->Fill(trackStruct.trkParams.theta*180./M_PI,trackStruct.trkParams.hitsStrip);
1818  tkDetector_.PtVsEta ->Fill(trackStruct.trkParams.eta,trackStruct.trkParams.pt);
1819  tkDetector_.PtVsTheta ->Fill(trackStruct.trkParams.theta*180./M_PI,trackStruct.trkParams.pt);
1820 
1821  tkDetector_.PMeanAngleVsHits ->Fill(trackStruct.trkParams.hitsSize,trackStruct.trkParams.meanPhiSensToNorm*180./M_PI);
1822  tkDetector_.PHitsPixelVsEta ->Fill(trackStruct.trkParams.eta,trackStruct.trkParams.hitsPixel);
1823  tkDetector_.PHitsPixelVsTheta->Fill(trackStruct.trkParams.theta*180./M_PI,trackStruct.trkParams.hitsPixel);
1824  tkDetector_.PHitsStripVsEta ->Fill(trackStruct.trkParams.eta,trackStruct.trkParams.hitsStrip);
1825  tkDetector_.PHitsStripVsTheta->Fill(trackStruct.trkParams.theta*180./M_PI,trackStruct.trkParams.hitsStrip);
1826  tkDetector_.PPtVsEta ->Fill(trackStruct.trkParams.eta,trackStruct.trkParams.pt);
1827  tkDetector_.PPtVsTheta ->Fill(trackStruct.trkParams.theta*180./M_PI,trackStruct.trkParams.pt);
1828 
1829 
1830  for(auto & i_hit : trackStruct.v_hitParams){
1831  const TrackStruct::HitParameterStruct& hit(i_hit);
1832  //Put here from earlier method
1833  if(hit.hitState == TrackStruct::notAssignedToSectors)continue;
1834 
1835  for(auto & i_sector : m_tkSector_){
1836  bool moduleInSector(false);
1837  for(auto const & i_hitSector : hit.v_sector){
1838  if(i_sector.first == i_hitSector){
1839  moduleInSector = true;
1840  break;
1841  }
1842  }
1843  if(!moduleInSector)continue;
1844  TrackerSectorStruct& sector(i_sector.second);
1845 
1846  if(hit.goodXMeasurement){
1847  std::map<std::string,TrackerSectorStruct::CorrelationHists>& m_corrHists(sector.m_correlationHistsX);
1848 
1849  // Cluster and Hit Parameters
1850  this->fillHitHistsXForAnalyzerMode(hit, sector);
1851 
1852  // Track Parameters
1853  m_corrHists["HitsValid"].fillCorrHistsX(hit,trackStruct.trkParams.hitsValid);
1854  m_corrHists["HitsGood"].fillCorrHistsX(hit,goodHitsPerTrack);
1855  m_corrHists["HitsInvalid"].fillCorrHistsX(hit,trackStruct.trkParams.hitsInvalid);
1856  m_corrHists["Hits2D"].fillCorrHistsX(hit,trackStruct.trkParams.hits2D);
1857  m_corrHists["LayersMissed"].fillCorrHistsX(hit,trackStruct.trkParams.layersMissed);
1858  m_corrHists["HitsPixel"].fillCorrHistsX(hit,trackStruct.trkParams.hitsPixel);
1859  m_corrHists["HitsStrip"].fillCorrHistsX(hit,trackStruct.trkParams.hitsStrip);
1860  m_corrHists["NorChi2"].fillCorrHistsX(hit,trackStruct.trkParams.norChi2);
1861  m_corrHists["Theta"].fillCorrHistsX(hit,trackStruct.trkParams.theta*180./M_PI);
1862  m_corrHists["Phi"].fillCorrHistsX(hit,trackStruct.trkParams.phi*180./M_PI);
1863  m_corrHists["D0Beamspot"].fillCorrHistsX(hit,trackStruct.trkParams.d0Beamspot);
1864  m_corrHists["Dz"].fillCorrHistsX(hit,trackStruct.trkParams.dz);
1865  m_corrHists["Pt"].fillCorrHistsX(hit,trackStruct.trkParams.pt);
1866  m_corrHists["P"].fillCorrHistsX(hit,trackStruct.trkParams.p);
1867  m_corrHists["InvP"].fillCorrHistsX(hit,1./trackStruct.trkParams.p);
1868  m_corrHists["MeanAngle"].fillCorrHistsX(hit,trackStruct.trkParams.meanPhiSensToNorm*180./M_PI);
1869  }
1870 
1871  if(hit.goodYMeasurement){
1872  std::map<std::string,TrackerSectorStruct::CorrelationHists>& m_corrHists(sector.m_correlationHistsY);
1873 
1874  // Cluster and Hit Parameters
1875  this->fillHitHistsYForAnalyzerMode(hit, sector);
1876 
1877  // Track Parameters
1878  m_corrHists["HitsValid"].fillCorrHistsY(hit,trackStruct.trkParams.hitsValid);
1879  m_corrHists["HitsGood"].fillCorrHistsY(hit,goodHitsPerTrack);
1880  m_corrHists["HitsInvalid"].fillCorrHistsY(hit,trackStruct.trkParams.hitsInvalid);
1881  m_corrHists["Hits2D"].fillCorrHistsY(hit,trackStruct.trkParams.hits2D);
1882  m_corrHists["LayersMissed"].fillCorrHistsY(hit,trackStruct.trkParams.layersMissed);
1883  m_corrHists["HitsPixel"].fillCorrHistsY(hit,trackStruct.trkParams.hitsPixel);
1884  m_corrHists["HitsStrip"].fillCorrHistsY(hit,trackStruct.trkParams.hitsStrip);
1885  m_corrHists["NorChi2"].fillCorrHistsY(hit,trackStruct.trkParams.norChi2);
1886  m_corrHists["Theta"].fillCorrHistsY(hit,trackStruct.trkParams.theta*180./M_PI);
1887  m_corrHists["Phi"].fillCorrHistsY(hit,trackStruct.trkParams.phi*180./M_PI);
1888  m_corrHists["D0Beamspot"].fillCorrHistsY(hit,trackStruct.trkParams.d0Beamspot);
1889  m_corrHists["Dz"].fillCorrHistsY(hit,trackStruct.trkParams.dz);
1890  m_corrHists["Pt"].fillCorrHistsY(hit,trackStruct.trkParams.pt);
1891  m_corrHists["P"].fillCorrHistsY(hit,trackStruct.trkParams.p);
1892  m_corrHists["InvP"].fillCorrHistsY(hit,1./trackStruct.trkParams.p);
1893  m_corrHists["MeanAngle"].fillCorrHistsY(hit,trackStruct.trkParams.meanPhiSensToNorm*180./M_PI);
1894  }
1895 
1896  // Special Histograms
1897  for(auto & i_sigmaX : sector.m_sigmaX){
1898  for(auto & iHist : i_sigmaX.second){
1899  if (i_sigmaX.first=="sigmaXHit") iHist->Fill(hit.errXHit*10000.);
1900  else if(i_sigmaX.first=="sigmaXTrk") iHist->Fill(hit.errXTrk*10000.);
1901  else if(i_sigmaX.first=="sigmaX") iHist->Fill(hit.errX*10000.);
1902  }
1903  }
1904  for(auto & i_sigmaY : sector.m_sigmaY){
1905  for(auto & iHist : i_sigmaY.second){
1906  if (i_sigmaY.first=="sigmaYHit") iHist->Fill(hit.errYHit*10000.);
1907  else if(i_sigmaY.first=="sigmaYTrk") iHist->Fill(hit.errYTrk*10000.);
1908  else if(i_sigmaY.first=="sigmaY") iHist->Fill(hit.errY*10000.);
1909  }
1910  }
1911  }
1912  }
1913 }
1914 
1915 
1916 
1917 void
1919  std::map<std::string, TrackerSectorStruct::CorrelationHists>& m_corrHists(sector.m_correlationHistsX);
1920 
1921  // Cluster Parameters
1922  m_corrHists["WidthX"].fillCorrHistsX(hit, hit.widthX);
1923  m_corrHists["BaryStripX"].fillCorrHistsX(hit, hit.baryStripX);
1924 
1925  if(hit.isPixelHit){
1926  m_corrHists["ChargePixel"].fillCorrHistsX(hit, hit.chargePixel);
1927  m_corrHists["ClusterProbXY"].fillCorrHistsX(hit, hit.clusterProbabilityXY);
1928  m_corrHists["ClusterProbQ"].fillCorrHistsX(hit, hit.clusterProbabilityQ);
1929  m_corrHists["ClusterProbXYQ"].fillCorrHistsX(hit, hit.clusterProbabilityXYQ);
1930  m_corrHists["LogClusterProb"].fillCorrHistsX(hit, hit.logClusterProbability);
1931  m_corrHists["IsOnEdge"].fillCorrHistsX(hit, hit.isOnEdge);
1932  m_corrHists["HasBadPixels"].fillCorrHistsX(hit, hit.hasBadPixels);
1933  m_corrHists["SpansTwoRoc"].fillCorrHistsX(hit, hit.spansTwoRoc);
1934  m_corrHists["QBin"].fillCorrHistsX(hit, hit.qBin);
1935 
1936  }else{
1937  m_corrHists["ChargeStrip"].fillCorrHistsX(hit, hit.chargeStrip);
1938  m_corrHists["MaxStrip"].fillCorrHistsX(hit, hit.maxStrip);
1939  m_corrHists["MaxCharge"].fillCorrHistsX(hit, hit.maxCharge);
1940  m_corrHists["MaxIndex"].fillCorrHistsX(hit, hit.maxIndex);
1941  m_corrHists["ChargeOnEdges"].fillCorrHistsX(hit, hit.chargeOnEdges);
1942  m_corrHists["ChargeAsymmetry"].fillCorrHistsX(hit, hit.chargeAsymmetry);
1943  m_corrHists["ChargeLRplus"].fillCorrHistsX(hit, hit.chargeLRplus);
1944  m_corrHists["ChargeLRminus"].fillCorrHistsX(hit, hit.chargeLRminus);
1945  m_corrHists["SOverN"].fillCorrHistsX(hit, hit.sOverN);
1946  m_corrHists["WidthProj"].fillCorrHistsX(hit, hit.projWidth);
1947  m_corrHists["WidthDiff"].fillCorrHistsX(hit, hit.projWidth-static_cast<float>( hit.widthX));
1948 
1949  sector.WidthVsWidthProjected->Fill( hit.projWidth, hit.widthX);
1950  sector.PWidthVsWidthProjected->Fill( hit.projWidth, hit.widthX);
1951 
1952  sector.WidthDiffVsMaxStrip->Fill( hit.maxStrip, hit.projWidth-static_cast<float>( hit.widthX));
1953  sector.PWidthDiffVsMaxStrip->Fill( hit.maxStrip, hit.projWidth-static_cast<float>( hit.widthX));
1954 
1955  sector.WidthDiffVsSigmaXHit->Fill( hit.errXHit, hit.projWidth-static_cast<float>( hit.widthX));
1956  sector.PWidthDiffVsSigmaXHit->Fill( hit.errXHit, hit.projWidth-static_cast<float>( hit.widthX));
1957 
1958  sector.WidthVsPhiSensX->Fill( hit.phiSensX*180./M_PI, hit.widthX);
1959  sector.PWidthVsPhiSensX->Fill( hit.phiSensX*180./M_PI, hit.widthX);
1960  }
1961 
1962  // Hit Parameters
1963  m_corrHists["SigmaXHit"].fillCorrHistsX(hit, hit.errXHit*10000.);
1964  m_corrHists["SigmaXTrk"].fillCorrHistsX(hit, hit.errXTrk*10000.);
1965  m_corrHists["SigmaX"].fillCorrHistsX(hit, hit.errX*10000.);
1966 
1967  m_corrHists["PhiSens"].fillCorrHistsX(hit, hit.phiSens*180./M_PI);
1968  m_corrHists["PhiSensX"].fillCorrHistsX(hit, hit.phiSensX*180./M_PI);
1969  m_corrHists["PhiSensY"].fillCorrHistsX(hit, hit.phiSensY*180./M_PI);
1970 
1971  sector.XHit ->Fill(hit.xHit);
1972  sector.XTrk ->Fill(hit.xTrk);
1973  sector.SigmaX2->Fill(hit.errX2*10000.*10000.);
1974 
1975  sector.ResX ->Fill(hit.resX*10000.);
1976  sector.NorResX->Fill(hit.norResX);
1977 
1978  sector.ProbX->Fill(hit.probX);
1979 
1980  sector.PhiSensXVsBarycentreX->Fill(hit.baryStripX, hit.phiSensX*180./M_PI);
1981  sector.PPhiSensXVsBarycentreX->Fill(hit.baryStripX, hit.phiSensX*180./M_PI);
1982 }
1983 
1984 
1985 
1986 void
1988  std::map<std::string, TrackerSectorStruct::CorrelationHists>& m_corrHists(sector.m_correlationHistsY);
1989  // Do not fill anything for strip
1990  if(!hit.isPixelHit)return;
1991 
1992  // Cluster Parameters
1993  m_corrHists["WidthY"].fillCorrHistsY(hit,hit.widthY);
1994  m_corrHists["BaryStripY"].fillCorrHistsY(hit,hit.baryStripY);
1995 
1996  m_corrHists["ChargePixel"].fillCorrHistsY(hit, hit.chargePixel);
1997  m_corrHists["ClusterProbXY"].fillCorrHistsY(hit, hit.clusterProbabilityXY);
1998  m_corrHists["ClusterProbQ"].fillCorrHistsY(hit, hit.clusterProbabilityQ);
1999  m_corrHists["ClusterProbXYQ"].fillCorrHistsY(hit, hit.clusterProbabilityXYQ);
2000  m_corrHists["LogClusterProb"].fillCorrHistsY(hit, hit.logClusterProbability);
2001  m_corrHists["IsOnEdge"].fillCorrHistsY(hit, hit.isOnEdge);
2002  m_corrHists["HasBadPixels"].fillCorrHistsY(hit, hit.hasBadPixels);
2003  m_corrHists["SpansTwoRoc"].fillCorrHistsY(hit, hit.spansTwoRoc);
2004  m_corrHists["QBin"].fillCorrHistsY(hit, hit.qBin);
2005 
2006  // Hit Parameters
2007  m_corrHists["SigmaYHit"].fillCorrHistsY(hit, hit.errYHit*10000.);
2008  m_corrHists["SigmaYTrk"].fillCorrHistsY(hit, hit.errYTrk*10000.);
2009  m_corrHists["SigmaY"].fillCorrHistsY(hit, hit.errY*10000.);
2010 
2011  m_corrHists["PhiSens"].fillCorrHistsY(hit, hit.phiSens*180./M_PI);
2012  m_corrHists["PhiSensX"].fillCorrHistsY(hit, hit.phiSensX*180./M_PI);
2013  m_corrHists["PhiSensY"].fillCorrHistsY(hit, hit.phiSensY*180./M_PI);
2014 
2015  sector.YHit ->Fill(hit.yHit);
2016  sector.YTrk ->Fill(hit.yTrk);
2017  sector.SigmaY2->Fill(hit.errY2*10000.*10000.);
2018 
2019  sector.ResY ->Fill(hit.resY*10000.);
2020  sector.NorResY->Fill(hit.norResY);
2021 
2022  sector.ProbY->Fill(hit.probY);
2023 
2024  sector.PhiSensYVsBarycentreY->Fill(hit.baryStripY, hit.phiSensY*180./M_PI);
2025  sector.PPhiSensYVsBarycentreY->Fill(hit.baryStripY, hit.phiSensY*180./M_PI);
2026 }
2027 
2028 
2029 
2030 void
2032  unsigned int goodHitsPerTrack(trackStruct.v_hitParams.size());
2033 
2034  if(parameterSet_.getParameter<bool>("applyTrackCuts")){
2035  // which tracks to take? need min. nr. of selected hits?
2036  if(goodHitsPerTrack < minGoodHitsPerTrack_)return;
2037  }
2038 
2039  for(auto const & i_hit : trackStruct.v_hitParams){
2040  // Put here from earlier method
2041  if(i_hit.hitState == TrackStruct::notAssignedToSectors)continue;
2042 
2043  for(auto & i_sector : m_tkSector_){
2044 
2045  bool moduleInSector(false);
2046  for(auto const & i_hitSector : i_hit.v_sector){
2047  if(i_sector.first == i_hitSector){
2048  moduleInSector = true;
2049  break;
2050  }
2051  }
2052  if(!moduleInSector)continue;
2053 
2054  if(!calculateApe_)continue;
2055 
2056  if(i_hit.goodXMeasurement){
2057  for(auto const & i_errBins : m_resErrBins_){
2058  // Separate the bins for residual resolution w/o APE, to be consistent within iterations where APE will change (have same hit always in same bin)
2059  // So also fill this value in the histogram sigmaX
2060  // But of course use the normalized residual regarding the APE to have its influence in its width
2061  if(i_hit.errXWoApe < i_errBins.second.first || i_hit.errXWoApe >= i_errBins.second.second){
2062  continue;
2063  }
2064  i_sector.second.m_binnedHists[i_errBins.first]["sigmaX"] ->Fill(i_hit.errXWoApe);
2065  i_sector.second.m_binnedHists[i_errBins.first]["norResX"]->Fill(i_hit.norResX);
2066  break;
2067  }
2068  i_sector.second.ResX->Fill(i_hit.resX*10000.);
2069  i_sector.second.NorResX->Fill(i_hit.norResX);
2070  }
2071 
2072  if(i_hit.goodYMeasurement){
2073  for(auto const & i_errBins : m_resErrBins_){
2074  // Separate the bins for residual resolution w/o APE, to be consistent within iterations where APE will change (have same hit always in same bin)
2075  // So also fill this value in the histogram sigmaY
2076  // But of course use the normalized residual regarding the APE to have its influence in its width
2077  if(i_hit.errYWoApe < i_errBins.second.first || i_hit.errYWoApe >= i_errBins.second.second){
2078  continue;
2079  }
2080  i_sector.second.m_binnedHists[i_errBins.first]["sigmaY"] ->Fill(i_hit.errYWoApe);
2081  i_sector.second.m_binnedHists[i_errBins.first]["norResY"]->Fill(i_hit.norResY);
2082  break;
2083  }
2084  i_sector.second.ResY->Fill(i_hit.resY*10000.);
2085  i_sector.second.NorResY->Fill(i_hit.norResY);
2086  }
2087  }
2088  }
2089 }
2090 
2091 
2092 
2093 
2094 // -----------------------------------------------------------------------------------------------------------
2095 
2096 
2097 
2098 void
2100  // Loop over sectors for calculating APE
2101  for(auto & i_sector : m_tkSector_){
2102 
2103  // Loop over residual error bins to calculate APE for every bin
2104  for(auto const & i_errBins : i_sector.second.m_binnedHists){
2105  std::map<std::string,TH1*> m_Hists = i_errBins.second;
2106 
2107  // Fitting Parameters
2108  double integralX = m_Hists["norResX"]->Integral();
2109  i_sector.second.EntriesX->SetBinContent(i_errBins.first, integralX);
2110 
2111  if(i_sector.second.isPixel){
2112  double integralY = m_Hists["norResY"]->Integral();
2113  i_sector.second.EntriesY->SetBinContent(i_errBins.first, integralY);
2114  }
2115  }
2116  }
2117 }
2118 
2119 
2120 
2121 
2122 // -----------------------------------------------------------------------------------------------------------
2123 
2124 
2125 bool
2127 {
2128  // we count SiStrip stereo modules as 2D if selected via countStereoHitAs2D_
2129  // (since they provide theta information)
2130  // --- NO, here it is always set to true ---
2131  if(!hit.isValid() || (hit.dimension() < 2 && !dynamic_cast<const SiStripRecHit1D*>(&hit))){
2132  return false; // real RecHit1D - but SiStripRecHit1D depends on countStereoHitAs2D_
2133  }else{
2134  const DetId detId(hit.geographicalId());
2135  if(detId.det() == DetId::Tracker) {
2136  if(detId.subdetId() == PixelSubdetector::PixelBarrel || detId.subdetId() == PixelSubdetector::PixelEndcap) {
2137  return true; // pixel is always 2D
2138  }else{ // should be SiStrip now
2139  const SiStripDetId stripId(detId);
2140  if (stripId.stereo()) return true; // stereo modules
2141  else if (dynamic_cast<const SiStripRecHit1D*>(&hit) || dynamic_cast<const SiStripRecHit2D*>(&hit)) return false; // rphi modules hit
2142  //the following two are not used any more since ages...
2143  else if (dynamic_cast<const SiStripMatchedRecHit2D*>(&hit)) return true; // matched is 2D
2144  else if (dynamic_cast<const ProjectedSiStripRecHit2D*>(&hit)) {
2145  const ProjectedSiStripRecHit2D* pH = static_cast<const ProjectedSiStripRecHit2D*>(&hit);
2146  return (this->isHit2D(pH->originalHit())); // depends on original...
2147  }else{
2148  edm::LogError("UnkownType") << "@SUB=AlignmentTrackSelector::isHit2D"
2149  << "Tracker hit not in pixel, neither SiStripRecHit[12]D nor "
2150  << "SiStripMatchedRecHit2D nor ProjectedSiStripRecHit2D.";
2151  return false;
2152  }
2153  }
2154  }else{ // not tracker??
2155  edm::LogWarning("DetectorMismatch") << "@SUB=AlignmentTrackSelector::isHit2D"
2156  << "Hit not in tracker with 'official' dimension >=2.";
2157  return true; // dimension() >= 2 so accept that...
2158  }
2159  }
2160  // never reached...
2161 }
2162 
2163 
2164 
2165 // -----------------------------------------------------------------------------------------------------------
2166 
2167 // ------------ method called to for each event ------------
2168 void
2170 {
2172  edm::Handle<reco::BeamSpot> beamSpotHandle;
2173  iEvent.getByToken(offlinebeamSpot_, beamSpotHandle);
2174 
2175  if (beamSpotHandle.isValid()){
2176  beamSpot = *beamSpotHandle;
2177  }else{
2178  edm::LogError("ApeEstimator")<<"No beam spot available from EventSetup"
2179  <<"\n...skip event";
2180  return;
2181  }
2182 
2184  iEvent.getByToken(tjTagToken_, m_TrajTracksMap);
2185 
2186  if(analyzerMode_)tkDetector_.TrkSize->Fill(m_TrajTracksMap->size());
2187 
2188  if(maxTracksPerEvent_!=0 && m_TrajTracksMap->size()>maxTracksPerEvent_)return;
2189 
2190  //Creation of (traj,track)
2191  typedef std::pair<const Trajectory*, const reco::Track*> ConstTrajTrackPair;
2192  typedef std::vector<ConstTrajTrackPair> ConstTrajTrackPairCollection;
2193  ConstTrajTrackPairCollection trajTracks;
2194 
2196  for(i_trajTrack = m_TrajTracksMap->begin();i_trajTrack != m_TrajTracksMap->end();++i_trajTrack){
2197  trajTracks.push_back(ConstTrajTrackPair(&(*(*i_trajTrack).key), &(*(*i_trajTrack).val)));
2198  }
2199 
2200 
2201  //Loop over Tracks & Hits
2202  unsigned int trackSizeGood(0);
2203  ConstTrajTrackPairCollection::const_iterator iTrack;
2204  for(iTrack = trajTracks.begin(); iTrack != trajTracks.end();++iTrack){
2205 
2206  const Trajectory *traj = (*iTrack).first;
2207  const reco::Track *track = (*iTrack).second;
2208 
2209  TrackStruct trackStruct;
2210  trackStruct.trkParams = this->fillTrackVariables(*track, *traj, beamSpot);
2211 
2212  if(trackCut_)continue;
2213 
2214  const std::vector<TrajectoryMeasurement> v_meas = (*traj).measurements();
2215 
2216  //Loop over Hits
2217  for(std::vector<TrajectoryMeasurement>::const_iterator i_meas = v_meas.begin(); i_meas != v_meas.end(); ++i_meas){
2218  TrackStruct::HitParameterStruct hitParams = this->fillHitVariables(*i_meas, iSetup);
2219  if(this->hitSelected(hitParams))trackStruct.v_hitParams.push_back(hitParams);
2220  }
2221 
2222  if(analyzerMode_)this->fillHistsForAnalyzerMode(trackStruct);
2223  if(calculateApe_)this->fillHistsForApeCalculation(trackStruct);
2224 
2225  if(!trackStruct.v_hitParams.empty())++trackSizeGood;
2226  }
2227  if(analyzerMode_ && trackSizeGood>0)tkDetector_.TrkSizeGood->Fill(trackSizeGood);
2228 }
2229 
2230 
2231 // ------------ method called once each job just before starting event loop ------------
2232 void
2234  this->hitSelection();
2235 
2236  this->sectorBuilder();
2237 
2238  this->residualErrorBinning();
2239 
2241 
2243 
2244  if(analyzerMode_)this->bookTrackHists();
2245 
2246 
2247 }
2248 
2249 // ------------ method called once each job just after ending the event loop ------------
2250 void
2252  if(calculateApe_)this->calculateAPE();
2253 
2254  edm::LogInfo("HitSelector")<<"\nThere are "<<counter1<< " negative Errors calculated\n";
2255 }
2256 
2257 //define this as a plug-in
ClusterRef cluster() const
virtual const Topology & topology() const =0
uint8_t maxCharge() const
double p() const
momentum vector magnitude
Definition: TrackBase.h:648
bool valid() const
Definition: LocalError.h:21
bool inDoubleInterval(const std::vector< double > &, const float) const
T getParameter(std::string const &) const
double z0() const
z coordinate
Definition: BeamSpot.h:68
std::vector< unsigned int > v_sector
virtual float angularWidth() const =0
const edm::ParameterSet parameterSet_
float xx() const
Definition: LocalError.h:24
double d0Error() const
error on d0
Definition: TrackBase.h:847
virtual float length() const =0
void hitSelection()
float vv() const
unsigned short lost() const
Number of lost (=invalid) hits on track.
Definition: Track.h:201
float clusterProbability(unsigned int flags=0) const
T y() const
Definition: PV2DBase.h:46
ConstRecHitPointer const & recHit() const
void bookSectorHistsForAnalyzerMode()
double d0() const
dxy parameter in perigee convention (d0 = -dxy)
Definition: TrackBase.h:630
uint32_t stereo() const
Definition: SiStripDetId.h:160
virtual const GeomDetType & type() const
Definition: GeomDet.cc:85
const_iterator end() const
last iterator over the map (read only)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
std::pair< uint16_t, uint16_t > chargeLR() const
virtual float originToIntersection() const =0
double theta() const
polar angle
Definition: TrackBase.h:612
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
size_t recHitsSize() const
Get number of RecHits. (Warning, this includes invalid hits, which are not physical hits)...
Definition: Track.h:121
std::map< std::string, std::vector< TH1 * > > m_sigmaY
LocalVector localDirection() const
ApeEstimator(const edm::ParameterSet &)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
const bool calculateApe_
std::map< std::string, std::vector< TH1 * > > m_sigmaX
void sectorBuilder()
unsigned int counter1
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
float baryStrip() const
T y() const
Definition: PV3DBase.h:63
double etaError() const
error on eta
Definition: TrackBase.h:829
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:678
const Bounds & bounds() const
Definition: Surface.h:120
~ApeEstimator() override
int charge() const
PositionAndError2 radialPositionAndError2(const LocalPoint &, const LocalError &, const RadialStripTopology &)
unsigned int counter3
void fillHitHistsYForAnalyzerMode(const TrackStruct::HitParameterStruct &, TrackerSectorStruct &)
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
unsigned int counter4
uint16_t maxIndex() const
auto stripCharges() const -> decltype(cluster() ->amplitudes())
void calculateAPE()
bool isOnEdge() const
PositionAndError2 rectangularPositionAndError2(const LocalPoint &, const LocalError &)
TrackerDetectorStruct tkDetector_
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
LocalError positionError() const
const unsigned int maxTracksPerEvent_
bool hasBadPixels() const
TrackStruct::HitParameterStruct fillHitVariables(const TrajectoryMeasurement &, const edm::EventSetup &)
std::map< unsigned int, std::pair< double, double > > m_resErrBins_
std::pair< TrackStruct::HitState, PositionAndError2 > StatePositionAndError2
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
void residualErrorBinning()
const bool analyzerMode_
virtual float width() const =0
float localStripLength(const LocalPoint &) const override=0
DataContainer const & measurements() const
Definition: Trajectory.h:196
float signalOverNoise() const
float xy() const
Definition: LocalError.h:25
int iEvent
Definition: GenABIO.cc:230
float getLorentzAngle(const uint32_t &) const
TProfile * PPhiSensXVsBarycentreX
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:684
std::vector< HitParameterStruct > v_hitParams
uint16_t charge() const
float yy() const
Definition: LocalError.h:26
double chi2() const
chi-squared of the fit
Definition: TrackBase.h:582
float stripAngle(float strip) const override=0
double ndof() const
number of degrees of freedom of the fit
Definition: TrackBase.h:588
T sqrt(T t)
Definition: SSEVec.h:18
virtual int dimension() const =0
bool isHit2D(const TrackingRecHit &) const
TrackStruct::TrackParameterStruct fillTrackVariables(const reco::Track &, const Trajectory &, const reco::BeamSpot &)
double pt() const
track transverse momentum
Definition: TrackBase.h:654
TrackParameterStruct trkParams
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
Definition: TrackBase.h:808
edm::EDGetTokenT< reco::BeamSpot > offlinebeamSpot_
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
double phiError() const
error on phi
Definition: TrackBase.h:835
float uu() const
uint16_t width() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:79
double BeamWidthX() const
beam width X
Definition: BeamSpot.h:86
bool hitSelected(TrackStruct::HitParameterStruct &) const
ClusterRef cluster() const
bool checkModulePositions(const float, const std::vector< double > &) const
void analyze(const edm::Event &, const edm::EventSetup &) override
T * make(const Args &...args) const
make new ROOT object
unsigned int counter6
const LocalTrajectoryError & localError() const
bool checkModuleBools(const bool, const std::vector< unsigned int > &) const
bool checkModuleIds(const unsigned int, const std::vector< unsigned int > &) const
virtual LocalPoint localPosition() const =0
std::map< unsigned int, TrackerSectorStruct > m_tkSector_
bool isValid() const
Definition: HandleBase.h:74
std::map< std::string, std::vector< unsigned int > > m_hitSelectionUInt_
MeasurementError measurementError(const LocalPoint &, const LocalError &) const override=0
TProfile * PWidthVsWidthProjected
bool checkIntervalsForSectors(const unsigned int sectorCounter, const std::vector< double > &) const
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
#define M_PI
std::pair< const Trajectory *, const reco::Track * > ConstTrajTrackPair
void bookTrackHists()
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Definition: TrackBase.h:642
double dzError() const
error on dz
Definition: TrackBase.h:859
SiStripRecHit2D originalHit() const
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
int qBin() const
Definition: DetId.h:18
virtual TrackingRecHit const * hit() const
virtual float detHeight() const =0
MeasurementPoint measurementPosition(const LocalPoint &) const override=0
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
uint16_t maxStrip() const
std::map< std::string, CorrelationHists > m_correlationHistsX
size_type size() const
map size
virtual float thickness() const =0
edm::Service< TFileService > fileService
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:479
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
bool checkModuleDirections(const int, const std::vector< int > &) const
Detector
Definition: DetId.h:26
ClusterRef cluster() const
Definition: SiPixelRecHit.h:49
double BeamWidthY() const
beam width Y
Definition: BeamSpot.h:88
bool isValid() const
bool inUintInterval(const std::vector< unsigned int > &, const unsigned int, const unsigned int=999) const
int sizeY() const
bool IsModuleUsable() const
std::map< unsigned int, ReducedTrackerTreeVariables > m_tkTreeVar_
Pixel cluster – collection of neighboring pixels above threshold.
void beginJob() override
fixed size matrix
unsigned int counter5
HLT enums.
virtual const GeomDetUnit * detUnit() const
void fillHistsForApeCalculation(const TrackStruct &)
unsigned short found() const
Number of valid hits on track.
Definition: Track.h:196
T get() const
Definition: EventSetup.h:68
unsigned int counter2
bool isPixel(HitType hitType)
bool spansTwoROCs() const
double y0() const
y coordinate
Definition: BeamSpot.h:66
const unsigned int minGoodHitsPerTrack_
float y() const
void setHitSelectionMap(const std::string &)
edm::EDGetTokenT< TrajTrackAssociationCollection > tjTagToken_
int charge() const
track electric charge
Definition: TrackBase.h:600
void fillHitHistsXForAnalyzerMode(const TrackStruct::HitParameterStruct &, TrackerSectorStruct &)
Definition: Bounds.h:22
const_iterator begin() const
first iterator over the map (read only)
DetId geographicalId() const
void fillHistsForAnalyzerMode(const TrackStruct &)
void bookSectorHistsForApeCalculation()
std::map< std::string, CorrelationHists > m_correlationHistsY
virtual LocalError localPositionError() const =0
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
void endJob() override
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Definition: TrackBase.h:624
T x() const
Definition: PV2DBase.h:45
TProfile * PWidthDiffVsSigmaXHit
std::map< std::string, std::vector< double > > m_hitSelection_
int sizeX() const
T x() const
Definition: PV3DBase.h:62
const PositionType & position() const
void setHitSelectionMapUInt(const std::string &)
T const * product() const
Definition: ESHandle.h:84
Definition: vlib.h:208
float x() const
LocalError const & localAlignmentError() const
Return local alligment error.
void statistics(const TrackerSectorStruct &, const int) const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
std::vector< unsigned int > v_rawId
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:45
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)
Our base class.
Definition: SiPixelRecHit.h:23
double x0() const
x coordinate
Definition: BeamSpot.h:64
StatePositionAndError2 positionAndError2(const LocalPoint &, const LocalError &, const TransientTrackingRecHit &)