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 | Private Attributes
CSCDCCUnpacker Class Reference

#include <CSCDCCUnpacker.h>

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

Public Member Functions

 CSCDCCUnpacker (const edm::ParameterSet &pset)
 Constructor. More...
 
void produce (edm::Event &e, const edm::EventSetup &c)
 Produce digis out of raw data. More...
 
void visual_raw (int hl, int id, int run, int event, bool fedshort, bool fDump, short unsigned int *buf) const
 Visualization of raw data in FED-less events (Robert Harr and Alexander Sakharov) More...
 
virtual ~CSCDCCUnpacker ()
 Destructor. More...
 
- 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)
 

Private Attributes

bool debug
 
unsigned int errorMask
 
unsigned int examinerMask
 
bool formatedEventDump
 
bool goodEvent
 
edm::EDGetTokenT
< FEDRawDataCollection
i_token
 Token for consumes interface & access to data. More...
 
bool instantiateDQM
 
CSCMonitorInterfacemonitor
 
int numOfEvents
 
bool printEventNumber
 
bool SuppressZeroLCT
 Suppress zeros LCTs. More...
 
bool unpackStatusDigis
 
bool useExaminer
 
bool useFormatStatus
 
bool useSelectiveUnpacking
 
bool visualFEDInspect
 Visualization of raw data. More...
 
bool visualFEDShort
 

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

Author
Alex Tumanov

Definition at line 17 of file CSCDCCUnpacker.h.

Constructor & Destructor Documentation

CSCDCCUnpacker::CSCDCCUnpacker ( const edm::ParameterSet pset)

Constructor.

Selective unpacking mode will skip only troublesome CSC blocks and not whole DCC/DDU block

Enable Format Status Digis

Visualization of raw data

Suppress zeros LCTs

Definition at line 75 of file CSCDCCUnpacker.cc.

References debug, errorMask, examinerMask, formatedEventDump, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i_token, instantiateDQM, monitor, cppFunctionSkipper::operator, printEventNumber, CSCDCCEventData::setDebug(), CSCRPCData::setDebug(), CSCALCTHeader::setDebug(), CSCDDUEventData::setDebug(), CSCCLCTData::setDebug(), CSCTMBData::setDebug(), CSCEventData::setDebug(), CSCTMBHeader::setDebug(), CSCDDUEventData::setErrorMask(), SuppressZeroLCT, unpackStatusDigis, useExaminer, useFormatStatus, useSelectiveUnpacking, visualFEDInspect, and visualFEDShort.

