CMS 3D CMS Logo

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

#include <EcalRawToDigi.h>

Inheritance diagram for EcalRawToDigi:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginRun (const edm::Run &run, const edm::EventSetup &es) override
 
 EcalRawToDigi (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c) override
 
virtual ~EcalRawToDigi ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Public Attributes

edm::ESWatcher< EcalMappingRcdwatcher_
 

Private Attributes

edm::EDGetTokenT
< FEDRawDataCollection
dataToken_
 
edm::EDGetTokenT< EcalListOfFEDSfedsToken_
 
std::vector< int > fedUnpackList_
 
bool feIdCheck_
 
bool feUnpacking_
 
bool first_
 
bool forceToKeepFRdata_
 
bool headerUnpacking_
 
bool memUnpacking_
 
EcalElectronicsMappermyMap_
 
unsigned int nevts_
 
unsigned int numbTriggerTSamples_
 
unsigned int numbXtalTSamples_
 
std::vector< int > orderedDCCIdList_
 
std::vector< int > orderedFedUnpackList_
 
bool put_
 
bool REGIONAL_
 
double RUNNING_TIME_
 
double SETUP_TIME_
 
bool srpUnpacking_
 
bool syncCheck_
 
bool tccUnpacking_
 
DCCDataUnpackertheUnpacker_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 41 of file EcalRawToDigi.h.

Constructor & Destructor Documentation

EcalRawToDigi::EcalRawToDigi ( const edm::ParameterSet ps)
explicit

Class constructor

Definition at line 18 of file EcalRawToDigi.cc.

References dataToken_, fedsToken_, fedUnpackList_, feIdCheck_, feUnpacking_, first_, forceToKeepFRdata_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), headerUnpacking_, i, LogDebug, EcalElectronicsMapper::makeMapFromVectors(), FEDNumbering::MAXECALFEDID, memUnpacking_, FEDNumbering::MINECALFEDID, myMap_, numbTriggerTSamples_, numbXtalTSamples_, orderedDCCIdList_, orderedFedUnpackList_, convertSQLitetoXML_cfg::output, REGIONAL_, DCCDataUnpacker::silentMode_, srpUnpacking_, syncCheck_, tccUnpacking_, and theUnpacker_.

