CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes
StraightTrackAlignment Class Reference

Track-based alignment using straight tracks. More...

#include <StraightTrackAlignment.h>

Classes

struct  ResiduaHistogramSet
 map: detector id –> residua histogram More...
 
struct  RPSetPlots
 

Public Member Functions

virtual void begin (edm::ESHandle< CTPPSRPAlignmentCorrectionsData > hRealAlignment, edm::ESHandle< CTPPSGeometry > hRealGeometry, edm::ESHandle< CTPPSGeometry > hMisalignedGeometry)
 
virtual void finish ()
 performs analyses and fill results variable More...
 
virtual void processEvent (const edm::EventID &eventId, const edm::DetSetVector< TotemRPUVPattern > &uvPatternsStrip, const edm::DetSetVector< CTPPSDiamondRecHit > &hitsDiamond, const edm::DetSetVector< CTPPSPixelRecHit > &hitsPixel, const edm::DetSetVector< CTPPSPixelLocalTrack > &tracksPixel)
 
 StraightTrackAlignment (const edm::ParameterSet &)
 
virtual ~StraightTrackAlignment ()
 

Protected Types

enum  ConstraintsType { ctFixedDetectors, ctStandard }
 constraint types More...
 

Protected Member Functions

void buildConstraints (std::vector< AlignmentConstraint > &)
 builds a selected set of constraints More...
 
void fitLocalTrack (HitCollection &, LocalTrackFit &, bool &failed, bool &selectionChanged)
 
TH1D * newResiduaHist (const char *name)
 creates a new residua histogram More...
 
void printAlgorithmsLine (const std::vector< std::map< unsigned int, AlignmentResult > > &)
 
void printLineSeparator (const std::vector< std::map< unsigned int, AlignmentResult > > &)
 
void printN (const char *str, unsigned int N)
 result pretty printing routines More...
 
void printQuantitiesLine (const std::vector< std::map< unsigned int, AlignmentResult > > &)
 
void removeInsufficientPots (HitCollection &, bool &selectionChanged)
 removes the hits of pots with too few planes active More...
 
void saveDiagnostics () const
 saves a ROOT file with diagnostic plots More...
 
void updateDiagnosticHistograms (const HitCollection &selection, const std::set< unsigned int > &selectedRPs, const LocalTrackFit &trackFit, bool trackSelected)
 fills diagnostic (chi^2, residua, ...) histograms More...
 

Static Protected Member Functions

static std::string setToString (const std::set< unsigned int > &)
 converts a set to string More...
 

Protected Attributes

std::vector< std::set< unsigned int > > additionalAcceptedRPSets
 list of RP sets accepted irrespective of the other "require" settings More...
 
std::vector< AlignmentAlgorithm * > algorithms
 the collection of the alignment algorithms More...
 
bool buildDiagnosticPlots
 whether to build and save diagnostic plots More...
 
double chiSqPerNdfCut
 the value of chi^2/ndf cut threshold More...
 
ConstraintsType constraintsType
 the chosen type of constraints More...
 
std::string cumulativeFileNamePrefix
 file name prefix for cumulative result files More...
 
bool cutOnChiSqPerNdf
 whether to cut on chi^2/ndf More...
 
std::string diagnosticsFile
 file name for some event selection statistics More...
 
signed int eventsFitted
 counter of processed tracks More...
 
signed int eventsSelected
 counter of processed tracks More...
 
signed int eventsTotal
 counter of events More...
 
std::vector< unsigned int > excludePlanes
 list of planes to be excluded from processing More...
 
std::string expandedFileNamePrefix
 file name prefix for cumulative expanded result files More...
 
std::string factoredFileNamePrefix
 file name prefix for cumulative factored result files More...
 
std::string fileNamePrefix
 file name prefix for result files More...
 
TH1D * fitAxHist_fitted
 
TH1D * fitAxHist_selected
 fit ax histograms for all/selected tracks More...
 
TH1D * fitAyHist_fitted
 
TH1D * fitAyHist_selected
 fit ay histograms for all/selected tracks More...
 
TH1D * fitBxHist_fitted
 
TH1D * fitBxHist_selected
 fit bx histograms for all/selected tracks More...
 
TH1D * fitByHist_fitted
 
TH1D * fitByHist_selected
 fit by histograms for all/selected tracks More...
 
TH1D * fitNdfHist_fitted
 
TH1D * fitNdfHist_selected
 fit num. of degrees of freedom histograms for all/selected tracks More...
 
TH1D * fitPHist_fitted
 
TH1D * fitPHist_selected
 fit p-value histograms for all/selected tracks More...
 
std::map< std::set< unsigned int >, unsigned long > fittedTracksPerRPSet
 counter of fitted tracks in a certain RP set More...
 
LocalTrackFitter fitter
 track fitter More...
 
RPSetPlots globalPlots
 global (all RP sets) chi^2 histograms More...
 
CTPPSRPAlignmentCorrectionsData initialAlignments
 (real geometry) alignments before this alignment iteration More...
 
signed int maxEvents
 stops after this event number has been reached More...
 
double maxTrackAx
 cuts on absolute values of the track angle More...
 
double maxTrackAy
 
bool preciseXMLFormat
 whether to use long format (many decimal digits) when saving XML files More...
 
bool removeImpossible
 remove events with impossible signatures (i.e. simultaneously top and bottom) More...
 
bool requireAtLeast3PotsInOverlap
 if a track goes through overlap, select it only if it leaves signal in at least 3 pots More...
 
unsigned int requireNumberOfUnits
 select only tracks with activity in minimal number of units More...
 
bool requireOverlap
 if true, only track through vertical-horizontal overlap are seleceted More...
 
std::map< unsigned int, ResiduaHistogramSetresiduaHistograms
 residua histograms More...
 
std::vector< unsigned int > rpIds
 list of RPs for which the alignment parameters shall be optimized More...
 
std::map< std::set< unsigned int >, RPSetPlotsrpSetPlots
 chi^2 histograms per RP set More...
 
bool saveIntermediateResults
 whether itermediate results (S, CS matrices) of alignments shall be saved More...
 
bool saveXMLUncertainties
 whether to save uncertainties in the result XML files More...
 
std::map< unsigned int, unsigned int > selectedHitsPerPlane
 counter of selected hits per plane More...
 
std::map< std::set< unsigned int >, unsigned long > selectedTracksPerRPSet
 counter of selected tracks in a certain RP set More...
 
AlignmentTask task
 the alignment task to be solved More...
 
TFile * taskDataFile
 the file with task data More...
 
std::string taskDataFileName
 the name task data file More...
 
unsigned int verbosity
 verbosity level More...
 
double z0
 

Detailed Description

Track-based alignment using straight tracks.

Definition at line 48 of file StraightTrackAlignment.h.

Member Enumeration Documentation

◆ ConstraintsType

constraint types

Enumerator
ctFixedDetectors 
ctStandard 

Definition at line 86 of file StraightTrackAlignment.h.

Constructor & Destructor Documentation

◆ StraightTrackAlignment()

StraightTrackAlignment::StraightTrackAlignment ( const edm::ParameterSet ps)

Definition at line 97 of file StraightTrackAlignment.cc.

References a, additionalAcceptedRPSets, algorithms, triggerObjects_cff::bit, groupFilesInBlocks::block, constraintsType, ctFixedDetectors, ctStandard, Exception, edm::ParameterSet::getParameter(), mps_fire::i, task, taskDataFile, and taskDataFileName.