75  :
76  numOfEvents(0)
77 {
78 
79  // Tracked
80  i_token = consumes<FEDRawDataCollection>( pset.getParameter<edm::InputTag>("InputObjects") );
81 
82  useExaminer = pset.getParameter<bool>("UseExaminer");
83  examinerMask = pset.getParameter<unsigned int>("ExaminerMask");
85  useSelectiveUnpacking = pset.getParameter<bool>("UseSelectiveUnpacking");
86  errorMask = pset.getParameter<unsigned int>("ErrorMask");
87  unpackStatusDigis = pset.getParameter<bool>("UnpackStatusDigis");
89  useFormatStatus = pset.getParameter<bool>("UseFormatStatus");
90 
91  // Untracked
92 
93  printEventNumber = pset.getUntrackedParameter<bool>("PrintEventNumber", true);
94  debug = pset.getUntrackedParameter<bool>("Debug", false);
95  instantiateDQM = pset.getUntrackedParameter<bool>("runDQM", false);
96 
98  visualFEDInspect = pset.getUntrackedParameter<bool>("VisualFEDInspect", false);
99  visualFEDShort = pset.getUntrackedParameter<bool>("VisualFEDShort", false);
100  formatedEventDump = pset.getUntrackedParameter<bool>("FormatedEventDump", false);
101 
103  SuppressZeroLCT = pset.getUntrackedParameter<bool>("SuppressZeroLCT", true);
104 
105 
106 
107  if (instantiateDQM)
108  {
110  }
111 
112  produces<CSCWireDigiCollection>("MuonCSCWireDigi");
113  produces<CSCStripDigiCollection>("MuonCSCStripDigi");
114  produces<CSCComparatorDigiCollection>("MuonCSCComparatorDigi");
115  produces<CSCALCTDigiCollection>("MuonCSCALCTDigi");
116  produces<CSCCLCTDigiCollection>("MuonCSCCLCTDigi");
117  produces<CSCRPCDigiCollection>("MuonCSCRPCDigi");
118  produces<CSCCorrelatedLCTDigiCollection>("MuonCSCCorrelatedLCTDigi");
119 
120  if (unpackStatusDigis)
121  {
122  produces<CSCCFEBStatusDigiCollection>("MuonCSCCFEBStatusDigi");
123  produces<CSCTMBStatusDigiCollection>("MuonCSCTMBStatusDigi");
124  produces<CSCDMBStatusDigiCollection>("MuonCSCDMBStatusDigi");
125  produces<CSCALCTStatusDigiCollection>("MuonCSCALCTStatusDigi");
126  produces<CSCDDUStatusDigiCollection>("MuonCSCDDUStatusDigi");
127  produces<CSCDCCStatusDigiCollection>("MuonCSCDCCStatusDigi");
128  }
129 
130  if (useFormatStatus)
131  {
132  produces<CSCDCCFormatStatusDigiCollection>("MuonCSCDCCFormatStatusDigi");
133  }
134  //CSCAnodeData::setDebug(debug);
144 
145 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool SuppressZeroLCT
Suppress zeros LCTs.
static void setDebug(bool value)
CSCMonitorInterface * monitor
bool visualFEDInspect
Visualization of raw data.
static void setDebug(const bool value)
Definition: CSCTMBHeader.h:122
static void setDebug(const bool value)
Definition: CSCTMBData.h:37
static void setErrorMask(unsigned int value)
static void setDebug(bool value)
static void setDebug(const bool value)
Definition: CSCCLCTData.h:35
edm::EDGetTokenT< FEDRawDataCollection > i_token
Token for consumes interface &amp; access to data.
unsigned int errorMask
unsigned int examinerMask
static void setDebug(bool value)
to access data by via status digis
Definition: CSCALCTHeader.h:30
bool useSelectiveUnpacking
static void setDebug(const bool value)
Definition: CSCEventData.h:58
static void setDebug(bool debugValue)
Definition: CSCRPCData.h:27
CSCDCCUnpacker::~CSCDCCUnpacker ( )
virtual

Destructor.

Definition at line 147 of file CSCDCCUnpacker.cc.

148 {
149  //fill destructor here
150 }

Member Function Documentation

void CSCDCCUnpacker::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 152 of file CSCDCCUnpacker.cc.

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

152  {
154  desc.add<edm::InputTag>("InputObjects",edm::InputTag("rawDataCollector"))->setComment("# Define input to the unpacker");
155  desc.add<bool>("UseExaminer",true)->setComment("# Use CSC examiner to check for corrupt or semi-corrupt data & avoid unpacker crashes");
156  desc.add<unsigned int>("ExaminerMask",535557110)->setComment("# This mask is needed by the examiner");
157  desc.add<bool>("UseSelectiveUnpacking",true)->setComment("# Use Examiner to unpack good chambers and skip only bad ones");
158  desc.add<unsigned int>("ErrorMask",0)->setComment("# This mask simply reduces error reporting");
159  desc.add<bool>("UnpackStatusDigis",false)->setComment("# Unpack general status digis?");
160  desc.add<bool>("UseFormatStatus",true)->setComment("# Unpack FormatStatus digi?");
161  desc.addUntracked<bool>("Debug",false)->setComment("# Turn on lots of output");
162  desc.addUntracked<bool>("PrintEventNumber",false);
163  desc.addUntracked<bool>("runDQM",false);
164  desc.addUntracked<bool>("VisualFEDInspect",false)->setComment("# Visualization of raw data in corrupted events");
165  desc.addUntracked<bool>("VisualFEDShort",false)->setComment("# Visualization of raw data in corrupted events");
166  desc.addUntracked<bool>("FormatedEventDump",false);
167  desc.addUntracked<bool>("SuppressZeroLCT",true);
168  descriptions.add("muonCSCDCCUnpacker",desc);
169  descriptions.setComment(" This is the generic cfi file for CSC unpacking");
170 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void setComment(std::string const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void CSCDCCUnpacker::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Produce digis out of raw data.

access database for mapping

Get a handle to the FED data collection

create the collections of CSC digis

uncomment this for regional unpacking if (id!=SOME_ID) continue;

Take a reference to this FED's data

if fed has data then unpack it

examine event for integrity

If we have DCC or only DDU FED by checking FED ID set examiner to uswe DCC or DDU mode

Visualization of raw data

get a pointer to data and pass it to constructor for unpacking

set default detid to that for E=+z, S=1, R=1, C=1, L=1

get a reference to dduData

DCC Trailer 2 added to dcc status product (to access TTS from DCC)

skip the DDU if its data has serious errors define a mask for serious errors

DDU Trailer 0 added to ddu status product (to access TTS from DDU)

get a reference to chamber data

first process chamber-wide digis such as LCT

default value for all digis not related to cfebs

layer=0 flags entire chamber

For Post-LS1 readout only. Check Chamber->FED/DDU mapping consistency. Skip chambers (special case of data corruption), which report wrong ID and pose as different chamber

check alct data integrity

fill alct digi

check tmb data integrity

fill correlatedlct and clct digis

fill cscrpc digi

fill cfeb status digi

loop over status digis

fill dmb status digi

fill wire, strip and comparator digis...

set layer, dmb and vme are valid because already checked in line 240

Implements edm::stream::EDProducerBase.

Definition at line 172 of file CSCDCCUnpacker.cc.

References trackerTree::check(), CSCDCCExaminer::check(), CSCDCCExaminer::crcALCT(), CSCDCCExaminer::crcCFEB(), CSCDCCExaminer::crcTMB(), CSCDetId, FEDRawData::data(), data, CSCChamberMap::ddu(), debug, CSCCrateMap::detId(), CSCDCCExaminer::errName(), errorMask, CSCDCCExaminer::errors(), CSCDCCExaminer::errorsDetailed(), CSCDCCExaminer::errorsDetailedDDU(), edm::EventID::event(), examinerMask, formatedEventDump, edm::EventSetup::get(), edm::Event::getByToken(), CSCDCCExaminer::getMask(), goodEvent, i, i_token, edm::EventBase::id(), instantiateDQM, LogTrace, FEDNumbering::MAXCSCDDUFEDID, FEDNumbering::MAXCSCFEDID, FEDNumbering::MINCSCDDUFEDID, FEDNumbering::MINCSCFEDID, CSCDCCExaminer::modeDDU(), monitor, CSCDCCExaminer::nERRORS, NULL, numOfEvents, CSCDCCExaminer::payloadDetailed(), printEventNumber, CSCMonitorInterface::process(), edm::ESHandle< class >::product(), edm::Event::put(), lumiPlot::rawdata, DetId::rawId(), edm::EventID::run(), CSCDCCExaminer::setMask(), FEDRawData::size(), CSCDCCExaminer::statusDetailed(), SuppressZeroLCT, unpackStatusDigis, useExaminer, useFormatStatus, useSelectiveUnpacking, visual_raw(), visualFEDInspect, and visualFEDShort.

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

173 {
174 
176  // Do we really have to do this every event???
177  // ... Yes, because framework is more efficient than you are at caching :)
178  // (But if you want to actually DO something specific WHEN the mapping changes, check out ESWatcher)
180  c.get<CSCCrateMapRcd>().get(hcrate);
181  const CSCCrateMap* pcrate = hcrate.product();
182 
183  // Need access to CSCChamberMap for chamber<->FED/DDU mapping consistency checks
185  c.get<CSCChamberMapRcd>().get(cscmap);
186  const CSCChamberMap* cscmapping = cscmap.product();
187 
189 
192  e.getByToken( i_token, rawdata);
193 
195  std::auto_ptr<CSCWireDigiCollection> wireProduct(new CSCWireDigiCollection);
196  std::auto_ptr<CSCStripDigiCollection> stripProduct(new CSCStripDigiCollection);
197  std::auto_ptr<CSCALCTDigiCollection> alctProduct(new CSCALCTDigiCollection);
198  std::auto_ptr<CSCCLCTDigiCollection> clctProduct(new CSCCLCTDigiCollection);
199  std::auto_ptr<CSCComparatorDigiCollection> comparatorProduct(new CSCComparatorDigiCollection);
200  std::auto_ptr<CSCRPCDigiCollection> rpcProduct(new CSCRPCDigiCollection);
201  std::auto_ptr<CSCCorrelatedLCTDigiCollection> corrlctProduct(new CSCCorrelatedLCTDigiCollection);
202  std::auto_ptr<CSCCFEBStatusDigiCollection> cfebStatusProduct(new CSCCFEBStatusDigiCollection);
203  std::auto_ptr<CSCDMBStatusDigiCollection> dmbStatusProduct(new CSCDMBStatusDigiCollection);
204  std::auto_ptr<CSCTMBStatusDigiCollection> tmbStatusProduct(new CSCTMBStatusDigiCollection);
205  std::auto_ptr<CSCDDUStatusDigiCollection> dduStatusProduct(new CSCDDUStatusDigiCollection);
206  std::auto_ptr<CSCDCCStatusDigiCollection> dccStatusProduct(new CSCDCCStatusDigiCollection);
207  std::auto_ptr<CSCALCTStatusDigiCollection> alctStatusProduct(new CSCALCTStatusDigiCollection);
208 
209  std::auto_ptr<CSCDCCFormatStatusDigiCollection> formatStatusProduct(new CSCDCCFormatStatusDigiCollection);
210 
211 
212  // If set selective unpacking mode
213  // hardcoded examiner mask below to check for DCC and DDU level errors will be used first
214  // then examinerMask for CSC level errors will be used during unpacking of each CSC block
215  unsigned long dccBinCheckMask = 0x06080016;
216 
217  // Post-LS1 FED/DDU ID mapping fix
218  const unsigned postLS1_map [] = { 841, 842, 843, 844, 845, 846, 847, 848, 849,
219  831, 832, 833, 834, 835, 836, 837, 838, 839,
220  861, 862, 863, 864, 865, 866, 867, 868, 869,
221  851, 852, 853, 854, 855, 856, 857, 858, 859 };
222 
223 
224  // For new CSC readout layout, which wont include DCCs need to loop over DDU FED IDs. DCC IDs are included for backward compatibility with old data
225  std::vector<unsigned int> cscFEDids;
226 
227  for (unsigned int id=FEDNumbering::MINCSCFEDID;
228  id<=FEDNumbering::MAXCSCFEDID; ++id) // loop over DCCs
229  {
230  cscFEDids.push_back(id);
231  }
232 
233  for (unsigned int id=FEDNumbering::MINCSCDDUFEDID;
234  id<=FEDNumbering::MAXCSCDDUFEDID; ++id) // loop over DDUs
235  {
236  cscFEDids.push_back(id);
237  }
238 
239  for (unsigned int i=0; i<cscFEDids.size(); i++) // loop over all CSC FEDs (DCCs and DDUs)
240  {
241  unsigned int id = cscFEDids[i];
242  bool isDDU_FED = ((id >= FEDNumbering::MINCSCDDUFEDID) && (id <= FEDNumbering::MAXCSCDDUFEDID))?true:false;
243 
244 
247 
249  const FEDRawData& fedData = rawdata->FEDData(id);
250  unsigned long length = fedData.size();
251 
252 
253  if (length>=32)
254  {
255  CSCDCCExaminer* examiner = NULL;
256  goodEvent = true;
257  if (useExaminer)
258  {
259  // CSCDCCExaminer examiner;
260  examiner = new CSCDCCExaminer();
261  if ( examinerMask&0x40000 ) examiner->crcCFEB(1);
262  if ( examinerMask&0x8000 ) examiner->crcTMB (1);
263  if ( examinerMask&0x0400 ) examiner->crcALCT(1);
264  examiner->setMask(examinerMask);
265 
267  if ( isDDU_FED )
268  {
269  if (examiner != NULL) examiner->modeDDU(true);
270  }
271 
272  const short unsigned int *data = (short unsigned int *)fedData.data();
273 
274  LogTrace("badData") << "Length: "<< length/2;
275  // Event data hex dump
276  /*
277  short unsigned * buf = (short unsigned int *)fedData.data();
278  std::cout <<std::endl<<length/2<<" words of data:"<<std::endl;
279  for (short unsigned int i=0;i<length/2;i++) {
280  printf("%04x %04x %04x %04x\n",buf[i+3],buf[i+2],buf[i+1],buf[i]);
281  i+=3;
282  }
283  */
284 
285  int res = examiner->check(data,long(fedData.size()/2));
286  if ( res < 0 )
287  {
288  goodEvent=false;
289  }
290  else
291  {
292  if (useSelectiveUnpacking) goodEvent=!(examiner->errors()&dccBinCheckMask);
293  else goodEvent=!(examiner->errors()&examinerMask);
294  }
295 
296  /*
297  std::cout << "FED" << id << " " << fedData.size() << " " << goodEvent << " "
298  << std::hex << examiner->errors() << std::dec << " " << status << std::endl;
299  */
300 
301  // Fill Format status digis per FED
302  // Remove examiner->errors() != 0 check if we need to put status digis for every event
303  if (useFormatStatus && (examiner->errors() !=0))
304  // formatStatusProduct->insertDigi(CSCDetId(1,1,1,1,1), CSCDCCFormatStatusDigi(id,examiner,dccBinCheckMask));
305  formatStatusProduct->insertDigi(CSCDetId(1,1,1,1,1),
306  CSCDCCFormatStatusDigi(id,dccBinCheckMask,
307  examiner->getMask(),
308  examiner->errors(),
309  examiner->errorsDetailedDDU(),
310  examiner->errorsDetailed(),
311  examiner->payloadDetailed(),
312  examiner->statusDetailed()));
313  }
314 
317  {
319  {
320  short unsigned * buf = (short unsigned int *)fedData.data();
321  visual_raw(length/2, id,(int)e.id().run(),(int)e.id().event(),
323  }
324  }
325 
326  if (goodEvent)
327  {
329 
330 
331  CSCDCCExaminer * ptrExaminer = examiner;
332  if (!useSelectiveUnpacking) ptrExaminer = NULL;
333 
334 
335 
336  std::vector<CSCDDUEventData> fed_Data;
337  std::vector<CSCDDUEventData>* ptr_fedData = &fed_Data;
338 
340  CSCDetId layer(1, 1, 1, 1, 1);
341 
342  if (isDDU_FED) // Use new DDU FED readout mode
343  {
344 
345  CSCDDUEventData single_dduData((short unsigned int *) fedData.data(), ptrExaminer);
346  fed_Data.push_back(single_dduData);
347 
348 
349  // if(instantiateDQM) monitor->process(examiner, &single_dduData);
350 
351 
352  }
353  else // Use old DCC FED readout mode
354  {
355 
356  CSCDCCEventData dccData((short unsigned int *) fedData.data(), ptrExaminer);
357 
358  //std::cout << " DCC Size [UNPK] " << dccData.sizeInWords() << std::endl;
359 
360  if (instantiateDQM) monitor->process(examiner, &dccData);
361 
363  // const std::vector<CSCDDUEventData> & dduData = dccData.dduData();
364  // ptr_fedData = &(dccData.dduData());
365  fed_Data = dccData.dduData();
366 
367 
368  if (unpackStatusDigis)
369  {
370 
372  short unsigned * bufForDcc = (short unsigned int *)fedData.data();
373 
374  //std::cout << "FED Length: " << std::dec << length/2 <<
375  //" Trailer 2: " << std::hex << bufForDcc[length/2-4] << std::endl;
376 
377  dccStatusProduct->insertDigi(layer, CSCDCCStatusDigi(dccData.dccHeader().data(),
378  dccData.dccTrailer().data(),
379  examiner->errors(),
380  bufForDcc[length/2-4]));
381 
382  }
383  }
384 
385  const std::vector<CSCDDUEventData> & dduData = *ptr_fedData;
386 
387 
388  for (unsigned int iDDU=0; iDDU<dduData.size(); ++iDDU) // loop over DDUs
389  {
390 
391 
394  if (dduData[iDDU].trailer().errorstat()&errorMask)
395  {
396  LogTrace("CSCDCCUnpacker|CSCRawToDigi") << "FED ID" << id << " DDU# " << iDDU << " has serious error - no digis unpacked! " <<
397  std::hex << dduData[iDDU].trailer().errorstat();
398  continue; // to next iteration of DDU loop
399  }
400 
401  if (unpackStatusDigis) dduStatusProduct->
402  insertDigi(layer, CSCDDUStatusDigi(dduData[iDDU].header().data(),
403  dduData[iDDU].trailer().data(),
405  dduData[iDDU].trailer0()));
406 
408  const std::vector<CSCEventData> & cscData = dduData[iDDU].cscData();
409 
410  // if (cscData.size() != 0) std::cout << "FED" << id << " DDU Source ID: " << dduData[iDDU].header().source_id() << " firmware version: " << dduData[iDDU].header().format_version() << std::endl;
411 
412  for (unsigned int iCSC=0; iCSC<cscData.size(); ++iCSC) // loop over CSCs
413  {
414 
416  int vmecrate = cscData[iCSC].dmbHeader()->crateID();
417  int dmb = cscData[iCSC].dmbHeader()->dmbID();
418 
419  int icfeb = 0;
420  int ilayer = 0;
421 
422  if (debug)
423  LogTrace ("CSCDCCUnpacker|CSCRawToDigi") << "crate = " << vmecrate << "; dmb = " << dmb;
424 
425 
426 
427  if ((vmecrate>=1)&&(vmecrate<=60) && (dmb>=1)&&(dmb<=10)&&(dmb!=6))
428  {
429  layer = pcrate->detId(vmecrate, dmb,icfeb,ilayer );
430  }
431  else
432  {
433  LogTrace ("CSCDCCUnpacker|CSCRawToDigi") << " detID input out of range!!! ";
434  LogTrace ("CSCDCCUnpacker|CSCRawToDigi")
435  << " skipping chamber vme= " << vmecrate << " dmb= " << dmb;
436  continue; // to next iteration of iCSC loop
437  }
438 
441  if (isDDU_FED)
442  {
443  unsigned int dduid = cscmapping->ddu(layer);
444  if ((dduid>=1) && (dduid <= 36)) dduid = postLS1_map[dduid-1]; // Fix for Post-LS1 FED/DDU IDs mappings
445  // std::cout << "CSC " << layer << " -> " << id << ":" << dduid << ":" << vmecrate << ":" << dmb ;
446  if (id != dduid )
447  {
448  LogTrace ("CSCDDUUnpacker|CSCRawToDigi") << " CSC->FED/DDU mapping inconsistency!!! ";
449  LogTrace ("CSCDCCUnpacker|CSCRawToDigi")
450  << "readout FED/DDU ID=" << id << " expected ID=" << dduid
451  << ", skipping chamber " << layer << " vme= " << vmecrate << " dmb= " << dmb;
452  continue;
453  }
454  }
455 
457  int nalct = cscData[iCSC].dmbHeader()->nalct();
458  bool goodALCT=false;
459  //if (nalct&&(cscData[iCSC].dataPresent>>6&0x1)==1) {
460  if (nalct&&cscData[iCSC].alctHeader())
461  {
462  if (cscData[iCSC].alctHeader()->check())
463  {
464  goodALCT=true;
465  }
466  else
467  {
468  LogTrace ("CSCDCCUnpacker|CSCRawToDigi") <<
469  "not storing ALCT digis; alct is bad or not present";
470  }
471  }
472  else
473  {
474  if (debug) LogTrace ("CSCDCCUnpacker|CSCRawToDigi") << "nALCT==0 !!!";
475  }
476 
478  if (goodALCT)
479  {
480  std::vector <CSCALCTDigi> alctDigis =
481  cscData[iCSC].alctHeader()->ALCTDigis();
482  if (SuppressZeroLCT)
483  {
484  std::vector<CSCALCTDigi> alctDigis_0;
485  for (int unsigned i=0; i<alctDigis.size(); ++i)
486  {
487  if (alctDigis[i].isValid())
488  alctDigis_0.push_back(alctDigis[i]);
489  }
490  alctProduct->move(std::make_pair(alctDigis_0.begin(), alctDigis_0.end()),layer);
491  }
492  else
493  alctProduct->move(std::make_pair(alctDigis.begin(), alctDigis.end()),layer);
494  }
495 
496 
498  int nclct = cscData[iCSC].dmbHeader()->nclct();
499  bool goodTMB=false;
500  // if (nclct&&(cscData[iCSC].dataPresent>>5&0x1)==1) {
501  if (nclct&&cscData[iCSC].tmbData())
502  {
503  if (cscData[iCSC].tmbHeader()->check())
504  {
505  if (cscData[iCSC].clctData()->check()) goodTMB=true;
506  }
507  else
508  {
509  LogTrace ("CSCDCCUnpacker|CSCRawToDigi") <<
510  "one of TMB checks failed! not storing TMB digis ";
511  }
512  }
513  else
514  {
515  if (debug) LogTrace ("CSCDCCUnpacker|CSCRawToDigi") << "nCLCT==0 !!!";
516  }
517 
519  if (goodTMB)
520  {
521  std::vector <CSCCorrelatedLCTDigi> correlatedlctDigis =
522  cscData[iCSC].tmbHeader()->CorrelatedLCTDigis(layer.rawId());
523  if (SuppressZeroLCT)
524  {
525  std::vector<CSCCorrelatedLCTDigi> correlatedlctDigis_0;
526  for (int unsigned i=0; i<correlatedlctDigis.size(); ++i)
527  {
528  if (correlatedlctDigis[i].isValid())
529  correlatedlctDigis_0.push_back(correlatedlctDigis[i]);
530  }
531  corrlctProduct->move(std::make_pair(correlatedlctDigis_0.begin(),
532  correlatedlctDigis_0.end()),layer);
533  }
534  else
535  corrlctProduct->move(std::make_pair(correlatedlctDigis.begin(),
536  correlatedlctDigis.end()),layer);
537 
538  std::vector <CSCCLCTDigi> clctDigis =
539  cscData[iCSC].tmbHeader()->CLCTDigis(layer.rawId());
540  if (SuppressZeroLCT)
541  {
542  std::vector<CSCCLCTDigi> clctDigis_0;
543  for (int unsigned i=0; i<clctDigis.size(); ++i)
544  {
545  if (clctDigis[i].isValid())
546  clctDigis_0.push_back(clctDigis[i]);
547  }
548  clctProduct->move(std::make_pair(clctDigis_0.begin(), clctDigis_0.end()),layer);
549  }
550  else
551  clctProduct->move(std::make_pair(clctDigis.begin(), clctDigis.end()),layer);
552 
554  if (cscData[iCSC].tmbData()->checkSize())
555  {
556  if (cscData[iCSC].tmbData()->hasRPC())
557  {
558  std::vector <CSCRPCDigi> rpcDigis =
559  cscData[iCSC].tmbData()->rpcData()->digis();
560  rpcProduct->move(std::make_pair(rpcDigis.begin(), rpcDigis.end()),layer);
561  }
562  }
563  else LogTrace("CSCDCCUnpacker|CSCRawToDigi") <<" TMBData check size failed!";
564  }
565 
566 
568  if (unpackStatusDigis)
569  {
570  for ( icfeb = 0; icfeb < 7; ++icfeb )
571  {
572  if ( cscData[iCSC].cfebData(icfeb) != NULL )
573  cfebStatusProduct->
574  insertDigi(layer, cscData[iCSC].cfebData(icfeb)->statusDigi());
575  }
577  dmbStatusProduct->insertDigi(layer, CSCDMBStatusDigi(cscData[iCSC].dmbHeader()->data(),
578  cscData[iCSC].dmbTrailer()->data()));
579  if (goodTMB) tmbStatusProduct->
580  insertDigi(layer, CSCTMBStatusDigi(cscData[iCSC].tmbHeader()->data(),
581  cscData[iCSC].tmbData()->tmbTrailer()->data()));
582  if (goodALCT) alctStatusProduct->
583  insertDigi(layer, CSCALCTStatusDigi(cscData[iCSC].alctHeader()->data(),
584  cscData[iCSC].alctTrailer()->data()));
585  }
586 
587 
589  for (int ilayer = 1; ilayer <= 6; ++ilayer)
590  {
592  // (You have to be kidding. Line 240 in whose universe?)
593 
594  // Allocate all ME1/1 wire digis to ring 1
595  layer = pcrate->detId( vmecrate, dmb, 0, ilayer );
596  {
597  std::vector <CSCWireDigi> wireDigis = cscData[iCSC].wireDigis(ilayer);
598  wireProduct->move(std::make_pair(wireDigis.begin(), wireDigis.end()),layer);
599  }
600 
601  for ( icfeb = 0; icfeb < 7; ++icfeb )
602  {
603  layer = pcrate->detId( vmecrate, dmb, icfeb,ilayer );
604  if (cscData[iCSC].cfebData(icfeb) && cscData[iCSC].cfebData(icfeb)->check())
605  {
606  std::vector<CSCStripDigi> stripDigis;
607  cscData[iCSC].cfebData(icfeb)->digis(layer.rawId(),stripDigis);
608  stripProduct->move(std::make_pair(stripDigis.begin(),
609  stripDigis.end()),layer);
610  }
611  }
612 
613 
614  if (goodTMB && (cscData[iCSC].tmbHeader() != NULL))
615  {
616  int nCFEBs = cscData[iCSC].tmbHeader()->NCFEBs();
617  for ( icfeb = 0; icfeb < nCFEBs; ++icfeb )
618  {
619  layer = pcrate->detId( vmecrate, dmb, icfeb,ilayer );
620  std::vector <CSCComparatorDigi> comparatorDigis =
621  cscData[iCSC].clctData()->comparatorDigis(layer.rawId(), icfeb);
622  // Set cfeb=0, so that ME1/a and ME1/b comparators go to
623  // ring 1.
624  layer = pcrate->detId( vmecrate, dmb, 0, ilayer );
625  comparatorProduct->move(std::make_pair(comparatorDigis.begin(),
626  comparatorDigis.end()),layer);
627  }
628  } // end of loop over cfebs
629  } // end of loop over layers
630  } // end of loop over chambers
631  } // endof loop over DDUs
632  } // end of good event
633  else
634  {
635  LogTrace("CSCDCCUnpacker|CSCRawToDigi") <<
636  "ERROR! Examiner rejected FED #" << id;
637  if (examiner)
638  {
639  for (int i=0; i<examiner->nERRORS; ++i)
640  {
641  if (((examinerMask&examiner->errors())>>i)&0x1)
642  LogTrace("CSCDCCUnpacker|CSCRawToDigi")<<examiner->errName(i);
643  }
644  if (debug)
645  {
646  LogTrace("CSCDCCUnpacker|CSCRawToDigi")
647  << " Examiner errors:0x" << std::hex << examiner->errors()
648  << " & 0x" << examinerMask
649  << " = " << (examiner->errors()&examinerMask);
650  }
651  }
652 
653  // dccStatusProduct->insertDigi(CSCDetId(1,1,1,1,1), CSCDCCStatusDigi(examiner->errors()));
654  // if(instantiateDQM) monitor->process(examiner, NULL);
655  }
656  if (examiner!=NULL) delete examiner;
657  } // end of if fed has data
658  } // end of loop over DCCs
659  // put into the event
660  e.put(wireProduct, "MuonCSCWireDigi");
661  e.put(stripProduct, "MuonCSCStripDigi");
662  e.put(alctProduct, "MuonCSCALCTDigi");
663  e.put(clctProduct, "MuonCSCCLCTDigi");
664  e.put(comparatorProduct, "MuonCSCComparatorDigi");
665  e.put(rpcProduct, "MuonCSCRPCDigi");
666  e.put(corrlctProduct, "MuonCSCCorrelatedLCTDigi");
667 
668  if (useFormatStatus) e.put(formatStatusProduct, "MuonCSCDCCFormatStatusDigi");
669 
670  if (unpackStatusDigis)
671  {
672  e.put(cfebStatusProduct, "MuonCSCCFEBStatusDigi");
673  e.put(dmbStatusProduct, "MuonCSCDMBStatusDigi");
674  e.put(tmbStatusProduct, "MuonCSCTMBStatusDigi");
675  e.put(dduStatusProduct, "MuonCSCDDUStatusDigi");
676  e.put(dccStatusProduct, "MuonCSCDCCStatusDigi");
677  e.put(alctStatusProduct, "MuonCSCALCTStatusDigi");
678  }
679  if (printEventNumber) LogTrace("CSCDCCUnpacker|CSCRawToDigi")
680  <<"[CSCDCCUnpacker]: " << numOfEvents << " events processed ";
681 }
RunNumber_t run() const
Definition: EventID.h:39
01/20/05 A.Tumanov
EventNumber_t event() const
Definition: EventID.h:41
void crcCFEB(bool enable)
int i
Definition: DBlmapReader.cc:9
bool SuppressZeroLCT
Suppress zeros LCTs.
void modeDDU(bool enable)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
CSCDetId detId(int vme, int dmb, int cfeb, int layer=0) const
Definition: CSCCrateMap.cc:11
int ddu(const CSCDetId &) const
ddu id for given DetId
const uint16_t nERRORS
CSCMonitorInterface * monitor
#define NULL
Definition: scimark2.h:8
ExaminerStatusType errors(void) const
void crcALCT(bool enable)
const char * errName(int num) const
bool visualFEDInspect
Visualization of raw data.
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
Definition: CSCMap.h:8
virtual void process(CSCDCCExaminer *examiner, CSCDCCEventData *dccData)=0
void visual_raw(int hl, int id, int run, int event, bool fedshort, bool fDump, short unsigned int *buf) const
Visualization of raw data in FED-less events (Robert Harr and Alexander Sakharov) ...
std::map< CSCIdType, ExaminerStatusType > errorsDetailed(void) const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
void crcTMB(bool enable)
std::map< CSCIdType, ExaminerStatusType > statusDetailed(void) const
#define LogTrace(id)
ExaminerMaskType getMask() const
edm::EDGetTokenT< FEDRawDataCollection > i_token
Token for consumes interface &amp; access to data.
unsigned int errorMask
unsigned int examinerMask
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
bool useSelectiveUnpacking
int32_t check(const uint16_t *&buffer, int32_t length)
std::map< CSCIdType, ExaminerStatusType > payloadDetailed(void) const
edm::EventID id() const
Definition: EventBase.h:59
CSC Format Status Object.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
std::map< DDUIdType, ExaminerStatusType > errorsDetailedDDU(void) const
dictionary rawdata
Definition: lumiPlot.py:393
void setMask(ExaminerMaskType mask)
void CSCDCCUnpacker::visual_raw ( int  hl,
int  id,
int  run,
int  event,
bool  fedshort,
bool  fDump,
short unsigned int *  buf 
) const

Visualization of raw data in FED-less events (Robert Harr and Alexander Sakharov)

Visualization of raw data.

ALCT Header 1,2

Definition at line 686 of file CSCDCCUnpacker.cc.

References gather_cfg::cout, formatedEventDump, i, j, relval_2017::k, GetRecoTauVFromDQM_MC_cff::kk, and w.

Referenced by produce().

688 {
689 
690  std::cout << std::endl << std::endl << std::endl;
691  std::cout << "Run: "<< run << " Event: " << event << std::endl;
692  std::cout << std::endl << std::endl;
693  if (formatedEventDump)
694  std::cout << "FED-" << id << " " << "(scroll down to see summary)" << std::endl;
695  else
696  std::cout << "Problem seems in FED-" << id << " " << "(scroll down to see summary)" << std::endl;
697  std::cout <<"********************************************************************************" << std::endl;
698  std::cout << hl <<" words of data:" << std::endl;
699 
700  //================================================
701  // FED codes in DCC
702  std::vector<int> dcc_id;
703  int dcc_h1_id=0;
704  // Current codes
705  for (int i=750; i<758; i++)
706  dcc_id.push_back(i);
707  // Codes for upgrade
708  for (int i=830; i<838; i++)
709  dcc_id.push_back(i);
710 
711  char dcc_common[]="DCC-";
712 
713  //================================================
714  // DDU codes per FED
715  std::vector<int> ddu_id;
716  int ddu_h1_12_13=0;
717  for (int i=1; i<37; i++)
718  ddu_id.push_back(i);
719  // For DDU Headers and tarailers
720  char ddu_common[]="DDU-";
721  char ddu_header1[]="Header 1";
722  char ddu_header2[]="Header 2";
723  char ddu_header3[]="Header 3";
724  char ddu_trail1[]="Trailer 1", ddu_trail2[]="Trailer 2", ddu_trail3[]="Trailer 3";
725  // For Header 2
726  char ddu_trailer1_bit[]= {'8','0','0','0','f','f','f','f','8','0','0','0','8','0','0','0'};
727  char ddu_trailer3_bit[]= {'a'};
728  // Corrupted Trailers
729  char ddu_tr1_err_common[]="Incomplet";
730  //====================================================
731 
732  //DMB
733  char dmb_common[]="DMB", dmb_header1[]="Header 1", dmb_header2[]="Header 2";
734  char dmb_common_crate[]="crate:", dmb_common_slot[]="slot:";
735  char dmb_common_l1a[]="L1A:";
736  char dmb_header1_bit[]= {'9','9','9','9'};
737  char dmb_header2_bit[]= {'a','a','a','a'};
738  char dmb_tr1[]="Trailer 1", dmb_tr2[]="Trailer 2";
739  char dmb_tr1_bit[]= {'f','f','f','f'}, dmb_tr2_bit[]= {'e','e','e','e'};
740 
741 
742  //=====================================================
743 
744  // ALCT
745  char alct_common[]="ALCT", alct_header1[]="Header 1", alct_header2[]="Header 2";
746  char alct_common_bxn[]="BXN:";
747  char alct_common_wcnt2[]="| Actual word count:";
748  char alct_common_wcnt1[]="Expected word count:";
749  char alct_header1_bit[]= {'d','d','d','d','b','0','a'};
750  char alct_header2_bit[]= {'0','0','0','0'};
751  char alct_tr1[]="Trailer 1";
752 
753  //======================================================
754 
755  //TMB
756  char tmb_common[]="TMB", tmb_header1[]="Header", tmb_tr1[]="Trailer";
757  char tmb_header1_bit[]= {'d','d','d','d','b','0','c'};
758  char tmb_tr1_bit[]= {'d','d','d','d','e','0','f'};
759 
760  //======================================================
761 
762  //CFEB
763  char cfeb_common[]="CFEB", cfeb_tr1[]="Trailer", cfeb_b[]="B-word";
764  char cfeb_common_sample[]="sample:";
765 
766  //======================================================
767 
768  //Auxiliary variables
769 
770  // Bufers
771  int word_lines=hl/4;
772  char tempbuf[80];
773  char tempbuf1[80];
774  char tempbuf_short[17];
775  char sign1[]=" --->| ";
776 
777  // Counters
778  int word_numbering=0;
779  int ddu_inst_i=0, ddu_inst_n=0, ddu_inst_l1a=0;
780  int ddu_inst_bxn=0;
781  int dmb_inst_crate=0, dmb_inst_slot=0, dmb_inst_l1a=0;
782  int cfeb_sample=0;
783  int alct_inst_l1a=0;
784  int alct_inst_bxn=0;
785  int alct_inst_wcnt1=0;
786  int alct_inst_wcnt2=0;
787  int alct_start=0;
788  int alct_stop=0;
789  int tmb_inst_l1a=0;
790  int tmb_inst_wcnt1=0;
791  int tmb_inst_wcnt2=0;
792  int tmb_start=0;
793  int tmb_stop=0;
794  int dcc_h1_check=0;
795 
796  //Flags
797  int ddu_h2_found=0; //DDU Header 2 found
798  int w=0;
799 
800  //Logic variables
801  const int sz1=5;
802  bool dcc_check=false;
803  bool ddu_h2_check[sz1]= {false};
804  bool ddu_h1_check=false;
805  bool dmb_h1_check[sz1]= {false};
806  bool dmb_h2_check[sz1]= {false};
807  bool ddu_h2_h1=false;
808  bool ddu_tr1_check[sz1]= {false};
809  bool alct_h1_check[sz1]= {false};
810  bool alct_h2_check[sz1]= {false};
811  bool alct_tr1_check[sz1]= {false};
812  bool dmb_tr1_check[sz1]= {false};
813  bool dmb_tr2_check[sz1]= {false};
814  bool tmb_h1_check[sz1]= {false};
815  bool tmb_tr1_check[sz1]= {false};
816  bool cfeb_tr1_check[sz1]= {false};
817  bool cfeb_b_check[sz1]= {false};
818  bool ddu_tr1_bad_check[sz1]= {false};
819  bool extraction=fedshort;
820 
821  //Summary vectors
822  //DDU
823  std::vector<int> ddu_h1_coll;
824  std::vector<int> ddu_h1_n_coll;
825  std::vector<int> ddu_h2_coll;
826  std::vector<int> ddu_h3_coll;
827  std::vector<int> ddu_t1_coll;
828  std::vector<int> ddu_t2_coll;
829  std::vector<int> ddu_t3_coll;
830  std::vector<int> ddu_l1a_coll;
831  std::vector<int> ddu_bxn_coll;
832  //DMB
833  std::vector<int> dmb_h1_coll;
834  std::vector<int> dmb_h2_coll;
835  std::vector<int> dmb_t1_coll;
836  std::vector<int> dmb_t2_coll;
837  std::vector<int> dmb_crate_coll;
838  std::vector<int> dmb_slot_coll;
839  std::vector<int> dmb_l1a_coll;
840  //ALCT
841  std::vector<int> alct_h1_coll;
842  std::vector<int> alct_h2_coll;
843  std::vector<int> alct_t1_coll;
844  std::vector<int> alct_l1a_coll;
845  std::vector<int> alct_bxn_coll;
846  std::vector<int> alct_wcnt1_coll;
847  std::vector<int> alct_wcnt2_coll;
848  std::vector<int> alct_wcnt2_id_coll;
849  //TMB
850  std::vector<int> tmb_h1_coll;
851  std::vector<int> tmb_t1_coll;
852  std::vector<int> tmb_l1a_coll;
853  std::vector<int> tmb_wcnt1_coll;
854  std::vector<int> tmb_wcnt2_coll;
855  //CFEB
856  std::vector<int> cfeb_t1_coll;
857 
858  //========================================================
859 
860  // DCC Header and Ttrailer information
861  char dcc_header1[]="DCC Header 1";
862  char dcc_header2[]="DCC Header 2";
863  char dcc_trail1[]="DCC Trailer 1", dcc_trail1_bit[]= {'e'};
864  char dcc_trail2[]="DCC Trailer 2", dcc_trail2_bit[]= {'a'};
865  //=========================================================
866 
867  for (int i=0; i < hl; i++)
868  {
869  ++word_numbering;
870  for (int j=-1; j<4; j++)
871  {
872 
873  sprintf(tempbuf_short,"%04x%04x%04x%04x",buf[i+4*(j-1)+3],buf[i+4*(j-1)+2],buf[i+4*(j-1)+1],buf[i+4*(j-1)]);
874 
875  // WARNING in 5_0_X for time being
876  ddu_h2_found++;
877  ddu_h2_found--;
878 
879  ddu_h2_check[j]=((buf[i+4*(j-1)+1]==0x8000)&&
880  (buf[i+4*(j-1)+2]==0x0001)&&(buf[i+4*(j-1)+3]==0x8000));
881 
882  ddu_tr1_check[j]=((tempbuf_short[0]==ddu_trailer1_bit[0])&&(tempbuf_short[1]==ddu_trailer1_bit[1])&&
883  (tempbuf_short[2]==ddu_trailer1_bit[2])&&(tempbuf_short[3]==ddu_trailer1_bit[3])&&
884  (tempbuf_short[4]==ddu_trailer1_bit[4])&&(tempbuf_short[5]==ddu_trailer1_bit[5])&&
885  (tempbuf_short[6]==ddu_trailer1_bit[6])&&(tempbuf_short[7]==ddu_trailer1_bit[7])&&
886  (tempbuf_short[8]==ddu_trailer1_bit[8])&&(tempbuf_short[9]==ddu_trailer1_bit[9])&&
887  (tempbuf_short[10]==ddu_trailer1_bit[10])&&(tempbuf_short[11]==ddu_trailer1_bit[11])&&
888  (tempbuf_short[12]==ddu_trailer1_bit[12])&&(tempbuf_short[13]==ddu_trailer1_bit[13])&&
889  (tempbuf_short[14]==ddu_trailer1_bit[14])&&(tempbuf_short[15]==ddu_trailer1_bit[15]));
890 
891  dmb_h1_check[j]=((tempbuf_short[0]==dmb_header1_bit[0])&&(tempbuf_short[4]==dmb_header1_bit[1])&&
892  (tempbuf_short[8]==dmb_header1_bit[2])&&(tempbuf_short[12]==dmb_header1_bit[3]));
893 
894  dmb_h2_check[j]=((tempbuf_short[0]==dmb_header2_bit[0])&&(tempbuf_short[4]==dmb_header2_bit[1])&&
895  (tempbuf_short[8]==dmb_header2_bit[2])&&(tempbuf_short[12]==dmb_header2_bit[3]));
896  alct_h1_check[j]=((tempbuf_short[0]==alct_header1_bit[0])&&(tempbuf_short[4]==alct_header1_bit[1])&&
897  (tempbuf_short[8]==alct_header1_bit[2])&&(tempbuf_short[12]==alct_header1_bit[3])&&
898  (tempbuf_short[13]==alct_header1_bit[4])&&(tempbuf_short[14]==alct_header1_bit[5])&&
899  (tempbuf_short[15]==alct_header1_bit[6]));
900  alct_h2_check[j]=(((tempbuf_short[0]==alct_header2_bit[0])&&(tempbuf_short[1]==alct_header2_bit[1])&&
901  (tempbuf_short[2]==alct_header2_bit[2])&&(tempbuf_short[3]==alct_header2_bit[3]))||
902  ((tempbuf_short[4]==alct_header2_bit[0])&&(tempbuf_short[5]==alct_header2_bit[1])&&
903  (tempbuf_short[6]==alct_header2_bit[2])&&(tempbuf_short[7]==alct_header2_bit[3]))||
904  ((tempbuf_short[8]==alct_header2_bit[0])&&(tempbuf_short[9]==alct_header2_bit[1])&&
905  (tempbuf_short[10]==alct_header2_bit[2])&&(tempbuf_short[11]==alct_header2_bit[3]))||
906  ((tempbuf_short[12]==alct_header2_bit[0])&&(tempbuf_short[13]==alct_header2_bit[1])&&
907  (tempbuf_short[14]==alct_header2_bit[2])&&(tempbuf_short[15]==alct_header2_bit[3]))
908  //(tempbuf_short[4]==alct_header2_bit[4])&&(tempbuf_short[5]==alct_header2_bit[5])
909  );
910  // ALCT Trailers
911  alct_tr1_check[j]=(((buf[i+4*(j-1)]&0xFFFF)==0xDE0D)&&((buf[i+4*(j-1)+1]&0xF800)==0xD000)&&
912  ((buf[i+4*(j-1)+2]&0xF800)==0xD000)&&((buf[i+4*(j-1)+3]&0xF000)==0xD000));
913  // DMB Trailers
914  dmb_tr1_check[j]=((tempbuf_short[0]==dmb_tr1_bit[0])&&(tempbuf_short[4]==dmb_tr1_bit[1])&&
915  (tempbuf_short[8]==dmb_tr1_bit[2])&&(tempbuf_short[12]==dmb_tr1_bit[3]));
916  dmb_tr2_check[j]=((tempbuf_short[0]==dmb_tr2_bit[0])&&(tempbuf_short[4]==dmb_tr2_bit[1])&&
917  (tempbuf_short[8]==dmb_tr2_bit[2])&&(tempbuf_short[12]==dmb_tr2_bit[3]));
918  // TMB
919  tmb_h1_check[j]=((tempbuf_short[0]==tmb_header1_bit[0])&&(tempbuf_short[4]==tmb_header1_bit[1])&&
920  (tempbuf_short[8]==tmb_header1_bit[2])&&(tempbuf_short[12]==tmb_header1_bit[3])&&
921  (tempbuf_short[13]==tmb_header1_bit[4])&&(tempbuf_short[14]==tmb_header1_bit[5])&&
922  (tempbuf_short[15]==tmb_header1_bit[6]));
923  tmb_tr1_check[j]=((tempbuf_short[0]==tmb_tr1_bit[0])&&(tempbuf_short[4]==tmb_tr1_bit[1])&&
924  (tempbuf_short[8]==tmb_tr1_bit[2])&&(tempbuf_short[12]==tmb_tr1_bit[3])&&
925  (tempbuf_short[13]==tmb_tr1_bit[4])&&(tempbuf_short[14]==tmb_tr1_bit[5])&&
926  (tempbuf_short[15]==tmb_tr1_bit[6]));
927  // CFEB
928  cfeb_tr1_check[j]=(((buf[i+4*(j-1)+1]&0xF000)==0x7000) &&
929  ((buf[i+4*(j-1)+2]&0xF000)==0x7000) &&
930  (( buf[i+4*(j-1)+1]!= 0x7FFF) || (buf[i+4*(j-1)+2] != 0x7FFF)) &&
931  ((buf[i+4*(j-1)+3] == 0x7FFF) ||
932  ((buf[i+4*(j-1)+3]&buf[i+4*(j-1)]) == 0x0&&(buf[i+4*(j-1)+3] + buf[i+4*(j-1)] == 0x7FFF ))) );
933  cfeb_b_check[j]=(((buf[i+4*(j-1)+3]&0xF000)==0xB000)&&((buf[i+4*(j-1)+2]&0xF000)==0xB000) &&
934  ((buf[i+4*(j-1)+1]&0xF000)==0xB000)&&((buf[i+4*(j-1)]=3&0xF000)==0xB000) );
935  // DDU Trailers with errors
936  ddu_tr1_bad_check[j]=((tempbuf_short[0]!=ddu_trailer1_bit[0])&&
937  //(tempbuf_short[1]!=ddu_trailer1_bit[1])&&(tempbuf_short[2]!=ddu_trailer1_bit[2])&&
938  //(tempbuf_short[3]==ddu_trailer1_bit[3])&&
939  (tempbuf_short[4]!=ddu_trailer1_bit[4])&&
940  //(tempbuf_short[5]==ddu_trailer1_bit[5])&&
941  //(tempbuf_short[6]==ddu_trailer1_bit[6])&&(tempbuf_short[7]==ddu_trailer1_bit[7])&&
942  (tempbuf_short[8]==ddu_trailer1_bit[8])&&(tempbuf_short[9]==ddu_trailer1_bit[9])&&
943  (tempbuf_short[10]==ddu_trailer1_bit[10])&&(tempbuf_short[11]==ddu_trailer1_bit[11])&&
944  (tempbuf_short[12]==ddu_trailer1_bit[12])&&(tempbuf_short[13]==ddu_trailer1_bit[13])&&
945  (tempbuf_short[14]==ddu_trailer1_bit[14])&&(tempbuf_short[15]==ddu_trailer1_bit[15]));
946  }
947 
948  // DDU Header 2 next to Header 1
949  ddu_h2_h1=ddu_h2_check[2];
950 
951  sprintf(tempbuf_short,"%04x%04x%04x%04x",buf[i+3],buf[i+2],buf[i+1],buf[i]);
952 
953  // Looking for DDU Header 1
954  ddu_h1_12_13=(buf[i]>>8);
955  for (int kk=0; kk<36; kk++)
956  {
957  if (((buf[i+3]&0xF000)==0x5000)&&(ddu_h1_12_13==ddu_id[kk])&&ddu_h2_h1)
958  {
959  ddu_h1_coll.push_back(word_numbering);
960  ddu_h1_n_coll.push_back(ddu_id[kk]);
961  ddu_inst_l1a=((buf[i+2]&0xFFFF)+((buf[i+3]&0x00FF)<<16));
962  ddu_l1a_coll.push_back(ddu_inst_l1a);
963  ddu_inst_bxn=(buf[i+1]&0xFFF0)>>4;
964  ddu_bxn_coll.push_back(ddu_inst_bxn);
965  sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s%i %s%s %s %i %s %i",
966  word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
967  sign1,ddu_common,ddu_id[kk],ddu_header1,sign1,dmb_common_l1a,ddu_inst_l1a,alct_common_bxn,ddu_inst_bxn);
968  std::cout << tempbuf1 << std::endl;
969  w=0;
970  ddu_h1_check=true;
971  ddu_inst_l1a=0;
972  cfeb_sample=0;
973  }
974  }
975 
976 
977 
978  // Looking for DCC Header 1
979  dcc_h1_id=(((buf[i+1]<<12)&0xF000)>>4)+(buf[i]>>8);
980  for (int dcci=0; dcci<16; dcci++)
981  {
982  if ((dcc_id[dcci]==dcc_h1_id)&&(((buf[i+3]&0xF000)==0x5000)&&(!ddu_h1_check)))
983  {
984  sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s%i %s",word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
985  sign1,dcc_common,dcc_h1_id,dcc_header1);
986  dcc_h1_check=word_numbering;
987  w=0;
988  dcc_check=true;
989  std::cout << tempbuf1 << std::endl;
990  }
991  }
992 
993  // Looking for DCC Header 2 and trailers
994  if (((word_numbering-1)==dcc_h1_check)&&((buf[i+3]&0xFF00)==0xD900))
995  {
996  sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s",word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
997  sign1,dcc_header2);
998  std::cout << tempbuf1 << std::endl;
999  w=0;
1000  }
1001  else if ((word_numbering==word_lines-1)&&(tempbuf_short[0]==dcc_trail1_bit[0]))
1002  {
1003  sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s",word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
1004  sign1,dcc_trail1);
1005  std::cout << tempbuf1 << std::endl;
1006  w=0;
1007  }
1008  else if ((word_numbering==word_lines)&&(tempbuf_short[0]==dcc_trail2_bit[0]))
1009  {
1010  sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s",word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
1011  sign1,dcc_trail2);
1012  std::cout << tempbuf1 << std::endl;
1013  w=0;
1014  }
1015 
1016  // DDU Header 2
1017  else if (ddu_h2_check[1])
1018  {
1019  ddu_inst_i = ddu_h1_n_coll.size(); //ddu_inst_n=ddu_h1_n_coll[0];
1020  if (ddu_inst_i>0)
1021  {
1022  ddu_inst_n=ddu_h1_n_coll[ddu_inst_i-1];
1023  }
1024  sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s%i %s",
1025  word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],sign1,ddu_common,
1026  ddu_inst_n, ddu_header2);
1027  ddu_h2_coll.push_back(word_numbering);
1028  std::cout << tempbuf1 << std::endl;
1029  w=0;
1030  ddu_h2_found=1;
1031  }
1032 
1033  // DDU Header 3 (either between DDU Header 2 DMB Header or DDU Header 2 DDU Trailer1)
1034  else if ((ddu_h2_check[0]&&dmb_h1_check[2])||(ddu_h2_check[0]&&ddu_tr1_check[2]))
1035  {
1036  ddu_inst_i = ddu_h1_n_coll.size();
1037  if (ddu_inst_i>0)
1038  {
1039  ddu_inst_n=ddu_h1_n_coll[ddu_inst_i-1];
1040  }
1041  sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s%i %s",word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
1042  sign1,ddu_common,ddu_inst_n,ddu_header3);
1043  ddu_h3_coll.push_back(word_numbering);
1044  std::cout << tempbuf1 << std::endl;
1045  w=0;
1046  ddu_h2_found=0;
1047  }
1048 
1049  // DMB Header 1,2
1050 
1051  else if (dmb_h1_check[1])
1052  {
1053  dmb_inst_crate=0;
1054  dmb_inst_slot=0;
1055  dmb_inst_l1a=0;
1056  dmb_inst_l1a=((buf[i]&0x0FFF)+((buf[i+1]&0xFFF)<<12));
1057  dmb_l1a_coll.push_back(dmb_inst_l1a);
1058  if (dmb_h2_check[2])
1059  {
1060  dmb_inst_crate=((buf[i+4+1]>>4)&0xFF);
1061  dmb_inst_slot=(buf[i+4+1]&0xF);
1062  dmb_crate_coll.push_back(dmb_inst_crate);
1063  dmb_slot_coll.push_back(dmb_inst_slot);
1064  }
1065  sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s %s%s%s %i %s %i %s %i",
1066  word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
1067  sign1,dmb_common,dmb_header1,sign1,dmb_common_crate,dmb_inst_crate,
1068  dmb_common_slot,dmb_inst_slot,dmb_common_l1a,dmb_inst_l1a);
1069  dmb_h1_coll.push_back(word_numbering);
1070  std::cout << tempbuf1 << std::endl;
1071  w=0;
1072  ddu_h2_found=1;
1073  }
1074 
1075  else if (dmb_h2_check[1])
1076  {
1077  dmb_inst_crate=((buf[i+1]>>4)&0xFF);
1078  dmb_inst_slot=(buf[i+1]&0xF);
1079  dmb_h2_coll.push_back(word_numbering);
1080  if (dmb_h1_check[0])
1081  dmb_inst_l1a=((buf[i-4]&0x0FFF)+((buf[i-4+1]&0xFFF)<<12));
1082  sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s %s%s%s %i %s %i %s %i",
1083  word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
1084  sign1,dmb_common,dmb_header2,sign1,dmb_common_crate,dmb_inst_crate,
1085  dmb_common_slot,dmb_inst_slot,dmb_common_l1a,dmb_inst_l1a);
1086  std::cout << tempbuf1 << std::endl;
1087  w=0;
1088  ddu_h2_found=1;
1089  }
1090 
1091  //DDU Trailer 1
1092 
1093  else if (ddu_tr1_check[1])
1094  {
1095  ddu_inst_i = ddu_h1_n_coll.size();
1096  if (ddu_inst_i>0)
1097  {
1098  ddu_inst_n=ddu_h1_n_coll[ddu_inst_i-1];
1099  }
1100  //ddu_inst_n=ddu_h1_n_coll[ddu_inst_i-1];
1101  sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s%i %s",
1102  word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],sign1,ddu_common,ddu_inst_n,ddu_trail1);
1103  ddu_t1_coll.push_back(word_numbering);
1104  std::cout << tempbuf1 << std::endl;
1105  w=0;
1106  }
1107 
1109  else if (alct_h1_check[1])
1110  {
1111  alct_start=word_numbering;
1112  alct_inst_l1a=(buf[i+2]&0x0FFF);
1113  alct_l1a_coll.push_back(alct_inst_l1a);
1114  sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s %s%s %s %i",
1115  word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
1116  sign1,alct_common,alct_header1,sign1,dmb_common_l1a,alct_inst_l1a);
1117  alct_h1_coll.push_back(word_numbering);
1118  std::cout << tempbuf1 << std::endl;
1119  w=0;
1120  alct_inst_l1a=0;
1121  }
1122 
1123  else if ((alct_h1_check[0])&&(alct_h2_check[2]))
1124  {
1125  alct_inst_bxn=(buf[i]&0x0FFF);
1126  alct_bxn_coll.push_back(alct_inst_bxn);
1127  sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s %s%s%s %i",
1128  word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
1129  sign1,alct_common,alct_header2,sign1,alct_common_bxn,alct_inst_bxn);
1130  alct_h2_coll.push_back(word_numbering);
1131  std::cout << tempbuf1 << std::endl;
1132  w=0;
1133  alct_inst_bxn=0;
1134  }
1135 
1136  //ALCT Trailer 1
1137  else if (alct_tr1_check[1])
1138  {
1139  alct_stop=word_numbering;
1140  if ((alct_start!=0)&&(alct_stop!=0)&&(alct_stop>alct_start))
1141  {
1142  alct_inst_wcnt2=4*(alct_stop-alct_start+1);
1143  alct_wcnt2_coll.push_back(alct_inst_wcnt2);
1144  alct_wcnt2_id_coll.push_back(alct_start);
1145  }
1146  alct_inst_wcnt1=(buf[i+3]&0x7FF);
1147  alct_wcnt1_coll.push_back(alct_inst_wcnt1);
1148  sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s %s%s%s %i %s %i",
1149  word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
1150  sign1,alct_common,alct_tr1,sign1,alct_common_wcnt1,alct_inst_wcnt1,
1151  alct_common_wcnt2,alct_inst_wcnt2);
1152  alct_t1_coll.push_back(word_numbering);
1153  std::cout << tempbuf1 << std::endl;
1154  w=0;
1155  alct_inst_wcnt1=0;
1156  alct_inst_wcnt2=0;
1157  }
1158 
1159  //DDU Trailer 3
1160 
1161 // else if ((ddu_tr1_check[-1])&&(tempbuf_short[0]==ddu_trailer3_bit[0])) { // !!! TO FIX: negative index
1162  else if((ddu_h2_h1)&&(tempbuf_short[0]==ddu_trailer3_bit[0])){
1163  //&&(tempbuf_short[0]==ddu_trailer3_bit[0])){
1164  ddu_inst_i = ddu_h1_n_coll.size();
1165  if (ddu_inst_i>0)
1166  {
1167  ddu_inst_n=ddu_h1_n_coll[ddu_inst_i-1];
1168  }
1169  //ddu_inst_n=ddu_h1_n_coll[ddu_inst_i-1];
1170  sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s%i %s",
1171  word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],sign1,ddu_common,ddu_inst_n,ddu_trail3);
1172  ddu_t3_coll.push_back(word_numbering);
1173  std::cout << tempbuf1 << std::endl;
1174  w=0;
1175  }
1176  //DDU Trailer 2
1177  else if ((ddu_tr1_check[0])&&(tempbuf_short[0]!=ddu_trailer3_bit[0]))
1178  {
1179  //&&(tempbuf_short[0]==ddu_trailer3_bit[0])){
1180  ddu_inst_i = ddu_h1_n_coll.size();
1181  if (ddu_inst_i>0)
1182  {
1183  ddu_inst_n=ddu_h1_n_coll[ddu_inst_i-1];
1184  }
1185  //ddu_inst_n=ddu_h1_n_coll[ddu_inst_i-1];
1186  sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s%i %s",
1187  word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],sign1,ddu_common,ddu_inst_n,ddu_trail2);
1188  ddu_t2_coll.push_back(word_numbering);
1189  std::cout << tempbuf1 << std::endl;
1190  w=0;
1191  }
1192 
1193  //DMB Trailer 1,2
1194  else if (dmb_tr1_check[1])
1195  {
1196  sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s %s",
1197  word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],sign1,dmb_common,dmb_tr1);
1198  dmb_t1_coll.push_back(word_numbering);
1199  std::cout << tempbuf1 << std::endl;
1200  w=0;
1201  cfeb_sample=0;
1202  }
1203 
1204  else if (dmb_tr2_check[1])
1205  {
1206  sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s %s",
1207  word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],sign1,dmb_common,dmb_tr2);
1208  dmb_t2_coll.push_back(word_numbering);
1209  std::cout << tempbuf1 << std::endl;
1210  w=0;
1211  }
1212  // TMB
1213  else if (tmb_h1_check[1])
1214  {
1215  tmb_start=word_numbering;
1216  tmb_inst_l1a=(buf[i+2]&0x000F);
1217  tmb_l1a_coll.push_back(tmb_inst_l1a);
1218  sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s %s%s%s %i",
1219  word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],sign1,tmb_common,tmb_header1,
1220  sign1,dmb_common_l1a,tmb_inst_l1a);
1221  tmb_h1_coll.push_back(word_numbering);
1222  std::cout << tempbuf1 << std::endl;
1223  w=0;
1224  tmb_inst_l1a=0;
1225  }
1226  else if (tmb_tr1_check[1])
1227  {
1228  tmb_stop=word_numbering;
1229  if ((tmb_start!=0)&&(tmb_stop!=0)&&(tmb_stop>tmb_start))
1230  {
1231  tmb_inst_wcnt2=4*(tmb_stop-tmb_start+1);
1232  tmb_wcnt2_coll.push_back(tmb_inst_wcnt2);
1233  }
1234  tmb_inst_wcnt1=(buf[i+3]&0x7FF);
1235  tmb_wcnt1_coll.push_back(tmb_inst_wcnt1);
1236  sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s %s%s%s %i %s %i",
1237  word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
1238  sign1,tmb_common,tmb_tr1,sign1,alct_common_wcnt1,tmb_inst_wcnt1,
1239  alct_common_wcnt2,tmb_inst_wcnt2);
1240  tmb_t1_coll.push_back(word_numbering);
1241  std::cout << tempbuf1 << std::endl;
1242  w=0;
1243  tmb_inst_wcnt2=0;
1244  }
1245  // CFEB
1246  else if (cfeb_tr1_check[1])
1247  {
1248  ++cfeb_sample;
1249  sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s %s%s %s %i",
1250  word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],
1251  sign1,cfeb_common,cfeb_tr1,sign1,cfeb_common_sample,cfeb_sample);
1252  cfeb_t1_coll.push_back(word_numbering);
1253  w=0;
1254  std::cout << tempbuf1 << std::endl;
1255  w=0;
1256  }
1257  else if (cfeb_b_check[1])
1258  {
1259  sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s %s",
1260  word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],sign1,cfeb_common,cfeb_b);
1261  std::cout << tempbuf1 << std::endl;
1262  w=0;
1263  }
1264 
1265  //ERRORS ddu_tr1_bad_check
1266 
1267  else if (ddu_tr1_bad_check[1])
1268  {
1269  ddu_inst_i = ddu_h1_n_coll.size();
1270  ddu_inst_n=ddu_h1_n_coll[ddu_inst_i-1];
1271  sprintf(tempbuf1,"%6i %04x %04x %04x %04x%s%s%i %s %s",
1272  word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i],sign1,ddu_common,ddu_inst_n,
1273  ddu_trail1,ddu_tr1_err_common);
1274  std::cout << tempbuf1 << std::endl;
1275  w=0;
1276  }
1277 
1278  else if (extraction&&(!ddu_h1_check)&&(!dcc_check))
1279  {
1280  if (w<3)
1281  {
1282  sprintf(tempbuf,"%6i %04x %04x %04x %04x",
1283  word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i]);
1284  std::cout << tempbuf << std::endl;
1285  w++;
1286  }
1287  if (w==3)
1288  {
1289  std::cout << "..................................................." << std::endl;
1290  w++;
1291  }
1292  }
1293 
1294  else if ((!ddu_h1_check)&&(!dcc_check))
1295  {
1296  sprintf(tempbuf,"%6i %04x %04x %04x %04x",word_numbering,buf[i+3],buf[i+2],buf[i+1],buf[i]);
1297  std::cout << tempbuf << std::endl;
1298  }
1299 
1300  i+=3;
1301  ddu_h1_check=false;
1302  dcc_check=false;
1303  }
1304  //char sign[30]; //WARNING 5_0_X
1305  std::cout <<"********************************************************************************" <<
1306  std::endl << std::endl;
1307  if (fedshort)
1308  std::cout << "For complete output turn off VisualFEDShort in muonCSCDigis configuration file." << std::endl;
1309  std::cout <<"********************************************************************************" <<
1310  std::endl << std::endl;
1311  std::cout << std::endl << std::endl;
1312  std::cout <<" Summary " << std::endl;
1313  std::cout << std::endl << std::endl;
1314  std::cout << ddu_h1_coll.size() <<" "<< ddu_common << " "<<ddu_header1 << " "<< "found" << std::endl;
1315  /*
1316  std::cout << ddu_h1_coll.size() << " " << ddu_h1_n_coll.size() << " " << ddu_l1a_coll.size() <<
1317  " " << ddu_bxn_coll.size() << std::endl;
1318  */
1319  for (unsigned int k=0; k<ddu_h1_coll.size(); ++k)
1320  {
1321  /*
1322  sprintf(sign,"%s%6i%5s %s%i %s %i %s %i","Line: ",
1323  ddu_h1_coll[k],sign1,ddu_common,ddu_h1_n_coll[k],dmb_common_l1a,ddu_l1a_coll[k],
1324  alct_common_bxn,ddu_bxn_coll[k]);
1325  */
1326  std::cout << "Line: " << " " << ddu_h1_coll[k] << " " << sign1 << " " <<
1327  ddu_common << " " << ddu_h1_n_coll[k] << " " << dmb_common_l1a << " " << ddu_l1a_coll[k] << " " <<
1328  alct_common_bxn << " " << ddu_bxn_coll[k] << std::endl;
1329  }
1330 
1331 
1332  std::cout << std::endl << std::endl;
1333  std::cout << "||||||||||||||||||||" << std::endl;
1334  std::cout << std::endl << std::endl;
1335  std::cout << ddu_h2_coll.size() <<" "<< ddu_common << " "<<ddu_header2 << " "<< "found" << std::endl;
1336  for (unsigned int k=0; k<ddu_h2_coll.size(); ++k)
1337  std::cout << "Line: " << ddu_h2_coll[k] << std::endl;
1338  std::cout << std::endl << std::endl;
1339  std::cout << "||||||||||||||||||||" << std::endl;
1340  std::cout << std::endl << std::endl;
1341  std::cout << ddu_h3_coll.size() <<" "<< ddu_common << " "<<ddu_header3 << " "<< "found" << std::endl;
1342  for (unsigned int k=0; k<ddu_h3_coll.size(); ++k)
1343  std::cout << "Line: " << ddu_h3_coll[k] << std::endl;
1344  std::cout << std::endl << std::endl;
1345  std::cout << "||||||||||||||||||||" << std::endl;
1346  std::cout << std::endl << std::endl;
1347  std::cout << ddu_t1_coll.size() <<" "<< ddu_common << " "<<ddu_trail1 << " "<< "found" << std::endl;
1348  for (unsigned int k=0; k<ddu_t1_coll.size(); ++k)
1349  std::cout << "Line: " << ddu_t1_coll[k] << std::endl;
1350  std::cout << std::endl << std::endl;
1351  std::cout << "||||||||||||||||||||" << std::endl;
1352  std::cout << std::endl << std::endl;
1353  std::cout << ddu_t2_coll.size() <<" "<< ddu_common << " "<<ddu_trail2 << " "<< "found" << std::endl;
1354  for (unsigned int k=0; k<ddu_t2_coll.size(); ++k)
1355  std::cout << "Line: " << ddu_t2_coll[k] << std::endl;
1356  std::cout << std::endl << std::endl;
1357  std::cout << "||||||||||||||||||||" << std::endl;
1358  std::cout << std::endl << std::endl;
1359  std::cout << ddu_t3_coll.size() <<" "<< ddu_common << " "<<ddu_trail3 << " "<< "found" << std::endl;
1360  for (unsigned int k=0; k<ddu_t3_coll.size(); ++k)
1361  std::cout << "Line: " << ddu_t3_coll[k] << std::endl;
1362  std::cout << std::endl << std::endl;
1363  std::cout << "||||||||||||||||||||" << std::endl;
1364  std::cout << std::endl << std::endl;
1365  std::cout << dmb_h1_coll.size() <<" "<< dmb_common << " "<<dmb_header1 << " "<< "found" << std::endl;
1366 
1367  for (unsigned int k=0; k<dmb_h1_coll.size(); ++k)
1368  {
1369  /*
1370  sprintf(sign,"%s%6i%5s %s %s %i %s %i %s %i","Line: ",
1371  dmb_h1_coll[k],sign1,dmb_common,dmb_common_crate,dmb_crate_coll[k],dmb_common_slot,
1372  dmb_slot_coll[k],dmb_common_l1a,dmb_l1a_coll[k]);
1373  */
1374  std::cout << "Line: " << " " << dmb_h1_coll[k] << " " << sign1 << dmb_common
1375  << " " << dmb_common_crate << " " << dmb_crate_coll[k] << " " << dmb_common_slot << " " <<
1376  dmb_slot_coll[k] << " " << dmb_common_l1a << " " << dmb_l1a_coll[k] << std::endl;
1377  }
1378  std::cout << std::endl << std::endl;
1379  std::cout << "||||||||||||||||||||" << std::endl;
1380  std::cout << std::endl << std::endl;
1381  std::cout << dmb_h2_coll.size() <<" "<< dmb_common << " "<<dmb_header2 << " "<< "found" << std::endl;
1382  for (unsigned int k=0; k<dmb_h2_coll.size(); ++k)
1383  std::cout << "Line: " << dmb_h2_coll[k] << std::endl;
1384  std::cout << std::endl << std::endl;
1385  std::cout << "||||||||||||||||||||" << std::endl;
1386  std::cout << std::endl << std::endl;
1387  std::cout << dmb_t1_coll.size() <<" "<< dmb_common << " "<<dmb_tr1 << " "<< "found" << std::endl;
1388  for (unsigned int k=0; k<dmb_t1_coll.size(); ++k)
1389  std::cout << "Line: " << dmb_t1_coll[k] << std::endl;
1390  std::cout << std::endl << std::endl;
1391  std::cout << "||||||||||||||||||||" << std::endl;
1392  std::cout << std::endl << std::endl;
1393  std::cout << dmb_t2_coll.size() <<" "<< dmb_common << " "<<dmb_tr2 << " "<< "found" << std::endl;
1394  for (unsigned int k=0; k<dmb_t2_coll.size(); ++k)
1395  std::cout << "Line: " << dmb_t2_coll[k] << std::endl;
1396  std::cout << std::endl << std::endl;
1397  std::cout << "||||||||||||||||||||" << std::endl;
1398  std::cout << std::endl << std::endl;
1399  std::cout << alct_h1_coll.size() <<" "<< alct_common << " "<<alct_header1 << " "<< "found" << std::endl;
1400  for (unsigned int k=0; k<alct_h1_coll.size(); ++k)
1401  {
1402  /*
1403  sprintf(sign,"%s%6i%5s %s %s %i","Line: ",
1404  alct_h1_coll[k],sign1,alct_common,
1405  dmb_common_l1a,alct_l1a_coll[k]);
1406  std::cout << sign << std::endl;
1407  */
1408  std::cout << "Line: " << " " <<
1409  alct_h1_coll[k] << " " << sign1 << " " << alct_common << " " <<
1410  dmb_common_l1a << " " << alct_l1a_coll[k] << std::endl;
1411  }
1412 
1413  std::cout << std::endl << std::endl;
1414  std::cout << "||||||||||||||||||||" << std::endl;
1415  std::cout << std::endl << std::endl;
1416  std::cout << alct_h2_coll.size() <<" "<< alct_common << " "<<alct_header2 << " "<< "found" << std::endl;
1417  for (unsigned int k=0; k<alct_h2_coll.size(); ++k)
1418  {
1419  /*
1420  sprintf(sign,"%s%6i%5s %s %s %i","Line: ",
1421  alct_h1_coll[k],sign1,alct_common,
1422  alct_common_bxn,alct_bxn_coll[k]);
1423  std::cout << sign << std::endl;
1424  */
1425  std::cout << "Line: " << " " <<
1426  alct_h1_coll[k] << " " << sign1 << " " << alct_common << " " <<
1427  alct_common_bxn << " " << alct_bxn_coll[k] << std::endl;
1428  }
1429 
1430  std::cout << std::endl << std::endl;
1431  std::cout << "||||||||||||||||||||" << std::endl;
1432  std::cout << std::endl << std::endl;
1433  std::cout << alct_t1_coll.size() <<" "<< alct_common << " "<<alct_tr1 << " "<< "found" << std::endl;
1434  for (unsigned int k=0; k<alct_t1_coll.size(); ++k)
1435  {
1436  /*
1437  sprintf(sign,"%s%6i%5s %s %s %i %s %i","Line: ",
1438  alct_t1_coll[k],sign1,alct_common,
1439  alct_common_wcnt1,alct_wcnt1_coll[k],alct_common_wcnt2,alct_wcnt2_coll[k]);
1440  std::cout << sign << std::endl;
1441  */
1442  std::cout << "Line: " << " " << alct_t1_coll[k] << " " << sign1 << " " << alct_common << " " <<
1443  alct_common_wcnt1 << " " << alct_wcnt1_coll[k] << " " << alct_common_wcnt2 << " ";
1444  if (alct_wcnt2_coll.size()>0)
1445  {
1446  std::cout << alct_wcnt2_coll[k] << std::endl;
1447  }
1448  else
1449  {
1450  std::cout << "Undefined (ALCT Header is not found) " << std::endl;
1451  }
1452  }
1453 
1454  std::cout << std::endl << std::endl;
1455  std::cout << "||||||||||||||||||||" << std::endl;
1456  std::cout << std::endl << std::endl;
1457  std::cout << tmb_h1_coll.size() <<" "<< tmb_common << " "<<tmb_header1 << " "<< "found" << std::endl;
1458  for (unsigned int k=0; k<tmb_h1_coll.size(); ++k)
1459  {
1460  /*
1461  sprintf(sign,"%s%6i%5s %s %s %i","Line: ",
1462  tmb_h1_coll[k],sign1,tmb_common,
1463  dmb_common_l1a,tmb_l1a_coll[k]);
1464  std::cout << sign << std::endl;
1465  */
1466  std::cout << "Line: " << " " << tmb_h1_coll[k] << " " << sign1 << " " << tmb_common << " " <<
1467  dmb_common_l1a << " " << tmb_l1a_coll[k] << std::endl;
1468  }
1469 
1470  std::cout << std::endl << std::endl;
1471  std::cout << "||||||||||||||||||||" << std::endl;
1472  std::cout << std::endl << std::endl;
1473  std::cout << tmb_t1_coll.size() <<" "<< tmb_common << " "<<tmb_tr1 << " "<< "found" << std::endl;
1474  for (unsigned int k=0; k<tmb_t1_coll.size(); ++k)
1475  {
1476  /*
1477  sprintf(sign,"%s%6i%5s %s %s %i %s %i","Line: ",
1478  tmb_t1_coll[k],sign1,tmb_common,
1479  alct_common_wcnt1,tmb_wcnt1_coll[k],alct_common_wcnt2,tmb_wcnt2_coll[k]);
1480  std::cout << sign << std::endl;
1481  */
1482  std::cout << "Line: " << " " << tmb_t1_coll[k] << " " << sign1 << " " << tmb_common << " " <<
1483  alct_common_wcnt1 << " " << tmb_wcnt1_coll[k] << " " << alct_common_wcnt2 << " " << tmb_wcnt2_coll[k]
1484  << std::endl;
1485  }
1486 
1487 
1488  std::cout << std::endl << std::endl;
1489  std::cout << "||||||||||||||||||||" << std::endl;
1490  std::cout << std::endl << std::endl;
1491  std::cout << cfeb_t1_coll.size() <<" "<< cfeb_common << " "<<cfeb_tr1 << " "<< "found" << std::endl;
1492  for (unsigned int k=0; k<cfeb_t1_coll.size(); ++k)
1493  std::cout << "Line: " << cfeb_t1_coll[k] << std::endl;
1494  std::cout <<"********************************************************************************" << std::endl;
1495 
1496 }
int i
Definition: DBlmapReader.cc:9
const double w
Definition: UKUtility.cc:23
int j
Definition: DBlmapReader.cc:9
tuple cout
Definition: gather_cfg.py:145

