CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Attributes | Private Attributes
ESDigiToRaw Class Reference

#include <ESDigiToRaw.h>

Inheritance diagram for ESDigiToRaw:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef uint32_t Word32
 
typedef uint64_t Word64
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

void beginJob ()
 
void endJob ()
 
 ESDigiToRaw (const edm::ParameterSet &ps)
 
int * GetBX ()
 
int * GetCounter ()
 
int * GetLV1 ()
 
int * GetOrbit ()
 
int * GetRunNumber ()
 
void produce (edm::Event &e, const edm::EventSetup &es)
 
virtual ~ESDigiToRaw ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Attributes

static const int BXMAX = 2808
 
static const int KCHIP_BC_RANGE = 4096
 
static const int KCHIP_EC_RANGE = 256
 
static const int LHC_BX_RANGE = 3564
 

Private Attributes

int bx_
 
int counter_
 
bool debug_
 
ESDataFormatterESDataFormatter_
 
edm::EDGetTokenT
< ESDigiCollection
ESDigiToken_
 
int fedId_ [2][2][40][40]
 
int formatMajor_
 
int formatMinor_
 
std::string instanceName_
 
int kchip_bc_
 
int kchip_ec_
 
std::string label_
 
edm::FileInPath lookup_
 
int lv1_
 
int orbit_number_
 
int run_number_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 20 of file ESDigiToRaw.h.

Member Typedef Documentation

typedef uint32_t ESDigiToRaw::Word32

Definition at line 31 of file ESDigiToRaw.h.

typedef uint64_t ESDigiToRaw::Word64

Definition at line 32 of file ESDigiToRaw.h.

Constructor & Destructor Documentation

ESDigiToRaw::ESDigiToRaw ( const edm::ParameterSet ps)

Definition at line 14 of file ESDigiToRaw.cc.

References counter_, gather_cfg::cout, debug_, ESDataFormatter_, ESDigiToken_, fedId_, mergeVDriftHistosByStation::file, formatMajor_, formatMinor_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, HLT_25ns10e33_v2_cff::InputTag, instanceName_, j, relval_2017::k, kchip_bc_, kchip_ec_, label_, lookup_, visualization-live-secondInstance_cfg::m, and submitDQMOfflineCAF::nLines.

