From df2d44e1a5c8a0a23f8af503557666e443b9e1f9 Mon Sep 17 00:00:00 2001 From: Jacek Kusnierz Date: Tue, 6 Aug 2019 13:38:10 +0200 Subject: [PATCH 01/64] change the way CMSSW calculates diamond detectors --- .../plugins/CTPPSGeometryESModule.cc | 349 ++++++++++-------- 1 file changed, 187 insertions(+), 162 deletions(-) diff --git a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc index b0986f1ca31d5..6499d67f060d4 100644 --- a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc +++ b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc @@ -49,85 +49,89 @@ * * Second, it creates CTPPSGeometry from DetGeoDesc tree. **/ -class CTPPSGeometryESModule : public edm::ESProducer { -public: - CTPPSGeometryESModule(const edm::ParameterSet&); - ~CTPPSGeometryESModule() override {} +class CTPPSGeometryESModule : public edm::ESProducer +{ + public: + CTPPSGeometryESModule( const edm::ParameterSet& ); + ~CTPPSGeometryESModule() override {} static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); -private: - std::unique_ptr produceIdealGD(const IdealGeometryRecord&); + private: + std::unique_ptr produceIdealGD( const IdealGeometryRecord& ); - template - struct GDTokens { - explicit GDTokens(edm::ESConsumesCollector&& iCC) - : idealGDToken_{iCC.consumesFrom(edm::ESInputTag())}, - alignmentToken_{iCC.consumesFrom(edm::ESInputTag())} {} - const edm::ESGetToken idealGDToken_; - const edm::ESGetToken alignmentToken_; - }; + template struct GDTokens { + explicit GDTokens( edm::ESConsumesCollector&& iCC): + idealGDToken_{iCC.consumesFrom(edm::ESInputTag())}, + alignmentToken_{iCC.consumesFrom(edm::ESInputTag())} + {} + const edm::ESGetToken idealGDToken_; + const edm::ESGetToken alignmentToken_; + }; - std::unique_ptr produceRealGD(const VeryForwardRealGeometryRecord&); - std::unique_ptr produceRealTG(const VeryForwardRealGeometryRecord&); + std::unique_ptr produceRealGD( const VeryForwardRealGeometryRecord& ); + std::unique_ptr produceRealTG( const VeryForwardRealGeometryRecord& ); - std::unique_ptr produceMisalignedGD(const VeryForwardMisalignedGeometryRecord&); - std::unique_ptr produceMisalignedTG(const VeryForwardMisalignedGeometryRecord&); + std::unique_ptr produceMisalignedGD( const VeryForwardMisalignedGeometryRecord& ); + std::unique_ptr produceMisalignedTG( const VeryForwardMisalignedGeometryRecord& ); - template - std::unique_ptr produceGD(IdealGeometryRecord const&, - const std::optional&, - GDTokens const&, - const char* name); + template + std::unique_ptr produceGD( IdealGeometryRecord const&, const std::optional&, GDTokens const&, const char* name); + - static void applyAlignments(const DetGeomDesc&, const CTPPSRPAlignmentCorrectionsData*, DetGeomDesc*&); - static void buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd); + static void applyAlignments( const DetGeomDesc&, const CTPPSRPAlignmentCorrectionsData*, DetGeomDesc*& ); + static void buildDetGeomDesc( DDFilteredView* fv, DetGeomDesc* gd ); - const unsigned int verbosity_; - const edm::ESGetToken compactViewToken_; + const unsigned int verbosity_; + const edm::ESGetToken compactViewToken_; - const GDTokens gdRealTokens_; - const GDTokens gdMisTokens_; + const GDTokens gdRealTokens_; + const GDTokens gdMisTokens_; + + const edm::ESGetToken dgdRealToken_; + const edm::ESGetToken dgdMisToken_; - const edm::ESGetToken dgdRealToken_; - const edm::ESGetToken dgdMisToken_; }; + //---------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------- -CTPPSGeometryESModule::CTPPSGeometryESModule(const edm::ParameterSet& iConfig) - : verbosity_(iConfig.getUntrackedParameter("verbosity")), - compactViewToken_{setWhatProduced(this, &CTPPSGeometryESModule::produceIdealGD) - .consumes(edm::ESInputTag( - "" /*optional module label */, iConfig.getParameter("compactViewTag")))}, - gdRealTokens_{setWhatProduced(this, &CTPPSGeometryESModule::produceRealGD)}, - gdMisTokens_{setWhatProduced(this, &CTPPSGeometryESModule::produceMisalignedGD)}, - dgdRealToken_{ - setWhatProduced(this, &CTPPSGeometryESModule::produceRealTG).consumes(edm::ESInputTag())}, - dgdMisToken_{ - setWhatProduced(this, &CTPPSGeometryESModule::produceMisalignedTG).consumes(edm::ESInputTag())} { +CTPPSGeometryESModule::CTPPSGeometryESModule(const edm::ParameterSet& iConfig) : + verbosity_( iConfig.getUntrackedParameter( "verbosity") ), + compactViewToken_{ setWhatProduced( this, &CTPPSGeometryESModule::produceIdealGD ) + .consumes(edm::ESInputTag(""/*optional module label */, + iConfig.getParameter( "compactViewTag" ) )) }, + gdRealTokens_{ setWhatProduced( this, &CTPPSGeometryESModule::produceRealGD ) }, + gdMisTokens_{ setWhatProduced( this, &CTPPSGeometryESModule::produceMisalignedGD ) }, + dgdRealToken_{ setWhatProduced( this, &CTPPSGeometryESModule::produceRealTG ).consumes(edm::ESInputTag()) }, + dgdMisToken_{ setWhatProduced( this, &CTPPSGeometryESModule::produceMisalignedTG ).consumes(edm::ESInputTag()) } +{ } -void CTPPSGeometryESModule::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { +void +CTPPSGeometryESModule::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.addUntracked("verbosity", 1); desc.add("compactViewTag", std::string()); descriptions.add("DoodadESSource", desc); } + //---------------------------------------------------------------------------------------------------- -void CTPPSGeometryESModule::applyAlignments(const DetGeomDesc& idealGD, - const CTPPSRPAlignmentCorrectionsData* alignments, - DetGeomDesc*& newGD) { - newGD = new DetGeomDesc(idealGD); +void +CTPPSGeometryESModule::applyAlignments( const DetGeomDesc& idealGD, + const CTPPSRPAlignmentCorrectionsData* alignments, + DetGeomDesc*& newGD ) +{ + newGD = new DetGeomDesc( idealGD ); std::deque buffer; std::deque bufferNew; - buffer.emplace_back(&idealGD); - bufferNew.emplace_back(newGD); + buffer.emplace_back( &idealGD ); + bufferNew.emplace_back( newGD ); - while (!buffer.empty()) { + while ( !buffer.empty() ) { const DetGeomDesc* sD = buffer.front(); DetGeomDesc* pD = bufferNew.front(); buffer.pop_front(); @@ -136,163 +140,175 @@ void CTPPSGeometryESModule::applyAlignments(const DetGeomDesc& idealGD, const std::string name = pD->name(); // Is it sensor? If yes, apply full sensor alignments - if (name == DDD_TOTEM_RP_SENSOR_NAME || name == DDD_CTPPS_DIAMONDS_SEGMENT_NAME || - name == DDD_CTPPS_UFSD_SEGMENT_NAME || name == DDD_CTPPS_PIXELS_SENSOR_NAME || - std::regex_match(name, std::regex(DDD_TOTEM_TIMING_SENSOR_TMPL))) { + if ( name == DDD_TOTEM_RP_SENSOR_NAME + || name == DDD_CTPPS_DIAMONDS_SEGMENT_NAME + || name == DDD_CTPPS_UFSD_SEGMENT_NAME + || name == DDD_CTPPS_PIXELS_SENSOR_NAME + || std::regex_match( name, std::regex( DDD_TOTEM_TIMING_SENSOR_TMPL ) )) { unsigned int plId = pD->geographicalID(); - if (alignments) { - const auto& ac = alignments->getFullSensorCorrection(plId); - pD->applyAlignment(ac); + if ( alignments ) { + const auto& ac = alignments->getFullSensorCorrection( plId ); + pD->applyAlignment( ac ); } } // Is it RP box? If yes, apply RP alignments - if (name == DDD_TOTEM_RP_RP_NAME || name == DDD_CTPPS_DIAMONDS_RP_NAME || name == DDD_CTPPS_PIXELS_RP_NAME || - name == DDD_TOTEM_TIMING_RP_NAME) { + if ( name == DDD_TOTEM_RP_RP_NAME + || name == DDD_CTPPS_DIAMONDS_RP_NAME + || name == DDD_CTPPS_PIXELS_RP_NAME + || name == DDD_TOTEM_TIMING_RP_NAME ) { unsigned int rpId = pD->geographicalID(); - if (alignments) { - const auto& ac = alignments->getRPCorrection(rpId); - pD->applyAlignment(ac); + if ( alignments ) { + const auto& ac = alignments->getRPCorrection( rpId ); + pD->applyAlignment( ac ); } } // create and add children - for (unsigned int i = 0; i < sD->components().size(); i++) { + for ( unsigned int i = 0; i < sD->components().size(); i++ ) { const DetGeomDesc* sDC = sD->components()[i]; - buffer.emplace_back(sDC); + buffer.emplace_back( sDC ); // create new node with the same information as in sDC and add it as a child of pD - DetGeomDesc* cD = new DetGeomDesc(*sDC); - pD->addComponent(cD); + DetGeomDesc* cD = new DetGeomDesc( *sDC ); + pD->addComponent( cD ); - bufferNew.emplace_back(cD); + bufferNew.emplace_back( cD ); } } } //---------------------------------------------------------------------------------------------------- -void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd) { +void +CTPPSGeometryESModule::buildDetGeomDesc( DDFilteredView* fv, DetGeomDesc* gd ) +{ // try to dive into next level - if (!fv->firstChild()) - return; + if ( !fv->firstChild() ) return; // loop over siblings in the level do { // create new DetGeomDesc node and add it to the parent's (gd) list - DetGeomDesc* newGD = new DetGeomDesc(fv); + DetGeomDesc* newGD = new DetGeomDesc( fv ); const std::string name = fv->logicalPart().name().name(); // strip sensors - if (name == DDD_TOTEM_RP_SENSOR_NAME) { + if ( name == DDD_TOTEM_RP_SENSOR_NAME ) { const std::vector& copy_num = fv->copyNumbers(); // check size of copy numubers array - if (copy_num.size() < 3) - throw cms::Exception("DDDTotemRPContruction") - << "size of copyNumbers for strip sensor is " << copy_num.size() << ". It must be >= 3."; + if ( copy_num.size() < 3 ) + throw cms::Exception("DDDTotemRPContruction") << "size of copyNumbers for strip sensor is " + << copy_num.size() << ". It must be >= 3."; // extract information const unsigned int decRPId = copy_num[copy_num.size() - 3]; const unsigned int arm = decRPId / 100; - const unsigned int station = (decRPId % 100) / 10; + const unsigned int station = ( decRPId % 100 ) / 10; const unsigned int rp = decRPId % 10; const unsigned int detector = copy_num[copy_num.size() - 1]; - newGD->setGeographicalID(TotemRPDetId(arm, station, rp, detector)); + newGD->setGeographicalID( TotemRPDetId( arm, station, rp, detector ) ); } // strip and pixels RPs - else if (name == DDD_TOTEM_RP_RP_NAME || name == DDD_CTPPS_PIXELS_RP_NAME) { + else if ( name == DDD_TOTEM_RP_RP_NAME || name == DDD_CTPPS_PIXELS_RP_NAME ) { unsigned int decRPId = fv->copyno(); // check if it is a pixel RP - if (decRPId >= 10000) { + if ( decRPId >= 10000 ){ decRPId = decRPId % 10000; - const unsigned int armIdx = (decRPId / 100) % 10; - const unsigned int stIdx = (decRPId / 10) % 10; + const unsigned int armIdx = ( decRPId / 100 ) % 10; + const unsigned int stIdx = ( decRPId / 10 ) % 10; const unsigned int rpIdx = decRPId % 10; - newGD->setGeographicalID(CTPPSPixelDetId(armIdx, stIdx, rpIdx)); - } else { - const unsigned int armIdx = (decRPId / 100) % 10; - const unsigned int stIdx = (decRPId / 10) % 10; + newGD->setGeographicalID( CTPPSPixelDetId( armIdx, stIdx, rpIdx ) ); + } + else { + const unsigned int armIdx = ( decRPId / 100 ) % 10; + const unsigned int stIdx = ( decRPId / 10 ) % 10; const unsigned int rpIdx = decRPId % 10; - newGD->setGeographicalID(TotemRPDetId(armIdx, stIdx, rpIdx)); + newGD->setGeographicalID( TotemRPDetId( armIdx, stIdx, rpIdx ) ); } } - else if (std::regex_match(name, std::regex(DDD_TOTEM_TIMING_SENSOR_TMPL))) { + else if ( std::regex_match( name, std::regex( DDD_TOTEM_TIMING_SENSOR_TMPL ) ) ) { const std::vector& copy_num = fv->copyNumbers(); // check size of copy numbers array - if (copy_num.size() < 4) - throw cms::Exception("DDDTotemRPContruction") - << "size of copyNumbers for TOTEM timing sensor is " << copy_num.size() << ". It must be >= 4."; - - const unsigned int decRPId = copy_num[copy_num.size() - 4]; - const unsigned int arm = decRPId / 100, station = (decRPId % 100) / 10, rp = decRPId % 10; - const unsigned int plane = copy_num[copy_num.size() - 2], channel = copy_num[copy_num.size() - 1]; - newGD->setGeographicalID(TotemTimingDetId(arm, station, rp, plane, channel)); + if ( copy_num.size() < 4 ) + throw cms::Exception("DDDTotemRPContruction") << "size of copyNumbers for TOTEM timing sensor is " + << copy_num.size() << ". It must be >= 4."; + + const unsigned int decRPId = copy_num[copy_num.size()-4]; + const unsigned int arm = decRPId / 100, station = ( decRPId % 100 )/10, rp = decRPId % 10; + const unsigned int plane = copy_num[copy_num.size()-2], channel = copy_num[copy_num.size()-1]; + newGD->setGeographicalID( TotemTimingDetId( arm, station, rp, plane, channel ) ); } - else if (name == DDD_TOTEM_TIMING_RP_NAME) { - const unsigned int arm = fv->copyno() / 100, station = (fv->copyno() % 100) / 10, rp = fv->copyno() % 10; - newGD->setGeographicalID(TotemTimingDetId(arm, station, rp)); + else if ( name == DDD_TOTEM_TIMING_RP_NAME ) { + const unsigned int arm = fv->copyno() / 100, station = ( fv->copyno() % 100 )/10, rp = fv->copyno() % 10; + newGD->setGeographicalID( TotemTimingDetId( arm, station, rp ) ); } // pixel sensors - else if (name == DDD_CTPPS_PIXELS_SENSOR_NAME) { + else if ( name == DDD_CTPPS_PIXELS_SENSOR_NAME ) { const std::vector& copy_num = fv->copyNumbers(); // check size of copy numubers array - if (copy_num.size() < 4) - throw cms::Exception("DDDTotemRPContruction") - << "size of copyNumbers for pixel sensor is " << copy_num.size() << ". It must be >= 4."; + if ( copy_num.size() < 4 ) + throw cms::Exception("DDDTotemRPContruction") << "size of copyNumbers for pixel sensor is " + << copy_num.size() << ". It must be >= 4."; // extract information const unsigned int decRPId = copy_num[copy_num.size() - 4] % 10000; const unsigned int arm = decRPId / 100; - const unsigned int station = (decRPId % 100) / 10; + const unsigned int station = ( decRPId % 100 ) / 10; const unsigned int rp = decRPId % 10; const unsigned int detector = copy_num[copy_num.size() - 2] - 1; - newGD->setGeographicalID(CTPPSPixelDetId(arm, station, rp, detector)); + newGD->setGeographicalID( CTPPSPixelDetId( arm, station, rp, detector ) ); } // diamond/UFSD sensors - else if (name == DDD_CTPPS_DIAMONDS_SEGMENT_NAME || name == DDD_CTPPS_UFSD_SEGMENT_NAME) { + else if ( name == DDD_CTPPS_DIAMONDS_SEGMENT_NAME || name == DDD_CTPPS_UFSD_SEGMENT_NAME ) { const std::vector& copy_num = fv->copyNumbers(); - const unsigned int id = copy_num[copy_num.size() - 1]; - const unsigned int arm = copy_num[1] - 1; - const unsigned int station = 1; - const unsigned int rp = 6; - const unsigned int plane = (id / 100); + std::cout<<"s"<setGeographicalID(CTPPSDiamondDetId(arm, station, rp, plane, channel)); + newGD->setGeographicalID( CTPPSDiamondDetId( arm, station, rp, plane, channel ) ); } // diamond/UFSD RPs - else if (name == DDD_CTPPS_DIAMONDS_RP_NAME) { - const std::vector& copy_num = fv->copyNumbers(); - - // check size of copy numubers array - if (copy_num.size() < 2) - throw cms::Exception("DDDTotemRPContruction") - << "size of copyNumbers for diamond RP is " << copy_num.size() << ". It must be >= 2."; + else if ( name == DDD_CTPPS_DIAMONDS_RP_NAME ) { + const std::vector& copy_num = fv->copyNumbers(); + + std::cout<<"d"<= 2."; - const unsigned int arm = copy_num[1] - 1; - const unsigned int station = 1; - const unsigned int rp = 6; +// const unsigned int arm = copy_num[1] - 1; + const unsigned int csize= copy_num.size(); + const unsigned int arm = copy_num[csize-2]%1000/100; + const unsigned int station = copy_num[csize-2]%100/10; + const unsigned int rp = copy_num[csize-2]%10; - newGD->setGeographicalID(CTPPSDiamondDetId(arm, station, rp)); + newGD->setGeographicalID( CTPPSDiamondDetId( arm, station, rp ) ); } // add component - gd->addComponent(newGD); + gd->addComponent( newGD ); // recursion - buildDetGeomDesc(fv, newGD); - } while (fv->nextSibling()); + buildDetGeomDesc( fv, newGD ); + } while ( fv->nextSibling() ); // go a level up fv->parent(); @@ -300,17 +316,19 @@ void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd //---------------------------------------------------------------------------------------------------- -std::unique_ptr CTPPSGeometryESModule::produceIdealGD(const IdealGeometryRecord& iRecord) { +std::unique_ptr +CTPPSGeometryESModule::produceIdealGD( const IdealGeometryRecord& iRecord ) +{ // get the DDCompactView from EventSetup - auto const& cpv = iRecord.get(compactViewToken_); + auto const& cpv = iRecord.get( compactViewToken_); // create DDFilteredView and apply the filter DDPassAllFilter filter; - DDFilteredView fv(cpv, filter); + DDFilteredView fv( cpv, filter ); // conversion to DetGeomDesc structure - auto root = std::make_unique(&fv); - buildDetGeomDesc(&fv, root.get()); + auto root = std::make_unique( &fv ); + buildDetGeomDesc( &fv, root.get() ); // construct the tree of DetGeomDesc return root; @@ -318,66 +336,73 @@ std::unique_ptr CTPPSGeometryESModule::produceIdealGD(const IdealGe //---------------------------------------------------------------------------------------------------- -template -std::unique_ptr CTPPSGeometryESModule::produceGD(IdealGeometryRecord const& iIdealRec, - std::optional const& iAlignRec, - GDTokens const& iTokens, - const char* name) { +template +std::unique_ptr +CTPPSGeometryESModule::produceGD(IdealGeometryRecord const& iIdealRec, + std::optional const& iAlignRec, + GDTokens const& iTokens, + const char* name) { // get the input GeometricalDet - auto const& idealGD = iIdealRec.get(iTokens.idealGDToken_); + auto const& idealGD = iIdealRec.get( iTokens.idealGDToken_ ); // load alignments edm::ESHandle alignments; - if (iAlignRec) { + if(iAlignRec) { alignments = iAlignRec->getHandle(iTokens.alignmentToken_); } - if (alignments.isValid()) { - if (verbosity_) - edm::LogVerbatim(name) << ">> " << name << " > Real geometry: " << alignments->getRPMap().size() << " RP and " - << alignments->getSensorMap().size() << " sensor alignments applied."; - } else { - if (verbosity_) - edm::LogVerbatim(name) << ">> " << name << " > Real geometry: No alignments applied."; + if ( alignments.isValid() ) { + if ( verbosity_ ) + edm::LogVerbatim(name) + << ">> "< Real geometry: " + << alignments->getRPMap().size() << " RP and " + << alignments->getSensorMap().size() << " sensor alignments applied."; + } + else { + if ( verbosity_ ) + edm::LogVerbatim(name) + << ">> "< Real geometry: No alignments applied."; } DetGeomDesc* newGD = nullptr; - applyAlignments(idealGD, alignments.product(), newGD); - return std::unique_ptr(newGD); + applyAlignments( idealGD, alignments.product(), newGD ); + return std::unique_ptr( newGD ); } -std::unique_ptr CTPPSGeometryESModule::produceRealGD(const VeryForwardRealGeometryRecord& iRecord) { - return produceGD(iRecord.getRecord(), - iRecord.tryToGetRecord(), - gdRealTokens_, +std::unique_ptr +CTPPSGeometryESModule::produceRealGD( const VeryForwardRealGeometryRecord& iRecord ) +{ + return produceGD(iRecord.getRecord(), iRecord.tryToGetRecord(), gdRealTokens_, "CTPPSGeometryESModule::produceRealGD"); } //---------------------------------------------------------------------------------------------------- -std::unique_ptr CTPPSGeometryESModule::produceMisalignedGD( - const VeryForwardMisalignedGeometryRecord& iRecord) { - return produceGD(iRecord.getRecord(), - iRecord.tryToGetRecord(), - gdMisTokens_, +std::unique_ptr +CTPPSGeometryESModule::produceMisalignedGD( const VeryForwardMisalignedGeometryRecord& iRecord ) +{ + return produceGD(iRecord.getRecord(), iRecord.tryToGetRecord(), gdMisTokens_, "CTPPSGeometryESModule::produceMisalignedGD"); } //---------------------------------------------------------------------------------------------------- -std::unique_ptr CTPPSGeometryESModule::produceRealTG(const VeryForwardRealGeometryRecord& iRecord) { - auto const& gD = iRecord.get(dgdRealToken_); +std::unique_ptr +CTPPSGeometryESModule::produceRealTG( const VeryForwardRealGeometryRecord& iRecord ) +{ + auto const& gD = iRecord.get( dgdRealToken_ ); - return std::make_unique(&gD); + return std::make_unique( &gD ); } //---------------------------------------------------------------------------------------------------- -std::unique_ptr CTPPSGeometryESModule::produceMisalignedTG( - const VeryForwardMisalignedGeometryRecord& iRecord) { - auto const& gD = iRecord.get(dgdMisToken_); +std::unique_ptr +CTPPSGeometryESModule::produceMisalignedTG( const VeryForwardMisalignedGeometryRecord& iRecord ) +{ + auto const& gD = iRecord.get( dgdMisToken_ ); - return std::make_unique(&gD); + return std::make_unique( &gD ); } -DEFINE_FWK_EVENTSETUP_MODULE(CTPPSGeometryESModule); +DEFINE_FWK_EVENTSETUP_MODULE( CTPPSGeometryESModule ); From c23cf87d793ecdf2740cf27041a1eb1d11a4165b Mon Sep 17 00:00:00 2001 From: Jacek Kusnierz Date: Tue, 6 Aug 2019 13:47:48 +0200 Subject: [PATCH 02/64] correct diamond detector software --- .../plugins/CTPPSGeometryESModule.cc | 331 ++++++++---------- 1 file changed, 154 insertions(+), 177 deletions(-) diff --git a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc index 6499d67f060d4..ae2eb9f4dea15 100644 --- a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc +++ b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc @@ -49,89 +49,85 @@ * * Second, it creates CTPPSGeometry from DetGeoDesc tree. **/ -class CTPPSGeometryESModule : public edm::ESProducer -{ - public: - CTPPSGeometryESModule( const edm::ParameterSet& ); - ~CTPPSGeometryESModule() override {} +class CTPPSGeometryESModule : public edm::ESProducer { +public: + CTPPSGeometryESModule(const edm::ParameterSet&); + ~CTPPSGeometryESModule() override {} static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - private: - std::unique_ptr produceIdealGD( const IdealGeometryRecord& ); +private: + std::unique_ptr produceIdealGD(const IdealGeometryRecord&); - template struct GDTokens { - explicit GDTokens( edm::ESConsumesCollector&& iCC): - idealGDToken_{iCC.consumesFrom(edm::ESInputTag())}, - alignmentToken_{iCC.consumesFrom(edm::ESInputTag())} - {} - const edm::ESGetToken idealGDToken_; - const edm::ESGetToken alignmentToken_; - }; + template + struct GDTokens { + explicit GDTokens(edm::ESConsumesCollector&& iCC) + : idealGDToken_{iCC.consumesFrom(edm::ESInputTag())}, + alignmentToken_{iCC.consumesFrom(edm::ESInputTag())} {} + const edm::ESGetToken idealGDToken_; + const edm::ESGetToken alignmentToken_; + }; - std::unique_ptr produceRealGD( const VeryForwardRealGeometryRecord& ); - std::unique_ptr produceRealTG( const VeryForwardRealGeometryRecord& ); + std::unique_ptr produceRealGD(const VeryForwardRealGeometryRecord&); + std::unique_ptr produceRealTG(const VeryForwardRealGeometryRecord&); - std::unique_ptr produceMisalignedGD( const VeryForwardMisalignedGeometryRecord& ); - std::unique_ptr produceMisalignedTG( const VeryForwardMisalignedGeometryRecord& ); + std::unique_ptr produceMisalignedGD(const VeryForwardMisalignedGeometryRecord&); + std::unique_ptr produceMisalignedTG(const VeryForwardMisalignedGeometryRecord&); - template - std::unique_ptr produceGD( IdealGeometryRecord const&, const std::optional&, GDTokens const&, const char* name); - + template + std::unique_ptr produceGD(IdealGeometryRecord const&, + const std::optional&, + GDTokens const&, + const char* name); - static void applyAlignments( const DetGeomDesc&, const CTPPSRPAlignmentCorrectionsData*, DetGeomDesc*& ); - static void buildDetGeomDesc( DDFilteredView* fv, DetGeomDesc* gd ); + static void applyAlignments(const DetGeomDesc&, const CTPPSRPAlignmentCorrectionsData*, DetGeomDesc*&); + static void buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd); - const unsigned int verbosity_; - const edm::ESGetToken compactViewToken_; + const unsigned int verbosity_; + const edm::ESGetToken compactViewToken_; - const GDTokens gdRealTokens_; - const GDTokens gdMisTokens_; - - const edm::ESGetToken dgdRealToken_; - const edm::ESGetToken dgdMisToken_; + const GDTokens gdRealTokens_; + const GDTokens gdMisTokens_; + const edm::ESGetToken dgdRealToken_; + const edm::ESGetToken dgdMisToken_; }; - //---------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------- -CTPPSGeometryESModule::CTPPSGeometryESModule(const edm::ParameterSet& iConfig) : - verbosity_( iConfig.getUntrackedParameter( "verbosity") ), - compactViewToken_{ setWhatProduced( this, &CTPPSGeometryESModule::produceIdealGD ) - .consumes(edm::ESInputTag(""/*optional module label */, - iConfig.getParameter( "compactViewTag" ) )) }, - gdRealTokens_{ setWhatProduced( this, &CTPPSGeometryESModule::produceRealGD ) }, - gdMisTokens_{ setWhatProduced( this, &CTPPSGeometryESModule::produceMisalignedGD ) }, - dgdRealToken_{ setWhatProduced( this, &CTPPSGeometryESModule::produceRealTG ).consumes(edm::ESInputTag()) }, - dgdMisToken_{ setWhatProduced( this, &CTPPSGeometryESModule::produceMisalignedTG ).consumes(edm::ESInputTag()) } -{ +CTPPSGeometryESModule::CTPPSGeometryESModule(const edm::ParameterSet& iConfig) + : verbosity_(iConfig.getUntrackedParameter("verbosity")), + compactViewToken_{setWhatProduced(this, &CTPPSGeometryESModule::produceIdealGD) + .consumes(edm::ESInputTag( + "" /*optional module label */, iConfig.getParameter("compactViewTag")))}, + gdRealTokens_{setWhatProduced(this, &CTPPSGeometryESModule::produceRealGD)}, + gdMisTokens_{setWhatProduced(this, &CTPPSGeometryESModule::produceMisalignedGD)}, + dgdRealToken_{ + setWhatProduced(this, &CTPPSGeometryESModule::produceRealTG).consumes(edm::ESInputTag())}, + dgdMisToken_{ + setWhatProduced(this, &CTPPSGeometryESModule::produceMisalignedTG).consumes(edm::ESInputTag())} { } -void -CTPPSGeometryESModule::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { +void CTPPSGeometryESModule::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.addUntracked("verbosity", 1); desc.add("compactViewTag", std::string()); descriptions.add("DoodadESSource", desc); } - //---------------------------------------------------------------------------------------------------- -void -CTPPSGeometryESModule::applyAlignments( const DetGeomDesc& idealGD, - const CTPPSRPAlignmentCorrectionsData* alignments, - DetGeomDesc*& newGD ) -{ - newGD = new DetGeomDesc( idealGD ); +void CTPPSGeometryESModule::applyAlignments(const DetGeomDesc& idealGD, + const CTPPSRPAlignmentCorrectionsData* alignments, + DetGeomDesc*& newGD) { + newGD = new DetGeomDesc(idealGD); std::deque buffer; std::deque bufferNew; - buffer.emplace_back( &idealGD ); - bufferNew.emplace_back( newGD ); + buffer.emplace_back(&idealGD); + bufferNew.emplace_back(newGD); - while ( !buffer.empty() ) { + while (!buffer.empty()) { const DetGeomDesc* sD = buffer.front(); DetGeomDesc* pD = bufferNew.front(); buffer.pop_front(); @@ -140,175 +136,164 @@ CTPPSGeometryESModule::applyAlignments( const DetGeomDesc& idealGD, const std::string name = pD->name(); // Is it sensor? If yes, apply full sensor alignments - if ( name == DDD_TOTEM_RP_SENSOR_NAME - || name == DDD_CTPPS_DIAMONDS_SEGMENT_NAME - || name == DDD_CTPPS_UFSD_SEGMENT_NAME - || name == DDD_CTPPS_PIXELS_SENSOR_NAME - || std::regex_match( name, std::regex( DDD_TOTEM_TIMING_SENSOR_TMPL ) )) { + if (name == DDD_TOTEM_RP_SENSOR_NAME || name == DDD_CTPPS_DIAMONDS_SEGMENT_NAME || + name == DDD_CTPPS_UFSD_SEGMENT_NAME || name == DDD_CTPPS_PIXELS_SENSOR_NAME || + std::regex_match(name, std::regex(DDD_TOTEM_TIMING_SENSOR_TMPL))) { unsigned int plId = pD->geographicalID(); - if ( alignments ) { - const auto& ac = alignments->getFullSensorCorrection( plId ); - pD->applyAlignment( ac ); + if (alignments) { + const auto& ac = alignments->getFullSensorCorrection(plId); + pD->applyAlignment(ac); } } // Is it RP box? If yes, apply RP alignments - if ( name == DDD_TOTEM_RP_RP_NAME - || name == DDD_CTPPS_DIAMONDS_RP_NAME - || name == DDD_CTPPS_PIXELS_RP_NAME - || name == DDD_TOTEM_TIMING_RP_NAME ) { + if (name == DDD_TOTEM_RP_RP_NAME || name == DDD_CTPPS_DIAMONDS_RP_NAME || name == DDD_CTPPS_PIXELS_RP_NAME || + name == DDD_TOTEM_TIMING_RP_NAME) { unsigned int rpId = pD->geographicalID(); - if ( alignments ) { - const auto& ac = alignments->getRPCorrection( rpId ); - pD->applyAlignment( ac ); + if (alignments) { + const auto& ac = alignments->getRPCorrection(rpId); + pD->applyAlignment(ac); } } // create and add children - for ( unsigned int i = 0; i < sD->components().size(); i++ ) { + for (unsigned int i = 0; i < sD->components().size(); i++) { const DetGeomDesc* sDC = sD->components()[i]; - buffer.emplace_back( sDC ); + buffer.emplace_back(sDC); // create new node with the same information as in sDC and add it as a child of pD - DetGeomDesc* cD = new DetGeomDesc( *sDC ); - pD->addComponent( cD ); + DetGeomDesc* cD = new DetGeomDesc(*sDC); + pD->addComponent(cD); - bufferNew.emplace_back( cD ); + bufferNew.emplace_back(cD); } } } //---------------------------------------------------------------------------------------------------- -void -CTPPSGeometryESModule::buildDetGeomDesc( DDFilteredView* fv, DetGeomDesc* gd ) -{ +void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd) { // try to dive into next level - if ( !fv->firstChild() ) return; + if (!fv->firstChild()) + return; // loop over siblings in the level do { // create new DetGeomDesc node and add it to the parent's (gd) list - DetGeomDesc* newGD = new DetGeomDesc( fv ); + DetGeomDesc* newGD = new DetGeomDesc(fv); const std::string name = fv->logicalPart().name().name(); // strip sensors - if ( name == DDD_TOTEM_RP_SENSOR_NAME ) { + if (name == DDD_TOTEM_RP_SENSOR_NAME) { const std::vector& copy_num = fv->copyNumbers(); // check size of copy numubers array - if ( copy_num.size() < 3 ) - throw cms::Exception("DDDTotemRPContruction") << "size of copyNumbers for strip sensor is " - << copy_num.size() << ". It must be >= 3."; + if (copy_num.size() < 3) + throw cms::Exception("DDDTotemRPContruction") + << "size of copyNumbers for strip sensor is " << copy_num.size() << ". It must be >= 3."; // extract information const unsigned int decRPId = copy_num[copy_num.size() - 3]; const unsigned int arm = decRPId / 100; - const unsigned int station = ( decRPId % 100 ) / 10; + const unsigned int station = (decRPId % 100) / 10; const unsigned int rp = decRPId % 10; const unsigned int detector = copy_num[copy_num.size() - 1]; - newGD->setGeographicalID( TotemRPDetId( arm, station, rp, detector ) ); + newGD->setGeographicalID(TotemRPDetId(arm, station, rp, detector)); } // strip and pixels RPs - else if ( name == DDD_TOTEM_RP_RP_NAME || name == DDD_CTPPS_PIXELS_RP_NAME ) { + else if (name == DDD_TOTEM_RP_RP_NAME || name == DDD_CTPPS_PIXELS_RP_NAME) { unsigned int decRPId = fv->copyno(); // check if it is a pixel RP - if ( decRPId >= 10000 ){ + if (decRPId >= 10000) { decRPId = decRPId % 10000; - const unsigned int armIdx = ( decRPId / 100 ) % 10; - const unsigned int stIdx = ( decRPId / 10 ) % 10; + const unsigned int armIdx = (decRPId / 100) % 10; + const unsigned int stIdx = (decRPId / 10) % 10; const unsigned int rpIdx = decRPId % 10; - newGD->setGeographicalID( CTPPSPixelDetId( armIdx, stIdx, rpIdx ) ); - } - else { - const unsigned int armIdx = ( decRPId / 100 ) % 10; - const unsigned int stIdx = ( decRPId / 10 ) % 10; + newGD->setGeographicalID(CTPPSPixelDetId(armIdx, stIdx, rpIdx)); + } else { + const unsigned int armIdx = (decRPId / 100) % 10; + const unsigned int stIdx = (decRPId / 10) % 10; const unsigned int rpIdx = decRPId % 10; - newGD->setGeographicalID( TotemRPDetId( armIdx, stIdx, rpIdx ) ); + newGD->setGeographicalID(TotemRPDetId(armIdx, stIdx, rpIdx)); } } - else if ( std::regex_match( name, std::regex( DDD_TOTEM_TIMING_SENSOR_TMPL ) ) ) { + else if (std::regex_match(name, std::regex(DDD_TOTEM_TIMING_SENSOR_TMPL))) { const std::vector& copy_num = fv->copyNumbers(); // check size of copy numbers array - if ( copy_num.size() < 4 ) - throw cms::Exception("DDDTotemRPContruction") << "size of copyNumbers for TOTEM timing sensor is " - << copy_num.size() << ". It must be >= 4."; - - const unsigned int decRPId = copy_num[copy_num.size()-4]; - const unsigned int arm = decRPId / 100, station = ( decRPId % 100 )/10, rp = decRPId % 10; - const unsigned int plane = copy_num[copy_num.size()-2], channel = copy_num[copy_num.size()-1]; - newGD->setGeographicalID( TotemTimingDetId( arm, station, rp, plane, channel ) ); + if (copy_num.size() < 4) + throw cms::Exception("DDDTotemRPContruction") + << "size of copyNumbers for TOTEM timing sensor is " << copy_num.size() << ". It must be >= 4."; + + const unsigned int decRPId = copy_num[copy_num.size() - 4]; + const unsigned int arm = decRPId / 100, station = (decRPId % 100) / 10, rp = decRPId % 10; + const unsigned int plane = copy_num[copy_num.size() - 2], channel = copy_num[copy_num.size() - 1]; + newGD->setGeographicalID(TotemTimingDetId(arm, station, rp, plane, channel)); } - else if ( name == DDD_TOTEM_TIMING_RP_NAME ) { - const unsigned int arm = fv->copyno() / 100, station = ( fv->copyno() % 100 )/10, rp = fv->copyno() % 10; - newGD->setGeographicalID( TotemTimingDetId( arm, station, rp ) ); + else if (name == DDD_TOTEM_TIMING_RP_NAME) { + const unsigned int arm = fv->copyno() / 100, station = (fv->copyno() % 100) / 10, rp = fv->copyno() % 10; + newGD->setGeographicalID(TotemTimingDetId(arm, station, rp)); } // pixel sensors - else if ( name == DDD_CTPPS_PIXELS_SENSOR_NAME ) { + else if (name == DDD_CTPPS_PIXELS_SENSOR_NAME) { const std::vector& copy_num = fv->copyNumbers(); // check size of copy numubers array - if ( copy_num.size() < 4 ) - throw cms::Exception("DDDTotemRPContruction") << "size of copyNumbers for pixel sensor is " - << copy_num.size() << ". It must be >= 4."; + if (copy_num.size() < 4) + throw cms::Exception("DDDTotemRPContruction") + << "size of copyNumbers for pixel sensor is " << copy_num.size() << ". It must be >= 4."; // extract information const unsigned int decRPId = copy_num[copy_num.size() - 4] % 10000; const unsigned int arm = decRPId / 100; - const unsigned int station = ( decRPId % 100 ) / 10; + const unsigned int station = (decRPId % 100) / 10; const unsigned int rp = decRPId % 10; const unsigned int detector = copy_num[copy_num.size() - 2] - 1; - newGD->setGeographicalID( CTPPSPixelDetId( arm, station, rp, detector ) ); + newGD->setGeographicalID(CTPPSPixelDetId(arm, station, rp, detector)); } // diamond/UFSD sensors - else if ( name == DDD_CTPPS_DIAMONDS_SEGMENT_NAME || name == DDD_CTPPS_UFSD_SEGMENT_NAME ) { + else if (name == DDD_CTPPS_DIAMONDS_SEGMENT_NAME || name == DDD_CTPPS_UFSD_SEGMENT_NAME) { const std::vector& copy_num = fv->copyNumbers(); - std::cout<<"s"<setGeographicalID( CTPPSDiamondDetId( arm, station, rp, plane, channel ) ); + newGD->setGeographicalID(CTPPSDiamondDetId(arm, station, rp, plane, channel)); } // diamond/UFSD RPs - else if ( name == DDD_CTPPS_DIAMONDS_RP_NAME ) { - const std::vector& copy_num = fv->copyNumbers(); - - std::cout<<"d"<= 2."; + else if (name == DDD_CTPPS_DIAMONDS_RP_NAME) { + const std::vector& copy_num = fv->copyNumbers(); -// const unsigned int arm = copy_num[1] - 1; + // check size of copy numubers array + if (copy_num.size() < 2) + throw cms::Exception("DDDTotemRPContruction") + << "size of copyNumbers for diamond RP is " << copy_num.size() << ". It must be >= 2."; const unsigned int csize= copy_num.size(); const unsigned int arm = copy_num[csize-2]%1000/100; const unsigned int station = copy_num[csize-2]%100/10; const unsigned int rp = copy_num[csize-2]%10; - newGD->setGeographicalID( CTPPSDiamondDetId( arm, station, rp ) ); + newGD->setGeographicalID(CTPPSDiamondDetId(arm, station, rp)); } // add component - gd->addComponent( newGD ); + gd->addComponent(newGD); // recursion - buildDetGeomDesc( fv, newGD ); - } while ( fv->nextSibling() ); + buildDetGeomDesc(fv, newGD); + } while (fv->nextSibling()); // go a level up fv->parent(); @@ -316,19 +301,17 @@ CTPPSGeometryESModule::buildDetGeomDesc( DDFilteredView* fv, DetGeomDesc* gd ) //---------------------------------------------------------------------------------------------------- -std::unique_ptr -CTPPSGeometryESModule::produceIdealGD( const IdealGeometryRecord& iRecord ) -{ +std::unique_ptr CTPPSGeometryESModule::produceIdealGD(const IdealGeometryRecord& iRecord) { // get the DDCompactView from EventSetup - auto const& cpv = iRecord.get( compactViewToken_); + auto const& cpv = iRecord.get(compactViewToken_); // create DDFilteredView and apply the filter DDPassAllFilter filter; - DDFilteredView fv( cpv, filter ); + DDFilteredView fv(cpv, filter); // conversion to DetGeomDesc structure - auto root = std::make_unique( &fv ); - buildDetGeomDesc( &fv, root.get() ); + auto root = std::make_unique(&fv); + buildDetGeomDesc(&fv, root.get()); // construct the tree of DetGeomDesc return root; @@ -336,73 +319,67 @@ CTPPSGeometryESModule::produceIdealGD( const IdealGeometryRecord& iRecord ) //---------------------------------------------------------------------------------------------------- -template -std::unique_ptr -CTPPSGeometryESModule::produceGD(IdealGeometryRecord const& iIdealRec, - std::optional const& iAlignRec, - GDTokens const& iTokens, - const char* name) { +template +std::unique_ptr CTPPSGeometryESModule::produceGD(IdealGeometryRecord const& iIdealRec, + std::optional const& iAlignRec, + GDTokens const& iTokens, + const char* name) { // get the input GeometricalDet - auto const& idealGD = iIdealRec.get( iTokens.idealGDToken_ ); + auto const& idealGD = iIdealRec.get(iTokens.idealGDToken_); // load alignments edm::ESHandle alignments; - if(iAlignRec) { + if (iAlignRec) { alignments = iAlignRec->getHandle(iTokens.alignmentToken_); } - if ( alignments.isValid() ) { - if ( verbosity_ ) - edm::LogVerbatim(name) - << ">> "< Real geometry: " - << alignments->getRPMap().size() << " RP and " - << alignments->getSensorMap().size() << " sensor alignments applied."; - } - else { - if ( verbosity_ ) - edm::LogVerbatim(name) - << ">> "< Real geometry: No alignments applied."; + if (alignments.isValid()) { + if (verbosity_) + edm::LogVerbatim(name) << ">> " << name << " > Real geometry: " << alignments->getRPMap().size() << " RP and " + << alignments->getSensorMap().size() << " sensor alignments applied."; + } else { + if (verbosity_) + edm::LogVerbatim(name) << ">> " << name << " > Real geometry: No alignments applied."; } DetGeomDesc* newGD = nullptr; - applyAlignments( idealGD, alignments.product(), newGD ); - return std::unique_ptr( newGD ); + applyAlignments(idealGD, alignments.product(), newGD); + return std::unique_ptr(newGD); } -std::unique_ptr -CTPPSGeometryESModule::produceRealGD( const VeryForwardRealGeometryRecord& iRecord ) -{ - return produceGD(iRecord.getRecord(), iRecord.tryToGetRecord(), gdRealTokens_, +std::unique_ptr CTPPSGeometryESModule::produceRealGD(const VeryForwardRealGeometryRecord& iRecord) { + return produceGD(iRecord.getRecord(), + iRecord.tryToGetRecord(), + gdRealTokens_, "CTPPSGeometryESModule::produceRealGD"); } //---------------------------------------------------------------------------------------------------- -std::unique_ptr -CTPPSGeometryESModule::produceMisalignedGD( const VeryForwardMisalignedGeometryRecord& iRecord ) -{ - return produceGD(iRecord.getRecord(), iRecord.tryToGetRecord(), gdMisTokens_, +std::unique_ptr CTPPSGeometryESModule::produceMisalignedGD( + const VeryForwardMisalignedGeometryRecord& iRecord) { + return produceGD(iRecord.getRecord(), + iRecord.tryToGetRecord(), + gdMisTokens_, "CTPPSGeometryESModule::produceMisalignedGD"); } //---------------------------------------------------------------------------------------------------- -std::unique_ptr -CTPPSGeometryESModule::produceRealTG( const VeryForwardRealGeometryRecord& iRecord ) -{ - auto const& gD = iRecord.get( dgdRealToken_ ); +std::unique_ptr CTPPSGeometryESModule::produceRealTG(const VeryForwardRealGeometryRecord& iRecord) { + auto const& gD = iRecord.get(dgdRealToken_); - return std::make_unique( &gD ); + return std::make_unique(&gD); } //---------------------------------------------------------------------------------------------------- -std::unique_ptr -CTPPSGeometryESModule::produceMisalignedTG( const VeryForwardMisalignedGeometryRecord& iRecord ) -{ - auto const& gD = iRecord.get( dgdMisToken_ ); +std::unique_ptr CTPPSGeometryESModule::produceMisalignedTG( + const VeryForwardMisalignedGeometryRecord& iRecord) { + auto const& gD = iRecord.get(dgdMisToken_); - return std::make_unique( &gD ); + return std::make_unique(&gD); } -DEFINE_FWK_EVENTSETUP_MODULE( CTPPSGeometryESModule ); +DEFINE_FWK_EVENTSETUP_MODULE(CTPPSGeometryESModule); + From 51cafa0c641a75ca01bbea18555f3cf1cd969c95 Mon Sep 17 00:00:00 2001 From: Jacek Kusnierz Date: Tue, 6 Aug 2019 14:57:05 +0200 Subject: [PATCH 03/64] minor naming correction --- .../plugins/CTPPSGeometryESModule.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc index ae2eb9f4dea15..6a82110b8d7b8 100644 --- a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc +++ b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc @@ -262,10 +262,10 @@ void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd const std::vector& copy_num = fv->copyNumbers(); const unsigned int id = copy_num[copy_num.size()-1]; - const unsigned int csize= copy_num.size(); - const unsigned int arm = copy_num[csize-4]%1000/100; - const unsigned int station = copy_num[csize-4]%100/10; - const unsigned int rp = copy_num[csize-4]%10; + const unsigned int decRPId= copy_num(copy_num.size()-4); + const unsigned int arm = decRPId%1000/100; + const unsigned int station = decRPId%100/10; + const unsigned int rp = decRPId%10; const unsigned int plane = ( id / 100 ); const unsigned int channel = id % 100; @@ -280,10 +280,10 @@ void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd if (copy_num.size() < 2) throw cms::Exception("DDDTotemRPContruction") << "size of copyNumbers for diamond RP is " << copy_num.size() << ". It must be >= 2."; - const unsigned int csize= copy_num.size(); - const unsigned int arm = copy_num[csize-2]%1000/100; - const unsigned int station = copy_num[csize-2]%100/10; - const unsigned int rp = copy_num[csize-2]%10; + const unsigned int decRPId= copy_num(copy_num.size()-2); + const unsigned int arm = decRPId%1000/100; + const unsigned int station = decRPId%100/10; + const unsigned int rp = decRPId%10; newGD->setGeographicalID(CTPPSDiamondDetId(arm, station, rp)); } From ae4d2cb63dab142076596083b9834a9d35a93615 Mon Sep 17 00:00:00 2001 From: Jacek Kusnierz Date: Tue, 6 Aug 2019 15:13:52 +0200 Subject: [PATCH 04/64] fix array --- .../plugins/CTPPSGeometryESModule.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc index 6a82110b8d7b8..be9d43d688dad 100644 --- a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc +++ b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc @@ -262,7 +262,7 @@ void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd const std::vector& copy_num = fv->copyNumbers(); const unsigned int id = copy_num[copy_num.size()-1]; - const unsigned int decRPId= copy_num(copy_num.size()-4); + const unsigned int decRPId= copy_num[copy_num.size()-4]; const unsigned int arm = decRPId%1000/100; const unsigned int station = decRPId%100/10; const unsigned int rp = decRPId%10; @@ -280,7 +280,7 @@ void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd if (copy_num.size() < 2) throw cms::Exception("DDDTotemRPContruction") << "size of copyNumbers for diamond RP is " << copy_num.size() << ". It must be >= 2."; - const unsigned int decRPId= copy_num(copy_num.size()-2); + const unsigned int decRPId= copy_num[copy_num.size()-2]; const unsigned int arm = decRPId%1000/100; const unsigned int station = decRPId%100/10; const unsigned int rp = decRPId%10; From da55fc08dec5402fc8bc6d8c4098eae18383b97a Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Mon, 15 Jun 2020 18:04:23 +0200 Subject: [PATCH 05/64] CMS style --- .../plugins/CTPPSGeometryESModule.cc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc index be9d43d688dad..4077cb80c9a55 100644 --- a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc +++ b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc @@ -261,12 +261,12 @@ void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd else if (name == DDD_CTPPS_DIAMONDS_SEGMENT_NAME || name == DDD_CTPPS_UFSD_SEGMENT_NAME) { const std::vector& copy_num = fv->copyNumbers(); + const unsigned int decRPId= copy_num[1]; const unsigned int id = copy_num[copy_num.size()-1]; - const unsigned int decRPId= copy_num[copy_num.size()-4]; - const unsigned int arm = decRPId%1000/100; - const unsigned int station = decRPId%100/10; - const unsigned int rp = decRPId%10; - const unsigned int plane = ( id / 100 ); + const unsigned int arm = (decRPId % 1000) / 100; + const unsigned int station = (decRPId % 100) / 10; + const unsigned int rp = decRPId % 10; + const unsigned int plane = id / 100; const unsigned int channel = id % 100; newGD->setGeographicalID(CTPPSDiamondDetId(arm, station, rp, plane, channel)); @@ -280,10 +280,11 @@ void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd if (copy_num.size() < 2) throw cms::Exception("DDDTotemRPContruction") << "size of copyNumbers for diamond RP is " << copy_num.size() << ". It must be >= 2."; - const unsigned int decRPId= copy_num[copy_num.size()-2]; - const unsigned int arm = decRPId%1000/100; - const unsigned int station = decRPId%100/10; - const unsigned int rp = decRPId%10; + + const unsigned int decRPId= copy_num[1]; + const unsigned int arm = (decRPId % 1000) / 100; + const unsigned int station = (decRPId % 100)/10; + const unsigned int rp = decRPId % 10; newGD->setGeographicalID(CTPPSDiamondDetId(arm, station, rp)); } From 3a43178270cc0ae02b925524d5252aee64d4ec1a Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Mon, 15 Jun 2020 18:05:54 +0200 Subject: [PATCH 06/64] Sanity check on geometry hierarchy --- .../plugins/CTPPSGeometryESModule.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc index 4077cb80c9a55..4811fcdd8499f 100644 --- a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc +++ b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc @@ -261,6 +261,11 @@ void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd else if (name == DDD_CTPPS_DIAMONDS_SEGMENT_NAME || name == DDD_CTPPS_UFSD_SEGMENT_NAME) { const std::vector& copy_num = fv->copyNumbers(); + // check size of copy numbers array + if (copy_num.size() < 2) + throw cms::Exception("DDDTotemRPConstruction") + << "size of copyNumbers for diamond segments is " << copy_num.size() << ". It must be >= 2."; + const unsigned int decRPId= copy_num[1]; const unsigned int id = copy_num[copy_num.size()-1]; const unsigned int arm = (decRPId % 1000) / 100; @@ -276,9 +281,9 @@ void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd else if (name == DDD_CTPPS_DIAMONDS_RP_NAME) { const std::vector& copy_num = fv->copyNumbers(); - // check size of copy numubers array + // check size of copy numbers array if (copy_num.size() < 2) - throw cms::Exception("DDDTotemRPContruction") + throw cms::Exception("DDDTotemRPConstruction") << "size of copyNumbers for diamond RP is " << copy_num.size() << ". It must be >= 2."; const unsigned int decRPId= copy_num[1]; From 6150ff4ed5ab184d51642b9c7d3744befc20dadb Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Mon, 15 Jun 2020 18:25:51 +0200 Subject: [PATCH 07/64] Generalised the tracks reconstruction algorithms multiplicity --- .../interface/CTPPSDiamondTrackRecognition.h | 2 +- .../plugins/CTPPSDiamondLocalTrackFitter.cc | 48 +++++-------------- 2 files changed, 14 insertions(+), 36 deletions(-) diff --git a/RecoPPS/Local/interface/CTPPSDiamondTrackRecognition.h b/RecoPPS/Local/interface/CTPPSDiamondTrackRecognition.h index 4ed4085047558..65236be82aacb 100644 --- a/RecoPPS/Local/interface/CTPPSDiamondTrackRecognition.h +++ b/RecoPPS/Local/interface/CTPPSDiamondTrackRecognition.h @@ -25,7 +25,7 @@ **/ class CTPPSDiamondTrackRecognition : public CTPPSTimingTrackRecognition { public: - CTPPSDiamondTrackRecognition(const edm::ParameterSet& iConfig); + CTPPSDiamondTrackRecognition(const edm::ParameterSet& iConfig = edm::ParameterSet()); void clear() override; /// Feed a new hit to the tracks recognition algorithm diff --git a/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc b/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc index a07904ba9cce7..b4ba9aa63281c 100644 --- a/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc +++ b/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc @@ -28,7 +28,6 @@ class CTPPSDiamondLocalTrackFitter : public edm::stream::EDProducer<> { public: explicit CTPPSDiamondLocalTrackFitter(const edm::ParameterSet&); - ~CTPPSDiamondLocalTrackFitter() override; static void fillDescriptions(edm::ConfigurationDescriptions&); @@ -36,65 +35,44 @@ class CTPPSDiamondLocalTrackFitter : public edm::stream::EDProducer<> { void produce(edm::Event&, const edm::EventSetup&) override; edm::EDGetTokenT > recHitsToken_; - CTPPSDiamondTrackRecognition trk_algo_45_; - CTPPSDiamondTrackRecognition trk_algo_56_; + const edm::ParameterSet trk_algo_params_; + std::unordered_map trk_algo_; }; CTPPSDiamondLocalTrackFitter::CTPPSDiamondLocalTrackFitter(const edm::ParameterSet& iConfig) : recHitsToken_( consumes >(iConfig.getParameter("recHitsTag"))), - trk_algo_45_(iConfig.getParameter("trackingAlgorithmParams")), - trk_algo_56_(iConfig.getParameter("trackingAlgorithmParams")) { + trk_algo_params_(iConfig.getParameter("trackingAlgorithmParams")) { produces >(); } -CTPPSDiamondLocalTrackFitter::~CTPPSDiamondLocalTrackFitter() {} - void CTPPSDiamondLocalTrackFitter::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + // prepare the output auto pOut = std::make_unique >(); edm::Handle > recHits; iEvent.getByToken(recHitsToken_, recHits); - const CTPPSDiamondDetId id_45(0, 1, 6, 0, 0), id_56(1, 1, 6, 0, 0); - - pOut->find_or_insert(id_45); // tracks in 4-5 - edm::DetSet& tracks56 = pOut->find_or_insert(id_56); // tracks in 5-6 - - // workaround to retrieve the detset for 4-5 without losing the reference - edm::DetSet& tracks45 = pOut->operator[](id_45); - // feed hits to the track producers for (const auto& vec : *recHits) { const CTPPSDiamondDetId detid(vec.detId()); + // if algorithm is not found, build it + if (trk_algo_.count(detid) == 0) + trk_algo_[detid] = CTPPSDiamondTrackRecognition(trk_algo_params_); + // remove all hits from the track producers to prepare for the forthcoming event + trk_algo_[detid].clear(); for (const auto& hit : vec) { // skip hits without a leading edge if (hit.ootIndex() == CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING) continue; - - switch (detid.arm()) { - case 0: { - trk_algo_45_.addHit(hit); - } break; - case 1: { - trk_algo_56_.addHit(hit); - } break; - default: - edm::LogWarning("CTPPSDiamondLocalTrackFitter") << "Invalid arm for rechit: " << detid.arm(); - break; - } + trk_algo_[detid].addHit(hit); } + auto& tracks = pOut->find_or_insert(detid); + // retrieve the tracks for both arms + trk_algo_[detid].produceTracks(tracks); } - // retrieve the tracks for both arms - trk_algo_45_.produceTracks(tracks45); - trk_algo_56_.produceTracks(tracks56); - iEvent.put(std::move(pOut)); - - // remove all hits from the track producers to prepare for the next event - trk_algo_45_.clear(); - trk_algo_56_.clear(); } void CTPPSDiamondLocalTrackFitter::fillDescriptions(edm::ConfigurationDescriptions& descr) { From 45eff0cad54198f60c54c9fbef80aa121e2e3909 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Mon, 15 Jun 2020 18:34:19 +0200 Subject: [PATCH 08/64] Added a hash function for CTPPSDetId objects --- DataFormats/CTPPSDetId/interface/CTPPSDetId.h | 11 +++++++++++ .../Local/interface/CTPPSDiamondTrackRecognition.h | 2 +- RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc | 10 +++++----- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/DataFormats/CTPPSDetId/interface/CTPPSDetId.h b/DataFormats/CTPPSDetId/interface/CTPPSDetId.h index e2753e74f8e48..6812b7ce09ce6 100644 --- a/DataFormats/CTPPSDetId/interface/CTPPSDetId.h +++ b/DataFormats/CTPPSDetId/interface/CTPPSDetId.h @@ -153,4 +153,15 @@ class CTPPSDetId : public DetId { std::ostream &operator<<(std::ostream &os, const CTPPSDetId &id); +namespace std +{ + template<> struct hash { + typedef CTPPSDetId argument_type; + typedef std::size_t result_type; + result_type operator()(const argument_type& id) const noexcept { + return std::hash()(id.rawId()); + } + }; +} + #endif diff --git a/RecoPPS/Local/interface/CTPPSDiamondTrackRecognition.h b/RecoPPS/Local/interface/CTPPSDiamondTrackRecognition.h index 65236be82aacb..4ed4085047558 100644 --- a/RecoPPS/Local/interface/CTPPSDiamondTrackRecognition.h +++ b/RecoPPS/Local/interface/CTPPSDiamondTrackRecognition.h @@ -25,7 +25,7 @@ **/ class CTPPSDiamondTrackRecognition : public CTPPSTimingTrackRecognition { public: - CTPPSDiamondTrackRecognition(const edm::ParameterSet& iConfig = edm::ParameterSet()); + CTPPSDiamondTrackRecognition(const edm::ParameterSet& iConfig); void clear() override; /// Feed a new hit to the tracks recognition algorithm diff --git a/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc b/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc index b4ba9aa63281c..e04ef116a9550 100644 --- a/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc +++ b/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc @@ -36,7 +36,7 @@ class CTPPSDiamondLocalTrackFitter : public edm::stream::EDProducer<> { edm::EDGetTokenT > recHitsToken_; const edm::ParameterSet trk_algo_params_; - std::unordered_map trk_algo_; + std::unordered_map > trk_algo_; }; CTPPSDiamondLocalTrackFitter::CTPPSDiamondLocalTrackFitter(const edm::ParameterSet& iConfig) @@ -58,18 +58,18 @@ void CTPPSDiamondLocalTrackFitter::produce(edm::Event& iEvent, const edm::EventS const CTPPSDiamondDetId detid(vec.detId()); // if algorithm is not found, build it if (trk_algo_.count(detid) == 0) - trk_algo_[detid] = CTPPSDiamondTrackRecognition(trk_algo_params_); + trk_algo_[detid].reset(new CTPPSDiamondTrackRecognition(trk_algo_params_)); // remove all hits from the track producers to prepare for the forthcoming event - trk_algo_[detid].clear(); + trk_algo_[detid]->clear(); for (const auto& hit : vec) { // skip hits without a leading edge if (hit.ootIndex() == CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING) continue; - trk_algo_[detid].addHit(hit); + trk_algo_[detid]->addHit(hit); } auto& tracks = pOut->find_or_insert(detid); // retrieve the tracks for both arms - trk_algo_[detid].produceTracks(tracks); + trk_algo_[detid]->produceTracks(tracks); } iEvent.put(std::move(pOut)); From 47b2b9ff98a930d68f8e755e24f6561c71005129 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Mon, 15 Jun 2020 18:38:02 +0200 Subject: [PATCH 09/64] Code-format --- DataFormats/CTPPSDetId/interface/CTPPSDetId.h | 12 +++++------- .../plugins/CTPPSGeometryESModule.cc | 9 ++++----- .../Local/plugins/CTPPSDiamondLocalTrackFitter.cc | 2 +- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/DataFormats/CTPPSDetId/interface/CTPPSDetId.h b/DataFormats/CTPPSDetId/interface/CTPPSDetId.h index 6812b7ce09ce6..fa3a4be55be84 100644 --- a/DataFormats/CTPPSDetId/interface/CTPPSDetId.h +++ b/DataFormats/CTPPSDetId/interface/CTPPSDetId.h @@ -153,15 +153,13 @@ class CTPPSDetId : public DetId { std::ostream &operator<<(std::ostream &os, const CTPPSDetId &id); -namespace std -{ - template<> struct hash { +namespace std { + template <> + struct hash { typedef CTPPSDetId argument_type; typedef std::size_t result_type; - result_type operator()(const argument_type& id) const noexcept { - return std::hash()(id.rawId()); - } + result_type operator()(const argument_type &id) const noexcept { return std::hash()(id.rawId()); } }; -} +} // namespace std #endif diff --git a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc index 4811fcdd8499f..7055c5f609ef6 100644 --- a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc +++ b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc @@ -266,8 +266,8 @@ void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd throw cms::Exception("DDDTotemRPConstruction") << "size of copyNumbers for diamond segments is " << copy_num.size() << ". It must be >= 2."; - const unsigned int decRPId= copy_num[1]; - const unsigned int id = copy_num[copy_num.size()-1]; + const unsigned int decRPId = copy_num[1]; + const unsigned int id = copy_num[copy_num.size() - 1]; const unsigned int arm = (decRPId % 1000) / 100; const unsigned int station = (decRPId % 100) / 10; const unsigned int rp = decRPId % 10; @@ -286,9 +286,9 @@ void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd throw cms::Exception("DDDTotemRPConstruction") << "size of copyNumbers for diamond RP is " << copy_num.size() << ". It must be >= 2."; - const unsigned int decRPId= copy_num[1]; + const unsigned int decRPId = copy_num[1]; const unsigned int arm = (decRPId % 1000) / 100; - const unsigned int station = (decRPId % 100)/10; + const unsigned int station = (decRPId % 100) / 10; const unsigned int rp = decRPId % 10; newGD->setGeographicalID(CTPPSDiamondDetId(arm, station, rp)); @@ -388,4 +388,3 @@ std::unique_ptr CTPPSGeometryESModule::produceMisalignedTG( } DEFINE_FWK_EVENTSETUP_MODULE(CTPPSGeometryESModule); - diff --git a/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc b/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc index e04ef116a9550..3e248b565cb79 100644 --- a/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc +++ b/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc @@ -36,7 +36,7 @@ class CTPPSDiamondLocalTrackFitter : public edm::stream::EDProducer<> { edm::EDGetTokenT > recHitsToken_; const edm::ParameterSet trk_algo_params_; - std::unordered_map > trk_algo_; + std::unordered_map > trk_algo_; }; CTPPSDiamondLocalTrackFitter::CTPPSDiamondLocalTrackFitter(const edm::ParameterSet& iConfig) From b5645d8264876cd5d27fd4fd0b538b13f56312e5 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Mon, 15 Jun 2020 19:37:58 +0200 Subject: [PATCH 10/64] One algo per station, not per channel --- .../Local/plugins/CTPPSDiamondLocalTrackFitter.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc b/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc index 3e248b565cb79..984551162cb92 100644 --- a/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc +++ b/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc @@ -55,21 +55,20 @@ void CTPPSDiamondLocalTrackFitter::produce(edm::Event& iEvent, const edm::EventS // feed hits to the track producers for (const auto& vec : *recHits) { - const CTPPSDiamondDetId detid(vec.detId()); + const CTPPSDiamondDetId raw_detid(vec.detId()), detid(raw_detid.arm(), raw_detid.station(), raw_detid.rp()); // if algorithm is not found, build it if (trk_algo_.count(detid) == 0) trk_algo_[detid].reset(new CTPPSDiamondTrackRecognition(trk_algo_params_)); - // remove all hits from the track producers to prepare for the forthcoming event - trk_algo_[detid]->clear(); - for (const auto& hit : vec) { + for (const auto& hit : vec) // skip hits without a leading edge - if (hit.ootIndex() == CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING) - continue; - trk_algo_[detid]->addHit(hit); - } + if (hit.ootIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING) + trk_algo_[detid]->addHit(hit); auto& tracks = pOut->find_or_insert(detid); // retrieve the tracks for both arms trk_algo_[detid]->produceTracks(tracks); + std::cout<<">>>"<>"<clear(); } iEvent.put(std::move(pOut)); From 02cb9dbe9ed877449ed87deee552ef90b68a8149 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Mon, 15 Jun 2020 19:53:37 +0200 Subject: [PATCH 11/64] Algorithm launched after all hits are fed --- .../Local/plugins/CTPPSDiamondLocalTrackFitter.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc b/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc index 984551162cb92..3f96bac38f955 100644 --- a/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc +++ b/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc @@ -63,12 +63,14 @@ void CTPPSDiamondLocalTrackFitter::produce(edm::Event& iEvent, const edm::EventS // skip hits without a leading edge if (hit.ootIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING) trk_algo_[detid]->addHit(hit); - auto& tracks = pOut->find_or_insert(detid); - // retrieve the tracks for both arms - trk_algo_[detid]->produceTracks(tracks); - std::cout<<">>>"<>"<clear(); + } + + for (auto& algo_vs_id : trk_algo_) { + auto& tracks = pOut->find_or_insert(algo_vs_id.first); + // build the tracks for all stations + algo_vs_id.second->produceTracks(tracks); + // clear all hits to prepare for the next event + algo_vs_id.second->clear(); } iEvent.put(std::move(pOut)); From 518a2509bb2f3f03d91cc92d2c7fc1bc6b1c7ec3 Mon Sep 17 00:00:00 2001 From: Jan Kaspar Date: Fri, 5 Jun 2020 18:04:56 +0200 Subject: [PATCH 12/64] Added 2021-like geometry. --- .../data/2021/v1/RP_220_Left_Station.xml | 162 ++++++++++++++++++ .../data/2021/v1/RP_220_Right_Station.xml | 160 +++++++++++++++++ .../data/2021/v1/Timing_Stations_Assembly.xml | 44 +++++ .../data/CTPPS_Timing_Stations_Assembly.xml | 15 +- .../python/geometryRPFromDD_2021_cfi.py | 152 ++++++++++++++++ 5 files changed, 526 insertions(+), 7 deletions(-) create mode 100644 Geometry/VeryForwardData/data/2021/v1/RP_220_Left_Station.xml create mode 100644 Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml create mode 100644 Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml create mode 100644 Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py diff --git a/Geometry/VeryForwardData/data/2021/v1/RP_220_Left_Station.xml b/Geometry/VeryForwardData/data/2021/v1/RP_220_Left_Station.xml new file mode 100644 index 0000000000000..14fae56e32d72 --- /dev/null +++ b/Geometry/VeryForwardData/data/2021/v1/RP_220_Left_Station.xml @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml b/Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml new file mode 100644 index 0000000000000..f0c7f736d56b5 --- /dev/null +++ b/Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml b/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml new file mode 100644 index 0000000000000..b6c0d856cce6b --- /dev/null +++ b/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml b/Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml index 2e6254a3eb4ae..acee3e5f3075b 100644 --- a/Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml +++ b/Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml @@ -2,22 +2,23 @@ - - - + + + - + - + - + + - + diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py new file mode 100644 index 0000000000000..1c400e0599619 --- /dev/null +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py @@ -0,0 +1,152 @@ +# TODO: for the moment this is just copy of the 2018 config !!! this needs updating !!! + +import FWCore.ParameterSet.Config as cms + +# common and strip files +totemGeomXMLFiles = cms.vstring( + 'Geometry/CMSCommonData/data/materials.xml', + 'Geometry/CMSCommonData/data/rotations.xml', + 'Geometry/CMSCommonData/data/extend/cmsextent.xml', + 'Geometry/CMSCommonData/data/cms/2017/v1/cms.xml', + 'Geometry/CMSCommonData/data/beampipe/2017/v1/beampipe.xml', + 'Geometry/CMSCommonData/data/cmsBeam.xml', + 'Geometry/CMSCommonData/data/cmsMother.xml', + 'Geometry/CMSCommonData/data/mgnt.xml', + 'Geometry/ForwardCommonData/data/forward.xml', + 'Geometry/ForwardCommonData/data/totemRotations.xml', + 'Geometry/ForwardCommonData/data/totemMaterials.xml', + 'Geometry/ForwardCommonData/data/totemt1.xml', + 'Geometry/ForwardCommonData/data/totemt2.xml', + 'Geometry/ForwardCommonData/data/ionpump.xml', + 'Geometry/VeryForwardData/data/RP_Box.xml', + 'Geometry/VeryForwardData/data/RP_Box/RP_Box_000.xml', + 'Geometry/VeryForwardData/data/RP_Box/RP_Box_001.xml', + 'Geometry/VeryForwardData/data/RP_Box/RP_Box_002.xml', + 'Geometry/VeryForwardData/data/RP_Box/RP_Box_003.xml', + 'Geometry/VeryForwardData/data/RP_Box/RP_Box_004.xml', + 'Geometry/VeryForwardData/data/RP_Box/RP_Box_005.xml', + 'Geometry/VeryForwardData/data/RP_Box/RP_Box_020.xml', + 'Geometry/VeryForwardData/data/RP_Box/RP_Box_021.xml', + #'Geometry/VeryForwardData/data/RP_Box/RP_Box_022.xml', + 'Geometry/VeryForwardData/data/RP_Box/RP_Box_023.xml', + 'Geometry/VeryForwardData/data/RP_Box/RP_Box_024.xml', + 'Geometry/VeryForwardData/data/RP_Box/RP_Box_025.xml', + 'Geometry/VeryForwardData/data/RP_Box/RP_Box_100.xml', + 'Geometry/VeryForwardData/data/RP_Box/RP_Box_101.xml', + 'Geometry/VeryForwardData/data/RP_Box/RP_Box_102.xml', + 'Geometry/VeryForwardData/data/RP_Box/2018/RP_Box_103.xml', + 'Geometry/VeryForwardData/data/RP_Box/RP_Box_104.xml', + 'Geometry/VeryForwardData/data/RP_Box/RP_Box_105.xml', + 'Geometry/VeryForwardData/data/RP_Box/RP_Box_120.xml', + 'Geometry/VeryForwardData/data/RP_Box/RP_Box_121.xml', + #'Geometry/VeryForwardData/data/RP_Box/RP_Box_122.xml', + 'Geometry/VeryForwardData/data/RP_Box/RP_Box_123.xml', + 'Geometry/VeryForwardData/data/RP_Box/RP_Box_124.xml', + 'Geometry/VeryForwardData/data/RP_Box/RP_Box_125.xml', + 'Geometry/VeryForwardData/data/RP_Hybrid.xml', + 'Geometry/VeryForwardData/data/RP_Materials.xml', + 'Geometry/VeryForwardData/data/RP_Transformations.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_000.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_001.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_002.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_004.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_005.xml', + #'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_022.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_024.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_025.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_100.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_101.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_102.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_104.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_105.xml', + #'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_122.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_124.xml', + 'Geometry/VeryForwardData/data/RP_Detectors_Assembly/RP_Detectors_Assembly_125.xml', + 'Geometry/VeryForwardData/data/RP_Device.xml', + 'Geometry/VeryForwardData/data/RP_Vertical_Device.xml', + 'Geometry/VeryForwardData/data/RP_Horizontal_Device.xml', + 'Geometry/VeryForwardData/data/2021/RP_220_Right_Station.xml', + 'Geometry/VeryForwardData/data/2021/RP_220_Left_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/RP_147_Right_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/RP_147_Left_Station.xml', + 'Geometry/VeryForwardData/data/RP_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/RP_Sensitive_Dets.xml', + 'Geometry/VeryForwardData/data/RP_Cuts_Per_Region.xml', + 'Geometry/VeryForwardData/data/RP_Param_Beam_Region.xml' + ) + +# diamond files +ctppsDiamondGeomXMLFiles = cms.vstring( + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Materials.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Transformations.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_X_Distance.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Parameters.xml', + 'Geometry/VeryForwardData/data/CTPPS_Timing_Station_Parameters.xml', + 'Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot.xml', + 'Geometry/VeryForwardData/data/CTPPS_Timing_Positive_Station.xml', + 'Geometry/VeryForwardData/data/CTPPS_Timing_Negative_Station.xml', + 'Geometry/VeryForwardData/data/2021/CTPPS_Timing_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern1_Segment1.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment1.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment2.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment1.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment2.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern3_Segment4.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment1.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment2.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment4.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern4_Segment5.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane1.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane2.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane3.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Planes/CTPPS_Diamond_Plane4.xml', + 'Geometry/VeryForwardData/data/CTPPS_Diamond_2018/CTPPS_Diamond_Detector_Assembly.xml' + ) + +# UFSD files +ctppsUFSDGeomXMLFiles = cms.vstring( + # UFSDetectors + 'Geometry/VeryForwardData/data/CTPPS_UFSD_Segments/CTPPS_UFSD_Pattern1.xml', + 'Geometry/VeryForwardData/data/CTPPS_UFSD_Segments/CTPPS_UFSD_Pattern2_SegmentA.xml', + 'Geometry/VeryForwardData/data/CTPPS_UFSD_Segments/CTPPS_UFSD_Pattern2_SegmentB.xml', + 'Geometry/VeryForwardData/data/CTPPS_UFSD_Planes/CTPPS_UFSD_Plane4.xml', + 'Geometry/VeryForwardData/data/CTPPS_UFSD_Parameters.xml', + ) + +# Totem Timing files +totemTimingGeomXMLFiles = cms.vstring( + # UFSDetectors + 'Geometry/VeryForwardData/data/TotemTiming/TotemTiming_Dist_Beam_Cent.xml', + 'Geometry/VeryForwardData/data/TotemTiming/TotemTiming_DetectorAssembly.xml', + 'Geometry/VeryForwardData/data/TotemTiming/TotemTiming_Parameters.xml', + 'Geometry/VeryForwardData/data/TotemTiming/TotemTiming_Plane.xml', + 'Geometry/VeryForwardData/data/TotemTiming/TotemTiming_Station.xml', + ) + +# pixel files +ctppsPixelGeomXMLFiles = cms.vstring( + 'Geometry/VeryForwardData/data/ppstrackerMaterials.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_Module_2x2.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_023.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_123.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_003.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/CTPPS_Pixel_Assembly_Box_Real_103.xml', + 'Geometry/VeryForwardData/data/CTPPS_Pixel_Sens.xml' + ) + +XMLIdealGeometryESSource_CTPPS = cms.ESSource("XMLIdealGeometryESSource", + geomXMLFiles = totemGeomXMLFiles + ctppsDiamondGeomXMLFiles + ctppsUFSDGeomXMLFiles + totemTimingGeomXMLFiles + ctppsPixelGeomXMLFiles, + rootNodeName = cms.string('cms:CMSE') + ) + +# position of RPs +XMLIdealGeometryESSource_CTPPS.geomXMLFiles.append("Geometry/VeryForwardData/data/2016_ctpps_15sigma_margin0/RP_Dist_Beam_Cent.xml") + +ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", + verbosity = cms.untracked.uint32(1), + compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') + ) From ed17cff6ebc4bfbe49fd69eb88630bfaaadb8c14 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Mon, 15 Jun 2020 20:14:21 +0200 Subject: [PATCH 13/64] Indentation fix --- .../VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml b/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml index b6c0d856cce6b..5d30f2e02b31b 100644 --- a/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml +++ b/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml @@ -2,10 +2,8 @@ - - - + From f5e2148a055bd059bde4c13039c117e545229027 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Thu, 18 Jun 2020 13:28:09 +0200 Subject: [PATCH 14/64] Formatted XML files --- .../data/2021/v1/RP_220_Left_Station.xml | 312 +++++++++--------- .../data/2021/v1/RP_220_Right_Station.xml | 308 +++++++++-------- .../data/2021/v1/Timing_Stations_Assembly.xml | 8 +- 3 files changed, 303 insertions(+), 325 deletions(-) diff --git a/Geometry/VeryForwardData/data/2021/v1/RP_220_Left_Station.xml b/Geometry/VeryForwardData/data/2021/v1/RP_220_Left_Station.xml index 14fae56e32d72..781fc80a8bb05 100644 --- a/Geometry/VeryForwardData/data/2021/v1/RP_220_Left_Station.xml +++ b/Geometry/VeryForwardData/data/2021/v1/RP_220_Left_Station.xml @@ -1,162 +1,154 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml b/Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml index f0c7f736d56b5..14b2b405018d9 100644 --- a/Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml +++ b/Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml @@ -1,160 +1,152 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml b/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml index 5d30f2e02b31b..d2c8bdffa5286 100644 --- a/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml +++ b/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml @@ -1,5 +1,5 @@ + - @@ -7,7 +7,6 @@ - @@ -15,21 +14,18 @@ - - - @@ -37,6 +33,4 @@ - - From efe2bec95d582ef659d7f28d2e900104718919b4 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Fri, 19 Jun 2020 14:37:19 +0200 Subject: [PATCH 15/64] Added eval=true to ConstantsSection of 2021 scenario DDLs --- Geometry/VeryForwardData/data/2021/v1/RP_220_Left_Station.xml | 2 +- Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml | 2 +- .../VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Geometry/VeryForwardData/data/2021/v1/RP_220_Left_Station.xml b/Geometry/VeryForwardData/data/2021/v1/RP_220_Left_Station.xml index 781fc80a8bb05..cc4d294466815 100644 --- a/Geometry/VeryForwardData/data/2021/v1/RP_220_Left_Station.xml +++ b/Geometry/VeryForwardData/data/2021/v1/RP_220_Left_Station.xml @@ -1,6 +1,6 @@ - + diff --git a/Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml b/Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml index 14b2b405018d9..d2cd1c6135d23 100644 --- a/Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml +++ b/Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml @@ -1,6 +1,6 @@ - + diff --git a/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml b/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml index d2c8bdffa5286..be6209c2aff3d 100644 --- a/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml +++ b/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml @@ -1,6 +1,6 @@ - + From 065320ad0301b155d8670403850817d2815470a9 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 23 Jun 2020 14:46:48 +0200 Subject: [PATCH 16/64] Updated the paths in the DDL parser steering component --- .../VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py index 1c400e0599619..f0ab5f25f1cb0 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py @@ -66,8 +66,8 @@ 'Geometry/VeryForwardData/data/RP_Device.xml', 'Geometry/VeryForwardData/data/RP_Vertical_Device.xml', 'Geometry/VeryForwardData/data/RP_Horizontal_Device.xml', - 'Geometry/VeryForwardData/data/2021/RP_220_Right_Station.xml', - 'Geometry/VeryForwardData/data/2021/RP_220_Left_Station.xml', + 'Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml', + 'Geometry/VeryForwardData/data/2021/v1/RP_220_Left_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/RP_147_Right_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_Pixel_2018/RP_147_Left_Station.xml', 'Geometry/VeryForwardData/data/RP_Stations_Assembly.xml', @@ -86,7 +86,7 @@ 'Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Positive_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Negative_Station.xml', - 'Geometry/VeryForwardData/data/2021/CTPPS_Timing_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/2021/v1/CTPPS_Timing_Stations_Assembly.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern1_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment2.xml', From b2b5b0ae79dd36c999e1a82defc7235866026a8f Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 14 Jul 2020 15:52:05 +0200 Subject: [PATCH 17/64] Dropped z sign mitigation for diamond in direct proton simulation --- Validation/CTPPS/plugins/CTPPSDirectProtonSimulation.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Validation/CTPPS/plugins/CTPPSDirectProtonSimulation.cc b/Validation/CTPPS/plugins/CTPPSDirectProtonSimulation.cc index 0ae46d5a1cb2e..1d6434f5a446e 100644 --- a/Validation/CTPPS/plugins/CTPPSDirectProtonSimulation.cc +++ b/Validation/CTPPS/plugins/CTPPSDirectProtonSimulation.cc @@ -456,10 +456,6 @@ void CTPPSDirectProtonSimulation::processProton( const auto &gl_a1 = geometry.localToGlobal(detId, CTPPSGeometry::Vector(1, 0, 0)) - gl_o; const auto &gl_a2 = geometry.localToGlobal(detId, CTPPSGeometry::Vector(0, 1, 0)) - gl_o; - double gl_o_z = gl_o.z(); - if (detId.subdetId() == CTPPSDetId::sdTimingDiamond) - gl_o_z = -gl_o_z; // fix bug in diamond geometry - TMatrixD A(3, 3); TVectorD B(3); A(0, 0) = a_x; @@ -473,7 +469,7 @@ void CTPPSDirectProtonSimulation::processProton( A(2, 0) = z_sign; A(2, 1) = -gl_a1.z(); A(2, 2) = -gl_a2.z(); - B(2) = gl_o_z - z_scoringPlane; + B(2) = gl_o.z() - z_scoringPlane; TMatrixD Ai(3, 3); Ai = A.Invert(); TVectorD P(3); @@ -564,7 +560,7 @@ void CTPPSDirectProtonSimulation::processProton( 2. * x_half_width, gl_o.y(), 2. * y_half_width, - gl_o_z, + gl_o.z(), 2. * z_half_width, t0, tot, From c1ac29cd41bfbce57b35157c9ecd4813e5e4e418 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 14 Jul 2020 16:00:31 +0200 Subject: [PATCH 18/64] Dropped z sign mitigation for diamond in proton reconstruction algorithm (timing/tracking associatioN) --- RecoPPS/ProtonReconstruction/plugins/CTPPSProtonProducer.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/RecoPPS/ProtonReconstruction/plugins/CTPPSProtonProducer.cc b/RecoPPS/ProtonReconstruction/plugins/CTPPSProtonProducer.cc index cba96e78b40c1..3ed23090ab219 100644 --- a/RecoPPS/ProtonReconstruction/plugins/CTPPSProtonProducer.cc +++ b/RecoPPS/ProtonReconstruction/plugins/CTPPSProtonProducer.cc @@ -411,8 +411,7 @@ void CTPPSProtonProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSe continue; // interpolation from tracking RPs - const double z_ti = - -hGeometry->rpTranslation(tr_ti.rpId()).z(); // the minus sign fixes a bug in the diamond geometry + const double z_ti = hGeometry->rpTranslation(tr_ti.rpId()).z(); const double f_i = (z_ti - z_j) / (z_i - z_j), f_j = (z_i - z_ti) / (z_i - z_j); const double x_inter = f_i * tr_i.x() + f_j * tr_j.x(); const double x_inter_unc_sq = From 87f2e74e48d7d8ce0ed522e1c74888202ed65a28 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 14 Jul 2020 18:36:15 +0200 Subject: [PATCH 19/64] Added copyNumber field to all PosPart --- .../data/2021/v1/RP_220_Left_Station.xml | 10 +++++----- .../data/2021/v1/RP_220_Right_Station.xml | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Geometry/VeryForwardData/data/2021/v1/RP_220_Left_Station.xml b/Geometry/VeryForwardData/data/2021/v1/RP_220_Left_Station.xml index cc4d294466815..6e4d55b3e4424 100644 --- a/Geometry/VeryForwardData/data/2021/v1/RP_220_Left_Station.xml +++ b/Geometry/VeryForwardData/data/2021/v1/RP_220_Left_Station.xml @@ -95,27 +95,27 @@ - + - + - + - + - + diff --git a/Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml b/Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml index d2cd1c6135d23..03b4f2b1c9ac1 100644 --- a/Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml +++ b/Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml @@ -95,12 +95,12 @@ - + - + @@ -110,12 +110,12 @@ - + - + From ce4dc3f677190bff0a3a89749f11583ab27b76b1 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 14 Jul 2020 18:40:47 +0200 Subject: [PATCH 20/64] Dropped the CTPPS prefix for timing detectors assembly --- .../VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml | 4 ++-- ...ing_Stations_Assembly.xml => Timing_Stations_Assembly.xml} | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename Geometry/VeryForwardData/data/{CTPPS_Timing_Stations_Assembly.xml => Timing_Stations_Assembly.xml} (88%) diff --git a/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml b/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml index be6209c2aff3d..fb625a570d9e4 100644 --- a/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml +++ b/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml @@ -1,13 +1,13 @@ - + - + diff --git a/Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml b/Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml similarity index 88% rename from Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml rename to Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml index acee3e5f3075b..c74ba2710d4e9 100644 --- a/Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml +++ b/Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml @@ -1,13 +1,13 @@ - + - + From 345acafcbd6eefc7de9d703ecc88668834c0e79f Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 14 Jul 2020 18:43:46 +0200 Subject: [PATCH 21/64] Updated path to timing stations assembly files --- .../python/geometryIdealPPSFromDD_2016_cfi.py | 2 +- .../python/geometryIdealPPSFromDD_2017_cfi.py | 2 +- .../python/geometryIdealPPSFromDD_2018_cfi.py | 2 +- .../VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py | 2 +- .../VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py | 2 +- .../VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2016_cfi.py b/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2016_cfi.py index 37e7bbbabf487..cca78e2984290 100644 --- a/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2016_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2016_cfi.py @@ -91,7 +91,7 @@ 'Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Positive_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Negative_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern1_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment2.xml', diff --git a/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2017_cfi.py b/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2017_cfi.py index 37e7bbbabf487..cca78e2984290 100644 --- a/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2017_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2017_cfi.py @@ -91,7 +91,7 @@ 'Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Positive_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Negative_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern1_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment2.xml', diff --git a/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2018_cfi.py b/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2018_cfi.py index 4a4b33efd94c5..b36bb2afbce6a 100644 --- a/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2018_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2018_cfi.py @@ -84,7 +84,7 @@ 'Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Positive_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Negative_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern1_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment2.xml', diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py index 8449588967ed3..9d3a41464aad9 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py @@ -91,7 +91,7 @@ 'Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Positive_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Negative_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern1_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment2.xml', diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py index 0946d1a71b8e0..c4b62e7ad37c4 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py @@ -84,7 +84,7 @@ 'Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Positive_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Negative_Station.xml', - 'Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern1_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment2.xml', diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py index f0ab5f25f1cb0..55269bf6c9585 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py @@ -86,7 +86,7 @@ 'Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Positive_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Negative_Station.xml', - 'Geometry/VeryForwardData/data/2021/v1/CTPPS_Timing_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern1_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment2.xml', From e41c3546c5638f715692f356bf7048bb4b5b54ed Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 15 Jul 2020 09:49:18 +0200 Subject: [PATCH 22/64] Swapped z sign in timing station assemblies --- .../data/2021/v1/Timing_Stations_Assembly.xml | 8 ++++---- .../VeryForwardData/data/Timing_Stations_Assembly.xml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml b/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml index fb625a570d9e4..0889845266174 100644 --- a/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml +++ b/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml @@ -2,10 +2,10 @@ - - - - + + + + diff --git a/Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml b/Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml index c74ba2710d4e9..43ddc85375ebd 100644 --- a/Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml +++ b/Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml @@ -3,8 +3,8 @@ - - + + From 6ca34379b07310207e4594e2e411ee36e00f84ab Mon Sep 17 00:00:00 2001 From: Gabrielle Hugo Date: Tue, 8 Sep 2020 16:48:30 +0200 Subject: [PATCH 23/64] Revert "Swapped z sign in timing station assemblies" This reverts commit e41c3546c5638f715692f356bf7048bb4b5b54ed. --- .../data/2021/v1/Timing_Stations_Assembly.xml | 8 ++++---- .../VeryForwardData/data/Timing_Stations_Assembly.xml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml b/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml index 0889845266174..fb625a570d9e4 100644 --- a/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml +++ b/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml @@ -2,10 +2,10 @@ - - - - + + + + diff --git a/Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml b/Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml index 43ddc85375ebd..c74ba2710d4e9 100644 --- a/Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml +++ b/Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml @@ -3,8 +3,8 @@ - - + + From d4addbbf077d7fed53975350842754e327e05102 Mon Sep 17 00:00:00 2001 From: Gabrielle Hugo Date: Tue, 8 Sep 2020 16:49:43 +0200 Subject: [PATCH 24/64] Revert "Updated path to timing stations assembly files" This reverts commit 345acafcbd6eefc7de9d703ecc88668834c0e79f. --- .../python/geometryIdealPPSFromDD_2016_cfi.py | 2 +- .../python/geometryIdealPPSFromDD_2017_cfi.py | 2 +- .../python/geometryIdealPPSFromDD_2018_cfi.py | 2 +- .../VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py | 2 +- .../VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py | 2 +- .../VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2016_cfi.py b/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2016_cfi.py index cca78e2984290..37e7bbbabf487 100644 --- a/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2016_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2016_cfi.py @@ -91,7 +91,7 @@ 'Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Positive_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Negative_Station.xml', - 'Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern1_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment2.xml', diff --git a/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2017_cfi.py b/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2017_cfi.py index cca78e2984290..37e7bbbabf487 100644 --- a/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2017_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2017_cfi.py @@ -91,7 +91,7 @@ 'Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Positive_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Negative_Station.xml', - 'Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern1_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment2.xml', diff --git a/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2018_cfi.py b/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2018_cfi.py index b36bb2afbce6a..4a4b33efd94c5 100644 --- a/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2018_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryIdealPPSFromDD_2018_cfi.py @@ -84,7 +84,7 @@ 'Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Positive_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Negative_Station.xml', - 'Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern1_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment2.xml', diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py index 9d3a41464aad9..8449588967ed3 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py @@ -91,7 +91,7 @@ 'Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Positive_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Negative_Station.xml', - 'Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern1_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment2.xml', diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py index c4b62e7ad37c4..0946d1a71b8e0 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py @@ -84,7 +84,7 @@ 'Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Positive_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Negative_Station.xml', - 'Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern1_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment2.xml', diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py index 55269bf6c9585..f0ab5f25f1cb0 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py @@ -86,7 +86,7 @@ 'Geometry/VeryForwardData/data/CTPPS_Timing_Horizontal_Pot.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Positive_Station.xml', 'Geometry/VeryForwardData/data/CTPPS_Timing_Negative_Station.xml', - 'Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml', + 'Geometry/VeryForwardData/data/2021/v1/CTPPS_Timing_Stations_Assembly.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern1_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment1.xml', 'Geometry/VeryForwardData/data/CTPPS_Diamond_Segments/CTPPS_Diamond_Pattern2_Segment2.xml', From cd4b0270cd62385209fd7829d7f09f79c1f4c752 Mon Sep 17 00:00:00 2001 From: Gabrielle Hugo Date: Tue, 8 Sep 2020 16:50:12 +0200 Subject: [PATCH 25/64] Revert "Dropped the CTPPS prefix for timing detectors assembly" This reverts commit ce4dc3f677190bff0a3a89749f11583ab27b76b1. --- .../VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml | 4 ++-- ...ations_Assembly.xml => CTPPS_Timing_Stations_Assembly.xml} | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename Geometry/VeryForwardData/data/{Timing_Stations_Assembly.xml => CTPPS_Timing_Stations_Assembly.xml} (88%) diff --git a/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml b/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml index fb625a570d9e4..be6209c2aff3d 100644 --- a/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml +++ b/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml @@ -1,13 +1,13 @@ - + - + diff --git a/Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml b/Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml similarity index 88% rename from Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml rename to Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml index c74ba2710d4e9..acee3e5f3075b 100644 --- a/Geometry/VeryForwardData/data/Timing_Stations_Assembly.xml +++ b/Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml @@ -1,13 +1,13 @@ - + - + From 858843cda7d7dd3c2f8898110dc2987c27722ba7 Mon Sep 17 00:00:00 2001 From: Gabrielle Hugo Date: Tue, 8 Sep 2020 16:50:34 +0200 Subject: [PATCH 26/64] Revert "Dropped z sign mitigation for diamond in proton reconstruction algorithm (timing/tracking associatioN)" This reverts commit c1ac29cd41bfbce57b35157c9ecd4813e5e4e418. --- RecoPPS/ProtonReconstruction/plugins/CTPPSProtonProducer.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RecoPPS/ProtonReconstruction/plugins/CTPPSProtonProducer.cc b/RecoPPS/ProtonReconstruction/plugins/CTPPSProtonProducer.cc index 3ed23090ab219..cba96e78b40c1 100644 --- a/RecoPPS/ProtonReconstruction/plugins/CTPPSProtonProducer.cc +++ b/RecoPPS/ProtonReconstruction/plugins/CTPPSProtonProducer.cc @@ -411,7 +411,8 @@ void CTPPSProtonProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSe continue; // interpolation from tracking RPs - const double z_ti = hGeometry->rpTranslation(tr_ti.rpId()).z(); + const double z_ti = + -hGeometry->rpTranslation(tr_ti.rpId()).z(); // the minus sign fixes a bug in the diamond geometry const double f_i = (z_ti - z_j) / (z_i - z_j), f_j = (z_i - z_ti) / (z_i - z_j); const double x_inter = f_i * tr_i.x() + f_j * tr_j.x(); const double x_inter_unc_sq = From 4de3ea8994e6894f906e8ba6721f222b49385210 Mon Sep 17 00:00:00 2001 From: Gabrielle Hugo Date: Tue, 8 Sep 2020 16:51:03 +0200 Subject: [PATCH 27/64] Revert "Dropped z sign mitigation for diamond in direct proton simulation" This reverts commit b2b5b0ae79dd36c999e1a82defc7235866026a8f. --- Validation/CTPPS/plugins/CTPPSDirectProtonSimulation.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Validation/CTPPS/plugins/CTPPSDirectProtonSimulation.cc b/Validation/CTPPS/plugins/CTPPSDirectProtonSimulation.cc index e1e1fa1ce6070..d04fc363c0e78 100644 --- a/Validation/CTPPS/plugins/CTPPSDirectProtonSimulation.cc +++ b/Validation/CTPPS/plugins/CTPPSDirectProtonSimulation.cc @@ -439,6 +439,10 @@ void CTPPSDirectProtonSimulation::processProton( const auto &gl_a1 = geometry.localToGlobal(detId, CTPPSGeometry::Vector(1, 0, 0)) - gl_o; const auto &gl_a2 = geometry.localToGlobal(detId, CTPPSGeometry::Vector(0, 1, 0)) - gl_o; + double gl_o_z = gl_o.z(); + if (detId.subdetId() == CTPPSDetId::sdTimingDiamond) + gl_o_z = -gl_o_z; // fix bug in diamond geometry + TMatrixD A(3, 3); TVectorD B(3); A(0, 0) = a_x; @@ -452,7 +456,7 @@ void CTPPSDirectProtonSimulation::processProton( A(2, 0) = z_sign; A(2, 1) = -gl_a1.z(); A(2, 2) = -gl_a2.z(); - B(2) = gl_o.z() - z_scoringPlane; + B(2) = gl_o_z - z_scoringPlane; TMatrixD Ai(3, 3); Ai = A.Invert(); TVectorD P(3); @@ -543,7 +547,7 @@ void CTPPSDirectProtonSimulation::processProton( 2. * x_half_width, gl_o.y(), 2. * y_half_width, - gl_o.z(), + gl_o_z, 2. * z_half_width, t0, tot, From 4e0e8710aca33e6a1a1cda31e9ff7530b8d61946 Mon Sep 17 00:00:00 2001 From: Gabrielle Hugo Date: Tue, 8 Sep 2020 16:57:58 +0200 Subject: [PATCH 28/64] Fix forgotten copyNumber in PosPart section, in 2021 XML file. --- Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml b/Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml index 03b4f2b1c9ac1..cf25ab7531be4 100644 --- a/Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml +++ b/Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml @@ -105,7 +105,7 @@ - + From 8ff7b0762814a84afa142f2d48c0dfa0face39ff Mon Sep 17 00:00:00 2001 From: Gabrielle Hugo Date: Tue, 8 Sep 2020 17:00:49 +0200 Subject: [PATCH 29/64] Consistent naming of CTPPS_Timing_Stations_Assembly.xml among scenarios, otherwise we become crazy. --- ...g_Stations_Assembly.xml => CTPPS_Timing_Stations_Assembly.xml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Geometry/VeryForwardData/data/2021/v1/{Timing_Stations_Assembly.xml => CTPPS_Timing_Stations_Assembly.xml} (100%) diff --git a/Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml b/Geometry/VeryForwardData/data/2021/v1/CTPPS_Timing_Stations_Assembly.xml similarity index 100% rename from Geometry/VeryForwardData/data/2021/v1/Timing_Stations_Assembly.xml rename to Geometry/VeryForwardData/data/2021/v1/CTPPS_Timing_Stations_Assembly.xml From 100b50d834d9bfa129f1cbc5a5fb757dccabbdd2 Mon Sep 17 00:00:00 2001 From: Gabrielle Hugo Date: Tue, 8 Sep 2020 17:23:54 +0200 Subject: [PATCH 30/64] Add 2021 scenario also for DD4hep, in parallel of old DD. --- .../data/dd4hep/geometryRPFromDD_2021.xml | 136 ++++++++++++++++++ .../dd4hep/geometryRPFromDD_2021_cfi.py | 17 +++ 2 files changed, 153 insertions(+) create mode 100644 Geometry/VeryForwardGeometry/data/dd4hep/geometryRPFromDD_2021.xml create mode 100644 Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py diff --git a/Geometry/VeryForwardGeometry/data/dd4hep/geometryRPFromDD_2021.xml b/Geometry/VeryForwardGeometry/data/dd4hep/geometryRPFromDD_2021.xml new file mode 100644 index 0000000000000..e5f1797212398 --- /dev/null +++ b/Geometry/VeryForwardGeometry/data/dd4hep/geometryRPFromDD_2021.xml @@ -0,0 +1,136 @@ + + + + + + + # common and strip files + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + # diamond files + + + + + + + + + + + + + + + + + + + + + + + + + + + + # UFSD files + + + + + + + # Totem Timing files + + + + + + + # pixel files + + + + + + + + + + + # RP distance + + + + diff --git a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py new file mode 100644 index 0000000000000..932fc960c6b49 --- /dev/null +++ b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py @@ -0,0 +1,17 @@ +import FWCore.ParameterSet.Config as cms + +DDDetectorESProducer = cms.ESSource("DDDetectorESProducer", + confGeomXMLFiles = cms.FileInPath('Geometry/VeryForwardGeometry/data/dd4hep/geometryRPFromDD_2021.xml'), + appendToDataLabel = cms.string('XMLIdealGeometryESSource_CTPPS') +) + +DDCompactViewESProducer = cms.ESProducer("DDCompactViewESProducer", + appendToDataLabel = cms.string('XMLIdealGeometryESSource_CTPPS') +) + +ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", + fromDD4hep = cms.untracked.bool(True), + verbosity = cms.untracked.uint32(1), + compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') +) + From 4a90808507010c26bf9dd4eb4b6efb306c5fd1c5 Mon Sep 17 00:00:00 2001 From: Gabrielle Hugo Date: Tue, 8 Sep 2020 19:24:38 +0200 Subject: [PATCH 31/64] Add 2021 bool and special DetId computation in the 2021 scenario case. --- .../Geometry/plugins/PPSGeometryBuilder.cc | 14 +-- .../dd4hep/geometryRPFromDD_2021_cfi.py | 1 + .../python/geometryRPFromDD_2021_cfi.py | 3 +- .../interface/DetGeomDesc.h | 8 +- .../interface/DetGeomDescBuilder.h | 6 +- .../plugins/CTPPSGeometryESModule.cc | 7 +- .../src/DetGeomDesc.cc | 95 ++++++++++++------- .../src/DetGeomDescBuilder.cc | 18 ++-- 8 files changed, 93 insertions(+), 59 deletions(-) diff --git a/CondTools/Geometry/plugins/PPSGeometryBuilder.cc b/CondTools/Geometry/plugins/PPSGeometryBuilder.cc index 20b4728ba45fa..7568a61676904 100644 --- a/CondTools/Geometry/plugins/PPSGeometryBuilder.cc +++ b/CondTools/Geometry/plugins/PPSGeometryBuilder.cc @@ -37,6 +37,7 @@ class PPSGeometryBuilder : public edm::one::EDAnalyzer<> { bool fromDD4hep_; std::string compactViewTag_; + bool is2021_; edm::ESGetToken ddToken_; edm::ESGetToken dd4hepToken_; edm::ESWatcher watcherIdealGeometry_; @@ -44,10 +45,11 @@ class PPSGeometryBuilder : public edm::one::EDAnalyzer<> { }; PPSGeometryBuilder::PPSGeometryBuilder(const edm::ParameterSet& iConfig) - : fromDD4hep_(iConfig.getUntrackedParameter("fromDD4hep", false)), - compactViewTag_(iConfig.getUntrackedParameter("compactViewTag", "XMLIdealGeometryESSource_CTPPS")), - ddToken_(esConsumes(edm::ESInputTag("", compactViewTag_))), - dd4hepToken_(esConsumes(edm::ESInputTag("", compactViewTag_))) {} + : fromDD4hep_(iConfig.getUntrackedParameter("fromDD4hep", false)), + compactViewTag_(iConfig.getUntrackedParameter("compactViewTag", "XMLIdealGeometryESSource_CTPPS")), + is2021_(iConfig.getUntrackedParameter("is2021", false)), + ddToken_(esConsumes(edm::ESInputTag("", compactViewTag_))), + dd4hepToken_(esConsumes(edm::ESInputTag("", compactViewTag_))) {} /* * Save PPS geo to DB. @@ -63,7 +65,7 @@ void PPSGeometryBuilder::analyze(const edm::Event& iEvent, const edm::EventSetup auto const& myCompactView = iSetup.getData(ddToken_); // Build geometry - geoInfoRoot = detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView); + geoInfoRoot = detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView, is2021_); } // DD4hep else { @@ -71,7 +73,7 @@ void PPSGeometryBuilder::analyze(const edm::Event& iEvent, const edm::EventSetup auto const& myCompactView = iSetup.getData(dd4hepToken_); // Build geometry - geoInfoRoot = detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView); + geoInfoRoot = detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView, is2021_); } } diff --git a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py index 932fc960c6b49..4eb910de6d21c 100644 --- a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py +++ b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py @@ -10,6 +10,7 @@ ) ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", + is2021 = cms.untracked.bool(True), fromDD4hep = cms.untracked.bool(True), verbosity = cms.untracked.uint32(1), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py index f0ab5f25f1cb0..b1fd9972be3cc 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py @@ -148,5 +148,6 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", verbosity = cms.untracked.uint32(1), - compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') + compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS'), + is2021 = cms.untracked.bool(True) ) diff --git a/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDesc.h b/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDesc.h index 63eb169e8960f..9d9eef0941b24 100644 --- a/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDesc.h +++ b/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDesc.h @@ -56,9 +56,9 @@ class DetGeomDesc { using Translation = ROOT::Math::DisplacementVector3D>; // Constructor from old DD DDFilteredView - DetGeomDesc(const DDFilteredView& fv); + DetGeomDesc(const DDFilteredView& fv, const bool is2021); // Constructor from DD4Hep DDFilteredView - DetGeomDesc(const cms::DDFilteredView& fv, const cms::DDSpecParRegistry& allSpecParSections); + DetGeomDesc(const cms::DDFilteredView& fv, const cms::DDSpecParRegistry& allSpecParSections, const bool is2021); DetGeomDesc(const DetGeomDesc&); DetGeomDesc& operator=(const DetGeomDesc&); @@ -116,8 +116,8 @@ class DetGeomDesc { DiamondDimensions computeDiamondDimensions(const bool isABox, const bool isDD4hep, const std::vector& params) const; - DetId computeDetID(const std::string& name, const std::vector& copyNos, unsigned int copyNum) const; - DetId computeDetIDFromDD4hep(const std::string& name, const std::vector& copyNos, unsigned int copyNum) const; + DetId computeDetID(const std::string& name, const std::vector& copyNos, const unsigned int copyNum, const bool is2021) const; + DetId computeDetIDFromDD4hep(const std::string& name, const std::vector& copyNos, const unsigned int copyNum, const bool is2021) const; std::string computeSensorType(std::string_view name); std::string computeSensorType(std::string_view nameFromView, const std::string& nodePath, diff --git a/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDescBuilder.h b/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDescBuilder.h index ab367d19df08e..d2fb0a2d0386e 100644 --- a/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDescBuilder.h +++ b/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDescBuilder.h @@ -9,9 +9,9 @@ * Generic function to build geo (tree of DetGeomDesc) from compact view. */ namespace detgeomdescbuilder { - std::unique_ptr buildDetGeomDescFromCompactView(const DDCompactView& myCompactView); - void buildDetGeomDescDescendants(DDFilteredView& fv, DetGeomDesc* geoInfoParent); - std::unique_ptr buildDetGeomDescFromCompactView(const cms::DDCompactView& myCompactView); + std::unique_ptr buildDetGeomDescFromCompactView(const DDCompactView& myCompactView, const bool is2021); + void buildDetGeomDescDescendants(DDFilteredView& fv, DetGeomDesc* geoInfoParent, const bool is2021); + std::unique_ptr buildDetGeomDescFromCompactView(const cms::DDCompactView& myCompactView, const bool is2021); } // namespace detgeomdescbuilder #endif diff --git a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc index 89383bfd4b1e3..d25924a52c1a8 100644 --- a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc +++ b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc @@ -84,6 +84,7 @@ class CTPPSGeometryESModule : public edm::ESProducer { static std::unique_ptr applyAlignments(const DetGeomDesc&, const CTPPSRPAlignmentCorrectionsData*); const unsigned int verbosity_; + const bool is2021_; edm::ESGetToken ddToken_; edm::ESGetToken dd4hepToken_; @@ -98,6 +99,7 @@ class CTPPSGeometryESModule : public edm::ESProducer { CTPPSGeometryESModule::CTPPSGeometryESModule(const edm::ParameterSet& iConfig) : verbosity_(iConfig.getUntrackedParameter("verbosity")), + is2021_(iConfig.getUntrackedParameter("is2021", false)), fromDD4hep_(iConfig.getUntrackedParameter("fromDD4hep", false)), gdRealTokens_{setWhatProduced(this, &CTPPSGeometryESModule::produceRealGD)}, gdMisTokens_{setWhatProduced(this, &CTPPSGeometryESModule::produceMisalignedGD)}, @@ -118,6 +120,7 @@ CTPPSGeometryESModule::CTPPSGeometryESModule(const edm::ParameterSet& iConfig) void CTPPSGeometryESModule::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.addUntracked("verbosity", 1); + desc.addUntracked("is2021", false); desc.add("compactViewTag", std::string()); desc.addUntracked("fromDD4hep", false); descriptions.add("CTPPSGeometryESModule", desc); @@ -189,7 +192,7 @@ std::unique_ptr CTPPSGeometryESModule::produceIdealGD(const IdealGe auto const& myCompactView = iRecord.get(ddToken_); // Build geo from compact view. - return detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView); + return detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView, is2021_); } else { @@ -197,7 +200,7 @@ std::unique_ptr CTPPSGeometryESModule::produceIdealGD(const IdealGe auto const& myCompactView = iRecord.get(dd4hepToken_); // Build geo from compact view. - return detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView); + return detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView, is2021_); } } diff --git a/Geometry/VeryForwardGeometryBuilder/src/DetGeomDesc.cc b/Geometry/VeryForwardGeometryBuilder/src/DetGeomDesc.cc index ccb6f6b14ee9f..5db2215abddf2 100644 --- a/Geometry/VeryForwardGeometryBuilder/src/DetGeomDesc.cc +++ b/Geometry/VeryForwardGeometryBuilder/src/DetGeomDesc.cc @@ -32,24 +32,24 @@ /* * Constructor from old DD DDFilteredView, also using the SpecPars to access 2x2 wafers info. */ -DetGeomDesc::DetGeomDesc(const DDFilteredView& fv) - : m_name(computeNameWithNoNamespace(fv.name())), - m_copy(fv.copyno()), - m_isDD4hep(false), - m_trans(fv.translation()), // mm (legacy) - m_rot(fv.rotation()), - m_params(fv.parameters()), // default unit from old DD (mm) - m_isABox(fv.shape() == DDSolidShape::ddbox), - m_diamondBoxParams(computeDiamondDimensions(m_isABox, m_isDD4hep, m_params)), // mm (legacy) - m_sensorType(computeSensorType(fv.name())), - m_geographicalID(computeDetID(m_name, fv.copyNumbers(), fv.copyno())), - m_z(fv.translation().z()) // mm (legacy) +DetGeomDesc::DetGeomDesc(const DDFilteredView& fv, const bool is2021) + : m_name(computeNameWithNoNamespace(fv.name())), + m_copy(fv.copyno()), + m_isDD4hep(false), + m_trans(fv.translation()), // mm (legacy) + m_rot(fv.rotation()), + m_params(fv.parameters()), // default unit from old DD (mm) + m_isABox(fv.shape() == DDSolidShape::ddbox), + m_diamondBoxParams(computeDiamondDimensions(m_isABox, m_isDD4hep, m_params)), // mm (legacy) + m_sensorType(computeSensorType(fv.name())), + m_geographicalID(computeDetID(m_name, fv.copyNumbers(), fv.copyno(), is2021)), + m_z(fv.translation().z()) // mm (legacy) {} /* * Constructor from DD4Hep DDFilteredView, also using the SpecPars to access 2x2 wafers info. */ -DetGeomDesc::DetGeomDesc(const cms::DDFilteredView& fv, const cms::DDSpecParRegistry& allSpecParSections) +DetGeomDesc::DetGeomDesc(const cms::DDFilteredView& fv, const cms::DDSpecParRegistry& allSpecParSections, const bool is2021) : m_name(computeNameWithNoNamespace(fv.name())), m_copy(fv.copyNum()), m_isDD4hep(true), @@ -59,7 +59,7 @@ DetGeomDesc::DetGeomDesc(const cms::DDFilteredView& fv, const cms::DDSpecParRegi m_isABox(fv.isABox()), m_diamondBoxParams(computeDiamondDimensions(m_isABox, m_isDD4hep, m_params)), // converted from cm (DD4hep) to mm m_sensorType(computeSensorType(fv.name(), fv.path(), allSpecParSections)), - m_geographicalID(computeDetIDFromDD4hep(m_name, fv.copyNos(), fv.copyNum())), + m_geographicalID(computeDetIDFromDD4hep(m_name, fv.copyNos(), fv.copyNum(), is2021)), m_z(geant_units::operators::convertCmToMm(fv.translation().z())) // converted from cm (DD4hep) to mm {} @@ -170,14 +170,14 @@ DiamondDimensions DetGeomDesc::computeDiamondDimensions(const bool isABox, * old DD DetId computation. * Relies on name and volumes copy numbers. */ -DetId DetGeomDesc::computeDetID(const std::string& name, const std::vector& copyNos, unsigned int copyNum) const { +DetId DetGeomDesc::computeDetID(const std::string& name, const std::vector& copyNos, const unsigned int copyNum, const bool is2021) const { DetId geoID; // strip sensors if (name == DDD_TOTEM_RP_SENSOR_NAME) { - // check size of copy numbers array + // check size of copy numbers vector if (copyNos.size() < 3) - throw cms::Exception("DDDTotemRPContruction") + throw cms::Exception("DDDTotemRPConstruction") << "size of copyNumbers for strip sensor is " << copyNos.size() << ". It must be >= 3."; // extract information @@ -209,9 +209,9 @@ DetId DetGeomDesc::computeDetID(const std::string& name, const std::vector& } else if (std::regex_match(name, std::regex(DDD_TOTEM_TIMING_SENSOR_TMPL))) { - // check size of copy numbers array + // check size of copy numbers vector if (copyNos.size() < 4) - throw cms::Exception("DDDTotemRPContruction") + throw cms::Exception("DDDTotemRPConstruction") << "size of copyNumbers for TOTEM timing sensor is " << copyNos.size() << ". It must be >= 4."; const unsigned int decRPId = copyNos[copyNos.size() - 4]; @@ -227,9 +227,9 @@ DetId DetGeomDesc::computeDetID(const std::string& name, const std::vector& // pixel sensors else if (name == DDD_CTPPS_PIXELS_SENSOR_NAME) { - // check size of copy numbers array + // check size of copy numbers vector if (copyNos.size() < 4) - throw cms::Exception("DDDTotemRPContruction") + throw cms::Exception("DDDTotemRPConstruction") << "size of copyNumbers for pixel sensor is " << copyNos.size() << ". It must be >= 4."; // extract information @@ -243,26 +243,52 @@ DetId DetGeomDesc::computeDetID(const std::string& name, const std::vector& // diamond/UFSD sensors else if (name == DDD_CTPPS_DIAMONDS_SEGMENT_NAME || name == DDD_CTPPS_UFSD_SEGMENT_NAME) { + // check size of copy numbers vector + if (copyNos.size() < 2) + throw cms::Exception("DDDTotemRPConstruction") + << "size of copyNumbers for diamond segments is " << copyNos.size() << ". It must be >= 2."; + const unsigned int decRPId = copyNos[1]; + unsigned int arm, station, rp; + if (!is2021) { + std::cout << "is NOT 2021 " << std::endl; + arm = decRPId - 1; + station = 1; + rp = 6; + } else { + std::cout << "is 2021 " << std::endl; + arm = (decRPId % 1000) / 100; + station = (decRPId % 100) / 10; + rp = decRPId % 10; + } const unsigned int id = copyNos[copyNos.size() - 1]; - const unsigned int arm = copyNos[1] - 1; - const unsigned int station = 1; - const unsigned int rp = 6; - const unsigned int plane = (id / 100); + const unsigned int plane = id / 100; const unsigned int channel = id % 100; + std::cout << "diamond sensors. arm = " << arm << " station = " << station << " rp = " << rp << " plane = " << plane << std::endl; geoID = CTPPSDiamondDetId(arm, station, rp, plane, channel); } // diamond/UFSD RPs else if (name == DDD_CTPPS_DIAMONDS_RP_NAME) { - // check size of copy numbers array + // check size of copy numbers vector if (copyNos.size() < 2) - throw cms::Exception("DDDTotemRPContruction") - << "size of copyNumbers for diamond RP is " << copyNos.size() << ". It must be >= 2."; - - const unsigned int arm = copyNos[1] - 1; - const unsigned int station = 1; - const unsigned int rp = 6; + throw cms::Exception("DDDTotemRPConstruction") + << "size of copyNumbers for diamond RP is " << copyNos.size() << ". It must be >= 2."; + + const unsigned int decRPId = copyNos[1]; + unsigned int arm, station, rp; + if (!is2021) { + std::cout << "is NOT 2021 " << std::endl; + arm = decRPId - 1; + station = 1; + rp = 6; + } else { + std::cout << "is 2021 " << std::endl; + arm = (decRPId % 1000) / 100; + station = (decRPId % 100) / 10; + rp = decRPId % 10; + } + std::cout << "diamond RPs. arm = " << arm << " station = " << station << " rp = " << rp << std::endl; geoID = CTPPSDiamondDetId(arm, station, rp); } @@ -275,10 +301,11 @@ DetId DetGeomDesc::computeDetID(const std::string& name, const std::vector& */ DetId DetGeomDesc::computeDetIDFromDD4hep(const std::string& name, const std::vector& copyNos, - unsigned int copyNum) const { + const unsigned int copyNum, + const bool is2021) const { std::vector copyNosOldDD = {copyNos.rbegin() + 1, copyNos.rend()}; - return computeDetID(name, copyNosOldDD, copyNum); + return computeDetID(name, copyNosOldDD, copyNum, is2021); } /* diff --git a/Geometry/VeryForwardGeometryBuilder/src/DetGeomDescBuilder.cc b/Geometry/VeryForwardGeometryBuilder/src/DetGeomDescBuilder.cc index f87e0ca487a2e..4a42bffddf1eb 100644 --- a/Geometry/VeryForwardGeometryBuilder/src/DetGeomDescBuilder.cc +++ b/Geometry/VeryForwardGeometryBuilder/src/DetGeomDescBuilder.cc @@ -8,16 +8,16 @@ /* * Generic function to build geo (tree of DetGeomDesc) from old DD compact view. */ -std::unique_ptr detgeomdescbuilder::buildDetGeomDescFromCompactView(const DDCompactView& myCompactView) { +std::unique_ptr detgeomdescbuilder::buildDetGeomDescFromCompactView(const DDCompactView& myCompactView, const bool is2021) { // Create DDFilteredView (no filter!!) DDPassAllFilter filter; DDFilteredView fv(myCompactView, filter); // Geo info: root node. - auto geoInfoRoot = std::make_unique(fv); + auto geoInfoRoot = std::make_unique(fv, is2021); // Construct the tree of children geo info (DetGeomDesc). - detgeomdescbuilder::buildDetGeomDescDescendants(fv, geoInfoRoot.get()); + detgeomdescbuilder::buildDetGeomDescDescendants(fv, geoInfoRoot.get(), is2021); edm::LogInfo("PPSGeometryESProducer") << "Successfully built geometry."; @@ -28,18 +28,18 @@ std::unique_ptr detgeomdescbuilder::buildDetGeomDescFromCompactView * Depth-first search recursion. * Construct the tree of children geo info (DetGeomDesc) (old DD). */ -void detgeomdescbuilder::buildDetGeomDescDescendants(DDFilteredView& fv, DetGeomDesc* geoInfo) { +void detgeomdescbuilder::buildDetGeomDescDescendants(DDFilteredView& fv, DetGeomDesc* geoInfo, const bool is2021) { // Leaf if (!fv.firstChild()) return; do { // Create node, and add it to the geoInfoParent's list. - DetGeomDesc* child = new DetGeomDesc(fv); + DetGeomDesc* child = new DetGeomDesc(fv, is2021); geoInfo->addComponent(child); // Recursion - buildDetGeomDescDescendants(fv, child); + buildDetGeomDescDescendants(fv, child, is2021); } while (fv.nextSibling()); fv.parent(); @@ -49,7 +49,7 @@ void detgeomdescbuilder::buildDetGeomDescDescendants(DDFilteredView& fv, DetGeom * Generic function to build geo (tree of DetGeomDesc) from DD4hep compact view. */ std::unique_ptr detgeomdescbuilder::buildDetGeomDescFromCompactView( - const cms::DDCompactView& myCompactView) { + const cms::DDCompactView& myCompactView, const bool is2021) { // create DDFilteredView (no filter!!) const cms::DDDetector* mySystem = myCompactView.detector(); const dd4hep::Volume& worldVolume = mySystem->worldVolume(); @@ -60,12 +60,12 @@ std::unique_ptr detgeomdescbuilder::buildDetGeomDescFromCompactView const cms::DDSpecParRegistry& allSpecParSections = myCompactView.specpars(); // Geo info: root node. - auto geoInfoRoot = std::make_unique(fv, allSpecParSections); + auto geoInfoRoot = std::make_unique(fv, allSpecParSections, is2021); // Construct the tree of children geo info (DetGeomDesc). do { // Create node, and add it to the geoInfoRoot's list. - DetGeomDesc* child = new DetGeomDesc(fv, allSpecParSections); + DetGeomDesc* child = new DetGeomDesc(fv, allSpecParSections, is2021); geoInfoRoot->addComponent(child); } while (fv.next(0)); From f4afe113b884e9fa1cc8fc68e9f100e0e9f1dfe1 Mon Sep 17 00:00:00 2001 From: Gabrielle Hugo Date: Tue, 8 Sep 2020 19:37:04 +0200 Subject: [PATCH 32/64] There should be no diff in old DD scenarios, remove change to Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml --- .../data/CTPPS_Timing_Stations_Assembly.xml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml b/Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml index acee3e5f3075b..2e6254a3eb4ae 100644 --- a/Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml +++ b/Geometry/VeryForwardData/data/CTPPS_Timing_Stations_Assembly.xml @@ -2,23 +2,22 @@ - - - + + + - + - + - - + - + From ff92f7251113b7b705a20dd90eb1aa7168d61274 Mon Sep 17 00:00:00 2001 From: Gabrielle Hugo Date: Fri, 11 Sep 2020 17:02:41 +0200 Subject: [PATCH 33/64] Remove printouts --- Geometry/VeryForwardGeometryBuilder/src/DetGeomDesc.cc | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Geometry/VeryForwardGeometryBuilder/src/DetGeomDesc.cc b/Geometry/VeryForwardGeometryBuilder/src/DetGeomDesc.cc index 69685f5cafba9..a41b06e4c9972 100644 --- a/Geometry/VeryForwardGeometryBuilder/src/DetGeomDesc.cc +++ b/Geometry/VeryForwardGeometryBuilder/src/DetGeomDesc.cc @@ -245,12 +245,10 @@ DetId DetGeomDesc::computeDetID(const std::string& name, const std::vector& const unsigned int decRPId = copyNos[1]; unsigned int arm, station, rp; if (!is2021) { - std::cout << "is NOT 2021 " << std::endl; arm = decRPId - 1; station = 1; rp = 6; } else { - std::cout << "is 2021 " << std::endl; arm = (decRPId % 1000) / 100; station = (decRPId % 100) / 10; rp = decRPId % 10; @@ -258,8 +256,6 @@ DetId DetGeomDesc::computeDetID(const std::string& name, const std::vector& const unsigned int id = copyNos[copyNos.size() - 1]; const unsigned int plane = id / 100; const unsigned int channel = id % 100; - std::cout << "diamond sensors. arm = " << arm << " station = " << station << " rp = " << rp << " plane = " << plane << std::endl; - geoID = CTPPSDiamondDetId(arm, station, rp, plane, channel); } @@ -273,18 +269,14 @@ DetId DetGeomDesc::computeDetID(const std::string& name, const std::vector& const unsigned int decRPId = copyNos[1]; unsigned int arm, station, rp; if (!is2021) { - std::cout << "is NOT 2021 " << std::endl; arm = decRPId - 1; station = 1; rp = 6; } else { - std::cout << "is 2021 " << std::endl; arm = (decRPId % 1000) / 100; station = (decRPId % 100) / 10; rp = decRPId % 10; } - std::cout << "diamond RPs. arm = " << arm << " station = " << station << " rp = " << rp << std::endl; - geoID = CTPPSDiamondDetId(arm, station, rp); } From b13fd321caf7f1f34617dc8c812180feebcd7d99 Mon Sep 17 00:00:00 2001 From: Gabrielle Hugo Date: Fri, 11 Sep 2020 17:09:22 +0200 Subject: [PATCH 34/64] scram build code-format --- CondTools/Geometry/plugins/PPSGeometryBuilder.cc | 10 +++++----- .../interface/DetGeomDesc.h | 10 ++++++++-- .../interface/DetGeomDescBuilder.h | 3 ++- .../VeryForwardGeometryBuilder/src/DetGeomDesc.cc | 11 +++++++---- .../src/DetGeomDescBuilder.cc | 3 ++- RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc | 2 +- 6 files changed, 25 insertions(+), 14 deletions(-) diff --git a/CondTools/Geometry/plugins/PPSGeometryBuilder.cc b/CondTools/Geometry/plugins/PPSGeometryBuilder.cc index 7568a61676904..bd0b8e0c8d698 100644 --- a/CondTools/Geometry/plugins/PPSGeometryBuilder.cc +++ b/CondTools/Geometry/plugins/PPSGeometryBuilder.cc @@ -45,11 +45,11 @@ class PPSGeometryBuilder : public edm::one::EDAnalyzer<> { }; PPSGeometryBuilder::PPSGeometryBuilder(const edm::ParameterSet& iConfig) - : fromDD4hep_(iConfig.getUntrackedParameter("fromDD4hep", false)), - compactViewTag_(iConfig.getUntrackedParameter("compactViewTag", "XMLIdealGeometryESSource_CTPPS")), - is2021_(iConfig.getUntrackedParameter("is2021", false)), - ddToken_(esConsumes(edm::ESInputTag("", compactViewTag_))), - dd4hepToken_(esConsumes(edm::ESInputTag("", compactViewTag_))) {} + : fromDD4hep_(iConfig.getUntrackedParameter("fromDD4hep", false)), + compactViewTag_(iConfig.getUntrackedParameter("compactViewTag", "XMLIdealGeometryESSource_CTPPS")), + is2021_(iConfig.getUntrackedParameter("is2021", false)), + ddToken_(esConsumes(edm::ESInputTag("", compactViewTag_))), + dd4hepToken_(esConsumes(edm::ESInputTag("", compactViewTag_))) {} /* * Save PPS geo to DB. diff --git a/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDesc.h b/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDesc.h index 6d27a020e46e4..8e922932d103c 100644 --- a/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDesc.h +++ b/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDesc.h @@ -114,8 +114,14 @@ class DetGeomDesc { DiamondDimensions computeDiamondDimensions(const bool isABox, const bool isDD4hep, const std::vector& params) const; - DetId computeDetID(const std::string& name, const std::vector& copyNos, const unsigned int copyNum, const bool is2021) const; - DetId computeDetIDFromDD4hep(const std::string& name, const std::vector& copyNos, const unsigned int copyNum, const bool is2021) const; + DetId computeDetID(const std::string& name, + const std::vector& copyNos, + const unsigned int copyNum, + const bool is2021) const; + DetId computeDetIDFromDD4hep(const std::string& name, + const std::vector& copyNos, + const unsigned int copyNum, + const bool is2021) const; std::string computeSensorType(std::string_view name); std::string m_name; // with no namespace diff --git a/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDescBuilder.h b/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDescBuilder.h index d2fb0a2d0386e..d15962279e068 100644 --- a/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDescBuilder.h +++ b/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDescBuilder.h @@ -11,7 +11,8 @@ namespace detgeomdescbuilder { std::unique_ptr buildDetGeomDescFromCompactView(const DDCompactView& myCompactView, const bool is2021); void buildDetGeomDescDescendants(DDFilteredView& fv, DetGeomDesc* geoInfoParent, const bool is2021); - std::unique_ptr buildDetGeomDescFromCompactView(const cms::DDCompactView& myCompactView, const bool is2021); + std::unique_ptr buildDetGeomDescFromCompactView(const cms::DDCompactView& myCompactView, + const bool is2021); } // namespace detgeomdescbuilder #endif diff --git a/Geometry/VeryForwardGeometryBuilder/src/DetGeomDesc.cc b/Geometry/VeryForwardGeometryBuilder/src/DetGeomDesc.cc index a41b06e4c9972..fd2b2069e83c1 100644 --- a/Geometry/VeryForwardGeometryBuilder/src/DetGeomDesc.cc +++ b/Geometry/VeryForwardGeometryBuilder/src/DetGeomDesc.cc @@ -165,7 +165,10 @@ DiamondDimensions DetGeomDesc::computeDiamondDimensions(const bool isABox, * old DD DetId computation. * Relies on name and volumes copy numbers. */ -DetId DetGeomDesc::computeDetID(const std::string& name, const std::vector& copyNos, const unsigned int copyNum, const bool is2021) const { +DetId DetGeomDesc::computeDetID(const std::string& name, + const std::vector& copyNos, + const unsigned int copyNum, + const bool is2021) const { DetId geoID; // strip sensors @@ -241,7 +244,7 @@ DetId DetGeomDesc::computeDetID(const std::string& name, const std::vector& // check size of copy numbers vector if (copyNos.size() < 2) throw cms::Exception("DDDTotemRPConstruction") - << "size of copyNumbers for diamond segments is " << copyNos.size() << ". It must be >= 2."; + << "size of copyNumbers for diamond segments is " << copyNos.size() << ". It must be >= 2."; const unsigned int decRPId = copyNos[1]; unsigned int arm, station, rp; if (!is2021) { @@ -264,7 +267,7 @@ DetId DetGeomDesc::computeDetID(const std::string& name, const std::vector& // check size of copy numbers vector if (copyNos.size() < 2) throw cms::Exception("DDDTotemRPConstruction") - << "size of copyNumbers for diamond RP is " << copyNos.size() << ". It must be >= 2."; + << "size of copyNumbers for diamond RP is " << copyNos.size() << ". It must be >= 2."; const unsigned int decRPId = copyNos[1]; unsigned int arm, station, rp; @@ -289,7 +292,7 @@ DetId DetGeomDesc::computeDetID(const std::string& name, const std::vector& DetId DetGeomDesc::computeDetIDFromDD4hep(const std::string& name, const std::vector& copyNos, const unsigned int copyNum, - const bool is2021) const { + const bool is2021) const { std::vector copyNosOldDD = {copyNos.rbegin() + 1, copyNos.rend()}; return computeDetID(name, copyNosOldDD, copyNum, is2021); diff --git a/Geometry/VeryForwardGeometryBuilder/src/DetGeomDescBuilder.cc b/Geometry/VeryForwardGeometryBuilder/src/DetGeomDescBuilder.cc index 01e732b71f011..bcb631c96aed0 100644 --- a/Geometry/VeryForwardGeometryBuilder/src/DetGeomDescBuilder.cc +++ b/Geometry/VeryForwardGeometryBuilder/src/DetGeomDescBuilder.cc @@ -6,7 +6,8 @@ /* * Generic function to build geo (tree of DetGeomDesc) from old DD compact view. */ -std::unique_ptr detgeomdescbuilder::buildDetGeomDescFromCompactView(const DDCompactView& myCompactView, const bool is2021) { +std::unique_ptr detgeomdescbuilder::buildDetGeomDescFromCompactView(const DDCompactView& myCompactView, + const bool is2021) { // Create DDFilteredView (no filter!!) DDPassAllFilter filter; DDFilteredView fv(myCompactView, filter); diff --git a/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc b/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc index 3f96bac38f955..97173eb815938 100644 --- a/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc +++ b/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc @@ -58,7 +58,7 @@ void CTPPSDiamondLocalTrackFitter::produce(edm::Event& iEvent, const edm::EventS const CTPPSDiamondDetId raw_detid(vec.detId()), detid(raw_detid.arm(), raw_detid.station(), raw_detid.rp()); // if algorithm is not found, build it if (trk_algo_.count(detid) == 0) - trk_algo_[detid].reset(new CTPPSDiamondTrackRecognition(trk_algo_params_)); + trk_algo_[detid] = std::make_unique(trk_algo_params_); for (const auto& hit : vec) // skip hits without a leading edge if (hit.ootIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING) From 826deaa5de56a6c1dfa23c245fd6326a6be68bce Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 16 Sep 2020 10:01:49 +0200 Subject: [PATCH 35/64] Renamed legacy run 2 switch in DetGeomDesc --- .../interface/DetGeomDesc.h | 16 +++++++------ .../src/DetGeomDesc.cc | 24 +++++++++---------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDesc.h b/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDesc.h index 8e922932d103c..4197bad36d64d 100644 --- a/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDesc.h +++ b/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDesc.h @@ -1,7 +1,7 @@ /**************************************************************************** * * Authors: -* Jan Kašpar (jan.kaspar@gmail.com) +* Jan Kašpar (jan.kaspar@gmail.com) * CMSSW developpers (based on class GeometricDet) * * Rewritten + Moved out common functionalities to DetGeomDesc(Builder) by Gabrielle Hugo. @@ -28,7 +28,7 @@ class CTPPSRPAlignmentCorrectionData; * * Class resembling GeometricDet class. Slight changes were made to suit needs of the TOTEM RP description. * Each instance is a tree node, with geometrical information from DDD (shift, rotation, material, ...), ID and list of children nodes. - * + * * The translation and rotation parameters are defined by local-to-global * coordinate transform. That is, if r_l is a point in local coordinate system and x_g in global, * then the transform reads: @@ -37,7 +37,7 @@ class CTPPSRPAlignmentCorrectionData; \endverbatim * * July 2020: Migrated to DD4hep - * To avoid any regression with values from XMLs / Geant4, all lengths are converted from cm (DD4hep) to mm. + * To avoid any regression with values from XMLs / Geant4, all lengths are converted from cm (DD4hep) to mm. * **/ @@ -54,9 +54,11 @@ class DetGeomDesc { using Translation = ROOT::Math::DisplacementVector3D>; // Constructor from old DD DDFilteredView - DetGeomDesc(const DDFilteredView& fv, const bool is2021); + /// \param[in] legacyRun2 Switch between legacy run 2-like geometry and 2021 scenario + DetGeomDesc(const DDFilteredView& fv, const bool legacyRun2); // Constructor from DD4Hep DDFilteredView - DetGeomDesc(const cms::DDFilteredView& fv, const bool is2021); + /// \param[in] legacyRun2 Switch between legacy run 2-like geometry and 2021 scenario + DetGeomDesc(const cms::DDFilteredView& fv, const bool legacyRun2); DetGeomDesc(const DetGeomDesc&); DetGeomDesc& operator=(const DetGeomDesc&); @@ -117,11 +119,11 @@ class DetGeomDesc { DetId computeDetID(const std::string& name, const std::vector& copyNos, const unsigned int copyNum, - const bool is2021) const; + const bool legacyRun2) const; DetId computeDetIDFromDD4hep(const std::string& name, const std::vector& copyNos, const unsigned int copyNum, - const bool is2021) const; + const bool legacyRun2) const; std::string computeSensorType(std::string_view name); std::string m_name; // with no namespace diff --git a/Geometry/VeryForwardGeometryBuilder/src/DetGeomDesc.cc b/Geometry/VeryForwardGeometryBuilder/src/DetGeomDesc.cc index fd2b2069e83c1..bd2d542eb143a 100644 --- a/Geometry/VeryForwardGeometryBuilder/src/DetGeomDesc.cc +++ b/Geometry/VeryForwardGeometryBuilder/src/DetGeomDesc.cc @@ -1,8 +1,8 @@ /**************************************************************************** * * This is a part of the TOTEM offline software. -* Authors: -* Jan Kašpar (jan.kaspar@gmail.com) +* Authors: +* Jan Kašpar (jan.kaspar@gmail.com) * CMSSW developers (based on GeometricDet class) * ****************************************************************************/ @@ -27,7 +27,7 @@ /* * Constructor from old DD DDFilteredView, also using the SpecPars to access 2x2 wafers info. */ -DetGeomDesc::DetGeomDesc(const DDFilteredView& fv, const bool is2021) +DetGeomDesc::DetGeomDesc(const DDFilteredView& fv, const bool legacyRun2) : m_name(computeNameWithNoNamespace(fv.name())), m_copy(fv.copyno()), m_isDD4hep(false), @@ -37,14 +37,14 @@ DetGeomDesc::DetGeomDesc(const DDFilteredView& fv, const bool is2021) m_isABox(fv.shape() == DDSolidShape::ddbox), m_diamondBoxParams(computeDiamondDimensions(m_isABox, m_isDD4hep, m_params)), // mm (legacy) m_sensorType(computeSensorType(fv.logicalPart().name().fullname())), - m_geographicalID(computeDetID(m_name, fv.copyNumbers(), fv.copyno(), is2021)), + m_geographicalID(computeDetID(m_name, fv.copyNumbers(), fv.copyno(), legacyRun2)), m_z(fv.translation().z()) // mm (legacy) {} /* * Constructor from DD4Hep DDFilteredView, also using the SpecPars to access 2x2 wafers info. */ -DetGeomDesc::DetGeomDesc(const cms::DDFilteredView& fv, const bool is2021) +DetGeomDesc::DetGeomDesc(const cms::DDFilteredView& fv, const bool legacyRun2) : m_name(computeNameWithNoNamespace(fv.name())), m_copy(fv.copyNum()), m_isDD4hep(true), @@ -54,7 +54,7 @@ DetGeomDesc::DetGeomDesc(const cms::DDFilteredView& fv, const bool is2021) m_isABox(dd4hep::isA(fv.solid())), m_diamondBoxParams(computeDiamondDimensions(m_isABox, m_isDD4hep, m_params)), // converted from cm (DD4hep) to mm m_sensorType(computeSensorType(fv.name())), - m_geographicalID(computeDetIDFromDD4hep(m_name, fv.copyNos(), fv.copyNum(), is2021)), + m_geographicalID(computeDetIDFromDD4hep(m_name, fv.copyNos(), fv.copyNum(), legacyRun2)), m_z(geant_units::operators::convertCmToMm(fv.translation().z())) // converted from cm (DD4hep) to mm {} @@ -140,7 +140,7 @@ std::vector DetGeomDesc::computeParameters(const cms::DDFilteredView& fv /* * Compute diamond dimensions. * The diamond sensors are represented by the Box shape parameters. - * oldDD: params are already in mm. + * oldDD: params are already in mm. * DD4hep: convert params from cm (DD4hep) to mm (legacy expected by PPS reco software). */ DiamondDimensions DetGeomDesc::computeDiamondDimensions(const bool isABox, @@ -168,7 +168,7 @@ DiamondDimensions DetGeomDesc::computeDiamondDimensions(const bool isABox, DetId DetGeomDesc::computeDetID(const std::string& name, const std::vector& copyNos, const unsigned int copyNum, - const bool is2021) const { + const bool legacyRun2) const { DetId geoID; // strip sensors @@ -247,7 +247,7 @@ DetId DetGeomDesc::computeDetID(const std::string& name, << "size of copyNumbers for diamond segments is " << copyNos.size() << ". It must be >= 2."; const unsigned int decRPId = copyNos[1]; unsigned int arm, station, rp; - if (!is2021) { + if (legacyRun2) { arm = decRPId - 1; station = 1; rp = 6; @@ -271,7 +271,7 @@ DetId DetGeomDesc::computeDetID(const std::string& name, const unsigned int decRPId = copyNos[1]; unsigned int arm, station, rp; - if (!is2021) { + if (legacyRun2) { arm = decRPId - 1; station = 1; rp = 6; @@ -292,10 +292,10 @@ DetId DetGeomDesc::computeDetID(const std::string& name, DetId DetGeomDesc::computeDetIDFromDD4hep(const std::string& name, const std::vector& copyNos, const unsigned int copyNum, - const bool is2021) const { + const bool legacyRun2) const { std::vector copyNosOldDD = {copyNos.rbegin() + 1, copyNos.rend()}; - return computeDetID(name, copyNosOldDD, copyNum, is2021); + return computeDetID(name, copyNosOldDD, copyNum, legacyRun2); } /* From 0e77af5efe3605703f46eaa3510375829cd4d28b Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 16 Sep 2020 10:04:23 +0200 Subject: [PATCH 36/64] Matched builder too --- .../interface/DetGeomDescBuilder.h | 6 +++--- .../src/DetGeomDescBuilder.cc | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDescBuilder.h b/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDescBuilder.h index d15962279e068..aefab1763d9b2 100644 --- a/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDescBuilder.h +++ b/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDescBuilder.h @@ -9,10 +9,10 @@ * Generic function to build geo (tree of DetGeomDesc) from compact view. */ namespace detgeomdescbuilder { - std::unique_ptr buildDetGeomDescFromCompactView(const DDCompactView& myCompactView, const bool is2021); - void buildDetGeomDescDescendants(DDFilteredView& fv, DetGeomDesc* geoInfoParent, const bool is2021); + std::unique_ptr buildDetGeomDescFromCompactView(const DDCompactView& myCompactView, const bool legacyRun2); + void buildDetGeomDescDescendants(DDFilteredView& fv, DetGeomDesc* geoInfoParent, const bool legacyRun2); std::unique_ptr buildDetGeomDescFromCompactView(const cms::DDCompactView& myCompactView, - const bool is2021); + const bool legacyRun2); } // namespace detgeomdescbuilder #endif diff --git a/Geometry/VeryForwardGeometryBuilder/src/DetGeomDescBuilder.cc b/Geometry/VeryForwardGeometryBuilder/src/DetGeomDescBuilder.cc index bcb631c96aed0..ac8b052b3149f 100644 --- a/Geometry/VeryForwardGeometryBuilder/src/DetGeomDescBuilder.cc +++ b/Geometry/VeryForwardGeometryBuilder/src/DetGeomDescBuilder.cc @@ -7,16 +7,16 @@ * Generic function to build geo (tree of DetGeomDesc) from old DD compact view. */ std::unique_ptr detgeomdescbuilder::buildDetGeomDescFromCompactView(const DDCompactView& myCompactView, - const bool is2021) { + const bool legacyRun2) { // Create DDFilteredView (no filter!!) DDPassAllFilter filter; DDFilteredView fv(myCompactView, filter); // Geo info: root node. - auto geoInfoRoot = std::make_unique(fv, is2021); + auto geoInfoRoot = std::make_unique(fv, legacyRun2); // Construct the tree of children geo info (DetGeomDesc). - detgeomdescbuilder::buildDetGeomDescDescendants(fv, geoInfoRoot.get(), is2021); + detgeomdescbuilder::buildDetGeomDescDescendants(fv, geoInfoRoot.get(), legacyRun2); edm::LogInfo("PPSGeometryESProducer") << "Successfully built geometry."; @@ -27,18 +27,18 @@ std::unique_ptr detgeomdescbuilder::buildDetGeomDescFromCompactView * Depth-first search recursion. * Construct the tree of children geo info (DetGeomDesc) (old DD). */ -void detgeomdescbuilder::buildDetGeomDescDescendants(DDFilteredView& fv, DetGeomDesc* geoInfo, const bool is2021) { +void detgeomdescbuilder::buildDetGeomDescDescendants(DDFilteredView& fv, DetGeomDesc* geoInfo, const bool legacyRun2) { // Leaf if (!fv.firstChild()) return; do { // Create node, and add it to the geoInfoParent's list. - DetGeomDesc* child = new DetGeomDesc(fv, is2021); + DetGeomDesc* child = new DetGeomDesc(fv, legacyRun2); geoInfo->addComponent(child); // Recursion - buildDetGeomDescDescendants(fv, child, is2021); + buildDetGeomDescDescendants(fv, child, legacyRun2); } while (fv.nextSibling()); fv.parent(); @@ -48,7 +48,7 @@ void detgeomdescbuilder::buildDetGeomDescDescendants(DDFilteredView& fv, DetGeom * Generic function to build geo (tree of DetGeomDesc) from DD4hep compact view. */ std::unique_ptr detgeomdescbuilder::buildDetGeomDescFromCompactView( - const cms::DDCompactView& myCompactView, const bool is2021) { + const cms::DDCompactView& myCompactView, const bool legacyRun2) { // create DDFilteredView (no filter!!) const cms::DDDetector* mySystem = myCompactView.detector(); const dd4hep::Volume& worldVolume = mySystem->worldVolume(); @@ -58,12 +58,12 @@ std::unique_ptr detgeomdescbuilder::buildDetGeomDescFromCompactView } // Geo info: root node. - auto geoInfoRoot = std::make_unique(fv, is2021); + auto geoInfoRoot = std::make_unique(fv, legacyRun2); // Construct the tree of children geo info (DetGeomDesc). do { // Create node, and add it to the geoInfoRoot's list. - DetGeomDesc* child = new DetGeomDesc(fv, is2021); + DetGeomDesc* child = new DetGeomDesc(fv, legacyRun2); geoInfoRoot->addComponent(child); } while (fv.next(0)); From 26e0b8c1ab28e84c4e480f0fa22337be5294d454 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 16 Sep 2020 10:07:52 +0200 Subject: [PATCH 37/64] Adapted tag in PPS geometry builder --- CondTools/Geometry/plugins/PPSGeometryBuilder.cc | 8 ++++---- .../python/dd4hep/geometryRPFromDD_2021_cfi.py | 1 - .../python/geometryRPFromDD_2021_cfi.py | 3 +-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/CondTools/Geometry/plugins/PPSGeometryBuilder.cc b/CondTools/Geometry/plugins/PPSGeometryBuilder.cc index bd0b8e0c8d698..860184af31451 100644 --- a/CondTools/Geometry/plugins/PPSGeometryBuilder.cc +++ b/CondTools/Geometry/plugins/PPSGeometryBuilder.cc @@ -37,7 +37,7 @@ class PPSGeometryBuilder : public edm::one::EDAnalyzer<> { bool fromDD4hep_; std::string compactViewTag_; - bool is2021_; + bool legacyRun2_; edm::ESGetToken ddToken_; edm::ESGetToken dd4hepToken_; edm::ESWatcher watcherIdealGeometry_; @@ -47,7 +47,7 @@ class PPSGeometryBuilder : public edm::one::EDAnalyzer<> { PPSGeometryBuilder::PPSGeometryBuilder(const edm::ParameterSet& iConfig) : fromDD4hep_(iConfig.getUntrackedParameter("fromDD4hep", false)), compactViewTag_(iConfig.getUntrackedParameter("compactViewTag", "XMLIdealGeometryESSource_CTPPS")), - is2021_(iConfig.getUntrackedParameter("is2021", false)), + legacyRun2_(iConfig.getUntrackedParameter("legacyRun2", false)), ddToken_(esConsumes(edm::ESInputTag("", compactViewTag_))), dd4hepToken_(esConsumes(edm::ESInputTag("", compactViewTag_))) {} @@ -65,7 +65,7 @@ void PPSGeometryBuilder::analyze(const edm::Event& iEvent, const edm::EventSetup auto const& myCompactView = iSetup.getData(ddToken_); // Build geometry - geoInfoRoot = detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView, is2021_); + geoInfoRoot = detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView, legacyRun2_); } // DD4hep else { @@ -73,7 +73,7 @@ void PPSGeometryBuilder::analyze(const edm::Event& iEvent, const edm::EventSetup auto const& myCompactView = iSetup.getData(dd4hepToken_); // Build geometry - geoInfoRoot = detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView, is2021_); + geoInfoRoot = detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView, legacyRun2_); } } diff --git a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py index 4eb910de6d21c..932fc960c6b49 100644 --- a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py +++ b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py @@ -10,7 +10,6 @@ ) ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", - is2021 = cms.untracked.bool(True), fromDD4hep = cms.untracked.bool(True), verbosity = cms.untracked.uint32(1), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py index b1fd9972be3cc..f0ab5f25f1cb0 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py @@ -148,6 +148,5 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", verbosity = cms.untracked.uint32(1), - compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS'), - is2021 = cms.untracked.bool(True) + compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) From 9f767ffe0537c108321b1eeca4ac0c19f849e8c1 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 16 Sep 2020 10:14:21 +0200 Subject: [PATCH 38/64] Also adapted legacy ESModule --- .../dd4hep/geometryRPFromDD_2017_cfi.py | 1 + .../dd4hep/geometryRPFromDD_2018_cfi.py | 1 + .../geometryPPS_CMSxz_fromDD_2016_cfi.py | 29 ++++++++++--------- .../geometryPPS_CMSxz_fromDD_2017_cfi.py | 29 ++++++++++--------- .../geometryPPS_CMSxz_fromDD_2018_cfi.py | 29 ++++++++++--------- .../python/geometryRPFromDD_2017_cfi.py | 1 + .../python/geometryRPFromDD_2018_cfi.py | 1 + .../plugins/CTPPSGeometryESModule.cc | 10 +++---- 8 files changed, 54 insertions(+), 47 deletions(-) diff --git a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2017_cfi.py b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2017_cfi.py index cfcf10a1ddac3..41637e7a3c085 100644 --- a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2017_cfi.py +++ b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2017_cfi.py @@ -11,6 +11,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", fromDD4hep = cms.untracked.bool(True), + legacyRun2 = cms.untracked.bool(True), verbosity = cms.untracked.uint32(1), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2018_cfi.py b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2018_cfi.py index caee6c207680f..84a7d54ee41ec 100644 --- a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2018_cfi.py +++ b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2018_cfi.py @@ -11,6 +11,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", fromDD4hep = cms.untracked.bool(True), + legacyRun2 = cms.untracked.bool(True), verbosity = cms.untracked.uint32(1), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2016_cfi.py b/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2016_cfi.py index cad035090b01f..de99986173f5c 100644 --- a/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2016_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2016_cfi.py @@ -3,19 +3,19 @@ # common and strip files totemGeomXMLFiles = cms.vstring( 'Geometry/CMSCommonData/data/materials.xml', - 'Geometry/CMSCommonData/data/rotations.xml', + 'Geometry/CMSCommonData/data/rotations.xml', 'Geometry/CMSCommonData/data/cmsextent/2018/v1/cmsextent.xml', - 'Geometry/CMSCommonData/data/cms/2017/v1/cms.xml', - 'Geometry/CMSCommonData/data/beampipe/2017/v1/beampipe.xml', - 'Geometry/CMSCommonData/data/cmsBeam.xml', - 'Geometry/CMSCommonData/data/cmsMother.xml', - 'Geometry/CMSCommonData/data/mgnt.xml', - 'Geometry/ForwardCommonData/data/forward.xml', - 'Geometry/ForwardCommonData/data/totemRotations.xml', - 'Geometry/ForwardCommonData/data/totemMaterials.xml', - 'Geometry/ForwardCommonData/data/totemt1.xml', - 'Geometry/ForwardCommonData/data/totemt2.xml', - 'Geometry/ForwardCommonData/data/ionpump.xml', + 'Geometry/CMSCommonData/data/cms/2017/v1/cms.xml', + 'Geometry/CMSCommonData/data/beampipe/2017/v1/beampipe.xml', + 'Geometry/CMSCommonData/data/cmsBeam.xml', + 'Geometry/CMSCommonData/data/cmsMother.xml', + 'Geometry/CMSCommonData/data/mgnt.xml', + 'Geometry/ForwardCommonData/data/forward.xml', + 'Geometry/ForwardCommonData/data/totemRotations.xml', + 'Geometry/ForwardCommonData/data/totemMaterials.xml', + 'Geometry/ForwardCommonData/data/totemt1.xml', + 'Geometry/ForwardCommonData/data/totemt2.xml', + 'Geometry/ForwardCommonData/data/ionpump.xml', 'Geometry/VeryForwardData/data/RP_Box.xml', 'Geometry/VeryForwardData/data/RP_Box/RP_Box_000.xml', 'Geometry/VeryForwardData/data/RP_Box/RP_Box_001.xml', @@ -79,7 +79,7 @@ 'Geometry/VeryForwardData/data/CTPPS_Stations_Assembly.xml', 'Geometry/VeryForwardData/data/CTPPS_Cuts_Per_Region.xml', 'Geometry/VeryForwardData/data/RP_Sensitive_Dets.xml' -) +) # diamond files ctppsDiamondGeomXMLFiles = cms.vstring( @@ -112,7 +112,7 @@ ctppsUFSDGeomXMLFiles = cms.vstring( 'Geometry/VeryForwardData/data/CTPPS_UFSD_Segments/CTPPS_UFSD_Pattern1.xml', 'Geometry/VeryForwardData/data/CTPPS_UFSD_Segments/CTPPS_UFSD_Pattern2_SegmentA.xml', - 'Geometry/VeryForwardData/data/CTPPS_UFSD_Segments/CTPPS_UFSD_Pattern2_SegmentB.xml', + 'Geometry/VeryForwardData/data/CTPPS_UFSD_Segments/CTPPS_UFSD_Pattern2_SegmentB.xml', 'Geometry/VeryForwardData/data/CTPPS_UFSD_Planes/CTPPS_UFSD_Plane4.xml', 'Geometry/VeryForwardData/data/CTPPS_UFSD_Parameters.xml' ) @@ -136,6 +136,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", verbosity = cms.untracked.uint32(1), + legacyRun2 = cms.untracked.bool(True), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2017_cfi.py b/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2017_cfi.py index 7e8059401f622..c692b973ce642 100644 --- a/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2017_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2017_cfi.py @@ -3,19 +3,19 @@ # common and strip files totemGeomXMLFiles = cms.vstring( 'Geometry/CMSCommonData/data/materials.xml', - 'Geometry/CMSCommonData/data/rotations.xml', + 'Geometry/CMSCommonData/data/rotations.xml', 'Geometry/CMSCommonData/data/cmsextent/2018/v1/cmsextent.xml', - 'Geometry/CMSCommonData/data/cms/2017/v1/cms.xml', - 'Geometry/CMSCommonData/data/beampipe/2017/v1/beampipe.xml', - 'Geometry/CMSCommonData/data/cmsBeam.xml', - 'Geometry/CMSCommonData/data/cmsMother.xml', - 'Geometry/CMSCommonData/data/mgnt.xml', - 'Geometry/ForwardCommonData/data/forward.xml', - 'Geometry/ForwardCommonData/data/totemRotations.xml', - 'Geometry/ForwardCommonData/data/totemMaterials.xml', - 'Geometry/ForwardCommonData/data/totemt1.xml', - 'Geometry/ForwardCommonData/data/totemt2.xml', - 'Geometry/ForwardCommonData/data/ionpump.xml', + 'Geometry/CMSCommonData/data/cms/2017/v1/cms.xml', + 'Geometry/CMSCommonData/data/beampipe/2017/v1/beampipe.xml', + 'Geometry/CMSCommonData/data/cmsBeam.xml', + 'Geometry/CMSCommonData/data/cmsMother.xml', + 'Geometry/CMSCommonData/data/mgnt.xml', + 'Geometry/ForwardCommonData/data/forward.xml', + 'Geometry/ForwardCommonData/data/totemRotations.xml', + 'Geometry/ForwardCommonData/data/totemMaterials.xml', + 'Geometry/ForwardCommonData/data/totemt1.xml', + 'Geometry/ForwardCommonData/data/totemt2.xml', + 'Geometry/ForwardCommonData/data/ionpump.xml', 'Geometry/VeryForwardData/data/RP_Box.xml', 'Geometry/VeryForwardData/data/RP_Box/RP_Box_000.xml', 'Geometry/VeryForwardData/data/RP_Box/RP_Box_001.xml', @@ -77,7 +77,7 @@ 'Geometry/VeryForwardData/data/CTPPS_Stations_Assembly.xml', 'Geometry/VeryForwardData/data/CTPPS_Cuts_Per_Region.xml', 'Geometry/VeryForwardData/data/RP_Sensitive_Dets.xml' -) +) # diamond files ctppsDiamondGeomXMLFiles = cms.vstring( @@ -109,7 +109,7 @@ ctppsUFSDGeomXMLFiles = cms.vstring( 'Geometry/VeryForwardData/data/CTPPS_UFSD_Segments/CTPPS_UFSD_Pattern1.xml', 'Geometry/VeryForwardData/data/CTPPS_UFSD_Segments/CTPPS_UFSD_Pattern2_SegmentA.xml', - 'Geometry/VeryForwardData/data/CTPPS_UFSD_Segments/CTPPS_UFSD_Pattern2_SegmentB.xml', + 'Geometry/VeryForwardData/data/CTPPS_UFSD_Segments/CTPPS_UFSD_Pattern2_SegmentB.xml', 'Geometry/VeryForwardData/data/CTPPS_UFSD_Planes/CTPPS_UFSD_Plane4.xml', 'Geometry/VeryForwardData/data/CTPPS_UFSD_Parameters.xml', 'Geometry/VeryForwardData/data/CTPPS_UFSD_Sensitive_Dets_TimingHits.xml' @@ -136,6 +136,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", verbosity = cms.untracked.uint32(1), + legacyRun2 = cms.untracked.bool(True), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2018_cfi.py b/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2018_cfi.py index c1be84c4a9839..8084a490fec77 100644 --- a/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2018_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2018_cfi.py @@ -3,19 +3,19 @@ # common and strip files totemGeomXMLFiles = cms.vstring( 'Geometry/CMSCommonData/data/materials.xml', - 'Geometry/CMSCommonData/data/rotations.xml', + 'Geometry/CMSCommonData/data/rotations.xml', 'Geometry/CMSCommonData/data/cmsextent/2018/v1/cmsextent.xml', - 'Geometry/CMSCommonData/data/cms/2017/v1/cms.xml', - 'Geometry/CMSCommonData/data/beampipe/2017/v1/beampipe.xml', - 'Geometry/CMSCommonData/data/cmsBeam.xml', - 'Geometry/CMSCommonData/data/cmsMother.xml', - 'Geometry/CMSCommonData/data/mgnt.xml', - 'Geometry/ForwardCommonData/data/forward.xml', - 'Geometry/ForwardCommonData/data/totemRotations.xml', - 'Geometry/ForwardCommonData/data/totemMaterials.xml', - 'Geometry/ForwardCommonData/data/totemt1.xml', - 'Geometry/ForwardCommonData/data/totemt2.xml', - 'Geometry/ForwardCommonData/data/ionpump.xml', + 'Geometry/CMSCommonData/data/cms/2017/v1/cms.xml', + 'Geometry/CMSCommonData/data/beampipe/2017/v1/beampipe.xml', + 'Geometry/CMSCommonData/data/cmsBeam.xml', + 'Geometry/CMSCommonData/data/cmsMother.xml', + 'Geometry/CMSCommonData/data/mgnt.xml', + 'Geometry/ForwardCommonData/data/forward.xml', + 'Geometry/ForwardCommonData/data/totemRotations.xml', + 'Geometry/ForwardCommonData/data/totemMaterials.xml', + 'Geometry/ForwardCommonData/data/totemt1.xml', + 'Geometry/ForwardCommonData/data/totemt2.xml', + 'Geometry/ForwardCommonData/data/ionpump.xml', 'Geometry/VeryForwardData/data/RP_Box.xml', 'Geometry/VeryForwardData/data/RP_Box/RP_Box_000.xml', 'Geometry/VeryForwardData/data/RP_Box/RP_Box_001.xml', @@ -75,7 +75,7 @@ 'Geometry/VeryForwardData/data/CTPPS_Stations_Assembly.xml', 'Geometry/VeryForwardData/data/CTPPS_Cuts_Per_Region.xml', 'Geometry/VeryForwardData/data/RP_Sensitive_Dets.xml' -) +) # diamond files ctppsDiamondGeomXMLFiles = cms.vstring( @@ -108,7 +108,7 @@ ctppsUFSDGeomXMLFiles = cms.vstring( 'Geometry/VeryForwardData/data/CTPPS_UFSD_Segments/CTPPS_UFSD_Pattern1.xml', 'Geometry/VeryForwardData/data/CTPPS_UFSD_Segments/CTPPS_UFSD_Pattern2_SegmentA.xml', - 'Geometry/VeryForwardData/data/CTPPS_UFSD_Segments/CTPPS_UFSD_Pattern2_SegmentB.xml', + 'Geometry/VeryForwardData/data/CTPPS_UFSD_Segments/CTPPS_UFSD_Pattern2_SegmentB.xml', 'Geometry/VeryForwardData/data/CTPPS_UFSD_Planes/CTPPS_UFSD_Plane4.xml', 'Geometry/VeryForwardData/data/CTPPS_UFSD_Parameters.xml', 'Geometry/VeryForwardData/data/CTPPS_UFSD_Sensitive_Dets_TimingHits.xml' @@ -137,6 +137,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", verbosity = cms.untracked.uint32(1), + legacyRun2 = cms.untracked.bool(True), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py index 8449588967ed3..07c1ed339be2a 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py @@ -140,5 +140,6 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", verbosity = cms.untracked.uint32(1), + legacyRun2 = cms.untracked.bool(True), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py index 0946d1a71b8e0..467a59b1ec2d5 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py @@ -146,5 +146,6 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", verbosity = cms.untracked.uint32(1), + legacyRun2 = cms.untracked.bool(True), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc index cfaba0bdb9f7e..e03c005497269 100644 --- a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc +++ b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc @@ -79,7 +79,7 @@ class CTPPSGeometryESModule : public edm::ESProducer { static std::unique_ptr applyAlignments(const DetGeomDesc&, const CTPPSRPAlignmentCorrectionsData*); const unsigned int verbosity_; - const bool is2021_; + const bool legacyRun2_; edm::ESGetToken ddToken_; edm::ESGetToken dd4hepToken_; @@ -94,7 +94,7 @@ class CTPPSGeometryESModule : public edm::ESProducer { CTPPSGeometryESModule::CTPPSGeometryESModule(const edm::ParameterSet& iConfig) : verbosity_(iConfig.getUntrackedParameter("verbosity")), - is2021_(iConfig.getUntrackedParameter("is2021", false)), + legacyRun2_(iConfig.getUntrackedParameter("legacyRun2", false)), fromDD4hep_(iConfig.getUntrackedParameter("fromDD4hep", false)), gdRealTokens_{setWhatProduced(this, &CTPPSGeometryESModule::produceRealGD)}, gdMisTokens_{setWhatProduced(this, &CTPPSGeometryESModule::produceMisalignedGD)}, @@ -115,7 +115,7 @@ CTPPSGeometryESModule::CTPPSGeometryESModule(const edm::ParameterSet& iConfig) void CTPPSGeometryESModule::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.addUntracked("verbosity", 1); - desc.addUntracked("is2021", false); + desc.addUntracked("legacyRun2", false)->setDescription("Switch to legacy (2017-18) definition of diamond geometry"); desc.add("compactViewTag", std::string()); desc.addUntracked("fromDD4hep", false); descriptions.add("CTPPSGeometryESModule", desc); @@ -187,7 +187,7 @@ std::unique_ptr CTPPSGeometryESModule::produceIdealGD(const IdealGe auto const& myCompactView = iRecord.get(ddToken_); // Build geo from compact view. - return detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView, is2021_); + return detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView, legacyRun2_); } else { @@ -195,7 +195,7 @@ std::unique_ptr CTPPSGeometryESModule::produceIdealGD(const IdealGe auto const& myCompactView = iRecord.get(dd4hepToken_); // Build geo from compact view. - return detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView, is2021_); + return detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView, legacyRun2_); } } From ec4875e07f1ed2c3d08c1828bfd26617525e744b Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 16 Sep 2020 10:15:32 +0200 Subject: [PATCH 39/64] Introduced flag in eras for safety --- .../VeryForwardGeometry/python/geometryRPFromDB_cfi.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py index bfdf3d2a349bc..da04319d9ab20 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py @@ -10,3 +10,12 @@ verbosity = cms.untracked.uint32(1), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) + +from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 +ctpps_2016.toModify(ctppsGeometryESModule, legacyRun2=cms.untracked.bool(True)) + +from Configuration.Eras.Modifier_ctpps_2017_cff import ctpps_2017 +ctpps_2017.toModify(ctppsGeometryESModule, legacyRun2=cms.untracked.bool(True)) + +from Configuration.Eras.Modifier_ctpps_2018_cff import ctpps_2018 +ctpps_2018.toModify(ctppsGeometryESModule, legacyRun2=cms.untracked.bool(True)) From 09867cce6b2a87e99c7d348d57faf169d8bb7f8c Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 16 Sep 2020 10:20:01 +0200 Subject: [PATCH 40/64] Code-format/fixed comment method in ESModule PSet description filling --- .../VeryForwardGeometryBuilder/interface/DetGeomDescBuilder.h | 3 ++- .../plugins/CTPPSGeometryESModule.cc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDescBuilder.h b/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDescBuilder.h index aefab1763d9b2..da969154934b4 100644 --- a/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDescBuilder.h +++ b/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDescBuilder.h @@ -9,7 +9,8 @@ * Generic function to build geo (tree of DetGeomDesc) from compact view. */ namespace detgeomdescbuilder { - std::unique_ptr buildDetGeomDescFromCompactView(const DDCompactView& myCompactView, const bool legacyRun2); + std::unique_ptr buildDetGeomDescFromCompactView(const DDCompactView& myCompactView, + const bool legacyRun2); void buildDetGeomDescDescendants(DDFilteredView& fv, DetGeomDesc* geoInfoParent, const bool legacyRun2); std::unique_ptr buildDetGeomDescFromCompactView(const cms::DDCompactView& myCompactView, const bool legacyRun2); diff --git a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc index e03c005497269..925035ac50c9c 100644 --- a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc +++ b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc @@ -115,7 +115,7 @@ CTPPSGeometryESModule::CTPPSGeometryESModule(const edm::ParameterSet& iConfig) void CTPPSGeometryESModule::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.addUntracked("verbosity", 1); - desc.addUntracked("legacyRun2", false)->setDescription("Switch to legacy (2017-18) definition of diamond geometry"); + desc.addUntracked("legacyRun2", false)->setComment("Switch to legacy (2017-18) definition of diamond geometry"); desc.add("compactViewTag", std::string()); desc.addUntracked("fromDD4hep", false); descriptions.add("CTPPSGeometryESModule", desc); From f831c50f16e79d5ee176efa28f334494f0773725 Mon Sep 17 00:00:00 2001 From: Gabrielle Hugo Date: Wed, 16 Sep 2020 11:38:28 +0200 Subject: [PATCH 41/64] Replace use of !is2021 by isRun2. isRun2 is set to true by default (to avoid modifying existing workflows). --- .../Geometry/plugins/PPSGeometryBuilder.cc | 8 ++++---- .../interface/DetGeomDesc.h | 16 ++++++++++++---- .../interface/DetGeomDescBuilder.h | 7 +++---- .../plugins/CTPPSGeometryESModule.cc | 10 +++++----- .../src/DetGeomDesc.cc | 18 +++++++++--------- .../src/DetGeomDescBuilder.cc | 6 +++--- 6 files changed, 36 insertions(+), 29 deletions(-) diff --git a/CondTools/Geometry/plugins/PPSGeometryBuilder.cc b/CondTools/Geometry/plugins/PPSGeometryBuilder.cc index 860184af31451..af320fbdd1c5c 100644 --- a/CondTools/Geometry/plugins/PPSGeometryBuilder.cc +++ b/CondTools/Geometry/plugins/PPSGeometryBuilder.cc @@ -37,7 +37,7 @@ class PPSGeometryBuilder : public edm::one::EDAnalyzer<> { bool fromDD4hep_; std::string compactViewTag_; - bool legacyRun2_; + bool isRun2_; edm::ESGetToken ddToken_; edm::ESGetToken dd4hepToken_; edm::ESWatcher watcherIdealGeometry_; @@ -47,7 +47,7 @@ class PPSGeometryBuilder : public edm::one::EDAnalyzer<> { PPSGeometryBuilder::PPSGeometryBuilder(const edm::ParameterSet& iConfig) : fromDD4hep_(iConfig.getUntrackedParameter("fromDD4hep", false)), compactViewTag_(iConfig.getUntrackedParameter("compactViewTag", "XMLIdealGeometryESSource_CTPPS")), - legacyRun2_(iConfig.getUntrackedParameter("legacyRun2", false)), + isRun2_(iConfig.getUntrackedParameter("isRun2", false)), ddToken_(esConsumes(edm::ESInputTag("", compactViewTag_))), dd4hepToken_(esConsumes(edm::ESInputTag("", compactViewTag_))) {} @@ -65,7 +65,7 @@ void PPSGeometryBuilder::analyze(const edm::Event& iEvent, const edm::EventSetup auto const& myCompactView = iSetup.getData(ddToken_); // Build geometry - geoInfoRoot = detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView, legacyRun2_); + geoInfoRoot = detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView, isRun2_); } // DD4hep else { @@ -73,7 +73,7 @@ void PPSGeometryBuilder::analyze(const edm::Event& iEvent, const edm::EventSetup auto const& myCompactView = iSetup.getData(dd4hepToken_); // Build geometry - geoInfoRoot = detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView, legacyRun2_); + geoInfoRoot = detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView, isRun2_); } } diff --git a/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDesc.h b/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDesc.h index 4197bad36d64d..85671a52977da 100644 --- a/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDesc.h +++ b/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDesc.h @@ -54,11 +54,11 @@ class DetGeomDesc { using Translation = ROOT::Math::DisplacementVector3D>; // Constructor from old DD DDFilteredView - /// \param[in] legacyRun2 Switch between legacy run 2-like geometry and 2021 scenario - DetGeomDesc(const DDFilteredView& fv, const bool legacyRun2); + /// \param[in] isRun2 Switch between legacy run 2-like geometry and 2021+ scenarii + DetGeomDesc(const DDFilteredView& fv, const bool isRun2); // Constructor from DD4Hep DDFilteredView - /// \param[in] legacyRun2 Switch between legacy run 2-like geometry and 2021 scenario - DetGeomDesc(const cms::DDFilteredView& fv, const bool legacyRun2); + /// \param[in] isRun2 Switch between legacy run 2-like geometry and 2021+ scenarii + DetGeomDesc(const cms::DDFilteredView& fv, const bool isRun2); DetGeomDesc(const DetGeomDesc&); DetGeomDesc& operator=(const DetGeomDesc&); @@ -119,11 +119,19 @@ class DetGeomDesc { DetId computeDetID(const std::string& name, const std::vector& copyNos, const unsigned int copyNum, +<<<<<<< HEAD const bool legacyRun2) const; DetId computeDetIDFromDD4hep(const std::string& name, const std::vector& copyNos, const unsigned int copyNum, const bool legacyRun2) const; +======= + const bool isRun2) const; + DetId computeDetIDFromDD4hep(const std::string& name, + const std::vector& copyNos, + const unsigned int copyNum, + const bool isRun2) const; +>>>>>>> 2784baa47e5... Replace use of !is2021 by isRun2. isRun2 is set to true by default (to avoid modifying existing workflows). std::string computeSensorType(std::string_view name); std::string m_name; // with no namespace diff --git a/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDescBuilder.h b/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDescBuilder.h index da969154934b4..722d9cdcee1b5 100644 --- a/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDescBuilder.h +++ b/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDescBuilder.h @@ -9,11 +9,10 @@ * Generic function to build geo (tree of DetGeomDesc) from compact view. */ namespace detgeomdescbuilder { - std::unique_ptr buildDetGeomDescFromCompactView(const DDCompactView& myCompactView, - const bool legacyRun2); - void buildDetGeomDescDescendants(DDFilteredView& fv, DetGeomDesc* geoInfoParent, const bool legacyRun2); + std::unique_ptr buildDetGeomDescFromCompactView(const DDCompactView& myCompactView, const bool isRun2); + void buildDetGeomDescDescendants(DDFilteredView& fv, DetGeomDesc* geoInfoParent, const bool isRun2); std::unique_ptr buildDetGeomDescFromCompactView(const cms::DDCompactView& myCompactView, - const bool legacyRun2); + const bool isRun2); } // namespace detgeomdescbuilder #endif diff --git a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc index 925035ac50c9c..120dcdafb3540 100644 --- a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc +++ b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc @@ -79,7 +79,7 @@ class CTPPSGeometryESModule : public edm::ESProducer { static std::unique_ptr applyAlignments(const DetGeomDesc&, const CTPPSRPAlignmentCorrectionsData*); const unsigned int verbosity_; - const bool legacyRun2_; + const bool isRun2_; edm::ESGetToken ddToken_; edm::ESGetToken dd4hepToken_; @@ -94,7 +94,7 @@ class CTPPSGeometryESModule : public edm::ESProducer { CTPPSGeometryESModule::CTPPSGeometryESModule(const edm::ParameterSet& iConfig) : verbosity_(iConfig.getUntrackedParameter("verbosity")), - legacyRun2_(iConfig.getUntrackedParameter("legacyRun2", false)), + isRun2_(iConfig.getUntrackedParameter("isRun2", false)), fromDD4hep_(iConfig.getUntrackedParameter("fromDD4hep", false)), gdRealTokens_{setWhatProduced(this, &CTPPSGeometryESModule::produceRealGD)}, gdMisTokens_{setWhatProduced(this, &CTPPSGeometryESModule::produceMisalignedGD)}, @@ -115,7 +115,7 @@ CTPPSGeometryESModule::CTPPSGeometryESModule(const edm::ParameterSet& iConfig) void CTPPSGeometryESModule::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.addUntracked("verbosity", 1); - desc.addUntracked("legacyRun2", false)->setComment("Switch to legacy (2017-18) definition of diamond geometry"); + desc.addUntracked("isRun2", false)->setComment("Switch to legacy (2017-18) definition of diamond geometry"); desc.add("compactViewTag", std::string()); desc.addUntracked("fromDD4hep", false); descriptions.add("CTPPSGeometryESModule", desc); @@ -187,7 +187,7 @@ std::unique_ptr CTPPSGeometryESModule::produceIdealGD(const IdealGe auto const& myCompactView = iRecord.get(ddToken_); // Build geo from compact view. - return detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView, legacyRun2_); + return detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView, isRun2_); } else { @@ -195,7 +195,7 @@ std::unique_ptr CTPPSGeometryESModule::produceIdealGD(const IdealGe auto const& myCompactView = iRecord.get(dd4hepToken_); // Build geo from compact view. - return detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView, legacyRun2_); + return detgeomdescbuilder::buildDetGeomDescFromCompactView(myCompactView, isRun2_); } } diff --git a/Geometry/VeryForwardGeometryBuilder/src/DetGeomDesc.cc b/Geometry/VeryForwardGeometryBuilder/src/DetGeomDesc.cc index bd2d542eb143a..d2afb5c8b178d 100644 --- a/Geometry/VeryForwardGeometryBuilder/src/DetGeomDesc.cc +++ b/Geometry/VeryForwardGeometryBuilder/src/DetGeomDesc.cc @@ -27,7 +27,7 @@ /* * Constructor from old DD DDFilteredView, also using the SpecPars to access 2x2 wafers info. */ -DetGeomDesc::DetGeomDesc(const DDFilteredView& fv, const bool legacyRun2) +DetGeomDesc::DetGeomDesc(const DDFilteredView& fv, const bool isRun2) : m_name(computeNameWithNoNamespace(fv.name())), m_copy(fv.copyno()), m_isDD4hep(false), @@ -37,14 +37,14 @@ DetGeomDesc::DetGeomDesc(const DDFilteredView& fv, const bool legacyRun2) m_isABox(fv.shape() == DDSolidShape::ddbox), m_diamondBoxParams(computeDiamondDimensions(m_isABox, m_isDD4hep, m_params)), // mm (legacy) m_sensorType(computeSensorType(fv.logicalPart().name().fullname())), - m_geographicalID(computeDetID(m_name, fv.copyNumbers(), fv.copyno(), legacyRun2)), + m_geographicalID(computeDetID(m_name, fv.copyNumbers(), fv.copyno(), isRun2)), m_z(fv.translation().z()) // mm (legacy) {} /* * Constructor from DD4Hep DDFilteredView, also using the SpecPars to access 2x2 wafers info. */ -DetGeomDesc::DetGeomDesc(const cms::DDFilteredView& fv, const bool legacyRun2) +DetGeomDesc::DetGeomDesc(const cms::DDFilteredView& fv, const bool isRun2) : m_name(computeNameWithNoNamespace(fv.name())), m_copy(fv.copyNum()), m_isDD4hep(true), @@ -54,7 +54,7 @@ DetGeomDesc::DetGeomDesc(const cms::DDFilteredView& fv, const bool legacyRun2) m_isABox(dd4hep::isA(fv.solid())), m_diamondBoxParams(computeDiamondDimensions(m_isABox, m_isDD4hep, m_params)), // converted from cm (DD4hep) to mm m_sensorType(computeSensorType(fv.name())), - m_geographicalID(computeDetIDFromDD4hep(m_name, fv.copyNos(), fv.copyNum(), legacyRun2)), + m_geographicalID(computeDetIDFromDD4hep(m_name, fv.copyNos(), fv.copyNum(), isRun2)), m_z(geant_units::operators::convertCmToMm(fv.translation().z())) // converted from cm (DD4hep) to mm {} @@ -168,7 +168,7 @@ DiamondDimensions DetGeomDesc::computeDiamondDimensions(const bool isABox, DetId DetGeomDesc::computeDetID(const std::string& name, const std::vector& copyNos, const unsigned int copyNum, - const bool legacyRun2) const { + const bool isRun2) const { DetId geoID; // strip sensors @@ -247,7 +247,7 @@ DetId DetGeomDesc::computeDetID(const std::string& name, << "size of copyNumbers for diamond segments is " << copyNos.size() << ". It must be >= 2."; const unsigned int decRPId = copyNos[1]; unsigned int arm, station, rp; - if (legacyRun2) { + if (isRun2) { arm = decRPId - 1; station = 1; rp = 6; @@ -271,7 +271,7 @@ DetId DetGeomDesc::computeDetID(const std::string& name, const unsigned int decRPId = copyNos[1]; unsigned int arm, station, rp; - if (legacyRun2) { + if (isRun2) { arm = decRPId - 1; station = 1; rp = 6; @@ -292,10 +292,10 @@ DetId DetGeomDesc::computeDetID(const std::string& name, DetId DetGeomDesc::computeDetIDFromDD4hep(const std::string& name, const std::vector& copyNos, const unsigned int copyNum, - const bool legacyRun2) const { + const bool isRun2) const { std::vector copyNosOldDD = {copyNos.rbegin() + 1, copyNos.rend()}; - return computeDetID(name, copyNosOldDD, copyNum, legacyRun2); + return computeDetID(name, copyNosOldDD, copyNum, isRun2); } /* diff --git a/Geometry/VeryForwardGeometryBuilder/src/DetGeomDescBuilder.cc b/Geometry/VeryForwardGeometryBuilder/src/DetGeomDescBuilder.cc index ac8b052b3149f..06c0771bd32ca 100644 --- a/Geometry/VeryForwardGeometryBuilder/src/DetGeomDescBuilder.cc +++ b/Geometry/VeryForwardGeometryBuilder/src/DetGeomDescBuilder.cc @@ -48,7 +48,7 @@ void detgeomdescbuilder::buildDetGeomDescDescendants(DDFilteredView& fv, DetGeom * Generic function to build geo (tree of DetGeomDesc) from DD4hep compact view. */ std::unique_ptr detgeomdescbuilder::buildDetGeomDescFromCompactView( - const cms::DDCompactView& myCompactView, const bool legacyRun2) { + const cms::DDCompactView& myCompactView, const bool isRun2) { // create DDFilteredView (no filter!!) const cms::DDDetector* mySystem = myCompactView.detector(); const dd4hep::Volume& worldVolume = mySystem->worldVolume(); @@ -58,12 +58,12 @@ std::unique_ptr detgeomdescbuilder::buildDetGeomDescFromCompactView } // Geo info: root node. - auto geoInfoRoot = std::make_unique(fv, legacyRun2); + auto geoInfoRoot = std::make_unique(fv, isRun2); // Construct the tree of children geo info (DetGeomDesc). do { // Create node, and add it to the geoInfoRoot's list. - DetGeomDesc* child = new DetGeomDesc(fv, legacyRun2); + DetGeomDesc* child = new DetGeomDesc(fv, isRun2); geoInfoRoot->addComponent(child); } while (fv.next(0)); From c302e5badfbf7ab78ba8f72b8562c653723f0790 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 16 Sep 2020 12:00:21 +0200 Subject: [PATCH 42/64] Replaced all remaining legacyRun2 mentions --- .../dd4hep/geometryPPS_CMSxz_fromDD_2016_cfi.py | 1 + .../dd4hep/geometryPPS_CMSxz_fromDD_2017_cfi.py | 1 + .../dd4hep/geometryPPS_CMSxz_fromDD_2018_cfi.py | 1 + .../python/dd4hep/geometryRPFromDD_2017_cfi.py | 2 +- .../python/dd4hep/geometryRPFromDD_2018_cfi.py | 2 +- .../python/geometryPPS_CMSxz_fromDD_2016_cfi.py | 2 +- .../python/geometryPPS_CMSxz_fromDD_2017_cfi.py | 2 +- .../python/geometryPPS_CMSxz_fromDD_2018_cfi.py | 2 +- .../python/geometryRPFromDB_cfi.py | 6 +++--- .../python/geometryRPFromDD_2017_cfi.py | 2 +- .../python/geometryRPFromDD_2018_cfi.py | 2 +- .../interface/DetGeomDesc.h | 8 -------- .../src/DetGeomDescBuilder.cc | 12 ++++++------ 13 files changed, 19 insertions(+), 24 deletions(-) diff --git a/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2016_cfi.py b/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2016_cfi.py index 5c178c0372f14..98682d391bd45 100644 --- a/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2016_cfi.py +++ b/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2016_cfi.py @@ -11,6 +11,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", fromDD4hep = cms.untracked.bool(True), + isRun2 = cms.untracked.bool(True), verbosity = cms.untracked.uint32(1), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2017_cfi.py b/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2017_cfi.py index 0012898c432bd..f62e5c407305d 100644 --- a/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2017_cfi.py +++ b/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2017_cfi.py @@ -11,6 +11,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", fromDD4hep = cms.untracked.bool(True), + isRun2 = cms.untracked.bool(True), verbosity = cms.untracked.uint32(1), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2018_cfi.py b/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2018_cfi.py index f3fffae290864..299843d599b88 100644 --- a/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2018_cfi.py +++ b/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2018_cfi.py @@ -11,6 +11,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", fromDD4hep = cms.untracked.bool(True), + isRun2 = cms.untracked.bool(True), verbosity = cms.untracked.uint32(1), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2017_cfi.py b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2017_cfi.py index 41637e7a3c085..ff781ad2f403e 100644 --- a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2017_cfi.py +++ b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2017_cfi.py @@ -11,7 +11,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", fromDD4hep = cms.untracked.bool(True), - legacyRun2 = cms.untracked.bool(True), + isRun2 = cms.untracked.bool(True), verbosity = cms.untracked.uint32(1), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2018_cfi.py b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2018_cfi.py index 84a7d54ee41ec..bfb2412d31b51 100644 --- a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2018_cfi.py +++ b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2018_cfi.py @@ -11,7 +11,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", fromDD4hep = cms.untracked.bool(True), - legacyRun2 = cms.untracked.bool(True), + isRun2 = cms.untracked.bool(True), verbosity = cms.untracked.uint32(1), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2016_cfi.py b/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2016_cfi.py index de99986173f5c..cba809db6f21e 100644 --- a/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2016_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2016_cfi.py @@ -136,7 +136,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", verbosity = cms.untracked.uint32(1), - legacyRun2 = cms.untracked.bool(True), + isRun2 = cms.untracked.bool(True), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2017_cfi.py b/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2017_cfi.py index c692b973ce642..2ee0f297428ca 100644 --- a/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2017_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2017_cfi.py @@ -136,7 +136,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", verbosity = cms.untracked.uint32(1), - legacyRun2 = cms.untracked.bool(True), + isRun2 = cms.untracked.bool(True), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2018_cfi.py b/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2018_cfi.py index 8084a490fec77..166ff41ca7c43 100644 --- a/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2018_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2018_cfi.py @@ -137,7 +137,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", verbosity = cms.untracked.uint32(1), - legacyRun2 = cms.untracked.bool(True), + isRun2 = cms.untracked.bool(True), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py index da04319d9ab20..c190f3683b6d8 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py @@ -12,10 +12,10 @@ ) from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 -ctpps_2016.toModify(ctppsGeometryESModule, legacyRun2=cms.untracked.bool(True)) +ctpps_2016.toModify(ctppsGeometryESModule, isRun2=cms.untracked.bool(True)) from Configuration.Eras.Modifier_ctpps_2017_cff import ctpps_2017 -ctpps_2017.toModify(ctppsGeometryESModule, legacyRun2=cms.untracked.bool(True)) +ctpps_2017.toModify(ctppsGeometryESModule, isRun2=cms.untracked.bool(True)) from Configuration.Eras.Modifier_ctpps_2018_cff import ctpps_2018 -ctpps_2018.toModify(ctppsGeometryESModule, legacyRun2=cms.untracked.bool(True)) +ctpps_2018.toModify(ctppsGeometryESModule, isRun2=cms.untracked.bool(True)) diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py index 07c1ed339be2a..fa3b86594c483 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py @@ -140,6 +140,6 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", verbosity = cms.untracked.uint32(1), - legacyRun2 = cms.untracked.bool(True), + isRun2 = cms.untracked.bool(True), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py index 467a59b1ec2d5..f36be8f637aeb 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py @@ -146,6 +146,6 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", verbosity = cms.untracked.uint32(1), - legacyRun2 = cms.untracked.bool(True), + isRun2 = cms.untracked.bool(True), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDesc.h b/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDesc.h index 85671a52977da..ed4fe42131f8b 100644 --- a/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDesc.h +++ b/Geometry/VeryForwardGeometryBuilder/interface/DetGeomDesc.h @@ -119,19 +119,11 @@ class DetGeomDesc { DetId computeDetID(const std::string& name, const std::vector& copyNos, const unsigned int copyNum, -<<<<<<< HEAD - const bool legacyRun2) const; - DetId computeDetIDFromDD4hep(const std::string& name, - const std::vector& copyNos, - const unsigned int copyNum, - const bool legacyRun2) const; -======= const bool isRun2) const; DetId computeDetIDFromDD4hep(const std::string& name, const std::vector& copyNos, const unsigned int copyNum, const bool isRun2) const; ->>>>>>> 2784baa47e5... Replace use of !is2021 by isRun2. isRun2 is set to true by default (to avoid modifying existing workflows). std::string computeSensorType(std::string_view name); std::string m_name; // with no namespace diff --git a/Geometry/VeryForwardGeometryBuilder/src/DetGeomDescBuilder.cc b/Geometry/VeryForwardGeometryBuilder/src/DetGeomDescBuilder.cc index 06c0771bd32ca..1bbe604204591 100644 --- a/Geometry/VeryForwardGeometryBuilder/src/DetGeomDescBuilder.cc +++ b/Geometry/VeryForwardGeometryBuilder/src/DetGeomDescBuilder.cc @@ -7,16 +7,16 @@ * Generic function to build geo (tree of DetGeomDesc) from old DD compact view. */ std::unique_ptr detgeomdescbuilder::buildDetGeomDescFromCompactView(const DDCompactView& myCompactView, - const bool legacyRun2) { + const bool isRun2) { // Create DDFilteredView (no filter!!) DDPassAllFilter filter; DDFilteredView fv(myCompactView, filter); // Geo info: root node. - auto geoInfoRoot = std::make_unique(fv, legacyRun2); + auto geoInfoRoot = std::make_unique(fv, isRun2); // Construct the tree of children geo info (DetGeomDesc). - detgeomdescbuilder::buildDetGeomDescDescendants(fv, geoInfoRoot.get(), legacyRun2); + detgeomdescbuilder::buildDetGeomDescDescendants(fv, geoInfoRoot.get(), isRun2); edm::LogInfo("PPSGeometryESProducer") << "Successfully built geometry."; @@ -27,18 +27,18 @@ std::unique_ptr detgeomdescbuilder::buildDetGeomDescFromCompactView * Depth-first search recursion. * Construct the tree of children geo info (DetGeomDesc) (old DD). */ -void detgeomdescbuilder::buildDetGeomDescDescendants(DDFilteredView& fv, DetGeomDesc* geoInfo, const bool legacyRun2) { +void detgeomdescbuilder::buildDetGeomDescDescendants(DDFilteredView& fv, DetGeomDesc* geoInfo, const bool isRun2) { // Leaf if (!fv.firstChild()) return; do { // Create node, and add it to the geoInfoParent's list. - DetGeomDesc* child = new DetGeomDesc(fv, legacyRun2); + DetGeomDesc* child = new DetGeomDesc(fv, isRun2); geoInfo->addComponent(child); // Recursion - buildDetGeomDescDescendants(fv, child, legacyRun2); + buildDetGeomDescDescendants(fv, child, isRun2); } while (fv.nextSibling()); fv.parent(); From 5936844f8a1e4584cf299f02d3b3517ddc278c1e Mon Sep 17 00:00:00 2001 From: Gabrielle Hugo Date: Wed, 16 Sep 2020 13:40:23 +0200 Subject: [PATCH 43/64] Also change variable name in function + safer to also treat DB writer. --- CondTools/Geometry/test/ppsgeometrywriter_DD4hep.py | 3 ++- CondTools/Geometry/test/ppsgeometrywriter_oldDD.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CondTools/Geometry/test/ppsgeometrywriter_DD4hep.py b/CondTools/Geometry/test/ppsgeometrywriter_DD4hep.py index df831b9fd83a9..7b9ffed69ca48 100644 --- a/CondTools/Geometry/test/ppsgeometrywriter_DD4hep.py +++ b/CondTools/Geometry/test/ppsgeometrywriter_DD4hep.py @@ -37,11 +37,12 @@ ) # geometry -process.load("Geometry.VeryForwardGeometry.dd4hep.geometryRPFromDD_2018_cfi") +process.load("Geometry.VeryForwardGeometry.dd4hep.geometryRPFromDD_2021_cfi") # DB writer process.ppsGeometryBuilder = cms.EDAnalyzer("PPSGeometryBuilder", fromDD4hep = cms.untracked.bool(True), + isRun2 = cms.untracked.bool(False), compactViewTag = cms.untracked.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/CondTools/Geometry/test/ppsgeometrywriter_oldDD.py b/CondTools/Geometry/test/ppsgeometrywriter_oldDD.py index 227850425e807..7a2428dedd4e9 100644 --- a/CondTools/Geometry/test/ppsgeometrywriter_oldDD.py +++ b/CondTools/Geometry/test/ppsgeometrywriter_oldDD.py @@ -37,10 +37,11 @@ ) # geometry -process.load("Geometry.VeryForwardGeometry.geometryRPFromDD_2018_cfi") +process.load("Geometry.VeryForwardGeometry.geometryRPFromDD_2021_cfi") # DB writer process.ppsGeometryBuilder = cms.EDAnalyzer("PPSGeometryBuilder", + isRun2 = cms.untracked.bool(False), compactViewTag = cms.untracked.string('XMLIdealGeometryESSource_CTPPS') ) From eef4883f1edcb90554a7944569b655ee41eac203 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Sun, 15 Nov 2020 10:10:59 +0100 Subject: [PATCH 44/64] Clearing the algorithm before filling the event --- RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc b/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc index 97173eb815938..7817d0d60ae8e 100644 --- a/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc +++ b/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc @@ -59,6 +59,8 @@ void CTPPSDiamondLocalTrackFitter::produce(edm::Event& iEvent, const edm::EventS // if algorithm is not found, build it if (trk_algo_.count(detid) == 0) trk_algo_[detid] = std::make_unique(trk_algo_params_); + // clear all hits possibly inherited from previous event + trk_algo_[detid]->clear(); for (const auto& hit : vec) // skip hits without a leading edge if (hit.ootIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING) @@ -69,8 +71,6 @@ void CTPPSDiamondLocalTrackFitter::produce(edm::Event& iEvent, const edm::EventS auto& tracks = pOut->find_or_insert(algo_vs_id.first); // build the tracks for all stations algo_vs_id.second->produceTracks(tracks); - // clear all hits to prepare for the next event - algo_vs_id.second->clear(); } iEvent.put(std::move(pOut)); From be5411216ca34cd4e3ac7f8e7ee5de2271770d4e Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Mon, 16 Nov 2020 01:57:37 +0100 Subject: [PATCH 45/64] Only clearing algorithms once at new event --- RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc b/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc index 7817d0d60ae8e..d9c3af54d031d 100644 --- a/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc +++ b/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc @@ -53,23 +53,25 @@ void CTPPSDiamondLocalTrackFitter::produce(edm::Event& iEvent, const edm::EventS edm::Handle > recHits; iEvent.getByToken(recHitsToken_, recHits); + // clear all hits possibly inherited from previous event + for (auto& algo_vs_id : trk_algo_) + algo_vs_id.second->clear(); + // feed hits to the track producers for (const auto& vec : *recHits) { const CTPPSDiamondDetId raw_detid(vec.detId()), detid(raw_detid.arm(), raw_detid.station(), raw_detid.rp()); // if algorithm is not found, build it if (trk_algo_.count(detid) == 0) trk_algo_[detid] = std::make_unique(trk_algo_params_); - // clear all hits possibly inherited from previous event - trk_algo_[detid]->clear(); for (const auto& hit : vec) // skip hits without a leading edge if (hit.ootIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING) trk_algo_[detid]->addHit(hit); } + // build the tracks for all stations for (auto& algo_vs_id : trk_algo_) { auto& tracks = pOut->find_or_insert(algo_vs_id.first); - // build the tracks for all stations algo_vs_id.second->produceTracks(tracks); } From 6d265f40146de7d892878065dda5f725b2178c14 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 17 Nov 2020 22:00:51 +0100 Subject: [PATCH 46/64] Run2 tag now tracked --- .../plugins/CTPPSGeometryESModule.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc index 007f52f7f3fd1..f4c3a1b838f75 100644 --- a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc +++ b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc @@ -94,7 +94,7 @@ class CTPPSGeometryESModule : public edm::ESProducer { CTPPSGeometryESModule::CTPPSGeometryESModule(const edm::ParameterSet& iConfig) : verbosity_(iConfig.getUntrackedParameter("verbosity")), - isRun2_(iConfig.getUntrackedParameter("isRun2", false)), + isRun2_(iConfig.getParameter("isRun2")), fromDD4hep_(iConfig.getUntrackedParameter("fromDD4hep", false)), gdRealTokens_{setWhatProduced(this, &CTPPSGeometryESModule::produceRealGD)}, gdMisTokens_{setWhatProduced(this, &CTPPSGeometryESModule::produceMisalignedGD)}, @@ -115,7 +115,7 @@ CTPPSGeometryESModule::CTPPSGeometryESModule(const edm::ParameterSet& iConfig) void CTPPSGeometryESModule::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.addUntracked("verbosity", 1); - desc.addUntracked("isRun2", false)->setComment("Switch to legacy (2017-18) definition of diamond geometry"); + desc.add("isRun2", false)->setComment("Switch to legacy (2017-18) definition of diamond geometry"); desc.add("compactViewTag", std::string()); desc.addUntracked("fromDD4hep", false); descriptions.add("CTPPSGeometryESModule", desc); From acf10f379933f33d6b428ce7759b80f75f35bc9b Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 17 Nov 2020 22:13:25 +0100 Subject: [PATCH 47/64] Updated versioning through xml file hierarchy --- .../data/dd4hep/{ => v1}/geometryRPFromDD_2021.xml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Geometry/VeryForwardGeometry/data/dd4hep/{ => v1}/geometryRPFromDD_2021.xml (100%) diff --git a/Geometry/VeryForwardGeometry/data/dd4hep/geometryRPFromDD_2021.xml b/Geometry/VeryForwardGeometry/data/dd4hep/v1/geometryRPFromDD_2021.xml similarity index 100% rename from Geometry/VeryForwardGeometry/data/dd4hep/geometryRPFromDD_2021.xml rename to Geometry/VeryForwardGeometry/data/dd4hep/v1/geometryRPFromDD_2021.xml From 7f7b1fd6f4b297db288bcef9879aba1f7e7fc46c Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 17 Nov 2020 22:14:29 +0100 Subject: [PATCH 48/64] Matched python file to new 2021 scenario file path --- .../python/dd4hep/geometryRPFromDD_2021_cfi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py index 932fc960c6b49..762264cde5e10 100644 --- a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py +++ b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms DDDetectorESProducer = cms.ESSource("DDDetectorESProducer", - confGeomXMLFiles = cms.FileInPath('Geometry/VeryForwardGeometry/data/dd4hep/geometryRPFromDD_2021.xml'), + confGeomXMLFiles = cms.FileInPath('Geometry/VeryForwardGeometry/data/dd4hep/v1/geometryRPFromDD_2021.xml'), appendToDataLabel = cms.string('XMLIdealGeometryESSource_CTPPS') ) From ff042c80af32ec1e227d8366032e242228b28e31 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 18 Nov 2020 00:13:33 +0100 Subject: [PATCH 49/64] Forgot a few untracked here and there --- CondTools/Geometry/plugins/PPSGeometryBuilder.cc | 2 +- CondTools/Geometry/test/ppsgeometrywriter_DD4hep.py | 2 +- CondTools/Geometry/test/ppsgeometrywriter_oldDD.py | 2 +- .../python/dd4hep/geometryPPS_CMSxz_fromDD_2016_cfi.py | 2 +- .../python/dd4hep/geometryPPS_CMSxz_fromDD_2017_cfi.py | 2 +- .../python/dd4hep/geometryPPS_CMSxz_fromDD_2018_cfi.py | 2 +- .../python/dd4hep/geometryRPFromDD_2017_cfi.py | 2 +- .../python/dd4hep/geometryRPFromDD_2018_cfi.py | 2 +- .../python/geometryPPS_CMSxz_fromDD_2016_cfi.py | 2 +- .../python/geometryPPS_CMSxz_fromDD_2017_cfi.py | 2 +- .../python/geometryPPS_CMSxz_fromDD_2018_cfi.py | 2 +- Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py | 6 +++--- .../VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py | 2 +- .../VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py | 2 +- 14 files changed, 16 insertions(+), 16 deletions(-) diff --git a/CondTools/Geometry/plugins/PPSGeometryBuilder.cc b/CondTools/Geometry/plugins/PPSGeometryBuilder.cc index af320fbdd1c5c..acd3ce9a93d9d 100644 --- a/CondTools/Geometry/plugins/PPSGeometryBuilder.cc +++ b/CondTools/Geometry/plugins/PPSGeometryBuilder.cc @@ -47,7 +47,7 @@ class PPSGeometryBuilder : public edm::one::EDAnalyzer<> { PPSGeometryBuilder::PPSGeometryBuilder(const edm::ParameterSet& iConfig) : fromDD4hep_(iConfig.getUntrackedParameter("fromDD4hep", false)), compactViewTag_(iConfig.getUntrackedParameter("compactViewTag", "XMLIdealGeometryESSource_CTPPS")), - isRun2_(iConfig.getUntrackedParameter("isRun2", false)), + isRun2_(iConfig.getParameter("isRun2")), ddToken_(esConsumes(edm::ESInputTag("", compactViewTag_))), dd4hepToken_(esConsumes(edm::ESInputTag("", compactViewTag_))) {} diff --git a/CondTools/Geometry/test/ppsgeometrywriter_DD4hep.py b/CondTools/Geometry/test/ppsgeometrywriter_DD4hep.py index 7b9ffed69ca48..faeab38098f3d 100644 --- a/CondTools/Geometry/test/ppsgeometrywriter_DD4hep.py +++ b/CondTools/Geometry/test/ppsgeometrywriter_DD4hep.py @@ -42,7 +42,7 @@ # DB writer process.ppsGeometryBuilder = cms.EDAnalyzer("PPSGeometryBuilder", fromDD4hep = cms.untracked.bool(True), - isRun2 = cms.untracked.bool(False), + isRun2 = cms.bool(False), compactViewTag = cms.untracked.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/CondTools/Geometry/test/ppsgeometrywriter_oldDD.py b/CondTools/Geometry/test/ppsgeometrywriter_oldDD.py index 7a2428dedd4e9..ee7b06ec8dd6f 100644 --- a/CondTools/Geometry/test/ppsgeometrywriter_oldDD.py +++ b/CondTools/Geometry/test/ppsgeometrywriter_oldDD.py @@ -41,7 +41,7 @@ # DB writer process.ppsGeometryBuilder = cms.EDAnalyzer("PPSGeometryBuilder", - isRun2 = cms.untracked.bool(False), + isRun2 = cms.bool(False), compactViewTag = cms.untracked.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2016_cfi.py b/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2016_cfi.py index 98682d391bd45..c30b091f9ee01 100644 --- a/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2016_cfi.py +++ b/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2016_cfi.py @@ -11,7 +11,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", fromDD4hep = cms.untracked.bool(True), - isRun2 = cms.untracked.bool(True), + isRun2 = cms.bool(True), verbosity = cms.untracked.uint32(1), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2017_cfi.py b/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2017_cfi.py index f62e5c407305d..bd384b8f3fc2a 100644 --- a/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2017_cfi.py +++ b/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2017_cfi.py @@ -11,7 +11,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", fromDD4hep = cms.untracked.bool(True), - isRun2 = cms.untracked.bool(True), + isRun2 = cms.bool(True), verbosity = cms.untracked.uint32(1), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2018_cfi.py b/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2018_cfi.py index 299843d599b88..0bae498d08288 100644 --- a/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2018_cfi.py +++ b/Geometry/VeryForwardGeometry/python/dd4hep/geometryPPS_CMSxz_fromDD_2018_cfi.py @@ -11,7 +11,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", fromDD4hep = cms.untracked.bool(True), - isRun2 = cms.untracked.bool(True), + isRun2 = cms.bool(True), verbosity = cms.untracked.uint32(1), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2017_cfi.py b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2017_cfi.py index ff781ad2f403e..44d9d32cb06c7 100644 --- a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2017_cfi.py +++ b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2017_cfi.py @@ -11,7 +11,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", fromDD4hep = cms.untracked.bool(True), - isRun2 = cms.untracked.bool(True), + isRun2 = cms.bool(True), verbosity = cms.untracked.uint32(1), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2018_cfi.py b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2018_cfi.py index bfb2412d31b51..a9488cc5ba5f4 100644 --- a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2018_cfi.py +++ b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2018_cfi.py @@ -11,7 +11,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", fromDD4hep = cms.untracked.bool(True), - isRun2 = cms.untracked.bool(True), + isRun2 = cms.bool(True), verbosity = cms.untracked.uint32(1), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2016_cfi.py b/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2016_cfi.py index cba809db6f21e..2191aad40930e 100644 --- a/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2016_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2016_cfi.py @@ -136,7 +136,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", verbosity = cms.untracked.uint32(1), - isRun2 = cms.untracked.bool(True), + isRun2 = cms.bool(True), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2017_cfi.py b/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2017_cfi.py index 2ee0f297428ca..7f7a5309a0a28 100644 --- a/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2017_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2017_cfi.py @@ -136,7 +136,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", verbosity = cms.untracked.uint32(1), - isRun2 = cms.untracked.bool(True), + isRun2 = cms.bool(True), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2018_cfi.py b/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2018_cfi.py index 166ff41ca7c43..340305d0347d4 100644 --- a/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2018_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryPPS_CMSxz_fromDD_2018_cfi.py @@ -137,7 +137,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", verbosity = cms.untracked.uint32(1), - isRun2 = cms.untracked.bool(True), + isRun2 = cms.bool(True), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py index c190f3683b6d8..77fb9e5398cf9 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py @@ -12,10 +12,10 @@ ) from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 -ctpps_2016.toModify(ctppsGeometryESModule, isRun2=cms.untracked.bool(True)) +ctpps_2016.toModify(ctppsGeometryESModule, isRun2=True) from Configuration.Eras.Modifier_ctpps_2017_cff import ctpps_2017 -ctpps_2017.toModify(ctppsGeometryESModule, isRun2=cms.untracked.bool(True)) +ctpps_2017.toModify(ctppsGeometryESModule, isRun2=True) from Configuration.Eras.Modifier_ctpps_2018_cff import ctpps_2018 -ctpps_2018.toModify(ctppsGeometryESModule, isRun2=cms.untracked.bool(True)) +ctpps_2018.toModify(ctppsGeometryESModule, isRun2=True) diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py index fa3b86594c483..052adda8a3060 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2017_cfi.py @@ -140,6 +140,6 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", verbosity = cms.untracked.uint32(1), - isRun2 = cms.untracked.bool(True), + isRun2 = cms.bool(True), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py index f36be8f637aeb..2fb469b405b95 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py @@ -146,6 +146,6 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", verbosity = cms.untracked.uint32(1), - isRun2 = cms.untracked.bool(True), + isRun2 = cms.bool(True), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) From dad504115a5af75dc31571d6bc4e4aef1392c2b5 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 18 Nov 2020 03:18:07 +0100 Subject: [PATCH 50/64] Reverted isRun2 keyword to untracked for CondTool utolitary as it does not contain a fillDescriptions static member --- CondTools/Geometry/plugins/PPSGeometryBuilder.cc | 2 +- CondTools/Geometry/test/ppsgeometrywriter_DD4hep.py | 2 +- CondTools/Geometry/test/ppsgeometrywriter_oldDD.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CondTools/Geometry/plugins/PPSGeometryBuilder.cc b/CondTools/Geometry/plugins/PPSGeometryBuilder.cc index acd3ce9a93d9d..af320fbdd1c5c 100644 --- a/CondTools/Geometry/plugins/PPSGeometryBuilder.cc +++ b/CondTools/Geometry/plugins/PPSGeometryBuilder.cc @@ -47,7 +47,7 @@ class PPSGeometryBuilder : public edm::one::EDAnalyzer<> { PPSGeometryBuilder::PPSGeometryBuilder(const edm::ParameterSet& iConfig) : fromDD4hep_(iConfig.getUntrackedParameter("fromDD4hep", false)), compactViewTag_(iConfig.getUntrackedParameter("compactViewTag", "XMLIdealGeometryESSource_CTPPS")), - isRun2_(iConfig.getParameter("isRun2")), + isRun2_(iConfig.getUntrackedParameter("isRun2", false)), ddToken_(esConsumes(edm::ESInputTag("", compactViewTag_))), dd4hepToken_(esConsumes(edm::ESInputTag("", compactViewTag_))) {} diff --git a/CondTools/Geometry/test/ppsgeometrywriter_DD4hep.py b/CondTools/Geometry/test/ppsgeometrywriter_DD4hep.py index faeab38098f3d..a44763ee7bd69 100644 --- a/CondTools/Geometry/test/ppsgeometrywriter_DD4hep.py +++ b/CondTools/Geometry/test/ppsgeometrywriter_DD4hep.py @@ -42,7 +42,7 @@ # DB writer process.ppsGeometryBuilder = cms.EDAnalyzer("PPSGeometryBuilder", fromDD4hep = cms.untracked.bool(True), - isRun2 = cms.bool(False), + isRun2 = cms.untracked.bool(True), compactViewTag = cms.untracked.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/CondTools/Geometry/test/ppsgeometrywriter_oldDD.py b/CondTools/Geometry/test/ppsgeometrywriter_oldDD.py index ee7b06ec8dd6f..0396e7b9b2bff 100644 --- a/CondTools/Geometry/test/ppsgeometrywriter_oldDD.py +++ b/CondTools/Geometry/test/ppsgeometrywriter_oldDD.py @@ -41,7 +41,7 @@ # DB writer process.ppsGeometryBuilder = cms.EDAnalyzer("PPSGeometryBuilder", - isRun2 = cms.bool(False), + isRun2 = cms.untracked.bool(True), compactViewTag = cms.untracked.string('XMLIdealGeometryESSource_CTPPS') ) From 9b5a389cd3c5d23ab0e70a555cff2841b0cbab03 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 1 Dec 2020 13:17:41 +0100 Subject: [PATCH 51/64] Specifying the isRun2 flag in ctppsGeometryESModule base object definition --- .../VeryForwardGeometry/python/geometryRPFromDB_cfi.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py index 77fb9e5398cf9..adc38f223d6bd 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py @@ -8,14 +8,15 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", verbosity = cms.untracked.uint32(1), + isRun2 = cms.bool(False), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 -ctpps_2016.toModify(ctppsGeometryESModule, isRun2=True) +ctpps_2016.toModify(ctppsGeometryESModule, isRun2=cms.bool(True)) from Configuration.Eras.Modifier_ctpps_2017_cff import ctpps_2017 -ctpps_2017.toModify(ctppsGeometryESModule, isRun2=True) +ctpps_2017.toModify(ctppsGeometryESModule, isRun2=cms.bool(True)) from Configuration.Eras.Modifier_ctpps_2018_cff import ctpps_2018 -ctpps_2018.toModify(ctppsGeometryESModule, isRun2=True) +ctpps_2018.toModify(ctppsGeometryESModule, isRun2=cms.bool(True)) From 548dbb44dab042bad7e3449c055480bc56ee4e79 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 1 Dec 2020 13:23:53 +0100 Subject: [PATCH 52/64] Importing CTPPSGeometryESModule already defined from ESModule's fillDescriptions instead of redefining it --- Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py index adc38f223d6bd..db67f4c882e5e 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py @@ -1,4 +1,5 @@ import FWCore.ParameterSet.Config as cms +from Geometry.VeryForwardGeometryBuilder.CTPPSGeometryESModule_cfi import CTPPSGeometryESModule XMLIdealGeometryESSource_CTPPS = cms.ESProducer("XMLIdealGeometryESProducer", rootDDName = cms.string('cms:CMSE'), @@ -6,9 +7,7 @@ appendToDataLabel = cms.string('XMLIdealGeometryESSource_CTPPS') ) -ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", - verbosity = cms.untracked.uint32(1), - isRun2 = cms.bool(False), +ctppsGeometryESModule = CTPPSGeometryESModule.clone( compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) From cba52382f0b80f3ac46c69386c51ecb00184376f Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 1 Dec 2020 14:58:12 +0100 Subject: [PATCH 53/64] Small aesthetic changes --- .../VeryForwardGeometry/python/geometryRPFromDB_cfi.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py index db67f4c882e5e..dffe742630d6a 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py @@ -12,10 +12,7 @@ ) from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 -ctpps_2016.toModify(ctppsGeometryESModule, isRun2=cms.bool(True)) - from Configuration.Eras.Modifier_ctpps_2017_cff import ctpps_2017 -ctpps_2017.toModify(ctppsGeometryESModule, isRun2=cms.bool(True)) - from Configuration.Eras.Modifier_ctpps_2018_cff import ctpps_2018 -ctpps_2018.toModify(ctppsGeometryESModule, isRun2=cms.bool(True)) + +(ctpps_2016 | ctpps_2017 | ctpps_2018).toModify(ctppsGeometryESModule, isRun2=True) From 02dbab4cd08b7ee2943d6d077d0aa25dd0d971b4 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 1 Dec 2020 18:07:46 +0100 Subject: [PATCH 54/64] No spurious imports of ESProducer for the ctppsGeometryESModule definition --- .../python/geometryRPFromDB_cfi.py | 13 +++++++------ .../python/geometryRPFromDD_2021_cfi.py | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py index dffe742630d6a..92ce25ed2e492 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py @@ -1,13 +1,14 @@ import FWCore.ParameterSet.Config as cms -from Geometry.VeryForwardGeometryBuilder.CTPPSGeometryESModule_cfi import CTPPSGeometryESModule XMLIdealGeometryESSource_CTPPS = cms.ESProducer("XMLIdealGeometryESProducer", - rootDDName = cms.string('cms:CMSE'), - label = cms.string('CTPPS'), - appendToDataLabel = cms.string('XMLIdealGeometryESSource_CTPPS') - ) + rootDDName = cms.string('cms:CMSE'), + label = cms.string('CTPPS'), + appendToDataLabel = cms.string('XMLIdealGeometryESSource_CTPPS') +) -ctppsGeometryESModule = CTPPSGeometryESModule.clone( +ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", + verbosity = cms.untracked.uint32(1), + isRun2 = False, compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py index f0ab5f25f1cb0..9e5eabaf0d272 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py @@ -148,5 +148,6 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", verbosity = cms.untracked.uint32(1), + isRun2 = False, compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) From 497ac85204102fe68bd3fda34e7659058cca3715 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 1 Dec 2020 18:25:05 +0100 Subject: [PATCH 55/64] Forgot one isRun2 for dd4hep configuration --- .../python/dd4hep/geometryRPFromDD_2021_cfi.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py index 762264cde5e10..8c5fd6517fdb0 100644 --- a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py +++ b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py @@ -11,6 +11,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", fromDD4hep = cms.untracked.bool(True), + isRun2 = False, verbosity = cms.untracked.uint32(1), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) From d317b6684cd06e1517bc142e6f2396e138824d72 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 2 Dec 2020 17:52:47 +0100 Subject: [PATCH 56/64] Explicit type of isRun2 for ESProducer definition --- Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py index 92ce25ed2e492..22f148a00625d 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDB_cfi.py @@ -8,7 +8,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", verbosity = cms.untracked.uint32(1), - isRun2 = False, + isRun2 = cms.bool(False), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) From 695c0a69f4f970bd9bdeb80a2bc9db91acfa9f52 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 2 Dec 2020 17:55:38 +0100 Subject: [PATCH 57/64] Correcting all other ESProducer definitions --- .../python/dd4hep/geometryRPFromDB_cfi.py | 3 ++- .../python/dd4hep/geometryRPFromDD_2021_cfi.py | 2 +- .../python/geometryRPFromDD_2018_cfi.py | 8 ++++---- .../python/geometryRPFromDD_2021_cfi.py | 8 ++++---- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDB_cfi.py b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDB_cfi.py index c787064a7e914..47180aefc1ff3 100644 --- a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDB_cfi.py +++ b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDB_cfi.py @@ -10,11 +10,12 @@ DDCompactViewESProducer = cms.ESProducer("DDCompactViewESProducer", appendToDataLabel = cms.string('XMLIdealGeometryESSource_CTPPS') -) +) ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", fromDD4hep = cms.untracked.bool(True), + isRun2 = cms.bool(False), verbosity = cms.untracked.uint32(1), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py index 8c5fd6517fdb0..b9618ec260b14 100644 --- a/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py +++ b/Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py @@ -11,7 +11,7 @@ ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", fromDD4hep = cms.untracked.bool(True), - isRun2 = False, + isRun2 = cms.bool(False), verbosity = cms.untracked.uint32(1), compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py index 2fb469b405b95..952964b387e35 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2018_cfi.py @@ -145,7 +145,7 @@ XMLIdealGeometryESSource_CTPPS.geomXMLFiles.append("Geometry/VeryForwardData/data/2016_ctpps_15sigma_margin0/RP_Dist_Beam_Cent.xml") ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", - verbosity = cms.untracked.uint32(1), - isRun2 = cms.bool(True), - compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') - ) + verbosity = cms.untracked.uint32(1), + isRun2 = cms.bool(True), + compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') +) diff --git a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py index 9e5eabaf0d272..927ee71de5942 100644 --- a/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py +++ b/Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py @@ -147,7 +147,7 @@ XMLIdealGeometryESSource_CTPPS.geomXMLFiles.append("Geometry/VeryForwardData/data/2016_ctpps_15sigma_margin0/RP_Dist_Beam_Cent.xml") ctppsGeometryESModule = cms.ESProducer("CTPPSGeometryESModule", - verbosity = cms.untracked.uint32(1), - isRun2 = False, - compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') - ) + verbosity = cms.untracked.uint32(1), + isRun2 = cms.bool(False), + compactViewTag = cms.string('XMLIdealGeometryESSource_CTPPS') +) From 86e30ca8b1919101fb4d9f63ac4bc4d9cfee69be Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 9 Dec 2020 11:19:07 +0100 Subject: [PATCH 58/64] Added isRun2 private attribute to CTPPSCompositeESSource plugin --- CalibPPS/ESProducers/plugins/CTPPSCompositeESSource.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CalibPPS/ESProducers/plugins/CTPPSCompositeESSource.cc b/CalibPPS/ESProducers/plugins/CTPPSCompositeESSource.cc index 2e9d786d1b3dd..08df690098f34 100644 --- a/CalibPPS/ESProducers/plugins/CTPPSCompositeESSource.cc +++ b/CalibPPS/ESProducers/plugins/CTPPSCompositeESSource.cc @@ -66,6 +66,7 @@ class CTPPSCompositeESSource : public edm::ESProducer, public edm::EventSetupRec std::string opticsLabel_; unsigned int generateEveryNEvents_; unsigned int verbosity_; + const bool isRun2_; // ES tokens edm::ESGetToken tokenCompactViewReal_, tokenCompactViewMisaligned_; @@ -126,6 +127,7 @@ CTPPSCompositeESSource::CTPPSCompositeESSource(const edm::ParameterSet &conf) opticsLabel_(conf.getParameter("opticsLabel")), generateEveryNEvents_(conf.getUntrackedParameter("generateEveryNEvents")), verbosity_(conf.getUntrackedParameter("verbosity")), + isRun2_(conf.getParameter("isRun2")), m_engine_(new CLHEP::HepJamesRandom(conf.getParameter("seed"))) { double l_int_sum = 0; @@ -174,6 +176,7 @@ void CTPPSCompositeESSource::fillDescriptions(edm::ConfigurationDescriptions &de desc.add("lhcInfoLabel", "")->setComment("label of the LHCInfo record"); desc.add("opticsLabel", "")->setComment("label of the optics record"); desc.add("seed", 1)->setComment("random seed"); + desc.add("isRun2", false)->setComment("use diamond's run 2 geometry definition?"); desc.addUntracked("generateEveryNEvents", 1)->setComment("how often to switch conditions"); desc.addUntracked("verbosity", 0); @@ -470,4 +473,4 @@ std::unique_ptr CTPPSCompositeESSource::produceLhcInfo(const LHCInfoRcd //---------------------------------------------------------------------------------------------------- -DEFINE_FWK_EVENTSETUP_SOURCE(CTPPSCompositeESSource); \ No newline at end of file +DEFINE_FWK_EVENTSETUP_SOURCE(CTPPSCompositeESSource); From d1c66aee26e32d6e17f515775079101e3d175a72 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 9 Dec 2020 11:20:58 +0100 Subject: [PATCH 59/64] Using the isRun2 flag when building geometry description from compact view --- CalibPPS/ESProducers/plugins/CTPPSCompositeESSource.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalibPPS/ESProducers/plugins/CTPPSCompositeESSource.cc b/CalibPPS/ESProducers/plugins/CTPPSCompositeESSource.cc index 08df690098f34..dc67eac1c9112 100644 --- a/CalibPPS/ESProducers/plugins/CTPPSCompositeESSource.cc +++ b/CalibPPS/ESProducers/plugins/CTPPSCompositeESSource.cc @@ -262,7 +262,7 @@ void CTPPSCompositeESSource::buildDirectSimuData(const edm::ParameterSet &profil //---------------------------------------------------------------------------------------------------- void CTPPSCompositeESSource::buildGeometry(const DDCompactView &cpv) { - std::unique_ptr idealGD = detgeomdescbuilder::buildDetGeomDescFromCompactView(cpv); + std::unique_ptr idealGD = detgeomdescbuilder::buildDetGeomDescFromCompactView(cpv, isRun2_); for (auto &pb : profile_bins_) { auto &p = pb.data; From 4e2021522a404db6f653db340118a1757dccb20c Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 9 Dec 2020 12:52:38 +0100 Subject: [PATCH 60/64] Added isRun2 attribute to PPS composite geometry source --- Validation/CTPPS/python/simu_config/year_2016_cff.py | 3 ++- Validation/CTPPS/python/simu_config/year_2017_cff.py | 3 ++- Validation/CTPPS/python/simu_config/year_2018_cff.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Validation/CTPPS/python/simu_config/year_2016_cff.py b/Validation/CTPPS/python/simu_config/year_2016_cff.py index 845cda44ae71d..d2212bdcaff9a 100644 --- a/Validation/CTPPS/python/simu_config/year_2016_cff.py +++ b/Validation/CTPPS/python/simu_config/year_2016_cff.py @@ -12,11 +12,12 @@ # geometry from Geometry.VeryForwardGeometry.geometryRPFromDD_2017_cfi import * # using 2017 here is OK ctppsCompositeESSource.compactViewTag = ctppsGeometryESModule.compactViewTag +ctppsCompositeESSource.isRun2 = True del ctppsGeometryESModule # this functionality is replaced by the composite ES source # local reconstruction ctppsLocalTrackLiteProducer.includeStrips = True -ctppsLocalTrackLiteProducer.includePixels = False +ctppsLocalTrackLiteProducer.includePixels = False reco_local = cms.Sequence( totemRPUVPatternFinder diff --git a/Validation/CTPPS/python/simu_config/year_2017_cff.py b/Validation/CTPPS/python/simu_config/year_2017_cff.py index d6df416230be7..88f874dc94bf8 100644 --- a/Validation/CTPPS/python/simu_config/year_2017_cff.py +++ b/Validation/CTPPS/python/simu_config/year_2017_cff.py @@ -7,7 +7,7 @@ ctppsLHCInfo = dict( beamEnergy = 6500 ), - + ctppsOpticalFunctions = dict( opticalFunctions = cms.VPSet( cms.PSet( xangle = cms.double(120), fileName = cms.FileInPath("CalibPPS/ESProducers/data/optical_functions/2017/version5tim/120urad.root") ), @@ -31,6 +31,7 @@ # geometry from Geometry.VeryForwardGeometry.geometryRPFromDD_2017_cfi import * ctppsCompositeESSource.compactViewTag = ctppsGeometryESModule.compactViewTag +ctppsCompositeESSource.isRun2 = True del ctppsGeometryESModule # this functionality is replaced by the composite ES source # local reconstruction diff --git a/Validation/CTPPS/python/simu_config/year_2018_cff.py b/Validation/CTPPS/python/simu_config/year_2018_cff.py index f739353565512..8a5fad5de5539 100644 --- a/Validation/CTPPS/python/simu_config/year_2018_cff.py +++ b/Validation/CTPPS/python/simu_config/year_2018_cff.py @@ -26,7 +26,7 @@ cms.PSet( rpId = cms.uint32(2040004608), dirName = cms.string("XRPH_B6R5_B1"), z = cms.double(+21955.0) ), # RP 123, pixel ) ), - + ctppsDirectSimuData = dict( empiricalAperture45 = cms.string("-(8.44219E-07*[xangle]-0.000100957)+(([xi]<(0.000247185*[xangle]+0.101599))*-(1.40289E-05*[xangle]-0.00727237)+([xi]> = (0.000247185*[xangle]+0.101599))*-(0.000107811*[xangle]-0.0261867))*([xi]-(0.000247185*[xangle]+0.101599))"), empiricalAperture56 = cms.string("-(-4.74758E-07*[xangle]+3.0881E-05)+(([xi]<(0.000727859*[xangle]+0.0722653))*-(2.43968E-05*[xangle]-0.0085461)+([xi]> = (0.000727859*[xangle]+0.0722653))*-(7.19216E-05*[xangle]-0.0148267))*([xi]-(0.000727859*[xangle]+0.0722653))") @@ -36,6 +36,7 @@ # geometry from Geometry.VeryForwardGeometry.geometryRPFromDD_2018_cfi import * ctppsCompositeESSource.compactViewTag = ctppsGeometryESModule.compactViewTag +ctppsCompositeESSource.isRun2 = True del ctppsGeometryESModule # this functionality is replaced by the composite ES source # local reconstruction From 35a77e11de17ce1d8cff1230edb26009d114f14c Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 9 Dec 2020 12:54:04 +0100 Subject: [PATCH 61/64] isRun2 is a bool and not an unsigned int --- CalibPPS/ESProducers/plugins/CTPPSCompositeESSource.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalibPPS/ESProducers/plugins/CTPPSCompositeESSource.cc b/CalibPPS/ESProducers/plugins/CTPPSCompositeESSource.cc index dc67eac1c9112..a0f70205566e6 100644 --- a/CalibPPS/ESProducers/plugins/CTPPSCompositeESSource.cc +++ b/CalibPPS/ESProducers/plugins/CTPPSCompositeESSource.cc @@ -127,7 +127,7 @@ CTPPSCompositeESSource::CTPPSCompositeESSource(const edm::ParameterSet &conf) opticsLabel_(conf.getParameter("opticsLabel")), generateEveryNEvents_(conf.getUntrackedParameter("generateEveryNEvents")), verbosity_(conf.getUntrackedParameter("verbosity")), - isRun2_(conf.getParameter("isRun2")), + isRun2_(conf.getParameter("isRun2")), m_engine_(new CLHEP::HepJamesRandom(conf.getParameter("seed"))) { double l_int_sum = 0; From 033388d25bd5b0131ba72b7cd37c561751665299 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 9 Dec 2020 12:54:56 +0100 Subject: [PATCH 62/64] Fixed wrong isRun2 value for 2021 geometry tests --- CondTools/Geometry/test/ppsgeometrywriter_DD4hep.py | 2 +- CondTools/Geometry/test/ppsgeometrywriter_oldDD.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CondTools/Geometry/test/ppsgeometrywriter_DD4hep.py b/CondTools/Geometry/test/ppsgeometrywriter_DD4hep.py index a44763ee7bd69..7b9ffed69ca48 100644 --- a/CondTools/Geometry/test/ppsgeometrywriter_DD4hep.py +++ b/CondTools/Geometry/test/ppsgeometrywriter_DD4hep.py @@ -42,7 +42,7 @@ # DB writer process.ppsGeometryBuilder = cms.EDAnalyzer("PPSGeometryBuilder", fromDD4hep = cms.untracked.bool(True), - isRun2 = cms.untracked.bool(True), + isRun2 = cms.untracked.bool(False), compactViewTag = cms.untracked.string('XMLIdealGeometryESSource_CTPPS') ) diff --git a/CondTools/Geometry/test/ppsgeometrywriter_oldDD.py b/CondTools/Geometry/test/ppsgeometrywriter_oldDD.py index 0396e7b9b2bff..7a2428dedd4e9 100644 --- a/CondTools/Geometry/test/ppsgeometrywriter_oldDD.py +++ b/CondTools/Geometry/test/ppsgeometrywriter_oldDD.py @@ -41,7 +41,7 @@ # DB writer process.ppsGeometryBuilder = cms.EDAnalyzer("PPSGeometryBuilder", - isRun2 = cms.untracked.bool(True), + isRun2 = cms.untracked.bool(False), compactViewTag = cms.untracked.string('XMLIdealGeometryESSource_CTPPS') ) From cc64919c8dff48d87e5a9f95fc5d92f2236fb1cc Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 9 Dec 2020 14:38:04 +0100 Subject: [PATCH 63/64] Picking up isRun2 flag from base ESModule --- Validation/CTPPS/python/simu_config/year_2016_cff.py | 2 +- Validation/CTPPS/python/simu_config/year_2017_cff.py | 2 +- Validation/CTPPS/python/simu_config/year_2018_cff.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Validation/CTPPS/python/simu_config/year_2016_cff.py b/Validation/CTPPS/python/simu_config/year_2016_cff.py index d2212bdcaff9a..9d17dae419b9a 100644 --- a/Validation/CTPPS/python/simu_config/year_2016_cff.py +++ b/Validation/CTPPS/python/simu_config/year_2016_cff.py @@ -12,7 +12,7 @@ # geometry from Geometry.VeryForwardGeometry.geometryRPFromDD_2017_cfi import * # using 2017 here is OK ctppsCompositeESSource.compactViewTag = ctppsGeometryESModule.compactViewTag -ctppsCompositeESSource.isRun2 = True +ctppsCompositeESSource.isRun2 = ctppsGeometryESModule.isRun2 del ctppsGeometryESModule # this functionality is replaced by the composite ES source # local reconstruction diff --git a/Validation/CTPPS/python/simu_config/year_2017_cff.py b/Validation/CTPPS/python/simu_config/year_2017_cff.py index 88f874dc94bf8..e85558e19ec99 100644 --- a/Validation/CTPPS/python/simu_config/year_2017_cff.py +++ b/Validation/CTPPS/python/simu_config/year_2017_cff.py @@ -31,7 +31,7 @@ # geometry from Geometry.VeryForwardGeometry.geometryRPFromDD_2017_cfi import * ctppsCompositeESSource.compactViewTag = ctppsGeometryESModule.compactViewTag -ctppsCompositeESSource.isRun2 = True +ctppsCompositeESSource.isRun2 = ctppsGeometryESModule.isRun2 del ctppsGeometryESModule # this functionality is replaced by the composite ES source # local reconstruction diff --git a/Validation/CTPPS/python/simu_config/year_2018_cff.py b/Validation/CTPPS/python/simu_config/year_2018_cff.py index 8a5fad5de5539..fedfcfa4ea28f 100644 --- a/Validation/CTPPS/python/simu_config/year_2018_cff.py +++ b/Validation/CTPPS/python/simu_config/year_2018_cff.py @@ -36,7 +36,7 @@ # geometry from Geometry.VeryForwardGeometry.geometryRPFromDD_2018_cfi import * ctppsCompositeESSource.compactViewTag = ctppsGeometryESModule.compactViewTag -ctppsCompositeESSource.isRun2 = True +ctppsCompositeESSource.isRun2 = ctppsGeometryESModule.isRun2 del ctppsGeometryESModule # this functionality is replaced by the composite ES source # local reconstruction From c0145c7f21cc0801afc5fd503aa332afb68ff984 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 9 Dec 2020 16:07:44 +0100 Subject: [PATCH 64/64] Individual imports instead as import-delete --- Validation/CTPPS/python/simu_config/year_2016_cff.py | 11 ++++++----- Validation/CTPPS/python/simu_config/year_2017_cff.py | 9 +++++---- Validation/CTPPS/python/simu_config/year_2018_cff.py | 9 +++++---- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Validation/CTPPS/python/simu_config/year_2016_cff.py b/Validation/CTPPS/python/simu_config/year_2016_cff.py index 9d17dae419b9a..6e2e956e92a94 100644 --- a/Validation/CTPPS/python/simu_config/year_2016_cff.py +++ b/Validation/CTPPS/python/simu_config/year_2016_cff.py @@ -9,11 +9,12 @@ ) ) -# geometry -from Geometry.VeryForwardGeometry.geometryRPFromDD_2017_cfi import * # using 2017 here is OK -ctppsCompositeESSource.compactViewTag = ctppsGeometryESModule.compactViewTag -ctppsCompositeESSource.isRun2 = ctppsGeometryESModule.isRun2 -del ctppsGeometryESModule # this functionality is replaced by the composite ES source +# geometry (using 2017 here is OK) +from Geometry.VeryForwardGeometry.geometryRPFromDD_2017_cfi import totemGeomXMLFiles, ctppsDiamondGeomXMLFiles, ctppsUFSDGeomXMLFiles, ctppsPixelGeomXMLFiles +from Geometry.VeryForwardGeometry.geometryRPFromDD_2017_cfi import XMLIdealGeometryESSource_CTPPS +from Geometry.VeryForwardGeometry.geometryRPFromDD_2017_cfi import ctppsGeometryESModule as _geom +ctppsCompositeESSource.compactViewTag = _geom.compactViewTag +ctppsCompositeESSource.isRun2 = _geom.isRun2 # local reconstruction ctppsLocalTrackLiteProducer.includeStrips = True diff --git a/Validation/CTPPS/python/simu_config/year_2017_cff.py b/Validation/CTPPS/python/simu_config/year_2017_cff.py index e85558e19ec99..b25acd1d8b332 100644 --- a/Validation/CTPPS/python/simu_config/year_2017_cff.py +++ b/Validation/CTPPS/python/simu_config/year_2017_cff.py @@ -29,10 +29,11 @@ ) # geometry -from Geometry.VeryForwardGeometry.geometryRPFromDD_2017_cfi import * -ctppsCompositeESSource.compactViewTag = ctppsGeometryESModule.compactViewTag -ctppsCompositeESSource.isRun2 = ctppsGeometryESModule.isRun2 -del ctppsGeometryESModule # this functionality is replaced by the composite ES source +from Geometry.VeryForwardGeometry.geometryRPFromDD_2017_cfi import totemGeomXMLFiles, ctppsDiamondGeomXMLFiles, ctppsUFSDGeomXMLFiles, ctppsPixelGeomXMLFiles +from Geometry.VeryForwardGeometry.geometryRPFromDD_2017_cfi import XMLIdealGeometryESSource_CTPPS +from Geometry.VeryForwardGeometry.geometryRPFromDD_2017_cfi import ctppsGeometryESModule as _geom +ctppsCompositeESSource.compactViewTag = _geom.compactViewTag +ctppsCompositeESSource.isRun2 = _geom.isRun2 # local reconstruction ctppsLocalTrackLiteProducer.includeStrips = True diff --git a/Validation/CTPPS/python/simu_config/year_2018_cff.py b/Validation/CTPPS/python/simu_config/year_2018_cff.py index fedfcfa4ea28f..321d6e047c1ff 100644 --- a/Validation/CTPPS/python/simu_config/year_2018_cff.py +++ b/Validation/CTPPS/python/simu_config/year_2018_cff.py @@ -34,10 +34,11 @@ ) # geometry -from Geometry.VeryForwardGeometry.geometryRPFromDD_2018_cfi import * -ctppsCompositeESSource.compactViewTag = ctppsGeometryESModule.compactViewTag -ctppsCompositeESSource.isRun2 = ctppsGeometryESModule.isRun2 -del ctppsGeometryESModule # this functionality is replaced by the composite ES source +from Geometry.VeryForwardGeometry.geometryRPFromDD_2018_cfi import totemGeomXMLFiles, ctppsDiamondGeomXMLFiles, ctppsUFSDGeomXMLFiles, ctppsPixelGeomXMLFiles +from Geometry.VeryForwardGeometry.geometryRPFromDD_2018_cfi import XMLIdealGeometryESSource_CTPPS +from Geometry.VeryForwardGeometry.geometryRPFromDD_2018_cfi import ctppsGeometryESModule as _geom +ctppsCompositeESSource.compactViewTag = _geom.compactViewTag +ctppsCompositeESSource.isRun2 = _geom.isRun2 # local reconstruction ctppsLocalTrackLiteProducer.includeStrips = False