CMS 3D CMS Logo

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

#include <EcalSimRawData.h>

Inheritance diagram for EcalSimRawData:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
 EcalSimRawData (const edm::ParameterSet &pset)
 
virtual ~EcalSimRawData ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- 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 ()
 

Private Types

enum  writeMode_t { littleEndian, bigEndian, ascii }
 

Private Member Functions

void checkGeometry (const edm::EventSetup &eventSetup)
 
void checkTriggerMap (const edm::EventSetup &eventSetup)
 
int cIndex2iTtEta (int iTtEta0) const
 
int cIndex2TtPhi (int iTtPhi0) const
 
void elec2GeomNum (int ittEta0, int ittPhi0, int strip1, int ch1, int &iEta0, int &iPhi0) const
 
void fwrite (std::ofstream &f, uint16_t data, int &iword, bool hpar=true) const
 
void genFeData (std::string basename, int iEvent, const std::vector< uint16_t > adcCount[nEbEta][nEbPhi]) const
 
void genSrData (std::string basename, int iEvent, int ttf[nEbTtEta][nTtPhi]) const
 
void genTccIn (std::string basename, int iEvent, const int tps[nTtEta][nTtPhi]) const
 
void genTccOut (std::string basename, int iEvent, const int tps[nTtEta][nTtPhi]) const
 
void getEbDigi (const edm::Event &event, std::vector< uint16_t > adc[nEbEta][nEbPhi]) const
 
std::string getExt () const
 
void getSrfs (const edm::Event &event, int ebSrf[nTtEta][nTtPhi], int eeSrf[nEndcaps][nScX][nScY]) const
 
void getTp (const edm::Event &event, const std::string &collName, int tp[nTtEta][nTtPhi]) const
 
int iEta2cIndex (int iEta) const
 
int iPhi2cIndex (int iPhi) const
 
int iTtEta2cIndex (int iTtEta) const
 
int iTtPhi2cIndex (int iTtPhi) const
 
void setHParity (uint16_t &a) const
 

Private Attributes

std::string basename_
 
int dccNum_
 
std::string digiProducer_
 
std::string ebDigiCollection_
 
std::string ebSrFlagCollection_
 
std::string eeDigiCollection_
 
std::string eeSrFlagCollection_
 
std::auto_ptr
< EcalSelectiveReadout
esr_
 
bool fe2dcc_
 
bool fe2tcc_
 
std::string srDigiProducer_
 
std::ofstream srfFile
 
bool srp2dcc_
 
bool tcc2dcc_
 
int tccInDefaultVal_
 
int tccNum_
 
std::string tcpDigiCollection_
 
const CaloGeometrytheGeometry
 
const
EcalTrigTowerConstituentsMap
theTriggerTowerMap
 
std::string tpDigiCollection_
 
std::string tpProducer_
 
bool tpVerbose_
 
std::ofstream ttfFile
 
writeMode_t writeMode_
 
bool xtalVerbose_
 

Static Private Attributes

static const int ebDccPhiEdge = 20
 
static const int ebTccPhiEdge = 20
 
static const int nDccEndcap = 9
 
static const int nDccInPhi = 18
 
static const int nEbEta = 170
 
static const int nEbPhi = 360
 
static const int nEbTtEta = nEbEta/ttEdge
 
static const int nEeTtEta = 11
 
static const int nEeX = 100
 
static const int nEeY = 100
 
static const int nEndcaps = 2
 
static const int nScX = 20
 
static const int nScY = 20
 
static const int nTccEndcap = 36
 
static const int nTccInPhi = 18
 
static const int nTtEta = nEbTtEta+2*nEeTtEta
 
static const int nTtPhi = nEbPhi/ttEdge
 
static const int nTtPhisPerEbDcc = 4
 
static const int nTtPhisPerEbTcc = 4
 
static const int nTtSmEta = 17
 
static const int nTtSmPhi = 4
 
static const int nTtTypes = 2
 
static const int scEdge = 5
 
static const int strip2Eta [nTtTypes][ttEdge]
 
static const int stripCh2Phi [nTtTypes][ttEdge][ttEdge]
 
static const int ttEdge = 5
 
static const int ttType [nEbTtEta]
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- 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