18  :
19 
20  //define the list of FED to be unpacked
21  fedUnpackList_(conf.getParameter<std::vector<int> >("FEDs")),
22 
23  //define the ordered FED list
24  orderedFedUnpackList_(conf.getParameter<std::vector<int> >("orderedFedList")),
25 
26  //define the ordered DCCId list
27  orderedDCCIdList_(conf.getParameter<std::vector<int> >("orderedDCCIdList")),
28 
29  //get number of Xtal Time Samples
30  numbXtalTSamples_(conf.getParameter<int>("numbXtalTSamples")),
31 
32  //Get number of Trigger Time Samples
33  numbTriggerTSamples_(conf.getParameter<int>("numbTriggerTSamples")),
34 
35  //See if header unpacking is enabled
36  headerUnpacking_(conf.getParameter<bool>("headerUnpacking")),
37 
38  //See if srp unpacking is enabled
39  srpUnpacking_(conf.getParameter<bool>("srpUnpacking")),
40 
41  //See if tcc unpacking is enabled
42  tccUnpacking_(conf.getParameter<bool>("tccUnpacking")),
43 
44  //See if fe unpacking is enabled
45  feUnpacking_(conf.getParameter<bool>("feUnpacking")),
46 
47  //See if fe unpacking is enabled for mem box
48  memUnpacking_(conf.getParameter<bool>("memUnpacking")),
49 
50  //See if syncCheck is enabled
51  syncCheck_(conf.getParameter<bool>("syncCheck")),
52 
53  //See if feIdCheck is enabled
54  feIdCheck_(conf.getParameter<bool>("feIdCheck")),
55 
56  // See if we want to keep data even if we have a mismatch between SR decision and block length
57  forceToKeepFRdata_(conf.getParameter<bool>("forceToKeepFRData")),
58 
59 
60  put_(conf.getParameter<bool>("eventPut")),
61 
62 
63 
64  REGIONAL_(conf.getParameter<bool>("DoRegional")),
65 
66 
67 
68  myMap_(0),
69 
70  theUnpacker_(0)
71 
72 {
73 
74  first_ = true;
75  DCCDataUnpacker::silentMode_ = conf.getUntrackedParameter<bool>("silentMode",false) ;
76 
77  if( numbXtalTSamples_ <6 || numbXtalTSamples_>64 || (numbXtalTSamples_-2)%4 ){
78  std::ostringstream output;
79  output <<"\n Unsuported number of xtal time samples : "<<numbXtalTSamples_
80  <<"\n Valid Number of xtal time samples are : 6,10,14,18,...,62";
81  edm::LogError("IncorrectConfiguration")<< output.str();
82  // todo : throw an execption
83  }
84 
86  std::ostringstream output;
87  output <<"\n Unsuported number of trigger time samples : "<<numbTriggerTSamples_
88  <<"\n Valid number of trigger time samples are : 1, 4 or 8";
89  edm::LogError("IncorrectConfiguration")<< output.str();
90  // todo : throw an execption
91  }
92 
93  //NA : testing
94  //nevts_=0;
95  //RUNNING_TIME_=0;
96 
97  // if there are FEDs specified to unpack fill the vector of the fedUnpackList_
98  // else fill with the entire ECAL fed range (600-670)
99  if (fedUnpackList_.empty())
101  fedUnpackList_.push_back(i);
102 
103  //print the FEDs to unpack to the logger
104  std::ostringstream loggerOutput_;
105  if(fedUnpackList_.size()!=0){
106  for (unsigned int i=0; i<fedUnpackList_.size(); i++)
107  loggerOutput_ << fedUnpackList_[i] << " ";
108  edm::LogInfo("EcalRawToDigi") << "EcalRawToDigi will unpack FEDs ( " << loggerOutput_.str() << ")";
109  LogDebug("EcalRawToDigi") << "EcalRawToDigi will unpack FEDs ( " << loggerOutput_.str() << ")";
110  }
111 
112  edm::LogInfo("EcalRawToDigi")
113  <<"\n ECAL RawToDigi configuration:"
114  <<"\n Header unpacking is "<<headerUnpacking_
115  <<"\n SRP Bl. unpacking is "<<srpUnpacking_
116  <<"\n TCC Bl. unpacking is "<<tccUnpacking_
117  <<"\n FE Bl. unpacking is "<<feUnpacking_
118  <<"\n MEM Bl. unpacking is "<<memUnpacking_
119  <<"\n sync check is "<<syncCheck_
120  <<"\n feID check is "<<feIdCheck_
121  <<"\n force keep FR data is "<<forceToKeepFRdata_
122  <<"\n";
123 
124  edm::InputTag dataLabel = conf.getParameter<edm::InputTag>("InputLabel");
125  edm::InputTag fedsLabel = conf.getParameter<edm::InputTag>("FedLabel");
126 
127  // Producer products :
128  produces<EBDigiCollection>("ebDigis");
129  produces<EEDigiCollection>("eeDigis");
130  produces<EBSrFlagCollection>();
131  produces<EESrFlagCollection>();
132  produces<EcalRawDataCollection>();
133  produces<EcalPnDiodeDigiCollection>();
134  produces<EcalTrigPrimDigiCollection>("EcalTriggerPrimitives");
135  produces<EcalPSInputDigiCollection>("EcalPseudoStripInputs");
136 
137  // Integrity for xtal data
138  produces<EBDetIdCollection>("EcalIntegrityGainErrors");
139  produces<EBDetIdCollection>("EcalIntegrityGainSwitchErrors");
140  produces<EBDetIdCollection>("EcalIntegrityChIdErrors");
141 
142  // Integrity for xtal data - EE specific (to be rivisited towards EB+EE common collection)
143  produces<EEDetIdCollection>("EcalIntegrityGainErrors");
144  produces<EEDetIdCollection>("EcalIntegrityGainSwitchErrors");
145  produces<EEDetIdCollection>("EcalIntegrityChIdErrors");
146 
147  // Integrity Errors
148  produces<EcalElectronicsIdCollection>("EcalIntegrityTTIdErrors");
149  produces<EcalElectronicsIdCollection>("EcalIntegrityZSXtalIdErrors");
150  produces<EcalElectronicsIdCollection>("EcalIntegrityBlockSizeErrors");
151 
152  // Mem channels' integrity
153  produces<EcalElectronicsIdCollection>("EcalIntegrityMemTtIdErrors");
154  produces<EcalElectronicsIdCollection>("EcalIntegrityMemBlockSizeErrors");
155  produces<EcalElectronicsIdCollection>("EcalIntegrityMemChIdErrors");
156  produces<EcalElectronicsIdCollection>("EcalIntegrityMemGainErrors");
157 
158  dataToken_=consumes<FEDRawDataCollection>(dataLabel);
159  if (REGIONAL_){
160  fedsToken_=consumes<EcalListOfFEDS>(fedsLabel);
161  }
162 
163  // Build a new Electronics mapper and parse default map file
164  myMap_ = new EcalElectronicsMapper(numbXtalTSamples_,numbTriggerTSamples_);
165 
166  // in case of external tsext file (deprecated by HLT environment)
167  // bool readResult = myMap_->readDCCMapFile(conf.getParameter<std::string>("DCCMapFile",""));
168 
169  // use two arrays from cfg to establish DCCId:FedId. If they are empy, than use hard coded correspondence
171  // myMap::makeMapFromVectors() returns "true" always
172  // need to be fixed?
173 
174  if(!readResult){
175  edm::LogWarning("IncorrectConfiguration")
176  << "Arrays orderedFedList and orderedDCCIdList are emply. "
177  "Hard coded correspondence for DCCId:FedId will be used.";
178  // edm::LogError("EcalRawToDigi")<<"\n unable to read file : "
179  // <<conf.getParameter<std::string>("DCCMapFile");
180  }
181 
182  // Build a new ECAL DCC data unpacker
184 
185 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
unsigned int numbXtalTSamples_
Definition: EcalRawToDigi.h:75
bool forceToKeepFRdata_
Definition: EcalRawToDigi.h:85
edm::EDGetTokenT< FEDRawDataCollection > dataToken_
Definition: EcalRawToDigi.h:90
std::vector< int > orderedFedUnpackList_
Definition: EcalRawToDigi.h:72
std::vector< int > fedUnpackList_
Definition: EcalRawToDigi.h:70
DCCDataUnpacker * theUnpacker_
static std::atomic< bool > silentMode_
unsigned int numbTriggerTSamples_
Definition: EcalRawToDigi.h:76
bool makeMapFromVectors(std::vector< int > &, std::vector< int > &)
std::vector< int > orderedDCCIdList_
Definition: EcalRawToDigi.h:73
edm::EDGetTokenT< EcalListOfFEDS > fedsToken_
Definition: EcalRawToDigi.h:91
bool headerUnpacking_
Definition: EcalRawToDigi.h:78
EcalElectronicsMapper * myMap_
Definition: EcalRawToDigi.h:98
EcalRawToDigi::~EcalRawToDigi ( )
virtual

