diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/cmt/requirements b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/cmt/requirements new file mode 100644 index 0000000000000000000000000000000000000000..9932ee4f0fe5fd4c141670de9898798434c561da --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/cmt/requirements @@ -0,0 +1,74 @@ +package MuonD3PDMaker + +use AtlasPolicy AtlasPolicy-* + +private +use GaudiInterface GaudiInterface-* External +use AtlasHepMC AtlasHepMC-* External +use AtlasCLHEP AtlasCLHEP-* External +use AtlasBoost AtlasBoost-* External +#use AtlasROOT AtlasROOT-* External +use AthenaKernel AthenaKernel-* Control +use SGTools SGTools-* Control +use DataModel DataModel-* Control +use AthenaBaseComps AthenaBaseComps-* Control +use StoreGate StoreGate-* Control +use EventKernel EventKernel-* Event +use AtlasDetDescr AtlasDetDescr-* DetectorDescription +use EventInfo EventInfo-* Event +use xAODMuon xAODMuon-* Event/xAOD +use xAODTruth xAODTruth-* Event/xAOD +use xAODTracking xAODTracking-* Event/xAOD + +use D3PDMakerUtils D3PDMakerUtils-* PhysicsAnalysis/D3PDMaker +use TrkEventPrimitives TrkEventPrimitives-* Tracking/TrkEvent +use TrkExInterfaces TrkExInterfaces-* Tracking/TrkExtrapolation +use TrkToolInterfaces TrkToolInterfaces-* Tracking/TrkTools +use TrkGeometry TrkGeometry-* Tracking/TrkDetDescr +use TrkTrackSummary TrkTrackSummary-* Tracking/TrkEvent +use TrkPrepRawData TrkPrepRawData-* Tracking/TrkEvent +use muonEvent muonEvent-* Reconstruction/MuonIdentification +use FourMomUtils FourMomUtils-* Event +use TrkTruthData TrkTruthData-* Tracking/TrkEvent + +#for trigger information +use TriggerD3PDMaker TriggerD3PDMaker-* PhysicsAnalysis/D3PDMaker +use TrigMuonEvent TrigMuonEvent-* Trigger/TrigEvent +use TrigInDetEvent TrigInDetEvent-* Trigger/TrigEvent +use TrigObjectMatching TrigObjectMatching-* Trigger/TrigAnalysis +use AnalysisTriggerEvent AnalysisTriggerEvent-* PhysicsAnalysis/AnalysisTrigger + +#for truth info +use MCTruthClassifier MCTruthClassifier-* PhysicsAnalysis +use McParticleEvent McParticleEvent-* PhysicsAnalysis/TruthParticleID +use TrackRecord TrackRecord-* Simulation/G4Sim + +use AnalysisTriggerEvent AnalysisTriggerEvent-* PhysicsAnalysis/AnalysisTrigger + +#segment +use TrkSegment TrkSegment-* Tracking/TrkEvent +use MuonSegment MuonSegment-* MuonSpectrometer/MuonReconstruction/MuonRecEvent +use MuonIdHelpers MuonIdHelpers-* MuonSpectrometer + +# Muon EDM, Id helpers +use MuonRecHelperTools MuonRecHelperTools-* MuonSpectrometer/MuonReconstruction/MuonRecTools +#id to fixedid tool +use MuonCalibITools MuonCalibITools-* MuonSpectrometer/MuonCalib + +use MuonSimEvent MuonSimEvent-* MuonSpectrometer + +use MuonPrepRawData MuonPrepRawData-* MuonSpectrometer/MuonReconstruction/MuonRecEvent + +# Muon Truth Tools +use MuonTruthAlgs MuonTruthAlgs-* MuonSpectrometer +use MuonPattern MuonPattern-* MuonSpectrometer/MuonReconstruction/MuonRecEvent +use MuonRecToolInterfaces MuonRecToolInterfaces-* MuonSpectrometer/MuonReconstruction/MuonRecTools + +end_private + +library MuonD3PDMaker *.cxx components/*.cxx +apply_pattern component_library +apply_pattern declare_python_modules files="*.py" +apply_pattern declare_joboptions files="*.py" + + diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/ispellwords b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/ispellwords new file mode 100644 index 0000000000000000000000000000000000000000..e0911aa139b46d10498b60ecbb45773705373c55 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/ispellwords @@ -0,0 +1,780 @@ +personal_ws-1.1 en 779 +MuonTiming +MuonEFMGIndexAssoc +MUONAUTHORSFILLERTOOL +bir +MSTrkT +nMDTEOHits +GenParticle +doTruth +MGTrackDetails +TruthMuonContainer +bmf +egammaMCTruthClassifier +TileLayer +bml +calo +bof +ATH +bms +bol +bos +energyLossPar +kinem +EFInfoMuonKinematicsFiller +MuonTimingTool +MuonUtils +EDM +cmt +MuonExtrapolatorTool +TrkRIO +MboyMuonChamberT +MDTSimHitD +ees +nCSCPhiHoles +cov +DRVar +CSC +inputFileType +eil +DoGlobalSpaceTimePoints +ErrorCount +eis +TileCellEnergyLayer +DoMDTSpaceTimePoints +ptcone +EFTrigMatchType +muonTimingHook +Dohmae +eml +nTRTOutliers +AtlasID +hastrack +SGKey +eol +EFMEInfo +indices +CaloEvent +cxx +GeV +ESD +ConfigurableDb +tracklet +MomTruthEvent +FPE +isEndcap +egammaIDHitsExtraFillerTool +ElectronEFAssoc +athenaCommonFlags +mucbtrk +krasznaa +EFMEInfoIndex +DetStore +ChainPattern +yHitPos +ExtrapolatedTrackAssoc +FSR +Michiru +AtlasDetDescr +CaloMuonCollection +lowPt +nCSCUnspoiledEtaHits +nSCTHits +prasad +TrackRecordD +IOVDbSvc +MuonBits +FitQualityFillerTool +PDMakerUtils +momentumBalanceSignificance +nMDTBMHits +MuonRecHelperTools +CBInfoIndex +tuplename +Niels +Serhan +AuditRestart +stationName +EFTrkInfo +CaloNoiseTool +unextrapolated +WriteSegments +nCSCPhiHits +muid +MuID +efmepattern +TNtuple +DoTileTime +VxVertex +NCellEta +mdtIdHelper +RecExCommon +theNoiseTool +isLoose +MuonEFAssoc +TileCellEnergy +muon +MuGirlTrackAssoc +MCP +FourMomUtils +MuGirlSeg +InDetBroadInDetRotCreator +mdt +bool +ContainerKey +musp +innerExtrapolatedTrkTrack +MuonSegmentD +MuonTrkHitFillerTool +MuidMuonCollection +LOD +giveMSTrkT +TrkEventPrimitives +TrkParameters +AuditReinitialize +MuonSGKey +MuonSegments +MuonSegmentT +diag +Verena +FIXME +ChargeFillerTool +etadiff +bestMatch +Krasznahorkay +PrimaryTrackDiagonalCovarianceAtPV +outliers +TileCellSignLayer +mdtName +EFKinematics +nSCTDeadSensors +getter +muXX +nMDTEMHits +nRPCLayer +auth +TrkToolInterfaces +atlasDetId +MUONPARAMETERSFILLERTOOL +OFL +msExtrap +ExtrapolatedTrackBasics +endcap +MuonSegmentContainer +defineTriggerBits +QualityTool +CaloEnergy +PDG +MuonboySP +isCombinedMuon +GenParticleFillerTool +MuonEntryLayerFilter +PDs +SaveMETrackCovarianceOffDiagonal +IsolationPtCut +DetectorStore +PeV +SaveIDTrackCovarianceDiagonal +EFCB +barcode +MDTSimHitFillerTool +kineticEnergy +TileCalo +unspoilt +MooreSegments +Lashkar +ElectronEFTPAssoc +MooreSegmentT +tilecal +TileCal +muoncode +hasCB +nTGCPhiHoles +TrkMatchQuality +AthenaKernel +MUONELOSSSFILLERTOOL +AuditExecute +CombinedTrackBasics +doMuonBoyCSCTiming +PDMakerFlags +pos +OnlyPassed +TrigMuonD +ROIFillerTool +MuonIDIsolTool +nMDTHoles +Kagan +EFME +TileID +EFMG +EFTrackParticlePerigeeAssoc +seg +SCT +TruthMuonFiller +fileName +ExtrapolatedTrackDetails +reco +hasME +Coggeshall +hasMG +MuonSegmentFitQualityFillerTool +checkreq +TruthContainer +MuonOffDiaCovMatEleFillerTool +mboyseg +MboySeg +TileTimeLayer +rpc +MuonFixedId +tgc +OffDiaCovMatElements +McParticleEvent +PDMakerConf +SaveIDMuonHitSummary +TrkCovOffDiag +MuonTimingFillerTool +nRPCEtaHits +bugfix +Benitez +NCellPhi +snyder +SpaceTime +SGDataVector +WritePosition +FillerTool +src +MuonSegmentLocationFillerTool +energyDeposit +TrkTrackSummary +muonTrack +MuonTPAssoc +MuonWZTruthTool +AuditStop +MuonCB +CombinedTrackAssoc +caloLRLikelihood +STL +oldtimetool +stp +str +CellTime +egamma +trf +TPs +nTGCLayer +const +chamberT +chambert +trigmuonef +TrigMuonEF +TRT +mooreseg +MooreSeg +tSP +MuonEntryLayer +PerigeeCovDiagFillerTool +MCTruthClassifier +TruthParticle +muonCombSkelton +TrigInDetEvent +isStandAloneMuon +IncidentService +AlgTool +originalTrack +TileTimingFillerTool +SGTools +elif +TrackExtrapolatorToCalo +AuditEndRun +perfmon +MuonSegmentAuthorFillerTool +IDHitsBlock +MaxDR +MuonChargeFillerTool +muonSpectrometerTrkTrack +MuTagIMO +SavePrimaryTrackCovarianceDiagonal +tError +AuditStart +TrkParametersBase +MuonSpectrometer +TFile +genconf +genConf +addVariable +PerigeeFillerTool +nMDTHits +spacepoint +moore +subdetector +Willocq +mucomb +conddb +EFIDHitsExtra +cb +isSiliconAssociatedForwardMuon +etconeNoEm +SaveMSMuonHitSummary +xSP +CBKinematics +EE +EF +SelectionFlagging +eg +EI +efmgpattern +dr +isLowPtReconstructedMuon +eo +nprecisionLayers +MuonTruthPartAssoc +nprecisionHoleLayers +nCSCEtaHoles +ySP +ie +JA +AuditInitialize +fillCfgDb +InfoIndex +configurables +nucone +TauD +IP +cfgDb +zSP +nPixSharedHits +StudyTrackChamberT +StacoMuonCollection +TrigDec +MuFast +CaloNoiseToolDefault +ns +nphiLayers +config +AtlasDetectorID +MuonIdHelpers +TrkExInterfaces +nRPCPhiHoles +azimuthal +pT +PV +SG +px +py +egammaTrackParticleAssociationTool +pz +nTGCEtaHits +ESDs +sp +TrackTimingTool +EFIDHits +Haifeng +innerSegments +innerHits +qOverp +qoverp +TROOT +Wl +idToFixedIdTool +SpclMC +PrimaryTrackOffDiagonalCovarianceAtPV +Nectarios +CellEnergy +ErrorMax +expectBLayerHit +InDet +MuonCalibITools +MuonBetaFillerTool +streamName +InDetSlidingWindowTrackTimeToolMCP +Nektarios +ntuple +TrigMuonEFCbTrack +MuonEFTriggerObjectAssociationTool +AthenaHitsVector +TruthParticleContainer +ToolSvc +MuonEFInfoTriggerObjectAssociationTool +SaveIDTrackCovarianceOffDiagonal +TrackRecordFillerTool +isMuonLikelihood +XXXSimHit +EFTrk +TrackParticlePerigeeAssoc +TriggerD +MuonTruthClassificationFillerTool +nMDTBIHits +WriteEta +nPixHits +combmuonfeature +ToolTRT +nTRTHighTHits +TrackSelectorTool +StudyMuonTrackSP +DataModel +MyExtrapolator +MuGirlTrackBasics +StacoMuon +phidiff +particleEncoding +MUONBETASFILLERTOOL +MuonAllAuthorFillerTool +AtlasHitsVector +TriggerObjectAssociationTool +EFDetail +PDObject +idfp +TruthMuon +OtherMuonAnalysis +mbellomo +MuonCosmic +MuonEFTrigPattern +MDTid +scatteringCurvatureSignificance +MSonly +ntrigEtaHoleLayers +HepMC +pdgId +TrackParticle +studyTrackInCalo +middleSegments +tSOSs +TileCellRmsNoiseLayer +TrkCovDiag +TileCellRmsNoise +TemphasMuonSpectrometerTrackParticle +CombinedMuonFeatureFillerTool +AuditFinalize +AcceptMethods +EFInfo +ChainPatterns +TrkSpaceTimePoint +nMDTBIS +EtaHits +EFMEInfoTrackAssoc +globalTime +MuonAuthorFillerTool +exPV +AuditTools +DoTrigger +TrkInfo +nMDTEIHits +StoreGateSvc +barrelSectors +testFactory +DoSpaceTimePointDetails +TileEvent +nPixelDeadSensors +MatchTool +CombinedTrackFitDetails +MuonCombinedToolInterfaces +CaloEnergyLoss +DriftCircle +isDown +outerHits +muonCombSkeleton +TrkTrack +MDTSimHit +nTGCEtaHoles +CovarianceAtPV +IDTrackDiagonalCovarianceAtPV +CaloInterface +EFCBInfo +MuonHits +matchchi +MuonExtrapolated +TrigObjectMatching +MuonParameterFillerTool +nTRTHighTOutliers +nRPCPhiHits +CBTrackDetails +uint +MuonQualityFillerTool +nTRTHits +truthMuonAlgHook +SaveMETrackCovarianceDiagonal +ChangeLog +MuonSegment +DiaCovMatElements +MuonTriggerBits +muonboy +numberOfTRTDeadStraws +nphiHoleLayers +alsoFoundByCaloMuonId +MuGirl +mugirl +MuonSpectrometerHitSummary +tupleFileOutput +MuonLikelihoodFillerTool +trigmugirl +BlockName +blockname +MuonSpShowerFillerTool +CombinedTrackFitResults +Domae +Takechi +AnalysisTriggerEvent +efcbpattern +TileCellSign +ntrigEtaLayers +isRecoDown +muonEvent +AthenaBaseComps +Bellomo +combinedMuonTrkTrack +trigHits +MuonDiaCovMatEleFillerTool +CaloMuon +Stephane +MuidCo +PerigeeCovOffDiagFillerTool +ispellwords +ExtrapolatedTrackFitResults +SGKeyResolver +middleHits +CombinedMuonFeature +FilesInput +tsit +muonTruth +INav +DoTileSpaceTimePoints +numberOfSCTDeadSensors +Eldik +EFMGInfoIndex +tuple +tsos +tSOS +WriteHits +jobOptions +joboptions +nBLHits +TrackParticlePerigeeAssociationTool +MuonTrackCovarianceAtPV +vertices +ideta +scatteringNeighbourSignificance +emacs +MuidSA +endcapSectors +TruthMuonD +AllAuthor +allauthor +TrigMatchTool +METrackDetails +TileCellEta +stationEta +TruthMuons +ITrackToVertex +getGenPart +MuonAcceptMethodFillerTool +TileTime +MuonboySegmentT +outerSegments +driftRadius +nTRTDeadStraws +CaloTools +mdtEta +DoChamberT +functor +RegisterForContextService +EFMuonFillerTool +EFMGInfoTrackAssoc +PDMakerCoreComps +TrackInCaloTools +caloMuonIdTag +isTight +Destructor +mgseg +trackNumber +TruthAssoc +MuonSpShower +CBDetail +MCTruthClassifierConfig +TrackInCaloTimingTools +TruthClassification +compoent +Christoph +nTGCPhiHits +namespace +egammaEvent +isRecoTop +MatchThreshold +nGangedPixels +IncidentSvc +jobO +idExtrap +CellPhi +etcone +TrkFitQuality +FitQuality +isSegmentTaggedMuon +defineBlock +TrigMuonEvent +MboyEDMTool +SavePrimaryTrackCovarianceOffDiagonal +MUONALLAUTHORSFILLERTOOL +etCore +MuonMatchQualityFillerTool +TrigMuonEFTrack +CalibrationFilesPath +MuonComponentTrkParameters +nRPCEtaHoles +METrackOffDiagonalCovarianceAtPV +isMedium +MonitorSvc +nCSCEtaHits +stepLength +MuonGenParticleAssociationTool +MDTTime +TrkInfoInDet +MooreMuonChamberT +IDTrackOffDiagonalCovarianceAtPV +TrackRecord +StoreGate +MuonSimEvent +MuonELossFillerTool +TrigMuonEFInfo +alsoFoundByLowPt +ITrackInCaloTools +ToolHandle +ssnyder +isUp +DoTRTSpaceTimePoints +PDMaker +Outschoorn +TileConditions +TMath +GaudiHandle +nSCTSharedHits +ComponentTrkParameters +Benekos +idHelperTool +EFCBInfoIndex +MuonTriggerBitsFiller +muonD +MuonSpShowerD +scott +idphi +pseudorapidity +nBLSharedHits +MuonL +isCaloMuonId +TrackStateOnSurface +EFCBInfoTrackAssoc +muons +MuonSpShowers +MuonSeg +muonseg +ConstDataVector +numberOfPixelDeadSensors +MuonRIO +TileCellPhi +StationPhi +TruthMuonsToSG +Gaudi +TruthD +muRec +coverity +MuGirlTrackFitDetails +covariance +ConvertedMBoySegments +FourMomFillerTool +EvtStore +mdtPhi +EFMGInfo +nPixHoles +TrackRecordCollection +Massimiliano +AuditAlgorithms +dumpType +WriteDR +AuditBeginRun +MuGirlSegments +EventInfo +WriteEt +TileIdentifier +CBInfo +InnerExtrapolated +srivas +MuTag +PhiHits +ItemStreamer +CaloIdentifier +BasicInfo +energyLossType +initializeVariables +extrapolator +energyLossErr +Takeshi +OutputLevel +TrigMuonEFInfoTrack +MuonChamberT +inDetTrkTrack +Eloss +SpaceTimePoints +MuonTrackParticleAssociationTool +yPerigeePos +VxPrimaryCandidate +MuonTrackAtPVFiller +matchndof +nSCTHoles +trackToVertexTool +MUONACCEPTMETHODSFILLERTOOL +muonTrk +WritePt +boolean +EventKernel +nMDTBOHits +Kaneda +MuGirlTrackFitResults +clhep +informations +muonCombinedTimingTool +MonitorService +staco +calorimeter +MuonSpectrometerTrkSummart +cmath +locX +locY +CellLayer +MuonSpectrometerTrkSummary +MuonQualityTool +nMDTEEHits +MuonExtrapolations +CaloToolsConf +ndof +locAngleXZ +TrkSegment +locAngleYZ +WriteE +filledLayer +SpaceTimePoint +WriteM +nOutliersOnTrack +SegmentTimingTool +energyLossMeas +detID +MuonTruthAssociationTool +TrigInDetTrack +prodJobOFragment +InnerDetector +MuidMuon +allowMissing +TrackD +EventCommonD +MuonHitSummary +nMDTBEEHits +TrackInCalo +OnTrack +alaettin +ICaloNoiseTool +trackfit +GaudiKernel +AOD +ParametersAtPV +SimpleAssociation +TruthTool +METrackDiagonalCovarianceAtPV +bil +bim diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/CscPrepDataD3PDObject.py b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/CscPrepDataD3PDObject.py new file mode 100644 index 0000000000000000000000000000000000000000..087859689e801d704616375df44d1c2aebca2c4d --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/CscPrepDataD3PDObject.py @@ -0,0 +1,29 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +import MuonD3PDMaker +import D3PDMakerCoreComps +from D3PDMakerCoreComps.D3PDObject import D3PDObject +from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags + + +def makeD3PDObject (name, prefix, object_name, getter = None, + sgkey = 'CSC_Clusters', + typename = 'Muon::CscPrepDataContainer', + label = 'CscPrepData'): + if not getter: + from MuonD3PDMaker.MuonD3PDMakerConf import D3PD__CscPrepDataCollectionGetterTool + getter = D3PD__CscPrepDataCollectionGetterTool \ + (name + '_Getter', + SGKey = sgkey, + TypeName = typename, + Label = label) + getter.OutputLevel=1 + return D3PDMakerCoreComps.VectorFillerTool (name, + Prefix = prefix, + Getter = getter, + ObjectName = object_name, OutputLevel=1) + + +CscPrepDataD3PDObject = D3PDObject (makeD3PDObject, 'csc_', 'CscPrepDataD3PDObject') + +CscPrepDataD3PDObject.defineBlock (0, 'PrepData', MuonD3PDMaker.CscPrepDataFillerTool) diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MDTSimHitD3PDObject.py b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MDTSimHitD3PDObject.py new file mode 100644 index 0000000000000000000000000000000000000000..b33c3dbbccd62ce315409c7289173a4ca96e9fdf --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MDTSimHitD3PDObject.py @@ -0,0 +1,20 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +# $Id: MDTSimHitD3PDObject.py 508173 2012-06-29 11:47:55Z ssnyder $ + +# Import all needed modules: +import MuonD3PDMaker +import D3PDMakerCoreComps +from D3PDMakerCoreComps.D3PDObject import make_SGDataVector_D3PDObject +from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags +from D3PDMakerCoreComps.D3PDObject import D3PDObject + +# Create the configurable: +MDTSimHitD3PDObject = \ + make_SGDataVector_D3PDObject ('AtlasHitsVector<MDTSimHit>', + 'MDT_Hits', + 'mdt_hit_', 'MDTSimHitD3PDObject') + +# Add blocks to it: +MDTSimHitD3PDObject.defineBlock( 0, "BasicInfo", + MuonD3PDMaker.MDTSimHitFillerTool ) diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MdtPrepDataD3PDObject.py b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MdtPrepDataD3PDObject.py new file mode 100644 index 0000000000000000000000000000000000000000..4ddc187f4f44733c9fdce92e7150ffe174749bf9 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MdtPrepDataD3PDObject.py @@ -0,0 +1,29 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +import MuonD3PDMaker +import D3PDMakerCoreComps +from D3PDMakerCoreComps.D3PDObject import D3PDObject +from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags + + +def makeD3PDObject (name, prefix, object_name, getter = None, + sgkey = 'MDT_DriftCircles', + typename = 'Muon::MdtPrepDataContainer', + label = 'MdtPrepData'): + if not getter: + from MuonD3PDMaker.MuonD3PDMakerConf import D3PD__MdtPrepDataCollectionGetterTool + getter = D3PD__MdtPrepDataCollectionGetterTool \ + (name + '_Getter', + SGKey = sgkey, + TypeName = typename, + Label = label) + getter.OutputLevel=1 + return D3PDMakerCoreComps.VectorFillerTool (name, + Prefix = prefix, + Getter = getter, + ObjectName = object_name, OutputLevel=1) + + +MdtPrepDataD3PDObject = D3PDObject (makeD3PDObject, 'mdt_', 'MdtPrepDataD3PDObject') + +MdtPrepDataD3PDObject.defineBlock (0, 'PrepData', MuonD3PDMaker.MdtPrepDataFillerTool) diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MuonD3PDMakerFlags.py b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MuonD3PDMakerFlags.py new file mode 100644 index 0000000000000000000000000000000000000000..99526390656fa8110ccf4715bcfbdbc0b1c58439 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MuonD3PDMakerFlags.py @@ -0,0 +1,56 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +# +## @file MuonD3PDMaker/python/MuonD3PDMakerFlags.py +## @purpose Python module to hold common flags to configure MuonD3PDMaker JobOptions +## + + + +##----------------------------------------------------------------------------- +## Import +from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer +from AthenaCommon.JobProperties import jobproperties + +# General flags + +class doSingleMuons(JobProperty): + """ Turn on when using single muon samples + """ + statusOn=True + allowedTypes=['bool'] + StoredValue=False + +class doNewChainOnly(JobProperty): + """ Turn on when Muid and Staco chains are de-activated + """ + statusOn=True + allowedTypes=['bool'] + StoredValue=True + +class doSegmentTruth(JobProperty): + """ Turn on to dump segment truth information + """ + statusOn=True + allowedTypes=['bool'] + StoredValue=False + + + + +##----------------------------------------------------------------------------- +## Definition of the MuonD3PDMaker flag container + +class MuonD3PDMakerFlags(JobPropertyContainer): + """ The Muon D3PD flag container + """ + + +# add the reconstruction flags container to the top container +jobproperties.add_Container(MuonD3PDMakerFlags) + +jobproperties.MuonD3PDMakerFlags.add_JobProperty(doSingleMuons) +jobproperties.MuonD3PDMakerFlags.add_JobProperty(doNewChainOnly) +jobproperties.MuonD3PDMakerFlags.add_JobProperty(doSegmentTruth) + +MuonD3PDFlags=jobproperties.MuonD3PDMakerFlags diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MuonD3PDObject.py b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MuonD3PDObject.py new file mode 100644 index 0000000000000000000000000000000000000000..baf459c5baba1de7e50a2a64f89e22cb1560ad69 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MuonD3PDObject.py @@ -0,0 +1,626 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + + +import MuonD3PDMaker +import D3PDMakerCoreComps +import EventCommonD3PDMaker +import TriggerD3PDMaker +import TrackD3PDMaker +from TriggerD3PDMaker.defineTriggerBits import defineTriggerBits +from D3PDMakerCoreComps.D3PDObject import make_SGDataVector_D3PDObject +from D3PDMakerCoreComps.D3PDObject import DeferArg +from D3PDMakerCoreComps.SimpleAssociation import SimpleAssociation +from D3PDMakerCoreComps.IndexAssociation import IndexAssociation +from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags +from D3PDMakerCoreComps.ContainedVectorMultiAssociation import ContainedVectorMultiAssociation +import TrigMuonD3PDMaker +import TruthD3PDMaker + +from RecExConfig.RecFlags import rec +from RecExConfig.ObjKeyStore import cfgKeyStore + +from AthenaCommon.AppMgr import ToolSvc +from AthenaCommon.Include import include + +from MuonD3PDMaker.MuonD3PDMakerFlags import MuonD3PDFlags + + +MuonD3PDObject = \ + make_SGDataVector_D3PDObject ('DataVector<xAOD::Muon_v1>', + D3PDMakerFlags.MuonSGKey(), + 'mu_', 'MuonD3PDObject') + +MuonD3PDObject.defineBlock (0, 'Kinematics', + EventCommonD3PDMaker.FourMomFillerTool, + WriteRect = True, + WriteE = True, + WriteM = True) +MuonD3PDObject.defineBlock ( + 0, 'AllAuthor', + D3PDMakerCoreComps.AuxDataFillerTool, + Vars = ['allauthor = allAuthors']) + +MuonD3PDObject.defineBlock ( + 1, 'Authors', + D3PDMakerCoreComps.AuxDataFillerTool, + Vars = ['author']) +MuonD3PDObject.defineBlock (1, 'NumberOfSegments', + MuonD3PDMaker.MuonNumberOfSegmentsFillerTool) + +MuonD3PDObject.defineBlock ( + 1, 'Isolation', + D3PDMakerCoreComps.AuxDataFillerTool, + Vars = ['etcone20', + 'etcone30', + 'etcone40', + 'nucone20', + 'nucone30', + 'nucone40', + 'ptcone20', + 'ptcone30', + 'ptcone40', + 'etconeNoEm10', + 'etconeNoEm20', + 'etconeNoEm30', + 'etconeNoEm40', + 'scatteringCurvatureSignificance', + 'scatteringNeighbourSignificance', + 'momentumBalanceSignificance']) + +MuonD3PDObject.defineBlock ( + 1, 'CaloEnergyLoss', + D3PDMakerCoreComps.AuxDataFillerTool, + Vars = ['energyLossType']) +MuonD3PDObject.defineBlock ( + 1, 'MuonType', + D3PDMakerCoreComps.AuxDataFillerTool, + Vars = ['muonType']) + +MuonD3PDObject.defineBlock (2, 'MuonHitSummary', + MuonD3PDMaker.MuonTrkHitFillerTool) + +MuonD3PDObject.defineBlock ( + 2, 'MuonSpectrometerHitSummary', + D3PDMakerCoreComps.AuxDataFillerTool, + Vars = ['primarySector', + 'secondarySector', + 'innerSmallHits', + 'innerLargeHits', + 'middleSmallHits', + 'middleLargeHits', + 'outerSmallHits', + 'outerLargeHits', + 'extendedSmallHits', + 'extendedLargeHits', + 'innerSmallHoles', + 'innerLargeHoles', + 'middleSmallHoles', + 'middleLargeHoles', + 'outerSmallHoles', + 'outerLargeHoles', + 'extendedSmallHoles', + 'extendedLargeHoles', + 'phiLayer1Hits', + 'phiLayer2Hits', + 'phiLayer3Hits', + 'phiLayer4Hits', + 'etaLayer1Hits', + 'etaLayer2Hits', + 'etaLayer3Hits', + 'etaLayer4Hits', + 'phiLayer1Holes', + 'phiLayer2Holes', + 'phiLayer3Holes', + 'phiLayer4Holes', + 'etaLayer1Holes', + 'etaLayer2Holes', + 'etaLayer3Holes', + 'etaLayer4Holes', + ]) + +MuonD3PDObject.defineBlock ( + 4, 'MuonSpectrometerFieldIntegral', + D3PDMakerCoreComps.AuxDataFillerTool, + Vars = ['MSFieldIntegral = spectrometerFieldIntegral']) + + +############################################################################ +# TrackParticle variables +############################################################################ + + +MuonTPAssoc = SimpleAssociation \ + (MuonD3PDObject, + MuonD3PDMaker.MuonTrackParticleAssociationTool, + matched = 'hastrack', + blockname = 'TrkInfo') +MuonTPAssoc.defineBlock ( + 0, 'Charge', + TrackD3PDMaker.TrackParticleChargeFillerTool) +TrackParticlePerigeeAssoc = SimpleAssociation \ + (MuonTPAssoc, + TrackD3PDMaker.TrackParticlePerigeeAtOOAssociationTool, + prefix = 'track', + blockname = 'TrackParticlePerigeeAssoc') +TrackParticlePerigeeAssoc.defineBlock (1, 'TrkParameters', + TrackD3PDMaker.PerigeeFillerTool) + +TrackParticleCovarAssoc = SimpleAssociation (TrackParticlePerigeeAssoc, + TrackD3PDMaker.PerigeeCovarianceAssociationTool, + blockname = 'TrackParticleCovarAssoc') +TrackParticleCovarAssoc.defineBlock (1, 'TrkCovDiag', + TrackD3PDMaker.CovarianceFillerTool, + IsTrackPerigee = True, + Error = False, + DiagCovariance = True) +TrackParticleCovarAssoc.defineBlock (2, 'TrkCovOffDiag', + TrackD3PDMaker.CovarianceFillerTool, + IsTrackPerigee = True, + Error = False, + OffDiagCovariance = True) + +MuonTPAssoc.defineBlock ( + 2, 'TrkFitQuality', + D3PDMakerCoreComps.AuxDataFillerTool, + Vars = ['chi2 = chiSquared', + 'ndof = numberDoF'], + prefix = 'trackfit') + + +MuonIDTPAssoc = SimpleAssociation \ + (MuonD3PDObject, + MuonD3PDMaker.MuonTrackParticleAssociationTool, + blockname = 'TrkInfoInDet', + Type = 'InDet') + +if not MuonD3PDFlags.doSingleMuons(): + # + # Impact parameter variables. Use the ID track for this. + # These are likely not very useful for standalone muons anyway. + # + from TrackD3PDMaker.TrackParticleImpactParameters \ + import TrackParticleImpactParameters + TrackParticleImpactParameters (MuonIDTPAssoc) + + +MuonPVPerigeeAssoc = SimpleAssociation ( + MuonTPAssoc, + TrackD3PDMaker.TrackParticlePerigeeAtPVAssociationTool, + suffix = '_exPV', + blockname = 'MuonPVPerigeeAssoc') +MuonPVPerigeeAssoc.defineBlock ( + 1, 'ParametersAtPV', + TrackD3PDMaker.PerigeeFillerTool) +MuonPVCovarAssoc = SimpleAssociation ( + MuonPVPerigeeAssoc, + TrackD3PDMaker.PerigeeCovarianceAssociationTool, + blockname = 'MuonPVCovarAssoc') +MuonPVCovarAssoc.defineBlock ( + 1, 'PrimaryTrackDiagonalCovarianceAtPV', + TrackD3PDMaker.CovarianceFillerTool, + IsTrackPerigee = True, + Error = True) +MuonPVCovarAssoc.defineBlock ( + 1, 'PrimaryTrackOffDiagonalCovarianceAtPV', + TrackD3PDMaker.CovarianceFillerTool, + IsTrackPerigee = True, + Error = False, + OffDiagCovariance = True) + +MuonCBTPAssoc = SimpleAssociation \ + (MuonD3PDObject, + MuonD3PDMaker.MuonTrackParticleAssociationTool, + Type = 'Combined', + prefix = 'cb_', + blockname = 'CBTrkInfo') +MuonCBPVPerigeeAssoc = SimpleAssociation ( + MuonCBTPAssoc, + TrackD3PDMaker.TrackParticlePerigeeAtPVAssociationTool, + suffix = '_exPV', + blockname = 'MuonCBPVPerigeeAssoc') +MuonCBPVPerigeeAssoc.defineBlock ( + 1, 'CBParametersAtPV', + TrackD3PDMaker.PerigeeFillerTool) + +MuonIDTPAssoc = SimpleAssociation \ + (MuonD3PDObject, + MuonD3PDMaker.MuonTrackParticleAssociationTool, + Type = 'InDet', + prefix = 'id_', + blockname = 'IDTrkInfo') +MuonIDPerigeeAssoc = SimpleAssociation ( + MuonIDTPAssoc, + TrackD3PDMaker.TrackParticlePerigeeAtOOAssociationTool, + blockname = 'MuonIDPerigeeAssoc') +MuonIDPerigeeAssoc.defineBlock ( + 1, 'IDParameters', + TrackD3PDMaker.PerigeeFillerTool) +MuonIDPVPerigeeAssoc = SimpleAssociation ( + MuonIDTPAssoc, + TrackD3PDMaker.TrackParticlePerigeeAtPVAssociationTool, + suffix = '_exPV', + blockname = 'MuonIDPVPerigeeAssoc') +MuonIDPVPerigeeAssoc.defineBlock ( + 1, 'IDParametersAtPV', + TrackD3PDMaker.PerigeeFillerTool) + +MuonIDPVCovarAssoc = SimpleAssociation ( + MuonIDPVPerigeeAssoc, + TrackD3PDMaker.PerigeeCovarianceAssociationTool, + blockname = 'MuonIDPVCovarAssoc') +MuonIDPVCovarAssoc.defineBlock ( + 2, 'IDTrackDiagonalCovarianceAtPV', + TrackD3PDMaker.CovarianceFillerTool, + IsTrackPerigee = True, + Error = True) +MuonIDPVCovarAssoc.defineBlock ( + 3, 'IDTrackOffDiagonalCovarianceAtPV', + TrackD3PDMaker.CovarianceFillerTool, + IsTrackPerigee = True, + Error = False, + OffDiagCovariance = True) + + +MuonMETPAssoc = SimpleAssociation \ + (MuonD3PDObject, + MuonD3PDMaker.MuonTrackParticleAssociationTool, + Type = 'MuonSpectrometer', + prefix = 'me_', + blockname = 'METrkInfo') +MuonMEPerigeeAssoc = SimpleAssociation ( + MuonMETPAssoc, + TrackD3PDMaker.TrackParticlePerigeeAtOOAssociationTool) +MuonMEPerigeeAssoc.defineBlock ( + 1, 'MEParametersAt', + TrackD3PDMaker.PerigeeFillerTool) +MuonMEPVPerigeeAssoc = SimpleAssociation ( + MuonMETPAssoc, + TrackD3PDMaker.TrackParticlePerigeeAtPVAssociationTool, + suffix = '_exPV', + blockname = 'MuonMEPVPerigeeAssoc') +MuonMEPVPerigeeAssoc.defineBlock ( + 1, 'MEParametersAtPV', + TrackD3PDMaker.PerigeeFillerTool) + +MuonMEPVCovarAssoc = SimpleAssociation ( + MuonMEPVPerigeeAssoc, + TrackD3PDMaker.PerigeeCovarianceAssociationTool, + blockname = 'MuonMEPVCovarAssoc') +MuonMEPVCovarAssoc.defineBlock ( + 2, 'METrackDiagonalCovarianceAtPV', + TrackD3PDMaker.CovarianceFillerTool, + IsTrackPerigee = True, + Error = True) +MuonMEPVCovarAssoc.defineBlock ( + 3, 'METrackOffDiagonalCovarianceAtPV', + TrackD3PDMaker.CovarianceFillerTool, + IsTrackPerigee = True, + Error = False, + OffDiagCovariance = True) + + +############################################################################ +# Truth matching +############################################################################ +if rec.doTruth(): + from TruthD3PDMaker.MCTruthClassifierConfig \ + import D3PDMCTruthClassifier + + MuonD3PDObject.defineBlock (1, 'TruthClassification', + MuonD3PDMaker.MuonTruthClassificationFillerTool, + Classifier = D3PDMCTruthClassifier) + + MuonTruthPartAssoc = SimpleAssociation \ + (MuonD3PDObject, + MuonD3PDMaker.MuonGenParticleAssociationTool, + Classifier = D3PDMCTruthClassifier, + blockname = 'TruthAssoc', + DRVar = 'dr') + MuonTruthPartAssoc.defineBlock (0, 'TruthKin', + EventCommonD3PDMaker.FourMomFillerTool, + WriteE = True, + WriteM = False, + prefix = 'truth_') + MuonTruthPartAssoc.defineBlock (0, 'Truth', + TruthD3PDMaker.TruthParticleFillerTool, + PDGIDVariable = 'type', + prefix = 'truth_') + MuonTruthPartMotherAssoc = SimpleAssociation \ + (MuonTruthPartAssoc, + D3PDMakerCoreComps.FirstAssociationTool, + Associator = TruthD3PDMaker.TruthParticleParentAssociationTool + ('MuonTruthPartMotherAssoc2'), + blockname = 'MuonTruthPartMotherAssoc', + prefix = 'truth_mother') + MuonTruthPartMotherAssoc.defineBlock (0, 'MotherTruth', + TruthD3PDMaker.TruthParticleFillerTool, + PDGIDVariable = 'type') + MuonTruthPartAssoc.defineBlock (0, 'TruthAssocIndex', + D3PDMakerCoreComps.IndexFillerTool, + prefix = 'mc_', + Target = 'mc_') + + +# ############################################################################ +# # Trigger matching +# ############################################################################ + +# ############################# Event Filter ################################# +# if D3PDMakerFlags.DoTrigger(): + +# defineTriggerBits (MuonD3PDObject, 0, +# ['L1_MU0', +# 'EF_L1ItemStreamer_L1_MU0', +# 'EF_mu4', +# 'L2_mu4', +# 'L2_mu4_MSonly', +# 'EF_mu4_MSonly', +# 'EF_mu6', +# 'L2_mu6', +# 'L1_MU6', +# 'L2_mu6_MSonly', +# 'EF_mu6_MSonly', +# 'EF_mu10', +# 'L2_mu10', +# 'L1_MU10', +# 'EF_mu10i_loose', +# 'L2_mu10i_loose', +# 'EF_mu13', +# 'L2_mu13', +# 'EF_mu20', +# 'EF_mu20_MSonly', +# 'L2_mu20', +# 'L2_mu20_MSonly', +# 'L1_MU20', +# 'EF_2mu4', +# 'L2_2mu4', +# 'L1_2MU4', +# 'EF_mu6', +# 'EF_mu4', +# 'EF_2mu10', +# ]) +# defineTriggerBits (MuonD3PDObject, 1, +# D3PDMakerFlags.MuonL1TrigPattern()) +# defineTriggerBits (MuonD3PDObject, 1, +# D3PDMakerFlags.MuonL2TrigPattern()) +# defineTriggerBits (MuonD3PDObject, 1, +# D3PDMakerFlags.MuonEFTrigPattern()) + +# ################################################################################### +# # Event filter. Associations to combined muons (EF_muXX / muid type trigger muons) +# ################################################################################### +# efcbpattern = 'EF_mu[0-9]*$|EF_mu[0-9]*_tight$' +# efmepattern = 'EF_mu[0-9]*_MSonly$|EF_mu[0-9]*_MSonly_tight$' +# efmgpattern = 'EF_mu[0-9]*_MG$|EF_mu[0-9]*_MG_tight$' + +# MuonEFCBIndexAssoc = IndexAssociation \ +# (MuonD3PDObject, +# MuonD3PDMaker.MuonEFInfoTriggerObjectAssociationTool, +# target = 'trig_EF_trigmuonef_', +# prefix = 'EFCB_', +# level = 11, +# blockname = 'EFCBInfoIndex', +# EFTrigMatchType = "CB", +# # matched = 'matched', +# WriteDR = False, +# ChainPattern = efcbpattern) + + +# MuonEFCBAssoc = SimpleAssociation \ +# (MuonD3PDObject, +# MuonD3PDMaker.MuonEFInfoTriggerObjectAssociationTool, +# EFTrigMatchType = "CB", +# matched = 'matched', +# blockname = 'EFCBInfo', +# level = 1, +# prefix = 'EFCB_', +# ChainPattern = efcbpattern) + +# CBInfoTrackAssoc = \ +# ContainedVectorMultiAssociation( MuonEFCBAssoc, +# TrigMuonD3PDMaker.TrigMuonEFInfoTrackAssociationTool, +# prefix = "", blockname = "EFCBInfoTrackAssoc" ) +# CBInfoTrackAssoc.defineBlock( 0, "CBTrackDetails", +# TrigMuonD3PDMaker.TrigMuonEFInfoTrackFillerTool ) +# CombinedTrackAssoc = \ +# SimpleAssociation( CBInfoTrackAssoc, +# TrigMuonD3PDMaker.TrigMuonEFInfoTrackCombinedTrackAssociationTool, +# matched = "hasCB", blockname = "CombinedTrackAssoc", prefix = "" ) +# CombinedTrackAssoc.defineBlock( 1, "CombinedTrackBasics", +# EventCommonD3PDMaker.FourMomFillerTool, +# WriteM = False ) +# CombinedTrackAssoc.defineBlock( 12, "CombinedTrackFitResults1", +# TrigMuonD3PDMaker.TrigMuonEFTrackFillerTool, +# SaveFitResults = True ) +# CombinedTrackAssoc.defineBlock( 13, "CombinedTrackFitResults2", +# TrigMuonD3PDMaker.TrigMuonEFCbTrackFillerTool, +# SaveFitResults = True ) +# CombinedTrackAssoc.defineBlock( 13, "CombinedTrackFitDetails1", +# TrigMuonD3PDMaker.TrigMuonEFTrackFillerTool, +# SaveHitInfo = True ) +# CombinedTrackAssoc.defineBlock( 13, "CombinedTrackFitDetails2", +# TrigMuonD3PDMaker.TrigMuonEFCbTrackFillerTool, +# SaveHitInfo = True ) + + +# ################################################################################### +# # Event filter. Associations to MuGirl muons (EF_muXX_MG type trigger muons) +# ################################################################################### +# MuonEFMGIndexAssoc = IndexAssociation \ +# (MuonD3PDObject, +# MuonD3PDMaker.MuonEFInfoTriggerObjectAssociationTool, +# target = 'trig_EF_trigmugirl_', +# prefix = 'EFMG_', +# level = 11, +# blockname = 'EFMGInfoIndex', +# EFTrigMatchType = "MG", +# # matched = 'matched', +# WriteDR = False, +# ChainPattern = efmgpattern) # D3PDMakerFlags.MuonEFTrigPattern()) + +# MuonEFMGAssoc = SimpleAssociation \ +# (MuonD3PDObject, +# MuonD3PDMaker.MuonEFInfoTriggerObjectAssociationTool, +# EFTrigMatchType = "MG", +# matched = 'matched', +# blockname = 'EFMGInfo', +# level = 1, +# prefix = 'EFMG_', +# ChainPattern = efmgpattern) #D3PDMakerFlags.MuonEFTrigPattern()) + +# MGInfoTrackAssoc = \ +# ContainedVectorMultiAssociation( MuonEFMGAssoc, +# TrigMuonD3PDMaker.TrigMuonEFInfoTrackAssociationTool, +# prefix = "", blockname = "EFMGInfoTrackAssoc" ) +# MGInfoTrackAssoc.defineBlock( 0, "MGTrackDetails", +# TrigMuonD3PDMaker.TrigMuonEFInfoTrackFillerTool ) +# # Associate combined TrigMuonEFCbTrack objects to the TrigMuonEFInfoTrack objects: +# MuGirlTrackAssoc = \ +# SimpleAssociation( MGInfoTrackAssoc, +# TrigMuonD3PDMaker.TrigMuonEFInfoTrackCombinedTrackAssociationTool, +# matched = "hasMG", blockname = "MuGirlTrackAssoc", prefix = "" ) +# MuGirlTrackAssoc.defineBlock( 1, "MuGirlTrackBasics", +# EventCommonD3PDMaker.FourMomFillerTool, +# WriteM = False ) +# MuGirlTrackAssoc.defineBlock( 12, "MuGirlTrackFitResults1", +# TrigMuonD3PDMaker.TrigMuonEFTrackFillerTool, +# SaveFitResults = True ) +# MuGirlTrackAssoc.defineBlock( 13, "MuGirlTrackFitResults2", +# TrigMuonD3PDMaker.TrigMuonEFCbTrackFillerTool, +# SaveFitResults = True ) +# MuGirlTrackAssoc.defineBlock( 13, "MuGirlTrackFitDetails1", +# TrigMuonD3PDMaker.TrigMuonEFTrackFillerTool, +# SaveHitInfo = True ) +# MuGirlTrackAssoc.defineBlock( 13, "MuGirlTrackFitDetails2", +# TrigMuonD3PDMaker.TrigMuonEFCbTrackFillerTool, +# SaveHitInfo = True ) + +# ################################################################################### +# # Event filter. Associations to MSonly muons (EF_muXX_MSonly type trigger muons) +# ################################################################################### +# MuonEFMEIndexAssoc = IndexAssociation \ +# (MuonD3PDObject, +# MuonD3PDMaker.MuonEFInfoTriggerObjectAssociationTool, +# target = 'trig_EF_trigmuonef_', +# prefix = 'EFME_', +# level = 11, +# blockname = 'EFMEInfoIndex', +# EFTrigMatchType = "ME", +# # matched = 'matched', +# WriteDR = False, +# ChainPattern = efmepattern) #D3PDMakerFlags.MuonEFTrigPattern()) + +# MuonEFMEAssoc = SimpleAssociation \ +# (MuonD3PDObject, +# MuonD3PDMaker.MuonEFInfoTriggerObjectAssociationTool, +# EFTrigMatchType = "ME", +# matched = 'matched', +# blockname = 'EFMEInfo', +# level = 1, +# prefix = 'EFME_', +# ChainPattern = efmepattern) #D3PDMakerFlags.MuonEFTrigPattern()) + +# MEInfoTrackAssoc = \ +# ContainedVectorMultiAssociation( MuonEFMEAssoc, +# TrigMuonD3PDMaker.TrigMuonEFInfoTrackAssociationTool, +# prefix = "", blockname = "EFMEInfoTrackAssoc" ) +# MEInfoTrackAssoc.defineBlock( 0, "METrackDetails", +# TrigMuonD3PDMaker.TrigMuonEFInfoTrackFillerTool ) +# # Associate spectrometer-extrapolated TrigMuonEFTrack objects to the TrigMuonEFInfoTrack objects: +# ExtrapolatedTrackAssoc = \ +# SimpleAssociation( MEInfoTrackAssoc, +# TrigMuonD3PDMaker.TrigMuonEFInfoTrackExtrapolatedTrackAssociationTool, +# matched = "hasME", blockname = "ExtrapolatedTrackAssoc", prefix = "" ) +# ExtrapolatedTrackAssoc.defineBlock( 1, "ExtrapolatedTrackBasics", +# EventCommonD3PDMaker.FourMomFillerTool, +# WriteM = False ) +# ExtrapolatedTrackAssoc.defineBlock( 12, "ExtrapolatedTrackFitResults", +# TrigMuonD3PDMaker.TrigMuonEFTrackFillerTool, +# SaveFitResults = True) +# ExtrapolatedTrackAssoc.defineBlock( 13, "ExtrapolatedTrackDetails", +# TrigMuonD3PDMaker.TrigMuonEFTrackFillerTool, +# SaveHitInfo = True ) + + +# ############################# Level Two ###################################### +# MuonL2IndexAssoc = IndexAssociation \ +# (MuonD3PDObject, +# MuonD3PDMaker.MuonL2TriggerObjectAssociationTool, +# target = 'trig_L2_combmuonfeature_', +# prefix = 'L2CB_', +# level = 11, +# blockname = 'L2CBInfoIndex', +# WriteDR = False, +# ChainPattern = D3PDMakerFlags.MuonL2TrigPattern()) + +# MuonL2Assoc = SimpleAssociation \ +# (MuonD3PDObject, +# MuonD3PDMaker.MuonL2TriggerObjectAssociationTool, +# level = 1, +# matched = 'matched', +# blockname = 'L2CBInfo', +# prefix = 'L2CB_', +# ChainPattern = D3PDMakerFlags.MuonL2TrigPattern()) +# MuonL2Assoc.defineBlock (1, 'L2CBKinematics', +# EventCommonD3PDMaker.FourMomFillerTool, +# WriteM = False) +# MuonL2Assoc.defineBlock (1, 'L2CBDetail1', +# MuonD3PDMaker.L2MuonCB1FillerTool) +# MuonL2Assoc.defineBlock (2, 'L2CBDetail2', +# MuonD3PDMaker.L2MuonCB2FillerTool) + +# ############################# Level One ###################################### +# MuonL1IndexAssoc = IndexAssociation \ +# (MuonD3PDObject, +# MuonD3PDMaker.MuonL1TriggerObjectAssociationTool, +# target = 'trig_L1_mu_', +# prefix = 'L1_', +# level = 11, +# MaxDR = 0.5, +# blockname = 'L1InfoIndex', +# WriteDR = False, +# ChainPattern = D3PDMakerFlags.MuonL1TrigPattern()) + +# MuonL1Assoc = SimpleAssociation \ +# (MuonD3PDObject, +# MuonD3PDMaker.MuonL1TriggerObjectAssociationTool, +# level = 1, +# matched = 'matched', +# blockname = 'L1Info', +# MaxDR = 0.5, +# prefix = 'L1_', +# ChainPattern = D3PDMakerFlags.MuonL1TrigPattern()) +# MuonL1Assoc.defineBlock (1, 'L1Kinematics', +# EventCommonD3PDMaker.FourMomFillerTool, +# WriteM = False) +# MuonL1Assoc.defineBlock (2, 'L1Detail2', +# TriggerD3PDMaker.Muon_ROIFillerTool, +# WriteDecodedInfo = True) + + +# MuonIDOrPTPAssoc = SimpleAssociation \ +# (MuonD3PDObject, +# MuonD3PDMaker.MuonTrackParticleAssociationTool, +# blockname = 'TrkInfoInDetOrPrimary', +# Type = 'InDetOrPrimary') + +# from TrackD3PDMaker.trackIsolationTool import \ +# trackIsolationTool_500MeV, trackIsolationTool_trkelstyle + +# from TrackD3PDMaker.addTrackIsolationCones import addTrackIsolationCones +# addTrackIsolationCones (MuonIDOrPTPAssoc, +# 'Isolation_500MeV', +# sizes = [0.2, 0.3, 0.4], +# level = 999, +# suffix = '_trk500MeV', +# isolationTool=DeferArg('tool()', +# tool=trackIsolationTool_500MeV)) +# addTrackIsolationCones (MuonIDOrPTPAssoc, +# 'Isolation_elstyletracks', +# sizes = [0.2, 0.3, 0.4], +# level = 999, +# suffix = '_trkelstyle', +# isolationTool=DeferArg('tool()', +# tool=trackIsolationTool_trkelstyle)) + + diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MuonParameterFillerTool.py b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MuonParameterFillerTool.py new file mode 100644 index 0000000000000000000000000000000000000000..f90e967060e6fa8df12b04948ffa04dbdfea8bd3 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MuonParameterFillerTool.py @@ -0,0 +1,17 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +from MuonD3PDMaker import MuonD3PDMakerConf + + + +class MuonParameterFillerTool (MuonD3PDMakerConf.D3PD__MuonParameterFillerTool): + def __init__ (self, + name, + Parameters = [], + **kwargs): + Parameters = [str(x) for x in Parameters] + MuonD3PDMakerConf.D3PD__MuonParameterFillerTool.__init__ (self, + name, + Parameters = Parameters, + **kwargs) + diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MuonSegmentD3PDObject.py b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MuonSegmentD3PDObject.py new file mode 100644 index 0000000000000000000000000000000000000000..54557190d10f58d2a36a750ff936f1be71f001e6 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MuonSegmentD3PDObject.py @@ -0,0 +1,38 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +import MuonD3PDMaker +import D3PDMakerCoreComps +import EventCommonD3PDMaker +from D3PDMakerCoreComps.D3PDObject import make_SGDataVector_D3PDObject +from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags + +from MuonD3PDMaker.MuonD3PDMakerFlags import MuonD3PDFlags +from RecExConfig.RecFlags import rec + +#from MuonD3PDMaker.MuonD3PDMakerConf import MuonWZTruthTool +#TruthTool = MuonWZTruthTool() +#ToolSvc += TruthTool + +MuonSegmentD3PDObject = \ + make_SGDataVector_D3PDObject ('Trk::SegmentCollection', + D3PDMakerFlags.MuonSegmentSGKey(), + 'mu_seg_', 'MuonSegmentD3PDObject') + +MuonSegmentD3PDObject.defineBlock (1, 'Location', + MuonD3PDMaker.MuonSegmentLocationFillerTool) +MuonSegmentD3PDObject.defineBlock (1, 'Author', + MuonD3PDMaker.MuonSegmentAuthorFillerTool) +MuonSegmentD3PDObject.defineBlock (1, 'FitQuality', + MuonD3PDMaker.MuonSegmentFitQualityFillerTool) + +# Include the chamber t0 for the relevant MuonSegment collection, leave out the other +MuonSegmentD3PDObject.defineBlock (1, 'MuonboySegmentT0', + MuonD3PDMaker.MuonSegmentT0FillerTool,doMuonBoyCSCTiming=True) + +MuonSegmentD3PDObject.defineBlock (1, 'MooreSegmentT0', + MuonD3PDMaker.MuonSegmentT0FillerTool,doMuonBoyCSCTiming=False) + +if rec.doTruth() and MuonD3PDFlags.doSegmentTruth(): + MuonSegmentD3PDObject.defineBlock (1, 'PatternTruthCombination', + MuonD3PDMaker.MuonSegmentTruthFillerTool) + diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MuonSegmentTruthD3PDObject.py b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MuonSegmentTruthD3PDObject.py new file mode 100644 index 0000000000000000000000000000000000000000..e8cfa5bc2b1e0cc1bed662a63281f75632cdebfc --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MuonSegmentTruthD3PDObject.py @@ -0,0 +1,19 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +import MuonD3PDMaker +import D3PDMakerCoreComps +import EventCommonD3PDMaker +from D3PDMakerCoreComps.D3PDObject import make_SGDataVector_D3PDObject +from D3PDMakerCoreComps.SimpleAssociation import SimpleAssociation +from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags + +from RecExConfig.RecFlags import rec + +MuonSegmentTruthD3PDObject = \ + make_SGDataVector_D3PDObject ('Trk::SegmentCollection', + 'MuonSegments', + 'mu_segmentTruth_', 'MuonSegmentTruthD3PDObject') + +MuonSegmentTruthD3PDObject.defineBlock (1, 'PatternTruthCombination', + MuonD3PDMaker.MuonSegmentTruthFillerTool) + diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MuonSpShowerD3PDObject.py b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MuonSpShowerD3PDObject.py new file mode 100644 index 0000000000000000000000000000000000000000..bf3d1f64eb57d3a87f98b2dc2dba25840fdffd8a --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MuonSpShowerD3PDObject.py @@ -0,0 +1,38 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +# $Id$ +# +# @file MuonD3PDMaker/python/MuonSpShowerD3PDObject.py +# @author Michiru Kaneda <Michiru.Kaneda@cern.ch> +# @date Jan., 2011 +# @brief MuonSpShower filler tool +# + +import D3PDMakerCoreComps +from D3PDMakerCoreComps.D3PDObject import make_SGDataVector_D3PDObject +from MuonD3PDMaker.MuonD3PDMakerConf import D3PD__MuonSpShowerFillerTool as MuonSpShowerFillerTool + +MuonSpShowerD3PDObject = \ + make_SGDataVector_D3PDObject ('Rec::MuonSpShowerContainer', + 'MuonSpShowers', + 'musp_', 'MuonSpShowerD3PDObject') + +MuonSpShowerD3PDObject.defineBlock(0, 'Position', + MuonSpShowerFillerTool, + WritePosition = True, + WriteHits = False, + WriteSegments = False) + +MuonSpShowerD3PDObject.defineBlock(1, 'Hits', + MuonSpShowerFillerTool, + WritePosition = False, + WriteHits = True, + WriteSegments = False) + +MuonSpShowerD3PDObject.defineBlock(1, 'Segments', + MuonSpShowerFillerTool, + WritePosition = False, + WriteHits = False, + WriteSegments = True) + + diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MuonTriggerBitsD3PDObject.py b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MuonTriggerBitsD3PDObject.py new file mode 100644 index 0000000000000000000000000000000000000000..dadf35a4a4977c18f5257c808cf32c346b23babc --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/MuonTriggerBitsD3PDObject.py @@ -0,0 +1,20 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +# @file MuonD3PDMaker/python/MuonTriggerBitsD3PDObject.py +# @author Srivas Prasad <srivas.prasad@cern.ch> +# @date Jan, 2010 +# @brief Define muon trigger bit blocks + + + +from D3PDMakerCoreComps.D3PDObject import make_Void_D3PDObject + + +MuonTriggerBitsD3PDObject = \ + make_Void_D3PDObject (default_name = 'MuonTriggerBitsFiller') + + +# +# The muon trigger bits are now added in MuonD3PDObject; +# this file is kept just for backwards compatibility. +# diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/RpcPrepDataD3PDObject.py b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/RpcPrepDataD3PDObject.py new file mode 100644 index 0000000000000000000000000000000000000000..a8cb743c876318467f092dededc66b8264401dad --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/RpcPrepDataD3PDObject.py @@ -0,0 +1,29 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +import MuonD3PDMaker +import D3PDMakerCoreComps +from D3PDMakerCoreComps.D3PDObject import D3PDObject +from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags + + +def makeD3PDObject (name, prefix, object_name, getter = None, + sgkey = 'RPC_Measurements', + typename = 'Muon::RpcPrepDataContainer', + label = 'RpcPrepData'): + if not getter: + from MuonD3PDMaker.MuonD3PDMakerConf import D3PD__RpcPrepDataCollectionGetterTool + getter = D3PD__RpcPrepDataCollectionGetterTool \ + (name + '_Getter', + SGKey = sgkey, + TypeName = typename, + Label = label) + getter.OutputLevel=1 + return D3PDMakerCoreComps.VectorFillerTool (name, + Prefix = prefix, + Getter = getter, + ObjectName = object_name, OutputLevel=1) + + +RpcPrepDataD3PDObject = D3PDObject (makeD3PDObject, 'rpc_', 'RpcPrepDataD3PDObject') + +RpcPrepDataD3PDObject.defineBlock (0, 'PrepData', MuonD3PDMaker.RpcPrepDataFillerTool) diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/TgcPrepDataD3PDObject.py b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/TgcPrepDataD3PDObject.py new file mode 100644 index 0000000000000000000000000000000000000000..74780db166d54f8b377a6472145af67461a2a373 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/TgcPrepDataD3PDObject.py @@ -0,0 +1,31 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +import MuonD3PDMaker +import D3PDMakerCoreComps +from D3PDMakerCoreComps.D3PDObject import D3PDObject +from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags + + +def makeD3PDObject (name, prefix, object_name, getter = None, + sgkey = 'TGC_Measurements', + #sgkey = 'TGC_MeasurementsPriorBC', + #sgkey = 'TGC_MeasurementsNextBC', + typename = 'Muon::TgcPrepDataContainer', + label = 'TgcPrepData'): + if not getter: + from MuonD3PDMaker.MuonD3PDMakerConf import D3PD__TgcPrepDataCollectionGetterTool + getter = D3PD__TgcPrepDataCollectionGetterTool \ + (name + '_Getter', + SGKey = sgkey, + TypeName = typename, + Label = label) + getter.OutputLevel=1 + return D3PDMakerCoreComps.VectorFillerTool (name, + Prefix = prefix, + Getter = getter, + ObjectName = object_name, OutputLevel=1) + + +TgcPrepDataD3PDObject = D3PDObject (makeD3PDObject, 'tgc_', 'TgcPrepDataD3PDObject') + +TgcPrepDataD3PDObject.defineBlock (0, 'PrepData', MuonD3PDMaker.TgcPrepDataFillerTool) diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/TrackRecordD3PDObject.py b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/TrackRecordD3PDObject.py new file mode 100644 index 0000000000000000000000000000000000000000..510a686f4c90140c83322cf5923dc0559caaf451 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/TrackRecordD3PDObject.py @@ -0,0 +1,25 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +# $Id: TrackRecordD3PDObject.py + +# Import all needed modules: +import MuonD3PDMaker +import D3PDMakerCoreComps +from D3PDMakerCoreComps.resolveSGKey import testSGKey +from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags +from D3PDMakerCoreComps.D3PDObject import D3PDObject +from D3PDMakerCoreComps.D3PDObject import make_SGDataVector_D3PDObject + + +# Create the configurable: +TrackRecordD3PDObject = \ + make_SGDataVector_D3PDObject ('AthenaHitsVector<TrackRecord>', + 'MuonEntryLayerFilter', + 'ms_entry_truth_', + 'TrackRecordD3PDObject') + +# Add blocks to it: +TrackRecordD3PDObject.defineBlock( 0, "BasicInfo", + MuonD3PDMaker.TrackRecordFillerTool ) +TrackRecordD3PDObject.defineBlock( 0, "TruthHits", + MuonD3PDMaker.MuonTruthHitsFillerTool ) diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/TruthMuonD3PDObject.py b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/TruthMuonD3PDObject.py new file mode 100644 index 0000000000000000000000000000000000000000..e14187f65572775bca10359359e5ee34af2e9d2f --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/TruthMuonD3PDObject.py @@ -0,0 +1,68 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +# @file MuonD3PDMaker/python/TruthMuonD3PDObject.py +# $author Srivas Prasad <srivas.prasad@cern.ch> +# @date March 2010 +# @brief dump true muons - modeled on Tau code + + +import MuonD3PDMaker +import EventCommonD3PDMaker +from D3PDMakerCoreComps.D3PDObject import make_SGDataVector_D3PDObject +from D3PDMakerCoreComps.resolveSGKey import testSGKey +from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags +from AthenaCommon.AlgSequence import AlgSequence +from RecExConfig.ObjKeyStore import cfgKeyStore +import TruthD3PDMaker + + +TruthMuonD3PDObject = make_SGDataVector_D3PDObject ('DataVector<xAOD::TruthParticle_v1>', + 'TruthMuons', + 'muonTruth_', + 'TruthMuonD3PDObject') +def _truthMuonAlgHook (c, prefix, sgkey, + TruthContainer = 'TruthParticle', + **kw): + preseq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName()) + + # Is the container already in SG? + if cfgKeyStore.isInInput ('DataVector<xAOD::TruthParticle_v1>', sgkey): + return + + # Is the algorithm already in the sequence? + algname = prefix + 'TruthMuonsToSG' + if hasattr (preseq, algname): + return + + from TruthD3PDMaker.MCTruthClassifierConfig \ + import D3PDMCTruthClassifier + preseq += MuonD3PDMaker.TruthMuonsToSG \ + (algname, + TruthMuonContainer = sgkey, + TruthContainer = TruthContainer, + Classifier = D3PDMCTruthClassifier) + return +TruthMuonD3PDObject.defineHook (_truthMuonAlgHook) + + +#----------------------------------------------------------------------------- +# Blocks +#----------------------------------------------------------------------------- +TruthMuonD3PDObject.defineBlock (0, 'Kinematics', + EventCommonD3PDMaker.FourMomFillerTool, + WriteEt = False, + WritePt = True, + WriteEtaPhi = True ) +TruthMuonD3PDObject.defineBlock (0, 'Info', + TruthD3PDMaker.TruthParticleFillerTool, + PDGIDVariable = 'PDGID') +from TruthD3PDMaker.MCTruthClassifierConfig \ + import D3PDMCTruthClassifier +TruthMuonD3PDObject.defineBlock (0, 'Classification', + TruthD3PDMaker.TruthParticleClassificationFillerTool, + Classifier = D3PDMCTruthClassifier) +#delete TruthMuonFiller? + +TruthMuonD3PDObject.defineBlock(99, "TruthHits", + MuonD3PDMaker.MuonTruthHitsFillerTool ) + diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/__init__.py b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..97815f07941a95ad629a1835eda73afd4e72e5b6 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/__init__.py @@ -0,0 +1,7 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +import MuonD3PDMakerConf +for k, v in MuonD3PDMakerConf.__dict__.items(): + if k.startswith ('D3PD__'): + globals()[k[6:]] = v + diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/muonD3PD.py b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/muonD3PD.py new file mode 100644 index 0000000000000000000000000000000000000000..d3ddfb1b3f6361db05dbf0c23c510c414ad2749e --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/python/muonD3PD.py @@ -0,0 +1,132 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +# $Id$ +# +# @file MuonD3PDMaker/python/muonD3PD.py +# @author srivas prasad <srivas.prasad@cern.ch> +# @date Nov, 2010 +# @brief Construct a muon D3PD. +# + + +import D3PDMakerCoreComps +from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags +from EventCommonD3PDMaker.EventInfoD3PDObject import EventInfoD3PDObject +from EventCommonD3PDMaker.LBMetadataConfig import LBMetadataConfig +from MuonD3PDMaker.MuonD3PDMakerFlags import MuonD3PDFlags +from MuonD3PDMaker.MuonD3PDObject import MuonD3PDObject +from MuonD3PDMaker.MuonSegmentD3PDObject import MuonSegmentD3PDObject +from MuonD3PDMaker.MuonTriggerBitsD3PDObject import MuonTriggerBitsD3PDObject +from RecExConfig.RecFlags import rec +from AthenaCommon.AlgSequence import AlgSequence +topSequence = AlgSequence() + + +def _args (level, name, kwin, **kw): + kw = kw.copy() + kw['level'] = level + for (k, v) in kwin.items(): + if k.startswith (name + '_'): + kw[k[len(name)+1:]] = v + return kw + + +def muonD3PD (file, + tuplename = 'muon', + seq = topSequence, + D3PDSvc = 'D3PD::RootD3PDSvc', + streamNameRoot = None, + **kw): + + alg = D3PDMakerCoreComps.MakerAlg(tuplename, seq, + file = file, + D3PDSvc = D3PDSvc, + streamNameRoot = streamNameRoot) + alg += EventInfoD3PDObject (**_args (10, 'EventInfo', kw)) + + if D3PDMakerFlags.DoTrigger(): + + # Segregate trigger decision flags in a separate tree. + trigalg = D3PDMakerCoreComps.MakerAlg(tuplename + 'TrigDec', + seq, + file = file, + D3PDSvc = D3PDSvc, + streamNameRoot = streamNameRoot) + trigalg += EventInfoD3PDObject (0) + alg.trigDecisionTree = trigalg + + + # Muon blocks + alg += MuonD3PDObject (**_args (10, 'Muons', kw, + sgkey='Muons', + prefix='mu_', allowMissing=True)) + + if not MuonD3PDFlags.doNewChainOnly(): + + alg += MuonD3PDObject (**_args (10, 'MuidMuon', kw, + sgkey='MuidMuonCollection', + prefix='mu_muid_', allowMissing=True)) + alg += MuonD3PDObject (**_args (10, 'StacoMuon', kw, + sgkey='StacoMuonCollection', + prefix='mu_staco_', allowMissing=True)) + alg += MuonD3PDObject (**_args (10, 'CaloMuon', kw, + sgkey='CaloMuonCollection', + prefix='mu_calo_', allowMissing=True)) + + # Muon segments + alg += MuonSegmentD3PDObject (**_args (10, 'MuonSeg', kw, + sgkey='MuonSegments', + prefix='muonseg_', + include = ['MuonSegmentT0'], + exclude = ['MuonboySegmentT0'], + allowMissing=True + ) + ) + + if not MuonD3PDFlags.doNewChainOnly(): + + alg += MuonSegmentD3PDObject (**_args (10, 'MooreSeg', kw, + sgkey='MooreSegments', + prefix='mooreseg_', + include = ['MooreSegmentT0'], + exclude = ['MuonboySegmentT0'], + allowMissing=True + ) + ) + + alg += MuonSegmentD3PDObject (**_args (10, 'MboySeg', kw, + sgkey='ConvertedMBoySegments', + prefix='mboyseg_', + include = ['MuonboySegmentT0'], + exclude = ['MooreSegmentT0'], + allowMissing=True + ) + ) + + alg += MuonSegmentD3PDObject (**_args (10, 'MuGirlSeg', kw, + sgkey='MuGirlSegments', + prefix='mgseg_', + include = ['MooreSegmentT0'], + exclude = ['MuonboySegmentT0'], + allowMissing=True + ) + ) + + from MuonD3PDMaker.MuonSpShowerD3PDObject import MuonSpShowerD3PDObject + alg += MuonSpShowerD3PDObject (**_args(10, 'MuonSpShower', kw, allowMissing=True)) + + # Truth + if rec.doTruth(): + from MuonD3PDMaker.TruthMuonD3PDObject import TruthMuonD3PDObject + alg += TruthMuonD3PDObject (**_args ( 2, 'TruthMuon', kw, allowMissing=True)) + + from MuonD3PDMaker.TrackRecordD3PDObject import TrackRecordD3PDObject + alg += TrackRecordD3PDObject (**_args(10, 'MuonEntryLayerFilter', kw)) + + # Trigger + if D3PDMakerFlags.DoTrigger(): + alg += MuonTriggerBitsD3PDObject (**_args ( 2, 'MuonTriggerBits', kw)) + + alg.MetadataTools += [LBMetadataConfig()] + + return alg diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/share/AODToMuonD3PD.py b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/share/AODToMuonD3PD.py new file mode 100644 index 0000000000000000000000000000000000000000..8d1efd6a9fa25648de31bb72a1eb7a397344fbe7 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/share/AODToMuonD3PD.py @@ -0,0 +1,59 @@ +# $Id$ +# +# @file MuonD3PDMaker/share/AODToMuonD3PD.py +# @author srivas prasad <srivas.prasad@cern.ch> +# @date Nov, 2010 +# @brief Example for building a muon D3PD from an AOD. + +# Define the input file here. +from AthenaCommon.AthenaCommonFlags import athenaCommonFlags +#athenaCommonFlags.FilesInput= ["AOD.pool.root"] +athenaCommonFlags.FilesInput= [ +"/tmp/srivas/data11_7TeV.00183412.physics_Muons.merge.AOD.f385_m884/data11_7TeV.00183412.physics_Muons.merge.AOD.f385_m884._lb0420-lb0421._0001.1" +] + +athenaCommonFlags.EvtMax = 2000 + +# Define the output file here. +if not globals().get('inputFileType'): + inputFileType = 'AOD' +if not globals().get('tupleFileOutput'): + tupleFileOutput = 'muon.root' + +################################################################### +# Configure RecExCommon. +from RecExConfig.RecFlags import rec +rec.doCBNT.set_Value_and_Lock(False) +rec.doWriteESD.set_Value_and_Lock(False) +rec.doWriteAOD.set_Value_and_Lock(False) +rec.doAOD.set_Value_and_Lock(False) +rec.doESD.set_Value_and_Lock(False) +rec.doDPD.set_Value_and_Lock(False) +rec.doWriteTAG.set_Value_and_Lock(False) +rec.doForwardDet.set_Value_and_Lock(False) +include ("RecExCommon/RecExCommon_topOptions.py") + +# Load the conditions stuff for TRT and Tile timing +from AthenaCommon.DetFlags import DetFlags +DetFlags.ID_setOn() +DetFlags.Calo_setOn() +DetFlags.Muon_setOn() + +if not ('conddb' in dir()): + IOVDbSvc = Service("IOVDbSvc") + from IOVDbSvc.CondDB import conddb +conddb.addFolderSplitOnline("TRT","/TRT/Onl/Calib/RT","/TRT/Calib/RT") +conddb.addFolderSplitOnline("TRT","/TRT/Onl/Calib/T0","/TRT/Calib/T0") +from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_CalDbSvc +InDetTRTCalDbSvc = TRT_CalDbSvc() +ServiceMgr += InDetTRTCalDbSvc + +####### Reduce output +#turn off perfmon +from PerfMonComps.PerfMonFlags import jobproperties as jp +jp.PerfMonFlags.doMonitoring = False +jp.PerfMonFlags.doFastMon = False +################################################################### + +from MuonD3PDMaker.muonD3PD import muonD3PD +alg = muonD3PD (tupleFileOutput) diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/share/ESDToMuonD3PD.py b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/share/ESDToMuonD3PD.py new file mode 100644 index 0000000000000000000000000000000000000000..a7235d47664e5a31b26fde5231a35ae461f9f4c1 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/share/ESDToMuonD3PD.py @@ -0,0 +1,67 @@ +# $Id$ +# +# @file MuonD3PDMaker/share/ESDToMuonD3PD.py +# @author srivas prasad <srivas.prasad@cern.ch> +# @date Nov, 2010 +# @brief Example for building a muon D3PD from an ESD. + +# Define the input file here. +from AthenaCommon.AthenaCommonFlags import athenaCommonFlags +#athenaCommonFlags.FilesInput= ["ESD.pool.root"] +athenaCommonFlags.FilesInput= [ +"/tmp/srivas/data11_7TeV.00183412.physics_Muons.recon.ESD.f385/data11_7TeV.00183412.physics_Muons.recon.ESD.f385._lb0420._SFO-10._0001.1", +"/tmp/srivas/data11_7TeV.00183412.physics_Muons.recon.ESD.f385/data11_7TeV.00183412.physics_Muons.recon.ESD.f385._lb0420._SFO-11._0001.1", +"/tmp/srivas/data11_7TeV.00183412.physics_Muons.recon.ESD.f385/data11_7TeV.00183412.physics_Muons.recon.ESD.f385._lb0420._SFO-12._0001.1", +"/tmp/srivas/data11_7TeV.00183412.physics_Muons.recon.ESD.f385/data11_7TeV.00183412.physics_Muons.recon.ESD.f385._lb0420._SFO-4._0001.1", +"/tmp/srivas/data11_7TeV.00183412.physics_Muons.recon.ESD.f385/data11_7TeV.00183412.physics_Muons.recon.ESD.f385._lb0420._SFO-5._0001.1", +"/tmp/srivas/data11_7TeV.00183412.physics_Muons.recon.ESD.f385/data11_7TeV.00183412.physics_Muons.recon.ESD.f385._lb0421._SFO-10._0001.1", +"/tmp/srivas/data11_7TeV.00183412.physics_Muons.recon.ESD.f385/data11_7TeV.00183412.physics_Muons.recon.ESD.f385._lb0421._SFO-11._0001.1", +"/tmp/srivas/data11_7TeV.00183412.physics_Muons.recon.ESD.f385/data11_7TeV.00183412.physics_Muons.recon.ESD.f385._lb0421._SFO-12._0001.1", +"/tmp/srivas/data11_7TeV.00183412.physics_Muons.recon.ESD.f385/data11_7TeV.00183412.physics_Muons.recon.ESD.f385._lb0421._SFO-4._0001.1", +"/tmp/srivas/data11_7TeV.00183412.physics_Muons.recon.ESD.f385/data11_7TeV.00183412.physics_Muons.recon.ESD.f385._lb0421._SFO-5._0001.1" +] + +athenaCommonFlags.EvtMax = 2000 + +# Define the output file here. +if not globals().get('inputFileType'): + inputFileType = 'ESD' +if not globals().get('tupleFileOutput'): + tupleFileOutput = 'muon.root' + +################################################################### +# Configure RecExCommon. +from RecExConfig.RecFlags import rec +rec.doCBNT.set_Value_and_Lock(False) +rec.doWriteESD.set_Value_and_Lock(False) +rec.doWriteAOD.set_Value_and_Lock(False) +rec.doAOD.set_Value_and_Lock(False) +rec.doESD.set_Value_and_Lock(False) +rec.doDPD.set_Value_and_Lock(False) +rec.doWriteTAG.set_Value_and_Lock(False) +rec.doForwardDet.set_Value_and_Lock(False) +include ("RecExCommon/RecExCommon_topOptions.py") + +# Load the conditions stuff for TRT and Tile timing +from AthenaCommon.DetFlags import DetFlags +DetFlags.ID_setOn() +DetFlags.Calo_setOn() +DetFlags.Muon_setOn() + +if not ('conddb' in dir()): + IOVDbSvc = Service("IOVDbSvc") + from IOVDbSvc.CondDB import conddb +conddb.addFolderSplitOnline("TRT","/TRT/Onl/Calib/RT","/TRT/Calib/RT") +conddb.addFolderSplitOnline("TRT","/TRT/Onl/Calib/T0","/TRT/Calib/T0") +from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_CalDbSvc +InDetTRTCalDbSvc = TRT_CalDbSvc() +ServiceMgr += InDetTRTCalDbSvc + +#turn off perfmon stuff +from PerfMonComps.PerfMonFlags import jobproperties as jp +jp.PerfMonFlags.doMonitoring = False +jp.PerfMonFlags.doFastMon = False +################################################################### + +from MuonD3PDMaker.muonD3PD import muonD3PD +alg = muonD3PD (tupleFileOutput) diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/share/MuonD3PD_prodJobOFragment.py b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/share/MuonD3PD_prodJobOFragment.py new file mode 100644 index 0000000000000000000000000000000000000000..b5fc3d72198fff406ffee389edd65f6013615538 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/share/MuonD3PD_prodJobOFragment.py @@ -0,0 +1,482 @@ +# +# This jobO fragment is meant to be called by Reco_trf.py in transformation jobs to +# create the "MUON D3PD part". + +# This jobO should not be included more than once: +include.block( "MuonD3PDMaker/MuonD3PD_prodJobOFragment.py" ) + +# Common import(s): +from AthenaCommon.JobProperties import jobproperties +prodFlags = jobproperties.D3PDProdFlags +from PrimaryDPDMaker.PrimaryDPDHelpers import buildFileName + +# Set up a logger: +from AthenaCommon.Logging import logging +MuonD3PDStream_msg = logging.getLogger( 'MuonD3PD_prodJobOFragment' ) + +# Check if the configuration makes sense: +if prodFlags.WriteMuonD3PD.isVirtual: + MuonD3PDStream_msg.error( "The MUON D3PD stream can't be virtual! " + + "It's a configuration error!" ) + raise NameError( "MUON D3PD set to be a virtual stream" ) + pass + +# Check if there are chain 1 and chain 2 +from MuonD3PDMaker.MuonD3PDMakerFlags import MuonD3PDFlags +from D3PDMakerCoreComps.resolveSGKey import testSGKey +MuonD3PDFlags.doNewChainOnly = not (testSGKey ('Analysis::MuonContainer', 'MuidMuonCollection') + and testSGKey ('Analysis::MuonContainer', 'StacoMuonCollection')) + +# Pre-sequence for filters....things to run before D3PD making +from AthenaCommon.AlgSequence import AlgSequence +preseq = AlgSequence (D3PDMakerFlags.PreD3PDAlgSeqName()) + +# filter ID tracks with pT>4 GeV and at least 1 Pixel or SCT hit or hole +from TauD3PDMaker.makeTrackFilterAlg import makeTrackFilterAlg +trackFilter = makeTrackFilterAlg(TracksName = D3PDMakerFlags.TrackSGKey(), + OutputTracksName='HighPtTracks', + ptCut=4000., nSCTPix=0) +preseq += trackFilter + +from RecExConfig.RecFlags import rec +# Fit the D3PD SG keys for truth to the filtered ones +from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags +D3PDMakerFlags.TruthParticlesSGKey.set_Value_and_Lock('SpclMC_MUON') +D3PDMakerFlags.TruthSGKey.set_Value_and_Lock('GEN_EVENT_MUON') + +# Filter Truth to keep only muons and fsr photons +if rec.doTruth(): + # get a handle on the job main sequence + from AthenaCommon.AlgSequence import AlgSequence + topSequence = AlgSequence() + from McParticleTools.McParticleToolsConf import McVtxFilterTool + from McParticleTools.McParticleToolsConf import TruthParticleCnvTool + from McParticleAlgs.McParticleAlgsConf import McAodFilter + topSequence += McAodFilter() + topSequence.McAodFilter.DoGenAod = True + topSequence.McAodFilter.McVtxFilterTool = McVtxFilterTool() + if rec.readESD(): + topSequence.McAodFilter.McVtxFilterTool.McEvents = "TruthEvent" + if rec.readAOD(): + topSequence.McAodFilter.McVtxFilterTool.McEvents = "GEN_AOD" + topSequence.McAodFilter.McVtxFilterTool.McEventsOutput = "GEN_EVENT_MUON" + topSequence.McAodFilter.McVtxFilterTool.DoSignalProcessVtx = True + topSequence.McAodFilter.McVtxFilterTool.DecayPatterns += [ " -> 13|-13 " ] + topSequence.McAodFilter.McVtxFilterTool.DecayPatterns += [ " 13 -> 22 + 13 " ] + topSequence.McAodFilter.McVtxFilterTool.DecayPatterns += [ " -13 -> 22 + -13 " ] + #topSequence.McAodFilter.DoTruthParticles = True + #topSequence.McAodFilter.TruthParticleCnvTool = TruthParticleCnvTool() + #topSequence.McAodFilter.TruthParticleCnvTool.McEvents = "GEN_EVENT_MUON" + #topSequence.McAodFilter.TruthParticleCnvTool.TruthParticlesOutput = "SpclMC_MUON" + # from McParticleAlgs.JobOptCfg import McAodBuilder + # topSequence += McAodBuilder() + # if rec.readESD(): + # topSequence.McAodBuilder.FilterTool.McEvents = "TruthEvent" + # if rec.readAOD(): + # topSequence.McAodBuilder.FilterTool.McEvents = "GEN_AOD" + # topSequence.McAodBuilder.CnvTool.TruthParticlesOutput = "SpclMC_muon" + + +# +# Merge CaloMuonCollection to MuonCollections +# Requires MuonCollectionBuilders-00-00-14 or higher +MergeCaloCollections = False +StacoMergedCollection = "StacoMuonCollection" +MuidMergedCollection = "MuidMuonCollection" +MuonMergedCollection = "Muons" +# +if MergeCaloCollections: + + StacoMergedCollection = "CStaco" + MuidMergedCollection = "CMuid" + MuonMergedCollection = "CMuons" + + from AthenaCommon.AppMgr import ToolSvc + from AthenaCommon import CfgMgr + ToolSvc += CfgMgr.Rec__MuonPrintingTool( "MuonCombinedPrintingTool" ) + ToolSvc += CfgMgr.Rec__MuonOverlapTool( "MuonCombinedOverlapTool" ) + ToolSvc += CfgMgr.Rec__MuonOverlapResolverTool( "UnifiedChainOverlapResolverTool", + UpgradeMugirlToCombined = True, + EnforceRel16MuonContent = False) + ToolSvc += CfgMgr.Rec__MuonOverlapResolverTool( "MuonCombinedOverlapResolverTool" ) + ToolSvc += CfgMgr.MuonQualityTool( name = "UnifiedMuonQualityTool", IsUnified = True ) + + # Merge Muons and CaloMuon + MergeMuonsAndCaloMuonCollection = CfgMgr.Rec__MuonCollectionMerger( + name = "MergeMuonsAndCaloMuonCollection", + MuonContainerNames = ["Muons","CaloMuonCollection"], + OutputMuonCollection = "MergedMuons", + MuonIsolationTool = None, + MuGirlLowBetaCollection = "", # keep away from existing collection, + AddClusterIsolationToAllMuons = False, + OutputLevel = INFO + ) + topSequence += MergeMuonsAndCaloMuonCollection + BuildCMuonCollection = CfgMgr.Rec__MuonIntegratedCollectionBuilder ( + name = "BuildCMuonCollection", + MuonQualityTool = ToolSvc.UnifiedMuonQualityTool, + MuonOverlapTool = ToolSvc.MuonCombinedOverlapTool, + MuonOverlapResolverTool= ToolSvc.UnifiedChainOverlapResolverTool, + MuonPrintingTool = None, + DebugTextFile = "", + InputMuonCollection = "MergedMuons", + FinalMuonCollection = MuonMergedCollection, + DoLockContainers = True, + OutputLevel = INFO + ) + topSequence += BuildCMuonCollection + +# >>>>>Backward compatibility for Staco/Miud<<<<< + if not MuonD3PDFlags.doNewChainOnly: + # Merge Muid and CaloMuon + MergeMuidAndCaloMuonCollection = CfgMgr.Rec__MuonCollectionMerger( + name = "MergeMuidAndCaloMuonCollection", + MuonContainerNames = ["MuidMuonCollection","CaloMuonCollection"], + OutputMuonCollection = "MergedMuid", + MuonIsolationTool = None, + MuGirlLowBetaCollection = "", # keep away from existing collection, + AddClusterIsolationToAllMuons = False, + OutputLevel = INFO + ) + topSequence += MergeMuidAndCaloMuonCollection + BuildCMuidCollection = CfgMgr.Rec__MuonIntegratedCollectionBuilder ( + name = "BuildCMuidCollection", + MuonQualityTool = ToolSvc.UnifiedMuonQualityTool, + MuonOverlapTool = ToolSvc.MuonCombinedOverlapTool, + MuonOverlapResolverTool= ToolSvc.UnifiedChainOverlapResolverTool, + MuonPrintingTool = None, + DebugTextFile = "", + InputMuonCollection = "MergedMuid", + FinalMuonCollection = MuidMergedCollection, + DoLockContainers = True, + OutputLevel = INFO + ) + topSequence += BuildCMuidCollection + + # Merge Staco and CaloMuon + MergeStacoAndCaloMuonCollection = CfgMgr.Rec__MuonCollectionMerger( + name = "MergeStacoAndCaloMuonCollection", + MuonContainerNames = ["StacoMuonCollection","CaloMuonCollection"], + OutputMuonCollection = "MergedStaco", + MuonIsolationTool = None, + MuGirlLowBetaCollection = "", # keep away from existing collection, + AddClusterIsolationToAllMuons = False, + OutputLevel = INFO + ) + topSequence += MergeStacoAndCaloMuonCollection + BuildCStacoCollection = CfgMgr.Rec__MuonIntegratedCollectionBuilder ( + name = "BuildCStacoCollection", + MuonQualityTool = ToolSvc.UnifiedMuonQualityTool, + MuonOverlapTool = ToolSvc.MuonCombinedOverlapTool, + MuonOverlapResolverTool= ToolSvc.UnifiedChainOverlapResolverTool, + MuonPrintingTool = None, + DebugTextFile = "", + InputMuonCollection = "MergedStaco", + FinalMuonCollection = StacoMergedCollection, + DoLockContainers = True, + OutputLevel = INFO + ) + topSequence += BuildCStacoCollection +# >>>>>----------------end------------------<<<<< + + +################################################################################## +# Build the Muon D3PD +################################################################################## + +# Construct the stream and file names for the MUON D3PD +streamName = prodFlags.WriteMuonD3PD.StreamName +fileName = buildFileName( prodFlags.WriteMuonD3PD ) +MuonD3PDStream_msg.info( "Configuring Muon D3PD with streamName '%s' and fileName '%s'" % \ + ( streamName, fileName ) ) + +# Create the D3PD stream itself: +from OutputStreamAthenaPool.MultipleStreamManager import MSMgr +MuonD3PDStream = MSMgr.NewRootStream( streamName, fileName, "muon" ) + +# Event info +from EventCommonD3PDMaker.EventInfoD3PDObject import EventInfoD3PDObject +MuonD3PDStream+= EventInfoD3PDObject(10) + +# Truth (from filtered truth collection) +if rec.doTruth(): + from TruthD3PDAnalysis.TruthD3PDAnalysisConf import D3PD__GenObjectsFilterTool + # ... remove empty GenEvents + LightGenEvtFilterTool = D3PD__GenObjectsFilterTool( "LightGenEvtFilterTool" ) + ToolSvc += LightGenEvtFilterTool + LightGenEvtFilterTool.RemoveDummyEvents = True + LightGenEvtFilterTool.RemoveInTimePileUp = True + LightGenEvtFilterTool.Remove2BCPileUp = True + LightGenEvtFilterTool.Remove800nsPileUp = True + LightGenEvtFilterTool.RemoveCavernBkg = True + LightGenEvtFilterTool.RemoveEmptyEvents = True + from TruthD3PDMaker.GenEventD3PDObject import GenEventD3PDObject + MuonD3PDStream += GenEventD3PDObject (level=0, filter=LightGenEvtFilterTool) + + from TruthD3PDMaker.TruthParticleD3PDObject import TruthParticleD3PDObject + MuonD3PDStream += TruthParticleD3PDObject(1) + +# The actual MuonD3PD object +from MuonD3PDMaker.MuonD3PDObject import MuonD3PDObject +#from MuonD3PDMaker.TruthMuonD3PDObject import TruthMuonD3PDObject +from MuonD3PDMaker.MuonTriggerBitsD3PDObject import MuonTriggerBitsD3PDObject + +muonIncludes = ['Kinematics','Charge','AllAuthor','Authors','TrkMatchQuality','Isolation', + 'CaloEnergyLoss','AcceptMethods','ParametersAtPV','ComponentTrkParameters','MuonHitSummary', + 'MuonSpectrometerHitSummary','TrkParameters','TrkCovDiag','TrkCovOffDiag','Quality', + 'EFCBInfoIndex', 'EFMGInfoIndex','EFMEInfoIndex', 'PrimaryTrackDiagonalCovarianceAtPV', + 'StacoTrackAssocIndex'] + +if rec.doTruth(): + muonIncludes += ['TruthInfoIndex'] + +# The 3 variants of muon objects +MuonsD3PDObject = MuonD3PDObject.copy() + +# >>>>>Backward compatibility for Staco/Miud<<<<< +if not MuonD3PDFlags.doNewChainOnly: + StacoD3PDObject = MuonD3PDObject.copy() + MuidD3PDObject = MuonD3PDObject.copy() +# >>>>>----------------end------------------<<<<< + + +# Trigger Decision +if D3PDMakerFlags.DoTrigger(): + from TriggerD3PDMaker.TrigDecisionD3PDObject import TrigDecisionD3PDObject + from TriggerD3PDMaker.TrigConfMetadata import addTrigConfMetadata + from TriggerD3PDMaker.BGCodeD3PDObject import BGCodeD3PDObject + from TriggerD3PDMaker.BunchStructureMetadata import addBunchStructureMetadata + addBunchStructureMetadata(MuonD3PDStream) + # Trigger Decision + metadata + MuonD3PDStream += TrigDecisionD3PDObject(10) + addTrigConfMetadata(MuonD3PDStream) + # Bunch group info + MuonD3PDStream += BGCodeD3PDObject(2) + +# Muon Trigger Info +from TrigMuonD3PDMaker.TrigMuonEFInfoD3PDObject import TrigMuonEFInfoD3PDObject +MuonD3PDStream += TrigMuonEFInfoD3PDObject(0, + include=['Decision'], + exclude=['TrackDetails','SpectrometerTrackBasics','ExtrapolatedTrackBasics'], + allowMissing = True) +MuonD3PDStream += TrigMuonEFInfoD3PDObject(0, + name = "trig_EF_trigmugirl_", + sgkey = "HLT_eMuonEFInfo", + prefix = "trig_EF_trigmugirl_", + exclude=['TrackDetails','SpectrometerTrackBasics','ExtrapolatedTrackBasics'], + include=['Decision'], + allowMissing = True) + +# Segments and entry layer +from MuonD3PDMaker.MuonSegmentD3PDObject import MuonSegmentD3PDObject +MuonD3PDStream += MuonSegmentD3PDObject( level = 10, name = 'MuonSeg', + sgkey='MuonSegments', + prefix='muonseg_', + include = ['MuonSegmentT0'], + exclude = ['MuonboySegmentT0'], + allowMissing=True + ) + +from RecExConfig.RecFlags import rec +if rec.doTruth(): + from MuonD3PDMaker.TrackRecordD3PDObject import TrackRecordD3PDObject + MuonD3PDStream += TrackRecordD3PDObject(level=0) + + +# Tracking Info (to be activated with +from MuonRecExample.MuonRecFlags import muonRecFlags +TrackLevelOfDetail = 10 + +from TrackD3PDMaker.TrackD3PDMakerFlags import TrackD3PDFlags +TrackD3PDFlags.doTruth = False #rec.doTruth() +TrackD3PDFlags.storeTRTHitsOnTrack = False +TrackD3PDFlags.storePixelHitsOnTrack = False +TrackD3PDFlags.storeSCTHitsOnTrack = False +TrackD3PDFlags.storeBLayerHitsOnTrack = False +TrackD3PDFlags.storeCSCHitsOnTrack = True +TrackD3PDFlags.storeMDTHitsOnTrack = True +TrackD3PDFlags.storeRPCHitsOnTrack = True +TrackD3PDFlags.storeTGCHitsOnTrack = True +TrackD3PDFlags.storePullsAndResiduals = True +## Disable some things that are on by default +TrackD3PDFlags.storeVertexFitQuality = False +TrackD3PDFlags.storeVertexKinematics = False +TrackD3PDFlags.storeVertexPurity = False +TrackD3PDFlags.storeVertexTrackAssociation = False +TrackD3PDFlags.storeVertexTrackIndexAssociation = False +TrackD3PDFlags.storeTrackPredictionAtBLayer = False +TrackD3PDFlags.storeVertexType = False +TrackD3PDFlags.storeDetailedTruth = False #True + +# Add TrackParticle D3PD + +from TrackD3PDMaker.TrackD3PDObject import TrackD3PDObject +from TrackD3PDMaker.TrackD3PDObject import TrackParticleD3PDObject + +MuonTrackPartD3PDObject = TrackD3PDObject(_label='muTP', + _prefix='muTP_', + _sgkey='MuonSpectrometerParticles', + typeName='Rec::TrackParticleContainer', + truthTarget='mc', + truthPrefix='mc_', + detailedTruthPrefix='detailed_mc_', + truthMapKey='MuonSpectrometerParticlesTruth', + detailedTruthMapKey='MuonSpectrometerTracksTruth', + flags=TrackD3PDFlags) +MuonD3PDStream += MuonTrackPartD3PDObject(TrackLevelOfDetail) + +# >>>>>Backward compatibility for Staco/Miud<<<<< +if not MuonD3PDFlags.doNewChainOnly: + MboyTrackPartD3PDObject = TrackD3PDObject(_label='mboyTP', + _prefix='mboyTP_', + _sgkey='MuonboyTrackParticles', + typeName='Rec::TrackParticleContainer', + truthTarget='mc', + truthPrefix='mc_', + detailedTruthPrefix='detailed_mc_', + truthMapKey='MuonboyTrackTruthCollection', + detailedTruthMapKey='DetailedTrackTruth', + flags=TrackD3PDFlags) + MuonD3PDStream += MboyTrackPartD3PDObject(TrackLevelOfDetail) + + import MuonD3PDMaker + import D3PDMakerCoreComps + from D3PDMakerCoreComps.IndexAssociation import IndexAssociation + IndexAssociation( StacoD3PDObject, + MuonD3PDMaker.MuonTrackParticleAssociationTool, + target = "mboyTP_", + prefix = "mboyTP_", + level = 0, + blockname = "StacoTrackAssocIndex", + Type = "MuonSpectrometer") + + MooreTrackPartD3PDObject = TrackD3PDObject(_label='mooreTP', + _prefix='mooreTP_', + _sgkey='MooreTrackParticles', + typeName='Rec::TrackParticleContainer', + truthTarget='mc', + truthPrefix='mc_', + detailedTruthPrefix='detailed_mc_', + truthMapKey='MooreTrackParticlesTruth', + detailedTruthMapKey='MooreTracksTruth', + flags=TrackD3PDFlags) + MuonD3PDStream += MooreTrackPartD3PDObject(TrackLevelOfDetail) +# >>>>>----------------end------------------<<<<< + + + +# ID Tracks (for TP studies) +from TrackD3PDMaker.TrackD3PDMakerFlags import TrackD3PDFlags as IDTrackFlags +IDTrackFlags.doTruth = rec.doTruth() +IDTrackFlags.storeHitTruthMatching = rec.doTruth() +IDTrackFlags.storeTruthInfo=rec.doTruth() +IDTrackFlags.storeDiagonalCovarianceAsErrors = True +IDTrackFlags.storeBLayerHitsOnTrack = False +IDTrackFlags.storePixelHitsOnTrack = False +IDTrackFlags.storePixelHolesOnTrack = False +IDTrackFlags.storePixelOutliersOnTrack = False +IDTrackFlags.storeSCTHitsOnTrack = False +IDTrackFlags.storeSCTHolesOnTrack = False +IDTrackFlags.storeSCTOutliersOnTrack = False +IDTrackFlags.storeTRTHitsOnTrack = False +IDTrackFlags.storeTRTHolesOnTrack = False +IDTrackFlags.storeTRTOutliersOnTrack = False +IDTrackFlags.storeCSCHitsOnTrack = False +IDTrackFlags.storeMDTHitsOnTrack = False +IDTrackFlags.storeRPCHitsOnTrack = False +IDTrackFlags.storeTGCHitsOnTrack = False +IDTrackFlags.storeTrackFitQuality = True +IDTrackFlags.storeTrackMomentum = True +IDTrackFlags.storeTrackSummary = True +IDTrackFlags.storeTrackSummary.IDOutliers = False +IDTrackFlags.storeTrackSummary.PixelInfoPlus = False +IDTrackFlags.storeTrackSummary.SCTInfoPlus = False +IDTrackFlags.storeTrackSummary.TRTInfoPlus = False +IDTrackFlags.storeTrackSummary.InfoPlus = False +IDTrackFlags.storeTrackPredictionAtBLayer = False +IDTrackFlags.trackParametersAtBeamSpotLevelOfDetails = 0 +IDTrackFlags.trackParametersAtGlobalPerigeeLevelOfDetails = 2 +IDTrackFlags.trackParametersAtPrimaryVertexLevelOfDetails = 3 + +IDTrackParticleD3PDObject = TrackD3PDObject(_label='trkpt4', + _prefix='trkpt4_', + _sgkey='HighPtTracks', + typeName='Rec::TrackParticleContainer', + truthMapKey='TrackParticleTruthCollection', + SGKeyForTruth=D3PDMakerFlags.TrackSGKey(), + flags=IDTrackFlags) + +MuonD3PDStream += IDTrackParticleD3PDObject( 3, 'Tracks2', + sgkey = 'HighPtTracks', + label = 'trkpt4', + prefix = 'trkpt4_') + + +# Finally add the 3 muon objects to the stream +MuonD3PDStream += MuonsD3PDObject(level=0, name='Muon', sgkey=MuonMergedCollection, prefix="mu_", include = muonIncludes) + +# >>>>>Backward compatibility for Staco/Miud<<<<< +if not MuonD3PDFlags.doNewChainOnly: + MuonD3PDStream += StacoD3PDObject(level=0, name='Muon_staco', sgkey=StacoMergedCollection, prefix="mu_staco_", include = muonIncludes) + MuonD3PDStream += MuidD3PDObject(level=0, name='Muon_muid', sgkey=MuidMergedCollection, prefix="mu_muid_", include = muonIncludes) +# >>>>>----------------end------------------<<<<< + + + + + + + + + +##### old stuff, could still be useful + +# # Truth +# if rec.doTruth(): +# #from TrackD3PDMaker.TruthTrackD3PDObject import TruthTrackD3PDObject +# # MuonD3PDStream+= TruthTrackD3PDObject(levelOfDetail) +# from MuonD3PDMaker.TrackRecordD3PDObject import TrackRecordD3PDObject +# MuonD3PDStream += TrackRecordD3PDObject ("TrackRecord") + + + + +###### Trk::Track D3PD +# MooreTrackD3PDObject = TrackD3PDObject(_label='moore', +# _prefix='mutrk_moore_', +# _sgkey='MooreTracks', +# typeName='TrackCollection', +# truthTarget='mc', +# truthMapKey='', +# detailedTruthPrefix='detailed_mc_', +# detailedTruthMapKey='MooreTracksTruth', +# SGKeyForDetailedTruth='MooreTracks', +# flags=TrackD3PDFlags) + +# MboyTrackD3PDObject = TrackD3PDObject(_label='mboy', +# _prefix='mutrk_mboy_', +# _sgkey='ConvertedMBoyTracks', +# typeName='TrackCollection', +# truthTarget='mc', +# truthPrefix='mc_', +# detailedTruthPrefix='detailed_mc_', +# truthMapKey='ConvertedMBoyTracksTruth', +# detailedTruthMapKey='ConvertedMBoyTracksTruth', +# SGKeyForDetailedTruth='ConvertedMBoyTracksTruth', +# flags=TrackD3PDFlags) + +# MuonTrackD3PDObject = TrackD3PDObject(_label='muon', +# _prefix='mutrk_', +# _sgkey='MuonSpectrometerTracks', +# typeName='TrackCollection', +# truthTarget='mc', +# truthPrefix='mc_', +# detailedTruthPrefix='detailed_mc_', +# truthMapKey='MuonSpectrometerTrackTruthCollection', +# detailedTruthMapKey='DetailedTrackTruth', +# SGKeyForDetailedTruth='MuonSpectrometerTracks', +# flags=TrackD3PDFlags) + +# MuonD3PDStream += MooreTrackD3PDObject(levelOfDetail) +# MuonD3PDStream += MboyTrackD3PDObject(levelOfDetail) +# MuonD3PDStream += MuonTrackD3PDObject(levelOfDetail) diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/CscPrepDataCollectionGetterTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/CscPrepDataCollectionGetterTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8ea8b07888121ee7b6a4b5d989371ca86eef0971 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/CscPrepDataCollectionGetterTool.cxx @@ -0,0 +1,128 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: CscPrepDataCollectionGetterTool.cxx 535250 2013-01-29 13:22:17Z salekd $ +#include "CscPrepDataCollectionGetterTool.h" + +namespace D3PD { + +CscPrepDataCollectionGetterTool::CscPrepDataCollectionGetterTool + (const std::string& type, + const std::string& name, + const IInterface* parent) + : Base (type, name, parent) +{ +} + +StatusCode CscPrepDataCollectionGetterTool::initialize() +{ + CHECK( Base::initialize() ); + + return StatusCode::SUCCESS; +} + +const std::type_info& CscPrepDataCollectionGetterTool::typeinfo() const +{ + return typeid(Muon::CscPrepDataContainer); +} + + +const std::type_info& CscPrepDataCollectionGetterTool::elementTypeinfo() const +{ + return typeid(Muon::CscPrepData); +} + +size_t CscPrepDataCollectionGetterTool::sizeHint(bool allowMissing) +{ + const Muon::CscPrepDataContainer* cont = (Muon::CscPrepDataContainer*)getUntyped(allowMissing); + + if (!cont) { + return 0; + } + int nclus = 0; + + // Loop over the container + Muon::CscPrepDataContainer::const_iterator itr = cont->begin(); + Muon::CscPrepDataContainer::const_iterator itr_end = cont->end(); + for( ; itr!=itr_end; ++itr ){ + + // Loop over the collection + Muon::CscPrepDataCollection::const_iterator itr_col = (*itr)->begin(); + Muon::CscPrepDataCollection::const_iterator itr_col_end = (*itr)->end(); + for( ; itr_col!=itr_col_end; ++itr_col ){ + nclus++; + } + } + + return nclus; +} + +StatusCode CscPrepDataCollectionGetterTool::reset(bool allowMissing) +{ + const Muon::CscPrepDataContainer* cont = (Muon::CscPrepDataContainer*)getUntyped(allowMissing); + + if (!cont) { + m_contItr = m_contEnd; + m_collItr = m_collEnd; + return StatusCode::FAILURE; + } + + m_contItr = cont->begin(); + m_contEnd = cont->end(); + + if(m_contItr == m_contEnd){ + m_collItr = m_collEnd; + return StatusCode::SUCCESS; + } + + m_collItr = (*m_contItr)->begin(); + m_collEnd = (*m_contItr)->end(); + + return StatusCode::SUCCESS; +} + + +const void* CscPrepDataCollectionGetterTool::nextUntyped() +{ + if(m_collItr == m_collEnd){ + if(m_contItr==m_contEnd){ + return 0; + } + m_contItr++; + if(m_contItr==m_contEnd){ + return 0; + } + m_collItr = (*m_contItr)->begin(); + m_collEnd = (*m_contItr)->end(); + if(m_collItr == m_collEnd){ + return 0; + } + } + + const Muon::CscPrepData *clus = *m_collItr; + + m_collItr++; + + return clus; +} + + +// Dummies --- the default versions of these don't compile. +// But these are overridden by the derived class here. +template<> +const std::type_info& +CollectionGetterTool<Muon::CscPrepDataContainer>::elementTypeinfo() const +{ + return typeid(Muon::CscPrepData); +} + +template<> +const void* +CollectionGetterTool<Muon::CscPrepDataContainer>::nextUntyped() +{ + return 0; +} + + +} diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/CscPrepDataCollectionGetterTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/CscPrepDataCollectionGetterTool.h new file mode 100644 index 0000000000000000000000000000000000000000..a485fbbbc65fbdfeed5858d76704cd91984b87aa --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/CscPrepDataCollectionGetterTool.h @@ -0,0 +1,57 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: CscPrepDataCollectionGetterTool.h 535250 2013-01-29 13:22:17Z salekd $ +#ifndef MUOND3PDMAKER_CSCPREPDATACOLLECTIONGETTERTOOL_H +#define MUOND3PDMAKER_CSCPREPDATACOLLECTIONGETTERTOOL_H + +#include "D3PDMakerUtils/SGCollectionGetterTool.h" +#include "MuonPrepRawData/CscPrepData.h" +#include "MuonPrepRawData/CscPrepDataCollection.h" +#include "MuonPrepRawData/CscPrepDataContainer.h" + +//namespace Muon { +// class CscPrepData; +//} + +namespace D3PD { + +class CscPrepDataCollectionGetterTool + : public SGCollectionGetterTool<Muon::CscPrepDataContainer> +{ +public: + typedef SGCollectionGetterTool<Muon::CscPrepDataContainer> Base; + + CscPrepDataCollectionGetterTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + StatusCode initialize(); + size_t sizeHint(bool=false); + StatusCode reset(bool=false); + const void* nextUntyped(); + const std::type_info& typeinfo() const; + const std::type_info& elementTypeinfo() const; + +private: + Muon::CscPrepDataContainer::const_iterator m_contItr; + Muon::CscPrepDataContainer::const_iterator m_contEnd; + + Muon::CscPrepDataCollection::const_iterator m_collItr; + Muon::CscPrepDataCollection::const_iterator m_collEnd; +}; + +// Dummies --- the default versions of these don't compile. +// But these are overridden by the derived class here. +template<> +const std::type_info& +CollectionGetterTool<Muon::CscPrepDataContainer>::elementTypeinfo() const; + +template<> +const void* +CollectionGetterTool<Muon::CscPrepDataContainer>::nextUntyped(); + +} + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/CscPrepDataFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/CscPrepDataFillerTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5b69c9fc89360ebbdf5daf4ec2fdac5e3c1efe97 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/CscPrepDataFillerTool.cxx @@ -0,0 +1,52 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: CscPrepDataFillerTool.cxx 535262 2013-01-29 13:54:17Z salekd $ +#include "CscPrepDataFillerTool.h" +#include "AthenaKernel/errorcheck.h" + + +namespace D3PD { + + +CscPrepDataFillerTool::CscPrepDataFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent) + : BlockFillerTool<Muon::CscPrepData> (type, name, parent) +{ + book().ignore(); // Avoid coverity warnings. +} + + +StatusCode CscPrepDataFillerTool::book() +{ + CHECK( addVariable ("x", m_x) ); + CHECK( addVariable ("y", m_y) ); + CHECK( addVariable ("z", m_z) ); + CHECK( addVariable ("time", m_time) ); + CHECK( addVariable ("locX", m_locX) ); + CHECK( addVariable ("status", m_status) ); + CHECK( addVariable ("timeStatus", m_timeStatus) ); + CHECK( addVariable ("charge", m_charge) ); + + return StatusCode::SUCCESS; +} + + +StatusCode CscPrepDataFillerTool::fill (const Muon::CscPrepData& obj) +{ + *m_x = obj.globalPosition().x(); + *m_y = obj.globalPosition().y(); + *m_z = obj.globalPosition().z(); + *m_time = obj.time(); + *m_locX = obj.localPosition().x(); + *m_status = obj.status(); + *m_timeStatus = obj.timeStatus(); + *m_charge = obj.charge(); + + return StatusCode::SUCCESS; +} + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/CscPrepDataFillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/CscPrepDataFillerTool.h new file mode 100644 index 0000000000000000000000000000000000000000..0c0c96810540edef593bc64078722c0d85a689ad --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/CscPrepDataFillerTool.h @@ -0,0 +1,54 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: CscPrepDataFillerTool.h 535262 2013-01-29 13:54:17Z salekd $ +#ifndef D3PDMAKER_CSCPREPDATAFILLERTOOL_H +#define D3PDMAKER_CSCPREPDATAFILLERTOOL_H + +#include "MuonPrepRawData/CscPrepData.h" +#include "MuonPrepRawData/CscPrepDataCollection.h" +#include "D3PDMakerUtils/BlockFillerTool.h" +#include "D3PDMakerUtils/SGCollectionGetterTool.h" +#include <string> + +namespace D3PD { + +/** + * @brief Block filler tool for the CSC hits + * + * @author David Salek <David.Salek@cern.ch> + * + * $Revision: 535262 $ + * $Date: 2013-01-29 14:54:17 +0100 (Tue, 29 Jan 2013) $ + */ +class CscPrepDataFillerTool + : public BlockFillerTool<Muon::CscPrepData> +{ +public: + /// Regular Gaudi AlgTool constructor + CscPrepDataFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + /// Function booking the ntuple variables + virtual StatusCode book(); + + /// Function filling the ntuple variables for a single object + virtual StatusCode fill (const Muon::CscPrepData& obj); + + +private: + float* m_x; + float* m_y; + float* m_z; + float* m_time; + float* m_locX; + int* m_status; + int* m_timeStatus; + int* m_charge; +}; + +} // namespace D3PD + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/EFInfoMuonKinematicsFiller.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/EFInfoMuonKinematicsFiller.cxx new file mode 100644 index 0000000000000000000000000000000000000000..bca6e37993ea048272854cb298b03f8cb66e79fe --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/EFInfoMuonKinematicsFiller.cxx @@ -0,0 +1,96 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/EFInfoMuonKinematicsFiller.h + * @author srivas prasad <srivas.prasad@cern.ch> + * @date Jan 2010 + * @brief Block filler tool for TrigMuonEFInfo, detail level 1 + */ + +#include "D3PDMakerUtils/BlockFillerTool.h" +#include "EFInfoMuonKinematicsFiller.h" +#include "TrigMuonEvent/TrigMuonEFInfo.h" +#include "TrigMuonEvent/TrigMuonEFTrack.h" +#include "TrigMuonEvent/TrigMuonEFCbTrack.h" +#include "TrigMuonEvent/TrigMuonEFInfoTrack.h" + +#include "AthenaKernel/errorcheck.h" + + + +namespace D3PD { + + +/** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ +EFInfoMuonKinematicsFiller::EFInfoMuonKinematicsFiller + (const std::string& type, + const std::string& name, + const IInterface* parent) + : BlockFillerTool<TrigMuonEFInfo> (type, name, parent) +{ + book().ignore(); // Avoid coverity warnings. +} + + +/** + * @brief Book variables for this block. + */ +StatusCode EFInfoMuonKinematicsFiller::book() +{ + CHECK( addVariable ("cb_eta", m_cb_eta) ); + CHECK( addVariable ("cb_phi", m_cb_phi) ); + CHECK( addVariable ("cb_pt" , m_cb_pt) ); + + CHECK( addVariable ("ms_eta", m_ms_eta) ); + CHECK( addVariable ("ms_phi", m_ms_phi) ); + CHECK( addVariable ("ms_pt" , m_ms_pt) ); + + CHECK( addVariable ("me_eta", m_me_eta) ); + CHECK( addVariable ("me_phi", m_me_phi) ); + CHECK( addVariable ("me_pt" , m_me_pt) ); + + // CHECK( addVariable ("etadiff", m_etadiff) ); + // CHECK( addVariable ("phidiff", m_phidiff) ); + + return StatusCode::SUCCESS; +} + + +/** + * @brief Fill one block --- type-safe version. + * @param p The input object. + * + * This is called once per object. The caller + * is responsible for arranging that all the pointers for booked variables + * are set appropriately upon entry. + */ +StatusCode EFInfoMuonKinematicsFiller::fill (const TrigMuonEFInfo& p) +{ + TrigMuonEFInfo &cp = const_cast<TrigMuonEFInfo &>(p); + TrigMuonEFCbTrack* cbtrk = cp.CombinedTrack(); + *m_cb_eta = (cbtrk ? cbtrk->eta() : -10); + *m_cb_phi = (cbtrk ? cbtrk->phi() : -10); + *m_cb_pt = (cbtrk && cbtrk->iPt()!= 0 ? cbtrk->pt() : -1.e9); + + const TrigMuonEFTrack* mstrk = cp.SpectrometerTrack(); + *m_ms_eta = (mstrk ? mstrk->eta() : -10); + *m_ms_phi = (mstrk ? mstrk->phi() : -10); + *m_ms_pt = (mstrk ? mstrk->pt() : -1.e9); + + const TrigMuonEFTrack* metrk = cp.ExtrapolatedTrack(); + *m_me_eta = (metrk ? metrk->eta() : -10); + *m_me_phi = (metrk ? metrk->phi() : -10); + *m_me_pt = (metrk ? metrk->pt() : -1.e9); + + return StatusCode::SUCCESS; +} + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/EFInfoMuonKinematicsFiller.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/EFInfoMuonKinematicsFiller.h new file mode 100644 index 0000000000000000000000000000000000000000..ab8e07af31395cacbc3a9b88e439babcf2593d7b --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/EFInfoMuonKinematicsFiller.h @@ -0,0 +1,89 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/EFInfoMuonKinematicsFiller.h + * @author srivas prasad <srivas.prasad@cern.ch> + * @date Jan 2010 + * @brief Block filler tool for TrigMuonEFInfo, detail level 1 + */ + +#ifndef MUOND3PDMAKER_EFINFOMUONKINEMATICSFILLER_H +#define MUOND3PDMAKER_EFINFOMUONKINEMATICSFILLER_H 1 + + +#include "D3PDMakerUtils/BlockFillerTool.h" +class TrigMuonEFInfo; + + +namespace D3PD { + + +/** + * @brief Block filler tool for TrigMuonEF + */ +class EFInfoMuonKinematicsFiller + : public BlockFillerTool<TrigMuonEFInfo> +{ +public: + /** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ + EFInfoMuonKinematicsFiller (const std::string& type, + const std::string& name, + const IInterface* parent); + + + /// Book variables for this block. + virtual StatusCode book(); + + + /** + * @brief Fill one block --- type-safe version. + * @param p The input object. + * + * This is called once per object. The caller + * is responsible for arranging that all the pointers for booked variables + * are set appropriately upon entry. + */ + virtual StatusCode fill (const TrigMuonEFInfo& p); + + +private: + /// Combined trigger track kinematics + /// Variable: pt combined + float* m_cb_pt; + /// Variable: eta combined + float* m_cb_eta; + /// Variable: phi combined + float* m_cb_phi; + + /// MS trigger track kinematics + /// Variable: pt combined + float* m_ms_pt; + /// Variable: eta combined + float* m_ms_eta; + /// Variable: phi combined + float* m_ms_phi; + + /// extrapolated MS trigger track kinematics + /// Variable: pt combined + float* m_me_pt; + /// Variable: eta combined + float* m_me_eta; + /// Variable: phi combined + float* m_me_phi; + + + + +}; + + +} + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/EFMuonFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/EFMuonFillerTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0a587136efb7f70ee910435d21a242419356ebab --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/EFMuonFillerTool.cxx @@ -0,0 +1,63 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/EFMuonFillerTool.h + * @author srivas prasad <srivas.prasad@cern.ch> + * @date Jan 2010 + * @brief Block filler tool for TrigMuonEF + */ + +#include "D3PDMakerUtils/BlockFillerTool.h" +#include "EFMuonFillerTool.h" +#include "TrigMuonEvent/TrigMuonEF.h" +#include "AthenaKernel/errorcheck.h" + + + +namespace D3PD { + + +/** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ +EFMuonFillerTool::EFMuonFillerTool + (const std::string& type, + const std::string& name, + const IInterface* parent) + : BlockFillerTool<TrigMuonEF> (type, name, parent) +{ + book().ignore(); // Avoid coverity warnings. +} + + +/** + * @brief Book variables for this block. + */ +StatusCode EFMuonFillerTool::book() +{ + CHECK( addVariable ("muoncode", m_muonCode) ); + return StatusCode::SUCCESS; +} + + +/** + * @brief Fill one block --- type-safe version. + * @param p The input object. + * + * This is called once per object. The caller + * is responsible for arranging that all the pointers for booked variables + * are set appropriately upon entry. + */ +StatusCode EFMuonFillerTool::fill (const TrigMuonEF& p) +{ + *m_muonCode = p.MuonCode(); + return StatusCode::SUCCESS; +} + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/EFMuonFillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/EFMuonFillerTool.h new file mode 100644 index 0000000000000000000000000000000000000000..2125d02a529b05c485604fdaf2616141c1f93223 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/EFMuonFillerTool.h @@ -0,0 +1,64 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/EFMuonFillerTool.h + * @author srivas prasad <srivas.prasad@cern.ch> + * @date Jan 2010 + * @brief Block filler tool for TrigMuonEF + */ + +#ifndef MUOND3PDMAKER_EFMUONFILLERTOOL_H +#define MUOND3PDMAKER_EFMUONFILLERTOOL_H 1 + + +#include "D3PDMakerUtils/BlockFillerTool.h" +class TrigMuonEF; + + +namespace D3PD { + + +/** + * @brief Block filler tool for TrigMuonEF + */ +class EFMuonFillerTool + : public BlockFillerTool<TrigMuonEF> +{ +public: + /** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ + EFMuonFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + + /// Book variables for this block. + virtual StatusCode book(); + + + /** + * @brief Fill one block --- type-safe version. + * @param p The input object. + * + * This is called once per object. The caller + * is responsible for arranging that all the pointers for booked variables + * are set appropriately upon entry. + */ + virtual StatusCode fill (const TrigMuonEF& p); + + +private: + /// Variable: muon code + int* m_muonCode; +}; + + +} + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/L2MuonCB1FillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/L2MuonCB1FillerTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a677dbf7b48c4e8085ce09b82623336a4f5036e2 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/L2MuonCB1FillerTool.cxx @@ -0,0 +1,88 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/L2MuonCB1FillerTool.h + * @author srivas prasad <srivas.prasad@cern.ch> + * @date Jan 2010 + * @brief Block filler tool for CombinedMuonFeature charge, detail level 1 + */ + +#include "L2MuonCB1FillerTool.h" +#include "TrigMuonEvent/CombinedMuonFeature.h" +#include "TrigMuonEvent/MuonFeature.h" +#include "TrigInDetEvent/TrigInDetTrack.h" +#include "TrigInDetEvent/TrigInDetTrackFitPar.h" +#include "AthenaKernel/errorcheck.h" + + + +namespace D3PD { + + +/** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ +L2MuonCB1FillerTool::L2MuonCB1FillerTool + (const std::string& type, + const std::string& name, + const IInterface* parent) + : BlockFillerTool<CombinedMuonFeature> (type, name, parent) +{ + book().ignore(); // Avoid coverity warnings. +} + + +/** + * @brief Book variables for this block. + */ +StatusCode L2MuonCB1FillerTool::book() +{ + CHECK( addVariable ("id_pt" , m_id_pt) ); + CHECK( addVariable ("ms_pt" , m_ms_pt) ); + + return StatusCode::SUCCESS; +} + + +/** + * @brief Fill one block --- type-safe version. + * @param p The input object. + * + * This is called once per object. The caller + * is responsible for arranging that all the pointers for booked variables + * are set appropriately upon entry. + */ +StatusCode L2MuonCB1FillerTool::fill (const CombinedMuonFeature& p) +{ + const TrigInDetTrack* idtrk = p.IDTrack(); + const MuonFeature* mstrk = p.muFastTrack(); + const TrigInDetTrackFitPar* idfp = 0; + + //double ideta = 100; + //double idphi = 100; + + if(idtrk) idfp = idtrk->param(); + if(idfp) { + *m_id_pt = idfp->pT(); + //ideta = idfp->eta(); + //idphi = idfp->phi0(); + } else { + *m_id_pt = -1.e9; // momenta are signed...small values not obviously junk. 1 PeV :) + } + + if(mstrk) { + *m_ms_pt = mstrk->pt() ; + }else { + *m_ms_pt = -1.e9; + } + + return StatusCode::SUCCESS; +} + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/L2MuonCB1FillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/L2MuonCB1FillerTool.h new file mode 100644 index 0000000000000000000000000000000000000000..86b5ed511febad9a86b1e5914726711e83039fe1 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/L2MuonCB1FillerTool.h @@ -0,0 +1,67 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/L2MuonCB1FillerTool.h + * @author srivas prasad <srivas.prasad@cern.ch> + * @date Jan 2010 + * @brief Block filler tool for CombinedMuonFeature, detail level 1 + */ + +#ifndef MUOND3PDMAKER_L2MUONCB1FILLERTOOL_H +#define MUOND3PDMAKER_L2MUONCB1FILLERTOOL_H + + +#include "D3PDMakerUtils/BlockFillerTool.h" +class CombinedMuonFeature; + + +namespace D3PD { + + +/** + * @brief Block filler tool for CombinedMuonFeature detail level 1. + */ +class L2MuonCB1FillerTool + : public BlockFillerTool<CombinedMuonFeature> +{ +public: + /** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ + L2MuonCB1FillerTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + + /// Book variables for this block. + virtual StatusCode book(); + + + /** + * @brief Fill one block --- type-safe version. + * @param p The input object. + * + * This is called once per object. The caller + * is responsible for arranging that all the pointers for booked variables + * are set appropriately upon entry. + */ + virtual StatusCode fill (const CombinedMuonFeature& p); + + +private: + /// Variable: pt of ID track + float* m_id_pt; + /// Variable: pt of MuFast track + float* m_ms_pt; +}; + + +} // namespace D3PD + + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/L2MuonCB2FillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/L2MuonCB2FillerTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b670bf469198fb4be2b5733b018cbfafb44793b9 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/L2MuonCB2FillerTool.cxx @@ -0,0 +1,73 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/L2MuonCB2FillerTool.h + * @author srivas prasad <srivas.prasad@cern.ch> + * @date Jan 2010 + * @brief Block filler tool for CombinedMuonFeature charge, detail level 2 + * + * ??? This should be changed to operate on TrigInDetTrack and + * moved to TriggerD3PDMaker. + */ + +#include "L2MuonCB2FillerTool.h" +#include "TrigMuonEvent/CombinedMuonFeature.h" +#include "TrigInDetEvent/TrigInDetTrack.h" +#include "AthenaKernel/errorcheck.h" + + +namespace D3PD { + + +/** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ +L2MuonCB2FillerTool::L2MuonCB2FillerTool + (const std::string& type, + const std::string& name, + const IInterface* parent) + : BlockFillerTool<CombinedMuonFeature> (type, name, parent) +{ + book().ignore(); // Avoid coverity warnings. +} + + +/** + * @brief Book variables for this block. + */ +StatusCode L2MuonCB2FillerTool::book() +{ + CHECK( addVariable ("nPixHits" , m_NPixelSpacePoints) ); + CHECK( addVariable ("nSCTHits" , m_NSCT_SpacePoints) ); + CHECK( addVariable ("nTRTHits" , m_NStrawHits) ); + CHECK( addVariable ("nTRTHighTHits" , m_NTRHits) ); + + return StatusCode::SUCCESS; +} + + +/** + * @brief Fill one block --- type-safe version. + * @param p The input object. + * + * This is called once per object. The caller + * is responsible for arranging that all the pointers for booked variables + * are set appropriately upon entry. + */ +StatusCode L2MuonCB2FillerTool::fill (const CombinedMuonFeature& p) +{ + const TrigInDetTrack* idtrk = p.IDTrack(); + *m_NPixelSpacePoints = (idtrk ? idtrk->NPixelSpacePoints() : -999); + *m_NSCT_SpacePoints = (idtrk ? idtrk->NSCT_SpacePoints() : -999); + *m_NStrawHits = (idtrk ? idtrk->NStrawHits() : -999); + *m_NTRHits = (idtrk ? idtrk->NTRHits() : -999); + return StatusCode::SUCCESS; +} + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/L2MuonCB2FillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/L2MuonCB2FillerTool.h new file mode 100644 index 0000000000000000000000000000000000000000..06fec0a4009649c787af46967a676025f5875945 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/L2MuonCB2FillerTool.h @@ -0,0 +1,75 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/L2MuonCB2FillerTool.h + * @author srivas prasad <srivas.prasad@cern.ch> + * @date Jan 2010 + * @brief Block filler tool for CombinedMuonFeature, detail level 2 + */ + +#ifndef MUOND3PDMAKER_L2MUONCB2FILLERTOOL_H +#define MUOND3PDMAKER_L2MUONCB2FILLERTOOL_H + + +#include "D3PDMakerUtils/BlockFillerTool.h" +class CombinedMuonFeature; + + +namespace D3PD { + + +/** + * @brief Block filler tool for CombinedMuonFeature, detail level 2 + */ +class L2MuonCB2FillerTool + : public BlockFillerTool<CombinedMuonFeature> +{ +public: + /** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ + L2MuonCB2FillerTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + + /// Book variables for this block. + virtual StatusCode book(); + + + /** + * @brief Fill one block --- type-safe version. + * @param p The input object. + * + * This is called once per object. The caller + * is responsible for arranging that all the pointers for booked variables + * are set appropriately upon entry. + */ + virtual StatusCode fill (const CombinedMuonFeature& p); + + +private: + /// Variable: number of pixel space points for ID track + int* m_NPixelSpacePoints; + + /// Variable: number of SCT space points for ID track + int* m_NSCT_SpacePoints; + + /// Variable: number of straw hits for ID track + int* m_NStrawHits; + + /// Variable: number of high-threshold hits for ID track + int* m_NTRHits; + +}; + + +} // namespace D3PD + + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MDTSimHitFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MDTSimHitFillerTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..70490fba3c66a02951d92ccc0df07150ae95cc27 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MDTSimHitFillerTool.cxx @@ -0,0 +1,59 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: MDTSimHitFillerTool.cxx 503989 2012-06-05 16:07:54Z ssnyder $ + +// Gaudi/Athena include(s): +#include "AthenaKernel/errorcheck.h" + +// Local include(s): +#include "MDTSimHitFillerTool.h" + +namespace D3PD { + + MDTSimHitFillerTool::MDTSimHitFillerTool( const std::string& type, + const std::string& name, + const IInterface* parent ) + : BlockFillerTool< MDTSimHit >( type, name, parent ) + { + book().ignore(); // Avoid coverity warnings. + } + + StatusCode MDTSimHitFillerTool::book() { + + CHECK( addVariable( "globalTime", m_globalTime, + "Add description here..." ) ); + CHECK( addVariable( "driftRadius", m_driftRadius, + "Add description here..." ) ); + CHECK( addVariable( "stepLength", m_stepLength, + "Add description here..." ) ); + CHECK( addVariable( "energyDeposit", m_energyDeposit, + "Add description here..." ) ); + CHECK( addVariable( "particleEncoding", m_particleEncoding, + "Add description here..." ) ); + CHECK( addVariable( "kineticEnergy", m_kineticEnergy, + "Add description here..." ) ); + CHECK( addVariable( "MDTid", m_MDTid, + "Add description here..." ) ); + CHECK( addVariable( "trackNumber", m_trackNumber, + "Number of track which released this energy" ) ); + + return StatusCode::SUCCESS; + } + + StatusCode MDTSimHitFillerTool::fill( const MDTSimHit& obj ) { + + *m_globalTime = obj.globalTime(); + *m_driftRadius = obj.driftRadius(); + *m_stepLength = obj.stepLength(); + *m_energyDeposit = obj.energyDeposit(); + *m_particleEncoding = obj.particleEncoding(); + *m_kineticEnergy = obj.kineticEnergy(); + *m_MDTid = obj.MDTid(); + *m_trackNumber = obj.trackNumber(); + + return StatusCode::SUCCESS; + } + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MDTSimHitFillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MDTSimHitFillerTool.h new file mode 100644 index 0000000000000000000000000000000000000000..7910a5ba805ea0774e9ab79e31cd427f4ec37144 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MDTSimHitFillerTool.h @@ -0,0 +1,56 @@ +// Dear emacs, this is -*- c++ -*- + +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: MDTSimHitFillerTool.h 499698 2012-05-08 16:02:28Z krasznaa $ +#ifndef MUOND3PDMAKER_MDTSIMHITFILLERTOOL_H +#define MUOND3PDMAKER_MDTSIMHITFILLERTOOL_H + +// EDM include(s): +#include "MuonSimEvent/MDTSimHit.h" + +// D3PDMaker include(s): +#include "D3PDMakerUtils/BlockFillerTool.h" + +namespace D3PD { + + /** + * @short Filler tool for the basic properties of MDTSimHit + * + * This tool can be used to save the simple properties of an + * MDTSimHit object. + * + * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> + * + * $Revision: 499698 $ + * $Date: 2012-05-08 18:02:28 +0200 (Tue, 08 May 2012) $ + */ + class MDTSimHitFillerTool : public BlockFillerTool< MDTSimHit > { + + public: + /// Regular Gaudi AlgTool constructor + MDTSimHitFillerTool( const std::string& type, const std::string& name, + const IInterface* parent ); + + /// Function booking the ntuple variables + virtual StatusCode book(); + /// Function filling the ntuple variables for a single object + virtual StatusCode fill( const MDTSimHit& obj ); + + private: + float* m_globalTime; + float* m_driftRadius; + float* m_stepLength; + float* m_energyDeposit; + int* m_particleEncoding; + float* m_kineticEnergy; + int* m_MDTid; + int* m_trackNumber; ///< Number of track which released this energy + + }; // class MDTSimHitFillerTool + +} // namespace D3PD + +#endif // MUOND3PDMAKER_MDTSIMHITFILLERTOOL_H diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MdtPrepDataCollectionGetterTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MdtPrepDataCollectionGetterTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..92307f7428805abd1c6b993c2c1c06a4e2f93abc --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MdtPrepDataCollectionGetterTool.cxx @@ -0,0 +1,128 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: MdtPrepDataCollectionGetterTool.cxx 535250 2013-01-29 13:22:17Z salekd $ +#include "MdtPrepDataCollectionGetterTool.h" + +namespace D3PD { + +MdtPrepDataCollectionGetterTool::MdtPrepDataCollectionGetterTool + (const std::string& type, + const std::string& name, + const IInterface* parent) + : Base (type, name, parent) +{ +} + +StatusCode MdtPrepDataCollectionGetterTool::initialize() +{ + CHECK( Base::initialize() ); + + return StatusCode::SUCCESS; +} + +const std::type_info& MdtPrepDataCollectionGetterTool::typeinfo() const +{ + return typeid(Muon::MdtPrepDataContainer); +} + + +const std::type_info& MdtPrepDataCollectionGetterTool::elementTypeinfo() const +{ + return typeid(Muon::MdtPrepData); +} + +size_t MdtPrepDataCollectionGetterTool::sizeHint(bool allowMissing) +{ + const Muon::MdtPrepDataContainer* cont = (Muon::MdtPrepDataContainer*)getUntyped(allowMissing); + + if (!cont) { + return 0; + } + int nclus = 0; + + // Loop over the container + Muon::MdtPrepDataContainer::const_iterator itr = cont->begin(); + Muon::MdtPrepDataContainer::const_iterator itr_end = cont->end(); + for( ; itr!=itr_end; ++itr ){ + + // Loop over the collection + Muon::MdtPrepDataCollection::const_iterator itr_col = (*itr)->begin(); + Muon::MdtPrepDataCollection::const_iterator itr_col_end = (*itr)->end(); + for( ; itr_col!=itr_col_end; ++itr_col ){ + nclus++; + } + } + + return nclus; +} + +StatusCode MdtPrepDataCollectionGetterTool::reset(bool allowMissing) +{ + const Muon::MdtPrepDataContainer* cont = (Muon::MdtPrepDataContainer*)getUntyped(allowMissing); + + if (!cont) { + m_contItr = m_contEnd; + m_collItr = m_collEnd; + return StatusCode::FAILURE; + } + + m_contItr = cont->begin(); + m_contEnd = cont->end(); + + if(m_contItr == m_contEnd){ + m_collItr = m_collEnd; + return StatusCode::SUCCESS; + } + + m_collItr = (*m_contItr)->begin(); + m_collEnd = (*m_contItr)->end(); + + return StatusCode::SUCCESS; +} + + +const void* MdtPrepDataCollectionGetterTool::nextUntyped() +{ + if(m_collItr == m_collEnd){ + if(m_contItr==m_contEnd){ + return 0; + } + m_contItr++; + if(m_contItr==m_contEnd){ + return 0; + } + m_collItr = (*m_contItr)->begin(); + m_collEnd = (*m_contItr)->end(); + if(m_collItr == m_collEnd){ + return 0; + } + } + + const Muon::MdtPrepData *clus = *m_collItr; + + m_collItr++; + + return clus; +} + + +// Dummies --- the default versions of these don't compile. +// But these are overridden by the derived class here. +template<> +const std::type_info& +CollectionGetterTool<Muon::MdtPrepDataContainer>::elementTypeinfo() const +{ + return typeid(Muon::MdtPrepData); +} + +template<> +const void* +CollectionGetterTool<Muon::MdtPrepDataContainer>::nextUntyped() +{ + return 0; +} + + +} diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MdtPrepDataCollectionGetterTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MdtPrepDataCollectionGetterTool.h new file mode 100644 index 0000000000000000000000000000000000000000..b6365f721f2eb1f9c04d6c9c36a2f2af29deb63b --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MdtPrepDataCollectionGetterTool.h @@ -0,0 +1,57 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: MdtPrepDataCollectionGetterTool.h 535250 2013-01-29 13:22:17Z salekd $ +#ifndef MUOND3PDMAKER_MDTPREPDATACOLLECTIONGETTERTOOL_H +#define MUOND3PDMAKER_MDTPREPDATACOLLECTIONGETTERTOOL_H + +#include "D3PDMakerUtils/SGCollectionGetterTool.h" +#include "MuonPrepRawData/MdtPrepData.h" +#include "MuonPrepRawData/MdtPrepDataCollection.h" +#include "MuonPrepRawData/MdtPrepDataContainer.h" + +//namespace Muon { +// class MdtPrepData; +//} + +namespace D3PD { + +class MdtPrepDataCollectionGetterTool + : public SGCollectionGetterTool<Muon::MdtPrepDataContainer> +{ +public: + typedef SGCollectionGetterTool<Muon::MdtPrepDataContainer> Base; + + MdtPrepDataCollectionGetterTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + StatusCode initialize(); + size_t sizeHint(bool=false); + StatusCode reset(bool=false); + const void* nextUntyped(); + const std::type_info& typeinfo() const; + const std::type_info& elementTypeinfo() const; + +private: + Muon::MdtPrepDataContainer::const_iterator m_contItr; + Muon::MdtPrepDataContainer::const_iterator m_contEnd; + + Muon::MdtPrepDataCollection::const_iterator m_collItr; + Muon::MdtPrepDataCollection::const_iterator m_collEnd; +}; + +// Dummies --- the default versions of these don't compile. +// But these are overridden by the derived class here. +template<> +const std::type_info& +CollectionGetterTool<Muon::MdtPrepDataContainer>::elementTypeinfo() const; + +template<> +const void* +CollectionGetterTool<Muon::MdtPrepDataContainer>::nextUntyped(); + +} + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MdtPrepDataFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MdtPrepDataFillerTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5f0ee8dc563aee988defb73e9ab5cd1a419a6d3b --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MdtPrepDataFillerTool.cxx @@ -0,0 +1,50 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: MdtPrepDataFillerTool.cxx 535262 2013-01-29 13:54:17Z salekd $ +#include "MdtPrepDataFillerTool.h" +#include "AthenaKernel/errorcheck.h" + + +namespace D3PD { + + +MdtPrepDataFillerTool::MdtPrepDataFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent) + : BlockFillerTool<Muon::MdtPrepData> (type, name, parent) +{ + book().ignore(); // Avoid coverity warnings. +} + + +StatusCode MdtPrepDataFillerTool::book() +{ + CHECK( addVariable ("x", m_x) ); + CHECK( addVariable ("y", m_y) ); + CHECK( addVariable ("z", m_z) ); + CHECK( addVariable ("tdc", m_tdc) ); + CHECK( addVariable ("adc", m_adc) ); + CHECK( addVariable ("locX", m_locX) ); + CHECK( addVariable ("status", m_status) ); + + return StatusCode::SUCCESS; +} + + +StatusCode MdtPrepDataFillerTool::fill (const Muon::MdtPrepData& obj) +{ + *m_x = obj.globalPosition().x(); + *m_y = obj.globalPosition().y(); + *m_z = obj.globalPosition().z(); + *m_tdc = obj.tdc(); + *m_adc = obj.adc(); + *m_locX = obj.localPosition().x(); + *m_status = obj.status(); + + return StatusCode::SUCCESS; +} + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MdtPrepDataFillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MdtPrepDataFillerTool.h new file mode 100644 index 0000000000000000000000000000000000000000..b92d57e4001a3671d3d275984e9503a77f536d1b --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MdtPrepDataFillerTool.h @@ -0,0 +1,55 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: MdtPrepDataFillerTool.h 535262 2013-01-29 13:54:17Z salekd $ +#ifndef D3PDMAKER_MDTPREPDATAFILLERTOOL_H +#define D3PDMAKER_MDTPREPDATAFILLERTOOL_H + +#include "MuonPrepRawData/MdtPrepData.h" +#include "MuonPrepRawData/MdtPrepDataCollection.h" +#include "D3PDMakerUtils/BlockFillerTool.h" +#include "D3PDMakerUtils/SGCollectionGetterTool.h" +#include <string> + +namespace Muon { class MdtPrepData; } + +namespace D3PD { + +/** + * @brief Block filler tool for the MDT hits + * + * @author David Salek <David.Salek@cern.ch> + * + * $Revision: 535262 $ + * $Date: 2013-01-29 14:54:17 +0100 (Tue, 29 Jan 2013) $ + */ +class MdtPrepDataFillerTool + : public BlockFillerTool<Muon::MdtPrepData> +{ +public: + /// Regular Gaudi AlgTool constructor + MdtPrepDataFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + /// Function booking the ntuple variables + virtual StatusCode book(); + + /// Function filling the ntuple variables for a single object + virtual StatusCode fill (const Muon::MdtPrepData& obj); + + +private: + float* m_x; + float* m_y; + float* m_z; + int* m_tdc; + int* m_adc; + float* m_locX; + int* m_status; +}; + +} // namespace D3PD + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonEFInfoTriggerObjectAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonEFInfoTriggerObjectAssociationTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..066e6d31f7758c33e5a8973ff37ecdfc02478baf --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonEFInfoTriggerObjectAssociationTool.cxx @@ -0,0 +1,49 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/MuonEFInfoTriggerObjectAssociationTool.h + * @author Srivas Prasad <srivas.prasad@cern.ch> + * @date Jan 2010 + * @brief Associate from an Analysis::Muon to matching Event Filter trigger object. + */ + + +#include "MuonEFInfoTriggerObjectAssociationTool.h" + + +namespace D3PD { + + +/** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ +MuonEFInfoTriggerObjectAssociationTool::MuonEFInfoTriggerObjectAssociationTool + (const std::string& type, + const std::string& name, + const IInterface* parent) + : Base (type, name, parent) +{ + declareProperty("EFTrigMatchType", m_efTrigMatchType); // CB or MS or ME or MG +} + +///const HepMC::GenParticle* +///MuonGenParticleAssociationTool::get (const Analysis::Muon& p) +///{ + +const TrigMuonEFInfo* MuonEFInfoTriggerObjectAssociationTool::get(const Analysis::Muon& p) { + if(m_efTrigMatchType=="CB") TrigMatch::TrigMuonEFInfoHelper::setTrackToUse(TrigMatch::useCombinedTrack); + else if(m_efTrigMatchType=="MS") TrigMatch::TrigMuonEFInfoHelper::setTrackToUse(TrigMatch::useSpectrometerTrack); + else if(m_efTrigMatchType=="ME") TrigMatch::TrigMuonEFInfoHelper::setTrackToUse(TrigMatch::useExtrapolatedTrack); + else if(m_efTrigMatchType=="MG") TrigMatch::TrigMuonEFInfoHelper::setTrackToUse(TrigMatch::useMuGirlTrack); + else REPORT_MESSAGE(MSG::ERROR) << "MuonD3PDMaker::MuonEFInfoTriggerObjectAssociationTool: bad trigger match type"; + + return Base::get(p); + +} + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonEFInfoTriggerObjectAssociationTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonEFInfoTriggerObjectAssociationTool.h new file mode 100644 index 0000000000000000000000000000000000000000..d6761371cc1d1e38da329403565bd0ad93789d3c --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonEFInfoTriggerObjectAssociationTool.h @@ -0,0 +1,67 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/MuonEFInfoTriggerObjectAssociationTool.h + * @author Srivas Prasad <srivas.prasad@cern.ch> + * @date Jan 2010 + * @brief Associate from an Analysis::Muon to matching Event Filter trigger object (TrigMuonEFInfo) + */ + +#ifndef MUOND3PDMAKER_MUONEFINFOTRIGGEROBJECTASSOCIATIONTOOL_H +#define MUOND3PDMAKER_MUONEFINFOTRIGGEROBJECTASSOCIATIONTOOL_H 1 + + +#include "TriggerD3PDMaker/TriggerObjectAssociationTool.h" +#include "muonEvent/Muon.h" +#include "muonEvent/MuonContainer.h" +#include "TrigMuonEvent/TrigMuonEFInfo.h" +#include "TrigMuonEvent/TrigMuonEFInfoContainer.h" +#include "TrigObjectMatching/TrigMuonEFInfoDistanceFunctor.h" +//#include Trigger/TrigEvent/TrigMuonEvent/TrigMuonEvent/TrigMuonEFInfo.h" +#include <string> + + + +namespace D3PD { + + +/** + * @brief Associate from an Analysis::Muon to matching Event Filter trigger object. + */ + typedef TriggerObjectAssociationTool<Analysis::Muon, TrigMuonEFInfo> + MuonEFInfoTriggerObjectAssociationToolBase; + +class MuonEFInfoTriggerObjectAssociationTool + : public MuonEFInfoTriggerObjectAssociationToolBase +{ +public: + typedef MuonEFInfoTriggerObjectAssociationToolBase Base; + + + /** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ + MuonEFInfoTriggerObjectAssociationTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + virtual const TrigMuonEFInfo* get(const Analysis::Muon& p); + +private: + // EFInfo track type to match to. Can be (muid) combined, mugirl, muon spectrometer, or extrapolated track + // see Trigger/TrigAnalysis/TrigObjectMatching/TrigObjectMatching/TrigMuonEFInfoDistanceFunctor.h + // and Trigger/TrigEvent/TrigMuonEvent/TrigMuonEvent/TrigMuonEFInfo.h + std::string m_efTrigMatchType; +}; + + +} // namespace D3PD + + + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonEFTriggerObjectAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonEFTriggerObjectAssociationTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ef789cdb213328cac3f759aa163d68f6de88df4b --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonEFTriggerObjectAssociationTool.cxx @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/MuonEFTriggerObjectAssociationTool.h + * @author Srivas Prasad <srivas.prasad@cern.ch> + * @date Jan 2010 + * @brief Associate from an Analysis::Muon to matching Event Filter trigger object. + */ + + +#include "MuonEFTriggerObjectAssociationTool.h" + + +namespace D3PD { + + +/** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ +MuonEFTriggerObjectAssociationTool::MuonEFTriggerObjectAssociationTool + (const std::string& type, + const std::string& name, + const IInterface* parent) + : Base (type, name, parent) +{ +} + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonEFTriggerObjectAssociationTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonEFTriggerObjectAssociationTool.h new file mode 100644 index 0000000000000000000000000000000000000000..1a7e2498cb75c833f057ffb763ead7c07847a0e2 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonEFTriggerObjectAssociationTool.h @@ -0,0 +1,56 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/MuonEFTriggerObjectAssociationTool.h + * @author Srivas Prasad <srivas.prasad@cern.ch> + * @date Jan 2010 + * @brief Associate from an Analysis::Muon to matching Event Filter trigger object. + */ + +#ifndef MUOND3PDMAKER_MUONEFTRIGGEROBJECTASSOCIATIONTOOL_H +#define MUOND3PDMAKER_MUONEFTRIGGEROBJECTASSOCIATIONTOOL_H 1 + + +#include "TriggerD3PDMaker/TriggerObjectAssociationTool.h" +#include "muonEvent/Muon.h" +#include "muonEvent/MuonContainer.h" +#include "TrigMuonEvent/TrigMuonEF.h" +#include "TrigMuonEvent/TrigMuonEFContainer.h" + + + +namespace D3PD { + + +/** + * @brief Associate from an Analysis::Muon to matching Event Filter trigger object. + */ + typedef TriggerObjectAssociationTool<Analysis::Muon, TrigMuonEF> + MuonEFTriggerObjectAssociationToolBase; + +class MuonEFTriggerObjectAssociationTool + : public MuonEFTriggerObjectAssociationToolBase +{ +public: + typedef MuonEFTriggerObjectAssociationToolBase Base; + + + /** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ + MuonEFTriggerObjectAssociationTool (const std::string& type, + const std::string& name, + const IInterface* parent); +}; + + +} // namespace D3PD + + + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonGenParticleAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonGenParticleAssociationTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b6589bbea6b8905d41dc5423c859bcd94b9f0f3c --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonGenParticleAssociationTool.cxx @@ -0,0 +1,96 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id$ +/** + * @file MuonD3PDMaker/src/MuonGenParticleAssociationTool.cxx + * @author scott snyder <snyder@bnl.gov> + * @date Feb, 2010 + * @brief Associate from a muon to a matched GenParticle via + * classification tool. + */ + + +#include "MuonGenParticleAssociationTool.h" +#include "xAODMuon/Muon.h" +#include "xAODTruth/TruthParticle.h" +#include "FourMomUtils/P4Helpers.h" +#include "AthenaKernel/errorcheck.h" +#include <cstdlib> + + +namespace D3PD { + + +/** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ +MuonGenParticleAssociationTool::MuonGenParticleAssociationTool + (const std::string& type, + const std::string& name, + const IInterface* parent) + : Base (type, name, parent), + m_classifier ("MCTruthClassifier") +{ + declareProperty ("Classifier", m_classifier, "Classifier tool instance."); + declareProperty ("DRVar", m_drvar, + "If not empty, the variable name to use for DR."); + + m_dr = 0; +} + + +/** + * @brief Standard Gaudi initialize method. + */ +StatusCode MuonGenParticleAssociationTool::initialize() +{ + CHECK( Base::initialize() ); + CHECK( m_classifier.retrieve() ); + return StatusCode::SUCCESS; +} + + +/** + * @brief Create any needed tuple variables. + */ +StatusCode MuonGenParticleAssociationTool::book () +{ + if (!m_drvar.empty()) + CHECK( addVariable (m_drvar, m_dr) ); + return StatusCode::SUCCESS; +} + + +/** + * @brief Return the target object. + * @param p The source object for the association. + * + * Return the target of the association, or 0. + */ +const xAOD::TruthParticle* +MuonGenParticleAssociationTool::get (const xAOD::Muon& p) +{ + const xAOD::TruthParticle* out = 0; + if (m_classifier->particleTruthClassifier (&p).first != + MCTruthPartClassifier::Unknown) + { + out = m_classifier->getGenPart(); + } + + if (!m_drvar.empty()) { + if (out) + *m_dr = p.p4().DeltaR(out->p4()); + else + *m_dr = -999; + } + + return out; +} + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonGenParticleAssociationTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonGenParticleAssociationTool.h new file mode 100644 index 0000000000000000000000000000000000000000..d80d0128bfae0e7d4727dd82f56778a20e8909c2 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonGenParticleAssociationTool.h @@ -0,0 +1,86 @@ +// This file's extension implies that it's C, but it's really -*- C++ -*-. + +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id$ +/** + * @file MuonD3PDMaker/src/MuonGenParticleAssociationTool.h + * @author scott snyder <snyder@bnl.gov> + * @date Feb, 2010 + * @brief Associate from a muon to a matched GenParticle via + * classification tool. + */ + + +#ifndef MUOND3PDMAKER_MUONGENPARTICLEASSOCIATIONTOOL_H +#define MUOND3PDMAKER_MUONGENPARTICLEASSOCIATIONTOOL_H + + +#include "D3PDMakerUtils/SingleAssociationTool.h" +#include "MCTruthClassifier/IMCTruthClassifier.h" +#include "xAODMuon/Muon.h" +#include "xAODTruth/TruthParticle.h" +#include "GaudiKernel/ToolHandle.h" + + +namespace D3PD { + + +/** + * @brief Associate from an electron/photon to a matched GenParticle via + * classification tool. + */ +class MuonGenParticleAssociationTool + : public SingleAssociationTool<xAOD::Muon, xAOD::TruthParticle> +{ +public: + typedef SingleAssociationTool<xAOD::Muon, xAOD::TruthParticle> Base; + + + /** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ + MuonGenParticleAssociationTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + + /// Standard Gaudi initialize method. + StatusCode initialize(); + + + /// Create any needed tuple variables. + StatusCode book (); + + + /** + * @brief Return the target object. + * @param p The source object for the association. + * + * Return the target of the association, or 0. + */ + virtual const xAOD::TruthParticle* get (const xAOD::Muon& p); + + +private: + /// Property: classifier tool. + ToolHandle<IMCTruthClassifier> m_classifier; + + /// Property: If not empty, the variable name to use for DR. + std::string m_drvar; + + /// Variable: DR between reco and truth. + float* m_dr; +}; + + +} // namespace D3PD + + + +#endif // not MUOND3PDMAKER_MUONGENPARTICLEASSOCIATIONTOOL_H diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonL1TriggerObjectAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonL1TriggerObjectAssociationTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8dc148956dadb325c99f8113ffce8ca6f20bf1f7 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonL1TriggerObjectAssociationTool.cxx @@ -0,0 +1,39 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/MuonL1TriggerObjectAssociationTool.h + * @author Srivas Prasad <srivas.prasad@cern.ch> + * @date Jan 2010 + * @brief Associate from an Analysis::Muon to matching L1 trigger object. + */ + + +#include "MuonL1TriggerObjectAssociationTool.h" +#include "AthenaKernel/errorcheck.h" + + +namespace D3PD { + + +/** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ +MuonL1TriggerObjectAssociationTool::MuonL1TriggerObjectAssociationTool + (const std::string& type, + const std::string& name, + const IInterface* parent) + : Base (type, name, parent) +{ + if (setProperty ("ChainPattern", "L1_MU.*").isFailure()) { + REPORT_MESSAGE (MSG::ERROR) << "Can't set ChainPattern property for tool " + << type << "/" << name; + } +} + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonL1TriggerObjectAssociationTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonL1TriggerObjectAssociationTool.h new file mode 100644 index 0000000000000000000000000000000000000000..25211e58ee0c83e7a1d6d8fd1ef9eee434bc4d55 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonL1TriggerObjectAssociationTool.h @@ -0,0 +1,54 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/MuonL1TriggerObjectAssociationTool.h + * @author Srivas Prasad <srivas.prasad@cern.ch> + * @date Jan 2010 + * @brief Associate from an Analysis::Muon to matching L1 trigger object. + */ + + +#ifndef MUOND3PDMAKER_MUONL1TRIGGEROBJECTASSOCIATIONTOOL_H +#define MUOND3PDMAKER_MUONL1TRIGGEROBJECTASSOCIATIONTOOL_H + + +#include "TriggerD3PDMaker/TriggerObjectAssociationTool.h" +#include "AnalysisTriggerEvent/Muon_ROI.h" +#include "muonEvent/Muon.h" + + +namespace D3PD { + + +/** + * @brief Associate from an Analysis::Muon to matching L1 trigger object. + */ + typedef TriggerObjectAssociationTool<Analysis::Muon, Muon_ROI> + MuonL1TriggerObjectAssociationToolBase; + +class MuonL1TriggerObjectAssociationTool + : public MuonL1TriggerObjectAssociationToolBase +{ +public: + typedef MuonL1TriggerObjectAssociationToolBase Base; + + + /** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ + MuonL1TriggerObjectAssociationTool (const std::string& type, + const std::string& name, + const IInterface* parent); +}; + + +} // namespace D3PD + + + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonL2TriggerObjectAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonL2TriggerObjectAssociationTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..25df931410aa0ba5f2d6a4ad04ae3bfdb0f377d6 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonL2TriggerObjectAssociationTool.cxx @@ -0,0 +1,42 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/MuonL2TriggerObjectAssociationTool.h + * @author Srivas Prasad <srivas.prasad@cern.ch> + * @date Jan 2010 + * @brief Associate from an Analysis::Muon to matching L2 trigger object. + */ + + +#include "MuonL2TriggerObjectAssociationTool.h" +#include "SGTools/BaseInfo.h" + + +SG_ADD_BASE(CombinedMuonFeature, SG_VIRTUAL(INavigable4Momentum)); + + +namespace D3PD { + + +/** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ +MuonL2TriggerObjectAssociationTool::MuonL2TriggerObjectAssociationTool + (const std::string& type, + const std::string& name, + const IInterface* parent) + : Base (type, name, parent) +{ + if (setProperty ("ChainPattern", "L2_mu.*").isFailure()) { + REPORT_MESSAGE (MSG::ERROR) << "Can't set ChainPattern property for tool " + << type << "/" << name; + } +} + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonL2TriggerObjectAssociationTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonL2TriggerObjectAssociationTool.h new file mode 100644 index 0000000000000000000000000000000000000000..56a9717aefbac003ad75f246a4143c1bb6909ac8 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonL2TriggerObjectAssociationTool.h @@ -0,0 +1,54 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/MuonL2TriggerObjectAssociationTool.h + * @author Srivas Prasad <srivas.prasad@cern.ch> + * @date Jan 2010 + * @brief Associate from an Analysis::Muon to matching L2 trigger object. + */ + + +#ifndef MUOND3PDMAKER_MUONL2TRIGGEROBJECTASSOCIATIONTOOL_H +#define MUOND3PDMAKER_MUONL2TRIGGEROBJECTASSOCIATIONTOOL_H + + +#include "TriggerD3PDMaker/TriggerObjectAssociationTool.h" +#include "muonEvent/Muon.h" +#include "TrigMuonEvent/CombinedMuonFeature.h" +#include "TrigMuonEvent/CombinedMuonFeatureContainer.h" + +namespace D3PD { + + +/** + * @brief Associate from a muon to its matching L2 trigger object. + */ + typedef TriggerObjectAssociationTool<Analysis::Muon, CombinedMuonFeature> + MuonL2TriggerObjectAssociationToolBase; + +class MuonL2TriggerObjectAssociationTool + : public MuonL2TriggerObjectAssociationToolBase +{ +public: + typedef MuonL2TriggerObjectAssociationToolBase Base; + + + /** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ + MuonL2TriggerObjectAssociationTool (const std::string& type, + const std::string& name, + const IInterface* parent); +}; + + +} // namespace D3PD + + + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonNumberOfSegmentsFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonNumberOfSegmentsFillerTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7186bc43259560188454e24a42525b8b771edff8 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonNumberOfSegmentsFillerTool.cxx @@ -0,0 +1,62 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id$ +/** + * @file MuonD3PDMaker/src/MuonNumberOfSegmentsFillerTool.cxx + * @author scott snyder <snyder@bnl.gov> + * @date Apr, 2014 + * @brief Fill number of muon segments. + */ + + +#include "MuonNumberOfSegmentsFillerTool.h" +#include "AthenaKernel/errorcheck.h" + + +namespace D3PD { + + +/** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ +MuonNumberOfSegmentsFillerTool::MuonNumberOfSegmentsFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent) + : BlockFillerTool<xAOD::Muon> (type, name, parent) +{ + book().ignore(); // Avoid coverity warnings. +} + + +/** + * @brief Book variables for this block. + */ +StatusCode MuonNumberOfSegmentsFillerTool::book() +{ + CHECK( addVariable ("numberOfSegments", m_numberOfSegments, + "Number of segments.") ); + return StatusCode::SUCCESS; +} + + +/** + * @brief Fill one block --- type-safe version. + * @param p The input object. + * + * This is called once per object. The caller + * is responsible for arranging that all the pointers for booked variables + * are set appropriately upon entry. + */ +StatusCode MuonNumberOfSegmentsFillerTool::fill (const xAOD::Muon& p) +{ + *m_numberOfSegments = p.nMuonSegments(); + return StatusCode::SUCCESS; +} + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonNumberOfSegmentsFillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonNumberOfSegmentsFillerTool.h new file mode 100644 index 0000000000000000000000000000000000000000..cc664ebfabd9a9a1e2478a880b4625e6d32a78b5 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonNumberOfSegmentsFillerTool.h @@ -0,0 +1,70 @@ +// This file's extension implies that it's C, but it's really -*- C++ -*-. + +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id$ +/** + * @file MuonD3PDMaker/src/MuonNumberOfSegmentsFillerTool.h + * @author scott snyder <snyder@bnl.gov> + * @date Apr, 2014 + * @brief Fill number of muon segments. + */ + + +#ifndef MUOND3PDMAKER_MUONNUMBEROFSEGMENTSFILLERTOOL_H +#define MUOND3PDMAKER_MUONNUMBEROFSEGMENTSFILLERTOOL_H + + +#include "D3PDMakerUtils/BlockFillerTool.h" +#include "xAODMuon/Muon.h" +#include "GaudiKernel/ToolHandle.h" + + +namespace D3PD { + + +/** + * @brief Fill number of muon segments. + */ +class MuonNumberOfSegmentsFillerTool + : public BlockFillerTool<xAOD::Muon> +{ +public: + /** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ + MuonNumberOfSegmentsFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + + /// Book variables for this block. + virtual StatusCode book(); + + + /** + * @brief Fill one block --- type-safe version. + * @param p The input object. + * + * This is called once per object. The caller + * is responsible for arranging that all the pointers for booked variables + * are set appropriately upon entry. + */ + virtual StatusCode fill (const xAOD::Muon& p); + + +private: + /// Variable: Number of muon segments. + bool* m_numberOfSegments; +}; + + +} // namespace D3PD + + +#endif // not MUOND3PDMAKER_MUONNUMBEROFSEGMENTSFILLERTOOL_H diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationFillerTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..82f1bef406c7f5274f3f1984a94b02daaa070f36 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationFillerTool.cxx @@ -0,0 +1,219 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +////////////////////////////////////////////////////// +// +// Author : Daniel Ventura <ventura@cern.ch> +// +////////////////////////////////////////////////////// +#include "MuonPatternCombinationFillerTool.h" +#include "AthenaKernel/errorcheck.h" +#include "TrkTruthData/TruthTrajectory.h" +#include "HepMC/GenParticle.h" +#include "TrkTruthData/PRD_MultiTruthCollection.h" +#include "MuonPattern/MuonPatternCombinationCollection.h" +#include "MuonPattern/DetailedMuonPatternTruthCollection.h" +#include "MuonTruthAlgs/MuonPatternCombinationDetailedTrackTruthMaker.h" +#include "StoreGate/StoreGateSvc.h" +#include "TrkPrepRawData/PrepRawData.h" + + +namespace D3PD { + + + MuonPatternCombinationFillerTool::MuonPatternCombinationFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent) + : BlockFillerTool<Muon::MuonPatternCombination> (type, name, parent) , + m_idHelper(0), + m_truthTool("Trk::DetailedMuonPatternTruthBuilder/DetailedMuonPatternTruthBuilder") { + + declareProperty("DetailedMuonPatternTruthTool", m_truthTool); + declareProperty("MuonPatternCombinationCollection", m_patternKey = "MuonRoadPatternCombinations"); + } + + + StatusCode MuonPatternCombinationFillerTool::book() { + //branches + CHECK( addVariable("gpos_eta", m_pattern_gpos_eta) ); + CHECK( addVariable("gpos_phi", m_pattern_gpos_phi) ); + CHECK( addVariable("gpos_r", m_pattern_gpos_r) ); + CHECK( addVariable("gpos_z", m_pattern_gpos_z) ); + CHECK( addVariable("gdir_x", m_pattern_gdir_x) ); + CHECK( addVariable("gdir_y", m_pattern_gdir_y) ); + CHECK( addVariable("gdir_z", m_pattern_gdir_z) ); + CHECK( addVariable("seedType", m_pattern_seedType) ); + CHECK( addVariable("nMDT", m_pattern_nMDT) ); + CHECK( addVariable("nRPC", m_pattern_nRPC) ); + CHECK( addVariable("nTGC", m_pattern_nTGC) ); + CHECK( addVariable("nCSC", m_pattern_nCSC) ); + CHECK( addVariable("truth_barcode", m_truth_barcode) ); + CHECK( addVariable("truth_nMDT", m_truth_nMDT) ); + CHECK( addVariable("truth_nRPC", m_truth_nRPC) ); + CHECK( addVariable("truth_nTGC", m_truth_nTGC) ); + CHECK( addVariable("truth_nCSC", m_truth_nCSC) ); + CHECK( addVariable("noise_nMDT", m_noise_nMDT) ); + CHECK( addVariable("noise_nRPC", m_noise_nRPC) ); + CHECK( addVariable("noise_nTGC", m_noise_nTGC) ); + CHECK( addVariable("noise_nCSC", m_noise_nCSC) ); + CHECK( addVariable("common_nMDT", m_common_nMDT) ); + CHECK( addVariable("common_nRPC", m_common_nRPC) ); + CHECK( addVariable("common_nTGC", m_common_nTGC) ); + CHECK( addVariable("common_nCSC", m_common_nCSC) ); + + //constants + m_pi = 3.1415926; + + //get tools + if(m_truthTool.retrieve().isFailure() ){ + ATH_MSG_FATAL( "Could not get " << m_truthTool ); + return StatusCode::FAILURE; + } + if(!detStore()->retrieve(m_idHelper, "AtlasID").isSuccess()) { + ATH_MSG_FATAL("Unable to initialize ID helper."); + return StatusCode::FAILURE; + } + + + return StatusCode::SUCCESS; + } + + + StatusCode MuonPatternCombinationFillerTool::fill(const Muon::MuonPatternCombination& pattern) { + if(pattern.chamberData().size() == 0) return StatusCode::SUCCESS; + Amg::Vector3D gpos = pattern.chamberData().front().intersectPosition(); + *m_pattern_gpos_eta = static_cast<float>(gpos.eta()); + *m_pattern_gpos_phi = static_cast<float>(gpos.phi()); + *m_pattern_gpos_r = static_cast<float>(gpos.norm()); + *m_pattern_gpos_z = static_cast<float>(gpos.z()); + + Amg::Vector3D gdir = pattern.chamberData().front().intersectDirection(); + *m_pattern_gdir_x = static_cast<float>(gdir.x()); + *m_pattern_gdir_y = static_cast<float>(gdir.y()); + *m_pattern_gdir_z = static_cast<float>(gdir.z()); + *m_pattern_seedType = static_cast<int>(pattern.trackRoadType()); + + //hits from the pattern combination + int nPatternMDT(0),nPatternRPC(0),nPatternTGC(0),nPatternCSC(0); + std::vector< Muon::MuonPatternChamberIntersect >::const_iterator chit = pattern.chamberData().begin(); + for(; chit!=pattern.chamberData().end(); ++chit) { + if((*chit).prepRawDataVec().size() == 0) continue; + SubDetHitStatistics::SubDetType subdet = findSubDetType( (*chit).prepRawDataVec().at(0)->identify() ); + if(subdet == SubDetHitStatistics::MDT) nPatternMDT += (*chit).prepRawDataVec().size(); + else if(subdet == SubDetHitStatistics::RPC) nPatternRPC += (*chit).prepRawDataVec().size(); + else if(subdet == SubDetHitStatistics::TGC) nPatternTGC += (*chit).prepRawDataVec().size(); + else if(subdet == SubDetHitStatistics::CSC) nPatternCSC += (*chit).prepRawDataVec().size(); + } + *m_pattern_nMDT = static_cast<float>(nPatternMDT); + *m_pattern_nRPC = static_cast<float>(nPatternRPC); + *m_pattern_nTGC = static_cast<float>(nPatternTGC); + *m_pattern_nCSC = static_cast<float>(nPatternCSC); + + //---------------------------------------------------------------- + // Retrieve prep raw data truth + std::vector<std::string> PRD_TruthNames; + PRD_TruthNames.push_back("CSC_TruthMap"); + PRD_TruthNames.push_back("RPC_TruthMap"); + PRD_TruthNames.push_back("TGC_TruthMap"); + PRD_TruthNames.push_back("MDT_TruthMap"); + + std::vector<const PRD_MultiTruthCollection*> prdCollectionVector; + for(std::vector<std::string>::const_iterator ikey=PRD_TruthNames.begin(); ikey!=PRD_TruthNames.end(); ++ikey) { + prdCollectionVector.push_back(0); + StatusCode sc = evtStore()->retrieve(*prdCollectionVector.rbegin(), *ikey); + if (!sc.isSuccess()){ + ATH_MSG_WARNING( "PRD_MultiTruthCollection " << *ikey << " NOT found"); + } else { + ATH_MSG_DEBUG( "Got PRD_MultiTruthCollection " << *ikey); + } + } + + //---------------------------------------------------------------- + // Produce and store the output. + std::vector<DetailedTrackTruth> *dtt = new std::vector<DetailedTrackTruth>; + m_truthTool->buildDetailedTrackTruth(dtt, pattern, prdCollectionVector); + + bool isTruthMatched(false); + for(std::vector<DetailedTrackTruth>::const_iterator dtit=dtt->begin(); dtit!=dtt->end(); ++dtit) { + const TruthTrajectory traj = (*dtit).trajectory(); + std::cout << "check trajectory" << std::endl; + if(traj[0].isValid()) { + isTruthMatched = true; + + vector<int> barcode_list; + for(unsigned int i = 0; i < traj.size(); i++) { + barcode_list.push_back(traj[i].barcode()); + } + m_truth_barcode->push_back(barcode_list); + m_truth_nMDT->push_back(dtit->statsTruth()[SubDetHitStatistics::MDT]); + m_truth_nRPC->push_back(dtit->statsTruth()[SubDetHitStatistics::RPC]); + m_truth_nTGC->push_back(dtit->statsTruth()[SubDetHitStatistics::TGC]); + m_truth_nCSC->push_back(dtit->statsTruth()[SubDetHitStatistics::CSC]); + m_common_nMDT->push_back(dtit->statsCommon()[SubDetHitStatistics::MDT]); + m_common_nRPC->push_back(dtit->statsCommon()[SubDetHitStatistics::RPC]); + m_common_nTGC->push_back(dtit->statsCommon()[SubDetHitStatistics::TGC]); + m_common_nCSC->push_back(dtit->statsCommon()[SubDetHitStatistics::CSC]); + m_noise_nMDT->push_back(dtit->statsTrack()[SubDetHitStatistics::MDT]-dtit->statsCommon()[SubDetHitStatistics::MDT]); + m_noise_nRPC->push_back(dtit->statsTrack()[SubDetHitStatistics::RPC]-dtit->statsCommon()[SubDetHitStatistics::RPC]); + m_noise_nTGC->push_back(dtit->statsTrack()[SubDetHitStatistics::TGC]-dtit->statsCommon()[SubDetHitStatistics::TGC]); + m_noise_nCSC->push_back(dtit->statsTrack()[SubDetHitStatistics::CSC]-dtit->statsCommon()[SubDetHitStatistics::CSC]); + } + } + if(!isTruthMatched) { + vector<int> temp; + temp.push_back(0); + m_truth_barcode->push_back(temp); + m_truth_nMDT->push_back(0); + m_truth_nRPC->push_back(0); + m_truth_nTGC->push_back(0); + m_truth_nCSC->push_back(0); + m_common_nMDT->push_back(0); + m_common_nRPC->push_back(0); + m_common_nTGC->push_back(0); + m_common_nCSC->push_back(0); + m_noise_nMDT->push_back(0); + m_noise_nRPC->push_back(0); + m_noise_nTGC->push_back(0); + m_noise_nCSC->push_back(0); + } + + std::cout << "deleting the dtt" << std::endl; + if(dtt) delete dtt; + + std::cout << "Filled MuonPatternCombination information" << std::endl; + return StatusCode::SUCCESS; + } + + double MuonPatternCombinationFillerTool::deltaR(double eta1, double eta2, double phi1, double phi2) { + double Deta = eta1 - eta2; + double Dphi = phi1 - phi2; + if(Dphi > m_pi) Dphi -= 2*m_pi; + else if(Dphi < -m_pi) Dphi += 2*m_pi; + double DR = sqrt(Deta*Deta + Dphi*Dphi); + return DR; + } + + SubDetHitStatistics::SubDetType MuonPatternCombinationFillerTool::findSubDetType(Identifier id) { + if (m_idHelper->is_pixel(id)) + return SubDetHitStatistics::Pixel; + if (m_idHelper->is_sct(id)) + return SubDetHitStatistics::SCT; + if (m_idHelper->is_trt(id)) + return SubDetHitStatistics::TRT; + if (m_idHelper->is_mdt(id)) + return SubDetHitStatistics::MDT; + if (m_idHelper->is_rpc(id)) + return SubDetHitStatistics::RPC; + if (m_idHelper->is_tgc(id)) + return SubDetHitStatistics::TGC; + if (m_idHelper->is_csc(id)) + return SubDetHitStatistics::CSC; + + + ATH_MSG_WARNING("findSubDetType(): UNKNOWN subdet for id="<<id); + return SubDetHitStatistics::NUM_SUBDETECTORS; + } + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationFillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationFillerTool.h new file mode 100644 index 0000000000000000000000000000000000000000..e8e30d6e6fe1b3fb2db0a8d939086eb96d661be3 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationFillerTool.h @@ -0,0 +1,80 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/MuonPatternCombinationFillerTool.h + * @author Daniel Ventura <ventura@cern.ch> + * @date July 2012 + * @brief Block filler tool for MuonPatternCombinations, detail level 1 + */ + +#ifndef D3PDMAKER_MUONPATTERNCOMBINATIONFILLERTOOL_H +#define D3PDMAKER_MUONPATTERNCOMBINATIONFILLERTOOL_H + +#include "GaudiKernel/ToolHandle.h" +#include "D3PDMakerUtils/BlockFillerTool.h" +#include "MuonPattern/MuonPatternCombination.h" +#include "MuonRecToolInterfaces/IDetailedMuonPatternTruthBuilder.h" +#include "TrkTruthData/SubDetHitStatistics.h" +#include "AtlasDetDescr/AtlasDetectorID.h" + +#include <vector> +using namespace std; + +namespace D3PD { + + +class MuonPatternCombinationFillerTool + : public BlockFillerTool< Muon::MuonPatternCombination > +{ +public: + MuonPatternCombinationFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + virtual StatusCode book(); + + virtual StatusCode fill(const Muon::MuonPatternCombination& pattern); + virtual double deltaR(double eta1, double eta2, double phi1, double phi2); + virtual SubDetHitStatistics::SubDetType findSubDetType(Identifier id); + +private: + float* m_pattern_gpos_eta; + float* m_pattern_gpos_phi; + float* m_pattern_gpos_r; + float* m_pattern_gpos_z; + float* m_pattern_gdir_x; + float* m_pattern_gdir_y; + float* m_pattern_gdir_z; + int* m_pattern_seedType; + int* m_pattern_nMDT; + int* m_pattern_nRPC; + int* m_pattern_nTGC; + int* m_pattern_nCSC; + vector<vector<int> >* m_truth_barcode; + vector<int>* m_truth_nMDT; + vector<int>* m_truth_nRPC; + vector<int>* m_truth_nTGC; + vector<int>* m_truth_nCSC; + vector<int>* m_noise_nMDT; + vector<int>* m_noise_nRPC; + vector<int>* m_noise_nTGC; + vector<int>* m_noise_nCSC; + vector<int>* m_common_nMDT; + vector<int>* m_common_nRPC; + vector<int>* m_common_nTGC; + vector<int>* m_common_nCSC; + + int m_matchedTruth; + std::string m_truthSGkey; + std::string m_patternKey; + double m_pi; + + const AtlasDetectorID *m_idHelper; + ToolHandle<Trk::IDetailedMuonPatternTruthBuilder> m_truthTool; +}; + +} // namespace D3PD + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationMissedHitFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationMissedHitFillerTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d586970e739200a784cdfd845b82db32c7860b90 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationMissedHitFillerTool.cxx @@ -0,0 +1,257 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +////////////////////////////////////////////////////// +// +// Author : Daniel Ventura <ventura@cern.ch> +// +////////////////////////////////////////////////////// +#include "MuonPatternCombinationMissedHitFillerTool.h" +#include "AthenaKernel/errorcheck.h" +#include "TrkTruthData/TruthTrajectory.h" +#include "HepMC/GenParticle.h" +#include "TrkTruthData/PRD_MultiTruthCollection.h" +#include "MuonPattern/MuonPatternCombinationCollection.h" +#include "MuonPattern/DetailedMuonPatternTruthCollection.h" +#include "MuonTruthAlgs/MuonPatternCombinationDetailedTrackTruthMaker.h" +#include "StoreGate/StoreGateSvc.h" +#include "TrkPrepRawData/PrepRawData.h" +#include "MuonPrepRawData/MuonPrepDataContainer.h" +#include "MuonPrepRawData/MuonPrepDataCollection.h" +#include "MuonPattern/MuonPatternChamberIntersect.h" + + +namespace D3PD { + + + MuonPatternCombinationMissedHitFillerTool::MuonPatternCombinationMissedHitFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent) + : BlockFillerTool< EventInfo > (type, name, parent) , + m_idHelper(0), + m_truthTool("Trk::DetailedMuonPatternTruthBuilder/DetailedMuonPatternTruthBuilder") { + + declareProperty("DetailedMuonPatternTruthMissedHitTool", m_truthTool); + } + + + StatusCode MuonPatternCombinationMissedHitFillerTool::book() { + // branches + CHECK( addVariable("truth_barcode", m_truth_barcode) ); + CHECK( addVariable("truth_nMDT", m_truth_nMDT) ); + CHECK( addVariable("truth_nRPC", m_truth_nRPC) ); + CHECK( addVariable("truth_nTGC", m_truth_nTGC) ); + CHECK( addVariable("truth_nCSC", m_truth_nCSC) ); + CHECK( addVariable("noise_nMDT", m_noise_nMDT) ); + CHECK( addVariable("noise_nRPC", m_noise_nRPC) ); + CHECK( addVariable("noise_nTGC", m_noise_nTGC) ); + CHECK( addVariable("noise_nCSC", m_noise_nCSC) ); + CHECK( addVariable("common_nMDT", m_common_nMDT) ); + CHECK( addVariable("common_nRPC", m_common_nRPC) ); + CHECK( addVariable("common_nTGC", m_common_nTGC) ); + CHECK( addVariable("common_nCSC", m_common_nCSC) ); + + //get tools + if(m_truthTool.retrieve().isFailure() ){ + ATH_MSG_FATAL( "Could not get " << m_truthTool ); + return StatusCode::FAILURE; + } + if(!detStore()->retrieve(m_idHelper, "AtlasID").isSuccess()) { + ATH_MSG_FATAL("Unable to initialize ID helper."); + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; + } + + + StatusCode MuonPatternCombinationMissedHitFillerTool::fill(const EventInfo&) { + //build a MuonPatternCombination including all hits + Amg::Vector3D patpos(0,0,0); + Amg::Vector3D patdir(0,0,0); + Trk::TrackParameters* trkpars = new Trk::Perigee(patpos,patdir,1,patpos); + std::vector<Muon::MuonPatternChamberIntersect> chambers; + //MDT + const Muon::MdtPrepDataContainer* mdtPrds = 0; + if(StatusCode::SUCCESS != evtStore()->retrieve(mdtPrds, "MDT_DriftCircles")) { + ATH_MSG_ERROR( " Cannot retrieve MDT PRD Container MDT_DriftCircles"); + return StatusCode::FAILURE; + } + Muon::MdtPrepDataContainer::const_iterator mdtit = mdtPrds->begin(); + Muon::MdtPrepDataContainer::const_iterator mdtit_end = mdtPrds->end(); + for(; mdtit!=mdtit_end; ++mdtit) { + if( (*mdtit)->size() == 0 ) continue; + + std::vector< const Trk::PrepRawData* > rios; + Muon::MdtPrepDataCollection::const_iterator it = (*mdtit)->begin(); + Muon::MdtPrepDataCollection::const_iterator it_end = (*mdtit)->end(); + for(; it != it_end; ++it) rios.push_back( *it ); + Muon::MuonPatternChamberIntersect chIntersect(patpos,patdir,rios); + chambers.push_back(chIntersect); + } + //RPC + const Muon::RpcPrepDataContainer* rpcPrds = 0; + if(StatusCode::SUCCESS != evtStore()->retrieve(rpcPrds,"RPC_Measurements")) { + ATH_MSG_ERROR( "Cannot retrieve the RPC PRD container " ); + return StatusCode::FAILURE; + } + Muon::RpcPrepDataContainer::const_iterator rpcit = rpcPrds->begin(); + Muon::RpcPrepDataContainer::const_iterator rpcit_end = rpcPrds->end(); + for(; rpcit!=rpcit_end; ++rpcit) { + if( (*rpcit)->size() == 0 ) continue; + std::vector< const Trk::PrepRawData* > rios; + Muon::RpcPrepDataCollection::const_iterator it = (*rpcit)->begin(); + Muon::RpcPrepDataCollection::const_iterator it_end = (*rpcit)->end(); + for(; it != it_end; ++it) rios.push_back( *it ); + Muon::MuonPatternChamberIntersect chIntersect(patpos,patdir,rios); + chambers.push_back(chIntersect); + } + //TGC + const Muon::TgcPrepDataContainer* tgcPrds = 0; + if(StatusCode::SUCCESS != evtStore()->retrieve(tgcPrds,"TGC_Measurements")) { + ATH_MSG_ERROR( "Cannot retrieve the TGC PRD container " ); + return StatusCode::FAILURE; + } + Muon::TgcPrepDataContainer::const_iterator tgcit = tgcPrds->begin(); + Muon::TgcPrepDataContainer::const_iterator tgcit_end = tgcPrds->end(); + for(; tgcit!=tgcit_end; ++tgcit) { + if( (*tgcit)->size() == 0 ) continue; + std::vector< const Trk::PrepRawData* > rios; + Muon::TgcPrepDataCollection::const_iterator it = (*tgcit)->begin(); + Muon::TgcPrepDataCollection::const_iterator it_end = (*tgcit)->end(); + for(; it != it_end; ++it) rios.push_back( *it ); + Muon::MuonPatternChamberIntersect chIntersect(patpos,patdir,rios); + chambers.push_back(chIntersect); + } + //CSC + const Muon::CscPrepDataContainer* cscPrds = 0; + if(StatusCode::SUCCESS != evtStore()->retrieve(cscPrds,"CSC_Clusters")) { + ATH_MSG_ERROR( "Cannot retrieve the CSC PRD container " ); + return StatusCode::FAILURE; + } + Muon::CscPrepDataContainer::const_iterator cscit = cscPrds->begin(); + Muon::CscPrepDataContainer::const_iterator cscit_end = cscPrds->end(); + for(; cscit!=cscit_end; ++cscit) { + if( (*cscit)->size() == 0 ) continue; + std::vector< const Trk::PrepRawData* > rios; + Muon::CscPrepDataCollection::const_iterator it = (*cscit)->begin(); + Muon::CscPrepDataCollection::const_iterator it_end = (*cscit)->end(); + for(; it != it_end; ++it) rios.push_back( *it ); + Muon::MuonPatternChamberIntersect chIntersect(patpos,patdir,rios); + chambers.push_back(chIntersect); + } + //build the pattern combination + Muon::MuonPatternCombination *pattern = new Muon::MuonPatternCombination(trkpars, chambers); + pattern->setTrackRoadType(3); + + +// BEGIN + + if(pattern->chamberData().size() == 0) return StatusCode::SUCCESS; + + //---------------------------------------------------------------- + // Retrieve prep raw data truth + std::vector<std::string> PRD_TruthNames; + PRD_TruthNames.push_back("CSC_TruthMap"); + PRD_TruthNames.push_back("RPC_TruthMap"); + PRD_TruthNames.push_back("TGC_TruthMap"); + PRD_TruthNames.push_back("MDT_TruthMap"); + + std::vector<const PRD_MultiTruthCollection*> prdCollectionVector; + for(std::vector<std::string>::const_iterator ikey=PRD_TruthNames.begin(); ikey!=PRD_TruthNames.end(); ++ikey) { + prdCollectionVector.push_back(0); + StatusCode sc = evtStore()->retrieve(*prdCollectionVector.rbegin(), *ikey); + if (!sc.isSuccess()){ + ATH_MSG_WARNING( "PRD_MultiTruthCollection " << *ikey << " NOT found"); + } else { + ATH_MSG_DEBUG( "Got PRD_MultiTruthCollection " << *ikey); + } + } + + //---------------------------------------------------------------- + // Produce and store the output. + std::vector<DetailedTrackTruth> *dtt = new std::vector<DetailedTrackTruth>; + m_truthTool->buildDetailedTrackTruth(dtt, (*pattern), prdCollectionVector); + + bool isTruthMatched(false); + for(std::vector<DetailedTrackTruth>::const_iterator dtit=dtt->begin(); dtit!=dtt->end(); ++dtit) { + const TruthTrajectory traj = (*dtit).trajectory(); + std::cout << "check trajectory" << std::endl; + if(traj[0].isValid()) { + isTruthMatched = true; + + vector<int> barcode_list; + for(unsigned int i = 0; i < traj.size(); i++) { + barcode_list.push_back(traj[i].barcode()); + } + m_truth_barcode->push_back(barcode_list); + m_truth_nMDT->push_back(dtit->statsTruth()[SubDetHitStatistics::MDT]); + m_truth_nRPC->push_back(dtit->statsTruth()[SubDetHitStatistics::RPC]); + m_truth_nTGC->push_back(dtit->statsTruth()[SubDetHitStatistics::TGC]); + m_truth_nCSC->push_back(dtit->statsTruth()[SubDetHitStatistics::CSC]); + m_common_nMDT->push_back(dtit->statsCommon()[SubDetHitStatistics::MDT]); + m_common_nRPC->push_back(dtit->statsCommon()[SubDetHitStatistics::RPC]); + m_common_nTGC->push_back(dtit->statsCommon()[SubDetHitStatistics::TGC]); + m_common_nCSC->push_back(dtit->statsCommon()[SubDetHitStatistics::CSC]); + m_noise_nMDT->push_back(dtit->statsTrack()[SubDetHitStatistics::MDT]-dtit->statsCommon()[SubDetHitStatistics::MDT]); + m_noise_nRPC->push_back(dtit->statsTrack()[SubDetHitStatistics::RPC]-dtit->statsCommon()[SubDetHitStatistics::RPC]); + m_noise_nTGC->push_back(dtit->statsTrack()[SubDetHitStatistics::TGC]-dtit->statsCommon()[SubDetHitStatistics::TGC]); + m_noise_nCSC->push_back(dtit->statsTrack()[SubDetHitStatistics::CSC]-dtit->statsCommon()[SubDetHitStatistics::CSC]); + } + } + if(!isTruthMatched) { + vector<int> temp; + temp.push_back(0); + m_truth_barcode->push_back(temp); + m_truth_nMDT->push_back(0); + m_truth_nRPC->push_back(0); + m_truth_nTGC->push_back(0); + m_truth_nCSC->push_back(0); + m_common_nMDT->push_back(0); + m_common_nRPC->push_back(0); + m_common_nTGC->push_back(0); + m_common_nCSC->push_back(0); + m_noise_nMDT->push_back(0); + m_noise_nRPC->push_back(0); + m_noise_nTGC->push_back(0); + m_noise_nCSC->push_back(0); + } + + std::cout << "deleting the dtt" << std::endl; + if(dtt) delete dtt; + + std::cout << "Filled MuonPatternCombination information" << std::endl; + +// END HISTO FILLING + + + + //clean memory and return + delete pattern; + return StatusCode::SUCCESS; + } + + SubDetHitStatistics::SubDetType MuonPatternCombinationMissedHitFillerTool::findSubDetType(Identifier id) { + if (m_idHelper->is_pixel(id)) + return SubDetHitStatistics::Pixel; + if (m_idHelper->is_sct(id)) + return SubDetHitStatistics::SCT; + if (m_idHelper->is_trt(id)) + return SubDetHitStatistics::TRT; + if (m_idHelper->is_mdt(id)) + return SubDetHitStatistics::MDT; + if (m_idHelper->is_rpc(id)) + return SubDetHitStatistics::RPC; + if (m_idHelper->is_tgc(id)) + return SubDetHitStatistics::TGC; + if (m_idHelper->is_csc(id)) + return SubDetHitStatistics::CSC; + + + ATH_MSG_WARNING("findSubDetType(): UNKNOWN subdet for id="<<id); + return SubDetHitStatistics::NUM_SUBDETECTORS; + } + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationMissedHitFillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationMissedHitFillerTool.h new file mode 100644 index 0000000000000000000000000000000000000000..d52794f0ba17f83ef402769702af1fcf231b477b --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonPatternCombinationMissedHitFillerTool.h @@ -0,0 +1,62 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/MuonPatternCombinationMissedHitFillerTool.h + * @author Daniel Ventura <ventura@cern.ch> + * @date November 2012 + * @brief Block filler tool for hits not contained in MuonPatternCombinations, detail level 1 + */ + +#ifndef D3PDMAKER_MUONPATTERNCOMBINATIONMISSEDHITFILLERTOOL_H +#define D3PDMAKER_MUONPATTERNCOMBINATIONMISSEDHITFILLERTOOL_H + +#include "GaudiKernel/ToolHandle.h" +#include "D3PDMakerUtils/BlockFillerTool.h" +#include "MuonPattern/MuonPatternCombination.h" +#include "MuonRecToolInterfaces/IDetailedMuonPatternTruthBuilder.h" +#include "TrkTruthData/SubDetHitStatistics.h" +#include "AtlasDetDescr/AtlasDetectorID.h" +#include "EventInfo/EventInfo.h" +#include <vector> +using namespace std; + +namespace D3PD { + + +class MuonPatternCombinationMissedHitFillerTool + : public BlockFillerTool< EventInfo > +{ +public: + MuonPatternCombinationMissedHitFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + virtual StatusCode book(); + + virtual StatusCode fill(const EventInfo& p); + virtual SubDetHitStatistics::SubDetType findSubDetType(Identifier id); + +private: + vector<vector<int> >* m_truth_barcode; + vector<int>* m_truth_nMDT; + vector<int>* m_truth_nRPC; + vector<int>* m_truth_nTGC; + vector<int>* m_truth_nCSC; + vector<int>* m_noise_nMDT; + vector<int>* m_noise_nRPC; + vector<int>* m_noise_nTGC; + vector<int>* m_noise_nCSC; + vector<int>* m_common_nMDT; + vector<int>* m_common_nRPC; + vector<int>* m_common_nTGC; + vector<int>* m_common_nCSC; + + const AtlasDetectorID *m_idHelper; + ToolHandle<Trk::IDetailedMuonPatternTruthBuilder> m_truthTool; +}; + +} // namespace D3PD + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentAuthorFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentAuthorFillerTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..46da14f7740a71b522420a70e20067f5a5c8452d --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentAuthorFillerTool.cxx @@ -0,0 +1,42 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +////////////////////////////////////////////////////// +// +// Author : Srivas Prasad (srivas.prasad@cern.ch) +// Date : February 2010 +// +////////////////////////////////////////////////////// +#include "MuonSegmentAuthorFillerTool.h" +#include "TrkSegment/Segment.h" +#include "AthenaKernel/errorcheck.h" + + +namespace D3PD { + + +MuonSegmentAuthorFillerTool::MuonSegmentAuthorFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent) + : BlockFillerTool<Trk::Segment> (type, name, parent) +{ + book().ignore(); // Avoid coverity warnings. +} + + +StatusCode MuonSegmentAuthorFillerTool::book() +{ + CHECK( addVariable ("author", m_author) ); + return StatusCode::SUCCESS; +} + + +StatusCode MuonSegmentAuthorFillerTool::fill (const Trk::Segment& ms) { + *m_author = ms.author(); + + return StatusCode::SUCCESS; +} + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentAuthorFillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentAuthorFillerTool.h new file mode 100644 index 0000000000000000000000000000000000000000..34e135472b73eeecbd442a1be1f444eccdbd3f37 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentAuthorFillerTool.h @@ -0,0 +1,44 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/MuonSegmentAuthorFillerTool.h + * @author srivas prasad <srivas.prasad@cern.ch> + * @date Feb 2010 + * @brief Block filler tool with author information for muon segments, detail level 1 + */ + +#ifndef D3PDMAKER_MUONSEGMENTAUTHORFILLERTOOL_H +#define D3PDMAKER_MUONSEGMENTAUTHORFILLERTOOL_H 1 + + +#include "D3PDMakerUtils/BlockFillerTool.h" +namespace Trk { + class Segment; +} + + +namespace D3PD { + + +class MuonSegmentAuthorFillerTool + : public BlockFillerTool<Trk::Segment> +{ +public: + MuonSegmentAuthorFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + virtual StatusCode book(); + + virtual StatusCode fill (const Trk::Segment& p); + + +private: + int *m_author; +}; + +} // namespace D3PD + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentFitQualityFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentFitQualityFillerTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..fdb55b97db8a62a8d9c0acda6d20ff6178df0e7d --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentFitQualityFillerTool.cxx @@ -0,0 +1,48 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +////////////////////////////////////////////////////// +// +// Author : Srivas Prasad (srivas.prasad@cern.ch) +// Date : February 2010 +// +////////////////////////////////////////////////////// +#include "MuonSegmentFitQualityFillerTool.h" +#include "TrkSegment/Segment.h" +#include "MuonSegment/MuonSegment.h" +#include "TrkEventPrimitives/FitQuality.h" +#include "AthenaKernel/errorcheck.h" + + +namespace D3PD { + + +MuonSegmentFitQualityFillerTool::MuonSegmentFitQualityFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent) + : BlockFillerTool<Trk::Segment> (type, name, parent) +{ + book().ignore(); // Avoid coverity warnings. +} + + +StatusCode MuonSegmentFitQualityFillerTool::book() +{ + CHECK( addVariable ("chi2", m_chi2) ); + CHECK( addVariable ("ndof", m_ndof) ); + return StatusCode::SUCCESS; +} + + +StatusCode MuonSegmentFitQualityFillerTool::fill (const Trk::Segment& ts) { + const Muon::MuonSegment& mSeg = dynamic_cast<const Muon::MuonSegment&> (ts); + + *m_chi2 = (float) mSeg.fitQuality()->chiSquared(); + *m_ndof = (int) mSeg.fitQuality()->numberDoF(); + + return StatusCode::SUCCESS; +} + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentFitQualityFillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentFitQualityFillerTool.h new file mode 100644 index 0000000000000000000000000000000000000000..097fd9f1fa63924e1ba96eb46c569e2689423df0 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentFitQualityFillerTool.h @@ -0,0 +1,45 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/MuonSegmentFitQualityFillerTool.h + * @author srivas prasad <srivas.prasad@cern.ch> + * @date Feb 2010 + * @brief Block filler tool with fit quality information for muon segments, detail level 1 + */ + +#ifndef D3PDMAKER_MUONSEGMENTFITQUALITYFILLERTOOL_H +#define D3PDMAKER_MUONSEGMENTFITQUALITYFILLERTOOL_H 1 + + +#include "D3PDMakerUtils/BlockFillerTool.h" +namespace Trk { + class Segment; +} + + +namespace D3PD { + + +class MuonSegmentFitQualityFillerTool + : public BlockFillerTool<Trk::Segment> +{ +public: + MuonSegmentFitQualityFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + virtual StatusCode book(); + + virtual StatusCode fill (const Trk::Segment& p); + + +private: + float *m_chi2; + int *m_ndof; +}; + +} // namespace D3PD + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentLocationFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentLocationFillerTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e1333a503dcbe1048207f518fbe686ff953e3a7c --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentLocationFillerTool.cxx @@ -0,0 +1,215 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +////////////////////////////////////////////////////// +// +// Author : Srivas Prasad (srivas.prasad@cern.ch) +// Date : February 2010 +// +////////////////////////////////////////////////////// +#include "MuonSegmentLocationFillerTool.h" +#include "TrkSegment/Segment.h" +#include "MuonSegment/MuonSegment.h" +#include "AthenaKernel/errorcheck.h" +#include "TrkEventPrimitives/LocalDirection.h" + + +namespace D3PD { + + +MuonSegmentLocationFillerTool::MuonSegmentLocationFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent) + : BlockFillerTool<Trk::Segment> (type, name, parent), + m_helperTool("Muon::MuonEDMHelperTool/MuonEDMHelperTool"), + m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool"), + m_idToFixedIdTool("MuonCalib::IdToFixedIdTool"), + m_slPropagator("Trk::StraightLinePropagator/MuonStraightLinePropagator"), + m_pullCalculator("Trk::ResidualPullCalculator/ResidualPullCalculator") +{ + book().ignore(); // Avoid coverity warnings. +} + + +StatusCode MuonSegmentLocationFillerTool::initialize() +{ + CHECK( BlockFillerTool<Trk::Segment>::initialize() ); + CHECK( m_helperTool.retrieve() ); + CHECK( m_idHelperTool.retrieve() ); + CHECK( m_idToFixedIdTool.retrieve() ); + CHECK( m_slPropagator.retrieve() ); + CHECK( m_pullCalculator.retrieve() ); + m_magFieldProperties = new Trk::MagneticFieldProperties(Trk::FullField); + return StatusCode::SUCCESS; +} + +StatusCode MuonSegmentLocationFillerTool::book() +{ + CHECK( addVariable ("x", m_x) ); + CHECK( addVariable ("y", m_y) ); + CHECK( addVariable ("z", m_z) ); + CHECK( addVariable ("phi", m_phi) ); + CHECK( addVariable ("theta", m_theta) ); + CHECK( addVariable ("locX", m_locX) ); + CHECK( addVariable ("locY", m_locY) ); + CHECK( addVariable ("locAngleXZ", m_thetaXZ) ); + CHECK( addVariable ("locAngleYZ", m_thetaYZ) ); + CHECK( addVariable ("locAngleXZ_IP", m_thetaXZ_IP) ); + CHECK( addVariable ("locAngleYZ_IP", m_thetaYZ_IP) ); + CHECK( addVariable ("sector", m_sector) ); + CHECK( addVariable ("stationEta", m_stationEta) ); + CHECK( addVariable ("isEndcap", m_isEndcap) ); + CHECK( addVariable ("stationName", m_stationName) ); + CHECK( addVariable ("nphiHits", m_nphiHits) ); + CHECK( addVariable ("netaHits", m_netaHits) ); + CHECK( addVariable ("netaTrigHits", m_netaTrigHits) ); + CHECK( addVariable ("npadHits", m_npadHits) ); + CHECK( addVariable ("npseudoHits", m_npseudoHits) ); + CHECK( addVariable ("id", m_id) ); + CHECK( addVariable ("type", m_type) ); + CHECK( addVariable ("residual", m_residual) ); + CHECK( addVariable ("error", m_error) ); + CHECK( addVariable ("biasedpull", m_biasedPull) ); + CHECK( addVariable ("unbiasedpull", m_unbiasedPull) ); + + return StatusCode::SUCCESS; +} + + +StatusCode MuonSegmentLocationFillerTool::fill (const Trk::Segment& ts) { + const Muon::MuonSegment& mSeg = dynamic_cast<const Muon::MuonSegment&> (ts); + + // global position + const Amg::Vector3D& globalPos = mSeg.globalPosition(); + *m_x = (float) globalPos.x(); + *m_y = (float) globalPos.y(); + *m_z = (float) globalPos.z(); + + // global direction + const Amg::Vector3D& globalDir = mSeg.globalDirection(); + *m_phi = (float) globalDir.phi(); + *m_theta = (float) globalDir.theta(); + + //local position + Amg::Vector2D localPos; + Amg::Vector3D momdum (0, 0, 0); + + if( mSeg.associatedSurface().globalToLocal(globalPos, momdum, localPos) ) + { + *m_locX = (float) localPos.x(); + *m_locY = (float) localPos.y(); + } + else{ + *m_locX = -99999.; + *m_locY = -99999.; + } + + //local direction + const Trk::LocalDirection& localDir = mSeg.localDirection(); + *m_thetaXZ = (float) localDir.angleXZ(); + *m_thetaYZ = (float) localDir.angleYZ(); + + Amg::Vector3D pointingDir(globalPos.x(),globalPos.y(),globalPos.z()); + Trk::LocalDirection localIPDir; + mSeg.associatedSurface().globalToLocalDirection(pointingDir, localIPDir); + *m_thetaXZ_IP = (float) localIPDir.angleXZ(); + *m_thetaYZ_IP = (float) localIPDir.angleYZ(); + + Identifier chid = m_helperTool->chamberId(mSeg); + if( !(m_idHelperTool->isMuon(chid)) ) { // bad chid + *m_stationName = -1; + *m_sector = -1; + *m_stationEta = -1; + *m_isEndcap = -1; + } else { + MuonCalib::MuonFixedId fid = m_idToFixedIdTool->idToFixedId( chid ) ; + *m_stationName = fid.stationName(); + // chamber location information + // should not happen...chamberId is supposed to return id only for MDT or CSC hits. + if(!fid.is_tgc() ) *m_sector = m_idHelperTool->sector(chid); + else *m_sector = 0; + *m_stationEta = m_idHelperTool->stationEta(chid); + *m_isEndcap = m_idHelperTool->isEndcap(chid); + } + + const Trk::AtaPlane* pars = m_helperTool->createTrackParameters( mSeg ); + if( !pars ) return StatusCode::SUCCESS; + + int nphiHits = 0; + int netaHits = 0; + int netaTrigHits = 0; + int npadHits = 0; + int npseudoHits = 0; + + const std::vector<const Trk::MeasurementBase*>& measurements = mSeg.containedMeasurements(); + for( std::vector<const Trk::MeasurementBase*>::const_iterator it = measurements.begin();it!=measurements.end();++it ){ + const Trk::MeasurementBase& meas = **it; + Identifier id = m_helperTool->getIdentifier(meas); + m_id->push_back(m_idToFixedIdTool->idToFixedId(id).getIdInt()); + int type = 6; + if( id.is_valid() ){ + if( m_idHelperTool->isMdt(id) ) type = 0; + else if( m_idHelperTool->isRpc(id) ) type = 1; + else if( m_idHelperTool->isTgc(id) ) type = 2; + else if( m_idHelperTool->isCsc(id) ) type = 3; + else if( m_idHelperTool->isMM(id) ) type = 4; + else if( m_idHelperTool->issTgc(id) ) type = 5; + + if( m_idHelperTool->issTgc(id) ){ + int chtype = m_idHelperTool->stgcIdHelper().channelType(id); + type += 1000*chtype; + if( chtype == 0 ) ++npadHits; + else if( chtype == 1 ) ++netaTrigHits; + else ++nphiHits; + }else if( !m_idHelperTool->measuresPhi(id) ) { + if( type == 1 || type ==3 ) ++netaTrigHits; + else ++netaHits; + type += 1000; + }else{ + ++nphiHits; + } + }else ++npseudoHits; + + m_type->push_back(type); + + *m_nphiHits = nphiHits; + *m_netaHits = netaHits; + *m_netaTrigHits = netaTrigHits; + *m_npadHits = npadHits; + *m_npseudoHits = npseudoHits; + + const Trk::TrackParameters* exPars = m_slPropagator->propagate(*pars,meas.associatedSurface(),Trk::anyDirection,false,*m_magFieldProperties); + if( !exPars && meas.associatedSurface().isOnSurface(pars->position()) ){ + exPars = pars->clone(); + } + float res = -99999; + float pullub = -99999; + float pullb = -99999; + if( exPars ){ + const Trk::ResidualPull* resPull = m_pullCalculator->residualPull( &meas, exPars, Trk::ResidualPull::Biased ); + if( resPull ) { + res = resPull->residual().front(); + pullub = resPull->pull().front(); + delete resPull; + }else ATH_MSG_WARNING("Failed to calculate biased residual for " << m_idHelperTool->toString(id) ); + + resPull = m_pullCalculator->residualPull( &meas, exPars, Trk::ResidualPull::Unbiased ); + if( resPull ) { + pullb = resPull->pull().front(); + delete resPull; + }else ATH_MSG_WARNING("Failed to calculate biased residual for " << m_idHelperTool->toString(id) ); + delete exPars; + }else{ + ATH_MSG_WARNING("Failed to obtain track parameters for " << m_idHelperTool->toString(id) ); + } + m_residual->push_back(res); + m_biasedPull->push_back(pullb); + m_unbiasedPull->push_back(pullub); + } + delete pars; + return StatusCode::SUCCESS; +} + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentLocationFillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentLocationFillerTool.h new file mode 100644 index 0000000000000000000000000000000000000000..68ae49253235cd1bb71c37844f50d00bb2fc98dd --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentLocationFillerTool.h @@ -0,0 +1,99 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/MuonSegmentLocationFillerTool.h + * @author srivas prasad <srivas.prasad@cern.ch> + * @date Feb 2010 + * @brief Position/direction/chamber-location for muon segments, detail level 1 + */ + +#ifndef D3PDMAKER_MUONSEGMENTLOCATIONFILLERTOOL_H +#define D3PDMAKER_MUONSEGMENTLOCATIONFILLERTOOL_H 1 + +#include "D3PDMakerUtils/BlockFillerTool.h" + +#include "GaudiKernel/ToolHandle.h" +#include "MuonRecHelperTools/MuonEDMHelperTool.h" +#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonCalibITools/IIdToFixedIdTool.h" +#include "TrkExInterfaces/IPropagator.h" +#include "TrkGeometry/MagneticFieldProperties.h" +#include "TrkToolInterfaces/IResidualPullCalculator.h" + +namespace Trk { + class Segment; +} + + +namespace D3PD { + + +class MuonSegmentLocationFillerTool + : public BlockFillerTool<Trk::Segment> +{ +public: + MuonSegmentLocationFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + /// Standard Gaudi initialize method. + StatusCode initialize(); + + virtual StatusCode book(); + + virtual StatusCode fill (const Trk::Segment& p); + +private: + // global position + float *m_x; + float *m_y; + float *m_z; + + // global direction + float *m_phi; + float *m_theta; + + // local position + float *m_locX; + float *m_locY; + + // local direction - conventions for Moore and Muonboy are different! + float *m_thetaXZ; // local x-z angle + float *m_thetaYZ; // local y-z angle + float *m_thetaXZ_IP; // local x-z angle pointing to the IP + float *m_thetaYZ_IP; // local y-z angle pointing to the IP + + // chamber summary + int *m_sector; // phi sector - 1 to 16 + int *m_stationEta; // station eta + bool *m_isEndcap; // 1 for endcap, 0 for barrel + int *m_stationName; // Station name in MuonFixedId scheme + + // hit counts + int* m_nphiHits; + int* m_netaHits; + int* m_netaTrigHits; + int* m_npadHits; + int* m_npseudoHits; + + std::vector<int>* m_id; // fixed id + std::vector<int>* m_type; // 1000*channelType (0:pad,1:eta,2:phi) + 0:MDT,1:RPC,2:TGC,3:CSC,4:STGC,5::MM,6::Pseudo) + std::vector<float>* m_error; // error + std::vector<float>* m_residual; // residual + std::vector<float>* m_biasedPull; // biased pull + std::vector<float>* m_unbiasedPull; // unbiased pull + + // tools + ToolHandle<Muon::MuonEDMHelperTool> m_helperTool; + ToolHandle<Muon::MuonIdHelperTool> m_idHelperTool; + ToolHandle<MuonCalib::IIdToFixedIdTool> m_idToFixedIdTool; + ToolHandle<Trk::IPropagator> m_slPropagator; + ToolHandle<Trk::IResidualPullCalculator> m_pullCalculator; + Trk::MagneticFieldProperties* m_magFieldProperties; +}; + +} // namespace D3PD + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentT0FillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentT0FillerTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0978cd4025839c1c8dfd55ce3535a0a4ed9aa4f1 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentT0FillerTool.cxx @@ -0,0 +1,137 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +////////////////////////////////////////////////////// +// +// Author : Srivas Prasad (srivas.prasad@cern.ch) +// Date : February 2010 +// +////////////////////////////////////////////////////// +#include "MuonSegmentT0FillerTool.h" +#include "TrkSegment/Segment.h" +#include "MuonSegment/MuonSegment.h" +#include "MuonPrepRawData/CscPrepData.h" +#include "AthenaKernel/errorcheck.h" + +namespace D3PD { + + +MuonSegmentT0FillerTool::MuonSegmentT0FillerTool (const std::string& type, + const std::string& name, + const IInterface* parent) + : BlockFillerTool<Trk::Segment> (type, name, parent), + m_helperTool("Muon::MuonEDMHelperTool/MuonEDMHelperTool") + // m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool"), + // m_idToFixedIdTool("MuonCalib::IdToFixedIdTool") +{ + declareProperty("doMuonBoyCSCTiming", m_doMuonBoyCSCTiming=false); + + book().ignore(); // Avoid coverity warnings. +} + +StatusCode MuonSegmentT0FillerTool::initialize() +{ + CHECK( BlockFillerTool<Trk::Segment>::initialize() ); + CHECK( m_helperTool.retrieve() ); + // CHECK( m_idHelperTool.retrieve() ); + // CHECK( m_idToFixedIdTool.retrieve() ); + + return StatusCode::SUCCESS; +} + +StatusCode MuonSegmentT0FillerTool::book() +{ + CHECK( addVariable ("t0", m_t0) ); + CHECK( addVariable ("t0err", m_t0err) ); + + return StatusCode::SUCCESS; +} + + +StatusCode MuonSegmentT0FillerTool::fill (const Trk::Segment& ts) { + const Muon::MuonSegment& mSeg = dynamic_cast<const Muon::MuonSegment&> (ts); + float t0=0, t0err=0; + t0 = mSeg.time(); + t0err = mSeg.errorTime(); + if(m_doMuonBoyCSCTiming) MuonboyT0CSCSegment(&mSeg, t0, t0err); + + *m_t0 = t0; + *m_t0err = t0err; + + return StatusCode::SUCCESS; +} + +// CSC timing for muonboy +// Code from: MboyEDMTool-07-83-41/src//MuonboyToSegmentTool.cxx + +void MuonSegmentT0FillerTool::MuonboyT0CSCSegment(const Muon::MuonSegment* pMuonSegment, float& t0, float& t0Error) { + t0 = pMuonSegment->time() ; + t0Error = pMuonSegment->errorTime() ; + + int DoAlternative = 0 ; + int Alternative_ThereIsaCscTimeEarly = 0 ; + int Alternative_ThereIsaCscTimeLate = 0 ; + float Alternative_LatestEarlyTime = 0. ; + float Alternative_EarliestLateTime = 0. ; + float Alternative_Kounter = 0. ; + float Alternative_t0 = 0. ; + float Alternative_t0sqr = 0. ; + float Alternative_t0Error = 0. ; + const std::vector<const Trk::RIO_OnTrack*> pRIOSet = pMuonSegment->containedROTs(); + std::vector<const Trk::RIO_OnTrack*>::const_iterator pRIO_OnTrackIter = pRIOSet.begin(); + for (; pRIO_OnTrackIter!=pRIOSet.end(); ++pRIO_OnTrackIter){ + if ( (*pRIO_OnTrackIter) ){ + const Trk::PrepRawData* pPrepRawData =(*pRIO_OnTrackIter)->prepRawData () ; + if ( pPrepRawData ){ + const Muon::CscPrepData* pPrepData = dynamic_cast<const Muon::CscPrepData*>(pPrepRawData); + if ( pPrepData ){ + DoAlternative = 1 ; + double Time = pPrepData->time() ; + if (pPrepData->timeStatus() == Muon::CscTimeSuccess){ + Alternative_Kounter = Alternative_Kounter + 1. ; + Alternative_t0 = Alternative_t0 + Time ; + Alternative_t0sqr = Alternative_t0sqr + Time*Time ; + } + if (pPrepData->timeStatus() == Muon::CscTimeEarly) { + if ( Alternative_ThereIsaCscTimeEarly == 0 ) Alternative_LatestEarlyTime = Time ; + if ( Time >= Alternative_LatestEarlyTime ) Alternative_LatestEarlyTime = Time ; + Alternative_ThereIsaCscTimeEarly = 1 ; + } + if (pPrepData->timeStatus() == Muon::CscTimeLate ) { + if ( Alternative_ThereIsaCscTimeLate == 0 ) Alternative_EarliestLateTime = Time ; + if ( Time <= Alternative_EarliestLateTime ) Alternative_EarliestLateTime = Time ; + Alternative_ThereIsaCscTimeLate = 1 ; + } + } + } + } + } + + if (DoAlternative==1){ + if (Alternative_Kounter){ + Alternative_t0 = Alternative_t0 / Alternative_Kounter ; + Alternative_t0sqr = Alternative_t0sqr / Alternative_Kounter ; + Alternative_t0Error = Alternative_t0sqr - Alternative_t0*Alternative_t0 ; + if (Alternative_t0Error < 0.){ + Alternative_t0Error = 0. ; + }else{ + Alternative_t0Error = sqrt(Alternative_t0Error) ; + } + }else if (Alternative_ThereIsaCscTimeEarly == 1 && Alternative_ThereIsaCscTimeLate == 0){ + Alternative_t0 = Alternative_LatestEarlyTime ; + Alternative_t0Error = fabs(Alternative_LatestEarlyTime) ; + }else if (Alternative_ThereIsaCscTimeEarly == 0 && Alternative_ThereIsaCscTimeLate == 1){ + Alternative_t0 = Alternative_EarliestLateTime ; + Alternative_t0Error = Alternative_EarliestLateTime ; + }else{ + Alternative_t0 = 99999. ; + Alternative_t0Error = 99999. ; + } + t0 = Alternative_t0 ; + t0Error = Alternative_t0Error ; + } +} + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentT0FillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentT0FillerTool.h new file mode 100644 index 0000000000000000000000000000000000000000..66f711afba350c1d17e12b225ddf1adc46ae6338 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentT0FillerTool.h @@ -0,0 +1,65 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/MuonSegmentT0FillerTool.h + * @author srivas prasad <srivas.prasad@cern.ch> + * @date Jun 2010 + * @brief t0 fit info for muon segments, detail level 2 + */ + +#ifndef D3PDMAKER_MUONSEGMENTT0FILLERTOOL_H +#define D3PDMAKER_MUONSEGMENTT0FILLERTOOL_H 1 + +#include "D3PDMakerUtils/BlockFillerTool.h" + +#include "GaudiKernel/ToolHandle.h" +#include "MuonRecHelperTools/MuonEDMHelperTool.h" +//#include "MuonRecHelperTools/MuonIdHelperTool.h" +//#include "MuonCalibITools/IIdToFixedIdTool.h" +#include <string> + +namespace Trk { + class Segment; +} + + +namespace D3PD { + + +class MuonSegmentT0FillerTool + : public BlockFillerTool<Trk::Segment> +{ +public: + MuonSegmentT0FillerTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + /// Standard Gaudi initialize method. + StatusCode initialize(); + + virtual StatusCode book(); + + virtual StatusCode fill (const Trk::Segment& p); + +private: + // t0 from either t0segment or chamber-t0 + float *m_t0; + float *m_t0err; + + // muonboy specific CSC timing code + bool m_doMuonBoyCSCTiming; + void MuonboyT0CSCSegment(const Muon::MuonSegment* pMuonSegment, float& t0, float& t0Error); + + std::string m_muonSegmentT0ContainerKey; + // tools + ToolHandle<Muon::MuonEDMHelperTool> m_helperTool; + // ToolHandle<Muon::MuonIdHelperTool> m_idHelperTool; + // ToolHandle<MuonCalib::IIdToFixedIdTool> m_idToFixedIdTool; + +}; + +} // namespace D3PD + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentTruthFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentTruthFillerTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0a3e2ddc214a20d4df36491b1e04f1d75e64a956 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentTruthFillerTool.cxx @@ -0,0 +1,257 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +////////////////////////////////////////////////////// +// +// Author : Daniel Ventura <ventura@cern.ch> +// +////////////////////////////////////////////////////// +#include "MuonSegmentTruthFillerTool.h" +#include "AthenaKernel/errorcheck.h" +#include "TrkTruthData/TruthTrajectory.h" +#include "HepMC/GenParticle.h" +#include "TrkTruthData/PRD_MultiTruthCollection.h" +#include "MuonPattern/MuonPatternCombinationCollection.h" +#include "MuonPattern/DetailedMuonPatternTruthCollection.h" +#include "MuonTruthAlgs/MuonPatternCombinationDetailedTrackTruthMaker.h" +#include "StoreGate/StoreGateSvc.h" +#include "TrkPrepRawData/PrepRawData.h" + +#include "TrkTruthData/DetailedSegmentTruth.h" + +#include "MuonSegment/MuonSegment.h" + +using HepGeom::Point3D; +using HepGeom::Vector3D; + +namespace D3PD { + + MuonSegmentTruthFillerTool::MuonSegmentTruthFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent) + : BlockFillerTool<Trk::Segment> (type, name, parent) , + m_idHelper(0), + m_truthTool("Trk::DetailedMuonPatternTruthBuilder/DetailedMuonPatternTruthBuilder") { + + declareProperty("DetailedMuonPatternTruthTool", m_truthTool); + } + + StatusCode MuonSegmentTruthFillerTool::book() { + //branches + CHECK( addVariable("res_x", m_res_x) ); + CHECK( addVariable("res_y", m_res_y) ); + CHECK( addVariable("dAngleYZ", m_dAngleYZ) ); + CHECK( addVariable("dAngleXZ", m_dAngleXZ) ); + CHECK( addVariable("truth_barcode", m_truth_barcode) ); + CHECK( addVariable("truth_nSTGC", m_truth_nSTGC) ); + CHECK( addVariable("truth_nMM", m_truth_nMM) ); + CHECK( addVariable("truth_nMDT", m_truth_nMDT) ); + CHECK( addVariable("truth_nRPC", m_truth_nRPC) ); + CHECK( addVariable("truth_nTGC", m_truth_nTGC) ); + CHECK( addVariable("truth_nCSC", m_truth_nCSC) ); + CHECK( addVariable("noise_nSTGC", m_noise_nSTGC) ); + CHECK( addVariable("noise_nMM", m_noise_nMM) ); + CHECK( addVariable("noise_nMDT", m_noise_nMDT) ); + CHECK( addVariable("noise_nRPC", m_noise_nRPC) ); + CHECK( addVariable("noise_nTGC", m_noise_nTGC) ); + CHECK( addVariable("noise_nCSC", m_noise_nCSC) ); + CHECK( addVariable("common_nSTGC", m_common_nSTGC) ); + CHECK( addVariable("common_nMM", m_common_nMM) ); + CHECK( addVariable("common_nMDT", m_common_nMDT) ); + CHECK( addVariable("common_nRPC", m_common_nRPC) ); + CHECK( addVariable("common_nTGC", m_common_nTGC) ); + CHECK( addVariable("common_nCSC", m_common_nCSC) ); + + //constants + m_pi = 3.1415926; + + //get tools + if(m_truthTool.retrieve().isFailure() ){ + ATH_MSG_FATAL( "Could not get " << m_truthTool ); + return StatusCode::FAILURE; + } + if(!detStore()->retrieve(m_idHelper, "AtlasID").isSuccess()) { + ATH_MSG_FATAL("Unable to initialize ID helper."); + return StatusCode::FAILURE; + } + + + return StatusCode::SUCCESS; + } + + + StatusCode MuonSegmentTruthFillerTool::fill(const Trk::Segment& ts) { + const Muon::MuonSegment& mSeg = dynamic_cast<const Muon::MuonSegment&> (ts); + +// const std::vector<const Trk::RIO_OnTrack*>& cROTv = mSeg.containedROTs(); + + // global position +// const Point3D<double>& segGlobalPos = ts.globalPosition(); + + // global direction +// const Vector3D<double>& segGlobalDir = mSeg.globalDirection(); + + //---------------------------------------------------------------- + // Retrieve prep raw data truth + std::vector<std::string> PRD_TruthNames; + PRD_TruthNames.push_back("CSC_TruthMap"); + PRD_TruthNames.push_back("RPC_TruthMap"); + PRD_TruthNames.push_back("TGC_TruthMap"); + PRD_TruthNames.push_back("MDT_TruthMap"); + PRD_TruthNames.push_back("MM_TruthMap"); + PRD_TruthNames.push_back("STGC_TruthMap"); + + std::vector<const PRD_MultiTruthCollection*> prdCollectionVector; + for(std::vector<std::string>::const_iterator ikey=PRD_TruthNames.begin(); ikey!=PRD_TruthNames.end(); ++ikey) { + prdCollectionVector.push_back(0); + + StatusCode sc = evtStore()->retrieve(*prdCollectionVector.rbegin(), *ikey); + if (!sc.isSuccess()){ + ATH_MSG_WARNING( "PRD_MultiTruthCollection " << *ikey << " NOT found"); + } else { + ATH_MSG_DEBUG( "Got PRD_MultiTruthCollection " << *ikey); + } + } + + //---------------------------------------------------------------- + // Produce and store the output. + std::vector<DetailedSegmentTruth> *dtt = new std::vector<DetailedSegmentTruth>; + + m_truthTool->buildDetailedTrackTruthFromSegments(dtt, mSeg, prdCollectionVector); + + bool isTruthMatched(false); + + // Find the best dtt to store. Best is defined as the one with the most total hits in common + std::vector<DetailedSegmentTruth>::const_iterator best_dtit = dtt->begin(); + int best_nHits = 0; + + for(std::vector<DetailedSegmentTruth>::const_iterator dtit=dtt->begin(); dtit!=dtt->end(); ++dtit) { + int nHits = 0; + for(unsigned i = 0; i < SubDetHitStatistics::NUM_SUBDETECTORS; i++) { + nHits += dtit->statsCommon()[ (SubDetHitStatistics::SubDetType)i ]; + } + + if(nHits > best_nHits) { + best_dtit = dtit; + best_nHits = nHits; + } + } + + if(dtt->begin() != dtt->end() && ((*best_dtit).trajectory())[0].isValid()) { + const TruthTrajectory traj = (*best_dtit).trajectory(); + + isTruthMatched = true; + + + vector<int> barcode_list; + for(unsigned int i = 0; i < traj.size(); i++) { + barcode_list.push_back(traj[i].barcode()); + } + *m_truth_barcode = barcode_list; + *m_truth_nSTGC = best_dtit->statsTruth()[SubDetHitStatistics::STGC]; + *m_truth_nMM = best_dtit->statsTruth()[SubDetHitStatistics::MM]; + *m_truth_nMDT = best_dtit->statsTruth()[SubDetHitStatistics::MDT]; + *m_truth_nRPC = best_dtit->statsTruth()[SubDetHitStatistics::RPC]; + *m_truth_nTGC = best_dtit->statsTruth()[SubDetHitStatistics::TGC]; + *m_truth_nCSC = best_dtit->statsTruth()[SubDetHitStatistics::CSC]; + *m_common_nSTGC = best_dtit->statsCommon()[SubDetHitStatistics::STGC]; + *m_common_nMM = best_dtit->statsCommon()[SubDetHitStatistics::MM]; + *m_common_nMDT = best_dtit->statsCommon()[SubDetHitStatistics::MDT]; + *m_common_nRPC = best_dtit->statsCommon()[SubDetHitStatistics::RPC]; + *m_common_nTGC = best_dtit->statsCommon()[SubDetHitStatistics::TGC]; + *m_common_nCSC = best_dtit->statsCommon()[SubDetHitStatistics::CSC]; + *m_noise_nSTGC = best_dtit->statsTrack()[SubDetHitStatistics::STGC]-best_dtit->statsCommon()[SubDetHitStatistics::STGC]; + *m_noise_nMM = best_dtit->statsTrack()[SubDetHitStatistics::MM]-best_dtit->statsCommon()[SubDetHitStatistics::MM]; + *m_noise_nMDT = best_dtit->statsTrack()[SubDetHitStatistics::MDT]-best_dtit->statsCommon()[SubDetHitStatistics::MDT]; + *m_noise_nRPC = best_dtit->statsTrack()[SubDetHitStatistics::RPC]-best_dtit->statsCommon()[SubDetHitStatistics::RPC]; + *m_noise_nTGC = best_dtit->statsTrack()[SubDetHitStatistics::TGC]-best_dtit->statsCommon()[SubDetHitStatistics::TGC]; + *m_noise_nCSC = best_dtit->statsTrack()[SubDetHitStatistics::CSC]-best_dtit->statsCommon()[SubDetHitStatistics::CSC]; + + if(best_dtit->truthSegPos().x() != -15000.0) { + Amg::Transform3D gToLocal = mSeg.associatedSurface().transform().inverse(); + Amg::Vector3D localSegPos = gToLocal * mSeg.globalPosition(); + Amg::Vector3D localTrueSegPos = gToLocal * best_dtit->truthSegPos(); + Amg::Vector3D localSegDir = gToLocal * mSeg.globalDirection(); + Amg::Vector3D localTrueSegDir = gToLocal * best_dtit->truthSegDir(); + + double scaleFactor = localTrueSegPos.z() / localTrueSegDir.z(); + Amg::Vector3D localTrueSegPosOnSurface = -scaleFactor * localTrueSegDir + localTrueSegPos; + + *m_res_x = localSegPos.x() - localTrueSegPosOnSurface.x(); + *m_res_y = localSegPos.y() - localTrueSegPosOnSurface.y(); + + if( fabs(localSegPos.z() - localTrueSegPosOnSurface.z()) > 0.1) + ATH_MSG_WARNING("Error: localTrueSegPosOnSurface.z() has value " << localTrueSegPosOnSurface.z() << + ", but should be extremely close to zero."); + + Amg::Vector3D temp = localSegDir; + Amg::Vector3D tempTrue = localTrueSegDir; + temp.x() = 0; + tempTrue.x() = 0; + temp = temp.unit(); + tempTrue = tempTrue.unit(); + //double cosAngleYZ = temp * tempTrue; + //double dAngleYZ = acos(cosAngleYZ); + + double new_dAngleYZ = temp.theta() - tempTrue.theta(); + + + temp = localSegDir; + tempTrue = localTrueSegDir; + temp.y() = 0; + tempTrue.y() = 0; + temp = temp.unit(); + tempTrue = tempTrue.unit(); + //double cosAngleXZ = temp * tempTrue; + //double dAngleXZ = acos(cosAngleXZ); + + double new_dAngleXZ = temp.theta() - tempTrue.theta(); + + + *m_dAngleYZ = new_dAngleYZ; + *m_dAngleXZ = new_dAngleXZ; + } + } + if(!isTruthMatched) { + vector<int> temp; + temp.push_back(0); + *m_truth_barcode = temp; + *m_truth_nSTGC = 0; + *m_truth_nMM = 0; + *m_truth_nMDT = 0; + *m_truth_nRPC = 0; + *m_truth_nTGC = 0; + *m_truth_nCSC = 0; + *m_common_nSTGC = 0; + *m_common_nMM = 0; + *m_common_nMDT = 0; + *m_common_nRPC = 0; + *m_common_nTGC = 0; + *m_common_nCSC = 0; + *m_noise_nSTGC = 0; + *m_noise_nMM = 0; + *m_noise_nMDT = 0; + *m_noise_nRPC = 0; + *m_noise_nTGC = 0; + *m_noise_nCSC = 0; + *m_dAngleYZ = 0; + *m_dAngleXZ = 0; + *m_res_x = 0; + *m_res_y = 0; + } + +// if(dtt) delete dtt; + return StatusCode::SUCCESS; + } + + double MuonSegmentTruthFillerTool::deltaR(double eta1, double eta2, double phi1, double phi2) { + double Deta = eta1 - eta2; + double Dphi = phi1 - phi2; + if(Dphi > m_pi) Dphi -= 2*m_pi; + else if(Dphi < -m_pi) Dphi += 2*m_pi; + double DR = sqrt(Deta*Deta + Dphi*Dphi); + return DR; + } + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentTruthFillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentTruthFillerTool.h new file mode 100644 index 0000000000000000000000000000000000000000..1cde495c0c4fdde9d9323f51dd80fb465d4dad17 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentTruthFillerTool.h @@ -0,0 +1,79 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/MuonSegmentTruthFillerTool.h + * @author Daniel Blackburn <ventura@cern.ch> + * @date February 2013 + * @brief Block filler tool for MuonSegmentTruth + */ + +#ifndef D3PDMAKER_MuonSegmentTruthFillerTool_H +#define D3PDMAKER_MuonSegmentTruthFillerTool_H + +#include "GaudiKernel/ToolHandle.h" +#include "D3PDMakerUtils/BlockFillerTool.h" +#include "MuonPattern/MuonPatternCombination.h" +#include "TrkTruthData/SubDetHitStatistics.h" +#include "AtlasDetDescr/AtlasDetectorID.h" + +#include "MuonSegment/MuonSegment.h" +#include "MuonRecToolInterfaces/IDetailedMuonPatternTruthBuilder.h" + +#include <vector> +using namespace std; + +namespace D3PD { + + +class MuonSegmentTruthFillerTool + : public BlockFillerTool< Trk::Segment > +{ +public: + MuonSegmentTruthFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + virtual StatusCode book(); + + virtual StatusCode fill(const Trk::Segment& segment); + virtual double deltaR(double eta1, double eta2, double phi1, double phi2); +// virtual SubDetHitStatistics::SubDetType findSubDetType(Identifier id); + +private: + vector<int>* m_truth_barcode; + float* m_res_x; + float* m_res_y; + float* m_dAngleYZ; + float* m_dAngleXZ; + int* m_truth_nSTGC; + int* m_truth_nMM; + int* m_truth_nMDT; + int* m_truth_nRPC; + int* m_truth_nTGC; + int* m_truth_nCSC; + int* m_noise_nSTGC; + int* m_noise_nMM; + int* m_noise_nMDT; + int* m_noise_nRPC; + int* m_noise_nTGC; + int* m_noise_nCSC; + int* m_common_nSTGC; + int* m_common_nMM; + int* m_common_nMDT; + int* m_common_nRPC; + int* m_common_nTGC; + int* m_common_nCSC; + + int m_matchedTruth; + std::string m_truthSGkey; + double m_pi; + + const AtlasDetectorID *m_idHelper; + ToolHandle<Trk::IDetailedMuonPatternTruthBuilder> m_truthTool; +}; + +} // namespace D3PD + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSpShowerFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSpShowerFillerTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6327478b9429e86fed7aab0fa5012b19b6d471f9 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSpShowerFillerTool.cxx @@ -0,0 +1,102 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id$ +/** + * @file MuonD3PDMaker/src/fillers/MuonSpShowerFillerTool.cxx + * @author Michiru Kaneda <Michiru.Kaneda@cern.ch> + * @date Jan., 2011 + * @brief Block filler tool for MuonSpShower + */ + +#include "MuonSpShowerFillerTool.h" +#include "muonEvent/MuonSpShower.h" +#include "muonEvent/MuonSpShowerContainer.h" + +#include "AthenaKernel/errorcheck.h" + + +namespace D3PD { + + +/** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ +MuonSpShowerFillerTool::MuonSpShowerFillerTool + (const std::string& type, + const std::string& name, + const IInterface* parent) + : D3PD::BlockFillerTool<Rec::MuonSpShower> (type, name, parent), + m_storeGate("StoreGateSvc", name), + m_doPosition(false), + m_doHits(false), + m_doSegments(false) +{ + m_doPosition = true; + m_doHits = true; + m_doSegments = true; + book().ignore(); // Avoid coverity warnings. + + declareProperty("WritePosition", m_doPosition = false); + declareProperty("WriteHits", m_doHits = false); + declareProperty("WriteSegments", m_doSegments = false); +} + + +/** + * @brief Book variables for this block. + */ +StatusCode MuonSpShowerFillerTool::book() { + if(m_doPosition){ + CHECK( addVariable ("eta", m_eta) ); + CHECK( addVariable ("phi", m_phi) ); + } + if(m_doHits){ + CHECK( addVariable ("trigHits", m_trigHits) ); + CHECK( addVariable ("innerHits", m_innerHits) ); + CHECK( addVariable ("middleHits", m_middleHits) ); + CHECK( addVariable ("outerHits", m_outerHits) ); + } + if(m_doSegments){ + CHECK( addVariable ("innerSegments", m_innerSegments) ); + CHECK( addVariable ("middleSegments", m_middleSegments) ); + CHECK( addVariable ("outerSegments", m_outerSegments) ); + } + + return StatusCode::SUCCESS; +} + +/** + * @brief Fill one block --- type-safe version. + * @param p The input object. + * + * This is called once per object. The caller + * is responsible for arranging that all the pointers for booked variables + * are set appropriately upon entry. + */ +StatusCode MuonSpShowerFillerTool::fill(const Rec::MuonSpShower& p) { + if(m_doPosition){ + *m_eta = p.eta(); + *m_phi = p.phi(); + } + if(m_doHits){ + *m_trigHits = p.numberOfTriggerHits(); + *m_innerHits = p.numberOfInnerHits(); + *m_middleHits = p.numberOfMiddleHits(); + *m_outerHits = p.numberOfOuterHits(); + } + if(m_doSegments){ + *m_innerSegments = p.numberOfInnerSegments(); + *m_middleSegments = p.numberOfMiddleSegments(); + *m_outerSegments = p.numberOfOuterSegments(); + } + + return StatusCode::SUCCESS; +} + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSpShowerFillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSpShowerFillerTool.h new file mode 100644 index 0000000000000000000000000000000000000000..f356c063c64a23c4165cbc5bc0b733a518def915 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSpShowerFillerTool.h @@ -0,0 +1,76 @@ +// This file's extension implies that it's C, but it's really -*- C++ -*-. + +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id$ +/** + * @file MuonD3PDMaker/src/MuonSpShowerFillerTool.h + * @author Michiru Kaneda <Michiru.Kaneda@cern.ch> + * @date Jan., 2011 + * @brief Block filler tool for MuonSpShower + */ + +#ifndef MUOND3PDMAKER_MUONSPSHOWERFILLERTOOL_H +#define MUOND3PDMAKER_MUONSPSHOWERFILLERTOOL_H + +#include "D3PDMakerUtils/BlockFillerTool.h" +#include "StoreGate/StoreGateSvc.h" + +namespace Rec{ +class MuonSpShower; +} + +namespace D3PD { + + +class MuonSpShowerFillerTool + : public D3PD::BlockFillerTool<Rec::MuonSpShower> + +{ +public: + /** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ + MuonSpShowerFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + virtual StatusCode book (); + virtual StatusCode fill (const Rec::MuonSpShower &p); + + +private: + ServiceHandle<StoreGateSvc> m_storeGate; + + /// Variable: Position + float* m_eta; + float* m_phi; + /// Variable: Hits + unsigned short* m_trigHits; + unsigned short* m_innerHits; + unsigned short* m_middleHits; + unsigned short* m_outerHits; + /// Variable: Segments + unsigned short* m_innerSegments; + unsigned short* m_middleSegments; + unsigned short* m_outerSegments; + + /// Property: Fill Position? + bool m_doPosition; + /// Property: Fill Hits? + bool m_doHits; + /// Property: Fill Segments? + bool m_doSegments; + +}; + + +} // namespace D3PD + + +#endif //MUOND3PDMAKER_MUONSPSHOWERFILLERTOOL_H diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTrackParticleAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTrackParticleAssociationTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b58a16404faa5132f60f137153f058065a7b7887 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTrackParticleAssociationTool.cxx @@ -0,0 +1,98 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id$ +/** + * @file MuonD3PDMaker/src/MuonTrackParticleAssociationTool.cxx + * @author scott snyder <snyder@bnl.gov> + * @date Aug, 2009 + * @brief Associate from an Muon to its primary TrackParticle. + */ + + +#include "MuonTrackParticleAssociationTool.h" +#include "AthenaKernel/errorcheck.h" + + +namespace D3PD { + + +/** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ +MuonTrackParticleAssociationTool::MuonTrackParticleAssociationTool + (const std::string& type, + const std::string& name, + const IInterface* parent) + : Base (type, name, parent), + m_type (PRIMARY) +{ + declareProperty ("Type", m_typeprop = "Primary", + "Which TrackParticle to return. One of " + "Primary, Combined, " + "InDet, InDetOrPrimary, MuonSpectrometer"); +} + + +/** + * @brief Standard Gaudi initialize method. + */ +StatusCode MuonTrackParticleAssociationTool::initialize() +{ + CHECK( Base::initialize() ); + + if (m_typeprop == "Primary") + m_type = PRIMARY; + else if (m_typeprop == "Combined") + m_type = COMBINED; + else if (m_typeprop == "InDet") + m_type = INDET; + else if (m_typeprop == "InDetOrPrimary") + m_type = INDET_OR_PRIMARY; + else if (m_typeprop == "MuonSpectrometer") { + m_type = MUONSPECTROMETER; + REPORT_MESSAGE(MSG::INFO) << "called with type : MuonSpectrometer" << m_typeprop; + } + else { + REPORT_MESSAGE(MSG::ERROR) << "Bad type property " << m_typeprop; + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; +} + + +/** + * @brief Return the target object. + * @param p The source object for the association. + * + * Return the target of the association, or 0. + */ +const xAOD::TrackParticle* +MuonTrackParticleAssociationTool::get (const xAOD::Muon& p) +{ + switch (m_type) { + case PRIMARY: + return p.primaryTrackParticle(); + case COMBINED: + return p.trackParticle (xAOD::Muon::CombinedTrackParticle); + case INDET: + return p.trackParticle (xAOD::Muon::InnerDetectorTrackParticle); + case MUONSPECTROMETER: + return p.trackParticle (xAOD::Muon::MuonSpectrometerTrackParticle); + case INDET_OR_PRIMARY: + { + const xAOD::TrackParticle* t = p.trackParticle (xAOD::Muon::InnerDetectorTrackParticle); + if (!t) + t = p.primaryTrackParticle(); + return t; + } + } + std::abort(); +} + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTrackParticleAssociationTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTrackParticleAssociationTool.h new file mode 100644 index 0000000000000000000000000000000000000000..b8480094ebbb3f3b6965eff4af78f58ecb875bdd --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTrackParticleAssociationTool.h @@ -0,0 +1,81 @@ +// This file's extension implies that it's C, but it's really -*- C++ -*-. + +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id$ +/** + * @file MuonD3PDMaker/src/MuonTrackParticleAssociationTool.h + * @author scott snyder <snyder@bnl.gov> + * @date Aug, 2009 + * @brief Associate from an egamma to its primary TrackParticle. + */ + + +#ifndef MUOND3PDMAKER_MUONTRACKPARTICLEASSOCIATIONTOOL_H +#define MUOND3PDMAKER_MUONTRACKPARTICLEASSOCIATIONTOOL_H + + +#include "D3PDMakerUtils/SingleAssociationTool.h" +#include "xAODMuon/Muon.h" +#include "xAODTracking/TrackParticle.h" +#include <string> + + +namespace D3PD { + + +/** + * @brief Associate from an Muon to its primary TrackParticle. + */ +class MuonTrackParticleAssociationTool + : public SingleAssociationTool<xAOD::Muon, xAOD::TrackParticle> +{ +public: + typedef SingleAssociationTool<xAOD::Muon, xAOD::TrackParticle> Base; + + + /** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ + MuonTrackParticleAssociationTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + + /// Standard Gaudi initialize method. + StatusCode initialize(); + + + /** + * @brief Return the target object. + * @param p The source object for the association. + * + * Return the target of the association, or 0. + */ + virtual const xAOD::TrackParticle* get (const xAOD::Muon& p); + + +private: + /// Property: Which track particle should we return. + std::string m_typeprop; + + enum { + PRIMARY, + COMBINED, + INDET, + INDET_OR_PRIMARY, + MUONSPECTROMETER + } m_type; +}; + + +} // namespace D3PD + + + +#endif // not MUOND3PDMAKER_MUONTRACKPARTICLEASSOCIATIONTOOL_H diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTrkHitFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTrkHitFillerTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..22efc93637c9fc21142d31ed7e5dfb945539caef --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTrkHitFillerTool.cxx @@ -0,0 +1,99 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +////////////////////////////////////////////////////// +// +// Author : Alaettin Serhan Mete (serhan@iastate.edu) +// Date : 03 August 2009 +// +////////////////////////////////////////////////////// +#include "MuonTrkHitFillerTool.h" +#include "AthenaKernel/errorcheck.h" +#include "TrkTrackSummary/TrackSummary.h" + + +namespace { + +const int ID = 1; +const int MS = 2; + +struct Var +{ + const char* name; + xAOD::SummaryType type; + int which; +}; +const Var vars[] = +{ + {"nOutliersOnTrack", xAOD::numberOfOutliersOnTrack, ID+MS}, + + {"nBLHits", xAOD::numberOfBLayerHits, ID}, + {"nPixHits", xAOD::numberOfPixelHits, ID}, + {"nSCTHits", xAOD::numberOfSCTHits, ID}, + {"nTRTHits", xAOD::numberOfTRTHits, ID}, + {"nTRTHighTHits", xAOD::numberOfTRTHighThresholdHits, ID}, + {"nBLSharedHits", xAOD::numberOfBLayerSharedHits, ID}, + {"nPixSharedHits", xAOD::numberOfPixelSharedHits, ID}, + {"nPixHoles", xAOD::numberOfPixelHoles, ID}, + {"nSCTSharedHits", xAOD::numberOfSCTSharedHits, ID}, + {"nSCTHoles", xAOD::numberOfSCTHoles, ID}, + {"nTRTOutliers", xAOD::numberOfTRTOutliers, ID}, + {"nTRTHighTOutliers", xAOD::numberOfTRTHighThresholdOutliers, ID}, + {"nGangedPixels", xAOD::numberOfGangedPixels, ID}, + {"nPixelDeadSensors", xAOD::numberOfPixelDeadSensors, ID}, + {"nSCTDeadSensors", xAOD::numberOfSCTDeadSensors, ID}, + {"nTRTDeadStraws", xAOD::numberOfTRTDeadStraws, ID}, + {"expectBLayerHit", xAOD::expectBLayerHit, ID}, + + {"nprecisionLayers", xAOD::numberOfPrecisionLayers, MS}, + {"nprecisionHoleLayers", xAOD::numberOfPrecisionHoleLayers, MS}, + {"nphiLayers", xAOD::numberOfPhiLayers, MS}, + {"nphiHoleLayers", xAOD::numberOfPhiHoleLayers, MS}, + {"ntrigEtaLayers", xAOD::numberOfTriggerEtaLayers, MS}, + {"ntrigEtaHoleLayers", xAOD::numberOfTriggerEtaHoleLayers, MS}, +}; + + +} + + +namespace D3PD { + + +MuonTrkHitFillerTool::MuonTrkHitFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent) + : BlockFillerTool<xAOD::Muon> (type, name, parent) +{ + declareProperty ("SaveIDMuonHitSummary", m_saveIDMuonHitSummary = true); + declareProperty ("SaveMSMuonHitSummary", m_saveMSMuonHitSummary = true); +} + + +StatusCode MuonTrkHitFillerTool::book() +{ + int mask = 0; + if (m_saveIDMuonHitSummary) mask += ID; + if (m_saveMSMuonHitSummary) mask += MS; + + m_vars.reserve (std::distance (std::begin (vars), std::end (vars))); + for (const Var& v : vars) { + if (v.which & mask) { + m_vars.push_back (std::make_pair (v.type, nullptr)); + CHECK( addVariable (v.name, m_vars.back().second) ); + } + } + return StatusCode::SUCCESS; +} + + +StatusCode MuonTrkHitFillerTool::fill (const xAOD::Muon& p) +{ + for (auto& v : m_vars) + p.summaryValue (*v.second, v.first); + return StatusCode::SUCCESS; +} + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTrkHitFillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTrkHitFillerTool.h new file mode 100644 index 0000000000000000000000000000000000000000..dc32e730ec5a351e469e97e0c687a0613145095e --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTrkHitFillerTool.h @@ -0,0 +1,42 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef D3PDMAKER_MUONTRKHITFILLERTOOL_H +#define D3PDMAKER_MUONTRKHITFILLERTOOL_H + + +#include "D3PDMakerUtils/BlockFillerTool.h" +#include "xAODMuon/Muon.h" +#include <vector> +#include <stdint.h> + + +namespace D3PD { + + +class MuonTrkHitFillerTool + : public BlockFillerTool<xAOD::Muon> +{ +public: + MuonTrkHitFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + virtual StatusCode book(); + + virtual StatusCode fill (const xAOD::Muon& p); + + +private: + std::vector<std::pair<xAOD::SummaryType, uint8_t*> > m_vars; + + // toggle saving of track summary for ID and MS separately + bool m_saveIDMuonHitSummary; + bool m_saveMSMuonHitSummary; +}; + + +} // namespace D3PD + +#endif // not D3PDMAKER_MUONTRKHITFILLERTOOL_H diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthClassificationFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthClassificationFillerTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..dd6a648b509ea34b2587b66f968570cfd19418b6 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthClassificationFillerTool.cxx @@ -0,0 +1,55 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/MuonTruthClassificationFillerTool.h + * @author Massimiliano Bellomo <massimiliano.bellomo@cern.ch> + * @date February 2012 + * @brief Block filler for truth classification of muons - uses MCTruthClassifier + */ + +#include "MuonTruthClassificationFillerTool.h" +#include "AthenaKernel/errorcheck.h" +#include "xAODMuon/Muon.h" + +namespace D3PD { + +MuonTruthClassificationFillerTool::MuonTruthClassificationFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent) + : Base(type, name, parent), + m_classifier ("MCTruthClassifier") +{ + declareProperty ("Classifier", m_classifier, "Classifier tool instance."); + + book().ignore(); // Avoid coverity warnings. +} + +StatusCode MuonTruthClassificationFillerTool::initialize() { + CHECK( m_classifier.retrieve() ); + return Base::initialize(); +} + + +StatusCode MuonTruthClassificationFillerTool::book() { + CHECK( addVariable ("type", m_type, "MC particle type, from classifier tool" ) ); + CHECK( addVariable ("origin", m_origin, "MC particle origin, from classifier tool" ) ); + + return StatusCode::SUCCESS; +} + +StatusCode MuonTruthClassificationFillerTool::fill (const xAOD::Muon& p) { + + std::pair<MCTruthPartClassifier::ParticleType, + MCTruthPartClassifier::ParticleOrigin> res; + + res = m_classifier->particleTruthClassifier(&p); + + *m_type = res.first; + *m_origin = res.second; + + return StatusCode::SUCCESS; +} + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthClassificationFillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthClassificationFillerTool.h new file mode 100644 index 0000000000000000000000000000000000000000..0e5858151b49d45be4993f1806f85389340c653b --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthClassificationFillerTool.h @@ -0,0 +1,51 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/MuonTruthClassificationFillerTool.h + * @author Massimiliano Bellomo <massimiliano.bellomo@cern.ch> + * @date February 2012 + * @brief Block filler for truth classification of muons - uses MCTruthClassifier + */ + +#ifndef MUONTRUTHCLASSIFICATIONFILLERTOOL_H +#define MUONTRUTHCLASSIFICATIONFILLERTOOL_H + + +#include "D3PDMakerUtils/BlockFillerTool.h" + +#include "MCTruthClassifier/IMCTruthClassifier.h" +#include "xAODMuon/Muon.h" +#include "GaudiKernel/ToolHandle.h" + + +namespace D3PD { + + class MuonTruthClassificationFillerTool : public BlockFillerTool<xAOD::Muon> { + public: + typedef BlockFillerTool<xAOD::Muon> Base; + + MuonTruthClassificationFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + StatusCode initialize(); + virtual StatusCode book(); + virtual StatusCode fill (const xAOD::Muon& p); + + + private: + // Variables from each stored + int* m_type; + int* m_origin; + + // other private + ToolHandle<IMCTruthClassifier> m_classifier; +}; + + +} // namespace D3PD + + +#endif // MUONTRUTHCLASSIFICATIONFILLERTOOL_H diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthHitsFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthHitsFillerTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7ac6fed84d94c0ab75558eec8adb5fa92be7c51a --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthHitsFillerTool.cxx @@ -0,0 +1,221 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id$ +/** + * @file MuonD3PDMaker/src/MuonTruthHitsFillerTool.cxx + * @author scott snyder <snyder@bnl.gov>, from code by Niels van Eldik. + * @date Aug, 2013 + * @brief Fill truth hit information for muons. + */ + + +#include "MuonTruthHitsFillerTool.h" +#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "TrkTruthData/PRD_MultiTruthCollection.h" +#include "AthenaKernel/errorcheck.h" +#include "HepMC/GenParticle.h" +#include "boost/foreach.hpp" + + +namespace D3PD { + + +/** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ +MuonTruthHitsFillerTool::MuonTruthHitsFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent) + : Base (type, name, parent), + m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool") +{ + declareProperty("PRD_TruthNames", m_PRD_TruthNames); + m_PRD_TruthNames.push_back("CSC_TruthMap"); + m_PRD_TruthNames.push_back("RPC_TruthMap"); + m_PRD_TruthNames.push_back("TGC_TruthMap"); + m_PRD_TruthNames.push_back("MDT_TruthMap"); + m_PRD_TruthNames.push_back("MM_TruthMap"); + m_PRD_TruthNames.push_back("STGC_TruthMap"); + + book().ignore(); // Avoid coverity warnings. +} + + +/** + * @brief Standard Gaudi initialize method. + */ +StatusCode MuonTruthHitsFillerTool::initialize() +{ + CHECK( m_idHelper.retrieve() ); + return StatusCode::SUCCESS; +} + + +/** + * @brief Book variables for this block. + */ +StatusCode MuonTruthHitsFillerTool::book() +{ + typedef Muon::MuonStationIndex MSI; + + CHECK( addVariable ("nprecLayers", m_nprecLayers ) ); + CHECK( addVariable ("nphiLayers", m_nphiLayers ) ); + CHECK( addVariable ("ntrigEtaLayers", m_ntrigEtaLayers ) ); + + m_nprecHitsPerChamberLayer.resize(Muon::MuonStationIndex::ChIndexMax+2); + for( unsigned int i=0; i<MSI::ChIndexMax; ++i) { + MSI::ChIndex chIndex = (MSI::ChIndex)i; + CHECK( addVariable ( std::string("nprecHits")+MSI::chName(chIndex), + m_nprecHitsPerChamberLayer[i] ) ); + } + + CHECK( addVariable ( std::string("nprecHitsMMS"), + m_nprecHitsPerChamberLayer[MSI::ChIndexMax] ) ); + CHECK( addVariable ( std::string("nprecHitsMML"), + m_nprecHitsPerChamberLayer[MSI::ChIndexMax+1] ) ); + + m_nphiHitsPerChamberLayer.resize(MSI::PhiIndexMax); + m_ntrigEtaHitsPerChamberLayer.resize(MSI::PhiIndexMax); + for( unsigned int i=0; i<MSI::PhiIndexMax; ++i) { + MSI::PhiIndex phiIndex = (MSI::PhiIndex)i; + CHECK( addVariable ( std::string("nphiHits")+MSI::phiName(phiIndex), + m_nphiHitsPerChamberLayer[i] ) ); + CHECK( addVariable ( std::string("ntrigEtaHits")+MSI::phiName(phiIndex), + m_ntrigEtaHitsPerChamberLayer[i] ) ); + } + + return StatusCode::SUCCESS; +} + + +/** + * @brief Fill one block --- type-safe version. + */ +StatusCode MuonTruthHitsFillerTool::fill (const TrackRecord& p) +{ + CHECK( fillHitCounts (p.GetBarCode()) ); + return StatusCode::SUCCESS; +} + + +/** + * @brief Fill one block --- type-safe version. + */ +StatusCode MuonTruthHitsFillerTool::fill (const TruthParticle& p) +{ + CHECK( fillHitCounts (p.barcode()) ); + return StatusCode::SUCCESS; +} + + +/** + * @brief Fill one block --- type-safe version. + */ +StatusCode MuonTruthHitsFillerTool::fill (const xAOD::TruthParticle& p) +{ + CHECK( fillHitCounts (p.barcode()) ); + return StatusCode::SUCCESS; +} + + +StatusCode MuonTruthHitsFillerTool::fillHitCounts (int barcode) +{ + typedef Muon::MuonStationIndex MSI; + + bool found = false; + BOOST_FOREACH (const std::string& key, m_PRD_TruthNames) { + const PRD_MultiTruthCollection* collection = 0; + if (!evtStore()->retrieve(collection, key).isSuccess()) { + ATH_MSG_WARNING( "PRD_MultiTruthCollection " << key << " NOT found"); + continue; + } + + BOOST_FOREACH(const PRD_MultiTruthCollection::value_type& mc, *collection) { + // check if gen particle same as input + if( mc.second->barcode() != barcode ) continue; + found = true; + const Identifier& id = mc.first; + ATH_MSG_VERBOSE("found matching hit " << m_idHelper->toString(id) ); + bool measPhi = m_idHelper->measuresPhi(id); + + if( m_idHelper->issTgc(id) ) { + int index = m_idHelper->phiIndex(id); + if( measPhi ) ++*(m_nphiHitsPerChamberLayer[index]); + else ++*(m_ntrigEtaHitsPerChamberLayer[index]); + } + else if( m_idHelper->isMM(id) ) { + int index = m_idHelper->isSmallChamber(id) ? MSI::ChIndexMax : MSI::ChIndexMax + 1; + ++*(m_nprecHitsPerChamberLayer[index]); + } + else if( m_idHelper->isTrigger(id) ) { + MSI::PhiIndex index = m_idHelper->phiIndex(id); + if( measPhi ) ++*(m_nphiHitsPerChamberLayer[index]); + else ++*(m_ntrigEtaHitsPerChamberLayer[index]); + } + else { + if( measPhi ) { + Muon::MuonStationIndex::PhiIndex index = m_idHelper->phiIndex(id); + ++*(m_nphiHitsPerChamberLayer[index]); + }else{ + Muon::MuonStationIndex::ChIndex chIndex = m_idHelper->chamberIndex(id); + ++*(m_nprecHitsPerChamberLayer[chIndex]); + } + } + } + } + + if( !found ) { + ATH_MSG_VERBOSE("No hits associated to muon "); + } + else { + // sum precision hits + const std::vector<int*>& nprec = m_nprecHitsPerChamberLayer; + const std::vector<int*>& nphi = m_nphiHitsPerChamberLayer; + const std::vector<int*>& ntrig = m_ntrigEtaHitsPerChamberLayer; + + if( *nprec[MSI::BIS] + *nprec[MSI::BIL] > 3 ) ++*m_nprecLayers; + if( *nprec[MSI::BMS] + *nprec[MSI::BML] > 2 ) ++*m_nprecLayers; + if( *nprec[MSI::BOS] + *nprec[MSI::BOL] > 2 ) ++*m_nprecLayers; + if( *nprec[MSI::EIS] + *nprec[MSI::EIL] > 3 ) ++*m_nprecLayers; + if( *nprec[MSI::EMS] + *nprec[MSI::EML] > 2 ) ++*m_nprecLayers; + if( *nprec[MSI::EOS] + *nprec[MSI::EOL] > 2 ) ++*m_nprecLayers; + if( *nprec[MSI::EES] + *nprec[MSI::EEL] > 3 ) ++*m_nprecLayers; + if( *nprec[MSI::CSS] + *nprec[MSI::CSL] > 2 ) ++*m_nprecLayers; + if( *nprec[MSI::BEE] > 3 ) ++*m_nprecLayers; + if( *nprec[MSI::ChIndexMax] + *nprec[MSI::ChIndexMax+1] > 3 ) ++*m_nprecLayers; + + if( *nphi[MSI::BM1] > 0 ) ++*m_nphiLayers; + if( *nphi[MSI::BM2] > 0 ) ++*m_nphiLayers; + if( *nphi[MSI::BO1] > 0 ) ++*m_nphiLayers; + if( *nphi[MSI::T1] > 0 ) ++*m_nphiLayers; + if( *nphi[MSI::T2] > 0 ) ++*m_nphiLayers; + if( *nphi[MSI::T3] > 0 ) ++*m_nphiLayers; + if( *nphi[MSI::T4] > 0 ) ++*m_nphiLayers; + if( *nphi[MSI::CSC] > 2 ) ++*m_nphiLayers; + if( *nphi[MSI::STGC1] + *nphi[MSI::STGC2] > 3 ) ++*m_nphiLayers; + + if( *ntrig[MSI::BM1] > 0 ) ++*m_ntrigEtaLayers; + if( *ntrig[MSI::BM2] > 0 ) ++*m_ntrigEtaLayers; + if( *ntrig[MSI::BO1] > 0 ) ++*m_ntrigEtaLayers; + if( *ntrig[MSI::T1] > 0 ) ++*m_ntrigEtaLayers; + if( *ntrig[MSI::T2] > 0 ) ++*m_ntrigEtaLayers; + if( *ntrig[MSI::T3] > 0 ) ++*m_ntrigEtaLayers; + if( *ntrig[MSI::T4] > 0 ) ++*m_ntrigEtaLayers; + if( *ntrig[MSI::CSC] > 2 ) ++*m_ntrigEtaLayers; + if( *ntrig[MSI::STGC1] + + *ntrig[MSI::STGC2] > 3 ) ++*m_ntrigEtaLayers; + + ATH_MSG_DEBUG("Muon hits: prec " << *m_nprecLayers << + " phi " << *m_nphiLayers + << " trig eta " << *m_ntrigEtaLayers ); + } + return StatusCode::SUCCESS; +} + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthHitsFillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthHitsFillerTool.h new file mode 100644 index 0000000000000000000000000000000000000000..9b39900b0878762a886fd453f3808e61af8fb2e5 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthHitsFillerTool.h @@ -0,0 +1,102 @@ +// This file's extension implies that it's C, but it's really -*- C++ -*-. + +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id$ +/** + * @file MuonD3PDMaker/src/MuonTruthHitsFillerTool.h + * @author scott snyder <snyder@bnl.gov>, from code by Niels van Eldik. + * @date Aug, 2013 + * @brief Fill truth hit information for muons. + */ + + +#ifndef MUOND3PDMAKER_MUONTRUTHHITSFILLERTOOL_H +#define MUOND3PDMAKER_MUONTRUTHHITSFILLERTOOL_H + + +#include "D3PDMakerUtils/BlockFillerToolMulti.h" +#include "TrackRecord/TrackRecord.h" +#include "McParticleEvent/TruthParticle.h" +#include "xAODTruth/TruthParticle.h" +#include "GaudiKernel/ToolHandle.h" +#include <vector> + + +namespace Muon { + class MuonIdHelperTool; +} + + +namespace D3PD { + + +/** + * @brief Fill truth hit information for muons. + */ +class MuonTruthHitsFillerTool + : public BlockFillerTool<Types<TrackRecord, TruthParticle, xAOD::TruthParticle> > +{ +public: + typedef BlockFillerTool<Types<TrackRecord, TruthParticle, xAOD::TruthParticle> > Base; + + + /** + * @brief Standard Gaudi tool constructor. + * @param type The name of the tool type. + * @param name The tool name. + * @param parent The tool's Gaudi parent. + */ + MuonTruthHitsFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + + /// Standard Gaudi initialize method. + virtual StatusCode initialize(); + + + /// Book variables for this block. + virtual StatusCode book(); + + + /** + * @brief Fill one block --- type-safe version. + */ + virtual StatusCode fill (const TrackRecord& p); + + + /** + * @brief Fill one block --- type-safe version. + */ + virtual StatusCode fill (const TruthParticle& p); + + + /** + * @brief Fill one block --- type-safe version. + */ + virtual StatusCode fill (const xAOD::TruthParticle& p); + + +private: + StatusCode fillHitCounts (int barcode); + + int* m_nprecLayers; + int* m_nphiLayers; + int* m_ntrigEtaLayers; + std::vector<int*> m_nprecHitsPerChamberLayer; + std::vector<int*> m_nphiHitsPerChamberLayer; + std::vector<int*> m_ntrigEtaHitsPerChamberLayer; + + // other private + ToolHandle<Muon::MuonIdHelperTool> m_idHelper; + std::vector<std::string> m_PRD_TruthNames; +}; + + +} // namespace D3PD + + +#endif // not MUOND3PDMAKER_MUONTRUTHHITSFILLERTOOL_H diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/RpcPrepDataCollectionGetterTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/RpcPrepDataCollectionGetterTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5698b34037946322798570c2c077c6ec45b69a7c --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/RpcPrepDataCollectionGetterTool.cxx @@ -0,0 +1,128 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: RpcPrepDataCollectionGetterTool.cxx 535250 2013-01-29 13:22:17Z salekd $ +#include "RpcPrepDataCollectionGetterTool.h" + +namespace D3PD { + +RpcPrepDataCollectionGetterTool::RpcPrepDataCollectionGetterTool + (const std::string& type, + const std::string& name, + const IInterface* parent) + : Base (type, name, parent) +{ +} + +StatusCode RpcPrepDataCollectionGetterTool::initialize() +{ + CHECK( Base::initialize() ); + + return StatusCode::SUCCESS; +} + +const std::type_info& RpcPrepDataCollectionGetterTool::typeinfo() const +{ + return typeid(Muon::RpcPrepDataContainer); +} + + +const std::type_info& RpcPrepDataCollectionGetterTool::elementTypeinfo() const +{ + return typeid(Muon::RpcPrepData); +} + +size_t RpcPrepDataCollectionGetterTool::sizeHint(bool allowMissing) +{ + const Muon::RpcPrepDataContainer* cont = (Muon::RpcPrepDataContainer*)getUntyped(allowMissing); + + if (!cont) { + return 0; + } + int nclus = 0; + + // Loop over the container + Muon::RpcPrepDataContainer::const_iterator itr = cont->begin(); + Muon::RpcPrepDataContainer::const_iterator itr_end = cont->end(); + for( ; itr!=itr_end; ++itr ){ + + // Loop over the collection + Muon::RpcPrepDataCollection::const_iterator itr_col = (*itr)->begin(); + Muon::RpcPrepDataCollection::const_iterator itr_col_end = (*itr)->end(); + for( ; itr_col!=itr_col_end; ++itr_col ){ + nclus++; + } + } + + return nclus; +} + +StatusCode RpcPrepDataCollectionGetterTool::reset(bool allowMissing) +{ + const Muon::RpcPrepDataContainer* cont = (Muon::RpcPrepDataContainer*)getUntyped(allowMissing); + + if (!cont) { + m_contItr = m_contEnd; + m_collItr = m_collEnd; + return StatusCode::FAILURE; + } + + m_contItr = cont->begin(); + m_contEnd = cont->end(); + + if(m_contItr == m_contEnd){ + m_collItr = m_collEnd; + return StatusCode::SUCCESS; + } + + m_collItr = (*m_contItr)->begin(); + m_collEnd = (*m_contItr)->end(); + + return StatusCode::SUCCESS; +} + + +const void* RpcPrepDataCollectionGetterTool::nextUntyped() +{ + if(m_collItr == m_collEnd){ + if(m_contItr==m_contEnd){ + return 0; + } + m_contItr++; + if(m_contItr==m_contEnd){ + return 0; + } + m_collItr = (*m_contItr)->begin(); + m_collEnd = (*m_contItr)->end(); + if(m_collItr == m_collEnd){ + return 0; + } + } + + const Muon::RpcPrepData *clus = *m_collItr; + + m_collItr++; + + return clus; +} + + +// Dummies --- the default versions of these don't compile. +// But these are overridden by the derived class here. +template<> +const std::type_info& +CollectionGetterTool<Muon::RpcPrepDataContainer>::elementTypeinfo() const +{ + return typeid(Muon::RpcPrepData); +} + +template<> +const void* +CollectionGetterTool<Muon::RpcPrepDataContainer>::nextUntyped() +{ + return 0; +} + + +} diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/RpcPrepDataCollectionGetterTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/RpcPrepDataCollectionGetterTool.h new file mode 100644 index 0000000000000000000000000000000000000000..eb93736cafc6bb7631700c96eb96e8844dec6704 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/RpcPrepDataCollectionGetterTool.h @@ -0,0 +1,57 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: RpcPrepDataCollectionGetterTool.h 535250 2013-01-29 13:22:17Z salekd $ +#ifndef MUOND3PDMAKER_RPCPREPDATACOLLECTIONGETTERTOOL_H +#define MUOND3PDMAKER_RPCPREPDATACOLLECTIONGETTERTOOL_H + +#include "D3PDMakerUtils/SGCollectionGetterTool.h" +#include "MuonPrepRawData/RpcPrepData.h" +#include "MuonPrepRawData/RpcPrepDataCollection.h" +#include "MuonPrepRawData/RpcPrepDataContainer.h" + +//namespace Muon { +// class RpcPrepData; +//} + +namespace D3PD { + +class RpcPrepDataCollectionGetterTool + : public SGCollectionGetterTool<Muon::RpcPrepDataContainer> +{ +public: + typedef SGCollectionGetterTool<Muon::RpcPrepDataContainer> Base; + + RpcPrepDataCollectionGetterTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + StatusCode initialize(); + size_t sizeHint(bool=false); + StatusCode reset(bool=false); + const void* nextUntyped(); + const std::type_info& typeinfo() const; + const std::type_info& elementTypeinfo() const; + +private: + Muon::RpcPrepDataContainer::const_iterator m_contItr; + Muon::RpcPrepDataContainer::const_iterator m_contEnd; + + Muon::RpcPrepDataCollection::const_iterator m_collItr; + Muon::RpcPrepDataCollection::const_iterator m_collEnd; +}; + +// Dummies --- the default versions of these don't compile. +// But these are overridden by the derived class here. +template<> +const std::type_info& +CollectionGetterTool<Muon::RpcPrepDataContainer>::elementTypeinfo() const; + +template<> +const void* +CollectionGetterTool<Muon::RpcPrepDataContainer>::nextUntyped(); + +} + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/RpcPrepDataFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/RpcPrepDataFillerTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9b34524ba98cc3504926c22a623faa9ce4d2a1c2 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/RpcPrepDataFillerTool.cxx @@ -0,0 +1,46 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: RpcPrepDataFillerTool.cxx 535262 2013-01-29 13:54:17Z salekd $ +#include "RpcPrepDataFillerTool.h" +#include "AthenaKernel/errorcheck.h" + + +namespace D3PD { + + +RpcPrepDataFillerTool::RpcPrepDataFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent) + : BlockFillerTool<Muon::RpcPrepData> (type, name, parent) +{ + book().ignore(); // Avoid coverity warnings. +} + + +StatusCode RpcPrepDataFillerTool::book() +{ + CHECK( addVariable ("x", m_x) ); + CHECK( addVariable ("y", m_y) ); + CHECK( addVariable ("z", m_z) ); + CHECK( addVariable ("time", m_time) ); + CHECK( addVariable ("locX", m_locX) ); + + return StatusCode::SUCCESS; +} + + +StatusCode RpcPrepDataFillerTool::fill (const Muon::RpcPrepData& obj) +{ + *m_x = obj.globalPosition().x(); + *m_y = obj.globalPosition().y(); + *m_z = obj.globalPosition().z(); + *m_time = obj.time(); + *m_locX = obj.localPosition().x(); + + return StatusCode::SUCCESS; +} + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/RpcPrepDataFillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/RpcPrepDataFillerTool.h new file mode 100644 index 0000000000000000000000000000000000000000..929f779f1d285e0b0b3adbe1801e30a96de0a4bd --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/RpcPrepDataFillerTool.h @@ -0,0 +1,51 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: RpcPrepDataFillerTool.h 535262 2013-01-29 13:54:17Z salekd $ +#ifndef D3PDMAKER_RPCPREPDATAFILLERTOOL_H +#define D3PDMAKER_RPCPREPDATAFILLERTOOL_H + +#include "MuonPrepRawData/RpcPrepData.h" +#include "MuonPrepRawData/RpcPrepDataCollection.h" +#include "D3PDMakerUtils/BlockFillerTool.h" +#include "D3PDMakerUtils/SGCollectionGetterTool.h" +#include <string> + +namespace D3PD { + +/** + * @brief Block filler tool for the RPC hits + * + * @author David Salek <David.Salek@cern.ch> + * + * $Revision: 535262 $ + * $Date: 2013-01-29 14:54:17 +0100 (Tue, 29 Jan 2013) $ + */ +class RpcPrepDataFillerTool + : public BlockFillerTool<Muon::RpcPrepData> +{ +public: + /// Regular Gaudi AlgTool constructor + RpcPrepDataFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + /// Function booking the ntuple variables + virtual StatusCode book(); + + /// Function filling the ntuple variables for a single object + virtual StatusCode fill (const Muon::RpcPrepData& obj); + + +private: + float* m_x; + float* m_y; + float* m_z; + float* m_time; + float* m_locX; +}; + +} // namespace D3PD + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TgcPrepDataCollectionGetterTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TgcPrepDataCollectionGetterTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..de9342603bec4cfc7f65a9c6659380c78d7706ee --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TgcPrepDataCollectionGetterTool.cxx @@ -0,0 +1,128 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: TgcPrepDataCollectionGetterTool.cxx 535250 2013-01-29 13:22:17Z salekd $ +#include "TgcPrepDataCollectionGetterTool.h" + +namespace D3PD { + +TgcPrepDataCollectionGetterTool::TgcPrepDataCollectionGetterTool + (const std::string& type, + const std::string& name, + const IInterface* parent) + : Base (type, name, parent) +{ +} + +StatusCode TgcPrepDataCollectionGetterTool::initialize() +{ + CHECK( Base::initialize() ); + + return StatusCode::SUCCESS; +} + +const std::type_info& TgcPrepDataCollectionGetterTool::typeinfo() const +{ + return typeid(Muon::TgcPrepDataContainer); +} + + +const std::type_info& TgcPrepDataCollectionGetterTool::elementTypeinfo() const +{ + return typeid(Muon::TgcPrepData); +} + +size_t TgcPrepDataCollectionGetterTool::sizeHint(bool allowMissing) +{ + const Muon::TgcPrepDataContainer* cont = (Muon::TgcPrepDataContainer*)getUntyped(allowMissing); + + if (!cont) { + return 0; + } + int nclus = 0; + + // Loop over the container + Muon::TgcPrepDataContainer::const_iterator itr = cont->begin(); + Muon::TgcPrepDataContainer::const_iterator itr_end = cont->end(); + for( ; itr!=itr_end; ++itr ){ + + // Loop over the collection + Muon::TgcPrepDataCollection::const_iterator itr_col = (*itr)->begin(); + Muon::TgcPrepDataCollection::const_iterator itr_col_end = (*itr)->end(); + for( ; itr_col!=itr_col_end; ++itr_col ){ + nclus++; + } + } + + return nclus; +} + +StatusCode TgcPrepDataCollectionGetterTool::reset(bool allowMissing) +{ + const Muon::TgcPrepDataContainer* cont = (Muon::TgcPrepDataContainer*)getUntyped(allowMissing); + + if (!cont) { + m_contItr = m_contEnd; + m_collItr = m_collEnd; + return StatusCode::FAILURE; + } + + m_contItr = cont->begin(); + m_contEnd = cont->end(); + + if(m_contItr == m_contEnd){ + m_collItr = m_collEnd; + return StatusCode::SUCCESS; + } + + m_collItr = (*m_contItr)->begin(); + m_collEnd = (*m_contItr)->end(); + + return StatusCode::SUCCESS; +} + + +const void* TgcPrepDataCollectionGetterTool::nextUntyped() +{ + if(m_collItr == m_collEnd){ + if(m_contItr==m_contEnd){ + return 0; + } + m_contItr++; + if(m_contItr==m_contEnd){ + return 0; + } + m_collItr = (*m_contItr)->begin(); + m_collEnd = (*m_contItr)->end(); + if(m_collItr == m_collEnd){ + return 0; + } + } + + const Muon::TgcPrepData *clus = *m_collItr; + + m_collItr++; + + return clus; +} + + +// Dummies --- the default versions of these don't compile. +// But these are overridden by the derived class here. +template<> +const std::type_info& +CollectionGetterTool<Muon::TgcPrepDataContainer>::elementTypeinfo() const +{ + return typeid(Muon::TgcPrepData); +} + +template<> +const void* +CollectionGetterTool<Muon::TgcPrepDataContainer>::nextUntyped() +{ + return 0; +} + + +} diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TgcPrepDataCollectionGetterTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TgcPrepDataCollectionGetterTool.h new file mode 100644 index 0000000000000000000000000000000000000000..5aaf2cb3bb9399424f29155b92f2fda4ab558700 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TgcPrepDataCollectionGetterTool.h @@ -0,0 +1,57 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: TgcPrepDataCollectionGetterTool.h 535250 2013-01-29 13:22:17Z salekd $ +#ifndef MUOND3PDMAKER_TGCPREPDATACOLLECTIONGETTERTOOL_H +#define MUOND3PDMAKER_TGCPREPDATACOLLECTIONGETTERTOOL_H + +#include "D3PDMakerUtils/SGCollectionGetterTool.h" +#include "MuonPrepRawData/TgcPrepData.h" +#include "MuonPrepRawData/TgcPrepDataCollection.h" +#include "MuonPrepRawData/TgcPrepDataContainer.h" + +//namespace Muon { +// class TgcPrepData; +//} + +namespace D3PD { + +class TgcPrepDataCollectionGetterTool + : public SGCollectionGetterTool<Muon::TgcPrepDataContainer> +{ +public: + typedef SGCollectionGetterTool<Muon::TgcPrepDataContainer> Base; + + TgcPrepDataCollectionGetterTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + StatusCode initialize(); + size_t sizeHint(bool=false); + StatusCode reset(bool=false); + const void* nextUntyped(); + const std::type_info& typeinfo() const; + const std::type_info& elementTypeinfo() const; + +private: + Muon::TgcPrepDataContainer::const_iterator m_contItr; + Muon::TgcPrepDataContainer::const_iterator m_contEnd; + + Muon::TgcPrepDataCollection::const_iterator m_collItr; + Muon::TgcPrepDataCollection::const_iterator m_collEnd; +}; + +// Dummies --- the default versions of these don't compile. +// But these are overridden by the derived class here. +template<> +const std::type_info& +CollectionGetterTool<Muon::TgcPrepDataContainer>::elementTypeinfo() const; + +template<> +const void* +CollectionGetterTool<Muon::TgcPrepDataContainer>::nextUntyped(); + +} + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TgcPrepDataFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TgcPrepDataFillerTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..eff76ef0d0f1b970728cee7a4900a22dc57ba60e --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TgcPrepDataFillerTool.cxx @@ -0,0 +1,46 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: TgcPrepDataFillerTool.cxx 535262 2013-01-29 13:54:17Z salekd $ +#include "TgcPrepDataFillerTool.h" +#include "AthenaKernel/errorcheck.h" + + +namespace D3PD { + + +TgcPrepDataFillerTool::TgcPrepDataFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent) + : BlockFillerTool<Muon::TgcPrepData> (type, name, parent) +{ + book().ignore(); // Avoid coverity warnings. +} + + +StatusCode TgcPrepDataFillerTool::book() +{ + CHECK( addVariable ("x", m_x) ); + CHECK( addVariable ("y", m_y) ); + CHECK( addVariable ("z", m_z) ); + CHECK( addVariable ("locX", m_locX) ); + //CHECK( addVariable ("bcBitMap", m_bcBitMap) ); + + return StatusCode::SUCCESS; +} + + +StatusCode TgcPrepDataFillerTool::fill (const Muon::TgcPrepData& obj) +{ + *m_x = obj.globalPosition().x(); + *m_y = obj.globalPosition().y(); + *m_z = obj.globalPosition().z(); + *m_locX = obj.localPosition().x(); + //*m_bcBitMap = obj.getBcBitMap(); + + return StatusCode::SUCCESS; +} + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TgcPrepDataFillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TgcPrepDataFillerTool.h new file mode 100644 index 0000000000000000000000000000000000000000..1cb0e486e6093a4b6911400e3aa0565bbbbd603b --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TgcPrepDataFillerTool.h @@ -0,0 +1,51 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: TgcPrepDataFillerTool.h 542179 2013-03-24 05:55:13Z ssnyder $ +#ifndef D3PDMAKER_TGCPREPDATAFILLERTOOL_H +#define D3PDMAKER_TGCPREPDATAFILLERTOOL_H + +#include "MuonPrepRawData/TgcPrepData.h" +#include "MuonPrepRawData/TgcPrepDataCollection.h" +#include "D3PDMakerUtils/BlockFillerTool.h" +#include "D3PDMakerUtils/SGCollectionGetterTool.h" +#include <string> + +namespace D3PD { + +/** + * @brief Block filler tool for the TGC hits + * + * @author David Salek <David.Salek@cern.ch> + * + * $Revision: 542179 $ + * $Date: 2013-03-24 06:55:13 +0100 (Sun, 24 Mar 2013) $ + */ +class TgcPrepDataFillerTool + : public BlockFillerTool<Muon::TgcPrepData> +{ +public: + /// Regular Gaudi AlgTool constructor + TgcPrepDataFillerTool (const std::string& type, + const std::string& name, + const IInterface* parent); + + /// Function booking the ntuple variables + virtual StatusCode book(); + + /// Function filling the ntuple variables for a single object + virtual StatusCode fill (const Muon::TgcPrepData& obj); + + +private: + float* m_x; + float* m_y; + float* m_z; + float* m_locX; + //int* m_bcBitMap; +}; + +} // namespace D3PD + +#endif diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TrackRecordFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TrackRecordFillerTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b3d049006de5fcf772a6f66150fdbe2c99a9cf6f --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TrackRecordFillerTool.cxx @@ -0,0 +1,65 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// Gaudi/Athena include(s): +#include "AthenaKernel/errorcheck.h" +#include "CLHEP/Units/SystemOfUnits.h" + +// Local include(s): +#include "TrackRecordFillerTool.h" + + +using CLHEP::GeV; + + +namespace D3PD { + + TrackRecordFillerTool::TrackRecordFillerTool( const std::string& type, + const std::string& name, + const IInterface* parent ) + : BlockFillerTool< TrackRecord >( type, name, parent ), + m_OnlyMuon(false), + m_EnergyThreshold(1.*GeV) + { + book().ignore(); // Avoid coverity warnings. + } + + StatusCode TrackRecordFillerTool::book() { + + CHECK( addVariable( "barcode", m_barcode, "particle bar code" ) ); + CHECK( addVariable( "pdgId", m_pdgid, "particle PDG id" ) ); + CHECK( addVariable( "E", m_energy, "particle energy" ) ); + CHECK( addVariable( "pt", m_pt, "particle transverse momentum" ) ); + CHECK( addVariable( "eta", m_eta, "particle pseudorapidity" ) ); + CHECK( addVariable( "phi", m_phi, "particle azimuthal angle" ) ); + CHECK( addVariable( "pos_x", m_posx, "particle position x coordinate" ) ); + CHECK( addVariable( "pos_y", m_posy, "particle position y coordinate" ) ); + CHECK( addVariable( "pos_z", m_posz, "particle position z coordinate" ) ); + CHECK( addVariable( "time", m_time, "particle time" ) ); + return StatusCode::SUCCESS; + } + + StatusCode TrackRecordFillerTool::fill( const TrackRecord& obj ) { + + bool pass(true); + if ( m_OnlyMuon && abs( obj.GetPDGCode() ) != 13 ) pass = false; + if ( obj.GetEnergy() < m_EnergyThreshold ) pass = false; + if ( pass ){ + *m_barcode = obj.GetBarCode(); + *m_pdgid = obj.GetPDGCode(); + *m_energy = obj.GetEnergy(); + *m_pt = obj.GetMomentum().rho(); + *m_eta = obj.GetMomentum().eta(); + *m_phi = obj.GetMomentum().phi(); + *m_posx = obj.GetPosition().x(); + *m_posy = obj.GetPosition().y(); + *m_posz = obj.GetPosition().z(); + *m_time = obj.GetTime(); + } + return StatusCode::SUCCESS; + } + + +} // namespace D3PD + diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TrackRecordFillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TrackRecordFillerTool.h new file mode 100644 index 0000000000000000000000000000000000000000..f742ce2c1583eca128e5beface023aad64d5d7e0 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TrackRecordFillerTool.h @@ -0,0 +1,57 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MUOND3PDMAKER_TRACKRECORDFILLERTOOL_H +#define MUOND3PDMAKER_TRACKRECORDFILLERTOOL_H + +// EDM include(s): +#include "TrackRecord/TrackRecordCollection.h" + +// D3PDMaker include(s): +#include "D3PDMakerUtils/BlockFillerTool.h" + + +namespace D3PD { + + /** + * @short Filler tool for the basic properties of TrackRecord + * + * This tool can be used to save the simple properties of an + * TrackRecord object. + * + */ + class TrackRecordFillerTool : public BlockFillerTool< TrackRecord > { + + public: + /// Regular Gaudi AlgTool constructor + TrackRecordFillerTool( const std::string& type, const std::string& name, + const IInterface* parent ); + + /// Function booking the ntuple variables + virtual StatusCode book(); + /// Function filling the ntuple variables for a single object + virtual StatusCode fill( const TrackRecord& obj ); + + private: + + int* m_barcode; + int* m_pdgid; + float* m_energy; + float* m_pt; + float* m_eta; + float* m_phi; + float* m_posx; + float* m_posy; + float* m_posz; + float* m_time; + + // Property: fill info for only muons or all particles entering Muon Spectrometer? + bool m_OnlyMuon; + // Property: minimum particle energy + bool m_EnergyThreshold; + }; // class TrackRecordFillerTool + +} // namespace D3PD + +#endif // MUOND3PDMAKER_TRACKRECORDFILLERTOOL_H diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TruthMuonsToSG.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TruthMuonsToSG.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0e7ecc39b32da2be7e4608987148b861ed9cc22b --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TruthMuonsToSG.cxx @@ -0,0 +1,75 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/TruthMuonsToSG.h + * @author Srivas Prasad <srivas.prasad@cern.ch> + * @date March 2010 + * @brief Create collection of true muons in StoreGate, based on analogous code in TauD3PDMaker + */ + + +#include "TruthMuonsToSG.h" + +#include "xAODTruth/TruthParticleContainer.h" +#include "EventKernel/PdtPdg.h" +#include "DataModel/ConstDataVector.h" +#include "AthenaKernel/errorcheck.h" + + +namespace D3PD { + + +TruthMuonsToSG::TruthMuonsToSG(const std::string& name, ISvcLocator* pSvcLocator) + : AthAlgorithm(name, pSvcLocator), + m_resolver (name, evtStore(), m_truthContainerKey), + m_classifier ("MCTruthClassifier") +{ + declareProperty("TruthContainer", m_truthContainerKey = "TruthParticle" ); + declareProperty("TruthMuonContainer", m_truthMuonContainerKey = "TruthMuons" ); + declareProperty ("Classifier", m_classifier, "Classifier tool instance."); + +} + +StatusCode TruthMuonsToSG::initialize() { + CHECK( m_resolver.initialize<xAOD::TruthParticleContainer>() ); + CHECK( m_classifier.retrieve() ); + return StatusCode::SUCCESS; +} + +StatusCode TruthMuonsToSG::finalize() { + return StatusCode::SUCCESS; +} + + +StatusCode TruthMuonsToSG::execute() { + const xAOD::TruthParticleContainer *truthCollection = 0; + StatusCode sc=evtStore()->retrieve( truthCollection, m_resolver.key()); + if( sc.isFailure() || !truthCollection) { + ATH_MSG_ERROR("Failed to retrieve xAOD::TruthParticleContainer " << m_resolver.key()); + return StatusCode::FAILURE; + } + + // output container for muons + ConstDataVector<xAOD::TruthParticleContainer>* muonColl + = new ConstDataVector<xAOD::TruthParticleContainer>(SG::VIEW_ELEMENTS); + + for (const xAOD::TruthParticle* p : *truthCollection) { + if( abs(p->pdgId()) == PDG::mu_minus && p->status() == 1 ) { + muonColl->push_back(p); + } + else if( p->pdgId() == 22 ) { + std::pair<unsigned int, unsigned int> Classify=m_classifier->particleTruthClassifier( p ); + if( (MCTruthPartClassifier::ParticleOrigin)(Classify.second) == MCTruthPartClassifier::FSRPhot ) { + muonColl->push_back(p); + } + } + } + + if( evtStore()->record(muonColl, m_truthMuonContainerKey).isFailure() ) return StatusCode::FAILURE; + return StatusCode::SUCCESS; +} + + +} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TruthMuonsToSG.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TruthMuonsToSG.h new file mode 100644 index 0000000000000000000000000000000000000000..3c482bc159bb7c0eee279dbf76339c771b2431fc --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/TruthMuonsToSG.h @@ -0,0 +1,46 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file MuonD3PDMaker/src/TruthMuonsToSG.h + * @author Srivas Prasad <srivas.prasad@cern.ch> + * @date March 2010 + * @brief Create collection of true muons in StoreGate, based on analogous code in TauD3PDMaker + */ + +#ifndef TRUTHMMUONSTOSG_H +#define TRUTHMMUONSTOSG_H 1 + +#include "AthenaBaseComps/AthAlgorithm.h" +#include "MCTruthClassifier/IMCTruthClassifier.h" +#include "D3PDMakerUtils/SGKeyResolver.h" +#include "GaudiKernel/ToolHandle.h" +#include <string> + + +namespace D3PD { + + +class TruthMuonsToSG: public AthAlgorithm { + public: + TruthMuonsToSG(const std::string& name, ISvcLocator* pSvcLocator); + + StatusCode initialize(); + StatusCode finalize(); + StatusCode execute(); + + private: + std::string m_truthContainerKey; + std::string m_truthMuonContainerKey; + + /// Helper to resolve SG key for input collection. + SGKeyResolver m_resolver; + ToolHandle<IMCTruthClassifier> m_classifier; +}; + + +} // namespace D3PD + + +#endif // TRUTHMUONSTOSG_H diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/components/MuonD3PDMaker_entries.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/components/MuonD3PDMaker_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c2a7d75c67e914b83f730f108c5b14978150d5fd --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/components/MuonD3PDMaker_entries.cxx @@ -0,0 +1,121 @@ +// $Id$ +/** + * @file MuonD3PDMaker/src/components/MuonD3PDMaker_entries.cxx + * @author scott snyder <snyder@bnl.gov> + * @date Aug, 2009 + * @brief List Gaudi components. + */ + + +#include "../MuonTrkHitFillerTool.h" //Serhan +#include "../MuonNumberOfSegmentsFillerTool.h" +#include "../MuonTrackParticleAssociationTool.h" +#include "../MuonL1TriggerObjectAssociationTool.h" // Srivas +#include "../MuonL2TriggerObjectAssociationTool.h" // Srivas +#include "../MuonEFTriggerObjectAssociationTool.h" // Srivas +#include "../MuonEFInfoTriggerObjectAssociationTool.h" // Srivas +#include "../L2MuonCB1FillerTool.h" // Srivas +#include "../L2MuonCB2FillerTool.h" // Srivas +#include "../EFMuonFillerTool.h" // Srivas +#include "../MuonGenParticleAssociationTool.h" +#include "../EFInfoMuonKinematicsFiller.h" // Srivas +#include "../MuonSegmentAuthorFillerTool.h" // Srivas +#include "../MuonSegmentLocationFillerTool.h" // Srivas +#include "../MuonSegmentFitQualityFillerTool.h" // Srivas +#include "../MuonSegmentT0FillerTool.h" // Srivas, Verena +#include "../TruthMuonsToSG.h" // Srivas +#include "../MuonTruthClassificationFillerTool.h" // Max +//#include "../MuonIDIsolTool.h" // Lashkar +#include "../MuonSpShowerFillerTool.h" // Michiru, Haifeng +#include "../MdtPrepDataFillerTool.h" // David +#include "../RpcPrepDataFillerTool.h" // David +#include "../TgcPrepDataFillerTool.h" // David +#include "../CscPrepDataFillerTool.h" // David +#include "../MdtPrepDataCollectionGetterTool.h" // David +#include "../RpcPrepDataCollectionGetterTool.h" // David +#include "../TgcPrepDataCollectionGetterTool.h" // David +#include "../CscPrepDataCollectionGetterTool.h" // David +#include "../MuonPatternCombinationFillerTool.h" // Daniel +#include "../MuonPatternCombinationMissedHitFillerTool.h" // Daniel +#include "../MuonSegmentTruthFillerTool.h" // Daniel + +#include "../MDTSimHitFillerTool.h" +#include "../TrackRecordFillerTool.h" +#include "../MuonTruthHitsFillerTool.h" + +#include "GaudiKernel/DeclareFactoryEntries.h" + +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, MuonTrkHitFillerTool) // Serhan +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, MuonNumberOfSegmentsFillerTool) +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, MuonTrackParticleAssociationTool) +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, MuonL1TriggerObjectAssociationTool) // Srivas +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, MuonL2TriggerObjectAssociationTool) // Srivas +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, MuonEFTriggerObjectAssociationTool) // Srivas +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, MuonEFInfoTriggerObjectAssociationTool) // Srivas +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, L2MuonCB1FillerTool) // Srivas +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, L2MuonCB2FillerTool) // Srivas +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, EFMuonFillerTool) // Srivas +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, MuonGenParticleAssociationTool) +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, EFInfoMuonKinematicsFiller) // Srivas +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, MuonSegmentAuthorFillerTool) // Srivas +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, MuonSegmentLocationFillerTool) // Srivas +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, MuonSegmentFitQualityFillerTool) // Srivas +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, MuonSegmentT0FillerTool) // Srivas, Verena +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, MuonTruthClassificationFillerTool) // Max +DECLARE_NAMESPACE_ALGORITHM_FACTORY (D3PD, TruthMuonsToSG) // Srivas +// DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, MuonIDIsolTool) // Lashkar +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, MuonSpShowerFillerTool) // Michiru, Haifeng +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, MdtPrepDataFillerTool) // David +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, RpcPrepDataFillerTool) // David +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, TgcPrepDataFillerTool) // David +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, CscPrepDataFillerTool) // David +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, MdtPrepDataCollectionGetterTool) // David +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, RpcPrepDataCollectionGetterTool) // David +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, TgcPrepDataCollectionGetterTool) // David +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, CscPrepDataCollectionGetterTool) // David +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, MuonPatternCombinationFillerTool) // Daniel +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, MuonPatternCombinationMissedHitFillerTool) // Daniel +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, MuonSegmentTruthFillerTool) // Daniel + +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, MDTSimHitFillerTool) +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, TrackRecordFillerTool) +DECLARE_NAMESPACE_TOOL_FACTORY (D3PD, MuonTruthHitsFillerTool) + +DECLARE_FACTORY_ENTRIES(MuonD3PDMaker) { + DECLARE_NAMESPACE_TOOL (D3PD, MuonTrkParameterFillerTool) //Serhan + DECLARE_NAMESPACE_TOOL (D3PD, MuonTrkHitFillerTool) //Serhan + DECLARE_NAMESPACE_TOOL (D3PD, MuonNumberOfSegmentsFillerTool) + DECLARE_NAMESPACE_TOOL (D3PD, MuonTrackParticleAssociationTool) + DECLARE_NAMESPACE_TOOL (D3PD, MuonL1TriggerObjectAssociationTool) // Srivas + DECLARE_NAMESPACE_TOOL (D3PD, MuonL2TriggerObjectAssociationTool) // Srivas + DECLARE_NAMESPACE_TOOL (D3PD, MuonEFTriggerObjectAssociationTool) // Srivas + DECLARE_NAMESPACE_TOOL (D3PD, MuonEFInfoTriggerObjectAssociationTool) // Srivas + DECLARE_NAMESPACE_TOOL (D3PD, L2MuonCB1FillerTool) // Srivas + DECLARE_NAMESPACE_TOOL (D3PD, L2MuonCB2FillerTool) // Srivas + DECLARE_NAMESPACE_TOOL (D3PD, EFMuonFillerTool) // Srivas + DECLARE_NAMESPACE_TOOL (D3PD, MuonGenParticleAssociationTool) + DECLARE_NAMESPACE_TOOL (D3PD, EFInfoMuonKinematicsFiller) // Srivas + DECLARE_NAMESPACE_TOOL (D3PD, MuonSegmentAuthorFillerTool) // Srivas + DECLARE_NAMESPACE_TOOL (D3PD, MuonSegmentLocationFillerTool) // Srivas + DECLARE_NAMESPACE_TOOL (D3PD, MuonSegmentFitQualityFillerTool) // Srivas + DECLARE_NAMESPACE_TOOL (D3PD, MuonSegmentT0FillerTool) // Srivas, Verena + DECLARE_NAMESPACE_TOOL (D3PD, MuonTruthClassificationFillerTool) // Max + DECLARE_NAMESPACE_ALGORITHM (D3PD, TruthMuonsToSG) // Srivas + // DECLARE_NAMESPACE_TOOL (D3PD, MuonIDIsolTool) // Lashkar + DECLARE_NAMESPACE_TOOL (D3PD, MuonSpShowerFillerTool) // Michiru, Haifeng + DECLARE_NAMESPACE_TOOL (D3PD, MdtPrepDataFillerTool) // David + DECLARE_NAMESPACE_TOOL (D3PD, RpcPrepDataFillerTool) // David + DECLARE_NAMESPACE_TOOL (D3PD, TgcPrepDataFillerTool) // David + DECLARE_NAMESPACE_TOOL (D3PD, CscPrepDataFillerTool) // David + DECLARE_NAMESPACE_TOOL (D3PD, MdtPrepDataCollectionGetterTool) // David + DECLARE_NAMESPACE_TOOL (D3PD, RpcPrepDataCollectionGetterTool) // David + DECLARE_NAMESPACE_TOOL (D3PD, TgcPrepDataCollectionGetterTool) // David + DECLARE_NAMESPACE_TOOL (D3PD, CscPrepDataCollectionGetterTool) // David + DECLARE_NAMESPACE_TOOL (D3PD, MuonPatternCombinationFillerTool) // Daniel + DECLARE_NAMESPACE_TOOL (D3PD, MuonPatternCombinationMissedHitFillerTool) // Daniel + DECLARE_NAMESPACE_TOOL (D3PD, MuonSegmentTruthFillerTool) // Daniel + + DECLARE_NAMESPACE_TOOL (D3PD, MDTSimHitFillerTool) + DECLARE_NAMESPACE_TOOL (D3PD, TrackRecordFillerTool) + DECLARE_NAMESPACE_TOOL (D3PD, MuonTruthHitsFillerTool) +} diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/components/MuonD3PDMaker_load.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/components/MuonD3PDMaker_load.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d1f5dde663e146f1da471f91208da097cb0ed963 --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/components/MuonD3PDMaker_load.cxx @@ -0,0 +1,13 @@ +// $Id$ +/** + * @file MuonD3PDMaker/src/components/MuonD3PDMaker_entries.cxx + * @author scott snyder <snyder@bnl.gov> + * @date Aug, 2009 + * @brief Gaudi boilerplate. + */ + + +#include "GaudiKernel/LoadFactoryEntries.h" + +LOAD_FACTORY_ENTRIES(MuonD3PDMaker) + diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/muonInheritance.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/muonInheritance.cxx new file mode 100644 index 0000000000000000000000000000000000000000..cafc4bd8980208175349f9b5a9a3ff17d836e22b --- /dev/null +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/muonInheritance.cxx @@ -0,0 +1,25 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id$ +/** + * @file MuonD3PDMaker/src/muonInheritance.cxx + * @author scott snyder <snyder@bnl.gov> + * @date Feb, 2010 + * @brief Declare inheritance relationships for muon classes. + * + * Eventually, these should be moved to the EDM classes. + */ + +#include "muonEvent/MuonSpShowerContainer.h" +#include "TrigMuonEvent/TrigMuonEF.h" +#include "TrigMuonEvent/CombinedMuonFeature.h" +#include "AnalysisTriggerEvent/Muon_ROI.h" +#include "EventKernel/INavigable4Momentum.h" +#include "SGTools/BaseInfo.h" + +SG_ADD_BASE (TrigMuonEF, SG_VIRTUAL(INavigable4Momentum)); +SG_ADD_BASE (CombinedMuonFeature, SG_VIRTUAL(INavigable4Momentum)); +SG_ADD_BASE (Muon_ROI, SG_VIRTUAL(INavigable4Momentum)); +SG_ADD_BASE (Rec::MuonSpShowerContainer, DataVector<Rec::MuonSpShower>);