Go to the documentation of this file.00001 #ifndef Alignment_CommonAlignmentAlgorithm_TrackerAlignmentProducer_h
00002 #define Alignment_CommonAlignmentAlgorithm_TrackerAlignmentProducer_h
00003
00013
00014 #include <vector>
00015
00016
00017 #include "FWCore/Framework/interface/ESProducerLooper.h"
00018 #include "FWCore/Framework/interface/ESHandle.h"
00019 #include "FWCore/Framework/interface/ESWatcher.h"
00020
00021 #include "DataFormats/Provenance/interface/RunID.h"
00022
00023
00024 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00025
00026
00027 #include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentAlgorithmBase.h"
00028 #include "Alignment/CommonAlignmentMonitor/interface/AlignmentMonitorBase.h"
00029 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00030 #include <Geometry/Records/interface/MuonGeometryRecord.h>
00031 #include "Alignment/CommonAlignment/interface/AlignableExtras.h"
00032 #include "Alignment/TrackerAlignment/interface/AlignableTracker.h"
00033 #include "Alignment/MuonAlignment/interface/AlignableMuon.h"
00034 #include <FWCore/Framework/interface/Frameworkfwd.h>
00035 #include "CondCore/DBCommon/interface/Time.h"
00036 #include "CondFormats/Alignment/interface/Alignments.h"
00037 #include "CondFormats/Alignment/interface/AlignmentSurfaceDeformations.h"
00038
00039
00040 #include "CondFormats/AlignmentRecord/interface/TrackerSurveyRcd.h"
00041 #include "CondFormats/AlignmentRecord/interface/TrackerSurveyErrorRcd.h"
00042 #include "CondFormats/AlignmentRecord/interface/DTSurveyRcd.h"
00043 #include "CondFormats/AlignmentRecord/interface/DTSurveyErrorRcd.h"
00044 #include "CondFormats/AlignmentRecord/interface/CSCSurveyRcd.h"
00045 #include "CondFormats/AlignmentRecord/interface/CSCSurveyErrorRcd.h"
00046
00047
00048 class Alignments;
00049 class SurveyErrors;
00050 namespace edm {
00051 class Run;
00052 class LuminosityBlock;
00053 }
00054
00055 class AlignmentProducer : public edm::ESProducerLooper
00056 {
00057
00058 public:
00059 typedef std::vector<Alignable*> Alignables;
00060 typedef std::pair<const Trajectory*, const reco::Track*> ConstTrajTrackPair;
00061 typedef std::vector<ConstTrajTrackPair> ConstTrajTrackPairCollection;
00062
00063 typedef AlignmentAlgorithmBase::RunNumber RunNumber;
00064 typedef AlignmentAlgorithmBase::RunRange RunRange;
00065 typedef std::vector<RunRange> RunRanges;
00066
00068 AlignmentProducer( const edm::ParameterSet& iConfig );
00069
00071 ~AlignmentProducer();
00072
00074 virtual boost::shared_ptr<TrackerGeometry> produceTracker( const TrackerDigiGeometryRecord& iRecord );
00076 virtual boost::shared_ptr<DTGeometry> produceDT( const MuonGeometryRecord& iRecord );
00078 virtual boost::shared_ptr<CSCGeometry> produceCSC( const MuonGeometryRecord& iRecord );
00079
00081 virtual void beginOfJob(const edm::EventSetup&);
00082
00084 virtual void endOfJob();
00085
00087 virtual void startingNewLoop( unsigned int iLoop );
00088
00090 virtual Status endOfLoop( const edm::EventSetup&, unsigned int iLoop );
00091
00093 virtual void beginRun(const edm::Run &run, const edm::EventSetup &setup);
00095 virtual void endRun(const edm::Run &run, const edm::EventSetup &setup);
00096
00098 virtual void beginLuminosityBlock(const edm::LuminosityBlock &lumiBlock,
00099 const edm::EventSetup &setup);
00101 virtual void endLuminosityBlock(const edm::LuminosityBlock &lumiBlock,
00102 const edm::EventSetup &setup);
00104 virtual Status duringLoop(const edm::Event &event, const edm::EventSetup &setup);
00105
00106 private:
00107
00108
00109
00111 void simpleMisalignment_(const Alignables &alivec, const std::string &selection,
00112 float shift, float rot, bool local);
00113
00115 void createGeometries_( const edm::EventSetup& );
00116
00119 template<class G, class Rcd, class ErrRcd>
00120 void applyDB(G *geometry, const edm::EventSetup &iSetup,
00121 const AlignTransform &globalPosition) const;
00123 template<class G, class DeformationRcd>
00124 void applyDB(G *geometry, const edm::EventSetup &iSetup) const;
00125
00129 void writeDB(Alignments *alignments, const std::string &alignRcd,
00130 AlignmentErrors *alignmentErrors, const std::string &errRcd,
00131 const AlignTransform *globalCoordinates,
00132 cond::Time_t time = cond::timeTypeSpecs[cond::runnumber].beginValue) const;
00135 void writeDB(AlignmentSurfaceDeformations *alignmentSurfaceDeformations,
00136 const std::string &surfaceDeformationRcd) const;
00137
00139 void addSurveyInfo_(Alignable*);
00140
00142 void readInSurveyRcds( const edm::EventSetup& );
00143
00144 RunRanges makeNonOverlappingRunRanges(const edm::VParameterSet& RunRangeSelectionVPSet);
00145
00146
00147
00148 unsigned int theSurveyIndex;
00149 const Alignments* theSurveyValues;
00150 const SurveyErrors* theSurveyErrors;
00151
00152 AlignmentAlgorithmBase* theAlignmentAlgo;
00153 std::vector<AlignmentMonitorBase*> theMonitors;
00154 AlignmentParameterStore* theAlignmentParameterStore;
00155
00156 AlignableExtras* theAlignableExtras;
00157 AlignableTracker* theAlignableTracker;
00158 AlignableMuon* theAlignableMuon;
00159
00160 boost::shared_ptr<TrackerGeometry> theTracker;
00161 boost::shared_ptr<DTGeometry> theMuonDT;
00162 boost::shared_ptr<CSCGeometry> theMuonCSC;
00164 const Alignments *globalPositions_;
00165
00166 int nevent_;
00167 edm::ParameterSet theParameterSet;
00168
00169
00170
00171 const unsigned int theMaxLoops;
00172
00173 const int stNFixAlignables_;
00174 const double stRandomShift_,stRandomRotation_;
00175 const bool applyDbAlignment_,doMisalignmentScenario_;
00176 const bool saveToDB_, saveApeToDB_,saveDeformationsToDB_;
00177 const bool doTracker_,doMuon_,useExtras_;
00178 const bool useSurvey_;
00179
00180
00181 const edm::InputTag tjTkAssociationMapTag_;
00182 const edm::InputTag beamSpotTag_;
00183 const edm::InputTag tkLasBeamTag_;
00184 const edm::InputTag clusterValueMapTag_;
00185
00186
00187
00188 edm::ESWatcher<TrackerSurveyRcd> watchTkSurveyRcd_;
00189 edm::ESWatcher<TrackerSurveyErrorRcd> watchTkSurveyErrRcd_;
00190 edm::ESWatcher<DTSurveyRcd> watchDTSurveyRcd_;
00191 edm::ESWatcher<DTSurveyErrorRcd> watchDTSurveyErrRcd_;
00192 edm::ESWatcher<CSCSurveyRcd> watchCSCSurveyRcd_;
00193 edm::ESWatcher<CSCSurveyErrorRcd> watchCSCSurveyErrRcd_;
00194
00195 };
00196
00197 #endif