Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-01-10 06:14:22

0001 #ifndef CkfBaseTrajectoryFilter_H
0002 #define CkfBaseTrajectoryFilter_H
0003 
0004 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0005 #include "TrackingTools/TrajectoryFiltering/interface/TrajectoryFilter.h"
0006 #include "TrackingTools/TrajectoryFiltering/interface/ChargeSignificanceTrajectoryFilter.h"
0007 #include "TrackingTools/TrajectoryFiltering/interface/MaxConsecLostHitsTrajectoryFilter.h"
0008 #include "TrackingTools/TrajectoryFiltering/interface/MaxHitsTrajectoryFilter.h"
0009 #include "TrackingTools/TrajectoryFiltering/interface/MaxLostHitsTrajectoryFilter.h"
0010 #include "TrackingTools/TrajectoryFiltering/interface/MinHitsTrajectoryFilter.h"
0011 #include "TrackingTools/TrajectoryFiltering/interface/MinPtTrajectoryFilter.h"
0012 #include "TrackingTools/TrajectoryFiltering/interface/LostHitsFractionTrajectoryFilter.h"
0013 #include "TrackingTools/TrajectoryFiltering/interface/LooperTrajectoryFilter.h"
0014 #include "TrackingTools/TrajectoryFiltering/interface/SeedExtensionTrajectoryFilter.h"
0015 #include "TrackingTools/TrajectoryFiltering/interface/MaxCCCLostHitsTrajectoryFilter.h"
0016 
0017 class CkfBaseTrajectoryFilter : public TrajectoryFilter {
0018 public:
0019   explicit CkfBaseTrajectoryFilter(const edm::ParameterSet& pset, edm::ConsumesCollector& iC)
0020       :  //define the filters by default in the BaseCkfTrajectoryBuilder
0021         theChargeSignificanceTrajectoryFilter(new ChargeSignificanceTrajectoryFilter(pset, iC)),
0022         theMaxConsecLostHitsTrajectoryFilter(new MaxConsecLostHitsTrajectoryFilter(pset, iC)),
0023         theMaxHitsTrajectoryFilter(new MaxHitsTrajectoryFilter(pset, iC)),
0024         theMaxLostHitsTrajectoryFilter(new MaxLostHitsTrajectoryFilter(pset, iC)),
0025         theLostHitsFractionTrajectoryFilter(new LostHitsFractionTrajectoryFilter(pset, iC)),
0026         theMinHitsTrajectoryFilter(new MinHitsTrajectoryFilter(pset, iC)),
0027         theMinPtTrajectoryFilter(new MinPtTrajectoryFilter(pset, iC)),
0028         theLooperTrajectoryFilter(new LooperTrajectoryFilter(pset, iC)),
0029         theSeedExtensionTrajectoryFilter(new SeedExtensionTrajectoryFilter(pset, iC)),
0030         theMaxCCCLostHitsTrajectoryFilter(new MaxCCCLostHitsTrajectoryFilter(pset, iC)) {}
0031 
0032   static void fillPSetDescription(edm::ParameterSetDescription& iDesc) {
0033     ChargeSignificanceTrajectoryFilter::fillPSetDescription(iDesc);
0034     MaxConsecLostHitsTrajectoryFilter::fillPSetDescription(iDesc);
0035     MaxHitsTrajectoryFilter::fillPSetDescription(iDesc);
0036     MaxLostHitsTrajectoryFilter::fillPSetDescription(iDesc);
0037     LostHitsFractionTrajectoryFilter::fillPSetDescription(iDesc);
0038     MinHitsTrajectoryFilter::fillPSetDescription(iDesc);
0039     MinPtTrajectoryFilter::fillPSetDescription(iDesc);
0040     LooperTrajectoryFilter::fillPSetDescription(iDesc);
0041     SeedExtensionTrajectoryFilter::fillPSetDescription(iDesc);
0042     MaxCCCLostHitsTrajectoryFilter::fillPSetDescription(iDesc);
0043   }
0044 
0045   void setEvent(const edm::Event& iEvent, const edm::EventSetup& iSetup) override {
0046     theChargeSignificanceTrajectoryFilter->setEvent(iEvent, iSetup);
0047     theMaxLostHitsTrajectoryFilter->setEvent(iEvent, iSetup);
0048     theMaxConsecLostHitsTrajectoryFilter->setEvent(iEvent, iSetup);
0049     theMinPtTrajectoryFilter->setEvent(iEvent, iSetup);
0050     theMaxHitsTrajectoryFilter->setEvent(iEvent, iSetup);
0051     theMinHitsTrajectoryFilter->setEvent(iEvent, iSetup);
0052     theLostHitsFractionTrajectoryFilter->setEvent(iEvent, iSetup);
0053     theLooperTrajectoryFilter->setEvent(iEvent, iSetup);
0054     theMaxCCCLostHitsTrajectoryFilter->setEvent(iEvent, iSetup);
0055   }
0056 
0057   bool qualityFilter(const Trajectory& traj) const override { return QF<Trajectory>(traj); }
0058   bool qualityFilter(const TempTrajectory& traj) const override { return QF<TempTrajectory>(traj); }
0059 
0060   bool toBeContinued(Trajectory& traj) const override { return TBC<Trajectory>(traj); }
0061   bool toBeContinued(TempTrajectory& traj) const override { return TBC<TempTrajectory>(traj); }
0062 
0063   std::string name() const override { return "CkfBaseTrajectoryFilter"; }
0064 
0065 protected:
0066   template <class T>
0067   bool QF(const T& traj) const {
0068     if (!theSeedExtensionTrajectoryFilter->qualityFilter(traj))
0069       return false;
0070     if (!theChargeSignificanceTrajectoryFilter->qualityFilter(traj))
0071       return false;
0072     if (!theMinHitsTrajectoryFilter->qualityFilter(traj))
0073       return false;
0074     if (!theMinPtTrajectoryFilter->qualityFilter(traj))
0075       return false;
0076     if (!theLooperTrajectoryFilter->qualityFilter(traj))
0077       return false;
0078     return true;
0079   }
0080 
0081   template <class T>
0082   bool TBC(T& traj) const {
0083     if (!theSeedExtensionTrajectoryFilter->toBeContinued(traj))
0084       return false;
0085     if (!theMaxHitsTrajectoryFilter->toBeContinued(traj))
0086       return false;
0087     if (!theMaxLostHitsTrajectoryFilter->toBeContinued(traj))
0088       return false;
0089     if (!theMaxConsecLostHitsTrajectoryFilter->toBeContinued(traj))
0090       return false;
0091     if (!theLostHitsFractionTrajectoryFilter->toBeContinued(traj))
0092       return false;
0093     if (!theMaxCCCLostHitsTrajectoryFilter->toBeContinued(traj))
0094       return false;
0095     if (!theMinPtTrajectoryFilter->toBeContinued(traj))
0096       return false;
0097     if (!theChargeSignificanceTrajectoryFilter->toBeContinued(traj))
0098       return false;
0099     if (!theLooperTrajectoryFilter->toBeContinued(traj))
0100       return false;
0101     return true;
0102   }
0103 
0104   std::unique_ptr<ChargeSignificanceTrajectoryFilter> theChargeSignificanceTrajectoryFilter;
0105   std::unique_ptr<MaxConsecLostHitsTrajectoryFilter> theMaxConsecLostHitsTrajectoryFilter;
0106   std::unique_ptr<MaxHitsTrajectoryFilter> theMaxHitsTrajectoryFilter;
0107   std::unique_ptr<MaxLostHitsTrajectoryFilter> theMaxLostHitsTrajectoryFilter;
0108   std::unique_ptr<LostHitsFractionTrajectoryFilter> theLostHitsFractionTrajectoryFilter;
0109   std::unique_ptr<MinHitsTrajectoryFilter> theMinHitsTrajectoryFilter;
0110   std::unique_ptr<MinPtTrajectoryFilter> theMinPtTrajectoryFilter;
0111   std::unique_ptr<LooperTrajectoryFilter> theLooperTrajectoryFilter;
0112   std::unique_ptr<SeedExtensionTrajectoryFilter> theSeedExtensionTrajectoryFilter;
0113   std::unique_ptr<MaxCCCLostHitsTrajectoryFilter> theMaxCCCLostHitsTrajectoryFilter;
0114 };
0115 
0116 #endif