Class destructor

Definition at line 528 of file EcalRawToDigi.cc.

References myMap_, and theUnpacker_.

529 {
530 
531  //cout << "EcalDCCUnpackingModule " << "N events " << (nevts_-1)<<endl;
532  //cout << "EcalDCCUnpackingModule " << " --- SETUP time " << endl;
533  //cout << "EcalDCCUnpackingModule " << "Time (sys) " << SETUP_TIME_ << endl;
534  //cout << "EcalDCCUnpackingModule " << "Time in sec. " << SETUP_TIME_/ CLOCKS_PER_SEC << endl;
535  //cout << "EcalDCCUnpackingModule " << " --- Per event " << endl;
536 
537  //RUNNING_TIME_ = RUNNING_TIME_ / (nevts_-1);
538 
539  //cout << "EcalDCCUnpackingModule "<< "Time (sys) " << RUNNING_TIME_ << endl;
540  //cout << "EcalDCCUnpackingModule "<< "Time in sec. " << RUNNING_TIME_ / CLOCKS_PER_SEC << endl;
541 
542 
543 
544  if(myMap_ ) delete myMap_;
545  if(theUnpacker_) delete theUnpacker_;
546 
547 }
DCCDataUnpacker * theUnpacker_
EcalElectronicsMapper * myMap_
Definition: EcalRawToDigi.h:98

Member Function Documentation

void EcalRawToDigi::beginRun ( const edm::Run run,
const edm::EventSetup es 
)
overridevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 285 of file EcalRawToDigi.cc.

References edm::EventSetup::get(), edm::ESHandle< class >::product(), DCCDataUnpacker::setChannelStatusDB(), and theUnpacker_.

286 {
287  // channel status database
289  es.get<EcalChannelStatusRcd>().get(pChStatus);
291 
292  // uncomment following line to print list of crystals with bad status
293  //edm::ESHandle<EcalElectronicsMapping> pEcalMapping;
294  //es.get<EcalMappingRcd>().get(pEcalMapping);
295  //const EcalElectronicsMapping* mapping = pEcalMapping.product();
296  //printStatusRecords(theUnpacker_, mapping);
297 }
void setChannelStatusDB(const EcalChannelStatusMap *chdb)
DCCDataUnpacker * theUnpacker_
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
void EcalRawToDigi::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 243 of file EcalRawToDigi.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), i, and HLT_25ns10e33_v2_cff::InputTag.