98  : verbosity(ps.getUntrackedParameter<unsigned int>("verbosity", 0)),
99 
100  rpIds(ps.getParameter<vector<unsigned int> >("rpIds")),
101  excludePlanes(ps.getParameter<vector<unsigned int> >("excludePlanes")),
102  z0(ps.getParameter<double>("z0")),
103 
104  maxEvents(ps.getParameter<signed int>("maxEvents")),
105 
106  removeImpossible(ps.getParameter<bool>("removeImpossible")),
107  requireNumberOfUnits(ps.getParameter<unsigned int>("requireNumberOfUnits")),
108  requireAtLeast3PotsInOverlap(ps.getParameter<bool>("requireAtLeast3PotsInOverlap")),
109  requireOverlap(ps.getParameter<bool>("requireOverlap")),
110  cutOnChiSqPerNdf(ps.getParameter<bool>("cutOnChiSqPerNdf")),
111  chiSqPerNdfCut(ps.getParameter<double>("chiSqPerNdfCut")),
112  maxTrackAx(ps.getParameter<double>("maxTrackAx")),
113  maxTrackAy(ps.getParameter<double>("maxTrackAy")),
114 
115  fileNamePrefix(ps.getParameter<string>("fileNamePrefix")),
116  expandedFileNamePrefix(ps.getParameter<string>("expandedFileNamePrefix")),
117  factoredFileNamePrefix(ps.getParameter<string>("factoredFileNamePrefix")),
118  preciseXMLFormat(ps.getParameter<bool>("preciseXMLFormat")),
119  saveXMLUncertainties(ps.getParameter<bool>("saveXMLUncertainties")),
120 
121  saveIntermediateResults(ps.getParameter<bool>("saveIntermediateResults")),
122  taskDataFileName(ps.getParameter<string>("taskDataFileName")),
123  taskDataFile(nullptr),
124 
125  task(ps),
126  fitter(ps),
127 
128  buildDiagnosticPlots(ps.getParameter<bool>("buildDiagnosticPlots")),
129  diagnosticsFile(ps.getParameter<string>("diagnosticsFile")),
130  fitNdfHist_fitted(new TH1D("ndf_fitted", ";ndf;", 41, -4.5, 36.5)),
131  fitNdfHist_selected(new TH1D("ndf_selected", ";ndf;", 41, -4.5, 36.5)),
132  fitPHist_fitted(new TH1D("p_fitted", ";p value;", 100, 0., 1.)),
133  fitPHist_selected(new TH1D("p_selected", ";p value;", 100, 0., 1.)),
134  fitAxHist_fitted(new TH1D("ax_fitted", ";a_{x} (rad);", 10000, -0.1, 0.1)),
135  fitAxHist_selected(new TH1D("ax_selected", ";a_{x} (rad);", 10000, -0.1, 0.1)),
136  fitAyHist_fitted(new TH1D("ay_fitted", ";a_{y} (rad);", 10000, -0.1, 0.1)),
137  fitAyHist_selected(new TH1D("ay_selected", ";a_{y} (rad);", 10000, -0.1, 0.1)),
138  fitBxHist_fitted(new TH1D("bx_fitted", ";b_{x} (mm);", 500, -30., 30.)),
139  fitBxHist_selected(new TH1D("bx_selected", ";b_{x} (mm);", 500, -30., 30.)),
140  fitByHist_fitted(new TH1D("by_fitted", ";b_{y} (mm);", 500, -30., 30.)),
141  fitByHist_selected(new TH1D("by_selected", ";b_{y} (mm);", 500, -30., 30.)),
142 
143  globalPlots("global") {
144  // open task data file
145  if (!taskDataFileName.empty())
146  taskDataFile = new TFile(taskDataFileName.c_str(), "recreate");
147 
148  // instantiate algorithm objects
149  // (and save them)
150  vector<string> alNames(ps.getParameter<vector<string> >("algorithms"));
151  for (unsigned int i = 0; i < alNames.size(); i++) {
152  AlignmentAlgorithm *a = nullptr;
153 
154  if (alNames[i] == "Ideal") {
155  IdealResult *ir = new IdealResult(ps, &task);
156  a = ir;
157  } else if (alNames[i] == "Jan") {
159  a = jaa;
160  }
161 
162  if (a)
163  algorithms.push_back(a);
164  else
165  throw cms::Exception("PPS") << "Unknown alignment algorithm `" << alNames[i] << "'.";
166  }
167 
168  // get constraints type
169  string ct = ps.getParameter<string>("constraintsType");
170  if (ct.compare("fixedDetectors") == 0)
172  else if (ct.compare("standard") == 0)
174  else
175  throw cms::Exception("PPS") << "Unknown constraints type `" << ct << "'.";
176 
177  // parse additional accepted RP sets
178  string aars_str = ps.getParameter<string>("additionalAcceptedRPSets");
179 
180  size_t idx_b = 0, idx_e = string::npos;
181  while (idx_b != string::npos) {
182  // get one block - portion between successive ";"
183  idx_e = aars_str.find(';', idx_b);
184  size_t len = (idx_e == string::npos) ? string::npos : idx_e - idx_b;
185  string block = aars_str.substr(idx_b, len);
186 
187  // process the block
188  if (!block.empty()) {
189  set<unsigned int> rpSet;
190 
191  // isolate bits (= RP ids)
192  size_t bi_b = 0, bi_e = string::npos;
193  while (bi_b != string::npos) {
194  bi_e = block.find(',', bi_b);
195  size_t bit_len = (bi_e == string::npos) ? string::npos : bi_e - bi_b;
196  const string &bit = block.substr(bi_b, bit_len);
197 
198  unsigned int rp = atoi(bit.c_str());
199  rpSet.insert(rp);
200 
201  bi_b = (bi_e == string::npos) ? string::npos : bi_e + 1;
202  }
203 
204  additionalAcceptedRPSets.push_back(rpSet);
205  }
206 
207  // move to next block
208  idx_b = (idx_e == string::npos) ? string::npos : idx_e + 1;
209  }
210 }
std::string taskDataFileName
the name task data file
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
bool cutOnChiSqPerNdf
whether to cut on chi^2/ndf
TH1D * fitNdfHist_selected
fit num. of degrees of freedom histograms for all/selected tracks
std::vector< unsigned int > excludePlanes
list of planes to be excluded from processing
std::vector< unsigned int > rpIds
list of RPs for which the alignment parameters shall be optimized
TH1D * fitAyHist_selected
fit ay histograms for all/selected tracks
bool buildDiagnosticPlots
whether to build and save diagnostic plots
bool saveXMLUncertainties
whether to save uncertainties in the result XML files
Jan&#39;s alignment algorithm.
unsigned int requireNumberOfUnits
select only tracks with activity in minimal number of units
TFile * taskDataFile
the file with task data
TH1D * fitPHist_selected
fit p-value histograms for all/selected tracks
Abstract parent for all (track-based) alignment algorithms.
LocalTrackFitter fitter
track fitter
std::string factoredFileNamePrefix
file name prefix for cumulative factored result files
bool saveIntermediateResults
whether itermediate results (S, CS matrices) of alignments shall be saved
T getUntrackedParameter(std::string const &, T const &) const
bool preciseXMLFormat
whether to use long format (many decimal digits) when saving XML files
AlignmentTask task
the alignment task to be solved
signed int maxEvents
stops after this event number has been reached
unsigned int verbosity
verbosity level
std::string fileNamePrefix
file name prefix for result files
bool removeImpossible
remove events with impossible signatures (i.e. simultaneously top and bottom)
bool requireOverlap
if true, only track through vertical-horizontal overlap are seleceted
RPSetPlots globalPlots
global (all RP sets) chi^2 histograms
Calculates the ideal result of the StraightTrackAlignment.
Definition: IdealResult.h:24
TH1D * fitAxHist_selected
fit ax histograms for all/selected tracks
std::vector< std::set< unsigned int > > additionalAcceptedRPSets
list of RP sets accepted irrespective of the other "require" settings
double chiSqPerNdfCut
the value of chi^2/ndf cut threshold
std::vector< AlignmentAlgorithm * > algorithms
the collection of the alignment algorithms
ConstraintsType constraintsType
the chosen type of constraints
double a
Definition: hdecay.h:119
std::string diagnosticsFile
file name for some event selection statistics
TH1D * fitByHist_selected
fit by histograms for all/selected tracks
bool requireAtLeast3PotsInOverlap
if a track goes through overlap, select it only if it leaves signal in at least 3 pots ...
TH1D * fitBxHist_selected
fit bx histograms for all/selected tracks
double maxTrackAx
cuts on absolute values of the track angle
std::string expandedFileNamePrefix
file name prefix for cumulative expanded result files

◆ ~StraightTrackAlignment()

StraightTrackAlignment::~StraightTrackAlignment ( )
virtual

Definition at line 214 of file StraightTrackAlignment.cc.

References algorithms, fitAxHist_fitted, fitAxHist_selected, fitAyHist_fitted, fitAyHist_selected, fitBxHist_fitted, fitBxHist_selected, fitByHist_fitted, fitByHist_selected, fitNdfHist_fitted, fitNdfHist_selected, fitPHist_fitted, fitPHist_selected, cms::cuda::for(), StraightTrackAlignment::RPSetPlots::free(), globalPlots, AlCaHLTBitMon_ParallelJobs::p, residuaHistograms, rpSetPlots, and taskDataFile.

214  {
215  if (taskDataFile)
216  delete taskDataFile;
217 
218  for (vector<AlignmentAlgorithm *>::iterator it = algorithms.begin(); it != algorithms.end(); ++it)
219  delete (*it);
220 
221  delete fitNdfHist_fitted;
222  delete fitNdfHist_selected;
223  delete fitPHist_fitted;
224  delete fitPHist_selected;
225  delete fitAxHist_fitted;
226  delete fitAyHist_fitted;
227  delete fitAxHist_selected;
228  delete fitAyHist_selected;
229  delete fitBxHist_fitted;
230  delete fitByHist_fitted;
231  delete fitBxHist_selected;
232  delete fitByHist_selected;
233 
234  globalPlots.free();
235 
236  for (auto &p : rpSetPlots)
237  p.second.free();
238 
239  for (auto it = residuaHistograms.begin(); it != residuaHistograms.end(); ++it) {
240  delete it->second.total_fitted;
241  delete it->second.total_selected;
242  delete it->second.selected_vs_chiSq;
243  for (auto sit = it->second.perRPSet_fitted.begin(); sit != it->second.perRPSet_fitted.end(); ++sit)
244  delete sit->second;
245  for (auto sit = it->second.perRPSet_selected.begin(); sit != it->second.perRPSet_selected.end(); ++sit)
246  delete sit->second;
247  }
248 }
TH1D * fitNdfHist_selected
fit num. of degrees of freedom histograms for all/selected tracks
TH1D * fitAyHist_selected
fit ay histograms for all/selected tracks
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
TFile * taskDataFile
the file with task data
TH1D * fitPHist_selected
fit p-value histograms for all/selected tracks
RPSetPlots globalPlots
global (all RP sets) chi^2 histograms
TH1D * fitAxHist_selected
fit ax histograms for all/selected tracks
std::vector< AlignmentAlgorithm * > algorithms
the collection of the alignment algorithms
TH1D * fitByHist_selected
fit by histograms for all/selected tracks
TH1D * fitBxHist_selected
fit bx histograms for all/selected tracks
std::map< unsigned int, ResiduaHistogramSet > residuaHistograms
residua histograms
std::map< std::set< unsigned int >, RPSetPlots > rpSetPlots
chi^2 histograms per RP set

Member Function Documentation

◆ begin()

void StraightTrackAlignment::begin ( edm::ESHandle< CTPPSRPAlignmentCorrectionsData hRealAlignment,
edm::ESHandle< CTPPSGeometry hRealGeometry,
edm::ESHandle< CTPPSGeometry hMisalignedGeometry 
)
virtual

Definition at line 252 of file StraightTrackAlignment.cc.

References a, algorithms, AlignmentTask::buildGeometry(), AlignmentTask::buildIndexMaps(), eventsFitted, eventsSelected, eventsTotal, excludePlanes, fittedTracksPerRPSet, fitter, AlignmentTask::geometry, initialAlignments, AlignmentGeometry::print(), edm::ESHandle< T >::product(), rpIds, selectedHitsPerPlane, selectedTracksPerRPSet, task, taskDataFile, verbosity, and z0.

Referenced by PPSStraightTrackAligner::analyze().

254  {
255  // reset counters
256  eventsTotal = 0;
257  eventsFitted = 0;
258  eventsSelected = 0;
259  fittedTracksPerRPSet.clear();
260  selectedTracksPerRPSet.clear();
261  selectedHitsPerPlane.clear();
262 
263  // prepare geometry
265 
266  // build matrix index mappings
268 
269  // print geometry info
270  if (verbosity > 1)
271  task.geometry.print();
272 
273  // save task (including geometry) and fitter
274  if (taskDataFile) {
275  taskDataFile->WriteObject(&task, "task");
276  taskDataFile->WriteObject(&fitter, "fitter");
277  }
278 
279  // initiate the algorithms
280  for (const auto &a : algorithms)
281  a->begin(hRealGeometry.product(), hMisalignedGeometry.product());
282 
283  // get initial alignments
284  initialAlignments = *hRealAlignment;
285 }
std::vector< unsigned int > excludePlanes
list of planes to be excluded from processing
std::vector< unsigned int > rpIds
list of RPs for which the alignment parameters shall be optimized
void print() const
Prints the geometry.
signed int eventsSelected
counter of processed tracks
TFile * taskDataFile
the file with task data
CTPPSRPAlignmentCorrectionsData initialAlignments
(real geometry) alignments before this alignment iteration
void buildIndexMaps()
builds "mapMatrixIndeces" from "geometry"
LocalTrackFitter fitter
track fitter
std::map< unsigned int, unsigned int > selectedHitsPerPlane
counter of selected hits per plane
static void buildGeometry(const std::vector< unsigned int > &rpDecIds, const std::vector< unsigned int > &excludedSensors, const CTPPSGeometry *, double z0, AlignmentGeometry &geometry)
builds the alignment geometry
signed int eventsTotal
counter of events
T const * product() const
Definition: ESHandle.h:86
AlignmentTask task
the alignment task to be solved
AlignmentGeometry geometry
the geometry for this task
Definition: AlignmentTask.h:48
unsigned int verbosity
verbosity level
std::map< std::set< unsigned int >, unsigned long > selectedTracksPerRPSet
counter of selected tracks in a certain RP set
std::vector< AlignmentAlgorithm * > algorithms
the collection of the alignment algorithms
signed int eventsFitted
counter of processed tracks
double a
Definition: hdecay.h:119
std::map< std::set< unsigned int >, unsigned long > fittedTracksPerRPSet
counter of fitted tracks in a certain RP set

