CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
DTResidualCalibration Class Reference

#include <DTResidualCalibration.h>

Inheritance diagram for DTResidualCalibration:
edm::one::EDAnalyzer< edm::one::WatchRuns > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &setup) override
 
void beginJob () override
 
void beginRun (const edm::Run &, const edm::EventSetup &) override
 
 DTResidualCalibration (const edm::ParameterSet &pset)
 Constructor. More...
 
void endJob () override
 
void endRun (const edm::Run &, const edm::EventSetup &) override
 
 ~DTResidualCalibration () override
 Destructor. More...
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void bookHistos (DTSuperLayerId slId)
 
void bookHistos (DTLayerId slId)
 
void fillHistos (DTSuperLayerId slId, float distance, float residualOnDistance)
 
void fillHistos (DTLayerId slId, float distance, float residualOnDistance)
 
float segmentToWireDistance (const DTRecHit1D &recHit1D, const DTRecSegment4D &segment)
 

Private Attributes

const bool detailedAnalysis_
 
const DTGeometrydtGeom_
 
const edm::ESGetToken< DTGeometry, MuonGeometryRecorddtGeomToken_
 
std::map< DTLayerId, TH1F * > histoMapPerLayerTH1F_
 
std::map< DTLayerId, TH2F * > histoMapPerLayerTH2F_
 
std::map< DTSuperLayerId, TH1F * > histoMapTH1F_
 
std::map< DTSuperLayerId, TH2F * > histoMapTH2F_
 
const double histRange_
 
unsigned int nevent
 
const std::string rootBaseDir_
 
TFile * rootFile_
 
unsigned int segmbad
 
const edm::EDGetTokenT< DTRecSegment4DCollectionsegment4DToken_
 
unsigned int segmok
 
DTSegmentSelectorselect_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Extracts DT segment residuals

Definition at line 30 of file DTResidualCalibration.h.

Constructor & Destructor Documentation

◆ DTResidualCalibration()

DTResidualCalibration::DTResidualCalibration ( const edm::ParameterSet pset)

Constructor.

Definition at line 34 of file DTResidualCalibration.cc.

References edm::EDConsumerBase::consumesCollector(), LogDebug, nevent, muonDTDigis_cfi::pset, rootFile_, CSCSkim_cfi::rootFileName, segmbad, segmok, select_, and AlCaHLTBitMon_QueryRunRegistry::string.

35  : histRange_(pset.getParameter<double>("histogramRange")),
36  segment4DToken_(consumes<DTRecSegment4DCollection>(pset.getParameter<edm::InputTag>("segment4DLabel"))),
37  rootBaseDir_(pset.getUntrackedParameter<std::string>("rootBaseDir", "DT/Residuals")),
38  detailedAnalysis_(pset.getUntrackedParameter<bool>("detailedAnalysis", false)),
39  dtGeomToken_(esConsumes<edm::Transition::BeginRun>()) {
41  select_ = new DTSegmentSelector(pset, collector);
42 
43  LogDebug("Calibration") << "[DTResidualCalibration] Constructor called.";
44  std::string rootFileName = pset.getUntrackedParameter<std::string>("rootFileName", "residuals.root");
45  rootFile_ = new TFile(rootFileName.c_str(), "RECREATE");
46  rootFile_->cd();
47 
48  segmok = 0;
49  segmbad = 0;
50  nevent = 0;
51 }
DTSegmentSelector * select_
const edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomToken_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
const std::string rootBaseDir_
const edm::EDGetTokenT< DTRecSegment4DCollection > segment4DToken_
#define LogDebug(id)

◆ ~DTResidualCalibration()

DTResidualCalibration::~DTResidualCalibration ( )
override

Destructor.

Definition at line 53 of file DTResidualCalibration.cc.

References nevent, segmbad, segmok, and select_.

