CMS 3D CMS Logo

SubdetFEDSelector.cc
Go to the documentation of this file.
1 
3 
5  getEcal_ = iConfig.getParameter<bool>("getECAL");
6  getStrip_ = iConfig.getParameter<bool>("getSiStrip");
7  getPixel_ = iConfig.getParameter<bool>("getSiPixel");
8  getHcal_ = iConfig.getParameter<bool>("getHCAL");
9  getMuon_ = iConfig.getParameter<bool>("getMuon");
10  getTrigger_ = iConfig.getParameter<bool>("getTrigger");
11 
12  tok_raw_ = consumes<FEDRawDataCollection>(iConfig.getParameter<edm::InputTag>("rawInputLabel"));
13 
14  produces<FEDRawDataCollection>();
15 }
16 
18 
20  auto producedData = std::make_unique<FEDRawDataCollection>();
21 
23  iEvent.getByToken(tok_raw_, rawIn);
24 
25  std::vector<int> selFEDs;
26 
27  if (getEcal_) {
29  selFEDs.push_back(i);
30  }
32  selFEDs.push_back(i);
33  }
34  }
35 
36  if (getMuon_) {
38  selFEDs.push_back(i);
39  }
41  selFEDs.push_back(i);
42  }
44  selFEDs.push_back(i);
45  }
47  selFEDs.push_back(i);
48  }
50  selFEDs.push_back(i);
51  }
53  selFEDs.push_back(i);
54  }
56  selFEDs.push_back(i);
57  }
59  selFEDs.push_back(i);
60  }
61  }
62 
63  if (getHcal_) {
65  selFEDs.push_back(i);
66  }
67  }
68 
69  if (getStrip_) {
71  selFEDs.push_back(i);
72  }
73  }
74 
75  if (getPixel_) {
77  selFEDs.push_back(i);
78  }
79  }
80 
81  if (getTrigger_) {
83  selFEDs.push_back(i);
84  }
86  selFEDs.push_back(i);
87  }
89  selFEDs.push_back(i);
90  }
92  selFEDs.push_back(i);
93  }
95  selFEDs.push_back(i);
96  }
97 
99  selFEDs.push_back(i);
100  }
101 
103  selFEDs.push_back(i);
104  }
105 
107  selFEDs.push_back(i);
108  }
109 
111  selFEDs.push_back(i);
112  }
113 
115  selFEDs.push_back(i);
116  }
118  selFEDs.push_back(i);
119  }
120 
122  selFEDs.push_back(i);
123  }
125  selFEDs.push_back(i);
126  }
128  selFEDs.push_back(i);
129  }
130  }
131 
133  selFEDs.push_back(i);
134  }
135 
136  // Copying:
137  const FEDRawDataCollection* rdc = rawIn.product();
138 
139  // if ( ( rawData[i].provenance()->processName() != e.processHistory().rbegin()->processName() ) )
140  // continue ; // skip all raw collections not produced by the current process
141 
142  for (int j = 0; j < FEDNumbering::MAXFEDID; ++j) {
143  bool rightFED = false;
144  for (uint32_t k = 0; k < selFEDs.size(); k++) {
145  if (j == selFEDs[k]) {
146  rightFED = true;
147  }
148  }
149  if (!rightFED)
150  continue;
151  const FEDRawData& fedData = rdc->FEDData(j);
152  size_t size = fedData.size();
153 
154  if (size > 0) {
155  // this fed has data -- lets copy it
156  FEDRawData& fedDataProd = producedData->FEDData(j);
157  if (fedDataProd.size() != 0) {
158  // std::cout << " More than one FEDRawDataCollection with data in FED ";
159  // std::cout << j << " Skipping the 2nd\n";
160  continue;
161  }
162  fedDataProd.resize(size);
163  unsigned char* dataProd = fedDataProd.data();
164  const unsigned char* data = fedData.data();
165  for (unsigned int k = 0; k < size; ++k) {
166  dataProd[k] = data[k];
167  }
168  }
169  }
170 
171  iEvent.put(std::move(producedData));
172 }
173 
174 // ------------ method called once each job just before starting event loop ------------
176 
177 // ------------ method called once each job just after ending the event loop ------------
size
Write out results.
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
int iEvent
Definition: GenABIO.cc:224
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void resize(size_t newsize)
Definition: FEDRawData.cc:32
void endJob() override
SubdetFEDSelector(const edm::ParameterSet &)
int k[5][pyjets_maxn]
~SubdetFEDSelector() override
edm::EDGetTokenT< FEDRawDataCollection > tok_raw_
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
void beginJob() override
def move(src, dest)
Definition: eostools.py:511
void produce(edm::Event &, const edm::EventSetup &) override