◆ buildConstraints()

void StraightTrackAlignment::buildConstraints ( std::vector< AlignmentConstraint > &  constraints)
protected

builds a selected set of constraints

Definition at line 694 of file StraightTrackAlignment.cc.

References AlignmentTask::buildFixedDetectorsConstraints(), AlignmentTask::buildStandardConstraints(), createBeamHaloJobs::constraints, constraintsType, ctFixedDetectors, ctStandard, and task.

Referenced by finish().

694  {
695  constraints.clear();
696 
697  switch (constraintsType) {
698  case ctFixedDetectors:
700  return;
701 
702  case ctStandard:
704  return;
705  }
706 }
void buildStandardConstraints(std::vector< AlignmentConstraint > &) const
builds the standard constraints
AlignmentTask task
the alignment task to be solved
ConstraintsType constraintsType
the chosen type of constraints
void buildFixedDetectorsConstraints(std::vector< AlignmentConstraint > &) const
builds a set of fixed-detector constraints

◆ finish()

void StraightTrackAlignment::finish ( )
virtual

performs analyses and fill results variable

Definition at line 710 of file StraightTrackAlignment.cc.

References a, CTPPSRPAlignmentCorrectionsData::addCorrections(), qcdUeDQM_cfi::algorithm, algorithms, buildConstraints(), createBeamHaloJobs::constraints, alignCSCRings::corr, ztail::d, DeadROC_duringRun::dir, L1TDiffHarvesting_cfi::dir1, L1TDiffHarvesting_cfi::dir2, MillePedeFileConverter_cfg::e, mps_fire::end, eventsFitted, eventsSelected, eventsTotal, Exception, expandedFileNamePrefix, factoredFileNamePrefix, factorRPFromSensorCorrections(), fileNamePrefix, fittedTracksPerRPSet, AlignmentTask::geometry, AlignmentGeometry::get(), ForwardName::getName(), AlignmentGeometry::getSensorMap(), mps_fire::i, initialAlignments, label, Skims_PA_cff::name, AlCaHLTBitMon_ParallelJobs::p, funct::pow(), preciseXMLFormat, printAlgorithmsLine(), printId(), printLineSeparator(), printQuantitiesLine(), submitPVResolutionJobs::q, AlignmentTask::qcRotZ, AlignmentTask::qcShR1, AlignmentTask::qcShR2, AlignmentTask::qcShZ, AlignmentTask::quantityClasses, mysort::results, hcal_runs::rf, CTPPSDetId::rpId(), saveDiagnostics(), saveIntermediateResults, saveXMLUncertainties, selectedHitsPerPlane, selectedTracksPerRPSet, CTPPSRPAlignmentCorrectionsData::setSensorCorrection(), setToString(), mathSSE::sqrt(), pfDeepBoostedJetPreprocessParams_cfi::sv, task, taskDataFile, findQualityFiles::v, verbosity, and CTPPSRPAlignmentCorrectionsMethods::writeToXML().

Referenced by progressbar.ProgressBar::__next__(), and PPSStraightTrackAligner::endJob().

710  {
711  // print statistics
712  if (verbosity) {
713  printf("----------------------------------------------------------------------------------------------------\n");
714  printf("\n>> StraightTrackAlignment::Finish\n");
715  printf("\tevents total = %i\n", eventsTotal);
716  printf("\tevents fitted = %i\n", eventsFitted);
717  printf("\tevents selected = %i\n", eventsSelected);
718 
719  printf("\n* events per RP set:\n");
720  printf("%30s %10s%10s\n", "set of RPs", "fitted", "selected");
721 
722  for (auto it = fittedTracksPerRPSet.begin(); it != fittedTracksPerRPSet.end(); ++it) {
723  const string &label = setToString(it->first);
724 
725  auto sit = selectedTracksPerRPSet.find(it->first);
726  unsigned long sv = (sit == selectedTracksPerRPSet.end()) ? 0 : sit->second;
727 
728  printf("%30s :%10lu%10lu\n", label.c_str(), it->second, sv);
729  }
730 
731  if (verbosity >= 2) {
732  printf("\n* hits per plane:\n");
733  for (const auto it : selectedHitsPerPlane) {
734  printf(" ");
735  printId(it.first);
736  printf(" : %u\n", it.second);
737  }
738  }
739  }
740 
741  // write diagnostics plots
742  saveDiagnostics();
743 
744  // run analysis
745  for (auto a : algorithms)
746  a->analyze();
747 
748  // build constraints
749  vector<AlignmentConstraint> constraints;
751 
752  // save constraints
753  if (taskDataFile)
754  taskDataFile->WriteObject(&constraints, "constraints");
755 
756  if (verbosity) {
757  printf("\n>> StraightTrackAlignment::Finish > %lu constraints built\n", constraints.size());
758  for (unsigned int i = 0; i < constraints.size(); i++)
759  printf("\t%s\n", constraints[i].name.c_str());
760  }
761 
762  // solve
763  vector<map<unsigned int, AlignmentResult> > results;
764  for (auto algorithm : algorithms) {
765  TDirectory *dir = nullptr;
767  dir = taskDataFile->mkdir((algorithm->getName() + "_data").c_str());
768 
769  results.resize(results.size() + 1);
770  unsigned int rf = algorithm->solve(constraints, results.back(), dir);
771 
772  if (rf)
773  throw cms::Exception("PPS") << "The Solve method of `" << algorithm->getName()
774  << "' algorithm has failed (return value " << rf << ").";
775  }
776 
777  // print results
778  if (verbosity) {
779  printf("\n>> StraightTrackAlignment::Finish > Print\n");
780 
784 
785  signed int prevRPId = -1;
786 
787  for (const auto &dit : task.geometry.getSensorMap()) {
788  signed int rpId = CTPPSDetId(dit.first).rpId();
789  if (rpId != prevRPId)
791  prevRPId = rpId;
792 
793  printId(dit.first);
794  printf(" ║");
795 
796  for (unsigned int q = 0; q < task.quantityClasses.size(); q++) {
797  for (unsigned int a = 0; a < results.size(); a++) {
798  const auto it = results[a].find(dit.first);
799  if (it == results[a].end()) {
800  if (algorithms[a]->hasErrorEstimate())
801  printf("%19s", "----");
802  else
803  printf("%8s", "----");
804 
805  if (a + 1 == results.size())
806  printf("║");
807  else
808  printf("│");
809 
810  continue;
811  }
812 
813  const auto &ac = it->second;
814  double v = 0., e = 0.;
815  switch (task.quantityClasses[q]) {
817  v = ac.getShR1();
818  e = ac.getShR1Unc();
819  break;
821  v = ac.getShR2();
822  e = ac.getShR2Unc();
823  break;
825  v = ac.getShZ();
826  e = ac.getShZUnc();
827  break;
829  v = ac.getRotZ();
830  e = ac.getRotZUnc();
831  break;
832  }
833 
834  if (algorithms[a]->hasErrorEstimate())
835  printf("%+8.1f ± %7.1f", v * 1E3, e * 1E3);
836  else
837  printf("%+8.1f", v * 1E3);
838 
839  if (a + 1 == results.size())
840  printf("║");
841  else
842  printf("│");
843  }
844  }
845 
846  printf("\n");
847  }
848 
853  }
854 
855  // save results as alignment XML files
856  for (unsigned int a = 0; a < results.size(); a++) {
857  // convert readout-direction corrections to X and Y
858  CTPPSRPAlignmentCorrectionsData convertedAlignments;
859  for (const auto &p : results[a]) {
860  const DetGeometry &d = task.geometry.get(p.first);
861  const auto dir1 = d.getDirectionData(1);
862  const auto dir2 = d.getDirectionData(2);
863 
864  const double det = dir1.dx * dir2.dy - dir1.dy * dir2.dx;
865  const double sh_x = (dir2.dy * p.second.getShR1() - dir1.dy * p.second.getShR2()) / det;
866  const double sh_y = (-dir2.dx * p.second.getShR1() + dir1.dx * p.second.getShR2()) / det;
867 
868  const double sh_x_e =
869  sqrt(pow(dir2.dy / det * p.second.getShR1Unc(), 2) + pow(dir1.dy / det * p.second.getShR2Unc(), 2));
870  const double sh_y_e =
871  sqrt(pow(dir2.dx / det * p.second.getShR1Unc(), 2) + pow(dir1.dx / det * p.second.getShR2Unc(), 2));
872 
874  sh_x_e,
875  sh_y,
876  sh_y_e,
877  p.second.getShZ(),
878  p.second.getShZUnc(),
879  0.,
880  0.,
881  0.,
882  0.,
883  p.second.getRotZ(),
884  p.second.getRotZUnc());
885  convertedAlignments.setSensorCorrection(p.first, corr);
886  }
887 
888  // write non-cumulative alignments
889  if (!fileNamePrefix.empty()) {
891  fileNamePrefix + algorithms[a]->getName() + ".xml",
894  true,
895  true,
896  true,
897  true);
898  }
899 
900  // merge alignments
901  CTPPSRPAlignmentCorrectionsData cumulativeAlignments;
902 
903  cumulativeAlignments.addCorrections(initialAlignments, false, true, true);
904  cumulativeAlignments.addCorrections(convertedAlignments, false, true, true);
905 
906  // write expanded and factored results
907  if (!expandedFileNamePrefix.empty() || !factoredFileNamePrefix.empty()) {
908  CTPPSRPAlignmentCorrectionsData expandedAlignments;
909  CTPPSRPAlignmentCorrectionsData factoredAlignments;
910 
911  if (verbosity)
912  printf(">> Factorizing results of %s algorithm\n", algorithms[a]->getName().c_str());
913 
914  const bool equalWeights = false;
916  cumulativeAlignments, expandedAlignments, factoredAlignments, task.geometry, equalWeights, verbosity);
917 
918  if (!expandedFileNamePrefix.empty()) {
923  true,
924  true,
925  true,
926  true);
927  }
928 
929  if (!factoredFileNamePrefix.empty()) {
934  true,
935  true,
936  true,
937  true);
938  }
939  }
940  }
941 
942  // prepare algorithms for destructions
943  for (const auto &algorithm : algorithms)
944  algorithm->end();
945 }
A structure to hold relevant geometrical information about one detector/sensor.
bool saveXMLUncertainties
whether to save uncertainties in the result XML files
signed int eventsSelected
counter of processed tracks
TFile * taskDataFile
the file with task data
const std::map< unsigned int, DetGeometry > & getSensorMap() const
CTPPSRPAlignmentCorrectionsData initialAlignments
(real geometry) alignments before this alignment iteration
std::vector< QuantityClass > quantityClasses
list of quantity classes to be optimized
Definition: AlignmentTask.h:68
void buildConstraints(std::vector< AlignmentConstraint > &)
builds a selected set of constraints
std::map< unsigned int, unsigned int > selectedHitsPerPlane
counter of selected hits per plane
std::string factoredFileNamePrefix
file name prefix for cumulative factored result files
signed int eventsTotal
counter of events
bool saveIntermediateResults
whether itermediate results (S, CS matrices) of alignments shall be saved
bool preciseXMLFormat
whether to use long format (many decimal digits) when saving XML files
char const * label
AlignmentTask task
the alignment task to be solved
detector shifts in first readout direction
Definition: AlignmentTask.h:61
dictionary corr
AlignmentGeometry geometry
the geometry for this task
Definition: AlignmentTask.h:48
unsigned int verbosity
verbosity level
std::string fileNamePrefix
file name prefix for result files
CTPPSDetId rpId() const
Definition: CTPPSDetId.h:84
T sqrt(T t)
Definition: SSEVec.h:19
d
Definition: ztail.py:151
void factorRPFromSensorCorrections(const CTPPSRPAlignmentCorrectionsData &input, CTPPSRPAlignmentCorrectionsData &expanded, CTPPSRPAlignmentCorrectionsData &factored, const AlignmentGeometry &, bool equalWeights=false, unsigned int verbosity=0)
Definition: Utilities.cc:93
void addCorrections(const CTPPSRPAlignmentCorrectionsData &, bool sumErrors=true, bool addSh=true, bool addRot=true)
adds (merges) corrections on top of the current values
detector shifts in second readout direction
Definition: AlignmentTask.h:62
void printId(unsigned int id)
Definition: Utilities.cc:26
void saveDiagnostics() const
saves a ROOT file with diagnostic plots
std::map< std::set< unsigned int >, unsigned long > selectedTracksPerRPSet
counter of selected tracks in a certain RP set
detector rotations around z
Definition: AlignmentTask.h:64
void printQuantitiesLine(const std::vector< std::map< unsigned int, AlignmentResult > > &)
std::vector< AlignmentAlgorithm * > algorithms
the collection of the alignment algorithms
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
Container for CTPPS RP alignment corrections. The corrections are stored on two levels - RP and senso...
static std::string setToString(const std::set< unsigned int > &)
converts a set to string
signed int eventsFitted
counter of processed tracks
double a
Definition: hdecay.h:119
static void writeToXML(const CTPPSRPAlignmentCorrectionsDataSequence &seq, const std::string &fileName, bool precise=false, bool wrErrors=true, bool wrSh_xy=true, bool wrSh_z=false, bool wrRot_xy=false, bool wrRot_z=true)
writes sequence of alignment corrections into a single XML file
const DetGeometry & get(unsigned int id) const
retrieves sensor geometry
results
Definition: mysort.py:8
std::string getName(const G4String &)
Definition: ForwardName.cc:3
void printAlgorithmsLine(const std::vector< std::map< unsigned int, AlignmentResult > > &)
void printLineSeparator(const std::vector< std::map< unsigned int, AlignmentResult > > &)
void setSensorCorrection(unsigned int id, const CTPPSRPAlignmentCorrectionData &ac)
sets the alignment correction for the given sensor
detector shifts in z
Definition: AlignmentTask.h:63
std::string expandedFileNamePrefix
file name prefix for cumulative expanded result files
std::map< std::set< unsigned int >, unsigned long > fittedTracksPerRPSet
counter of fitted tracks in a certain RP set
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
Alignment correction for an element of the CT-PPS detector. Within the geometry description, every sensor (more generally every element) is given its translation and rotation. These two quantities shall be understood in local-to-global coordinate transform. That is, if r_l is a point in local coordinate system and x_g in global, then it holds.

