From 6dd00b494782357cf443d864b1699ee7dc74838b Mon Sep 17 00:00:00 2001 From: Jacek Kusnierz Date: Tue, 6 Aug 2019 13:38:10 +0200 Subject: [PATCH 01/37] 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 18d105a4499004b011ce7d5e06e7f0b07b75c070 Mon Sep 17 00:00:00 2001 From: Jacek Kusnierz Date: Tue, 6 Aug 2019 13:47:48 +0200 Subject: [PATCH 02/37] 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 8fd4ed3298ab6ef2eb40d5db5ae94d06592de158 Mon Sep 17 00:00:00 2001 From: Jacek Kusnierz Date: Tue, 6 Aug 2019 14:57:05 +0200 Subject: [PATCH 03/37] 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 f83aff8d4a54b7aba088a10b7526902a2130e397 Mon Sep 17 00:00:00 2001 From: Jacek Kusnierz Date: Tue, 6 Aug 2019 15:13:52 +0200 Subject: [PATCH 04/37] 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 107e308f49d30fbc3a6de1d31cf74d992435f453 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Mon, 15 Jun 2020 18:04:23 +0200 Subject: [PATCH 05/37] 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 cfda5772ca8de13d35e5e906f6d1ef04191a704a Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Mon, 15 Jun 2020 18:05:54 +0200 Subject: [PATCH 06/37] 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 f14b04e255afd575a1ea763681278e1c4770399a Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Mon, 15 Jun 2020 18:25:51 +0200 Subject: [PATCH 07/37] 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 eeb43695b98e0da843f92384489b9cbb4cdefc94 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Mon, 15 Jun 2020 18:34:19 +0200 Subject: [PATCH 08/37] 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 35a79b265321dca923d03dd1e55743b868b718cb Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Mon, 15 Jun 2020 18:38:02 +0200 Subject: [PATCH 09/37] 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 d4dcf4bde149dac383cd041ab4fa9ee54f1839f8 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Mon, 15 Jun 2020 19:37:58 +0200 Subject: [PATCH 10/37] 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 8428687eaecd7e2fb084ea477b6212b6b1caa2d2 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Mon, 15 Jun 2020 19:53:37 +0200 Subject: [PATCH 11/37] 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 d8c5b001f85c5e073751acfac7c6da9ae214353e Mon Sep 17 00:00:00 2001 From: Jan Kaspar Date: Fri, 5 Jun 2020 18:04:56 +0200 Subject: [PATCH 12/37] Added 2021-like geometry. --- .../data/CTPPS_Timing_Stations_Assembly.xml | 15 +- .../python/geometryRPFromDD_2021_cfi.py | 152 ++++++++++++++++++ 2 files changed, 160 insertions(+), 7 deletions(-) create mode 100644 Geometry/VeryForwardGeometry/python/geometryRPFromDD_2021_cfi.py 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 afd94a3e0d9a7aaa055a9ae5caa961e297ac4042 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Thu, 18 Jun 2020 15:28:15 +0200 Subject: [PATCH 13/37] Added a new legacy diamond hierarchy flag --- .../plugins/CTPPSGeometryESModule.cc | 38 +++++++++++++++---- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc index 7055c5f609ef6..fbe8a2243e3c9 100644 --- a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc +++ b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc @@ -81,9 +81,10 @@ class CTPPSGeometryESModule : public edm::ESProducer { const char* name); static void applyAlignments(const DetGeomDesc&, const CTPPSRPAlignmentCorrectionsData*, DetGeomDesc*&); - static void buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd); + void buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd) const; const unsigned int verbosity_; + const bool legacyDiamondHierarchy_; const edm::ESGetToken compactViewToken_; const GDTokens gdRealTokens_; @@ -98,6 +99,7 @@ class CTPPSGeometryESModule : public edm::ESProducer { CTPPSGeometryESModule::CTPPSGeometryESModule(const edm::ParameterSet& iConfig) : verbosity_(iConfig.getUntrackedParameter("verbosity")), + legacyDiamondHierarchy_(iConfig.getUntrackedParameter("legacyDiamondHierarchy", false)), compactViewToken_{setWhatProduced(this, &CTPPSGeometryESModule::produceIdealGD) .consumes(edm::ESInputTag( "" /*optional module label */, iConfig.getParameter("compactViewTag")))}, @@ -174,7 +176,7 @@ void CTPPSGeometryESModule::applyAlignments(const DetGeomDesc& idealGD, //---------------------------------------------------------------------------------------------------- -void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd) { +void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd) const { // try to dive into next level if (!fv->firstChild()) return; @@ -267,14 +269,24 @@ void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd << "size of copyNumbers for diamond segments is " << copy_num.size() << ". It must be >= 2."; const unsigned int decRPId = copy_num[1]; + unsigned int arm, station, rp; + if (legacyDiamondHierarchy_) { + arm = decRPId-1; + station = 1; + rp = 6; + } + else { + arm = (decRPId / 100) / 10; + station = (decRPId / 10) % 10; + rp = decRPId % 10; + } 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; const unsigned int plane = id / 100; const unsigned int channel = id % 100; newGD->setGeographicalID(CTPPSDiamondDetId(arm, station, rp, plane, channel)); + std::cout << "SEGMENT: " << decRPId << "/" << id << ">> " << CTPPSDiamondDetId(arm, station, rp, plane, channel) << std::endl; + for (const auto& id:copy_num)std::cout <<">>>"<= 2."; 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; + unsigned int arm, station, rp; + if (legacyDiamondHierarchy_) { + arm = decRPId-1; + station = 1; + rp = 6; + } + else { + arm = (decRPId / 100) % 10; + station = (decRPId / 10) % 10; + rp = decRPId % 10; + } newGD->setGeographicalID(CTPPSDiamondDetId(arm, station, rp)); + std::cout << "RP: " << decRPId << ">> " << CTPPSDiamondDetId(arm, station, rp) << std::endl; + for (const auto& id:copy_num)std::cout <<">>>"< Date: Thu, 18 Jun 2020 15:35:46 +0200 Subject: [PATCH 14/37] Added legacy diamond hierarchy modifier for Run 2 eras --- .../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..f297dccfab15e 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, legacyDiamondHierarchy=cms.untracked.bool(True)) + +from Configuration.Eras.Modifier_ctpps_2017_cff import ctpps_2017 +ctpps_2017.toModify(ctppsGeometryESModule, legacyDiamondHierarchy=cms.untracked.bool(True)) + +from Configuration.Eras.Modifier_ctpps_2018_cff import ctpps_2018 +ctpps_2018.toModify(ctppsGeometryESModule, legacyDiamondHierarchy=cms.untracked.bool(True)) From 370a62d783c0e5620f5ceafb541f46508f795e15 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Thu, 18 Jun 2020 16:08:44 +0200 Subject: [PATCH 15/37] Added the legacy flag to the configuration validator --- .../plugins/CTPPSGeometryESModule.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc index fbe8a2243e3c9..77839e38ef018 100644 --- a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc +++ b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc @@ -99,7 +99,7 @@ class CTPPSGeometryESModule : public edm::ESProducer { CTPPSGeometryESModule::CTPPSGeometryESModule(const edm::ParameterSet& iConfig) : verbosity_(iConfig.getUntrackedParameter("verbosity")), - legacyDiamondHierarchy_(iConfig.getUntrackedParameter("legacyDiamondHierarchy", false)), + legacyDiamondHierarchy_(iConfig.getUntrackedParameter("legacyDiamondHierarchy")), compactViewToken_{setWhatProduced(this, &CTPPSGeometryESModule::produceIdealGD) .consumes(edm::ESInputTag( "" /*optional module label */, iConfig.getParameter("compactViewTag")))}, @@ -114,6 +114,7 @@ CTPPSGeometryESModule::CTPPSGeometryESModule(const edm::ParameterSet& iConfig) void CTPPSGeometryESModule::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.addUntracked("verbosity", 1); + desc.addUntracked("legacyDiamondHierarchy", false); desc.add("compactViewTag", std::string()); descriptions.add("DoodadESSource", desc); } From dc071c9c2c62ec23f76bdad857fbc21185b3f71a Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Thu, 18 Jun 2020 16:09:09 +0200 Subject: [PATCH 16/37] Dropped unnecessary printout --- .../plugins/CTPPSGeometryESModule.cc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc index 77839e38ef018..b7d7e87e72bab 100644 --- a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc +++ b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc @@ -286,8 +286,6 @@ void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd const unsigned int channel = id % 100; newGD->setGeographicalID(CTPPSDiamondDetId(arm, station, rp, plane, channel)); - std::cout << "SEGMENT: " << decRPId << "/" << id << ">> " << CTPPSDiamondDetId(arm, station, rp, plane, channel) << std::endl; - for (const auto& id:copy_num)std::cout <<">>>"<setGeographicalID(CTPPSDiamondDetId(arm, station, rp)); - std::cout << "RP: " << decRPId << ">> " << CTPPSDiamondDetId(arm, station, rp) << std::endl; - for (const auto& id:copy_num)std::cout <<">>>"< Date: Thu, 18 Jun 2020 16:09:47 +0200 Subject: [PATCH 17/37] Code-format --- .../plugins/CTPPSGeometryESModule.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc index b7d7e87e72bab..5259617799d3f 100644 --- a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc +++ b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc @@ -272,11 +272,10 @@ void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd const unsigned int decRPId = copy_num[1]; unsigned int arm, station, rp; if (legacyDiamondHierarchy_) { - arm = decRPId-1; + arm = decRPId - 1; station = 1; rp = 6; - } - else { + } else { arm = (decRPId / 100) / 10; station = (decRPId / 10) % 10; rp = decRPId % 10; @@ -300,11 +299,10 @@ void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd const unsigned int decRPId = copy_num[1]; unsigned int arm, station, rp; if (legacyDiamondHierarchy_) { - arm = decRPId-1; + arm = decRPId - 1; station = 1; rp = 6; - } - else { + } else { arm = (decRPId / 100) % 10; station = (decRPId / 10) % 10; rp = decRPId % 10; From f3399901743fc562930c57f6f25b3e53f27d4eae Mon Sep 17 00:00:00 2001 From: Jacek Kusnierz Date: Tue, 6 Aug 2019 13:38:10 +0200 Subject: [PATCH 18/37] change the way CMSSW calculates diamond detectors --- .../plugins/CTPPSGeometryESModule.cc | 280 ++++++++++-------- 1 file changed, 149 insertions(+), 131 deletions(-) diff --git a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc index 5259617799d3f..0f804b76e1344 100644 --- a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc +++ b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc @@ -49,36 +49,35 @@ * * 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*&); void buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd) const; @@ -87,13 +86,15 @@ class CTPPSGeometryESModule : public edm::ESProducer { const bool legacyDiamondHierarchy_; 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_; }; + //---------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------- @@ -111,7 +112,8 @@ CTPPSGeometryESModule::CTPPSGeometryESModule(const edm::ParameterSet& iConfig) 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.addUntracked("legacyDiamondHierarchy", false); @@ -119,18 +121,21 @@ void CTPPSGeometryESModule::fillDescriptions(edm::ConfigurationDescriptions& des 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(); @@ -139,38 +144,42 @@ 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 ); } } } @@ -179,89 +188,89 @@ void CTPPSGeometryESModule::applyAlignments(const DetGeomDesc& idealGD, void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd) const { // 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(); // check size of copy numbers array @@ -284,7 +293,7 @@ void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd const unsigned int plane = id / 100; const unsigned int channel = id % 100; - newGD->setGeographicalID(CTPPSDiamondDetId(arm, station, rp, plane, channel)); + newGD->setGeographicalID( CTPPSDiamondDetId( arm, station, rp, plane, channel ) ); } // diamond/UFSD RPs @@ -308,15 +317,15 @@ void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd rp = decRPId % 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(); @@ -324,17 +333,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; @@ -342,66 +353,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 1ebccbfd1cc3870d6829daeb98370124a43eb4cd Mon Sep 17 00:00:00 2001 From: Jacek Kusnierz Date: Tue, 6 Aug 2019 13:47:48 +0200 Subject: [PATCH 19/37] correct diamond detector software --- .../plugins/CTPPSGeometryESModule.cc | 259 ++++++++---------- 1 file changed, 121 insertions(+), 138 deletions(-) diff --git a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc index 0f804b76e1344..1eb3907a49740 100644 --- a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc +++ b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc @@ -49,31 +49,30 @@ * * 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); @@ -86,15 +85,13 @@ class CTPPSGeometryESModule : public edm::ESProducer const bool legacyDiamondHierarchy_; 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_; }; - //---------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------- @@ -121,21 +118,18 @@ CTPPSGeometryESModule::fillDescriptions(edm::ConfigurationDescriptions& descript 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(); @@ -144,42 +138,38 @@ 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); } } } @@ -188,89 +178,89 @@ CTPPSGeometryESModule::applyAlignments( const DetGeomDesc& idealGD, void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd) const { // 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(); // check size of copy numbers array @@ -293,7 +283,7 @@ void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd const unsigned int plane = id / 100; const unsigned int channel = id % 100; - newGD->setGeographicalID( CTPPSDiamondDetId( arm, station, rp, plane, channel ) ); + newGD->setGeographicalID(CTPPSDiamondDetId(arm, station, rp, plane, channel)); } // diamond/UFSD RPs @@ -317,15 +307,15 @@ void CTPPSGeometryESModule::buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd rp = decRPId % 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(); @@ -333,19 +323,17 @@ 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; @@ -360,66 +348,61 @@ CTPPSGeometryESModule::produceGD(IdealGeometryRecord const& iIdealRec, 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 d48e2be4adb8a85b83cbf8f453ef85b0b0afdf28 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Mon, 15 Jun 2020 18:25:51 +0200 Subject: [PATCH 20/37] Generalised the tracks reconstruction algorithms multiplicity --- RecoPPS/Local/interface/CTPPSDiamondTrackRecognition.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 07860f97c9b45ed9323c475d12a7ef9411fb06ad Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Mon, 15 Jun 2020 18:34:19 +0200 Subject: [PATCH 21/37] Added a hash function for CTPPSDetId objects --- .../interface/CTPPSDiamondTrackRecognition.h | 2 +- .../plugins/CTPPSDiamondLocalTrackFitter.cc | 23 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) 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 3f96bac38f955..1d3d6b6260194 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) @@ -59,18 +59,17 @@ 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].reset(new CTPPSDiamondTrackRecognition(trk_algo_params_)); - for (const auto& hit : vec) + // 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) - trk_algo_[detid]->addHit(hit); - } - - 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(); + if (hit.ootIndex() == CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING) + continue; + trk_algo_[detid]->addHit(hit); + } + auto& tracks = pOut->find_or_insert(detid); + // retrieve the tracks for both arms + trk_algo_[detid]->produceTracks(tracks); } iEvent.put(std::move(pOut)); From 5f672e786fc53610206b11ba3964925a9cdca847 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Mon, 15 Jun 2020 18:38:02 +0200 Subject: [PATCH 22/37] Code-format --- .../VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc | 1 - RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc index 1eb3907a49740..740667ae1f7b9 100644 --- a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc +++ b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc @@ -405,4 +405,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 1d3d6b6260194..b3bfef00f1986 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 4ca73083cf6cf126cf163851807f3ccec228575a Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Mon, 15 Jun 2020 19:37:58 +0200 Subject: [PATCH 23/37] One algo per station, not per channel --- .../Local/plugins/CTPPSDiamondLocalTrackFitter.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc b/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc index b3bfef00f1986..984551162cb92 100644 --- a/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc +++ b/RecoPPS/Local/plugins/CTPPSDiamondLocalTrackFitter.cc @@ -59,17 +59,16 @@ 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].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 88b7b3c90559ee961450e63bfcd2757b2a248f4c Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Mon, 15 Jun 2020 19:53:37 +0200 Subject: [PATCH 24/37] 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 44683867050be3b1ad9e8fc7ce5ab1e427f0a313 Mon Sep 17 00:00:00 2001 From: Jan Kaspar Date: Fri, 5 Jun 2020 18:04:56 +0200 Subject: [PATCH 25/37] 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 +++++ 3 files changed, 366 insertions(+) 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 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 6ecbf4c919fa7401ed8e0c82d539df38dfe35fb6 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Mon, 15 Jun 2020 20:14:21 +0200 Subject: [PATCH 26/37] 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 9c68cce2143192bd9a73dc3d70124fdd1f7c8340 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Thu, 18 Jun 2020 13:28:09 +0200 Subject: [PATCH 27/37] 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 546de36532ee783bf2ad6134b20382eaf21556c5 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Fri, 19 Jun 2020 14:37:19 +0200 Subject: [PATCH 28/37] 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 e55224f10e9a580ff4ad971ef044ceb48436f7dc Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 23 Jun 2020 14:46:48 +0200 Subject: [PATCH 29/37] 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 b5a0a9ae7c6bbde72d39796f141b66d520ec4482 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 14 Jul 2020 15:52:05 +0200 Subject: [PATCH 30/37] 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 d04fc363c0e78..e1e1fa1ce6070 100644 --- a/Validation/CTPPS/plugins/CTPPSDirectProtonSimulation.cc +++ b/Validation/CTPPS/plugins/CTPPSDirectProtonSimulation.cc @@ -439,10 +439,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; @@ -456,7 +452,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); @@ -547,7 +543,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 023327d0d50b21015b9f4bf2f947681889117720 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 14 Jul 2020 16:00:31 +0200 Subject: [PATCH 31/37] 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 9670134f3ac5a0da0c0524c1ffaa6f854e463760 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 14 Jul 2020 18:36:15 +0200 Subject: [PATCH 32/37] 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 4df20451dabc1acf7be08d7c2f761bdc1a4941b7 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 14 Jul 2020 18:40:47 +0200 Subject: [PATCH 33/37] 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 6e5b44fb2ea38c9f92f646572cf2393b88d817e7 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 14 Jul 2020 18:43:46 +0200 Subject: [PATCH 34/37] 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 557b773dfdfbe729a115096e9ab135e273faca77 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 15 Jul 2020 09:49:18 +0200 Subject: [PATCH 35/37] 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 bb450e458b13e83b96921b503a017757590ec6c8 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 15 Sep 2020 14:31:36 +0200 Subject: [PATCH 36/37] Renaming and cleaning up --- .../data/2021/v1/RP_220_Left_Station.xml | 12 ++++++------ .../data/2021/v1/RP_220_Right_Station.xml | 10 +++++----- 2 files changed, 11 insertions(+), 11 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 6e4d55b3e4424..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,6 +1,6 @@ - + @@ -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 03b4f2b1c9ac1..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,6 +1,6 @@ - + @@ -95,12 +95,12 @@ - + - + @@ -110,12 +110,12 @@ - + - + From ccc9158f6495f6b64c4e0fb6dbdaec07e4b8517c Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 15 Sep 2020 15:36:38 +0200 Subject: [PATCH 37/37] Matched 2021 scenario's left/right stations to DD4Hep-validated ones. Cleanup. --- .../data/2021/v1/RP_220_Left_Station.xml | 317 +++++++++--------- .../data/2021/v1/RP_220_Right_Station.xml | 313 ++++++++--------- .../plugins/CTPPSGeometryESModule.cc | 22 +- 3 files changed, 339 insertions(+), 313 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..76bb308f2c129 100644 --- a/Geometry/VeryForwardData/data/2021/v1/RP_220_Left_Station.xml +++ b/Geometry/VeryForwardData/data/2021/v1/RP_220_Left_Station.xml @@ -1,154 +1,167 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..915c3cdda26d4 100644 --- a/Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml +++ b/Geometry/VeryForwardData/data/2021/v1/RP_220_Right_Station.xml @@ -1,152 +1,165 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc index 740667ae1f7b9..5259617799d3f 100644 --- a/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc +++ b/Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc @@ -74,9 +74,11 @@ class CTPPSGeometryESModule : public edm::ESProducer { 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*&); void buildDetGeomDesc(DDFilteredView* fv, DetGeomDesc* gd) const; @@ -109,8 +111,7 @@ CTPPSGeometryESModule::CTPPSGeometryESModule(const edm::ParameterSet& iConfig) 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.addUntracked("legacyDiamondHierarchy", false); @@ -341,12 +342,11 @@ 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_);