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 
trackerDTC::Setup::configurationSupported
bool configurationSupported() const
Definition: Setup.h:57
trackerDTC::ProducerED::edPutTokenAccepted_
EDPutTokenT< TTDTC > edPutTokenAccepted_
Definition: ProducerED.cc:49
Handle.h
TTDTC
Class to store hardware like structured TTStub Collection used by Track Trigger emulators.
Definition: TTDTC.h:17
electrons_cff.bool
bool
Definition: electrons_cff.py:366
trackerDTC::SensorModule
Definition: SensorModule.h:11
TTTypes.h
patZpeak.handle
handle
Definition: patZpeak.py:23
edm::Run
Definition: Run.h:45
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::EDPutTokenT< TTDTC >
trackerDTC::Setup::ttDTC
TTDTC ttDTC() const
Definition: Setup.h:83
trackerDTC::Setup::numDTCs
int numDTCs() const
Definition: Setup.h:243
TTDTC.h
trackerDTC::ProducerED::checkHistory_
bool checkHistory_
Definition: ProducerED.cc:57
edm::makeRefTo
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
trackerDTC::DTC::produce
void produce(TTDTC &accepted, TTDTC &lost)
Definition: DTC.cc:65
EDProducer.h
trackerDTC::Setup
Class to process and provide run-time constants used by Track Trigger emulators.
Definition: Setup.h:41
edm::Handle
Definition: AssociativeIterator.h:50
ESGetToken.h
trackerDTC::DTC
Definition: DTC.h:13
SensorModule.h
DetId
Definition: DetId.h:17
trackerDTC::ProducerED::esGetToken_
ESGetToken< Setup, SetupRcd > esGetToken_
Definition: ProducerED.cc:53
trackerDTC::ProducerED::endJob
void endJob()
Definition: ProducerED.cc:43
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
trackerDTC::Setup::sensorModule
SensorModule * sensorModule(const DetId &detId) const
Definition: Setup.cc:321
trackerDTC::Setup::checkHistory
void checkHistory(const edm::ProcessHistory &processHistory) const
Definition: Setup.cc:220
trackerDTC::SensorModule::dtcId
int dtcId() const
Definition: SensorModule.h:21
trackerDTC::ProducerED::setup_
Setup setup_
Definition: ProducerED.cc:45
Run.h
EDGetToken.h
trackerDTC::Setup::numModulesPerDTC
int numModulesPerDTC() const
Definition: Setup.h:225
trackerDTC::ProducerED::beginRun
void beginRun(const Run &, const EventSetup &) override
Definition: ProducerED.cc:73
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
EDPutToken.h
trackerDTC::ProducerED
Class to produce hardware like structured TTStub Collection used by Track Trigger emulators.
Definition: ProducerED.cc:35
trackerDTC::ProducerED::iConfig_
ParameterSet iConfig_
Definition: ProducerED.cc:55
iEvent
int iEvent
Definition: GenABIO.cc:224
trackerDTC::Setup::offsetDetIdDSV
int offsetDetIdDSV() const
Definition: Setup.h:235
edm::stream::EDProducer
Definition: EDProducer.h:38
edm::EventSetup
Definition: EventSetup.h:58
trackerDTC
Definition: DTC.h:10
edm::ESGetToken
Definition: EventSetup.h:48
trackerDTC::ProducerED::produce
void produce(Event &, const EventSetup &) override
Definition: ProducerED.cc:82
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
Setup.h
trackerDTC::ProducerED::edPutTokenLost_
EDPutTokenT< TTDTC > edPutTokenLost_
Definition: ProducerED.cc:51
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
DetId.h
trackerDTC::ProducerED::~ProducerED
~ProducerED() override
Definition: ProducerED.cc:38
DTC.h
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
trackerDTC::SensorModule::modId
int modId() const
Definition: SensorModule.h:23
trackerDTC::ProducerED::edGetToken_
EDGetTokenT< TTStubDetSetVec > edGetToken_
Definition: ProducerED.cc:47
ParameterSet.h
SimL1EmulatorRepack_Full_cff.inputTag
inputTag
Definition: SimL1EmulatorRepack_Full_cff.py:56
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
edm::Run::processHistory
ProcessHistory const & processHistory() const
Definition: Run.cc:113
edmNew::DetSet::const_iterator
const data_type * const_iterator
Definition: DetSetNew.h:31