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

CSC DDU IDs fix for post-LS1 configuration #4260

Merged
merged 2 commits into from Jun 18, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Expand Up @@ -40,7 +40,12 @@ void EventProcessor::processDDU(const CSCDDUEventData& dduData, const CSCDCCExam

if ( (dduID >= FEDNumbering::MINCSCDDUFEDID) && (dduID <= FEDNumbering::MAXCSCDDUFEDID) ) /// New CSC readout without DCCs. CMS CSC DDU ID range 830-869
{
dduID -= (FEDNumbering::MINCSCDDUFEDID - 1); /// TODO: Can require DDU-RUI remapping for actual system
// dduID -= (FEDNumbering::MINCSCDDUFEDID - 1); /// TODO: Can require DDU-RUI remapping for actual system
dduID = cscdqm::Utility::getRUIfromDDUId(dduHeader.source_id());
if (dduID < 0) {
LOG_WARN << "DDU source ID (" << dduHeader.source_id() << ") is out of valid range. Remapping to DDU ID 1.";
dduID = 1;
}
}
else
{
Expand Down
Expand Up @@ -43,7 +43,12 @@ bool EventProcessor::processExaminer(const CSCDCCExaminer& binChecker, const CSC
int dduID = (*ddu_itr)&0xFF;
if ( ((*ddu_itr) >= FEDNumbering::MINCSCDDUFEDID) && ((*ddu_itr) <= FEDNumbering::MAXCSCDDUFEDID) ) /// New CSC readout without DCCs. CMS CSC DDU ID range 830-869
{
dduID = (*ddu_itr) - FEDNumbering::MINCSCDDUFEDID + 1; /// TODO: Can require DDU-RUI remapping for actual system
// dduID = (*ddu_itr) - FEDNumbering::MINCSCDDUFEDID + 1; /// TODO: Can require DDU-RUI remapping for actual system
dduID = cscdqm::Utility::getRUIfromDDUId((*ddu_itr));
if (dduID < 0) {
LOG_WARN << "DDU source ID (" << (*ddu_itr) << ") is out of valid range. Remapping to DDU ID 1.";
dduID = 1;
}
}
if (errs != 0)
{
Expand Down
24 changes: 24 additions & 0 deletions DQM/CSCMonitorModule/plugins/CSCDQM_Utility.cc
Expand Up @@ -357,4 +357,28 @@ namespace cscdqm {
return sqrt(2.0 * (no * (log(no / ne) - 1) + ne));
}

/**
* @brief Get RUI Number from DDU source ID for post LS1 configuration
* @param ddu_id DDI Source ID
*/
int Utility::getRUIfromDDUId(unsigned ddu_id) {
int rui = -1;
const unsigned postLS1_map [] = { 841, 842, 843, 844, 845, 846, 847, 848, 849,
831, 832, 833, 834, 835, 836, 837, 838, 839,
861, 862, 863, 864, 865, 866, 867, 868, 869,
851, 852, 853, 854, 855, 856, 857, 858, 859 };
if ( (ddu_id >= FEDNumbering::MINCSCDDUFEDID) && (ddu_id <= FEDNumbering::MAXCSCDDUFEDID) )
{
for ( int i = 0; i < 36; i++)
{
if (ddu_id == postLS1_map[i]) { rui = i+1; return rui;}
}
} else {
rui = ddu_id & 0xFF;
}
return rui;
}



}
4 changes: 4 additions & 0 deletions DQM/CSCMonitorModule/plugins/CSCDQM_Utility.h
Expand Up @@ -34,6 +34,8 @@
#include <TString.h>
#include <TPRegexp.h>

#include "DataFormats/FEDRawData/interface/FEDNumbering.h"

namespace cscdqm {

/**
Expand Down Expand Up @@ -90,6 +92,8 @@ namespace cscdqm {
static double SignificanceLevelLow(const unsigned int N, const unsigned int n, const double eps);
static double SignificanceLevelHigh(const unsigned int N, const unsigned int n);

static int getRUIfromDDUId(unsigned ddu_id);

};


Expand Down
24 changes: 13 additions & 11 deletions EventFilter/CSCRawToDigi/src/CSCDigiToRaw.cc
Expand Up @@ -404,25 +404,27 @@ void CSCDigiToRaw::createFedBuffers(const CSCStripDigiCollection& stripDigis,

std::map<int, CSCDDUEventData> dduMap;
unsigned int ddu_fmt_version = 0x7; /// 2013 Format
const unsigned postLS1_map [] = { 841, 842, 843, 844, 845, 846, 847, 848, 849,
831, 832, 833, 834, 835, 836, 837, 838, 839,
861, 862, 863, 864, 865, 866, 867, 868, 869,
851, 852, 853, 854, 855, 856, 857, 858, 859 };


/// Create dummy DDu buffers
for (unsigned int iddu=FEDNumbering::MINCSCDDUFEDID;
// iddu<=FEDNumbering::MAXCSCDDUFEDID; ++iddu) // loop over DDUs
iddu<FEDNumbering::MINCSCDDUFEDID+36; ++iddu)
/// Create dummy DDU buffers
for (unsigned int i = 0; i < 36; i++)
{
unsigned int iddu = postLS1_map[i];
// make a new one
CSCDDUHeader newDDUHeader(bx,l1a, iddu, ddu_fmt_version);

dduMap.insert(std::pair<int, CSCDDUEventData>(iddu, CSCDDUEventData(newDDUHeader) ) );
}


// Loop over post-LS1 DDU FEDs
for (unsigned int iddu=FEDNumbering::MINCSCDDUFEDID;
// iddu<=FEDNumbering::MAXCSCDDUFEDID; ++iddu)
iddu<FEDNumbering::MINCSCDDUFEDID+36; ++iddu)
/// Loop over post-LS1 DDU FEDs
for (unsigned int i = 0; i < 36; i++)
{
unsigned int iddu = postLS1_map[i];
// for every chamber with data, add to a DDU in this DCC Event
for (map<CSCDetId, CSCEventData>::iterator chamberItr = theChamberDataMap.begin();
chamberItr != theChamberDataMap.end(); ++chamberItr)
Expand All @@ -434,15 +436,15 @@ void CSCDigiToRaw::createFedBuffers(const CSCStripDigiCollection& stripDigis,
{

int dduID = mapping->ddu(chamberItr->first); // try to switch to DDU ID mapping
if ((dduID >= FEDNumbering::MINCSCDDUFEDID) && (dduID <= FEDNumbering::MAXCSCDDUFEDID) ) // DDU ID is in expected FED ID range
if ((dduID >= FEDNumbering::MINCSCDDUFEDID) && (dduID <= FEDNumbering::MAXCSCDDUFEDID) ) // DDU ID is in expectedi post-LS1 FED ID range
{
indexDDU = dduID;
}
else // Messy
{
// Lets try to change 1-36 ID range to MINCSCDDUFEDID+id range
// Lets try to change pre-LS1 1-36 ID range to post-LS1 MINCSCDDUFEDID - MAXCSCDDUFEDID range
dduID &= 0xFF;
if ((dduID <= 36) && (dduID > 0)) indexDDU = FEDNumbering::MINCSCDDUFEDID + dduID-1;
if ((dduID <= 36) && (dduID > 0)) indexDDU = postLS1_map[dduID -1]; // indexDDU = FEDNumbering::MINCSCDDUFEDID + dduID-1;
}

}
Expand Down