CMS 3D CMS Logo

ResidualRefitting.h
Go to the documentation of this file.
1 #ifndef _ResidualRefitting_h__
2 #define __ResidualRefitting_h_ (1)
3 
4 #include <vector>
5 #include <string>
6 
7 #include "TFile.h"
8 #include "TBranch.h"
9 #include "TTree.h"
10 
16 
21 
24 
28 
30 
31 class TrackerTopology;
32 
34  static const int N_MAX_STORED = 10;
35  static const int N_MAX_STORED_HIT = 1000;
36 
37  static const int PXB = 1;
38  static const int PXF = 2;
39  static const int TIB = 3;
40  static const int TID = 4;
41  static const int TOB = 5;
42  static const int TEC = 6;
43 
44 public:
45  // typedef std::pair<const Trajectory*, const reco::Track*> ConstTrajTrackPair;
46  // typedef std::vector< ConstTrajTrackPair > ConstTrajTrackPairCollection;
47 
48  typedef struct {
49  int evtNum_;
50  int runNum_;
51  } storage_event;
52 
54 
55  typedef struct StorageMuon {
56  int n_;
57 
59  float pt_[N_MAX_STORED];
61  float p_[N_MAX_STORED];
67 
68  StorageMuon() : n_(0) {
69  for (int i = 0; i < N_MAX_STORED; ++i) {
70  charge_[i] = 0;
71  pt_[i] = 0.;
72  eta_[i] = 0.;
73  p_[i] = 0.;
74  phi_[i] = 0.;
75  numRecHits_[i] = 0;
76  chiSq_[i] = 0.;
77  ndf_[i] = 0.;
78  chiSqOvrNdf_[i] = 0.;
79  }
80  }
81  } storage_muon; // Storage for standard muon information
82 
83  typedef struct StorageHit {
84  int n_;
86 
96 
105 
106  StorageHit() : n_(0) {
107  for (int i = 0; i < N_MAX_STORED_HIT; ++i) {
108  muonLink_[i] = 0;
109  system_[i] = 0;
110  endcap_[i] = 0;
111  station_[i] = 0;
112  ring_[i] = 0;
113  chamber_[i] = 0;
114  layer_[i] = 0;
115  superLayer_[i] = 0;
116  wheel_[i] = 0;
117  sector_[i] = 0;
118  gpX_[i] = 0.;
119  gpY_[i] = 0.;
120  gpZ_[i] = 0.;
121  gpEta_[i] = 0.;
122  gpPhi_[i] = 0.;
123  lpX_[i] = 0.;
124  lpY_[i] = 0.;
125  lpZ_[i] = 0.;
126  }
127  }
128  } storage_hit;
129 
130  typedef struct StorageTrackExtrap {
131  int n_;
132 
146 
148  for (int i = 0; i < N_MAX_STORED_HIT; ++i) {
149  muonLink_[i] = 0;
150  recLink_[i] = 0;
151  gpX_[i] = 0.;
152  gpY_[i] = 0.;
153  gpZ_[i] = 0.;
154  gpEta_[i] = 0.;
155  gpPhi_[i] = 0.;
156  lpX_[i] = 0.;
157  lpY_[i] = 0.;
158  lpZ_[i] = 0.;
159  resX_[i] = 0.;
160  resY_[i] = 0.;
161  resZ_[i] = 0.;
162  }
163  }
165 
166  typedef struct StorageTrackHit {
167  int n_;
168 
181 
190 
192  for (int i = 0; i < N_MAX_STORED_HIT; ++i) {
193  muonLink_[i] = 0;
194  detector_[i] = 0;
195  subdetector_[i] = 0;
196  blade_[i] = 0;
197  disk_[i] = 0;
198  ladder_[i] = 0;
199  layer_[i] = 0;
200  module_[i] = 0;
201  panel_[i] = 0;
202  ring_[i] = 0;
203  side_[i] = 0;
204  wheel_[i] = 0;
205  gpX_[i] = 0.;
206  gpY_[i] = 0.;
207  gpZ_[i] = 0.;
208  gpEta_[i] = 0.;
209  gpPhi_[i] = 0.;
210  lpX_[i] = 0.;
211  lpY_[i] = 0.;
212  lpZ_[i] = 0.;
213  }
214  }
216 
217  //Standard Muon info storage
221 
224 
226 
232 
233  //Rec hit storage
236 
237  //Track Extrapolation to Muon System
240 
241  //Track Extrapolation with Cylinder
243 
244  //Track Extrapolation to Tracker system
250 
251  //
252  // Start of the method declarations
253  //
254 
255  explicit ResidualRefitting(const edm::ParameterSet&);
256  ~ResidualRefitting() override;
257  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
258 
259  void analyze(const edm::Event&, const edm::EventSetup&) override;
260  void beginJob() override;
261  void endJob() override;
262  //Zero Storage
263  void zero_storage();
268 
269  // void collectTrackRecExtrap(reco::MuonCollection::const_iterator muon, ResidualRefitting::storage_trackExtrap& storeTemp);
271 
274  const edm::EventSetup& eventSetup);
275  void StoreTrackerRecHits(DetId detid, const TrackerTopology* tTopo, int iTrack, int iRec);
279  int MatchTrackWithRecHits(reco::TrackCollection::const_iterator trackIt, edm::Handle<reco::TrackCollection> ref);
280 
281  bool IsSameHit(TrackingRecHit const& hit1, TrackingRecHit const& hit2);
282 
283  void trkExtrap(const DetId& detid,
284  int iTrkLink,
285  int iTrk,
286  int iRec,
287  const FreeTrajectoryState& freeTrajState,
288  const LocalPoint& recPoint,
289  storage_trackExtrap& storeTemp);
290 
292 
293  //Simplifiying functions
294  FreeTrajectoryState freeTrajStateMuon(reco::TrackRef muon); //Returns a Free Trajectory State
295  //Debug Data Dumps
296  // void dumpRecoMuonColl(reco::MuonCollection::const_iterator muon); //
297  // void dumpRecoTrack(reco::TrackCollection::const_iterator muon);
302 
303  int ReturnSector(DetId detid);
304  int ReturnStation(DetId detid);
305 
306  // Deprecated Functions
312  int omitStation);
317  int omitSystem);
318 
323 
324  // output histogram file name
326  //edm::InputTag PropagatorSource_;
328 
329  // names of product labels
331  muonsNoStation4_; //Global Muon Collections
332 
333  const bool debug_;
340 
341  // output ROOT file
342  TFile* outputFile_;
343 
344  TTree* outputTree_;
345  TBranch* outputBranch_;
346 
347  // unsigned int nBins_;
348 
353 };
354 
355 #endif
void CollectTrackHits(edm::Handle< reco::TrackCollection > trackColl, ResidualRefitting::storage_trackExtrap &trackExtrap, const edm::EventSetup &eventSetup)
ResidualRefitting::storage_muon storageGmrNoTIBLayer4
int endcap_[N_MAX_STORED_HIT]
struct ResidualRefitting::StorageMuon storage_muon
static const int TIB
ResidualRefitting::storage_muon storageTrkNoTOBLayer4
void zero_muon(ResidualRefitting::storage_muon *str)
static const int N_MAX_STORED
int ReturnStation(DetId detid)
void dumpTrackRef(reco::TrackRef muon, std::string str)
ResidualRefitting::storage_muon storageGmrNoTOBLayer1
void dumpMuonRecHits(const ResidualRefitting::storage_hit &hit)
ResidualRefitting::storage_trackExtrap storageTrackNoTEC
ResidualRefitting::storage_muon storageGmrNoPXBLayer1
float lpZ_[N_MAX_STORED_HIT]
bool IsSameHit(TrackingRecHit const &hit1, TrackingRecHit const &hit2)
ResidualRefitting::storage_trackExtrap storageTrackNoPXBLayer1
ResidualRefitting::storage_muon storageGmrNoTID
ResidualRefitting::storage_muon storageTrkNoTOBLayer6
int ReturnSector(DetId detid)
ResidualRefitting::storage_muon storageGmrNoTIBLayer1
static const int PXB
ResidualRefitting::storage_trackHit storageTrackHit_
std::string PropagatorSource_
const MagneticField * theField
void zero_trackExtrap(ResidualRefitting::storage_trackExtrap *str)
void analyze(const edm::Event &, const edm::EventSetup &) override
ResidualRefitting::storage_trackExtrap storageTrackExtrapRecNoSt3_
ResidualRefitting::storage_muon storageTrkNoTOBLayer5
static const int TOB
ResidualRefitting::storage_trackExtrap storageTrackNoTIBLayer2
const edm::EDGetTokenT< reco::TrackCollection > muonsNoSt4Token_
static const int N_MAX_STORED_HIT
ResidualRefitting::storage_trackExtrap storageTrackNoTIBLayer4
const edm::InputTag muonsNoStation1_
ResidualRefitting::storage_muon storageTrkNoTIBLayer2
int sector_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageGmrNoTOBLayer2
void endJob() override
struct ResidualRefitting::StorageTrackHit storage_trackHit
const edm::InputTag muonsNoStation2_
ResidualRefitting::storage_muon storageGmrNoSt1_
int layer_[N_MAX_STORED_HIT]
int chamber_[N_MAX_STORED_HIT]
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer6
float lpY_[N_MAX_STORED_HIT]
void omitTrackerSystem(edm::Handle< reco::MuonCollection > trkMuons, ResidualRefitting::storage_muon &storeGmr, ResidualRefitting::storage_muon &storeTrk, ResidualRefitting::storage_trackExtrap &storeExtrap, int omitSystem)
ResidualRefitting::storage_trackExtrap storageTrackExtrapRecNoSt1_
void trkExtrap(const DetId &detid, int iTrkLink, int iTrk, int iRec, const FreeTrajectoryState &freeTrajState, const LocalPoint &recPoint, storage_trackExtrap &storeTemp)
ResidualRefitting::storage_muon storageGmrNoTOBLayer6
int muonLink_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageSamNew_
static const int TEC
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer4
float gpEta_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageTrkNoTID
ResidualRefitting::storage_trackExtrap storageTrackExtrapTracker_
ResidualRefitting::storage_trackExtrap storageTrackExtrapRec_
static const int TID
ResidualRefitting::storage_muon storageGmrNoTOBLayer4
ResidualRefitting::storage_muon storageGmrNoSt4_
ResidualRefitting::storage_trackExtrap storageTrackExtrapRecNoSt4_
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer2
const edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorToken_
void branchMuon(ResidualRefitting::storage_muon &storageTmp, std::string branchName)
int MatchTrackWithRecHits(reco::TrackCollection::const_iterator trackIt, edm::Handle< reco::TrackCollection > ref)
float lpX_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageSamNoSt4_
int wheel_[N_MAX_STORED_HIT]
void muonInfo(ResidualRefitting::storage_muon &storeMuon, reco::TrackRef muon, int val)
struct ResidualRefitting::StorageHit storage_hit
ResidualRefitting::storage_trackExtrap storageTrackExtrapRecNoSt2_
const edm::InputTag muonsNoStation3_
ResidualRefitting::storage_muon storageTrkNoPXBLayer2
ResidualRefitting::storage_muon storageGmrNoSt2_
float gpY_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageGmrNoSt3_
void omitStation(edm::Handle< reco::MuonCollection > funcMuons, edm::Handle< reco::TrackCollection >, ResidualRefitting::storage_muon &storeGmr, ResidualRefitting::storage_muon &storeSam, ResidualRefitting::storage_trackExtrap &storeExtrap, int omitStation)
MuonServiceProxy * theService
ResidualRefitting::storage_muon storageGmrNoPXBLayer2
void dumpTrackExtrap(const ResidualRefitting::storage_trackExtrap &track)
ResidualRefitting(const edm::ParameterSet &)
FreeTrajectoryState freeTrajStateMuon(reco::TrackRef muon)
~ResidualRefitting() override
ResidualRefitting::storage_muon storageGmrOld_
ResidualRefitting::storage_muon storageTrkNoPXF
ResidualRefitting::storage_muon storageGmrNoTEC
ResidualRefitting::storage_trackExtrap trackExtrap120_
const edm::ESHandle< GlobalTrackingGeometry > trackingGeometry
const edm::EDGetTokenT< reco::TrackCollection > muonsNoSt1Token_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
const edm::EDGetTokenT< reco::TrackCollection > muonsNoSt2Token_
Definition: DetId.h:17
ResidualRefitting::storage_muon storageGmrNoTIBLayer3
ResidualRefitting::storage_muon storageGmrNew_
float gpX_[N_MAX_STORED_HIT]
std::string outputFileName_
ResidualRefitting::storage_muon storageGmrNoTIBLayer2
int station_[N_MAX_STORED_HIT]
void cylExtrapTrkSam(int recNum, reco::TrackRef track, ResidualRefitting::storage_trackExtrap &storage, double rho)
const edm::InputTag muonsRemake_
float gpPhi_[N_MAX_STORED_HIT]
static const int PXF
ResidualRefitting::storage_muon storageTrkNoTIBLayer3
int ring_[N_MAX_STORED_HIT]
ResidualRefitting::storage_trackExtrap storageTrackNoTID
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > trackingGeometryToken_
const edm::InputTag muonsNoStation4_
ResidualRefitting::storage_muon storageTrkNoTOBLayer2
ResidualRefitting::storage_trackExtrap storageTrackNoPXBLayer3
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer5
struct ResidualRefitting::StorageTrackExtrap storage_trackExtrap
ResidualRefitting::storage_muon storageSamNoSt2_
void dumpTrackHits(const ResidualRefitting::storage_trackHit &hit)
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer3
ResidualRefitting::storage_muon storageTrkNoTOBLayer1
float chiSqOvrNdf_[N_MAX_STORED]
ResidualRefitting::storage_muon storageGmrNoPXBLayer3
ResidualRefitting::storage_muon storageTrkNoTEC
ResidualRefitting::storage_muon storageSamNoSt3_
ResidualRefitting::storage_muon storageTrkNoPXBLayer1
float gpZ_[N_MAX_STORED_HIT]
const edm::EDGetTokenT< reco::TrackCollection > muonsNoSt3Token_
ResidualRefitting::storage_muon storageTrkNoTIBLayer1
ResidualRefitting::storage_muon storageGmrNoTOBLayer3
ResidualRefitting::storage_trackExtrap storageTrackNoTIBLayer1
int superLayer_[N_MAX_STORED_HIT]
ResidualRefitting::storage_event eventInfo_
ResidualRefitting::storage_hit storageRecMuon_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
ResidualRefitting::storage_muon storageTrkNoTOBLayer3
edm::ESHandle< Propagator > thePropagator
void NewTrackMeasurements(const edm::Handle< reco::TrackCollection > &trackCollOrig, const edm::Handle< reco::TrackCollection > &trackColl, ResidualRefitting::storage_trackExtrap &trackExtrap)
void StoreTrackerRecHits(DetId detid, const TrackerTopology *tTopo, int iTrack, int iRec)
ResidualRefitting::storage_muon storageTrkNew_
ResidualRefitting::storage_trackExtrap storageTrackNoPXF
ResidualRefitting::storage_muon storageSamNoSt1_
#define str(s)
const edm::InputTag tracks_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ResidualRefitting::storage_muon storageGmrNoTOBLayer5
ResidualRefitting::storage_trackExtrap storageTrackNoTIBLayer3
void beginJob() override
int system_[N_MAX_STORED_HIT]
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer1
void branchTrackExtrap(ResidualRefitting::storage_trackExtrap &storageTmp, std::string branchName)
ResidualRefitting::storage_muon storageGmrNoPXF
ResidualRefitting::storage_trackExtrap storageTrackNoPXBLayer2
const edm::EDGetTokenT< reco::TrackCollection > muonTracksToken_
ResidualRefitting::storage_muon storageTrkNoPXBLayer3
const edm::EDGetTokenT< reco::MuonCollection > muonsToken_
ResidualRefitting::storage_muon storageTrkNoTIBLayer4
const edm::InputTag muons_
ResidualRefitting::storage_trackExtrap samExtrap120_