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 73 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.

73  :
74  numOfEvents(0)
75 {
76 
77  // Tracked
78  i_token = consumes<FEDRawDataCollection>( pset.getParameter<edm::InputTag>("InputObjects") );
79 
80  useExaminer = pset.getParameter<bool>("UseExaminer");
81  examinerMask = pset.getParameter<unsigned int>("ExaminerMask");
83  useSelectiveUnpacking = pset.getParameter<bool>("UseSelectiveUnpacking");
84  errorMask = pset.getParameter<unsigned int>("ErrorMask");
85  unpackStatusDigis = pset.getParameter<bool>("UnpackStatusDigis");
87  useFormatStatus = pset.getParameter<bool>("UseFormatStatus");
88 
89  // Untracked
90 
91  printEventNumber = pset.getUntrackedParameter<bool>("PrintEventNumber", true);
92  debug = pset.getUntrackedParameter<bool>("Debug", false);
93  instantiateDQM = pset.getUntrackedParameter<bool>("runDQM", false);
94 
96  visualFEDInspect = pset.getUntrackedParameter<bool>("VisualFEDInspect", false);
97  visualFEDShort = pset.getUntrackedParameter<bool>("VisualFEDShort", false);
98  formatedEventDump = pset.getUntrackedParameter<bool>("FormatedEventDump", false);
99 
101  SuppressZeroLCT = pset.getUntrackedParameter<bool>("SuppressZeroLCT", true);
102 
103 
104 
105  if (instantiateDQM)
106  {
108  }
109 
110  produces<CSCWireDigiCollection>("MuonCSCWireDigi");
111  produces<CSCStripDigiCollection>("MuonCSCStripDigi");
112  produces<CSCComparatorDigiCollection>("MuonCSCComparatorDigi");
113  produces<CSCALCTDigiCollection>("MuonCSCALCTDigi");
114  produces<CSCCLCTDigiCollection>("MuonCSCCLCTDigi");
115  produces<CSCRPCDigiCollection>("MuonCSCRPCDigi");
116  produces<CSCCorrelatedLCTDigiCollection>("MuonCSCCorrelatedLCTDigi");
117 
118  if (unpackStatusDigis)
119  {
120  produces<CSCCFEBStatusDigiCollection>("MuonCSCCFEBStatusDigi");
121  produces<CSCTMBStatusDigiCollection>("MuonCSCTMBStatusDigi");
122  produces<CSCDMBStatusDigiCollection>("MuonCSCDMBStatusDigi");
123  produces<CSCALCTStatusDigiCollection>("MuonCSCALCTStatusDigi");
124  produces<CSCDDUStatusDigiCollection>("MuonCSCDDUStatusDigi");
125  produces<CSCDCCStatusDigiCollection>("MuonCSCDCCStatusDigi");
126  }
127 
128  if (useFormatStatus)
129  {
130  produces<CSCDCCFormatStatusDigiCollection>("MuonCSCDCCFormatStatusDigi");
131  }
132  //CSCAnodeData::setDebug(debug);
142 
143 }
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:114
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 145 of file CSCDCCUnpacker.cc.

146 {
147  //fill destructor here
148 }

Member Function Documentation

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

Definition at line 150 of file CSCDCCUnpacker.cc.

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

150  {
152  desc.add<edm::InputTag>("InputObjects",edm::InputTag("rawDataCollector"))->setComment("# Define input to the unpacker");
153  desc.add<bool>("UseExaminer",true)->setComment("# Use CSC examiner to check for corrupt or semi-corrupt data & avoid unpacker crashes");
154  desc.add<unsigned int>("ExaminerMask",535557110)->setComment("# This mask is needed by the examiner");
155  desc.add<bool>("UseSelectiveUnpacking",true)->setComment("# Use Examiner to unpack good chambers and skip only bad ones");
156  desc.add<unsigned int>("ErrorMask",0)->setComment("# This mask simply reduces error reporting");
157  desc.add<bool>("UnpackStatusDigis",false)->setComment("# Unpack general status digis?");
158  desc.add<bool>("UseFormatStatus",true)->setComment("# Unpack FormatStatus digi?");
159  desc.addUntracked<bool>("Debug",false)->setComment("# Turn on lots of output");
160  desc.addUntracked<bool>("PrintEventNumber",false);
161  desc.addUntracked<bool>("runDQM",false);
162  desc.addUntracked<bool>("VisualFEDInspect",false)->setComment("# Visualization of raw data in corrupted events");
163  desc.addUntracked<bool>("VisualFEDShort",false)->setComment("# Visualization of raw data in corrupted events");
164  desc.addUntracked<bool>("FormatedEventDump",false);
165  desc.addUntracked<bool>("SuppressZeroLCT",true);
166  descriptions.add("muonCSCDCCUnpacker",desc);
167  descriptions.setComment(" This is the generic cfi file for CSC unpacking");
168 }
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

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 170 of file CSCDCCUnpacker.cc.