14  : ESDataFormatter_(0)
15 {
16 
17  label_ = ps.getParameter<string>("Label");
18  instanceName_ = ps.getParameter<string>("InstanceES");
19  edm::InputTag ESTag = edm::InputTag(label_, instanceName_);
20  ESDigiToken_ = consumes<ESDigiCollection>(ESTag);
21  debug_ = ps.getUntrackedParameter<bool>("debugMode", false);
22  formatMajor_ = ps.getUntrackedParameter<int>("formatMajor", 4);
23  formatMinor_ = ps.getUntrackedParameter<int>("formatMinor", 1);
24  lookup_ = ps.getUntrackedParameter<FileInPath>("LookupTable");
25 
26  counter_ = 0;
27  kchip_ec_ = 0;
28  kchip_bc_ = 0;
29 
30  produces<FEDRawDataCollection>();
31 
32  if (formatMajor_ == 4)
34  else
36 
37  // initialize look-up table
38  for (int i=0; i<2; ++i)
39  for (int j=0; j<2; ++j)
40  for (int k=0 ;k<40; ++k)
41  for (int m=0; m<40; m++)
42  fedId_[i][j][k][m] = -1;
43 
44  // read in look-up table
45  int nLines, iz, ip, ix, iy, fed, kchip, pace, bundle, fiber, optorx;
46  ifstream file;
47  file.open(lookup_.fullPath().c_str());
48  if( file.is_open() ) {
49 
50  file >> nLines;
51  for (int i=0; i<nLines; ++i) {
52  file >> iz >> ip >> ix >> iy >> fed >> kchip >> pace >> bundle >> fiber >> optorx ;
53  fedId_[(3-iz)/2-1][ip-1][ix-1][iy-1] = fed;
54  }
55  } else {
56  cout<<"[ESDigiToRaw] Look up table file can not be found in "<<lookup_.fullPath().c_str() <<endl;
57  }
58 
59  file.close();
60 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
std::string label_
Definition: ESDigiToRaw.h:56
edm::EDGetTokenT< ESDigiCollection > ESDigiToken_
Definition: ESDigiToRaw.h:58
int formatMinor_
Definition: ESDigiToRaw.h:62
ESDataFormatter * ESDataFormatter_
Definition: ESDigiToRaw.h:64
edm::FileInPath lookup_
Definition: ESDigiToRaw.h:59
int formatMajor_
Definition: ESDigiToRaw.h:61
int fedId_[2][2][40][40]
Definition: ESDigiToRaw.h:54
std::string instanceName_
Definition: ESDigiToRaw.h:57
int j
Definition: DBlmapReader.cc:9
tuple cout
Definition: gather_cfg.py:145
ESDigiToRaw::~ESDigiToRaw ( )
virtual

Definition at line 62 of file ESDigiToRaw.cc.

References ESDataFormatter_.

62  {
64 }
ESDataFormatter * ESDataFormatter_
Definition: ESDigiToRaw.h:64

Member Function Documentation

void ESDigiToRaw::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 66 of file ESDigiToRaw.cc.

66  {
67 }
void ESDigiToRaw::endJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 122 of file ESDigiToRaw.cc.

122  {
123 }
int* ESDigiToRaw::GetBX ( )
inline

Definition at line 36 of file ESDigiToRaw.h.

References bx_.

36 {return &bx_ ;}
int* ESDigiToRaw::GetCounter ( )
inline

Definition at line 34 of file ESDigiToRaw.h.

References counter_.

34 {return &counter_ ;}
int* ESDigiToRaw::GetLV1 ( )
inline

Definition at line 37 of file ESDigiToRaw.h.

References lv1_.

37 {return &lv1_ ;}
int* ESDigiToRaw::GetOrbit ( )
inline

Definition at line 35 of file ESDigiToRaw.h.

References orbit_number_.

35 {return &orbit_number_ ;}
int orbit_number_
Definition: ESDigiToRaw.h:48
int* ESDigiToRaw::GetRunNumber ( )
inline

Definition at line 38 of file ESDigiToRaw.h.

References run_number_.

38 {return &run_number_ ;}
int run_number_
Definition: ESDigiToRaw.h:49
void ESDigiToRaw::produce ( edm::Event e,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 69 of file ESDigiToRaw.cc.

References bx_, counter_, gather_cfg::cout, debug_, ESDataFormatter::DigiToRaw(), ESDataFormatter_, ESDigiToken_, edm::EventID::event(), fedId_, edm::Event::getByToken(), edm::EventBase::id(), kchip_bc_, KCHIP_BC_RANGE, kchip_ec_, KCHIP_EC_RANGE, LHC_BX_RANGE, lv1_, orbit_number_, ESDetId::plane(), edm::Event::put(), edm::EventID::run(), run_number_, ESDataFormatter::setBX(), ESDataFormatter::setKchipBC(), ESDataFormatter::setKchipEC(), ESDataFormatter::setLV1(), ESDataFormatter::setOrbitNumber(), ESDataFormatter::setRunNumber(), ESDetId::six(), ESDetId::siy(), FEDRawData::size(), and ESDetId::zside().

Referenced by JSONExport.JsonExport::export().

69  {
70 
71  run_number_ = ev.id().run();
74 
75  lv1_ = ev.id().event();
78  counter_++;
79 
86 
88  ev.getByToken(ESDigiToken_, digis);
89 
90  int ifed;
92  Digis.clear();
93 
94  for (ESDigiCollection::const_iterator it=digis->begin(); it!=digis->end(); ++it) {
95 
96  const ESDataFrame& df = *it;
97  const ESDetId& detId = it->id();
98 
99  ifed = fedId_[(3-detId.zside())/2-1][detId.plane()-1][detId.six()-1][detId.siy()-1];
100  if (ifed < 0) continue;
101 
102  Digis[ifed].push_back(df);
103  }
104 
105  auto_ptr<FEDRawDataCollection> productRawData( new FEDRawDataCollection );
106 
107  ESDataFormatter::Digis::const_iterator itfed;
108  for (itfed = Digis.begin(); itfed != Digis.end(); ++itfed) {
109  int fId = (*itfed).first ;
110 
111  FEDRawData& fedRawData = productRawData->FEDData(fId);
112  ESDataFormatter_->DigiToRaw(fId, Digis, fedRawData);
113 
114  if (debug_) cout<<"FED : "<<fId<<" Data size : "<<fedRawData.size()<<" (Bytes)"<<endl;
115  }
116 
117  ev.put(productRawData);
118 
119  return;
120 }
static const int KCHIP_EC_RANGE
Definition: ESDigiToRaw.h:43
virtual void DigiToRaw(int fedId, Digis &digis, FEDRawData &fedRawData)=0
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
virtual void setRunNumber(int i)
int orbit_number_
Definition: ESDigiToRaw.h:48
bool ev
int six() const
Definition: ESDetId.h:48
virtual void setKchipEC(int i)
edm::EDGetTokenT< ESDigiCollection > ESDigiToken_
Definition: ESDigiToRaw.h:58
std::map< int, DetDigis > Digis
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
ESDataFormatter * ESDataFormatter_
Definition: ESDigiToRaw.h:64
virtual void setKchipBC(int i)
int siy() const
Definition: ESDetId.h:50
virtual void setBX(int i)
int fedId_[2][2][40][40]
Definition: ESDigiToRaw.h:54
virtual void setOrbitNumber(int i)
int run_number_
Definition: ESDigiToRaw.h:49
int zside() const
Definition: ESDetId.h:44
virtual void setLV1(int i)
static const int KCHIP_BC_RANGE
Definition: ESDigiToRaw.h:42
int plane() const
Definition: ESDetId.h:46
tuple cout
Definition: gather_cfg.py:145
static const int LHC_BX_RANGE
Definition: ESDigiToRaw.h:41

Member Data Documentation

int ESDigiToRaw::bx_
private

Definition at line 50 of file ESDigiToRaw.h.

Referenced by GetBX(), and produce().

const int ESDigiToRaw::BXMAX = 2808
static

Definition at line 40 of file ESDigiToRaw.h.

int ESDigiToRaw::counter_
private

Definition at line 47 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw(), GetCounter(), and produce().

bool ESDigiToRaw::debug_
private

Definition at line 60 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw(), and produce().

ESDataFormatter* ESDigiToRaw::ESDataFormatter_
private

Definition at line 64 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw(), produce(), and ~ESDigiToRaw().

edm::EDGetTokenT<ESDigiCollection> ESDigiToRaw::ESDigiToken_
private

Definition at line 58 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw(), and produce().

int ESDigiToRaw::fedId_[2][2][40][40]
private

Definition at line 54 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw(), and produce().

int ESDigiToRaw::formatMajor_
private

Definition at line 61 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw().

int ESDigiToRaw::formatMinor_
private

Definition at line 62 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw().

std::string ESDigiToRaw::instanceName_
private

Definition at line 57 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw().

int ESDigiToRaw::kchip_bc_
private

Definition at line 53 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw(), and produce().

const int ESDigiToRaw::KCHIP_BC_RANGE = 4096
static

Definition at line 42 of file ESDigiToRaw.h.

Referenced by produce().

int ESDigiToRaw::kchip_ec_
private

Definition at line 52 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw(), and produce().

const int ESDigiToRaw::KCHIP_EC_RANGE = 256
static

Definition at line 43 of file ESDigiToRaw.h.

Referenced by produce().

std::string ESDigiToRaw::label_
private

Definition at line 56 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw().

const int ESDigiToRaw::LHC_BX_RANGE = 3564
static

Definition at line 41 of file ESDigiToRaw.h.

Referenced by produce().

edm::FileInPath ESDigiToRaw::lookup_
private

Definition at line 59 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw().

int ESDigiToRaw::lv1_
private

Definition at line 51 of file ESDigiToRaw.h.

Referenced by GetLV1(), and produce().

int ESDigiToRaw::orbit_number_
private

Definition at line 48 of file ESDigiToRaw.h.

Referenced by GetOrbit(), and produce().

int ESDigiToRaw::run_number_
private

Definition at line 49 of file ESDigiToRaw.h.

Referenced by GetRunNumber(), and produce().