Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:27:39

0001 /*
0002  *
0003 * This is a part of CTPPS offline software.
0004 * Author:
0005 *   Fabrizio Ferro (ferro@ge.infn.it)
0006 *   Enrico Robutti (robutti@ge.infn.it)
0007 *   Fabio Ravera   (fabio.ravera@cern.ch)
0008 *
0009 */
0010 #ifndef RecoPPS_Local_RPixPlaneCombinatoryTracking_H
0011 #define RecoPPS_Local_RPixPlaneCombinatoryTracking_H
0012 
0013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0014 #include "DataFormats/Common/interface/DetSetVector.h"
0015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0016 
0017 #include "DataFormats/CTPPSReco/interface/CTPPSPixelLocalTrack.h"
0018 #include "RecoPPS/Local/interface/RPixDetTrackFinder.h"
0019 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0020 
0021 #include <vector>
0022 #include <map>
0023 
0024 class RPixPlaneCombinatoryTracking : public RPixDetTrackFinder {
0025 public:
0026   RPixPlaneCombinatoryTracking(edm::ParameterSet const &parameterSet);
0027   ~RPixPlaneCombinatoryTracking() override;
0028   void initialize() override;
0029   void findTracks(int run) override;
0030 
0031 private:
0032   typedef std::vector<std::vector<uint32_t> > PlaneCombinations;
0033   typedef std::vector<RPixDetPatternFinder::PointInPlane> PointInPlaneList;
0034   typedef std::map<CTPPSPixelDetId, size_t> HitReferences;
0035   typedef std::map<HitReferences, PointInPlaneList> PointAndReferenceMap;
0036   typedef std::pair<HitReferences, PointInPlaneList> PointAndReferencePair;
0037 
0038   int verbosity_;
0039   uint32_t trackMinNumberOfPoints_;
0040   double maximumChi2OverNDF_;
0041   double maximumXLocalDistanceFromTrack_;
0042   double maximumYLocalDistanceFromTrack_;
0043   PlaneCombinations possiblePlaneCombinations_;
0044 
0045   void getPlaneCombinations(const std::vector<uint32_t> &inputPlaneList,
0046                             uint32_t numberToExtract,
0047                             PlaneCombinations &planeCombinations) const;
0048   CTPPSPixelLocalTrack fitTrack(PointInPlaneList pointList);
0049   void getHitCombinations(const std::map<CTPPSPixelDetId, PointInPlaneList> &mapOfAllHits,
0050                           std::map<CTPPSPixelDetId, PointInPlaneList>::iterator mapIterator,
0051                           HitReferences tmpHitPlaneMap,
0052                           const PointInPlaneList &tmpHitVector,
0053                           PointAndReferenceMap &outputMap);
0054   PointAndReferenceMap produceAllHitCombination(PlaneCombinations inputPlaneCombination);
0055   bool calculatePointOnDetector(CTPPSPixelLocalTrack *track, CTPPSPixelDetId planeId, GlobalPoint &planeLineIntercept);
0056   static bool functionForPlaneOrdering(PointAndReferencePair a, PointAndReferencePair b) {
0057     return (a.second.size() > b.second.size());
0058   }
0059   std::vector<PointAndReferencePair> orderCombinationsPerNumberOrPoints(PointAndReferenceMap inputMap);
0060 
0061   inline uint32_t factorial(uint32_t x) const {
0062     if (x == 0)
0063       return 1;
0064     return (x == 1 ? x : x * factorial(x - 1));
0065   }
0066 };
0067 
0068 #endif