◆ fitLocalTrack()

void StraightTrackAlignment::fitLocalTrack ( HitCollection ,
LocalTrackFit ,
bool &  failed,
bool &  selectionChanged 
)
protected

fits the collection of hits and removes hits with too high residual/sigma ratio

Parameters
failedwhether the fit has failed
selectionChangedwhether some hits have been removed

◆ newResiduaHist()

TH1D * StraightTrackAlignment::newResiduaHist ( const char *  name)
protected

creates a new residua histogram

Definition at line 40 of file StraightTrackAlignment.cc.

References Skims_PA_cff::name.

Referenced by updateDiagnosticHistograms().

40  {
41  return new TH1D(name, ";residual (mm)", 2000, -3., +3.); // in mm
42 }

◆ printAlgorithmsLine()

void StraightTrackAlignment::printAlgorithmsLine ( const std::vector< std::map< unsigned int, AlignmentResult > > &  results)
protected

Definition at line 1012 of file StraightTrackAlignment.cc.

References a, algorithms, ForwardName::getName(), submitPVResolutionJobs::q, AlignmentTask::quantityClasses, mysort::results, and task.

Referenced by finish().

1012  {
1013  printf(" ║");
1014 
1015  for (unsigned int q = 0; q < task.quantityClasses.size(); q++) {
1016  for (unsigned int a = 0; a < results.size(); a++) {
1017  printf((algorithms[a]->hasErrorEstimate()) ? "%18s" : "%8s", algorithms[a]->getName().substr(0, 8).c_str());
1018 
1019  if (a + 1 == results.size())
1020  printf("║");
1021  else
1022  printf("│");
1023  }
1024  }
1025  printf("\n");
1026 }
std::vector< QuantityClass > quantityClasses
list of quantity classes to be optimized
Definition: AlignmentTask.h:68
AlignmentTask task
the alignment task to be solved
std::vector< AlignmentAlgorithm * > algorithms
the collection of the alignment algorithms
double a
Definition: hdecay.h:119
results
Definition: mysort.py:8
std::string getName(const G4String &)
Definition: ForwardName.cc:3

◆ printLineSeparator()

void StraightTrackAlignment::printLineSeparator ( const std::vector< std::map< unsigned int, AlignmentResult > > &  results)
protected

Definition at line 976 of file StraightTrackAlignment.cc.

References a, algorithms, printN(), submitPVResolutionJobs::q, AlignmentTask::quantityClasses, mysort::results, and task.

Referenced by finish().

976  {
977  printf("═════════════════════════╬");
978  for (unsigned int q = 0; q < task.quantityClasses.size(); q++) {
979  for (unsigned int a = 0; a < results.size(); a++) {
980  printN("═", algorithms[a]->hasErrorEstimate() ? 18 : 8);
981  if (a + 1 != results.size())
982  printf("═");
983  }
984  printf("╬");
985  }
986  printf("\n");
987 }
std::vector< QuantityClass > quantityClasses
list of quantity classes to be optimized
Definition: AlignmentTask.h:68
AlignmentTask task
the alignment task to be solved
void printN(const char *str, unsigned int N)
result pretty printing routines
std::vector< AlignmentAlgorithm * > algorithms
the collection of the alignment algorithms
double a
Definition: hdecay.h:119
results
Definition: mysort.py:8

◆ printN()

void StraightTrackAlignment::printN ( const char *  str,
unsigned int  N 
)
protected

result pretty printing routines

Definition at line 969 of file StraightTrackAlignment.cc.

References mps_fire::i, N, and str.

Referenced by printLineSeparator(), and printQuantitiesLine().

969  {
970  for (unsigned int i = 0; i < N; i++)
971  printf("%s", str);
972 }
#define N
Definition: blowfish.cc:9
#define str(s)

◆ printQuantitiesLine()

void StraightTrackAlignment::printQuantitiesLine ( const std::vector< std::map< unsigned int, AlignmentResult > > &  results)
protected

Definition at line 991 of file StraightTrackAlignment.cc.

References a, algorithms, printN(), submitPVResolutionJobs::q, AlignmentTask::quantityClasses, AlignmentTask::quantityClassTag(), mysort::results, findQualityFiles::size, makeGlobalPositionRcd_cfg::tag, and task.

Referenced by finish().

991  {
992  printf(" ║");
993 
994  for (unsigned int q = 0; q < task.quantityClasses.size(); q++) {
995  unsigned int size = 0;
996  for (unsigned int a = 0; a < results.size(); a++)
997  size += (algorithms[a]->hasErrorEstimate()) ? 18 : 8;
998  size += algorithms.size() - 1;
999 
1000  const string &tag = task.quantityClassTag(task.quantityClasses[q]);
1001  unsigned int space = (size - tag.size()) / 2;
1002  printN(" ", space);
1003  printf("%s", tag.c_str());
1004  printN(" ", size - space - tag.size());
1005  printf("║");
1006  }
1007  printf("\n");
1008 }
size
Write out results.
std::string quantityClassTag(QuantityClass) const
returns a string tag for the given quantity class
std::vector< QuantityClass > quantityClasses
list of quantity classes to be optimized
Definition: AlignmentTask.h:68
AlignmentTask task
the alignment task to be solved
void printN(const char *str, unsigned int N)
result pretty printing routines
std::vector< AlignmentAlgorithm * > algorithms
the collection of the alignment algorithms
double a
Definition: hdecay.h:119
results
Definition: mysort.py:8

◆ processEvent()

void StraightTrackAlignment::processEvent ( const edm::EventID eventId,
const edm::DetSetVector< TotemRPUVPattern > &  uvPatternsStrip,
const edm::DetSetVector< CTPPSDiamondRecHit > &  hitsDiamond,
const edm::DetSetVector< CTPPSPixelRecHit > &  hitsPixel,
const edm::DetSetVector< CTPPSPixelLocalTrack > &  tracksPixel 
)
virtual