The EcalSimRawData CMSSW module produces raw data from digis. The raw data are written into files which can be loaded into the TCC DCC and SRP boards in order to emulate the front-end. Only barrel is fully supported. The produced files for TCC assumes a special LUT in the TCC forged for FE emulation mode.

Module Parameters:

Definition at line 41 of file EcalSimRawData.h.

Member Enumeration Documentation

Output format mode

littleEndian: little endian binary bigEndian: big endian binary ascii: ascii mode. The one accepted by the TCC, DCC and SRP board control software.

Enumerator
littleEndian 
bigEndian 
ascii 

Definition at line 182 of file EcalSimRawData.h.

Constructor & Destructor Documentation

EcalSimRawData::EcalSimRawData ( const edm::ParameterSet pset)
explicit

Constructor

Parameters
psetCMSSW configuration

Definition at line 47 of file EcalSimRawData.cc.

virtual EcalSimRawData::~EcalSimRawData ( )
inlinevirtual

Destructor

Definition at line 50 of file EcalSimRawData.h.

Member Function Documentation

void EcalSimRawData::analyze ( const edm::Event event,
const edm::EventSetup es 
)
virtual

Main method. Called back for each event. This method produced the raw data and write them to disk.

Implements edm::EDAnalyzer.

Definition at line 83 of file EcalSimRawData.cc.

void EcalSimRawData::checkGeometry ( const edm::EventSetup eventSetup)
private

call these once an event, to make sure everything is up-to-date

void EcalSimRawData::checkTriggerMap ( const edm::EventSetup eventSetup)
private
int EcalSimRawData::cIndex2iTtEta ( int  iTtEta0) const
inlineprivate

Converse of iTtEta2cIndex

Parameters
iTtEta0c eta index of TT
stdCMSSW TT eta index

Definition at line 237 of file EcalSimRawData.h.

int EcalSimRawData::cIndex2TtPhi ( int  iTtPhi0) const
inlineprivate

Converse of iTtPhi2cIndex

Parameters
iTtPhi0phi index of TT
Returns
std CMSS TT index

Definition at line 245 of file EcalSimRawData.h.

void EcalSimRawData::elec2GeomNum ( int  ittEta0,
int  ittPhi0,
int  strip1,
int  ch1,
int &  iEta0,
int &  iPhi0 
) const
private

Converts electronic number of an ECAL barrel channel to geometrical indices

Parameters
ittEta0trigger tower c index
ittPhi0trigger tower c index
strip1strip index within the TT. Runs from 1 to 5.
ch1channel electronics number within the VFE. Runs from 1 to 5.
[out]iEta0eta c index of the channel
[out]iPhi0eta c index of the channel

Definition at line 124 of file EcalSimRawData.cc.

void EcalSimRawData::fwrite ( std::ofstream &  f,
uint16_t  data,
int &  iword,
bool  hpar = true 
) const
private

Write a data 16-bit word into file according to selected format.

Parameters
fthe file stream to write to
datathe peace of data to write
[in,out]iwordpass zero when writing for the first time in a file, then the value returned by the previous call. Counts the number of words written into the file.
hparif true the horizontal odd word parity is set before writing the word into the file.

Definition at line 137 of file EcalSimRawData.cc.

void EcalSimRawData::genFeData ( std::string  basename,
int  iEvent,
const std::vector< uint16_t >  adcCount[nEbEta][nEbPhi] 
) const
private

Generates FE crystal data

Parameters
basenamebase for the output file name. DCC number is appended to the name
iEventevent index
adcCountthe payload, the ADC count of the channels.

stripHeader |= parity(stripHeader) << 15;

Definition at line 184 of file EcalSimRawData.cc.

void EcalSimRawData::genSrData ( std::string  basename,
int  iEvent,
int  ttf[nEbTtEta][nTtPhi] 
) const
private

Generates SR flags

Parameters
basenamebase for the output file name. DCC number is appended to the name
iEventevent index
thetrigger tower flags

Definition at line 274 of file EcalSimRawData.cc.

void EcalSimRawData::genTccIn ( std::string  basename,
int  iEvent,
const int  tps[nTtEta][nTtPhi] 
) const
private

Generates FE trigger primitives data

Parameters
basenamebase for the output file name. DCC number is appended to the name
iEventevent index
tpsthe payload, the trigger primitives

