Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 
0002 #ifndef CkfDebugTrackCandidateMaker_h
0003 #define CkfDebugTrackCandidateMaker_h
0004 
0005 #include "RecoTracker/CkfPattern/interface/CkfTrackCandidateMakerBase.h"
0006 #include "CkfDebugTrajectoryBuilder.h"
0007 #include "FWCore/Framework/interface/one/EDProducer.h"
0008 #include "DataFormats/TrackReco/interface/SeedStopInfo.h"
0009 #include <memory>
0010 
0011 //CkfDebugger wants to see all the events and can only handle a single thread at a time
0012 namespace cms {
0013   class CkfDebugTrackCandidateMaker : public edm::one::EDProducer<edm::one::WatchRuns>,
0014                                       public CkfTrackCandidateMakerBase {
0015   public:
0016     CkfDebugTrackCandidateMaker(const edm::ParameterSet& conf) : CkfTrackCandidateMakerBase(conf, consumesCollector()) {
0017       produces<TrackCandidateCollection>();
0018       produces<SeedStopInfo>();
0019       dbg = std::make_unique<CkfDebugger>(consumesCollector());
0020     }
0021 
0022     void beginRun(edm::Run const& run, edm::EventSetup const& es) override {
0023       beginRunBase(run, es);
0024       initDebugger(es);
0025     }
0026     void endRun(edm::Run const&, edm::EventSetup const&) override {}
0027 
0028     void produce(edm::Event& e, const edm::EventSetup& es) override { produceBase(e, es); }
0029 
0030   private:
0031     TrajectorySeedCollection::const_iterator lastSeed(TrajectorySeedCollection const& theSeedColl) override {
0032       return theSeedColl.begin() + 1;
0033     }
0034 
0035     void initDebugger(edm::EventSetup const& es) {
0036       dbg->setConditions(es);
0037       myTrajectoryBuilder = dynamic_cast<const CkfDebugTrajectoryBuilder*>(theTrajectoryBuilder.get());
0038       if (myTrajectoryBuilder)
0039         myTrajectoryBuilder->setDebugger(dbg.get());
0040       else
0041         throw cms::Exception("CkfDebugger") << "please use CkfDebugTrajectoryBuilder";
0042       //theTrajectoryBuilder->setDebugger( dbg);
0043     };
0044 
0045     void printHitsDebugger(edm::Event& e) override { dbg->printSimHits(e); };
0046     void countSeedsDebugger() override { dbg->countSeed(); };
0047     void deleteAssocDebugger() override { dbg->deleteHitAssociator(); };
0048     void deleteDebugger() { dbg.reset(); };
0049     std::unique_ptr<CkfDebugger> dbg;
0050     const CkfDebugTrajectoryBuilder* myTrajectoryBuilder;
0051   };
0052 }  // namespace cms
0053 
0054 #endif