Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:44

0001 #ifndef TrackAssociator_TrackDetMatchInfo_h
0002 #define TrackAssociator_TrackDetMatchInfo_h
0003 
0004 #include "DataFormats/CaloTowers/interface/CaloTower.h"
0005 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
0006 #include "DataFormats/HcalRecHit/interface/HBHERecHit.h"
0007 #include "DataFormats/HcalRecHit/interface/HORecHit.h"
0008 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0009 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0010 #include "TrackingTools/TrackAssociator/interface/TAMuonChamberMatch.h"
0011 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0012 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
0013 class TrackDetMatchInfo {
0014 public:
0015   enum EnergyType { EcalRecHits, HcalRecHits, HORecHits, TowerTotal, TowerEcal, TowerHcal, TowerHO };
0016 
0017   TrackDetMatchInfo();
0018 
0019   /// energy in detector elements crossed by the track by types

0020   double crossedEnergy(EnergyType);
0021 
0022   /// cone energy around the track direction at the origin (0,0,0)

0023   /// ( not well defined for tracks originating away from IP)

0024   double coneEnergy(double dR, EnergyType);
0025 
0026   /// get energy of the NxN shape (N = 2*gridSize + 1) around given detector element

0027   double nXnEnergy(const DetId&, EnergyType, int gridSize = 1);
0028 
0029   /// get energy of the NxN shape (N = 2*gridSize + 1) around track projection

0030   double nXnEnergy(EnergyType, int gridSize = 1);
0031 
0032   /// Find detector elements with highest energy deposition

0033   DetId findMaxDeposition(EnergyType);
0034   DetId findMaxDeposition(EnergyType, int gridSize);
0035   DetId findMaxDeposition(const DetId&, EnergyType, int gridSize);
0036 
0037   /// Track position at different parts of the calorimeter

0038   math::XYZPoint trkGlobPosAtEcal;
0039   math::XYZPoint trkGlobPosAtHcal;
0040   math::XYZPoint trkGlobPosAtHO;
0041 
0042   GlobalVector trkMomAtEcal;
0043   GlobalVector trkMomAtHcal;
0044   GlobalVector trkMomAtHO;
0045 
0046   bool isGoodEcal;
0047   bool isGoodHcal;
0048   bool isGoodCalo;
0049   bool isGoodHO;
0050   bool isGoodMuon;
0051 
0052   /// hits in the cone

0053   std::vector<const EcalRecHit*> ecalRecHits;
0054   std::vector<const HBHERecHit*> hcalRecHits;
0055   std::vector<const HORecHit*> hoRecHits;
0056   std::vector<const CaloTower*> towers;
0057 
0058   /// hits in detector elements crossed by a track

0059   std::vector<const EcalRecHit*> crossedEcalRecHits;
0060   std::vector<const HBHERecHit*> crossedHcalRecHits;
0061   std::vector<const HORecHit*> crossedHORecHits;
0062   std::vector<const CaloTower*> crossedTowers;
0063 
0064   /// detector elements crossed by a track

0065   /// (regardless of whether energy was deposited or not)

0066   std::vector<DetId> crossedEcalIds;
0067   std::vector<DetId> crossedHcalIds;
0068   std::vector<DetId> crossedHOIds;
0069   std::vector<DetId> crossedTowerIds;
0070   std::vector<DetId> crossedPreshowerIds;
0071 
0072   std::vector<TAMuonChamberMatch> chambers;
0073 
0074   /// track info

0075   FreeTrajectoryState stateAtIP;
0076 
0077   /// MC truth info

0078   const SimTrack* simTrack;
0079   double ecalTrueEnergy;
0080   double hcalTrueEnergy;
0081   double hcalTrueEnergyCorrected;
0082 
0083   /// Obsolete methods and data members for backward compatibility.

0084   /// Will be removed in future releases.

0085   reco::TrackRef trackRef_;
0086   SimTrackRef simTrackRef_;
0087 
0088   double ecalCrossedEnergy();
0089   double ecalConeEnergy();
0090   double hcalCrossedEnergy();
0091   double hcalConeEnergy();
0092   double hoCrossedEnergy();
0093   double hoConeEnergy();
0094 
0095   double ecalTowerEnergy() { return crossedEnergy(TowerEcal); }
0096   double ecalTowerConeEnergy() { return coneEnergy(999, TowerEcal); }
0097   double hcalTowerEnergy() { return crossedEnergy(TowerHcal); }
0098   double hcalTowerConeEnergy() { return coneEnergy(999, TowerHcal); }
0099   double hoTowerEnergy() { return crossedEnergy(TowerHO); }
0100   double hoTowerConeEnergy() { return coneEnergy(999, TowerHO); }
0101 
0102   double ecalEnergy() { return ecalCrossedEnergy(); }
0103   double hcalEnergy() { return hcalCrossedEnergy(); }
0104   double hoEnergy() { return hoCrossedEnergy(); }
0105 
0106   int numberOfSegments() const;
0107   int numberOfSegmentsInStation(int station) const;
0108   int numberOfSegmentsInStation(int station, int detector) const;
0109   int numberOfSegmentsInDetector(int detector) const;
0110 
0111   void setCaloGeometry(const CaloGeometry* geometry) { caloGeometry = geometry; }
0112   GlobalPoint getPosition(const DetId&);
0113   std::string dumpGeometry(const DetId&);
0114 
0115 private:
0116   bool insideCone(const DetId&, const double);
0117   const CaloGeometry* caloGeometry;
0118 };
0119 #endif