243  {
245  desc.add<bool>("tccUnpacking",true);
246  desc.add<edm::InputTag>("FedLabel",edm::InputTag("listfeds"));
247  desc.add<bool>("srpUnpacking",true);
248  desc.add<bool>("syncCheck",true);
249  desc.add<bool>("feIdCheck",true);
250  desc.addUntracked<bool>("silentMode",true);
251  desc.add<edm::InputTag>("InputLabel",edm::InputTag("rawDataCollector"));
252  {
253  std::vector<int> temp1;
254  unsigned int nvec = 54;
255  temp1.reserve(nvec);
256  for (unsigned int i=0; i<nvec; i++) temp1.push_back(601+i);
257  desc.add<std::vector<int> >("orderedFedList",temp1);
258  }
259  desc.add<bool>("eventPut",true);
260  desc.add<int>("numbTriggerTSamples",1);
261  desc.add<int>("numbXtalTSamples",10);
262  {
263  std::vector<int> temp1;
264  unsigned int nvec = 54;
265  temp1.reserve(nvec);
266  for (unsigned int i=0; i<nvec; i++) temp1.push_back(1+i);
267  desc.add<std::vector<int> >("orderedDCCIdList",temp1);
268  }
269  {
270  std::vector<int> temp1;
271  unsigned int nvec = 54;
272  temp1.reserve(nvec);
273  for (unsigned int i=0; i<nvec; i++) temp1.push_back(601+i);
274  desc.add<std::vector<int> >("FEDs",temp1);
275  }
276  desc.add<bool>("DoRegional",false);
277  desc.add<bool>("feUnpacking",true);
278  desc.add<bool>("forceToKeepFRData",false);
279  desc.add<bool>("headerUnpacking",true);
280  desc.add<bool>("memUnpacking",true);
281  descriptions.add("ecalRawToDigi",desc);
282 }
int i
Definition: DBlmapReader.cc:9
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void EcalRawToDigi::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Functions that are called by framework at each event

Implements edm::stream::EDProducerBase.

Definition at line 300 of file EcalRawToDigi.cc.

References edm::ESWatcher< T >::check(), FEDRawData::data(), AlCaHLTBitMon_QueryRunRegistry::data, dataToken_, EMPTYEVENTSIZE, fedsToken_, fedUnpackList_, feUnpacking_, spr::find(), first_, edm::EventSetup::get(), EcalElectronicsMapper::getActiveSM(), edm::Event::getByToken(), headerUnpacking_, i, LogDebug, memUnpacking_, myMap_, edm::ESHandle< class >::product(), edm::Event::put(), put_, lumiPlot::rawdata, REGIONAL_, EcalElectronicsMapper::setActiveDCC(), DCCDataUnpacker::setDccHeadersCollection(), DCCDataUnpacker::setEBDigisCollection(), DCCDataUnpacker::setEBSrFlagsCollection(), DCCDataUnpacker::setEcalPSsCollection(), DCCDataUnpacker::setEcalTpsCollection(), DCCDataUnpacker::setEEDigisCollection(), DCCDataUnpacker::setEESrFlagsCollection(), DCCDataUnpacker::setInvalidBlockLengthsCollection(), DCCDataUnpacker::setInvalidChIdsCollection(), DCCDataUnpacker::setInvalidEEChIdsCollection(), DCCDataUnpacker::setInvalidEEGainsCollection(), DCCDataUnpacker::setInvalidEEGainsSwitchCollection(), DCCDataUnpacker::setInvalidGainsCollection(), DCCDataUnpacker::setInvalidGainsSwitchCollection(), DCCDataUnpacker::setInvalidMemBlockSizesCollection(), DCCDataUnpacker::setInvalidMemChIdsCollection(), DCCDataUnpacker::setInvalidMemGainsCollection(), DCCDataUnpacker::setInvalidMemTtIdsCollection(), DCCDataUnpacker::setInvalidTTIdsCollection(), DCCDataUnpacker::setInvalidZSXtalIdsCollection(), DCCDataUnpacker::setPnDiodeDigisCollection(), FEDRawData::size(), srpUnpacking_, tccUnpacking_, theUnpacker_, DCCDataUnpacker::unpack(), and watcher_.

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