Definition at line 340 of file EcalSimRawData.cc.

void EcalSimRawData::genTccOut ( std::string  basename,
int  iEvent,
const int  tps[nTtEta][nTtPhi] 
) const
private

Generates TCC->DCC data

Parameters
basenamebase for the output file name. DCC number is appended to the name
iEventevent index
tpsthe payload, the trigger primitives

Definition at line 398 of file EcalSimRawData.cc.

void EcalSimRawData::getEbDigi ( const edm::Event event,
std::vector< uint16_t >  adc[nEbEta][nEbPhi] 
) const
private

Retrieves barrel digis (APD ADC count).

Parameters
eventCMS event
adc[out] the adc counts: adc[iEta0][iPhi0][iTimeSample0]

Definition at line 531 of file EcalSimRawData.cc.

string EcalSimRawData::getExt ( ) const
private

Help function to get the file extension which depends on the output formats.

Definition at line 171 of file EcalSimRawData.cc.

void EcalSimRawData::getSrfs ( const edm::Event event,
int  ebSrf[nTtEta][nTtPhi],
int  eeSrf[nEndcaps][nScX][nScY] 
) const
private

Computes the selective readout flags.

Parameters
[in]eventCMS event
[out]ebSrfthe computed SR flags for barrel
[out]eeSrfthe computed SR flags for endcaps

Definition at line 477 of file EcalSimRawData.cc.

void EcalSimRawData::getTp ( const edm::Event event,
const std::string &  collName,
int  tp[nTtEta][nTtPhi] 
) const
private

Extracts the trigger primitive (TP). The collection name parameter permits to select either the TCP Fenix output or the TCC output. Note: TCP output is only valid for the barrel.

Parameters
eventCMS event
collNamelabel of the EDM collection containing the TP.
tp[out] the trigger primitives

Definition at line 599 of file EcalSimRawData.cc.

int EcalSimRawData::iEta2cIndex ( int  iEta) const
inlineprivate

Converts std CMSSW crystal eta index into a c-index (contiguous integer starting from 0 and increasing with pseudo-rapidity).

Parameters
iEtastd CMSSW crystal eta index
Returns
the c-array index

Definition at line 208 of file EcalSimRawData.h.

int EcalSimRawData::iPhi2cIndex ( int  iPhi) const
inlineprivate

Converts std CMSSW crystal phi index into a c-index (contiguous integer starting from 0 at phi=0deg and increasing with phi).

Parameters
iPhistd CMSSW crystal phi index
Returns
the c-array index

Definition at line 217 of file EcalSimRawData.h.

int EcalSimRawData::iTtEta2cIndex ( int  iTtEta) const
inlineprivate

Converts std CMSSW ECAL trigger tower eta index into a c-index (contiguous integer starting from 0 and increasing with pseudo-rapidity).

Parameters
iEtastd CMSSW trigger tower eta index
Returns
the c-array index

Definition at line 229 of file EcalSimRawData.h.

int EcalSimRawData::iTtPhi2cIndex ( int  iTtPhi) const
inlineprivate

Converts std CMSSW ECAL trigger tower phi index into a c-index (contiguous integer starting from 0 at phi=0deg and increasing with phi).

Parameters
iPhistd CMSSW ECAL trigger tower phi index
Returns
the c-array index

Definition at line 254 of file EcalSimRawData.h.

void EcalSimRawData::setHParity ( uint16_t &  a) const
private

Definition at line 467 of file EcalSimRawData.cc.

Member Data Documentation

std::string EcalSimRawData::basename_
private

basename for output files

Definition at line 466 of file EcalSimRawData.h.

int EcalSimRawData::dccNum_
private

Index of the DCC, FE data must be produced for. -1 for all TTCs

Definition at line 458 of file EcalSimRawData.h.

std::string EcalSimRawData::digiProducer_
private

Name of module/plugin/producer making digis

Definition at line 369 of file EcalSimRawData.h.

const int EcalSimRawData::ebDccPhiEdge = 20
staticprivate

Number of barrel crystals along phi covered by a DCC

Definition at line 140 of file EcalSimRawData.h.

std::string EcalSimRawData::ebDigiCollection_
private

EB digi product instance name

Definition at line 373 of file EcalSimRawData.h.

