CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/Alignment/MuonAlignment/plugins/MuonGeometryArrange.h

Go to the documentation of this file.
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 //        virtual void endJob(void);
00059         
00060 private:
00061 
00062 
00063         //parameters
00064         edm::ParameterSet m_params;
00065         std::vector<align::StructureType> theLevels;
00066         //std::vector<int> theSubDets;
00067         
00068         //compares two geometries, driver routine
00069         void compare(Alignable* refAli, Alignable* curAli,
00070                 Alignable* curAliCopy2);
00071         void endHist();
00072         // Map one onto other and compare details
00073         void compareGeometries(Alignable* refAli, Alignable* curAli,
00074                 Alignable* curAliCopy2);
00075         //filling the ROOT file
00076         void fillTree(Alignable *refAli, AlgebraicVector diff);
00077         //void createDBGeometry(const edm::EventSetup& iSetup);
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 );     // Is ali one of wanted CSC?
00085         bool passChosen( Alignable* ali );      // Is ali either one of wanted
00086                                                 // CSC or does it contain them?
00087         bool isMother( Alignable* ali );        // Is ali the container (ring)?
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         // configurables
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         //root configuration
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;       // no deta?
00135   float dalpha, dbeta, dgamma;
00136   float ldx, ldy, ldz;
00137   float ldr, ldphi;       // no deta?
00138   int useDetId, detDim;
00139   float rotx, roty, rotz;
00140   float drotx, droty, drotz;
00141   float surW, surL;     // surWidth and length
00142   double surRot[9];
00143   int phipos;
00144 };
00145 
00146         std::vector<MGACollection> _mgacollection;      
00147         // Two sets of alignment inputs
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