CMS 3D CMS Logo

CastorDigiToRaw.cc
Go to the documentation of this file.
8 #include <iostream>
9 
12 
13 using namespace std;
14 
16  : castorTag_(conf.getParameter<edm::InputTag>("CASTOR")),
17  usingctdc_(conf.getParameter<bool>("CastorCtdc")),
18  tok_input_(consumes<CastorDigiCollection>(castorTag_)),
19  tok_put_(produces<FEDRawDataCollection>()) {}
20 
21 // Functions that gets called by framework every event
23  CastorCollections colls;
24 
25  // Step A: Get Inputs
27  if (!castorTag_.label().empty()) {
28  e.getByToken(tok_input_, castor);
29  colls.castorCont = castor.product();
30  }
31  // get the mapping
33  es.get<CastorDbRecord>().get(pSetup);
34  const CastorElectronicsMap* readoutMap = pSetup->getCastorMapping();
35  // Step B: Create empty output
37 
38  constexpr int ifed_first = FEDNumbering::MINCASTORFEDID; //690
39  constexpr int ifed_last = FEDNumbering::MAXCASTORFEDID; //693
40 
41  int orbitN = e.id().event();
42  int bcnN = 2000;
43 
44  // Step C: pack all requested FEDs
45  for (int ifed = ifed_first; ifed <= ifed_last; ++ifed) {
46  FEDRawData& fed = raw.FEDData(ifed);
47  try {
48  if (usingctdc_) {
49  CastorCtdcPacker::pack(ifed, ifed - ifed_first, e.id().event(), orbitN, bcnN, colls, *readoutMap, fed);
50  } else {
51  CastorPacker::pack(ifed, ifed - ifed_first, e.id().event(), orbitN, bcnN, colls, *readoutMap, fed);
52  }
53  } catch (cms::Exception& e) {
54  edm::LogWarning("Unpacking error") << e.what();
55  } catch (...) {
56  edm::LogWarning("Unpacking exception");
57  }
58  }
59 
60  e.emplace(tok_put_, std::move(raw));
61 }
CastorDigiToRaw::castorTag_
const edm::InputTag castorTag_
Definition: CastorDigiToRaw.h:32
FEDNumbering.h
edm::StreamID
Definition: StreamID.h:30
CastorDigiToRaw::CastorDigiToRaw
CastorDigiToRaw(const edm::ParameterSet &ps)
Definition: CastorDigiToRaw.cc:15
FEDNumbering::MAXCASTORFEDID
Definition: FEDNumbering.h:46
electrons_cff.bool
bool
Definition: electrons_cff.py:372
CastorCtdcPacker::pack
static void pack(int fedid, int dccnumber, int nl1a, int orbitn, int bcn, const CastorCollections &inputs, const CastorElectronicsMap &emap, FEDRawData &output)
Definition: CastorCtdcPacker.cc:45
MessageLogger.h
CastorDigiToRaw::produce
void produce(edm::StreamID, edm::Event &e, const edm::EventSetup &c) const override
Definition: CastorDigiToRaw.cc:22
ESHandle.h
FEDRawDataCollection
Definition: FEDRawDataCollection.h:18
edm
HLT enums.
Definition: AlignableModifier.h:19
CastorDigiToRaw::tok_put_
const edm::EDPutTokenT< FEDRawDataCollection > tok_put_
Definition: CastorDigiToRaw.h:35
edm::SortedCollection
Definition: SortedCollection.h:49
CastorDigiToRaw.h
edm::Handle
Definition: AssociativeIterator.h:50
FEDRawData
Definition: FEDRawData.h:19
CastorCollections.h
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
CastorCollections::castorCont
const CastorDigiCollection * castorCont
Definition: CastorCollections.h:20
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
FEDNumbering::MINCASTORFEDID
Definition: FEDNumbering.h:45
HcalDigiCollections.h
edm::ESHandle
Definition: DTSurvey.h:22
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: FEDRawDataCollection.cc:19
edm::LogWarning
Definition: MessageLogger.h:141
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
CastorCollections
Definition: CastorCollections.h:16
CastorDigiToRaw::usingctdc_
const bool usingctdc_
Definition: CastorDigiToRaw.h:33
FEDRawDataCollection.h
CastorPacker::pack
static void pack(int fedid, int dccnumber, int nl1a, int orbitn, int bcn, const CastorCollections &inputs, const CastorElectronicsMap &emap, FEDRawData &output)
Definition: CastorPacker.cc:41
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
CastorDbRecord
Definition: CastorDbRecord.h:29
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
CastorDbService.h
CastorElectronicsMap
Definition: CastorElectronicsMap.h:30
CastorDbService::getCastorMapping
const CastorElectronicsMap * getCastorMapping() const
Definition: CastorDbService.cc:183
cms::Exception
Definition: Exception.h:70
edm::Event
Definition: Event.h:73
CastorDbRecord.h
castorDigitizer_cfi.castor
castor
Definition: castorDigitizer_cfi.py:9
CastorDigiToRaw::tok_input_
const edm::EDGetTokenT< CastorDigiCollection > tok_input_
Definition: CastorDigiToRaw.h:34
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37