CMS 3D CMS Logo

CastorDigiToRaw.cc
Go to the documentation of this file.
6 #include <iostream>
7 
10 
11 using namespace std;
12 
14  : castorTag_(conf.getParameter<edm::InputTag>("CASTOR")),
15  usingctdc_(conf.getParameter<bool>("CastorCtdc")),
16  tok_input_(consumes<CastorDigiCollection>(castorTag_)),
17  tok_put_(produces<FEDRawDataCollection>()),
18  tok_pSetup_(esConsumes<CastorDbService, CastorDbRecord>()) {}
19 
20 // Functions that gets called by framework every event
22  CastorCollections colls;
23 
24  // Step A: Get Inputs
26  if (!castorTag_.label().empty()) {
27  e.getByToken(tok_input_, castor);
28  colls.castorCont = castor.product();
29  }
30  // get the mapping
32  const CastorElectronicsMap* readoutMap = pSetup->getCastorMapping();
33  // Step B: Create empty output
35 
36  constexpr int ifed_first = FEDNumbering::MINCASTORFEDID; //690
37  constexpr int ifed_last = FEDNumbering::MAXCASTORFEDID; //693
38 
39  int orbitN = e.id().event();
40  int bcnN = 2000;
41 
42  // Step C: pack all requested FEDs
43  for (int ifed = ifed_first; ifed <= ifed_last; ++ifed) {
44  FEDRawData& fed = raw.FEDData(ifed);
45  try {
46  if (usingctdc_) {
47  CastorCtdcPacker::pack(ifed, ifed - ifed_first, e.id().event(), orbitN, bcnN, colls, *readoutMap, fed);
48  } else {
49  CastorPacker::pack(ifed, ifed - ifed_first, e.id().event(), orbitN, bcnN, colls, *readoutMap, fed);
50  }
51  } catch (cms::Exception& e) {
52  edm::LogWarning("Unpacking error") << e.what();
53  } catch (...) {
54  edm::LogWarning("Unpacking exception");
55  }
56  }
57 
58  e.emplace(tok_put_, std::move(raw));
59 }
CastorDigiToRaw::castorTag_
const edm::InputTag castorTag_
Definition: CastorDigiToRaw.h:35
FEDNumbering.h
edm::StreamID
Definition: StreamID.h:30
CastorDigiToRaw::CastorDigiToRaw
CastorDigiToRaw(const edm::ParameterSet &ps)
Definition: CastorDigiToRaw.cc:13
FEDNumbering::MAXCASTORFEDID
Definition: FEDNumbering.h:46
electrons_cff.bool
bool
Definition: electrons_cff.py:393
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:21
ESHandle.h
FEDRawDataCollection
Definition: FEDRawDataCollection.h:18
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89353
CastorDigiToRaw::tok_put_
const edm::EDPutTokenT< FEDRawDataCollection > tok_put_
Definition: CastorDigiToRaw.h:38
edm::SortedCollection
Definition: SortedCollection.h:49
CastorDigiToRaw.h
edm::Handle
Definition: AssociativeIterator.h:50
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
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
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::ParameterSet
Definition: ParameterSet.h:47
CastorCollections
Definition: CastorCollections.h:16
CastorDigiToRaw::usingctdc_
const bool usingctdc_
Definition: CastorDigiToRaw.h:36
FEDRawDataCollection.h
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
CastorDbService
Definition: CastorDbService.h:28
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
CastorDbRecord
Definition: CastorDbRecord.h:29
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
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
CastorDigiToRaw::tok_pSetup_
const edm::ESGetToken< CastorDbService, CastorDbRecord > tok_pSetup_
Definition: CastorDigiToRaw.h:39
castorDigitizer_cfi.castor
castor
Definition: castorDigitizer_cfi.py:9
CastorDigiToRaw::tok_input_
const edm::EDGetTokenT< CastorDigiCollection > tok_input_
Definition: CastorDigiToRaw.h:37
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37