diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MdtReadoutElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MdtReadoutElement.cxx index 45004d8969b13f7a6feb882e5acebb26921665f0..f2855ac8e70c1706072722b04991f222b463793b 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MdtReadoutElement.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MdtReadoutElement.cxx @@ -49,6 +49,11 @@ // m_ep = 1.0e-5; // 10 ppm // m_en = 1.0e-5; // 10 ppm +namespace { + // the tube number of a tube in a tubeLayer in encoded in the GeoSerialIdentifier (modulo maxNTubesPerLayer) + static constexpr unsigned int const maxNTubesPerLayer = 120; +} + namespace MuonGM { MdtReadoutElement::MdtReadoutElement(GeoVFullPhysVol* pv, std::string stName, @@ -150,7 +155,7 @@ double MdtReadoutElement::getTubeLengthForCaching(int tubeLayer, int tube) const // usually the tube number corresponds to the child number, however for // BMG chambers full tubes are skipped during the building process // therefore the matching needs to be done via the volume ID - int packed_id = tube + 100*tubeLayer; + int packed_id = tube + maxNTubesPerLayer*tubeLayer; int kk = 0; bool found = false; geoGetIds ([&](int id) { @@ -162,7 +167,7 @@ double MdtReadoutElement::getTubeLengthForCaching(int tubeLayer, int tube) const }, &*cv); if (found && log.level()<=MSG::DEBUG) { log << MSG::DEBUG << " MdtReadoutElement tube match found for BMG - input : tube(" << tube << "), layer(" << tubeLayer - << ") - output match : tube(" << ii%100 << "), layer(" << ii/100 << ")" << endmsg; + << ") - output match : tube(" << ii%maxNTubesPerLayer << "), layer(" << ii/maxNTubesPerLayer << ")" << endmsg; } } if (ii>=nGrandchildren) { @@ -482,7 +487,7 @@ MdtReadoutElement::nodeform_localTubePos(int multilayer, int tubelayer, int tube // usually the tube number corresponds to the child number, however for // BMG chambers full tubes are skipped during the building process // therefore the matching needs to be done via the volume ID - int packed_id = tube + 100*tubelayer; + int packed_id = tube + maxNTubesPerLayer*tubelayer; int kk = 0; bool found = false; geoGetIds ([&](int id) { @@ -495,7 +500,7 @@ MdtReadoutElement::nodeform_localTubePos(int multilayer, int tubelayer, int tube #ifndef NDEBUG if (found && log.level()<=MSG::DEBUG) { log << MSG::DEBUG << " MdtReadoutElement tube match found for BMG - input : tube(" << tube << "), layer(" << tubelayer - << ") - output match : tube(" << ii%100 << "), layer(" << ii/100 << ")" << endmsg; + << ") - output match : tube(" << ii%maxNTubesPerLayer << "), layer(" << ii/maxNTubesPerLayer << ")" << endmsg; } #endif } @@ -1753,7 +1758,7 @@ void MdtReadoutElement::fillCache() // usually the tube number corresponds to the child number, however for // BMG chambers full tubes are skipped during the building process // therefore the matching needs to be done via the volume ID - int packed_id = tube + 100*tl; + int packed_id = tube + maxNTubesPerLayer*tl; bool found = false; geoGetIds ([&](int id) { if (!found && id == packed_id) { diff --git a/MuonSpectrometer/MuonG4/MuonG4SD/src/MDTSensitiveDetector.cxx b/MuonSpectrometer/MuonG4/MuonG4SD/src/MDTSensitiveDetector.cxx index b23950a27e25a74163b3eaa1696f7b1b2034028d..45c633deef870518653ec348731c53eacf232ae7 100755 --- a/MuonSpectrometer/MuonG4/MuonG4SD/src/MDTSensitiveDetector.cxx +++ b/MuonSpectrometer/MuonG4/MuonG4SD/src/MDTSensitiveDetector.cxx @@ -13,6 +13,11 @@ #include "GeoPrimitives/CLHEPtoEigenConverter.h" +namespace { + // the tube number of a tube in a tubeLayer in encoded in the GeoSerialIdentifier (modulo maxNTubesPerLayer) + static constexpr unsigned int const maxNTubesPerLayer = 120; +} + // construction/destruction MDTSensitiveDetector::MDTSensitiveDetector(const std::string& name, const std::string& hitCollectionName, const unsigned int nTubesMax) : G4VSensitiveDetector( name ) @@ -209,8 +214,8 @@ int MDTSensitiveDetector::GetIdentifier(G4TouchableHistory* touchHist) } multilayer = gmID; } else if ((npos = volName.find("Drift")) != std::string::npos) { // layer and tube - tubeLayer = touchHist->GetVolume(i)->GetCopyNo()/100; - tube = touchHist->GetVolume(i)->GetCopyNo()%100; + tubeLayer = touchHist->GetVolume(i)->GetCopyNo()/maxNTubesPerLayer; + tube = touchHist->GetVolume(i)->GetCopyNo()%maxNTubesPerLayer; } } //construct the hit identifier diff --git a/MuonSpectrometer/MuonG4/MuonG4SD/src/MDTSensitiveDetectorCosmics.cxx b/MuonSpectrometer/MuonG4/MuonG4SD/src/MDTSensitiveDetectorCosmics.cxx index b44478a00a941e806b7946ba59cbd7d0f2f45e7c..50ac1b73de0fdf97e58a0ef08e8bde605f76cebd 100755 --- a/MuonSpectrometer/MuonG4/MuonG4SD/src/MDTSensitiveDetectorCosmics.cxx +++ b/MuonSpectrometer/MuonG4/MuonG4SD/src/MDTSensitiveDetectorCosmics.cxx @@ -14,6 +14,11 @@ #include "GeoPrimitives/CLHEPtoEigenConverter.h" +namespace { + // the tube number of a tube in a tubeLayer in encoded in the GeoSerialIdentifier (modulo maxNTubesPerLayer) + static constexpr unsigned int const maxNTubesPerLayer = 120; +} + typedef std::istringstream my_isstream; // construction/destruction @@ -252,8 +257,8 @@ int MDTSensitiveDetectorCosmics::GetIdentifier(G4TouchableHistory* touchHist) } multilayer = gmID; } else if ((npos = volName.find("Drift")) != std::string::npos) { // layer and tube - tubeLayer = touchHist->GetVolume(i)->GetCopyNo()/100; - tube = touchHist->GetVolume(i)->GetCopyNo()%100; + tubeLayer = touchHist->GetVolume(i)->GetCopyNo()/maxNTubesPerLayer; + tube = touchHist->GetVolume(i)->GetCopyNo()%maxNTubesPerLayer; } } //construct the hit identifier diff --git a/MuonSpectrometer/MuonG4/MuonG4SD/test/MDTSensitiveDetectorCosmics_gtest.cxx b/MuonSpectrometer/MuonG4/MuonG4SD/test/MDTSensitiveDetectorCosmics_gtest.cxx index c756e3bdf4f9743a1a253c5594c3a9a5a58a7d33..e5e39be01fa318eb53d7991d353cce96e33ee79e 100644 --- a/MuonSpectrometer/MuonG4/MuonG4SD/test/MDTSensitiveDetectorCosmics_gtest.cxx +++ b/MuonSpectrometer/MuonG4/MuonG4SD/test/MDTSensitiveDetectorCosmics_gtest.cxx @@ -63,9 +63,9 @@ TEST_F ( MDTSensitiveDetectorCosmicstest, ProcessHits ) G4HCofThisEvent hce; G4double totalenergydeposit = 3.0; - std::vector<G4String> physicalname = {"World::World","Atlas::Atlas","MUONQ02::MUONQ02","Muon::MuonSys","BML2_station","ml[1]MDT03component","DriftTube8","SensitiveGas"}; + std::vector<G4String> physicalname = {"World::World","Atlas::Atlas","MUONQ02::MUONQ02","Muon::MuonSys","BOL1_station","ml[1]MDT03component","DriftTube3","SensitiveGas"}; G4String logicalname = "logicalName"; - std::vector<G4int> copynos = {0,0,0,0,302,8,109,16969}; + std::vector<G4int> copynos = {0,0,0,0,406,1,124,16969}; G4ThreeVector preStepPos = G4ThreeVector(0,0,1); G4ThreeVector postStepPos = G4ThreeVector(0,0,2); G4double globaltime0 = 0.5; @@ -246,7 +246,7 @@ TEST_F ( MDTSensitiveDetectorCosmicstest, ProcessHits ) HepMcParticleLink plink(barcode); MDTSimHitCollection* a = sd2.m_MDTHitColl.ptr(); - ASSERT_EQ(a->begin()->MDTid(), 16868488); //test if the MDTid value of the Hit generated by this member function is right, the same below + ASSERT_EQ(a->begin()->MDTid(), 6395024); //test if the MDTid value of the Hit generated by this member function is right, the same below ASSERT_EQ(a->begin()->globalTime(), 0.5); ASSERT_EQ(a->begin()->driftRadius(), 0); ASSERT_EQ(a->begin()->localPosition(), Amg::Vector3D(0,0,1)); diff --git a/MuonSpectrometer/MuonG4/MuonG4SD/test/MDTSensitiveDetector_gtest.cxx b/MuonSpectrometer/MuonG4/MuonG4SD/test/MDTSensitiveDetector_gtest.cxx index 5eefec3202a8b62634317c3d467d4bde6e29b641..3a640ead2a6f734ba29e603b7d1797f8f6a0e117 100644 --- a/MuonSpectrometer/MuonG4/MuonG4SD/test/MDTSensitiveDetector_gtest.cxx +++ b/MuonSpectrometer/MuonG4/MuonG4SD/test/MDTSensitiveDetector_gtest.cxx @@ -64,9 +64,10 @@ TEST_F ( MDTSensitiveDetectortest, ProcessHits ) G4HCofThisEvent hce; G4double totalenergydeposit = 3.0; - std::vector<G4String> physicalname = {"World::World","Atlas::Atlas","MUONQ02::MUONQ02","Muon::MuonSys","EES4_station","ml[2]MDT04component","DriftTube57","SensitiveGas"}; + + std::vector<G4String> physicalname = {"Atlas::Atlas","MUONQ02::MUONQ02","Muon::MuonSys","BIL1_station","ml[1]MDT01component","DriftTube17","SensitiveGas"}; G4String logicalname = "logicalName"; - std::vector<G4int> copynos = {0,0,0,0,-1207,7,218,16969}; + std::vector<G4int> copynos = {0,0,0,404,1,138,16969}; G4ThreeVector preStepPos = G4ThreeVector(0,0,1); G4ThreeVector postStepPos = G4ThreeVector(0,0,2); G4double globaltime0 = 0.5; @@ -246,7 +247,7 @@ TEST_F ( MDTSensitiveDetectortest, ProcessHits ) HepMcParticleLink plink(barcode); MDTSimHitCollection* a = sd2.m_MDTHitColl.ptr(); - ASSERT_EQ(a->begin()->MDTid(), 36493337); //test if the MDTid value of the Hit generated by this member function is right, the same below + ASSERT_EQ(a->begin()->MDTid(), 35753088); //test if the MDTid value of the Hit generated by this member function is right, the same below ASSERT_EQ(a->begin()->globalTime(), 0.5); ASSERT_EQ(a->begin()->driftRadius(), 0); ASSERT_EQ(a->begin()->localPosition(), Amg::Vector3D(0,0,1)); diff --git a/MuonSpectrometer/MuonGeoModel/src/MultiLayer.cxx b/MuonSpectrometer/MuonGeoModel/src/MultiLayer.cxx index 6dee99d7e56b3d9b0fa832ca5061e2cbe4bb4655..1074115ca8589ce129b57a4010e7f9b4263a973d 100755 --- a/MuonSpectrometer/MuonGeoModel/src/MultiLayer.cxx +++ b/MuonSpectrometer/MuonGeoModel/src/MultiLayer.cxx @@ -36,6 +36,11 @@ using namespace GeoXF; #define verbose_multilayer false +namespace { + // the tube number of a tube in a tubeLayer in encoded in the GeoSerialIdentifier (modulo maxNTubesPerLayer) + static constexpr unsigned int const maxNTubesPerLayer = 120; +} + namespace MuonGM { MultiLayer::MultiLayer(std::string n): DetectorElement(n), @@ -644,7 +649,7 @@ GeoFullPhysVol* MultiLayer::build() TRANSFUNCTION t = GeoTrf::TranslateY3D(0.)*GeoTrf::RotateX3D(90*Gaudi::Units::deg)* GeoTrf::TranslateX3D(tstart)*Pow(GeoTrf::TranslateY3D(1.0),f); GeoSerialTransformer* s = new GeoSerialTransformer(tV,&t,nt); - play->add(new GeoSerialIdentifier(100*(i+1)+nttot + 1)); + play->add(new GeoSerialIdentifier(maxNTubesPerLayer*(i+1)+nttot + 1)); play->add(s); nttot = nttot + nt; @@ -720,7 +725,7 @@ GeoFullPhysVol* MultiLayer::build() TRANSFUNCTION t = GeoTrf::TranslateY3D(dy)*GeoTrf::RotateX3D(90*Gaudi::Units::deg)* GeoTrf::TranslateX3D(tstart)*Pow(GeoTrf::TranslateY3D(1.0),f); GeoSerialTransformer* s = new GeoSerialTransformer(tV,&t,nt); - play->add(new GeoSerialIdentifier(100*(i+1)+nttot + 1)); + play->add(new GeoSerialIdentifier(maxNTubesPerLayer*(i+1)+nttot + 1)); play->add(s); nttot = nttot + nt; @@ -739,14 +744,13 @@ GeoFullPhysVol* MultiLayer::build() for (int i = 0; i < nrOfLayers; i++) { tstart = -mdtthickness/2. + yy[i]; lstart = -length/2. + xx[i]; - GeoGenfun::Variable K; GeoGenfun::GENFUNCTION f = tubePitch*K + lstart; TRANSFUNCTION t = GeoTrf::RotateX3D(90*Gaudi::Units::deg)*GeoTrf::TranslateX3D(tstart)* Pow(GeoTrf::TranslateY3D(1.0),f); GeoVPhysVol* tV = tubeVector[0]; GeoSerialTransformer* s = new GeoSerialTransformer(tV,&t,nrOfTubes); - play->add(new GeoSerialIdentifier(100*(i+1)+1)); + play->add(new GeoSerialIdentifier(maxNTubesPerLayer*(i+1)+1)); play->add(s); } } else { @@ -765,7 +769,7 @@ GeoFullPhysVol* MultiLayer::build() TRANSFUNCTION t = GeoTrf::RotateX3D(90*Gaudi::Units::deg)*GeoTrf::TranslateX3D(tstart)* Pow(GeoTrf::TranslateY3D(1.0),f); GeoSerialTransformer* s = new GeoSerialTransformer(tV,&t,nrTubesPerStep); - play->add(new GeoSerialIdentifier(100*(i+1)+j*nrTubesPerStep + 1)); + play->add(new GeoSerialIdentifier(maxNTubesPerLayer*(i+1)+j*nrTubesPerStep + 1)); play->add(s); } } diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx index 6b864b6b3c047a6383a89a6b26e2da0d5ddd35c0..accf5f9e257ff2713006f053a6601b1994b195f9 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonHoughPatternFinderTool.cxx @@ -27,6 +27,8 @@ using namespace TrkDriftCircleMath; +// maxNTubesPerLayer is included via DriftCircle.h + namespace Muon { MuonHoughPatternFinderTool::MuonHoughPatternFinderTool(const std::string& t,const std::string& n,const IInterface* p) : @@ -1474,7 +1476,7 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo int nhits = 0; for( ;it1!=it_end;++it1, nhits++ ) { sel[nhits] = 0; - int isort = 100*(4*(it1->id().ml()) + it1->id().lay()) + it1->id().tube(); + int isort = maxNTubesPerLayer*(4*(it1->id().ml()) + it1->id().lay()) + it1->id().tube(); dcsId[isort] = nhits; int ilay = 4*(it1->id().ml()) + it1->id().lay(); ATH_MSG_VERBOSE (" ilay " << ilay << " isort " << isort); @@ -1572,7 +1574,7 @@ std::pair<std::unique_ptr<MuonPatternCombinationCollection>, std::unique_ptr<Muo TrkDriftCircleMath::DCOnTrackIt itt_end = hitsOnLineSel.end(); int i = 0; for( ;itt!=itt_end;++itt,i++ ) { - int isort = 100*(4*(itt->id().ml()) + itt->id().lay()) + itt->id().tube(); + int isort = maxNTubesPerLayer*(4*(itt->id().ml()) + itt->id().lay()) + itt->id().tube(); if (dcsId.count(isort) == 1) { int dcsIndex = dcsId[isort]; sel[dcsIndex] = 1; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/src/MdtIntersectGeometry.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/src/MdtIntersectGeometry.cxx index 1758729faf6f46574f51e83a98207b36e2d7b447..d9e1f56b9bbf66b498651844fa91d497c354c51c 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/src/MdtIntersectGeometry.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonStationIntersectSvc/src/MdtIntersectGeometry.cxx @@ -15,9 +15,10 @@ #include "TrkDriftCircleMath/MdtId.h" #include <TString.h> // for Form +// maxNTubesPerLayer is included via MdtChamberGeometry.h -> DriftCircle.h + namespace Muon{ - MdtIntersectGeometry::MdtIntersectGeometry(const Identifier& chid, const MuonGM::MuonDetectorManager* detMgr, const MdtCondDbData* dbData, MsgStream* msg, const Muon::IMuonIdHelperSvc* idHelp) : m_chid(chid), m_mdtGeometry(nullptr), @@ -105,7 +106,7 @@ namespace Muon{ { if (ml<0 || ml>1) throw std::runtime_error(Form("File: %s, Line: %d\nMdtIntersectGeometry::tubeLength() - got called with ml=%d which is definitely out of range", __FILE__, __LINE__,ml)); if (layer<0 || layer>3) throw std::runtime_error(Form("File: %s, Line: %d\nMdtIntersectGeometry::tubeLength() - got called with layer=%d which is definitely out of range", __FILE__, __LINE__,layer)); - if (tube<0 || tube>119) throw std::runtime_error(Form("File: %s, Line: %d\nMdtIntersectGeometry::tubeLength() - got called with tube=%d which is definitely out of range", __FILE__, __LINE__,tube)); + if (tube<0 || tube>int(maxNTubesPerLayer-1)) throw std::runtime_error(Form("File: %s, Line: %d\nMdtIntersectGeometry::tubeLength() - got called with tube=%d which is definitely out of range", __FILE__, __LINE__,tube)); // shift by one to account for MuonGeoModel scheme int theTube = tube+1; int theLayer = layer+1; @@ -246,7 +247,7 @@ namespace Muon{ std::vector<int>::iterator it = tubes.begin(); for(int layer = 1; layer <= mydetEl->getNLayers(); layer++){ for(int tube = 1; tube <= mydetEl->getNtubesperlayer(); tube++){ - int want_id = layer*100 + tube; + int want_id = layer*maxNTubesPerLayer + tube; if (it != tubes.end() && *it == want_id) { ++it; } diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataMonAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataMonAlg.cxx index 8315c90638439c88e0f44035be0b61efa2c9a61d..cf5c608a021e56b1da4c7f653b2821b241144a45 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataMonAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataMonAlg.cxx @@ -48,6 +48,11 @@ #include <cmath> #include <sstream> +namespace { + // the tube number of a tube in a tubeLayer in encoded in the GeoSerialIdentifier (modulo maxNTubesPerLayer) + static constexpr unsigned int const maxNTubesPerLayer = 120; +} + enum {enumInner, enumMiddle, enumOuter, enumExtra}; struct MDTOverviewHistogramStruct { @@ -1375,8 +1380,8 @@ void MdtRawDataMonAlg::initDeadChannels(const MuonGM::MdtReadoutElement* mydetEl for(int tube = 1; tube <= mydetEl->getNtubesperlayer(); tube++){ bool tubefound = false; for(unsigned int kk=0; kk < cv->getNChildVols(); kk++) { - int tubegeo = cv->getIdOfChildVol(kk) % 100; - int layergeo = ( cv->getIdOfChildVol(kk) - tubegeo ) / 100; + int tubegeo = cv->getIdOfChildVol(kk) % maxNTubesPerLayer; + int layergeo = ( cv->getIdOfChildVol(kk) - tubegeo ) / maxNTubesPerLayer; if( tubegeo == tube && layergeo == layer ) { tubefound=true; break; diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx index 39aa54d3a6b36ca38170e2968aa0cd0c7ac3fd81..7b7cc0b1623283209e32558cb2a07ca44aa06813 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx @@ -51,6 +51,11 @@ #include <cmath> #include <sstream> +namespace { + // the tube number of a tube in a tubeLayer in encoded in the GeoSerialIdentifier (modulo maxNTubesPerLayer) + static constexpr unsigned int const maxNTubesPerLayer = 120; +} + float parESD1, parESD2, parESD3, parESD4; enum {enumBarrelA, enumBarrelC, enumEndCapA, enumEndCapC}; @@ -548,24 +553,7 @@ StatusCode MdtRawDataValAlg::fillHistograms() else {ATH_MSG_DEBUG("m_nummdtchamberswithHighOcc not in hist list!" );} m_MdtNHitsvsRpcNHits->Fill(nPrd,Nhitsrpc); - - // TotalNumber_of_MDT_hits_per_event with RPCtrig - /*if (mdtevents_RPCtrig){ - if(HasTrigBARREL()) mdtevents_RPCtrig->Fill(nPrdcut); - } - else { - ATH_MSG_DEBUG("mdtevents_RPCtrig not in hist list!" ); - } - - // TotalNumber_of_MDT_hits_per_event with TGCtrig - if (mdtevents_TGCtrig){ - if(HasTrigENDCAP()) mdtevents_TGCtrig->Fill(nPrdcut); - } - else { - ATH_MSG_DEBUG("mdtevents_TGCtrig not in hist list!" ); - } -*/ // TotalNumber_of_MDT_hits_per_event with cut on ADC if (m_mdteventscutLumi) m_mdteventscutLumi->Fill(nPrdcut); else {ATH_MSG_DEBUG("m_mdteventscutLumi not in hist list!" );} @@ -582,20 +570,7 @@ StatusCode MdtRawDataValAlg::fillHistograms() if (m_mdteventsLumi_big) m_mdteventsLumi_big->Fill(nPrd); else {ATH_MSG_DEBUG("m_mdteventsLumi_big not in hist list!" );} - /* if (m_numberOfEvents < 10000){ //only make this plot for first 10000 events - // TotalNumber_of_MDT_hits_vs_event_number with cut on ADC - if (mdthitsvseventnumcut) mdthitsvseventnumcut->SetBinContent(m_numberOfEvents, nPrdcut); - else {ATH_MSG_DEBUG("mdthitsvseventnumcut not in hist list!" );} - - // TotalNumber_of_MDT_hits_vs_event_number without cut on ADC - if (mdthitsvseventnum) mdthitsvseventnum->SetBinContent(m_numberOfEvents, nPrd); - else {ATH_MSG_DEBUG("mdthitsvseventnum not in hist list!" );} - }*/ - - //if(nPrdcut > 20000){ - //int realTime = m_time - m_firstTime; - if (m_mdtglobalhitstime) m_mdtglobalhitstime->Fill(m_time - m_firstTime); - //} + if (m_mdtglobalhitstime) m_mdtglobalhitstime->Fill(m_time - m_firstTime); // Number_of_Chambers_with_hits_per_event if (m_nummdtchamberswithhits) m_nummdtchamberswithhits->Fill(nColl); @@ -2022,7 +1997,7 @@ void MdtRawDataValAlg::initDeadChannels(const MuonGM::MdtReadoutElement* mydetEl std::vector<int>::iterator it = tubes.begin(); for(int layer = 1; layer <= mydetEl->getNLayers(); layer++){ for(int tube = 1; tube <= mydetEl->getNtubesperlayer(); tube++){ - int want_id = layer*100 + tube; + int want_id = layer*maxNTubesPerLayer + tube; if (it != tubes.end() && *it == want_id) { ++it; } diff --git a/Tracking/TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/MdtId.h b/Tracking/TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/MdtId.h index 01252a602f7a44da0b49bf18bbe43dc36dd27528..8f39f9550f2eaef40ae5d3db6dbb6cabf1200f77 100644 --- a/Tracking/TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/MdtId.h +++ b/Tracking/TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/MdtId.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef DCMATH_MDTID_H @@ -7,18 +7,23 @@ #include <ostream> +namespace { + // the tube number of a tube in a tubeLayer in encoded in the GeoSerialIdentifier (modulo maxNTubesPerLayer) + static constexpr unsigned int const maxNTubesPerLayer = 120; +} + namespace TrkDriftCircleMath { class MdtId { public: MdtId() : m_id(0) {} MdtId( int isBarrel, int ml, int lay, int tube ) { - m_id = 100000*isBarrel + 10000*ml+100*lay+tube; + m_id = 100000*isBarrel + 10000*ml+maxNTubesPerLayer*lay+tube; } int isBarrel() const { return m_id/100000; } int ml() const { return (m_id%100000)/10000; } - int lay() const { return (m_id%10000)/100; } - int tube() const { return m_id%100; } + int lay() const { return (m_id%10000)/maxNTubesPerLayer; } + int tube() const { return (m_id%10000)%maxNTubesPerLayer; } int value() const { return m_id; } bool operator==(const MdtId &other) const { @@ -29,7 +34,7 @@ namespace TrkDriftCircleMath { } private: - int m_id; + int m_id; }; //DR (clang32) operator<< to be defined inside the namespace diff --git a/Tracking/TrkUtilityPackages/TrkDriftCircleMath/src/MdtChamberGeometry.cxx b/Tracking/TrkUtilityPackages/TrkDriftCircleMath/src/MdtChamberGeometry.cxx index 6dce8c6487a8a9bfbabd8d267cc15e3c0c8766b5..b992d59ba4ecfabb198d548f73083a0ed4e37a8d 100644 --- a/Tracking/TrkUtilityPackages/TrkDriftCircleMath/src/MdtChamberGeometry.cxx +++ b/Tracking/TrkUtilityPackages/TrkDriftCircleMath/src/MdtChamberGeometry.cxx @@ -9,6 +9,8 @@ #include <algorithm> #include <TString.h> // for Form +// maxNTubesPerLayer is included via MdtChamberGeometry.h -> DriftCircle.h + namespace TrkDriftCircleMath { MdtChamberGeometry::MdtChamberGeometry() : @@ -79,9 +81,9 @@ namespace TrkDriftCircleMath { m_allTubes.clear(); if(m_nml<1 || m_nml>2) throw std::runtime_error(Form("File: %s, Line: %d\nMdtChamberGeometry::setGeometry() - got called with nml=%d which is definitely out of range", __FILE__, __LINE__,m_nml)); if(m_nlay<1 || m_nlay>4) throw std::runtime_error(Form("File: %s, Line: %d\nMdtChamberGeometry::setGeometry() - got called with nlay=%d which is definitely out of range", __FILE__, __LINE__,m_nlay)); - if(ntubesml0<1 || ntubesml0>120) throw std::runtime_error(Form("File: %s, Line: %d\nMdtChamberGeometry::setGeometry() - got called with ntubesml0=%d which is definitely out of range", __FILE__, __LINE__,ntubesml0)); + if(ntubesml0<1 || ntubesml0>maxNTubesPerLayer) throw std::runtime_error(Form("File: %s, Line: %d\nMdtChamberGeometry::setGeometry() - got called with ntubesml0=%d which is definitely out of range", __FILE__, __LINE__,ntubesml0)); // there can be chambers with only 1 multilayer. Then, the second multilayer will have ntubesml1=0 - if(ntubesml1>120) throw std::runtime_error(Form("File: %s, Line: %d\nMdtChamberGeometry::setGeometry() - got called with ntubesml1=%d which is definitely out of range", __FILE__, __LINE__,ntubesml1)); + if(ntubesml1>maxNTubesPerLayer) throw std::runtime_error(Form("File: %s, Line: %d\nMdtChamberGeometry::setGeometry() - got called with ntubesml1=%d which is definitely out of range", __FILE__, __LINE__,ntubesml1)); m_stationTheta = stationTheta; } diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.cxx index fc17297940ede325c619d1214bcb8dd2e849d04c..dcc551d27210245d3950f9ed9d13e639a832fb51 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtDataPreparator.cxx @@ -37,6 +37,11 @@ #include "AthenaBaseComps/AthMsgStreamMacros.h" #include "IRegionSelector/RegSelEnums.h" +namespace { + // the tube number of a tube in a tubeLayer in encoded in the GeoSerialIdentifier (modulo maxNTubesPerLayer) + static constexpr unsigned int const maxNTubesPerLayer = 120; +} + // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- @@ -1048,7 +1053,7 @@ void TrigL2MuonSA::MdtDataPreparator::initDeadChannels(const MuonGM::MdtReadoutE std::vector<int>::iterator it = tubes.begin(); for(int layer = 1; layer <= mydetEl->getNLayers(); layer++){ for(int tube = 1; tube <= mydetEl->getNtubesperlayer(); tube++){ - int want_id = layer*100 + tube; + int want_id = layer*maxNTubesPerLayer + tube; if (it != tubes.end() && *it == want_id) { ++it; }