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::ProductRegistryHelper

Public Types

typedef uint32_t Word32
 
typedef uint64_t Word64
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

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 ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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_
 
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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 19 of file ESDigiToRaw.h.

Member Typedef Documentation

typedef uint32_t ESDigiToRaw::Word32

Definition at line 30 of file ESDigiToRaw.h.

typedef uint64_t ESDigiToRaw::Word64

Definition at line 31 of file ESDigiToRaw.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file ESDigiToRaw.cc.

References counter_, gather_cfg::cout, debug_, ESDataFormatter_, fedId_, mergeVDriftHistosByStation::file, formatMajor_, formatMinor_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, instanceName_, j, gen::k, kchip_bc_, kchip_ec_, label_, lookup_, m, and submitDQMOfflineCAF::nLines.

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

Definition at line 61 of file ESDigiToRaw.cc.

References ESDataFormatter_.

61  {
63 }
ESDataFormatter * ESDataFormatter_
Definition: ESDigiToRaw.h:62

Member Function Documentation

void ESDigiToRaw::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 65 of file ESDigiToRaw.cc.

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

Reimplemented from edm::EDProducer.

Definition at line 121 of file ESDigiToRaw.cc.

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

Definition at line 35 of file ESDigiToRaw.h.

References bx_.

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

Definition at line 33 of file ESDigiToRaw.h.

References counter_.

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

Definition at line 36 of file ESDigiToRaw.h.

References lv1_.

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

Definition at line 34 of file ESDigiToRaw.h.

References orbit_number_.

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

Definition at line 37 of file ESDigiToRaw.h.

References run_number_.

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

Implements edm::EDProducer.

Definition at line 68 of file ESDigiToRaw.cc.

References bx_, counter_, gather_cfg::cout, debug_, ESDataFormatter::DigiToRaw(), ESDataFormatter_, edm::EventID::event(), fedId_, edm::Event::getByLabel(), edm::EventBase::id(), instanceName_, kchip_bc_, KCHIP_BC_RANGE, kchip_ec_, KCHIP_EC_RANGE, label_, 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(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

68  {
69 
70  run_number_ = ev.id().run();
73 
74  lv1_ = ev.id().event();
77  counter_++;
78 
85 
87  ev.getByLabel(label_, instanceName_, digis);
88 
89  int ifed;
91  Digis.clear();
92 
93  for (ESDigiCollection::const_iterator it=digis->begin(); it!=digis->end(); ++it) {
94 
95  const ESDataFrame& df = *it;
96  const ESDetId& detId = it->id();
97 
98  ifed = fedId_[(3-detId.zside())/2-1][detId.plane()-1][detId.six()-1][detId.siy()-1];
99  if (ifed < 0) continue;
100 
101  Digis[ifed].push_back(df);
102  }
103 
104  auto_ptr<FEDRawDataCollection> productRawData( new FEDRawDataCollection );
105 
106  ESDataFormatter::Digis::const_iterator itfed;
107  for (itfed = Digis.begin(); itfed != Digis.end(); ++itfed) {
108  int fId = (*itfed).first ;
109 
110  FEDRawData& fedRawData = productRawData->FEDData(fId);
111  ESDataFormatter_->DigiToRaw(fId, Digis, fedRawData);
112 
113  if (debug_) cout<<"FED : "<<fId<<" Data size : "<<fedRawData.size()<<" (Bytes)"<<endl;
114  }
115 
116  ev.put(productRawData);
117 
118  return;
119 }
static const int KCHIP_EC_RANGE
Definition: ESDigiToRaw.h:42
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:47
int six() const
Definition: ESDetId.h:37
virtual void setKchipEC(int i)
std::string label_
Definition: ESDigiToRaw.h:55
std::map< int, DetDigis > Digis
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:49
ESDataFormatter * ESDataFormatter_
Definition: ESDigiToRaw.h:62
virtual void setKchipBC(int i)
int siy() const
Definition: ESDetId.h:39
virtual void setBX(int i)
int fedId_[2][2][40][40]
Definition: ESDigiToRaw.h:53
std::string instanceName_
Definition: ESDigiToRaw.h:56
virtual void setOrbitNumber(int i)
int run_number_
Definition: ESDigiToRaw.h:48
int zside() const
Definition: ESDetId.h:33
virtual void setLV1(int i)
static const int KCHIP_BC_RANGE
Definition: ESDigiToRaw.h:41
int plane() const
Definition: ESDetId.h:35
tuple cout
Definition: gather_cfg.py:121
static const int LHC_BX_RANGE
Definition: ESDigiToRaw.h:40

Member Data Documentation

int ESDigiToRaw::bx_
private

Definition at line 49 of file ESDigiToRaw.h.

Referenced by GetBX(), and produce().

const int ESDigiToRaw::BXMAX = 2808
static

Definition at line 39 of file ESDigiToRaw.h.

int ESDigiToRaw::counter_
private

Definition at line 46 of file ESDigiToRaw.h.

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

bool ESDigiToRaw::debug_
private

Definition at line 58 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw(), and produce().

ESDataFormatter* ESDigiToRaw::ESDataFormatter_
private

Definition at line 62 of file ESDigiToRaw.h.

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

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

Definition at line 53 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw(), and produce().

int ESDigiToRaw::formatMajor_
private

Definition at line 59 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw().

int ESDigiToRaw::formatMinor_
private

Definition at line 60 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw().

std::string ESDigiToRaw::instanceName_
private

Definition at line 56 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw(), and produce().

int ESDigiToRaw::kchip_bc_
private

Definition at line 52 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw(), and produce().

const int ESDigiToRaw::KCHIP_BC_RANGE = 4096
static

Definition at line 41 of file ESDigiToRaw.h.

Referenced by produce().

int ESDigiToRaw::kchip_ec_
private

Definition at line 51 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw(), and produce().

const int ESDigiToRaw::KCHIP_EC_RANGE = 256
static

Definition at line 42 of file ESDigiToRaw.h.

Referenced by produce().

std::string ESDigiToRaw::label_
private
const int ESDigiToRaw::LHC_BX_RANGE = 3564
static

Definition at line 40 of file ESDigiToRaw.h.

Referenced by produce().

edm::FileInPath ESDigiToRaw::lookup_
private

Definition at line 57 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw().

int ESDigiToRaw::lv1_
private

Definition at line 50 of file ESDigiToRaw.h.

Referenced by GetLV1(), and produce().

int ESDigiToRaw::orbit_number_
private

Definition at line 47 of file ESDigiToRaw.h.

Referenced by GetOrbit(), and produce().

int ESDigiToRaw::run_number_
private

Definition at line 48 of file ESDigiToRaw.h.

Referenced by GetRunNumber(), and produce().