301 {
302 
303  //double TIME_START = clock();
304  //nevts_++; //NUNO
305 
306 
307  if (first_) {
308  watcher_.check(es);
310  es.get< EcalMappingRcd >().get(ecalmapping);
311  myMap_ -> setEcalElectronicsMapping(ecalmapping.product());
312 
313  first_ = false;
314 
315  }else{
316 
317  if ( watcher_.check(es) ) {
319  es.get< EcalMappingRcd >().get(ecalmapping);
320  myMap_ -> deletePointers();
321  myMap_ -> resetPointers();
322  myMap_ -> setEcalElectronicsMapping(ecalmapping.product());
323  }
324 
325  }
326 
327  // Get list of FEDS :
328  std::vector<int> FEDS_to_unpack;
329  if (REGIONAL_) {
330  edm::Handle<EcalListOfFEDS> listoffeds;
331  e.getByToken(fedsToken_, listoffeds);
332  FEDS_to_unpack = listoffeds -> GetList();
333  }
334 
335 
336 
337  // Step A: Get Inputs
338 
340  e.getByToken(dataToken_,rawdata);
341 
342 
343  // Step B: encapsulate vectors in actual collections and set unpacker pointers
344 
345  // create the collection of Ecal Digis
346  std::auto_ptr<EBDigiCollection> productDigisEB(new EBDigiCollection);
347  productDigisEB->reserve(1700);
348  theUnpacker_->setEBDigisCollection(&productDigisEB);
349 
350  // create the collection of Ecal Digis
351  std::auto_ptr<EEDigiCollection> productDigisEE(new EEDigiCollection);
352  theUnpacker_->setEEDigisCollection(&productDigisEE);
353 
354  // create the collection for headers
355  std::auto_ptr<EcalRawDataCollection> productDccHeaders(new EcalRawDataCollection);
356  theUnpacker_->setDccHeadersCollection(&productDccHeaders);
357 
358  // create the collection for invalid gains
359  std::auto_ptr< EBDetIdCollection> productInvalidGains(new EBDetIdCollection);
360  theUnpacker_->setInvalidGainsCollection(&productInvalidGains);
361 
362  // create the collection for invalid gain Switch
363  std::auto_ptr< EBDetIdCollection> productInvalidGainsSwitch(new EBDetIdCollection);
364  theUnpacker_->setInvalidGainsSwitchCollection(&productInvalidGainsSwitch);
365 
366  // create the collection for invalid chids
367  std::auto_ptr< EBDetIdCollection> productInvalidChIds(new EBDetIdCollection);
368  theUnpacker_->setInvalidChIdsCollection(&productInvalidChIds);
369 
371 
372  // create the collection for invalid gains
373  std::auto_ptr<EEDetIdCollection> productInvalidEEGains(new EEDetIdCollection);
374  theUnpacker_->setInvalidEEGainsCollection(&productInvalidEEGains);
375 
376  // create the collection for invalid gain Switch
377  std::auto_ptr<EEDetIdCollection> productInvalidEEGainsSwitch(new EEDetIdCollection);
378  theUnpacker_->setInvalidEEGainsSwitchCollection(&productInvalidEEGainsSwitch);
379 
380  // create the collection for invalid chids
381  std::auto_ptr<EEDetIdCollection> productInvalidEEChIds(new EEDetIdCollection);
382  theUnpacker_->setInvalidEEChIdsCollection(&productInvalidEEChIds);
383 
385 
386  // create the collection for EB srflags
387  std::auto_ptr<EBSrFlagCollection> productEBSrFlags(new EBSrFlagCollection);
388  theUnpacker_->setEBSrFlagsCollection(&productEBSrFlags);
389 
390  // create the collection for EB srflags
391  std::auto_ptr<EESrFlagCollection> productEESrFlags(new EESrFlagCollection);
392  theUnpacker_->setEESrFlagsCollection(&productEESrFlags);
393 
394  // create the collection for ecal trigger primitives
395  std::auto_ptr<EcalTrigPrimDigiCollection> productEcalTps(new EcalTrigPrimDigiCollection);
396  theUnpacker_->setEcalTpsCollection(&productEcalTps);
398 
399  // create the collection for ecal trigger primitives
400  std::auto_ptr<EcalPSInputDigiCollection> productEcalPSs(new EcalPSInputDigiCollection);
401  theUnpacker_->setEcalPSsCollection(&productEcalPSs);
403 
404  // create the collection for invalid TTIds
405  std::auto_ptr<EcalElectronicsIdCollection> productInvalidTTIds(new EcalElectronicsIdCollection);
406  theUnpacker_->setInvalidTTIdsCollection(&productInvalidTTIds);
407 
408  // create the collection for invalid TTIds
409  std::auto_ptr<EcalElectronicsIdCollection> productInvalidZSXtalIds(new EcalElectronicsIdCollection);
410  theUnpacker_->setInvalidZSXtalIdsCollection(&productInvalidZSXtalIds);
411 
412 
413 
414  // create the collection for invalid BlockLengths
415  std::auto_ptr<EcalElectronicsIdCollection> productInvalidBlockLengths(new EcalElectronicsIdCollection);
416  theUnpacker_->setInvalidBlockLengthsCollection(&productInvalidBlockLengths);
417 
418  // MEMs Collections
419  // create the collection for the Pn Diode Digis
420  std::auto_ptr<EcalPnDiodeDigiCollection> productPnDiodeDigis(new EcalPnDiodeDigiCollection);
421  theUnpacker_->setPnDiodeDigisCollection(&productPnDiodeDigis);
422 
423  // create the collection for invalid Mem Tt id
424  std::auto_ptr<EcalElectronicsIdCollection> productInvalidMemTtIds(new EcalElectronicsIdCollection);
425  theUnpacker_->setInvalidMemTtIdsCollection(& productInvalidMemTtIds);
426 
427  // create the collection for invalid Mem Block Size
428  std::auto_ptr<EcalElectronicsIdCollection> productInvalidMemBlockSizes(new EcalElectronicsIdCollection);
429  theUnpacker_->setInvalidMemBlockSizesCollection(& productInvalidMemBlockSizes);
430 
431  // create the collection for invalid Mem Block Size
432  std::auto_ptr<EcalElectronicsIdCollection> productInvalidMemChIds(new EcalElectronicsIdCollection);
433  theUnpacker_->setInvalidMemChIdsCollection(& productInvalidMemChIds);
434 
435  // create the collection for invalid Mem Gain Errors
436  std::auto_ptr<EcalElectronicsIdCollection> productInvalidMemGains(new EcalElectronicsIdCollection);
437  theUnpacker_->setInvalidMemGainsCollection(& productInvalidMemGains);
438  // double TIME_START = clock();
439 
440 
441  // Step C: unpack all requested FEDs
442  for (std::vector<int>::const_iterator i=fedUnpackList_.begin(); i!=fedUnpackList_.end(); i++) {
443 
444  if (REGIONAL_) {
445  std::vector<int>::const_iterator fed_it = find(FEDS_to_unpack.begin(), FEDS_to_unpack.end(), *i);
446  if (fed_it == FEDS_to_unpack.end()) continue;
447  }
448 
449 
450  // get fed raw data and SM id
451  const FEDRawData& fedData = rawdata->FEDData(*i);
452  const size_t length = fedData.size();
453 
454  LogDebug("EcalRawToDigi") << "raw data length: " << length ;
455  //if data size is not null interpret data
456  if ( length >= EMPTYEVENTSIZE ){
457 
458  if(myMap_->setActiveDCC(*i)){
459 
460  const int smId = myMap_->getActiveSM();
461  LogDebug("EcalRawToDigi") << "Getting FED = " << *i <<"(SM = "<<smId<<")"<<" data size is: " << length;
462 
463  const uint64_t* data = (uint64_t*) fedData.data();
464  theUnpacker_->unpack(data, length, smId, *i);
465 
466  LogDebug("EcalRawToDigi") <<" in EE :"<<productDigisEE->size()
467  <<" in EB :"<<productDigisEB->size();
468  }
469  }
470 
471  }// loop on FEDs
472 
473  //if(nevts_>1){ //NUNO
474  // double TIME_END = clock(); //NUNO
475  // RUNNING_TIME_ += TIME_END-TIME_START; //NUNO
476  // }
477 
478 
479  // Add collections to the event
480 
481  if(put_){
482 
483  if( headerUnpacking_){
484  e.put(productDccHeaders);
485  }
486 
487  if(feUnpacking_){
488  productDigisEB->sort();
489  e.put(productDigisEB,"ebDigis");
490  productDigisEE->sort();
491  e.put(productDigisEE,"eeDigis");
492  e.put(productInvalidGains,"EcalIntegrityGainErrors");
493  e.put(productInvalidGainsSwitch, "EcalIntegrityGainSwitchErrors");
494  e.put(productInvalidChIds, "EcalIntegrityChIdErrors");
495  // EE (leaving for now the same names as in EB)
496  e.put(productInvalidEEGains,"EcalIntegrityGainErrors");
497  e.put(productInvalidEEGainsSwitch, "EcalIntegrityGainSwitchErrors");
498  e.put(productInvalidEEChIds, "EcalIntegrityChIdErrors");
499  // EE
500  e.put(productInvalidTTIds,"EcalIntegrityTTIdErrors");
501  e.put(productInvalidZSXtalIds,"EcalIntegrityZSXtalIdErrors");
502  e.put(productInvalidBlockLengths,"EcalIntegrityBlockSizeErrors");
503  e.put(productPnDiodeDigis);
504  }
505  if(memUnpacking_){
506  e.put(productInvalidMemTtIds,"EcalIntegrityMemTtIdErrors");
507  e.put(productInvalidMemBlockSizes,"EcalIntegrityMemBlockSizeErrors");
508  e.put(productInvalidMemChIds,"EcalIntegrityMemChIdErrors");
509  e.put(productInvalidMemGains,"EcalIntegrityMemGainErrors");
510  }
511  if(srpUnpacking_){
512  e.put(productEBSrFlags);
513  e.put(productEESrFlags);
514  }
515  if(tccUnpacking_){
516  e.put(productEcalTps,"EcalTriggerPrimitives");
517  e.put(productEcalPSs,"EcalPseudoStripInputs");
518  }
519  }
520 
521 //if(nevts_>1){ //NUNO
522 // double TIME_END = clock(); //NUNO
523 // RUNNING_TIME_ += TIME_END-TIME_START; //NUNO
524 //}
525 
526 }
#define LogDebug(id)
void setPnDiodeDigisCollection(std::auto_ptr< EcalPnDiodeDigiCollection > *x)
edm::ESWatcher< EcalMappingRcd > watcher_
Definition: EcalRawToDigi.h:64
int i
Definition: DBlmapReader.cc:9
void unpack(const uint64_t *buffer, size_t bufferSize, unsigned int smId, unsigned int fedId)
void setInvalidZSXtalIdsCollection(std::auto_ptr< EcalElectronicsIdCollection > *x)
edm::EDGetTokenT< FEDRawDataCollection > dataToken_
Definition: EcalRawToDigi.h:90
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
void setInvalidMemBlockSizesCollection(std::auto_ptr< EcalElectronicsIdCollection > *x)
void setDccHeadersCollection(std::auto_ptr< EcalRawDataCollection > *x)
void setEcalPSsCollection(std::auto_ptr< EcalPSInputDigiCollection > *x)
void setInvalidEEGainsSwitchCollection(std::auto_ptr< EEDetIdCollection > *x)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
void setEEDigisCollection(std::auto_ptr< EEDigiCollection > *x)
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
std::vector< int > fedUnpackList_
Definition: EcalRawToDigi.h:70
DCCDataUnpacker * theUnpacker_
void setInvalidMemTtIdsCollection(std::auto_ptr< EcalElectronicsIdCollection > *x)
void setEBSrFlagsCollection(std::auto_ptr< EBSrFlagCollection > *x)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
bool setActiveDCC(unsigned int dccId)
void setEBDigisCollection(std::auto_ptr< EBDigiCollection > *x)
void setInvalidMemGainsCollection(std::auto_ptr< EcalElectronicsIdCollection > *x)
void setInvalidGainsCollection(std::auto_ptr< EBDetIdCollection > *x)
void setInvalidEEChIdsCollection(std::auto_ptr< EEDetIdCollection > *x)
edm::EDGetTokenT< EcalListOfFEDS > fedsToken_
Definition: EcalRawToDigi.h:91
void setInvalidTTIdsCollection(std::auto_ptr< EcalElectronicsIdCollection > *x)
bool headerUnpacking_
Definition: EcalRawToDigi.h:78
void setInvalidGainsSwitchCollection(std::auto_ptr< EBDetIdCollection > *x)
unsigned long long uint64_t
Definition: Time.h:15
void setEESrFlagsCollection(std::auto_ptr< EESrFlagCollection > *x)
T const * product() const
Definition: ESHandle.h:86
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
void setEcalTpsCollection(std::auto_ptr< EcalTrigPrimDigiCollection > *x)
void setInvalidMemChIdsCollection(std::auto_ptr< EcalElectronicsIdCollection > *x)
void setInvalidBlockLengthsCollection(std::auto_ptr< EcalElectronicsIdCollection > *x)
dictionary rawdata
Definition: lumiPlot.py:393
void setInvalidEEGainsCollection(std::auto_ptr< EEDetIdCollection > *x)
EcalElectronicsMapper * myMap_
Definition: EcalRawToDigi.h:98
void setInvalidChIdsCollection(std::auto_ptr< EBDetIdCollection > *x)

