CMS 3D CMS Logo

HIPAlignmentAlgorithm.h
Go to the documentation of this file.
1 #ifndef Alignment_HIPAlignmentAlgorithm_HIPAlignmentAlgorithm_h
2 #define Alignment_HIPAlignmentAlgorithm_HIPAlignmentAlgorithm_h
3 
4 #include <vector>
12 #include "Riostream.h"
13 
20 
23 
26 #include "TFormula.h"
27 
28 
29 class TFile;
30 class TTree;
31 
33 public:
34 
37 
39  ~HIPAlignmentAlgorithm() override{};
40 
42  void initialize(
43  const edm::EventSetup& setup,
46  ) override;
47 
49  void terminate(const edm::EventSetup& setup) override;
50 
52  void startNewLoop(void) override;
53 
55  void run(const edm::EventSetup& setup, const EventInfo& eventInfo) override;
56 
57 private:
58  bool processHit1D(
59  const AlignableDetOrUnitPtr& alidet,
60  const Alignable* ali,
61  const HIPAlignableSpecificParameters* alispecifics,
62  const TrajectoryStateOnSurface& tsos,
63  const TrackingRecHit* hit,
64  double hitwt
65  );
66 
67  bool processHit2D(
68  const AlignableDetOrUnitPtr& alidet,
69  const Alignable* ali,
70  const HIPAlignableSpecificParameters* alispecifics,
71  const TrajectoryStateOnSurface& tsos,
72  const TrackingRecHit* hit,
73  double hitwt
74  );
75 
77  void writeIterationFile(std::string filename, int iter);
78  void setAlignmentPositionError(void);
79  double calcAPE(double* par, int iter, int function);
80  void bookRoot(void);
81  void fillAlignablesMonitor(const edm::EventSetup& setup);
82  bool calcParameters(Alignable* ali, int setDet, double start, double step);
83  void collector(void);
84  void collectMonitorTrees(const std::vector<std::string>& filenames);
85 
87 
88  // private data members
89 
90  std::unique_ptr<AlignableObjectId> alignableObjectId_;
92  std::vector<Alignable*> theAlignables;
93  std::unique_ptr<AlignableNavigator> theAlignableDetAccessor;
94 
96  int ioerr;
98 
99  // steering parameters
100 
101  // verbosity flag
102  const bool verbose;
103  // Monitor configuration
106  // names of IO root files
109 
111  std::vector<unsigned> theIOVrangeSet;
112 
113  // alignment position error parameters
115  std::vector<edm::ParameterSet> theAPEParameterSet;
116  std::vector<std::pair<std::vector<Alignable*>, std::vector<double> > > theAPEParameters;
117 
118  // Default alignment specifications
119  // - min number of hits on alignable to calc parameters
120  // - max allowed rel error on parameter (else not used)
121  // - max allowed pull (residual / uncertainty) on a hit used in alignment
123 
125  std::vector<edm::ParameterSet> theCutsPerComponent;
126  std::vector<HIPAlignableSpecificParameters> theAlignableSpecifics;
127 
128  // collector mode (parallel processing)
132  int theDataGroup; // The data type specified in the cfg
136  std::vector<double> SetScanDet;
137 
138  std::unique_ptr<TFormula> theEtaFormula;
139 
140 
141  const std::vector<std::string> surveyResiduals_;
142  std::vector<align::StructureType> theLevels; // for survey residuals
143 
144  // root tree variables
146  TTree* theTrackMonitorTree; // event-wise tree
147  TTree* theHitMonitorTree; // hit-wise tree
149  TTree* theAlignablesMonitorTree; // alignable-wise tree
151  TTree* theSurveyTree; // survey tree
152 
153  // variables for event-wise tree
156  std::vector<float> m_Pt, m_Eta, m_Phi, m_Chi2n, m_P, m_d0, m_dz, m_wt;
157 
158  // variables for hit-wise tree
161  unsigned int m_rawQualityWord;
164 
165  // variables for alignable-wise tree
172  unsigned int m2_nsurfdef;
173  std::vector<float> m2_surfDef;
174 
175  // variables for survey tree
178  float m3_par[6];
179 };
180 
181 #endif
Definition: start.py:1
std::vector< float > m_Phi
std::vector< HIPAlignableSpecificParameters > theAlignableSpecifics
HIPAlignableSpecificParameters defaultAlignableSpecs
AlignmentParameterStore * theAlignmentParameterStore
std::vector< int > m_nhTEC
HIPAlignableSpecificParameters * findAlignableSpecs(const Alignable *ali)
void run(const edm::EventSetup &setup, const EventInfo &eventInfo) override
Run the algorithm.
void initialize(const edm::EventSetup &setup, AlignableTracker *tracker, AlignableMuon *muon, AlignableExtras *extras, AlignmentParameterStore *store) override
Call at beginning of job.
uint32_t ID
Definition: Definitions.h:26
std::vector< int > m_nhTIB
align::StructureType m2_ObjId
std::vector< float > m_wt
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
void writeIterationFile(std::string filename, int iter)
~HIPAlignmentAlgorithm() override
Destructor.
Interface/Base class for alignment algorithms, each alignment algorithm has to be derived from this c...
std::vector< float > m_Eta
std::unique_ptr< AlignableNavigator > theAlignableDetAccessor
define event information passed to algorithms
std::vector< unsigned > theIOVrangeSet
std::vector< float > m_d0
bool calcParameters(Alignable *ali, int setDet, double start, double step)
std::vector< float > m_Pt
std::vector< std::pair< std::vector< Alignable * >, std::vector< double > > > theAPEParameters
std::vector< int > m_Nhits
std::vector< float > m_Chi2n
HIPAlignmentAlgorithm(const edm::ParameterSet &cfg)
Constructor.
std::vector< edm::ParameterSet > theCutsPerComponent
std::vector< float > m_P
std::vector< float > m_dz
std::vector< int > m_nhTID
int readIterationFile(std::string filename)
std::vector< double > SetScanDet
void collectMonitorTrees(const std::vector< std::string > &filenames)
double calcAPE(double *par, int iter, int function)
std::unique_ptr< AlignableObjectId > alignableObjectId_
std::vector< edm::ParameterSet > theAPEParameterSet
align::StructureType m3_ObjId
std::unique_ptr< TFormula > theEtaFormula
std::vector< int > m_nhPXF
virtual void terminate()
Called at end of job (must be implemented in derived class)
std::vector< float > m2_surfDef
HIPMonitorConfig theMonitorConfig
void fillAlignablesMonitor(const edm::EventSetup &setup)
void startNewLoop(void) override
Called at start of new loop.
const std::vector< std::string > surveyResiduals_
step
bool processHit2D(const AlignableDetOrUnitPtr &alidet, const Alignable *ali, const HIPAlignableSpecificParameters *alispecifics, const TrajectoryStateOnSurface &tsos, const TrackingRecHit *hit, double hitwt)
eventInfo
add run, event number and lumi section
bool processHit1D(const AlignableDetOrUnitPtr &alidet, const Alignable *ali, const HIPAlignableSpecificParameters *alispecifics, const TrajectoryStateOnSurface &tsos, const TrackingRecHit *hit, double hitwt)
std::vector< int > m_nhTOB
Constructor of the full muon geometry.
Definition: AlignableMuon.h:37
std::vector< int > m_nhPXB
std::vector< align::StructureType > theLevels
std::vector< Alignable * > theAlignables
SurfaceDeformationFactory::Type m2_dtype