Definition at line 289 of file StraightTrackAlignment.cc.

References a, additionalAcceptedRPSets, algorithms, CTPPSDetId::arm(), LocalTrackFit::ax, LocalTrackFit::ay, LocalTrackFit::chiSqPerNdf(), chiSqPerNdfCut, cutOnChiSqPerNdf, protons_cff::decRPId, DetGeometry::DirectionData::dz, edm::EventID::event(), eventsFitted, eventsSelected, eventsTotal, spr::find(), LocalTrackFitter::fit(), fittedTracksPerRPSet, fitter, AlignmentTask::geometry, AlignmentGeometry::get(), DetGeometry::getDirectionData(), h, interestingEgammaIsoDetIdsSequence_cff::hitSelection, hit::id, AlignmentGeometry::isValidSensorId(), maxEvents, maxTrackAx, maxTrackAy, hltL1SingleMuFiltered5_cfi::overlap, topSingleLeptonDQM_PU_cfi::pattern, pi, TotemRPUVPattern::projU, TotemRPUVPattern::projV, removeImpossible, requireAtLeast3PotsInOverlap, requireNumberOfUnits, requireOverlap, CTPPSDetId::rp(), rpIds, edm::EventID::run(), selectedHitsPerPlane, selectedTracksPerRPSet, mathSSE::sqrt(), CTPPSDetId::station(), task, units(), updateDiagnosticHistograms(), verbosity, and z.

Referenced by PPSStraightTrackAligner::analyze().

