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: bug fix #2 in run ranges for FEDs channels mapping #18732

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Jan Kašpar (jan.kaspar@cern.ch)
* Marcin Borratynski (mborratynski@gmail.com)
* Seyed Mohsen Etesami (setesami@cern.ch)
* Laurent Forthomme
****************************************************************************/

#include "FWCore/Framework/interface/MakerMacros.h"
Expand Down Expand Up @@ -71,7 +72,7 @@ class TotemDAQMappingESSourceXML: public edm::ESProducer, public edm::EventSetup
TotemDAQMappingESSourceXML(const edm::ParameterSet &);
~TotemDAQMappingESSourceXML();

edm::ESProducts< boost::shared_ptr<TotemDAQMapping>, boost::shared_ptr<TotemAnalysisMask> > produce( const TotemReadoutRcd & );
edm::ESProducts< std::shared_ptr<TotemDAQMapping>, std::shared_ptr<TotemAnalysisMask> > produce( const TotemReadoutRcd & );

private:
unsigned int verbosity;
Expand Down Expand Up @@ -110,15 +111,15 @@ class TotemDAQMappingESSourceXML: public edm::ESProducer, public edm::EventSetup
enum ParseType { pMapping, pMask };

/// parses XML file
void ParseXML(ParseType, const string &file, const boost::shared_ptr<TotemDAQMapping>&, const boost::shared_ptr<TotemAnalysisMask>&);
void ParseXML(ParseType, const string &file, const std::shared_ptr<TotemDAQMapping>&, const std::shared_ptr<TotemAnalysisMask>&);

/// recursive method to extract RP-related information from the DOM tree
void ParseTreeRP(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID,
const boost::shared_ptr<TotemDAQMapping>&, const boost::shared_ptr<TotemAnalysisMask>&);
const std::shared_ptr<TotemDAQMapping>&, const std::shared_ptr<TotemAnalysisMask>&);

/// recursive method to extract RP-related information from the DOM tree
void ParseTreeDiamond(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID,
const boost::shared_ptr<TotemDAQMapping>&, const boost::shared_ptr<TotemAnalysisMask>&);
const std::shared_ptr<TotemDAQMapping>&, const std::shared_ptr<TotemAnalysisMask>&);

private:
/// adds the path prefix, if needed
Expand Down Expand Up @@ -233,23 +234,24 @@ void TotemDAQMappingESSourceXML::setIntervalFor(const edm::eventsetup::EventSetu
{
const auto &bl = configuration[idx];

edm::EventRange range = bl.validityRange;

// event id "1:min" has a special meaning and is translated to a truly minimal event id (1:0:0)
EventID startEventID = bl.validityRange.startEventID();
if (startEventID.event() == 1)
startEventID = EventID(startEventID.run(), startEventID.luminosityBlock(), 0);
if (range.startEventID()==edm::EventID(1, 0, 1))
range = edm::EventRange(edm::EventID(1, 0, 0), range.endEventID());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just for me to understand: using event number '0' has what exact special meaning?
or phrased differently, what kind of magic happens in EventRange and EventID that prevents the kind of failure mentioned by @franzoni from happening again?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ghellwig,
It appears that the nomenclature <run_number>:min used for the run ranges in the python configuration refers to the event <run_number>:0:1 instead of <run_number>:0:0 (first event effectively observed in the stream), thus preventing any channels mapping to be associated for this first, boundary, event.

Again, this is a temporary workaround while a frontier conditions-based mapping is being developed!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the explanation


if (startEventID <= iosv.eventID() && iosv.eventID() <= bl.validityRange.endEventID())
if (edm::contains(range, iosv.eventID()))
{
currentBlockValid = true;
currentBlock = idx;

const IOVSyncValue begin(startEventID);
const IOVSyncValue end(bl.validityRange.endEventID());
oValidity = ValidityInterval(begin, end);
const IOVSyncValue begin(range.startEventID());
const IOVSyncValue end(range.endEventID());
oValidity = edm::ValidityInterval(begin, end);

LogVerbatim("TotemDAQMappingESSourceXML")
<< " block found: index=" << currentBlock
<< ", interval=(" << startEventID << " - " << bl.validityRange.endEventID() << ")";
<< ", interval=(" << range.startEventID() << " - " << range.endEventID() << ")";

return;
}
Expand Down Expand Up @@ -278,13 +280,13 @@ string TotemDAQMappingESSourceXML::CompleteFileName(const string &fn)

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

edm::ESProducts< boost::shared_ptr<TotemDAQMapping>, boost::shared_ptr<TotemAnalysisMask> >
edm::ESProducts< std::shared_ptr<TotemDAQMapping>, std::shared_ptr<TotemAnalysisMask> >
TotemDAQMappingESSourceXML::produce( const TotemReadoutRcd & )
{
assert(currentBlockValid);

boost::shared_ptr<TotemDAQMapping> mapping(new TotemDAQMapping());
boost::shared_ptr<TotemAnalysisMask> mask(new TotemAnalysisMask());
auto mapping = std::make_shared<TotemDAQMapping>();
auto mask = std::make_shared<TotemAnalysisMask>();

// initialize Xerces
try
Expand Down Expand Up @@ -316,7 +318,7 @@ edm::ESProducts< boost::shared_ptr<TotemDAQMapping>, boost::shared_ptr<TotemAnal
//----------------------------------------------------------------------------------------------------

void TotemDAQMappingESSourceXML::ParseXML(ParseType pType, const string &file,
const boost::shared_ptr<TotemDAQMapping> &mapping, const boost::shared_ptr<TotemAnalysisMask> &mask)
const std::shared_ptr<TotemDAQMapping> &mapping, const std::shared_ptr<TotemAnalysisMask> &mask)
{
unique_ptr<XercesDOMParser> parser(new XercesDOMParser());
parser->parse(file.c_str());
Expand All @@ -341,8 +343,8 @@ void TotemDAQMappingESSourceXML::ParseXML(ParseType pType, const string &file,
//-----------------------------------------------------------------------------------------------------------

void TotemDAQMappingESSourceXML::ParseTreeRP(ParseType pType, xercesc::DOMNode * parent, NodeType parentType,
unsigned int parentID, const boost::shared_ptr<TotemDAQMapping>& mapping,
const boost::shared_ptr<TotemAnalysisMask>& mask)
unsigned int parentID, const std::shared_ptr<TotemDAQMapping>& mapping,
const std::shared_ptr<TotemAnalysisMask>& mask)
{
#ifdef DEBUG
printf(">> TotemDAQMappingESSourceXML::ParseTreeRP(%s, %u, %u)\n", XMLString::transcode(parent->getNodeName()),
Expand Down Expand Up @@ -475,8 +477,8 @@ void TotemDAQMappingESSourceXML::ParseTreeRP(ParseType pType, xercesc::DOMNode *
//----------------------------------------------------------------------------------------------------

void TotemDAQMappingESSourceXML::ParseTreeDiamond(ParseType pType, xercesc::DOMNode * parent, NodeType parentType,
unsigned int parentID, const boost::shared_ptr<TotemDAQMapping>& mapping,
const boost::shared_ptr<TotemAnalysisMask>& mask)
unsigned int parentID, const std::shared_ptr<TotemDAQMapping>& mapping,
const std::shared_ptr<TotemAnalysisMask>& mask)
{

#ifdef DEBUG
Expand Down