CMS 3D CMS Logo

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