CMS 3D CMS Logo

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)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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< FEDRawDataCollectioni_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, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
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, Utilities::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 & 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(), 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 
)

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

Definition at line 172 of file CSCDCCUnpacker.cc.

References trackerTree::check(), CSCDCCExaminer::check(), CSCDCCExaminer::crcALCT(), CSCDCCExaminer::crcCFEB(), CSCDCCExaminer::crcTMB(), FEDRawData::data(), data, CSCChamberMap::ddu(), debug, CSCCrateMap::detId(), CSCDCCExaminer::errName(), errorMask, CSCDCCExaminer::errors(), CSCDCCExaminer::errorsDetailed(), CSCDCCExaminer::errorsDetailedDDU(), edm::EventID::event(), examinerMask, FEDRawDataCollection::FEDData(), formatedEventDump, edm::EventSetup::get(), edm::Event::getByToken(), CSCDCCExaminer::getMask(), goodEvent, RecoTauValidation_cfi::header, mps_fire::i, i_token, hcalTTPDigis_cfi::id, edm::EventBase::id(), instantiateDQM, createfilelist::int, LogTrace, FEDNumbering::MAXCSCDDUFEDID, FEDNumbering::MAXCSCFEDID, FEDNumbering::MINCSCDDUFEDID, FEDNumbering::MINCSCFEDID, CSCDCCExaminer::modeDDU(), monitor, eostools::move(), CSCDCCExaminer::nERRORS, NULL, numOfEvents, CSCDCCExaminer::payloadDetailed(), printEventNumber, CSCMonitorInterface::process(), edm::ESHandle< T >::product(), edm::Event::put(), matplotRender::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  auto wireProduct = std::make_unique<CSCWireDigiCollection>();
196  auto stripProduct = std::make_unique<CSCStripDigiCollection>();
197  auto alctProduct = std::make_unique<CSCALCTDigiCollection>();
198  auto clctProduct = std::make_unique<CSCCLCTDigiCollection>();
199  auto comparatorProduct = std::make_unique<CSCComparatorDigiCollection>();
200  auto rpcProduct = std::make_unique<CSCRPCDigiCollection>();
201  auto corrlctProduct = std::make_unique<CSCCorrelatedLCTDigiCollection>();
202  auto cfebStatusProduct = std::make_unique<CSCCFEBStatusDigiCollection>();
203  auto dmbStatusProduct = std::make_unique<CSCDMBStatusDigiCollection>();
204  auto tmbStatusProduct = std::make_unique<CSCTMBStatusDigiCollection>();
205  auto dduStatusProduct = std::make_unique<CSCDDUStatusDigiCollection>();
206  auto dccStatusProduct = std::make_unique<CSCDCCStatusDigiCollection>();
207  auto alctStatusProduct = std::make_unique<CSCALCTStatusDigiCollection>();
208 
209  auto formatStatusProduct = std::make_unique<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 
413  for (unsigned int iCSC=0; iCSC<cscData.size(); ++iCSC) // loop over CSCs
414  {
415 
417  int vmecrate = cscData[iCSC].dmbHeader()->crateID();
418  int dmb = cscData[iCSC].dmbHeader()->dmbID();
419 
420  int icfeb = 0;
421  int ilayer = 0;
422 
423  if (debug)
424  LogTrace ("CSCDCCUnpacker|CSCRawToDigi") << "crate = " << vmecrate << "; dmb = " << dmb;
425 
426 
427 
428  if ((vmecrate>=1)&&(vmecrate<=60) && (dmb>=1)&&(dmb<=10)&&(dmb!=6))
429  {
430  layer = pcrate->detId(vmecrate, dmb,icfeb,ilayer );
431  }
432  else
433  {
434  LogTrace ("CSCDCCUnpacker|CSCRawToDigi") << " detID input out of range!!! ";
435  LogTrace ("CSCDCCUnpacker|CSCRawToDigi")
436  << " skipping chamber vme= " << vmecrate << " dmb= " << dmb;
437  continue; // to next iteration of iCSC loop
438  }
439 
440 
443  if (isDDU_FED)
444  {
445  unsigned int dduid = cscmapping->ddu(layer);
446  if ((dduid>=1) && (dduid <= 36)) dduid = postLS1_map[dduid-1]; // Fix for Post-LS1 FED/DDU IDs mappings
447  // std::cout << "CSC " << layer << " -> " << id << ":" << dduid << ":" << vmecrate << ":" << dmb ;
448  if (id != dduid )
449  {
450  LogTrace ("CSCDDUUnpacker|CSCRawToDigi") << " CSC->FED/DDU mapping inconsistency!!! ";
451  LogTrace ("CSCDCCUnpacker|CSCRawToDigi")
452  << "readout FED/DDU ID=" << id << " expected ID=" << dduid
453  << ", skipping chamber " << layer << " vme= " << vmecrate << " dmb= " << dmb;
454  continue;
455  }
456  }
457 
459  int nalct = cscData[iCSC].dmbHeader()->nalct();
460  bool goodALCT=false;
461  //if (nalct&&(cscData[iCSC].dataPresent>>6&0x1)==1) {
462  if (nalct&&cscData[iCSC].alctHeader())
463  {
464  if (cscData[iCSC].alctHeader()->check())
465  {
466  goodALCT=true;
467  }
468  else
469  {
470  LogTrace ("CSCDCCUnpacker|CSCRawToDigi") <<
471  "not storing ALCT digis; alct is bad or not present";
472  }
473  }
474  else
475  {
476  if (debug) LogTrace ("CSCDCCUnpacker|CSCRawToDigi") << "nALCT==0 !!!";
477  }
478 
480  if (goodALCT)
481  {
482  std::vector <CSCALCTDigi> alctDigis =
483  cscData[iCSC].alctHeader()->ALCTDigis();
484  if (SuppressZeroLCT)
485  {
486  std::vector<CSCALCTDigi> alctDigis_0;
487  for (int unsigned i=0; i<alctDigis.size(); ++i)
488  {
489  if (alctDigis[i].isValid())
490  alctDigis_0.push_back(alctDigis[i]);
491  }
492  alctProduct->move(std::make_pair(alctDigis_0.begin(), alctDigis_0.end()),layer);
493  }
494  else
495  alctProduct->move(std::make_pair(alctDigis.begin(), alctDigis.end()),layer);
496  }
497 
498 
500  int nclct = cscData[iCSC].dmbHeader()->nclct();
501  bool goodTMB=false;
502  // if (nclct&&(cscData[iCSC].dataPresent>>5&0x1)==1) {
503  if (nclct&&cscData[iCSC].tmbData())
504  {
505  if (cscData[iCSC].tmbHeader()->check())
506  {
507  if (cscData[iCSC].clctData()->check()) goodTMB=true;
508  }
509  else
510  {
511  LogTrace ("CSCDCCUnpacker|CSCRawToDigi") <<
512  "one of TMB checks failed! not storing TMB digis ";
513  }
514  }
515  else
516  {
517  if (debug) LogTrace ("CSCDCCUnpacker|CSCRawToDigi") << "nCLCT==0 !!!";
518  }
519 
521  if (goodTMB)
522  {
523  std::vector <CSCCorrelatedLCTDigi> correlatedlctDigis =
524  cscData[iCSC].tmbHeader()->CorrelatedLCTDigis(layer.rawId());
525  if (SuppressZeroLCT)
526  {
527  std::vector<CSCCorrelatedLCTDigi> correlatedlctDigis_0;
528  for (int unsigned i=0; i<correlatedlctDigis.size(); ++i)
529  {
530  if (correlatedlctDigis[i].isValid())
531  correlatedlctDigis_0.push_back(correlatedlctDigis[i]);
532  }
533  corrlctProduct->move(std::make_pair(correlatedlctDigis_0.begin(),
534  correlatedlctDigis_0.end()),layer);
535  }
536  else
537  corrlctProduct->move(std::make_pair(correlatedlctDigis.begin(),
538  correlatedlctDigis.end()),layer);
539 
540  std::vector <CSCCLCTDigi> clctDigis =
541  cscData[iCSC].tmbHeader()->CLCTDigis(layer.rawId());
542  if (SuppressZeroLCT)
543  {
544  std::vector<CSCCLCTDigi> clctDigis_0;
545  for (int unsigned i=0; i<clctDigis.size(); ++i)
546  {
547  if (clctDigis[i].isValid())
548  clctDigis_0.push_back(clctDigis[i]);
549  }
550  clctProduct->move(std::make_pair(clctDigis_0.begin(), clctDigis_0.end()),layer);
551  }
552  else
553  clctProduct->move(std::make_pair(clctDigis.begin(), clctDigis.end()),layer);
554 
556  if (cscData[iCSC].tmbData()->checkSize())
557  {
558  if (cscData[iCSC].tmbData()->hasRPC())
559  {
560  std::vector <CSCRPCDigi> rpcDigis =
561  cscData[iCSC].tmbData()->rpcData()->digis();
562  rpcProduct->move(std::make_pair(rpcDigis.begin(), rpcDigis.end()),layer);
563  }
564  }
565  else LogTrace("CSCDCCUnpacker|CSCRawToDigi") <<" TMBData check size failed!";
566  }
567 
568 
570  if (unpackStatusDigis)
571  {
572  for ( icfeb = 0; icfeb < 7; ++icfeb )
573  {
574  if ( cscData[iCSC].cfebData(icfeb) != NULL )
575  cfebStatusProduct->
576  insertDigi(layer, cscData[iCSC].cfebData(icfeb)->statusDigi());
577  }
579  dmbStatusProduct->insertDigi(layer, CSCDMBStatusDigi(cscData[iCSC].dmbHeader()->data(),
580  cscData[iCSC].dmbTrailer()->data()));
581  if (goodTMB) tmbStatusProduct->
582  insertDigi(layer, CSCTMBStatusDigi(cscData[iCSC].tmbHeader()->data(),
583  cscData[iCSC].tmbData()->tmbTrailer()->data()));
584  if (goodALCT) alctStatusProduct->
585  insertDigi(layer, CSCALCTStatusDigi(cscData[iCSC].alctHeader()->data(),
586  cscData[iCSC].alctTrailer()->data()));
587  }
588 
589 
591  for (int ilayer = 1; ilayer <= 6; ++ilayer)
592  {
594  // (You have to be kidding. Line 240 in whose universe?)
595 
596  // Allocate all ME1/1 wire digis to ring 1
597  layer = pcrate->detId( vmecrate, dmb, 0, ilayer );
598  {
599  std::vector <CSCWireDigi> wireDigis = cscData[iCSC].wireDigis(ilayer);
600  wireProduct->move(std::make_pair(wireDigis.begin(), wireDigis.end()),layer);
601  }
602 
603  for ( icfeb = 0; icfeb < 7; ++icfeb )
604  {
605  layer = pcrate->detId( vmecrate, dmb, icfeb,ilayer );
606  if (cscData[iCSC].cfebData(icfeb) && cscData[iCSC].cfebData(icfeb)->check())
607  {
608  std::vector<CSCStripDigi> stripDigis;
609  cscData[iCSC].cfebData(icfeb)->digis(layer.rawId(),stripDigis);
610  stripProduct->move(std::make_pair(stripDigis.begin(),
611  stripDigis.end()),layer);
612  }
613  }
614 
615 
616  if (goodTMB && (cscData[iCSC].tmbHeader() != NULL))
617  {
618  int nCFEBs = cscData[iCSC].tmbHeader()->NCFEBs();
619  for ( icfeb = 0; icfeb < nCFEBs; ++icfeb )
620  {
621  layer = pcrate->detId( vmecrate, dmb, icfeb,ilayer );
622  std::vector <CSCComparatorDigi> comparatorDigis =
623  cscData[iCSC].clctData()->comparatorDigis(layer.rawId(), icfeb);
624  // Set cfeb=0, so that ME1/a and ME1/b comparators go to
625  // ring 1.
626  layer = pcrate->detId( vmecrate, dmb, 0, ilayer );
627  comparatorProduct->move(std::make_pair(comparatorDigis.begin(),
628  comparatorDigis.end()),layer);
629  }
630  } // end of loop over cfebs
631  } // end of loop over layers
632  } // end of loop over chambers
633  } // endof loop over DDUs
634  } // end of good event
635  else
636  {
637  LogTrace("CSCDCCUnpacker|CSCRawToDigi") <<
638  "ERROR! Examiner rejected FED #" << id;
639  if (examiner)
640  {
641  for (int i=0; i<examiner->nERRORS; ++i)
642  {
643  if (((examinerMask&examiner->errors())>>i)&0x1)
644  LogTrace("CSCDCCUnpacker|CSCRawToDigi")<<examiner->errName(i);
645  }
646  if (debug)
647  {
648  LogTrace("CSCDCCUnpacker|CSCRawToDigi")
649  << " Examiner errors:0x" << std::hex << examiner->errors()
650  << " & 0x" << examinerMask
651  << " = " << (examiner->errors()&examinerMask);
652  }
653  }
654 
655  // dccStatusProduct->insertDigi(CSCDetId(1,1,1,1,1), CSCDCCStatusDigi(examiner->errors()));
656  // if(instantiateDQM) monitor->process(examiner, NULL);
657  }
658  if (examiner!=NULL) delete examiner;
659  } // end of if fed has data
660  } // end of loop over DCCs
661  // put into the event
662  e.put(std::move(wireProduct), "MuonCSCWireDigi");
663  e.put(std::move(stripProduct), "MuonCSCStripDigi");
664  e.put(std::move(alctProduct), "MuonCSCALCTDigi");
665  e.put(std::move(clctProduct), "MuonCSCCLCTDigi");
666  e.put(std::move(comparatorProduct), "MuonCSCComparatorDigi");
667  e.put(std::move(rpcProduct), "MuonCSCRPCDigi");
668  e.put(std::move(corrlctProduct), "MuonCSCCorrelatedLCTDigi");
669 
670  if (useFormatStatus) e.put(std::move(formatStatusProduct), "MuonCSCDCCFormatStatusDigi");
671 
672  if (unpackStatusDigis)
673  {
674  e.put(std::move(cfebStatusProduct), "MuonCSCCFEBStatusDigi");
675  e.put(std::move(dmbStatusProduct), "MuonCSCDMBStatusDigi");
676  e.put(std::move(tmbStatusProduct), "MuonCSCTMBStatusDigi");
677  e.put(std::move(dduStatusProduct), "MuonCSCDDUStatusDigi");
678  e.put(std::move(dccStatusProduct), "MuonCSCDCCStatusDigi");
679  e.put(std::move(alctStatusProduct), "MuonCSCALCTStatusDigi");
680  }
681  if (printEventNumber) LogTrace("CSCDCCUnpacker|CSCRawToDigi")
682  <<"[CSCDCCUnpacker]: " << numOfEvents << " events processed ";
683 }
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)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool SuppressZeroLCT
Suppress zeros LCTs.
void modeDDU(bool enable)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
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: Electron.h:4
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) ...
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
std::map< CSCIdType, ExaminerStatusType > errorsDetailed(void) const
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 & access to data.
unsigned int errorMask
unsigned int examinerMask
const T & get() const
Definition: EventSetup.h:56
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:60
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
def check(config)
Definition: trackerTree.py:14
T const * product() const
Definition: ESHandle.h:86
void setMask(ExaminerMaskType mask)
def move(src, dest)
Definition: eostools.py:510
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 688 of file CSCDCCUnpacker.cc.

References gather_cfg::cout, formatedEventDump, mps_fire::i, gen::k, GetRecoTauVFromDQM_MC_cff::kk, and w.

Referenced by produce().

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

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().