std::string EcalSimRawData::ebSrFlagCollection_
private

EB SRP flag digi product instance name

Definition at line 386 of file EcalSimRawData.h.

const int EcalSimRawData::ebTccPhiEdge = 20
staticprivate

number of TTs along phi of a TCC sector

Definition at line 128 of file EcalSimRawData.h.

std::string EcalSimRawData::eeDigiCollection_
private

EE digi product instance name

Definition at line 377 of file EcalSimRawData.h.

std::string EcalSimRawData::eeSrFlagCollection_
private

EE SRP flag digi product instancename

Definition at line 390 of file EcalSimRawData.h.

std::auto_ptr<EcalSelectiveReadout> EcalSimRawData::esr_
private

Selective readout simulator

Definition at line 442 of file EcalSimRawData.h.

bool EcalSimRawData::fe2dcc_
private

Switch for data of FE->DCC link

Definition at line 430 of file EcalSimRawData.h.

bool EcalSimRawData::fe2tcc_
private

Switch for data of FE->TCC link

Definition at line 434 of file EcalSimRawData.h.

const int EcalSimRawData::nDccEndcap = 9
staticprivate

Number of DCCs for a single endcap

Definition at line 124 of file EcalSimRawData.h.

const int EcalSimRawData::nDccInPhi = 18
staticprivate

Number of barrel DCCs along Phi

Definition at line 120 of file EcalSimRawData.h.

const int EcalSimRawData::nEbEta = 170
staticprivate

Number of crystals in ECAL barrel along eta

Definition at line 60 of file EcalSimRawData.h.

const int EcalSimRawData::nEbPhi = 360
staticprivate

Number of crystals in ECAL barrel along phi

Definition at line 64 of file EcalSimRawData.h.

const int EcalSimRawData::nEbTtEta = nEbEta/ttEdge
staticprivate

Number of TTs along Ecal barrel eta

Definition at line 108 of file EcalSimRawData.h.

const int EcalSimRawData::nEeTtEta = 11
staticprivate

Number of TTs along eta for one endcap.

Definition at line 112 of file EcalSimRawData.h.

const int EcalSimRawData::nEeX = 100
staticprivate

X-edge of endcap (x,y)- crystal grid

Definition at line 68 of file EcalSimRawData.h.

const int EcalSimRawData::nEeY = 100
staticprivate

Y-edge of endcap (x,y)- crystal grid

Definition at line 72 of file EcalSimRawData.h.

const int EcalSimRawData::nEndcaps = 2
staticprivate

Number of endcaps

Definition at line 76 of file EcalSimRawData.h.

const int EcalSimRawData::nScX = 20
staticprivate

Maximum number of supercrystal along x axis

Definition at line 84 of file EcalSimRawData.h.

const int EcalSimRawData::nScY = 20
staticprivate

Maximum number of supercrystal along y axis

Definition at line 88 of file EcalSimRawData.h.

const int EcalSimRawData::nTccEndcap = 36
staticprivate

Number of TCCs for a single endcap

Definition at line 136 of file EcalSimRawData.h.

const int EcalSimRawData::nTccInPhi = 18
staticprivate

Number of Barrel TTCs along phi

Definition at line 132 of file EcalSimRawData.h.

const int EcalSimRawData::nTtEta = nEbTtEta+2*nEeTtEta
staticprivate

Number of TTs along ECAL eta

Definition at line 116 of file EcalSimRawData.h.

const int EcalSimRawData::nTtPhi = nEbPhi/ttEdge
staticprivate

Number of TTs along Ecal Phi

Definition at line 104 of file EcalSimRawData.h.

const int EcalSimRawData::nTtPhisPerEbDcc = 4
staticprivate

Number of trigger towers alng phi covered by a DCC

Definition at line 144 of file EcalSimRawData.h.

const int EcalSimRawData::nTtPhisPerEbTcc = 4
staticprivate

Number of trigger towers alng phi covered by a TCC

Definition at line 148 of file EcalSimRawData.h.

const int EcalSimRawData::nTtSmEta = 17
staticprivate

Number of TTs along SM eta

Definition at line 100 of file EcalSimRawData.h.

const int EcalSimRawData::nTtSmPhi = 4
staticprivate

Number of TTs along SM phi

Definition at line 96 of file EcalSimRawData.h.

