CMS 3D CMS Logo

ESDigiToRaw Class Reference

#include <EventFilter/ESDigiToRaw/interface/ESDigiToRaw.h>

Inheritance diagram for ESDigiToRaw:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Types

typedef unsigned int Word32
typedef long long Word64

Public Member Functions

void beginJob (const EventSetup &es)
void endJob ()
 ESDigiToRaw (const ParameterSet &ps)
intGetBX ()
intGetCounter ()
intGetLV1 ()
intGetOrbit ()
intGetRunNumber ()
void produce (Event &e, const EventSetup &es)
virtual ~ESDigiToRaw ()

Static Public Attributes

static const int BXMAX = 2808

Private Attributes

int bx_
int counter_
bool debug_
ESDataFormatterESDataFormatter_
string instanceName_
string label_
int lv1_
int orbit_number_
int run_number_


Detailed Description

Definition at line 20 of file ESDigiToRaw.h.


Member Typedef Documentation

typedef unsigned int ESDigiToRaw::Word32

Definition at line 32 of file ESDigiToRaw.h.

typedef long long ESDigiToRaw::Word64

Definition at line 31 of file ESDigiToRaw.h.


Constructor & Destructor Documentation

ESDigiToRaw::ESDigiToRaw ( const ParameterSet ps  ) 

Definition at line 10 of file ESDigiToRaw.cc.

References counter_, debug_, ESDataFormatter_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), instanceName_, and label_.

00011 {
00012 
00013   label_ = ps.getParameter<string>("Label");
00014   instanceName_ = ps.getParameter<string>("InstanceES");
00015   debug_ = ps.getUntrackedParameter<bool>("debugMode", false);
00016 
00017   counter_ = 0;
00018 
00019   produces<FEDRawDataCollection>();
00020 
00021   ESDataFormatter_ = new ESDataFormatter(ps);
00022 
00023 }

ESDigiToRaw::~ESDigiToRaw (  )  [virtual]

Definition at line 25 of file ESDigiToRaw.cc.

References ESDataFormatter_.

00025                           {
00026   delete ESDataFormatter_;
00027 }


Member Function Documentation

void ESDigiToRaw::beginJob ( const EventSetup es  )  [virtual]

Reimplemented from edm::EDProducer.

Definition at line 29 of file ESDigiToRaw.cc.

00029                                                   {
00030 }

void ESDigiToRaw::endJob ( void   )  [virtual]

Reimplemented from edm::EDProducer.

Definition at line 126 of file ESDigiToRaw.cc.

00126                          {
00127 }

int* ESDigiToRaw::GetBX (  )  [inline]

Definition at line 36 of file ESDigiToRaw.h.

References bx_.

00036 {return &bx_ ;}

int* ESDigiToRaw::GetCounter (  )  [inline]

Definition at line 34 of file ESDigiToRaw.h.

References counter_.

00034 {return &counter_ ;}

int* ESDigiToRaw::GetLV1 (  )  [inline]

Definition at line 37 of file ESDigiToRaw.h.

References lv1_.

00037 {return &lv1_ ;}

int* ESDigiToRaw::GetOrbit (  )  [inline]

Definition at line 35 of file ESDigiToRaw.h.

References orbit_number_.

00035 {return &orbit_number_ ;}

int* ESDigiToRaw::GetRunNumber (  )  [inline]

Definition at line 38 of file ESDigiToRaw.h.

References run_number_.

00038 {return &run_number_ ;}

void ESDigiToRaw::produce ( edm::Event ev,
const EventSetup es 
) [virtual]

Implements edm::EDProducer.

Definition at line 32 of file ESDigiToRaw.cc.

References bx_, BXMAX, counter_, GenMuonPlsPt100GeV_cfg::cout, debug_, detId, ESDataFormatter::DigiToRaw(), lat::endl(), ESDataFormatter_, edm::EventID::event(), edm::Event::getByLabel(), FEDNumbering::getPreShowerFEDIds(), edm::Event::id(), instanceName_, it, label_, lv1_, orbit_number_, ESDetId::plane(), edm::Event::put(), edm::EventID::run(), run_number_, ESDataFormatter::setBX(), ESDataFormatter::setLV1(), ESDataFormatter::setOrbitNumber(), ESDataFormatter::setRunNumber(), ESDetId::six(), ESDetId::siy(), FEDRawData::size(), and ESDetId::zside().