53  {
54  delete select_;
55  edm::LogVerbatim("Calibration") << "[DTResidualCalibration] Destructor called.";
56  edm::LogVerbatim("Calibration") << "[DTResidualCalibration] Analyzed events: " << nevent;
57  edm::LogVerbatim("Calibration") << "[DTResidualCalibration] Good segments: " << segmok;
58  edm::LogVerbatim("Calibration") << "[DTResidualCalibration] Bad segments: " << segmbad;
59 }
Log< level::Info, true > LogVerbatim
DTSegmentSelector * select_

Member Function Documentation

◆ analyze()

void DTResidualCalibration::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 87 of file DTResidualCalibration.cc.

References relativeConstraints::chamber, DTGeometry::chamber(), DTRecHitSegmentResidual::compute(), filterCSVwithJSON::copy, detailedAnalysis_, dtGeom_, edmPickEvents::event, fillHistos(), DTWireId::layerId(), LogTrace, nevent, FastTimerService_cff::range, rootFile_, segmbad, segment4DToken_, segmentToWireDistance(), segmok, select_, singleTopDQM_cfi::setup, DTRecSegment2D::specificRecHits(), and DTLayerId::superlayerId().

87  {
88  rootFile_->cd();
89  ++nevent;
90 
91  // Get the 4D rechits from the event
92  const edm::Handle<DTRecSegment4DCollection>& segments4D = event.getHandle(segment4DToken_);
93 
94  // Loop over segments by chamber
96  for (chamberIdIt = segments4D->id_begin(); chamberIdIt != segments4D->id_end(); ++chamberIdIt) {
97  const DTChamber* chamber = dtGeom_->chamber(*chamberIdIt);
98 
99  // Get the range for the corresponding ChamberId
100  DTRecSegment4DCollection::range range = segments4D->get((*chamberIdIt));
101  // Loop over the rechits of this DetUnit
102  for (DTRecSegment4DCollection::const_iterator segment = range.first; segment != range.second; ++segment) {
103  LogTrace("Calibration") << "Segment local pos (in chamber RF): " << (*segment).localPosition()
104  << "\nSegment global pos: " << chamber->toGlobal((*segment).localPosition());
105 
106  if (!(*select_)(*segment, event, setup)) {
107  segmbad++;
108  continue;
109  }
110  segmok++;
111 
112  // Get all 1D RecHits at step 3 within the 4D segment
113  std::vector<DTRecHit1D> recHits1D_S3;
114 
115  if ((*segment).hasPhi()) {
116  const DTChamberRecSegment2D* phiSeg = (*segment).phiSegment();
117  const std::vector<DTRecHit1D>& phiRecHits = phiSeg->specificRecHits();
118  std::copy(phiRecHits.begin(), phiRecHits.end(), back_inserter(recHits1D_S3));
119  }
120 
121  if ((*segment).hasZed()) {
122  const DTSLRecSegment2D* zSeg = (*segment).zSegment();
123  const std::vector<DTRecHit1D>& zRecHits = zSeg->specificRecHits();
124  std::copy(zRecHits.begin(), zRecHits.end(), back_inserter(recHits1D_S3));
125  }
126 
127  // Loop over 1D RecHit inside 4D segment
128  for (std::vector<DTRecHit1D>::const_iterator recHit1D = recHits1D_S3.begin(); recHit1D != recHits1D_S3.end();
129  ++recHit1D) {
130  const DTWireId wireId = recHit1D->wireId();
131 
132  float segmDistance = segmentToWireDistance(*recHit1D, *segment);
133  if (segmDistance > 2.1)
134  LogTrace("Calibration") << "WARNING: segment-wire distance: " << segmDistance;
135  else
136  LogTrace("Calibration") << "segment-wire distance: " << segmDistance;
137 
138  float residualOnDistance = DTRecHitSegmentResidual().compute(dtGeom_, *recHit1D, *segment);
139  LogTrace("Calibration") << "Wire Id " << wireId << " residual on distance: " << residualOnDistance;
140 
141  fillHistos(wireId.superlayerId(), segmDistance, residualOnDistance);
142  if (detailedAnalysis_)
143  fillHistos(wireId.layerId(), segmDistance, residualOnDistance);
144  }
145  }
146  }
147 }
DTSegmentSelector * select_
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
void fillHistos(DTSuperLayerId slId, float distance, float residualOnDistance)
identifier iterator
Definition: RangeMap.h:130
#define LogTrace(id)
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
float compute(const DTGeometry *, const DTRecHit1D &, const DTRecSegment4D &)
const DTGeometry * dtGeom_
const edm::EDGetTokenT< DTRecSegment4DCollection > segment4DToken_
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:45
float segmentToWireDistance(const DTRecHit1D &recHit1D, const DTRecSegment4D &segment)
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:45
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:90

