CMS 3D CMS Logo

CTPPSLocalTrackLiteProducer.cc
Go to the documentation of this file.
1 /****************************************************************************
2 *
3 * This is a part of TOTEM offline software.
4 * Authors:
5 * Jan Kašpar (jan.kaspar@gmail.com)
6 * Laurent Forthomme
7 *
8 ****************************************************************************/
9 
15 
19 
21 
22 //----------------------------------------------------------------------------------------------------
23 
28 {
29  public:
32 
33  virtual void produce( edm::Event&, const edm::EventSetup& ) override;
34 
35  private:
38 
41  bool doNothing_;
42 };
43 
44 //----------------------------------------------------------------------------------------------------
45 
47  doNothing_( iConfig.getParameter<bool>( "doNothing" ) )
48 {
49  if ( doNothing_ ) return;
50 
51  siStripTrackToken_ = consumes< edm::DetSetVector<TotemRPLocalTrack> > ( iConfig.getParameter<edm::InputTag>("tagSiStripTrack") );
52  diamondTrackToken_ = consumes< edm::DetSetVector<CTPPSDiamondLocalTrack> >( iConfig.getParameter<edm::InputTag>("tagDiamondTrack") );
53 
54  produces< std::vector<CTPPSLocalTrackLite> >();
55 }
56 
57 //----------------------------------------------------------------------------------------------------
58 
59 void
61 {
62  if ( doNothing_ )
63  return;
64 
65  // prepare output
66  std::unique_ptr< std::vector<CTPPSLocalTrackLite> > pOut( new std::vector<CTPPSLocalTrackLite>() );
67 
68  //----- TOTEM strips
69 
70  // get input from Si strips
72  iEvent.getByToken( siStripTrackToken_, inputSiStripTracks );
73 
74  // process tracks from Si strips
75  for ( const auto& rpv : *inputSiStripTracks ) {
76  const uint32_t rpId = rpv.detId();
77  for ( const auto& trk : rpv ) {
78  if ( !trk.isValid() ) continue;
79  pOut->emplace_back( rpId, trk.getX0(), trk.getX0Sigma(), trk.getY0(), trk.getY0Sigma() );
80  }
81  }
82 
83  //----- diamond detectors
84 
85  // get input from diamond detectors
87  iEvent.getByToken( diamondTrackToken_, inputDiamondTracks );
88 
89  // process tracks from diamond detectors
90  for ( const auto& rpv : *inputDiamondTracks ) {
91  const unsigned int rpId = rpv.detId();
92  for ( const auto& trk : rpv ) {
93  if ( !trk.isValid() ) continue;
94  pOut->emplace_back( rpId, trk.getX0(), trk.getX0Sigma(), trk.getY0(), trk.getY0Sigma(), trk.getT() );
95  }
96  }
97 
98  // save output to event
99  iEvent.put( std::move( pOut ) );
100 }
101 
102 //----------------------------------------------------------------------------------------------------
103 
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int iEvent
Definition: GenABIO.cc:230
virtual void produce(edm::Event &, const edm::EventSetup &) override
CTPPSLocalTrackLiteProducer(const edm::ParameterSet &)
Distills the essential track data from all RPs.
edm::EDGetTokenT< edm::DetSetVector< CTPPSDiamondLocalTrack > > diamondTrackToken_
edm::EDGetTokenT< edm::DetSetVector< TotemRPLocalTrack > > siStripTrackToken_
def move(src, dest)
Definition: eostools.py:510