const int EcalSimRawData::nTtTypes = 2
staticprivate

Number of barrel trigger tower types (in term of VFE card orientation)

Definition at line 152 of file EcalSimRawData.h.

const int EcalSimRawData::scEdge = 5
staticprivate

Supercrystal edge in number of crystals

Definition at line 80 of file EcalSimRawData.h.

std::string EcalSimRawData::srDigiProducer_
private

Label of SR flags and suppressed digis

Definition at line 382 of file EcalSimRawData.h.

std::ofstream EcalSimRawData::srfFile
private

Output file for selective readout flags

Definition at line 450 of file EcalSimRawData.h.

bool EcalSimRawData::srp2dcc_
private

Switch for data of SRP->DCC link

Definition at line 422 of file EcalSimRawData.h.

const int EcalSimRawData::strip2Eta
staticprivate
Initial value:
= {
{4,3,2,1,0},
{0,1,2,3,4}
}

Maps strip_id to eta index within a TT. strip2Eta[iTtType][strip_id-1] will be the eta index of channels with strip_id 'strip_id'. The eta index runs from 0 to 4 and increasing with the eta of the std CMS coordinates.

Definition at line 173 of file EcalSimRawData.h.

const int EcalSimRawData::stripCh2Phi
staticprivate
Initial value:
= {
{{4,3,2,1,0},
{0,1,2,3,4},
{4,3,2,1,0},
{0,1,2,3,4},
{4,3,2,1,0}},
{{0,1,2,3,4},
{4,3,2,1,0},
{0,1,2,3,4},
{4,3,2,1,0},
{0,1,2,3,4}}
}

Maps (strip_id, channel_id) to phi index within a TT. stripCh2Phi[iTtType][strip_id-1][ch_id-1] will be the phi index of the TT of type iTtType with strip ID 'strip_id' and channel VFE id 'ch_id'. The phi runs from 0 to 4 and increases with the phi of std CMS coordinates.

Definition at line 166 of file EcalSimRawData.h.

bool EcalSimRawData::tcc2dcc_
private

Switch for data of TCC->DCC link

Definition at line 426 of file EcalSimRawData.h.

int EcalSimRawData::tccInDefaultVal_
private

default TriggerPrimitive values if the trigger tower is abscent

Definition at line 462 of file EcalSimRawData.h.

int EcalSimRawData::tccNum_
private

Index of the TCC, FE data must be produced for. -1 for all TTCs

Definition at line 454 of file EcalSimRawData.h.

std::string EcalSimRawData::tcpDigiCollection_
private

TCP Fenix output digi product instance name

Definition at line 398 of file EcalSimRawData.h.

const CaloGeometry* EcalSimRawData::theGeometry
private

Calorimeter geometry

Definition at line 402 of file EcalSimRawData.h.

const EcalTrigTowerConstituentsMap* EcalSimRawData::theTriggerTowerMap
private

ECAL endcap trigger tower map

Definition at line 438 of file EcalSimRawData.h.

std::string EcalSimRawData::tpDigiCollection_
private

Trigger primitive digi product instance name

Definition at line 394 of file EcalSimRawData.h.

std::string EcalSimRawData::tpProducer_
private

Name of the trigger primitive label

Definition at line 406 of file EcalSimRawData.h.

bool EcalSimRawData::tpVerbose_
private

Verbosity switch for crystal data

Definition at line 418 of file EcalSimRawData.h.

const int EcalSimRawData::ttEdge = 5
staticprivate

Definition at line 92 of file EcalSimRawData.h.

std::ofstream EcalSimRawData::ttfFile
private

Output file for trigger tower flags

Definition at line 446 of file EcalSimRawData.h.

const int EcalSimRawData::ttType
staticprivate
Initial value:
= {
0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,1,
0,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1
}

Map of trigger tower types (in term of VFE card orientation). ttType[iTtEta0]: trigger tower type of TTs with eta 'c-arrary' index iTtEta0

Definition at line 158 of file EcalSimRawData.h.

writeMode_t EcalSimRawData::writeMode_
private

output format

Definition at line 410 of file EcalSimRawData.h.

bool EcalSimRawData::xtalVerbose_
private

Verbosity switch for crystal data

Definition at line 414 of file EcalSimRawData.h.