CMS 3D CMS Logo

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

#include <SiPixelDigiToRaw.h>

Inheritance diagram for SiPixelDigiToRaw:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

virtual void endJob ()
 dummy end of job More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 get data, convert to raw event, attach again to Event More...
 
 SiPixelDigiToRaw (const edm::ParameterSet &)
 ctor More...
 
virtual ~SiPixelDigiToRaw ()
 dtor More...
 
- 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 ()
 

Private Attributes

int allDigiCounter
 
int allWordCounter
 
SiPixelFedCablingTreecablingTree_
 
edm::ParameterSet config_
 
bool debug
 
unsigned long eventCounter
 
std::vector< unsigned int > fedIds
 
SiPixelFrameReverterframeReverter_
 
TH1D * hCPU
 
TH1D * hDigi
 
edm::InputTag label
 
edm::ESWatcher
< SiPixelFedCablingMapRcd
recordWatcher
 
R2DTimerObservertheTimer
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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 21 of file SiPixelDigiToRaw.h.

Constructor & Destructor Documentation

SiPixelDigiToRaw::SiPixelDigiToRaw ( const edm::ParameterSet pset)
explicit

ctor

Definition at line 25 of file SiPixelDigiToRaw.cc.

References allDigiCounter, allWordCounter, config_, eventCounter, edm::ParameterSet::getUntrackedParameter(), hCPU, hDigi, and theTimer.

25  :
26  cablingTree_(0),
27  frameReverter_(0),
28  config_(pset),
29  hCPU(0), hDigi(0), theTimer(0)
30 {
31 
32  // Define EDProduct type
33  produces<FEDRawDataCollection>();
34 
35  // start the counters
36  eventCounter = 0;
37  allDigiCounter = 0;
38  allWordCounter = 0;
39 
40  // Timing
41  bool timing = config_.getUntrackedParameter<bool>("Timing",false);
42  if (timing) {
43  theTimer = new R2DTimerObserver("**** MY TIMING REPORT ***");
44  hCPU = new TH1D ("hCPU","hCPU",100,0.,0.050);
45  hDigi = new TH1D("hDigi","hDigi",50,0.,15000.);
46  }
47 }
T getUntrackedParameter(std::string const &, T const &) const
unsigned long eventCounter
R2DTimerObserver * theTimer
edm::ParameterSet config_
SiPixelFrameReverter * frameReverter_
SiPixelFedCablingTree * cablingTree_
SiPixelDigiToRaw::~SiPixelDigiToRaw ( )
virtual

dtor

Definition at line 50 of file SiPixelDigiToRaw.cc.

References cablingTree_, frameReverter_, hCPU, hDigi, and theTimer.

50  {
51  delete cablingTree_;
52  delete frameReverter_;
53 
54  if (theTimer) {
55  TFile rootFile("analysis.root", "RECREATE", "my histograms");
56  hCPU->Write();
57  hDigi->Write();
58  delete theTimer;
59  }
60 }
R2DTimerObserver * theTimer
SiPixelFrameReverter * frameReverter_
SiPixelFedCablingTree * cablingTree_

Member Function Documentation

virtual void SiPixelDigiToRaw::endJob ( void  )
inlinevirtual

dummy end of job

Reimplemented from edm::EDProducer.

Definition at line 32 of file SiPixelDigiToRaw.h.

32 {}
void SiPixelDigiToRaw::produce ( edm::Event ev,
const edm::EventSetup es 
)
virtual

get data, convert to raw event, attach again to Event

Implements edm::EDProducer.

Definition at line 65 of file SiPixelDigiToRaw.cc.

References allDigiCounter, allWordCounter, cablingTree_, edm::ESWatcher< T >::check(), config_, debug, edm::MessageDrop::debugEnabled, reco_application_2006_simpleTBanalysis_cfg::digiCollection, edm::EventID::event(), eventCounter, fedIds, SiPixelFedCablingTree::fedList(), PixelDataFormatter::formatRawData(), frameReverter_, edm::EventSetup::get(), edm::Event::getByLabel(), edm::ParameterSet::getParameter(), hCPU, hDigi, edm::EventBase::id(), edm::MessageDrop::instance(), label, R2DTimerObserver::lastMeasurement(), LogDebug, PixelDataFormatter::nDigis(), PixelDataFormatter::nWords(), PixelDataFormatter::passFrameReverter(), edm::ESHandle< class >::product(), edm::Event::put(), lumiPlot::rawdata, R2DTimerObserver::LastMeasurement::real(), recordWatcher, FEDRawData::size(), findQualityFiles::size, R2DTimerObserver::start(), R2DTimerObserver::stop(), theTimer, and SiPixelFedCablingTree::version().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

