Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ctpps pixel unpacker #18103

Merged
merged 40 commits into from Apr 13, 2017
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
d957c4c
CTPPS pixel unpacker
fabferro Mar 24, 2017
6a9d719
correct link to xml file
fabferro Mar 24, 2017
3ffbc84
CTPPS->ctpps
fabferro Mar 24, 2017
71f7280
->rawDataCollector
fabferro Mar 24, 2017
5db56c8
correct xml
fabferro Mar 24, 2017
c576174
check map conversion errors
fabferro Mar 24, 2017
cda51ca
added test for pixels
fabferro Mar 27, 2017
9d758de
fixing logdebug
fabferro Mar 27, 2017
e6e2d90
commenting unused constants
fabferro Mar 29, 2017
45e368f
safeguard from using null pointer
fabferro Mar 29, 2017
517cae7
removing cout and cerr
fabferro Apr 1, 2017
d045aac
data file from afs to eos
fabferro Apr 1, 2017
606b681
adding message logger
fabferro Apr 1, 2017
342a7be
include guard matching the full file name
fabferro Apr 5, 2017
e618c01
removed public init call in CTPPSPixelDigi
fabferro Apr 5, 2017
ba51196
improved readability
fabferro Apr 5, 2017
a6abc05
boost/cstdint.hpp -> cstdint
fabferro Apr 5, 2017
2563a6b
using auto for iterators
fabferro Apr 5, 2017
9309f85
null masked channel map
fabferro Apr 5, 2017
1625406
data from first tests in P5
fabferro Apr 5, 2017
c6082a4
cms_uint -> uint
fabferro Apr 5, 2017
830d09b
local variable names with lower case
fabferro Apr 5, 2017
b1d1bdc
naming data members style
fabferro Apr 5, 2017
7e4ddbc
removing commented code
fabferro Apr 5, 2017
bbc5247
not-const to const data members
fabferro Apr 5, 2017
2830a59
delete theIndices
fabferro Apr 5, 2017
f7dda02
class number 5->3
fabferro Apr 5, 2017
076f2b2
correct label
fabferro Apr 5, 2017
04c5720
added keep CTPPSPixelDigiedmDetSetVector_ctppsPixelDigis_*_* in RECO …
fabferro Apr 7, 2017
7ea0643
added keep CTPPSPixelDigiedmDetSetVector_ctppsPixelDigis_*_* in AOD a…
fabferro Apr 7, 2017
6b2bae9
fixing typo, missing comma in .py
fabferro Apr 7, 2017
d83de9b
removing *_TEST.xml, leaving only *_200_far.xml
fabferro Apr 10, 2017
2972cef
const -> constexpr
fabferro Apr 10, 2017
787ce03
using cms::concurrency::xercesInitialize and Terminate
fabferro Apr 10, 2017
501bf91
CTPPSPixelIndices theIndices no more pointer
fabferro Apr 13, 2017
95444f0
reserved size of vector output
fabferro Apr 13, 2017
4ba46b3
removed try-catch
fabferro Apr 13, 2017
d23b060
simplified iteration over input
fabferro Apr 13, 2017
1107717
simplifications and removal of unnecessary run time checks
fabferro Apr 13, 2017
94f4e85
adding constants and comments for channel definition
fabferro Apr 13, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions CondFormats/CTPPSReadoutObjects/BuildFile.xml
@@ -1,6 +1,9 @@
<use name="FWCore/Framework"/>
<use name="FWCore/Concurrency"/>
<use name="DataFormats/CTPPSDetId"/>

<use name="CondFormats/Serialization"/>
<use name="boost_serialization"/>
<export>
<lib name="1"/>
</export>
48 changes: 48 additions & 0 deletions CondFormats/CTPPSReadoutObjects/interface/CTPPSPixelAnalysisMask.h
@@ -0,0 +1,48 @@
/****************************************************************************
*
* Author: F.Ferro ferro@ge.infn.it
*
****************************************************************************/

#ifndef CondFormats_CTPPSReadoutObjects_CTPPSPixelAnalysisMask
#define CondFormats_CTPPSReadoutObjects_CTPPSPixelAnalysisMask

#include <set>
#include <map>

#include "CondFormats/Serialization/interface/Serializable.h"
#include "CondFormats/CTPPSReadoutObjects/interface/CTPPSPixelIndices.h"

/**
*\brief Contains data on masked channels of a ROC
*/
class CTPPSPixelROCAnalysisMask
{
public:
CTPPSPixelROCAnalysisMask() : fullMask(false) {}

/// whether all channels of the ROC shall be masked
bool fullMask;

/// list of channels to be masked
std::set<std::pair<unsigned char, unsigned char> > maskedPixels;

COND_SERIALIZABLE;

};

/**
*\brief Channel-mask mapping.
**/
class CTPPSPixelAnalysisMask
{
public:
std::map<uint32_t, CTPPSPixelROCAnalysisMask> analysisMask;

void insert(const uint32_t &sid, const CTPPSPixelROCAnalysisMask &am);

COND_SERIALIZABLE;

};

#endif
55 changes: 55 additions & 0 deletions CondFormats/CTPPSReadoutObjects/interface/CTPPSPixelDAQMapping.h
@@ -0,0 +1,55 @@
/****************************************************************************
*
*
* Authors:
* F.Ferro ferro@ge.infn.it
*
****************************************************************************/