◆ beginJob()

void DTResidualCalibration::beginJob ( )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 61 of file DTResidualCalibration.cc.

61 { TH1::SetDefaultSumw2(true); }

◆ beginRun()

void DTResidualCalibration::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
override

Definition at line 63 of file DTResidualCalibration.cc.

References bookHistos(), DTGeometry::chambers(), detailedAnalysis_, dtGeom_, dtGeomToken_, histoMapTH1F_, hgcalTBTopologyTester_cfi::layers, edm::ESHandle< T >::product(), and singleTopDQM_cfi::setup.

63  {
64  // get the geometry
66  dtGeomH = setup.getHandle(dtGeomToken_);
67  dtGeom_ = dtGeomH.product();
68 
69  // Loop over all the chambers
70  if (histoMapTH1F_.empty()) {
71  for (auto ch_it : dtGeom_->chambers()) {
72  // Loop over the SLs
73  for (auto sl_it : ch_it->superLayers()) {
74  DTSuperLayerId slId = (sl_it)->id();
75  bookHistos(slId);
76  if (detailedAnalysis_) {
77  for (auto layer_it : (sl_it)->layers()) {
78  DTLayerId layerId = (layer_it)->id();
79  bookHistos(layerId);
80  }
81  }
82  }
83  }
84  }
85 }
std::map< DTSuperLayerId, TH1F * > histoMapTH1F_
void bookHistos(DTSuperLayerId slId)
T const * product() const
Definition: ESHandle.h:86
const edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomToken_
const DTGeometry * dtGeom_
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
Definition: DTGeometry.cc:84

◆ bookHistos() [1/2]

void DTResidualCalibration::bookHistos ( DTSuperLayerId  slId)
private

Definition at line 197 of file DTResidualCalibration.cc.

References ALCARECODTCalibSynchDQM_cff::baseDir, histoMapTH1F_, histoMapTH2F_, histRange_, LogDebug, rootBaseDir_, rootFile_, DTChamberId::sector(), DTChamberId::station(), AlCaHLTBitMon_QueryRunRegistry::string, DTSuperLayerId::superlayer(), to_string(), and DTChamberId::wheel().

Referenced by beginRun().

