Skip to content

Commit

Permalink
Merge pull request cms-sw#18732 from forthommel/ctpps-runranges_patch…
Browse files Browse the repository at this point in the history
…2-8_0_X

CTPPS: bug fix #2 in run ranges for FEDs channels mapping
  • Loading branch information
davidlange6 authored May 19, 2017
2 parents d0b0b5d + 57dbdeb commit 98f6ae0
Showing 1 changed file with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Jan Kašpar ([email protected])
* Marcin Borratynski ([email protected])
* Seyed Mohsen Etesami ([email protected])
* 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());

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

0 comments on commit 98f6ae0

Please sign in to comment.