#ifndef CondFormats_CTPPSReadoutObjects_CTPPSPixelDAQMapping
#define CondFormats_CTPPSReadoutObjects_CTPPSPixelDAQMapping

#include "CondFormats/Serialization/interface/Serializable.h"
#include "CondFormats/CTPPSReadoutObjects/interface/CTPPSPixelFramePosition.h"
#include "CondFormats/CTPPSReadoutObjects/interface/CTPPSPixelIndices.h"

#include <map>
#include <set>

//----------------------------------------------------------------------------------------------------

/**
*\brief Contains mappind data related to a ROC.
*/
class CTPPSPixelROCInfo
{
public:
/// the symbolic id
uint32_t iD;

unsigned int roc;

friend std::ostream& operator << (std::ostream& s, const CTPPSPixelROCInfo &fp);

COND_SERIALIZABLE;
};

//----------------------------------------------------------------------------------------------------

/**
*\brief The mapping between FramePosition and ROCInfo.
*/
class CTPPSPixelDAQMapping
{
public:
std::map<CTPPSPixelFramePosition, CTPPSPixelROCInfo> ROCMapping;

void insert(const CTPPSPixelFramePosition &fp, const CTPPSPixelROCInfo &vi);

std::set<unsigned int> fedIds() const;

COND_SERIALIZABLE;

};

#endif
118 changes: 118 additions & 0 deletions CondFormats/CTPPSReadoutObjects/interface/CTPPSPixelFramePosition.h
@@ -0,0 +1,118 @@
/****************************************************************************
*
*
* Authors:
* F.Ferro ferro@ge.infn.it
*
****************************************************************************/

#ifndef CondFormats_CTPPSReadoutObjects_CTPPSPixelFramePosition
#define CondFormats_CTPPSReadoutObjects_CTPPSPixelFramePosition

#include <iostream>
#include <string>

#include "CondFormats/Serialization/interface/Serializable.h"

/**
* Uniquely identifies the DAQ channel through which a ROC frame has been received.
*
* The internal representation has the following structure:
* \verbatim
* | 32 bits raw position |
* | 11 bits | 12 bits | 1 bit | 6 bits | 2bits |
* | empty | FED ID | FMC 0-1 | fiber index 0-12 | ROC 0-2 |
* \endverbatim
*
**/
class CTPPSPixelFramePosition
{
public:
static const unsigned int offsetROC = 0, maskROC = 0x3;
static const unsigned int offsetChannelIdx = 2, maskChannelIdx = 0x3F;
static const unsigned int offsetFMCId = 8, maskFMCId = 0x1;
static const unsigned int offsetFEDId = 9, maskFEDId = 0xFFF;


/// the preferred constructor
CTPPSPixelFramePosition( unsigned short FEDId, unsigned short FMCId, unsigned short ChannelIdx, unsigned short ROC) :
rawPosition(ROC<<offsetROC | ChannelIdx<<offsetChannelIdx | FMCId<<FMCId | FEDId<<offsetFEDId )
{
}

/// don't use this constructor unless you have a good reason
CTPPSPixelFramePosition(unsigned int pos = 0) : rawPosition(pos)
{
}

~CTPPSPixelFramePosition()
{
}

/// recomended getters and setters

unsigned short getFEDId() const
{
return (rawPosition >> offsetFEDId) & maskFEDId;
}

void setFEDId(unsigned short v)
{ v &= maskFEDId; rawPosition &= 0xFFFFFFFF - (maskFEDId << offsetFEDId); rawPosition |= (v << offsetFEDId); }

unsigned short getChannelIdx() const { return (rawPosition >> offsetChannelIdx) & maskChannelIdx; }

void setChannelIdx(unsigned short v)
{ v &= maskChannelIdx; rawPosition &= 0xFFFFFFFF - (maskChannelIdx << offsetChannelIdx); rawPosition |= (v << offsetChannelIdx); }

unsigned short getROC() const { return (rawPosition >> offsetROC) & maskROC; }

void setROC(unsigned short v)
{ v &= maskROC; rawPosition &= 0xFFFFFFFF - (maskROC << offsetROC); rawPosition |= (v << offsetROC); }

unsigned short getFMCId() const { return (rawPosition >> offsetFMCId) & maskFMCId; }

void setFMCId(unsigned short v)
{ v &= maskFMCId; rawPosition &= 0xFFFFFFFF - (maskFMCId << offsetFMCId); rawPosition |= (v << offsetFMCId); }


unsigned int getRawPosition() const
{
return rawPosition;
}

bool operator < (const CTPPSPixelFramePosition &pos) const
{
return (rawPosition < pos.rawPosition);
}

bool operator == (const CTPPSPixelFramePosition &pos) const
{
return (rawPosition == pos.rawPosition);
}

/// Condensed representation of the DAQ channel.
/// prints 5-digit hex number,
friend std::ostream& operator << (std::ostream& s, const CTPPSPixelFramePosition &fp);

/// prints XML formatted DAQ channel to stdout
void printXML();

/// Sets attribute with XML name 'attribute' and value 'value'.
/// Also turns on attribute presents bit in the flag parameter
/// returns 0 if the attribute is known, non-zero value else
unsigned char setXMLAttribute(const std::string &attribute, const std::string &value, unsigned char &flag);

/// returns true if all attributes have been set
static bool checkXMLAttributeFlag(unsigned char flag)
{
return (flag == 0xF);
}

protected:
unsigned int rawPosition;

COND_SERIALIZABLE;

};

#endif