Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:26:07

0001 /*
0002  *  See header file for a description of this class.
0003  *
0004  *  \author N. Amapane & G. Cerminara - INFN Torino
0005  */
0006 
0007 #include "RecoLocalMuon/DTRecHit/interface/DTRecHitBaseAlgo.h"
0008 
0009 #include "Geometry/DTGeometry/interface/DTLayer.h"
0010 #include "CalibMuon/DTDigiSync/interface/DTTTrigBaseSync.h"
0011 #include "CalibMuon/DTDigiSync/interface/DTTTrigSyncFactory.h"
0012 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0013 #include "FWCore/Framework/interface/ConsumesCollector.h"
0014 
0015 using namespace std;
0016 using namespace edm;
0017 
0018 DTRecHitBaseAlgo::DTRecHitBaseAlgo(const ParameterSet& config, ConsumesCollector cc)
0019     : theSync{DTTTrigSyncFactory::get()->create(
0020           config.getParameter<string>("tTrigMode"), config.getParameter<ParameterSet>("tTrigModeConfig"), cc)} {}
0021 
0022 DTRecHitBaseAlgo::~DTRecHitBaseAlgo() {}
0023 
0024 // Build all hits in the range associated to the layerId, at the 1st step.
0025 OwnVector<DTRecHit1DPair> DTRecHitBaseAlgo::reconstruct(const DTLayer* layer,
0026                                                         const DTLayerId& layerId,
0027                                                         const DTDigiCollection::Range& digiRange) {
0028   OwnVector<DTRecHit1DPair> result;
0029 
0030   // Loop over all digis in the given range
0031   for (DTDigiCollection::const_iterator digi = digiRange.first; digi != digiRange.second; digi++) {
0032     // Get the wireId
0033     DTWireId wireId(layerId, (*digi).wire());
0034 
0035     LocalError tmpErr;
0036     LocalPoint lpoint, rpoint;
0037     // Call the compute method
0038     bool OK = compute(layer, *digi, lpoint, rpoint, tmpErr);
0039     if (!OK)
0040       continue;
0041 
0042     // Build a new pair of 1D rechit
0043     auto recHitPair = std::make_unique<DTRecHit1DPair>(wireId, *digi);
0044 
0045     // Set the position and the error of the 1D rechits
0046     recHitPair->setPositionAndError(DTEnums::Left, lpoint, tmpErr);
0047     recHitPair->setPositionAndError(DTEnums::Right, rpoint, tmpErr);
0048 
0049     result.push_back(std::move(recHitPair));
0050   }
0051   return result;
0052 }