197  {
198  TH1AddDirectorySentry addDir;
199  rootFile_->cd();
200 
201  LogDebug("Calibration") << "[DTResidualCalibration] Booking histos for SL: " << slId;
202 
203  // Compose the chamber name
204  // Define the step
205  int step = 3;
206 
207  std::string wheelStr = std::to_string(slId.wheel());
208  std::string stationStr = std::to_string(slId.station());
209  std::string sectorStr = std::to_string(slId.sector());
210 
211  std::string slHistoName = "_STEP" + std::to_string(step) + "_W" + wheelStr + "_St" + stationStr + "_Sec" + sectorStr +
212  "_SL" + std::to_string(slId.superlayer());
213 
214  LogDebug("Calibration") << "Accessing " << rootBaseDir_;
215  TDirectory* baseDir = rootFile_->GetDirectory(rootBaseDir_.c_str());
216  if (!baseDir)
217  baseDir = rootFile_->mkdir(rootBaseDir_.c_str());
218  LogDebug("Calibration") << "Accessing " << ("Wheel" + wheelStr);
219  TDirectory* wheelDir = baseDir->GetDirectory(("Wheel" + wheelStr).c_str());
220  if (!wheelDir)
221  wheelDir = baseDir->mkdir(("Wheel" + wheelStr).c_str());
222  LogDebug("Calibration") << "Accessing " << ("Station" + stationStr);
223  TDirectory* stationDir = wheelDir->GetDirectory(("Station" + stationStr).c_str());
224  if (!stationDir)
225  stationDir = wheelDir->mkdir(("Station" + stationStr).c_str());
226  LogDebug("Calibration") << "Accessing " << ("Sector" + sectorStr);
227  TDirectory* sectorDir = stationDir->GetDirectory(("Sector" + sectorStr).c_str());
228  if (!sectorDir)
229  sectorDir = stationDir->mkdir(("Sector" + sectorStr).c_str());
230 
231  sectorDir->cd();
232 
233  // Create the monitor elements
234  TH1F* histosTH1F = new TH1F(("hResDist" + slHistoName).c_str(),
235  "Residuals on the distance from wire (rec_hit - segm_extr) (cm)",
236  200,
237  -histRange_,
238  histRange_);
239  TH2F* histosTH2F = new TH2F(("hResDistVsDist" + slHistoName).c_str(),
240  "Residuals on the dist. (cm) from wire (rec_hit - segm_extr) vs dist. (cm)",
241  100,
242  0,
243  2.5,
244  200,
245  -histRange_,
246  histRange_);
247  histoMapTH1F_[slId] = histosTH1F;
248  histoMapTH2F_[slId] = histosTH2F;
249 }
int station() const
Return the station number.
Definition: DTChamberId.h:42
std::map< DTSuperLayerId, TH1F * > histoMapTH1F_
static std::string to_string(const XMLCh *ch)
const std::string rootBaseDir_
std::map< DTSuperLayerId, TH2F * > histoMapTH2F_
int superlayer() const
Return the superlayer number (deprecated method name)
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
int sector() const
Definition: DTChamberId.h:49
step
Definition: StallMonitor.cc:98
#define LogDebug(id)

◆ bookHistos() [2/2]

void DTResidualCalibration::bookHistos ( DTLayerId  slId)
private

Definition at line 251 of file DTResidualCalibration.cc.

References ALCARECODTCalibSynchDQM_cff::baseDir, histoMapPerLayerTH1F_, histoMapPerLayerTH2F_, histRange_, DTLayerId::layer(), LogDebug, rootBaseDir_, rootFile_, DTChamberId::sector(), DTChamberId::station(), AlCaHLTBitMon_QueryRunRegistry::string, DTSuperLayerId::superlayer(), to_string(), and DTChamberId::wheel().

