#ifndef _MuonVariables_HH_ #define _MuonVariables_HH_ 1 //////////////////////////////////////////////////////////////////// // File: MuonVariables.hh // Authors: Abe Debenedetti, Henry Frisch // Purpose: High level analysis muon variables defined as functions // Created: 7/26/2001 from Vladimir's start // // Revision: (none so far) // // //////////////////////////////////////////////////////////////////// #include "MuonObjects/CdfMuon.hh" #include "Muon/MuonFiducialTool.hh" #include "TrackingObjects/Tracks/CdfTrack.hh" #include "CLHEP/Vector/LorentzVector.h" #include "Extrapolator/MExtrapolator.hh" #include "VertexObjects/VertexColl.hh" //#include "CalorGeometry/CalConstants.hh" //#include "CalorObjects/Pes2dCluster.hh" //#include "CalorObjects/CesCluster.hh" //#include "CLHEP/Geometry/Point3D.h" //#include "CLHEP/Vector/LorentzVector.h" //class HepPoint3D; //class HepLorentzVector; //class CdfMuon; class CdfTrackView; namespace MuonVariables { // function returnig reference to structure CdfMuon::cmpMatch // holding delta and chi-square data. const MuonMatchData& cmpMatch(const CdfMuon& muonObject) ; // function accessing dphi, member of structure cmpMatch float cmpMatchDphi(const CdfMuon& muonObject) ; // function accessing drphi, member of structure cmpMatch float cmpMatchDrphi(const CdfMuon& muonObject) ; // function accessing chsqX, member of structure cmpMatch float cmpMatchChsqX(const CdfMuon& muonObject) ; // function accessing chsqXPosition, member of structure cmpMatch float cmpMatchChsqXPosition(const CdfMuon& muonObject) ; // function returning reference to structure CdfMuon::cmuMatch // holding delta and chi-square data. const MuonMatchData& cmuMatch(const CdfMuon& muonObject) ; // function accessing dphi, member of structure cmuMatch float cmuMatchDphi(const CdfMuon& muonObject) ; // function accessing drphi, member of structure cmuMatch float cmuMatchDrphi(const CdfMuon& muonObject) ; // function accessing dtheta, member of structure cmuMatch float cmuMatchDtheta(const CdfMuon& muonObject) ; // function accessing dz, member of structure cmuMatch float cmuMatchDz(const CdfMuon& muonObject) ; // function accessing chsqZ, member of structure cmuMatch float cmuMatchChsqZ(const CdfMuon& muonObject) ; // function accessing chsqX, member of structure cmuMatch float cmuMatchChsqX(const CdfMuon& muonObject) ; // function accessing chsqZPosition, member of structure cmuMatch float cmuMatchChsqZPosition(const CdfMuon& muonObject) ; // function accessing chsqXPosition, member of structure cmuMatch float cmuMatchChsqXPosition(const CdfMuon& muonObject) ; // em energy float getEmEnergy(const CdfMuon& muonObject) ; // hadron Energy float getHadronEnergy(const CdfMuon& muonObject) ; //Tracks // best track CdfTrack_clnk getBestTrack(const CdfMuon& muonObject) ; // access to best track parameters double bestTrackCurvature(const CdfMuon& muonObject) ; //const CdfMuon& testMuon; //double myTrackLink = getBestTrack(testMuon)->curvature(); // access to best track parameters double bestTrackD0(const CdfMuon& muonObject) ; // access to best track parameters double bestTrackZ0(const CdfMuon& muonObject) ; // access to best track parameters double bestTrackLambda(const CdfMuon& muonObject) ; // second best track CdfTrack_clnk getSecondBestTrack(const CdfMuon& muonObject) ; // access to best track parameters double secondBestTrackCurvature(const CdfMuon& muonObject) ; //const CdfMuon& testMuon; //double myTrackLink = getBestTrack(testMuon)->curvature(); // access to best track parameters double secondBestTrackD0(const CdfMuon& muonObject) ; // access to best track parameters double secondBestTrackZ0(const CdfMuon& muonObject) ; // access to best track parameters double secondBestTrackLambda(const CdfMuon& muonObject) ; // four Momentum HepLorentzVector getFourMomentum(const CdfMuon& muonObject) ; // test function bool isItCmu(const CdfMuon& muonObject) ; // test function bool isItCmp(const CdfMuon& muonObject) ; // test function bool isItCmx(const CdfMuon& muonObject) ; // test function bool isItImu(const CdfMuon& muonObject) ; /********************************************************/ // Pt taken from the best track double muoPt(const CdfMuon& muonObject) ; // Px taken from the best track double muoPx(const CdfMuon& muonObject) ; // Py taken from the best track double muoPy(const CdfMuon& muonObject) ; // Pz taken from the best track double muoPz(const CdfMuon& muonObject) ; // E taken from the best track double muoE(const CdfMuon& muonObject) ; // Charge (+=1; -=-1): inherited from SimpleReconstructedTrack double muoCharge(const CdfMuon& muonObject) ; // This is event eta, because it comes from the track double muoEventEta(const CdfMuon& muonObject) ; // This is phi at r=0, because it comes from the track double muoPhi0(const CdfMuon& muonObject) ; //Detector Eta // Needs input argument giving muon Type: // Type of muon taken from CdfMuon //typedef enum ; CMU = 0, // CMP = 1, // CMX = 2, // BMU = 3, // CSP = 4, // CSX = 5, // BSU = 6, // TSU = 7 } System; // //spacePoint() should be in Global Coordinates taken from the Stub double muoDetectorEta(const CdfMuon& muonObject,int system) ; //Detector Phi //spacePoint() should be in Global Coordinates taken from the Stub double muoDetectorPhi(const CdfMuon& muonObject,int system) ; //Stub X,Y,Z double muoDetectorX(const CdfMuon& muonObject,int system) ; double muoDetectorY(const CdfMuon& muonObject,int system) ; double muoDetectorZ(const CdfMuon& muonObject,int system) ; //Type of muon taken from CdfMuon //typedef enum ; CMU = 0, // CMP = 1, // CMX = 2, // BMU = 3, // CSP = 4, // CSX = 5, // BSU = 6, // TSU = 7 } System; //bit 0 corresponds to CMU et cetra. So a CMU-CMP-CSP is 10011 or 19 unsigned int muoType(const CdfMuon& muonObject) ; //Does it has have a system (eg. CMU)? bool muoHasSystem(const CdfMuon& muonObject,int system) ; //Wedge or region of first hit (0-31) unsigned int muoWedge(const CdfMuon& muonObject,int system); //Bit map of CMU/CMP/CMX Layer hits unsigned int muoLayerBitmap(const CdfMuon& muonObject,int system); //Number of hits in the system for the stub int muoSystemHits(const CdfMuon& muonObject,int system); //array of DigiCodes for up to 4 hits std::vector muoHitDigiCodes(const CdfMuon& muonObject,int system); //array of Widths for up to 4 hits std::vector muoHitWidths(const CdfMuon& muonObject,int system); //Tracking Algorithm for the best track int muoTrackAlgo(const CdfMuon& muonObject); //X,Y,Z at the point of closest approach to beam double muoTrackX0(const CdfMuon& muonObject) ; double muoTrackY0(const CdfMuon& muonObject) ; double muoTrackZ0(const CdfMuon& muonObject) ; //According to Pasha, ) is positively curved and, i.e. dphi/dr>0, //if y is positive then impact parameter is positive double muoTrackD0(const CdfMuon& muonObject) ; //Phi at the point of closest approach to beam double muoTrackPhi0(const CdfMuon& muonObject) ; //Chi^2 of track double muoTrackChi2(const CdfMuon& muonObject) ; //Degrees of Freedom from trackfit unsigned int muoTrackdof(const CdfMuon& muonObject) ; //Track Covariance Matrix const HepSymMatrix & muoTrackErrorMatrix(const CdfMuon& muonObject); //Extrapolation of the Track extrapolated to the radius of the Stub MExtrapolator muoTrackExtrapolation(const CdfMuon& muonObject,int system); //3 point of the Track extrapolated to the radius of the Stub HepPoint3D muoExtrTrackPoint(const CdfMuon& muonObject,int system); // X position of the Track extrapolated to the radius of the Stub double muoExtrTrackX(const CdfMuon& muonObject,int system); // Y position of the Track extrapolated to the radius of the Stub double muoExtrTrackY(const CdfMuon& muonObject,int system); // Z position of the Track extrapolated to the radius of the Stub double muoExtrTrackZ(const CdfMuon& muonObject,int system); //3 Momentum of the Track extrapolated to the radius of the Stub HepVector3D muoExtrTrackMomentum(const CdfMuon& muonObject,int system); // //this is purely track based and has nothing to do with the stub // //We think this is useless // // the difference in theta between the position and Momentum // // of the Track extrapolated to the radius of the Stub // double muoExtrTrackDeltaTheta(const CdfMuon& muonObject,int system); // // the difference in Phi between the position and Momentum // // of the Track extrapolated to the radius of the Stub // double muoExtrTrackDeltaPhi(const CdfMuon& muonObject,int system); // These are not implemented in MExtrapolator // //sigma x of the Track extrapolated to the radius of the Stub // HepVector3D muoExtrTrackSigmaX(const CdfMuon& muonObject,int system); // //sigma x slope of the Track extrapolated to the radius of the Stub // HepVector3D muoExtrTrackSigmaXSlope(const CdfMuon& muonObject,int system); // //sigma z of the Track extrapolated to the radius of the Stub // HepVector3D muoExtrTrackSigmaZ(const CdfMuon& muonObject,int system); // //sigma z slope of the Track extrapolated to the radius of the Stub // HepVector3D muoExtrTrackSigmaZSlope(const CdfMuon& muonObject,int system); //Bit map of the SVX hits unsigned int muoSiLayerBitMap(const CdfMuon& muonObject); //Bit map of the COT hits CT_LayerMask muoCTLayerBitMap(const CdfMuon& muonObject); //Number of Axial Superlayer Hits int muoNAxialHits(const CdfMuon& muonObject); //Number of Stereo Superlayer Hits int muoNStereoHits(const CdfMuon& muonObject); //Closest Vertex const Vertex * muoClosestVertex(const CdfMuon& muonObject); //Z of Closest Vertex double muoClosestVertexZ(const CdfMuon& muonObject); //Ht of Closest Vertex double muoClosestVertexHt(const CdfMuon& muonObject); //Number of tracks associated with the Closest Vertex int muoClosestVertexNTracks(const CdfMuon& muonObject); //Delta Z between the Closest vertex and the Z0 of the track double muoDelZClosestVertex(const CdfMuon& muonObject); //Delta Z between the primary vertex and the Z0 of the track double muoDelZPrimaryVertex(const CdfMuon& muonObject); //Best Track CdfTrack_clnk muoBestTrack(const CdfMuon& muonObject) ; //Second Best Track CdfTrack_clnk muoSecondBestTrack(const CdfMuon& muonObject) ; const MuonStub * muoStub(const CdfMuon& muonObject,int system); //Return a pointer to the closest stub if there is one in the same wedge const MuonStub * muoClosestStub(const CdfMuon& muonObject,int system); HepVector3D muoStubDirection(const CdfMuon& muonObject,int system); double muoStubDirectionPhi(const CdfMuon& muonObject,int system); double muoStubDirectionCotanTheta(const CdfMuon& muonObject,int system); // delta X between the Track extrapolated to the radius of the Stub and the stub double muoDeltaX(const CdfMuon& muonObject,int system); // delta Z between the Track extrapolated to the radius of the Stub and the stub double muoDeltaZ(const CdfMuon& muonObject,int system); // delta phi between the Track extrapolated to the radius of the Stub and the stub double muoDeltaPhi(const CdfMuon& muonObject,int system); // delta Theta between the Track extrapolated to the radius of the Stub and the stub double muoDeltaTheta(const CdfMuon& muonObject,int system); // Chi Squared X of the Track extrapolated to the radius of the Stub and the stub double muoChiSqX(const CdfMuon& muonObject,int system); // Chi Squared Z of the Track extrapolated to the radius of the Stub and the stub double muoChiSqZ(const CdfMuon& muonObject,int system); //X error matrix of the Track extrapolated to the radius of the Stub //This is used as the error matrix for the chi squared calculation HepSymMatrix muoErrorMatrixX(const CdfMuon& muonObject,int system); //Z error matrix of the Track extrapolated to the radius of the Stub //This is used as the error matrix for the chi squared calculation HepSymMatrix muoErrorMatrixZ(const CdfMuon& muonObject,int system); // Et in cone of R = 0.4 around muon tower double muoCone4Et(const CdfMuon& muonObject); // Et in cone of R = 0.7 around muon tower double muoCone7Et(const CdfMuon& muonObject); // Em fraction in cone of R = 0.4 around muon tower double muoCone4EmFraction(const CdfMuon& muonObject); // Em fraction in cone of R = 0.7 around muon tower double muoCone7EmFraction(const CdfMuon& muonObject); // This is the Sum of the Pt of all track within a cone of .4, pt>.2 and // < 10 cm from the Z0 of the track double muoTrackPtCone4(const CdfMuon& muonObject); // This is the Sum of the Pt of all track within a cone of .7, pt>.2 and // < 10 cm from the Z0 of the track double muoTrackPtCone7(const CdfMuon& muonObject); // This is the Sum of the Pt of all track within a cone of .4, pt>.2 and // < 10 cm from the Z0 of the track, in the specified track view double muoTrackPtCone4(const CdfMuon& muonObject, const CdfTrackView& trview); // This is the Sum of the Pt of all track within a cone of .7, pt>.2 and // < 10 cm from the Z0 of the track, in the specified track view double muoTrackPtCone7(const CdfMuon& muonObject, const CdfTrackView& trview); // em energy float muoEmEnergy(const CdfMuon& muonObject) ; // hadron Energy float muoHadronEnergy(const CdfMuon& muonObject) ; // em Et float muoEmEt(const CdfMuon& muonObject) ; // hadron Et float muoHadronEt(const CdfMuon& muonObject) ; //Et of Neighboring towers float muoNeighborEt(const CdfMuon& muonObject); //time of HTDC of towers hit by muon float muoTime(const CdfMuon& muonObject); //Returns a bitmask of which detector the MuonFiducialTool claims // a muon should hit. See description of muoType for explanation of // bitmask. int muoFidType(const CdfMuon& muonObject); // Returns the likelihood that the CdfMuon object is a real muon std::vector createVector(int n, double v[]); int getBin(std::vector p, std::vector > edges); double muonLikelihood_iso4(double iso4); double muonLikelihood_tIso(double tIso); double muonLikelihood_hadE(double hadE); double muonLikelihood_emE(double emE); double muonLikelihood(double iso4, double tIso, double hadE, double emE); double muonLikelihood(std::vector vars); int muoRegion(const CdfMuon& muonObject); } #endif