67 {
68  using namespace sipixelobjects;
69  eventCounter++;
70  edm::LogInfo("SiPixelDigiToRaw") << "[SiPixelDigiToRaw::produce] "
71  << "event number: " << eventCounter;
72 
74  label = config_.getParameter<edm::InputTag>("InputLabel");
76 
79  typedef vector< edm::DetSet<PixelDigi> >::const_iterator DI;
80 
81  int digiCounter = 0;
82  for (DI di=digiCollection->begin(); di != digiCollection->end(); di++) {
83  digiCounter += (di->data).size();
84  digis[ di->id] = di->data;
85  }
86  allDigiCounter += digiCounter;
87 
88  if (recordWatcher.check( es )) {
90  es.get<SiPixelFedCablingMapRcd>().get( cablingMap );
91  fedIds = cablingMap->fedIds();
92  if (cablingTree_) delete cablingTree_; cablingTree_= cablingMap->cablingTree();
93  if (frameReverter_) delete frameReverter_; frameReverter_ = new SiPixelFrameReverter( es, cablingMap.product() );
94  }
95 
97  if (debug) LogDebug("SiPixelDigiToRaw") << cablingTree_->version();
98 
100  formatter.passFrameReverter(frameReverter_);
101  if (theTimer) theTimer->start();
102 
103  // create product (raw data)
104  std::auto_ptr<FEDRawDataCollection> buffers( new FEDRawDataCollection );
105 
106  const vector<const PixelFEDCabling *> fedList = cablingTree_->fedList();
107 
108  // convert data to raw
109  formatter.formatRawData( ev.id().event(), rawdata, digis );
110 
111  // pack raw data into collection
112  typedef vector<const PixelFEDCabling *>::const_iterator FI;
113  for (FI it = fedList.begin(); it != fedList.end(); it++) {
114  LogDebug("SiPixelDigiToRaw")<<" PRODUCE DATA FOR FED_id: " << (**it).id();
115  FEDRawData& fedRawData = buffers->FEDData( (**it).id() );
116  PixelDataFormatter::RawData::iterator fedbuffer = rawdata.find( (**it).id() );
117  if( fedbuffer != rawdata.end() ) fedRawData = fedbuffer->second;
118  LogDebug("SiPixelDigiToRaw")<<"size of data in fedRawData: "<<fedRawData.size();
119  }
120  allWordCounter += formatter.nWords();
121  if (debug) LogDebug("SiPixelDigiToRaw")
122 
123  << "Words/Digis this ev: "<<digiCounter<<"(fm:"<<formatter.nDigis()<<")/"
124  <<formatter.nWords()
125  <<" all: "<< allDigiCounter <<"/"<<allWordCounter;
126 
127  if (theTimer) {
128  theTimer->stop();
129  LogDebug("SiPixelDigiToRaw") << "TIMING IS: (real)" << theTimer->lastMeasurement().real() ;
130  LogDebug("SiPixelDigiToRaw") << " (Words/Digis) this ev: "
131  <<formatter.nWords()<<"/"<<formatter.nDigis() << "--- all :"<<allWordCounter<<"/"<<allDigiCounter;
132  hCPU->Fill( theTimer->lastMeasurement().real() );
133  hDigi->Fill(formatter.nDigis());
134  }
135 
136  ev.put( buffers );
137 
138 }
#define LogDebug(id)
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:44
std::map< cms_uint32_t, DetDigis > Digis
static MessageDrop * instance()
Definition: MessageDrop.cc:65
unsigned long eventCounter
static bool debugEnabled
Definition: MessageDrop.h:105
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:49
std::vector< unsigned int > fedIds
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
R2DTimerObserver * theTimer
virtual std::string version() const
map version
const LastMeasurement & lastMeasurement()
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
std::map< int, FEDRawData > RawData
edm::ESWatcher< SiPixelFedCablingMapRcd > recordWatcher
edm::ParameterSet config_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:59
edm::EventID id() const
Definition: EventBase.h:56
SiPixelFrameReverter * frameReverter_
dictionary rawdata
Definition: lumiPlot.py:393
SiPixelFedCablingTree * cablingTree_
std::vector< const PixelFEDCabling * > fedList() const
tuple size
Write out results.
edm::InputTag label

Member Data Documentation

int SiPixelDigiToRaw::allDigiCounter
private

Definition at line 46 of file SiPixelDigiToRaw.h.

Referenced by produce(), and SiPixelDigiToRaw().

int SiPixelDigiToRaw::allWordCounter
private

Definition at line 47 of file SiPixelDigiToRaw.h.

Referenced by produce(), and SiPixelDigiToRaw().

SiPixelFedCablingTree* SiPixelDigiToRaw::cablingTree_
private

Definition at line 39 of file SiPixelDigiToRaw.h.

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

edm::ParameterSet SiPixelDigiToRaw::config_
private

Definition at line 41 of file SiPixelDigiToRaw.h.

Referenced by produce(), and SiPixelDigiToRaw().

bool SiPixelDigiToRaw::debug
private

Definition at line 50 of file SiPixelDigiToRaw.h.

Referenced by produce().

unsigned long SiPixelDigiToRaw::eventCounter
private

Definition at line 44 of file SiPixelDigiToRaw.h.

Referenced by produce(), and SiPixelDigiToRaw().

std::vector<unsigned int> SiPixelDigiToRaw::fedIds
private

Definition at line 48 of file SiPixelDigiToRaw.h.

Referenced by produce().

SiPixelFrameReverter* SiPixelDigiToRaw::frameReverter_
private

Definition at line 40 of file SiPixelDigiToRaw.h.

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

TH1D* SiPixelDigiToRaw::hCPU
private

Definition at line 42 of file SiPixelDigiToRaw.h.

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

TH1D * SiPixelDigiToRaw::hDigi
private

Definition at line 42 of file SiPixelDigiToRaw.h.

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

edm::InputTag SiPixelDigiToRaw::label
private
edm::ESWatcher<SiPixelFedCablingMapRcd> SiPixelDigiToRaw::recordWatcher
private

Definition at line 49 of file SiPixelDigiToRaw.h.

Referenced by produce().

R2DTimerObserver* SiPixelDigiToRaw::theTimer
private

Definition at line 43 of file SiPixelDigiToRaw.h.

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