Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef CosmicTrackFinder_h
0002 #define CosmicTrackFinder_h
0003 
0004 // Package:    RecoTracker/SingleTrackPattern
0005 // Class:      CosmicTrackFinder
0006 // Original Author:  Michele Pioppi-INFN perugia
0007 
0008 #include "FWCore/Framework/interface/stream/EDProducer.h"
0009 #include "FWCore/Framework/interface/Event.h"
0010 #include "DataFormats/Common/interface/Handle.h"
0011 #include "FWCore/Framework/interface/EventSetup.h"
0012 #include "RecoTracker/SingleTrackPattern/interface/CosmicTrajectoryBuilder.h"
0013 #include "RecoTracker/SingleTrackPattern/interface/CRackTrajectoryBuilder.h"
0014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0015 #include "TrackingTools/PatternTools/interface/Trajectory.h"
0016 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
0017 
0018 namespace cms {
0019   class CompareTrajLay {
0020   public:
0021     bool operator()(Trajectory* t1, Trajectory* t2) {
0022       AnalHits(t1->recHits());
0023       unsigned int alay = nlay;
0024       AnalHits(t2->recHits());
0025       unsigned int blay = nlay;
0026       if (alay != blay)
0027         return alay > blay;
0028       if (t1->foundHits() != t2->foundHits())
0029         return t1->foundHits() > t2->foundHits();
0030       return t1->chiSquared() < t2->chiSquared();
0031       // std::cout<<"chi "<<t1.chiSquared()<<" "<<t2.chiSquared()<<std::endl;
0032       // return false;
0033     }
0034     void AnalHits(const std::vector<TransientTrackingRecHit::ConstRecHitPointer>& hits) {
0035       ltob1 = false;
0036       ltob2 = false;
0037       ltib1 = false;
0038       ltib2 = false;
0039       //     ConstRecHitIterator hit;
0040       for (auto hit = hits.begin(); hit != hits.end(); hit++) {
0041         unsigned int iid = (*hit)->hit()->geographicalId().rawId();
0042 
0043         int sub = (iid >> 25) & 0x7;
0044         int lay = (iid >> 16) & 0xF;
0045         if ((lay == 1) && (sub == 3))
0046           ltib1 = true;
0047         if ((lay == 2) && (sub == 3))
0048           ltib2 = true;
0049         if ((lay == 1) && (sub == 5))
0050           ltob1 = true;
0051         if ((lay == 2) && (sub == 5))
0052           ltob2 = true;
0053       }
0054       nlay = ltib1 + ltib2 + ltob1 + ltob2;
0055     }
0056 
0057   private:
0058     bool ltib1, ltib2, ltob1, ltob2;
0059     unsigned int nlay;
0060   };
0061   class CompareTrajChi {
0062   public:
0063     bool operator()(Trajectory* t1, Trajectory* t2) {
0064       if (t1->foundHits() != t2->foundHits())
0065         return t1->foundHits() > t2->foundHits();
0066       return t1->chiSquared() < t2->chiSquared();
0067     }
0068   };
0069   class CosmicTrackFinder : public edm::stream::EDProducer<> {
0070     typedef TrajectoryStateOnSurface TSOS;
0071 
0072   public:
0073     explicit CosmicTrackFinder(const edm::ParameterSet& conf);
0074 
0075     ~CosmicTrackFinder() override;
0076 
0077     void produce(edm::Event& e, const edm::EventSetup& c) override;
0078 
0079   private:
0080     CosmicTrajectoryBuilder cosmicTrajectoryBuilder_;
0081     CRackTrajectoryBuilder crackTrajectoryBuilder_;
0082     edm::ParameterSet conf_;
0083     std::string geometry;
0084     bool trinevents;
0085     bool useHitsSplitting_;
0086     edm::EDGetTokenT<SiStripMatchedRecHit2DCollection> matchedrecHitsToken_;
0087     edm::EDGetTokenT<SiStripRecHit2DCollection> rphirecHitsToken_;
0088     edm::EDGetTokenT<SiStripRecHit2DCollection> stereorecHitsToken_;
0089     edm::EDGetTokenT<SiPixelRecHitCollection> pixelRecHitsToken_;
0090     edm::EDGetTokenT<TrajectorySeedCollection> seedToken_;
0091   };
0092 }  // namespace cms
0093 
0094 #endif