Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef CosmicTrackingRegion_H
0002 #define CosmicTrackingRegion_H
0003 
0004 /** \class CosmicTrackingRegion
0005  * A concrete implementation of TrackingRegion. 
0006  * Apart of vertex constraint from TrackingRegion in this implementation
0007  * the region of interest is further constrainted in phi and eta 
0008  * around the direction of the region 
0009  */
0010 
0011 #include "RecoTracker/TkTrackingRegions/interface/TrackingRegionBase.h"
0012 #include "RecoTracker/TkTrackingRegions/interface/HitRZConstraint.h"
0013 #include "RecoTracker/MeasurementDet/interface/MeasurementTrackerEvent.h"
0014 #include "MagneticField/Engine/interface/MagneticField.h"
0015 
0016 #include "DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h"
0017 #include "DataFormats/TrackingRecHit/interface/mayown_ptr.h"
0018 
0019 #include <vector>
0020 
0021 using SeedingHit = BaseTrackerRecHit const*;
0022 
0023 class CosmicTrackingRegion : public TrackingRegionBase {
0024 public:
0025   ~CosmicTrackingRegion() override {}
0026 
0027   /** constructor (symmetric eta and phi margins). <BR>
0028    * dir        - the direction around which region is constructed <BR>
0029    *              the initial direction of the momentum of the particle 
0030    *              should be in the range <BR> 
0031    *              phi of dir +- deltaPhi <BR>
0032    *              eta of dir +- deltaEta <BR> 
0033    *              
0034    * vertexPos  - the position of the vertex (origin) of the of the region.<BR>
0035    *              It is a centre of cylinder constraind with rVertex, zVertex.
0036    *              The track of the particle should cross the cylinder <BR>
0037    *              WARNING: in the current implementaion the vertexPos is
0038    *              supposed to be placed on the beam line, i.e. to be of the form
0039    *              (0,0,float)
0040    *
0041    * ptMin      - minimal pt of interest <BR>
0042    * rVertex    - radius of the cylinder around beam line where the tracks
0043    *              of interest should point to. <BR>
0044    * zVertex    - half height of the cylinder around the beam line
0045    *              where the tracks of interest should point to.   <BR>
0046    * deltaEta   - allowed deviation of the initial direction of particle
0047    *              in eta in respect to direction of the region <BR>
0048    *  deltaPhi  - allowed deviation of the initial direction of particle
0049    *              in phi in respect to direction of the region 
0050   */
0051   CosmicTrackingRegion(const GlobalVector& dir,
0052                        const GlobalPoint& vertexPos,
0053                        float ptMin,
0054                        float rVertex,
0055                        float zVertex,
0056                        float deltaEta,
0057                        float deltaPhi,
0058                        const MagneticField& magField,
0059                        float dummy = 0.,
0060                        const MeasurementTrackerEvent* measurementTracker = nullptr)
0061       : TrackingRegionBase(dir, vertexPos, Range(-1 / ptMin, 1 / ptMin), rVertex, zVertex),
0062         theMeasurementTracker_(measurementTracker),
0063         theMagneticField_(&magField) {}
0064 
0065   CosmicTrackingRegion(const GlobalVector& dir,
0066                        const GlobalPoint& vertexPos,
0067                        float ptMin,
0068                        float rVertex,
0069                        float zVertex,
0070                        float deltaEta,
0071                        float deltaPhi,
0072                        const MagneticField& magField,
0073                        const MeasurementTrackerEvent* measurementTracker = nullptr)
0074       : TrackingRegionBase(dir, vertexPos, Range(-1 / ptMin, 1 / ptMin), rVertex, zVertex),
0075         theMeasurementTracker_(measurementTracker),
0076         theMagneticField_(&magField) {}
0077 
0078   CosmicTrackingRegion(CosmicTrackingRegion const& rh)
0079       : TrackingRegionBase(rh),
0080         theMeasurementTracker_(rh.theMeasurementTracker_),
0081         theMagneticField_(rh.theMagneticField_) {}
0082 
0083   TrackingRegion::Hits hits(const SeedingLayerSetsHits::SeedingLayer& layer) const override;
0084 
0085   std::unique_ptr<HitRZCompatibility> checkRZ(const DetLayer* layer,
0086                                               const Hit& outerHit,
0087                                               const DetLayer* outerlayer = nullptr,
0088                                               float lr = 0,
0089                                               float gz = 0,
0090                                               float dr = 0,
0091                                               float dz = 0) const override {
0092     return nullptr;
0093   }
0094 
0095   /// Set the elements of the mask corresponding to the tracks that are compatable with the region.
0096   /// Does not reset the elements corresponding to the tracks that are not compatible.
0097   void checkTracks(reco::TrackCollection const& tracks, std::vector<bool>& mask) const override;
0098 
0099   std::unique_ptr<TrackingRegion> clone() const override { return std::make_unique<CosmicTrackingRegion>(*this); }
0100 
0101   std::string name() const override { return "CosmicTrackingRegion"; }
0102 
0103 private:
0104   template <typename T>
0105   void hits_(const T& layer, TrackingRegion::Hits& result) const;
0106 
0107   const MeasurementTrackerEvent* theMeasurementTracker_;
0108   const MagneticField* theMagneticField_;
0109 
0110   using cacheHitPointer = mayown_ptr<BaseTrackerRecHit>;
0111   using cacheHits = std::vector<cacheHitPointer>;
0112 
0113   // not a solution!  here just to try to get this thing working....
0114   // in any case onDemand is NOT thread safe yet
0115   // actually this solution is absolutely safe. It lays in the effimeral nature of the region itself
0116   mutable cacheHits cache;
0117 };
0118 
0119 #endif