File indexing completed on 2024-08-13 05:00:11
0001
0002 #ifndef LaserAlignment_LaserAlignment_H
0003 #define LaserAlignment_LaserAlignment_H
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include <sstream>
0015 #include <iostream>
0016 #include <cmath>
0017
0018 #include "FWCore/Framework/interface/Event.h"
0019 #include "FWCore/Framework/interface/one/EDProducer.h"
0020 #include "FWCore/Framework/interface/ESHandle.h"
0021 #include "FWCore/Framework/interface/EventSetup.h"
0022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0023 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0024 #include "FWCore/ServiceRegistry/interface/Service.h"
0025
0026 #include "DataFormats/Common/interface/DetSetVector.h"
0027 #include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
0028 #include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h"
0029 #include "DataFormats/DetId/interface/DetId.h"
0030 #include "DataFormats/SiStripDetId/interface/SiStripDetId.h"
0031 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
0032
0033 #include "DataFormats/GeometryCommonDetAlgo/interface/ErrorFrameTransformer.h"
0034 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0035 #include "DataFormats/Alignment/interface/SiStripLaserRecHit2D.h"
0036 #include "DataFormats/Alignment/interface/TkLasBeam.h"
0037
0038 #include "CondFormats/SiStripObjects/interface/SiStripPedestals.h"
0039 #include "CondFormats/DataRecord/interface/SiStripPedestalsRcd.h"
0040 #include "CondFormats/Alignment/interface/DetectorGlobalPosition.h"
0041 #include "CondFormats/AlignmentRecord/interface/GlobalPositionRcd.h"
0042
0043 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
0044 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeomBuilderFromGeometricDet.h"
0045 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0046 #include "Geometry/CommonTopologies/interface/StripTopology.h"
0047 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0048 #include "Geometry/GeometryAligner/interface/GeometryAligner.h"
0049
0050 #include "Alignment/TrackerAlignment/interface/AlignableTracker.h"
0051
0052 #include "Alignment/LaserAlignment/interface/LASGlobalData.h"
0053 #include "Alignment/LaserAlignment/interface/LASGlobalLoop.h"
0054 #include "Alignment/LaserAlignment/interface/LASModuleProfile.h"
0055 #include "Alignment/LaserAlignment/interface/LASProfileJudge.h"
0056 #include "Alignment/LaserAlignment/interface/LASBarrelAlgorithm.h"
0057 #include "Alignment/LaserAlignment/interface/LASAlignmentTubeAlgorithm.h"
0058 #include "Alignment/LaserAlignment/interface/LASEndcapAlgorithm.h"
0059 #include "Alignment/LaserAlignment/interface/LASPeakFinder.h"
0060 #include "Alignment/LaserAlignment/interface/LASCoordinateSet.h"
0061 #include "Alignment/LaserAlignment/interface/LASGeometryUpdater.h"
0062 #include "Alignment/LaserAlignment/interface/LASConstants.h"
0063
0064 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
0065
0066 #include "TH1.h"
0067 #include "TFile.h"
0068 #include "TF1.h"
0069
0070
0071
0072
0073 class LaserAlignment : public edm::one::EDProducer<edm::EndRunProducer> {
0074 public:
0075 explicit LaserAlignment(edm::ParameterSet const& theConf);
0076 ~LaserAlignment() override;
0077 void beginJob() override;
0078 void produce(edm::Event&, edm::EventSetup const&) override;
0079 void endJob() override;
0080 void endRunProduce(edm::Run&, const edm::EventSetup&) override;
0081
0082
0083 void testRoutine(void);
0084
0085 private:
0086
0087 void fillDataProfiles(edm::Event const&, edm::EventSetup const&);
0088
0089
0090 void fillPedestalProfiles(edm::ESHandle<SiStripPedestals>&);
0091
0092
0093 bool isTECBeam(void);
0094 bool isATBeam(void);
0095
0096
0097 double getTIBTOBNominalBeamOffset(unsigned int, unsigned int, unsigned int);
0098
0099
0100 double getTEC2TECNominalBeamOffset(unsigned int, unsigned int, unsigned int);
0101
0102
0103 void fillDetectorId(void);
0104
0105
0106 double ConvertAngle(double);
0107
0108
0109 void CalculateNominalCoordinates(void);
0110
0111
0112 void DumpPosFileSet(LASGlobalData<LASCoordinateSet>&);
0113
0114
0115 void DumpStripFileSet(LASGlobalData<std::pair<float, float> >&);
0116
0117
0118 void DumpHitmaps(LASGlobalData<int>&);
0119
0120
0121 void ApplyEndcapMaskingCorrections(LASGlobalData<LASCoordinateSet>&,
0122 LASGlobalData<LASCoordinateSet>&,
0123 LASEndcapAlignmentParameterSet&);
0124
0125
0126 void ApplyATMaskingCorrections(LASGlobalData<LASCoordinateSet>&,
0127 LASGlobalData<LASCoordinateSet>&,
0128 LASBarrelAlignmentParameterSet&);
0129
0130
0131 const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> topoToken_;
0132 const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geomToken_;
0133 const edm::ESGetToken<GeometricDet, IdealGeometryRecord> geomDetToken_;
0134 const edm::ESGetToken<PTrackerParameters, PTrackerParametersRcd> ptpToken_;
0135 const edm::ESGetToken<PTrackerAdditionalParametersPerDet, PTrackerAdditionalParametersPerDetRcd> ptitpToken_;
0136 const edm::ESGetToken<Alignments, GlobalPositionRcd> gprToken_;
0137 const edm::ESGetToken<SiStripPedestals, SiStripPedestalsRcd> stripPedestalsToken_;
0138
0139
0140 int theEvents;
0141
0142
0143 bool theDoPedestalSubtraction;
0144
0145
0146 bool theUseMinuitAlgorithm;
0147
0148
0149 bool theApplyBeamKinkCorrections;
0150
0151
0152 double peakFinderThreshold;
0153
0154
0155 bool enableJudgeZeroFilter;
0156
0157
0158 unsigned int judgeOverdriveThreshold;
0159
0160
0161 bool updateFromInputGeometry;
0162
0163
0164 bool misalignedByRefGeometry;
0165
0166
0167 bool theStoreToDB;
0168
0169
0170 std::vector<edm::ParameterSet> theDigiProducersList;
0171
0172
0173 bool theSaveHistograms;
0174
0175
0176 int theCompression;
0177
0178
0179 std::string theFileName;
0180
0181
0182 std::vector<unsigned int> theMaskTecModules;
0183 std::vector<unsigned int> theMaskAtModules;
0184
0185
0186 bool theSetNominalStrips;
0187
0188
0189
0190 LASProfileJudge judge;
0191
0192
0193 LASConstants theLasConstants;
0194
0195
0196 LASGlobalData<unsigned int> detectorId;
0197
0198
0199 std::vector<unsigned int> tecDoubleHitDetId;
0200
0201
0202 LASGlobalData<LASModuleProfile> pedestalProfiles;
0203
0204
0205 LASGlobalData<LASModuleProfile> currentDataProfiles;
0206
0207
0208 LASGlobalData<LASModuleProfile> collectedDataProfiles;
0209
0210
0211 LASGlobalData<std::string> theProfileNames;
0212
0213
0214 LASGlobalData<int> numberOfAcceptedProfiles;
0215
0216
0217
0218 LASGlobalData<int> isAcceptedProfile;
0219
0220
0221
0222 LASGlobalData<TH1D*> summedHistograms;
0223
0224
0225 LASGlobalData<LASCoordinateSet> nominalCoordinates;
0226
0227
0228
0229 LASGlobalLoop moduleLoop;
0230
0231
0232 TFile* theFile;
0233 TDirectory* singleModulesDir;
0234
0235
0236 edm::ESHandle<GeometricDet> gD;
0237 edm::ESHandle<TrackerGeometry> theTrackerGeometry;
0238 edm::ESHandle<Alignments> theGlobalPositionRcd;
0239
0240 AlignableTracker* theAlignableTracker;
0241
0242 std::string theAlignRecordName, theErrorRecordName;
0243
0244 bool firstEvent_;
0245 };
0246 #endif