References DDVectorGetter::check(), CSCDCCExaminer::check(), CSCDCCExaminer::crcALCT(), CSCDCCExaminer::crcCFEB(), CSCDCCExaminer::crcTMB(), CSCDetId, FEDRawData::data(), data, 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().

171 {
172 
174  // Do we really have to do this every event???
175  // ... Yes, because framework is more efficient than you are at caching :)
176  // (But if you want to actually DO something specific WHEN the mapping changes, check out ESWatcher)
178  c.get<CSCCrateMapRcd>().get(hcrate);
179  const CSCCrateMap* pcrate = hcrate.product();
180 
181 
183 
186  e.getByToken( i_token, rawdata);
187 
189  std::auto_ptr<CSCWireDigiCollection> wireProduct(new CSCWireDigiCollection);
190  std::auto_ptr<CSCStripDigiCollection> stripProduct(new CSCStripDigiCollection);
191  std::auto_ptr<CSCALCTDigiCollection> alctProduct(new CSCALCTDigiCollection);
192  std::auto_ptr<CSCCLCTDigiCollection> clctProduct(new CSCCLCTDigiCollection);
193  std::auto_ptr<CSCComparatorDigiCollection> comparatorProduct(new CSCComparatorDigiCollection);
194  std::auto_ptr<CSCRPCDigiCollection> rpcProduct(new CSCRPCDigiCollection);
195  std::auto_ptr<CSCCorrelatedLCTDigiCollection> corrlctProduct(new CSCCorrelatedLCTDigiCollection);
196  std::auto_ptr<CSCCFEBStatusDigiCollection> cfebStatusProduct(new CSCCFEBStatusDigiCollection);
197  std::auto_ptr<CSCDMBStatusDigiCollection> dmbStatusProduct(new CSCDMBStatusDigiCollection);
198  std::auto_ptr<CSCTMBStatusDigiCollection> tmbStatusProduct(new CSCTMBStatusDigiCollection);
199  std::auto_ptr<CSCDDUStatusDigiCollection> dduStatusProduct(new CSCDDUStatusDigiCollection);
200  std::auto_ptr<CSCDCCStatusDigiCollection> dccStatusProduct(new CSCDCCStatusDigiCollection);
201  std::auto_ptr<CSCALCTStatusDigiCollection> alctStatusProduct(new CSCALCTStatusDigiCollection);
202 
203  std::auto_ptr<CSCDCCFormatStatusDigiCollection> formatStatusProduct(new CSCDCCFormatStatusDigiCollection);
204 
205 
206  // If set selective unpacking mode
207  // hardcoded examiner mask below to check for DCC and DDU level errors will be used first
208  // then examinerMask for CSC level errors will be used during unpacking of each CSC block
209  unsigned long dccBinCheckMask = 0x06080016;
210 
211 
212  // 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
213  std::vector<unsigned int> cscFEDids;
214 
215  for (unsigned int id=FEDNumbering::MINCSCFEDID;
216  id<=FEDNumbering::MAXCSCFEDID; ++id) // loop over DCCs
217  {
218  cscFEDids.push_back(id);
219  }
220 
221  for (unsigned int id=FEDNumbering::MINCSCDDUFEDID;
222  id<=FEDNumbering::MAXCSCDDUFEDID; ++id) // loop over DDUs
223  {
224  cscFEDids.push_back(id);
225  }
226 
227  for (unsigned int i=0; i<cscFEDids.size(); i++) // loop over all CSC FEDs (DCCs and DDUs)
228  {
229  unsigned int id = cscFEDids[i];
230  bool isDDU_FED = ((id >= FEDNumbering::MINCSCDDUFEDID) && (id <= FEDNumbering::MAXCSCDDUFEDID))?true:false;
231 
232 
235 
237  const FEDRawData& fedData = rawdata->FEDData(id);
238  unsigned long length = fedData.size();
239 
240 
241  if (length>=32)
242  {
243  CSCDCCExaminer* examiner = NULL;
244  goodEvent = true;
245  if (useExaminer)
246  {
247  // CSCDCCExaminer examiner;
248  examiner = new CSCDCCExaminer();
249  if ( examinerMask&0x40000 ) examiner->crcCFEB(1);
250  if ( examinerMask&0x8000 ) examiner->crcTMB (1);
251  if ( examinerMask&0x0400 ) examiner->crcALCT(1);
252  examiner->setMask(examinerMask);
253 
255  if ( isDDU_FED )
256  {
257  if (examiner != NULL) examiner->modeDDU(true);
258  }
259 
260  const short unsigned int *data = (short unsigned int *)fedData.data();
261 
262  LogTrace("badData") << "Length: "<< length/2;
263  // Event data hex dump
264  /*
265  short unsigned * buf = (short unsigned int *)fedData.data();
266  std::cout <<std::endl<<length/2<<" words of data:"<<std::endl;
267  for (short unsigned int i=0;i<length/2;i++) {
268  printf("%04x %04x %04x %04x\n",buf[i+3],buf[i+2],buf[i+1],buf[i]);
269  i+=3;
270  }
271  */
272 
273  int res = examiner->check(data,long(fedData.size()/2));
274  if ( res < 0 )
275  {
276  goodEvent=false;
277  }
278  else
279  {
280  if (useSelectiveUnpacking) goodEvent=!(examiner->errors()&dccBinCheckMask);
281  else goodEvent=!(examiner->errors()&examinerMask);
282  }
283 
284  /*
285  std::cout << "FED" << id << " " << fedData.size() << " " << goodEvent << " "
286  << std::hex << examiner->errors() << std::dec << " " << status << std::endl;
287  */
288 
289  // Fill Format status digis per FED
290  // Remove examiner->errors() != 0 check if we need to put status digis for every event
291  if (useFormatStatus && (examiner->errors() !=0))
292  // formatStatusProduct->insertDigi(CSCDetId(1,1,1,1,1), CSCDCCFormatStatusDigi(id,examiner,dccBinCheckMask));
293  formatStatusProduct->insertDigi(CSCDetId(1,1,1,1,1),
294  CSCDCCFormatStatusDigi(id,dccBinCheckMask,
295  examiner->getMask(),
296  examiner->errors(),
297  examiner->errorsDetailedDDU(),
298  examiner->errorsDetailed(),
299  examiner->payloadDetailed(),
300  examiner->statusDetailed()));
301  }
302 
305  {
307  {
308  short unsigned * buf = (short unsigned int *)fedData.data();
309  visual_raw(length/2, id,(int)e.id().run(),(int)e.id().event(),
311  }
312  }
313 
314  if (goodEvent)
315  {
317 
318 
319  CSCDCCExaminer * ptrExaminer = examiner;
320  if (!useSelectiveUnpacking) ptrExaminer = NULL;
321 
322 
323 
324  std::vector<CSCDDUEventData> fed_Data;
325  std::vector<CSCDDUEventData>* ptr_fedData = &fed_Data;
326 
328  CSCDetId layer(1, 1, 1, 1, 1);
329 
330  if (isDDU_FED) // Use new DDU FED readout mode
331  {
332 
333  CSCDDUEventData single_dduData((short unsigned int *) fedData.data(), ptrExaminer);
334  fed_Data.push_back(single_dduData);
335 
336 
337  // if(instantiateDQM) monitor->process(examiner, &single_dduData);
338 
339 
340  }
341  else // Use old DCC FED readout mode
342  {
343 
344  CSCDCCEventData dccData((short unsigned int *) fedData.data(), ptrExaminer);
345 
346  //std::cout << " DCC Size [UNPK] " << dccData.sizeInWords() << std::endl;
347 
348  if (instantiateDQM) monitor->process(examiner, &dccData);
349 
351  // const std::vector<CSCDDUEventData> & dduData = dccData.dduData();
352  // ptr_fedData = &(dccData.dduData());
353  fed_Data = dccData.dduData();
354 
355 
356  if (unpackStatusDigis)
357  {
358 
360  short unsigned * bufForDcc = (short unsigned int *)fedData.data();
361 
362  //std::cout << "FED Length: " << std::dec << length/2 <<
363  //" Trailer 2: " << std::hex << bufForDcc[length/2-4] << std::endl;
364 
365  dccStatusProduct->insertDigi(layer, CSCDCCStatusDigi(dccData.dccHeader().data(),
366  dccData.dccTrailer().data(),
367  examiner->errors(),
368  bufForDcc[length/2-4]));
369 
370  }
371  }
372 
373  const std::vector<CSCDDUEventData> & dduData = *ptr_fedData;
374 
375 
376  for (unsigned int iDDU=0; iDDU<dduData.size(); ++iDDU) // loop over DDUs
377  {
378 
379 
382  if (dduData[iDDU].trailer().errorstat()&errorMask)
383  {
384  LogTrace("CSCDCCUnpacker|CSCRawToDigi") << "FED ID" << id << " DDU# " << iDDU << " has serious error - no digis unpacked! " <<
385  std::hex << dduData[iDDU].trailer().errorstat();
386  continue; // to next iteration of DDU loop
387  }
388 
389  if (unpackStatusDigis) dduStatusProduct->
390  insertDigi(layer, CSCDDUStatusDigi(dduData[iDDU].header().data(),
391  dduData[iDDU].trailer().data(),
393  dduData[iDDU].trailer0()));
394 
396  const std::vector<CSCEventData> & cscData = dduData[iDDU].cscData();
397 
398  // 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;
399 
400 
401  for (unsigned int iCSC=0; iCSC<cscData.size(); ++iCSC) // loop over CSCs
402  {
403 
405  int vmecrate = cscData[iCSC].dmbHeader()->crateID();
406  int dmb = cscData[iCSC].dmbHeader()->dmbID();
407 
408  int icfeb = 0;
409  int ilayer = 0;
410 
411  if (debug)
412  LogTrace ("CSCDCCUnpacker|CSCRawToDigi") << "crate = " << vmecrate << "; dmb = " << dmb;
413 
414 
415 
416  if ((vmecrate>=1)&&(vmecrate<=60) && (dmb>=1)&&(dmb<=10)&&(dmb!=6))
417  {
418  layer = pcrate->detId(vmecrate, dmb,icfeb,ilayer );
419  }
420  else
421  {
422  LogTrace ("CSCDCCUnpacker|CSCRawToDigi") << " detID input out of range!!! ";
423  LogTrace ("CSCDCCUnpacker|CSCRawToDigi")
424  << " skipping chamber vme= " << vmecrate << " dmb= " << dmb;
425  continue; // to next iteration of iCSC loop
426  }
427 
428 
429  // std::cout << "crate = " << vmecrate << "; dmb = " << dmb << " format version = " << cscData[iCSC].getFormatVersion() << std::endl;
430 
432  int nalct = cscData[iCSC].dmbHeader()->nalct();
433  bool goodALCT=false;
434  //if (nalct&&(cscData[iCSC].dataPresent>>6&0x1)==1) {
435  if (nalct&&cscData[iCSC].alctHeader())
436  {
437  if (cscData[iCSC].alctHeader()->check())
438  {
439  goodALCT=true;
440  }
441  else
442  {
443  LogTrace ("CSCDCCUnpacker|CSCRawToDigi") <<
444  "not storing ALCT digis; alct is bad or not present";
445  }
446  }
447  else
448  {
449  if (debug) LogTrace ("CSCDCCUnpacker|CSCRawToDigi") << "nALCT==0 !!!";
450  }
451 
453  if (goodALCT)
454  {
455  std::vector <CSCALCTDigi> alctDigis =
456  cscData[iCSC].alctHeader()->ALCTDigis();
457  if (SuppressZeroLCT)
458  {
459  std::vector<CSCALCTDigi> alctDigis_0;
460  for (int unsigned i=0; i<alctDigis.size(); ++i)
461  {
462  if (alctDigis[i].isValid())
463  alctDigis_0.push_back(alctDigis[i]);
464  }
465  alctProduct->move(std::make_pair(alctDigis_0.begin(), alctDigis_0.end()),layer);
466  }
467  else
468  alctProduct->move(std::make_pair(alctDigis.begin(), alctDigis.end()),layer);
469  }
470 
471 
473  int nclct = cscData[iCSC].dmbHeader()->nclct();
474  bool goodTMB=false;
475  // if (nclct&&(cscData[iCSC].dataPresent>>5&0x1)==1) {
476  if (nclct&&cscData[iCSC].tmbData())
477  {
478  if (cscData[iCSC].tmbHeader()->check())
479  {
480  if (cscData[iCSC].clctData()->check()) goodTMB=true;
481  }
482  else
483  {
484  LogTrace ("CSCDCCUnpacker|CSCRawToDigi") <<
485  "one of TMB checks failed! not storing TMB digis ";
486  }
487  }
488  else
489  {
490  if (debug) LogTrace ("CSCDCCUnpacker|CSCRawToDigi") << "nCLCT==0 !!!";
491  }
492 
494  if (goodTMB)
495  {
496  std::vector <CSCCorrelatedLCTDigi> correlatedlctDigis =
497  cscData[iCSC].tmbHeader()->CorrelatedLCTDigis(layer.rawId());
498  if (SuppressZeroLCT)
499  {
500  std::vector<CSCCorrelatedLCTDigi> correlatedlctDigis_0;
501  for (int unsigned i=0; i<correlatedlctDigis.size(); ++i)
502  {
503  if (correlatedlctDigis[i].isValid())
504  correlatedlctDigis_0.push_back(correlatedlctDigis[i]);
505  }
506  corrlctProduct->move(std::make_pair(correlatedlctDigis_0.begin(),
507  correlatedlctDigis_0.end()),layer);
508  }
509  else
510  corrlctProduct->move(std::make_pair(correlatedlctDigis.begin(),
511  correlatedlctDigis.end()),layer);
512 
513  std::vector <CSCCLCTDigi> clctDigis =
514  cscData[iCSC].tmbHeader()->CLCTDigis(layer.rawId());
515  if (SuppressZeroLCT)
516  {
517  std::vector<CSCCLCTDigi> clctDigis_0;
518  for (int unsigned i=0; i<clctDigis.size(); ++i)
519  {
520  if (clctDigis[i].isValid())
521  clctDigis_0.push_back(clctDigis[i]);
522  }
523  clctProduct->move(std::make_pair(clctDigis_0.begin(), clctDigis_0.end()),layer);
524  }
525  else
526  clctProduct->move(std::make_pair(clctDigis.begin(), clctDigis.end()),layer);
527 
529  if (cscData[iCSC].tmbData()->checkSize())
530  {
531  if (cscData[iCSC].tmbData()->hasRPC())
532  {
533  std::vector <CSCRPCDigi> rpcDigis =
534  cscData[iCSC].tmbData()->rpcData()->digis();
535  rpcProduct->move(std::make_pair(rpcDigis.begin(), rpcDigis.end()),layer);
536  }
537  }
538  else LogTrace("CSCDCCUnpacker|CSCRawToDigi") <<" TMBData check size failed!";
539  }
540 
541 
543  if (unpackStatusDigis)
544  {
545  for ( icfeb = 0; icfeb < 7; ++icfeb )
546  {
547  if ( cscData[iCSC].cfebData(icfeb) != NULL )
548  cfebStatusProduct->
549  insertDigi(layer, cscData[iCSC].cfebData(icfeb)->statusDigi());
550  }
552  dmbStatusProduct->insertDigi(layer, CSCDMBStatusDigi(cscData[iCSC].dmbHeader()->data(),
553  cscData[iCSC].dmbTrailer()->data()));
554  if (goodTMB) tmbStatusProduct->
555  insertDigi(layer, CSCTMBStatusDigi(cscData[iCSC].tmbHeader()->data(),
556  cscData[iCSC].tmbData()->tmbTrailer()->data()));
557  if (goodALCT) alctStatusProduct->
558  insertDigi(layer, CSCALCTStatusDigi(cscData[iCSC].alctHeader()->data(),
559  cscData[iCSC].alctTrailer()->data()));
560  }
561 
562 
564  for (int ilayer = 1; ilayer <= 6; ++ilayer)
565  {
567  // (You have to be kidding. Line 240 in whose universe?)
568 
569  // Allocate all ME1/1 wire digis to ring 1
570  layer = pcrate->detId( vmecrate, dmb, 0, ilayer );
571  {
572  std::vector <CSCWireDigi> wireDigis = cscData[iCSC].wireDigis(ilayer);
573  wireProduct->move(std::make_pair(wireDigis.begin(), wireDigis.end()),layer);
574  }
575 
576  for ( icfeb = 0; icfeb < 7; ++icfeb )
577  {
578  layer = pcrate->detId( vmecrate, dmb, icfeb,ilayer );
579  if (cscData[iCSC].cfebData(icfeb) && cscData[iCSC].cfebData(icfeb)->check())
580  {
581  std::vector<CSCStripDigi> stripDigis;
582  cscData[iCSC].cfebData(icfeb)->digis(layer.rawId(),stripDigis);
583  stripProduct->move(std::make_pair(stripDigis.begin(),
584  stripDigis.end()),layer);
585  }
586  }
587 
588 
589  if (goodTMB && (cscData[iCSC].tmbHeader() != NULL))
590  {
591  int nCFEBs = cscData[iCSC].tmbHeader()->NCFEBs();
592  for ( icfeb = 0; icfeb < nCFEBs; ++icfeb )
593  {
594  layer = pcrate->detId( vmecrate, dmb, icfeb,ilayer );
595  std::vector <CSCComparatorDigi> comparatorDigis =
596  cscData[iCSC].clctData()->comparatorDigis(layer.rawId(), icfeb);
597  // Set cfeb=0, so that ME1/a and ME1/b comparators go to
598  // ring 1.
599  layer = pcrate->detId( vmecrate, dmb, 0, ilayer );
600  comparatorProduct->move(std::make_pair(comparatorDigis.begin(),
601  comparatorDigis.end()),layer);
602  }
603  } // end of loop over cfebs
604  } // end of loop over layers
605  } // end of loop over chambers
606  } // endof loop over DDUs
607  } // end of good event
608  else
609  {
610  LogTrace("CSCDCCUnpacker|CSCRawToDigi") <<
611  "ERROR! Examiner rejected FED #" << id;
612  if (examiner)
613  {
614  for (int i=0; i<examiner->nERRORS; ++i)
615  {
616  if (((examinerMask&examiner->errors())>>i)&0x1)
617  LogTrace("CSCDCCUnpacker|CSCRawToDigi")<<examiner->errName(i);
618  }
619  if (debug)
620  {
621  LogTrace("CSCDCCUnpacker|CSCRawToDigi")
622  << " Examiner errors:0x" << std::hex << examiner->errors()
623  << " & 0x" << examinerMask
624  << " = " << (examiner->errors()&examinerMask);
625  }
626  }
627 
628  // dccStatusProduct->insertDigi(CSCDetId(1,1,1,1,1), CSCDCCStatusDigi(examiner->errors()));
629  // if(instantiateDQM) monitor->process(examiner, NULL);
630  }
631  if (examiner!=NULL) delete examiner;
632  } // end of if fed has data
633  } // end of loop over DCCs
634  // put into the event
635  e.put(wireProduct, "MuonCSCWireDigi");
636  e.put(stripProduct, "MuonCSCStripDigi");
637  e.put(alctProduct, "MuonCSCALCTDigi");
638  e.put(clctProduct, "MuonCSCCLCTDigi");
639  e.put(comparatorProduct, "MuonCSCComparatorDigi");
640  e.put(rpcProduct, "MuonCSCRPCDigi");
641  e.put(corrlctProduct, "MuonCSCCorrelatedLCTDigi");
642 
643  if (useFormatStatus) e.put(formatStatusProduct, "MuonCSCDCCFormatStatusDigi");
644 
645  if (unpackStatusDigis)
646  {
647  e.put(cfebStatusProduct, "MuonCSCCFEBStatusDigi");
648  e.put(dmbStatusProduct, "MuonCSCDMBStatusDigi");
649  e.put(tmbStatusProduct, "MuonCSCTMBStatusDigi");
650  e.put(dduStatusProduct, "MuonCSCDDUStatusDigi");
651  e.put(dccStatusProduct, "MuonCSCDCCStatusDigi");
652  e.put(alctStatusProduct, "MuonCSCALCTStatusDigi");
653  }
654  if (printEventNumber) LogTrace("CSCDCCUnpacker|CSCRawToDigi")
655  <<"[CSCDCCUnpacker]: " << numOfEvents << " events processed ";
656 }
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
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
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
bool check(const std::string &)
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 661 of file CSCDCCUnpacker.cc.

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

Referenced by produce().

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