Member Data Documentation

edm::EDGetTokenT<FEDRawDataCollection> EcalRawToDigi::dataToken_
private

Definition at line 90 of file EcalRawToDigi.h.

Referenced by EcalRawToDigi(), and produce().

edm::EDGetTokenT<EcalListOfFEDS> EcalRawToDigi::fedsToken_
private

Definition at line 91 of file EcalRawToDigi.h.

Referenced by EcalRawToDigi(), and produce().

std::vector<int> EcalRawToDigi::fedUnpackList_
private

Definition at line 70 of file EcalRawToDigi.h.

Referenced by EcalRawToDigi(), and produce().

bool EcalRawToDigi::feIdCheck_
private

Definition at line 84 of file EcalRawToDigi.h.

Referenced by EcalRawToDigi().

bool EcalRawToDigi::feUnpacking_
private

Definition at line 81 of file EcalRawToDigi.h.

Referenced by EcalRawToDigi(), and produce().

bool EcalRawToDigi::first_
private

Definition at line 86 of file EcalRawToDigi.h.

Referenced by EcalRawToDigi(), and produce().

bool EcalRawToDigi::forceToKeepFRdata_
private

Definition at line 85 of file EcalRawToDigi.h.

Referenced by EcalRawToDigi().

bool EcalRawToDigi::headerUnpacking_
private