00032                                                                {
00033 
00034   run_number_ = ev.id().run();
00035   orbit_number_ = counter_ / BXMAX;
00036   bx_ = (counter_ % BXMAX);
00037   //lv1_ = counter_;
00038   lv1_ = ev.id().event();
00039   counter_++;
00040 
00041   ESDataFormatter_->setRunNumber(run_number_);
00042   ESDataFormatter_->setOrbitNumber(orbit_number_);
00043   ESDataFormatter_->setBX(bx_);
00044   ESDataFormatter_->setLV1(lv1_);
00045 
00046   pair<int,int> ESFEDIds = FEDNumbering::getPreShowerFEDIds();
00047 
00048   edm::Handle<ESDigiCollection> digis;
00049   ev.getByLabel(label_, instanceName_, digis);
00050 
00051   ESDataFormatter::Digis Digis;
00052   Digis.clear();
00053 
00054   for (ESDigiCollection::const_iterator it=digis->begin(); it!=digis->end(); ++it) {
00055 
00056     const ESDataFrame& df = *it;
00057     const ESDetId& detId = it->id();
00058 
00059     // Fake DCC-fed map, for the time being
00060     int dccId = 0;
00061     if (detId.zside() == 1) {
00062       if (detId.plane() == 1) {
00063         if (detId.six()<=20 && detId.siy()<=20) {
00064           dccId = 0;
00065         } else if (detId.six()>=20 && detId.siy()<=20) {
00066           dccId = 1;
00067         } else if (detId.six()<=20 && detId.siy()>=20) {
00068           dccId = 2;
00069         } else if (detId.six()>=20 && detId.siy()>=20) {
00070           dccId = 3;
00071         }
00072       } else if (detId.plane() == 2) {
00073         if (detId.six()<=20 && detId.siy()<=20) {
00074           dccId = 4;
00075         } else if (detId.six()>=20 && detId.siy()<=20) {
00076           dccId = 5;
00077         } else if (detId.six()<=20 && detId.siy()>=20) {
00078           dccId = 6;
00079         } else if (detId.six()>=20 && detId.siy()>=20) {
00080           dccId = 7;
00081         }
00082       }
00083     } else if (detId.zside() == -1) {
00084       if (detId.plane() == 1) {
00085         if (detId.six()<=20 && detId.siy()<=20) {
00086           dccId = 8;
00087         } else if (detId.six()>=20 && detId.siy()<=20) {
00088           dccId = 9;
00089         } else if (detId.six()<=20 && detId.siy()>=20) {
00090           dccId = 10;
00091         } else if (detId.six()>=20 && detId.siy()>=20) {
00092           dccId = 11;
00093         }
00094       } else if (detId.plane() == 2) {
00095         if (detId.six()<=20 && detId.siy()<=20) {
00096           dccId = 12;
00097         } else if (detId.six()>=20 && detId.siy()<=20) {
00098           dccId = 13;
00099         } else if (detId.six()<=20 && detId.siy()>=20) {
00100           dccId = 14;
00101         } else if (detId.six()>=20 && detId.siy()>=20) {
00102           dccId = 15;
00103         }
00104       }
00105     }
00106 
00107     int fedId = ESFEDIds.first + dccId;
00108 
00109     Digis[fedId].push_back(df);
00110   }
00111 
00112   auto_ptr<FEDRawDataCollection> productRawData( new FEDRawDataCollection );
00113 
00114   for (int fId=ESFEDIds.first; fId<=ESFEDIds.second; ++fId) {
00115     FEDRawData *rawData = ESDataFormatter_->DigiToRaw(fId, Digis);
00116     FEDRawData& fedRawData = productRawData->FEDData(fId); 
00117     fedRawData = *rawData;
00118     if (debug_) cout<<"FED : "<<fId<<" Data size : "<<fedRawData.size()<<" (Bytes)"<<endl;
00119   } 
00120 
00121   ev.put(productRawData);
00122 
00123   return;
00124 }


Member Data Documentation

int ESDigiToRaw::bx_ [private]

Definition at line 47 of file ESDigiToRaw.h.

Referenced by GetBX(), and produce().

const int ESDigiToRaw::BXMAX = 2808 [static]

Definition at line 40 of file ESDigiToRaw.h.

Referenced by produce().

int ESDigiToRaw::counter_ [private]

Definition at line 44 of file ESDigiToRaw.h.

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

bool ESDigiToRaw::debug_ [private]

Definition at line 52 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw(), and produce().

ESDataFormatter* ESDigiToRaw::ESDataFormatter_ [private]

Definition at line 54 of file ESDigiToRaw.h.

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

string ESDigiToRaw::instanceName_ [private]

Definition at line 51 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw(), and produce().

string ESDigiToRaw::label_ [private]

Definition at line 50 of file ESDigiToRaw.h.

Referenced by ESDigiToRaw(), and produce().

int ESDigiToRaw::lv1_ [private]

Definition at line 48 of file ESDigiToRaw.h.

Referenced by GetLV1(), and produce().

int ESDigiToRaw::orbit_number_ [private]

Definition at line 45 of file ESDigiToRaw.h.

Referenced by GetOrbit(), and produce().

int ESDigiToRaw::run_number_ [private]

Definition at line 46 of file ESDigiToRaw.h.

Referenced by GetRunNumber(), and produce().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:20:25 2009 for CMSSW by  doxygen 1.5.4