File indexing completed on 2023-01-21 00:19:05
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/CommonTopologies/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<Alignments, GlobalPositionRcd> gprToken_;
0136 const edm::ESGetToken<SiStripPedestals, SiStripPedestalsRcd> stripPedestalsToken_;
0137
0138
0139 int theEvents;
0140
0141
0142 bool theDoPedestalSubtraction;
0143
0144
0145 bool theUseMinuitAlgorithm;
0146
0147
0148 bool theApplyBeamKinkCorrections;
0149
0150
0151 double peakFinderThreshold;
0152
0153
0154 bool enableJudgeZeroFilter;
0155
0156
0157 unsigned int judgeOverdriveThreshold;
0158
0159
0160 bool updateFromInputGeometry;
0161
0162
0163 bool misalignedByRefGeometry;
0164
0165
0166 bool theStoreToDB;
0167
0168
0169 std::vector<edm::ParameterSet> theDigiProducersList;
0170
0171
0172 bool theSaveHistograms;
0173
0174
0175 int theCompression;
0176
0177
0178 std::string theFileName;
0179
0180
0181 std::vector<unsigned int> theMaskTecModules;
0182 std::vector<unsigned int> theMaskAtModules;
0183
0184
0185 bool theSetNominalStrips;
0186
0187
0188
0189 LASProfileJudge judge;
0190
0191
0192 LASConstants theLasConstants;
0193
0194
0195 LASGlobalData<unsigned int> detectorId;
0196
0197
0198 std::vector<unsigned int> tecDoubleHitDetId;
0199
0200
0201 LASGlobalData<LASModuleProfile> pedestalProfiles;
0202
0203
0204 LASGlobalData<LASModuleProfile> currentDataProfiles;
0205
0206
0207 LASGlobalData<LASModuleProfile> collectedDataProfiles;
0208
0209
0210 LASGlobalData<std::string> theProfileNames;
0211
0212
0213 LASGlobalData<int> numberOfAcceptedProfiles;
0214
0215
0216
0217 LASGlobalData<int> isAcceptedProfile;
0218
0219
0220
0221 LASGlobalData<TH1D*> summedHistograms;
0222
0223
0224 LASGlobalData<LASCoordinateSet> nominalCoordinates;
0225
0226
0227
0228 LASGlobalLoop moduleLoop;
0229
0230
0231 TFile* theFile;
0232 TDirectory* singleModulesDir;
0233
0234
0235 edm::ESHandle<GeometricDet> gD;
0236 edm::ESHandle<TrackerGeometry> theTrackerGeometry;
0237 edm::ESHandle<Alignments> theGlobalPositionRcd;
0238
0239 AlignableTracker* theAlignableTracker;
0240
0241 std::string theAlignRecordName, theErrorRecordName;
0242
0243 bool firstEvent_;
0244 };
0245 #endif