Definition at line 78 of file EcalRawToDigi.h.

Referenced by EcalRawToDigi(), and produce().

bool EcalRawToDigi::memUnpacking_
private

Definition at line 82 of file EcalRawToDigi.h.

Referenced by EcalRawToDigi(), and produce().

EcalElectronicsMapper* EcalRawToDigi::myMap_
private

Definition at line 98 of file EcalRawToDigi.h.

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

unsigned int EcalRawToDigi::nevts_
private

Definition at line 103 of file EcalRawToDigi.h.

unsigned int EcalRawToDigi::numbTriggerTSamples_
private

Definition at line 76 of file EcalRawToDigi.h.

Referenced by EcalRawToDigi().

unsigned int EcalRawToDigi::numbXtalTSamples_
private

Definition at line 75 of file EcalRawToDigi.h.

Referenced by EcalRawToDigi().

std::vector<int> EcalRawToDigi::orderedDCCIdList_
private

Definition at line 73 of file EcalRawToDigi.h.

Referenced by EcalRawToDigi().

std::vector<int> EcalRawToDigi::orderedFedUnpackList_
private

Definition at line 72 of file EcalRawToDigi.h.

Referenced by EcalRawToDigi().

bool EcalRawToDigi::put_
private

Definition at line 87 of file EcalRawToDigi.h.

