00001 #ifndef MCTruth_MuonTruth_h 00002 #define MCTruth_MuonTruth_h 00003 00004 #include "DataFormats/CSCRecHit/interface/CSCRecHit2D.h" 00005 #include "DataFormats/CSCDigi/interface/CSCStripDigi.h" 00006 #include "DataFormats/CSCDigi/interface/CSCWireDigi.h" 00007 #include "SimDataFormats/Track/interface/SimTrackContainer.h" 00008 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" 00009 #include "FWCore/Framework/interface/Event.h" 00010 #include "FWCore/Framework/interface/EventSetup.h" 00011 #include "DataFormats/Common/interface/DetSetVector.h" 00012 #include "SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h" 00013 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00014 #include "FWCore/Utilities/interface/InputTag.h" 00015 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" 00016 #include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h" 00017 #include "SimDataFormats/CrossingFrame/interface/MixCollection.h" 00018 #include "Geometry/CSCGeometry/interface/CSCGeometry.h" 00019 #include "Geometry/CSCGeometry/interface/CSCLayerGeometry.h" 00020 #include "CondFormats/CSCObjects/interface/CSCBadChambers.h" 00021 #include "CondFormats/DataRecord/interface/CSCBadChambersRcd.h" 00022 00023 class MuonTruth 00024 { 00025 public: 00026 typedef edm::DetSetVector<StripDigiSimLink> DigiSimLinks; 00027 typedef edm::DetSetVector<StripDigiSimLink> WireDigiSimLinks; 00028 typedef edm::DetSet<StripDigiSimLink> LayerLinks; 00029 typedef std::pair <uint32_t, EncodedEventId> SimHitIdpr; 00030 00031 MuonTruth(const edm::Event&, const edm::EventSetup&, const edm::ParameterSet&); 00032 std::vector<SimHitIdpr> associateHitId(const TrackingRecHit &); 00033 std::vector<SimHitIdpr> associateCSCHitId(const CSCRecHit2D *); 00034 00035 void analyze(const CSCRecHit2D & recHit); 00036 void analyze(const CSCStripDigi & stripDigi, int rawDetIdCorrespondingToCSCLayer); 00037 void analyze(const CSCWireDigi & wireDigi , int rawDetIdCorrespondingToCSCLayer); 00038 00040 float muonFraction(); 00041 00042 std::vector<PSimHit> muonHits(); 00043 00044 std::vector<PSimHit> simHits(); 00045 00046 const CSCBadChambers* cscBadChambers; 00047 00048 private: 00049 00050 std::vector<PSimHit> hitsFromSimTrack(SimHitIdpr truthId); 00051 // goes to SimHits for information 00052 int particleType(SimHitIdpr truthId); 00053 00054 void addChannel(const LayerLinks &layerLinks, int channel, float weight=1.); 00055 00056 std::map<SimHitIdpr, float> theChargeMap; 00057 float theTotalCharge; 00058 00059 unsigned int theDetId; 00060 00061 const DigiSimLinks * theDigiSimLinks; 00062 const DigiSimLinks * theWireDigiSimLinks; 00063 00064 edm::InputTag linksTag; 00065 edm::InputTag wireLinksTag; 00066 00067 bool crossingframe; 00068 edm::InputTag CSCsimHitsTag; 00069 edm::InputTag CSCsimHitsXFTag; 00070 00071 std::map<unsigned int, edm::PSimHitContainer> theSimHitMap; 00072 00073 const CSCGeometry* cscgeom; 00074 }; 00075 00076 #endif