293  {
294  eventsTotal++;
295 
296  if (verbosity > 9)
297  printf("\n---------- StraightTrackAlignment::ProcessEvent (%u:%llu)\n", eventId.run(), eventId.event());
298 
299  // -------------------- STEP 1: get hits from selected RPs
300 
302 
303  // strips
304  for (const auto &pv : uvPatternsStrip) {
305  const CTPPSDetId detId(pv.detId());
306  const unsigned int rpDecId = detId.arm() * 100 + detId.station() * 10 + detId.rp();
307 
308  // skip if RP not selected
309  if (find(rpIds.begin(), rpIds.end(), rpDecId) == rpIds.end())
310  continue;
311 
312  // require exactly 1 U and 1 V pattern, i.e. unique U-V association
313  unsigned int n_U = 0, n_V = 0;
314  unsigned int idx_U = 0, idx_V = 0;
315  for (unsigned int pi = 0; pi < pv.size(); pi++) {
316  const TotemRPUVPattern &pattern = pv[pi];
317 
318  switch (pattern.projection()) {
320  n_U++;
321  idx_U = pi;
322  break;
323 
325  n_V++;
326  idx_V = pi;
327  break;
328 
329  default:
330  break;
331  }
332  }
333 
334  if (n_U != 1 || n_V != 1)
335  continue;
336 
337  // skip if patterns not reasonable
338  if (!pv[idx_U].fittable() || !pv[idx_V].fittable())
339  continue;
340 
341  // add hits from the U and V pattern
342  for (const auto &pattern : {pv[idx_U], pv[idx_V]}) {
343  for (const auto &hitsDetSet : pattern.hits()) {
344  // skip if sensor not in geometry
345  if (!task.geometry.isValidSensorId(hitsDetSet.detId()))
346  continue;
347 
348  const double &z = task.geometry.get(hitsDetSet.detId()).z;
349  for (auto &hit : hitsDetSet)
350  hitSelection.emplace_back(Hit(hitsDetSet.detId(), 2, hit.position(), hit.sigma(), z));
351  }
352  }
353  }
354 
355  // diamonds
356  for (const auto &pv : hitsDiamond) {
357  // skip if RP not selected
358  const CTPPSDetId detId(pv.detId());
359  const unsigned int rpDecId = detId.arm() * 100 + detId.station() * 10 + detId.rp();
360 
361  // skip if RP not selected
362  if (find(rpIds.begin(), rpIds.end(), rpDecId) == rpIds.end())
363  continue;
364 
365  // skip if sensor not in geometry
366  if (!task.geometry.isValidSensorId(detId))
367  continue;
368 
369  const double &z = task.geometry.get(pv.detId()).z;
370 
371  for (const auto &h : pv)
372  hitSelection.emplace_back(Hit(pv.detId(), 1, h.x(), h.xWidth() / sqrt(12.), z));
373  }
374 
375  // pixels: data from rec hits
376  map<unsigned int, unsigned int> pixelPlaneMultiplicity;
377  for (const auto &pv : hitsPixel)
378  pixelPlaneMultiplicity[pv.detId()] += pv.size();
379 
380  for (const auto &pv : hitsPixel) {
381  // skip if RP not selected
382  const CTPPSDetId detId(pv.detId());
383  const unsigned int rpDecId = detId.arm() * 100 + detId.station() * 10 + detId.rp();
384 
385  // skip if RP not selected
386  if (find(rpIds.begin(), rpIds.end(), rpDecId) == rpIds.end())
387  continue;
388 
389  // skip if sensor not in geometry
390  if (!task.geometry.isValidSensorId(detId))
391  continue;
392 
393  // skip if plane multiplicity greater than 1
394  if (pixelPlaneMultiplicity[pv.detId()] > 1)
395  continue;
396 
397  for (const auto &h : pv) {
398  const auto &dg = task.geometry.get(pv.detId());
399  const double dz1 = dg.getDirectionData(1).dz;
400  const double dz2 = dg.getDirectionData(2).dz;
401  const double z = dg.z + h.point().x() * dz1 + h.point().y() * dz2;
402 
403  double x_unc = sqrt(h.error().xx());
404  double y_unc = sqrt(h.error().yy());
405 
406  // TODO: Check this
407 
408  if (x_unc <= 0.)
409  x_unc = 10E-3; // mm
410  if (y_unc <= 0.)
411  y_unc = 10E-3; // mm
412 
413  hitSelection.emplace_back(Hit(pv.detId(), 1, h.point().x(), x_unc, z));
414  hitSelection.emplace_back(Hit(pv.detId(), 2, h.point().y(), y_unc, z));
415  }
416  }
417 
418  // pixels: data from tracks
419  for (const auto &pv : tracksPixel) {
420  const CTPPSDetId rpId(pv.detId());
421  const unsigned int rpDecId = rpId.arm() * 100 + rpId.station() * 10 + rpId.rp();
422 
423  // skip if RP not selected
424  if (find(rpIds.begin(), rpIds.end(), rpDecId) == rpIds.end())
425  continue;
426 
427  // skip if more than 1 (valid) track in the RP
428  unsigned int n_valid_tracks = 0;
429  for (const auto &tr : pv) {
430  if (tr.isValid())
431  n_valid_tracks++;
432  }
433 
434  if (n_valid_tracks > 1)
435  continue;
436 
437  // go through all valid tracks
438  for (const auto &tr : pv) {
439  if (!tr.isValid())
440  continue;
441 
442  // go through all associated rec hits
443  for (const auto &hv : tr.hits()) {
444  const CTPPSPixelDetId senId(hv.detId());
445 
446  // skip if sensor not in geometry
447  if (!task.geometry.isValidSensorId(senId))
448  continue;
449 
450  for (const auto &h : hv) {
451  // skip hit if not used for fit
452  if (!h.isUsedForFit())
453  continue;
454 
455  const auto &dg = task.geometry.get(senId);
456  const double dz1 = dg.getDirectionData(1).dz;
457  const double dz2 = dg.getDirectionData(2).dz;
458  const double z = dg.z + h.point().x() * dz1 + h.point().y() * dz2;
459 
460  double x_unc = sqrt(h.error().xx());
461  double y_unc = sqrt(h.error().yy());
462 
463  if (x_unc <= 0.)
464  x_unc = 10E-3; // mm
465  if (y_unc <= 0.)
466  y_unc = 10E-3; // mm
467 
468  hitSelection.emplace_back(Hit(senId, 1, h.point().x(), x_unc, z));
469  hitSelection.emplace_back(Hit(senId, 2, h.point().y(), y_unc, z));
470  }
471  }
472  }
473  }
474 
475  if (hitSelection.empty())
476  return;
477 
478  // -------------------- STEP 2: fit + outlier rejection
479 
480  LocalTrackFit trackFit;
481  if (!fitter.fit(hitSelection, task.geometry, trackFit))
482  return;
483 
484  set<unsigned int> selectedRPs;
485  for (const auto &hit : hitSelection) {
486  CTPPSDetId detId(hit.id);
487  const unsigned int decRPId = detId.arm() * 100 + detId.station() * 10 + detId.rp();
488  selectedRPs.insert(decRPId);
489  }
490 
491  eventsFitted++;
492  fittedTracksPerRPSet[selectedRPs]++;
493 
494  // -------------------- STEP 3: quality checks
495 
496  bool top = false, bottom = false, horizontal = false;
497  unordered_set<unsigned int> units;
498  for (const auto &rp : selectedRPs) {
499  unsigned int rpIdx = rp % 10;
500  unsigned int stId = rp / 10;
501  unsigned int unitId = stId * 10;
502  if (rpIdx > 2)
503  unitId++;
504 
505  if (rpIdx == 0 || rpIdx == 4)
506  top = true;
507  if (rpIdx == 1 || rpIdx == 5)
508  bottom = true;
509  if (rpIdx == 2 || rpIdx == 3)
510  horizontal = true;
511 
512  units.insert(unitId);
513  }
514 
515  bool overlap = (top && horizontal) || (bottom && horizontal);
516 
517  bool rp_set_accepted = true;
518 
519  // impossible signature
520  if (removeImpossible && top && bottom)
521  rp_set_accepted = false;
522 
523  // cleanliness cuts
524  if (units.size() < requireNumberOfUnits)
525  rp_set_accepted = false;
526 
527  if (requireOverlap && !overlap)
528  rp_set_accepted = false;
529 
530  if (requireAtLeast3PotsInOverlap && overlap && selectedRPs.size() < 3)
531  rp_set_accepted = false;
532 
533  // is it an additional accepted RP set?
534  if (find(additionalAcceptedRPSets.begin(), additionalAcceptedRPSets.end(), selectedRPs) !=
536  rp_set_accepted = true;
537 
538  if (verbosity > 5)
539  printf("* rp set accepted: %u\n", rp_set_accepted);
540 
541  bool selected = rp_set_accepted;
542 
543  // too bad chisq
544  if (cutOnChiSqPerNdf && trackFit.chiSqPerNdf() > chiSqPerNdfCut)
545  selected = false;
546 
547  // parallelity cut
548  if (fabs(trackFit.ax) > maxTrackAx || fabs(trackFit.ay) > maxTrackAy)
549  selected = false;
550 
551  updateDiagnosticHistograms(hitSelection, selectedRPs, trackFit, selected);
552 
553  if (verbosity > 5)
554  printf("* event selected: %u\n", selected);
555 
556  if (!selected)
557  return;
558 
559  // update counters
560  eventsSelected++;
561  selectedTracksPerRPSet[selectedRPs]++;
562 
563  for (const auto &h : hitSelection)
564  selectedHitsPerPlane[h.id]++;
565 
566  // -------------------- STEP 4: FEED ALGORITHMS
567 
568  for (auto &a : algorithms)
569  a->feed(hitSelection, trackFit);
570 
571  // -------------------- STEP 5: ENOUGH TRACKS?
572 
573  if (eventsSelected == maxEvents)
574  throw "StraightTrackAlignment: Number of tracks processed reached maximum";
575 }
bool cutOnChiSqPerNdf
whether to cut on chi^2/ndf
std::vector< unsigned int > rpIds
list of RPs for which the alignment parameters shall be optimized
signed int eventsSelected
counter of processed tracks
uint32_t arm() const
Definition: CTPPSDetId.h:57
unsigned int requireNumberOfUnits
select only tracks with activity in minimal number of units
double dz
x, y and z components of the direction unit vector in global coordinates
double chiSqPerNdf() const
Definition: LocalTrackFit.h:42
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
void updateDiagnosticHistograms(const HitCollection &selection, const std::set< unsigned int > &selectedRPs, const LocalTrackFit &trackFit, bool trackSelected)
fills diagnostic (chi^2, residua, ...) histograms
const DirectionData & getDirectionData(unsigned int idx) const
LocalTrackFitter fitter
track fitter
std::map< unsigned int, unsigned int > selectedHitsPerPlane
counter of selected hits per plane
const Double_t pi
signed int eventsTotal
counter of events
Local (linear) track description (or a fit result). Uses global reference system. ...
Definition: LocalTrackFit.h:15
AlignmentTask task
the alignment task to be solved
signed int maxEvents
stops after this event number has been reached
AlignmentGeometry geometry
the geometry for this task
Definition: AlignmentTask.h:48
unsigned int verbosity
verbosity level
T sqrt(T t)
Definition: SSEVec.h:19
bool removeImpossible
remove events with impossible signatures (i.e. simultaneously top and bottom)
bool fit(HitCollection &, const AlignmentGeometry &, LocalTrackFit &) const
bool requireOverlap
if true, only track through vertical-horizontal overlap are seleceted
bool isValidSensorId(unsigned int id) const
check whether the sensor Id is valid (present in the map)
SeedingHitSet::ConstRecHitPointer Hit
unsigned int id
A linear pattern in U or V projection. The intercept b is taken at the middle of a RP: (geometry->Get...
std::map< std::set< unsigned int >, unsigned long > selectedTracksPerRPSet
counter of selected tracks in a certain RP set
RunNumber_t run() const
Definition: EventID.h:38
std::vector< std::set< unsigned int > > additionalAcceptedRPSets
list of RP sets accepted irrespective of the other "require" settings
double chiSqPerNdfCut
the value of chi^2/ndf cut threshold
std::vector< Hit > HitCollection
Definition: HitCollection.h:35
std::vector< AlignmentAlgorithm * > algorithms
the collection of the alignment algorithms
Base class for CTPPS detector IDs.
Definition: CTPPSDetId.h:32
TString units(TString variable, Char_t axis)
signed int eventsFitted
counter of processed tracks
double a
Definition: hdecay.h:119
const DetGeometry & get(unsigned int id) const
retrieves sensor geometry
bool requireAtLeast3PotsInOverlap
if a track goes through overlap, select it only if it leaves signal in at least 3 pots ...
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
double maxTrackAx
cuts on absolute values of the track angle
std::map< std::set< unsigned int >, unsigned long > fittedTracksPerRPSet
counter of fitted tracks in a certain RP set
EventNumber_t event() const
Definition: EventID.h:40
double ax
slopes in rad
Definition: LocalTrackFit.h:20

◆ removeInsufficientPots()

void StraightTrackAlignment::removeInsufficientPots ( HitCollection ,
bool &  selectionChanged 
)
protected

removes the hits of pots with too few planes active

◆ saveDiagnostics()

void StraightTrackAlignment::saveDiagnostics ( ) const
protected

saves a ROOT file with diagnostic plots

Definition at line 1030 of file StraightTrackAlignment.cc.

References algorithms, visDQMUpload::buf, buildDiagnosticPlots, HltBtagPostValidation_cff::c, hgcalPerformanceValidation::df, diagnosticsFile, fitAxHist_fitted, fitAxHist_selected, fitAyHist_fitted, fitAyHist_selected, fitBxHist_fitted, fitBxHist_selected, fitByHist_fitted, fitByHist_selected, fitNdfHist_fitted, fitNdfHist_selected, fitPHist_fitted, fitPHist_selected, globalPlots, heavyIonCSV_trainingSettings::idx, genParticles_cff::map, residuaHistograms, rpSetPlots, setToString(), and StraightTrackAlignment::RPSetPlots::write().

Referenced by finish().

1030  {
1031  if (diagnosticsFile.empty())
1032  return;
1033 
1034  TFile *df = new TFile(diagnosticsFile.c_str(), "recreate");
1035  if (df->IsZombie())
1036  throw cms::Exception("PPS") << "Cannot open file `" << diagnosticsFile << "' for writing.";
1037 
1038  if (buildDiagnosticPlots) {
1039  TDirectory *commonDir = df->mkdir("common");
1040  gDirectory = commonDir;
1041 
1042  fitNdfHist_fitted->Write();
1043  fitNdfHist_selected->Write();
1044  fitAxHist_fitted->Write();
1045  fitAyHist_fitted->Write();
1046  fitAxHist_selected->Write();
1047  fitAyHist_selected->Write();
1048  fitBxHist_fitted->Write();
1049  fitByHist_fitted->Write();
1050  fitBxHist_selected->Write();
1051  fitByHist_selected->Write();
1052  fitPHist_fitted->Write();
1053  fitPHist_selected->Write();
1054 
1055  gDirectory = commonDir->mkdir("plots global");
1056  globalPlots.write();
1057 
1058  TDirectory *ppsDir = commonDir->mkdir("plots per RP set");
1059  for (map<set<unsigned int>, RPSetPlots>::const_iterator it = rpSetPlots.begin(); it != rpSetPlots.end(); ++it) {
1060  gDirectory = ppsDir->mkdir(setToString(it->first).c_str());
1061 
1062  it->second.write();
1063  }
1064 
1065  TDirectory *resDir = commonDir->mkdir("residuals");
1066  for (map<unsigned int, ResiduaHistogramSet>::const_iterator it = residuaHistograms.begin();
1067  it != residuaHistograms.end();
1068  ++it) {
1069  char buf[10];
1070  sprintf(buf, "%u", it->first);
1071  gDirectory = resDir->mkdir(buf);
1072  it->second.total_fitted->Write();
1073  it->second.total_selected->Write();
1074  it->second.selected_vs_chiSq->Write();
1075 
1076  /*
1077  gDirectory = gDirectory->mkdir("fitted per RP set");
1078  for (map< set<unsigned int>, TH1D* >::iterator sit = it->second.perRPSet_fitted.begin();
1079  sit != it->second.perRPSet_fitted.end(); ++sit)
1080  sit->second->Write();
1081  gDirectory->cd("..");
1082 */
1083 
1084  gDirectory = gDirectory->mkdir("selected per RP set");
1085  TCanvas *c = new TCanvas;
1086  c->SetName("alltogether");
1087  unsigned int idx = 0;
1088  for (map<set<unsigned int>, TH1D *>::const_iterator sit = it->second.perRPSet_selected.begin();
1089  sit != it->second.perRPSet_selected.end();
1090  ++sit, ++idx) {
1091  sit->second->SetLineColor(idx + 1);
1092  sit->second->Draw((idx == 0) ? "" : "same");
1093  sit->second->Write();
1094  }
1095  c->Write();
1096  }
1097  }
1098 
1099  // save diagnostics of algorithms
1100  for (vector<AlignmentAlgorithm *>::const_iterator it = algorithms.begin(); it != algorithms.end(); ++it) {
1101  TDirectory *algDir = df->mkdir((*it)->getName().c_str());
1102  (*it)->saveDiagnostics(algDir);
1103  }
1104 
1105  delete df;
1106 }
TH1D * fitNdfHist_selected
fit num. of degrees of freedom histograms for all/selected tracks
TH1D * fitAyHist_selected
fit ay histograms for all/selected tracks
bool buildDiagnosticPlots
whether to build and save diagnostic plots
TH1D * fitPHist_selected
fit p-value histograms for all/selected tracks
RPSetPlots globalPlots
global (all RP sets) chi^2 histograms
TH1D * fitAxHist_selected
fit ax histograms for all/selected tracks
std::vector< AlignmentAlgorithm * > algorithms
the collection of the alignment algorithms
static std::string setToString(const std::set< unsigned int > &)
converts a set to string
std::string diagnosticsFile
file name for some event selection statistics
TH1D * fitByHist_selected
fit by histograms for all/selected tracks
TH1D * fitBxHist_selected
fit bx histograms for all/selected tracks
std::map< unsigned int, ResiduaHistogramSet > residuaHistograms
residua histograms
std::map< std::set< unsigned int >, RPSetPlots > rpSetPlots
chi^2 histograms per RP set

◆ setToString()

string StraightTrackAlignment::setToString ( const std::set< unsigned int > &  )
staticprotected

converts a set to string

Definition at line 949 of file StraightTrackAlignment.cc.

References visDQMUpload::buf, mps_fire::i, N, alignCSCRings::s, and str.

Referenced by finish(), saveDiagnostics(), and updateDiagnosticHistograms().

949  {
950  unsigned int N = s.size();
951  if (N == 0)
952  return "empty";
953 
954  string str;
955  char buf[10];
956  unsigned int i = 0;
957  for (set<unsigned int>::iterator it = s.begin(); it != s.end(); ++it, ++i) {
958  sprintf(buf, "%u", *it);
959  str += buf;
960  if (i < N - 1)
961  str += ", ";
962  }
963 
964  return str;
965 }
#define N
Definition: blowfish.cc:9
#define str(s)

◆ updateDiagnosticHistograms()

void StraightTrackAlignment::updateDiagnosticHistograms ( const HitCollection selection,
const std::set< unsigned int > &  selectedRPs,
const LocalTrackFit trackFit,
bool  trackSelected 
)
protected

fills diagnostic (chi^2, residua, ...) histograms

Definition at line 579 of file StraightTrackAlignment.cc.

References LocalTrackFit::ax, LocalTrackFit::ay, visDQMUpload::buf, buildDiagnosticPlots, LocalTrackFit::bx, LocalTrackFit::by, StraightTrackAlignment::RPSetPlots::chisqn_lin_fitted, StraightTrackAlignment::RPSetPlots::chisqn_lin_selected, StraightTrackAlignment::RPSetPlots::chisqn_log_fitted, StraightTrackAlignment::RPSetPlots::chisqn_log_selected, LocalTrackFit::chiSqPerNdf(), f, dqmdumpme::first, fitAxHist_fitted, fitAxHist_selected, StraightTrackAlignment::RPSetPlots::fitAxVsAyGraph_fitted, StraightTrackAlignment::RPSetPlots::fitAxVsAyGraph_selected, fitAyHist_fitted, fitAyHist_selected, fitBxHist_fitted, fitBxHist_selected, StraightTrackAlignment::RPSetPlots::fitBxVsByGraph_fitted, StraightTrackAlignment::RPSetPlots::fitBxVsByGraph_selected, fitByHist_fitted, fitByHist_selected, fitNdfHist_fitted, fitNdfHist_selected, fitPHist_fitted, fitPHist_selected, relativeConstraints::geom, AlignmentTask::geometry, AlignmentGeometry::get(), globalPlots, hit::id, label, visualization-live-secondInstance_cfg::m, LocalTrackFit::ndf, newResiduaHist(), LocalTrackFit::pValue(), dttmaxenums::R, residuaHistograms, rpSetPlots, corrVsCorr::selection, setToString(), task, x, y, and hit::z.

Referenced by processEvent().

582  {
584  return;
585 
586  fitNdfHist_fitted->Fill(trackFit.ndf);
587  fitPHist_fitted->Fill(trackFit.pValue());
588  fitAxHist_fitted->Fill(trackFit.ax);
589  fitAyHist_fitted->Fill(trackFit.ay);
590  fitBxHist_fitted->Fill(trackFit.bx);
591  fitByHist_fitted->Fill(trackFit.by);
592 
593  globalPlots.chisqn_lin_fitted->Fill(trackFit.chiSqPerNdf());
594  globalPlots.chisqn_log_fitted->Fill(log10(trackFit.chiSqPerNdf()));
595  globalPlots.fitAxVsAyGraph_fitted->SetPoint(globalPlots.fitAxVsAyGraph_fitted->GetN(), trackFit.ax, trackFit.ay);
596  globalPlots.fitBxVsByGraph_fitted->SetPoint(globalPlots.fitBxVsByGraph_fitted->GetN(), trackFit.bx, trackFit.by);
597 
598  if (trackSelected) {
599  fitNdfHist_selected->Fill(trackFit.ndf);
600  fitPHist_selected->Fill(trackFit.pValue());
601  fitAxHist_selected->Fill(trackFit.ax);
602  fitAyHist_selected->Fill(trackFit.ay);
603  fitBxHist_selected->Fill(trackFit.bx);
604  fitByHist_selected->Fill(trackFit.by);
605 
606  globalPlots.chisqn_lin_selected->Fill(trackFit.chiSqPerNdf());
607  globalPlots.chisqn_log_selected->Fill(log10(trackFit.chiSqPerNdf()));
609  globalPlots.fitAxVsAyGraph_selected->GetN(), trackFit.ax, trackFit.ay);
611  globalPlots.fitBxVsByGraph_selected->GetN(), trackFit.bx, trackFit.by);
612  }
613 
614  auto it = rpSetPlots.find(selectedRPs);
615  if (it == rpSetPlots.end())
616  it = rpSetPlots.insert({selectedRPs, RPSetPlots(setToString(selectedRPs))}).first;
617 
618  it->second.chisqn_lin_fitted->Fill(trackFit.chiSqPerNdf());
619  it->second.chisqn_log_fitted->Fill(log10(trackFit.chiSqPerNdf()));
620  it->second.fitAxVsAyGraph_fitted->SetPoint(it->second.fitAxVsAyGraph_fitted->GetN(), trackFit.ax, trackFit.ay);
621  it->second.fitBxVsByGraph_fitted->SetPoint(it->second.fitBxVsByGraph_fitted->GetN(), trackFit.bx, trackFit.by);
622 
623  if (trackSelected) {
624  it->second.chisqn_lin_selected->Fill(trackFit.chiSqPerNdf());
625  it->second.chisqn_log_selected->Fill(log10(trackFit.chiSqPerNdf()));
626  it->second.fitAxVsAyGraph_selected->SetPoint(it->second.fitAxVsAyGraph_selected->GetN(), trackFit.ax, trackFit.ay);
627  it->second.fitBxVsByGraph_selected->SetPoint(it->second.fitBxVsByGraph_selected->GetN(), trackFit.bx, trackFit.by);
628  }
629 
630  for (const auto &hit : selection) {
631  unsigned int id = hit.id;
632 
633  const DetGeometry &geom = task.geometry.get(id);
634  const auto dirData = geom.getDirectionData(hit.dirIdx);
635 
636  double m = hit.position + dirData.s - (hit.z - geom.z) * dirData.dz;
637  double x = trackFit.ax * hit.z + trackFit.bx;
638  double y = trackFit.ay * hit.z + trackFit.by;
639  double f = x * dirData.dx + y * dirData.dy;
640  double R = m - f;
641 
642  auto it = residuaHistograms.find(id);
643  if (it == residuaHistograms.end()) {
644  it = residuaHistograms.insert(pair<unsigned int, ResiduaHistogramSet>(id, ResiduaHistogramSet())).first;
645  char buf[30];
646  sprintf(buf, "%u: total_fitted", id);
647  it->second.total_fitted = newResiduaHist(buf);
648  sprintf(buf, "%u: total_selected", id);
649  it->second.total_selected = newResiduaHist(buf);
650  it->second.selected_vs_chiSq = new TGraph();
651  sprintf(buf, "%u: selected_vs_chiSq", id);
652  it->second.selected_vs_chiSq->SetName(buf);
653  }
654 
655  it->second.total_fitted->Fill(R);
656 
657  if (trackSelected) {
658  it->second.total_selected->Fill(R);
659  it->second.selected_vs_chiSq->SetPoint(it->second.selected_vs_chiSq->GetN(), trackFit.chiSqPerNdf(), R);
660  }
661 
662  auto sit = it->second.perRPSet_fitted.find(selectedRPs);
663  if (sit == it->second.perRPSet_fitted.end()) {
664  char buf[10];
665  sprintf(buf, "%u: ", id);
666  string label = buf;
667  label += setToString(selectedRPs);
668  sit =
669  it->second.perRPSet_fitted.insert(pair<set<unsigned int>, TH1D *>(selectedRPs, newResiduaHist(label.c_str())))
670  .first;
671  }
672 
673  sit->second->Fill(R);
674 
675  if (trackSelected) {
676  sit = it->second.perRPSet_selected.find(selectedRPs);
677  if (sit == it->second.perRPSet_selected.end()) {
678  char buf[10];
679  sprintf(buf, "%u: ", id);
680  string label = buf;
681  label += setToString(selectedRPs);
682  sit = it->second.perRPSet_selected
683  .insert(pair<set<unsigned int>, TH1D *>(selectedRPs, newResiduaHist(label.c_str())))
684  .first;
685  }
686 
687  sit->second->Fill(R);
688  }
689  }
690 }
TGraph * fitBxVsByGraph_fitted
plots bx vs. by
TH1D * fitNdfHist_selected
fit num. of degrees of freedom histograms for all/selected tracks
A structure to hold relevant geometrical information about one detector/sensor.
TH1D * fitAyHist_selected
fit ay histograms for all/selected tracks
bool buildDiagnosticPlots
whether to build and save diagnostic plots
selection
main part
Definition: corrVsCorr.py:100
double chiSqPerNdf() const
Definition: LocalTrackFit.h:42
TH1D * fitPHist_selected
fit p-value histograms for all/selected tracks
TGraph * fitAxVsAyGraph_fitted
plots ax vs. ay
char const * label
AlignmentTask task
the alignment task to be solved
AlignmentGeometry geometry
the geometry for this task
Definition: AlignmentTask.h:48
signed int ndf
the number of degrees of freedom
Definition: LocalTrackFit.h:26
double pValue() const
Definition: LocalTrackFit.h:40
double f[11][100]
RPSetPlots globalPlots
global (all RP sets) chi^2 histograms
TH1D * newResiduaHist(const char *name)
creates a new residua histogram
unsigned int id
TH1D * chisqn_lin_fitted
normalised chi^2 histograms for all/selected tracks, in linear/logarithmic scale
TH1D * fitAxHist_selected
fit ax histograms for all/selected tracks
static std::string setToString(const std::set< unsigned int > &)
converts a set to string
const DetGeometry & get(unsigned int id) const
retrieves sensor geometry
TH1D * fitByHist_selected
fit by histograms for all/selected tracks
TH1D * fitBxHist_selected
fit bx histograms for all/selected tracks
std::map< unsigned int, ResiduaHistogramSet > residuaHistograms
residua histograms
double bx
intercepts in mm
Definition: LocalTrackFit.h:23
double ax
slopes in rad
Definition: LocalTrackFit.h:20
std::map< std::set< unsigned int >, RPSetPlots > rpSetPlots
chi^2 histograms per RP set

