CMS 3D CMS Logo

CTPPSDiamondLocalTrackFitter.cc
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * This is a part of CTPPS offline software.
4  * Authors:
5  * Laurent Forthomme (laurent.forthomme@cern.ch)
6  * Nicola Minafra (nicola.minafra@cern.ch)
7  *
8  ****************************************************************************/
9 
10 #include <memory>
11 
16 
19 
21 
25 
27 
29 {
30  public:
33 
35 
36  private:
37  virtual void produce( edm::Event&, const edm::EventSetup& ) override;
38 
42 };
43 
45  recHitsToken_( consumes< edm::DetSetVector<CTPPSDiamondRecHit> >( iConfig.getParameter<edm::InputTag>( "recHitsTag" ) ) ),
46  trk_algo_45_ ( iConfig.getParameter<edm::ParameterSet>( "trackingAlgorithmParams" ) ),
47  trk_algo_56_ ( iConfig.getParameter<edm::ParameterSet>( "trackingAlgorithmParams" ) )
48 {
49  produces< edm::DetSetVector<CTPPSDiamondLocalTrack> >();
50 }
51 
53 {}
54 
55 void
57 {
58  std::unique_ptr< edm::DetSetVector<CTPPSDiamondLocalTrack> > pOut( new edm::DetSetVector<CTPPSDiamondLocalTrack> );
59 
61  iEvent.getByToken( recHitsToken_, recHits );
62 
63  const CTPPSDiamondDetId id_45( 0, 1, 6, 0, 0 ), id_56( 1, 1, 6, 0, 0 );
64 
65  pOut->find_or_insert( id_45 ); // tracks in 4-5
66  edm::DetSet<CTPPSDiamondLocalTrack>& tracks56 = pOut->find_or_insert( id_56 ); // tracks in 5-6
67 
68  // workaround to retrieve the detset for 4-5 without losing the reference
69  edm::DetSet<CTPPSDiamondLocalTrack>& tracks45 = pOut->operator[]( id_45 );
70 
71  // feed hits to the track producers
72  for ( edm::DetSetVector<CTPPSDiamondRecHit>::const_iterator vec = recHits->begin(); vec != recHits->end(); ++vec )
73  {
74  const CTPPSDiamondDetId detid( vec->detId() );
75 
76  if (detid.arm()==0)
77  {
78  for ( edm::DetSet<CTPPSDiamondRecHit>::const_iterator hit = vec->begin(); hit != vec->end(); ++hit )
79  {
81  }
82  } else
83  {
84  for ( edm::DetSet<CTPPSDiamondRecHit>::const_iterator hit = vec->begin(); hit != vec->end(); ++hit )
85  {
87  }
88  }
89  }
90 
91  // retrieve the tracks for both arms
92  trk_algo_45_.produceTracks( tracks45 );
93  trk_algo_56_.produceTracks( tracks56 );
94 
95  iEvent.put( std::move( pOut ) );
96 
97  // remove all hits from the track producers to prepare for the next event
100 }
101 
102 void
104 {
105  // The following says we do not know what parameters are allowed so do no validation
106  // Please change this to state exactly what you do use, even if it is no parameters
108  desc.setUnknown();
109  descr.addDefault( desc );
110 }
111 
static void fillDescriptions(edm::ConfigurationDescriptions &)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
void clear()
Reset the list of hits.
CTPPSDiamondTrackRecognition trk_algo_45_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
Reconstructed hit in diamond detectors.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::EDGetTokenT< edm::DetSetVector< CTPPSDiamondRecHit > > recHitsToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
int iEvent
Definition: GenABIO.cc:230
void addDefault(ParameterSetDescription const &psetDescription)
virtual void produce(edm::Event &, const edm::EventSetup &) override
CTPPSDiamondTrackRecognition trk_algo_56_
void addHit(const CTPPSDiamondRecHit &recHit)
Feed a new hit to the tracks recognition algorithm.
Class performing smart reconstruction for CTPPS Diamond Detectors.
int produceTracks(edm::DetSet< CTPPSDiamondLocalTrack > &tracks)
Produce a collection of tracks for the current station, given its hits collection.
HLT enums.
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
collection_type::const_iterator const_iterator
Definition: DetSet.h:33
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:104
CTPPSDiamondLocalTrackFitter(const edm::ParameterSet &)
def move(src, dest)
Definition: eostools.py:510