Member Data Documentation

bool CSCDCCUnpacker::debug
private
unsigned int CSCDCCUnpacker::errorMask
private

Definition at line 44 of file CSCDCCUnpacker.h.

Referenced by CSCDCCUnpacker(), and produce().

unsigned int CSCDCCUnpacker::examinerMask
private

Definition at line 44 of file CSCDCCUnpacker.h.

Referenced by CSCDCCUnpacker(), and produce().

bool CSCDCCUnpacker::formatedEventDump
private

Definition at line 39 of file CSCDCCUnpacker.h.

Referenced by CSCDCCUnpacker(), produce(), and visual_raw().

bool CSCDCCUnpacker::goodEvent
private

Definition at line 35 of file CSCDCCUnpacker.h.

Referenced by produce().

edm::EDGetTokenT<FEDRawDataCollection> CSCDCCUnpacker::i_token
private

Token for consumes interface & access to data.

Definition at line 49 of file CSCDCCUnpacker.h.

Referenced by CSCDCCUnpacker(), and produce().

bool CSCDCCUnpacker::instantiateDQM
private

Definition at line 45 of file CSCDCCUnpacker.h.

Referenced by CSCDCCUnpacker(), and produce().

CSCMonitorInterface* CSCDCCUnpacker::monitor
private