251  {
252  TH1AddDirectorySentry addDir;
253  rootFile_->cd();
254 
255  LogDebug("Calibration") << "[DTResidualCalibration] Booking histos for layer: " << layerId;
256 
257  // Compose the chamber name
258  std::string wheelStr = std::to_string(layerId.wheel());
259  std::string stationStr = std::to_string(layerId.station());
260  std::string sectorStr = std::to_string(layerId.sector());
261  std::string superLayerStr = std::to_string(layerId.superlayer());
262  std::string layerStr = std::to_string(layerId.layer());
263  // Define the step
264  int step = 3;
265 
266  std::string layerHistoName = "_STEP" + std::to_string(step) + "_W" + wheelStr + "_St" + stationStr + "_Sec" +
267  sectorStr + "_SL" + superLayerStr + "_Layer" + layerStr;
268 
269  LogDebug("Calibration") << "Accessing " << rootBaseDir_;
270  TDirectory* baseDir = rootFile_->GetDirectory(rootBaseDir_.c_str());
271  if (!baseDir)
272  baseDir = rootFile_->mkdir(rootBaseDir_.c_str());
273  LogDebug("Calibration") << "Accessing " << ("Wheel" + wheelStr);
274  TDirectory* wheelDir = baseDir->GetDirectory(("Wheel" + wheelStr).c_str());
275  if (!wheelDir)
276  wheelDir = baseDir->mkdir(("Wheel" + wheelStr).c_str());
277  LogDebug("Calibration") << "Accessing " << ("Station" + stationStr);
278  TDirectory* stationDir = wheelDir->GetDirectory(("Station" + stationStr).c_str());
279  if (!stationDir)
280  stationDir = wheelDir->mkdir(("Station" + stationStr).c_str());
281  LogDebug("Calibration") << "Accessing " << ("Sector" + sectorStr);
282  TDirectory* sectorDir = stationDir->GetDirectory(("Sector" + sectorStr).c_str());
283  if (!sectorDir)
284  sectorDir = stationDir->mkdir(("Sector" + sectorStr).c_str());
285  LogDebug("Calibration") << "Accessing " << ("SL" + superLayerStr);
286  TDirectory* superLayerDir = sectorDir->GetDirectory(("SL" + superLayerStr).c_str());
287  if (!superLayerDir)
288  superLayerDir = sectorDir->mkdir(("SL" + superLayerStr).c_str());
289 
290  superLayerDir->cd();
291  // Create histograms
292  TH1F* histosTH1F = new TH1F(("hResDist" + layerHistoName).c_str(),
293  "Residuals on the distance from wire (rec_hit - segm_extr) (cm)",
294  200,
295  -histRange_,
296  histRange_);
297  TH2F* histosTH2F = new TH2F(("hResDistVsDist" + layerHistoName).c_str(),
298  "Residuals on the dist. (cm) from wire (rec_hit - segm_extr) vs dist. (cm)",
299  100,
300  0,
301  2.5,
302  200,
303  -histRange_,
304  histRange_);
305  histoMapPerLayerTH1F_[layerId] = histosTH1F;
306  histoMapPerLayerTH2F_[layerId] = histosTH2F;
307 }
std::map< DTLayerId, TH2F * > histoMapPerLayerTH2F_
static std::string to_string(const XMLCh *ch)
const std::string rootBaseDir_
step
Definition: StallMonitor.cc:98
std::map< DTLayerId, TH1F * > histoMapPerLayerTH1F_
#define LogDebug(id)

◆ endJob()

void DTResidualCalibration::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 178 of file DTResidualCalibration.cc.

References LogDebug, and rootFile_.

Referenced by o2olib.O2ORunMgr::executeJob().

178  {
179  LogDebug("Calibration") << "[DTResidualCalibration] Writing histos to file.";
180  rootFile_->cd();
181  rootFile_->Write();
182  rootFile_->Close();
183 
184  /*std::map<DTSuperLayerId, TH1F* >::const_iterator itSlHistos = histoMapTH1F_.begin();
185  std::map<DTSuperLayerId, TH1F* >::const_iterator itSlHistos_end = histoMapTH1F_.end();
186  for(; itSlHistos != itSlHistos_end; ++itSlHistos){
187  std::vector<TH1F*>::const_iterator itHistTH1F = (*itSlHistos).second.begin();
188  std::vector<TH1F*>::const_iterator itHistTH1F_end = (*itSlHistos).second.end();
189  for(; itHistTH1F != itHistTH1F_end; ++itHistTH1F) (*itHistTH1F)->Write();
190 
191  std::vector<TH2F*>::const_iterator itHistTH2F = histoMapTH2F_[(*itSlHistos).first].begin();
192  std::vector<TH2F*>::const_iterator itHistTH2F_end = histoMapTH2F_[(*itSlHistos).first].end();
193  for(; itHistTH2F != itHistTH2F_end; ++itHistTH2F) (*itHistTH2F)->Write();
194  }*/
195 }
#define LogDebug(id)

