Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:46

0001 #include "Phase2EndcapLayer.h"
0002 
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004 
0005 #include "DataFormats/GeometrySurface/interface/SimpleDiskBounds.h"
0006 
0007 #include "TrackingTools/DetLayers/interface/DetLayerException.h"
0008 #include "TrackingTools/GeomPropagators/interface/HelixForwardPlaneCrossing.h"
0009 
0010 #include <array>
0011 #include "DetGroupMerger.h"
0012 
0013 using namespace std;
0014 
0015 typedef GeometricSearchDet::DetWithState DetWithState;
0016 
0017 //hopefully is never called!
0018 const std::vector<const GeometricSearchDet*>& Phase2EndcapLayer::components() const {
0019   if (not theComponents) {
0020     auto temp = std::make_unique<std::vector<const GeometricSearchDet*>>();
0021     temp->reserve(15);  // This number is just an upper bound
0022     for (auto c : theComps)
0023       temp->push_back(c);
0024     std::vector<const GeometricSearchDet*>* expected = nullptr;
0025     if (theComponents.compare_exchange_strong(expected, temp.get())) {
0026       //this thread set the value
0027       temp.release();
0028     }
0029   }
0030   return *theComponents;
0031 }
0032 
0033 void Phase2EndcapLayer::fillRingPars(int i) {
0034   const BoundDisk& ringDisk = static_cast<const BoundDisk&>(theComps[i]->surface());
0035   ringPars.push_back(tkDetUtil::fillRingParametersFromDisk(ringDisk));
0036 }
0037 
0038 Phase2EndcapLayer::Phase2EndcapLayer(vector<const Phase2EndcapRing*>& rings, const bool isOT)
0039     : RingedForwardLayer(true), isOuterTracker(isOT), theComponents{nullptr} {
0040   //They should be already R-ordered. TO BE CHECKED!!
0041   //sort( theRings.begin(), theRings.end(), DetLessR());
0042 
0043   theRingSize = rings.size();
0044   LogDebug("TkDetLayers") << "Number of rings in Phase2 OT EC layer is " << theRingSize << std::endl;
0045   setSurface(computeDisk(rings));
0046 
0047   for (unsigned int i = 0; i != rings.size(); ++i) {
0048     theComps.push_back(rings[i]);
0049     fillRingPars(i);
0050     theBasicComps.insert(
0051         theBasicComps.end(), (*rings[i]).basicComponents().begin(), (*rings[i]).basicComponents().end());
0052   }
0053 
0054   LogDebug("TkDetLayers") << "==== DEBUG Phase2EndcapLayer =====";
0055   LogDebug("TkDetLayers") << "r,zed pos  , thickness, innerR, outerR: " << this->position().perp() << " , "
0056                           << this->position().z() << " , " << this->specificSurface().bounds().thickness() << " , "
0057                           << this->specificSurface().innerRadius() << " , " << this->specificSurface().outerRadius();
0058 }
0059 
0060 BoundDisk* Phase2EndcapLayer::computeDisk(const vector<const Phase2EndcapRing*>& rings) const {
0061   return tkDetUtil::computeDisk(rings);
0062 }
0063 
0064 Phase2EndcapLayer::~Phase2EndcapLayer() {
0065   for (auto c : theComps)
0066     delete c;
0067 
0068   delete theComponents.load();
0069 }
0070 
0071 void Phase2EndcapLayer::groupedCompatibleDetsV(const TrajectoryStateOnSurface& startingState,
0072                                                const Propagator& prop,
0073                                                const MeasurementEstimator& est,
0074                                                std::vector<DetGroup>& result) const {
0075   tkDetUtil::groupedCompatibleDetsV(startingState, prop, est, result, theRingSize, theComps, ringPars);
0076 }
0077 
0078 float Phase2EndcapLayer::computeWindowSize(const GeomDet* det,
0079                                            const TrajectoryStateOnSurface& tsos,
0080                                            const MeasurementEstimator& est) const {
0081   return tkDetUtil::computeYdirWindowSize(det, tsos, est);
0082 }
0083 
0084 bool Phase2EndcapLayer::overlapInR(const TrajectoryStateOnSurface& tsos,
0085                                    int index,
0086                                    double ymax,
0087                                    std::vector<tkDetUtil::RingPar> ringParams) const {
0088   return tkDetUtil::overlapInR(tsos, index, ymax, ringParams);
0089 }