00001 #ifndef Alignment_OfflineValidation_MuonGeometryArrange_h
00002 #define Alignment_OfflineValidation_MuonGeometryArrange_h
00003
00022 #include "FWCore/Framework/interface/EDAnalyzer.h"
00023 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00024 #include "Alignment/MuonAlignment/interface/AlignableMuon.h"
00025 #include "CondFormats/Alignment/interface/SurveyErrors.h"
00026 #include "Alignment/CommonAlignment/interface/StructureType.h"
00027
00028 #include "Alignment/CommonAlignment/interface/AlignTools.h"
00029
00030 #include <algorithm>
00031 #include "TTree.h"
00032
00033 class AlignTransform;
00034 class MuonAlignment;
00035 class TGraph;
00036 class TH2F;
00037
00038 class MuonGeometryArrange:
00039 public edm::EDAnalyzer
00040 {
00041 public:
00042 typedef AlignTransform SurveyValue;
00043 typedef Alignments SurveyValues;
00044 typedef std::vector<Alignable*> Alignables;
00045
00047 MuonGeometryArrange(
00048 const edm::ParameterSet&
00049 );
00050
00052 virtual void beginJob();
00053
00054 virtual void analyze(
00055 const edm::Event&,
00056 const edm::EventSetup&
00057 );
00058
00059
00060 private:
00061
00062
00063
00064 edm::ParameterSet m_params;
00065 std::vector<align::StructureType> theLevels;
00066
00067
00068
00069 void compare(Alignable* refAli, Alignable* curAli,
00070 Alignable* curAliCopy2);
00071 void endHist();
00072
00073 void compareGeometries(Alignable* refAli, Alignable* curAli,
00074 Alignable* curAliCopy2);
00075
00076 void fillTree(Alignable *refAli, AlgebraicVector diff);
00077
00078 void createROOTGeometry(const edm::EventSetup& iSetup);
00079 void makeGraph(int sizeI, float smi, float sma, float minV,
00080 float maxV, TH2F* dxh, TGraph* grx, const char* name, const char* title,
00081 const char* titleg, const char* axis, float* xp, float* yp, int numEntries);
00082
00083 bool passIdCut( uint32_t );
00084 bool checkChosen( Alignable* ali );
00085 bool passChosen( Alignable* ali );
00086
00087 bool isMother( Alignable* ali );
00088
00089 AlignableMuon* referenceMuon;
00090 AlignableMuon* dummyMuon;
00091 AlignableMuon* currentMuon;
00092 Alignable* inputGeometry1;
00093 Alignable* inputGeometry2;
00094
00095 unsigned int theSurveyIndex;
00096 const Alignments* theSurveyValues;
00097 const SurveyErrors* theSurveyErrors;
00098
00099
00100 std::string _inputFilename1;
00101 std::string _inputFilename2;
00102 std::string _inputTreename;
00103 bool _writeToDB;
00104 std::string _weightBy;
00105 std::string _setCommonMuonSystem;
00106 bool _detIdFlag;
00107 std::string _detIdFlagFile;
00108 bool _weightById;
00109 std::string _weightByIdFile;
00110 std::vector< unsigned int > _weightByIdVector;
00111 int _endcap;
00112 int _station;
00113 int _ring;
00114
00115 std::vector< uint32_t > _detIdFlagVector;
00116 align::StructureType _commonMuonLevel;
00117 align::GlobalVector _MuonCommonT;
00118 align::EulerAngles _MuonCommonR;
00119 align::PositionType _MuonCommonCM;
00120
00121
00122 std::string _filename;
00123
00124 struct MGACollection {
00125 int id;
00126 int level;
00127 int mid;
00128 int mlevel;
00129 int sublevel;
00130 float x,y,z;
00131 float r, phi, eta;
00132 float alpha, beta, gamma;
00133 float dx, dy, dz;
00134 float dr, dphi;
00135 float dalpha, dbeta, dgamma;
00136 float ldx, ldy, ldz;
00137 float ldr, ldphi;
00138 int useDetId, detDim;
00139 float rotx, roty, rotz;
00140 float drotx, droty, drotz;
00141 float surW, surL;
00142 double surRot[9];
00143 int phipos;
00144 };
00145
00146 std::vector<MGACollection> _mgacollection;
00147
00148 std::string _inputXMLCurrent;
00149 std::string _inputXMLReference;
00150 MuonAlignment* inputAlign1;
00151 MuonAlignment* inputAlign2;
00152 MuonAlignment* inputAlign2a;
00153
00154 TFile* _theFile;
00155 TTree* _alignTree;
00156 TFile* _inputRootFile1;
00157 TFile* _inputRootFile2;
00158 TTree* _inputTree1;
00159 TTree* _inputTree2;
00160
00161 int _id, _level, _mid, _mlevel, _sublevel, _useDetId, _detDim;
00162 float _xVal, _yVal, _zVal, _rVal, _phiVal, _alphaVal, _betaVal, _gammaVal, _etaVal;
00163 float _dxVal, _dyVal, _dzVal, _drVal, _dphiVal, _dalphaVal;
00164 float _dbetaVal, _dgammaVal, _ldxVal, _ldyVal, _ldzVal;
00165 float _ldrVal, _ldphiVal;
00166 float _rotxVal, _rotyVal, _rotzVal;
00167 float _drotxVal, _drotyVal, _drotzVal;
00168 float _surWidth, _surLength;
00169 double _surRot[9];
00170
00171 bool firstEvent_;
00172
00173 };
00174
00175
00176
00177
00178 #endif