CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SubdetFEDSelector.cc
Go to the documentation of this file.
1 // user include files
7 
11 
13 
15 public:
17  ~SubdetFEDSelector() override;
18  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
19 
20 private:
21  void beginJob() override {}
22  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
23  void endJob() override {}
24 
25  // ----------member data ---------------------------
26  const bool getEcal_;
27  const bool getHcal_;
28  const bool getStrip_;
29  const bool getPixel_;
30  const bool getMuon_;
31  const bool getTrigger_;
32 
34 };
35 
37  : getEcal_(iConfig.getParameter<bool>("getECAL")),
38  getHcal_(iConfig.getParameter<bool>("getHCAL")),
39  getStrip_(iConfig.getParameter<bool>("getSiStrip")),
40  getPixel_(iConfig.getParameter<bool>("getSiPixel")),
41  getMuon_(iConfig.getParameter<bool>("getMuon")),
42  getTrigger_(iConfig.getParameter<bool>("getTrigger")),
43  tok_raw_(consumes<FEDRawDataCollection>(iConfig.getParameter<edm::InputTag>("rawInputLabel"))) {
44  produces<FEDRawDataCollection>();
45 }
46 
48 
50  auto producedData = std::make_unique<FEDRawDataCollection>();
51 
53 
54  std::vector<int> selFEDs;
55 
56  if (getEcal_) {
58  selFEDs.push_back(i);
59  }
61  selFEDs.push_back(i);
62  }
63  }
64 
65  if (getMuon_) {
67  selFEDs.push_back(i);
68  }
70  selFEDs.push_back(i);
71  }
73  selFEDs.push_back(i);
74  }
76  selFEDs.push_back(i);
77  }
79  selFEDs.push_back(i);
80  }
82  selFEDs.push_back(i);
83  }
85  selFEDs.push_back(i);
86  }
88  selFEDs.push_back(i);
89  }
90  }
91 
92  if (getHcal_) {
94  selFEDs.push_back(i);
95  }
96  }
97 
98  if (getStrip_) {
100  selFEDs.push_back(i);
101  }
102  }
103 
104  if (getPixel_) {
106  selFEDs.push_back(i);
107  }
108  }
109 
110  if (getTrigger_) {
112  selFEDs.push_back(i);
113  }
115  selFEDs.push_back(i);
116  }
118  selFEDs.push_back(i);
119  }
121  selFEDs.push_back(i);
122  }
124  selFEDs.push_back(i);
125  }
126 
128  selFEDs.push_back(i);
129  }
130 
132  selFEDs.push_back(i);
133  }
134 
136  selFEDs.push_back(i);
137  }
138 
140  selFEDs.push_back(i);
141  }
142 
144  selFEDs.push_back(i);
145  }
147  selFEDs.push_back(i);
148  }
149 
151  selFEDs.push_back(i);
152  }
154  selFEDs.push_back(i);
155  }
157  selFEDs.push_back(i);
158  }
159  }
160 
162  selFEDs.push_back(i);
163  }
164 
165  // Copying:
166  const FEDRawDataCollection* rdc = rawIn.product();
167 
168  // if ( ( rawData[i].provenance()->processName() != e.processHistory().rbegin()->processName() ) )
169  // continue ; // skip all raw collections not produced by the current process
170 
171  for (int j = 0; j < FEDNumbering::MAXFEDID; ++j) {
172  bool rightFED = false;
173  for (uint32_t k = 0; k < selFEDs.size(); k++) {
174  if (j == selFEDs[k]) {
175  rightFED = true;
176  }
177  }
178  if (!rightFED)
179  continue;
180  const FEDRawData& fedData = rdc->FEDData(j);
181  size_t size = fedData.size();
182 
183  if (size > 0) {
184  // this fed has data -- lets copy it
185  FEDRawData& fedDataProd = producedData->FEDData(j);
186  if (fedDataProd.size() != 0) {
187  // std::cout << " More than one FEDRawDataCollection with data in FED ";
188  // std::cout << j << " Skipping the 2nd\n";
189  continue;
190  }
191  fedDataProd.resize(size);
192  unsigned char* dataProd = fedDataProd.data();
193  const unsigned char* data = fedData.data();
194  for (unsigned int k = 0; k < size; ++k) {
195  dataProd[k] = data[k];
196  }
197  }
198  }
199 
200  iEvent.put(std::move(producedData));
201 }
202 
205  desc.add<edm::InputTag>("rawInputLabel", edm::InputTag("rawDataCollector"));
206  desc.add<bool>("getSiPixel", true);
207  desc.add<bool>("getHCAL", true);
208  desc.add<bool>("getECAL", false);
209  desc.add<bool>("getMuon", false);
210  desc.add<bool>("getTrigger", true);
211  desc.add<bool>("getSiStrip", false);
212  descriptions.add("subdetFED", desc);
213 }
214 
217 
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:563
int iEvent
Definition: GenABIO.cc:224
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void resize(size_t newsize)
Definition: FEDRawData.cc:28
def move
Definition: eostools.py:511
void endJob() override
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
SubdetFEDSelector(const edm::ParameterSet &)
~SubdetFEDSelector() override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const edm::EDGetTokenT< FEDRawDataCollection > tok_raw_
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
void beginJob() override
tuple size
Write out results.