Definition at line 46 of file CSCDCCUnpacker.h.

Referenced by CSCDCCUnpacker(), produce(), and production_tasks.MonitorJobs::run().

int CSCDCCUnpacker::numOfEvents
private

Definition at line 43 of file CSCDCCUnpacker.h.

Referenced by produce().

bool CSCDCCUnpacker::printEventNumber
private

Definition at line 35 of file CSCDCCUnpacker.h.

Referenced by CSCDCCUnpacker(), and produce().

bool CSCDCCUnpacker::SuppressZeroLCT
private

Suppress zeros LCTs.

Definition at line 41 of file CSCDCCUnpacker.h.

Referenced by CSCDCCUnpacker(), and produce().

bool CSCDCCUnpacker::unpackStatusDigis
private

Definition at line 35 of file CSCDCCUnpacker.h.

Referenced by CSCDCCUnpacker(), and produce().

bool CSCDCCUnpacker::useExaminer
private

Definition at line 35 of file CSCDCCUnpacker.h.

Referenced by CSCDCCUnpacker(), and produce().

bool CSCDCCUnpacker::useFormatStatus
private

Definition at line 36 of file CSCDCCUnpacker.h.

Referenced by CSCDCCUnpacker(), and produce().

bool CSCDCCUnpacker::useSelectiveUnpacking
private

Definition at line 36 of file CSCDCCUnpacker.h.

Referenced by CSCDCCUnpacker(), and produce().

bool CSCDCCUnpacker::visualFEDInspect
private

Visualization of raw data.

Definition at line 39 of file CSCDCCUnpacker.h.

Referenced by CSCDCCUnpacker(), and produce().

bool CSCDCCUnpacker::visualFEDShort
private

Definition at line 39 of file CSCDCCUnpacker.h.

Referenced by CSCDCCUnpacker(), and produce().