Referenced by produce().

bool EcalRawToDigi::REGIONAL_
private

Definition at line 94 of file EcalRawToDigi.h.

Referenced by EcalRawToDigi(), and produce().

double EcalRawToDigi::RUNNING_TIME_
private

Definition at line 104 of file EcalRawToDigi.h.

double EcalRawToDigi::SETUP_TIME_
private

Definition at line 104 of file EcalRawToDigi.h.

bool EcalRawToDigi::srpUnpacking_
private

Definition at line 79 of file EcalRawToDigi.h.

Referenced by EcalRawToDigi(), and produce().

bool EcalRawToDigi::syncCheck_
private

Definition at line 83 of file EcalRawToDigi.h.

Referenced by EcalRawToDigi().

bool EcalRawToDigi::tccUnpacking_
private

Definition at line 80 of file EcalRawToDigi.h.

Referenced by EcalRawToDigi(), and produce().

DCCDataUnpacker* EcalRawToDigi::theUnpacker_
private

Definition at line 101 of file EcalRawToDigi.h.

Referenced by beginRun(), EcalRawToDigi(), produce(), and ~EcalRawToDigi().

edm::ESWatcher<EcalMappingRcd> EcalRawToDigi::watcher_

Definition at line 64 of file EcalRawToDigi.h.

Referenced by produce().