Member Data Documentation

◆ additionalAcceptedRPSets

std::vector<std::set<unsigned int> > StraightTrackAlignment::additionalAcceptedRPSets
protected

list of RP sets accepted irrespective of the other "require" settings

Definition at line 119 of file StraightTrackAlignment.h.

Referenced by processEvent(), and StraightTrackAlignment().

◆ algorithms

std::vector<AlignmentAlgorithm *> StraightTrackAlignment::algorithms
protected

◆ buildDiagnosticPlots

bool StraightTrackAlignment::buildDiagnosticPlots
protected

whether to build and save diagnostic plots

Definition at line 164 of file StraightTrackAlignment.h.

Referenced by saveDiagnostics(), and updateDiagnosticHistograms().

◆ chiSqPerNdfCut

double StraightTrackAlignment::chiSqPerNdfCut
protected

the value of chi^2/ndf cut threshold

Definition at line 112 of file StraightTrackAlignment.h.

Referenced by processEvent().

◆ constraintsType

ConstraintsType StraightTrackAlignment::constraintsType
protected

the chosen type of constraints

Definition at line 89 of file StraightTrackAlignment.h.

Referenced by buildConstraints(), and StraightTrackAlignment().

◆ cumulativeFileNamePrefix

std::string StraightTrackAlignment::cumulativeFileNamePrefix
protected

