diff --git a/Projects/Athena/package_filters.txt b/Projects/Athena/package_filters.txt index 404fd74062304a143c5c9ce22c890a2e432ce38f..63ad8949dab0f70e8d1077c0bc7a01786bc685da 100644 --- a/Projects/Athena/package_filters.txt +++ b/Projects/Athena/package_filters.txt @@ -59,11 +59,6 @@ - Tracking/TrkTools/TrkSegmentConverter - Trigger/TrigAlgorithms/TrigEFLongLivedParticles -# obsolete JPsi monitoring packages that may be removed in the future -- Trigger/TrigTools/TrigJPsiTools -- Trigger/TrigMonitoring/TrigIDJpsiMonitoring -- Trigger/TrigAnalysis/TrigEffJpsiTools - # Huge D3PD librarys not really useful any more - PhysicsAnalysis/D3PDMaker/InDetD3PDMaker - PhysicsAnalysis/D3PDMaker/CaloSysD3PDMaker diff --git a/Trigger/TrigAnalysis/TrigEffJpsiTools/CMakeLists.txt b/Trigger/TrigAnalysis/TrigEffJpsiTools/CMakeLists.txt deleted file mode 100644 index ccb3504e9ad21ff25ce3e6030aecfc9eda1578d6..0000000000000000000000000000000000000000 --- a/Trigger/TrigAnalysis/TrigEffJpsiTools/CMakeLists.txt +++ /dev/null @@ -1,56 +0,0 @@ -################################################################################ -# Package: TrigEffJpsiTools -################################################################################ - -# Declare the package name: -atlas_subdir( TrigEffJpsiTools ) - -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - DetectorDescription/GeoPrimitives - GaudiKernel - PRIVATE - Control/AthenaBaseComps - Control/AthenaKernel - Control/StoreGate - Event/EventInfo - Event/EventKernel - MuonSpectrometer/MuonCablings/RPCcablingInterface - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry - MuonSpectrometer/MuonIdHelpers - PhysicsAnalysis/AnalysisTrigger/AnalysisTriggerEvent - Reconstruction/MuonIdentification/muonEvent - Reconstruction/Particle - Tracking/TrkDetDescr/TrkSurfaces - Tracking/TrkEvent/TrkEventUtils - Tracking/TrkEvent/TrkParameters - Tracking/TrkEvent/TrkRIO_OnTrack - Tracking/TrkEvent/TrkTrack - Tracking/TrkExtrapolation/TrkExInterfaces - Trigger/TrigAnalysis/TrigDecisionTool - Trigger/TrigAnalysis/TrigInDetAnalysis - Trigger/TrigAnalysis/TrigInDetAnalysisUtils - Trigger/TrigConfiguration/TrigConfL1Data - Trigger/TrigEvent/TrigMuonEvent - Trigger/TrigEvent/TrigParticle - Trigger/TrigEvent/TrigSteeringEvent - Trigger/TrigT1/TrigT1Interfaces - Trigger/TrigT1/TrigT1RPCRecRoiSvc - Trigger/TrigT1/TrigT1Result - Trigger/TrigT1/TrigT1TGCRecRoiSvc ) - -# External dependencies: -find_package( Eigen ) -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint ) - -# Component(s) in the package: -atlas_add_component( TrigEffJpsiTools - src/*.cxx - src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} GeoPrimitives GaudiKernel AthenaBaseComps AthenaKernel StoreGateLib SGtests EventInfo EventKernel RPCcablingInterfaceLib MuonReadoutGeometry MuonIdHelpersLib AnalysisTriggerEvent muonEvent Particle TrkSurfaces TrkEventUtils TrkParameters TrkRIO_OnTrack TrkTrack TrkExInterfaces TrigDecisionToolLib TrigInDetAnalysis TrigInDetAnalysisUtils TrigConfL1Data TrigMuonEvent TrigParticle TrigSteeringEvent TrigT1Interfaces TrigT1RPCRecRoiSvcLib TrigT1Result TrigT1TGCRecRoiSvcLib ) - -# Install files from the package: -atlas_install_headers( TrigEffJpsiTools ) -atlas_install_joboptions( share/*.py ) - diff --git a/Trigger/TrigAnalysis/TrigEffJpsiTools/TrigEffJpsiTools/ITrigEffJpsiTools.h b/Trigger/TrigAnalysis/TrigEffJpsiTools/TrigEffJpsiTools/ITrigEffJpsiTools.h deleted file mode 100644 index e6df12cf98a246ae81a7f22bed02d2bb5a4ddb33..0000000000000000000000000000000000000000 --- a/Trigger/TrigAnalysis/TrigEffJpsiTools/TrigEffJpsiTools/ITrigEffJpsiTools.h +++ /dev/null @@ -1,312 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ITRIGEFFJPSITOOLS_H -#define ITRIGEFFJPSITOOLS_H -/** - * @author Hironori Kiyamura - * @author Takashi Matsushita - * @date $Date: 2013-11-11 01:34:19 +0100 (Mon, 11 Nov 2013) $ - * @version $Revision: 569614 $ - */ - -/** @todo */ -/** @warnings */ - - -/*--------------------------------------------------------------------* - * headers - *--------------------------------------------------------------------*/ -#include "GaudiKernel/IAlgTool.h" -#include "GeoPrimitives/GeoPrimitives.h" - -class INavigable4Momentum; -namespace Rec { class TrackParticle; } -namespace Trk { class Track; } -namespace Trk { class RIO_OnTrack; } -namespace Trk { class TrackStateOnSurface; } - -static const InterfaceID IID_ITrigEffJpsiTools("ITrigEffJpsiTools", 1, 0); - - -/*--------------------------------------------------------------------* - * classes - *--------------------------------------------------------------------*/ -class ITrigEffJpsiTools : virtual public IAlgTool -{ - public: - enum TrackType { COMBINED=0, SPECTROMETER=1, EXTRAPOLATED=2, IDONLY=3, UNDEFINED=99 }; - enum TargetDetector { UNDEF, TGC, RPC }; - struct TrigObject { - std::vector<std::string> names; - double eta; - double phi; - double pt; - int q; - int64_t id; - int64_t parentId; - int64_t grandparentId; - std::vector<int64_t> daughterIds; - std::vector<int> combIds; - std::vector<int> efObjIds; - int type; // combined, spectrometer, extrapolated track - }; - typedef std::map<int64_t, TrigObject> TrigObjectMap; - typedef std::pair<int64_t, TrigObject> TrigObjectPair; - - static const InterfaceID& interfaceID() { return IID_ITrigEffJpsiTools; }; - - /** checks if track has passed given trigger chain - * - * @param track[in] Rec::TrackParticle to be tested - * @param chainName[in] name of trigger chain - * @return true if the given track has passed the trigger chain - */ - virtual bool isTriggeredMuonEF(const Rec::TrackParticle* track, - const std::string& chainName) const = 0; - - /** checks if track has passed given trigger chain - * - * @param track[in] Rec::TrackParticle to be tested - * @param chainName[in] name of trigger chain - * @return true if the given track has passed the trigger chain - */ - virtual bool isTriggeredMuonL2(const Rec::TrackParticle* track, - const std::string& chainName) const = 0; - - /** checks if track has passed given trigger chain - * - * @param track[in] Rec::TrackParticle to be tested - * @param chainName[in] name of trigger chain - * @return true if the given track has passed the trigger chain - */ - virtual bool isTriggeredMuonL1(const Rec::TrackParticle* track, - const std::string& chainName) const = 0; - - /** checks if track has matching muon RoI with the given threshold or not - * - * @param track[in] Rec::TrackParticle to be tested - * @param thresholdNumber[in] logic number of the muon level1 threshold to be passed - * @return true if the given track has corresponding muon RoI, false otherwise - */ - virtual bool isTriggeredMuon(const Rec::TrackParticle* track, - int thresholdNumber) const = 0; - - /** checks if a track pair is a J/psi candidate or not - * - * @param track1[in] Rec::TrackParticle to be tested - * @param track2[in] Rec::TrackParticle to be tested - * @return true if the given track pair is a J/psi candidate, false otherwise - */ - virtual bool isJPsiCandidate(const Rec::TrackParticle* track1, - const Rec::TrackParticle* track2) const = 0; - - /** checks if a 4-vector pair is a Jpsi candidate or not - * - * @param mom1[in] INavigable4Momentum to be tested - * @param mom2[in] INavigable4Momentum to be tested - */ - virtual bool isJPsiCandidate(const INavigable4Momentum* mom1, - const INavigable4Momentum* mom2) const = 0; - - /** searches level1 muon RoI associating with the given track - * - * @param track[in] Rec::TrackParticle to be tested - * @param barrel[out] returns true if the track passes barrel pivot plane - * @param endcap[out] returns true if the track passes endcap pivot plane - * @param eta[out] if not null, returns extrapolated position and error in eta (if the track passes both barrel/endcap pivot planes without matching roi, barrel information is stored) - * @param phi[out] if not null, returns extrapolated position and error in phi (if the track passes both barrel/endcap pivot planes without matching roi, barrel information is stored) - * @return index to muon_type (std::vector<Muon_ROI>), -1 when there is no association - */ - virtual int getMatchedRoI(const Rec::TrackParticle* track, - bool* barrel = 0, - bool* endcap = 0, - Amg::Vector2D* eta = 0, - Amg::Vector2D* phi = 0) const = 0; - - /** calculates size of the givin RoI - * - * @param roiWord[in] roiWord to be examined - * @param etaSize[out] roiSize in eta - * @param phiSize[out] roiSize in phi - * @return StatusCode - */ - virtual StatusCode getRoiSize(const unsigned int roiWord, - double* etaSize, - double* phiSize) const = 0; - - /** get array of reconstruction input objects (rio) on track - * - * @param track[in] reference track - * @param rots[in] array of rio on the reference track - * @param pivotOnly[in] if true, get rio on pivot plane only - * @return StatusCode - */ - virtual StatusCode getRioOnTriggerChamber(const Trk::Track* track, - std::vector<const Trk::RIO_OnTrack*>& rots, - bool pivotOnly=true) const = 0; - - /** extrapolate an input track to given rio - * - * @param track[in] track to be extrapolated - * @param rot[in] target rio - * @param eta[out] eta and its error of extrapolated position - * @param phi[out] phi and its error of extrapolated position - * @param ptpz[out] pt and pz of the extrapolated track - * @param getTsos[in] set true when you need tsos output - * @param tsos[out] array of TrackStateOnSurface along extrapolation - * @return true for successful extrapolation, false otherwise - */ - virtual bool extrapolateToRio(const Rec::TrackParticle* track, - const Trk::RIO_OnTrack* rot, - Amg::Vector2D* eta, - Amg::Vector2D* phi, - Amg::Vector2D* ptpz, - bool getTsos, - const std::vector<const Trk::TrackStateOnSurface*>* &tsos) const = 0; - - /** extrapolate an input track to given point - * - * @param track[in] track to be extrapolated - * @param pos[in] target position - * @param detector[in] target detector - * @param eta[out] eta and its error of extrapolated position - * @param phi[out] phi and its error of extrapolated position - * @param mom[out] momentum of the extrapolated track - * @return true for successful extrapolation, false otherwise - */ - virtual bool extrapolateToPoint(const Rec::TrackParticle* track, - const Amg::Vector3D* pos, - const int detector, - Amg::Vector2D* eta, - Amg::Vector2D* phi, - Amg::Vector3D* mom) const = 0; - - /** get all trigger objects of a given chain and its parents - * - * @param chain[in] name of the trigger chain - * @param muonsEF[out] pointer to the TrigObjectMap to be filled by EF trigger objects - * @param muonsL2[out] pointer to the TrigObjectMap to be filled by L2 trigger objects - * @param muonsL1[out] pointer to the TrigObjectMap to be filled by EF trigger objects - * @return true for successful retrival, false otherwise - */ - virtual bool getTriggerObjects(const std::string& chain, - TrigObjectMap* muonsEF = NULL, - TrigObjectMap* muonsL2 = NULL, - TrigObjectMap* muonsL1 = NULL) const = 0; - - /** get L1 trigger objects of a given chain - * - * @param chain[in] name of the trigger chain - * @param muonsL1[out] pointer to the TrigObjectMap to be filled by EF trigger objects - * @return true for successful retrival, false otherwise - */ - virtual bool getL1TriggerObjects(const std::string& chain, - TrigObjectMap* muonsL1 = NULL) const = 0; - - /** get L2 trigger objects of a given chain and its parents - * - * @param chain[in] name of the trigger chain - * @param muonsL2[out] pointer to the TrigObjectMap to be filled by L2 trigger objects - * @param muonsL1[out] pointer to the TrigObjectMap to be filled by EF trigger objects - * @return true for successful retrival, false otherwise - */ - virtual bool getL2TriggerObjects(const std::string& chain, - TrigObjectMap* muonsL2 = NULL, - TrigObjectMap* muonsL1 = NULL) const = 0; - - /** get EF trigger objects of a given chain and its parents - * - * @param chain[in] name of the trigger chain - * @param muonsEF[out] pointer to the TrigObjectMap to be filled by EF trigger objects - * @param muonsL2[out] pointer to the TrigObjectMap to be filled by L2 trigger objects - * @param muonsL1[out] pointer to the TrigObjectMap to be filled by EF trigger objects - * @return true for successful retrival, false otherwise - */ - virtual bool getEFTriggerObjects(const std::string& chain, - TrigObjectMap* muonsEF = NULL, - TrigObjectMap* muonsL2 = NULL, - TrigObjectMap* muonsL1 = NULL) const = 0; - - /** get EF trigger objects of a given chain and its parents - * - * @param chain[in] name of the trigger chain - * @param muonsEF[out] pointer to the TrigObjectMap to be filled by EF trigger objects - * @param muonsL2[out] pointer to the TrigObjectMap to be filled by L2 trigger objects - * @param muonsL1[out] pointer to the TrigObjectMap to be filled by EF trigger objects - * @return true for successful retrival, false otherwise - */ - virtual bool getEFAllTriggerObjects(const std::string& chain, - TrigObjectMap* muonsEF = NULL, - TrigObjectMap* muonsL2 = NULL, - TrigObjectMap* muonsL1 = NULL) const = 0; - - /** get EF trigger objects of a given chain and its parents - * - * @param chain[in] name of the trigger chain - * @param muonsEF[out] pointer to the TrigObjectMap to be filled by EF trigger objects - * @param muonsL2[out] pointer to the TrigObjectMap to be filled by L2 trigger objects - * @param muonsL1[out] pointer to the TrigObjectMap to be filled by EF trigger objects - * @return true for successful retrival, false otherwise - */ - virtual bool getEFIDTriggerObjects(const std::string& chain, - TrigObjectMap* muonsEF = NULL, - TrigObjectMap* muonsL2 = NULL, - TrigObjectMap* muonsL1 = NULL) const = 0; - - virtual bool getEFMSTriggerObjects(const std::string& chain, - TrigObjectMap* muonsEF = NULL, - TrigObjectMap* muonsL2 = NULL, - TrigObjectMap* muonsL1 = NULL) const = 0; - - - /** get BPhysics L2 trigger objects of a given chain and its parents - * - * @param chain[in] name of the trigger chain - * @param muonsL2[out] pointer to the TrigObjectMap to be filled by L2 trigger objects - * @param muonsL1[out] pointer to the TrigObjectMap to be filled by EF trigger objects - * @return true for successful retrival, false otherwise - */ - virtual bool getBPhysL2TriggerObjects(const std::string& chain, - TrigObjectMap* muonsL2 = NULL, - TrigObjectMap* muonsL1 = NULL) const = 0; - - /** get BPhysics EF trigger objects of a given chain and its parents - * - * @param chain[in] name of the trigger chain - * @param muonsEF[out] pointer to the TrigObjectMap to be filled by EF trigger objects - * @param muonsL2[out] pointer to the TrigObjectMap to be filled by L2 trigger objects - * @param muonsL1[out] pointer to the TrigObjectMap to be filled by EF trigger objects - * @return true for successful retrival, false otherwise - */ - virtual bool getBPhysEFTriggerObjects(const std::string& chain, - TrigObjectMap* muonsEF = NULL, - TrigObjectMap* muonsL2 = NULL, - TrigObjectMap* muonsL1 = NULL) const = 0; - - /** get bunch crossing ID difference between 7-bit bcid and the event - * - * @param roiBcid[in] 7-bit bcid of muon RoI - */ - virtual int muctpiBcidDiff(const int roiBcid) const = 0; - - /** get bunch crossing ID difference between given roi and the event - * - * @param roiWord[in] roiWord - */ - virtual int getMuonRoiBcidDiff(const uint32_t roiWord) const = 0; - - - /** checks if the event is triggered by EF_mu0_missingRoi or L1_2MU0 with TGC only trigger - * - * @param roiWord[in] roiWord - */ - virtual bool isOffTimeTgcTrigger() const = 0; - - /** emulates EF_mu4_MSOnly trigger with EF_mu0_outOfTime1 - * - */ - virtual bool EF_mu4_MSOnly_from_EF_mu0_outOfTime1() const = 0; -}; -#endif diff --git a/Trigger/TrigAnalysis/TrigEffJpsiTools/share/configureServices.py b/Trigger/TrigAnalysis/TrigEffJpsiTools/share/configureServices.py deleted file mode 100644 index 0c3e300a110349b5bd598ec08d7a4ce2b8ebfb06..0000000000000000000000000000000000000000 --- a/Trigger/TrigAnalysis/TrigEffJpsiTools/share/configureServices.py +++ /dev/null @@ -1,23 +0,0 @@ -### -### extrapolator -### -include("TrkDetDescrSvc/AtlasTrackingGeometrySvc.py") -from TrkExTools.AtlasExtrapolator import AtlasExtrapolator -theAtlasExtrapolator = AtlasExtrapolator() -ToolSvc += theAtlasExtrapolator - - -### -### TrigEffJpsiTools -### -from TrigEffJpsiTools.TrigEffJpsiToolsConf import TrigEffJpsiTools -theTrigEffJpsiTools = TrigEffJpsiTools("TrigEffJpsiTools") - -# barrel and endcap enlarged. -# not to lose curly tracks escaping through barrel/end-cap transition regions -theTrigEffJpsiTools.EndcapPivotPlaneMaximumRadius = 20000. -theTrigEffJpsiTools.BarrelPivotPlaneHalfLength = 16000. - -ToolSvc += theTrigEffJpsiTools - -# eof diff --git a/Trigger/TrigAnalysis/TrigEffJpsiTools/src/MuonRoiWithExtendedBunches.cxx b/Trigger/TrigAnalysis/TrigEffJpsiTools/src/MuonRoiWithExtendedBunches.cxx deleted file mode 100644 index 6bcb652315066afbfbf10324b23515f5ae4904db..0000000000000000000000000000000000000000 --- a/Trigger/TrigAnalysis/TrigEffJpsiTools/src/MuonRoiWithExtendedBunches.cxx +++ /dev/null @@ -1,284 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** - * @date $Date: 2010-09-30 22:13:27 +0200 (Thu, 30 Sep 2010) $ - * @version $Revision: 324593 $ - */ - -/** @todo */ -/** @warning */ - -/*--------------------------------------------------------------------* - * headers - *--------------------------------------------------------------------*/ -#include "AthenaKernel/errorcheck.h" -#include "StoreGate/StoreGate.h" - -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" - -#include "TrigT1Result/MuCTPI_RDO.h" -#include "TrigT1Result/MuCTPIResult.h" -#include "TrigT1Result/MuCTPIRoI.h" -#include "TrigT1Result/MuCTPI_DataWord_Decoder.h" -#include "TrigT1Result/MuCTPI_MultiplicityWord_Decoder.h" -#include "TrigT1Result/RoIBResult.h" - -#include "TrigT1Interfaces/RecMuonRoI.h" -#include "TrigT1Interfaces/RecMuonRoiSvc.h" - -#include "TrigConfL1Data/TriggerThreshold.h" - -#include "AnalysisTriggerEvent/LVL1_ROI.h" - -#include "MuonRoiWithExtendedBunches.h" - - -namespace MuComm { - -/*--------------------------------------------------------------------* - * constructor & destructor - *--------------------------------------------------------------------*/ -MuonRoiWithExtendedBunches::MuonRoiWithExtendedBunches(const std::string& name, - ISvcLocator* pSvcLocator) - : AthAlgorithm(name, pSvcLocator), - m_muctpiInput("MUCTPI_RDO"), // StoreGate key for MuCTPI_RDO - m_roibInput("RoIBResult"), // StoreGate key for ROIB::RoIBResult - m_extendedMuonRoi("ExtendedMuonRoi"), // StoreGate key for LVL1_ROI with extneded BCs - m_allowedBcArray(), // a list of bunch-offset wrt to the current BCID - m_allowedBcSet(), - m_l1PtNames(), // a list of level1 muon trigger item names - m_l1PtValues(), // a list of level1 muon trigger item pt values in MeV - m_recRpcRoiSvc(LVL1::ID_RecRpcRoiSvc, name), - m_recTgcRoiSvc(LVL1::ID_RecTgcRoiSvc, name) -{ - declareProperty("MuCTPIInput", m_muctpiInput); - declareProperty("RoIBInput", m_roibInput); - declareProperty("Lvl1_RoiName", m_extendedMuonRoi); - declareProperty("AllowedBCs", m_allowedBcArray); - declareProperty("L1PtNames", m_l1PtNames); - declareProperty("L1PtValues", m_l1PtValues); -} - - -/*--------------------------------------------------------------------* - * public methods - *--------------------------------------------------------------------*/ -StatusCode -MuonRoiWithExtendedBunches::initialize() -{ - if ((m_l1PtNames.size() != NUM_THRESHOLDS) or - (m_l1PtValues.size() != NUM_THRESHOLDS)) { - ATH_MSG_ERROR("MuonRoiWithExtendedBunches::initialize(): " - "setup failure: L1PtNames or L1PtValues" - << m_l1PtNames << " : " << m_l1PtValues); - return StatusCode::FAILURE; - } - - m_allowedBcSet.clear(); - for (size_t ii = 0; ii < m_allowedBcArray.size(); ii++) { - m_allowedBcSet.insert(m_allowedBcArray.at(ii)); - ATH_MSG_INFO("MuonRoiWithExtendedBunches::initialize(): " - "adding bc diff = " << m_allowedBcArray.at(ii)); - } - - // Get the RPC RecRoI service - CHECK(m_recRpcRoiSvc.retrieve()); - ATH_MSG_VERBOSE(LVL1::ID_RecRpcRoiSvc << " retrieved"); - - // Get the TGC RecRoI service - CHECK(m_recTgcRoiSvc.retrieve()); - ATH_MSG_VERBOSE(LVL1::ID_RecTgcRoiSvc << " retrieved"); - - return StatusCode::SUCCESS; -} - - -StatusCode -MuonRoiWithExtendedBunches::execute() -{ - ATH_MSG_DEBUG("MuonRoiWithExtendedBunches::execute()"); - - ROIB::RoIBResult* roibResult = getExtendedRoIBResult(); - if (roibResult == 0) { - ATH_MSG_FATAL("MuonRoiWithExtendedBunches: getExtendedRoiBResult() "); - return StatusCode::FAILURE; - } - - LVL1_ROI* rois = new LVL1_ROI(); - CHECK(evtStore()->record(rois, m_extendedMuonRoi)); - ATH_MSG_VERBOSE("recorded LVL1_ROI with key " << m_extendedMuonRoi); - - std::vector<TrigConf::TriggerThreshold*> dummy; - const std::vector<ROIB::MuCTPIRoI>& muctpiRois = roibResult->muCTPIResult().roIVec(); - std::vector<ROIB::MuCTPIRoI>::const_iterator cit = muctpiRois.begin(); - std::vector<ROIB::MuCTPIRoI>::const_iterator end = muctpiRois.end(); - ATH_MSG_VERBOSE("found " << muctpiRois.size() << " muctpiRois"); - for (; cit != end; cit++) { - int thresholdNumber = cit->pt(); - if (thresholdNumber < 1 or thresholdNumber > 6) { - ATH_MSG_FATAL("MuonRoiWithExtendedBunches: execute: " - "unexpected threshold number: " << thresholdNumber); - return StatusCode::FAILURE; - } - - uint32_t roiWord = cit->roIWord(); - LVL1::RecMuonRoI recRoi(roiWord, - m_recRpcRoiSvc.operator->(), - m_recTgcRoiSvc.operator->(), - &dummy); - - Muon_ROI roi(roiWord, recRoi.eta(), recRoi.phi(), - m_l1PtNames.at(thresholdNumber-1), - m_l1PtValues.at(thresholdNumber-1)); - - rois->addMuonROI(roi); - } - ATH_MSG_VERBOSE("found " << rois->getMuonROIs().size() << " muon rois"); - - CHECK(evtStore()->setConst(rois)); - ATH_MSG_VERBOSE("set const for LVL1_ROI with key " << m_extendedMuonRoi); - - delete roibResult; - - return StatusCode::SUCCESS; -} - - -/*--------------------------------------------------------------------* - * private methods - *--------------------------------------------------------------------*/ -ROIB::RoIBResult* -MuonRoiWithExtendedBunches::getExtendedRoIBResult() -{ - ATH_MSG_DEBUG("MuonRoiWithExtendedBunches::getExtendedRoIBResult()"); - - const EventInfo* eventInfo = 0; - if (StoreGate::pointer()->retrieve(eventInfo).isFailure()) { - ATH_MSG_WARNING("MuonRoiWithExtendedBunches: couldn't retrieve EventInfo"); - return 0; - } - const EventID* eventId = eventInfo->event_ID(); - const unsigned int eventBcid = eventId->bunch_crossing_id(); - - // Create the RoI vector from the RDO data: - const MuCTPI_RDO* muctpi_rdo = 0; - if (evtStore()->retrieve(muctpi_rdo, m_muctpiInput).isFailure()) { - ATH_MSG_WARNING("MuonRoiWithExtendedBunches: couldn't retrieve " - << m_muctpiInput); - return 0; - } - ATH_MSG_VERBOSE("Retrieved the MuCTPI_RDO object with key: " - << m_muctpiInput ); - - ATH_MSG_VERBOSE("Now creating the RoIs in extended bunches..."); - std::vector<ROIB::MuCTPIRoI> roi_vector; - MuCTPI_MultiplicityWord_Decoder mwDecoder(muctpi_rdo->candidateMultiplicity()); - uint32_t currentBcid = mwDecoder.getBCID(); - if (currentBcid != (eventBcid & 0x7)) { - ATH_MSG_WARNING("MuonRoiWithExtendedBunches: BCID mis-match: " << eventBcid << ":" << currentBcid - << " at " << eventId->run_number() << " " << eventId->event_number() << " " - << eventId->lumi_block() << " " << eventId->time_stamp() << " " << eventId->time_stamp_ns_offset()); - currentBcid = (eventBcid & 0x7); - } - - // Loop over all "data words" and select the ones in streatched time window - ATH_MSG_VERBOSE("found " << muctpi_rdo->dataWord().size() << " muctpi_rdo dataWords"); - - std::vector<uint32_t>::const_iterator cit = muctpi_rdo->dataWord().begin(); - std::vector<uint32_t>::const_iterator end = muctpi_rdo->dataWord().end(); - for(; cit != end; ++cit) { - MuCTPI_DataWord_Decoder dwDecoder(*cit); - - uint32_t bcid = dwDecoder.getBCID(); - int bcDiff = bcid - currentBcid; - switch (eventBcid) { - case 0: // cannot distinguish 3563 and 3, 3562 and 2, 3561 and 1 - if (bcid == 3) { - bcDiff = -1; - } else if (bcid == 2) { - bcDiff = -2; - } else if (bcid == 1) { - bcDiff = -3; - } - break; - - case 1: // cannot distinguish 3563 and 3, 3562 and 2 - if (bcid == 3) { - bcDiff = -2; - } else if (bcid == 2) { - bcDiff = -3; - } - break; - - case 2: // cannot distinguish 3563 and 3 - if (bcid == 3) { - bcDiff = -3; - } - break; - - default: - break; - } - - if (abs(bcDiff) > 4) { - bcDiff = (8 - abs(bcDiff)) * ((bcDiff < 0) ? 1 : -1); - } - - ATH_MSG_DEBUG(std::dec << bcid << " : " << currentBcid); - ATH_MSG_DEBUG("bcid diff = " << std::dec << bcDiff << - " loc = " << dwDecoder.getSectorLocation()); - - if (dwDecoder.getSectorLocation() == MuCTPI_RDO::BARREL) { // BARREL - ATH_MSG_VERBOSE("bcid diff in BARREL"); - } else { // ENDCAP - ATH_MSG_VERBOSE("bcid diff in ENDCAP"); - } - if (m_allowedBcSet.find(bcDiff) == m_allowedBcSet.end()) continue; - - ATH_MSG_DEBUG("accepted"); - roi_vector.push_back(ROIB::MuCTPIRoI(RDOtoRoI(*cit))); - ATH_MSG_VERBOSE( " - Processed data word: 0x" << std::hex << std::setw(8) - << std::setfill('0') << *cit ); - } - - - // Create the new MuCTPI result: - const ROIB::RoIBResult* roibResult = 0; - if (evtStore()->retrieve(roibResult, m_roibInput).isFailure()) { - ATH_MSG_WARNING("MuonRoiWithExtendedBunches: couldn't retrieve " - << m_roibInput); - return 0; - } - ATH_MSG_VERBOSE("Retrieved the old RoIBResult object with key:" - << m_roibInput); - - ROIB::MuCTPIResult newResult(roibResult->muCTPIResult().header(), - roibResult->muCTPIResult().trailer(), - roi_vector); - - // Create the new RoIBResult object: - return new ROIB::RoIBResult(newResult, - roibResult->cTPResult(), - roibResult->jetEnergyResult(), - roibResult->eMTauResult()); -} - - -/** - * @param data_word Data word from the MuCTPI_RDO object - * @returns The RoI word created from the data word - */ -uint32_t -MuonRoiWithExtendedBunches::RDOtoRoI(uint32_t data_word) -{ - // MuCTPI_RDO to MuCTPIRoI - // ref: Fig 3.6 and Fig 3.8 in https://edms.cern.ch/file/248757/1/mirod.pdf - return (((data_word & 0x8000000) >> 4) | ((data_word & 0x3fe0000) >> 3) | - (data_word & 0x3fff)); -} - - -} // namespace MuComm diff --git a/Trigger/TrigAnalysis/TrigEffJpsiTools/src/MuonRoiWithExtendedBunches.h b/Trigger/TrigAnalysis/TrigEffJpsiTools/src/MuonRoiWithExtendedBunches.h deleted file mode 100644 index bc048635a0c833bddeb461a2dfcc925213477e43..0000000000000000000000000000000000000000 --- a/Trigger/TrigAnalysis/TrigEffJpsiTools/src/MuonRoiWithExtendedBunches.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MuonRoiWithExtendedBunches_h -#define MuonRoiWithExtendedBunches_h -/** - * @author Takashi Matsushita - * @date $Date: 2010-06-17 12:11:12 +0200 (Thu, 17 Jun 2010) $ - * @version $Revision: 305782 $ - * - * This algorithm reconstructs Muon_ROI with extended bunches - * for RPC commissioning period. - * Based on MuCTPI_RDOToRoIBResult.h - */ - -/*--------------------------------------------------------------------* - * headers - *--------------------------------------------------------------------*/ -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ServiceHandle.h" -#include "TrigT1Interfaces/RecMuonRoiSvc.h" - -namespace ROIB { class RoIBResult; } - -namespace MuComm { -enum { - NUM_THRESHOLDS = 6 -}; - -/*--------------------------------------------------------------------* - * classes - *--------------------------------------------------------------------*/ -class MuonRoiWithExtendedBunches : public AthAlgorithm { - - public: - MuonRoiWithExtendedBunches(const std::string& name, - ISvcLocator* pSvcLocator); - virtual StatusCode initialize(); - virtual StatusCode execute(); - - private: - ROIB::RoIBResult* getExtendedRoIBResult(); - static uint32_t RDOtoRoI(uint32_t data_word); - - std::string m_muctpiInput; - std::string m_roibInput; - std::string m_extendedMuonRoi; - - std::vector<int> m_allowedBcArray; - std::set<int> m_allowedBcSet; - std::vector<std::string> m_l1PtNames; - std::vector<double> m_l1PtValues; - - ServiceHandle<LVL1::RecMuonRoiSvc> m_recRpcRoiSvc; - ServiceHandle<LVL1::RecMuonRoiSvc> m_recTgcRoiSvc; - -}; // class MuonRoiWithExtendedBunches - -} // namespace MuComm - - -#endif // MuonRoiWithExtendedBunches_h diff --git a/Trigger/TrigAnalysis/TrigEffJpsiTools/src/TrigEffJpsiTools.cxx b/Trigger/TrigAnalysis/TrigEffJpsiTools/src/TrigEffJpsiTools.cxx deleted file mode 100644 index 0d4c16cb5fa5c60ff3cab89e56dd7677b99cc94e..0000000000000000000000000000000000000000 --- a/Trigger/TrigAnalysis/TrigEffJpsiTools/src/TrigEffJpsiTools.cxx +++ /dev/null @@ -1,3376 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** - * @date $Date: 2016-02-10 18:13:46 +0100 (Wed, 10 Feb 2016) $ - * @version $Revision: 723173 $ - */ - -/** @todo */ -/** @warning */ - -/*--------------------------------------------------------------------* - * headers - *--------------------------------------------------------------------*/ -#include "EventKernel/INavigable4Momentum.h" -#include "Particle/TrackParticle.h" -#include "TrkExInterfaces/IExtrapolator.h" -#include "TrkTrack/Track.h" -#include "TrkRIO_OnTrack/RIO_OnTrack.h" -#include "TrkTrack/TrackStateOnSurface.h" -#include "TrigT1TGCRecRoiSvc/TGCRecRoiSvc.h" -#include "TrigT1RPCRecRoiSvc/RPCRecRoiSvc.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "RPCcablingInterface/IRPCcablingServerSvc.h" - -#include "TrkSurfaces/DiscSurface.h" -#include "TrkSurfaces/CylinderSurface.h" -#include "TrkEventUtils/RoT_Extractor.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" - -#include "AnalysisTriggerEvent/Muon_ROI.h" -#include "TrigDecisionTool/ChainGroup.h" -#include "TrigDecisionTool/Combination.h" -#include "TrigDecisionTool/FeatureContainer.h" -#include "TrigDecisionTool/Feature.h" -#include "TrigMuonEvent/MuonFeature.h" -#include "TrigMuonEvent/CombinedMuonFeature.h" -#include "TrigMuonEvent/CombinedMuonFeatureContainer.h" -#include "TrigMuonEvent/MuonFeatureContainer.h" -#include "TrigMuonEvent/TrigMuonEF.h" -#include "TrigMuonEvent/TrigMuonEFInfo.h" -#include "TrigMuonEvent/TrigMuonEFInfoContainer.h" -#include "TrigMuonEvent/TrigMuonEFInfoTrack.h" -#include "TrigMuonEvent/TrigMuonEFInfoTrackContainer.h" -#include "TrigMuonEvent/TrigMuonEFCbTrack.h" -#include "TrigInDetAnalysis/TIDARoiDescriptor.h" -#include "TrigInDetAnalysisUtils/TIDARoiDescriptorBuilder.h" -#include "TrigSteeringEvent/TrigPassBits.h" -#include "TrigSteeringEvent/TrigPassBitsCollection.h" -#include "TrigSteeringEvent/TrigRoiDescriptor.h" - -#include "TrigParticle/TrigL2BphysContainer.h" -#include "TrigParticle/TrigL2Bphys.h" -#include "TrigParticle/TrigEFBphysContainer.h" -#include "TrigParticle/TrigEFBphys.h" - -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" - -#include "TrigT1Result/MuCTPI_RDO.h" -#include "TrigT1Result/MuCTPI_DataWord_Decoder.h" -#include "TrigT1Result/MuCTPI_MultiplicityWord_Decoder.h" - -#include "muonEvent/Muon.h" -#include "muonEvent/MuonContainer.h" - -//#include "AnalysisTools/IAnalysisTools.h" -#include "TLorentzVector.h" - -#include <limits> -#include <cmath> - -#include "src/TrigEffJpsiTools.h" - -/*--------------------------------------------------------------------* - * constructor & destructor - *--------------------------------------------------------------------*/ -TrigEffJpsiTools::TrigEffJpsiTools(const std::string& type, - const std::string& name, - const IInterface* parent) - : AthAlgTool(type, name, parent), - m_rpcRoiService("LVL1RPC::RPCRecRoiSvc", name), - m_tgcRoiService("LVL1TGC::TGCRecRoiSvc", name), - m_muonIdHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"), - m_extrapolator("Trk::Extrapolator/AtlasExtrapolator"), - m_trigDecisionTool("Trig::TrigDecisionTool/TrigDecisionTool"), - m_Lvl1RoiName("LVL1_ROI"), // container name for level1 RoI - m_endcapPivotPlaneZ(15525.), // z position of pivot plane in endcap region - m_endcapPivotPlaneMinimumRadius(0.), // minimum radius of pivot plane in endcap region - m_endcapPivotPlaneMaximumRadius(11977.), // maximum radius of pivot plane in endcap region - m_barrelPivotPlaneRadius(7500.), // radius of pivot plane in barrel region - m_barrelPivotPlaneHalfLength(9500.), // half length of pivot plane in barrel region - m_invariantMassUpperLimit(3300.), // upper limit on invariant mass of di-muon system - m_invariantMassLowerLimit(2880.), // lower limit on invariant mass of di-muon system - m_trackPtCut(0.), // minimum pt of track - m_trackEtaCut(5.), // maximum eta of track - m_roiSizeBarrel(0.071), // half-diagonal lengh of barrel RoI in eta-phi plane - m_roiSizeEndcap(0.019), // half-diagonal lengh of endcap RoI in eta-phi plane - m_roiSizeForward(0.034), // half-diagonal lengh of forward RoI in eta-phi plane - m_endcapForwardBoundary(1.95), // boundary of forward and endcap chambers in eta - m_searchRangeTolerance(3.), // coefficient for extrapolation error to calculate search range - m_searchRangeOffset(0.), // offset to calculate search range - m_appendL1IfExists(true), - m_appendL2IfExists(true), - m_appendEFIfExists(true), - m_useManualHypoCuts(false), - p_rpcCablingSvc(0), - m_cacheEndcap(), - m_cacheBarrel(), - m_MUON_MASS(105.658367) // MeV/c ref - PL B667, 1 (2008) (pdg.lbl.gov) -{ - declareInterface<ITrigEffJpsiTools>(this); - - declareProperty("RPCRecRoiSvc", m_rpcRoiService); - declareProperty("TGCRecRoiSvc", m_tgcRoiService); - declareProperty("MuonIdHelperTool", m_muonIdHelper); - declareProperty("Extrapolator", m_extrapolator); - declareProperty("TrigDecisionTool", m_trigDecisionTool); - - declareProperty("Lvl1_RoiName", m_Lvl1RoiName); - declareProperty("EndcapPivotPlaneZ", m_endcapPivotPlaneZ); - declareProperty("EndcapPivotPlaneMinimumRadius", m_endcapPivotPlaneMinimumRadius); - declareProperty("EndcapPivotPlaneMaximumRadius", m_endcapPivotPlaneMaximumRadius); - declareProperty("BarrelPivotPlaneRadius", m_barrelPivotPlaneRadius); - declareProperty("BarrelPivotPlaneHalfLength", m_barrelPivotPlaneHalfLength); - declareProperty("InvariantMassUpperLimit", m_invariantMassUpperLimit); - declareProperty("InvariantMassLowerLimit", m_invariantMassLowerLimit); - declareProperty("MuonPtCut", m_trackPtCut); - declareProperty("MuonEtaCut", m_trackEtaCut); - declareProperty("roiSizeBarrel", m_roiSizeBarrel); - declareProperty("roiSizeEndcap", m_roiSizeEndcap); - declareProperty("roiSizeForward", m_roiSizeForward); - declareProperty("endcapForwardBoundary", m_endcapForwardBoundary); - declareProperty("searchRangeTolerance", m_searchRangeTolerance); - declareProperty("searchRangeOffset", m_searchRangeOffset); - declareProperty("appendL1IfExists", m_appendL1IfExists); - declareProperty("appendL2IfExists", m_appendL2IfExists); - declareProperty("appendEFIfExists", m_appendEFIfExists); - declareProperty("useManualHypoCuts", m_useManualHypoCuts); - -} - - -TrigEffJpsiTools::~TrigEffJpsiTools() -{ -} - - - -/*--------------------------------------------------------------------* - * public methods - *--------------------------------------------------------------------*/ -StatusCode -TrigEffJpsiTools::initialize() -{ - ATH_MSG_DEBUG("initialize()"); - - if (AthAlgTool::initialize().isFailure()) return StatusCode::FAILURE; - - - // extrapolator - if (m_extrapolator.retrieve().isFailure()) { - ATH_MSG_FATAL("Failed to retrieve tool: " << m_extrapolator); - return StatusCode::FAILURE; - } - ATH_MSG_INFO("Retrieved tool: " << m_extrapolator); - - - // trigger decision tool - if (m_trigDecisionTool.retrieve().isFailure()) { - ATH_MSG_FATAL("Failed to retrieve tool: " << m_trigDecisionTool); - return StatusCode::FAILURE; - } - ATH_MSG_INFO("Retrieved tool: " << m_trigDecisionTool); - - - // muon id helper tool - if (m_muonIdHelper.retrieve().isFailure()) { - ATH_MSG_FATAL("Failed to retrieve tool: " << m_muonIdHelper); - return StatusCode::FAILURE; - } - ATH_MSG_INFO("Retrieved tool: " << m_muonIdHelper); - - - // muon id helpers - const MuonGM::MuonDetectorManager* muonDetectorManager; - if (detStore()->retrieve(muonDetectorManager).isFailure() or - !muonDetectorManager) { - ATH_MSG_FATAL("Failed to retrieve MuonDetectorManager"); - return StatusCode::FAILURE; - } - ATH_MSG_INFO("Muon id helper ready"); - - - // rpc cabling server service - const IRPCcablingServerSvc* rpcCablingServer = 0; - if (service("RPCcablingServerSvc", rpcCablingServer, 1).isFailure() or - !rpcCablingServer) { - ATH_MSG_FATAL("Failed to retrieve the RPCcablingServerSvc"); - return StatusCode::FAILURE; - } - ATH_MSG_INFO("RPCCablingServerSvc ready"); - - - // rpc cabling service - if (rpcCablingServer->giveCabling(p_rpcCablingSvc).isFailure() or - !p_rpcCablingSvc) { - ATH_MSG_FATAL("Failed to get the IRPCcablingSvc"); - return StatusCode::FAILURE; - } - ATH_MSG_INFO("IRPCcablingSvc ready"); - - - // rpc rec roi service - if (m_rpcRoiService.retrieve().isFailure()) { - ATH_MSG_FATAL("Failed to retrieve " << m_rpcRoiService); - return StatusCode::FAILURE; - } - ATH_MSG_INFO("Retrieved service: " << m_rpcRoiService); - - - // tgc rec roi service - if (m_tgcRoiService.retrieve().isFailure()) { - ATH_MSG_FATAL("Failed to retrieve " << m_tgcRoiService); - return StatusCode::FAILURE; - } - ATH_MSG_INFO("Retrieved service: " << m_tgcRoiService); - - m_cacheEndcap.evtNo = 0; - m_cacheEndcap.runNo = 0; - m_cacheEndcap.tp.clear(); - - m_cacheBarrel.evtNo = 0; - m_cacheBarrel.runNo = 0; - m_cacheBarrel.tp.clear(); - - Btrig_L2_initCuts(); - Btrig_EF_initCuts(); - - - ATH_MSG_DEBUG("initialize() successful"); - - return StatusCode::SUCCESS; -} - - - -StatusCode -TrigEffJpsiTools::finalize() -{ - ATH_MSG_DEBUG("finalize()"); - if (AthAlgTool::finalize().isFailure()) return StatusCode::FAILURE; - - return StatusCode::SUCCESS; -} - - - -bool -TrigEffJpsiTools::isTriggeredMuonEF(const Rec::TrackParticle* track, - const std::string& chainName) const -{ - if (not isConfigured(chainName, "EF")) return false; - - const Trig::ChainGroup* cg = m_trigDecisionTool->getChainGroup(chainName); - if (not (m_trigDecisionTool->isPassedBits(cg) & - TrigDefs::EF_passedRaw)) { - ATH_MSG_DEBUG("isTriggeredMuonEF:EF_passedRaw: no " << chainName); - return false; - } - ATH_MSG_DEBUG("isTriggeredMuonEF:EF_passedRaw: yes " << chainName); - - return isTriggeredMuonHLT(track, chainName, cg); -} - - -bool -TrigEffJpsiTools::isTriggeredMuonL2(const Rec::TrackParticle* track, - const std::string& chainName) const -{ - if (not isConfigured(chainName, "L2")) return false; - - const Trig::ChainGroup* cg = m_trigDecisionTool->getChainGroup(chainName); - if (not (m_trigDecisionTool->isPassedBits(cg) & - TrigDefs::L2_passedRaw)) { - ATH_MSG_DEBUG("isTriggeredMuonEF:L2_passedRaw: no " << chainName); - return false; - } - ATH_MSG_DEBUG("isTriggeredMuonEF:L2_passedRaw: yes " << chainName); - - return isTriggeredMuonHLT(track, chainName, cg); -} - - - -bool -TrigEffJpsiTools::isTriggeredMuonL1(const Rec::TrackParticle* track, - const std::string& chainName) const -{ - if (not isConfigured(chainName, "L1")) return false; - - const int ptRequired = getL1PtThreshold(chainName); - if (ptRequired < 0) { - ATH_MSG_WARNING("isTriggeredMuonL1: problem on chainName '" << chainName << "'"); - return false; - } - - const Trig::ChainGroup *cg = m_trigDecisionTool->getChainGroup("L1_MU[0-9]+"); - const std::vector<std::string> l1muonName = cg->getListOfTriggers(); - bool passed = false; - for (size_t ii = 0; ii < l1muonName.size(); ii++) { - int pt = getL1PtThreshold(l1muonName.at(ii)); - if (pt < ptRequired) continue; - if (m_trigDecisionTool->isPassedBits(l1muonName.at(ii)) & - TrigDefs::L1_isPassedBeforePrescale) { - ATH_MSG_DEBUG("isTriggeredMuonL1:L1_isPassedBeforePrescale: yes " << l1muonName.at(ii)); - passed = true; - break; - } else { - ATH_MSG_DEBUG("isTriggeredMuonL1:L1_isPassedBeforePrescale: no " << l1muonName.at(ii)); - } - } - - if (not passed) return false; - - - struct Match match; - if (not getMatchedRoI(track, match)) { - ATH_MSG_DEBUG("isTriggeredMuonL1:getMatchedRoI: no " << chainName); - return false; - } - - bool rc = (match.roiThrValue >= ptRequired); - ATH_MSG_DEBUG("Pt passed: " << match.roiThrValue << - " >= Pt required: " << ptRequired << - " = " << rc); - return rc; -} - - - -bool -TrigEffJpsiTools::isTriggeredMuon(const Rec::TrackParticle* track, - int thresholdNumber) const -{ - ATH_MSG_DEBUG("isTriggeredMuon()"); - - if (!track) { - ATH_MSG_WARNING("isTriggeredMuon: track pointer is null"); - return false; - } - - if ((thresholdNumber < 1) or (thresholdNumber > 6)) { - ATH_MSG_WARNING("isTriggeredMuon: logical threshold number out of range: " << - thresholdNumber); - return false; - } - - const LVL1_ROI* lvl1Roi = 0; - if (evtStore()->retrieve(lvl1Roi, m_Lvl1RoiName).isFailure() or !lvl1Roi) { - ATH_MSG_WARNING("Failed to retrieve: " << m_Lvl1RoiName); - return false; - } - - LVL1_ROI::muons_type muonRoIs = lvl1Roi->getMuonROIs(); - - bool rc = isTriggeredOnEndcap(track, muonRoIs, thresholdNumber) or - isTriggeredOnBarrel(track, muonRoIs, thresholdNumber); - return rc; -} - - - -bool -TrigEffJpsiTools::isJPsiCandidate(const Rec::TrackParticle* track1, - const Rec::TrackParticle* track2) const -{ - ATH_MSG_DEBUG("isJPsiCandidate()"); - - if (!track1 or !track2) { - ATH_MSG_WARNING("isTriggeredMuon: track pointer is null"); - return false; - } - - if (track1->charge()*track2->charge() > 0.) { - ATH_MSG_DEBUG("reject: same charge combination"); - return false; - } - ATH_MSG_DEBUG("accept: opposite charge combination"); - - if (!isSeparated(track1, track2)) { - ATH_MSG_DEBUG("reject: two tracks too close"); - return false; - } - ATH_MSG_DEBUG("accept: tracks well separated"); - - TLorentzVector tvec1, tvec2; - tvec1.SetPtEtaPhiM(track1->pt(), track1->eta(), track1->phi(), m_MUON_MASS); - tvec2.SetPtEtaPhiM(track2->pt(), track2->eta(), track2->phi(), m_MUON_MASS); - double invariantMass = (tvec1 + tvec2).M(); - - if ((invariantMass < m_invariantMassLowerLimit) or - (invariantMass > m_invariantMassUpperLimit)) { - ATH_MSG_DEBUG("reject: invariant mass: " << invariantMass); - return false; - } - ATH_MSG_DEBUG("accept: invariant mass: " << invariantMass); - - return true; -} - - -bool -TrigEffJpsiTools::isJPsiCandidate(const INavigable4Momentum* mom1, - const INavigable4Momentum* mom2) const -{ - ATH_MSG_DEBUG("isJPsiCandidate"); - - if (!mom1 or !mom2) { - ATH_MSG_WARNING("isTriggeredMuon: momentum pointer is null"); - return false; - } - - // invariant mass calculation - TLorentzVector tvec1, tvec2; - tvec1.SetPtEtaPhiM(mom1->pt(), mom1->eta(), mom1->phi(), m_MUON_MASS); - tvec2.SetPtEtaPhiM(mom2->pt(), mom2->eta(), mom2->phi(), m_MUON_MASS); - double invariantMass = (tvec1 + tvec2).M(); - - if ((invariantMass < m_invariantMassLowerLimit) or - (invariantMass > m_invariantMassUpperLimit)) { - ATH_MSG_DEBUG("reject: invariant mass: " << invariantMass); - return false; - } - ATH_MSG_DEBUG("accept: invariant mass: " << invariantMass); - - return true; -} - - - -int -TrigEffJpsiTools::getMatchedRoI(const Rec::TrackParticle* track, - bool* barrel, - bool* endcap, - Amg::Vector2D* eta, - Amg::Vector2D* phi) const -{ - ATH_MSG_DEBUG("getMatchedRoI()"); - - struct Match match; - match.etaExTrk = eta; - match.phiExTrk = phi; - getMatchedRoI(track, match); - if (barrel) *barrel = match.barrel; - if (endcap) *endcap = match.endcap; - return match.roiIndex; -} - - - -bool -TrigEffJpsiTools::extrapolateToRio(const Rec::TrackParticle* track, - const Trk::RIO_OnTrack* rot, - Amg::Vector2D* eta, - Amg::Vector2D* phi, - Amg::Vector2D* ptpz, - bool getTsos, - const std::vector<const Trk::TrackStateOnSurface*>* &tsos) const - -{ - if (!track) { - ATH_MSG_WARNING("extrapolateToRio: track pointer is null"); - return false; - } - - if (!rot) { - ATH_MSG_WARNING("extrapolateToRio: rot pointer is null"); - return false; - } - - if (!eta) { - ATH_MSG_WARNING("extrapolateToRio: eta pointer is null"); - return false; - } - - if (!phi) { - ATH_MSG_WARNING("extrapolateToRio: phi pointer is null"); - return false; - } - - if (!ptpz) { - ATH_MSG_WARNING("extrapolateToRio: ptpz pointer is null"); - return false; - } - - const Identifier id = rot->identify(); - if (not m_muonIdHelper->isMuon(id)) return false; - if (not m_muonIdHelper->isTrigger(id)) return false; - - const bool useCache = false; - const Trk::TrackParameters* point = 0; - Amg::Vector2D dEtaPhi; - if (m_muonIdHelper->isTgc(id)) { - const Trk::AtaDisc* p = extrapolateToEndcap(track, rot->globalPosition().z(), useCache); - if (!p) return false; - getExtrapolationErrorOnEndcap(p, &dEtaPhi); - point = p; - - } else { - double x = rot->globalPosition().x(); - double y = rot->globalPosition().y(); - double pivotRadius = sqrt(x*x + y*y); - const Trk::AtaCylinder* p = extrapolateToBarrel(track, pivotRadius, - useCache); - if (!p) return false; - getExtrapolationErrorOnBarrel(p, &dEtaPhi); - point = p; - } - (*eta)[Trk::locX] = point->position().eta(); - (*eta)[Trk::locY] = dEtaPhi[Trk::locX]; - (*phi)[Trk::locX] = point->position().phi(); - (*phi)[Trk::locY] = dEtaPhi[Trk::locY]; - - (*ptpz)[Trk::locX] = point->momentum().perp(); - (*ptpz)[Trk::locY] = point->momentum().z(); - delete point; - - if (not getTsos) return true; - - if (m_muonIdHelper->isTgc(id)) { - tsos = extrapolateToEndcapM(track, rot->globalPosition().z()); - } else { - double x = rot->globalPosition().x(); - double y = rot->globalPosition().y(); - double pivotRadius = sqrt(x*x + y*y); - tsos = extrapolateToBarrelM(track, pivotRadius); - } - - return true; -} - - - -bool -TrigEffJpsiTools::extrapolateToPoint(const Rec::TrackParticle* track, - const Amg::Vector3D* pos, - const int detector, - Amg::Vector2D* eta, - Amg::Vector2D* phi, - Amg::Vector3D* mom) const - -{ - if (!track) { - ATH_MSG_WARNING("extrapolateToPoint: track pointer is null"); - return false; - } - - if (!pos) { - ATH_MSG_WARNING("extrapolateToPoint: pos pointer is null"); - return false; - } - - if (!eta) { - ATH_MSG_WARNING("extrapolateToPoint: eta pointer is null"); - return false; - } - - if (!phi) { - ATH_MSG_WARNING("extrapolateToPoint: phi pointer is null"); - return false; - } - - if (!mom) { - ATH_MSG_WARNING("extrapolateToPoint: mom pointer is null"); - return false; - } - - - const bool useCache = false; - const Trk::TrackParameters* point = 0; - Amg::Vector2D dEtaPhi; - if (detector == ITrigEffJpsiTools::TGC) { - const Trk::AtaDisc* p = extrapolateToEndcap(track, pos->z(), useCache); - if (!p) return false; - getExtrapolationErrorOnEndcap(p, &dEtaPhi); - point = p; - - } else if (detector == ITrigEffJpsiTools::RPC) { - double x = pos->x(); - double y = pos->y(); - double pivotRadius = sqrt(x*x + y*y); - const Trk::AtaCylinder* p = extrapolateToBarrel(track, pivotRadius, - useCache); - if (!p) return false; - getExtrapolationErrorOnBarrel(p, &dEtaPhi); - point = p; - - } else { - ATH_MSG_WARNING("extrapolateToPoint: unknown target: " << detector); - return false; - } - - (*eta)[Trk::locX] = point->position().eta(); - (*eta)[Trk::locY] = dEtaPhi[Trk::locX]; - (*phi)[Trk::locX] = point->position().phi(); - (*phi)[Trk::locY] = dEtaPhi[Trk::locY]; - - (*mom)[Trk::locX] = point->momentum().x(); - (*mom)[Trk::locY] = point->momentum().y(); - (*mom)[Trk::locZ] = point->momentum().z(); - - delete point; - - return true; -} - - -// Accessing Trigger Elements using advanced expert features -// This functionality may disappear when TDT veriosn used is above 01-05-56 -std::vector<HLT::TriggerElement*> -TrigEffJpsiTools::getExpertTEs(const std::string& chain) const -{ - Trig::ExpertMethods* expert = m_trigDecisionTool->ExperimentalAndExpertMethods(); - expert->enable(); - std::vector<HLT::TriggerElement*> tes; - expert->getNavigation()->getAllOfType(chain, tes, true); ///EF_mu4 is the TE name, see NavigatioNcore or lxr for docu on it - - return tes; -} - - -bool -TrigEffJpsiTools::getTriggerObjects(const std::string& chain, - TrigObjectMap* muonsEF, - TrigObjectMap* muonsL2, - TrigObjectMap* muonsL1) const -{ - std::string lvl = chain.substr(0,2); - if (lvl == "EF") return getEFTriggerObjects( chain, muonsEF, muonsL2, muonsL1); - if (lvl == "L2") return getL2TriggerObjects( chain, muonsL2, muonsL1); - if (lvl == "L1") return getL1TriggerObjects( chain, muonsL1); - return false; -} - - - -bool -TrigEffJpsiTools::getL1TriggerObjects(const std::string& chain, - TrigObjectMap* muonsL1) const -{ - ATH_MSG_DEBUG("TrigEffJpsiTools::getL1TriggerObjects() : " << chain); - - const LVL1_ROI* lvl1Roi = 0; - if (evtStore()->retrieve(lvl1Roi, chain).isFailure() or !lvl1Roi) { - ATH_MSG_WARNING("Failed to retrieve: " << chain); - return false; - } - - std::string keyPref = "L1_"; - - std::vector<Muon_ROI>::const_iterator it; - short iMuon=0; - for (it = lvl1Roi->getMuonROIs().begin(); it != lvl1Roi->getMuonROIs().end(); ++it, ++iMuon) { - ATH_MSG_DEBUG("L1 object # " << iMuon - << " &: " << &(*it) - << " pt: " << it->pt() - << " eta: " << it->eta() - << " phi: " << it->phi() - << " word: " << it->getROIWord() - << " Source: " << it->getSource() - << " Hemisphere: " << it->getHemisphere() ); - - if ( muonsL1 != NULL) { - TrigObject trigObjectL1; - int charge = -99; - switch (it->getCharge()) { - case Muon_ROI::Pos: - charge = 1; - break; - case Muon_ROI::Neg: - charge = -1; - break; - default: - charge = -99; - } - trigObjectL1.names.push_back( keyPref + it->getThrName() ); - trigObjectL1.eta = it->eta(); - trigObjectL1.phi = it->phi(); - trigObjectL1.pt = it->pt(); - trigObjectL1.q = charge; - trigObjectL1.id = it->getROIWord(); - trigObjectL1.parentId = -1; - trigObjectL1.grandparentId = -1; - //trigObjectL1.daughterIds.push_back(-1); - trigObjectL1.combIds.push_back(iMuon); - trigObjectL1.efObjIds.push_back(-1); - trigObjectL1.type = SPECTROMETER; - addTrigObject(trigObjectL1, muonsL1, m_appendL1IfExists); - } - } - - // Trig::FeatureContainer fc = m_trigDecisionTool->features(chain); - // ATH_MSG_INFO("Features: # " << fc.get<TrigRoiDescriptor>().size() ); - // const std::vector<Trig::Combination>& combs = fc.getCombinations(); - // std::vector<Trig::Combination>::const_iterator combIt; - // int iComb = 1; - // for ( combIt = combs.begin(); combIt != combs.end(); ++combIt, ++iComb ) { - // std::vector<Trig::Feature<TrigRoiDescriptor> > muons = fc.get<TrigRoiDescriptor>(); - // std::vector<Trig::Feature<TrigRoiDescriptor> >::const_iterator mit; - // int iObj = 0; - // for ( mit = muons.begin(); mit != muons.end(); ++mit, ++iObj) { - // const TrigRoiDescriptor* mu = mit->cptr(); - // ATH_MSG_INFO("L1 combination # " << iComb << " object # " << iObj - // << " &: " << mu - // // << " pt: " << mu - // << " eta: " << mu->eta() << ", " << mu->eta0() - // << " phi: " << mu->phi() << ", " << mu->phi0() - // << " word: " << mu->roiWord() ); - // } - // } - - return true; -} - - -bool -TrigEffJpsiTools::getL2TriggerObjects(const std::string& chain, - TrigObjectMap* muonsL2, - TrigObjectMap* muonsL1) const -{ - ATH_MSG_DEBUG("TrigEffJpsiTools::getL2TriggerObjects() : " << chain); - - //const Trig::ChainGroup* cg = m_trigDecisionTool->getChainGroup(chain); - // Getting the chain's features: - const Trig::FeatureContainer fc = m_trigDecisionTool->features(chain); - - std::vector<Trig::Combination>::const_iterator it; - short iComb = 1; - short iMuon = 0; - for ( it = fc.getCombinations().begin(); it != fc.getCombinations().end(); ++it, ++iComb ) { // Loop over combinations - // TOOD: It is possible for L2 objects which did not pass L2 hypo (not active) to still go into the ntuple - // via getEFTriggerObjects EF parents. Find solution - const Trig::Combination& combination = *it; - if (not combination.active()) { - ATH_MSG_DEBUG("getEFTriggerObjects: combination " << combination << " is not active"); - continue; - } - ATH_MSG_DEBUG("getEFTriggerObjects: combination " << combination << " is active"); - - std::vector<Trig::Feature<CombinedMuonFeature> > muons = combination.get<CombinedMuonFeature>(); // TODO: Use MuonFeature as well to retrieve non-combined - std::vector<Trig::Feature<CombinedMuonFeature> >::const_iterator mit; - int iObj = 0; - for ( mit = muons.begin(); mit != muons.end(); ++mit, ++iObj) { - const CombinedMuonFeature* muonL2 = mit->cptr(); - Trig::Feature<Muon_ROI> muonL1Feature = m_trigDecisionTool->ancestor<Muon_ROI>(*mit); - const Muon_ROI* muonL1 = muonL1Feature.cptr(); - if ( muonL2 != NULL ) { - ATH_MSG_DEBUG("L2 combination # " << iComb << " object # " << iObj - << " &:" << (int64_t) muonL2 - << " TE id: " << mit->te()->getId() - << " pt: " << muonL2->pt() - << " eta: " << muonL2->eta() - << " phi: " << muonL2->phi()); - - if ( muonsL2 != NULL) { - TrigObject trigObjectL2; - trigObjectL2.names.push_back(chain); - trigObjectL2.eta = muonL2->eta(); - trigObjectL2.phi = muonL2->phi(); - trigObjectL2.pt = muonL2->pt(); - trigObjectL2.q = muonL2->pt() > 0.0 ? 1 : -1; - trigObjectL2.id = (int64_t) muonL2; - trigObjectL2.parentId = (muonL1 != NULL) ? muonL1->getROIWord() : -1; - trigObjectL2.grandparentId = -1; - //trigObjectL2.daughterIds.push_back(-1); - trigObjectL2.combIds.push_back(iComb); - trigObjectL2.efObjIds.push_back(-1); - trigObjectL2.type = COMBINED; // TODO: Add non-combined objects too - addTrigObject(trigObjectL2, muonsL2, m_appendL2IfExists); - } - } else ATH_MSG_WARNING("getL2TriggerObjects(): muonL2 is NULL"); - - if ( muonL1 != NULL ) { - ATH_MSG_DEBUG(" parent: &:" << (int64_t) muonL1 - << " pt: " << muonL1->pt() - << " eta: " << muonL1->eta() - << " phi: " << muonL1->phi() - << " word: " << muonL1->getROIWord() ); - if ( muonsL1 != NULL) { - TrigObject trigObjectL1; - int charge = -99; - switch (muonL1->getCharge()) { - case Muon_ROI::Pos: charge = 1; break; - case Muon_ROI::Neg: charge = -1; break; - default: - charge = -99; - ATH_MSG_DEBUG("muonL1 charge not defined " << muonL1->getCharge()); - } - trigObjectL1.names.push_back(chain); - trigObjectL1.eta = muonL1->eta(); - trigObjectL1.phi = muonL1->phi(); - trigObjectL1.pt = muonL1->pt(); - trigObjectL1.q = charge; - trigObjectL1.id = muonL1->getROIWord(); - trigObjectL1.parentId = -1; - trigObjectL1.grandparentId = -1; - //trigObjectL1.daughterIds.push_back((int64_t) muonL2); - trigObjectL1.combIds.push_back(iComb); - trigObjectL1.efObjIds.push_back(-1); - trigObjectL1.type = SPECTROMETER; - addTrigObject(trigObjectL1, muonsL1, m_appendL1IfExists); - } - } else ATH_MSG_WARNING("getL2TriggerObjects(): muonL1 is NULL"); - ++iMuon; - } - } // End loop over combinations - - return true; -} - - -bool -TrigEffJpsiTools::getEFTriggerObjects(const std::string& chain, - TrigObjectMap* muonsEF, - TrigObjectMap* muonsL2, - TrigObjectMap* muonsL1) const -{ - ATH_MSG_DEBUG("TrigEffJpsiTools::getEFTriggerObjects() : " << chain); - - //const Trig::ChainGroup* cg = m_trigDecisionTool->getChainGroup(chain); - // Getting the chain's features: - const Trig::FeatureContainer fc = m_trigDecisionTool->features(chain); - - std::vector<Trig::Combination>::const_iterator it; - short iComb = 1; - for ( it = fc.getCombinations().begin(); it != fc.getCombinations().end(); ++it, ++iComb ) { // Loop over combinations - const Trig::Combination& combination = *it; - if (not combination.active()) { - ATH_MSG_DEBUG("getEFTriggerObjects: combination " << combination << " is not active"); - continue; - } - ATH_MSG_DEBUG("getEFTriggerObjects: combination " << combination << " is active"); - - std::vector<Trig::Feature<TrigMuonEFInfo> > muons = combination.get<TrigMuonEFInfo>(); - std::vector<Trig::Feature<TrigMuonEFInfo> >::iterator mit; - short iObj = 0; - for ( mit = muons.begin(); mit != muons.end(); ++mit, ++iObj) { // Loop over objects - const TrigMuonEFInfo* muonEF = mit->cptr(); - Trig::Feature<CombinedMuonFeature> muonL2Feature = m_trigDecisionTool->ancestor<CombinedMuonFeature>(*mit); - Trig::Feature<Muon_ROI> muonL1Feature = m_trigDecisionTool->ancestor<Muon_ROI>(*mit); - const CombinedMuonFeature* muonL2 = muonL2Feature.cptr(); - const Muon_ROI* muonL1 = muonL1Feature.cptr(); - const TrigMuonEFInfoTrackContainer* muonEFInfoTrackCont = muonEF->TrackContainer(); - TrigMuonEFInfoTrackContainer::const_iterator trit; - - int iTrack = 0; - int iCbTrack = 0; - for ( trit = muonEFInfoTrackCont->begin(); trit != muonEFInfoTrackCont->end(); ++trit, ++iTrack ) { - const TrigMuonEFTrack* muonEFTrack = NULL; - int trackType = UNDEFINED; - if ( (*trit)->hasCombinedTrack() ) { trackType = COMBINED; muonEFTrack = (*trit)->CombinedTrack(); } - else if ( (*trit)->hasSpectrometerTrack() ) { trackType = SPECTROMETER; muonEFTrack = (*trit)->SpectrometerTrack(); } - else if ( (*trit)->hasExtrapolatedTrack() ) { trackType = EXTRAPOLATED; muonEFTrack = (*trit)->ExtrapolatedTrack(); } - - if ( muonEFTrack != NULL ) { - ATH_MSG_DEBUG("EF combination # " << iComb << " object # " << iObj << " CbTrack #" << iCbTrack - << " CbTrack&: " << (uint64_t) muonEFTrack - << " TrigMuonEFInfo&: " << (int64_t) muonEF - << " pt: " << muonEFTrack->pt() - << " eta: " << muonEFTrack->eta() - << " phi: " << muonEFTrack->phi() - << " type: " << trackType ); - - TrigObject trigObjectEF; - trigObjectEF.names.push_back(chain); - trigObjectEF.eta = muonEFTrack->eta(); - trigObjectEF.phi = muonEFTrack->phi(); - trigObjectEF.pt = muonEFTrack->pt(); - trigObjectEF.q = muonEFTrack->Charge(); - trigObjectEF.id = (int64_t) muonEFTrack; - trigObjectEF.parentId = (int64_t) muonL2; - trigObjectEF.grandparentId = (muonL1 != NULL) ? muonL1->getROIWord() : -1; - //trigObjectEF.daughterIds.push_back(-1); - trigObjectEF.combIds.push_back(iComb); - trigObjectEF.efObjIds.push_back(iTrack); - trigObjectEF.type = trackType; - addTrigObject(trigObjectEF, muonsEF, m_appendEFIfExists); - ++iCbTrack; // TODO: Find a more proper name - } - } // End if muonEFTrack - - if ( muonEFInfoTrackCont->size() > 0 && iCbTrack == 0 ) - ATH_MSG_WARNING("getEFTriggerObjects(): Could not find a combined track"); - - if ( muonL2 != NULL ) { - ATH_MSG_DEBUG(" parent: &: " << (int64_t) muonL2 - << " pt: " << muonL2->pt() - << " eta: " << muonL2->eta() - << " phi: " << muonL2->phi() ); - - if ( muonsL2 != NULL) { - TrigObject trigObjectL2; - trigObjectL2.names.push_back(chain); - trigObjectL2.eta = muonL2->eta(); - trigObjectL2.phi = muonL2->phi(); - trigObjectL2.pt = muonL2->pt(); - trigObjectL2.q = muonL2->pt() > 0.0 ? 1 : -1; - trigObjectL2.id = (int64_t) muonL2; - trigObjectL2.parentId = (muonL1 != NULL) ? muonL1->getROIWord() : -1; - trigObjectL2.grandparentId = -1; - //trigObjectL2.daughterIds.push_back((int64_t) muonEF); - trigObjectL2.combIds.push_back(iComb); - trigObjectL2.efObjIds.push_back(-1); - trigObjectL2.type = COMBINED; - addTrigObject(trigObjectL2, muonsL2, m_appendL2IfExists); - } - } else ATH_MSG_WARNING("getEFTriggerObjects(): muonL2 is NULL"); - - if ( muonL1 != NULL ) { - ATH_MSG_DEBUG(" grandparent: &: " << (int64_t) muonL1 - << " pt: " << muonL1->pt() - << " eta: " << muonL1->eta() - << " word: " << muonL1->getROIWord() - << " phi: " << muonL1->phi() ); - if ( muonsL1 != NULL) { - TrigObject trigObjectL1; - int charge = -99; - switch (muonL1->getCharge()) { - case Muon_ROI::Pos: charge = 1; break; - case Muon_ROI::Neg: charge = -1; break; - default: - charge = -99; - ATH_MSG_WARNING("muonL1 charge not defined " << muonL1->getCharge()); - } - trigObjectL1.names.push_back(chain); - trigObjectL1.eta = muonL1->eta(); - trigObjectL1.phi = muonL1->phi(); - trigObjectL1.pt = muonL1->pt(); - trigObjectL1.q = charge; - trigObjectL1.id = muonL1->getROIWord(); - trigObjectL1.parentId = -1; - trigObjectL1.grandparentId = -1; - //trigObjectL1.daughterIds.push_back((int64_t) muonL2); - trigObjectL1.combIds.push_back(iComb); - trigObjectL1.efObjIds.push_back(-1); - trigObjectL1.type = SPECTROMETER; - addTrigObject(trigObjectL1, muonsL1, m_appendL1IfExists); - } - } else ATH_MSG_WARNING("getEFTriggerObjects(): muonL1 is NULL"); - } - } // End loop over combinations - - return true; -} - -bool -TrigEffJpsiTools::getEFAllTriggerObjects(const std::string& chain, - TrigObjectMap* muonsEF, - TrigObjectMap* /*muonsL2*/, - TrigObjectMap* /*muonsL1*/) const -{ - ATH_MSG_DEBUG("TrigEffJpsiTools::getEFAllTriggerObjects() : " << chain); - - const Trig::ChainGroup* cg = m_trigDecisionTool->getChainGroup(chain); - ATH_MSG_INFO( "The chain " << chain << " is passing" << cg->isPassed() ); - - std::vector<HLT::TriggerElement*> tes = getExpertTEs(chain); - - // now get features - - BOOST_FOREACH( const HLT::TriggerElement* te, tes ) { - Trig::Feature<TrigMuonEFInfoContainer> FeatureCont = m_trigDecisionTool->ancestor<TrigMuonEFInfoContainer>(te); - const TrigMuonEFInfoContainer* TmuonsCont = FeatureCont.cptr(); - ATH_MSG_INFO("Object container found !: " << FeatureCont.cptr() << " size " << TmuonsCont->size() ); - - TrigMuonEFInfoContainer::const_iterator MuonItr = TmuonsCont->begin(); - TrigMuonEFInfoContainer::const_iterator MuonItrE = TmuonsCont->end(); - - for (int imu=0; MuonItr != MuonItrE; ++MuonItr, ++imu ) { - const TrigMuonEFInfo* muonInfo = (*MuonItr); - const TrigMuonEFInfoTrackContainer* muonEFInfoTrackCont = muonInfo->TrackContainer(); - int iTrack = 0; - TrigMuonEFInfoTrackContainer::const_iterator trit; - for ( trit = muonEFInfoTrackCont->begin(); trit != muonEFInfoTrackCont->end(); ++trit, ++iTrack ) { - const TrigMuonEFTrack* muonEFTrack = NULL; - int trackType = UNDEFINED; - if ( (*trit)->hasCombinedTrack() ) { trackType = COMBINED; muonEFTrack = (*trit)->CombinedTrack(); } - else if ( (*trit)->hasSpectrometerTrack() ) { trackType = SPECTROMETER; muonEFTrack = (*trit)->SpectrometerTrack(); } - else if ( (*trit)->hasExtrapolatedTrack() ) { trackType = EXTRAPOLATED; muonEFTrack = (*trit)->ExtrapolatedTrack(); } - - if ( muonEFTrack != NULL ) { - ATH_MSG_DEBUG("EF container, track " << imu << " " << iTrack - << " CbTrack&: " << (uint64_t) muonEFTrack - << " TrigMuonEFInfo&: " << (int64_t) muonInfo - << " pt: " << muonEFTrack->pt() - << " eta: " << muonEFTrack->eta() - << " phi: " << muonEFTrack->phi() - << " type: " << trackType - << " combId: " << imu ); - - // store ntuple info - TrigObject trigObjectEF; - trigObjectEF.names.push_back("EF_mu4_All"); - trigObjectEF.eta = muonEFTrack->eta(); - trigObjectEF.phi = muonEFTrack->phi(); - trigObjectEF.pt = muonEFTrack->pt(); - trigObjectEF.q = muonEFTrack->Charge(); - trigObjectEF.id = (int64_t) muonEFTrack; - trigObjectEF.parentId = -1; // (int64_t) muonL2; - trigObjectEF.grandparentId = -1; // (muonL1 != NULL) ? muonL1->getROIWord() : -1; - //trigObjectEF.daughterIds.push_back(-1); - trigObjectEF.combIds.push_back(-1); - trigObjectEF.efObjIds.push_back(iTrack); - trigObjectEF.type = trackType; - addTrigObject(trigObjectEF, muonsEF, m_appendEFIfExists); - // ++iCbTrack; // TODO: Find a more proper name - } - } // End if muonEFTrack - - - } // end loop over muon conatiner - - - } // end loop over TEs - - - return true; -} - -bool -TrigEffJpsiTools::getEFIDTriggerObjects(const std::string& chain, - TrigObjectMap* muonsEF, - TrigObjectMap* /*muonsL2*/, - TrigObjectMap* /*muonsL1*/) const -{ - ATH_MSG_DEBUG("TrigEffJpsiTools::getEFIDTriggerObjects() : " << chain); - - const Trig::FeatureContainer fc = m_trigDecisionTool->features(chain); - - ATH_MSG_DEBUG("getEFIDTriggerObjects: number of combination " << fc.getCombinations().size()); - - std::vector<Trig::Combination>::const_iterator it; - short iComb = 0; - for ( it = fc.getCombinations().begin(); it != fc.getCombinations().end(); ++it, ++iComb ) { // Loop over combinations - const Trig::Combination& combination = *it; - if (not combination.active()) { - ATH_MSG_DEBUG("getEFIDTriggerObjects: combination " << iComb << " " << combination << " is not active"); - continue; - } - ATH_MSG_DEBUG("getEFIDTriggerObjects: combination " << iComb << " " << combination << " is active"); - - std::vector<Trig::Feature<Rec::TrackParticleContainer> > tracks = combination.get<Rec::TrackParticleContainer>("InDetTrigParticleCreation_Muon_EFID"); - std::vector<Trig::Feature<Rec::TrackParticleContainer> >::iterator trit; - - short iTrk = 0; - ATH_MSG_DEBUG("getEFIDTriggerObjects: number of track collections " << tracks.size()); - for ( trit = tracks.begin(); trit != tracks.end(); ++trit, ++iTrk) { // Loop over objects - const Rec::TrackParticleContainer* trackEF = trit->cptr(); - - ATH_MSG_DEBUG("getEFIDTriggerObjects: number of tracks " << trackEF->size()); - Rec::TrackParticleContainer::const_iterator trkIt = trackEF->begin(); - Rec::TrackParticleContainer::const_iterator lastTrkIt = trackEF->end(); - - for (int itrk=0 ; trkIt != lastTrkIt; itrk++, trkIt++) { - const Trk::Perigee* perigee = (*trkIt)->measuredPerigee(); - - double px = perigee->momentum()[Trk::px]; - double py = perigee->momentum()[Trk::py]; - double ptSquare=std::pow(px,2) + std::pow(py,2); - double pT = sqrt(ptSquare) * perigee->parameters()[Trk::qOverP]/fabs(perigee->parameters()[Trk::qOverP]); - - ATH_MSG_DEBUG("getEFIDTriggerObjects: track " << itrk - << " pt: " << pT - << " eta: " << perigee->eta() - << " phi: " << perigee->parameters()[Trk::phi] - << " type: " << IDONLY - << " combId: " << iComb ); - - // store ntuple info - TrigObject trigObjectEF; - trigObjectEF.names.push_back(chain); - trigObjectEF.eta = perigee->eta(); - trigObjectEF.phi = perigee->parameters()[Trk::phi]; - trigObjectEF.pt = pT; - trigObjectEF.q = perigee->parameters()[Trk::qOverP]/fabs(perigee->parameters()[Trk::qOverP]); - trigObjectEF.id = (int64_t) (*trkIt); - trigObjectEF.parentId = -1; - trigObjectEF.grandparentId = -1; - // trigObjectEF.daughterIds.push_back(-1); - trigObjectEF.combIds.push_back(iComb); - trigObjectEF.efObjIds.push_back(iTrk); - trigObjectEF.type = IDONLY; - addTrigObject(trigObjectEF, muonsEF, m_appendEFIfExists); - - } // end loop over tracks - } // end loop over track collections - } // end loopp over combinations - - - return true; -} - -bool -TrigEffJpsiTools::getEFMSTriggerObjects(const std::string& chain, - TrigObjectMap* muonsEF, - TrigObjectMap* /*muonsL2*/, - TrigObjectMap* /*muonsL1*/) const -{ - std::vector< const TrigMuonEFTrack* > muonExtrapolatedTracks; - ATH_MSG_DEBUG("TrigEffJpsiTools::getEFMSTriggerObjects() : " << chain); - const Trig::FeatureContainer fc = m_trigDecisionTool->features(chain); - ATH_MSG_DEBUG("getEFMSTriggerObjects: number of combination " << fc.getCombinations().size()); - - std::vector<Trig::Combination>::const_iterator it; - short iComb = 0; - for ( it = fc.getCombinations().begin(); it != fc.getCombinations().end(); ++it, ++iComb ) { // Loop over combinations - const Trig::Combination& combination = *it; - if (not combination.active()) { - ATH_MSG_DEBUG("getEFMSTriggerObjects: combination " << iComb << " " << combination << " is not active"); - continue; - } - ATH_MSG_DEBUG("getEFMSTriggerObjects: combination " << iComb << " " << combination << " is active"); - - //from Peter - std::vector< Trig::Feature<TrigRoiDescriptor> > initRois = combination.get<TrigRoiDescriptor>("initialRoI", TrigDefs::Physics); - std::vector< Trig::Feature< TrigMuonEFInfoContainer > > muons = combination.get< TrigMuonEFInfoContainer >("MuonEFInfo", TrigDefs::Physics); - - for( unsigned roiIt1 = 0; roiIt1 < muons.size(); roiIt1++ ){ - Trig::Feature< TrigMuonEFInfoContainer > trackFeature1 = muons.at(roiIt1); - const TrigMuonEFInfoContainer* trigMuon1 = trackFeature1.cptr(); - TrigMuonEFInfoContainer::const_iterator muonItr1 = trigMuon1->begin(); - const TrigMuonEFInfo* muoninfo1 = (*muonItr1); - - if( !initRois.empty() ){ - const TrigRoiDescriptor* roid1 = initRois[roiIt1].cptr(); - TIDARoiDescriptor roiInfo1 = TIDARoiDescriptorBuilder(*roid1); - if( muoninfo1->hasTrack() ){ - const TrigMuonEFInfoTrackContainer* tc1 = muoninfo1->TrackContainer(); - bool selected = false; - for( TrigMuonEFInfoTrackContainer::const_iterator trackItr = tc1->begin(); trackItr != tc1->end(); trackItr++){ - const TrigMuonEFInfoTrack* muonInfo1 = (*trackItr); - if( muonInfo1->hasExtrapolatedTrack() ){ - TrigMuonEFTrack* eTrack1 = muonInfo1->ExtrapolatedTrack(); - - // std::cout << "RoI " << muoninfo1->RoINum() << " extrapolated track " << *eTrack1 << std::endl; - for( unsigned roiIt2 = 0; roiIt2 < muons.size(); roiIt2++ ){ - if( roiIt1 != roiIt2 ){ - Trig::Feature< TrigMuonEFInfoContainer > trackFeature2 = muons.at(roiIt2); - const TrigMuonEFInfoContainer* trigMuon2 = trackFeature2.cptr(); - TrigMuonEFInfoContainer::const_iterator muonItr2 = trigMuon2->begin(); - const TrigMuonEFInfo* muoninfo2 = (*muonItr2); - if( !initRois.empty() ){ - const TrigRoiDescriptor* roid2 = initRois[roiIt2].cptr(); - TIDARoiDescriptor roiInfo2 = TIDARoiDescriptorBuilder(*roid2); - - if( muoninfo2->hasTrack() ){ - const TrigMuonEFInfoTrackContainer* tc2 = muoninfo2->TrackContainer(); - for( TrigMuonEFInfoTrackContainer::const_iterator trackItr = tc2->begin(); trackItr != tc2->end(); trackItr++){ - const TrigMuonEFInfoTrack* muonInfo2 = (*trackItr); - if( muonInfo2->hasExtrapolatedTrack() ){ - TrigMuonEFTrack* eTrack2 = muonInfo2->ExtrapolatedTrack(); - // std::cout << "RoI " << muoninfo2->RoINum() << " extrapolated track " << *eTrack2 << std::endl; - double deta = getEtaDistance(eTrack1->eta(), eTrack2->eta()); - double dphi = getPhiDistance(eTrack1->phi(), eTrack2->phi()); - - if( muoninfo1->RoINum() != muoninfo2->RoINum() && ((std::fabs(deta) < 0.08) && (std::fabs(dphi) < 0.08)) ){ - double deltarT1Roi1 = getEtaPhiDistance(eTrack1->eta(), roiInfo1.eta(), eTrack1->phi(), roiInfo1.phi() ); - double deltarT2Roi2 = getEtaPhiDistance(eTrack2->eta(), roiInfo2.eta(), eTrack2->phi(), roiInfo2.phi() ); - - if( deltarT1Roi1 > deltarT2Roi2 ){ - eTrack1 = eTrack2; - // std::cout << "Switched!" << std::endl; - } - }//check duplcates - pick 1 closest to centre of its RoI - } - } - } - } - }//roi1!=roi2 - }//start 2nd RoI loop - - for( std::vector<const TrigMuonEFTrack*>::const_iterator setIt = muonExtrapolatedTracks.begin(); setIt != muonExtrapolatedTracks.end(); ++setIt){ - double deta = getEtaDistance( (*setIt)->eta(), eTrack1->eta() ); - double dphi = getPhiDistance( (*setIt)->phi(), eTrack1->phi() ); - if( (std::fabs(deta) < 0.08) && (std::fabs(dphi) < 0.08) ){ - selected = true; - } - } - if( !selected ){ - muonExtrapolatedTracks.push_back(eTrack1); - // std::cout << "\nExtrapolatedTrack1 inserted." << *eTrack1 << "\n" << std::endl; - } - }//extrapolated track? - } - } - } - } - // END PETER - - int MSsize = muonExtrapolatedTracks.size(); - ATH_MSG_DEBUG("getEFMSTriggerObjects: number of MStracks " << MSsize ); - - for (int iMS=0 ; iMS < MSsize; iMS++) { - double px = (*muonExtrapolatedTracks.at(iMS)).px(); //perigee->momentum()[Trk::px]; - double py = (*muonExtrapolatedTracks.at(iMS)).py(); //perigee->momentum()[Trk::py]; - double ptSquare=std::pow(px,2) + std::pow(py,2); - double charge = (*muonExtrapolatedTracks.at(iMS)).Charge(); - double pT = sqrt(ptSquare) * charge; - double eta = (*muonExtrapolatedTracks.at(iMS)).eta(); - double phi = (*muonExtrapolatedTracks.at(iMS)).phi(); - - ATH_MSG_DEBUG("getEFMSTriggerObjects: track " << iMS << " Pt eta phi " << pT << " / " << eta << " / " << phi ); - // store ntuple info - TrigObject trigObjectEF; - trigObjectEF.names.push_back(chain); - trigObjectEF.eta = eta; - trigObjectEF.phi = phi; - trigObjectEF.pt = pT; - trigObjectEF.q = charge; - trigObjectEF.id = (int64_t) (muonExtrapolatedTracks.at(iMS)); - trigObjectEF.parentId = -1; - trigObjectEF.grandparentId = -1; - //trigObjectEF.daughterIds.push_back(-1); - trigObjectEF.combIds.push_back(iComb); - trigObjectEF.efObjIds.push_back(iMS); - trigObjectEF.type = EXTRAPOLATED; //2999; - addTrigObject(trigObjectEF, muonsEF, m_appendEFIfExists); - } // end loop over tracks - } - return true; -} - - -bool -TrigEffJpsiTools::getBPhysL2TriggerObjects(const std::string& chain, - TrigObjectMap* muonsL2, - TrigObjectMap* muonsL1) const -{ - ATH_MSG_DEBUG("TrigEffJpsiTools::getBPhysL2TriggerObjects() : " << chain); - int nTrig=-1; - bool muTrkJpsi = (chain.find("_mu") && chain.find("Trk")); // Checks if chain is a mu+Trk chain. Notice: Case sensitive! - - for (unsigned int iTrig=0; iTrig < m_Btrig_L2_chain.size(); iTrig++) { - if (m_Btrig_L2_chain[iTrig] == chain) nTrig=iTrig; - } - if (m_useManualHypoCuts) { - if (nTrig<0) { - ATH_MSG_WARNING("getBPhysL2TriggerObjects: do not have HYPO cuts for chain " << chain); - return true; - } - ATH_MSG_DEBUG("getBPhysL2TriggerObjects: cuts for chain " << chain); - ATH_MSG_DEBUG("getBPhysL2TriggerObjects: mass : " << m_Btrig_L2_massMin[nTrig] << " - " << m_Btrig_L2_massMax[nTrig]); - ATH_MSG_DEBUG("getBPhysL2TriggerObjects: applyMassMax " << m_Btrig_L2_applyMassMax[nTrig]); - ATH_MSG_DEBUG("getBPhysL2TriggerObjects: checkOS " << m_Btrig_L2_checkOS[nTrig]); - ATH_MSG_DEBUG("getBPhysL2TriggerObjects: nHits " << m_Btrig_L2_nHits[nTrig]); - ATH_MSG_DEBUG("getBPhysL2TriggerObjects: chi2 " << m_Btrig_L2_chi2[nTrig]); - } - - - const Trig::FeatureContainer fc = m_trigDecisionTool->features(chain); - const std::vector<Trig::Combination>& combinations = fc.getCombinations(); - ATH_MSG_DEBUG("getBPhysL2TriggerObjects: number of combinations: " << combinations.size()); - - std::vector<Trig::Combination>::const_iterator cit; - int iComb = 1; - for (cit = combinations.begin(); cit != combinations.end(); ++cit, ++iComb) { // Loop over combinations - const Trig::Combination& combination = *cit; - if (not combination.active()) { - ATH_MSG_DEBUG("getBPhysL2TriggerObjects: combination " << combination << " is not active"); - continue; - } - ATH_MSG_DEBUG("getBPhysL2TriggerObjects: combination " << combination << " is active"); - - - const std::vector<const HLT::TriggerElement*> tes = combination.tes(); - std::vector<const HLT::TriggerElement*>::const_iterator tesIt; - int iTrigElement = 0; - ATH_MSG_DEBUG("Trigger elements: " << tes.size()); - for (tesIt = tes.begin(); tesIt != tes.end(); ++tesIt, ++iTrigElement) { - ATH_MSG_DEBUG("Trigger element #" << iTrigElement << ": id = " << (*tesIt)->getId() << " activeState = " << (*tesIt)->getActiveState()); - } - - std::vector<Trig::Feature<TrigL2Bphys> > triggerFeatures = combination.get<TrigL2Bphys>(); - std::vector<Trig::Feature<TrigL2Bphys> >::const_iterator tfIt; - int iObj = 0; - ATH_MSG_DEBUG("Trigger features: " << triggerFeatures.size()); - for (tfIt = triggerFeatures.begin(); tfIt != triggerFeatures.end(); ++tfIt, ++iObj) { // Loop over trigger features - if(tfIt->te()) ATH_MSG_DEBUG("Trigger feature #" << iObj << ": id = " << tfIt->te()->getId() << " activeState = " << tfIt->te()->getActiveState()); - - Trig::Feature<TrigL2Bphys> triggerFeature = *tfIt; - const TrigL2Bphys* trigObj = triggerFeature.cptr(); - Trig::Feature<Muon_ROI> muonL1Feature = m_trigDecisionTool->ancestor<Muon_ROI>(triggerFeature); - const Muon_ROI* muonL1 = muonL1Feature.cptr(); - - const ElementLinkVector<TrigInDetTrackCollection> trackVector = trigObj->trackVector(); - // check broken ElementLinks - if( !trackVector.at(0).isValid() || !trackVector.at(1).isValid() ) { - ATH_MSG_WARNING("Broken ElementLink. Chain = " << chain); - continue; - } - int nTracks = trackVector.size(); - ATH_MSG_DEBUG("Number of tracks in vertex: " << nTracks); - if (nTracks != 2) { - ATH_MSG_ERROR("Number of trigger tracks in J/psi vertex differs from 2"); - continue; - } - - const TrigInDetTrack* trigObjTracks[2] = { *(trackVector.at(0)), *(trackVector.at(1)) }; - if ( trigObjTracks[0]->param() == NULL || trigObjTracks[1]->param() == NULL) { - ATH_MSG_ERROR("Some trigger tracks are without fitted parameters"); - continue; - } - - bool passedHypo = m_useManualHypoCuts ? selectL2TrigDiMuon(trigObj, - trigObjTracks[0], - trigObjTracks[1], - m_Btrig_L2_checkOS[nTrig], - m_Btrig_L2_massMin[nTrig], - m_Btrig_L2_massMax[nTrig], - m_Btrig_L2_applyMassMax[nTrig], - m_Btrig_L2_nHits[nTrig], - m_Btrig_L2_chi2[nTrig]) : true; - - if (!passedHypo) { - ATH_MSG_DEBUG("This object failed hypo, will not store on ntuple"); - continue; - } - - // Get trigger object tracks - for (int iTrack = 0; iTrack < nTracks; ++iTrack) { // Loop over trigger object tracks - int64_t trkId = (int64_t) trigObjTracks[iTrack]; // TODO: Get a unique ID - const TrigInDetTrackFitPar* param = trigObjTracks[iTrack]->param(); - ATH_MSG_DEBUG("BPhys L2 comb # " << iComb <<" object # " << iObj - << " &:" << trkId - << " pt: " << param->pT() - << " eta: " << param->eta() - << " phi: " << param->phi0() - << " passHypo: " << passedHypo); - if ( muonsL2 != NULL ) { - TrackType trackType = COMBINED; - if (muTrkJpsi) { - trackType = (iTrack == 0) ? COMBINED : IDONLY; - } - TrigObject trigObjectL2; - trigObjectL2.names.push_back(chain); - trigObjectL2.eta = param->eta(); - trigObjectL2.phi = param->phi0(); - trigObjectL2.pt = param->pT(); - trigObjectL2.q = param->pT() > 0.0 ? 1 : -1 ; - trigObjectL2.id = trkId; - trigObjectL2.parentId = (muonL1 != NULL) ? muonL1->getROIWord() : -1; - trigObjectL2.grandparentId = -1; - trigObjectL2.combIds.push_back(1000*iComb + iObj); - trigObjectL2.efObjIds.push_back(-1); - trigObjectL2.type = trackType; - addTrigObject(trigObjectL2, muonsL2, m_appendL2IfExists); - } - } // End loop over trigger object tracks - - if ( muonL1 != NULL ) { - ATH_MSG_DEBUG(" parent: &:" << (int64_t) muonL1 - << " pt: " << muonL1->pt() - << " eta: " << muonL1->eta() - << " phi: " << muonL1->phi() - << " word: " << muonL1->getROIWord() ); - if ( muonsL1 != NULL) { - TrigObject trigObjectL1; - int charge = -99; - switch (muonL1->getCharge()) { - case Muon_ROI::Pos: charge = 1; break; - case Muon_ROI::Neg: charge = -1; break; - default: - charge = -99; - ATH_MSG_WARNING("muonL1 charge not defined " << muonL1->getCharge()); - } - trigObjectL1.names.push_back(chain); - trigObjectL1.eta = muonL1->eta(); - trigObjectL1.phi = muonL1->phi(); - trigObjectL1.pt = muonL1->pt(); - trigObjectL1.q = charge; - trigObjectL1.id = muonL1->getROIWord(); - trigObjectL1.parentId = -1; - trigObjectL1.grandparentId = -1; - trigObjectL1.combIds.push_back(iObj); - trigObjectL1.efObjIds.push_back(-1); - trigObjectL1.type = SPECTROMETER; - addTrigObject(trigObjectL1, muonsL1, m_appendL1IfExists); - } - } else ATH_MSG_WARNING("getBPhysL2TriggerObjects(): muonL1 is NULL"); - } // End loop over trigger features - } // End loop over combinations - - return true; -} - -bool -TrigEffJpsiTools::getBPhysEFTriggerObjects(const std::string& chain, - TrigObjectMap* muonsEF, - TrigObjectMap* /*muonsL2*/, - TrigObjectMap* muonsL1) const -{ - // TOOD: Finish this - ATH_MSG_DEBUG("TrigEffJpsiTools::getBPhysEFTriggerObjects() : " << chain); - int nTrig = -1; - bool muTrkJpsi = (chain.find("_mu") && chain.find("Trk")); // Checks if chain is a mu+Trk chain. Notice: Case sensitive! - - for (unsigned int iTrig=0; iTrig < m_Btrig_EF_chain.size(); iTrig++) { - if (m_Btrig_EF_chain[iTrig] == chain) nTrig=iTrig; - } - - if (m_useManualHypoCuts) { - if (nTrig<0) { - ATH_MSG_WARNING("getBPhysEFTriggerObjects: do not have HYPO cuts for chain " << chain); - return true; - } - ATH_MSG_DEBUG("getBPhysEFTriggerObjects: cuts for chain " << chain); - ATH_MSG_DEBUG("getBPhysEFTriggerObjects: mass : " << m_Btrig_EF_massMin[nTrig] << " -> " << m_Btrig_EF_massMax[nTrig]); - ATH_MSG_DEBUG("getBPhysEFTriggerObjects: applyMassMax " << m_Btrig_EF_applyMassMax[nTrig]); - ATH_MSG_DEBUG("getBPhysEFTriggerObjects: checkOS " << m_Btrig_EF_checkOS[nTrig]); - ATH_MSG_DEBUG("getBPhysEFTriggerObjects: chi2 " << m_Btrig_EF_chi2[nTrig]); - } - - // Getting the chain's features: - const Trig::FeatureContainer fc = m_trigDecisionTool->features(chain/*, TrigDefs::alsoDeactivateTEs*/ ); - const std::vector<Trig::Combination>& combinations = fc.getCombinations(); - ATH_MSG_DEBUG("getBPhysEFTriggerObjects: number of combinations: " << combinations.size()); - - std::vector<Trig::Combination>::const_iterator cit; - int iComb = 1; - for (cit = combinations.begin(); cit != combinations.end(); ++cit, ++iComb) { // Loop over combinations - const Trig::Combination& combination = *cit; - if (not combination.active()) { - ATH_MSG_DEBUG("getBPhysEFTriggerObjects: combination " << combination << " is not active"); - continue; - } - ATH_MSG_DEBUG("getBPhysEFTriggerObjects: combination " << combination << " is active"); - - - const std::vector<const HLT::TriggerElement*> tes = combination.tes(); - std::vector<const HLT::TriggerElement*>::const_iterator tesIt; - int iTrigElement = 0; - ATH_MSG_DEBUG("Trigger elements: " << tes.size()); - for (tesIt = tes.begin(); tesIt != tes.end(); ++tesIt, ++iTrigElement) { - ATH_MSG_DEBUG("Trigger element #" << iTrigElement << ": id = " << (*tesIt)->getId() << " activeState = " << (*tesIt)->getActiveState()); - } - - std::vector<Trig::Feature<TrigEFBphys> > triggerFeatures = combination.get<TrigEFBphys>(); - std::vector<Trig::Feature<TrigEFBphys> >::const_iterator tfIt; - int iObj = 0; - ATH_MSG_DEBUG("Trigger features: " << triggerFeatures.size()); - for (tfIt = triggerFeatures.begin(); tfIt != triggerFeatures.end(); ++tfIt, ++iObj) { // Loop over trigger features - if(tfIt->te()) ATH_MSG_DEBUG("Trigger feature #" << iObj << ": id = " << tfIt->te()->getId() << " activeState = " << tfIt->te()->getActiveState()); - - - Trig::Feature<TrigEFBphys> triggerFeature = *tfIt; - const TrigEFBphys* trigObj = triggerFeature.cptr(); - Trig::Feature<Muon_ROI> muonL1Feature = m_trigDecisionTool->ancestor<Muon_ROI>(triggerFeature); - const Muon_ROI* muonL1 = muonL1Feature.cptr(); - if (muonL1 != NULL) ATH_MSG_DEBUG(" L1 muon feature: " << muonL1->getROIWord()); - Trig::Feature<TrigL2Bphys> muonL2Feature = m_trigDecisionTool->ancestor<TrigL2Bphys>(triggerFeature); - ATH_MSG_DEBUG(" L2 muon feature: " << (int64_t) muonL2Feature.te() ); - const TrigL2Bphys* muonL2 = muonL2Feature.cptr(); - - const ElementLinkVector<Rec::TrackParticleContainer> trackVector = trigObj->trackVector(); - // check broken ElementLinks - if( !trackVector.at(0).isValid() || !trackVector.at(1).isValid() ) { - ATH_MSG_WARNING("Broken ElementLink. Chain = " << chain); - continue; - } - int nTracks = trackVector.size(); - ATH_MSG_DEBUG("Number of tracks in vertex: " << nTracks); - if (nTracks != 2) { - ATH_MSG_ERROR("Number of trigger tracks in J/psi vertex differs from 2"); - continue; - } - - const Rec::TrackParticle* trigObjTracks[2] = { *(trackVector.at(0)), *(trackVector.at(1)) }; - const TrigInDetTrack* l2Tracks[2] = { NULL, NULL }; - if (muonL2 != NULL) { - l2Tracks[0] = *(muonL2->trackVector().at(0)); - l2Tracks[1] = *(muonL2->trackVector().at(1)); - } - // if ( trigObjTracks[0]->param() == NULL || trigObjTracks[1]->param() == NULL) { - // ATH_MSG_ERROR("Some trigger tracks are without fitted parameters"); - // continue; - // } - - // check HYPO cuts - need to make these explicitly now, in 2011 will be able to use TrigPassBits - ATH_MSG_DEBUG("B trigger mass ( " << chain << ") = " << trigObj->mass() ); - bool passedHypo = m_useManualHypoCuts ? selectEFTrigDiMuon(trigObj, - trigObjTracks[0], - trigObjTracks[1], - m_Btrig_EF_checkOS[nTrig], - m_Btrig_EF_massMin[nTrig], - m_Btrig_EF_massMax[nTrig], - m_Btrig_EF_applyMassMax[nTrig], - m_Btrig_EF_chi2[nTrig]) : true; - - if (!passedHypo) { - ATH_MSG_DEBUG("This object failed hypo, will not store on ntuple"); - continue; - } - - // Get trigger object tracks - for (int iTrack = 0; iTrack < nTracks; ++iTrack) { // Loop over trigger object tracks - int64_t trkId = (int64_t) trigObjTracks[iTrack]; // TODO: Get a unique ID - int64_t parentId = (int64_t) l2Tracks[iTrack]; - ATH_MSG_DEBUG("BPhys EF comb # " << iComb <<" object # " << iObj - << " &:" << trkId - << " pt: " << trigObjTracks[iTrack]->pt() - << " eta: " << trigObjTracks[iTrack]->eta() - << " phi: " << trigObjTracks[iTrack]->phi() - << " passHypo: " << passedHypo); - if ( muonsEF != NULL ) { - TrackType trackType = COMBINED; - if (muTrkJpsi) { - trackType = (iTrack == 0) ? COMBINED : IDONLY; - } - - TrigObject trigObjectEF; - trigObjectEF.names.push_back(chain); - trigObjectEF.eta = trigObjTracks[iTrack]->eta(); - trigObjectEF.phi = trigObjTracks[iTrack]->phi(); - - int charge = trigObjTracks[iTrack]->measuredPerigee()->parameters()[Trk::qOverP] > 0 ? 1. : -1. ; - trigObjectEF.pt = charge * trigObjTracks[iTrack]->pt(); - trigObjectEF.q = charge; - trigObjectEF.id = trkId; - trigObjectEF.parentId = parentId; -// trigObjectEF.parentId = (int64_t) muonL2; - ATH_MSG_DEBUG(" parentId = " << trigObjectEF.parentId); - trigObjectEF.grandparentId = (muonL1 != NULL) ? muonL1->getROIWord() : -1; - //trigObjectEF.daughterIds.push_back(-1); - trigObjectEF.combIds.push_back(1000*iComb + iObj); // Multiply by 1000 to differentiate BPhys trigs from single-muon ones - trigObjectEF.efObjIds.push_back(iTrack); - trigObjectEF.type = trackType; - addTrigObject(trigObjectEF, muonsEF, m_appendEFIfExists); - } - } // End loop over trigger object tracks - - - // TODO: - // Need to add muonL2 acquisition step. - // Provenance is currently working only if the L2 - // chain is specified in the BPhysL2 chains - if ( muonL1 != NULL ) { - ATH_MSG_DEBUG(" grandparent: &:" << (int64_t) muonL1 - << " pt: " << muonL1->pt() - << " eta: " << muonL1->eta() - << " phi: " << muonL1->phi() - << " word: " << muonL1->getROIWord() ); - if ( muonsL1 != NULL) { - TrigObject trigObjectL1; - int charge = -99; - switch (muonL1->getCharge()) { - case Muon_ROI::Pos: charge = 1; break; - case Muon_ROI::Neg: charge = -1; break; - default: - charge = -99; - ATH_MSG_WARNING("muonL1 charge not defined " << muonL1->getCharge()); - } - trigObjectL1.names.push_back(chain); - trigObjectL1.eta = muonL1->eta(); - trigObjectL1.phi = muonL1->phi(); - trigObjectL1.pt = muonL1->pt(); - trigObjectL1.q = charge; - trigObjectL1.id = muonL1->getROIWord(); - trigObjectL1.parentId = -1; - trigObjectL1.grandparentId = -1; - //trigObjectL1.daughterIds.push_back((int64_t) muonL2); - trigObjectL1.combIds.push_back(iObj); - trigObjectL1.efObjIds.push_back(-1); - trigObjectL1.type = SPECTROMETER; - addTrigObject(trigObjectL1, muonsL1, m_appendL1IfExists); - } - } else ATH_MSG_WARNING("getBPhysEFTriggerObjects(): muonL1 is NULL"); - } // End loop over trigger features - } // End loop over combinations - - return true; -} - - -int -TrigEffJpsiTools::muctpiBcidDiff(const int roiBcid) const -{ - const EventInfo* eventInfo = 0; - if (evtStore()->retrieve(eventInfo).isFailure()) { - ATH_MSG_WARNING("muctpiBcidDiff: couldn't retrieve EventInfo"); - return 0; - } - const unsigned int eventBcid = eventInfo->event_ID()->bunch_crossing_id(); - - int diff = roiBcid - (eventBcid & 0x7); - switch (eventBcid) { - case 0: // cannot distinguish 3563 and 3, 3562 and 2, 3561 and 1 - if (roiBcid == 3) { - diff = -1; - } else if (roiBcid == 2) { - diff = -2; - } else if (roiBcid == 1) { - diff = -3; - } - break; - - case 1: // cannot distinguish 3563 and 3, 3562 and 2 - if (roiBcid == 3) { - diff = -2; - } else if (roiBcid == 2) { - diff = -3; - } - break; - - case 2: // cannot distinguish 3563 and 3 - if (roiBcid == 3) { - diff = -3; - } - break; - - default: - break; - } - - if (abs(diff) > 4) { - diff = (8 - abs(diff)) * ((diff < 0) ? 1 : -1); - } - - return diff; -} - - -int -TrigEffJpsiTools::getMuonRoiBcidDiff(const uint32_t roiWord) const -{ - ATH_MSG_DEBUG("TrigEffJpsiTools::getMuonRoiBcidDiff()"); - - const EventInfo* eventInfo = 0; - if (evtStore()->retrieve(eventInfo).isFailure()) { - ATH_MSG_WARNING("getMuonRoiBcidDiff: couldn't retrieve EventInfo"); - return 0; - } - const unsigned int eventBcid = eventInfo->event_ID()->bunch_crossing_id(); - - // Create the RoI vector from the RDO data: - const std::string key = "MUCTPI_RDO"; - const MuCTPI_RDO* muctpi_rdo = 0; - if (evtStore()->retrieve(muctpi_rdo, key).isFailure()) { - ATH_MSG_WARNING("TrigEffJpsiTools::getMuonRoiBcidDiff: couldn't retrieve " << key); - return 0; - } - ATH_MSG_VERBOSE("Retrieved the MuCTPI_RDO object with key: " - << key); - - ATH_MSG_VERBOSE("Now creating the RoIs in extended bunches..."); - MuCTPI_MultiplicityWord_Decoder mwDecoder(muctpi_rdo->candidateMultiplicity()); - uint32_t currentBcid = mwDecoder.getBCID(); - if (currentBcid != (eventBcid & 0x7)) { - ATH_MSG_WARNING("MuonRoiWithExtendedBunches: BCID mis-match: " << eventBcid << ":" << currentBcid); - return 0; - } - - // Loop over all "data words" and calculate bunch crossing difference of the given roiWord - ATH_MSG_VERBOSE("found " << muctpi_rdo->dataWord().size() << " muctpi_rdo dataWords"); - - std::vector<uint32_t>::const_iterator cit = muctpi_rdo->dataWord().begin(); - std::vector<uint32_t>::const_iterator end = muctpi_rdo->dataWord().end(); - for(; cit != end; ++cit) { - if (roiWord != RDOtoRoI(*cit)) continue; - - MuCTPI_DataWord_Decoder dwDecoder(*cit); - uint32_t bcid = dwDecoder.getBCID(); - int bcDiff = muctpiBcidDiff(bcid); - ATH_MSG_DEBUG(std::dec << bcid << " : " << currentBcid << " diff = " << bcDiff); - return bcDiff; - } - - ATH_MSG_WARNING("TrigEffJpsiTools::getMuonRoiBcidDiff: " - "No corresponding RoI found: " << roiWord); - return 10000; -} - - -bool -TrigEffJpsiTools::isOffTimeTgcTrigger() const -{ - ATH_MSG_DEBUG("TrigEffJpsiTools::isOffTimeTgcTrigger()"); - - // apply for the run periods D2...D5 [158443, 159113] - const EventInfo* eventInfo; - StatusCode sc = evtStore()->retrieve(eventInfo); - if (sc.isFailure()) { - ATH_MSG_WARNING("failed to get EventInfo"); - return false; - } - const EventID* eventId = eventInfo->event_ID(); - int runNumber = eventId->run_number(); - if (runNumber < 158443) return false; - if (runNumber > 159113) return false; - - - // check trigger configuration - const std::string EF_mu0_missingRoi = "EF_mu0_missingRoi"; - if (not isConfigured(EF_mu0_missingRoi, "EF")) { - ATH_MSG_WARNING(EF_mu0_missingRoi << "not configured"); - return false; - } - - const std::string EF_mu0_rpcOnly = "EF_mu0_rpcOnly"; - if (not isConfigured(EF_mu0_rpcOnly, "EF")) { - ATH_MSG_WARNING(EF_mu0_rpcOnly << "not configured"); - return false; - } - - const std::string EF_mu4_MSonly = "EF_mu4_MSonly"; - if (not isConfigured(EF_mu4_MSonly, "EF")) { - ATH_MSG_WARNING(EF_mu4_MSonly << "not configured"); - return false; - } - - const std::string L1_2MU0 = "L1_2MU0"; - if (not isConfigured(L1_2MU0, "L1")) { - ATH_MSG_WARNING(L1_2MU0 << "not configured"); - return false; - } - - - // accept if event has triggers other than EF_mu0_missingRoi and l1_2mu0 - bool ef_mu4_msonly = m_trigDecisionTool->isPassed(EF_mu4_MSonly); - bool ef_mu0_rpconly = m_trigDecisionTool->isPassed(EF_mu0_rpcOnly); - if (ef_mu4_msonly or ef_mu0_rpconly) return false; - - bool ef_mu0_missingRoi = m_trigDecisionTool->isPassed(EF_mu0_missingRoi); - bool l1_2mu0 = m_trigDecisionTool->isPassed(L1_2MU0); - if ((not ef_mu0_missingRoi) and (not l1_2mu0)) return false; - - - // get level1 muon rois - const LVL1_ROI* lvl1Roi = 0; - if (evtStore()->retrieve(lvl1Roi, m_Lvl1RoiName).isFailure() or - !lvl1Roi) { - ATH_MSG_WARNING("Failed to retrieve " << m_Lvl1RoiName); - return false; - } - - bool tgcOffTime = false; - - LVL1_ROI::muons_type muonRoIs = lvl1Roi->getMuonROIs(); - typedef LVL1_ROI::muons_type::const_iterator iterator; - iterator cit = muonRoIs.begin(); - iterator end = muonRoIs.end(); - - for (; cit != end; cit++) { - bool inTime = false; - int bcDiff = getMuonRoiBcidDiff(cit->getROIWord()); - switch (bcDiff) { - case -2: - case -1: - case 0: - inTime = true; - break; - - default: - break; - } - - if (inTime and (cit->getSource() == Muon_ROI::Barrel)) return false; - if (inTime and (bcDiff < 0)) tgcOffTime = true; - } - - return tgcOffTime; -} - - -bool -TrigEffJpsiTools::EF_mu4_MSOnly_from_EF_mu0_outOfTime1() const -{ - const std::string L2_mu0_outOfTime1 = "L2_mu0_outOfTime1"; - - if (not m_trigDecisionTool->isPassed("EF_mu0_outOfTime1")) return false; - if (not m_trigDecisionTool->isPassed(L2_mu0_outOfTime1)) return false; - - Trig::FeatureContainer fc = m_trigDecisionTool->features(L2_mu0_outOfTime1); - std::vector<Trig::Feature<MuonFeature> > l2muons = fc.get<MuonFeature>(); - std::vector<Trig::Feature<MuonFeature> >::const_iterator cit; - for (cit = l2muons.begin(); cit != l2muons.end(); cit++) { - const MuonFeature* l2mf = cit->cptr(); - if (EF_mu4_MSOnly_with_Muid(l2mf)) return true; - } - - return false; -} - - -/*--------------------------------------------------------------------* - * private methods - *--------------------------------------------------------------------*/ -void -TrigEffJpsiTools::getExtrapolationErrorOnEndcap(const Trk::AtaDisc* p, - Amg::Vector2D* dEtaPhi) const -{ - if (!p or !dEtaPhi) { - ATH_MSG_WARNING("getExtrapolationErrorOnEndcap: null input pointer"); - return; - } - - (*dEtaPhi)[Trk::locX] = getEtaErrFromRPhi(p); - - (*dEtaPhi)[Trk::locY] = 9999.; - const AmgSymMatrix(5) *covMatrix = p->covariance(); - if(covMatrix){ - (*dEtaPhi)[Trk::locY] = sqrt((*covMatrix)(Trk::locPhi, Trk::locPhi)); - } -} - - -void -TrigEffJpsiTools::getExtrapolationErrorOnBarrel(const Trk::AtaCylinder* p, - Amg::Vector2D* dEtaPhi) const -{ - if (!p or !dEtaPhi) { - ATH_MSG_WARNING("getExtrapolationErrorOnBarrel: null input pointer"); - return; - } - - double radius = p->position().perp(); - (*dEtaPhi)[Trk::locX] = getEtaErrFromRPhiZ(p); - (*dEtaPhi)[Trk::locY] = 9999.; - const AmgSymMatrix(5) *covMatrix = p->covariance(); - if(covMatrix){ - (*dEtaPhi)[Trk::locY] = sqrt((*covMatrix)(Trk::locRPhi, Trk::locRPhi))/radius; - } -} - - -// dR limit to match -double -TrigEffJpsiTools::getSearchRangeOnEndcap(const Trk::AtaDisc* p) const -{ - if (!p) { - ATH_MSG_WARNING("getSearchRangeOnEndcap: null input pointer"); - return false; - } - - Amg::Vector2D dEtaPhi; - getExtrapolationErrorOnEndcap(p, &dEtaPhi); - double searchRange = m_searchRangeOffset + m_searchRangeTolerance * - sqrt(dEtaPhi.x()*dEtaPhi.x() + dEtaPhi.y()*dEtaPhi.y()); - - double eta = p->position().eta(); - if (fabs(eta) > m_endcapForwardBoundary) { - searchRange += m_roiSizeForward; - } else { - searchRange += m_roiSizeEndcap; - } - return searchRange; -} - - -double -TrigEffJpsiTools::getSearchRangeOnBarrel(const Trk::AtaCylinder* p) const -{ - if (!p) { - ATH_MSG_WARNING("getSearchRangeOnBarrel: null input pointer"); - return false; - } - - Amg::Vector2D dEtaPhi; - getExtrapolationErrorOnBarrel(p, &dEtaPhi); - double searchRange = m_searchRangeOffset + m_searchRangeTolerance * - sqrt(dEtaPhi.x()*dEtaPhi.x() + dEtaPhi.y()*dEtaPhi.y()) + - m_roiSizeBarrel; - return searchRange; -} - - -double TrigEffJpsiTools::getEtaPhiDistanceAtIp(const Rec::TrackParticle* track1, - const Rec::TrackParticle* track2) const -{ - if (!track1 or !track2) { - ATH_MSG_WARNING("getEtaPhiDistanceAtIp: null input pointer"); - return -1.; - } - - double eta[2] = {track1->eta(), track2->eta()}; - double phi[2] = {track1->phi(), track2->phi()}; - return getEtaPhiDistance(eta[0], eta[1], phi[0], phi[1]); -} - - -double -TrigEffJpsiTools::getEtaPhiDistanceOnEndcap(const Trk::AtaDisc* p1, - const Trk::AtaDisc* p2) const -{ - if (!p1 or !p2) { - ATH_MSG_WARNING("getEtaPhiDistanceOnEndcap: null input pointer"); - return -1.; - } - - return getEtaPhiDistance(p1->position().eta(), p2->position().eta(), - p1->position().phi(), p2->position().phi()); -} - - -double -TrigEffJpsiTools::getEtaPhiDistanceOnBarrel(const Trk::AtaCylinder* p1, - const Trk::AtaCylinder* p2) const -{ - if (!p1 or !p2) { - ATH_MSG_WARNING("getEtaPhiDistanceOnBarrel: null input pointer"); - return -1.; - } - - return getEtaPhiDistance(p1->position().eta(), p2->position().eta(), - p1->position().phi(), p2->position().phi()); -} - - -double -TrigEffJpsiTools::getEtaPhiDistance(double eta1, - double eta2, - double phi1, - double phi2) const -{ - double deta = getEtaDistance(eta1, eta2); - double dphi = getPhiDistance(phi1, phi2); - - double dr = sqrt(deta*deta + dphi*dphi); - return dr; -} - - -double -TrigEffJpsiTools::getEtaDistance(double eta1, - double eta2) const -{ - return fabs(eta1 - eta2); -} - - -double -TrigEffJpsiTools::getPhiDistance(double phi1, - double phi2) const -{ - double dphi = fabs(phi1 - phi2); - - if (dphi > M_PI) dphi = 2.*M_PI - dphi; - return dphi; -} - - -bool -TrigEffJpsiTools::isSeparated(const Rec::TrackParticle* track1, - const Rec::TrackParticle* track2) const -{ - if (!track1 or !track2) { - ATH_MSG_WARNING("isSeparated: null input pointer"); - return false; - } - - return isSeparatedOnEndcap(track1, track2) and - isSeparatedOnBarrel(track1, track2); - -} - -bool -TrigEffJpsiTools::isSeparatedOnEndcap(const Rec::TrackParticle* track1, - const Rec::TrackParticle* track2) const -{ - if (!track1 or !track2) { - ATH_MSG_WARNING("isSeparatedOnEndcap: null input pointer"); - return false; - } - - bool isSeparated = true; - - double pivotZ1 = track1->eta() < 0. ? -m_endcapPivotPlaneZ : m_endcapPivotPlaneZ; - const Trk::AtaDisc* measurement1 = extrapolateToEndcap(track1, pivotZ1); - double pivotZ2 = track2->eta() < 0. ? -m_endcapPivotPlaneZ : m_endcapPivotPlaneZ; - const Trk::AtaDisc* measurement2 = extrapolateToEndcap(track2, pivotZ2); - - if (measurement1 and measurement2) { - double searchRange = getSearchRangeOnEndcap(measurement1) + - getSearchRangeOnEndcap(measurement2); - double dr = getEtaPhiDistanceOnEndcap(measurement1, measurement2); - if (dr < searchRange) isSeparated = false; - } - - delete measurement1; - delete measurement2; - - return isSeparated; -} - -bool -TrigEffJpsiTools::isSeparatedOnBarrel(const Rec::TrackParticle* track1, - const Rec::TrackParticle* track2) const -{ - if (!track1 or !track2) { - ATH_MSG_WARNING("isSeparatedOnBarrel: null input pointer"); - return false; - } - - bool isSeparated = true; - - double pivotRadius = m_barrelPivotPlaneRadius; - const Trk::AtaCylinder* measurement1 = extrapolateToBarrel(track1, pivotRadius); - const Trk::AtaCylinder* measurement2 = extrapolateToBarrel(track2, pivotRadius); - - if (measurement1 and measurement2) { - double searchRange = getSearchRangeOnBarrel(measurement1) + - getSearchRangeOnBarrel(measurement2); - double dr = getEtaPhiDistanceOnBarrel(measurement1, measurement2); - if (dr < searchRange) isSeparated = false; - } - - delete measurement1; - delete measurement2; - - return isSeparated; -} - - -//--- convert local errors to global ---// -// Disc to global -double -TrigEffJpsiTools::getEtaErrFromRPhi(const Trk::AtaDisc* p) const -{ - if (!p) { - ATH_MSG_WARNING("getEtaErrFromRPhi: null input pointer"); - return -1; - } - - double localR = p->localPosition().x(); - double globalZ = p->position().z(); - double dLocalR = 9999.; - const AmgSymMatrix(5) *covMatrix = p->covariance(); - if(covMatrix){ - dLocalR = sqrt((*covMatrix)(Trk::locR, Trk::locR)); - } - - double radius = sqrt(localR*localR + globalZ*globalZ); - double etaError = fabs(globalZ/localR/radius*dLocalR); - return etaError; -} - - -// Cylinder to global -double -TrigEffJpsiTools::getEtaErrFromRPhiZ(const Trk::AtaCylinder* p) const -{ - if (!p) { - ATH_MSG_WARNING("getEtaErrFromRPhiZ: null input pointer"); - return -1; - } - - double localR = p->position().perp(); - double localZ = p->localPosition().y(); - double dLocalZ = 9999.; - const AmgSymMatrix(5) *covMatrix = p->covariance(); - if(covMatrix){ - dLocalZ = sqrt((*covMatrix)(Trk::locZ, Trk::locZ)); - } - - double radius = sqrt(localR*localR + localZ*localZ); - double etaError = fabs(1./radius*dLocalZ); - return etaError; -} - - - -void -TrigEffJpsiTools::validateCache(Cache& map) const -{ - const EventInfo* eventInfo = 0; - if (evtStore()->retrieve(eventInfo).isFailure() or !eventInfo) { - ATH_MSG_WARNING("validateCache: Failed to retrieve EventInfo"); - return; - } - - const EventID* eventId = eventInfo->event_ID(); - if (!eventId) { - ATH_MSG_WARNING("validateCache: Failed to get EventID"); - return; - } - - if (((map.runNo == eventId->run_number()) and // new evt - (map.evtNo != eventId->event_number())) or - (map.runNo != eventId->run_number())) { // new run - map.runNo = eventId->run_number(); - map.evtNo = eventId->event_number(); - ATH_MSG_DEBUG("validateCache: clear cache: " << map.runNo << - ", " << map.evtNo); - CacheMap::const_iterator cit; - for (cit = map.tp.begin(); cit != map.tp.end(); cit++) { - delete cit->second; - } - map.tp.clear(); - } - - return; -} - - - -const Trk::AtaDisc* -TrigEffJpsiTools::extrapolateToEndcap(const Rec::TrackParticle *track, - const double pivotZ, - const bool useCache) const -{ - if (!track) { - ATH_MSG_WARNING("extrapolateToEndcap: null input pointer"); - return 0; - } - - if (useCache) { - validateCache(m_cacheEndcap); - CacheMap::const_iterator cit; - cit = m_cacheEndcap.tp.find(track); - if (cit != m_cacheEndcap.tp.end()) { - // ATH_MSG_DEBUG("extrapolateToEndcap: use cache: " << track); // TODO: Removed as track dump segfaults in 17.3.1 - if (cit->second) - return dynamic_cast<const Trk::AtaDisc*>(cit->second); - return 0; - } - - m_cacheEndcap.tp.insert(CachePair(track, 0)); - } - // ATH_MSG_DEBUG("extrapolateToEndcap: " << *track); // TODO: Removed as track dump segfaults in 17.3.1 - - - const Trk::Perigee *perigee = track->measuredPerigee(); - if (!perigee) { - ATH_MSG_WARNING("extrapolateToEndcap: null perigee"); - return 0; - } - - Amg::Vector3D endcapCentre(0., 0., pivotZ); - Amg::Transform3D* matrix = new Amg::Transform3D(Amg::RotationMatrix3D::Identity(), endcapCentre); - - Trk::DiscSurface* disc = - new Trk::DiscSurface(matrix, - m_endcapPivotPlaneMinimumRadius, - m_endcapPivotPlaneMaximumRadius); - if (!disc) { - ATH_MSG_WARNING("new Trk::DiscSurface failed."); - delete matrix; - matrix = 0; - return 0; - } - - bool boundaryCheck = true; - const Trk::Surface* surface = disc; - const Trk::TrackParameters* p = m_extrapolator->extrapolate(*perigee, - *surface, - Trk::alongMomentum, - boundaryCheck, - Trk::muon); - delete disc; - disc = 0; - surface = 0; - matrix = 0; - - if (useCache) m_cacheEndcap.tp[track] = p; - if (!p) return 0; - const Trk::AtaDisc *measurement = - dynamic_cast<const Trk::AtaDisc*>(p); - return measurement; -} - - -const Trk::AtaCylinder* -TrigEffJpsiTools::extrapolateToBarrel(const Rec::TrackParticle *track, - const double pivotRadius, - const bool useCache) const -{ - if (!track) { - ATH_MSG_WARNING("extrapolateToBarrel: null input pointer"); - return 0; - } - - if (useCache) { - validateCache(m_cacheBarrel); - CacheMap::const_iterator cit; - cit = m_cacheBarrel.tp.find(track); - if (cit != m_cacheBarrel.tp.end()) { - ATH_MSG_DEBUG("extrapolateToBarrel: use cache: " << track); - if (cit->second) - return dynamic_cast<const Trk::AtaCylinder*>(cit->second); - return 0; - } - - m_cacheBarrel.tp.insert(CachePair(track, 0)); - } - ATH_MSG_DEBUG("extrapolateToBarrel: " << *track); - - const Trk::Perigee *perigee = track->measuredPerigee(); - if (!perigee) { - ATH_MSG_WARNING("extrapolateToBarrel: null perigee"); - return 0; - } - - Amg::Vector3D barrelCentre(0., 0., 0.); - Amg::Transform3D* matrix = new Amg::Transform3D(Amg::RotationMatrix3D::Identity(), barrelCentre); - - Trk::CylinderSurface* cylinder = - new Trk::CylinderSurface(matrix, - pivotRadius, - m_barrelPivotPlaneHalfLength); - if (!cylinder) { - ATH_MSG_WARNING("new Trk::CylinderSurface failed."); - delete matrix; - matrix = 0; - return 0; - } - - bool boundaryCheck = true; - const Trk::Surface* surface = cylinder; - const Trk::TrackParameters* p = m_extrapolator->extrapolate(*perigee, - *surface, - Trk::alongMomentum, - boundaryCheck, - Trk::muon); - delete cylinder; - cylinder = 0; - surface = 0; - matrix = 0; - - if (useCache) m_cacheBarrel.tp[track] = p; - if (!p) return 0; - const Trk::AtaCylinder* measurement = - dynamic_cast<const Trk::AtaCylinder*>(p); - return measurement; -} - - -const std::vector<const Trk::TrackStateOnSurface*>* -TrigEffJpsiTools::extrapolateToEndcapM(const Rec::TrackParticle *track, - const double pivotZ) const -{ - if (!track) { - ATH_MSG_WARNING("extrapolateToEndcapM: null input pointer"); - return 0; - } - - const Trk::Perigee *perigee = track->measuredPerigee(); - if (!perigee) { - ATH_MSG_WARNING("extrapolateToEndcapM: null perigee"); - return 0; - } - - Amg::Vector3D endcapCentre(0., 0., pivotZ); - Amg::Transform3D* matrix = new Amg::Transform3D(Amg::RotationMatrix3D::Identity(), endcapCentre); - - Trk::DiscSurface* disc = - new Trk::DiscSurface(matrix, - m_endcapPivotPlaneMinimumRadius, - m_endcapPivotPlaneMaximumRadius); - if (!disc) { - ATH_MSG_WARNING("new Trk::DiscSurface failed."); - delete matrix; - matrix = 0; - return 0; - } - - bool boundaryCheck = true; - const Trk::Surface* surface = disc; - const std::vector<const Trk::TrackStateOnSurface*>* p = - m_extrapolator->extrapolateM(*perigee, *surface, Trk::alongMomentum, - boundaryCheck, Trk::muon); - - delete disc; - disc = 0; - surface = 0; - matrix = 0; - - return p; -} - - -const std::vector<const Trk::TrackStateOnSurface*>* -TrigEffJpsiTools::extrapolateToBarrelM(const Rec::TrackParticle *track, - const double pivotRadius) const -{ - if (!track) { - ATH_MSG_WARNING("extrapolateToBarrelM: null input pointer"); - return 0; - } - - const Trk::Perigee *perigee = track->measuredPerigee(); - if (!perigee) { - ATH_MSG_WARNING("extrapolateToBarrelM: null perigee"); - return 0; - } - - Amg::Vector3D barrelCentre(0., 0., 0.); - Amg::Transform3D* matrix = new Amg::Transform3D(Amg::RotationMatrix3D::Identity(), barrelCentre); - - Trk::CylinderSurface* cylinder; - cylinder = new Trk::CylinderSurface(matrix, - pivotRadius, - m_barrelPivotPlaneHalfLength); - - if (!cylinder) { - ATH_MSG_WARNING("new Trk::CylinderSurface failed."); - delete matrix; - matrix = 0; - return 0; - } - - bool boundaryCheck = true; - const Trk::Surface* surface = cylinder; - const std::vector<const Trk::TrackStateOnSurface*>* p = - m_extrapolator->extrapolateM(*perigee, *surface, Trk::alongMomentum, - boundaryCheck, Trk::muon); - - delete cylinder; - cylinder = 0; - surface = 0; - matrix = 0; - - return p; -} - - -bool -TrigEffJpsiTools::isTriggered(const struct Search& centre, - const int thresholdNumber, - const LVL1_ROI::muons_type& muonRoIs) const -{ - typedef LVL1_ROI::muons_type::const_iterator iterator; - iterator cit_end = muonRoIs.end(); - for (iterator cit = muonRoIs.begin(); cit != cit_end; cit++) { - const Muon_ROI *roi = &(*cit); - if (roi->getThrNumber() < thresholdNumber) continue; - - double eta = roi->eta(); - double phi = roi->phi(); - double dr = getEtaPhiDistance(centre.eta, eta, centre.phi, phi); - if (dr < centre.searchRange) return true; - } - return false; -} - - -bool -TrigEffJpsiTools::isTriggeredOnEndcap(const Rec::TrackParticle* track, - LVL1_ROI::muons_type& muonRoIs, - int thresholdNumber) const -{ - if (!track) { - ATH_MSG_WARNING("isTriggeredOnEndcap: null input pointer"); - return 0; - } - - double pivotZ = track->eta() < 0. ? -m_endcapPivotPlaneZ : m_endcapPivotPlaneZ; - const Trk::AtaDisc* measurement = extrapolateToEndcap(track, pivotZ); - if (!measurement) { - ATH_MSG_DEBUG("Failed to extrapolate to endcap"); - return false; - } - - struct Search centre; - centre.eta = measurement->position().eta(); - centre.phi = measurement->position().phi(); - centre.searchRange = getSearchRangeOnEndcap(measurement); - - return isTriggered(centre, thresholdNumber, muonRoIs); -} - - -bool -TrigEffJpsiTools::isTriggeredOnBarrel(const Rec::TrackParticle* track, - LVL1_ROI::muons_type& muonRoIs, - int thresholdNumber) const -{ - if (!track) { - ATH_MSG_WARNING("isTriggeredOnBarrel: null input pointer"); - return 0; - } - - double pivotRadius = m_barrelPivotPlaneRadius; - const Trk::AtaCylinder* measurement = extrapolateToBarrel(track, - pivotRadius); - if (!measurement) { - ATH_MSG_DEBUG("Failed to extrapolate to barrel"); - return false; - } - struct Search centre; - centre.eta = measurement->position().eta(); - centre.phi = measurement->position().phi(); - centre.searchRange = getSearchRangeOnBarrel(measurement); - - //delete measurement; - return isTriggered(centre, thresholdNumber, muonRoIs); -} - - -int -TrigEffJpsiTools::getRoiRegion(int roiWord) const -{ - // ref: Muon_ROI::getSource() - unsigned int word = (unsigned int) roiWord; - unsigned int sectorAddress = ((word >> 14) & 0xff); - - if (sectorAddress & 0x80) { // endcap - return ENDCAP; - - } else if (sectorAddress & 0x40) { // forward - return ENDCAP; - - } else { // barrel - return BARREL; - } - - return -1; -} - - -unsigned int -TrigEffJpsiTools::getBitMaskValue(const unsigned int value, - const unsigned int mask) const -{ - // ref: RecMuonRoI::getBitMaskValue() - unsigned int maskcopy = mask; - unsigned int result = value & mask; - - if (mask != 0) { - while ((maskcopy & 0x00000001) == 0) { - maskcopy = maskcopy >> 1; - result = result >> 1; - } - } - return result; -} - - -StatusCode -TrigEffJpsiTools::getRoiSize(const unsigned int roiWord, - double* etaSize, - double* phiSize) const -{ - switch (getRoiRegion(roiWord)) { - case ENDCAP: - return getRoiSizeTgc(roiWord, etaSize, phiSize); - - case BARREL: - return getRoiSizeRpc(roiWord, etaSize, phiSize); - - default: - break; - } - - return StatusCode::FAILURE; -} - - -StatusCode -TrigEffJpsiTools::getRoiSizeTgc(const unsigned int roiWord, - double* etaSize, - double* phiSize) const -{ - if (!etaSize or !phiSize) { - ATH_MSG_FATAL("getRoiSizeTgc: null input pointer"); - return StatusCode::FAILURE; - } - - double etaMin, etaMax, phiMin, phiMax; - m_tgcRoiService->RoIsize(roiWord, etaMin, etaMax, phiMin, phiMax); - - *etaSize = fabs(etaMax - etaMin); - *phiSize = fabs(phiMax - phiMin); - - return StatusCode::SUCCESS; -} - - -StatusCode -TrigEffJpsiTools::getRoiSizeRpc(const unsigned int roiWord, - double* etaSize, - double* phiSize) const -{ - if (!etaSize or !phiSize) { - ATH_MSG_FATAL("getRoiSizeRpc: null input pointer"); - return StatusCode::FAILURE; - } - - // ref: RPCRecRoiSvc::reconstruct() - *etaSize = *phiSize = -1.e30; - - double etaMin, etaMax, phiMin, phiMax; - m_rpcRoiService->RoIsize(roiWord, etaMin, etaMax, phiMin, phiMax); - - *etaSize = fabs(etaMax - etaMin); - *phiSize = fabs(phiMax - phiMin); - - return StatusCode::SUCCESS; -} - -StatusCode -TrigEffJpsiTools::getRioOnTriggerChamber(const Trk::Track* track, - std::vector<const Trk::RIO_OnTrack*>& rots, - bool pivotOnly) const -{ - if (!track) { - ATH_MSG_FATAL("getRioOnTriggerChamber: null input pointer"); - return StatusCode::FAILURE; - } - - const DataVector<const Trk::TrackStateOnSurface>* tsos; - tsos = track->trackStateOnSurfaces(); - - if (!tsos or tsos->empty()) return StatusCode::SUCCESS; - - typedef DataVector<const Trk::TrackStateOnSurface>::const_iterator iterator; - iterator cit_end = tsos->end(); - for (iterator cit = tsos->begin(); cit != cit_end; cit++) { - if (not (*cit)->type(Trk::TrackStateOnSurface::Measurement)) continue; - - const Trk::MeasurementBase* measurement = (*cit)->measurementOnTrack(); - - const Trk::RIO_OnTrack* rot = 0; - Trk::RoT_Extractor::extract(rot, measurement); - if (!rot) continue; - - const Identifier id = rot->identify(); - if (not m_muonIdHelper->isMuon(id)) continue; - if (not m_muonIdHelper->isTrigger(id)) continue; - - bool isTgc = m_muonIdHelper->isTgc(id); - bool isRpc = m_muonIdHelper->isRpc(id); - - if (isTgc and isRpc) { - ATH_MSG_FATAL("rot belonging to both rpc and tgc()"); - return StatusCode::FAILURE; - } - - // ref; MuonChamberNameConverter.cxx - convertChamberName(...) - bool isPivot = false; - if (isRpc) { - const RpcIdHelper & rpcIdHelper = m_muonIdHelper->rpcIdHelper(); - switch (rpcIdHelper.stationName(id)) { - case 2: // BML - case 3: // BMS - case 8: // BMF - if (rpcIdHelper.doubletR(id) == 2) { // RPC2 - isPivot = true; - } - break; - - default: - isPivot = false; - break; - } - } - - if (isTgc) { - const TgcIdHelper & tgcIdHelper = m_muonIdHelper->tgcIdHelper(); - switch (tgcIdHelper.stationName(id)) { - case 45: // T3F - case 46: // T3E - isPivot = true; - break; - - default: - isPivot = false; - break; - } - } - - if (pivotOnly) { - if (isPivot) { - rots.push_back(rot); - } - } else { - rots.push_back(rot); - } - - } // TrackStateOnSurface - - return StatusCode::SUCCESS; -} - - -int -TrigEffJpsiTools::getL1PtThreshold(const std::string& ptname) const -{ - int pt = -1; - - if (ptname == "L1_MU0_COMM" or ptname == "MU0_COMM") { - // RPC commissioning trigger, 3-station full open - // PT3 MU10, PT4 MU0_COMM, PT5 MU15 in early 2010 data taking - // assign 11 GeV for this trigger to get valid integer. - return 11; - } - - const std::string prefix = "MU"; - const size_t found = ptname.find(prefix); - if (found == std::string::npos) { - ATH_MSG_WARNING("getL1PtThreshold: cannot parse input string: " << ptname); - return pt; - } - - const std::string delimiter = "_"; - const size_t first = ptname.find_first_of(delimiter); - if (first != ptname.find_last_of(delimiter)) { - ATH_MSG_DEBUG("getL1PtThreshold: skip " << ptname); - return pt; // consider single muon trigger only - } - - size_t offset = found + prefix.size(); - std::string value = ptname.substr(offset); - - std::istringstream iss(value); - if (not (iss >> pt)) { - ATH_MSG_WARNING("getL1PtThreshold: Failed int conversion " << value); - } - - ATH_MSG_DEBUG("getL1PtThreshold: " << ptname << " = " << pt); - - return pt; -} - - -bool -TrigEffJpsiTools::isConfigured(const std::string& chainName, - const std::string& prefix) const -{ - if (chainName.find(prefix) != 0) { - ATH_MSG_WARNING("isConfigured: unexpected chain name: " << chainName); - return false; - } - - const Trig::ChainGroup* chain = m_trigDecisionTool->getChainGroup(chainName); - if (chain->getListOfTriggers().empty()) { - if (msgLvl(MSG::DEBUG)) { - ATH_MSG_DEBUG("isConfigured: available triggers for " + prefix); - const Trig::ChainGroup *chain = m_trigDecisionTool->getChainGroup(prefix + "_.*"); - std::vector<std::string> tmpChainName = chain->getListOfTriggers(); - for (size_t ii = 0; ii < tmpChainName.size(); ii++) { - ATH_MSG_DEBUG(" " << tmpChainName.at(ii)); - } - } - - ATH_MSG_WARNING("isConfigured: " << chainName << " not configured"); - return false; - } - - ATH_MSG_DEBUG("isConfigured: " << chainName << " configured"); - return true; -} - - -bool -TrigEffJpsiTools::getMatchedRoI(const Rec::TrackParticle* track, - struct Match& match) const -{ - ATH_MSG_DEBUG("getMatchedRoI(private)"); - - match.roiIndex = -1; - match.roiWord = 0; - match.roiThrNumber = -1; - - if (!track) { - ATH_MSG_WARNING("getMatchedRoI: track pointer is null"); - return false; - } - - double searchRange[NUM_REGION] = {0.}; - double etaAtPivot[NUM_REGION] = {0.}; - double phiAtPivot[NUM_REGION] = {0.}; - double detaAtPivot[NUM_REGION] = {0.}; - double dphiAtPivot[NUM_REGION] = {0.}; - - if (match.etaExTrk) { - (*(match.etaExTrk))[Trk::locX] = -1.e30; - (*(match.etaExTrk))[Trk::locY] = -1.e30; - } - - if (match.phiExTrk) { - (*(match.phiExTrk))[Trk::locX] = -1.e30; - (*(match.phiExTrk))[Trk::locY] = -1.e30; - } - - // the extrapolation - double pivotZ = track->eta() < 0. ? -m_endcapPivotPlaneZ : m_endcapPivotPlaneZ; - const Trk::AtaDisc* disc = extrapolateToEndcap(track, pivotZ); - double pivotRadius = m_barrelPivotPlaneRadius; - const Trk::AtaCylinder* cylinder = extrapolateToBarrel(track, pivotRadius); - - if (!disc and !cylinder) return false; - - if (disc) { - Amg::Vector2D dEtaPhi; - getExtrapolationErrorOnEndcap(disc, &dEtaPhi); - - searchRange[ENDCAP] = getSearchRangeOnEndcap(disc); - etaAtPivot[ENDCAP] = disc->position().eta(); - phiAtPivot[ENDCAP] = disc->position().phi(); - detaAtPivot[ENDCAP] = dEtaPhi.x(); - dphiAtPivot[ENDCAP] = dEtaPhi.y(); - match.endcap = true; - - if (match.etaExTrk) { - (*(match.etaExTrk))[Trk::locX] = etaAtPivot[ENDCAP]; - (*(match.etaExTrk))[Trk::locY] = detaAtPivot[ENDCAP]; - } - if (match.phiExTrk) { - (*(match.phiExTrk))[Trk::locX] = phiAtPivot[ENDCAP]; - (*(match.phiExTrk))[Trk::locY] = dphiAtPivot[ENDCAP]; - } - ATH_MSG_DEBUG("getMatchedRoI: endcap: search range = " << searchRange[ENDCAP]); - //delete disc; - } - - if (cylinder) { - Amg::Vector2D dEtaPhi; - getExtrapolationErrorOnBarrel(cylinder, &dEtaPhi); - - searchRange[BARREL] = getSearchRangeOnBarrel(cylinder); - etaAtPivot[BARREL] = cylinder->position().eta(); - phiAtPivot[BARREL] = cylinder->position().phi(); - detaAtPivot[BARREL] = dEtaPhi.x(); - dphiAtPivot[BARREL] = dEtaPhi.y(); - match.barrel = true; - - if (match.etaExTrk) { - (*(match.etaExTrk))[Trk::locX] = etaAtPivot[BARREL]; - (*(match.etaExTrk))[Trk::locY] = detaAtPivot[BARREL]; - } - if (match.phiExTrk) { - (*(match.phiExTrk))[Trk::locX] = phiAtPivot[BARREL]; - (*(match.phiExTrk))[Trk::locY] = dphiAtPivot[BARREL]; - } - ATH_MSG_DEBUG("getMatchedRoI: barrel: search range = " << searchRange[BARREL]); - //delete cylinder; - } - - // get level1 muon rois - const LVL1_ROI* lvl1Roi = 0; - if (evtStore()->retrieve(lvl1Roi, m_Lvl1RoiName).isFailure() or - !lvl1Roi) { - ATH_MSG_WARNING("Failed to retrieve " << m_Lvl1RoiName); - return false; - } - LVL1_ROI::muons_type muonRoIs = lvl1Roi->getMuonROIs(); - - // search for the closest roi - typedef LVL1_ROI::muons_type::const_iterator iterator; - iterator cit = muonRoIs.begin(); - iterator cit_end = muonRoIs.end(); - double closest = -1; - for (int nRoi = 0; cit != cit_end; cit++, nRoi++) { - const Muon_ROI* roi = &(*cit); - ATH_MSG_DEBUG("getMatchedRoI: " << *roi); - double roiEta = roi->eta(); - double roiPhi = roi->phi(); - int roiRegion = (roi->getSource() == Muon_ROI::Barrel) ? BARREL : ENDCAP; - double dr = getEtaPhiDistance(etaAtPivot[roiRegion], roiEta, - phiAtPivot[roiRegion], roiPhi); - if (dr > searchRange[roiRegion]) continue; - if (closest < 0. or dr < closest) { - closest = dr; - match.roiIndex = nRoi; - if (match.etaExTrk) { - (*(match.etaExTrk))[Trk::locX] = etaAtPivot[roiRegion]; - (*(match.etaExTrk))[Trk::locY] = detaAtPivot[roiRegion]; - } - if (match.phiExTrk) { - (*(match.phiExTrk))[Trk::locX] = phiAtPivot[roiRegion]; - (*(match.phiExTrk))[Trk::locY] = dphiAtPivot[roiRegion]; - } - } - } - - if (match.roiIndex < 0) return false; - - const Muon_ROI roi = muonRoIs.at(match.roiIndex); - match.roiWord = roi.getROIWord(); - match.roiThrNumber = roi.getThrNumber(); - match.roiThrValue = getL1PtThreshold(roi.getThrName()); - match.roiEta = roi.getEta(); - match.roiPhi = roi.getPhi(); - if (roi.getSource() == Muon_ROI::Barrel) { - match.barrel = true; - match.endcap = false; - } else { - match.barrel = false; - match.endcap = true; - } - ATH_MSG_DEBUG("getMatchedRoI: matched " << &roi << " : " << roi); - - return true; -} - - - -bool -TrigEffJpsiTools::isTriggeredMuonHLT(const Rec::TrackParticle* track, - const std::string& chainName, - const Trig::ChainGroup* cg) const -{ - struct Match match; - if (not getMatchedRoI(track, match)) { - ATH_MSG_DEBUG("isTriggeredMuonHLT:getMatchedRoI: no " << chainName); - return false; - } - ATH_MSG_DEBUG("match roi: " << match.roiIndex); - - - const Trig::FeatureContainer fc = cg->features(TrigDefs::alsoDeactivateTEs); - const std::vector<Trig::Combination>& combinations = fc.getCombinations(); - ATH_MSG_DEBUG("isTriggeredMuonHLT: number of combinations:" << combinations.size()); - bool isTriggered = false; - - std::vector<Trig::Combination>::const_iterator cit; - for (cit = combinations.begin(); cit != combinations.end(); cit++) { - const Trig::Combination& combination = *cit; - if (not combination.active()) { - ATH_MSG_DEBUG("isTriggeredMuonHLT: combination " << combination << " is not active"); - continue; - } - ATH_MSG_DEBUG("isTriggeredMuonHLT: combination " << combination << " is active"); - - if (msgLvl(MSG::DEBUG)) { - const std::vector<const HLT::TriggerElement*>& tes = combination.tes(); - for (size_t jj = 0; jj < tes.size(); jj++) { - ATH_MSG_DEBUG("TE name[" << jj << "] = " << Trig::getTEName(*(tes.at(jj)))); - } - } - - - const std::vector<Trig::Feature<TrigRoiDescriptor> > features = - combination.get<TrigRoiDescriptor>("initialRoI", TrigDefs::alsoDeactivateTEs); - ATH_MSG_DEBUG("isTriggeredMuonHLT: number of muon features: " << features.size()); - - for (size_t ii = 0; ii < features.size(); ii++) { - const Trig::Feature<TrigRoiDescriptor> feature = features[ii]; - const TrigRoiDescriptor* roi = feature.cptr(); - const HLT::TriggerElement* te = features[ii].te(); - ATH_MSG_DEBUG("feature: " << feature); - ATH_MSG_DEBUG("roi word: " << roi->roiWord() << " ref: " << match.roiWord); - ATH_MSG_DEBUG("TE name(): " << Trig::getTEName(*te)); - - if (roi->roiWord() == match.roiWord) { - isTriggered = true; - ATH_MSG_DEBUG("isTriggeredMuonHLT: " << chainName << " triggered"); - break; - } - } - if (isTriggered) break; - } - - return isTriggered; -} - - - -bool -TrigEffJpsiTools::isTriggeredMuonHLTwMuonFeature(const Rec::TrackParticle* track, - const std::string& chainName, - const Trig::ChainGroup* cg) const -{ - struct Match match; - if (not getMatchedRoI(track, match)) { - ATH_MSG_DEBUG("isTriggeredMuonHLTwMuonFeature:getMatchedRoI: no " << chainName); - return false; - } - ATH_MSG_DEBUG("match roi: " << match.roiIndex); - - - const Trig::FeatureContainer fc = cg->features(TrigDefs::alsoDeactivateTEs); - const std::vector<Trig::Combination>& combinations = fc.getCombinations(); - ATH_MSG_DEBUG("isTriggeredMuonHLTwMuonFeature: number of combinations:" << combinations.size()); - bool isTriggered = false; - - std::vector<Trig::Combination>::const_iterator cit; - for (cit = combinations.begin(); cit != combinations.end(); cit++) { - const Trig::Combination& combination = *cit; - if (not combination.active()) { - ATH_MSG_DEBUG("isTriggeredMuonHLTwMuonFeature: combination " << combination << " is not active"); - continue; - } - ATH_MSG_DEBUG("isTriggeredMuonHLTwMuonFeature: combination " << combination << " is active"); - - if (msgLvl(MSG::DEBUG)) { - const std::vector<const HLT::TriggerElement*>& tes = combination.tes(); - for (size_t jj = 0; jj < tes.size(); jj++) { - ATH_MSG_DEBUG("TE name[" << jj << "] = " << Trig::getTEName(*(tes.at(jj)))); - } - } - - - const std::vector<Trig::Feature<MuonFeature> > features = - combination.get<MuonFeature>("", TrigDefs::alsoDeactivateTEs); - ATH_MSG_DEBUG("isTriggeredMuonHLTwMuonFeature: number of muon features: " << features.size()); - - for (size_t ii = 0; ii < features.size(); ii++) { - const Trig::Feature<MuonFeature> feature = features[ii]; - const HLT::TriggerElement* te = features[ii].te(); - Trig::Feature<Muon_ROI> roiFeature = m_trigDecisionTool->ancestor<Muon_ROI>(te); - const Muon_ROI* roi = roiFeature.cptr(); - //const MuonFeature* mf = feature.cptr(); - //ATH_MSG_DEBUG("MuonFeature: " << str(mf) << " algoid = " << mf->algoId()); // MuonFeatureDetails.h - ATH_MSG_DEBUG("feature: " << feature); - ATH_MSG_DEBUG("roi word: " << roi->getROIWord() << " ref: " << match.roiWord); - ATH_MSG_DEBUG("TE name(): " << Trig::getTEName(*te)); - - if (roi->getROIWord() == match.roiWord) { - isTriggered = true; - ATH_MSG_DEBUG("isTriggeredMuonHLTwMuonFeature: " << chainName << " triggered"); - break; - } - } - if (isTriggered) break; - } - - return isTriggered; -} - - - -bool -TrigEffJpsiTools::addTrigObject(TrigObject& trig, TrigObjectMap* map, bool appendIfExists) const -{ - TrigObjectMap::iterator mIt = map->find( trig.id ); - if (mIt == map->end()) { // Element does not exist in map - ATH_MSG_DEBUG( "track not in map, will add , comb Id: " << trig.id); - std::pair<TrigObjectMap::iterator, bool> rc; - rc = map->insert(TrigObjectPair(trig.id, trig)); - if (not rc.second) { - ATH_MSG_WARNING( "pointerMap: map key " << trig.id << " duplicated "); - } - return true; - } else { // Element exists in map - if (appendIfExists) { - // Add element's name and combinations to existing element - ATH_MSG_DEBUG( "track already in map will add name, combId " << trig.id); - mIt->second.names.push_back(trig.names[0]); - //mIt->second.daughterIds.push_back(trig.daughterIds[0]); - mIt->second.combIds.push_back(trig.combIds[0]); - mIt->second.efObjIds.push_back(trig.efObjIds[0]); - } - return false; - } -} - - -/** - * @param data_word Data word from the MuCTPI_RDO object - * @returns The RoI word created from the data word - */ -uint32_t -TrigEffJpsiTools::RDOtoRoI(uint32_t data_word) const -{ - // MuCTPI_RDO to MuCTPIRoI - // ref: Fig 3.6 and Fig 3.8 in https://edms.cern.ch/file/248757/1/mirod.pdf - return (((data_word & 0x8000000) >> 4) | ((data_word & 0x3fe0000) >> 3) | - (data_word & 0x3fff)); -} - - -bool -TrigEffJpsiTools::EF_mu4_MSOnly_with_Muid(const MuonFeature* mf) const -{ - // apply hypo cut - if (not hasPassedMuFast(mf)) return false; - - - // find matching level roi - const LVL1_ROI* lvl1Roi = 0; - if (evtStore()->retrieve(lvl1Roi, m_Lvl1RoiName).isFailure() or - !lvl1Roi) { - ATH_MSG_WARNING("TrigEffJpsiTools::EF_mu4_MSOnly_with_Muid: Failed to retrieve " << m_Lvl1RoiName); - return false; - } - - LVL1_ROI::muons_type muonRoIs = lvl1Roi->getMuonROIs(); - typedef LVL1_ROI::muons_type::const_iterator roi_it; - const double eta = mf->eta(); - const double phi = mf->phi(); - double minDist = 1.e30; - for (roi_it cit = muonRoIs.begin(); cit != muonRoIs.end(); cit++) { - double dist = getEtaPhiDistance(cit->eta(), eta, cit->phi(), phi); - if (dist < minDist) minDist = dist; - } - - if (minDist > 0.5) return false; - - - // find matching muid muon - const Analysis::MuonContainer* muons = 0; - if (evtStore()->retrieve(muons, "MuidMuonCollection").isFailure() or - !muons) { - ATH_MSG_WARNING("TrigEffJpsiTools::EF_mu4_MSOnly_with_MuidSA: Failed to retrieve MuidMuonCollection"); - return false; - } - - minDist = 0.1; - typedef Analysis::MuonContainer::const_iterator mc_it; - for (mc_it cit = muons->begin(); cit != muons->end(); cit++) { - const Analysis::Muon* muon = *cit; - uint16_t allAuthors = muon->allAuthors(); - if ((allAuthors & (0x1 << 10)) or // MuTagIMO - (allAuthors & (0x1 << 3)) or // MuidSA - (allAuthors & (0x1 << 4))) { // MuidCo - double dist = getEtaPhiDistance(muon->eta(), eta, muon->phi(), phi); - if (dist < minDist) { - const Rec::TrackParticle* tp; - tp = muon->muonSpectrometerTrackParticle(); - if (!tp) tp = muon->innerExtrapolatedTrackParticle(); - if (!tp) tp = muon->inDetTrackParticle(); - if (hasPassedTrigMuonEF(tp)) return true; - } - } - } - - return false; -} - - -bool -TrigEffJpsiTools::hasPassedMuFast(const MuonFeature* mf) const -{ - // https://svnweb.cern.ch/trac/atlasoff/browser/Trigger/TrigHypothesis/TrigMuonHypo/trunk/python/TrigMuonHypoConfig.py - double pt = mf->pt(); - double eta = std::abs(mf->eta()); - - if (eta < 1.05) { - if (pt < 3.0) return false; - - } else if (eta < 1.5) { - if (pt < 2.5) return false; - - } else if (eta < 2.0) { - if (pt < 2.5) return false; - - } else if (eta < 9.9) { - if (pt < 3.0) return false; - - } else { - return false; - } - - return true; -} - - -bool -TrigEffJpsiTools::hasPassedTrigMuonEF(const Rec::TrackParticle* tp) const -{ - // https://svnweb.cern.ch/trac/atlasoff/browser/Trigger/TrigHypothesis/TrigMuonHypo/trunk/python/TrigMuonHypoConfig.py - double pt = tp->pt(); - double eta = std::abs(tp->eta()); - - if (eta < 1.05) { - if (pt < 3.0) return false; - - } else if (eta < 1.5) { - if (pt < 2.5) return false; - - } else if (eta < 2.0) { - if (pt < 2.5) return false; - - } else if (eta < 9.9) { - if (pt < 2.5) return false; - - } else { - return false; - } - - return true; -} - -// ************************************************************************** -bool -TrigEffJpsiTools::selectL2TrigDiMuon(const TrigL2Bphys* trigger, - const TrigInDetTrack* track1, - const TrigInDetTrack* track2, - bool checkOS, // if true, tracks must have opposite charge - double massMin, // invariant mass lower limit - double massMax, // invariant mass upper limit - bool applyMassMax, // apply upper invariant mass cut - int nHits, // number of matching muon hits - double chi2) const // chi2 cut. If < 0, no cut is applied -{ - // apply chi2 cut if requested - if(chi2>=0 && trigger->fitchi2() > chi2) return false; - - //apply invariant mass cut - if(trigger->mass() < massMin) return false; - if(applyMassMax && trigger->mass()>massMax) return false; - - //apply OS cut - if (checkOS && track1->param()->pT() * track2->param()->pT() >= 0.0) return false; - - //apply number of hits cut - // if nHits<0 then don't apply cut - used for topological triggers - if (nHits > 0) { - // decode number of hits - int32_t word1 = track1->HitPattern(); - Encoding* pEncoding1 = (Encoding*)&word1; - - int32_t word2 = track2->HitPattern(); - Encoding* pEncoding2 = (Encoding*)&word2; - - // Make sure to cast to int32_t! - int32_t nMdtHits[2] = { static_cast<int32_t>(pEncoding1->mdt), static_cast<int32_t>(pEncoding2->mdt) } ; - int32_t nRpcHits[2] = { static_cast<int32_t>(pEncoding1->rpc), static_cast<int32_t>(pEncoding2->rpc) } ; - int32_t nTgcHits[2] = { static_cast<int32_t>(pEncoding1->tgc), static_cast<int32_t>(pEncoding2->tgc) } ; - int32_t nHits1 = nMdtHits[0] + nRpcHits[0] + nTgcHits[0]; - int32_t nHits2 = nMdtHits[1] + nRpcHits[1] + nTgcHits[1]; - if ( nHits1 < nHits || nHits2 < nHits) return false; - ATH_MSG_VERBOSE("nMdtHits: " << nMdtHits[0] << ", " << nMdtHits[1]); - ATH_MSG_VERBOSE("nRpcHits: " << nRpcHits[0] << ", " << nRpcHits[1]); - ATH_MSG_VERBOSE("nTgcHits: " << nTgcHits[0] << ", " << nTgcHits[1]); - ATH_MSG_VERBOSE("Sum: " << nHits1 << ", " << nHits2); - } - // if we got this far, candidate was accepted - ATH_MSG_DEBUG("This candidate passed hypo selection " ); - return true; - -} -// ************************************************************************** -bool -TrigEffJpsiTools::selectEFTrigDiMuon(const TrigEFBphys* trigger, - const Rec::TrackParticle* track1, - const Rec::TrackParticle* track2, - bool checkOS, // if true, tracks must have opposite charge - double massMin, // invariant mass lower limit - double massMax, // invariant mass upper limit - bool applyMassMax, // apply upper invariant mass cut - double chi2) const // chi2 cut. If < 0, no cut is applied -{ - // apply chi2 cut if requested - if(chi2>=0 && trigger->fitchi2() > chi2) return false; - - //apply invariant mass cut - if(trigger->mass() < massMin) return false; - if(applyMassMax && trigger->mass()>massMax) return false; - - //apply OS cut - if (checkOS && track1->measuredPerigee()->parameters()[Trk::qOverP] * track2->measuredPerigee()->parameters()[Trk::qOverP] >= 0.0) return false; - - // if we got this far, candidate was accepted - ATH_MSG_DEBUG("This candidate passed hypo selection " ); - return true; - -} - -// ************************************************************************** -void -TrigEffJpsiTools::Btrig_L2_initCuts() -{ - ATH_MSG_DEBUG("Use manual hypo cuts: " << m_useManualHypoCuts); - //L2_mu4_DiMu - m_Btrig_L2_chain.push_back("L2_mu4_DiMu"); - m_Btrig_L2_checkOS.push_back(true); - m_Btrig_L2_massMin.push_back(500.); - m_Btrig_L2_massMax.push_back(13000.); - m_Btrig_L2_applyMassMax.push_back(false); - m_Btrig_L2_nHits.push_back(3); - m_Btrig_L2_chi2.push_back(-1.); - - //L2_mu4_Jpsimumu - m_Btrig_L2_chain.push_back("L2_mu4_Jpsimumu"); - m_Btrig_L2_checkOS.push_back(true); - m_Btrig_L2_massMin.push_back(2500.); - m_Btrig_L2_massMax.push_back(4300.); - m_Btrig_L2_applyMassMax.push_back(true); - m_Btrig_L2_nHits.push_back(3); - m_Btrig_L2_chi2.push_back(-1.); - - //L2_mu4_Upsimumu - m_Btrig_L2_chain.push_back("L2_mu4_Upsimumu"); - m_Btrig_L2_checkOS.push_back(true); - m_Btrig_L2_massMin.push_back(8000.); - m_Btrig_L2_massMax.push_back(12000.); - m_Btrig_L2_applyMassMax.push_back(true); - m_Btrig_L2_nHits.push_back(3); - m_Btrig_L2_chi2.push_back(-1.); - - //L2_mu4_Bmumu - m_Btrig_L2_chain.push_back("L2_mu4_Bmumu"); - m_Btrig_L2_checkOS.push_back(true); - m_Btrig_L2_massMin.push_back(8000.); - m_Btrig_L2_massMax.push_back(12000.); - m_Btrig_L2_applyMassMax.push_back(true); - m_Btrig_L2_nHits.push_back(3); - m_Btrig_L2_chi2.push_back(-1.); - - //L2_2mu4_DiMu - m_Btrig_L2_chain.push_back("L2_2mu4_DiMu"); - m_Btrig_L2_checkOS.push_back(true); - m_Btrig_L2_massMin.push_back(500.); - m_Btrig_L2_massMax.push_back(13000.); - m_Btrig_L2_applyMassMax.push_back(false); - m_Btrig_L2_nHits.push_back(-1); - m_Btrig_L2_chi2.push_back(20.); - - //L2_2mu4_Jpsimumu - m_Btrig_L2_chain.push_back("L2_2mu4_Jpsimumu"); - m_Btrig_L2_checkOS.push_back(true); - m_Btrig_L2_massMin.push_back(2500.); - m_Btrig_L2_massMax.push_back(4300.); - m_Btrig_L2_applyMassMax.push_back(true); - m_Btrig_L2_nHits.push_back(-1); - m_Btrig_L2_chi2.push_back(20.); - - //L2_2mu4_Upsimumu - m_Btrig_L2_chain.push_back("L2_2mu4_Upsimumu"); - m_Btrig_L2_checkOS.push_back(true); - m_Btrig_L2_massMin.push_back(8000.); - m_Btrig_L2_massMax.push_back(12000.); - m_Btrig_L2_applyMassMax.push_back(true); - m_Btrig_L2_nHits.push_back(-1); - m_Btrig_L2_chi2.push_back(20.); - - //L2_2mu4_Bmumu - m_Btrig_L2_chain.push_back("L2_2mu4_Bmumu"); - m_Btrig_L2_checkOS.push_back(true); - m_Btrig_L2_massMin.push_back(4000.); - m_Btrig_L2_massMax.push_back(7000.); - m_Btrig_L2_applyMassMax.push_back(true); - m_Btrig_L2_nHits.push_back(-1); - m_Btrig_L2_chi2.push_back(20.); - - - //L2_mu4_DiMu_FS - m_Btrig_L2_chain.push_back("L2_mu4_DiMu_FS"); - m_Btrig_L2_checkOS.push_back(true); - m_Btrig_L2_massMin.push_back(500.); - m_Btrig_L2_massMax.push_back(13000.); - m_Btrig_L2_applyMassMax.push_back(false); - m_Btrig_L2_nHits.push_back(3); - m_Btrig_L2_chi2.push_back(-1.); - - //L2_mu4_Jpsimumu_FS - m_Btrig_L2_chain.push_back("L2_mu4_Jpsimumu_FS"); - m_Btrig_L2_checkOS.push_back(true); - m_Btrig_L2_massMin.push_back(2500.); - m_Btrig_L2_massMax.push_back(4300.); - m_Btrig_L2_applyMassMax.push_back(true); - m_Btrig_L2_nHits.push_back(3); - m_Btrig_L2_chi2.push_back(-1.); - - //L2_mu4_Upsimumu_FS - m_Btrig_L2_chain.push_back("L2_mu4_Upsimumu_FS"); - m_Btrig_L2_checkOS.push_back(true); - m_Btrig_L2_massMin.push_back(8000.); - m_Btrig_L2_massMax.push_back(12000.); - m_Btrig_L2_applyMassMax.push_back(true); - m_Btrig_L2_nHits.push_back(3); - m_Btrig_L2_chi2.push_back(-1.); - - //L2_mu4_Bmumu_FS - m_Btrig_L2_chain.push_back("L2_mu4_Bmumu_FS"); - m_Btrig_L2_checkOS.push_back(true); - m_Btrig_L2_massMin.push_back(4000.); - m_Btrig_L2_massMax.push_back(7000.); - m_Btrig_L2_applyMassMax.push_back(true); - m_Btrig_L2_nHits.push_back(3); - m_Btrig_L2_chi2.push_back(-1.); - - - - return; - -} - -void -TrigEffJpsiTools::Btrig_EF_initCuts() -{ - ATH_MSG_DEBUG("Use manual hypo cuts: " << m_useManualHypoCuts); - //Ef_mu4_DiMu - m_Btrig_EF_chain.push_back("EF_mu4_DiMu"); - m_Btrig_EF_checkOS.push_back(true); - m_Btrig_EF_massMin.push_back(500.); - m_Btrig_EF_massMax.push_back(13000.); - m_Btrig_EF_applyMassMax.push_back(false); - m_Btrig_EF_chi2.push_back(-1.); - - - //EF_mu4_Jpsimumu - m_Btrig_EF_chain.push_back("EF_mu4_Jpsimumu"); - m_Btrig_EF_checkOS.push_back(true); - m_Btrig_EF_massMin.push_back(2500.); - m_Btrig_EF_massMax.push_back(4300.); - m_Btrig_EF_applyMassMax.push_back(true); - m_Btrig_EF_chi2.push_back(-1.); - - //EF_mu4_Bmumu - m_Btrig_EF_chain.push_back("EF_mu4_Bmumu"); - m_Btrig_EF_checkOS.push_back(true); - m_Btrig_EF_massMin.push_back(4000.); - m_Btrig_EF_massMax.push_back(7000.); - m_Btrig_EF_applyMassMax.push_back(true); - m_Btrig_EF_chi2.push_back(-1.); - - //EF_2mu4_DiMu - m_Btrig_EF_chain.push_back("EF_2mu4_DiMu"); - m_Btrig_EF_checkOS.push_back(true); - m_Btrig_EF_massMin.push_back(500.); - m_Btrig_EF_massMax.push_back(13000.); - m_Btrig_EF_applyMassMax.push_back(false); - m_Btrig_EF_chi2.push_back(20.); - - //EF_2mu4_Bmumu - m_Btrig_EF_chain.push_back("EF_2mu4_Bmumu"); - m_Btrig_EF_checkOS.push_back(true); - m_Btrig_EF_massMin.push_back(4000.); - m_Btrig_EF_massMax.push_back(7000.); - m_Btrig_EF_applyMassMax.push_back(true); - m_Btrig_EF_chi2.push_back(20.); - - //EF_2mu4_Jpsimumu - m_Btrig_EF_chain.push_back("EF_2mu4_Jpsimumu"); - m_Btrig_EF_checkOS.push_back(true); - m_Btrig_EF_massMin.push_back(2500.); - m_Btrig_EF_massMax.push_back(4300.); - m_Btrig_EF_applyMassMax.push_back(true); - m_Btrig_EF_chi2.push_back(20.); - - //EF_2mu4_Upsimumu - m_Btrig_EF_chain.push_back("EF_2mu4_Upsimumu"); - m_Btrig_EF_checkOS.push_back(true); - m_Btrig_EF_massMin.push_back(8000.); - m_Btrig_EF_massMax.push_back(12000.); - m_Btrig_EF_applyMassMax.push_back(true); - m_Btrig_EF_chi2.push_back(20.); - - //EF_mu4_DiMumumu_FS - m_Btrig_EF_chain.push_back("EF_mu4_DiMu_FS"); - m_Btrig_EF_checkOS.push_back(true); - m_Btrig_EF_massMin.push_back(500.); - m_Btrig_EF_massMax.push_back(13000.); - m_Btrig_EF_applyMassMax.push_back(false); - m_Btrig_EF_chi2.push_back(-1.); - - //EF_mu4_Jpsimumu_FS - m_Btrig_EF_chain.push_back("EF_mu4_Jpsimumu_FS"); - m_Btrig_EF_checkOS.push_back(true); - m_Btrig_EF_massMin.push_back(2500.); - m_Btrig_EF_massMax.push_back(4300.); - m_Btrig_EF_applyMassMax.push_back(true); - m_Btrig_EF_chi2.push_back(-1.); - - //EF_mu4_Upsimumu_FS - m_Btrig_EF_chain.push_back("EF_mu4_Upsimumu_FS"); - m_Btrig_EF_checkOS.push_back(true); - m_Btrig_EF_massMin.push_back(8000.); - m_Btrig_EF_massMax.push_back(12000.); - m_Btrig_EF_applyMassMax.push_back(true); - m_Btrig_EF_chi2.push_back(-1.); - - //EF_mu4_Bmumu_FS - m_Btrig_EF_chain.push_back("EF_mu4_Bmumu_FS"); - m_Btrig_EF_checkOS.push_back(true); - m_Btrig_EF_massMin.push_back(4000.); - m_Btrig_EF_massMax.push_back(7000.); - m_Btrig_EF_applyMassMax.push_back(true); - m_Btrig_EF_chi2.push_back(-1.); - - - - return; - -} - - - - -// ************************************************************************** - -/* eof */ diff --git a/Trigger/TrigAnalysis/TrigEffJpsiTools/src/TrigEffJpsiTools.h b/Trigger/TrigAnalysis/TrigEffJpsiTools/src/TrigEffJpsiTools.h deleted file mode 100644 index 4f5831cf466299a1d47e338c1894840d22bf27d2..0000000000000000000000000000000000000000 --- a/Trigger/TrigAnalysis/TrigEffJpsiTools/src/TrigEffJpsiTools.h +++ /dev/null @@ -1,394 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGEFFJPSITOOLS_H -#define TRIGEFFJPSITOOLS_H -/** - * @author Hironori Kiyamura - * @author Takashi Matsushita - * @date $Date: 2016-02-10 17:47:59 +0100 (Wed, 10 Feb 2016) $ - * @version $Revision: 723159 $ - */ - -/** @todo */ -/** @warnings */ - - -/*--------------------------------------------------------------------* - * headers - *--------------------------------------------------------------------*/ -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "AnalysisTriggerEvent/LVL1_ROI.h" -#include "TrigDecisionTool/TrigDecisionTool.h" -#include "TrigEffJpsiTools/ITrigEffJpsiTools.h" -#include "TrkParameters/TrackParameters.h" -#include <vector> -#include <string> - -class INavigable4Momentum; -namespace Rec { class TrackParticle; } -namespace Trk { class IExtrapolator; } -namespace Trk { class Track; } -namespace Trk { class RIO_OnTrack; } -namespace Trk { class TrackStateOnSurface; } -namespace LVL1RPC { class RPCRecRoiSvc; } -namespace LVL1TGC { class TGCRecRoiSvc; } -namespace Muon { class MuonIdHelperTool; } -namespace Trig { class TrigDecisionTool; } -namespace Trig { class ChainGroup; } - - -class IRPCcablingSvc; -class MuonFeature; -class TrigL2Bphys; -class TrigEFBphys; -class TrigInDetTrack; - -/*--------------------------------------------------------------------* - * classes - *--------------------------------------------------------------------*/ -struct Encoding -{ - unsigned unused:18; - unsigned mdt:5; - unsigned tgc:5; - unsigned rpc:4; -}; - -class TrigEffJpsiTools : virtual public ITrigEffJpsiTools, - public AthAlgTool { - - public: - TrigEffJpsiTools(const std::string& type, - const std::string& name, - const IInterface* parent); - ~TrigEffJpsiTools(); - - virtual StatusCode initialize(); - virtual StatusCode finalize(); - - - bool isTriggeredMuonEF(const Rec::TrackParticle* track, - const std::string& chainName) const; - - bool isTriggeredMuonL2(const Rec::TrackParticle* track, - const std::string& chainName) const; - - bool isTriggeredMuonL1(const Rec::TrackParticle* track, - const std::string& triggerName) const; - - bool isTriggeredMuon(const Rec::TrackParticle* track, - int thresholdNumber) const; - - bool isJPsiCandidate(const Rec::TrackParticle* track1, - const Rec::TrackParticle* track2) const; - - bool isJPsiCandidate(const INavigable4Momentum* mom1, - const INavigable4Momentum* mom2) const; - - int getMatchedRoI(const Rec::TrackParticle* track, - bool* barrel = 0, - bool* endcap = 0, - Amg::Vector2D* eta = 0, - Amg::Vector2D* phi = 0) const; - - - StatusCode getRoiSize(const unsigned int roiWord, - double* etaSize, - double* phiSize) const; - - StatusCode getRioOnTriggerChamber(const Trk::Track* track, - std::vector<const Trk::RIO_OnTrack*>& rots, - bool pivotOnly=true) const; - - bool extrapolateToRio(const Rec::TrackParticle* track, - const Trk::RIO_OnTrack* rot, - Amg::Vector2D* eta, - Amg::Vector2D* phi, - Amg::Vector2D* ptpz, - bool getTsos, - const std::vector<const Trk::TrackStateOnSurface*>* &tsos) const; - - bool extrapolateToPoint(const Rec::TrackParticle* track, - const Amg::Vector3D* pos, - const int detector, - Amg::Vector2D* eta, - Amg::Vector2D* phi, - Amg::Vector3D* mom) const; - - std::vector<HLT::TriggerElement*> getExpertTEs(const std::string& chain = "EF_mu4") const; - - bool getTriggerObjects(const std::string& chain, - TrigObjectMap* muonsEF = NULL, - TrigObjectMap* muonsL2 = NULL, - TrigObjectMap* muonsL1 = NULL) const; - bool getL1TriggerObjects(const std::string& chain, - TrigObjectMap* muonsL1 = NULL) const; - bool getL2TriggerObjects(const std::string& chain, - TrigObjectMap* muonsL2 = NULL, - TrigObjectMap* muonsL1 = NULL) const; - bool getEFTriggerObjects(const std::string& chain, - TrigObjectMap* muonsEF = NULL, - TrigObjectMap* muonsL2 = NULL, - TrigObjectMap* muonsL1 = NULL) const; - bool getEFAllTriggerObjects(const std::string& chain, - TrigObjectMap* muonsEF = NULL, - TrigObjectMap* muonsL2 = NULL, - TrigObjectMap* muonsL1 = NULL) const; - - bool getEFIDTriggerObjects(const std::string& chain, - TrigObjectMap* muonsEF = NULL, - TrigObjectMap* muonsL2 = NULL, - TrigObjectMap* muonsL1 = NULL) const; - - bool getEFMSTriggerObjects(const std::string& chain, - TrigObjectMap* muonsEF = NULL, - TrigObjectMap* muonsL2 = NULL, - TrigObjectMap* muonsL1 = NULL) const; - - bool getBPhysL2TriggerObjects(const std::string& chain, - TrigObjectMap* muonsL2 = NULL, - TrigObjectMap* muonsL1 = NULL) const; - bool getBPhysEFTriggerObjects(const std::string& chain, - TrigObjectMap* muonsEF = NULL, - TrigObjectMap* muonsL2 = NULL, - TrigObjectMap* muonsL1 = NULL) const; - - int muctpiBcidDiff(const int roiBcid) const; - int getMuonRoiBcidDiff(const uint32_t roiWord) const; - - bool isOffTimeTgcTrigger() const; - bool EF_mu4_MSOnly_from_EF_mu0_outOfTime1() const; - - - private: - // methods to get extrapolation error on each plane - void getExtrapolationErrorOnEndcap(const Trk::AtaDisc* measurement, - Amg::Vector2D* dEtaPhi) const; - void getExtrapolationErrorOnBarrel(const Trk::AtaCylinder* measurement, - Amg::Vector2D* dEtaPhi) const; - - // methods to get search range on each plane - double getSearchRangeOnEndcap(const Trk::AtaDisc* measurement) const; - double getSearchRangeOnBarrel(const Trk::AtaCylinder* measurement) const; - - // methods to get eta-phi distance - double getEtaPhiDistanceAtIp(const Rec::TrackParticle* track1, - const Rec::TrackParticle* track2) const; - double getEtaPhiDistanceOnEndcap(const Trk::AtaDisc* measurement1, - const Trk::AtaDisc* measurement2) const; - double getEtaPhiDistanceOnBarrel(const Trk::AtaCylinder* measurement1, - const Trk::AtaCylinder* measurement2) const; - double getEtaPhiDistance(double eta1, - double eta2, - double phi1, - double phi2) const; - double getEtaDistance(double eta1, - double eta2) const; - double getPhiDistance(double phi1, - double phi2) const; - - // methods to check isolation - bool isSeparated(const Rec::TrackParticle* track1, - const Rec::TrackParticle* track2) const; - bool isSeparatedOnEndcap(const Rec::TrackParticle* track1, - const Rec::TrackParticle* track2) const; - bool isSeparatedOnBarrel(const Rec::TrackParticle* track1, - const Rec::TrackParticle* track2) const; - - // methods to convert local errors to global one - double getEtaErrFromRPhi(const Trk::AtaDisc* measurement) const; - double getEtaErrFromRPhiZ(const Trk::AtaCylinder* measurement) const; - - // methods for track extrapolation to target plane - const Trk::AtaDisc* - extrapolateToEndcap(const Rec::TrackParticle* track, - const double pivotZ, - const bool useCache = true) const; - const Trk::AtaCylinder* - extrapolateToBarrel(const Rec::TrackParticle* track, - const double pivotRadius, - const bool useCache = true) const; - - const std::vector<const Trk::TrackStateOnSurface*>* - extrapolateToEndcapM(const Rec::TrackParticle* track, - const double pivotZ) const; - const std::vector<const Trk::TrackStateOnSurface*>* - extrapolateToBarrelM(const Rec::TrackParticle* track, - const double pivotRadius) const; - - // struct to store center of search and serch range - struct Search { - double eta; - double phi; - double searchRange; - }; - - // methods to check if track has associated muon roi or not - bool isTriggered(const struct Search& centre, - const int thresholdNumber, - const LVL1_ROI::muons_type& muonRoIs) const; - bool isTriggeredOnEndcap(const Rec::TrackParticle* track, - LVL1_ROI::muons_type& muonRoIs, - int thresholdNumber) const; - bool isTriggeredOnBarrel(const Rec::TrackParticle* track, - LVL1_ROI::muons_type& muonRoIs, - int thresholdNumber) const; - - // methods to check the roi region - int getRoiRegion(int roiWord) const; - unsigned int getBitMaskValue(const unsigned int value, - const unsigned int mask) const; - - // methods to get roi size - StatusCode getRoiSizeTgc(const unsigned int roiWord, - double* etaSize, - double* phiSize) const; - - StatusCode getRoiSizeRpc(const unsigned int roiWord, - double* etaSize, - double* phiSize) const; - - // method to extract pt value from chain name - int getL1PtThreshold(const std::string& l1TriggerName) const; - - // method to check if the given chain is configured or not - bool isConfigured(const std::string& chainName, - const std::string& prefix) const; - - // struct to store matched roi information - struct Match { - int roiIndex; - unsigned int roiWord; - int roiThrNumber; - int roiThrValue; - float roiEta; - float roiPhi; - Amg::Vector2D* etaExTrk; - Amg::Vector2D* phiExTrk; - bool barrel; - bool endcap; - - Match() : roiIndex(-1), roiWord(0), roiThrNumber(-1), roiThrValue(-1), - roiEta(0.), roiPhi(0.), etaExTrk(0), phiExTrk(0), - barrel(false), endcap(false) {} - }; - - bool getMatchedRoI(const Rec::TrackParticle* track, - struct Match& match) const; - bool isTriggeredMuonHLT(const Rec::TrackParticle* track, - const std::string& chainName, - const Trig::ChainGroup *cg) const; - bool isTriggeredMuonHLTwMuonFeature(const Rec::TrackParticle* track, - const std::string& chainName, - const Trig::ChainGroup *cg) const; - - // struct for data cache - typedef std::map<const Rec::TrackParticle*, - const Trk::TrackParameters*> CacheMap; - typedef std::pair<const Rec::TrackParticle*, - const Trk::TrackParameters*> CachePair; - struct Cache { - unsigned int runNo; - unsigned int evtNo; - CacheMap tp; - }; - - void validateCache(Cache& map) const; - - bool addTrigObject(TrigObject& trig, TrigObjectMap* map, bool appendIfExists = true) const; - - uint32_t RDOtoRoI(uint32_t data_word) const; - - bool EF_mu4_MSOnly_with_Muid(const MuonFeature* mf) const; - bool hasPassedMuFast(const MuonFeature* mf) const; - bool hasPassedTrigMuonEF(const Rec::TrackParticle* tp) const; - - void Btrig_L2_initCuts(); - void Btrig_EF_initCuts(); - - bool selectL2TrigDiMuon(const TrigL2Bphys* trigger, - const TrigInDetTrack* track1, - const TrigInDetTrack* track2, - bool checkOS, // if true, tracks must have opposite charge - double massMin, // invariant mass lower limit - double massMax, // invariant mass upper limit - bool applyMassMax, // apply upper invariant mass cut - int nHits, // number of matching muon hits - double chi2) const; - - bool selectEFTrigDiMuon(const TrigEFBphys* trigger, - const Rec::TrackParticle* track1, - const Rec::TrackParticle* track2, - bool checkOS, // if true, tracks must have opposite charge - double massMin, // invariant mass lower limit - double massMax, // invariant mass upper limit - bool applyMassMax, // apply upper invariant mass cut - double chi2) const; - - // attributes - - // service handles - ServiceHandle<LVL1RPC::RPCRecRoiSvc> m_rpcRoiService; - ServiceHandle<LVL1TGC::TGCRecRoiSvc> m_tgcRoiService; - - // tool handles - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelper; - ToolHandle<Trk::IExtrapolator> m_extrapolator; - ToolHandle<Trig::TrigDecisionTool> m_trigDecisionTool; - - std::string m_Lvl1RoiName; - double m_endcapPivotPlaneZ; - double m_endcapPivotPlaneMinimumRadius; - double m_endcapPivotPlaneMaximumRadius; - double m_barrelPivotPlaneRadius; - double m_barrelPivotPlaneHalfLength; - double m_invariantMassUpperLimit; - double m_invariantMassLowerLimit; - double m_trackPtCut; - double m_trackEtaCut; - double m_roiSizeBarrel; - double m_roiSizeEndcap; - double m_roiSizeForward; - double m_endcapForwardBoundary; - double m_searchRangeTolerance; - double m_searchRangeOffset; - bool m_appendL1IfExists; - bool m_appendL2IfExists; - bool m_appendEFIfExists; - bool m_useManualHypoCuts; - - const IRPCcablingSvc* p_rpcCablingSvc; - - mutable Cache m_cacheEndcap; - mutable Cache m_cacheBarrel; - - // constants - const double m_MUON_MASS; - enum RoiRegion { - BARREL, - ENDCAP, - NUM_REGION - }; - - std::vector<std::string> m_Btrig_L2_chain; - std::vector<bool> m_Btrig_L2_checkOS; - std::vector<double> m_Btrig_L2_massMin; - std::vector<double> m_Btrig_L2_massMax; - std::vector<bool> m_Btrig_L2_applyMassMax; - std::vector<int> m_Btrig_L2_nHits; - std::vector<double> m_Btrig_L2_chi2; - - std::vector<std::string> m_Btrig_EF_chain; - std::vector<bool> m_Btrig_EF_checkOS; - std::vector<double> m_Btrig_EF_massMin; - std::vector<double> m_Btrig_EF_massMax; - std::vector<bool> m_Btrig_EF_applyMassMax; - std::vector<double> m_Btrig_EF_chi2; - -}; - -#endif // TRIGEFFJPSITOOLS_H diff --git a/Trigger/TrigAnalysis/TrigEffJpsiTools/src/components/TrigEffJpsiTools_entries.cxx b/Trigger/TrigAnalysis/TrigEffJpsiTools/src/components/TrigEffJpsiTools_entries.cxx deleted file mode 100644 index 4d163fffcb21094d19ef2ce5d3caf56cd22e2395..0000000000000000000000000000000000000000 --- a/Trigger/TrigAnalysis/TrigEffJpsiTools/src/components/TrigEffJpsiTools_entries.cxx +++ /dev/null @@ -1,8 +0,0 @@ - -#include "src/TrigEffJpsiTools.h" -#include "src/MuonRoiWithExtendedBunches.h" - - -DECLARE_COMPONENT( TrigEffJpsiTools ) -DECLARE_COMPONENT( MuComm::MuonRoiWithExtendedBunches ) - diff --git a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/CMakeLists.txt b/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/CMakeLists.txt deleted file mode 100644 index 8739f3bf3547df6318a172adfff37074575ddcd0..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/CMakeLists.txt +++ /dev/null @@ -1,44 +0,0 @@ -################################################################################ -# Package: TrigIDJpsiMonitoring -################################################################################ - -# Declare the package name: -atlas_subdir( TrigIDJpsiMonitoring ) - -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Event/EventInfo - InnerDetector/InDetConditions/InDetBeamSpotService - Reconstruction/Particle - Trigger/TrigAnalysis/TrigDecisionTool - Trigger/TrigAnalysis/TrigInDetAnalysis - Trigger/TrigAnalysis/TrigInDetAnalysisUtils - Trigger/TrigEvent/TrigMuonEvent - Trigger/TrigEvent/TrigParticle - Trigger/TrigEvent/TrigSteeringEvent - Trigger/TrigMonitoring/TrigHLTMonitoring - Trigger/TrigTools/TrigJPsiTools - PRIVATE - Control/AthenaKernel - Control/AthenaMonitoring - GaudiKernel - Reconstruction/MuonIdentification/muonEvent - Reconstruction/egamma/egammaEvent - Tracking/TrkEvent/VxVertex - Trigger/TrigEvent/TrigInDetEvent - Trigger/TrigTruthEvent/TrigInDetTruthEvent ) - -# External dependencies: -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint ) - -# Component(s) in the package: -atlas_add_component( TrigIDJpsiMonitoring - src/*.cxx - src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} EventInfo Particle TrigDecisionToolLib TrigInDetAnalysis TrigInDetAnalysisUtils TrigMuonEvent TrigParticle TrigSteeringEvent TrigHLTMonitoringLib TrigJPsiTools AthenaKernel AthenaMonitoringLib GaudiKernel muonEvent egammaEvent VxVertex TrigInDetEvent TrigInDetTruthEvent ) - -# Install files from the package: -atlas_install_headers( TrigIDJpsiMonitoring ) -atlas_install_python_modules( python/*.py ) - diff --git a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/TrigIDJpsiMonitoring/AnalysisConfig_Jpsi.h b/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/TrigIDJpsiMonitoring/AnalysisConfig_Jpsi.h deleted file mode 100644 index c82f3053bbb4bed9e876d30a043018c10537f2e0..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/TrigIDJpsiMonitoring/AnalysisConfig_Jpsi.h +++ /dev/null @@ -1,640 +0,0 @@ -// emacs: this is -*- c++ -*- - -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -/** @file AnalysisConfig_Jpsi.h */ -/** @author Mark Sutton (sutt@cern.ch) **/ -/** @author Peter Wijeratne (paw@hep.ucl.ac.uk) **/ -/** @author Christian Gutschow (chris.g@cern.ch) **/ - -#ifndef TrigIDJpsiMonitoring_AnalysisConfig_Jpsi_H -#define TrigIDJpsiMonitoring_AnalysisConfig_Jpsi_H - -#include "TrigHLTMonitoring/IHLTMonTool.h" -#include "InDetBeamSpotService/IBeamCondSvc.h" - -#include "TrigInDetAnalysisUtils/T_AnalysisConfig.h" - -#include "TrigJPsiTools/MakeDiMuonsTool.h" - -#include "TrigIDJpsiMonitoring/JpsiTrackSelector.h" - -#include "TrigIDJpsiMonitoring/JpsiAnalysis.h" -#include "TrigIDJpsiMonitoring/DuplicateRemover.h" - -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" - -#include "TrigInDetAnalysisUtils/Associator_BestMatch.h" -//#include "TrigInDetAnalysisUtils/TIDA_newtracking.h" - -//#include "RecoToolInterfaces/IExtrapolateToCaloTool.h" -//#include "TrigInDetTrackExtrapolator/TrigInDetTrackExtrapolator.h" - -#include "TROOT.h" -#include "TFile.h" -#include "TH1F.h" -#include "TLorentzVector.h" - -namespace TrigInDetAnalysis { - - class AnalysisConfig_Jpsi : public T_AnalysisConfig<IHLTMonTool> { - - public: - - // Full constructor: test/reference/selection - // - analysisInstanceName: the name of the analysis chain being created - // - xxxChainName: the name of the chain to be used as test/reference/selection; - // must be "StoreGate" in case of direct access to SG containers - // - xxxType: the type of tracks to be retrieved from the test/reference/selection chain or container - // - xxxKey: the key for tracks to be retrieved from the test/reference/selection chain or container - // - roiInfo: in case the test chain is a real chain, this is used to specify RoI widths; - // in case the test chain is a fake chain, this is used for RoI position too - // - all standard operations are performed in loops over 0=test 1=reference 2=selection - AnalysisConfig_Jpsi(const std::string &analysisInstanceName, const std::string& testChainName, const std::string& testType, - const std::string& testKey, const std::string& referenceChainName, const std::string& referenceType, - const std::string& referenceKey, const std::string& selectionChainName, const std::string& selectionType, - const std::string& selectionKey, TIDARoiDescriptor* roiInfo, TrackFilter* testFilter, - TrackFilter* referenceFilter, TrackFilter* selectionFilter, TrackAssociator* associator, - TrackAnalysis* analysis) : T_AnalysisConfig<IHLTMonTool>( analysisInstanceName, testChainName, - testType, testKey, referenceChainName, - referenceType, referenceKey, - selectionChainName, selectionType, - selectionKey, roiInfo, testFilter, - referenceFilter, selectionFilter, - associator, analysis), - //m_iBeamCondSvc(0) - m_iBeamCondSvc("BeamCondSvc",analysisInstanceName), - m_toolSvc("ToolSvc",analysisInstanceName), - m_selectorTestA(0), m_selectorTestB(0) { - // m_efExtrapolator("ExtrapolateToCaloTool/ExtrapolateToCaloTool"), - // m_l2Extrapolator("TrigInDetTrackExtrapolator") { - m_selectorJ = 0; - } - - // Partial constructor: test/reference - // - analysisInstanceName: the name of the analysis chain being created - // - xxxChainName: the name of the chain to be used as test/reference; - // must be "StoreGate" in case of direct access to SG containers - // - xxxType: the type of tracks to be retrieved from the test/reference chain or container - // - xxxKey: the key for tracks to be retrieved from the test/reference chain or container - // - roiInfo: in case the test chain is a real chain, this is used to specify RoI widths; - // in case the test chain is a fake chain, this is used for RoI position too - // - all standard operations are performed in loops over 0=test 1=reference 2=selection - AnalysisConfig_Jpsi(const std::string &analysisInstanceName, const std::string &testChainName, const std::string &testType, - const std::string &testKey, const std::string &referenceChainName, const std::string &referenceType, - const std::string &referenceKey, TIDARoiDescriptor* roiInfo, TrackFilter* testFilter, - TrackFilter* referenceFilter, TrackAssociator* associator, TrackAnalysis* analysis) : - T_AnalysisConfig<IHLTMonTool>( analysisInstanceName, testChainName, testType, testKey, - referenceChainName, referenceType, referenceKey, roiInfo, - testFilter, referenceFilter, associator, analysis), - //m_iBeamCondSvc(0), - m_iBeamCondSvc("BeamCondSvc",analysisInstanceName), - m_toolSvc("ToolSvc",analysisInstanceName), - m_jpsi(0), m_remover(0), m_selectorTestA(0), m_selectorTestB(0) { - // m_efExtrapolator("ExtrapolateToCaloTool/ExtrapolateToCaloTool"), - // m_l2Extrapolator("TrigInDetTrackExtrapolator") { - - if(m_selectorRef) { - delete m_selectorRef; - m_selectorRef = new JpsiTrackSelector( referenceFilter ); - } - - if(m_selectorTest) { - delete m_selectorTest; - m_selectorTest = new JpsiTrackSelector( testFilter ); - } - m_selectorJ = 0; - m_jpsi = new MakeDiMuonsTool(); - m_remover = new DuplicateRemover(); - m_selectorTestA = new TrigTrackSelector( testFilter ); - m_selectorTestB = new TrigTrackSelector( testFilter ); - //if(m_l2Extrapolator.retrieve().isFailure()) cout << ">>> Unable to locate L2 extrapol tool!!" << endl; - //if(m_efExtrapolator.retrieve().isFailure()) cout << ">>> Unable to locate EF extrapol tool!!" << endl; - } - - - virtual ~AnalysisConfig_Jpsi() { - delete m_jpsi; - delete m_remover; - delete m_analysis; - delete m_selectorTestA; - delete m_selectorTestB; - //if ( m_associator ){delete m_associator; m_associator=NULL;} - } - - virtual void book(); - virtual void finalize(); - - // helper functions - float deltaR( float eta1, float phi1, float eta2, float phi2); - float deltaPhi(float phi1, float phi2); - float fixPhi( float phi); - - //analysis - - JpsiAnalysis* m_analysisJ; - - template<class TrackCollection> void selectTracks(const std::string& key="", unsigned index=0,const std::string& chain="") { - m_provider->msg(MSG::DEBUG) << "Starting selectTracks ..." << endmsg; - - Trig::ExpertMethods* em = (*m_tdt)->ExperimentalAndExpertMethods(); - em->enable(); - const HLT::NavigationCore* nc = em->getNavigation(); - - Trig::FeatureContainer fcont = (*m_tdt)->features( chain, TrigDefs::alsoDeactivateTEs ); - const std::vector< Trig::Combination >& comb = fcont.getCombinations(); - std::vector< Trig::Combination >::const_iterator c_itr = comb.begin(); - std::vector< Trig::Combination >::const_iterator c_end = comb.end(); - - std::cout << "choosing ID chain name..." << std::endl; - - std::string idChainName; - if(chain.find("2mu4T_") != std::string::npos) idChainName = "L2_mu4T_IDTrkNoCut"; - //if(chain.find("2mu4T_") != std::string::npos) idChainName = "L2_muon_standalone_mu4T"; - //if(chain.find("2mu4T_") != std::string::npos) idChainName = "somestuff"; - if(chain.find("2mu4_") != std::string::npos) idChainName = "L2_mu4_IDTrkNoCut"; - if(chain.find("2mu13_") != std::string::npos) idChainName = "L2_mu13_IDTrkNoCut"; - if(chain.find("e4_etcut_Jpsi") != std::string::npos) idChainName = "L2_e4_etcutid"; - else if(chain.find("e5_tight1_") != std::string::npos) idChainName = "L2_e5_tight1id"; - if(chain.find("e24vh_") != std::string::npos) idChainName = "L2_e15_NoCutid"; - if(chain.find("mu24i_") != std::string::npos) idChainName = ""; //L2_mu24_tight"; - if(chain.find("_mu20") != std::string::npos) idChainName = ""; - //if(chain.find("mu24i_") != std::string::npos) idChainName = " L2_muon_standalone_mu18_tight"; - - m_provider->msg(MSG::DEBUG) << "chain= " << chain - << " idChainName= " << idChainName - << " key= " << key << endmsg; - - for( ; c_itr != c_end; ++c_itr ) { - // Now we iterate over accepted "combinations". (Single or multiple - // RoIs that passed the trigger.) - /*if(index==0) cout << "A Before " << idChainName << " HLTTruncated = " << HLTTruncated << std::endl; - if(index==1) cout << "B Before " << idChainName << " HLTTruncated = " << HLTTruncated << std::endl; - if(index==2) cout << "C Before " << idChainName << " HLTTruncated = " << HLTTruncated << std::endl;*/ - //cout << " header - before get<...>" << std::endl; - std::vector< Trig::Feature< TrackCollection > > probeTracks = c_itr->get< TrackCollection >(key, TrigDefs::alsoDeactivateTEs, idChainName); - //cout << " header - after get<...>" << probeTracks.size() << std::endl; - - // This will probably be a single-element vector if the chain used a - // single TE. But if it was constructed from multiple TEs, we should - // have multiple track collections here. - // cout << "\n# combinations = " << comb.size() << " # collections = " << probeTracks.size() << "\n" << std::endl; - - for(unsigned ifeat = 0; ifeat < probeTracks.size(); ++ifeat) { - - Trig::Feature<TrackCollection> trackfeature = probeTracks.at(ifeat); - - Trig::Feature<TrigRoiDescriptor> trackroi = (*m_tdt)->ancestor<TrigRoiDescriptor>(trackfeature); - const TrigRoiDescriptor* roid1 = trackroi.cptr(); - // cout << "ID track RoI ID = " << roid1->roiId() << std::endl; - /// if there are > 3 combinations, roiID can be > 1; ie. there are > 2 RoIs - /// currently we ignore them - int roiID = roid1->roiId(); - m_provider->msg(MSG::DEBUG) << "roi ID: " << roiID << endmsg; - - const HLT::TriggerElement* te = trackfeature.te(); - std::string TEName = ""; - TEName = (Trig::getTEName(*te).c_str()); - m_provider->msg(MSG::DEBUG) << "TE name: " << TEName << endmsg; - - // get all the named collections attached to the TE - //if(TEName == "L2_mu4T_IDTrkNoCut"){ - std::vector< const TrackCollection* > collectionVector; - if( !const_cast<HLT::NavigationCore *>(nc)->getFeatures( te, collectionVector, key ) ) return; - - for(unsigned iv = 0; iv < collectionVector.size(); iv++ ) { - // collectionVector holds different algorithms (StratA, B, C) - // index = 0, 1, 2 is the index where the algorithm sits - if(index != iv) continue; // only consider one algorithm - - ///finally, extract the tracks from this RoI - if(collectionVector[iv]) { - //if(count == ifeat){ - //cout << "V1 - RoI num: " << roiID << std::endl; - getL2tracks<TrackCollection>(collectionVector[iv], roiID); - //cout << "AC_Jpsi collectionVector[" << iv << "]->size() " << collectionVector[iv]->size() << " roiID " << roiID << std::endl; - //} - //if(roiID == 0) selectorA->selectTracks(collectionVector[iv], truthmap); - //if(roiID == 1) selectorB->selectTracks(collectionVector[iv], truthmap); - //if(roiID != 0 && roiID != 1) cout << "ID tracks roiID = " << roiID << std::endl; - } - } - //}//specify TEname - } - } - m_provider->msg(MSG::DEBUG) << "... end of selectTracks." << endmsg; - } - - template<class TrackCollection> void selectTracks0(const std::string &key="", unsigned index=0, const std::string& chain="") { - m_provider->msg(MSG::DEBUG) << "Starting selectTracks0 ..." << endmsg; - - Trig::ExpertMethods* em = (*m_tdt)->ExperimentalAndExpertMethods(); - em->enable(); - const HLT::NavigationCore* nc = em->getNavigation(); - - std::cout << "Chain: " << chain << std::endl; - Trig::FeatureContainer fcont = (*m_tdt)->features( chain, TrigDefs::alsoDeactivateTEs ); - const std::vector< Trig::Combination >& comb = fcont.getCombinations(); - std::vector< Trig::Combination >::const_iterator c_itr = comb.begin(); - std::vector< Trig::Combination >::const_iterator c_end = comb.end(); - - std::string idChainName; - if( (chain.find("2mu4T_")!=std::string::npos) ){ - if( key.find("InDetTrig") != std::string::npos) idChainName = "EFID_mu4T_IDTrkNoCut"; - else idChainName = "L2_mu4T_IDTrkNoCut"; - } - if( (chain.find("2mu4_")!=std::string::npos) ){ - if( key.find("InDetTrig") != std::string::npos) idChainName = "EFID_mu4_IDTrkNoCut"; - else idChainName = "L2_mu4_IDTrkNoCut"; - } - - if( (chain.find("2mu13_")!=std::string::npos) ){ - if( key.find("InDetTrig") != std::string::npos) idChainName = "EFID_mu13_IDTrkNoCut"; - else idChainName = "L2_mu4_IDTrkNoCut"; - } - - if( (chain.find("mu24i_")!=std::string::npos) ) { - if( key.find("InDetTrig") != std::string::npos) idChainName = ""; - else idChainName = "L2_mu24_tight"; - } - if( (chain.find("_mu20")!=std::string::npos) ) { - if( key.find("InDetTrig") != std::string::npos) idChainName = ""; - else idChainName = "L2_mu24_tight"; - } - - if( (chain.find("e4_etcut_Jpsi")!=std::string::npos) ){ - if( key.find("InDetTrig") != std::string::npos) idChainName = "EF_e4_etcutid"; - else idChainName = "L2_e4_etcutid"; - } - else if( (chain.find("e5_tight1_")!=std::string::npos) ){ - if( key.find("InDetTrig") != std::string::npos) idChainName = "EF_e5_tight1id"; - else idChainName = "L2_e5_tight1id"; - } - - if( (chain.find("e24vh_")!=std::string::npos) ){ - if( key.find("InDetTrig") != std::string::npos) idChainName = "EF_e15_NoCutid1"; - else idChainName = "L2_e15_NoCutcl"; - } - - m_provider->msg(MSG::DEBUG) << "EF idChainName = " << idChainName << " key = " << key << endmsg; - - for( ; c_itr != c_end; ++c_itr ) { - // Now we iterate over accepted "combinations". (Single or multiple - // RoIs that passed the trigger.) - // if(index==0) std::cout << "A Before " << idChainName << " HLTTruncated = " << HLTTruncated << std::endl; - /* if(index==1) std::cout << "B Before " << idChainName << " HLTTruncated = " << HLTTruncated << std::endl; - if(index==2) std::cout << "C Before " << idChainName << " HLTTruncated = " << HLTTruncated << std::endl;*/ - std::cout << "selectTracks0 BEFORE c_itr->get<...>(...)" << std::endl; - std::vector< Trig::Feature< TrackCollection > > probeTracks = c_itr->get< TrackCollection >(key, TrigDefs::alsoDeactivateTEs, idChainName); - std::cout << "selectTracks0 AFTER c_itr->get<...>(...)" << std::endl; - /// if empty, probably 2011... so try this one - if(chain.find("mu24i") != std::string::npos && !probeTracks.size()) { - if(chain.find("2mu4T_") != std::string::npos) idChainName = "EF_EFID_mu4T_IDTrkNoCut"; - if(chain.find("2mu13_") != std::string::npos) idChainName = "EF_EFID_mu13_IDTrkNoCut"; - probeTracks = c_itr->get< TrackCollection >(key, TrigDefs::alsoDeactivateTEs, idChainName); - } - /* std::cout << "After after " << probeTracks.size() << std::endl; - if(probeTracks.size() == 0) idChainName = "EF_trt_mu4T_IDTrkNoCut"; - probeTracks = c_itr->get< TrackCollection >(key, TrigDefs::alsoDeactivateTEs, idChainName); - std::cout << "Next try " << probeTracks.size() << std::endl; - if(probeTracks.size() == 0) idChainName = "EF_MS_mu4T_IDTrkNoCut"; - probeTracks = c_itr->get< TrackCollection >(key, TrigDefs::alsoDeactivateTEs, idChainName); - std::cout << "And again " << probeTracks.size() << std::endl; - if(probeTracks.size() == 0) idChainName = "EF_TB_mu4T_IDTrkNoCut"; - probeTracks = c_itr->get< TrackCollection >(key, TrigDefs::alsoDeactivateTEs, idChainName); - std::cout << "And and again " << probeTracks.size() << std::endl; - if(probeTracks.size() == 0) idChainName = "EF_SA_mu4T_IDTrkNoCut"; - probeTracks = c_itr->get< TrackCollection >(key, TrigDefs::alsoDeactivateTEs, idChainName); - std::cout << "And and and again " << probeTracks.size() << std::endl; - if(probeTracks.size() == 0) idChainName = "EF_mu4T_IDTrkNoCut"; - probeTracks = c_itr->get< TrackCollection >(key, TrigDefs::alsoDeactivateTEs, idChainName); - std::cout << "Last try " << probeTracks.size() << std::endl;*/ - - // This will probably be a single-element vector if the chain used a - // single TE. But if it was constructed from multiple TEs, we should - // have multiple track collections here. - //std::cout << "\n# combinations = " << comb.size() << " # collections = " << probeTracks.size() << "\n" << std::endl; - - for(unsigned ifeat = 0; ifeat < probeTracks.size(); ++ifeat) { - - Trig::Feature<TrackCollection> trackfeature = probeTracks[ifeat]; - - Trig::Feature<TrigRoiDescriptor> trackroi = (*m_tdt)->ancestor<TrigRoiDescriptor>(trackfeature); - const TrigRoiDescriptor* roid1 = trackroi.cptr(); - //std::cout << "ID track RoI ID = " << roid1->roiId() << std::endl; - - // if there are > 3 combinations, roiID can be > 1; ie. there are > 2 RoIs - // currently we ignore them - int roiID = roid1->roiId(); - m_provider->msg(MSG::DEBUG) << "EF roi ID: " << roiID << "eta = " << roid1->eta() << " phi = " << roid1->phi() << endmsg; - - const HLT::TriggerElement* te = trackfeature.te(); - std::string TEName = ""; - TEName = (Trig::getTEName(*te).c_str()); - m_provider->msg(MSG::DEBUG) << "EF TE name: " << TEName << endmsg; - - // get all the named collections attached to the TE - std::vector<const TrackCollection*> collectionVector; - if( !const_cast<HLT::NavigationCore*>(nc)->getFeatures(te, collectionVector, key) ) return; - - for( unsigned iv = 0; iv < collectionVector.size(); iv++ ) { - // collectionVector holds different algorithms - // for EF, index is always 0 - if(index != iv) continue; // only consider one algorithm - //finally, extract the tracks from this RoI - if(collectionVector[iv]) { - //if(count == ifeat) { - //std::cout << "V2 - RoI num: " << roiID << std::endl; - getEFtracks<TrackCollection>(collectionVector[iv], roiID); - //std::cout << "AC_Jpsi collectionVector[" << iv << "]->size() " << collectionVector[iv]->size() << std::endl; - //} - //if(roiID == 0) selectorA->selectTracks(collectionVector[iv], truthmap); - //if(roiID == 1) selectorB->selectTracks(collectionVector[iv], truthmap); - //if(roiID != 0 && roiID != 1) std::cout << "ID tracks roiID = " << roiID << std::endl; - } - } - } - } - m_provider->msg(MSG::DEBUG) << "... end of selectTracks0." << endmsg; - } - - ///PW modified for 2 RoIs - /* template<class TrackCollection> - void selectTracks( TrigTrackSelector* selector, const std::string& key="", const TrigInDetTrackTruthMap* truthmap=0, unsigned index=0, - const std::string& chain="") { - - ///get the all-powerful expert methods - Trig::ExpertMethods* expert = (*m_tdt)->ExperimentalAndExpertMethods(); - expert->enable(); - - ///retrieve all trigger elements for defined subchain, eg. for a primary trigger "EF_2mu4T_Jpsimumu_IDTrkNoCut", - ///chain = "L2_mu4T_IDTrkNoCut" - std::vector<HLT::TriggerElement*> tes; - expert->getNavigation()->getAllOfType(chain, tes, true); - - ///this loop should iterate once / RoI - for(std::vector<HLT::TriggerElement*>::const_iterator te = tes.begin(); te!=tes.end(); te++){ - // std::vector<HLT::TriggerElement*>::const_iterator te = tes.begin(); - - std::string TEName = ""; - TEName = (Trig::getTEName(*(*te))).c_str(); - std::cout << "TE name = " << TEName << std::endl; - - ///using the ancestor method gives us access to all the tracks - for leading and - ///test algorithms - in the RoI - std::vector< Trig::Feature<TrackCollection> > featureVector = (*m_tdt)->ancestors<TrackCollection>(*te, key); - - ///this loop should iterate once / track collection, eg. MuonA, MuonB, etc... - for( unsigned iv=0; iv<featureVector.size(); iv++){ - if( index!=iv ) continue; - const TrackCollection* idTracks = featureVector[iv].cptr(); - - ///finally, extract the tracks from this RoI - std::string algo; - if(index==0) algo = "A"; - if(index==1) algo = "B"; - if(index==2) algo = "C"; - std::cout << "key = " << key << algo << std::endl; - if(idTracks) selector->selectTracks(idTracks, truthmap); - - } - } - }*/ - - protected: - - virtual void loop(); - - template<class TrackCollection> void getL2tracks(const TrackCollection *collection, int roi) { - - m_provider->msg(MSG::DEBUG) << "Starting getL2tracks ..." << endmsg; - typename TrackCollection::const_iterator trackitr = collection->begin(); - typename TrackCollection::const_iterator trackend = collection->end(); - for( ; trackitr != trackend; ++trackitr) { - const TrigInDetTrack* track = dynamic_cast<const TrigInDetTrack*>( *trackitr ); - if(track) { - double eta = track->param()->eta(); - double phi = track->param()->phi0(); - double z0 = track->param()->z0(); - double pT = track->param()->pT(); - double d0 = track->param()->a0(); - double deta = track->param()->eeta(); - double dphi = track->param()->ephi0(); - double dz0 = track->param()->ez0(); - double dpT = track->param()->epT(); - double dd0 = track->param()->ea0(); - - int algoid = track->algorithmId(); - int nBlayerHits = (track->HitPattern() & 0x1); - int nPixelHits = 2 * track->NPixelSpacePoints(); // NB: for comparison with offline - int nSctHits = 2 * track->NSCT_SpacePoints(); // a spacepoint is 2 "hits" - int nStrawHits = track->NStrawHits(); - int nTrHits = track->NTRHits(); - int nSiHits = nPixelHits + nSctHits; - - bool expectBL = false; //not filled in - - unsigned int hitPattern = track->HitPattern(); - unsigned int multiPattern = 0; - - double chi2 = track->chi2(); - - bool truth = false; - int match_barcode = -1; - - m_trigTracks.push_back( new TIDA::Track(eta, phi, z0, d0, pT, chi2, - deta, dphi, dz0, dd0, dpT, - nBlayerHits, nPixelHits, nSctHits, - nSiHits, nStrawHits, nTrHits, - hitPattern, multiPattern, - algoid, truth, -1, match_barcode, expectBL) ); - - /*double phiAtCalo = 0., etaAtCalo = 0.; - // arguments: track, RCalBarrelFace, ZCalEndcapFace, extrapolatated phi, extrapolated phi - StatusCode sc = m_l2Extrapolator->extrapolateToCalo((*trackitr), 1470.0*CLHEP::mm, 3800.0*CLHEP::mm, phiAtCalo, etaAtCalo); - if(sc.isFailure()) std::cout << "L2 extrapolator failed " << std::endl; - m_phiAtCalo[ int(m_trigTracks.size() - 1) ] = phiAtCalo; - m_etaAtCalo[ int(m_trigTracks.size() - 1) ] = etaAtCalo;*/ - m_trackRois[ int(m_trigTracks.size() - 1) ] = roi; - //std::cout << "SUTT ID track " << *t << "\t0x" << std::hex << track->HitPattern() << std::dec << std::endl; - //if( !addTrack( t ) ) delete t; - } // if(track) - } // loop over collection - m_provider->msg(MSG::DEBUG) << "... end of getL2tracks." << endmsg; - } - - template<class TrackCollection> void getEFtracks(const TrackCollection *collection, int roi) { - m_provider->msg(MSG::DEBUG) << "Starting getEFtracks ..." << endmsg; - - typename TrackCollection::const_iterator trackitr = collection->begin(); - typename TrackCollection::const_iterator trackend = collection->end(); - for( ; trackitr != trackend; ++trackitr) { - const Rec::TrackParticle* track = (*trackitr); - if(track) { - static int hpmap[] = { 0, 1, 2, 7, 8, 9, 3, 4, 5, 6, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 }; - - - // #ifndef TIDA_NEWTRACKING_H - // const Trk::MeasuredPerigee* measPer = track->measuredPerigee(); - // #else - const Trk::Perigee* measPer = track->measuredPerigee(); - // #endif - - double pT = measPer->pT(); - double eta = measPer->eta(); - double phi = measPer->parameters()[Trk::phi0]; - double z0 = measPer->parameters()[Trk::z0]; - double d0 = measPer->parameters()[Trk::d0]; - - m_provider->msg(MSG::DEBUG) << "current track -- eta = " << eta << " phi = " << phi << endmsg; - - if( measPer->parameters()[Trk::qOverP]<0 ) pT *= -1; - - double deta = 1; - double dphi = 1; - double dz0 = 1; - double dd0 = 1; - double dpT = 1; - - // Check number of hits - // NB: a spacepoint is two offline "hits", so a pixel spacepoint is really - // 2 "hits" and an offline SCT "hit" is really a 1D cluster, so two intersetcting - // stereo clusters making a spacepoint are two "hits" - const Trk::TrackSummary *summary = track->trackSummary(); - int nBlayerHits = 2*summary->get(Trk::numberOfInnermostPixelLayerHits); - int nPixelHits = 2*summary->get(Trk::numberOfPixelHits); - int nSctHits = summary->get(Trk::numberOfSCTHits); - int nStrawHits = summary->get(Trk::numberOfTRTHits); - int nTrHits = summary->get(Trk::numberOfTRTHighThresholdHits); - - int nSiHits = nPixelHits + nSctHits; - bool expectBL = summary->get(Trk::expectInnermostPixelLayerHit); - - const Trk::FitQuality *quality = track->fitQuality(); - double chi2 = quality->chiSquared(); - - unsigned bitmap = 0; - - for(int ih = 0; ih < 20; ih++ ) { - if( summary->isHit(Trk::DetectorType(ih)) ) bitmap |= ( 1<<hpmap[ih] ); - } - - // now some *ridiculous* code to get the author of the - // TrackParticle (offline) tracks - - int fitter = track->info().trackFitter(); - std::string dumpinfo = track->info().dumpInfo(); - - int trackAuthor = -1; - if( fitter > 0 && fitter<Trk::TrackInfo::NumberOfTrackFitters ) { - if( dumpinfo.find("TRTStandalone" ) != std::string::npos) trackAuthor = 2; - else if( dumpinfo.find("TRTSeededTrackFinder") != std::string::npos) trackAuthor = 1; - else trackAuthor = 0; - } - - m_trigTracks.push_back( new TIDA::Track(eta, phi, z0, d0, pT, chi2, - deta, dphi, dz0, dd0, dpT, - nBlayerHits, nPixelHits, nSctHits, - nSiHits, nStrawHits, nTrHits, - bitmap, 0, trackAuthor, expectBL) ); - - const Trk::TrackParticleBase trk = (Trk::TrackParticleBase)*track; - m_provider->msg(MSG::DEBUG) << "original track?? " << trk.originalTrack() << endmsg; - - m_trackRois[ int(m_trigTracks.size() - 1) ] = roi; - //std::cout << "SUTT ID track " << *t << "\t0x" << std::hex << track->HitPattern() << std::dec << std::endl; - //if( !addTrack( t ) ) delete t; - //if(result) delete result; - } // if(track) - } // end of loop over collection - //delete m_test; - m_provider->msg(MSG::DEBUG) << "... end of getEFtracks." << endmsg; - } - - void makeClean() { - m_provider->msg(MSG::DEBUG) << "Start cleaning... " << endmsg; - for(unsigned i=0; i < m_trigTracks.size(); i++) delete m_trigTracks[i]; - m_trigTracks.clear(); - m_trackRois.clear(); - //m_etaAtCalo.clear(); - //m_phiAtCalo.clear(); - if(m_selectorJ) m_selectorJ->clear(); - if(m_selectorTestA) m_selectorTestA->clear(); - if(m_jpsi) m_jpsi->clear(); - m_provider->msg(MSG::DEBUG) << "... all clear." << endmsg; - } - - private: - - // Beamspot - ServiceHandle<IBeamCondSvc> m_iBeamCondSvc; - ServiceHandle<IToolSvc> m_toolSvc; - //IBeamCondSvc* m_iOnlineBeamCondSvc; - - //ServiceHandle<IBeamCondSvc> m_iBeamCondSvc; // pointer to beam condition service - //Trk::VxCandidate* m_beamSpotVxCand; - - //TrigJpsiTools - std::string m_stream; - std::string m_tracksName; - std::string m_triggerChainName; - std::string m_muonCollection; - double m_jpsiPDGmass; - double m_jpsiwidth; - double m_ptcut; - double m_tagptcut; - double m_etacut; - double m_tagetacut; - double m_muonMass; - double m_plusMass; - double m_minusMass; - int m_checkrate; - int m_events; - bool m_TagAndProbe; - bool m_useTrigger; - bool m_runOnline; - - unsigned int m_count_before, m_count_after; - - MakeDiMuonsTool* m_jpsi; - DuplicateRemover* m_remover; - - TrigTrackSelector* m_selectorTestA; - TrigTrackSelector* m_selectorTestB; - //ToolHandle<IExtrapolateToCaloTool> m_efExtrapolator; - //ToolHandle<ITrigInDetTrackExtrapolator> m_l2Extrapolator; - - ///temp - std::vector<int> m_testtrackRoIs; - std::vector<int> m_reftrackRoIs; - ///temp - //TFile *fOut; - //TH1F *my_hist; - bool /*my_check,*/ m_isMuon, m_isJpsi; - unsigned int m_trigDefs; - - //map<int, std::vector<Track*> > m_trigTracks; - std::map<int, int> m_trackRois; - //map<int, double> m_phiAtCalo, m_etaAtCalo; - std::vector<TIDA::Track*> m_trigTracks; - - // SG - std::string m_truthCollection; - - //selector - JpsiTrackSelector* m_selectorJ; - - //associator - Associator_BestDeltaRMatcher* m_associatorJ; - - //event info - const DataHandle<EventInfo> m_eventInfo; - - }; -} - -#endif // TrigIDJpsiMonitoring_AnalysisConfig_Jpsi_H - diff --git a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/TrigIDJpsiMonitoring/DuplicateRemover.h b/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/TrigIDJpsiMonitoring/DuplicateRemover.h deleted file mode 100644 index 80bad92cf86a7526480a75a735cdb025b6607e8f..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/TrigIDJpsiMonitoring/DuplicateRemover.h +++ /dev/null @@ -1,522 +0,0 @@ -// emacs: this is -*- c++ -*- - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// File name: DuplicateRemover.h -// Description: Method to remove duplicated EF muons from overlapping RoIs -// Author: Peter Wijeratne (paw@hep.ucl.ac.uk) -// Author: Christian Gutschow (chris.g@cern.ch) - -#ifndef DUPLICATEREMOVER_H -#define DUPLICATEREMOVER_H - -#include "TrigInDetAnalysisUtils/TIDARoiDescriptorBuilder.h" - -#include "TrigMuonEvent/TrigMuonEFInfoContainer.h" -#include "TrigMuonEvent/TrigMuonEFInfo.h" -#include "TrigMuonEvent/TrigMuonEFTrack.h" -#include "TrigMuonEvent/TrigMuonEFCbTrack.h" -#include "TrigMuonEvent/TrigMuonEFInfoTrackContainer.h" - -#include "Particle/TrackParticle.h" - -#include "TrigSteeringEvent/TrigRoiDescriptorCollection.h" - -//tmp -#include "TrigDecisionTool/TrigDecisionTool.h" - -class DuplicateRemover { - -public: - - DuplicateRemover() { } - virtual ~DuplicateRemover() { } - - void muonMaker( Trig::FeatureContainer::combination_const_iterator dItr, std::string chain, - ToolHandle<Trig::TrigDecisionTool>* tool, unsigned int &trigDefs) { - - - // std::cout << "START REMOVER" << std::endl; - // while(dItr != dEnd){ - ///tmp - //double roiEta0 = 0.; - //double roiPhi0 = 0.; - ///tmp - - //cout << "duplicate remover -- get features..." << endl; - - std::vector< Trig::Feature<TrigRoiDescriptor> > initRois = dItr->get<TrigRoiDescriptor>("forID", trigDefs);//TrigDefs::Physics); - - //cout << "duplicate remover -- get init rois..." << endl; - if(initRois.empty()) initRois = dItr->get<TrigRoiDescriptor>("", TrigDefs::Physics); - if(initRois.empty()) initRois = dItr->get<TrigRoiDescriptor>("initialRoI", TrigDefs::Physics); - - // std::vector< Trig::Feature< TrigMuonEFInfoContainer > > muons = dItr->get< TrigMuonEFInfoContainer >("MuonEFInfo", TrigDefs::Physics); - - std::string probeTE = ""; - std::string tagTE = ""; - - ///default names are for data 12 - if(chain.find("_2mu4T_")!=std::string::npos){ - probeTE = "EF_SA_mu4T_IDTrkNoCut"; - tagTE = "EF_mu4T"; - } - if(chain.find("_2mu13_")!=std::string::npos){ - probeTE = "EF_SA_mu13_IDTrkNoCut"; - tagTE = "EF_mu13"; - } - - //cout << "duplicate remover -- get tag muons..." << endl; - std::vector< Trig::Feature< TrigMuonEFInfoContainer > > tagmuons = dItr->get< TrigMuonEFInfoContainer >("MuonEFInfo", trigDefs, tagTE); - //cout << "duplicate remover -- get probe muons..." << endl; - std::vector< Trig::Feature< TrigMuonEFInfoContainer > > probemuons = dItr->get< TrigMuonEFInfoContainer >("MuonEFInfo", trigDefs, probeTE); - - //cout << "duplicate remover -- done, try again?" << endl; - ///if they've got size 0, it's probably because we're running on data or MC 11; if just 0 probes, probably MC12 - if( tagmuons.size() == 0 ){ - if(chain.find("_2mu4T_")!=std::string::npos) tagTE = "EF_MS_mu4T"; - if(chain.find("_2mu13_")!=std::string::npos) tagTE = "EF_MS_mu13"; - tagmuons = dItr->get< TrigMuonEFInfoContainer >("MuonEFInfo", TrigDefs::Physics, tagTE); - } - if( probemuons.size() == 0 ){ - if(chain.find("_2mu4T_")!=std::string::npos) probeTE = "EF_MS_mu4T_IDTrkNoCut"; - if(chain.find("_2mu13_")!=std::string::npos) probeTE = "EF_MS_mu13_IDTrkNoCut"; - probemuons = dItr->get< TrigMuonEFInfoContainer >("MuonEFInfo", TrigDefs::Physics, probeTE); - } - - /*std::cout << "\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl; - std::cout << "!!!!!!!!! tagmuons.size = " << tagmuons.size() << std::endl; - std::cout << "!!!!!!!!! probemuons.size = " << probemuons.size() << std::endl; - std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;*/ - - - /* std::cout << "\n??????????????????????????????????????????????????" << std::endl; - std::cout << "????????? muons.size = " << muons.size() << std::endl; - std::cout << "????????????????????????????????????????????????????" << std::endl;*/ - - double PI = 3.14159265; - - ////// - /////// ADD BREAK OUT OF LOOP IF roiIt2 == muons.size() - ///// - - int probeRoiID = 0; - int tagRoiID = 0; - - std::vector<const TrigRoiDescriptor*> rois; - - for( unsigned roiIt1 = 0; roiIt1 < probemuons.size(); roiIt1++ ){ - - Trig::Feature< TrigMuonEFInfoContainer > trackFeature1 = probemuons.at(roiIt1); - const TrigMuonEFInfoContainer* trigMuon1 = trackFeature1.cptr(); - TrigMuonEFInfoContainer::const_iterator muonItr1 = trigMuon1->begin(); - if (muonItr1==trigMuon1->end()) continue; - const TrigMuonEFInfo* muoninfo1 = (*muonItr1); - - ///ROI associated with this Feature - Trig::Feature<TrigRoiDescriptor> trackroi1 = (*tool)->ancestor<TrigRoiDescriptor>(trackFeature1, "forID"); - const TrigRoiDescriptor* roid1 = trackroi1.cptr(); - TIDARoiDescriptor roiInfo1 = TIDARoiDescriptorBuilder(*roid1); - /* std::cout << "\nROI probe eta0 = " << roiInfo1.eta() << " phi0 = " << roiInfo1.phi() << " zed0 = " << roiInfo1.zed() - << "\neta halfwidth = " << roiInfo1.etaHalfWidth() << " phi halfwidth = " << roiInfo1.phiHalfWidth() - << " Z halfwidth = " << roiInfo1.zedHalfWidth() << " roiId = " << roid1->roiId() << "\n" - << std::endl;*/ - probeRoiID = roid1->roiId(); - - rois.push_back(roid1); - - if( !initRois.empty() ){ - - // const TrigRoiDescriptor* roid1 = initRois[roiIt1].cptr(); - // TIDARoiDescriptor roiInfo1 = TIDARoiDescriptorBuilder(*roid1); - - // std::cout << "\nROI probe eta = " << roiInfo1.eta() << " phi = " << roiInfo1.phi() - // << std::endl; - - if( muoninfo1->hasTrack() ){ - - const TrigMuonEFInfoTrackContainer* tc1 = muoninfo1->TrackContainer(); - - bool selected = false; - - for( TrigMuonEFInfoTrackContainer::const_iterator trackItr = tc1->begin(); trackItr != tc1->end(); trackItr++){ - - const TrigMuonEFInfoTrack* muonInfo1 = (*trackItr); - - if( muonInfo1->hasExtrapolatedTrack() ){ - - TrigMuonEFTrack* eTrack1 = muonInfo1->ExtrapolatedTrack(); - - ///tmp - // Trig::Feature<TrigRoiDescriptor> trackroi1 = (*tool)->ancestor<TrigRoiDescriptor>(trackFeature1); - // const TrigRoiDescriptor* roid1 = trackroi1.cptr(); - // std::cout << "\n!!!Probe!!! probe1 RoI eta = " << roid1->eta() << " phi = " << roid1->phi() - // << " probe pt = " << eTrack1->pt() << std::endl; - ///tmp - - - // std::cout << "RoI " << muoninfo1->RoINum() << " extrapolated track " << *eTrack1 << std::endl; - - for( unsigned roiIt2 = 0; roiIt2 < probemuons.size(); roiIt2++ ){ - - if( roiIt1 != roiIt2 ){ - - Trig::Feature< TrigMuonEFInfoContainer > trackFeature2 = probemuons.at(roiIt2); - const TrigMuonEFInfoContainer* trigMuon2 = trackFeature2.cptr(); - TrigMuonEFInfoContainer::const_iterator muonItr2 = trigMuon2->begin(); - const TrigMuonEFInfo* muoninfo2 = (*muonItr2); - - Trig::Feature<TrigRoiDescriptor> trackroi2 = (*tool)->ancestor<TrigRoiDescriptor>(trackFeature2); - const TrigRoiDescriptor* roid2 = trackroi2.cptr(); - TIDARoiDescriptor roiInfo2 = TIDARoiDescriptorBuilder(*roid2); - - if( !initRois.empty() ){ - - /* const TrigRoiDescriptor* roid2 = initRois[roiIt2].cptr(); - TIDARoiDescriptor roiInfo2 = TIDARoiDescriptorBuilder(*roid2);*/ - - if( muoninfo2->hasTrack() ){ - - const TrigMuonEFInfoTrackContainer* tc2 = muoninfo2->TrackContainer(); - - for( TrigMuonEFInfoTrackContainer::const_iterator trackItr = tc2->begin(); trackItr != tc2->end(); trackItr++){ - - const TrigMuonEFInfoTrack* muonInfo2 = (*trackItr); - - if( muonInfo2->hasExtrapolatedTrack() ){ - - TrigMuonEFTrack* eTrack2 = muonInfo2->ExtrapolatedTrack(); - - ///tmp - // Trig::Feature<TrigRoiDescriptor> trackroi2 = (*tool)->ancestor<TrigRoiDescriptor>(trackFeature2); - // const TrigRoiDescriptor* roid2 = trackroi2.cptr(); - // std::cout << "\n!!!Probe!!! probe2 RoI eta = " << roid2->eta() << " phi = " << roid2->phi0() - // << " probe pt = " << eTrack2->pt() << std::endl; - ///tmp - - // std::cout << "RoI " << muoninfo2->RoINum() << " extrapolated track " << *eTrack2 << std::endl; - - double deta = (eTrack1->eta() - eTrack2->eta()); - double dphi = (eTrack1->phi() - eTrack2->phi()); - if ( dphi > PI ) dphi -= 2*PI; - if ( dphi < -PI ) dphi += 2*PI; - - ///tmp - //roiEta0 = roiInfo1.eta(); - //roiPhi0 = roiInfo1.phi(); - ///tmp - - if( muoninfo1->RoINum() != muoninfo2->RoINum() && ((std::fabs(deta) < 0.08) && (std::fabs(dphi) < 0.08)) ){ - /// probably the same track - - double dphi1 = eTrack1->phi() - roiInfo1.phi(); - double dphi2 = eTrack2->phi() - roiInfo2.phi(); - if ( dphi1 > PI ) dphi1 -= 2*PI; - if ( dphi1 < -PI ) dphi1 += 2*PI; - if ( dphi2 > PI ) dphi2 -= 2*PI; - if ( dphi2 < -PI ) dphi2 += 2*PI; - /// track angles with respect to their RoIs - double deltarT1Roi1 = std::fabs( pow(eTrack1->eta() - roiInfo1.eta(),2) + pow(dphi1,2) ); - double deltarT2Roi2 = std::fabs( pow(eTrack2->eta() - roiInfo2.eta(),2) + pow(dphi2,2) ); - - /// pick the roi that is better aligned with this track - if( deltarT1Roi1 > deltarT2Roi2 ){ - eTrack1 = eTrack2; - ///tmp - ///tmp - //roiEta0 = roiInfo2.eta(); - //roiPhi0 = roiInfo2.phi(); - ///tmp - /// want to keep this information to check if probe was matched to an ID - muonInfo1 = muonInfo2; - roiInfo1 = roiInfo2; - // std::cout << "Switched!" << std::endl; - } - - }//check duplcates - pick 1 closest to centre of its RoI - - } - } // loop over tracks from RoI 2 - } // muoninfo2->hasTrack() - } // if ! initRois.empty() - - //cout << "muonInfo1: " << muonInfo1 << endl; - //cout << "roiInfo1: " << roiInfo1 << endl; - - }//roi1!=roi2 - - }//start 2nd RoI loop - - for( std::vector<const TrigMuonEFTrack*>::const_iterator setIt = m_muonExtrapolatedTracks.begin(); setIt != m_muonExtrapolatedTracks.end(); ++setIt){ - - double deta = ((*setIt)->eta() - eTrack1->eta()); - double dphi = ((*setIt)->phi() - eTrack1->phi()); - if ( dphi > PI ) dphi -= 2*PI; - if ( dphi < -PI ) dphi += 2*PI; - - if( (std::fabs(deta) < 0.08) && (std::fabs(dphi) < 0.08) ){ - selected = true; - } - } - - if( !selected ){ - m_muonExtrapolatedTracks.push_back(eTrack1); - m_probeRoIs.push_back(probeRoiID); - if(muonInfo1->hasCombinedTrack()){ - // std::cout << "This should happen most of the time... " << (muonInfo1->CombinedTrack())->getIDTrackParticle() << std::endl; - m_matchedProbes.push_back((muonInfo1->CombinedTrack())->getIDTrackParticle()); - //tmp - } - else m_matchedProbes.push_back(NULL); - // std::cout << "\nExtrapolatedTrack1 inserted." << *eTrack1 << "\n" << std::endl; - } - - }//extrapolated track? - } - } - } - } - - //int iroi = 0; - for( unsigned roiIt1 = 0; roiIt1 < tagmuons.size(); roiIt1++ ){ - Trig::Feature< TrigMuonEFInfoContainer > trackFeature1 = tagmuons.at(roiIt1); - Trig::Feature<TrigRoiDescriptor> trackroi1 = (*tool)->ancestor<TrigRoiDescriptor>(trackFeature1, ""); - const TrigRoiDescriptor* roid1 = trackroi1.cptr(); - rois.push_back(roid1); - //cout <<iroi++ << "rois: " << rois.back() << endl; - } - - for( unsigned roiIt1 = 0; roiIt1 < tagmuons.size(); roiIt1++ ){ - - ///tmp - //double roiEta = 0.; - //double roiPhi = 0.; - ///tmp - - Trig::Feature< TrigMuonEFInfoContainer > trackFeature1 = tagmuons.at(roiIt1); - const TrigMuonEFInfoContainer* trigMuon1 = trackFeature1.cptr(); - TrigMuonEFInfoContainer::const_iterator muonItr1 = trigMuon1->begin(); - const TrigMuonEFInfo* muoninfo1 = (*muonItr1); - - ///ROI associated with this Feature - Trig::Feature<TrigRoiDescriptor> trackroi1 = (*tool)->ancestor<TrigRoiDescriptor>(trackFeature1, ""); - const TrigRoiDescriptor* roid1 = trackroi1.cptr(); - TIDARoiDescriptor roiInfo1 = TIDARoiDescriptorBuilder(*roid1); - /* std::cout << "\nROI tag eta0 = " << roiInfo1.eta() << " phi0 = " << roiInfo1.phi() << " zed0 = " << roiInfo1.zed() - << "\neta halfwidth = " << roiInfo1.etaHalfWidth() << " phi halfwidth = " << roiInfo1.phiHalfWidth() - << " Z halfwidth = " << roiInfo1.zedHalfWidth() << " roiId = " << roid1->roiId() << "\n" - << std::endl;*/ - - if( !initRois.empty() ){ - - /* const TrigRoiDescriptor* roid1 = initRois[roiIt1].cptr(); - TIDARoiDescriptor roiInfo1 = TIDARoiDescriptorBuilder(*roid1); - roiID = roid1->roiId(); - std::cout << "\nROI tag eta = " << roiInfo1.eta() << " phi = " << roiInfo1.phi0() - << std::endl; - // std::cout << "\\\\roid1 = " << roid1->roiId() << std::endl; - */ - if( muoninfo1->hasTrack() ){ - - const TrigMuonEFInfoTrackContainer* tc1 = muoninfo1->TrackContainer(); - - bool selected = false; - - for( TrigMuonEFInfoTrackContainer::const_iterator trackItr = tc1->begin(); trackItr != tc1->end(); trackItr++){ - - const TrigMuonEFInfoTrack* muonInfo1 = (*trackItr); - - if( muonInfo1->hasCombinedTrack() ){ - - tagRoiID = roid1->roiId(); - - TrigMuonEFCbTrack* eTrack1 = muonInfo1->CombinedTrack(); - - // check if it actually fits the RoI - if(tc1->size() > 1){ - int index = 0; - double deltar = 0.; - double temp = 9999.; - for(unsigned i=0; i<rois.size(); i++){ - const Rec::TrackParticle* idComp = eTrack1->getIDTrackParticle(); - //double roiEtaHalfWidth = rois[i]->etaHalfWidth(); - //double roiPhiHalfWidth = rois[i]->phiHalfWidth(); - double roiEta = rois[i]->eta(); - double roiPhi = rois[i]->phi(); - double deltaPhi1 = 0.; - if(idComp) deltaPhi1 = idComp->phi() - roiPhi; - else deltaPhi1 = eTrack1->phi() - roiPhi; - if ( deltaPhi1 > PI ) deltaPhi1 -= 2*PI; - if ( deltaPhi1 < -PI ) deltaPhi1 += 2*PI; - if(idComp) deltar = std::sqrt( std::pow(deltaPhi1,2) + std::pow(idComp->eta() - roiEta, 2) ); - else deltar = std::sqrt( std::pow(deltaPhi1,2) + std::pow(eTrack1->eta() - roiEta, 2) ); - // std::cout << "\ndeltaPhi = " << deltaPhi1 << " deta = " << idComp->eta() - roiEta << std::endl; - if(deltar < temp){ - index = i; - temp = deltar; - } - - /* if(std::fabs(idComp->eta() - roiEta) > roiEtaHalfWidth || std::fabs(deltaPhi1) > roiPhiHalfWidth){ - std::cout << "Switching tag RoI ID from " << tagRoiID << " to " << probeRoiID << " because dEta = " << std::fabs(idComp->eta() - roiEta) - << " dPhi = " << std::fabs(deltaPhi1) << " and roiEtaHalfWidth = " << roiEtaHalfWidth << " roiPhiHalfWidth = " - << roiPhiHalfWidth - << "\ntag with eta = " << idComp->eta() << " phi = " << idComp->phi() - << "\nancestor roiId = " << tagRoiID << " trigmuon EDM roiNum = " << muoninfo1->RoINum() - << std::endl; - tagRoiID = probeRoiID; - }*/ - } - // std::cout << "Chose index " << index << " with deltar " << temp << " rois.size " << rois.size() << std::endl; - tagRoiID = rois[index]->roiId(); - } - ///tmp - // Trig::Feature<TrigRoiDescriptor> trackroi1 = (*tool)->ancestor<TrigRoiDescriptor>(trackFeature1); - // const TrigRoiDescriptor* roid1 = trackroi1.cptr(); - // std::cout << "\n!!!Tag!!! tag1 RoI eta = " << roid1->eta() << " phi = " << roid1->phi0() - // << " tag pt = " << eTrack1->pt() << std::endl; - ///tmp - - // std::cout << "RoI " << muoninfo1->RoINum() << " combined track " << *eTrack1 << std::endl; - - for( unsigned roiIt2 = roiIt1+1; roiIt2 < tagmuons.size(); roiIt2++ ){ - - Trig::Feature< TrigMuonEFInfoContainer > trackFeature2 = tagmuons.at(roiIt2); - const TrigMuonEFInfoContainer* trigMuon2 = trackFeature2.cptr(); - TrigMuonEFInfoContainer::const_iterator muonItr2 = trigMuon2->begin(); - const TrigMuonEFInfo* muoninfo2 = (*muonItr2); - - Trig::Feature<TrigRoiDescriptor> trackroi2 = (*tool)->ancestor<TrigRoiDescriptor>(trackFeature2); - const TrigRoiDescriptor* roid2 = trackroi2.cptr(); - TIDARoiDescriptor roiInfo2 = TIDARoiDescriptorBuilder(*roid2); - - if( !initRois.empty() ){ - - /* const TrigRoiDescriptor* roid2 = initRois[roiIt2].cptr(); - TIDARoiDescriptor roiInfo2 = TIDARoiDescriptorBuilder(*roid2);*/ - - if( muoninfo2->hasTrack() ){ - - const TrigMuonEFInfoTrackContainer* tc2 = muoninfo2->TrackContainer(); - - for( TrigMuonEFInfoTrackContainer::const_iterator trackItr = tc2->begin(); trackItr != tc2->end(); trackItr++){ - - const TrigMuonEFInfoTrack* muonInfo2 = (*trackItr); - - if( muonInfo2->hasCombinedTrack() ){ - - TrigMuonEFCbTrack* eTrack2 = muonInfo2->CombinedTrack(); - - ///tmp - // Trig::Feature<TrigRoiDescriptor> trackroi2 = (*tool)->ancestor<TrigRoiDescriptor>(trackFeature2); - // const TrigRoiDescriptor* roid2 = trackroi2.cptr(); - // std::cout << "!!!Tag!!! tag2 RoI eta = " << roid2->eta() << " phi = " << roid2->phi0() - // << " tag pt = " << eTrack2->pt() << std::endl; - ///tmp - - // std::cout << "RoI " << muoninfo2->RoINum() << " combined track " << *eTrack2 << std::endl; - - double deta = (eTrack1->eta() - eTrack2->eta()); - double dphi = (eTrack1->phi() - eTrack2->phi()); - if ( dphi > PI ) dphi -= 2*PI; - if ( dphi < -PI ) dphi += 2*PI; - - //tmp - //roiEta = roiInfo1.eta(); - //roiPhi = roiInfo1.phi(); - //tmp - - if( muoninfo1->RoINum() != muoninfo2->RoINum() && ((std::fabs(deta) < 0.08) && (std::fabs(dphi) < 0.08)) ){ - - double dphi1 = eTrack1->phi() - roiInfo1.phi(); - double dphi2 = eTrack2->phi() - roiInfo2.phi(); - if ( dphi1 > PI ) dphi1 -= 2*PI; - if ( dphi1 < -PI ) dphi1 += 2*PI; - if ( dphi2 > PI ) dphi2 -= 2*PI; - if ( dphi2 < -PI ) dphi2 += 2*PI; - double deltarT1Roi1 = std::fabs( pow(eTrack1->eta() - roiInfo1.eta(),2) + pow(dphi1,2) ); - double deltarT2Roi2 = std::fabs( pow(eTrack2->eta() - roiInfo2.eta(),2) + pow(dphi2,2) ); - - if( deltarT1Roi1 > deltarT2Roi2 ){ - eTrack1 = eTrack2; - // tagRoiID = roid2->roiId(); - // std::cout << "\\\\roid2 = " << roid2->roiId() << std::endl; - // std::cout << "Switched!" << std::endl; - //tmp - //roiEta = roiInfo2.eta(); - //roiPhi = roiInfo2.phi(); - //tmp - } - roiInfo1 = roiInfo2; - }//check duplicates - pick 1 closest to centre of its RoI - - } - } - } - } - }//start 2nd RoI loop - - for( std::vector<const TrigMuonEFCbTrack*>::const_iterator setIt = m_muonCombinedTracks.begin(); setIt != m_muonCombinedTracks.end(); ++setIt){ - - double deta = ((*setIt)->eta() - eTrack1->eta()); - double dphi = ((*setIt)->phi() - eTrack1->phi()); - if ( dphi > PI ) dphi -= 2*PI; - if ( dphi < -PI ) dphi += 2*PI; - - if( (std::fabs(deta) < 0.08) && (std::fabs(dphi) < 0.08) ){ - selected = true; - } - } - - if( !selected ){ - m_muonCombinedTracks.push_back(eTrack1); - m_tagRoiInfo.push_back(roiInfo1); - // std::cout << "DuplicateRemover finds tag with roiNum = " << tagRoiID << " eta = " << eTrack1->eta() << " phi = " << eTrack1->phi() << std::endl; - m_tagRoIs.push_back(tagRoiID); - //std::cout << "\nCombinedTrack1 inserted." << *eTrack1 << "\n" << std::endl; - } - - }//combined track? - - }//start track container loop - }//if has roi - }//if has track - }//start 1st RoI loop - - // dItr++; - // } - - } - - virtual void clear() { - m_muonExtrapolatedTracks.clear(); m_muonCombinedTracks.clear(); - m_matchedProbes.clear(); m_tagRoIs.clear(); - m_probeRoIs.clear(); m_tagRoiInfo.clear(); - } - - std::vector< const TrigMuonEFTrack* > getExTrks() const { return m_muonExtrapolatedTracks; } - std::vector< const TrigMuonEFCbTrack* > getCbTrks() const { return m_muonCombinedTracks; } - - std::vector< const Rec::TrackParticle* > getMatches() { return m_matchedProbes; }; - - ///temp, store tag muon RoI number - std::vector<int> getTagRoIs() { return m_tagRoIs; } - std::vector<int> getProbeRoIs() { return m_probeRoIs; } - std::vector<TIDARoiDescriptor> getRoiInfo() { return m_tagRoiInfo; } - -protected: - - std::vector< const TrigMuonEFTrack* > m_muonExtrapolatedTracks; - std::vector< const TrigMuonEFCbTrack* > m_muonCombinedTracks; - - std::vector< const Rec::TrackParticle* > m_matchedProbes; - - ///temp - std::vector<int> m_tagRoIs; - std::vector<int> m_probeRoIs; - std::vector<TIDARoiDescriptor> m_tagRoiInfo; - -}; - -#endif diff --git a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/TrigIDJpsiMonitoring/JpsiAnalysis.h b/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/TrigIDJpsiMonitoring/JpsiAnalysis.h deleted file mode 100644 index 7e0fb6e7566fea7764aed1fd0be3fac4a0c90522..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/TrigIDJpsiMonitoring/JpsiAnalysis.h +++ /dev/null @@ -1,253 +0,0 @@ -// emacs: this is -*- c++ -*- -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ -// -// @file JpsiAnalysis.h -// -// -// -// -// $Id: SigAnalysis.h, v0.0 Wed 28 Oct 2009 02:41:51 CET sutt $ - -//edits P. Wijeratne (paw@hep.ucl.ac.uk) -//edits C. Gutschow (chris.g@cern.ch) - -#ifndef __JPSIANALYSIS_H -#define __JPSIANALYSIS_H - -#include <iostream> -#include <vector> -#include <map> - -#include "TrigInDetAnalysis/TrackAnalysis.h" -#include "TrigInDetAnalysis/Track.h" -#include "TrigInDetAnalysis/Efficiency.h" -#include "TrigInDetAnalysis/TIDDirectory.h" - -#include "TrigIDJpsiMonitoring/JpsiTrack.h" - -#include "TH1F.h" -#include "TH2F.h" -#include "TProfile.h" - -///temp -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" -#include "TrigHLTMonitoring/IHLTMonTool.h" - -///temp -#include "TrigInDetAnalysis/TIDARoiDescriptor.h" - -class JpsiAnalysis : public TrackAnalysis { - -public: - - JpsiAnalysis( const std::string& name ) : TrackAnalysis( name ), m_chainName(name), - m_plusMass(0), m_minusMass(0), - //Nreco(0), - m_print(true), m_keepHistos(true), m_speaker(0) { - } - - ~JpsiAnalysis() { - - if(!m_keepHistos){ - std::map<std::string, TH1F*>::iterator hitr=m_histos.begin(); - std::map<std::string, TH1F*>::iterator hend=m_histos.end(); - for ( ; hitr!=hend ; hitr++ ) delete hitr->second; - - std::map<std::string, TProfile*>::iterator tphitr=m_tphistos.begin(); - std::map<std::string, TProfile*>::iterator tphend=m_tphistos.end(); - for ( ; tphitr!=tphend ; tphitr++ ) delete tphitr->second; - - // delete h2; delete h2r; delete h2m; - } - - } - - virtual void initialise(); - - virtual void execute(const std::vector<TIDA::Track*>& reftracks, - const std::vector<TIDA::Track*>& testtracks, - TrackAssociator* matcher); - - virtual void finalise(); - - //helper functions - float deltaR(float eta1, float phi1, float eta2, float phi2); - float deltaPhi(float phi1, float phi2); - float fixPhi(float phi); - - void setprint(bool p) { m_print=p; } - - std::map<std::string, TH1F*>::const_iterator THbegin() const { return m_histos.begin(); } - std::map<std::string, TH1F*>::const_iterator THend() const { return m_histos.end(); } - - std::map<std::string, TProfile*>::const_iterator TPbegin() const { return m_tphistos.begin(); } - std::map<std::string, TProfile*>::const_iterator TPend() const { return m_tphistos.end(); } - - std::map<std::string, TH2F*>::const_iterator TH2begin() const { return m_histos2d.begin(); } - std::map<std::string, TH2F*>::const_iterator TH2end() const { return m_histos2d.end(); } - - const std::map<std::string, TH1F*>& getHistograms() const { return m_histos; } - - void setChainName( const std::string& c ){ m_chainName = c; } - - void setPlusMass( const double& pm ){ m_plusMass = pm; } - void setMinusMass( const double& mm ){ m_minusMass = mm; } - - void setTracksA( const std::vector<TIDA::Track*>& tracksA ){ m_idTracksA = tracksA; } - void setTracksB( const std::vector<TIDA::Track*>& tracksB ){ m_idTracksB = tracksB; } - - void setSuperTracks( const std::vector< std::vector<TIDA::Track*> >& superTracks ){ m_superTracks = superTracks; } - void clearSuper(){ - std::cout << "m_superTracks " << m_superTracks.size() << std::endl; - for(unsigned i=m_superTracks.size(); i--; ){ - const std::vector<TIDA::Track*> temp = m_superTracks[i]; - for(unsigned j=temp.size(); j--; ){ - std::cout << "about to crash... " << temp.size() << " temp[0] eta " << temp[j]->eta() << " j " << j << std::endl; - delete temp[j]; - std::cout << " ... " << std::endl; - } - m_superTracks[i].clear(); - } - m_superTracks.clear(); - std::cout << "OUT" << std::endl; - } - - void setTIDARois(std::map<int, int> &m) { m_trackRois = &m; } - //void setEtaAtCalo(std::map<int, double> &m) { m_etaAtCalo = &m; } - //void setPhiAtCalo(std::map<int, double> &m) { m_phiAtCalo = &m; } - - void clearOffline(){ m_offlineProbes->clear(); m_offlineTags->clear(); } - void setOfflineProbes( std::map<unsigned int, const Rec::TrackParticle*>& offs ){ - m_offlineProbes = &offs; - } - void setOfflineTags( std::map<unsigned int, const Rec::TrackParticle*>& offs ){ - m_offlineTags = &offs; - } - void setSpeaker(IHLTMonTool* p){ m_speaker = p; } - void setVertices(std::vector<TIDA::Vertex*> &v){ m_vertices = v; } - void setTool(ToolHandle<Trig::TrigDecisionTool> *t){ m_tool = t; } - void setProbeOfflineDr( std::vector<float> &pOffDr ){ m_pOffDr = &pOffDr; } - void setProbeOfflineEt( std::vector<float> &pOffEt ){ m_pOffEt = &pOffEt; } - void setProbeOfflineDEta( std::vector<float> &pOffDeta ){ m_pOffDeta = &pOffDeta; } - void setProbeOfflineDPhi( std::vector<float> &pOffDphi ){ m_pOffDphi = &pOffDphi; } - void setProbeOfflineCharge( std::vector<float> &pOffCharge ){ m_pOffCharge = &pOffCharge; } - void setTagOfflineDr( std::vector<float> &tOffDr ){ m_tOffDr = &tOffDr; } - void setTagOfflineCharge( std::vector<float> &tOffCharge ){ m_tOffCharge = &tOffCharge; } - void setCase( bool isMuon, bool isJpsi ){ m_isMuon = isMuon; m_isJpsi = isJpsi; } - - private: - - void addHistogram( TH1F* h ) { - std::string name = h->GetName(); - m_histos.insert( std::map<std::string, TH1F*>::value_type( name, h) ); - } - - void addHistogram( TProfile* h ) { - std::string name = h->GetName(); - m_tphistos.insert( std::map<std::string, TProfile*>::value_type( name, h) ); - } - - void addHistogram( TH2F* h ) { - std::string name = h->GetName(); - m_histos2d.insert( std::map<std::string, TH2F*>::value_type( name, h) ); - } - - TH1F* find( const std::string& n ) { - m_speaker->msg(MSG::DEBUG) << "name: " << n << endmsg; - std::map<std::string, TH1F*>::iterator hmitr = m_histos.find(n); - if ( hmitr!=m_histos.end() ) { - m_speaker->msg(MSG::DEBUG) << "hmitr for " << n << ": " << hmitr->second << endmsg; - return hmitr->second; - } - return 0; - } - - private: - - std::string m_chainName; - double m_plusMass; - double m_minusMass; - - std::map<std::string, TH1F*> m_histos; - std::map<std::string, TProfile*> m_tphistos; - std::map<std::string, TH2F*> m_histos2d; - - std::vector<TIDA::Track*> m_idTracksA; - std::vector<TIDA::Track*> m_idTracksB; - - std::vector< std::vector<TIDA::Track*> > m_superTracks; - - TProfile* m_pT_eff; - TProfile* m_eta_eff; - TProfile* m_z0_eff; - TProfile* m_d0_eff; - TProfile* m_phi_eff; - TProfile* m_vert_eff; - TProfile* m_track_eff; - TProfile* m_invmass_eff; - - ///temp - TProfile* m_pT_eff_d0cut; - TProfile* m_eta_eff_d0cut; - TProfile* m_z0_eff_d0cut; - TProfile* m_d0_eff_d0cut; - TProfile* m_phi_eff_d0cut; - TProfile* m_vert_eff_d0cut; - TProfile* m_track_eff_d0cut; - TProfile* m_invmass_eff_d0cut; - - TProfile* m_pT_eff_offline; - TProfile* m_eta_eff_offline; - TProfile* m_z0_eff_offline; - TProfile* m_d0_eff_offline; - TProfile* m_phi_eff_offline; - TProfile* m_vert_eff_offline; - TProfile* m_track_eff_offline; - TProfile* m_invmass_eff_offline; - - ///temp - TProfile* m_pT_eff_d0cut_offline; - TProfile* m_eta_eff_d0cut_offline; - TProfile* m_z0_eff_d0cut_offline; - TProfile* m_d0_eff_d0cut_offline; - TProfile* m_phi_eff_d0cut_offline; - TProfile* m_vert_eff_d0cut_offline; - TProfile* m_track_eff_d0cut_offline; - TProfile* m_invmass_eff_d0cut_offline; - - //TProfile* m_pT_pur; - //TProfile* m_eta_pur; - //TProfile* m_phi_pur; - //TProfile* m_z0_pur; - //TProfile* m_d0_pur; - //TProfile* m_dRvspT; - - // TH2F* h2; - // TH2F* h2m; - // TH2F* h2r; - - /// number of reconstructed tracks - //int Nreco; - - /// flag to print out the matched tracks etc - bool m_print, m_isMuon, m_isJpsi, m_keepHistos; - - ///temp - std::map<unsigned int, const Rec::TrackParticle*> *m_offlineProbes; - std::map<unsigned int, const Rec::TrackParticle*> *m_offlineTags; - //std::map<int, double> *m_etaAtCalo, *m_phiAtCalo; - std::map<int, int> *m_trackRois; - IHLTMonTool* m_speaker; - std::vector<TIDA::Vertex*> m_vertices; - ToolHandle<Trig::TrigDecisionTool>* m_tool; - const DataHandle<EventInfo> m_eventInfo; - std::vector<float> *m_pOffDr, *m_tOffDr, *m_pOffDeta, *m_pOffDphi, - *m_pOffEt, *m_pOffCharge, *m_tOffCharge; - ///temp - -}; - -#endif // __JPSIANALYSIS_H diff --git a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/TrigIDJpsiMonitoring/JpsiEfficiency.h b/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/TrigIDJpsiMonitoring/JpsiEfficiency.h deleted file mode 100644 index 1fd2066756b3a028400c55c77e5e1b5422da6d5c..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/TrigIDJpsiMonitoring/JpsiEfficiency.h +++ /dev/null @@ -1,75 +0,0 @@ -// emacs: this is -*- c++ -*- -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ -// -// @file JpsiEfficiency.h -// -// -// -// -// $Id: TrackEfficiency.h, v0.0 Sun 18 Jan 2009 19:08:11 GMT sutt $ - -//edits P.Wijeratne (paw@hep.ucl.ac.uk) - -#ifndef __JPSIEFFICIENCY_H -#define __JPSIEFFICIENCY_H - - -#include <iostream> - -#include "TrigInDetAnalysis/TrackAnalysis.h" - -// class Track; -// class Effplot; -// class Resplot; - - -class JpsiEfficiency : public TrackAnalysis { - -public: - - JpsiEfficiency( const std::string& name ) : - TrackAnalysis( name ) - { } - - virtual void initialise(); - - virtual void execute(const std::vector<TIDA::Track*>& tracks1, - const std::vector<TIDA::Track*>& tracks2, - TrackAssociator* matcher); - - virtual void finalise(); - -private: - -#if 0 - // efficiency histograms - Effplot* effvsPT; - Effplot* effvseta; - Effplot* effvsphi; - Effplot* effvsd0; - - // resolution histograms - Resplot* iptvipt; - Resplot* ptvpt; - Resplot* phivpt; - Resplot* etavpt; - Resplot* z0vpt; - Resplot* d0vpt; - - Resplot* ptveta; - Resplot* iptveta; - Resplot* phiveta; - Resplot* etaveta; - Resplot* z0veta; - - Resplot* z0vz0; - Resplot* d0vd0; - -#endif - -}; - - -#endif // __JPSIEFFICIENCY_H diff --git a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/TrigIDJpsiMonitoring/JpsiTrack.h b/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/TrigIDJpsiMonitoring/JpsiTrack.h deleted file mode 100644 index a77f32dc6dc02a9437f4271e1a43b480a99c4742..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/TrigIDJpsiMonitoring/JpsiTrack.h +++ /dev/null @@ -1,79 +0,0 @@ -// emacs: this is -*- c++ -*- - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** @file JpsiTrack.h **/ -/** @author Peter Wijeratne (paw@hep.ucl.ac.uk) **/ - -#ifndef TrigIDJpsiMonitoring_JpsiTrack_H -#define TrigIDJpsiMonitoring_JpsiTrack_H - -#include <iostream> -#include <vector> - -#include "TrigInDetAnalysis/Track.h" -#include "TrigInDetAnalysis/TIDAVertex.h" - -#include "TrigJPsiTools/MakeDiMuonsTool.h" - -#include "Particle/TrackParticle.h" - -namespace TIDA{ - -class JpsiTrack : public TIDA::Track { - - public: - - JpsiTrack(const TIDA::Track& t) : TIDA::Track(t) { } - - JpsiTrack(const TIDA::Track& t, const Rec::TrackParticle* m, DiMuonTool *pair, int roi) : TIDA::Track(t), m_match(m) { - //std::cout << "JpsiTrack constructor called." << std::endl; - //std::cout << "pair (pointer): " << pair << std::endl; - m_pair = pair; - m_roi = roi; - /*std::cout << "Call probed track..." << std::endl; - const Wrapper::MuonTrack* probeTrack = m_pair->ProbedTrack(); - std::cout << "... done. Call tagged track..." << std::endl; - const Wrapper::MuonTrack* tagTrack = m_pair->TaggedTrack(); - std::cout << "...done." << std::endl; - std::cout << "... end of JpsiTrack constructor." << std::endl;*/ - } - - virtual ~JpsiTrack() { } - - const Rec::TrackParticle* hasMatch() { return m_match; } - - const Wrapper::MuonTrack* getTag() { - //std::cout << "JpsiTrack -- getTag() -- m_pair: " << m_pair << std::endl; - return m_pair->TaggedTrack(); - } - - double px() const { return ( pT() * cos( phi() ) ); } - double py() const { return ( pT() * sin( phi() ) ); } - double pz() const { return ( pT() * cos( 2. * atan(exp(-eta())) ) / sin( 2. * atan(exp(-eta())) ) ); } - double mass() { return m_pair->InvariantMass(); } - - int getRoiNum() { return m_roi; } - - const DiMuonTool* tool() const { return m_pair; } - - private: - - const Rec::TrackParticle *m_match; - DiMuonTool *m_pair; - int m_roi; - -}; - - - -inline std::ostream& operator<<( std::ostream& s, const JpsiTrack& t) { - s << *((Track*)(&t)) << "m_pair address: " << t.tool() << " " << std::endl; - return s << "\t" << *t.tool(); -} - -} - -#endif diff --git a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/TrigIDJpsiMonitoring/JpsiTrackSelector.h b/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/TrigIDJpsiMonitoring/JpsiTrackSelector.h deleted file mode 100644 index 28c46c7930476eb16918b4ecc2330c1f97b565ab..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/TrigIDJpsiMonitoring/JpsiTrackSelector.h +++ /dev/null @@ -1,114 +0,0 @@ -// emacs: this is -*- c++ -*- - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** @file JpsiTrackSelector.h **/ -/** @author Peter Wijeratne (paw@hep.ucl.ac.uk) **/ - -#ifndef TrigIDJpsiMonitoring_JpsiTrackSelector_H -#define TrigIDJpsiMonitoring_JpsiTrackSelector_H - -#include "TrigInDetAnalysis/TIDAVertex.h" - -#include "TrigInDetAnalysisUtils/TrigTrackSelector.h" - -#include "TrigIDJpsiMonitoring/JpsiTrack.h" -#include "TrigMuonEvent/TrigMuonEFTrack.h" - -#include "Particle/TrackParticle.h" - -class JpsiTrackSelector : public TrigTrackSelector { - - public: - - JpsiTrackSelector( TrackFilter* selector) : TrigTrackSelector( selector ) { } - - void addJpsi(std::vector<DiMuonTool*>& diMuon) { - - std::vector<DiMuonTool*>::iterator countZero; - - for (countZero=diMuon.begin();countZero!=diMuon.end();countZero++){ - - //std::cout << "addJpsi..." << std::endl; - const Wrapper::MuonTrack* probeTrack = (*countZero)->ProbedTrack(); - //std::cout << "...probe done." << std::endl; - /*std::cout << "...probe done..." << std::endl; - const Wrapper::MuonTrack* tagTrack = (*countZero)->TaggedTrack(); - std::cout << "...tag done." << std::endl;*/ - - if( probeTrack ) { - - double pT = probeTrack->pt(); - double eta = probeTrack->eta(); - double phi = probeTrack->phi(); - double z0 = probeTrack->z0(); - double d0 = probeTrack->a0(); - - if ( pT < 0 ) pT *= -1; - - double deta = 1; - double dphi = 1; - double dz0 = 1; - double dd0 = 1; - double dpT = 1; - - double chi2 = probeTrack->chi2(); - - // Check number of hits - // NB: a spacepoint is two offline "hits", so a pixel spacepoint is really - // 2 "hits" and an offline SCT "hit" is really a 1D cluster, so two intersetcting - // stereo clusters making a spacepoint are two "hits" - - /* int nCscHitsEta = probeTrack->bLayerHits(); - int nCscHitsPhi = probeTrack->pixelHits(); - int nTgcHitsEta = probeTrack->sctHits(); - int nTgcHitsPhi = probeTrack->siHits(); - int nRpcHitsEta = probeTrack->strawHits(); - int nRpcHitsPhi = probeTrack->trHits();*/ - - unsigned bitmap = 0; - unsigned trackAuthor = 0; - - const Rec::TrackParticle* match = probeTrack->match(); - - int roi = probeTrack->roiNum(); - /* - std::cout << "\t\t\tPAW JPSI track" - << "\teta=" << eta // << " +- " << (*trackitr)->params()->deta() - << "\tphi=" << phi // << " +- " << (*trackitr)->params()->dphi() - << "\tz0=" << z0 - << "\tpT=" << pT // << "\t( " << 1/qoverp << ")" - << "\td0=" << d0 - << "\tNCsc=" << nCscHitsEta - << "\tNTgc=" << nTgcHitsEta - << "\tNRpc=" << nRpcHitsEta - << std::endl; - */ - // Create and save Track - - int nRpcHitsPhi = probeTrack->nRpcHitsPhi(); - int nTgcHitsPhi = probeTrack->nTgcHitsPhi(); - int nCscHitsPhi = probeTrack->nCscHitsPhi(); - int nRpcHitsEta = probeTrack->nRpcHitsEta(); - int nTgcHitsEta = probeTrack->nTgcHitsEta(); - int nCscHitsEta = probeTrack->nCscHitsEta(); - - TIDA::JpsiTrack* jpsi = new TIDA::JpsiTrack(TIDA::Track(eta, phi, z0, d0, pT, chi2, - deta, dphi, dz0, dd0, dpT, - nCscHitsEta, nCscHitsPhi, nTgcHitsEta, nTgcHitsPhi, - nRpcHitsEta, nRpcHitsPhi, bitmap, 0, - trackAuthor), match, *countZero, roi ); - - if ( !addTrack( jpsi ) ) delete jpsi; - - } // for(countZero = diMuon.begin(); countZero != diMuon.end(); countZero++) - } // if( probeTrack ) - } // void addJpsi(std::vector<DiMuonTool*>& diMuon) - - virtual void clear() { delete_tracks(); } - -}; - -#endif diff --git a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/TrigIDJpsiMonitoring/TrigJpsiMonTool.h b/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/TrigIDJpsiMonitoring/TrigJpsiMonTool.h deleted file mode 100644 index 2ed846b7e3e5c06f99b3eafaf407fc9ae70a1d83..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/TrigIDJpsiMonitoring/TrigJpsiMonTool.h +++ /dev/null @@ -1,142 +0,0 @@ -// emacs: this is -*- c++ -*- - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -//edits P.Wijeratne (paw@hep.ucl.ac.uk) - -#ifndef TRIGIDJPSIMONITORING_TRIGJPSIMONTOOL_H -#define TRIGIDJPSIMONITORING_TRIGJPSIMONTOOL_H - -#include "TrigHLTMonitoring/IHLTMonTool.h" - -#include "TrigInDetAnalysis/TrackFilter.h" -#include "TrigInDetAnalysis/TIDDirectory.h" -#include "TrigInDetAnalysis/Efficiency.h" - -#include "TrigInDetAnalysisUtils/Filter_Track.h" -#include "TrigInDetAnalysisUtils/Filter_RoiSelector.h" -#include "TrigInDetAnalysisUtils/T_AnalysisConfig.h" -#include "TrigInDetAnalysisUtils/Associator_BestMatch.h" -//#include "TrigInDetAnalysisUtils/TrackMatchDeltaR.h" -//#include "TrigInDetAnalysisUtils/TrackMatchDeltaRCosmic.h" - -#include "TrigIDJpsiMonitoring/JpsiAnalysis.h" -#include "TrigIDJpsiMonitoring/JpsiEfficiency.h" - -#include "TH1F.h" - -class TrigJpsiMonTool : - public IHLTMonTool { - -public: - - - TrigJpsiMonTool( const std::string & type, const std::string & name, const IInterface* parent); - - virtual ~TrigJpsiMonTool(); - - StatusCode init(); - - #ifdef ManagedMonitorToolBase_Uses_API_201401 - StatusCode book(); - StatusCode proc(); - #else - StatusCode book(bool newEventsBlock, bool newLumiBlock, bool newRun); - StatusCode proc(bool endOfEventsBlock, bool endOfLumiBlock, bool endOfRun); - #endif - - StatusCode fill(); - - // histogram registration - - virtual void addHistogram( TH1* h , std::string MonGroup) { - IHLTMonTool::addHistogram( h, MonGroup ); - } - - void setprint(bool p) { m_print=p; } - - // track selector cuts - - // test tracks - double m_pTCut; - double m_etaCut; - double m_d0Cut; - double m_z0Cut; - - int m_siHits; // total number of si hits - int m_pixHits; // pixel hits - int m_sctHits; // sct hits - - int m_trtHits; // high threshold hits - int m_strawHits; // total number of straws - - // reference tracks - double m_pTCutOffline; - double m_etaCutOffline; - double m_d0CutOffline; - double m_z0CutOffline; - - int m_siHitsOffline; // total number of si hits - int m_pixHitsOffline; // pixel hits - int m_sctHitsOffline; // sct hits - - int m_trtHitsOffline; // high threshold hits - int m_strawHitsOffline; // total number of straws - - // roi size - double m_phiWidth; - double m_etaWidth; - double m_zedWidth; - - // matching parameters - double m_matchR; // for DeltaR matcher - double m_matchPhi; // for DeltaPhi matcher - - ToolHandle<Trig::TrigDecisionTool> m_tdt; - - TIDARoiDescriptor m_roiInfo; - - std::vector<TrackFilter*> m_filters; - std::vector<TrackAssociator*> m_associators; - - std::vector<T_AnalysisConfig<IHLTMonTool>*> m_sequences; - - std::vector<std::string> m_chainNames; - std::vector<std::string> m_collectionNames; - - std::string m_chain0; - std::string m_chain1; - std::string m_chain2; - std::string m_chain3; - - std::string m_collection0; - std::string m_collection1; - std::string m_collection2; - std::string m_collection3; - std::string m_collection4; - std::string m_collection5; - std::string m_collection6; - std::string m_collection7; - - bool m_buildNtuple; - bool m_mcTruth; - - private : - - /// number of reconstructed tracks - //int Nreco; - - /// flag to print out the matched tracks etc - bool m_print; - - // TIDDirectory* m_dir; - - ///////////////////to stop multiple books - bool m_countBook; - -}; - - -#endif // TRIGIDJPSIMONITORING_TRIGJPSIMONTOOL_H diff --git a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/python/TrigIDJpsiMonitoringConfig.py b/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/python/TrigIDJpsiMonitoringConfig.py deleted file mode 100644 index 18c2bd5d3adf92aad2a8d0a29e12109856dedd16..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/python/TrigIDJpsiMonitoringConfig.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -def TrigIDJpsiMonitoringTool(): - if not 'rec' in dir(): - from RecExConfig.RecFlags import rec - - if rec.doInDet: - # MonTool - from TrigIDJpsiMonitoring.TrigIDJpsiMonitoringConf import TrigJpsiMonTool - from AthenaCommon.AppMgr import ToolSvc - TrigJpsiMon = TrigJpsiMonTool(name = 'TrigJpsiMon', - histoPathBase = "/Trigger/HLT/IDJpsiMon") - - #ToolSvc += TrigJpsiMon - list = [ TrigJpsiMon ] - return list diff --git a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/run/InDetBeamSpotReader_jobOptions.py b/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/run/InDetBeamSpotReader_jobOptions.py deleted file mode 100644 index be6289a42e3bd043bccd472d4a49d020ca49b235..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/run/InDetBeamSpotReader_jobOptions.py +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -#ToolSvc = Service('ToolSvc') -from InDetBeamSpotFinder.InDetBeamSpotFinderConf import InDet__InDetBeamSpotReader as InDetBeamSpotReader - -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() -topSequence += InDetBeamSpotReader() - -from IOVDbSvc.CondDB import conddb - -from IOVDbSvc.IOVDbSvcConf import IOVDbSvc -#conddb.Folders+=[ "INDET" + "/Indet/Beampos" + "<tag>nominal</tag>"] -IOVDbSvc = Service("IOVDbSvc") -# IOVDbSvc.overrideTags += ["<prefix>/Indet/Beampos</prefix> <tag>nominal</tag>"] -# IOVDbSvc.overrideTags += ["<prefix>/Indet/Beampos</prefix>"] -# IOVDbSvc.dbConnection = "impl=cool;techno=sqlite;schema=beamspot.db;X:TESTCOOL" -IOVDbSvc.Folders += ["<dbConnection>impl=cool;techno=sqlite;schema=beamspot.db;X:BEAMSPOT</dbConnection> /Indet/Beampos<tag>nominal</tag>"] -#IOVDbSvc.Folders += ["<dbConnection>sqlite://;schema=beamspot.db;dbname=BEAMSPOT</dbConnection> /Indet/Beampos<tag>nominal</tag>"] diff --git a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/run/RunJpsimumu.py b/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/run/RunJpsimumu.py deleted file mode 100644 index 8c802d8f0a8fdd2d12e8570f895b89b7f86c0a35..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/run/RunJpsimumu.py +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -## set up monitoring -from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager -topSequence += AthenaMonManager( "HLTMonManager") -HLTMonManager = topSequence.HLTMonManager - -from TrigIDJpsiMonitoring.TrigIDJpsiMonitoringConf import TrigJpsiMonTool -TestMonTool = TrigJpsiMonTool( name="TestMonTool") -#ToolSvc += TestMonTool -HLTMonManager.AthenaMonTools += [ TestMonTool ] - -##### Trigger Decision Part ##################### - -## set up trigger decision tool -from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool -tdt = Trig__TrigDecisionTool("TrigDecisionTool") -ToolSvc += tdt -tdt.OutputLevel = INFO - -# these lines are new: -from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter -cfg = TriggerConfigGetter() - -rec.doWriteAOD=False -rec.doWriteESD=False - -#########cut part - -TrigJpsiMonTool.matchR = 0.1 -TrigJpsiMonTool.pTCutOffline = 4000.0 -TrigJpsiMonTool.d0Cut = 1000.0 -TrigJpsiMonTool.z0Cut = 2000.0 -TrigJpsiMonTool.d0CutOffline = 1000.0 -TrigJpsiMonTool.z0CutOffline = 2000.0 -#TrigJpsiMonTool.pTCutOffline = 4000.0 -#TrigJpsiMonTool.d0Cut = 1000.0 -#TrigJpsiMonTool.d0CutOffline = 1000.0 -#TrigJpsiMonTool.matchR = 1.0 -#TrigJpsiMonTool.z0CutOffline = 2000.0 - -#TrigJpsiMonTool.Chain0 = "EF_2mu13_Zmumu_IDTrkNoCut" -TrigJpsiMonTool.Chain0 = "EF_mu20" -TrigJpsiMonTool.Chain1 = "EF_mu24i_tight" -#TrigJpsiMonTool.Chain1 = "EF_2mu4T_Jpsimumu_IDTrkNoCut" -#TrigJpsiMonTool.Chain1 = "" -TrigJpsiMonTool.Chain2 = "" -TrigJpsiMonTool.Chain3 = "" - -TrigJpsiMonTool.IDSCAN = "" -TrigJpsiMonTool.SiTrack = "" -TrigJpsiMonTool.EF = "InDetTrigParticleCreation_Muon_EFID" -TrigJpsiMonTool.StratA = "TrigL2SiTrackFinder_MuonA" -#TrigJpsiMonTool.StratA = "TrigSiTrackFinder_Muon" -#TrigJpsiMonTool.StratB = "TrigL2SiTrackFinder_MuonB" -#TrigJpsiMonTool.StratC = "TrigL2SiTrackFinder_MuonC" -#TrigJpsiMonTool.StratA = "" -TrigJpsiMonTool.StratB = "" -TrigJpsiMonTool.StratC = "" - - -TrigJpsiMonTool.TRTSF = ""; -TrigJpsiMonTool.EFTRT = ""; -########################################## -# setup TTree registration Service -# save ROOT histograms and Tuple -from GaudiSvc.GaudiSvcConf import THistSvc -ServiceMgr += THistSvc() - -ServiceMgr.THistSvc.Output = [ "AANT DATAFILE='IDTrackingCBNT.aan.root' OPT='RECREATE'" ] -HLTMonManager.FileKey = "AANT" -#from AnalysisTools.AnalysisToolsConf import AANTupleStream -#topSequence += AANTupleStream() -#AANTupleStream = AANTupleStream() -#AANTupleStream.ExtraRefNames = [ "StreamESD","Stream1" ] -#AANTupleStream.OutputName = 'IDTrackingCBNT.aan.root' -#AANTupleStream.WriteInputDataHeader = True -#AANTupleStream.OutputLevel = WARNING diff --git a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/run/TrigIDJpsiMonitoring_topOptions.py b/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/run/TrigIDJpsiMonitoring_topOptions.py deleted file mode 100644 index bc7ac504d776eae2608efb950f9dd9f9131d6569..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/run/TrigIDJpsiMonitoring_topOptions.py +++ /dev/null @@ -1,211 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -# get a handle on the ServiceManager which holds all the services -from AthenaCommon.AppMgr import ToolSvc - -from AthenaCommon.AppMgr import ServiceMgr -# Event selector -import AthenaPoolCnvSvc.ReadAthenaPool - -# Import relevant libs -import os -import commands -import string - -#set DB by hand -ConfForMC = True - -from AthenaCommon.GlobalFlags import globalflags -globalflags.DetGeo.set_Value_and_Lock('atlas') -#GlobalFlags.DetGeo.set_atlas() -if (ConfForMC): - #GlobalFlags.DataSource.set_geant4() - globalflags.DetGeo.set_Value_and_Lock('geant4') -else : - #GlobalFlags.DataSource.set_data() - globalflags.DataSource.set_Value_and_Lock('data') -from IOVDbSvc.CondDB import conddb - -###Define ESD location on local disk for merged ESDs; change this to the path to your datasets -#path = "/unix/atlas2/paw/mc08.108407.Pythia_directJpsimu4mu4.recon.ESD.e347_s462_s520_r809_tid092535" -#path = "/unix/atlas2/paw/data10_7TeV.00153599.physics_MuonswBeam.recon.ESD.f251" - -ServiceMgr.EventSelector.InputCollections = [ #"/unix/atlas2/paw/mc09_7TeV.108407.Pythia_directJpsimu4mu4.digit.ESD.e477_s765_s767_d300_tid130174_00/1.ESD.pool.root", - #"/unix/atlas2/paw/mc09_7TeV.108407.Pythia_directJpsimu4mu4.digit.ESD.e477_s765_s767_d300_tid130174_00/2.ESD.pool.root", - #"/unix/atlas2/paw/mc09_7TeV.108407.Pythia_directJpsimu4mu4.digit.ESD.e477_s765_s767_d300_tid130174_00/3.ESD.pool.root", - #"/unix/atlas2/paw/mc09_7TeV.108407.Pythia_directJpsimu4mu4.digit.ESD.e477_s765_s767_d300_tid130174_00/4.ESD.pool.root", - #"/unix/atlas2/paw/mc09_7TeV.108407.Pythia_directJpsimu4mu4.digit.ESD.e477_s765_s767_d300_tid130174_00/5.ESD.pool.root", - #"/unix/atlas2/paw/mc09_7TeV.108407.Pythia_directJpsimu4mu4.digit.ESD.e477_s765_s767_d300_tid130174_00/6.ESD.pool.root" -# "root://eosatlas.cern.ch//eos/atlas/atlasdatadisk/data11_7TeV/AOD/r3365_r3368_p902/data11_7TeV.00190933.Jpsi_JulieKirk.merge.AOD.r3365_r3368_p902_tid735922_00/AOD.735922._000001.pool.root.1" - "/unix/atlas2/paw/mc11_7TeV.108494.Pythia_directJpsimu2p5mu2p5.merge.AOD.e835_a131_s1353_a140_r2900_tid601752_00/AOD.601752._000001.pool.root.1" -# "/afs/cern.ch/user/p/paw/BugFixing/myESD.pool.root" -# "/tmp/ESD.158525._000301.pool.root" -# "/tmp/Bug/myESD_express_0.pool.root" -# "/tmp/Bug/myESD.pool.root" -# "/unix/atlas2/paw/mc09_7TeV.106047.PythiaZmumu_no_filter.recon.ESD.e468_s765_s767_r1430_tid158525_00/ESD.158525._000301.pool.root" -# "/unix/atlas2/paw/data11_7TeV.00180664.physics_Muons.merge.AOD.o8_f375_m830/data11_7TeV.00180664.physics_Muons.merge.AOD.o8_f375_m830._lb0496-lb0498._0001.root" -# "/unix/atlas2/paw/mc09_7TeV.106047.PythiaZmumu_no_filter.recon.ESD.e468_s765_s767_r1430_tid158525_00/ESD.158525._000301.pool.root" - ] - -###code to add an ESD on InputCollections - -#status,output = commands.getstatusoutput('ls '+path) -#output = output.splitlines() - -#istart=0 -#for i in xrange(0,len(output)) : -# if output[i].count(path) < 1: -# output[i] = path+"/"+output[i] -# output[i] = output[i].replace('//','/') - -# ESDfile = output[i] -# print ESDfile - -# import glob -# inFile = glob.glob(ESDfile) - -# from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -# athenaCommonFlags.FilesInput = inFile - -# from RecExConfig.InputFilePeeker import inputFileSummary - -# import AthenaPoolCnvSvc.ReadAthenaPool - -# if istart==0: -# ServiceMgr.EventSelector.InputCollections = [ ESDfile ] -# istart=1 -# else: -# ServiceMgr.EventSelector.InputCollections += [ ESDfile ] - -#import glob -#inFile = glob.glob('/unix/atlas2/paw/mc08.108407.Pythia_directJpsimu4mu4.recon.ESD.e347_s462_s520_r809_tid092535/ESD.092535._000051.pool.root.1') - -#from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -#athenaCommonFlags.FilesInput.set_Value_and_Lock(inFile) - -#from RecExConfig.InputFilePeeker import inputFileSummary - -#import AthenaPoolCnvSvc.ReadAthenaPool - -#ServiceMgr.EventSelector.InputCollections = [ "/unix/atlas2/paw/mc08.108407.Pythia_directJpsimu4mu4.recon.ESD.e347_s462_s520_r809_tid092535/ESD.092535._000051.pool.root.1" ] - -#from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -#athenaCommonFlags.FilesInput=["/home/paw/data10_7TeV.00153565.physics_MuonswBeam.merge.AOD.f251_m466._lb0002-lb0022._0001.1"] - -#svcMgr.EventSelector.InputCollections=athenaCommonFlags.FilesInput() - -###test -#from RecExConfig.InputFilePeeker import inputFileSummary -#include ("RecExCond/RecExCommon_flags.py") -#include( "RecExCond/AllDet_detDescr.py" ) -#include( "AthenaPoolCnvSvc/ReadAthenaPool_jobOptions.py" ) -###test - -# Athena-Aware NTuple making Tools -CBNTAthenaAware = True -include ("CBNT_Athena/CBNT_AthenaAware_jobOptions.py") -include ("CBNT_Athena/CBNT_EventInfo_jobOptions.py") - -# BeamPos -from AthenaCommon.Include import include -include("InDetBeamSpotService/BeamCondSvc.py") - -# list of the algorithms to be executed at run time -#from TrigInDetAnalysisExample.TrigInDetAnalysisExampleConf import TrigInDetAnalysisSkeleton -#topSequence.CBNT_AthenaAware += TrigInDetAnalysisSkeleton() -#TrigInDetAnalysisSkeleton = TrigInDetAnalysisSkeleton() -#TrigInDetAnalysisSkeleton.OutputLevel = DEBUG - -## set up monitoring -from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager -topSequence += AthenaMonManager( "HLTMonManager") -HLTMonManager = topSequence.HLTMonManager - -from TrigIDJpsiMonitoring.TrigIDJpsiMonitoringConf import TrigJpsiMonTool -TestMonTool = TrigJpsiMonTool( name="TestMonTool") -#ToolSvc += TestMonTool -HLTMonManager.AthenaMonTools += [ TestMonTool ] - -##### Trigger Decision Part ##################### - -## set up trigger decision tool -from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool -tdt = Trig__TrigDecisionTool("TrigDecisionTool") -ToolSvc += tdt -tdt.OutputLevel = INFO - -# might be needed for TriggerConfigGetter... -from RecExConfig.RecFlags import rec -rec.readRDO=False -#rec.readESD=True -rec.readAOD=True -rec.doWriteAOD=False -rec.doWriteESD=False - -# To read files with trigger config stored as in-file meta-data, i.e. 13.0.40 -# and above: ds. To read AOD produced with 13.0.30 you need to change ds to aod: -#from TriggerJobOpts.TriggerFlags import TriggerFlags -#TriggerFlags.configurationSourceList = ['ds'] -# set up trigger config service -#from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter -#cfg = TriggerConfigGetter( "ReadPool" ) - -#########cut part - -TrigJpsiMonTool.matchR = 0.1 -TrigJpsiMonTool.pTCutOffline = 4000.0 -TrigJpsiMonTool.d0Cut = 1000.0 -TrigJpsiMonTool.z0Cut = 2000.0 -TrigJpsiMonTool.d0CutOffline = 1000.0 -TrigJpsiMonTool.z0CutOffline = 2000.0 -#TrigJpsiMonTool.pTCutOffline = 4000.0 -#TrigJpsiMonTool.d0Cut = 1000.0 -#TrigJpsiMonTool.d0CutOffline = 1000.0 -#TrigJpsiMonTool.matchR = 1.0 -#TrigJpsiMonTool.z0CutOffline = 2000.0 -TrigJpsiMonTool.Chain0 = "EF_2mu4T_Jpsimumu_IDTrkNoCut" -TrigJpsiMonTool.Chain1 = "" -TrigJpsiMonTool.Chain2 = "" -TrigJpsiMonTool.Collection0 = "" -#TrigJpsiMonTool.Collection1 = "" -TrigJpsiMonTool.Collection2 = "" -TrigJpsiMonTool.Collection3 = "" -TrigJpsiMonTool.Collection4 = "" -TrigJpsiMonTool.Collection5 = "" -TrigJpsiMonTool.Collection6 = "" -TrigJpsiMonTool.Collection7 = "" - -########################################## -# setup TTree registration Service -# save ROOT histograms and Tuple -from GaudiSvc.GaudiSvcConf import THistSvc -ServiceMgr += THistSvc() - -ServiceMgr.THistSvc.Output = [ "AANT DATAFILE='IDTrackingCBNT.aan.root' OPT='RECREATE'" ] -HLTMonManager.FileKey = "AANT" -from AnalysisTools.AnalysisToolsConf import AANTupleStream -topSequence += AANTupleStream() -AANTupleStream = AANTupleStream() -AANTupleStream.ExtraRefNames = [ "StreamESD","Stream1" ] -AANTupleStream.OutputName = 'IDTrackingCBNT.aan.root' -AANTupleStream.WriteInputDataHeader = True -AANTupleStream.OutputLevel = WARNING - -# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -ServiceMgr.MessageSvc.OutputLevel = DEBUG - -theApp.EvtMax = -1 - -from GaudiSvc.GaudiSvcConf import AuditorSvc -ServiceMgr.AuditorSvc.Auditors += [ "ChronoAuditor"] - -AthenaPoolCnvSvc = Service("AthenaPoolCnvSvc") -AthenaPoolCnvSvc.UseDetailChronoStat = TRUE - -from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter -TriggerConfigGetter( "ReadPool" ) - -#to dump ESD/AOD content (do only if theApp.EvtMax = 1) -#StoreGateSvc = Service( "StoreGateSvc" ) -#StoreGateSvc.Dump = True - diff --git a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/run/TrigInDetValidation_RTT_topOptions_Bphysics.py b/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/run/TrigInDetValidation_RTT_topOptions_Bphysics.py deleted file mode 100644 index 2dc99e8726535e40a35c7ccfcd0e2746b882b582..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/run/TrigInDetValidation_RTT_topOptions_Bphysics.py +++ /dev/null @@ -1,121 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -##################################################################################################### -# -# top level jobOptions to run Muon chains in the RTT or standalone -# sets some global variables that adjust the execution of TrigInDetValidation_RTT_Common.py -# -# Jiri.Masik@manchester.ac.uk -# -##################################################################################################### - -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags - -#set athenaCommonFlags.FilesInput to be able to use this job options standalone without RTT -#secondSet of files can be activated by the if statement below - -if athenaCommonFlags.FilesInput()==[]: - athenaCommonFlags.FilesInput=[ - ] - - secondSet=True - if secondSet: - athenaCommonFlags.FilesInput=[ - "root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/proj-sit/vchavda/TrigInDetValidation_muon/mc10_14TeV.106047.PythiaZmumu_no_filter.digit.RDO.e662_s1107_d459_tid285222_00/RDO.285222._000005.pool.root.1", - "root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/proj-sit/vchavda/TrigInDetValidation_muon/mc10_14TeV.106047.PythiaZmumu_no_filter.digit.RDO.e662_s1107_d459_tid285222_00/RDO.285222._000006.pool.root.1", - "root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/proj-sit/vchavda/TrigInDetValidation_muon/mc10_14TeV.106047.PythiaZmumu_no_filter.digit.RDO.e662_s1107_d459_tid285222_00/RDO.285222._000018.pool.root.1", - "root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/proj-sit/vchavda/TrigInDetValidation_muon/mc10_14TeV.106047.PythiaZmumu_no_filter.digit.RDO.e662_s1107_d459_tid285222_00/RDO.285222._000019.pool.root.1", - "root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/proj-sit/vchavda/TrigInDetValidation_muon/mc10_14TeV.106047.PythiaZmumu_no_filter.digit.RDO.e662_s1107_d459_tid285222_00/RDO.285222._000030.pool.root.1", - "root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/proj-sit/vchavda/TrigInDetValidation_muon/mc10_14TeV.106047.PythiaZmumu_no_filter.digit.RDO.e662_s1107_d459_tid285222_00/RDO.285222._000033.pool.root.1", - "root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/proj-sit/vchavda/TrigInDetValidation_muon/mc10_14TeV.106047.PythiaZmumu_no_filter.digit.RDO.e662_s1107_d459_tid285222_00/RDO.285222._000047.pool.root.1", - "root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/proj-sit/vchavda/TrigInDetValidation_muon/mc10_14TeV.106047.PythiaZmumu_no_filter.digit.RDO.e662_s1107_d459_tid285222_00/RDO.285222._000048.pool.root.1", - "root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/proj-sit/vchavda/TrigInDetValidation_muon/mc10_14TeV.106047.PythiaZmumu_no_filter.digit.RDO.e662_s1107_d459_tid285222_00/RDO.285222._000049.pool.root.1", - "root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/proj-sit/vchavda/TrigInDetValidation_muon/mc10_14TeV.106047.PythiaZmumu_no_filter.digit.RDO.e662_s1107_d459_tid285222_00/RDO.285222._000064.pool.root.1", - "root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/proj-sit/vchavda/TrigInDetValidation_muon/mc10_14TeV.106047.PythiaZmumu_no_filter.digit.RDO.e662_s1107_d459_tid285222_00/RDO.285222._000069.pool.root.1", - "root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/proj-sit/vchavda/TrigInDetValidation_muon/mc10_14TeV.106047.PythiaZmumu_no_filter.digit.RDO.e662_s1107_d459_tid285222_00/RDO.285222._000073.pool.root.1", - ] - - -rec.RootNtupleOutput="ntupleInDetMuonSlice.root" - -idTrigChainlist = [ 'mu22_IDTrkNoCut_tight', - 'mu24i_tight' - ] - -tidaAnalysischains = [ - "Truth", - "L2_mu22_IDTrkNoCut_tight:TrigL2SiTrackFinder_Muon:0", - "L2_mu22_IDTrkNoCut_tight:TrigL2SiTrackFinder_Muon:1", - "L2_mu22_IDTrkNoCut_tight:TrigL2SiTrackFinder_Muon:2", - "L2_mu22_IDTrkNoCut_tight:TrigL2SiTrackFinder_Muon:3", - "EF_mu22_IDTrkNoCut_tight:InDetTrigParticleCreation_Muon_EFID", -] - -if 'runMergedChain' in dir() and runMergedChain==True: - idTrigChainlist.append('mu22_IDTrkNoCut_tight_IDT') - tidaAnalysischains.append('EF_mu22_IDTrkNoCut_tight_IDT:TrigFastTrackFinder_Muon') - tidaAnalysischains.append('EF_mu22_IDTrkNoCut_tight_IDT:InDetTrigParticleCreation_Muon_EFID') - -def resetSigs(): - TriggerFlags.Slices_all_setOff() - TriggerFlags.MuonSlice.setAll(); - TriggerFlags.MuonSlice.signatures = idTrigChainlist - - -PdgId=13 - - -include("TrigInDetValidation/TrigInDetValidation_RTT_Common.py") - -#theApp.EvtMax = 100 # number of events to process - -HLTMonManager = topSequence.HLTMonManager - -from TrigIDJpsiMonitoring.TrigIDJpsiMonitoringConf import TrigJpsiMonTool -TPMonTool = TrigJpsiMonTool( name="TPMonTool") -#ToolSvc += TPMonTool -HLTMonManager.AthenaMonTools += [ TPMonTool ] - - -TPMonTool.matchR = 0.1 -TPMonTool.pTCutOffline = 4000.0 -TPMonTool.d0Cut = 1000.0 -TPMonTool.z0Cut = 2000.0 -TPMonTool.d0CutOffline = 1000.0 -TPMonTool.z0CutOffline = 2000.0 -#TPMonTool.pTCutOffline = 4000.0 -#TPMonTool.d0Cut = 1000.0 -#TPMonTool.d0CutOffline = 1000.0 -#TPMonTool.matchR = 1.0 -#TPMonTool.z0CutOffline = 2000.0 - -#TPMonTool.Chain0 = "EF_2mu13_Zmumu_IDTrkNoCut" -TPMonTool.Chain0 = "EF_mu24i_tight"; -#TPMonTool.Chain1 = "EF_2mu4T_Jpsimumu_IDTrkNoCut" -TPMonTool.Chain1 = "" -#TPMonTool.Chain2 = "" -#TPMonTool.Chain3 = "" - -#TPMonTool.IDSCAN = ""; -#TPMonTool.SiTrack = ""; -TPMonTool.EF = "InDetTrigParticleCreation_Muon_EFID"; -TPMonTool.StratA = "TrigL2SiTrackFinder_MuonA"; -#TPMonTool.StratB = "TrigL2SiTrackFinder_MuonB"; -#TPMonTool.StratC = "TrigL2SiTrackFinder_MuonC"; -#TPMonTool.StratA = ""; -TPMonTool.StratB = ""; -TPMonTool.StratC = ""; - - -#TPMonTool.TRTSF = ""; -#TPMonTool.EFTRT = ""; - -########################################## -# setup TTree registration Service -# save ROOT histograms and Tuple -from GaudiSvc.GaudiSvcConf import THistSvc -ServiceMgr += THistSvc() - -ServiceMgr.THistSvc.Output = [ "AANT DATAFILE='IDTrackingCBNT.aan.root' OPT='RECREATE'" ] -HLTMonManager.FileKey = "AANT" - diff --git a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/run/configureServices.py b/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/run/configureServices.py deleted file mode 100644 index 140548ca75de48245c22bcbb924208f8aae2be4e..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/run/configureServices.py +++ /dev/null @@ -1,161 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -############################################################################### -# -# configureServices.py -# Author: ATLAS B-physics group -# Configures supporting services for the B-physics AOD analyses. -# -############################################################################### - -#------------------------------------------------------------------------------ -# Magnetic field tool -#------------------------------------------------------------------------------ - -from TrkMagFieldTools.TrkMagFieldToolsConf import Trk__MagneticFieldTool -InDetMagField = Trk__MagneticFieldTool('InDetMagField') -ToolSvc += InDetMagField -print InDetMagField - -#------------------------------------------------------------------------------ -# Set up extrapolator -#------------------------------------------------------------------------------ - -from TrkExTools.AtlasExtrapolator import AtlasExtrapolator -InDetExtrapolator = AtlasExtrapolator() -ToolSvc += InDetExtrapolator -print InDetExtrapolator - -#------------------------------------------------------------------------------ -# Vertex point estimator -#------------------------------------------------------------------------------ - -from InDetConversionFinderTools.InDetConversionFinderToolsConf import InDet__VertexPointEstimator -VtxPointEstimator = InDet__VertexPointEstimator(name = 'VtxPointEstimator', - MinDeltaR = [ -10000., -10000., -10000. ], - MaxDeltaR = [ 10000., 10000., 10000. ], - MaxPhi = [ 10000., 10000., 10000. ], - MaxChi2OfVtxEstimation = 2000.) -ToolSvc += VtxPointEstimator - -#------------------------------------------------------------------------------ -# Helper Tools -#------------------------------------------------------------------------------ - -from InDetConversionFinderTools.InDetConversionFinderToolsConf import InDet__ConversionFinderUtils -InDetConversionHelper = InDet__ConversionFinderUtils(name = 'InDetConversionFinderUtils') -ToolSvc += InDetConversionHelper - -from InDetRecExample.InDetKeys import InDetKeys - -from InDetAssociationTools.InDetAssociationToolsConf import InDet__InDetPRD_AssociationToolGangedPixels -InDetPrdAssociationTool = InDet__InDetPRD_AssociationToolGangedPixels(name = 'InDetPrdAssociationTool', - PixelClusterAmbiguitiesMapName = InDetKeys.GangedPixelMap()) -ToolSvc += InDetPrdAssociationTool - -from RecExConfig.RecFlags import rec -CountDeadModulesAfterLastHit = False -#rec.Commissioning=False - -from InDetTrackHoleSearch.InDetTrackHoleSearchConf import InDet__InDetTrackHoleSearchTool -InDetHoleSearchTool = InDet__InDetTrackHoleSearchTool(name = 'InDetHoleSearchTool', - Extrapolator = InDetExtrapolator, - usePixel = DetFlags.haveRIO.pixel_on(), - useSCT = DetFlags.haveRIO.SCT_on(), - #Commissioning = rec.Commissioning()) - CountDeadModulesAfterLastHit = CountDeadModulesAfterLastHit) -ToolSvc += InDetHoleSearchTool - -from InDetTrackSummaryHelperTool.InDetTrackSummaryHelperToolConf import InDet__InDetTrackSummaryHelperTool -InDetTrackSummaryHelperTool = InDet__InDetTrackSummaryHelperTool(name = 'InDetSummaryHelper', - AssoTool = InDetPrdAssociationTool, - DoSharedHits = False, - HoleSearch = InDetHoleSearchTool, - usePixel = DetFlags.haveRIO.pixel_on(), - useSCT = DetFlags.haveRIO.SCT_on(), - useTRT = DetFlags.haveRIO.TRT_on()) -ToolSvc += InDetTrackSummaryHelperTool - -from TrkTrackSummaryTool.TrkTrackSummaryToolConf import Trk__TrackSummaryTool -InDetTrackSummaryTool = Trk__TrackSummaryTool(name = 'InDetTrackSummaryTool', - InDetSummaryHelperTool = InDetTrackSummaryHelperTool, - doSharedHits = False, - InDetHoleSearchTool = InDetHoleSearchTool) -ToolSvc += InDetTrackSummaryTool -#------------------------------------------------------------------------------ -# Configure vertex fitters -#------------------------------------------------------------------------------ - -from TrkVKalVrtFitter.TrkVKalVrtFitterConf import Trk__TrkVKalVrtFitter -TrkVKalVrtFitter = Trk__TrkVKalVrtFitter(name = 'VKalVrtFitterName', - Extrapolator = InDetExtrapolator, - MagFieldSvc = InDetMagField, - FirstMeasuredPoint = True, - #FirstMeasuredPointLimit = True, - MakeExtendedVertex = True) -ToolSvc += TrkVKalVrtFitter -print TrkVKalVrtFitter - -from TrkV0Fitter.TrkV0FitterConf import Trk__TrkV0VertexFitter -TrkV0Fitter = Trk__TrkV0VertexFitter(name = 'TrkV0FitterName', - MaxIterations = 10, - Use_deltaR = False, - Extrapolator = InDetExtrapolator, - MagneticFieldTool = InDetMagField) -ToolSvc += TrkV0Fitter -print TrkV0Fitter - -#------------------------------------------------------------------------------ -# Load linearized track factory -#------------------------------------------------------------------------------ - -from TrkVertexFitterUtils.TrkVertexFitterUtilsConf import Trk__FullLinearizedTrackFactory -InDetLinFactory = Trk__FullLinearizedTrackFactory(name = 'InDetFullLinearizedTrackFactory', - Extrapolator = InDetExtrapolator, - MagneticFieldTool = InDetMagField) -ToolSvc += InDetLinFactory -print InDetLinFactory - -from TrkVertexBilloirTools.TrkVertexBilloirToolsConf import Trk__FastVertexFitter -InDetFastVxFitterTool = Trk__FastVertexFitter(name = 'InDetFastVertexFitterTool', - LinearizedTrackFactory = InDetLinFactory, - Extrapolator = InDetExtrapolator) -ToolSvc += InDetFastVxFitterTool -print InDetFastVxFitterTool - -from TrkVertexBilloirTools.TrkVertexBilloirToolsConf import Trk__FullVertexFitter -InDetFullVxFitterTool = Trk__FullVertexFitter(name = 'InDetFullVertexFitterTool', - LinearizedTrackFactory = InDetLinFactory, - Extrapolator = InDetExtrapolator) -ToolSvc += InDetFullVxFitterTool -print InDetFullVxFitterTool - -#------------------------------------------------------------------------------ -# Primary vertex refitting -#------------------------------------------------------------------------------ - -from TrkVertexFitterUtils.TrkVertexFitterUtilsConf import Trk__KalmanVertexUpdator -myVertexUpdator = Trk__KalmanVertexUpdator() -ToolSvc += myVertexUpdator -print myVertexUpdator - -#------------------------------------------------------------------------------ -# Timing -#------------------------------------------------------------------------------ - -from PrimaryDPDMaker.PrimaryDPDMakerConf import MBTSTimeFilterTool -ToolSvc += MBTSTimeFilterTool() -MBTSTimeFilterTool.ChargeThreshold = 60.0/222.0 -MBTSTimeFilterTool.MinHitsPerSide = 2 -MBTSTimeFilterTool.MaxTimeDifference = 10.0 - -from TrkVertexAnalysisUtils.TrkVertexAnalysisUtilsConf import Trk__V0Tools -InDetV0Tools = Trk__V0Tools(name = 'InDetV0Tools') -ToolSvc += InDetV0Tools -print InDetV0Tools - -############################################################################### -# -# End of configureServices.py job-options -# -############################################################################### diff --git a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/run/grid_TrigIDJpsiMonitoring_topOptions.py b/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/run/grid_TrigIDJpsiMonitoring_topOptions.py deleted file mode 100644 index fd26065e841a51847fc9d02132f89e6478bec7f1..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/run/grid_TrigIDJpsiMonitoring_topOptions.py +++ /dev/null @@ -1,201 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -# get a handle on the ServiceManager which holds all the services -from AthenaCommon.AppMgr import ToolSvc - -from AthenaCommon.AppMgr import ServiceMgr -# Event selector -import AthenaPoolCnvSvc.ReadAthenaPool - -# Import relevant libs -import os -import commands -import string - -#set DB by hand -ConfForMC = True - -from AthenaCommon.GlobalFlags import globalflags -globalflags.DetGeo.set_Value_and_Lock('atlas') -#GlobalFlags.DetGeo.set_atlas() -if (ConfForMC): - #GlobalFlags.DataSource.set_geant4() - globalflags.DetGeo.set_Value_and_Lock('geant4') -else : - #GlobalFlags.DataSource.set_data() - globalflags.DataSource.set_Value_and_Lock('data') -from IOVDbSvc.CondDB import conddb - -###Define ESD location on local disk for merged ESDs; change this to the path to your datasets -#path = "/unix/atlas2/paw/mc08.108407.Pythia_directJpsimu4mu4.recon.ESD.e347_s462_s520_r809_tid092535" -#path = "/unix/atlas2/paw/data10_7TeV.00153599.physics_MuonswBeam.recon.ESD.f251" - -ServiceMgr.EventSelector.InputCollections = [ #"/unix/atlas2/paw/mc09_7TeV.108407.Pythia_directJpsimu4mu4.digit.ESD.e477_s765_s767_d300_tid130174_00/1.ESD.pool.root", - #"/unix/atlas2/paw/mc09_7TeV.108407.Pythia_directJpsimu4mu4.digit.ESD.e477_s765_s767_d300_tid130174_00/2.ESD.pool.root", - #"/unix/atlas2/paw/mc09_7TeV.108407.Pythia_directJpsimu4mu4.digit.ESD.e477_s765_s767_d300_tid130174_00/3.ESD.pool.root", - #"/unix/atlas2/paw/mc09_7TeV.108407.Pythia_directJpsimu4mu4.digit.ESD.e477_s765_s767_d300_tid130174_00/4.ESD.pool.root", - #"/unix/atlas2/paw/mc09_7TeV.108407.Pythia_directJpsimu4mu4.digit.ESD.e477_s765_s767_d300_tid130174_00/5.ESD.pool.root", - #"/unix/atlas2/paw/mc09_7TeV.108407.Pythia_directJpsimu4mu4.digit.ESD.e477_s765_s767_d300_tid130174_00/6.ESD.pool.root" -# "/afs/cern.ch/user/p/paw/BugFixing/myESD.pool.root" -# "/tmp/ESD.158525._000301.pool.root" -# "/tmp/Bug/myESD_express_0.pool.root" -# "/tmp/Bug/myESD.pool.root" -# "/unix/atlas2/paw/mc09_7TeV.106047.PythiaZmumu_no_filter.recon.ESD.e468_s765_s767_r1430_tid158525_00/ESD.158525._000301.pool.root" -# "/unix/atlas2/paw/data11_7TeV.00180664.physics_Muons.merge.AOD.o8_f375_m830/data11_7TeV.00180664.physics_Muons.merge.AOD.o8_f375_m830._lb0496-lb0498._0001.root" -# "/unix/atlas2/paw/mc09_7TeV.106047.PythiaZmumu_no_filter.recon.ESD.e468_s765_s767_r1430_tid158525_00/ESD.158525._000301.pool.root" - ] - -###code to add an ESD on InputCollections - -#status,output = commands.getstatusoutput('ls '+path) -#output = output.splitlines() - -#istart=0 -#for i in xrange(0,len(output)) : -# if output[i].count(path) < 1: -# output[i] = path+"/"+output[i] -# output[i] = output[i].replace('//','/') - -# ESDfile = output[i] -# print ESDfile - -# import glob -# inFile = glob.glob(ESDfile) - -# from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -# athenaCommonFlags.FilesInput = inFile - -# from RecExConfig.InputFilePeeker import inputFileSummary - -# import AthenaPoolCnvSvc.ReadAthenaPool - -# if istart==0: -# ServiceMgr.EventSelector.InputCollections = [ ESDfile ] -# istart=1 -# else: -# ServiceMgr.EventSelector.InputCollections += [ ESDfile ] - -#import glob -#inFile = glob.glob('/unix/atlas2/paw/mc08.108407.Pythia_directJpsimu4mu4.recon.ESD.e347_s462_s520_r809_tid092535/ESD.092535._000051.pool.root.1') - -#from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -#athenaCommonFlags.FilesInput.set_Value_and_Lock(inFile) - -#from RecExConfig.InputFilePeeker import inputFileSummary - -#import AthenaPoolCnvSvc.ReadAthenaPool - -#ServiceMgr.EventSelector.InputCollections = [ "/unix/atlas2/paw/mc08.108407.Pythia_directJpsimu4mu4.recon.ESD.e347_s462_s520_r809_tid092535/ESD.092535._000051.pool.root.1" ] - -#from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -#athenaCommonFlags.FilesInput=["/home/paw/data10_7TeV.00153565.physics_MuonswBeam.merge.AOD.f251_m466._lb0002-lb0022._0001.1"] - -#svcMgr.EventSelector.InputCollections=athenaCommonFlags.FilesInput() - -# Athena-Aware NTuple making Tools -CBNTAthenaAware = True -include ("CBNT_Athena/CBNT_AthenaAware_jobOptions.py") -include ("CBNT_Athena/CBNT_EventInfo_jobOptions.py") - -# BeamPos -include("InDetBeamSpotService/BeamCondSvc.py") - -# list of the algorithms to be executed at run time -#from TrigInDetAnalysisExample.TrigInDetAnalysisExampleConf import TrigInDetAnalysisSkeleton -#topSequence.CBNT_AthenaAware += TrigInDetAnalysisSkeleton() -#TrigInDetAnalysisSkeleton = TrigInDetAnalysisSkeleton() -#TrigInDetAnalysisSkeleton.OutputLevel = DEBUG - -## set up monitoring -from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager -topSequence += AthenaMonManager( "HLTMonManager") -HLTMonManager = topSequence.HLTMonManager - -from TrigIDJpsiMonitoring.TrigIDJpsiMonitoringConf import TrigJpsiMonTool -TestMonTool = TrigJpsiMonTool( name="TestMonTool") -#ToolSvc += TestMonTool -HLTMonManager.AthenaMonTools += [ TestMonTool ] - -##### Trigger Decision Part ##################### - -## set up trigger decision tool -from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool -tdt = Trig__TrigDecisionTool("TrigDecisionTool") -ToolSvc += tdt -tdt.OutputLevel = INFO - -# might be needed for TriggerConfigGetter... -from RecExConfig.RecFlags import rec -rec.readRDO=False -#rec.readESD=True -rec.readAOD=True -rec.doWriteAOD=False -rec.doWriteESD=False - -# To read files with trigger config stored as in-file meta-data, i.e. 13.0.40 -# and above: ds. To read AOD produced with 13.0.30 you need to change ds to aod: -#from TriggerJobOpts.TriggerFlags import TriggerFlags -#TriggerFlags.configurationSourceList = ['ds'] -# set up trigger config service -#from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter -#cfg = TriggerConfigGetter( "ReadPool" ) - -#########cut part - -TrigJpsiMonTool.matchR = 0.1 -TrigJpsiMonTool.pTCutOffline = 4000.0 -TrigJpsiMonTool.d0Cut = 1000.0 -TrigJpsiMonTool.z0Cut = 2000.0 -TrigJpsiMonTool.d0CutOffline = 1000.0 -TrigJpsiMonTool.z0CutOffline = 2000.0 -#TrigJpsiMonTool.pTCutOffline = 4000.0 -#TrigJpsiMonTool.d0Cut = 1000.0 -#TrigJpsiMonTool.d0CutOffline = 1000.0 -#TrigJpsiMonTool.matchR = 1.0 -#TrigJpsiMonTool.z0CutOffline = 2000.0 -TrigJpsiMonTool.Chain0 = "EF_2mu4T_Jpsimumu_IDTrkNoCut" -TrigJpsiMonTool.Chain1 = "EF_2mu4_Jpsimumu_IDTrkNoCut" -TrigJpsiMonTool.Chain2 = "" -#TrigJpsiMonTool.Collection0 = "" -#TrigJpsiMonTool.Collection1 = "" -TrigJpsiMonTool.Collection2 = "" -#TrigJpsiMonTool.Collection3 = "" -TrigJpsiMonTool.Collection4 = "" -#TrigJpsiMonTool.Collection5 = "" -TrigJpsiMonTool.Collection6 = "" -TrigJpsiMonTool.Collection7 = "" - -########################################## -# setup TTree registration Service -# save ROOT histograms and Tuple -from GaudiSvc.GaudiSvcConf import THistSvc -ServiceMgr += THistSvc() - -ServiceMgr.THistSvc.Output = [ "AANT DATAFILE='IDTrackingCBNT.aan.root' OPT='RECREATE'" ] -HLTMonManager.FileKey = "AANT" -from AnalysisTools.AnalysisToolsConf import AANTupleStream -topSequence += AANTupleStream() -AANTupleStream = AANTupleStream() -AANTupleStream.ExtraRefNames = [ "StreamESD","Stream1" ] -AANTupleStream.OutputName = 'IDTrackingCBNT.aan.root' -AANTupleStream.WriteInputDataHeader = True -AANTupleStream.OutputLevel = WARNING - -# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -ServiceMgr.MessageSvc.OutputLevel = DEBUG - -theApp.EvtMax = -1 - -from GaudiSvc.GaudiSvcConf import AuditorSvc -ServiceMgr.AuditorSvc.Auditors += [ "ChronoAuditor"] - -AthenaPoolCnvSvc = Service("AthenaPoolCnvSvc") -AthenaPoolCnvSvc.UseDetailChronoStat = TRUE - -from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter -TriggerConfigGetter( "ReadPool" ) - -#to dump ESD/AOD content (do only if theApp.EvtMax = 1) -#StoreGateSvc = Service( "StoreGateSvc" ) -#StoreGateSvc.Dump = True - diff --git a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/run/testOptions.py b/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/run/testOptions.py deleted file mode 100644 index 1f4530eb0d7eeea54a54115f9684a7fceeb1ce7d..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/run/testOptions.py +++ /dev/null @@ -1,256 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -#set DB by hand -#ConfForMC = False -ConfForMC = True - -from AthenaCommon.GlobalFlags import globalflags -globalflags.DetGeo.set_Value_and_Lock('atlas') -#GlobalFlags.DetGeo.set_atlas() -if (ConfForMC): - #GlobalFlags.DataSource.set_geant4() - globalflags.DetGeo.set_Value_and_Lock('geant4') -else : - #GlobalFlags.DataSource.set_data() - globalflags.DataSource.set_Value_and_Lock('data') -from IOVDbSvc.CondDB import conddb - -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags - -#athenaCommonFlags.FilesInput = [ "/afs/cern.ch/work/c/cgutscho/triggerFiles/data12_8TeV.00209084.physics_Muons.merge.AOD.f473_m1213._lb0072._0001.1" ] - -#athenaCommonFlags.FilesInput = [ "/afs/cern.ch/work/c/cgutscho/triggerFiles/data12_8TeV.00211620.physics_Egamma.merge.AOD.f479_m1228._lb0917._0001.1" ] - -# Zmm MC: - -#athenaCommonFlags.FilesInput = [ "/afs/cern.ch/user/c/cgutscho/workspace/triggerFiles/mc10_14TeV.106047.PythiaZmumu_no_filter.recon.AOD.e662_s1107_d459_r2037.AOD.root.1" ] - -# Muon data12 skim: - -""" -athenaCommonFlags.FilesInput = [ - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00200.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00250.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00201.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00251.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00202.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00252.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00203.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00253.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00204.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00254.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00205.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00255.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00206.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00256.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00207.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00257.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00208.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00258.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00209.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00259.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00210.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00260.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00211.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00261.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00212.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00262.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00213.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00263.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00214.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00264.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00215.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00265.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00216.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00266.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00217.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00267.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00218.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00268.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00219.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00269.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00220.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00270.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00221.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00271.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00222.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00272.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00223.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00273.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00224.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00274.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00225.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00275.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00226.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00276.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00227.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00277.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00228.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00278.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00229.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00279.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00230.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00280.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00231.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00281.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00232.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00282.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00233.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00283.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00234.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00284.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00235.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00285.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00236.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00286.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00237.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00287.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00238.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00288.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00239.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00289.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00240.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00290.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00241.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00291.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00242.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00292.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00243.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00293.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00244.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00294.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00245.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00295.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00246.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00296.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00247.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00297.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00248.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00298.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00249.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkim/user.cgutscho.008429._00299.Ztomumu0.AOD.pool.root" -] -""" - -# Muon data12 inefficient events: - -""" -athenaCommonFlags.FilesInput = [ - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkimIneffMu/user.cgutscho.008821._00001.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkimIneffMu/user.cgutscho.008821._00008.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkimIneffMu/user.cgutscho.008821._00002.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkimIneffMu/user.cgutscho.008821._00009.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkimIneffMu/user.cgutscho.008821._00003.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkimIneffMu/user.cgutscho.008821._00010.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkimIneffMu/user.cgutscho.008821._00004.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkimIneffMu/user.cgutscho.008821._00011.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkimIneffMu/user.cgutscho.008821._00005.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkimIneffMu/user.cgutscho.008821._00012.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkimIneffMu/user.cgutscho.008821._00006.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkimIneffMu/user.cgutscho.008821._00013.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkimIneffMu/user.cgutscho.008821._00007.Ztomumu0.AOD.pool.root", - "/afs/cern.ch/work/c/cgutscho/trigger/mergeSkimIneffMu/user.cgutscho.008821._00014.Ztomumu0.AOD.pool.root", -] -""" - -# Egamma data12 files: - -""" -athenaCommonFlags.FilesInput = [ -"/afs/cern.ch/work/c/cgutscho/triggerFiles/data12_8TeV.00211620.physics_Egamma.merge.AOD.f479_m1228._lb0813._0001.1", -"/afs/cern.ch/work/c/cgutscho/triggerFiles/data12_8TeV.00211620.physics_Egamma.merge.AOD.f479_m1228._lb0898._0001.1", -"/afs/cern.ch/work/c/cgutscho/triggerFiles/data12_8TeV.00211620.physics_Egamma.merge.AOD.f479_m1228._lb0917._0001.1", -"/afs/cern.ch/work/c/cgutscho/triggerFiles/data12_8TeV.00211937.physics_Egamma.merge.AOD.f479_m1228._lb0623._0001.1", -"/afs/cern.ch/work/c/cgutscho/triggerFiles/data12_8TeV.00212144.physics_Egamma.merge.AOD.f479_m1228._lb0296._0001.1", -"/afs/cern.ch/work/c/cgutscho/triggerFiles/data12_8TeV.00212172.physics_Egamma.merge.AOD.f479_m1228._lb0503._0001.1", -"/afs/cern.ch/work/c/cgutscho/triggerFiles/data12_8TeV.00211620.physics_Egamma.merge.AOD.f479_m1228._lb0837._0001.1", -"/afs/cern.ch/work/c/cgutscho/triggerFiles/data12_8TeV.00211620.physics_Egamma.merge.AOD.f479_m1228._lb0838._0001.1", -"/afs/cern.ch/work/c/cgutscho/triggerFiles/data12_8TeV.00211620.physics_Egamma.merge.AOD.f479_m1228._lb0839._0001.1", -"/afs/cern.ch/work/c/cgutscho/triggerFiles/data12_8TeV.00211620.physics_Egamma.merge.AOD.f479_m1228._lb0842._0001.1", -"/afs/cern.ch/work/c/cgutscho/triggerFiles/data12_8TeV.00211620.physics_Egamma.merge.AOD.f479_m1228._lb0843._0001.1", -"/afs/cern.ch/work/c/cgutscho/triggerFiles/data12_8TeV.00211620.physics_Egamma.merge.AOD.f479_m1228._lb0844._0001.1", -"/afs/cern.ch/work/c/cgutscho/triggerFiles/data12_8TeV.00211620.physics_Egamma.merge.AOD.f479_m1228._lb0840-lb0841._0001.1", -] -""" - -#mydir = "/afs/cern.ch/work/c/cgutscho/triggerFiles/temp/mc10_14TeV.106047.PythiaZmumu_no_filter.recon.AOD.e662_s1107_d459_r2037_tid285233_00/" -""" -athenaCommonFlags.FilesInput = [ - mydir + "AOD.285233._000010.pool.root.1", - mydir + "AOD.285233._000014.pool.root.1", - mydir + "AOD.285233._000018.pool.root.1", - mydir + "AOD.285233._000012.pool.root.1", - mydir + "AOD.285233._000015.pool.root.1", - mydir + "AOD.285233._000019.pool.root.1", - mydir + "AOD.285233._000013.pool.root.1", - mydir + "AOD.285233._000016.pool.root.1", -] -""" - -# Athena-Aware NTuple making Tools -#CBNTAthenaAware = True -#include ("CBNT_Athena/CBNT_AthenaAware_jobOptions.py") -#include ("CBNT_Athena/CBNT_EventInfo_jobOptions.py") -#athenaCommonFlags.PoolInputQuery.set_Value_and_Lock("") # Needed for TAG jobs (as is) - -from RecExConfig.RecFlags import rec -rec.doTrigger.set_Value_and_Lock(False) # leave false; nothing to do with trigger analysis -# include your algorithm job options here -rec.doESD.set_Value_and_Lock(False) # leave false; nothing to do with trigger analysis -rec.doAOD.set_Value_and_Lock(False) -rec.doFloatingPointException.set_Value_and_Lock(True) -rec.UserAlgs.set_Value_and_Lock("RunJpsimumu.py") -#rec.UserAlgs.set_Value_and_Lock("InDetBeamSpotReader_jobOptions.py") - -from InDetBeamSpotFinder.InDetBeamSpotFinderConf import InDet__InDetBeamSpotReader as InDetBeamSpotReader - -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() -topSequence += InDetBeamSpotReader() - -# Jiri's suggestions: -#topSequence.InTimeAntiKt4TruthJetsFixIt.Enable=False; -#topSequence.InTimeAntiKt4TruthJetsSwapper.Enable=False; -#topSequence.OutOfTimeAntiKt4TruthJetsFixIt.Enable=False; -#topSequence.OutOfTimeAntiKt4TruthJetsSwapper.Enable=False; - - -from IOVDbSvc.CondDB import conddb - -from IOVDbSvc.IOVDbSvcConf import IOVDbSvc -#conddb.Folders+=[ "INDET" + "/Indet/Beampos" + "<tag>nominal</tag>"] -IOVDbSvc = Service("IOVDbSvc") -# IOVDbSvc.overrideTags += ["<prefix>/Indet/Beampos</prefix> <tag>nominal</tag>"] -# IOVDbSvc.overrideTags += ["<prefix>/Indet/Beampos</prefix>"] -# IOVDbSvc.dbConnection = "impl=cool;techno=sqlite;schema=beamspot.db;X:TESTCOOL" -#IOVDbSvc.Folders += ["<dbConnection>impl=cool;techno=sqlite;schema=beamspot.db;X:BEAMSPOT</dbConnection> /Indet/Beampos<tag>nominal</tag>"] -#IOVDbSvc.Folders += ["<dbConnection>sqlite://;schema=beamspot.db;dbname=BEAMSPOT</dbConnection> /Indet/Beampos<tag>nominal</tag>"] - - -# Output log setting; this is for the framework in general -# You may over-ride this in your job options for your algorithm -rec.OutputLevel.set_Value_and_Lock(WARNING); -#rec.OutputLevel.set_Value_and_Lock(DEBUG); -# Write settings; keep all of these to false. -# Control the writing of your own n-tuple in the alg's job options -rec.doCBNT.set_Value_and_Lock(False) -rec.doWriteAOD.set_Value_and_Lock(False) -rec.doWriteTAG.set_Value_and_Lock(False) -rec.doHist.set_Value_and_Lock (False) -###beam spot!!! -#include("InDetBeamSpotReader_jobOptions.py") -### -# main jobOption - must always be included -#include("RecJobTransforms/UseOracle.py") # DB access -include("RecExCommon/RecExCommon_topOptions.py") -# Following 3 lines needed for TAG jobs (as is) -#svcMgr.EventSelector.RefName= "StreamAOD" -#svcMgr.EventSelector.CollectionType="ExplicitROOT" -#svcMgr.EventSelector.Query = "" -#svcMgr.EventSelector.SkipEvents = 15400 -theApp.EvtMax = -1 # number of event to process -#theApp.EvtMax = 500 # number of event to process -# Stops writing of monitoring ntuples (big files) -#from PerfMonComps.PerfMonFlags import jobproperties as jp -#jp.PerfMonFlags.doMonitoring = False -#jp.PerfMonFlags.doFastMon = False diff --git a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/src/AnalysisConfig_Jpsi.cxx b/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/src/AnalysisConfig_Jpsi.cxx deleted file mode 100644 index 42e4b41311ee8e3290e4bf5498f3a54725d91e44..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/src/AnalysisConfig_Jpsi.cxx +++ /dev/null @@ -1,985 +0,0 @@ -// emacs: this is -*- c++ -*- - -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -/** @file AnalysisConfig_Jpsi.cxx */ -/** @author Mark Sutton (sutt@cern.ch) **/ -/** @author Peter Wijeratne (paw@hep.ucl.ac.uk) **/ -/** @author Christian Gutschow (chris.g@cern.ch) **/ - -#include "TrigSteeringEvent/TrigRoiDescriptorCollection.h" - -#include "TrigInDetAnalysis/TIDDirectory.h" -#include "TrigInDetAnalysis/TIDAVertex.h" - -#include "TrigInDetAnalysisUtils/Filter_RoiSelector.h" - -#include "AthenaMonitoring/AthenaMonManager.h" -#include "AthenaMonitoring/ManagedMonitorToolBase.h" - -#include "muonEvent/Muon.h" -#include "muonEvent/MuonContainer.h" -#include "muonEvent/MuonParamDefs.h" - -#include "egammaEvent/ElectronContainer.h" -#include "egammaEvent/Electron.h" -#include "egammaEvent/egamma.h" - -#include "TrigIDJpsiMonitoring/AnalysisConfig_Jpsi.h" -#include "TrigIDJpsiMonitoring/JpsiTrack.h" -#include "TrigIDJpsiMonitoring/JpsiTrackSelector.h" -#include "TrigIDJpsiMonitoring/JpsiAnalysis.h" - -#include "TrigMuonEvent/TrigMuonEFInfoContainer.h" -#include "TrigMuonEvent/TrigMuonEFInfo.h" -#include "TrigMuonEvent/TrigMuonEFTrack.h" -#include "TrigMuonEvent/TrigMuonEFCbTrack.h" -#include "TrigMuonEvent/TrigMuonEFInfoTrackContainer.h" - -#include "VxVertex/VxContainer.h" - -#include "TrigInDetTruthEvent/TrigInDetTrackTruthMap.h" - -#include "TrigDecisionTool/Feature.h" -#include "TrigDecisionTool/FeatureContainer.h" - -#include "TrigInDetEvent/TrigInDetTrackCollection.h" -#include "Particle/TrackParticleContainer.h" -#include "TrigParticle/TrigElectronContainer.h" -#include "TrigParticle/TrigPhotonContainer.h" - -#include "TMath.h" -#include <cassert> - -using std::cout; -using std::endl; -using std::string; -using std::fabs; -using std::pow; -using std::vector; -using std::map; - -//#include "Particle/TrackParticle.h" - -using namespace TrigInDetAnalysis; - -void AnalysisConfig_Jpsi::loop() { - - ++m_count_before; - bool isPassed = false; - //string inclTrigChain = "EF_mu24i_tight"; - string inclTrigChain = "EF_mu20"; - //string inclTrigChain = "EF_mu18"; // MC test - //string checkTrigger = (m_refChainName.find("Zm") != string::npos)? "EF_2mu13" : string(m_refChainName); - string checkTrigger = (m_refChainName.find("Zm") != string::npos)? inclTrigChain : string(m_refChainName); - //string checkTrigger = (m_refChainName.find("Zm") != string::npos)? "EF_mu18_IDTrkNoCut_tight" : string(m_refChainName); - //if( (*m_tdt)->isPassed("EF_mu20it_tight") ) isPassed = true; - //else if( (*m_tdt)->isPassed("EF_mu24i_tight") ) isPassed = true; - if( (*m_tdt)->isPassed(checkTrigger) ) isPassed = true; - //if( (*m_tdt)->isPassed("EF_2mu13") && (*m_tdt)->isPassed(m_refChainName) ) isPassed = true; - //if( (*m_tdt)->isPassed(m_refChainName) ) isPassed = true; - - if( isPassed ) { - ++m_count_after; - m_provider->msg(MSG::INFO) << "EVENT PASSED TRIGGER: " << checkTrigger << endmsg; - - Trig::ExpertMethods* em = (*m_tdt)->ExperimentalAndExpertMethods(); - em->enable(); - bool HLTTruncated = true; - HLTTruncated = em->isHLTTruncated(); - if(HLTTruncated) { - m_provider->msg(MSG::WARNING) << "Incomplete HLT result - ABORTING EVENT." << endmsg; - return; - } - else { - m_provider->msg(MSG::INFO) << "\033[94;mSTART EVENT -- ALGORITHM: " << m_testChainKey << "\033[m" << endmsg; - makeClean(); - - //get beam position - double xbeam = 0; - double ybeam = 0; - //double xbeam_online = 0; - //double ybeam_online = 0; - - if( m_iBeamCondSvc ) { - - xbeam = m_iBeamCondSvc->beamPos()[0]; - ybeam = m_iBeamCondSvc->beamPos()[1]; - - m_analysis->setBeamRef( xbeam, ybeam ); - } - /*if( m_iOnlineBeamCondSvc ) { - HepPoint3D vertex = m_iOnlineBeamCondSvc->beamPos(); - //if (fabs(xbeam-vertex.x())>0.1 || fabs(ybeam-vertex.y())>0.1){ - m_provider->msg(MSG::INFO) << " using online beam position\tx=" << vertex.x() << "\ty=" << vertex.y() << endmsg; - //} - xbeam_online = vertex.x(); - ybeam_online = vertex.y(); - }*/ - - m_events++; - - if(m_provider->evtStore()->retrieve(m_eventInfo).isFailure()) { - cout << "Failed to get EventInfo." << endl; - } - unsigned int runNumber = m_eventInfo->event_ID()->run_number(); - unsigned int eventNumber = m_eventInfo->event_ID()->event_number(); - - //cout << "NEW EVENT WITH RUN NUMBER: " << runNumber << " AND EVENT NUMBER: " << eventNumber << endl; - - // bug in 8 TeV muon setup until July 24th 2012 - // causing efficiency to be 100 % --> ignore! - //if(m_isMuon && runNumber <= 207397) return; - - //cout << "SOME VERTEX STUFF" << endl; - - vector<TIDA::Vertex*> vertices; - const VxContainer* primaryVtxCollection; - if(m_provider->evtStore()->retrieve(primaryVtxCollection, "VxPrimaryCandidate").isFailure()) { - m_provider->msg(MSG::WARNING) << "Primary vertex container not found" << endmsg; - } - else { - VxContainer::const_iterator vtxitr = primaryVtxCollection->begin(); - for(; vtxitr != primaryVtxCollection->end(); ++vtxitr) { - if( (*vtxitr)->vxTrackAtVertex()->size()>0 ) { - vertices.push_back( new TIDA::Vertex( (*vtxitr)->recVertex().position().x(), (*vtxitr)->recVertex().position().y(), - (*vtxitr)->recVertex().position().z(), 0,0,0, (*vtxitr)->vxTrackAtVertex()->size() ) ); - } - } - } - if( m_selectorRef ) m_selectorJ = dynamic_cast<JpsiTrackSelector*>(m_selectorRef); - else { - return; - } - - //cout << "Trig::FeatureContainer" << endl; - - bool doTruth = false; - - //temp - vector<const TrigMuonEFTrack*> muonExtrapolatedTracks; - vector<const TrigMuonEFCbTrack*> muonCombinedTracks; - vector<const TrigMuonEFCbTrack*> incCombinedTracks; - vector<const egamma*> tightElectrons_EF; - vector<const CaloCluster*> ClusterContainer_EF; - const Analysis::MuonContainer* Muons = 0; - vector<const Rec::TrackParticle*> offlineMSOnly; - vector<const Rec::TrackParticle*> offlineInDet; - //vector<const Rec::TrackParticle*> offlineInDet2; - vector<const Analysis::Electron*> offTightElecs; - vector<int> clusterRoiIDs, tightElecsRoiIDs; - vector<int> tagRois, probeRois; - //temp - - if( doTruth ) { - //get truth tracks - const TruthParticleContainer* truthTracks = 0; - if(m_provider->evtStore()->contains<TruthParticleContainer>(m_truthCollection)) { - StatusCode scm = m_provider->evtStore()->retrieve(truthTracks,m_truthCollection); - if(scm.isFailure()) { - if(m_events == 1) { - m_provider->msg(MSG::WARNING) <<"No Collection with name "<<m_truthCollection<<" found in StoreGate" << endmsg; - } - else if(m_provider->msgLvl(MSG::DEBUG)) { - m_provider->msg(MSG::DEBUG)<< "No Collection with name "<<m_truthCollection<<" found in StoreGate" << endmsg; - } - } - } - else if (m_provider->msgLvl(MSG::DEBUG)) { - m_provider->msg(MSG::DEBUG) << "StoreGate does not contain Collection with name "<<m_truthCollection<<" "<<endmsg; - } - if(!m_provider->evtStore()->contains<LVL1_ROI>("LVL1_ROI")) m_useTrigger=false; - m_selectorJ->selectTracks( truthTracks ); - } - else { - if( !m_runOnline && m_isMuon ) { - if(m_provider->evtStore()->contains<Analysis::MuonContainer>(m_muonCollection)) { - StatusCode scm = m_provider->evtStore()->retrieve(Muons,m_muonCollection); - if(scm.isFailure()) { - if(m_events == 1) { - m_provider->msg(MSG::WARNING) <<"No Collection with name "<<m_muonCollection<<" found in StoreGate" << endmsg; - } - else if(m_provider->msgLvl(MSG::DEBUG)) { - m_provider->msg(MSG::DEBUG)<< "No Collection with name "<<m_muonCollection<<" found in StoreGate" << endmsg; - } - } - } - else if(m_provider->msgLvl(MSG::DEBUG)) { - m_provider->msg(MSG::DEBUG) << "StoreGate does not contain Collection with name "<<m_muonCollection<<" "<<endmsg; - } - //cout << "serious business below" << endl; - - if(!m_provider->evtStore()->contains<LVL1_ROI>("LVL1_ROI")) m_useTrigger=false; - //iterators over the muon container and retrieve ID tracks only - Analysis::MuonContainer::const_iterator MuonItr = Muons->begin(), MuonItrEnd = Muons->end(); - for(; MuonItr != MuonItrEnd; ++MuonItr) { - if((*MuonItr)->isCombinedMuon()&&(*MuonItr)->hasInDetTrackParticle()) offlineInDet.push_back((*MuonItr)->inDetTrackParticle()); - if((*MuonItr)->hasMuonExtrapolatedTrackParticle()) offlineMSOnly.push_back((*MuonItr)->muonExtrapolatedTrackParticle()); - } - } - else if(m_isMuon) { - if(m_remover) { - m_remover->clear(); - - - // MC test stuff: - // inclusive trigger chain: "EF_mu24i_tight"; - cout << "\n\nMC test: START ..." << endl; - - cout << "MC test: Inclusive trigger chain: " << m_refChainName << endl; - cout << "MC test: Get features with TrigDef::alsoDeactivateTEs ..." << endl; - Trig::FeatureContainer fdeac = (*m_tdt)->features(m_refChainName, TrigDefs::alsoDeactivateTEs); - cout << "MC test: Get combinations ..." << endl; - const vector<Trig::Combination>& incComboDeac = fdeac.getCombinations(); - vector<Trig::Combination>::const_iterator incComboDeac_itr = incComboDeac.begin(); - vector<Trig::Combination>::const_iterator incComboDeac_itrEnd = incComboDeac.end(); - int nComb = (incComboDeac_itrEnd - incComboDeac_itr); - cout << "MC test: nComb: " << nComb << endl; - cout << "MC test: ... return if < 2." << endl; - if(nComb < 2) return; - - - cout << "MC test: Get features with TrigDef::Physics ..." << endl; - Trig::FeatureContainer fphys = (*m_tdt)->features(m_refChainName, TrigDefs::Physics); - cout << "MC test: Get combinations ..." << endl; - const vector<Trig::Combination>& incCombo = fphys.getCombinations(); - vector<Trig::Combination>::const_iterator incCombo_itr = incCombo.begin(); - vector<Trig::Combination>::const_iterator incCombo_itrEnd = incCombo.end(); - int nCombPhys = (incCombo_itrEnd - incCombo_itr); - cout << "MC test: nCombPhys, nComb = " << nCombPhys << ", " << nComb << endl; - cout << "MC test: ... return if nCombPhys < 1." << endl; - if(nCombPhys < 1) return; - - // It appears they didn't run our monitoring chain for the MC ... - /*cout << m_refChainName << endl; - Trig::FeatureContainer _fconto = (*m_tdt)->features(m_refChainName, TrigDefs::alsoDeactivateTEs); - cout << "Get monitoring combinations... " << endl; - const vector<Trig::Combination>& _combo = _fconto.getCombinations(); - vector<Trig::Combination>::const_iterator _c_itro = _combo.begin(); - int monitComb = (_combo.end() - _c_itro); - cout << "monitoring combinations: " << monitComb << endl;*/ - - vector<int> used_combis; - string tagTE = "", TEName = ""; - //unsigned int m1roiID = 0, m2roiID = 0; - cout << "MC test: Loop over all tags ..." << endl; - for(int tag_index = 0; tag_index < nCombPhys; ++tag_index) { - //incCombo_itr != incCombo_itrEnd; ++incCombo_itr) { - cout << " MC test: current tag: " << tag_index << endl; - vector< Trig::Feature< TrigMuonEFInfoContainer > > tagmuons = incCombo_itr->get< TrigMuonEFInfoContainer >("MuonEFInfo", TrigDefs::Physics, tagTE); - ++incCombo_itr; - cout << " MC test: number of muons in tag combination: " << tagmuons.size() << endl; - assert(tagmuons.size() == 1 && "WARNING -- wrong number of muons in this combination!!!"); - const HLT::TriggerElement* m1te = tagmuons[0].te(); - TEName = (Trig::getTEName(*m1te).c_str()); - cout << " MC test: TE name for muon " << tag_index << " is: " << TEName << endl; - //cout << " MC test: TE ID = " << (*m1te).getId() << endl; - cout << " MC test: getActiveState: " << (*m1te).getActiveState() << endl; - //m1roiID = (*m_tdt)->ancestor<TrigRoiDescriptor>(tagmuons[0], "forID").cptr()->roiId(); - //cout << " MC test: RoI ID (mu1): " << m1roiID << " (" << tag_index << ")" << endl; - - //Trig::Feature< TrigMuonEFInfoContainer > trackFeature1 = tagmuons.at(0); - const TrigMuonEFInfoContainer* trigMuon = tagmuons.at(0).cptr(); - //TrigMuonEFInfoContainer::const_iterator muItr1 = trigMuon->begin(); - const TrigMuonEFInfoTrackContainer* tagCon = (*(trigMuon->begin()))->TrackContainer(); - TrigMuonEFInfoTrackContainer::const_iterator trackItr = tagCon->begin(); - TrigMuonEFInfoTrackContainer::const_iterator trackItrEnd = tagCon->end(); - //int nCons = int(trackItrEnd - trackItr); - //cout << "Number of trackcontainer elements: " << nCons << endl; - TrigMuonEFCbTrack* tagCB = 0; - for(; trackItr != trackItrEnd; ++trackItr) { - const TrigMuonEFInfoTrack* muonInfo = (*trackItr); - bool pass = muonInfo->hasCombinedTrack(); - cout << "hasCombinedTrack: " << pass << endl; - if(pass) tagCB = muonInfo->CombinedTrack(); - } - if(!tagCB) { cout << "TAG IGNORED." << endl; continue; } - //const TrigMuonEFInfoContainer* trigMuon = tagmuons[0].cptr(); - //TrigMuonEFInfoTrackContainer* tagCon = trigMuon->at(0)->TrackContainer(); - //TrigMuonEFCbTrack* tagCB = tagCon->at(0)->CombinedTrack(); - //TrigMuonEFCbTrack* tagCB = muonInfo->CombinedTrack(); - TrigMuonEFTrack* tag = tagCon->at(0)->ExtrapolatedTrack(); - //TrigMuonEFTrack* tag = tagmuons[0].cptr()->at(0)->TrackContainer()->at(0)->ExtrapolatedTrack(); - - cout << " MC test: Loop over all combinations including the deactived ones ..." << endl; - //vector<Trig::Combination>::const_iterator deacCombo_itr = incComboDeac_itr; - //vector<Trig::Combination>::const_iterator deacCombo_itr = incCombo_itr + 1; - incComboDeac_itr = incComboDeac.begin(); - double minMass = 0.; - for(int deac_index = 0; deac_index < nComb; ++deac_index) { - //deacCombo_itr < incComboDeac_itrEnd; ++deacCombo_itr) { - cout << "MC test: Indices for current combination: " << tag_index - << ", " << deac_index << " (ignore if equal)" << endl; - cout << " MC test: current combination: " << deac_index << endl; - vector< Trig::Feature< TrigMuonEFInfoContainer > > combimuons = incComboDeac_itr->get< TrigMuonEFInfoContainer >("MuonEFInfo", TrigDefs::alsoDeactivateTEs, tagTE); - ++incComboDeac_itr; - cout << " MC test: number of muons in current combination: " << combimuons.size() << endl; - assert(combimuons.size() == 1 && "WARNING -- wrong number of muons in this combination!!!"); - const HLT::TriggerElement* m2te = combimuons[0].te(); - TEName = (Trig::getTEName(*m2te).c_str()); - cout << " MC test: TE name for muon " << deac_index << " is: " << TEName << endl; - //cout << " MC test: TE ID = " << (*m2te).getId() << endl; - cout << " MC test: getActiveState: " << (*m2te).getActiveState() << endl; - //m2roiID = (*m_tdt)->ancestor<TrigRoiDescriptor>(combimuons[0], "forID").cptr()->roiId(); - //cout << " MC test: RoI ID (mu2): " << m2roiID << " (" << deac_index << ")" << endl; - //cout << " MC test: compare RoIs: (mu1, mu2) = (" << m1roiID << ", " << m2roiID << ")" << endl; - - const TrigMuonEFInfoContainer* trigMu = combimuons.at(0).cptr(); - const TrigMuonEFInfoTrackContainer* probeCon = (*(trigMu->begin()))->TrackContainer(); - TrigMuonEFInfoTrackContainer::const_iterator trackItr = probeCon->begin(); - TrigMuonEFInfoTrackContainer::const_iterator trackItrEnd = probeCon->end(); - TrigMuonEFTrack* probe = 0; - for(; trackItr != trackItrEnd; ++trackItr) { - const TrigMuonEFInfoTrack* muonInfo = (*trackItr); - bool pass = muonInfo->hasExtrapolatedTrack(); - cout << "hasExtrapolatedTrack: " << pass << endl; - if(pass) probe = muonInfo->ExtrapolatedTrack(); - } - if(!probe) { cout << "PROBE IGNORED." << endl; continue; } - //TrigMuonEFTrack* probe = combimuons[0].cptr()->at(0)->TrackContainer()->at(0)->ExtrapolatedTrack(); - if( (*tag) == (*probe) || !tagCB ) { cout << "IGNORED." << endl; continue; } - int tagRoiID = (*m_tdt)->ancestor<TrigRoiDescriptor>(tagmuons[0], "").cptr()->roiId(); - int probeRoiID = (*m_tdt)->ancestor<TrigRoiDescriptor>(combimuons[0], "").cptr()->roiId(); - cout << "tag pt, eta, phi: " << tag->pt() << " " << tag->eta() << " " << tag->phi() << endl; - cout << "probe pt, eta, phi: " << probe->pt() << " " << probe->eta() << " " << probe->phi() << endl; - cout << ">>> TEST 1: " << tag << " " << (*tag) << endl; - TLorentzVector v1, v2; - double energy = sqrt(pow(m_muonMass,2) + pow(tag->px(),2) + pow(tag->py(),2) + pow(tag->pz(),2)); - v1.SetPtEtaPhiE(tag->pt(), tag->eta(), tag->phi(), energy); - energy = sqrt(pow(m_muonMass,2) + pow(probe->px(),2) + pow(probe->py(),2) + pow(probe->pz(),2)); - v2.SetPtEtaPhiE(probe->pt(), probe->eta(), probe->phi(), energy); - double mass = (v1 + v2).Mag(); - cout << " MC test: invariant mass: " << mass << endl; - if(!minMass) { - minMass = mass; - used_combis.push_back( 100 + 10 * tag_index + deac_index ); - muonExtrapolatedTracks.push_back(probe); - muonCombinedTracks.push_back(tagCB); - probeRois.push_back(probeRoiID); - tagRois.push_back(tagRoiID); - } - else if(mass < minMass) { - minMass = mass; - used_combis[used_combis.size() - 1] = (100 + 10 * tag_index + deac_index ); - muonExtrapolatedTracks[muonExtrapolatedTracks.size() - 1] = probe; - //muonCombinedTracks[muonCombinedTracks.size() - 1] = tagCB; - probeRois[probeRois.size() - 1] = probeRoiID; - //tagRois[tagRois.size() - 1] = tagRoiID; - } - } // loop over deactivatedTEs - } // loop over physics - cout << "MC test: combinations being used:" << endl; - for(int ii = 0; ii < int(used_combis.size()); ++ii) { cout << " " << used_combis[ii] << endl; } - cout << "MC test: END.\n" << endl; - //return; - - /*m_provider->msg(MSG::DEBUG) << "Get features... " << endmsg; - Trig::FeatureContainer fconto = (*m_tdt)->features(m_refChainName, m_trigDefs); - m_provider->msg(MSG::DEBUG) << "Get combinations... " << endmsg; - const vector<Trig::Combination>& combo = fconto.getCombinations(); - vector<Trig::Combination>::const_iterator c_itro = combo.begin(); - m_provider->msg(MSG::DEBUG) << "combo.end() - combo.begin(): " << (combo.end() - c_itro) << endmsg; - if(c_itro == combo.end()) return; - m_provider->msg(MSG::DEBUG) << "m_remover->MuonMaker(...)" << endmsg; - m_remover->muonMaker(c_itro, m_refChainName, m_tdt, m_trigDefs); - muonExtrapolatedTracks = m_remover->getExTrks(); - muonCombinedTracks = m_remover->getCbTrks();*/ - - //cout << "Number of combined tracks before making J/Psi = " << muonCombinedTracks.size() - // << " extrp tracks = " << muonExtrapolatedTracks.size() << endl; - } - //temp - if(m_provider->evtStore()->contains<Analysis::MuonContainer>(m_muonCollection)) { - StatusCode scm = m_provider->evtStore()->retrieve(Muons,m_muonCollection); - if(scm.isFailure()) { - if(m_events==1) { - m_provider->msg(MSG::WARNING) <<"No Collection with name "<<m_muonCollection<<" found in StoreGate" << endmsg; - } - else if(m_provider->msgLvl(MSG::DEBUG)) { - m_provider->msg(MSG::DEBUG)<< "No Collection with name "<<m_muonCollection<<" found in StoreGate" << endmsg; - } - Muons = 0; - } - } - else { - if(m_provider->msgLvl(MSG::DEBUG)) { - m_provider->msg(MSG::DEBUG) << "StoreGate does not contain Collection with name " << m_muonCollection << " " << endmsg; - } - } - if(!m_provider->evtStore()->contains<LVL1_ROI>("LVL1_ROI")) m_useTrigger = false; - // iterators over the muon container and retrieve ID tracks only - if (Muons){ - Analysis::MuonContainer::const_iterator MuonItr = Muons->begin(), MuonItrEnd = Muons->end(); - for(; MuonItr != MuonItrEnd; ++MuonItr) { - if((*MuonItr)->isCombinedMuon()&&(*MuonItr)->hasInDetTrackParticle()) offlineInDet.push_back((*MuonItr)->inDetTrackParticle()); - if((*MuonItr)->hasMuonExtrapolatedTrackParticle()) offlineMSOnly.push_back((*MuonItr)->muonExtrapolatedTrackParticle()); - } - } - ////temp - } - else { - m_provider->msg(MSG::DEBUG) << "EF_egamma stuff" << endmsg; - Trig::FeatureContainer f = (*m_tdt)->features(m_refChainName, TrigDefs::Physics); - const vector<Trig::Combination> comb_container_EF = f.getCombinations(); - Trig::FeatureContainer::combination_const_iterator c(comb_container_EF.begin()); - Trig::FeatureContainer::combination_const_iterator cEnd(comb_container_EF.end()); - if(comb_container_EF.size()) { - int counter_egamma = -1; - int counter_cluster = -1; - for(Trig::FeatureContainer::combination_const_iterator my_it = c; my_it != cEnd; ++my_it) { - vector< Trig::Feature<TrigRoiDescriptor> > vecRoi = my_it->get<TrigRoiDescriptor>(""); - //vector< Trig::Feature<TrigRoiDescriptor> >::const_iterator roiItr = vecRoi.begin(); - //vector< Trig::Feature<TrigRoiDescriptor> >::const_iterator roiLast = vecRoi.end(); - /*for( ; (roiItr != roiLast); ++roiItr) { - const HLT::TriggerElement* a = (*roiItr).te(); - a = const_cast<HLT::TriggerElement*>(a); - string TEName = ""; - TEName = (Trig::getTEName((*a))).c_str(); - m_provider->msg(MSG::DEBUG) << "TE Name: " << TEName << endmsg; - }*/ - //const vector<Trig::Feature<CaloClusterContainer> > cluster_cont = my_it->get<CaloClusterContainer>(""); - m_provider->msg(MSG::DEBUG) << "Get calo cluster..." << endmsg; - std::string teName = ""; - //if(m_refChainName.find("Zee") != string::npos) teName = "EF_e15_NoCutcalo"; - //cout << "try TE name: " << teName << endl; - const vector<Trig::Feature<CaloClusterContainer> > cluster_cont = my_it->get<CaloClusterContainer>("",TrigDefs::Physics,teName); - m_provider->msg(MSG::DEBUG) << "egamma container cluster_cont size: " << cluster_cont.size() << endmsg; - if(cluster_cont.size() != 0) { - vector<Trig::Feature<CaloClusterContainer> >::const_iterator tempEnd = cluster_cont.end(); - for(vector<Trig::Feature<CaloClusterContainer> >::const_iterator contit = cluster_cont.begin(); contit != tempEnd; ++contit) { - ++counter_cluster; - if(!(counter_cluster%2 == 0)) { - //cout << "There are " << ((*contit).cptr())->size() << " loose cluster(s) in this event" << endl; - Trig::Feature<TrigRoiDescriptor> trackroi = (*m_tdt)->ancestor<TrigRoiDescriptor>(*contit, ""); - const TrigRoiDescriptor* roiId = trackroi.cptr(); - DataVector<CaloCluster>::const_iterator temp2End = ((*contit).cptr())->end(); - for(DataVector<CaloCluster>::const_iterator clusItr = ((*contit).cptr())->begin(); clusItr!= temp2End; ++clusItr) { - const CaloCluster* tempCalo = *clusItr; - //if(TMath::Abs(tempCalo->eta())<1.37 || TMath::Abs(tempCalo->eta())>1.52) { - ClusterContainer_EF.push_back(tempCalo); - clusterRoiIDs.push_back(roiId->roiId()); - m_provider->msg(MSG::DEBUG) << "cluster egamma roiId: " << roiId->roiId() << endmsg; - //} - } - } - } - } - //const vector< Trig::Feature<egammaContainer> > temp = my_it->get<egammaContainer>(""); - m_provider->msg(MSG::DEBUG) << "calocluster size: " << cluster_cont.size() << endmsg; - m_provider->msg(MSG::DEBUG) << "get tight electrons ..." << endmsg; - teName = ""; - //if(m_refChainName.find("Zee") != string::npos) teName = "EF_e24vh_tight1"; - //cout << "try TE name: " << teName << endl; - const vector<Trig::Feature<egammaContainer> > temp = my_it->get<egammaContainer>("",TrigDefs::Physics,teName); - m_provider->msg(MSG::DEBUG) << "egamma container temp size: " << temp.size() << endmsg; - if(temp.size() != 0) { - vector<Trig::Feature<egammaContainer> >::const_iterator t0 = temp.begin(); - vector<Trig::Feature<egammaContainer> >::const_iterator tEnd = temp.end(); - for(vector< Trig::Feature<egammaContainer> >::const_iterator contit = t0; contit != tEnd; ++contit){ - ++counter_egamma; - if(counter_egamma%2 == 0) { - Trig::Feature<TrigRoiDescriptor> trackroi = (*m_tdt)->ancestor<TrigRoiDescriptor>(*contit, ""); - const TrigRoiDescriptor* roiId = trackroi.cptr(); - DataVector<egamma>::const_iterator e0 = ((*contit).cptr())->begin(); - DataVector<egamma>::const_iterator eEnd = ((*contit).cptr())->end(); - for( DataVector<egamma>::const_iterator elecItr = e0; elecItr != eEnd; ++elecItr) { - const egamma* tempEl = *elecItr; - //if(TMath::Abs(tempEl->eta())<1.37 ||TMath::Abs(tempEl->eta())>1.52) { - tightElectrons_EF.push_back(tempEl); - tightElecsRoiIDs.push_back(roiId->roiId()); - m_provider->msg(MSG::DEBUG) << "tight egamma roiId: " << roiId->roiId() << endmsg; - //egamma_tightEl_EF.push_back(tempEl->trackParticle()); - //} - } - } - } - } - m_provider->msg(MSG::DEBUG) << "tightelectrons size: " << tightElectrons_EF.size() << endmsg; - /*vector< Trig::Feature<Rec::TrackParticleContainer> > feature_EF = my_it->get<Rec::TrackParticleContainer>("InDetTrigParticleCreation_Electron_EFID"); - vector< Trig::Feature<Rec::TrackParticleContainer> >::const_iterator contit = feature_EF.begin(); - vector< Trig::Feature<Rec::TrackParticleContainer> >::const_iterator contitEnd = feature_EF.end(); - for( ; contit != contitEnd; ++contit) { - const Rec::TrackParticleContainer *cont = (*contit).cptr(); - Rec::TrackParticleContainer::const_iterator track = cont->begin(); - Rec::TrackParticleContainer::const_iterator trackEnd = cont->end(); - for( ; track != trackEnd; ++track) { - //cout << "NEWEST_TEST" << endl; - //const Rec::TrackParticle *temp = *track; - offlineInDet2.push_back(*track); - } - }*/ - } - } - m_provider->msg(MSG::DEBUG) << "Start offline bit ..." << endmsg; - vector<int> tagRoIs; - const DataHandle<ElectronContainer> ElectronCollection; - string electronCollection = "ElectronAODCollection"; - StatusCode sc_electrons = m_provider->evtStore()->retrieve( ElectronCollection, electronCollection); - if(!sc_electrons.isFailure()) m_provider->msg(MSG::DEBUG) << "OFFLINE -- number of electrons: " << ElectronCollection->size() << endmsg; - if(ElectronCollection && ElectronCollection->size() != 0) { - ElectronContainer::const_iterator elecItrEnd = ElectronCollection->end(); - for(ElectronContainer::const_iterator elecItr = ElectronCollection->begin(); elecItr != elecItrEnd; ++elecItr) { - const Analysis::Electron* temp = *elecItr; - /*cout << "isem(0) = " << temp->isem(egammaPID::ElectronMediumPP) << " passID(1) = " - << temp->passID(egammaPID::ElectronIDMediumPP) << endl;*/ - if(temp->isem(egammaPIDObs::ElectronMediumPP)==0 || 1==temp->passID(egammaPIDObs::ElectronIDMediumPP)) { - //if(temp->isem(egammaPID::ElectronTightPP)==0 || 1==temp->passID(egammaPID::ElectronIDTightPP)) { - //if(TMath::Abs(temp->eta())<1.37 || TMath::Abs(temp->eta())>1.52) { - m_provider->msg(MSG::DEBUG) << "OFFLINE -- electron passed [ pT = " << temp->pt() - << ", eta = " << temp->eta() << ", phi = " << temp->phi() - << ", charge = " << temp->charge() << " ]" << endmsg; - cout << "OFFLINE -- electron passed [ pT = " << temp->pt() - << ", eta = " << temp->eta() << ", phi = " << temp->phi() - << ", charge = " << temp->charge() << " ]" << endl; - if(temp->charge()) offTightElecs.push_back(temp); // tight - //} - } - } - //cout << "OFFLINE -- Number of electrons after filtering: " << offlineInDet2.size() << " candidates!!" << endl; - } - //cout << "OFFLINE_END_OF_LOOP" << endl; - } // end of electron bit - if(m_jpsi) { - cout << "prepare making dilepton pairs..." << endl; - m_jpsi->initializeMembers(); - m_jpsi->doTagAndProbe(m_TagAndProbe); - m_jpsi->useTrigger(m_useTrigger); //tag a combined muon passing L1 muon ROI; not necessary for EF muons - m_jpsi->setTrackMass(m_muonMass); - m_jpsi->setUpperInvMassLimit(m_jpsiPDGmass+m_plusMass); - m_jpsi->setLowerInvMassLimit(m_jpsiPDGmass-m_minusMass); - cout << "making dilepton pairs..." << endl; - if(m_isMuon) { - cout << "set tags..." << endl; - m_jpsi->setTags(muonCombinedTracks, tagRois); //m_remover->getTagRoIs()); - cout << "set probes..." << endl; - m_jpsi->setProbes(muonExtrapolatedTracks, probeRois); //m_remover->getProbeRoIs()); - //m_jpsi->setProbes(muonExtrapolatedTracks, m_remover->getMatches(), m_remover->getRoIs()); - } - else { - m_jpsi->setTags(tightElectrons_EF,tightElecsRoiIDs); - m_jpsi->setProbes(ClusterContainer_EF,clusterRoiIDs); - } - cout << "finish off making dilepton pairs..." << endl; - m_jpsi->setPtcut(m_ptcut); - m_jpsi->setTagPtcut(m_tagptcut); - m_jpsi->setEtacut(m_etacut); - m_jpsi->setTagEtacut(m_tagetacut); - cout << "get the pairs..." << endl; - - //cout << "AC_Jpsi extrapolated tracks " << muonExtrapolatedTracks.size() << " combined tracks " << muonCombinedTracks.size() << endl; - vector<DiMuonTool*> mypairs = m_jpsi->execute(); - m_provider->msg(MSG::DEBUG) << "jpsi candidates: " << mypairs.size() << endmsg; - /*for(unsigned int q = 0; q < mypairs.size(); q++) { - m_provider->msg(MSG::DEBUG) << "pair: " << q << " mypairs[q]: " << mypairs[q] << endmsg; - const Wrapper::MuonTrack *p = mypairs[q]->ProbedTrack(); - m_provider->msg(MSG::DEBUG) << "probed track -- pt = " << p->pt() << " eta = " << p->eta() << " phi = " << p->phi() << endmsg; - const Wrapper::MuonTrack *t = mypairs[q]->TaggedTrack(); - m_provider->msg(MSG::DEBUG) << "tagged track -- pt = " << t->pt() << " eta = " << t->eta() << " phi = " << t->phi() << endmsg; - }*/ - //to protect against > 1 J/Psi's being made with 1 tag and > 1 similar probes - //take the pair with invariant mass closest to the J/Psi - //for 1 J/Psi, this will be seen as > 2 J/Psi candidates... - /*if(mypairs.size() > 2){ - double PI=3.14159265; - for(unsigned i=0; i<mypairs.size(); i++) { - for(unsigned j = i+1; j<mypairs.size(); ) { - double deta = mypairs[i]->ProbedTrack()->eta() - mypairs[j]->ProbedTrack()->eta(); - double dphi = mypairs[i]->ProbedTrack()->phi() - mypairs[j]->ProbedTrack()->phi(); - if(dphi > PI) dphi -= 2*PI; - if(dphi < -PI) dphi += 2*PI; - double dr = sqrt(pow(deta,2) + pow(dphi,2)); - if(dr < 0.5) { - if(fabs(m_jpsiPDGmass - mypairs[i]->InvariantMass()) < fabs(m_jpsiPDGmass - mypairs[j]->InvariantMass())) { - mypairs.erase(mypairs.begin()+j); - break; - } - else { - mypairs.erase(mypairs.begin()+i); - break; - } - } - else j++; - } - } - }*/ - m_selectorJ->addJpsi(mypairs); - m_provider->msg(MSG::DEBUG) << "Pair added." << endmsg; - cout << "SKIM CANDIDATES -- event #: " << eventNumber << " run #: " << runNumber << endl; - } // if( m_jpsi ) - } // end of else -> if( doTruth ) - - m_provider->msg(MSG::DEBUG) << "Call m_selectorJ->tracks()" << endmsg; - vector<TIDA::Track*> probeTracks = m_selectorJ->tracks(); - unsigned int trackSize = probeTracks.size(); - m_provider->msg(MSG::DEBUG) << "probeTracks size: " << trackSize << endmsg; - - // perform dR match between offline extrapolated tracks and EF probes - map<unsigned int, const Rec::TrackParticle*> offlineProbes, offlineTags; - vector<float> pOffDr(trackSize), tOffDr(trackSize), pOffDeta(trackSize), - pOffDphi(trackSize), pOffCharge(trackSize), tOffCharge(trackSize), - pOffEt(trackSize); - float ptCut = 4000., tagPtCut = 5000.; - if(!m_isJpsi) { - ptCut = 15000.; - tagPtCut = 24000.; - } - - m_provider->msg(MSG::DEBUG) << "loop over probeTracks." << endmsg; - for(unsigned int j=0; j< trackSize; j++) { - - const Rec::TrackParticle* closestProbe = 0, *closestTag = 0; - TIDA::JpsiTrack* probe = 0; - const Wrapper::MuonTrack *tag = 0; - const CaloCluster *offClust = 0; - - // Make sure there is a default value of 0 if there is no offline match - offlineProbes[j] = offlineTags[j] = 0; - pOffDr[j] = tOffDr[j] = pOffDeta[j] = pOffDphi[j] = 0; - pOffCharge[j] = tOffCharge[j] = pOffEt[j] = 0; - - m_provider->msg(MSG::DEBUG) << "probeTracks[j] --> " << probeTracks[j] << endmsg; - if(probeTracks[j]) { - m_provider->msg(MSG::DEBUG) << "Get probe ..." << endmsg; - probe = dynamic_cast<TIDA::JpsiTrack*>(probeTracks[j]); - m_provider->msg(MSG::DEBUG) << "probe: " << probe << " and *probe: " << *probe << endmsg; - m_provider->msg(MSG::DEBUG) << "Get tag ..." << endmsg; - tag = probe->getTag(); - m_provider->msg(MSG::DEBUG) << "tag: " << tag << endmsg; - m_provider->msg(MSG::DEBUG) << "... done." << endmsg; - } - else throw std::runtime_error("*** TrigJpsiMonTool *** Probe not casting, aborting!!! *** TrigJpsiMonTool ***"); - - - float tempP = 999., tempT = 999., detaP = 0., dphiP = 0., etP = 0.; - m_provider->msg(MSG::DEBUG) << "Loop over offline objects..." << endmsg; - unsigned int offSize = m_isMuon? offlineInDet.size() : offTightElecs.size(); - for(unsigned int i = 0; i < offSize; i++) { - - if(!m_isMuon) { - unsigned int author = offTightElecs[i]->author(); - m_provider->msg(MSG::DEBUG) << "author: " << author << endmsg; - if(author != 1 && author != 3) continue; - offClust = offTightElecs[i]->cluster(); - //cout << "off electron pT: " << offTightElecs[i]->pt() << endl; - //cout << "off cluster pT: " << offClust->pt() << endl; - //cout << "off track pT: " << offTightElecs[i]->trackParticle()->pt() << endl; - } - - float offEta = m_isMuon? offlineInDet[i]->eta() : offClust->eta(); - float offPhi = m_isMuon? offlineInDet[i]->phi() : offClust->phi(); - float offPt = m_isMuon? offlineInDet[i]->pt() : offClust->pt(); - float deltar = AnalysisConfig_Jpsi::deltaR(offEta, offPhi, probe->eta(), probe->phi()); - m_provider->msg(MSG::DEBUG) << "OFFLINE PROBE [ pt = " << offPt << " eta = " << offEta - << " phi = " << offPhi << " ]" << endmsg; - if(deltar < tempP && offPt > ptCut) { - tempP = deltar; - detaP = offEta - probe->eta(); - dphiP = AnalysisConfig_Jpsi::deltaPhi(offPhi, probe->phi()); - closestProbe = m_isMuon? offlineInDet[i] : offTightElecs[i]->trackParticle(); - etP = offPt; // cluster mass always zero, so I guess ET = pT in this case? - } - - if(!m_isMuon) { - offEta = offTightElecs[i]->eta(); - offPhi = offTightElecs[i]->phi(); - offPt = offTightElecs[i]->pt(); - } - deltar = AnalysisConfig_Jpsi::deltaR(offEta, offPhi, tag->eta(), tag->phi()); - m_provider->msg(MSG::DEBUG) << "OFFLINE TAG [ pt = " << offPt << " eta = " << offEta - << " phi = " << offPhi << " ]" << endmsg; - //cout << deltar << endl; - if(deltar < tempT && offPt > tagPtCut) { - tempT = deltar; - closestTag = m_isMuon? offlineInDet[i] : offTightElecs[i]->trackParticle(); - } - } - - if(closestProbe) { - const Trk::TrackSummary *summary = closestProbe->trackSummary(); - int nBlayerHits = 2*summary->get(Trk::numberOfInnermostPixelLayerHits); - int nPixelHits = 2*summary->get(Trk::numberOfPixelHits); - int nSctHits = summary->get(Trk::numberOfSCTHits); - //int nStrawHits = summary->get(Trk::numberOfTRTHits); - //int nTrHits = summary->get(Trk::numberOfTRTHighThresholdHits); - - if(tempP < 0.15 && nBlayerHits > 0 && nPixelHits > 1 && nSctHits > 5) { - offlineProbes[j] = closestProbe; - pOffDr[j] = tempP; - pOffDeta[j] = detaP; - pOffDphi[j] = dphiP; - pOffCharge[j] = closestProbe->charge(); - pOffEt[j] = etP; - } - } - if(closestTag) { - const Trk::TrackSummary *summary = closestTag->trackSummary(); - int nBlayerHits = 2*summary->get(Trk::numberOfInnermostPixelLayerHits); - int nPixelHits = 2*summary->get(Trk::numberOfPixelHits); - int nSctHits = summary->get(Trk::numberOfSCTHits); - //int nStrawHits = summary->get(Trk::numberOfTRTHits); - //int nTrHits = summary->get(Trk::numberOfTRTHighThresholdHits); - - if(tempT < 0.15 && nBlayerHits > 0 && nPixelHits > 1 && nSctHits > 5) { - offlineTags[j] = closestTag; - tOffDr[j] = tempT; - tOffCharge[j] = closestTag->charge(); - } - } - } - - m_provider->msg(MSG::DEBUG) << "Set probes and tags for m_analysisJ..." << endmsg; - m_analysisJ->setProbeOfflineDr(pOffDr); - m_analysisJ->setProbeOfflineEt(pOffEt); - m_analysisJ->setProbeOfflineDEta(pOffDeta); - m_analysisJ->setProbeOfflineDPhi(pOffDphi); - m_analysisJ->setProbeOfflineCharge(pOffCharge); - m_analysisJ->setTagOfflineDr(tOffDr); - m_analysisJ->setTagOfflineCharge(tOffCharge); - m_analysisJ->setOfflineProbes(offlineProbes); - m_analysisJ->setOfflineTags(offlineTags); - - // Fill vector of test tracks from the TDT feature - vector<int> sizes; - m_provider->msg(MSG::DEBUG) << "Start to select tracks with " << m_testChainKey << " / " << m_refChainName << endmsg; - bool check = m_testChainKey.find("IDSCAN") != string::npos; - check |= m_testChainKey.find("SegmentFinder") != string::npos; - check |= m_testChainKey.find("SiTrack_") != string::npos; - check |= m_testChainKey.find("SegFinder") != string::npos; - if(check) selectTracks<TrigInDetTrackCollection>(m_testChainKey, 0, m_refChainName); - - if(m_testChainKey.find("SiTrackFinder") != string::npos) { - if(m_isMuon) { - if(m_refChainName.find("_mu20") != string::npos) { - selectTracks<TrigInDetTrackCollection>("TrigSiTrack_Muon", 0, m_refChainName); - } - else if(m_testChainKey.find("MuonA") != string::npos) { - selectTracks<TrigInDetTrackCollection>("TrigL2SiTrackFinder_Muon", 0, m_refChainName); - } - else if(m_testChainKey.find("MuonB") != string::npos) { - selectTracks<TrigInDetTrackCollection>("TrigL2SiTrackFinder_Muon", 1, m_refChainName); - } - else if(m_testChainKey.find("MuonC") != string::npos) { - selectTracks<TrigInDetTrackCollection>("TrigL2SiTrackFinder_Muon", 2, m_refChainName); - } - } - else { - if(m_testChainKey.find("eGammaA") != string::npos) { - selectTracks<TrigInDetTrackCollection>("TrigL2SiTrackFinder_eGamma", 0, m_refChainName); - } - else if(m_testChainKey.find("eGammaB") != string::npos) { - selectTracks<TrigInDetTrackCollection>("TrigL2SiTrackFinder_eGamma", 1, m_refChainName); - } - else if(m_testChainKey.find("eGammaC") != string::npos) { - selectTracks<TrigInDetTrackCollection>("TrigL2SiTrackFinder_eGamma", 2, m_refChainName); - } - } - } - - if(m_testChainKey.find("InDetTrig") != string::npos) { - selectTracks0<Rec::TrackParticleContainer>(m_testChainKey, 0, m_refChainName); - } - - //const vector<Track*> &testtracksA = m_selectorTestA->tracks(); - const vector<TIDA::Track*> testtracksA = m_trigTracks; - sizes.push_back(testtracksA.size()); - - m_provider->msg(MSG::DEBUG) << "... done. Ntracks = " << testtracksA.size() << " ( " << m_testChainKey << " / " << m_refChainName << " )" << endmsg; - - m_analysisJ->setTIDARois(m_trackRois); - //m_analysisJ->setEtaAtCalo(m_etaAtCalo); - //m_analysisJ->setPhiAtCalo(m_phiAtCalo); - - if(m_associator) m_associatorJ = dynamic_cast<Associator_BestDeltaRMatcher*>(m_associator); - - //match the 2 sets of tracks ... this is no longer necessary, since we match by mass confirmation - //m_associatorJ->match(probeTracks, testtracks); - m_analysis->setBeamRef(xbeam, ybeam); - m_analysis->setBeamTest(xbeam, ybeam); - - m_analysisJ->setVertices(vertices); - m_analysisJ->setCase(m_isMuon, m_isJpsi); - - m_analysis->execute(probeTracks, testtracksA, m_associator); - - m_provider->msg(MSG::DEBUG) << "Final clean up ..." << endmsg; - for(vector<TIDA::Vertex*>::const_iterator it = vertices.begin(); it != vertices.end(); it++) delete (*it); - m_analysisJ->clearOffline(); - // m_analysisJ->clearSuper(); - //m_selectorTestB->clear(); - - m_provider->msg(MSG::DEBUG) << "END EVENT." << endmsg; - }//end of complete result condition - }//end of trigger condition -} - -/// setup the analysis the analysis, retrieve the tools etc - -void AnalysisConfig_Jpsi::book() { - - m_events = m_count_before = m_count_after = 0; - - m_isJpsi = (m_refChainName.find("Zmumu") == string::npos); - m_isJpsi &= (m_refChainName.find("mu24i") == string::npos); - m_isJpsi &= (m_refChainName.find("mu20") == string::npos); - m_isJpsi &= m_refChainName.find("Zee") == string::npos; - - m_isMuon = (m_refChainName.find("mu") != string::npos); - m_trigDefs = m_isMuon? TrigDefs::alsoDeactivateTEs : TrigDefs::Physics; - //m_trigDefs = TrigDefs::Physics; - - //get combined muons - m_muonCollection = "MuidMuonCollection"; - m_checkrate = 1000; - m_etacut = 2.5; - m_tagetacut = 2.5; - m_muonMass = m_isMuon? 105.66*CLHEP::MeV : 0.511*CLHEP::MeV; - m_TagAndProbe = true; - m_useTrigger = false; - m_runOnline = true; - -/* MEEEEH m_RCAL = 1470.0E+3; - m_ZCAL = 3800.0E+3;*/ - - if(m_isJpsi){ - m_jpsiPDGmass = 3.097*CLHEP::GeV; - m_jpsiwidth = 2.*CLHEP::GeV; - m_ptcut = 4.0*CLHEP::GeV; - m_tagptcut = (m_isMuon? 4.0 : 5.0) * CLHEP::GeV; - //m_plusMass = 1.203*GeV; - //m_plusMass = 0.603*GeV; - //m_minusMass = 0.597*GeV; - m_plusMass = (m_isMuon? 0.303 : 2.903) * CLHEP::GeV; - m_minusMass = (m_isMuon? 0.597 : 2.097) * CLHEP::GeV; - } - else { - m_jpsiPDGmass = 90.097*CLHEP::GeV; - m_jpsiwidth = 2.*CLHEP::GeV; - m_ptcut = 15.0*CLHEP::GeV; - m_tagptcut = 24.0*CLHEP::GeV; - //m_plusMass = 19.903*CLHEP::GeV; // 110 GeV - m_plusMass = 309.903*CLHEP::GeV; // 400 GeV - //m_minusMass = 20.097*CLHEP::GeV; // 70 GeV - m_minusMass = 55.097*CLHEP::GeV; // 35 GeV - } - - ///temp - - if(m_toolSvc.retrieve().isFailure()) m_provider->msg(MSG::FATAL) << "Failed to retrieve service " << m_toolSvc << endmsg; - else m_provider->msg(MSG::INFO) << "Retrieved service " << m_toolSvc << endmsg; - - // get the beam condition services - if(m_iBeamCondSvc.retrieve().isFailure()) m_provider->msg(MSG::ERROR) << " failed to retrieve BeamCondSvc " << endmsg; - else m_provider->msg(MSG::INFO) << " retrieved BeamCondSvc " << endmsg; - - /*m_iOnlineBeamCondSvc = 0; - if ( m_provider->service( "InDetBeamSpotOnline", m_iOnlineBeamCondSvc ).isFailure() ) { - m_provider->msg(MSG::ERROR) << " failed to retrieve Online BeamCondSvc" << endmsg; - } - else { - m_provider->msg(MSG::INFO) << " retrieved OnlineBeamCondSvc " << endmsg; - }*/ - - // get the TriggerDecisionTool - - if(m_tdt->retrieve().isFailure()) { - m_provider->msg(MSG::ERROR) << "Unable to retrieve the TrigDecisionTool: Please check job options file" << endmsg; - //return StatusCode::FAILURE; - } - - if(m_isMuon){ - if(m_testChainKey.find("SiTrackFinder") != string::npos){ - if(m_testChainKey.find("eGammaA") != string::npos) m_testChainKey = "TrigL2SiTrackFinder_MuonA"; - if(m_testChainKey.find("eGammaB") != string::npos) m_testChainKey = "TrigL2SiTrackFinder_MuonB"; - if(m_testChainKey.find("eGammaC") != string::npos) m_testChainKey = "TrigL2SiTrackFinder_MuonC"; - } - if(m_testChainKey.find("InDetTrig") != string::npos) { - if(m_testChainKey.find("Electron") != string::npos) m_testChainKey = "InDetTrigParticleCreation_Muon_EFID"; - } - } - -#ifdef ManagedMonitorToolBase_Uses_API_201401 - m_provider->addMonGroup( new ManagedMonitorToolBase::MonGroup( m_provider, - "HLT/IDJpsiMon/" + m_analysis->name() + "/" + m_testChainKey, - ManagedMonitorToolBase::run ) ); - // ManagedMonitorToolBase::shift, ManagedMonitorToolBase::run ) ); -#else - m_provider->addMonGroup( new ManagedMonitorToolBase::MonGroup( m_provider, - "HLT/IDJpsiMon/" + m_analysis->name() + "/" + m_testChainKey, - ManagedMonitorToolBase::shift, ManagedMonitorToolBase::run ) ); -#endif - - m_analysis->initialise(); - - m_analysisJ = dynamic_cast<JpsiAnalysis*> (m_analysis); - - m_analysisJ->setChainName(m_refChainName); - m_analysisJ->setPlusMass(m_plusMass); - m_analysisJ->setMinusMass(m_minusMass); - - map<string, TH1F*>::const_iterator hitr = m_analysisJ->THbegin(); - map<string, TH1F*>::const_iterator hend = m_analysisJ->THend(); - - while ( hitr!=hend ) { - m_provider->addHistogram( hitr->second,"HLT/IDJpsiMon/" + m_analysis->name() + "/" + m_testChainKey ); - hitr++; - } - - map<string, TProfile*>::const_iterator tphitr = m_analysisJ->TPbegin(); - map<string, TProfile*>::const_iterator tphend = m_analysisJ->TPend(); - - while(tphitr != tphend) { - m_provider->addHistogram( tphitr->second,"HLT/IDJpsiMon/" + m_analysis->name() + "/" + m_testChainKey ); - tphitr++; - } - - map<string, TH2F*>::const_iterator hitr2d = m_analysisJ->TH2begin(); - map<string, TH2F*>::const_iterator hend2d = m_analysisJ->TH2end(); - - while(hitr2d != hend2d) { - m_provider->addHistogram(hitr2d->second,"HLT/IDJpsiMon/" + m_analysis->name() + "/" + m_testChainKey); - hitr2d++; - } - - ///temp - m_analysisJ->setSpeaker(m_provider); - m_analysisJ->setTool(m_tdt); - -} - -/// finalise the analysis - take ratios for efficiencies etc -void AnalysisConfig_Jpsi::finalize() { - cout << ">>> trigger: " << m_refChainName << std::endl; - cout << ">>> before trigger: " << m_count_before << std::endl; - cout << ">>> after trigger : " << m_count_after << std::endl; - m_analysis->finalise(); -} - -// ########################################################################### - -float AnalysisConfig_Jpsi::deltaR(float eta1, float phi1, float eta2, float phi2) { - float deta = eta1-eta2; - float dphi = deltaPhi(phi1,phi2); - return TMath::Sqrt(deta*deta+dphi*dphi); -} - -// ########################################################################### - -float AnalysisConfig_Jpsi::deltaPhi(float phi1, float phi2) { - if(TMath::IsNaN(phi1)||TMath::IsNaN(phi2)) { - cout << "> > > > > WTF!? deltaPhi(phi1,phi2) called with NaN" << endl; - } - return fixPhi(phi1-phi2); -} - -// ########################################################################### - -float AnalysisConfig_Jpsi::fixPhi(float phi) { - while(phi >= M_PI) phi -= 2.0*M_PI; - while(phi < -M_PI) phi += 2.0*M_PI; - return phi; -} - -// ########################################################################### - diff --git a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/src/JpsiAnalysis.cxx b/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/src/JpsiAnalysis.cxx deleted file mode 100644 index 7e52519a880bf249a48a076eb32133619d3fb14b..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/src/JpsiAnalysis.cxx +++ /dev/null @@ -1,1313 +0,0 @@ -// emacs: this is -*- c++ -*- - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** @file JpsiAnalysis.cxx */ -/** @author Mark Sutton (sutt@cern.ch) **/ -/** @author Peter Wijeratne (paw@hep.ucl.ac.uk) **/ -/** @author Christian Gutschow (chris.g@cern.ch) **/ - -#include "TrigInDetAnalysis/TIDAVertex.h" - -#include "TrigIDJpsiMonitoring/JpsiAnalysis.h" -#include "TrigIDJpsiMonitoring/JpsiTrack.h" -#include "AthenaKernel/Units.h" - -#include "TLorentzVector.h" - -#include <stdexcept> - -using std::fabs; -using std::sqrt; -using std::pow; -using std::string; -using std::cout; -using std::endl; -using std::vector; -using Athena::Units::GeV; - -//#include "Particle/TrackParticle.h" - - -void JpsiAnalysis::initialise() { - - //+++ pT ranges - float tmp_absResPt = 0.0005; - - const int pTResBins = 100; - - //+++ Eta ranges - float tmp_maxEta = 3.5; - float tmp_absResEta = 0.1; // 0.00025; - float absResEta2D = 2.0; - - //+++ Phi ranges - float tmp_maxPhi = 3.5; - float tmp_absResPhi = 0.1; // 0.00025; - float absResPhi2D = 3.2; - - float tmp_absResR = 0.1; - const int rResBins = 500; - - const int etaBins = 60; - const int etaResBins = 800; - const int etaResBins2D = 800; - - const int phiBins = 36; - const int phiResBins = 800; - const int phiResBins2D = 640; - - const int zBins = 100; - const float zMax = 400; - - const int zresBins = 110; - const float zresMax = 10; - - const int d0Bins = 1000; - const float d0Max = 10; - - const int d0resBins = 110; - const float d0resMax = 5; - - // beamspot corrected position - - const int a0Bins = 1000; - const float a0Max = 10; - - const int a0resBins = 110; - const float a0resMax = 5; - - //+++ Book histograms - - // calculate a logarithmic binning in pt - /* const int ptnbins = 500; - float ptbinlims[ptnbins+1]; - for ( int i=0 ; i<=ptnbins ; i++ ) { ptbinlims[i] = pow(10, 2.0*i/ptnbins+2); }*/ - - int pTbins = 50; - float pTmax = 50.; - float pTmin = 0.; - int invmBins = 50; - float invmMax = 5.; - float invmMin = 0.; - bool isZ = m_chainName.find("Z") != string::npos; - isZ |= m_chainName.find("mu24i") != string::npos; - isZ |= m_chainName.find("mu20") != string::npos; - if(isZ) { - pTbins = 150; - pTmax = 150.; - invmBins = 400; - invmMax = 110.; - invmMin = 70.; - } - - // COUNTERS - addHistogram( new TH1F( "trigger_after", "after trigger", 1, 0.0, 1.0 ) ); - addHistogram( new TH1F( "cutflow", "cutflow", 7, -0.5, 6.5 ) ); - addHistogram( new TH1F( "cutflow_tight", "cutflow tight", 7, -0.5, 6.5 ) ); - - // "reference" quantities - addHistogram( new TH1F( "pT", "pT", pTbins, -pTmin, pTmax ) ); - addHistogram( new TH1F( "eta", "eta", etaBins, -tmp_maxEta, tmp_maxEta ) ); - addHistogram( new TH1F( "phi", "phi", phiBins, -tmp_maxPhi, tmp_maxPhi ) ); - addHistogram( new TH1F( "z0", "z0", zBins, -zMax, zMax ) ); - addHistogram( new TH1F( "d0", "d0", d0Bins, -d0Max, d0Max ) ); - addHistogram( new TH1F( "a0", "a0", a0Bins, -a0Max, a0Max ) ); - - // "test" quantities - addHistogram( new TH1F( "pT_rec", "pT_rec", pTbins, -pTmin, pTmax ) ); - addHistogram( new TH1F( "eta_rec", "eta_rec", etaBins, -tmp_maxEta, tmp_maxEta ) ); - addHistogram( new TH1F( "phi_rec", "phi_rec", phiBins, -tmp_maxPhi, tmp_maxPhi ) ); - addHistogram( new TH1F( "z0_rec", "z0_rec", zBins, -zMax, zMax ) ); - addHistogram( new TH1F( "d0_rec", "d0_rec", d0Bins, -d0Max, d0Max ) ); - addHistogram( new TH1F( "a0_rec", "a0_rec", a0Bins, -a0Max, a0Max ) ); - - // ID track quantities - addHistogram( new TH1F( "pT_track", "pT_track", pTbins, -pTmin, pTmax ) ); - addHistogram( new TH1F( "eta_track", "eta_track", etaBins, -tmp_maxEta, tmp_maxEta ) ); - addHistogram( new TH1F( "phi_track", "phi_track", phiBins, -tmp_maxPhi, tmp_maxPhi ) ); - // with back-to-back requirement (in dPhi between tag and probe) - addHistogram( new TH1F( "pT_track_b2b", "pT_track", pTbins, -pTmin, pTmax ) ); - addHistogram( new TH1F( "eta_track_b2b", "eta_track", etaBins, -tmp_maxEta, tmp_maxEta ) ); - addHistogram( new TH1F( "phi_track_b2b", "phi_track", phiBins, -tmp_maxPhi, tmp_maxPhi ) ); - // offline track quantities - addHistogram( new TH1F( "pT_offtrack", "pT_track", pTbins, -pTmin, pTmax ) ); - addHistogram( new TH1F( "eta_offtrack", "eta_track", etaBins, -tmp_maxEta, tmp_maxEta ) ); - addHistogram( new TH1F( "phi_offtrack", "phi_track", phiBins, -tmp_maxPhi, tmp_maxPhi ) ); - // offline track quantities (with pT/ET cut) - addHistogram( new TH1F( "pT_offtrackEt", "pT_track", pTbins, -pTmin, pTmax ) ); - addHistogram( new TH1F( "eta_offtrackEt", "eta_track", etaBins, -tmp_maxEta, tmp_maxEta ) ); - addHistogram( new TH1F( "phi_offtrackEt", "phi_track", phiBins, -tmp_maxPhi, tmp_maxPhi ) ); - // offline track quantities (with brem cut) - addHistogram( new TH1F( "pT_offtrackbrem", "pT_track", pTbins, -pTmin, pTmax ) ); - addHistogram( new TH1F( "eta_offtrackbrem", "eta_track", etaBins, -tmp_maxEta, tmp_maxEta ) ); - addHistogram( new TH1F( "phi_offtrackbrem", "phi_track", phiBins, -tmp_maxPhi, tmp_maxPhi ) ); - - // resolutions - addHistogram( new TH1F("pT_res", "pT_res", pTResBins, -tmp_absResPt, tmp_absResPt ) ); - addHistogram( new TH1F("eta_res", "eta_res", etaResBins, -tmp_absResEta, tmp_absResEta) ); - addHistogram( new TH1F("phi_res", "phi_res", phiResBins, -tmp_absResPhi, tmp_absResPhi) ); - addHistogram( new TH1F("z0_res", "z0_res", zresBins, -zresMax, zresMax ) ); - addHistogram( new TH1F("d0_res", "d0_res", d0resBins, -0.5*d0resMax, 0.5*d0resMax ) ); - addHistogram( new TH1F("a0_res", "a0_res", a0resBins, -0.5*a0resMax, 0.5*a0resMax ) ); - addHistogram( new TH1F("etaOff_res", "etaOres", etaResBins, -tmp_absResEta, tmp_absResEta) ); - addHistogram( new TH1F("phiOff_res", "phiOres", phiResBins, -tmp_absResPhi, tmp_absResPhi) ); - addHistogram( new TH1F("rOff_res", "rOff_res",rResBins, 0.0, tmp_absResR ) ); - addHistogram( new TH1F("minDr_res", "rOff_res",rResBins, 0.0, tmp_absResR ) ); - - /// delta-r between probe and its matched offline track - addHistogram( new TH1F("probe_off_dr", "probe_off_dr", 300, 0., 0.3) ); - addHistogram( new TH1F("probe_off_deta", "probe_off_deta", etaResBins, -tmp_absResEta, tmp_absResEta) ); - addHistogram( new TH1F("probe_off_dphi", "probe_off_dphi", phiResBins, -tmp_absResPhi, tmp_absResPhi) ); - - addHistogram( new TH1F("dphi_tp", "dPhi between tag and probe", 200, -1., 1.) ); - - addHistogram( new TH2F("asymEta", "asymEta", etaResBins2D, -absResEta2D, absResEta2D, etaResBins2D, -absResEta2D, absResEta2D ) ); - addHistogram( new TH2F("asymPhi", "asymPhi", phiResBins2D, -absResPhi2D, absResPhi2D, phiResBins2D, -absResPhi2D, absResPhi2D ) ); - - // # tracks - int Ntracks = 50; - - addHistogram( new TH1F( "ntracks", "ntracks", (Ntracks-40), -0.5, float(Ntracks-39.5) ) ); - addHistogram( new TH1F( "ntracks_rec", "ntracks_rec", Ntracks, -0.5, float(Ntracks+0.5) ) ); - - //hit occupancies (muon system) - addHistogram( new TH1F( "nRpcHitsEta", "nRpcHitsEta", 21, -0.5, 20.5 ) ); - addHistogram( new TH1F( "nTgcHitsEta", "nTgcHitsEta", 21, -0.5, 20.5 ) ); - addHistogram( new TH1F( "nCscHitsEta", "nCscHitsEta", 21, -0.5, 20.5 ) ); - addHistogram( new TH1F( "nRpcHitsPhi", "nRpcHitsPhi", 21, -0.5, 20.5 ) ); - addHistogram( new TH1F( "nTgcHitsPhi", "nTgcHitsPhi", 21, -0.5, 20.5 ) ); - addHistogram( new TH1F( "nCscHitsPhi", "nCscHitsPhi", 21, -0.5, 20.5 ) ); - addHistogram( new TH1F( "nMdtHits", "nMdtHits", 51, -0.5, 50.5 ) ); - - addHistogram( new TH1F("tagMatch_invmass","All tag&probe candidates;Invariant mass [GeV]", invmBins, invmMin, invmMax) ); - addHistogram( new TH1F("tagAndProbe_invmass","All tag&probe candidates;Invariant mass [GeV]", invmBins, invmMin, invmMax) ); - addHistogram( new TH1F("tagAndProbe_invmass_wo_match","Tag&probe candidates wo match;Invariant mass [GeV]", invmBins, invmMin, invmMax) ); - addHistogram( new TH1F("tagAndProbe_invmass_offline","Tag&probe candidates (with offline electron);Invariant mass [GeV]", invmBins, invmMin, invmMax) ); - addHistogram( new TH1F( "Zpt", "dilepton pt", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F( "pTmiss", "pTmiss", pTbins, pTmin, pTmax ) ); - m_pT_eff = new TProfile("pT_eff", "Efficiency versus pT; pT [MeV]", pTbins, pTmin, pTmax, 0., 110.); - m_pT_eff_d0cut = new TProfile("pT_eff_d0cut", "Efficiency versus pT; pT [MeV]", pTbins, pTmin, pTmax, 0., 110.); - m_invmass_eff = new TProfile("invmass_eff", "Efficiency versus Invariant Mass; Invariant Mass [GeV]", invmBins, invmMin, invmMax, 0., 110.); - m_invmass_eff_d0cut = new TProfile("invmass_eff_d0cut", "Efficiency versus Invariant Mass; Invariant Mass [GeV]", invmBins, invmMin, invmMax, 0., 110.); - m_pT_eff_offline = new TProfile("pT_eff_offline", "Efficiency versus pT; pT [MeV]", pTbins, pTmin, pTmax, 0., 110.); - m_pT_eff_d0cut_offline = new TProfile("pT_eff_d0cut_offline", "Efficiency versus pT; pT [MeV]", pTbins, pTmin, pTmax, 0., 110.); - m_invmass_eff_offline = new TProfile("invmass_eff_offline", "Efficiency versus Invariant Mass; Invariant Mass [GeV]", invmBins, invmMin, invmMax, 0., 110.); - m_invmass_eff_d0cut_offline = new TProfile("invmass_eff_d0cut_offline", "Efficiency versus Invariant Mass; Invariant Mass [GeV]", invmBins, invmMin, invmMax, 0., 110.); - - m_eta_eff = new TProfile("eta_eff", "Efficiency versus #eta; #eta", 32, -4., 4., 0., 110.); - m_vert_eff = new TProfile("vert_eff", "Efficiency versus nVertices; nvertices", 36, -0.5, 35.5, 0., 110.); - m_z0_eff = new TProfile("z0_eff", "Efficiency versus z0; z0[mm]", 20, 0., 200., 0., 110.); - m_d0_eff = new TProfile("d0_eff", "Efficiency versus d0; d0[mm]", d0Bins, -d0Max, d0Max, 0., 110.); - m_phi_eff = new TProfile("phi_eff", "Efficiency versus #phi; #phi[rads]", 20., -4., 4., 0., 110.); - m_track_eff = new TProfile("track_eff", "Efficiency versus nTracks; ntracks", 80., 0., 800., 0., 110.); - - m_eta_eff_d0cut = new TProfile("eta_eff_d0cut", "Efficiency versus #eta; #eta", 32, -4., 4., 0., 110.); - m_vert_eff_d0cut = new TProfile("vert_eff_d0cut", "Efficiency versus nVertices; nvertices", 36, -0.5, 35.5, 0., 110.); - m_z0_eff_d0cut = new TProfile("z0_eff_d0cut", "Efficiency versus z0; z0[mm]", 20, 0., 200., 0., 110.); - m_d0_eff_d0cut = new TProfile("d0_eff_d0cut", "Efficiency versus d0; d0[mm]", d0Bins, -d0Max, d0Max, 0., 110.); - m_phi_eff_d0cut = new TProfile("phi_eff_d0cut", "Efficiency versus #phi; #phi[rads]", 20., -4., 4., 0., 110.); - m_track_eff_d0cut = new TProfile("track_eff_d0cut", "Efficiency versus nTracks; ntracks", 80., 0., 800., 0., 110.); - - m_eta_eff_offline = new TProfile("eta_eff_offline", "Efficiency versus #eta; #eta", 32, -4., 4., 0., 110.); - m_vert_eff_offline = new TProfile("vert_eff_offline", "Efficiency versus nVertices; nvertices", 36, -0.5, 35.5, 0., 110.); - m_z0_eff_offline = new TProfile("z0_eff_offline", "Efficiency versus z0; z0[mm]", 20, 0., 200., 0., 110.); - m_d0_eff_offline = new TProfile("d0_eff_offline", "Efficiency versus d0; d0[mm]", d0Bins, -d0Max, d0Max, 0., 110.); - m_phi_eff_offline = new TProfile("phi_eff_offline", "Efficiency versus #phi; #phi[rads]", 20., -4., 4., 0., 110.); - m_track_eff_offline = new TProfile("track_eff_offline", "Efficiency versus nTracks; ntracks", 80., 0., 800., 0., 110.); - - m_eta_eff_d0cut_offline = new TProfile("eta_eff_d0cut_offline", "Efficiency versus #eta; #eta", 32, -4., 4., 0., 110.); - m_vert_eff_d0cut_offline = new TProfile("vert_eff_d0cut_offline", "Efficiency versus nVertices; nvertices", 36, -0.5, 35.5, 0., 110.); - m_z0_eff_d0cut_offline = new TProfile("z0_eff_d0cut_offline", "Efficiency versus z0; z0[mm]", 20, 0., 200., 0., 110.); - m_d0_eff_d0cut_offline = new TProfile("d0_eff_d0cut_offline", "Efficiency versus d0; d0[mm]", d0Bins, -d0Max, d0Max, 0., 110.); - m_phi_eff_d0cut_offline = new TProfile("phi_eff_d0cut_offline", "Efficiency versus #phi; #phi[rads]", 20., -4., 4., 0., 110.); - m_track_eff_d0cut_offline = new TProfile("track_eff_d0cut_offline", "Efficiency versus nTracks; ntracks", 40., 0., 400., 0., 110.); - - /* m_pT_pur = new TProfile("pT_pur", "Purity versus pT; pT [MeV]", 100, 0., 100000., 0., 110.); - m_eta_pur = new TProfile("eta_pur", "Purity versus #eta; #eta", 20, -4., 4., 0., 110.); - m_z0_pur = new TProfile("z0_pur", "Purity versus z0; z0[mm]", 20, 0., 200., 0., 110.); - m_d0_pur = new TProfile("d0_pur", "Purity versus d0; d0[mm]", 20, 0., 50., 0., 110.); - m_phi_pur = new TProfile("phi_pur", "Purity versus #phi; #phi[rads]", 20., -4., 4., 0., 110.);*/ - - /* addHistogram( m_pT_pur ); - addHistogram( m_eta_pur ); - addHistogram( m_z0_pur ); - addHistogram( m_d0_pur); - addHistogram( m_phi_pur );*/ - - addHistogram( m_pT_eff ); - addHistogram( m_eta_eff ); - addHistogram( m_vert_eff ); - addHistogram( m_z0_eff ); - addHistogram( m_d0_eff); - addHistogram( m_phi_eff ); - addHistogram( m_track_eff ); - addHistogram( m_invmass_eff ); - - /// |d0| > 1mm cut, to study delayed decays - addHistogram( m_pT_eff_d0cut ); - addHistogram( m_eta_eff_d0cut ); - addHistogram( m_vert_eff_d0cut ); - addHistogram( m_z0_eff_d0cut ); - addHistogram( m_d0_eff_d0cut); - addHistogram( m_phi_eff_d0cut ); - addHistogram( m_track_eff_d0cut ); - addHistogram( m_invmass_eff_d0cut ); - - addHistogram( m_pT_eff_offline ); - addHistogram( m_eta_eff_offline ); - addHistogram( m_vert_eff_offline ); - addHistogram( m_z0_eff_offline ); - addHistogram( m_d0_eff_offline); - addHistogram( m_phi_eff_offline ); - addHistogram( m_track_eff_offline ); - addHistogram( m_invmass_eff_offline ); - - /// |d0| > 1mm cut, to study delayed decays - addHistogram( m_pT_eff_d0cut_offline ); - addHistogram( m_eta_eff_d0cut_offline ); - addHistogram( m_vert_eff_d0cut_offline ); - addHistogram( m_z0_eff_d0cut_offline ); - addHistogram( m_d0_eff_d0cut_offline); - addHistogram( m_phi_eff_d0cut_offline ); - addHistogram( m_track_eff_d0cut_offline ); - addHistogram( m_invmass_eff_d0cut_offline ); - - /// - addHistogram( new TH1F("tag_offline_invmass", "tag_offline_invmass", invmBins, invmMin, invmMax) ); - addHistogram( new TH2F("tomass_vs_offpt", "tomass_vs_offpt", pTbins, pTmin, pTmax, 50, invmMin, invmMax) ); - - /// towards asymmetric errors... - - const int nTrksBins = 250; - const float nTrksMax = 1000; - const int nVtxsBins = 41; - const float nVtxsMax = 40.5; - const int muBins = 1000; - const float muMax = 100.5; - - //standard plots - addHistogram( new TH1F("invmass_tt","invmass_tt", 500, 0., 500.) ); - addHistogram( new TH1F("invmassnum","invmassnum",invmBins, invmMin, invmMax) ); - addHistogram( new TH1F("invmassden","invmassden",invmBins, invmMin, invmMax) ); - addHistogram( new TH1F("ETnum", "ETnum", 200, 0., 1.) ); - addHistogram( new TH1F("ETden", "ETden", 200, 0., 1.) ); - addHistogram( new TH1F("pTnum", "pTnum", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTden", "pTden", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTEtnum", "pTnum", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTEtden", "pTden", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTbremnum", "pTnum", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTbremden", "pTden", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTb2bnum", "pTnum", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTb2bden", "pTden", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTb2bloosenum", "pTnum", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTb2blooseden", "pTden", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("d0num", "d0num", d0Bins, -d0Max, d0Max ) ); - addHistogram( new TH1F("d0den", "d0den", d0Bins, -d0Max, d0Max ) ); - addHistogram( new TH1F("z0num", "z0num", zBins, -zMax, zMax) ); - addHistogram( new TH1F("z0den", "z0den", zBins, -zMax, zMax) ); - addHistogram( new TH1F("absd0num", "absd0num", d0Bins/2, 0, d0Max ) ); - addHistogram( new TH1F("absd0den", "absd0den", d0Bins/2, 0, d0Max ) ); - addHistogram( new TH1F("absz0num", "absz0num", zBins/2, 0, zMax) ); - addHistogram( new TH1F("absz0den", "absz0den", zBins/2, 0, zMax) ); - addHistogram( new TH1F("phinum", "phinum", 20., -4., 4.) ); - addHistogram( new TH1F("phiden", "phiden", 20., -4., 4.) ); - addHistogram( new TH1F("etanum", "etanum", 32, -4., 4.) ); - addHistogram( new TH1F("etaden", "etaden", 32, -4., 4.) ); - addHistogram( new TH1F("etaEtnum", "etanum", 32, -4., 4.) ); - addHistogram( new TH1F("etaEtden", "etaden", 32, -4., 4.) ); - addHistogram( new TH1F("etabremnum", "etanum", 32, -4., 4.) ); - addHistogram( new TH1F("etabremden", "etaden", 32, -4., 4.) ); - addHistogram( new TH1F("etab2bnum", "etanum", 32, -4., 4.) ); - addHistogram( new TH1F("etab2bden", "etaden", 32, -4., 4.) ); - addHistogram( new TH1F("etab2bloosenum", "etanum", 32, -4., 4.) ); - addHistogram( new TH1F("etab2blooseden", "etaden", 32, -4., 4.) ); - addHistogram( new TH1F("vertnum", "vertnum", nVtxsBins, -0.5, nVtxsMax) ); - addHistogram( new TH1F("vertden", "vertden", nVtxsBins, -0.5, nVtxsMax) ); - addHistogram( new TH1F("tracknum", "tracknum", nTrksBins, 0., nTrksMax) ); - addHistogram( new TH1F("trackden", "trackden", nTrksBins, 0., nTrksMax) ); - addHistogram( new TH1F("munum", "munum", muBins, -0.5, muMax) ); - addHistogram( new TH1F("muden", "muden", muBins, -0.5, muMax) ); - addHistogram( new TH1F("mub2bnum", "munum", muBins, -0.5, muMax) ); - addHistogram( new TH1F("mub2bden", "muden", muBins, -0.5, muMax) ); - addHistogram( new TH1F("mub2bloosenum", "munum", muBins, -0.5, muMax) ); - addHistogram( new TH1F("mub2blooseden", "muden", muBins, -0.5, muMax) ); - addHistogram( new TH1F("drnum", "drnum", 100., 0., 1.0) ); - addHistogram( new TH1F("drden", "drden", 100., 0., 1.0) ); - - //plots where an offline track is required to be matched to the probe - addHistogram( new TH1F("invmassnum_off","invmassnum_off",invmBins, invmMin, invmMax) ); - addHistogram( new TH1F("invmassden_off","invmassden_off",invmBins, invmMin, invmMax) ); - addHistogram( new TH1F("ETnum_off", "ETnum_off", 200, 0., 1.) ); - addHistogram( new TH1F("ETden_off", "ETden_off", 200, 0., 1.) ); - addHistogram( new TH1F("pTnum_off", "pTnum_off", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTden_off", "pTden_off", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTEtnum_off", "pTnum", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTEtden_off", "pTden", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTbremnum_off", "pTnum", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTbremden_off", "pTden", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTofftracknum_off", "pTnum_off", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTofftrackden_off", "pTden_off", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTofftrackEtnum_off", "pTnum", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTofftrackEtden_off", "pTden", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTofftrackbremnum_off", "pTnum", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTofftrackbremden_off", "pTden", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTb2bnum_off", "pTnum", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTb2bden_off", "pTden", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTb2bloosenum_off", "pTnum", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pTb2blooseden_off", "pTden", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("d0num_off", "d0num_off", d0Bins, -d0Max, d0Max ) ); - addHistogram( new TH1F("d0den_off", "d0den_off", d0Bins, -d0Max, d0Max ) ); - addHistogram( new TH1F("z0num_off", "z0num_off", zBins, -zMax, zMax) ); - addHistogram( new TH1F("z0den_off", "z0den_off", zBins, -zMax, zMax ) ); - addHistogram( new TH1F("absd0num_off", "absd0num_off", d0Bins/2, 0, d0Max ) ); - addHistogram( new TH1F("absd0den_off", "absd0den_off", d0Bins/2, 0, d0Max ) ); - addHistogram( new TH1F("absz0num_off", "absz0num_off", zBins/2, 0, zMax) ); - addHistogram( new TH1F("absz0den_off", "absz0den_off", zBins/2, 0, zMax) ); - addHistogram( new TH1F("etanum_off", "etanum_off", 32, -4., 4.) ); - addHistogram( new TH1F("etaden_off", "etaden_off", 32, -4., 4.) ); - addHistogram( new TH1F("etaEtnum_off", "etanum", 32, -4., 4.) ); - addHistogram( new TH1F("etaEtden_off", "etaden", 32, -4., 4.) ); - addHistogram( new TH1F("etabremnum_off", "etanum", 32, -4., 4.) ); - addHistogram( new TH1F("etabremden_off", "etaden", 32, -4., 4.) ); - addHistogram( new TH1F("etaofftracknum_off", "etanum_off", 32, -4., 4.) ); - addHistogram( new TH1F("etaofftrackden_off", "etaden_off", 32, -4., 4.) ); - addHistogram( new TH1F("etaofftrackEtnum_off", "etanum", 32, -4., 4.) ); - addHistogram( new TH1F("etaofftrackEtden_off", "etaden", 32, -4., 4.) ); - addHistogram( new TH1F("etaofftrackbremnum_off", "etanum", 32, -4., 4.) ); - addHistogram( new TH1F("etaofftrackbremden_off", "etaden", 32, -4., 4.) ); - addHistogram( new TH1F("etab2bnum_off", "etanum", 32, -4., 4.) ); - addHistogram( new TH1F("etab2bden_off", "etaden", 32, -4., 4.) ); - addHistogram( new TH1F("etab2bloosenum_off", "etanum", 32, -4., 4.) ); - addHistogram( new TH1F("etab2blooseden_off", "etaden", 32, -4., 4.) ); - addHistogram( new TH1F("phinum_off", "phinum_off", 20., -4., 4.) ); - addHistogram( new TH1F("phiden_off", "phiden_off", 20., -4., 4.) ); - addHistogram( new TH1F("vertnum_off", "vertnum_off", nVtxsBins, -0.5, nVtxsMax) ); - addHistogram( new TH1F("vertden_off", "vertden_off", nVtxsBins, -0.5, nVtxsMax) ); - addHistogram( new TH1F("tracknum_off", "tracknum_off", nTrksBins, 0., nTrksMax) ); - addHistogram( new TH1F("trackden_off", "trackden_off", nTrksBins, 0., nTrksMax) ); - addHistogram( new TH1F("munum_off", "munum_off", muBins, -0.5, muMax) ); - addHistogram( new TH1F("muden_off", "muden_off", muBins, -0.5, muMax) ); - addHistogram( new TH1F("mub2bnum_off", "munum_off", muBins, -0.5, muMax) ); - addHistogram( new TH1F("mub2bden_off", "muden_off", muBins, -0.5, muMax) ); - addHistogram( new TH1F("mub2bloosenum_off", "munum_off", muBins, -0.5, muMax) ); - addHistogram( new TH1F("mub2blooseden_off", "muden_off", muBins, -0.5, muMax) ); - addHistogram( new TH1F("drnum_off", "drnum_off", 100., 0., 1.0) ); - addHistogram( new TH1F("drden_off", "drden_off", 100., 0., 1.0) ); - - //plots where the offline track pT is used instead of the probe pT - addHistogram( new TH1F("pToffnum_off", "pToffnum_off", pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("pToffden_off", "pToffden_off", pTbins, pTmin, pTmax ) ); - - //plot of delta-r between tag and probe - addHistogram( new TH1F("deltarnum", "deltarnum", 400, 0., 5. ) ); - addHistogram( new TH1F("deltarden", "deltarden", 400, 0., 5. ) ); - addHistogram( new TH1F("deltarnum_lowpt", "deltarnum_lowpt", 400, 0., 5. ) ); - addHistogram( new TH1F("deltarden_lowpt", "deltarden_lowpt", 400, 0., 5. ) ); - - /// beamspot - addHistogram( new TH2F("beamspotxy", "beamspotxy", 50, -2., 2., 50, -2., 2.) ); - - ///tmp - if(m_chainName.find("Zmumu") != string::npos) { - invmMin = 0.; - } - addHistogram( new TH2F("invmass_vs_tinvmass", "invmass_vs_tinvmass", invmBins, invmMin, invmMax, invmBins, invmMin, invmMax) ); - - addHistogram( new TH1F("pToffnum_d0cut", "pToffnum_d0cut", pTbins, pTmin, pTmax) ); - addHistogram( new TH1F("pToffden_d0cut", "pToffden_d0cut", pTbins, pTmin, pTmax) ); - addHistogram( new TH1F("pTnum_d0cut", "pTnum_d0cut", pTbins, pTmin, pTmax) ); - addHistogram( new TH1F("pTden_d0cut", "pTden_d0cut", pTbins, pTmin, pTmax) ); - - ///tmp - addHistogram( new TH2F("invmass_vs_deltar", "invmass_vs_deltar", 400, 0., 5., invmBins, invmMin, invmMax) ); - addHistogram( new TH2F("pt_vs_deltar", "pt_vs_deltar", 400, 0., 5., pTbins, pTmin, pTmax ) ); - addHistogram( new TH2F("pt_vs_offpt", "pt_vs_offpt", pTbins, pTmin, pTmax, pTbins, pTmin, pTmax ) ); - addHistogram( new TH1F("tinvmass_miss", "tinvmass_miss", invmBins, invmMin, invmMax ) ); - -} - -void JpsiAnalysis::finalise() { } - -/*template<class T> -bool fillMap(std::map<std::string, T*> &m_histos, const std::string &name, float w) { - std::map<string, T*>::const_iterator hmitr = m_histos.find(name.c_string()); - if(hmitr != m_histos.end()) { - if(hmitr->second) { hmitr->second->Fill( w ); return true; } - - } - return false; -}*/ - - -void JpsiAnalysis::execute(const vector<TIDA::Track*>& probeTracks, - const vector<TIDA::Track*>& testtracks, - TrackAssociator* matcher=0) { - - m_speaker->msg(MSG::DEBUG) << "Start of JpsiAnalysis execute ..." << endmsg; - matcher = 0; - if(!matcher) m_speaker->msg(MSG::DEBUG) << "Matcher not used." << endmsg; - - // should have these as a class variable - static string varName[13] = { "pT", "eta", "phi", "z0", "d0", "a0", - "nRpcHitsEta", "nTgcHitsEta", "nCscHitsEta", - "nRpcHitsPhi", "nTgcHitsPhi", "nCscHitsPhi", "nMdtHits" }; - - std::map<string, TH1F*>::iterator hmitr = m_histos.find("ntracks"); - if(hmitr != m_histos.end()) hmitr->second->Fill(probeTracks.size()); - //fillMap(m_histos, "ntracks", probeTracks.size()); - - hmitr = m_histos.find("ntracks_rec"); - if(hmitr != m_histos.end()) hmitr->second->Fill(testtracks.size()); - - hmitr = m_histos.find("trigger_after"); - if(hmitr != m_histos.end()) hmitr->second->Fill( 0.5 ); - - hmitr = m_histos.find("cutflow"); // trigger hits - if(hmitr != m_histos.end()) hmitr->second->Fill( 0.0 ); - hmitr = m_histos.find("cutflow_tight"); // trigger hits - if(hmitr != m_histos.end()) hmitr->second->Fill( 0.0 ); - - std::map<string, TH2F*>::iterator hmitr2d; - - float pTt = 0.0, z0t = 0.0, etat = 0.0, - phit = 0.0, d0t = 0.0, a0t = 0.0, - invmass = 0.0; - int nvert = 0, ntracks = 0; //, q = 0; - - ///default is J/Psi - float mass = 3.097*GeV; - m_plusMass = 2.903*GeV; - m_minusMass = 2.097*GeV; - if(m_chainName.find("Z") != string::npos) { - mass = 90.097*GeV; - m_plusMass = 19.903*GeV; - m_minusMass = 20.097*GeV; - } - - /// beamspot x,y - //hmitr2d = m_histos2d.find("beamspotxy"); - //if(hmitr2d != m_histos2d.end()) hmitr2d->second->Fill(m_yBeamReference, m_xBeamReference, 1.0); - - /* - * - * THIS IS WHERE SOME SERIOUS BUSINESS IS HAPPENING... - * - * - */ - bool cutflow_check[] = { 1, 1, 1, 1 }; - bool cutflow_check_tight[] = { 1, 1, 1, 1 }; - for(unsigned int i=0; i < probeTracks.size(); i++) { - - TIDA::JpsiTrack* probe = 0; - const Wrapper::MuonTrack *tag = 0; - if(probeTracks[i]) { - probe = dynamic_cast<TIDA::JpsiTrack*> (probeTracks[i]); - tag = probe->getTag(); - } - else throw std::runtime_error("*** TrigJpsiMonTool *** Probe not casting, aborting!!! *** TrigJpsiMonTool ***"); - - m_speaker->msg(MSG::DEBUG) << "probe [ pT = " << probe->pT() << " eta = " << probe->eta() - << " phi = " << probe->phi() << " ]" << endmsg; - m_speaker->msg(MSG::DEBUG) << "tag [ pT = " << tag->pt() << " eta = " << tag->eta() - << " phi = " << tag->phi() << " ]" << endmsg; - cout << "probe [ pT = " << probe->pT() << " eta = " << probe->eta() - << " phi = " << probe->phi() << " ]" << endl; - cout << "tag [ pT = " << tag->pt() << " eta = " << tag->eta() - << " phi = " << tag->phi() << " ]" << endl; - - int probeRoiId = probe->getRoiNum(); - int tagRoiId = tag->roiNum(); - if(probeRoiId == tagRoiId) { - m_speaker->msg(MSG::WARNING) << "*** TrigJpsiMonTool *** probe RoI == tag RoI!!! *** TrigJpsiMonTool ***" << endmsg; - throw std::runtime_error("*** TrigJpsiMonTool *** probe RoI == tag RoI!!! *** TrigJpsiMonTool ***"); - } - else m_speaker->msg(MSG::DEBUG) << "JPsiAnalysis -- probe ROI: " << probeRoiId << " and tag ROI: " << tagRoiId << endmsg; - - m_speaker->msg(MSG::DEBUG) << "test tracks size: " << testtracks.size() - << " roi size: " << m_trackRois->size() << endmsg; - cout << "test tracks size: " << testtracks.size() << endl; - //for(unsigned int jj = 0; jj < testtracks.size(); ++jj) cout << "testtracks - " << jj << " - " << testtracks[jj] << endl; - //for( std::map<int,int>::iterator ii = m_trackRois->begin(); ii != m_trackRois->end(); ++ii) { - // cout << (*ii).first << " : " << (*ii).second << endl; - //} - - float m = probe->mass(); - bool isTightPair = m > (mass-m_minusMass) && m < (mass+m_plusMass); - //cout << "cutflow check ..." << endl; - if(cutflow_check[0]) { - cutflow_check[0] = 0; - hmitr = m_histos.find("cutflow"); // got t&p candidate - if(hmitr != m_histos.end()) hmitr->second->Fill( 1.0 ); - } - //cout << "tight cutflow check ..." << endl; - if(isTightPair && cutflow_check_tight[0]) { - cutflow_check_tight[0] = 0; - hmitr = m_histos.find("cutflow_tight"); // got t&p candidate - if(hmitr != m_histos.end()) hmitr->second->Fill( 1.0 ); - } - - float mu_inTime = 0; //, mu_outOfTime = 0; - - m_speaker->msg(MSG::DEBUG) << "get event info ..." << endmsg; - if(m_speaker->evtStore()->retrieve(m_eventInfo).isFailure()) m_speaker->msg(MSG::DEBUG) << "Failed to get EventInfo " << endmsg; - else { - mu_inTime = m_eventInfo->actualInteractionsPerCrossing(); - //mu_outOfTime = m_eventInfo->averageInteractionsPerCrossing(); - } - - unsigned int runNumber = m_eventInfo->event_ID()->run_number(); - unsigned int eventNumber = m_eventInfo->event_ID()->event_number(); - - ///temp - float offd0 = 0., offphi0 = 0., offz0 = 0., offpT = 0., - offeta = 0., offphi = 0., temp_Deta = 0., temp_Dphi = 0., - matched_brem = 0.; - /// what if there are more ef than offline tracks?!?! - //cout << "cutflow stuff ..." << endl; - bool fillOffline = false; - hmitr = m_histos.find("cutflow"); // offline matches - if(cutflow_check[1] && hmitr != m_histos.end()) { - //std::cout << "tag and probe pointers: " << m_offlineTags << " " << m_offlineProbes << std::endl; - //std::cout << "i: " << i << " offlineTags: " << m_offlineTags->size() << " offlineProbes: " << m_offlineProbes->size() << std::endl; - cutflow_check[1] = 0; - if(m_offlineTags->at(i)) hmitr->second->Fill( 2.0 ); - if(m_offlineProbes->at(i)) hmitr->second->Fill( 3.0 ); - if(m_offlineProbes->at(i) && m_offlineTags->at(i)) hmitr->second->Fill( 4.0 ); - } - hmitr = m_histos.find("cutflow_tight"); // offline matches - if(isTightPair && cutflow_check_tight[1] && hmitr != m_histos.end()) { - cutflow_check_tight[1] = 0; - if(m_offlineTags->at(i)) hmitr->second->Fill( 2.0 ); - if(m_offlineProbes->at(i)) hmitr->second->Fill( 3.0 ); - if(m_offlineProbes->at(i) && m_offlineTags->at(i)) hmitr->second->Fill( 4.0 ); - } - - m_speaker->msg(MSG::DEBUG) << "require offline matches ..." << endmsg; - - bool matchOffline = m_offlineProbes->at(i) ? true : false; - m_speaker->msg(MSG::DEBUG) << "matchOffline probes: " << matchOffline << endmsg; - if(!m_isMuon) { - matchOffline = m_offlineTags->at(i) && m_tOffCharge->at(i) * m_pOffCharge->at(i) < 0.0; - m_speaker->msg(MSG::DEBUG) << "offTag: " << m_offlineTags->at(i) << endmsg; - m_speaker->msg(MSG::DEBUG) << "tOffCharge: " << m_tOffCharge->at(i) << endmsg; - m_speaker->msg(MSG::DEBUG) << "pOffCharge: " << m_pOffCharge->at(i) << endmsg; - m_speaker->msg(MSG::DEBUG) << "matchOffline tag: " << matchOffline << endmsg; - } - - if(matchOffline) { - - // #ifndef TIDA_NEWTRACKING_H - // const Trk::MeasuredPerigee* measPer = m_offlineProbes->at(i)->measuredPerigee(); - // #else - const Trk::Perigee* measPer = m_offlineProbes->at(i)->measuredPerigee(); - // #endif - // cout << "offd0 offset x = " << m_xBeamReference << " y = " << m_yBeamReference << endl; - offd0 = measPer->parameters()[Trk::d0] + sin(m_offlineProbes->at(i)->phi())*m_xBeamReference; - offd0 -= cos(m_offlineProbes->at(i)->phi())*m_yBeamReference; - offphi0 = fixPhi( measPer->parameters()[Trk::phi0]); - offz0 = measPer->parameters()[Trk::z0]; - offpT = m_offlineProbes->at(i)->pt(); - offeta = m_offlineProbes->at(i)->eta(); - offphi = fixPhi(m_offlineProbes->at(i)->phi()); - temp_Deta = m_pOffDeta->at(i); - temp_Dphi = fixPhi(m_pOffDphi->at(i)); - float et = m_pOffEt->at(i); - if(et) matched_brem = fabs(offpT) / et; - - hmitr = m_histos.find("probe_off_deta"); - if(hmitr!=m_histos.end()) hmitr->second->Fill(temp_Deta); - hmitr = m_histos.find("probe_off_dphi"); - if(hmitr!=m_histos.end()) hmitr->second->Fill(temp_Dphi); - hmitr = m_histos.find("probe_off_dr"); - if(hmitr!=m_histos.end()) hmitr->second->Fill(m_pOffDr->at(i)); - - ///work out the tag-offline invmass - TLorentzVector tag4vec, probe4vec, offTag4vec, offProbe4vec, comb4vec; - float offtheta = 2. * atan(exp(-offeta)); - float pxoff = offpT * cos(m_offlineProbes->at(i)->phi()); - float pyoff = offpT * sin(m_offlineProbes->at(i)->phi()); - float pzoff = offpT * cos(offtheta) / sin(offtheta); - - float Mass = m_isMuon? 105.66 : 0.511; - - tag4vec.SetPtEtaPhiE(tag->pt(), tag->eta(), fixPhi(tag->phi()), - sqrt(pow(Mass,2)+pow(tag->px(),2)+pow(tag->py(),2)+pow(tag->pz(),2))); - probe4vec.SetPtEtaPhiE(probe->pT(), probe->eta(), fixPhi(probe->phi()), - sqrt(pow(Mass,2)+pow(probe->px(),2)+pow(probe->py(),2)+pow(probe->pz(),2))); - offProbe4vec.SetPtEtaPhiE(offpT, offeta, offphi0, - sqrt(pow(Mass,2)+pow(pxoff,2)+pow(pyoff,2)+pow(pzoff,2))); - comb4vec = tag4vec + offProbe4vec; - float vmag = comb4vec.Mag()/GeV; - // probe mass confirmation cut - fillOffline = !(vmag < 0.5); - m_speaker->msg(MSG::DEBUG) << "vmag: " << vmag << endmsg; - - cout << "> HIGH PT INEFFICIENCY DEBUG:" << endl; - cout << "> probe pT: " << probe->pT() << endl; - cout << "> offline probe track information:" << endl; - cout << "> offline probe track eta:" << offeta << endl; - cout << "> offline probe track phi:" << offphi << endl; - cout << "> offline probe track pT:" << offpT << endl; - //cout << (*m_offlineProbes->at(i)) << endl; - if(m_offlineTags->at(i)) { - cout << "> offline tag track information:" << endl; - float offTagPhi0 = fixPhi(((m_offlineTags->at(i)->measuredPerigee())->parameters())[Trk::phi0]); - float offTagPt = m_offlineTags->at(i)->pt(); - float offTagEta = m_offlineTags->at(i)->eta(); - float offTagTheta = 2. * atan(exp(-offTagEta)); - float pxTag = offTagPt * cos(m_offlineTags->at(i)->phi()); - float pyTag = offTagPt * sin(m_offlineTags->at(i)->phi()); - float pzTag = offTagPt * cos(offTagTheta) / sin(offTagTheta); - cout << "> offline tag track eta:" << offTagEta << endl; - cout << "> offline tag track phi:" << offTagPhi0 << endl; - cout << "> offline tag track pT:" << offTagPt << endl; - //cout << (*m_offlineTags->at(i)) << endl; - offTag4vec.SetPtEtaPhiE(offTagPt, offTagEta, offTagPhi0, - sqrt(pow(Mass,2)+pow(pxTag,2)+pow(pyTag,2)+pow(pzTag,2))); - hmitr = m_histos.find("Zpt"); - if(hmitr != m_histos.end()) hmitr->second->Fill((offProbe4vec + offTag4vec).Perp()/GeV); - } - - hmitr = m_histos.find("tag_offline_invmass"); - if(hmitr != m_histos.end()) hmitr->second->Fill(probe->mass()/GeV); - hmitr2d = m_histos2d.find("tomass_vs_offpt"); - if(hmitr2d != m_histos2d.end()) hmitr2d->second->Fill(fabs(offpT/GeV), vmag, 1.0); - - if(!m_isMuon) { - float offTagPhi0 = fixPhi(((m_offlineTags->at(i)->measuredPerigee())->parameters())[Trk::phi0]); - float offTagPt = m_offlineTags->at(i)->pt(); - float offTagEta = m_offlineTags->at(i)->eta(); - float offTagTheta = 2. * atan(exp(-offTagEta)); - float pxTag = offTagPt * cos(m_offlineTags->at(i)->phi()); - float pyTag = offTagPt * sin(m_offlineTags->at(i)->phi()); - float pzTag = offTagPt * cos(offTagTheta) / sin(offTagTheta); - offTag4vec.SetPtEtaPhiE(offTagPt, offTagEta, offTagPhi0, - sqrt(pow(Mass,2)+pow(pxTag,2)+pow(pyTag,2)+pow(pzTag,2))); - // tag mass confirmation cut - comb4vec = probe4vec + offTag4vec; - vmag = comb4vec.Mag()/GeV; - fillOffline &= !(vmag < 0.5); - } - } - else m_speaker->msg(MSG::INFO) << "No offline matches. fillOffline = " << fillOffline << endmsg; - //else break; - - if(cutflow_check[2] && fillOffline) { - cutflow_check[2] = 0; - hmitr = m_histos.find("cutflow"); // is efficient - if(hmitr != m_histos.end()) hmitr->second->Fill( 5.0 ); - } - if(isTightPair && cutflow_check_tight[2] && fillOffline) { - cutflow_check_tight[2] = 0; - hmitr = m_histos.find("cutflow_tight"); // is efficient - if(hmitr != m_histos.end()) hmitr->second->Fill( 5.0 ); - } - - ntracks = 0; - vector<TIDA::Vertex*>::const_iterator it = m_vertices.begin(); - vector<TIDA::Vertex*>::const_iterator itEnd = m_vertices.end(); - for(; it != itEnd; ++it) ntracks += (*it)->Ntracks(); - - // this is the dilepton invariant mass - invmass = probe->mass()/GeV; - - pTt = fabs(probe->pT()); - z0t = probe->z0(); - etat = probe->eta(); - phit = fixPhi(probe->phi()); - /// use the tag variables for impact parameter, since the probe is extrapolated - d0t = tag->a0(); - a0t = tag->a0() + sin(phit)*m_xBeamReference - cos(phit)*m_yBeamReference; - - //q = pTt>0? 1. : -1.; - - float tnpDeltaR = deltaR(etat, phit, tag->eta(), tag->phi()); - - ///////////////////////////////////// - ///////////////////////////////////// - // if(tnpDeltaR < 0.1) continue; - ///////////////////////////////////// - ///////////////////////////////////// - - float dPhiTP = deltaPhi(tag->phi(), probe->phi()) / M_PI; - - hmitr = m_histos.find("tagAndProbe_invmass"); - if(hmitr != m_histos.end()) hmitr->second->Fill(invmass); - - if(m_offlineTags->at(i)) { - hmitr = m_histos.find("tagMatch_invmass"); - if(hmitr != m_histos.end()) hmitr->second->Fill(invmass); - } - - const int vpartSize = 6; - float vpart[vpartSize] = { fabs(offpT)/GeV, offeta, offphi0, offz0, d0t, offd0 }; - for(int it = 0; it<vpartSize; it++) { - if(TH1F* hptr = find(varName[it])) hptr->Fill(vpart[it]); - } - - int isEfficient = 0, isEfficient_nocut = 0; - float tinvmass = 0, ttMass = 0.; - TIDA::Track *matched = 0, *matched_nocut = 0; - double matched_eta = 0., matched_phi = 0.; - // matched_eta_nocut = 0., matched_phi_nocut = 0.; - //int matched_roi = -1; - - float tempdmass = 999999.; - float fillmass = 0.; - - float minDR = 0., minDR_nocut = 0., etaID = 0., - phiID = 0., ptID = 0., maxPt = 0.; - m_speaker->msg(MSG::DEBUG) << "testtracks size: " << testtracks.size() - << " roi size: " << m_trackRois->size() << endmsg; - for(unsigned int trigind = 0; trigind < testtracks.size(); trigind++) { - // For electrons, require EQUAL RoIs for ID track and probe cluster - // For muons, require OPPOSITE RoIs for ID track and probe cluster - m_speaker->msg(MSG::DEBUG) << "testtrack [ pt = " << testtracks[trigind]->pT() - << " eta = " << testtracks[trigind]->eta() - << " phi = " << testtracks[trigind]->phi() - << " roi = " << m_trackRois->operator[](trigind) << " ]" << endmsg; - m_speaker->msg(MSG::DEBUG) << "track ROI: " << m_trackRois->operator[](trigind) - << " probeRoiId: " << probeRoiId << endmsg; - cout << "testtrack [ pt = " << testtracks[trigind]->pT() - << " eta = " << testtracks[trigind]->eta() - << " phi = " << testtracks[trigind]->phi() - << " roi = " << m_trackRois->operator[](trigind) << " ]" << endl; - m_speaker->msg(MSG::DEBUG) << "track ROI: " << m_trackRois->operator[](trigind) - << " probeRoiId: " << probeRoiId << endmsg; - cout << "track ROI: " << m_trackRois->operator[](trigind) << " probeRoiId: " << probeRoiId << endl; - /*if( m_isMuon && m_trackRois->operator[](trigind) == tagRoiId) continue; - else if(!m_isMuon && m_trackRois->operator[](trigind) != probeRoiId) continue;*/ - if(m_trackRois->operator[](trigind) != probeRoiId) continue; - m_speaker->msg(MSG::INFO) << "test track passed RoI check!" << endmsg; - cout << "test track passed RoI check!" << endl; - - TLorentzVector tagVec, trackVec, tagAndTrackPair; - float Mass = m_isMuon? 105.66 : 0.511; - - float idEta = testtracks[trigind]->eta(); - float idPhi = fixPhi(testtracks[trigind]->phi()); - //float thetaId = 2. * atan(exp(-testtracks[trigind]->eta())); - float idTheta = 2. * atan(exp(-idEta)); - float idPt = testtracks[trigind]->pT(); - float idPx = idPt * cos(idPhi); - float idPy = idPt * sin(idPhi); - float idPz = idPt * cos(idTheta) / sin(idTheta); - float idEn = sqrt(Mass*Mass + idPx*idPx + idPy*idPy + idPz*idPz); - - // TEMP !!! - // - //if( fabs(idPt) < 2000. ) continue; - // - // TEMP !!! - - float tagEn = sqrt(Mass*Mass + tag->px()*tag->px() + tag->py()*tag->py() + tag->pz()*tag->pz()); - - tagVec.SetPtEtaPhiE(tag->pt(), tag->eta(), fixPhi(tag->phi()), tagEn); - trackVec.SetPtEtaPhiE(idPt, idEta, idPhi, idEn); - tagAndTrackPair = tagVec + trackVec; - tinvmass = tagAndTrackPair.Mag(); - cout << "inv mass: " << (tinvmass / GeV) << endl; - - /// select the most J/Psi-like pair - if(fabs(tinvmass-mass) < tempdmass) { - tempdmass = fabs(tinvmass - mass); - fillmass = tinvmass; - } - - if(m_isMuon) { - // (mass-m_minusMass) && (mass+m_plusMass) - // this mass window matching is less than ideal - // need to come up with something cleverer!! - if(fabs(testtracks[trigind]->pT()) > maxPt) { - //float mdR = deltaR(probe->eta(), probe->phi(), testtracks[trigind]->eta(), testtracks[trigind]->phi()); - //if(!minDR || mdR < minDR) { - // - /*float mdR = deltaR(probe->eta(), probe->phi(), testtracks[trigind]->eta(), testtracks[trigind]->phi()); - m_speaker->msg(MSG::DEBUG) << "mdR(probe, track): " << mdR << " cut: 0.4" << endmsg; - if(!minDR_nocut || (minDR_nocut && mdR < minDR_nocut)) minDR_nocut = mdR; - if(mdR < 0.1) { - if(!isEfficient || (isEfficient && mdR < minDR)) {*/ - //isEfficient = 1; - ttMass = tinvmass; - matched = testtracks[trigind]; - etaID = testtracks[trigind]->eta(); - phiID = fixPhi(testtracks[trigind]->phi()); - matched_eta = testtracks[trigind]->eta(); - matched_phi = fixPhi(testtracks[trigind]->phi()); - ptID = fabs(testtracks[trigind]->pT())/GeV; - maxPt = fabs(testtracks[trigind]->pT()); - //minDR = mdR; - } - } - else if(fillOffline) { - float mdR = deltaR(offeta, offphi, testtracks[trigind]->eta(), testtracks[trigind]->phi()); - // as long as there is any track in the RoI it is efficient - // use closest track as the 'matched track' - if(!isEfficient_nocut || (isEfficient_nocut && mdR < minDR_nocut)) { - matched_nocut = testtracks[trigind]; - //matched_phi_nocut = fixPhi(m_phiAtCalo->operator[](trigind)); - //matched_eta_nocut = m_etaAtCalo->operator[](trigind); - minDR_nocut = mdR; - isEfficient_nocut = 1; - } - m_speaker->msg(MSG::DEBUG) << "mdR(off, track): " << mdR << endmsg; - if(mdR < 0.03) { - if(!isEfficient || (isEfficient && mdR < minDR)) { - //etaID = m_etaAtCalo->operator[](trigind); - //phiID = fixPhi(m_phiAtCalo->operator[](trigind)); - etaID = testtracks[trigind]->eta(); - phiID = fixPhi(testtracks[trigind]->phi()); - ptID = fabs(testtracks[trigind]->pT())/GeV; - matched = testtracks[trigind]; - matched_eta = testtracks[trigind]->eta(); - matched_phi = fixPhi(testtracks[trigind]->phi()); - //matched_phi = fixPhi(m_phiAtCalo->operator[](trigind)); - //matched_eta = m_etaAtCalo->operator[](trigind); - //matched_roi = m_trackRois->operator[](trigind); - minDR = mdR; - isEfficient = 1; - } - } - } // else if (fillOffline) - } // loop over all tracks - - if(m_isMuon) { - double lowerBound = m_isJpsi? 1000. : 50000.; - double upperBound = m_isJpsi? 20000 : 400000.; - m_speaker->msg(MSG::DEBUG) << "mass(ID track, tag): " << ttMass << endmsg; - m_speaker->msg(MSG::DEBUG) << "massLimitLow: " << lowerBound << endmsg; - m_speaker->msg(MSG::DEBUG) << "massLimitHigh: " << upperBound << endmsg; - cout << "mass(ID track, tag): " << ttMass << endl; - cout << "massLimitLow: " << lowerBound << endl; - cout << "massLimitHigh: " << upperBound << endl; - hmitr = m_histos.find("invmass_tt"); - if(hmitr != m_histos.end()) hmitr->second->Fill( ttMass/GeV ); - if(!isEfficient && ttMass > lowerBound && ttMass < upperBound) isEfficient = 1; - else { - matched = 0; - etaID = phiID = ptID = 0.; - } - } - - if(isEfficient) { - cout << "\033[92;1mEvent #: " << eventNumber << ", run #: " - << runNumber << " --> is efficient! :-)\033[m" << endl; - cout << "SKIM EFFICIENT -- event #: " << eventNumber - << " run #: " << runNumber << endl; - hmitr = m_histos.find("pT_track"); - if(hmitr != m_histos.end()) hmitr->second->Fill( ptID ); - hmitr = m_histos.find("eta_track"); - if(hmitr != m_histos.end()) hmitr->second->Fill( etaID ); - hmitr = m_histos.find("phi_track"); - if(hmitr != m_histos.end()) hmitr->second->Fill( phiID ); - hmitr = m_histos.find("dphi_tp"); - if(hmitr != m_histos.end()) hmitr->second->Fill( dPhiTP ); - - if(fabs(dPhiTP) > 0.75) { - hmitr = m_histos.find("pT_track_b2b"); - if(hmitr != m_histos.end()) hmitr->second->Fill( ptID ); - hmitr = m_histos.find("eta_track_b2b"); - if(hmitr != m_histos.end()) hmitr->second->Fill( etaID ); - hmitr = m_histos.find("phi_track_b2b"); - if(hmitr != m_histos.end()) hmitr->second->Fill( phiID ); - } - } - else { - cout << "\033[91;1mEvent #: " << eventNumber << ", run #: " - << runNumber << " --> is not efficient. :-(\033[m" << endl; - cout << "SKIM INEFFICIENT -- event #: " << eventNumber - << " run #: " << runNumber << endl; - } - - if((probe->pT()/GeV) > 60. && !isEfficient && fillOffline) { - cout << "\033[92;1mHIGH PT INEFFICIENCY: INVESTIGATE!!!\033[m" << endl; - } - - if(minDR_nocut) { - hmitr = m_histos.find("minDr_res"); - if(hmitr != m_histos.end()) hmitr->second->Fill( minDR_nocut ); - } - - if(cutflow_check[3] && isEfficient) { - cutflow_check[3] = 0; - hmitr = m_histos.find("cutflow"); // is efficient - if(hmitr != m_histos.end()) hmitr->second->Fill( 6.0 ); - } - else if(pTt > 30000.) { //DEBUG high pT inefficiency - if(isTightPair && cutflow_check_tight[3] && isEfficient) { - cutflow_check_tight[3] = 0; - hmitr = m_histos.find("cutflow_tight"); // is efficient - if(hmitr != m_histos.end()) hmitr->second->Fill( 6.0 ); - } - - if(fillOffline) { - hmitr2d = m_histos2d.find("pt_vs_offpt"); - if(hmitr2d != m_histos2d.end()) hmitr2d->second->Fill(offpT/GeV, pTt/GeV, 1.0); // for most J/Psi-like, use 'fillmass' - } - - hmitr = m_histos.find("tinvmass_miss"); - if(hmitr!=m_histos.end()) hmitr->second->Fill(fillmass/GeV); - - } - /////////////DEBUG high pT inefficiency - - ///if you don't want to make any matching cut... - // isEfficient = 1; - m_pT_eff->Fill(pTt/GeV, isEfficient, 1.); - m_eta_eff->Fill(etat, isEfficient, 1.); - m_vert_eff->Fill(nvert, isEfficient, 1.); - m_z0_eff->Fill(z0t, isEfficient, 1.); - m_d0_eff->Fill(a0t, isEfficient, 1.); - m_phi_eff->Fill(phit, isEfficient, 1.); - m_track_eff->Fill(ntracks, isEfficient, 1.); - m_invmass_eff->Fill(invmass, isEfficient, 1.); - - - hmitr2d = m_histos2d.find("invmass_vs_tinvmass"); - if(hmitr2d != m_histos2d.end()) hmitr2d->second->Fill(fillmass/GeV, invmass, 1.0); // for most J/Psi-like, use 'fillmass' - hmitr2d = m_histos2d.find("invmass_vs_deltar"); - if(hmitr2d != m_histos2d.end()) hmitr2d->second->Fill(tnpDeltaR, invmass, 1.0); // for most J/Psi-like, use 'fillmass' - hmitr2d = m_histos2d.find("pt_vs_deltar"); - if(hmitr2d != m_histos2d.end()) hmitr2d->second->Fill(tnpDeltaR, pTt/GeV, 1.0); // for most J/Psi-like, use 'fillmass' - - //////FOR ONLINE-OFFLINE COMPARISONS ONLY - // offpT = pTt; - // offeta = etat; - // offz0 = z0t; - // offphi0 = phit; - - ///temp - if(fabs(offd0) > 1.0) { - m_pT_eff_d0cut->Fill(offpT/GeV, isEfficient, 1.); - m_eta_eff_d0cut->Fill(offeta, isEfficient, 1.); - m_vert_eff_d0cut->Fill(nvert, isEfficient, 1.); - m_z0_eff_d0cut->Fill(offz0, isEfficient, 1.); - m_d0_eff_d0cut->Fill(offd0, isEfficient, 1.); - m_phi_eff_d0cut->Fill(offphi0, isEfficient, 1.); - m_track_eff_d0cut->Fill(ntracks, isEfficient, 1.); - m_invmass_eff_d0cut->Fill(invmass, isEfficient, 1.); - } - - static const int num = 11; - static string effName[num] = { "pT", "eta", "phi", "d0", "absd0", "z0", "absz0", - "invmass", "track", "vert", "mu" }; - float effVar[num] = { fabs(pTt)/GeV, etat, phit, offd0, fabs(offd0), offz0, - fabs(offz0), invmass, float(ntracks), float(nvert), mu_inTime }; - - if(isEfficient) { - for (int it = 0; it<num; it++) { - if(TH1F* hptr = find(effName[it]+"num")) hptr->Fill(effVar[it]); - } - for(int it = 0; it<num; it++) { - if(TH1F* hptr = find(effName[it]+"den")) hptr->Fill(effVar[it]); - } - if(TH1F* hptr = find("deltarnum")) hptr->Fill(tnpDeltaR); - if(TH1F* hptr = find("deltarden")) hptr->Fill(tnpDeltaR); - if(TH1F* hptr = find("ETnum")) hptr->Fill( matched_brem ); - if(TH1F* hptr = find("ETden")) hptr->Fill( matched_brem ); - if(fabs(offd0) < 0.5) { - if(TH1F* hptr = find("pTnum_d0cut")) hptr->Fill(pTt/GeV); - if(TH1F* hptr = find("pTden_d0cut")) hptr->Fill(pTt/GeV); - } - if(fabs(pTt) < 20000.) { - if(TH1F* hptr = find("deltarnum_lowpt")) hptr->Fill(tnpDeltaR); - if(TH1F* hptr = find("deltarden_lowpt")) hptr->Fill(tnpDeltaR); - } - if(matched_brem > 0.9) { - if( TH1F* hptr = find("pTEtnum") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("pTEtden") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("etaEtnum") ) hptr->Fill( etat ); - if( TH1F* hptr = find("etaEtden") ) hptr->Fill( etat ); - } - else if(matched_brem < 0.5) { - if( TH1F* hptr = find("pTbremnum") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("pTbremden") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("etabremnum") ) hptr->Fill( etat ); - if( TH1F* hptr = find("etabremden") ) hptr->Fill( etat ); - } - if(fabs(dPhiTP) > 0.5) { - if( TH1F* hptr = find("pTb2bloosenum") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("pTb2blooseden") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("etab2bloosenum") ) hptr->Fill( etat ); - if( TH1F* hptr = find("etab2blooseden") ) hptr->Fill( etat ); - if( TH1F* hptr = find("mub2bloosenum") ) hptr->Fill( mu_inTime ); - if( TH1F* hptr = find("mub2blooseden") ) hptr->Fill( mu_inTime ); - if(fabs(dPhiTP) > 0.75) { - if( TH1F* hptr = find("pTb2bnum") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("pTb2bden") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("etab2bnum") ) hptr->Fill( etat ); - if( TH1F* hptr = find("etab2bden") ) hptr->Fill( etat ); - if( TH1F* hptr = find("mub2bnum") ) hptr->Fill( mu_inTime ); - if( TH1F* hptr = find("mub2bden") ) hptr->Fill( mu_inTime ); - } - } - } - else { - hmitr = m_histos.find("tagAndProbe_invmass_wo_match"); - if(hmitr!=m_histos.end()) hmitr->second->Fill(invmass); - ///temp, pT of missed offline track - hmitr = m_histos.find("pTmiss"); - if(hmitr!=m_histos.end()) hmitr->second->Fill(fabs(offpT/GeV)); - - for ( int it=0 ; it<num; it++ ) { - if(TH1F* hptr = find(effName[it]+"den")) hptr->Fill(effVar[it]); - } - if(TH1F* hptr = find("deltarden")) hptr->Fill(tnpDeltaR); - if(TH1F* hptr = find("ETden")) hptr->Fill( matched_brem ); - if(fabs(offd0) < 0.5) { - if(TH1F* hptr = find("pTden_d0cut")) hptr->Fill(pTt/GeV); - } - if(fabs(pTt) < 20000.) { - if(TH1F* hptr = find("deltarden_lowpt")) hptr->Fill(tnpDeltaR); - } - if(matched_brem > 0.9) { - if( TH1F* hptr = find("pTEtden") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("etaEtden") ) hptr->Fill( etat ); - } - else if(matched_brem < 0.5) { - if( TH1F* hptr = find("pTbremden") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("etabremden") ) hptr->Fill( etat ); - } - if(fabs(dPhiTP) > 0.5) { - if( TH1F* hptr = find("pTb2blooseden") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("etab2blooseden") ) hptr->Fill( etat ); - if( TH1F* hptr = find("mub2blooseden") ) hptr->Fill( mu_inTime ); - if(fabs(dPhiTP) > 0.75) { - if( TH1F* hptr = find("pTb2bden") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("etab2bden") ) hptr->Fill( etat ); - if( TH1F* hptr = find("mub2bden") ) hptr->Fill( mu_inTime ); - } - } - } - - if(fillOffline) { - hmitr = m_histos.find("pT_offtrack"); - if(hmitr != m_histos.end()) hmitr->second->Fill( fabs(offpT)/GeV ); - hmitr = m_histos.find("eta_offtrack"); - if(hmitr != m_histos.end()) hmitr->second->Fill( offeta ); - hmitr = m_histos.find("phi_offtrack"); - if(hmitr != m_histos.end()) hmitr->second->Fill( offphi ); - if(matched_brem > 0.9) { - hmitr = m_histos.find("pT_offtrackEt"); - if(hmitr != m_histos.end()) hmitr->second->Fill( fabs(offpT)/GeV ); - hmitr = m_histos.find("eta_offtrackEt"); - if(hmitr != m_histos.end()) hmitr->second->Fill( offeta ); - hmitr = m_histos.find("phi_offtrackEt"); - if(hmitr != m_histos.end()) hmitr->second->Fill( offphi ); - } - else if(matched_brem < 0.5) { - hmitr = m_histos.find("pT_offtrackbrem"); - if(hmitr != m_histos.end()) hmitr->second->Fill( fabs(offpT)/GeV ); - hmitr = m_histos.find("eta_offtrackbrem"); - if(hmitr != m_histos.end()) hmitr->second->Fill( offeta ); - hmitr = m_histos.find("phi_offtrackbrem"); - if(hmitr != m_histos.end()) hmitr->second->Fill( offphi ); - } - - m_pT_eff_offline->Fill(offpT/GeV, isEfficient, 1.); - m_eta_eff_offline->Fill(offeta, isEfficient, 1.); - m_vert_eff_offline->Fill(nvert, isEfficient, 1.); - m_z0_eff_offline->Fill(offz0, isEfficient, 1.); - m_d0_eff_offline->Fill(offd0, isEfficient, 1.); - m_phi_eff_offline->Fill(offphi0, isEfficient, 1.); - m_track_eff_offline->Fill(ntracks, isEfficient, 1.); - m_invmass_eff_offline->Fill(invmass, isEfficient, 1.); - - ///temp - if(fabs(offd0) > 1.0){ - m_pT_eff_d0cut_offline->Fill(offpT/GeV, isEfficient, 1.); - m_eta_eff_d0cut_offline->Fill(offeta, isEfficient, 1.); - m_vert_eff_d0cut_offline->Fill(nvert, isEfficient, 1.); - m_z0_eff_d0cut_offline->Fill(offz0, isEfficient, 1.); - m_d0_eff_d0cut_offline->Fill(offd0, isEfficient, 1.); - m_phi_eff_d0cut_offline->Fill(offphi0, isEfficient, 1.); - m_track_eff_d0cut_offline->Fill(ntracks, isEfficient, 1.); - m_invmass_eff_d0cut_offline->Fill(invmass, isEfficient, 1.); - } - - if(isEfficient) { - for(int it = 0; it<num; it++) { - if(TH1F* hptr = find(effName[it]+"num_off")) hptr->Fill(effVar[it]); - } - for(int it = 0; it<num; it++) { - if(TH1F* hptr = find(effName[it]+"den_off")) hptr->Fill(effVar[it]); - } - if(TH1F* hptr = find("pToffnum_off")) hptr->Fill(fabs(offpT/GeV)); - if(TH1F* hptr = find("pToffden_off")) hptr->Fill(fabs(offpT/GeV)); - if(fabs(offd0) < 0.5) { - if( TH1F* hptr = find("pToffnum_d0cut") ) hptr->Fill( offpT/GeV ); - if( TH1F* hptr = find("pToffden_d0cut") ) hptr->Fill( offpT/GeV ); - } - if( TH1F* hptr = find("pTofftracknum_off") ) hptr->Fill( fabs(offpT)/GeV ); - if( TH1F* hptr = find("pTofftrackden_off") ) hptr->Fill( fabs(offpT)/GeV ); - if( TH1F* hptr = find("etaofftracknum_off") ) hptr->Fill( offeta ); - if( TH1F* hptr = find("etaofftrackden_off") ) hptr->Fill( offeta ); - if( TH1F* hptr = find("ETnum_off") ) hptr->Fill( matched_brem ); - if( TH1F* hptr = find("ETden_off") ) hptr->Fill( matched_brem ); - if(matched_brem > 0.9) { - if( TH1F* hptr = find("pTEtnum_off") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("pTEtden_off") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("etaEtnum_off") ) hptr->Fill( etat ); - if( TH1F* hptr = find("etaEtden_off") ) hptr->Fill( etat ); - if( TH1F* hptr = find("pTofftrackEtnum_off") ) hptr->Fill( fabs(offpT)/GeV ); - if( TH1F* hptr = find("pTofftrackEtden_off") ) hptr->Fill( fabs(offpT)/GeV ); - if( TH1F* hptr = find("etaofftrackEtnum_off") ) hptr->Fill( offeta ); - if( TH1F* hptr = find("etaofftrackEtden_off") ) hptr->Fill( offeta ); - } - else if(matched_brem < 0.5) { - if( TH1F* hptr = find("pTbremnum_off") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("pTbremden_off") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("etabremnum_off") ) hptr->Fill( etat ); - if( TH1F* hptr = find("etabremden_off") ) hptr->Fill( etat ); - if( TH1F* hptr = find("pTofftrackbremnum_off") ) hptr->Fill( fabs(offpT)/GeV ); - if( TH1F* hptr = find("pTofftrackbremden_off") ) hptr->Fill( fabs(offpT)/GeV ); - if( TH1F* hptr = find("etaofftrackbremnum_off") ) hptr->Fill( offeta ); - if( TH1F* hptr = find("etaofftrackbremden_off") ) hptr->Fill( offeta ); - } - if(fabs(dPhiTP) > 0.5) { - if( TH1F* hptr = find("pTb2bloosenum_off") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("pTb2blooseden_off") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("etab2bloosenum_off") ) hptr->Fill( etat ); - if( TH1F* hptr = find("etab2blooseden_off") ) hptr->Fill( etat ); - if( TH1F* hptr = find("mub2bloosenum_off") ) hptr->Fill( mu_inTime ); - if( TH1F* hptr = find("mub2blooseden_off") ) hptr->Fill( mu_inTime ); - if(fabs(dPhiTP) > 0.75) { - if( TH1F* hptr = find("pTb2bnum_off") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("pTb2bden_off") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("etab2bnum_off") ) hptr->Fill( etat ); - if( TH1F* hptr = find("etab2bden_off") ) hptr->Fill( etat ); - if( TH1F* hptr = find("mub2bnum_off") ) hptr->Fill( mu_inTime ); - if( TH1F* hptr = find("mub2bden_off") ) hptr->Fill( mu_inTime ); - } - } - } - else { - for(int it = 0; it<num; it++) { - if(TH1F* hptr = find(effName[it]+"den_off")) hptr->Fill(effVar[it]); - } - if(TH1F* hptr = find("pToffden_off")) hptr->Fill(fabs(offpT/GeV)); - if(TH1F* hptr = find("ETden_off")) hptr->Fill( matched_brem ); - if(fabs(offd0) < 0.5) { - if(TH1F* hptr = find("pToffden_d0cut")) hptr->Fill(offpT/GeV); - } - if( TH1F* hptr = find("pTofftrackden_off") ) hptr->Fill( fabs(offpT)/GeV ); - if( TH1F* hptr = find("etaofftrackden_off") ) hptr->Fill( offeta ); - if(matched_brem > 0.9) { - if( TH1F* hptr = find("pTEtden_off") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("etaEtden_off") ) hptr->Fill( etat ); - if( TH1F* hptr = find("pTofftrackEtden_off") ) hptr->Fill( fabs(offpT)/GeV ); - if( TH1F* hptr = find("etaofftrackEtden_off") ) hptr->Fill( offeta ); - } - else if(matched_brem < 0.5) { - if( TH1F* hptr = find("pTbremden_off") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("etabremden_off") ) hptr->Fill( etat ); - if( TH1F* hptr = find("pTofftrackbremden_off") ) hptr->Fill( fabs(offpT)/GeV ); - if( TH1F* hptr = find("etaofftrackbremden_off") ) hptr->Fill( offeta ); - } - if(fabs(dPhiTP) > 0.5) { - if( TH1F* hptr = find("pTb2blooseden_off") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("etab2blooseden_off") ) hptr->Fill( etat ); - if( TH1F* hptr = find("mub2blooseden_off") ) hptr->Fill( mu_inTime ); - if(fabs(dPhiTP) > 0.75) { - if( TH1F* hptr = find("pTb2bden_off") ) hptr->Fill( fabs(pTt)/GeV ); - if( TH1F* hptr = find("etab2bden_off") ) hptr->Fill( etat ); - if( TH1F* hptr = find("mub2bden_off") ) hptr->Fill( mu_inTime ); - } - } - } - } - - // residual histos, between ID track and probe - if(isEfficient && matched) { - - float pTr = fabs(matched->pT()); - float phir = fixPhi(matched_phi); - float etar = matched_eta; - float z0r = matched->z0(); - float d0r = matched->a0(); - float a0r = matched->a0() + sin(phir)*m_xBeamTest - cos(phir)*m_yBeamTest; // this will be changed when we know the beam spot position - - string vtname[6] = { "pT_rec", "eta_rec", "phi_rec", "z0_rec", "d0_rec", "a0_rec"}; - float vtpart[6] = { fabs(pTr)/GeV, etar, phir, z0r, d0r, a0r }; - - for(int it=0; it<6; it++) { - if(TH1F* hptr = find(vtname[it])) hptr->Fill(vtpart[it]); - } - - float dphi = deltaPhi(phit, phir); - - float vres[6] = { 1/pTt-1/pTr, etat-etar, dphi, z0t-z0r, d0t-d0r, a0t-a0r }; - - for(int it=0; it<6; it++) { - if(TH1F* hptr = find(varName[it]+"_res")) hptr->Fill(vres[it]); - } - float dr = deltaR(etat, phit, etar, phir); - hmitr = m_histos.find("deltar"); - if(hmitr!=m_histos.end()) hmitr->second->Fill(dr); - if(fillOffline) { - hmitr2d = m_histos2d.find("asymEta"); - if(hmitr2d != m_histos2d.end()) hmitr2d->second->Fill(offeta, matched->eta()); - hmitr2d = m_histos2d.find("asymPhi"); - if(hmitr2d != m_histos2d.end()) hmitr2d->second->Fill(offphi, fixPhi(matched->phi())); - } - } - if(fillOffline && isEfficient_nocut && matched_nocut) { - float dEtaProbeOff = offeta - matched_nocut->eta(); - float dPhiProbeOff = deltaPhi(offphi, matched_nocut->phi()); - /*if(fabs(dEtaProbeOff) > 0.4 || fabs(dPhiProbeOff) > 0.4) { - cout << "OUTLIER INFO: tag -- pt = " << tag->pt() - << " eta = " << tag->eta() - << " phi = " << tag->phi() - << " roi = " << tag->roiNum() << endl; - cout << "OUTLIER INFO: probe -- pt = " << probe->pT() - << " eta = " << probe->eta() - << " phi = " << probe->phi() - << " roi = " << probe->getRoiNum() << endl; - cout << "OUTLIER INFO: track-- pt = " << matched_nocut->pT() - << " eta = " << matched_nocut->eta() << " (" << matched_eta_nocut << ")" - << " phi = " << matched_nocut->phi() << " (" << matched_phi_nocut << ")" << endl; - cout << "OUTLIER INFO: offline probe track-- pt = " << offpT - << " eta = " << offeta - << " phi = " << offphi << endl; - }*/ - hmitr = m_histos.find("etaOff_res"); - if(hmitr != m_histos.end()) hmitr->second->Fill(dEtaProbeOff); - hmitr = m_histos.find("phiOff_res"); - if(hmitr != m_histos.end()) hmitr->second->Fill(dPhiProbeOff); - hmitr = m_histos.find("rOff_res"); - if(hmitr != m_histos.end()) hmitr->second->Fill(minDR_nocut); - } - } - m_speaker->msg(MSG::DEBUG) << "... end of JpsiAnalysis execute." << endmsg; -} - -// ########################################################################### - -float JpsiAnalysis::deltaR(float eta1, float phi1, float eta2, float phi2) { - float deta = eta1-eta2; - float dphi = deltaPhi(phi1,phi2); - return TMath::Sqrt(deta*deta+dphi*dphi); -} - -// ########################################################################### - -float JpsiAnalysis::deltaPhi(float phi1, float phi2) { - if(TMath::IsNaN(phi1)||TMath::IsNaN(phi2)) { - cout << "> > > > > WTF!? deltaPhi(phi1,phi2) called with NaN" << endl; - } - return fixPhi(phi1-phi2); -} - -// ########################################################################### - -float JpsiAnalysis::fixPhi(float phi) { - while(phi >= M_PI) phi -= 2.0*M_PI; - while(phi < -M_PI) phi += 2.0*M_PI; - return phi; -} - -// ########################################################################### - diff --git a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/src/TrigJpsiMonTool.cxx b/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/src/TrigJpsiMonTool.cxx deleted file mode 100644 index 4538db4c2382af42e28869054f2c24fc1c7bcef9..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/src/TrigJpsiMonTool.cxx +++ /dev/null @@ -1,206 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ -// -// @file TrigJpsiMonTool.cxx -// -// implementation of an IHLTMonToolAC -// -// -// -// $Id: TrigTestMonToolAC.cxx, v0.0 Wed 28 Oct 2009 02:23:23 CET sutt $ -/** @author Mark Sutton (sutt@cern.ch) **/ -/** @author Peter Wijeratne (paw@hep.ucl.ac.uk) **/ -/** @author Christian Gutschow (chris.g@cern.ch) **/ - -#include "TrigInDetAnalysisUtils/Filter_Track.h" - -#include "TrigIDJpsiMonitoring/TrigJpsiMonTool.h" -#include "TrigIDJpsiMonitoring/AnalysisConfig_Jpsi.h" - -#include "AthenaMonitoring/AthenaMonManager.h" -#include "AthenaMonitoring/ManagedMonitorToolTest.h" - -using namespace TrigInDetAnalysis; - -TrigJpsiMonTool::TrigJpsiMonTool(const std::string & type, const std::string & name, const IInterface* parent) - : IHLTMonTool(type, name, parent), - m_tdt("Trig::TrigDecisionTool/TrigDecisionTool"), - m_roiInfo(false), - m_buildNtuple(false), - m_countBook(true) -{ - // msg(MSG::DEBUG) << "TrigJpsiMonTool::TrigJpsiMonTool() compiled: " << __DATE__ << " " << __TIME__ << endmsg; - - declareProperty( "pTCut", m_pTCut = 0 ); - declareProperty( "etaCut", m_etaCut = 5 ); - declareProperty( "d0Cut", m_d0Cut = 1000 ); - declareProperty( "z0Cut", m_z0Cut = 2000 ); - declareProperty( "siHits", m_siHits = -1 ); - - declareProperty( "trtHits", m_trtHits = -2 ); - declareProperty( "strawHits", m_strawHits = -2 ); - - declareProperty( "pTCutOffline", m_pTCutOffline = 4000 ); - declareProperty( "etaCutOffline", m_etaCutOffline = 2.5 ); - declareProperty( "d0CutOffline", m_d0CutOffline = 100 ); - declareProperty( "z0CutOffline", m_z0CutOffline = 200 ); - declareProperty( "siHitsOffline", m_siHitsOffline = -1 ); - declareProperty( "pixHitsOffline", m_pixHitsOffline = 1 ); - declareProperty( "sctHitsOffline", m_sctHitsOffline = 6 ); - - declareProperty( "trtHitsOffline", m_trtHitsOffline = -2 ); - declareProperty( "strawHitsOffline", m_strawHitsOffline = -2 ); - - declareProperty( "phiWidth", m_phiWidth = 0.2 ); - declareProperty( "etaWidth", m_etaWidth = 0.2 ); - declareProperty( "zedWidth", m_zedWidth = 168 ); - - declareProperty( "matchR", m_matchR = 0.2 ); - declareProperty( "matchPhi", m_matchPhi = 999 ); - - // declareProperty( "Chain0", m_chain0="EF_2mu4T_Jpsimumu_IDTrkNoCut" ); - //declareProperty( "Chain0", m_chain0="EF_e5_tight1_e5_NoCut" ); - declareProperty( "Chain0", m_chain1="EF_e24vh_tight1_e15_NoCut_Zee" ); - //declareProperty( "Chain1", m_chain1="EF_e5_tight1_e9_etcut_Jpsi" ); - declareProperty( "Chain1", m_chain0="EF_e5_tight1_e4_etcut_Jpsi" ); - - /*declareProperty( "IDSCAN", m_collection0="TrigIDSCAN_Muon" ); - declareProperty( "SiTrack", m_collection1="TrigSiTrack_Muon" ); - //declareProperty( "TRTSF", m_collection2="TRTSegmentFinder" ); - //declareProperty( "EF", m_collection3="InDetTrigParticleCreation_Muon_EFID" ); - //declareProperty( "EFTRT", m_collection4="InDetTrigParticleCreationTRTOnly_Muon_EFID" ); - declareProperty( "StratA", m_collection5="TrigL2SiTrackFinder_MuonA" ); - declareProperty( "StratB", m_collection6="TrigL2SiTrackFinder_MuonB" ); - declareProperty( "StratC", m_collection7="TrigL2SiTrackFinder_MuonC" ); */ - - //declareProperty( "IDSCAN", m_collection0="TrigIDSCAN_eGamma" ); - //declareProperty( "SiTrack", m_collection1="TrigSiTrack_eGamma" ); - //declareProperty( "TRTSF", m_collection2="TrigTRTSegFinder_eGamma" ); - declareProperty( "EF", m_collection0="InDetTrigParticleCreation_Electron_EFID" ); - //declareProperty( "EFTRT", m_collection4="InDetTrigParticleCreationTRTOnly_Electron_EFID" ); - declareProperty( "StratA", m_collection1="TrigL2SiTrackFinder_eGammaA" ); - declareProperty( "StratB", m_collection2="TrigL2SiTrackFinder_eGammaB" ); - declareProperty( "StratC", m_collection3="TrigL2SiTrackFinder_eGammaC" ); - - declareProperty( "buildNtuple", m_buildNtuple = false ); - declareProperty( "mcTruth", m_mcTruth = false ); - -} - - - -TrigJpsiMonTool::~TrigJpsiMonTool() { - for( unsigned int i = m_filters.size() ; i-- ; ) delete m_filters[i]; - for( unsigned int i = m_associators.size() ; i-- ; ) delete m_associators[i]; - for( unsigned int i = m_sequences.size() ; i-- ; ) delete m_sequences[i]; -} - - - -StatusCode TrigJpsiMonTool::init() { - - // msg(MSG::DEBUG) << " ----- enter init() ----- " << endmsg; - - // roi width information - // m_roiInfo.etaHalfWidth(m_etaWidth); - // m_roiInfo.phiHalfWidth(m_phiWidth); - // m_roiInfo.zedHalfWidth(m_zedWidth); - - // track filters - // reference (EF) tracks... - TrackFilter* filterRef = new Filter_Track( m_etaCutOffline, m_d0CutOffline, m_z0CutOffline, m_pTCutOffline, - -1, -1, -1, -1, -2, -2 ); - - // test (trigger) tracks... - TrackFilter* filterTest = new Filter_Track( m_etaCut, m_d0Cut, m_z0Cut, m_pTCut, -1, -1, -1, -1, -2, -2 ); - //TrackFilter* filterTest = new Filter_AcceptAll(); - - // keep track of the filters so they can be cleaned up at the end - m_filters.push_back(filterRef); - m_filters.push_back(filterTest); - - // track associators - TrackAssociator* dR_matcher = new Associator_BestDeltaRMatcher( "EBdeltaR", m_matchR ); // this needs to be set correctly - - // keep track of the filters so they can be cleaned up at the end - m_associators.push_back(dR_matcher); - - if( !m_chain0.empty() ) m_chainNames.push_back( m_chain0 ); - if( !m_chain1.empty() ) m_chainNames.push_back( m_chain1 ); - if( !m_chain2.empty() ) m_chainNames.push_back( m_chain2 ); - if( !m_chain3.empty() ) m_chainNames.push_back( m_chain3 ); - - if( !m_collection0.empty() ) m_collectionNames.push_back( m_collection0 ); - if( !m_collection1.empty() ) m_collectionNames.push_back( m_collection1 ); - if( !m_collection2.empty() ) m_collectionNames.push_back( m_collection2 ); - if( !m_collection3.empty() ) m_collectionNames.push_back( m_collection3 ); - if( !m_collection4.empty() ) m_collectionNames.push_back( m_collection4 ); - if( !m_collection5.empty() ) m_collectionNames.push_back( m_collection5 ); - if( !m_collection6.empty() ) m_collectionNames.push_back( m_collection6 ); - if( !m_collection7.empty() ) m_collectionNames.push_back( m_collection7 ); - - for( unsigned i=0 ; i<m_chainNames.size() ; i++ ){ - for( unsigned j=0; j<m_collectionNames.size(); j++ ){ - - m_sequences.push_back( new AnalysisConfig_Jpsi( m_chainNames[i], - m_chainNames[i], "", m_collectionNames[j], - m_chainNames[i], "", "TrackParticleCandidate", - &m_roiInfo, - filterTest, filterRef, - dR_matcher, - new JpsiAnalysis(m_chainNames[i]) ) ); - - } - } - - m_countBook = true; - - // msg(MSG::DEBUG) << " ----- exit init() ----- " << endmsg; - - return StatusCode::SUCCESS; -} - - - -#ifdef ManagedMonitorToolBase_Uses_API_201401 -StatusCode TrigJpsiMonTool::book() { -#else -StatusCode TrigJpsiMonTool::book(bool /*newEventsBlock*/, bool /*newLumiBlock*/, bool /*newRun*/) { -#endif - // msg(MSG::DEBUG) << " ----- enter book() ----- " << endmsg; - if( m_countBook ){ - for ( unsigned i=0 ; i<m_sequences.size() ; i++ ) { - m_sequences[i]->initialize(this, &m_tdt); - m_sequences[i]->book(); - } - } - m_countBook=false; - // msg(MSG::DEBUG) << " ----- exit book() ----- " << endmsg; - return StatusCode::SUCCESS; -} - -StatusCode TrigJpsiMonTool::fill() { - // msg(MSG::DEBUG) << " ----- enter fill() ----- " << endmsg; - for ( unsigned i=0 ; i<m_sequences.size() ; i++ ) m_sequences[i]->execute(); - // msg(MSG::DEBUG) << " ----- exit fill() ----- " << endmsg; - return StatusCode::SUCCESS; -} - -#ifdef ManagedMonitorToolBase_Uses_API_201401 -StatusCode TrigJpsiMonTool::proc() { - bool endOfRun = endOfRunFlag(); -#else -StatusCode TrigJpsiMonTool::proc(bool /*endOfEventsBlock*/, bool /*endOfLumiBlock*/, bool endOfRun) { -#endif - // msg(MSG::DEBUG) << " ----- enter proc() ----- " << endmsg; - if(endOfRun) { - for( unsigned i=0 ; i<m_sequences.size() ; i++ ) { m_sequences[i]->finalize(); } - } - // msg(MSG::DEBUG) << " ====== exit proc() ====== " << endmsg; - return StatusCode::SUCCESS; -} - - - - diff --git a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/src/components/TrigIDJpsiMonitoring_entries.cxx b/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/src/components/TrigIDJpsiMonitoring_entries.cxx deleted file mode 100644 index 5c862ec16e6dd458d06f55f1eb1be02f4dd0ad5f..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigIDJpsiMonitoring/src/components/TrigIDJpsiMonitoring_entries.cxx +++ /dev/null @@ -1,4 +0,0 @@ -#include "TrigIDJpsiMonitoring/TrigJpsiMonTool.h" - -DECLARE_COMPONENT( TrigJpsiMonTool ) - diff --git a/Trigger/TrigTools/TrigJPsiTools/CMakeLists.txt b/Trigger/TrigTools/TrigJPsiTools/CMakeLists.txt deleted file mode 100644 index c9eb2e42e23c865c36c848583744abd438da201e..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigJPsiTools/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -################################################################################ -# Package: TrigJPsiTools -################################################################################ - -# Declare the package name: -atlas_subdir( TrigJPsiTools ) - -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Calorimeter/CaloEvent - GaudiKernel - Reconstruction/MuonIdentification/muonEvent - Reconstruction/Particle - Reconstruction/egamma/egammaEvent - Trigger/TrigAnalysis/TrigEffJpsiTools - Trigger/TrigAnalysis/TrigInDetAnalysisUtils - Trigger/TrigEvent/TrigInDetEvent - Trigger/TrigEvent/TrigMuonEvent ) - -# External dependencies: -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint ) - -# Component(s) in the package: -atlas_add_library( TrigJPsiTools - src/*.cxx - PUBLIC_HEADERS TrigJPsiTools - PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES CaloEvent GaudiKernel muonEvent Particle egammaEvent TrigInDetAnalysisUtils TrigInDetEvent TrigMuonEvent - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ) - diff --git a/Trigger/TrigTools/TrigJPsiTools/TrigJPsiTools/DiMuonTool.h b/Trigger/TrigTools/TrigJPsiTools/TrigJPsiTools/DiMuonTool.h deleted file mode 100644 index a48fdf2c7924eb3afd9ada9b69c25f9a10ca5b70..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigJPsiTools/TrigJPsiTools/DiMuonTool.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef DiMuonTool_H -#define DiMuonTool_H - -// *********************************************************************** -// DiMuonTool.h -// AUTHORS: Weina Ji (weina.ji@cern.ch) -// Peter Wijeratne (paw@hep.ucl.ac.uk) -// *********************************************************************** - -#include "Particle/TrackParticle.h" -#include "TrigEffJpsiTools/ITrigEffJpsiTools.h" -#include "GaudiKernel/ToolHandle.h" - -#include "TrigJPsiTools/MuonTrackSelector.h" - -class DiMuonTool : public MuonTrackSelector -{ - public: - DiMuonTool(); - ~DiMuonTool(); - - std::vector<const Wrapper::MuonTrack*> tracks() { return m_tracks; } - - double InvariantMass(); - double CurvatureDiff(); - double pt(); - double phi(); - double eta(); - - const Wrapper::MuonTrack* TaggedTrack(); - const Wrapper::MuonTrack* ProbedTrack(); - - bool doTagAndProbe(); - void clear(); - - //Inputs given in MakeDiMuonsTool - void setTracks(std::vector<const Wrapper::MuonTrack*> tracksIn) {m_tracks=tracksIn;} - void setTracks(const Wrapper::MuonTrack* track1, const Wrapper::MuonTrack* track2) {m_tracks.push_back(track1); m_tracks.push_back(track2);} - - void setTagAndProbe(bool doTAndP) {m_doTagAndProbe=doTAndP;} - void setTrackMass(double mass) {m_trackMass=mass;} - double getTrackMass() const { return m_trackMass; } - - const std::vector<const Wrapper::MuonTrack*>& tracks() const { return m_tracks; } - - private: - - std::vector<const Wrapper::MuonTrack*> m_tracks; - - bool m_doTagAndProbe; - - double m_trackMass; -}; - - - -inline std::ostream& operator<<( std::ostream& s, const DiMuonTool& t) { - return s << "[ mass = " << t.getTrackMass() << " m_tracks size= " << t.tracks().size() << " ] "; -} - - -#endif diff --git a/Trigger/TrigTools/TrigJPsiTools/TrigJPsiTools/MakeDiMuonsTool.h b/Trigger/TrigTools/TrigJPsiTools/TrigJPsiTools/MakeDiMuonsTool.h deleted file mode 100644 index e04cd7ee568509f997cc4e0dab2b1566d5bbb2b8..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigJPsiTools/TrigJPsiTools/MakeDiMuonsTool.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef MakeDiMuonsTool_H -#define MakeDiMuonsTool_H - -// *********************************************************************** -// MakeDiMuonsTool.h -// AUTHORS: Weina Ji (weina.ji@cern.ch) -// Peter Wijeratne (paw@hep.ucl.ac.uk) -// Christian Gutschow (chris.g@cern.ch) -// *********************************************************************** -#include "TrigInDetEvent/TrigInDetTrackCollection.h" -#include "GaudiKernel/StatusCode.h" -#include "TrigEffJpsiTools/ITrigEffJpsiTools.h" -#include "GaudiKernel/ToolHandle.h" -#include "muonEvent/Muon.h" -#include "muonEvent/MuonContainer.h" -#include "muonEvent/MuonParamDefs.h" -#include "TrigJPsiTools/DiMuonTool.h" -#include "TrigJPsiTools/MuonTrackSelector.h" - -#include "TrigMuonEvent/TrigMuonEFTrack.h" -#include "TrigMuonEvent/TrigMuonEFCbTrack.h" -#include "TrigMuonEvent/TrigMuonEFInfoTrack.h" - -class MakeDiMuonsTool -{ - public: - MakeDiMuonsTool(); - virtual ~MakeDiMuonsTool(); - bool initializeTools(); - void initializeMembers(); - - void setProbes(const std::vector<const CaloCluster*>& CombinedCollection, - const std::vector<int>& roi); - void setProbes(const std::vector< const TrigMuonEFTrack*>& trksIn, - const std::vector<int>& roi); - void setProbes(const std::vector< const Rec::TrackParticle* >& trksIn); - void setProbes(const TrigInDetTrackCollection* trigCollection); - - void setTags(const Analysis::MuonContainer* muonsIn); - void setTags(const std::vector<const TrigMuonEFCbTrack*>& muonsIn, - const std::vector<int>& roi); - void setTags(const std::vector< const egamma*>& trksIn, - const std::vector<int>& roi); - - void doTagAndProbe(bool doTagAndProbe); - void useTrigger(bool useTrigger); - void setPtcut(double ptcut); - void setTagPtcut(double ptcut); - void setEtacut(double etacut); - void setTagEtacut(double etacut); - void setTrackMass(double muonmass); - void setUpperInvMassLimit(double upperlimit); - void setLowerInvMassLimit(double lowerlimit); - void makePairs(const std::vector<Wrapper::MuonTrack*>& Tracks); - void makePairs(const std::vector<Wrapper::MuonTrack*>& taggedTracks,std::vector<Wrapper::MuonTrack*> probedTracks); - std::vector<DiMuonTool*> execute(); - void TagMuons( const std::vector< const TrigMuonEFCbTrack* >& combinedCollection, - const std::vector<int>& roi ); - void TagMuons( const Analysis::MuonContainer* muonCollection ); - - bool isTriggeredEF(const Rec::TrackParticle* track, std::string chainName) const; - bool isTriggeredL2(const Rec::TrackParticle* track, std::string chainName) const; - bool isTriggeredL1(const Rec::TrackParticle* track, std::string triggerName) const; - - void clear(); - - private: - double m_ptcut; - double m_tagptcut; - double m_etacut; - double m_tagetacut; - bool m_TagAndProbe; - - //bool m_runOnline; - - bool m_useTrigger; - //double m_invmass; - double m_trkmass; - double m_upperlimit; - double m_lowerlimit; - std::vector<Wrapper::MuonTrack*> m_tracks; - const Analysis::MuonContainer* m_MuonCollection; - std::vector<const TrigMuonEFCbTrack*> m_CombinedCollection; - const TrigInDetTrackCollection* m_TrigCollection; - std::vector<Wrapper::MuonTrack*> m_taggedMuons; - std::vector<DiMuonTool*> m_pairs; - ToolHandle<ITrigEffJpsiTools> m_trigEffJpsiTools; - MuonTrackSelector m_selectaProbe; - MuonTrackSelector m_selectaTag; -}; - -#endif diff --git a/Trigger/TrigTools/TrigJPsiTools/TrigJPsiTools/MuonTrack.h b/Trigger/TrigTools/TrigJPsiTools/TrigJPsiTools/MuonTrack.h deleted file mode 100644 index cdbe208f2c4ef1255ddaf8e91169913bad5c3d4b..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigJPsiTools/TrigJPsiTools/MuonTrack.h +++ /dev/null @@ -1,151 +0,0 @@ -// emacs: this is -*- c++ -*- - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// File name: MuonTrack.h -// Description: General muon track class -// Author: Peter Wijeratne (paw@hep.ucl.ac.uk) - -#ifndef MUONTRACK_H -#define MUONTRACK_H - -#include <iostream> -#include <string> - -#include "Particle/TrackParticle.h" - -namespace Wrapper{ - - class MuonTrack - { - - public: - - MuonTrack() { ; } - MuonTrack(double eta, double phi, double z0, double a0, double pT, - double px, double py, double pz, double charge, double chi2, double chi2prob, - double deta, double dphi, double dz0, double da0, double dpT, - int nCscHitsEta=0, int nCscHitsPhi=0, int nTgcHitsEta=0, int nTgcHitsPhi=0, - int nRpcHitsEta=0, int nRpcHitsPhi=0, int nMdtHits=0, - unsigned hitPattern=0, - unsigned multiPattern=0, - int author=0, - const Rec::TrackParticle* match=0, - int roiNum=0) : - m_eta(eta), m_phi(phi), m_z0(z0), m_a0(a0), m_pT(pT), - m_px(px), m_py(py), m_pz(pz), m_charge(charge), m_chi2(chi2), m_chi2prob(chi2prob), - m_deta(deta), m_dphi(dphi), m_dz0(dz0), m_da0(da0), m_dpT(dpT), - m_nCscHitsEta(nCscHitsEta), m_nCscHitsPhi(nCscHitsPhi), m_nTgcHitsEta(nTgcHitsEta), m_nTgcHitsPhi(nTgcHitsPhi), - m_nRpcHitsEta(nRpcHitsEta), m_nRpcHitsPhi(nRpcHitsPhi), m_nMdtHits(nMdtHits), - m_hitPattern(hitPattern), - m_multiPattern(multiPattern), - m_author(author), - m_match(match), - m_roiNum(roiNum) - {} - - virtual ~MuonTrack() { ; } - - double eta() const { return m_eta; } - double phi() const { return m_phi; } - double z0() const { return m_z0; } - double a0() const { return m_a0; } - double pt() const { return m_pT; } - double px() const { return m_px; } - double py() const { return m_py; } - double pz() const { return m_pz; } - - double charge() const { return m_charge; } - - double chi2() const {return m_chi2;} - double chi2prob() const { return m_chi2prob; } - - double deta() const {return m_deta;} - double dphi() const {return m_dphi;} - double dz0() const {return m_dz0;} - double da0() const {return m_da0;} - double dpT() const {return m_dpT;} - - int nCscHitsPhi() const { return m_nCscHitsPhi; } - int nTgcHitsEta() const { return m_nTgcHitsEta; } - int nTgcHitsPhi() const { return m_nTgcHitsPhi; } - int nCscHitsEta() const { return m_nCscHitsEta; } - int nRpcHitsEta() const {return m_nRpcHitsEta;} - int nRpcHitsPhi() const {return m_nRpcHitsPhi;} - int nMdtHits() const { return m_nMdtHits; } - - unsigned hitPattern() const { return m_hitPattern; } - unsigned multiPattern() const { return m_multiPattern; } - - int author() const { return m_author; } - - const Rec::TrackParticle* match() const { return m_match; } - - int roiNum() const { return m_roiNum; } - - public: - - bool operator==(const MuonTrack& t) { - - if( m_author != t.m_author ) return false; - - if( m_eta != t.m_eta ) return false; - if( m_phi != t.m_phi ) return false; - if( m_z0 != t.m_z0 ) return false; - if( m_a0 != t.m_a0 ) return false; - if( m_pT != t.m_pT ) return false; - - if( m_nCscHitsEta != t.m_nCscHitsEta ) return false; - if( m_nCscHitsPhi != t.m_nCscHitsPhi ) return false; - if( m_nTgcHitsEta != t.m_nTgcHitsEta ) return false; - if( m_nTgcHitsPhi != t.m_nTgcHitsPhi ) return false; - if( m_nRpcHitsEta != t.m_nRpcHitsEta ) return false; - if( m_nRpcHitsPhi != t.m_nRpcHitsPhi ) return false; - if ( m_hitPattern != t.m_hitPattern ) return false; - if ( m_multiPattern != t.m_multiPattern ) return false; - - return true; - } - - protected: - - // Track parameters - double m_eta, m_phi, m_z0, m_a0, m_pT, m_px, m_py, m_pz, m_charge, m_chi2, m_chi2prob; - double m_deta, m_dphi, m_dz0, m_da0, m_dpT; - - // Track hits - int m_nCscHitsEta, m_nCscHitsPhi, m_nTgcHitsEta, m_nTgcHitsPhi; - int m_nRpcHitsEta, m_nRpcHitsPhi; - int m_nMdtHits; - - // hit bit pattern - unsigned m_hitPattern; - unsigned m_multiPattern; - - //Track author; - int m_author; - - //matched - const Rec::TrackParticle* m_match; - - //roi number - int m_roiNum; - - }; - -} - -inline std::ostream& operator<<( std::ostream& s, const Wrapper::MuonTrack& t) { - return s<< "[ " - << "\teta=" << t.eta() - << "\tphi=" << t.phi() - << "\tz0=" << t.z0() - << "\tpT=" << t.pt() - << "\td0=" << t.a0() - << "\thp=0x" << std::hex << t.hitPattern() << std::dec << " " - << " ]"; -} - -#endif diff --git a/Trigger/TrigTools/TrigJPsiTools/TrigJPsiTools/MuonTrackAdder.h b/Trigger/TrigTools/TrigJPsiTools/TrigJPsiTools/MuonTrackAdder.h deleted file mode 100644 index cbf6846bd72b65c1b17aa4a2f66f79c504f555b8..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigJPsiTools/TrigJPsiTools/MuonTrackAdder.h +++ /dev/null @@ -1,43 +0,0 @@ -// emacs: this is -*- c++ -*- - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// file name: MuonTrackAdder.h -// description: Add muon tracks to member vector -// author: Peter Wijeratne (paw@hep.ucl.ac.uk) - -#ifndef MUONTRACKADDER_H -#define MUONTRACKADDER_H - -#include "TrigJPsiTools/MuonTrack.h" - -#include <vector> - -class MuonTrackAdder{ - - public: - - MuonTrackAdder() { } - virtual ~MuonTrackAdder() { } - - virtual bool muonAdder( Wrapper::MuonTrack* t ) { - if( t ){ - m_tracks.push_back(t); - return true; - } - else return false; - } - - const std::vector< Wrapper::MuonTrack* >& tracks() const { return m_tracks; } - - virtual void clear() { for(unsigned i=0; i--; ) delete m_tracks[i]; m_tracks.clear(); } - -protected: - - std::vector<Wrapper::MuonTrack*> m_tracks; - -}; - -#endif diff --git a/Trigger/TrigTools/TrigJPsiTools/TrigJPsiTools/MuonTrackSelector.h b/Trigger/TrigTools/TrigJPsiTools/TrigJPsiTools/MuonTrackSelector.h deleted file mode 100644 index e691eae4680e127138b4a47e46e0ead252d63bdd..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigJPsiTools/TrigJPsiTools/MuonTrackSelector.h +++ /dev/null @@ -1,371 +0,0 @@ -// emacs: this is -*- c++ -*- - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// file name: MuonTrackSelector.h -// description: Take input tracks and wrap in generic track object -// author: Peter Wijeratne (paw@hep.ucl.ac.uk) - -#ifndef MUONTRACKSELECTOR_H -#define MUONTRACKSELECTOR_H - -// L2 tracks -#include "TrigInDetEvent/TrigInDetTrack.h" - -// offline and EF -#include "Particle/TrackParticle.h" - -// online EF muons -#include "TrigMuonEvent/TrigMuonEFTrack.h" -#include "TrigMuonEvent/TrigMuonEFCbTrack.h" -#include "CaloEvent/CaloCluster.h" - -#include "egammaEvent/egamma.h" - -// TrigJpsiTool classes -#include "TrigJPsiTools/MuonTrackAdder.h" - - -class MuonTrackSelector : public MuonTrackAdder { - - public: - - MuonTrackSelector () : MuonTrackAdder() { } - ~MuonTrackSelector () { } - - virtual void cleanup() { - - for (int i=m_tracks.size(); i--; ){ - delete m_tracks[i]; - } - m_tracks.clear(); - - } - - void muonSelector(const egamma* track, int roi) { - - if( track ) { - double pT = track->pt(); - double eta = track->eta(); - double phi = track->phi(); - double z0 = 0;//track->z0(); - double d0 = 0;//track->d0(); - - double px = track->px(); - double py = track->py(); - double pz = track->pz(); - - double charge = track->charge(); - - double deta = 1; - double dphi = 1; - double dz0 = 1; - double dd0 = 1; - double dpT = 1; - - double chi2 = 0; - double chi2prob = 0; - - int nCscHitsEta = 0; - int nCscHitsPhi = 0; - int nTgcHitsEta = 0; - int nTgcHitsPhi = 0; - int nRpcHitsEta = 0; - int nRpcHitsPhi = 0; - int nMdtHits = 0; - - unsigned bitmap = 0; - unsigned trackAuthor = 0; - - Wrapper::MuonTrack* muon = new Wrapper::MuonTrack(eta, phi, z0, d0, pT, - px, py, pz, charge, chi2, chi2prob, - deta, dphi, dz0, dd0, dpT, - nCscHitsEta, nCscHitsPhi, nTgcHitsEta, nTgcHitsPhi, - nRpcHitsEta, nRpcHitsPhi, nMdtHits, - bitmap, 0, trackAuthor, NULL, roi); - - if ( !muonAdder( muon ) ) delete muon; - - } - } - - void muonSelector(const CaloCluster* track, int roi=0) { - - if( track ) { - - double pT = track->pt(); - double eta = track->eta(); - double phi = track->phi(); - double z0 = 0;//track->z0(); - double d0 = 0;//track->d0(); - - double px = track->px(); - double py = track->py(); - double pz = track->pz(); - - double charge = 1.; - - if( pT < 0 ) { - pT *= -1; - charge *= -1; - } - - double deta = 1; - double dphi = 1; - double dz0 = 1; - double dd0 = 1; - double dpT = 1; - - double chi2 = 0; - double chi2prob = 0; - - int nCscHitsEta = 0; - int nCscHitsPhi = 0; - int nTgcHitsEta = 0; - int nTgcHitsPhi = 0; - int nRpcHitsEta = 0; - int nRpcHitsPhi = 0; - int nMdtHits = 0; - - unsigned bitmap = 0; - unsigned trackAuthor = 0; - - Wrapper::MuonTrack* muon = new Wrapper::MuonTrack(eta, phi, z0, d0, pT, - px, py, pz, charge, chi2, chi2prob, - deta, dphi, dz0, dd0, dpT, - nCscHitsEta, nCscHitsPhi, nTgcHitsEta, nTgcHitsPhi, - nRpcHitsEta, nRpcHitsPhi, nMdtHits, - bitmap, 0, trackAuthor, NULL, roi); - - if ( !muonAdder( muon ) ) delete muon; - - } - } - - void muonSelector( const TrigMuonEFTrack* track, const Rec::TrackParticle* match=0, int roi=0){ - - if( track ){ - - // std::cout << "ZZZ roi = " << roi << std::endl; - - double pT = track->pt(); - double eta = track->eta(); - double phi = track->phi(); - double z0 = track->z0(); - double d0 = track->d0(); - - double px = track->px(); - double py = track->py(); - double pz = track->pz(); - - double charge = track->charge(); - - if ( pT < 0 ) pT *= -1; - - double deta = 1; - double dphi = 1; - double dz0 = 1; - double dd0 = 1; - double dpT = 1; - - double chi2 = track->chi2(); - double chi2prob = track->chi2prob(); - - // Check number of hits - // NB: a spacepoint is two offline "hits", so a pixel spacepoint is really - // 2 "hits" and an offline SCT "hit" is really a 1D cluster, so two intersetcting - // stereo clusters making a spacepoint are two "hits" - - int nCscHitsEta = track->NCscHitsEta(); - int nCscHitsPhi = track->NCscHitsPhi(); - int nTgcHitsEta = track->NTgcHitsEta(); - int nTgcHitsPhi = track->NTgcHitsPhi(); - int nRpcHitsEta = track->NRpcHitsEta(); - int nRpcHitsPhi = track->NRpcHitsPhi(); - int nMdtHits = track->NMdtHits(); - - unsigned bitmap = 0; - unsigned trackAuthor = 0; - -#if 0 - std::cout << "\t\t\tPAW MUON track" - << "\teta=" << eta // << " +- " << (*trackitr)->params()->deta() - << "\tphi=" << phi // << " +- " << (*trackitr)->params()->dphi() - << "\tz0=" << z0 - << "\tpT=" << pT // << "\t( " << 1/qoverp << ")" - << "\td0=" << d0 - << "\tNCsc=" << nCscHitsEta - << "\tNTgc=" << nTgcHitsEta - << "\tNRpc=" << nRpcHitsEta - << std::endl; - - // Create and save Track -#endif - - Wrapper::MuonTrack* muon = new Wrapper::MuonTrack(eta, phi, z0, d0, pT, - px, py, pz, charge, chi2, chi2prob, - deta, dphi, dz0, dd0, dpT, - nCscHitsEta, nCscHitsPhi, nTgcHitsEta, nTgcHitsPhi, - nRpcHitsEta, nRpcHitsPhi, nMdtHits, - bitmap, 0, - trackAuthor, match, roi); - - if ( !muonAdder( muon ) ) delete muon; - - } - - } - - void muonSelector( const Rec::TrackParticle* track ){ - - if( track ){ - - const Trk::Perigee* measPer = track->measuredPerigee(); - - double pT = measPer->pT(); - double eta = measPer->eta(); - double phi = measPer->parameters()[Trk::phi0]; - double z0 = measPer->parameters()[Trk::z0]; - double d0 = measPer->parameters()[Trk::d0]; - - double px = track->px(); - double py = track->py(); - double pz = track->pz(); - - double charge = track->charge(); - - if ( measPer->parameters()[Trk::qOverP]<0 ) pT *= -1; - - double deta = 1; - double dphi = 1; - double dz0 = 1; - double dd0 = 1; - double dpT = 1; - - double chi2 = 0; - - // Check number of hits - // NB: a spacepoint is two offline "hits", so a pixel spacepoint is really - // 2 "hits" and an offline SCT "hit" is really a 1D cluster, so two intersetcting - // stereo clusters making a spacepoint are two "hits" - const Trk::TrackSummary* summary = track->trackSummary(); - int nBlayerHits = 2*summary->get(Trk::numberOfInnermostPixelLayerHits); - int nPixelHits = 2*summary->get(Trk::numberOfPixelHits); - int nSctHits = summary->get(Trk::numberOfSCTHits); - int nStrawHits = summary->get(Trk::numberOfTRTHits); - int nTrHits = summary->get(Trk::numberOfTRTHighThresholdHits); - - int nSiHits = nPixelHits + nSctHits; - - unsigned bitmap = 0; - - int fitter = track->info().trackFitter(); - std::string dumpinfo = track->info().dumpInfo(); - - int trackAuthor = -1; - if ( fitter>0 && fitter<Trk::TrackInfo::NumberOfTrackFitters ) { - if ( dumpinfo.find("TRTStandalone")!=std::string::npos) trackAuthor = 2; - else if ( dumpinfo.find("TRTSeededTrackFinder")!=std::string::npos) trackAuthor = 1; - else trackAuthor = 0; - } - -#if 0 - std::cout << "\t\t\tPAW MUON track" - << "\teta=" << eta // << " +- " << (*trackitr)->params()->deta() - << "\tphi=" << phi // << " +- " << (*trackitr)->params()->dphi() - << "\tz0=" << z0 - << "\tpT=" << pT // << "\t( " << 1/qoverp << ")" - << "\td0=" << d0 - << "\tNsi=" << nSiHits - << "\tNtrt=" << nTrHits - << "\tNstr=" << nStrawHits - << "\tauthor=" << trackAuthor - << std::endl; -#endif - // Create and save Track - - Wrapper::MuonTrack* muon = new Wrapper::MuonTrack(eta, phi, z0, d0, pT, - px, py, pz, charge, chi2, - deta, dphi, dz0, dd0, dpT, - nBlayerHits, nPixelHits, nSctHits, nSiHits, - nStrawHits, nTrHits, bitmap, 0, - trackAuthor); - - if ( !muonAdder( muon ) ) delete muon; - - } - - } - - void muonSelector( const TrigInDetTrack* track ) { - // do the track extraction stuff here.... - if ( track ) { - - double eta = track->param()->eta(); - double phi = track->param()->phi0(); - double z0 = track->param()->z0(); - double pT = track->param()->pT(); - double d0 = track->param()->a0(); - - double deta = track->param()->eeta(); - double dphi = track->param()->ephi0(); - double dz0 = track->param()->ez0(); - double dpT = track->param()->epT(); - double dd0 = track->param()->ea0(); - - int algoid = track->algorithmId(); - - int nBlayerHits = (track->HitPattern() & 0x1); - int nPixelHits = 2 * track->NPixelSpacePoints(); // NB: for comparison with offline - int nSctHits = 2 * track->NSCT_SpacePoints(); // a spacepoint is 2 "hits" - int nStrawHits = track->NStrawHits(); - int nTrHits = track->NTRHits(); - - int nSiHits = nPixelHits + nSctHits; - - unsigned hitPattern = track->HitPattern(); - unsigned multiPattern = 0; - - double chi2 = track->chi2(); - // The DoF information is not available in LVL2 track EDM - - // if ( (*trackitr)->siSpacePoints() ) { - // NSiHits = (*trackitr)->siSpacePoints()->size(); - // if ( (*trackitr)->siSpacePoints()->at(0)->layer()==0 ) NBLayerHits=1; - // } - - // std::cout << "testing trigger track " << (*trackitr) << std::endl; - -#if 0 - std::cout << "\t\t\tSUTT ID track" - << "\teta=" << eta // << " +- " << (*trackitr)->params()->deta() - << "\tphi=" << phi // << " +- " << (*trackitr)->params()->dphi() - << "\tz0=" << z0 - << "\tpT=" << pT // << "\t( " << 1/qoverp << ")" - << "\td0=" << d0 - << "\tNtrt=" << nTrHits - << "\tNstr=" << nStrawHits - << "\tid=" << algoid - << "\thp=0x" << std::hex << track->HitPattern() << std::dec - << std::endl; -#endif - - Wrapper::MuonTrack* muon = new Wrapper::MuonTrack( eta, phi, z0, d0, pT, chi2, - deta, dphi, dz0, dd0, dpT, - nBlayerHits, nPixelHits, nSctHits, nSiHits, - nStrawHits, nTrHits, - hitPattern, multiPattern, - algoid ) ; - - // std::cout << "SUTT ID track " << *t << "\t0x" << std::hex << track->HitPattern() << std::dec << std::endl; - - if ( !muonAdder( muon ) ) delete muon; - - } - } - -}; - -#endif diff --git a/Trigger/TrigTools/TrigJPsiTools/src/DiMuonTool.cxx b/Trigger/TrigTools/TrigJPsiTools/src/DiMuonTool.cxx deleted file mode 100644 index 2fe75f9b082ced0eb3e244b6e8c3c0c21218c6a5..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigJPsiTools/src/DiMuonTool.cxx +++ /dev/null @@ -1,139 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// *********************************************************************** -// DiMuonTool.cxx -// Creates an object holding a pair of tracks - -// AUTHORS: Weina Ji (weina.ji@cern.ch) -// Peter Wijeratne (paw@hep.ucl.ac.uk) -// *********************************************************************** - -#include "TLorentzVector.h" -#include "TrigJPsiTools/DiMuonTool.h" - -#include "TrigMuonEvent/TrigMuonEFTrack.h" -#include "TrigMuonEvent/TrigMuonEFCbTrack.h" - -DiMuonTool::DiMuonTool() -{ - - m_doTagAndProbe=false; - m_trackMass = 105.66*CLHEP::MeV; - m_tracks.clear(); - -} - -DiMuonTool::~DiMuonTool() { } - -const Wrapper::MuonTrack* DiMuonTool::TaggedTrack() { - /*std::cout << "DiMuonTool::TaggedTrack -- m_tracks size: " << m_tracks.size() << std::endl; - std::cout << "DiMuonTool::TaggedTrack -- m_tracks[0]: " << m_tracks[0] << std::endl; - std::cout << "DiMuonTool::TaggedTrack -- m_tracks[1]: " << m_tracks[1] << std::endl; - std::cout << "DiMuonTool::TaggedTrack -- return m_tracks[0]" << std::endl;*/ - return m_tracks[0]; -} - -const Wrapper::MuonTrack* DiMuonTool::ProbedTrack() { - /*std::cout << "DiMuonTool::ProbedTrack -- m_tracks size: " << m_tracks.size() << std::endl; - std::cout << "DiMuonTool::ProbedTrack -- m_tracks[0]: " << m_tracks[0] << std::endl; - std::cout << "DiMuonTool::ProbedTrack -- m_tracks[1]: " << m_tracks[1] << std::endl; - std::cout << "DiMuonTool::ProbedTrack -- return m_tracks[1]" << std::endl;*/ - return m_tracks[1]; -} - -bool DiMuonTool::doTagAndProbe() {return m_doTagAndProbe;} -double DiMuonTool::InvariantMass() { - double invmass; - TLorentzVector particle1,particle2,v; - - if (m_tracks.size()==2) { - const Wrapper::MuonTrack* track1=m_tracks[0]; - const Wrapper::MuonTrack* track2=m_tracks[1]; - double Mass = m_trackMass; - particle1.SetPtEtaPhiE(track1->pt(),track1->eta(),track1->phi(),sqrt(pow(Mass,2)+pow(track1->px(),2)+pow(track1->py(),2)+pow(track1->pz(),2))); - particle2.SetPtEtaPhiE(track2->pt(),track2->eta(),track2->phi(),sqrt(pow(Mass,2)+pow(track2->px(),2)+pow(track2->py(),2)+pow(track2->pz(),2))); - v=particle1+particle2; - invmass = v.Mag(); - } - else invmass=0; - - return invmass; //CLHEP::MeV -} - -double DiMuonTool::pt() { - double transmom; - - if (m_tracks.size()==2) { - const Wrapper::MuonTrack* track1=m_tracks[0]; - const Wrapper::MuonTrack* track2=m_tracks[1]; - double px = track1->px()+track2->px(); - double py = track1->py()+track2->py(); - transmom=sqrt(px*px+py*py); - } - else transmom=0; - - return transmom; //CLHEP::MeV -} - -double DiMuonTool::eta() { - double eta; - - if (m_tracks.size()==2) { - const Wrapper::MuonTrack* track1=m_tracks[0]; - const Wrapper::MuonTrack* track2=m_tracks[1]; - - double px=track1->px()+track2->px(); - double py = track1->py()+track2->py(); - double pz = track1->pz()+track2->pz(); - double p=sqrt(px*px+py*py+pz*pz); - eta=0.5*log((p+pz)/(p-pz)); - } - else eta=0; - - return eta; -} - -double DiMuonTool::phi() { - double phi; - - if (m_tracks.size()==2) { - const Wrapper::MuonTrack* track1=m_tracks[0]; - const Wrapper::MuonTrack* track2=m_tracks[1]; - - double px = track1->px()+track2->px(); - double py = track1->py()+track2->py(); - double p=sqrt(px*px+py*py); - phi=acos(px/p); - if (py<0.) phi=-1.*phi; - } - else phi=0; - - return phi; -} - -double DiMuonTool::CurvatureDiff() { - double asym; - - if (m_tracks.size()==2) { - const Wrapper::MuonTrack* track1=m_tracks[0]->charge()>0?m_tracks[0]:m_tracks[1]; - const Wrapper::MuonTrack* track2=m_tracks[1]->charge()>0?m_tracks[1]:m_tracks[0]; - - double qoverpt1=track1->charge()/track1->pt(); - double qoverpt2=track2->charge()/track2->pt(); - asym=fabs(qoverpt1)-fabs(qoverpt2); - } - else asym=0; - - return asym; //[CLHEP::MeV]^-1 -} - -void DiMuonTool::clear() -{ - m_doTagAndProbe=false; - m_trackMass = 105.66*CLHEP::MeV; - for(unsigned i=0; i--; ) delete m_tracks[i]; - m_tracks.clear(); - -} diff --git a/Trigger/TrigTools/TrigJPsiTools/src/MakeDiMuonsTool.cxx b/Trigger/TrigTools/TrigJPsiTools/src/MakeDiMuonsTool.cxx deleted file mode 100644 index 134ecda8ebbaa193569989b656be74a8016504ba..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigJPsiTools/src/MakeDiMuonsTool.cxx +++ /dev/null @@ -1,285 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// *********************************************************************** -// MakeDiMuonsTool.cxx -// Returns a vector of DiMuon objects from input tracks. -// Possible to switch on/off tag-and-probe method. - -// AUTHORS: Weina Ji (weina.ji@cern.ch) -// Peter Wijeratne (paw@hep.ucl.ac.uk) -// Christian Gutschow (chris.g@cern.ch) -// *********************************************************************** - -#include "TrigJPsiTools/MakeDiMuonsTool.h" -#include "Particle/TrackParticleContainer.h" -#include "Particle/TrackParticle.h" -#include "TLorentzVector.h" - -#include "TrigMuonEvent/TrigMuonEFTrack.h" -#include "TrigMuonEvent/TrigMuonEFCbTrack.h" -#include "TrigMuonEvent/TrigMuonEFInfoTrack.h" - -#include <stdexcept> - -MakeDiMuonsTool::MakeDiMuonsTool() - :m_trigEffJpsiTools("TrigEffJpsiTools") -{ - m_ptcut=0*CLHEP::GeV; - m_tagptcut=0*CLHEP::GeV; - m_etacut=999; - m_tagetacut=999; - m_TagAndProbe=false; - m_useTrigger=false; - // m_trkmass = 105.66*CLHEP::MeV; - m_trkmass=0.511*CLHEP::MeV; - m_tracks.clear(); - m_pairs.clear(); - m_MuonCollection=0; - m_TrigCollection=0; - m_upperlimit = 99999; - m_lowerlimit = -99999; - m_taggedMuons.clear(); - m_selectaProbe.cleanup(); - m_selectaTag.cleanup(); -} - -MakeDiMuonsTool::~MakeDiMuonsTool() { } - -bool MakeDiMuonsTool::initializeTools() -{ - if(m_trigEffJpsiTools.retrieve().isFailure()) return false; - else return true; -} - -void MakeDiMuonsTool::initializeMembers() -{ - m_ptcut=0*CLHEP::GeV; - m_tagptcut=0*CLHEP::GeV; - m_etacut=999; - m_tagetacut=999; - m_TagAndProbe=false; - m_useTrigger=false; - //m_trkmass = 105.66*CLHEP::MeV; - m_trkmass=0.511*CLHEP::MeV; - m_tracks.clear(); - for(std::vector<Wrapper::MuonTrack*>::const_iterator it = m_tracks.begin(); it != m_tracks.end(); it++){ - delete (*it); - } - m_pairs.clear(); - m_MuonCollection=0; - m_TrigCollection=0; - m_upperlimit = 999; - m_lowerlimit = -999; - m_taggedMuons.clear(); - m_selectaProbe.cleanup(); - m_selectaTag.cleanup(); -} - -// input tracks, cuts or turn on tag-and-probe - -void MakeDiMuonsTool::setProbes(const std::vector<const TrigMuonEFTrack*>& trksIn, - const std::vector<int>& roi) { - for( unsigned i=0; i<trksIn.size(); ++i ) m_selectaProbe.muonSelector( trksIn[i], NULL, roi[i] ); - m_tracks = m_selectaProbe.tracks(); -} - -void MakeDiMuonsTool::setProbes(const std::vector<const CaloCluster*>& CombinedCollection, - const std::vector<int>& roi) { - for( unsigned i=0; i<CombinedCollection.size(); ++i ) m_selectaProbe.muonSelector( CombinedCollection[i], roi[i] ); - m_tracks = m_selectaProbe.tracks(); -} - -void MakeDiMuonsTool::setProbes(const std::vector<const Rec::TrackParticle*>& trksIn) { - for( unsigned i=0; i<trksIn.size(); ++i ) m_selectaProbe.muonSelector( trksIn[i] ); - m_tracks = m_selectaProbe.tracks(); -} - -void MakeDiMuonsTool::setProbes( const TrigInDetTrackCollection* trigCollection ){ - TrigInDetTrackCollection::const_iterator tIt = trigCollection->begin(); - TrigInDetTrackCollection::const_iterator tLast = trigCollection->end(); - while(tIt != tLast){ - m_selectaProbe.muonSelector( *tIt ); - tIt++; - } - m_tracks = m_selectaTag.tracks(); - -} - - -void MakeDiMuonsTool::setTags( const Analysis::MuonContainer* MuonCollection) { - m_MuonCollection = MuonCollection; - TagMuons(m_MuonCollection); -} - -void MakeDiMuonsTool::setTags( const std::vector< const TrigMuonEFCbTrack* >& CombinedCollection, - const std::vector<int>& roiNums ){ - m_CombinedCollection = CombinedCollection; - TagMuons(m_CombinedCollection, roiNums); -} - -void MakeDiMuonsTool::doTagAndProbe(bool doTagAndProbe) {m_TagAndProbe = doTagAndProbe;} -void MakeDiMuonsTool::useTrigger(bool useTrigger) {m_useTrigger=useTrigger;} -void MakeDiMuonsTool::setPtcut(double ptcut) {m_ptcut = ptcut;} -void MakeDiMuonsTool::setTagPtcut(double ptcut) {m_tagptcut = ptcut;} -void MakeDiMuonsTool::setEtacut(double etacut) {m_etacut=etacut;} -void MakeDiMuonsTool::setTagEtacut(double etacut) {m_tagetacut=etacut;} -void MakeDiMuonsTool::setTrackMass(double muonmass) {m_trkmass=muonmass;} -void MakeDiMuonsTool::setUpperInvMassLimit(double upperlimit) {m_upperlimit=upperlimit;} -void MakeDiMuonsTool::setLowerInvMassLimit(double lowerlimit) {m_lowerlimit=lowerlimit;} - -void MakeDiMuonsTool::TagMuons( const Analysis::MuonContainer* muonCollection ){ - Analysis::MuonContainer::const_iterator muonItr; - for (muonItr=muonCollection->begin(); muonItr != muonCollection->end(); ++muonItr) - { - if ((*muonItr)->hasInDetTrackParticle()) { - if (m_TagAndProbe) { - if (m_useTrigger && m_trigEffJpsiTools->isTriggeredMuon( (*muonItr)->inDetTrackParticle(),1)) { - m_selectaTag.muonSelector( (*muonItr)->inDetTrackParticle()); - } - else if (!m_useTrigger && (*muonItr)->isCombinedMuon()) { - m_selectaTag.muonSelector( (*muonItr)->inDetTrackParticle()); - } - } - } - } - - m_taggedMuons = m_selectaTag.tracks(); - -} - -void MakeDiMuonsTool::TagMuons( const std::vector<const TrigMuonEFCbTrack*>& combinedCollection, - const std::vector<int>& roiNums ){ - std::vector<const TrigMuonEFCbTrack*>::const_iterator tagItr; - if (!combinedCollection.empty()){ - int i = 0; - for (tagItr=combinedCollection.begin(); tagItr!=combinedCollection.end();++tagItr){ - if ( (*tagItr) ){ - if (m_TagAndProbe){ - m_selectaTag.muonSelector( (*tagItr), NULL, roiNums[i] ); - } - } - i++; - } - } - - m_taggedMuons = m_selectaTag.tracks(); - -} - -void MakeDiMuonsTool::setTags(const std::vector<const egamma*>& trksIn, - const std::vector<int>& roi) { - for(unsigned int i=0; i < trksIn.size(); ++i) { - if(trksIn[i] && m_TagAndProbe) { - m_selectaTag.muonSelector(trksIn[i], roi[i]); - } - } - m_taggedMuons = m_selectaTag.tracks(); -} - -//Execute -std::vector<DiMuonTool*> MakeDiMuonsTool::execute() -{ - if (m_TagAndProbe) makePairs(m_taggedMuons,m_tracks); - else makePairs(m_tracks); - return m_pairs; -} -void MakeDiMuonsTool::makePairs(const std::vector<Wrapper::MuonTrack*>& Tracks){ - std::vector<Wrapper::MuonTrack*>::const_iterator track1; - std::vector<Wrapper::MuonTrack*>::const_iterator track2; - if(Tracks.size()>=2){ - for(track1=Tracks.begin();track1<Tracks.end();track1++){ - for(track2=(track1+1);track2!=Tracks.end();track2++){ - if ((*track1)->pt()/CLHEP::GeV>(m_ptcut/CLHEP::GeV) && (fabs((*track1)->eta())<m_etacut)) - if ((*track2)->pt()/CLHEP::GeV>(m_ptcut/CLHEP::GeV) && (fabs((*track2)->eta())<m_etacut)) - if (((*track1)->charge()*(*track2)->charge())<0) { - DiMuonTool* dimuon = new DiMuonTool(); - dimuon->setTrackMass(m_trkmass); - dimuon->setTagAndProbe(m_TagAndProbe); - if ((*track1)->charge()>0){ - dimuon->setTracks(*track1,*track2); - } - if ((*track2)->charge()>0){ - dimuon->setTracks(*track2,*track1); - } - if ( dimuon->InvariantMass()<m_upperlimit && dimuon->InvariantMass()>m_lowerlimit ) - { - m_pairs.push_back(dimuon); - } - else delete dimuon; - } - } - } - } -} //Muons(+,-) - -void MakeDiMuonsTool::makePairs(const std::vector<Wrapper::MuonTrack*>& taggedTracks,std::vector<Wrapper::MuonTrack*> probedTracks) { - //std::cout << "JPSI TOOLS -- makePair sizes - tag: " << taggedTracks.size() << " and probe:" << probedTracks.size() << std::endl; - std::vector<Wrapper::MuonTrack*>::const_iterator tagItr; - std::vector<Wrapper::MuonTrack*>::const_iterator probeItr; - if(taggedTracks.size()>=1 && probedTracks.size()>=1 ) { - for(tagItr=taggedTracks.begin();tagItr!=taggedTracks.end();tagItr++) { - //std::cout << "tag pt: " << (*tagItr)->pt() << " cut: " << m_tagptcut << std::endl; - //std::cout << "tag eta: " << (*tagItr)->eta() << " cut: " << m_tagetacut << std::endl; - if((*tagItr)->pt() > m_tagptcut && fabs((*tagItr)->eta()) < m_tagetacut) { - for(probeItr=probedTracks.begin();probeItr!=probedTracks.end();probeItr++) { - //std::cout << "probe pt: " << (*probeItr)->pt() << " cut: " << m_ptcut << std::endl; - //std::cout << "probe eta: " << (*probeItr)->eta() << " cut: " << m_etacut << std::endl; - if((*probeItr)->pt()/CLHEP::GeV>(m_ptcut/CLHEP::GeV) && (fabs((*probeItr)->eta())<m_etacut)) { - //std::cout << "probe charge: " << (*probeItr)->charge() << " tag charge: " << (*tagItr)->charge() << std::endl; - //if(((*tagItr)->charge()*(*probeItr)->charge())<0) { //!!!!!!!!!!!!!!!!!!!!!!!!!!!! <----- !!!!! - DiMuonTool* dimuon = new DiMuonTool(); - dimuon->setTrackMass(m_trkmass); - dimuon->setTagAndProbe(m_TagAndProbe); - dimuon->setTracks(*tagItr,*probeItr); - //std::cout << "mass : " << dimuon->InvariantMass()<< " upper/lower limit: " << m_upperlimit << " , " << m_lowerlimit << std::endl; - if( dimuon->InvariantMass()<m_upperlimit && dimuon->InvariantMass()>m_lowerlimit) { - //std::cout << "Winning probe pt " << (*probeItr)->pt()/CLHEP::GeV << " eta " << (*probeItr)->eta()/CLHEP::GeV - //<< "\nWinning tag pt " << (*tagItr)->pt()/CLHEP::GeV << " eta " << (*tagItr)->eta()/CLHEP::GeV - //<< std::endl; - m_pairs.push_back(dimuon); - } - else { - //std::cout << "FAILED at invmass cut with invmass " << dimuon->InvariantMass() << std::endl; - delete dimuon; - } - //} //else std::cout << "FAILED at charge cut." << std::endl; - } //else std::cout << "FAILED at probe pt or eta cut. " << std::endl; - } - } //else std::cout << "FAILED at tag pt or eta cut. " << std::endl; - } - } - // return(myPairs); -} //Muons(tag,probe) - -bool MakeDiMuonsTool::isTriggeredEF(const Rec::TrackParticle* track,std::string chainName) const { - if (m_useTrigger) return m_trigEffJpsiTools->isTriggeredMuonEF(track, chainName); - else return false; -} - - -bool MakeDiMuonsTool::isTriggeredL2(const Rec::TrackParticle* track,std::string chainName) const { - if (m_useTrigger) return m_trigEffJpsiTools->isTriggeredMuonL2(track, chainName); - else return false; -} - -bool MakeDiMuonsTool::isTriggeredL1(const Rec::TrackParticle* track,std::string triggerName) const { - if (m_useTrigger) return m_trigEffJpsiTools->isTriggeredMuonL1(track, triggerName); - else return false; -} - -void MakeDiMuonsTool::clear(){ - - m_selectaProbe.cleanup(); - m_selectaTag.cleanup(); - m_tracks.clear(); - m_taggedMuons.clear(); - m_CombinedCollection.clear(); - for(std::vector<DiMuonTool*>::const_iterator it = m_pairs.begin(); it != m_pairs.end(); it++){ - (*it)->clear(); - delete (*it); - } - m_pairs.clear(); - -}