◆ endRun()

void DTResidualCalibration::endRun ( const edm::Run ,
const edm::EventSetup  
)
inlineoverride

Definition at line 40 of file DTResidualCalibration.h.

40 {};

◆ fillHistos() [1/2]

void DTResidualCalibration::fillHistos ( DTSuperLayerId  slId,
float  distance,
float  residualOnDistance 
)
private

Definition at line 310 of file DTResidualCalibration.cc.

References HLT_2023v12_cff::distance, histoMapTH1F_, and histoMapTH2F_.

Referenced by analyze().

310  {
311  histoMapTH1F_[slId]->Fill(residualOnDistance);
312  histoMapTH2F_[slId]->Fill(distance, residualOnDistance);
313 }
std::map< DTSuperLayerId, TH1F * > histoMapTH1F_
std::map< DTSuperLayerId, TH2F * > histoMapTH2F_

◆ fillHistos() [2/2]

void DTResidualCalibration::fillHistos ( DTLayerId  slId,
float  distance,
float  residualOnDistance 
)
private

Definition at line 316 of file DTResidualCalibration.cc.

References HLT_2023v12_cff::distance, histoMapPerLayerTH1F_, and histoMapPerLayerTH2F_.

316  {
317  histoMapPerLayerTH1F_[layerId]->Fill(residualOnDistance);
318  histoMapPerLayerTH2F_[layerId]->Fill(distance, residualOnDistance);
319 }
std::map< DTLayerId, TH2F * > histoMapPerLayerTH2F_
std::map< DTLayerId, TH1F * > histoMapPerLayerTH1F_

◆ segmentToWireDistance()

float DTResidualCalibration::segmentToWireDistance ( const DTRecHit1D recHit1D,
const DTRecSegment4D segment 
)
private

Definition at line 149 of file DTResidualCalibration.cc.