file name prefix for cumulative result files

Definition at line 127 of file StraightTrackAlignment.h.

◆ cutOnChiSqPerNdf

bool StraightTrackAlignment::cutOnChiSqPerNdf
protected

whether to cut on chi^2/ndf

Definition at line 109 of file StraightTrackAlignment.h.

Referenced by processEvent().

◆ diagnosticsFile

std::string StraightTrackAlignment::diagnosticsFile
protected

file name for some event selection statistics

Definition at line 167 of file StraightTrackAlignment.h.

Referenced by saveDiagnostics().

◆ eventsFitted

signed int StraightTrackAlignment::eventsFitted
protected

counter of processed tracks

Definition at line 170 of file StraightTrackAlignment.h.

Referenced by begin(), finish(), and processEvent().

◆ eventsSelected

signed int StraightTrackAlignment::eventsSelected
protected

counter of processed tracks

Definition at line 171 of file StraightTrackAlignment.h.

Referenced by begin(), finish(), and processEvent().

◆ eventsTotal

signed int StraightTrackAlignment::eventsTotal
protected

◆ excludePlanes

std::vector<unsigned int> StraightTrackAlignment::excludePlanes
protected

list of planes to be excluded from processing

Definition at line 76 of file StraightTrackAlignment.h.

Referenced by begin().

◆ expandedFileNamePrefix

std::string StraightTrackAlignment::expandedFileNamePrefix
protected

file name prefix for cumulative expanded result files

Definition at line 130 of file StraightTrackAlignment.h.

Referenced by finish().

◆ factoredFileNamePrefix

std::string StraightTrackAlignment::factoredFileNamePrefix
protected

file name prefix for cumulative factored result files

Definition at line 133 of file StraightTrackAlignment.h.

Referenced by finish().

◆ fileNamePrefix

std::string StraightTrackAlignment::fileNamePrefix
protected

file name prefix for result files

Definition at line 124 of file StraightTrackAlignment.h.

Referenced by finish().

◆ fitAxHist_fitted

TH1D* StraightTrackAlignment::fitAxHist_fitted
protected

◆ fitAxHist_selected

TH1D * StraightTrackAlignment::fitAxHist_selected
protected

fit ax histograms for all/selected tracks

Definition at line 181 of file StraightTrackAlignment.h.

Referenced by saveDiagnostics(), updateDiagnosticHistograms(), and ~StraightTrackAlignment().

◆ fitAyHist_fitted

TH1D* StraightTrackAlignment::fitAyHist_fitted
protected

◆ fitAyHist_selected

TH1D * StraightTrackAlignment::fitAyHist_selected
protected

fit ay histograms for all/selected tracks

Definition at line 182 of file StraightTrackAlignment.h.

Referenced by saveDiagnostics(), updateDiagnosticHistograms(), and ~StraightTrackAlignment().

◆ fitBxHist_fitted

TH1D* StraightTrackAlignment::fitBxHist_fitted
protected

◆ fitBxHist_selected

TH1D * StraightTrackAlignment::fitBxHist_selected
protected

fit bx histograms for all/selected tracks

Definition at line 183 of file StraightTrackAlignment.h.

Referenced by saveDiagnostics(), updateDiagnosticHistograms(), and ~StraightTrackAlignment().

◆ fitByHist_fitted

TH1D* StraightTrackAlignment::fitByHist_fitted
protected

◆ fitByHist_selected

TH1D * StraightTrackAlignment::fitByHist_selected
protected

fit by histograms for all/selected tracks

Definition at line 184 of file StraightTrackAlignment.h.

Referenced by saveDiagnostics(), updateDiagnosticHistograms(), and ~StraightTrackAlignment().

◆ fitNdfHist_fitted

TH1D* StraightTrackAlignment::fitNdfHist_fitted
protected

◆ fitNdfHist_selected

TH1D * StraightTrackAlignment::fitNdfHist_selected
protected

fit num. of degrees of freedom histograms for all/selected tracks

Definition at line 179 of file StraightTrackAlignment.h.

Referenced by saveDiagnostics(), updateDiagnosticHistograms(), and ~StraightTrackAlignment().

◆ fitPHist_fitted

TH1D* StraightTrackAlignment::fitPHist_fitted
protected

◆ fitPHist_selected

TH1D * StraightTrackAlignment::fitPHist_selected
protected

fit p-value histograms for all/selected tracks

Definition at line 180 of file StraightTrackAlignment.h.

Referenced by saveDiagnostics(), updateDiagnosticHistograms(), and ~StraightTrackAlignment().

◆ fittedTracksPerRPSet

std::map<std::set<unsigned int>, unsigned long> StraightTrackAlignment::fittedTracksPerRPSet
protected

counter of fitted tracks in a certain RP set

Definition at line 173 of file StraightTrackAlignment.h.

Referenced by begin(), finish(), and processEvent().

◆ fitter

LocalTrackFitter StraightTrackAlignment::fitter
protected

track fitter

Definition at line 156 of file StraightTrackAlignment.h.

Referenced by begin(), and processEvent().

◆ globalPlots

RPSetPlots StraightTrackAlignment::globalPlots
protected

global (all RP sets) chi^2 histograms

Definition at line 209 of file StraightTrackAlignment.h.

Referenced by saveDiagnostics(), updateDiagnosticHistograms(), and ~StraightTrackAlignment().

◆ initialAlignments

CTPPSRPAlignmentCorrectionsData StraightTrackAlignment::initialAlignments
protected

(real geometry) alignments before this alignment iteration

Definition at line 159 of file StraightTrackAlignment.h.

Referenced by begin(), and finish().

◆ maxEvents

signed int StraightTrackAlignment::maxEvents
protected

stops after this event number has been reached

Definition at line 92 of file StraightTrackAlignment.h.

Referenced by processEvent().

◆ maxTrackAx

double StraightTrackAlignment::maxTrackAx
protected

cuts on absolute values of the track angle

Definition at line 115 of file StraightTrackAlignment.h.

Referenced by processEvent().

◆ maxTrackAy

double StraightTrackAlignment::maxTrackAy
protected

Definition at line 116 of file StraightTrackAlignment.h.

Referenced by processEvent().

◆ preciseXMLFormat

bool StraightTrackAlignment::preciseXMLFormat
protected

whether to use long format (many decimal digits) when saving XML files

Definition at line 136 of file StraightTrackAlignment.h.

Referenced by finish().

◆ removeImpossible

bool StraightTrackAlignment::removeImpossible
protected

remove events with impossible signatures (i.e. simultaneously top and bottom)

Definition at line 97 of file StraightTrackAlignment.h.

Referenced by processEvent().

◆ requireAtLeast3PotsInOverlap

bool StraightTrackAlignment::requireAtLeast3PotsInOverlap
protected

if a track goes through overlap, select it only if it leaves signal in at least 3 pots

Definition at line 103 of file StraightTrackAlignment.h.

Referenced by processEvent().

◆ requireNumberOfUnits

unsigned int StraightTrackAlignment::requireNumberOfUnits
protected

select only tracks with activity in minimal number of units

Definition at line 100 of file StraightTrackAlignment.h.

Referenced by processEvent().

◆ requireOverlap

bool StraightTrackAlignment::requireOverlap
protected

if true, only track through vertical-horizontal overlap are seleceted

Definition at line 106 of file StraightTrackAlignment.h.

Referenced by processEvent().

◆ residuaHistograms

std::map<unsigned int, ResiduaHistogramSet> StraightTrackAlignment::residuaHistograms
protected

residua histograms

Definition at line 222 of file StraightTrackAlignment.h.

Referenced by saveDiagnostics(), updateDiagnosticHistograms(), and ~StraightTrackAlignment().

◆ rpIds

std::vector<unsigned int> StraightTrackAlignment::rpIds
protected

list of RPs for which the alignment parameters shall be optimized

Definition at line 73 of file StraightTrackAlignment.h.

Referenced by begin(), and processEvent().

◆ rpSetPlots

std::map<std::set<unsigned int>, RPSetPlots> StraightTrackAlignment::rpSetPlots
protected

chi^2 histograms per RP set

Definition at line 212 of file StraightTrackAlignment.h.

Referenced by saveDiagnostics(), updateDiagnosticHistograms(), and ~StraightTrackAlignment().

◆ saveIntermediateResults

bool StraightTrackAlignment::saveIntermediateResults
protected

whether itermediate results (S, CS matrices) of alignments shall be saved

Definition at line 142 of file StraightTrackAlignment.h.

Referenced by finish().

◆ saveXMLUncertainties

bool StraightTrackAlignment::saveXMLUncertainties
protected

whether to save uncertainties in the result XML files

Definition at line 139 of file StraightTrackAlignment.h.

Referenced by finish().

◆ selectedHitsPerPlane

std::map<unsigned int, unsigned int> StraightTrackAlignment::selectedHitsPerPlane
protected

counter of selected hits per plane

Definition at line 177 of file StraightTrackAlignment.h.

Referenced by begin(), finish(), and processEvent().

◆ selectedTracksPerRPSet

std::map<std::set<unsigned int>, unsigned long> StraightTrackAlignment::selectedTracksPerRPSet
protected

counter of selected tracks in a certain RP set

Definition at line 175 of file StraightTrackAlignment.h.

Referenced by begin(), finish(), and processEvent().

◆ task

AlignmentTask StraightTrackAlignment::task
protected

◆ taskDataFile

TFile* StraightTrackAlignment::taskDataFile
protected

the file with task data

Definition at line 148 of file StraightTrackAlignment.h.

Referenced by begin(), finish(), StraightTrackAlignment(), and ~StraightTrackAlignment().

◆ taskDataFileName

std::string StraightTrackAlignment::taskDataFileName
protected

the name task data file

Definition at line 145 of file StraightTrackAlignment.h.

Referenced by StraightTrackAlignment().

◆ verbosity

unsigned int StraightTrackAlignment::verbosity
protected

verbosity level

Definition at line 70 of file StraightTrackAlignment.h.

Referenced by begin(), finish(), and processEvent().

◆ z0

double StraightTrackAlignment::z0
protected

a characteristic z in mm to keep values of z small - this helps the numerical solution

Definition at line 80 of file StraightTrackAlignment.h.

Referenced by begin().