forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request cms-sw#18732 from forthommel/ctpps-runranges_patch…
…2-8_0_X CTPPS: bug fix #2 in run ranges for FEDs channels mapping
- Loading branch information
Showing
1 changed file
with
22 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" | ||
|
@@ -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; | ||
|
@@ -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 | ||
|
@@ -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; | ||
} | ||
|
@@ -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 | ||
|
@@ -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()); | ||
|
@@ -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()), | ||
|
@@ -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 | ||
|