CMS 3D CMS Logo

ProducerDRin.cc
Go to the documentation of this file.
12 
20 
21 #include <string>
22 #include <vector>
23 #include <deque>
24 #include <iterator>
25 #include <cmath>
26 #include <numeric>
27 
28 using namespace std;
29 using namespace edm;
30 using namespace trackerTFP;
31 using namespace tt;
32 
33 namespace trklet {
34 
40  class ProducerDRin : public stream::EDProducer<> {
41  public:
42  explicit ProducerDRin(const ParameterSet&);
43  ~ProducerDRin() override {}
44 
45  private:
46  void beginRun(const Run&, const EventSetup&) override;
47  void produce(Event&, const EventSetup&) override;
48  virtual void endJob() {}
49 
50  // ED input token of Tracks
52  // ED input token of Stubs
54  // ED output token for stubs
57  // ED output token for tracks
60  // Setup token
62  // DataFormats token
64  // LayerEncoding token
66  // ChannelAssignment token
68  // configuration
70  // helper class to store configurations
71  const Setup* setup_ = nullptr;
72  // helper class to extract structured data from tt::Frames
73  const DataFormats* dataFormats_ = nullptr;
74  // helper class to encode layer
75  const LayerEncoding* layerEncoding_ = nullptr;
76  // helper class to assign tracks to channel
77  const ChannelAssignment* channelAssignment_ = nullptr;
78  // helper class to store tracklet configurations
80  };
81 
82  ProducerDRin::ProducerDRin(const ParameterSet& iConfig) : iConfig_(iConfig) {
83  const string& label = iConfig.getParameter<string>("LabelTBout");
84  const string& branchAcceptedStubs = iConfig.getParameter<string>("BranchAcceptedStubs");
85  const string& branchAcceptedTracks = iConfig.getParameter<string>("BranchAcceptedTracks");
86  const string& branchLostStubs = iConfig.getParameter<string>("BranchLostStubs");
87  const string& branchLostTracks = iConfig.getParameter<string>("BranchLostTracks");
88  // book in- and output ED products
89  edGetTokenTracks_ = consumes<StreamsTrack>(InputTag(label, branchAcceptedTracks));
90  edGetTokenStubs_ = consumes<StreamsStub>(InputTag(label, branchAcceptedStubs));
91  edPutTokenAcceptedStubs_ = produces<StreamsStub>(branchAcceptedStubs);
92  edPutTokenAcceptedTracks_ = produces<StreamsTrack>(branchAcceptedTracks);
93  edPutTokenLostStubs_ = produces<StreamsStub>(branchLostStubs);
94  edPutTokenLostTracks_ = produces<StreamsTrack>(branchLostTracks);
95  // book ES products
96  esGetTokenSetup_ = esConsumes<Setup, SetupRcd, Transition::BeginRun>();
97  esGetTokenDataFormats_ = esConsumes<DataFormats, DataFormatsRcd, Transition::BeginRun>();
98  esGetTokenLayerEncoding_ = esConsumes<LayerEncoding, LayerEncodingRcd, Transition::BeginRun>();
99  esGetTokenChannelAssignment_ = esConsumes<ChannelAssignment, ChannelAssignmentRcd, Transition::BeginRun>();
100  }
101 
102  void ProducerDRin::beginRun(const Run& iRun, const EventSetup& iSetup) {
103  // helper class to store configurations
104  setup_ = &iSetup.getData(esGetTokenSetup_);
106  return;
107  // check process history if desired
108  if (iConfig_.getParameter<bool>("CheckHistory"))
110  // helper class to extract structured data from tt::Frames
112  // helper class to encode layer
114  // helper class to assign tracks to channel
116  }
117 
119  // empty KFin products
120  const int numStreamsTracks = channelAssignment_->numNodesDR() * setup_->numRegions();
121  const int numStreamsStubs = numStreamsTracks * setup_->numLayers();
122  StreamsStub acceptedStubs(numStreamsStubs);
123  StreamsTrack acceptedTracks(numStreamsTracks);
124  StreamsStub lostStubs(numStreamsStubs);
125  StreamsTrack lostTracks(numStreamsTracks);
126  // read in TBout Product and produce KFin product
128  Handle<StreamsStub> handleStubs;
129  iEvent.getByToken<StreamsStub>(edGetTokenStubs_, handleStubs);
130  const StreamsStub& stubs = *handleStubs;
131  Handle<StreamsTrack> handleTracks;
132  iEvent.getByToken<StreamsTrack>(edGetTokenTracks_, handleTracks);
133  const StreamsTrack& tracks = *handleTracks;
134  for (int region = 0; region < setup_->numRegions(); region++) {
135  // object to reformat tracks from tracklet fromat to TMTT format in a processing region
137  // read in and organize input tracks and stubs
138  drin.consume(tracks, stubs);
139  // fill output products
140  drin.produce(acceptedStubs, acceptedTracks, lostStubs, lostTracks);
141  }
142  }
143  // store products
144  iEvent.emplace(edPutTokenAcceptedStubs_, std::move(acceptedStubs));
145  iEvent.emplace(edPutTokenAcceptedTracks_, std::move(acceptedTracks));
146  iEvent.emplace(edPutTokenLostStubs_, std::move(lostStubs));
148  }
149 
150 } // namespace trklet
151 
virtual void endJob()
Definition: ProducerDRin.cc:48
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
Class to emulate transformation of tracklet tracks and stubs into TMTT format and routing of seed typ...
Definition: DRin.h:21
std::vector< StreamTrack > StreamsTrack
Definition: TTTypes.h:67
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
EDPutTokenT< StreamsTrack > edPutTokenLostTracks_
Definition: ProducerDRin.cc:59
EDPutTokenT< StreamsTrack > edPutTokenAcceptedTracks_
Definition: ProducerDRin.cc:58
Class to process and provide run-time constants used by Track Trigger emulators.
Definition: Setup.h:44
std::vector< StreamStub > StreamsStub
Definition: TTTypes.h:66
EDGetTokenT< StreamsStub > edGetTokenStubs_
Definition: ProducerDRin.cc:53
Class to assign tracklet tracks and stubs to output channel based on their Pt or seed type as well as...
EDPutTokenT< StreamsStub > edPutTokenAcceptedStubs_
Definition: ProducerDRin.cc:55
~ProducerDRin() override
Definition: ProducerDRin.cc:43
char const * label
ParameterSet iConfig_
Definition: ProducerDRin.cc:69
int iEvent
Definition: GenABIO.cc:224
Definition: TTTypes.h:54
ESGetToken< Setup, SetupRcd > esGetTokenSetup_
Definition: ProducerDRin.cc:61
Transforms format of TBout into that expected by DR input.
Definition: ProducerDRin.cc:40
ESGetToken< DataFormats, DataFormatsRcd > esGetTokenDataFormats_
Definition: ProducerDRin.cc:63
void consume(const tt::StreamsTrack &streamsTrack, const tt::StreamsStub &streamsStub)
Definition: DRin.cc:61
const ChannelAssignment * channelAssignment_
Definition: ProducerDRin.cc:77
const DataFormats * dataFormats_
Definition: ProducerDRin.cc:73
const Setup * setup_
Definition: ProducerDRin.cc:71
bool configurationSupported() const
Definition: Setup.h:60
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ProcessHistory const & processHistory() const
Definition: Run.cc:115
ESGetToken< ChannelAssignment, ChannelAssignmentRcd > esGetTokenChannelAssignment_
Definition: ProducerDRin.cc:67
EDPutTokenT< StreamsStub > edPutTokenLostStubs_
Definition: ProducerDRin.cc:56
int numLayers() const
Definition: Setup.h:215
void checkHistory(const edm::ProcessHistory &processHistory) const
Definition: Setup.cc:242
EDGetTokenT< StreamsTrack > edGetTokenTracks_
Definition: ProducerDRin.cc:51
void produce(tt::StreamsStub &accpetedStubs, tt::StreamsTrack &acceptedTracks, tt::StreamsStub &lostStubs, tt::StreamsTrack &lostTracks)
Definition: DRin.cc:217
int numRegions() const
Definition: Setup.h:349
HLT enums.
Class to encode layer ids for Kalman Filter Layers consitent with rough r-z track parameters are coun...
Definition: LayerEncoding.h:19
ESGetToken< LayerEncoding, LayerEncodingRcd > esGetTokenLayerEncoding_
Definition: ProducerDRin.cc:65
Class to calculate and provide dataformats used by Track Trigger emulator.
Definition: DataFormats.h:216
const LayerEncoding * layerEncoding_
Definition: ProducerDRin.cc:75
void beginRun(const Run &, const EventSetup &) override
def move(src, dest)
Definition: eostools.py:511
Definition: Run.h:45
void produce(Event &, const EventSetup &) override