References relativeConstraints::chamber, DTGeometry::chamber(), DTSuperLayerId::chamberId(), funct::cos(), dtGeom_, nano_mu_digi_cff::layer, DTGeometry::layer(), DTWireId::layerId(), DTRecSegment4D::localDirection(), DTRecHit1D::localPosition(), DTRecSegment4D::localPosition(), DTSuperLayerId::superlayer(), PV3DBase< T, PVType, FrameType >::theta(), DTWireId::wire(), DTRecHit1D::wireId(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by analyze().

149  {
150  // Get the layer and the wire position
151  const DTWireId wireId = recHit1D.wireId();
152  const DTLayer* layer = dtGeom_->layer(wireId);
153  float wireX = layer->specificTopology().wirePosition(wireId.wire());
154 
155  // Extrapolate the segment to the z of the wire
156  // Get wire position in chamber RF
157  // (y and z must be those of the hit to be coherent in the transf. of RF in case of rotations of the layer alignment)
158  LocalPoint wirePosInLay(wireX, recHit1D.localPosition().y(), recHit1D.localPosition().z());
159  GlobalPoint wirePosGlob = layer->toGlobal(wirePosInLay);
160  const DTChamber* chamber = dtGeom_->chamber(wireId.layerId().chamberId());
161  LocalPoint wirePosInChamber = chamber->toLocal(wirePosGlob);
162 
163  // Segment position at Wire z in chamber local frame
164  LocalPoint segPosAtZWire =
165  segment.localPosition() + segment.localDirection() * wirePosInChamber.z() / cos(segment.localDirection().theta());
166 
167  // Compute the distance of the segment from the wire
168  int sl = wireId.superlayer();
169  float segmDistance = -1;
170  if (sl == 1 || sl == 3)
171  segmDistance = fabs(wirePosInChamber.x() - segPosAtZWire.x());
172  else if (sl == 2)
173  segmDistance = fabs(segPosAtZWire.y() - wirePosInChamber.y());
174 
175  return segmDistance;
176 }
int wire() const
Return the wire number.
Definition: DTWireId.h:42
T z() const
Definition: PV3DBase.h:61
LocalVector localDirection() const override
Local direction in Chamber frame.
LocalPoint localPosition() const override
Local position in Chamber frame.
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
DTChamberId chamberId() const
Return the corresponding ChamberId.
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int superlayer() const
Return the superlayer number (deprecated method name)
const DTGeometry * dtGeom_
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:76
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:45
LocalPoint localPosition() const override
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:47
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:90
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:96

Member Data Documentation

◆ detailedAnalysis_

const bool DTResidualCalibration::detailedAnalysis_
private

Definition at line 61 of file DTResidualCalibration.h.

Referenced by analyze(), and beginRun().

◆ dtGeom_

const DTGeometry* DTResidualCalibration::dtGeom_
private

Definition at line 64 of file DTResidualCalibration.h.

Referenced by analyze(), beginRun(), and segmentToWireDistance().

◆ dtGeomToken_

const edm::ESGetToken<DTGeometry, MuonGeometryRecord> DTResidualCalibration::dtGeomToken_
private

Definition at line 65 of file DTResidualCalibration.h.

Referenced by beginRun().

◆ histoMapPerLayerTH1F_

std::map<DTLayerId, TH1F*> DTResidualCalibration::histoMapPerLayerTH1F_
private

Definition at line 71 of file DTResidualCalibration.h.

Referenced by bookHistos(), and fillHistos().

◆ histoMapPerLayerTH2F_

std::map<DTLayerId, TH2F*> DTResidualCalibration::histoMapPerLayerTH2F_
private

Definition at line 72 of file DTResidualCalibration.h.

Referenced by bookHistos(), and fillHistos().

◆ histoMapTH1F_

std::map<DTSuperLayerId, TH1F*> DTResidualCalibration::histoMapTH1F_
private

Definition at line 68 of file DTResidualCalibration.h.

Referenced by beginRun(), bookHistos(), and fillHistos().

◆ histoMapTH2F_

std::map<DTSuperLayerId, TH2F*> DTResidualCalibration::histoMapTH2F_
private

Definition at line 69 of file DTResidualCalibration.h.

Referenced by bookHistos(), and fillHistos().

◆ histRange_

const double DTResidualCalibration::histRange_
private

Definition at line 57 of file DTResidualCalibration.h.

Referenced by bookHistos().

◆ nevent

unsigned int DTResidualCalibration::nevent
private

Definition at line 45 of file DTResidualCalibration.h.

Referenced by analyze(), DTResidualCalibration(), and ~DTResidualCalibration().

◆ rootBaseDir_

const std::string DTResidualCalibration::rootBaseDir_
private

Definition at line 59 of file DTResidualCalibration.h.

Referenced by bookHistos().

◆ rootFile_

TFile* DTResidualCalibration::rootFile_
private

Definition at line 62 of file DTResidualCalibration.h.

Referenced by analyze(), bookHistos(), DTResidualCalibration(), and endJob().

◆ segmbad

unsigned int DTResidualCalibration::segmbad
private

Definition at line 46 of file DTResidualCalibration.h.

Referenced by analyze(), DTResidualCalibration(), and ~DTResidualCalibration().

◆ segment4DToken_

const edm::EDGetTokenT<DTRecSegment4DCollection> DTResidualCalibration::segment4DToken_
private

Definition at line 58 of file DTResidualCalibration.h.

Referenced by analyze().

◆ segmok

unsigned int DTResidualCalibration::segmok
private

Definition at line 46 of file DTResidualCalibration.h.

Referenced by analyze(), DTResidualCalibration(), and ~DTResidualCalibration().

◆ select_

DTSegmentSelector* DTResidualCalibration::select_
private

Definition at line 56 of file DTResidualCalibration.h.

Referenced by analyze(), DTResidualCalibration(), and ~DTResidualCalibration().