CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripDigiToRawModule.cc
Go to the documentation of this file.
1 // Last commit: $Id: SiStripDigiToRawModule.cc,v 1.11 2009/11/10 15:10:00 nc302 Exp $
2 
16 #include <cstdlib>
17 
18 namespace sistrip {
19 
20  // -----------------------------------------------------------------------------
25  inputModuleLabel_( pset.getParameter<std::string>( "InputModuleLabel" ) ),
26  inputDigiLabel_( pset.getParameter<std::string>( "InputDigiLabel" ) ),
27  mode_( fedReadoutModeFromString(pset.getParameter<std::string>( "FedReadoutMode" ))),
28  rawdigi_( false ),
29  digiToRaw_(0),
30  eventCounter_(0)
31  {
32  if ( edm::isDebugEnabled() ) {
33  LogDebug("DigiToRawModule")
34  << "[sistrip::DigiToRawModule::DigiToRawModule]"
35  << " Constructing object...";
36  }
37 
38  switch(mode_) {
39  case READOUT_MODE_ZERO_SUPPRESSED_LITE: rawdigi_ = false; break;
40  case READOUT_MODE_ZERO_SUPPRESSED: rawdigi_ = false; break;
41  case READOUT_MODE_VIRGIN_RAW: rawdigi_ = true; break;
42  case READOUT_MODE_PROC_RAW: rawdigi_ = true; break;
43  case READOUT_MODE_SCOPE: rawdigi_ = true; break;
44  case READOUT_MODE_INVALID: {
45  if( edm::isDebugEnabled()) {
46  edm::LogWarning("DigiToRawModule")
47  << "[sistrip::DigiToRawModule::DigiToRawModule]"
48  << " UNKNOWN readout mode: " << pset.getParameter<std::string>("FedReadoutMode");
49  }} break;
50  case READOUT_MODE_SPY: {
51  if( edm::isDebugEnabled()) {
52  edm::LogWarning("DigiToRawModule")
53  << "[sistrip::DigiToRawModule::DigiToRawModule]"
54  << " Digi to raw is not supported for spy channel data";
55  }} break;
56  }
57  if(pset.getParameter<bool>("UseWrongDigiType")) {
58  rawdigi_ = !rawdigi_;
59  if( edm::isDebugEnabled()) {
60  edm::LogWarning("DigiToRawModule")
61  << "[sistrip::DigiToRawModule::DigiToRawModule]"
62  << " You are using the wrong type of digis!";
63  }
64  }
65 
66  // Create instance of DigiToRaw formatter
67  digiToRaw_ = new DigiToRaw( mode_, pset.getParameter<bool>("UseFedKey") );
68 
69  produces<FEDRawDataCollection>();
70 
71  }
72 
73  // -----------------------------------------------------------------------------
76  if ( edm::isDebugEnabled() ) {
77  LogDebug("DigiToRaw")
78  << "[sistrip::DigiToRawModule::~DigiToRawModule]"
79  << " Destructing object...";
80  }
81  if ( digiToRaw_ ) delete digiToRaw_;
82  }
83 
84  // -----------------------------------------------------------------------------
92  const edm::EventSetup& iSetup ) {
93 
94  eventCounter_++;
95 
96  std::auto_ptr<FEDRawDataCollection> buffers( new FEDRawDataCollection );
97 
99  iSetup.get<SiStripFedCablingRcd>().get( cabling );
100 
101  if( rawdigi_ ) {
103  iEvent.getByLabel( inputModuleLabel_, inputDigiLabel_, rawdigis );
104  digiToRaw_->createFedBuffers( iEvent, cabling, rawdigis, buffers );
105  } else {
107  iEvent.getByLabel( inputModuleLabel_, inputDigiLabel_, digis );
108  digiToRaw_->createFedBuffers( iEvent, cabling, digis, buffers );
109  }
110 
111  iEvent.put( buffers );
112 
113  }
114 
115 }
116 
#define LogDebug(id)
T getParameter(std::string const &) const
bool isDebugEnabled()
virtual void produce(edm::Event &, const edm::EventSetup &)
FEDReadoutMode fedReadoutModeFromString(const std::string &readoutModeString)
DigiToRawModule(const edm::ParameterSet &)
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
void createFedBuffers(edm::Event &, edm::ESHandle< SiStripFedCabling > &cabling, edm::Handle< edm::DetSetVector< SiStripDigi > > &digis, std::auto_ptr< FEDRawDataCollection > &buffers)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
const T & get() const
Definition: EventSetup.h:55