CMS 3D CMS Logo

ProducerED.cc
Go to the documentation of this file.
12 
19 
20 #include <numeric>
21 #include <algorithm>
22 #include <vector>
23 #include <string>
24 #include <memory>
25 
26 using namespace std;
27 using namespace edm;
28 using namespace tt;
29 
30 namespace trackerDTC {
31 
37  class ProducerED : public stream::EDProducer<> {
38  public:
39  explicit ProducerED(const ParameterSet&);
40  ~ProducerED() override {}
41 
42  private:
43  void beginRun(const Run&, const EventSetup&) override;
44  void produce(Event&, const EventSetup&) override;
45  void endJob() {}
46  // helper class to store configurations
47  const Setup* setup_ = nullptr;
48  // class to encode layer ids used between DTC and TFP in Hybrid
49  const LayerEncoding* layerEncoding_ = nullptr;
50  // ED input token of TTStubs
52  // ED output token for accepted stubs
54  // ED output token for lost stubs
56  // Setup token
58  // LayerEncoding token
60  // configuration
62  };
63 
64  ProducerED::ProducerED(const ParameterSet& iConfig) : iConfig_(iConfig) {
65  // book in- and output ED products
66  const auto& inputTag = iConfig.getParameter<InputTag>("InputTag");
67  const auto& branchAccepted = iConfig.getParameter<string>("BranchAccepted");
68  const auto& branchLost = iConfig.getParameter<string>("BranchLost");
69  edGetToken_ = consumes<TTStubDetSetVec>(inputTag);
70  edPutTokenAccepted_ = produces<TTDTC>(branchAccepted);
71  edPutTokenLost_ = produces<TTDTC>(branchLost);
72  // book ES products
73  esGetTokenSetup_ = esConsumes<Setup, SetupRcd, Transition::BeginRun>();
74  esGetTokenLayerEncoding_ = esConsumes<LayerEncoding, LayerEncodingRcd, Transition::BeginRun>();
75  }
76 
77  void ProducerED::beginRun(const Run& iRun, const EventSetup& iSetup) {
78  setup_ = &iSetup.getData(esGetTokenSetup_);
80  return;
81  // check process history if desired
82  if (iConfig_.getParameter<bool>("CheckHistory"))
85  }
86 
87  void ProducerED::produce(Event& iEvent, const EventSetup& iSetup) {
88  // empty DTC products
89  TTDTC productAccepted = setup_->ttDTC();
90  TTDTC productLost = setup_->ttDTC();
92  // read in stub collection
94  iEvent.getByToken(edGetToken_, handle);
95  // apply cabling map, reorganise stub collections
96  vector<vector<vector<TTStubRef>>> stubsDTCs(setup_->numDTCs(),
97  vector<vector<TTStubRef>>(setup_->numModulesPerDTC()));
98  for (auto module = handle->begin(); module != handle->end(); module++) {
99  // DetSetVec->detId + 1 = tk layout det id
100  const DetId detId = module->detId() + setup_->offsetDetIdDSV();
101  // corresponding sensor module
103  // empty stub collection
104  vector<TTStubRef>& stubsModule = stubsDTCs[sm->dtcId()][sm->modId()];
105  stubsModule.reserve(module->size());
106  for (TTStubDetSet::const_iterator ttStub = module->begin(); ttStub != module->end(); ttStub++)
107  stubsModule.emplace_back(makeRefTo(handle, ttStub));
108  }
109  // board level processing
110  for (int dtcId = 0; dtcId < setup_->numDTCs(); dtcId++) {
111  // create single outer tracker DTC board
112  DTC dtc(iConfig_, setup_, layerEncoding_, dtcId, stubsDTCs.at(dtcId));
113  // route stubs and fill products
114  dtc.produce(productAccepted, productLost);
115  }
116  }
117  // store ED products
118  iEvent.emplace(edPutTokenAccepted_, std::move(productAccepted));
119  iEvent.emplace(edPutTokenLost_, std::move(productLost));
120  }
121 
122 } // namespace trackerDTC
123 
Class to represent an outer tracker DTC board.
Definition: DTC.h:19
~ProducerED() override
Definition: ProducerED.cc:40
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const LayerEncoding * layerEncoding_
Definition: ProducerED.cc:49
EDGetTokenT< TTStubDetSetVec > edGetToken_
Definition: ProducerED.cc:51
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
Class to process and provide run-time constants used by Track Trigger emulators.
Definition: Setup.h:44
const Setup * setup_
Definition: ProducerED.cc:47
data_type const * const_iterator
Definition: DetSetNew.h:31
int offsetDetIdDSV() const
Definition: Setup.h:363
int modId() const
Definition: SensorModule.h:23
int iEvent
Definition: GenABIO.cc:224
Definition: TTTypes.h:54
Ref< typename HandleT::element_type, typename HandleT::element_type::value_type::value_type > makeRefTo(const HandleT &iHandle, det_id_type iDetID, typename HandleT::element_type::value_type::const_iterator itIter)
Definition: DetSetVector.h:418
ESGetToken< Setup, SetupRcd > esGetTokenSetup_
Definition: ProducerED.cc:57
void produce(Event &, const EventSetup &) override
Definition: ProducerED.cc:87
bool configurationSupported() const
Definition: Setup.h:60
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ProcessHistory const & processHistory() const
Definition: Run.cc:115
int dtcId() const
Definition: SensorModule.h:21
Class to produce hardware like structured TTStub Collection used by Track Trigger emulators...
Definition: ProducerED.cc:37
EDPutTokenT< TTDTC > edPutTokenLost_
Definition: ProducerED.cc:55
TTDTC ttDTC() const
Definition: Setup.h:90
void checkHistory(const edm::ProcessHistory &processHistory) const
Definition: Setup.cc:238
Definition: DetId.h:17
int numModulesPerDTC() const
Definition: Setup.h:353
Class to store hardware like structured TTStub Collection used by Track Trigger emulators.
Definition: TTDTC.h:17
void beginRun(const Run &, const EventSetup &) override
Definition: ProducerED.cc:77
ESGetToken< LayerEncoding, LayerEncodingRcd > esGetTokenLayerEncoding_
Definition: ProducerED.cc:59
int numDTCs() const
Definition: Setup.h:373
ParameterSet iConfig_
Definition: ProducerED.cc:61
Class to encode layer ids used between DTC and TFP in Hybrid.
Definition: LayerEncoding.h:19
Definition: DTC.h:12
HLT enums.
EDPutTokenT< TTDTC > edPutTokenAccepted_
Definition: ProducerED.cc:53
SensorModule * sensorModule(const DetId &detId) const
Definition: Setup.cc:361
def move(src, dest)
Definition: eostools.py:511
Definition: Run.h:45