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 
19 
22 
26 //#include "TrackingTools/GeomPropagators/interface/AnalyticalPropagator.h"
27 //#include "TrackPropagation/SteppingHelixPropagator/interface/SteppingHelixPropagator.h"
28 
29 //#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
30 
31 //#include "TrackPropagation/SteppingHelixPropagator/interface/SteppingHelixPropagator.h"
32 
34 //#include "TrackingTools/TransientTrack/interface/TransientTrack.h"
35 //#include "TrackingTools/TrackRefitter/interface/TrackTransformer.h"
36 
37 class TrackerTopology;
38 
40  static const int N_MAX_STORED = 10;
41  static const int N_MAX_STORED_HIT = 1000;
42 
43  static const int PXB = 1;
44  static const int PXF = 2;
45  static const int TIB = 3;
46  static const int TID = 4;
47  static const int TOB = 5;
48  static const int TEC = 6;
49 
50 public:
51  // typedef std::pair<const Trajectory*, const reco::Track*> ConstTrajTrackPair;
52  // typedef std::vector< ConstTrajTrackPair > ConstTrajTrackPairCollection;
53 
54  typedef struct {
55  int evtNum_;
56  int runNum_;
57  } storage_event;
58 
60 
61  typedef struct StorageMuon {
62  int n_;
63 
65  float pt_[N_MAX_STORED];
67  float p_[N_MAX_STORED];
73 
74  StorageMuon() : n_(0) {
75  for (int i = 0; i < N_MAX_STORED; ++i) {
76  charge_[i] = 0;
77  pt_[i] = 0.;
78  eta_[i] = 0.;
79  p_[i] = 0.;
80  phi_[i] = 0.;
81  numRecHits_[i] = 0;
82  chiSq_[i] = 0.;
83  ndf_[i] = 0.;
84  chiSqOvrNdf_[i] = 0.;
85  }
86  }
87  } storage_muon; // Storage for standard muon information
88 
89  typedef struct StorageHit {
90  int n_;
92 
102 
111 
112  StorageHit() : n_(0) {
113  for (int i = 0; i < N_MAX_STORED_HIT; ++i) {
114  muonLink_[i] = 0;
115  system_[i] = 0;
116  endcap_[i] = 0;
117  station_[i] = 0;
118  ring_[i] = 0;
119  chamber_[i] = 0;
120  layer_[i] = 0;
121  superLayer_[i] = 0;
122  wheel_[i] = 0;
123  sector_[i] = 0;
124  gpX_[i] = 0.;
125  gpY_[i] = 0.;
126  gpZ_[i] = 0.;
127  gpEta_[i] = 0.;
128  gpPhi_[i] = 0.;
129  lpX_[i] = 0.;
130  lpY_[i] = 0.;
131  lpZ_[i] = 0.;
132  }
133  }
134  } storage_hit;
135 
136  typedef struct StorageTrackExtrap {
137  int n_;
138 
152 
154  for (int i = 0; i < N_MAX_STORED_HIT; ++i) {
155  muonLink_[i] = 0;
156  recLink_[i] = 0;
157  gpX_[i] = 0.;
158  gpY_[i] = 0.;
159  gpZ_[i] = 0.;
160  gpEta_[i] = 0.;
161  gpPhi_[i] = 0.;
162  lpX_[i] = 0.;
163  lpY_[i] = 0.;
164  lpZ_[i] = 0.;
165  resX_[i] = 0.;
166  resY_[i] = 0.;
167  resZ_[i] = 0.;
168  }
169  }
171 
172  typedef struct StorageTrackHit {
173  int n_;
174 
187 
196 
198  for (int i = 0; i < N_MAX_STORED_HIT; ++i) {
199  muonLink_[i] = 0;
200  detector_[i] = 0;
201  subdetector_[i] = 0;
202  blade_[i] = 0;
203  disk_[i] = 0;
204  ladder_[i] = 0;
205  layer_[i] = 0;
206  module_[i] = 0;
207  panel_[i] = 0;
208  ring_[i] = 0;
209  side_[i] = 0;
210  wheel_[i] = 0;
211  gpX_[i] = 0.;
212  gpY_[i] = 0.;
213  gpZ_[i] = 0.;
214  gpEta_[i] = 0.;
215  gpPhi_[i] = 0.;
216  lpX_[i] = 0.;
217  lpY_[i] = 0.;
218  lpZ_[i] = 0.;
219  }
220  }
222 
223  //Standard Muon info storage
227 
230 
232 
238 
239  //Rec hit storage
242 
243  //Track Extrapolation to Muon System
246 
247  //Track Extrapolation with Cylinder
249 
250  //Track Extrapolation to Tracker system
256 
257  //
258  // Start of the method declarations
259  //
260 
261  explicit ResidualRefitting(const edm::ParameterSet&);
262  ~ResidualRefitting() override;
263 
264  void analyze(const edm::Event&, const edm::EventSetup&) override;
265  void beginJob() override;
266  void endJob() override;
267  //Zero Storage
268  void zero_storage();
273 
274  // void collectTrackRecExtrap(reco::MuonCollection::const_iterator muon, ResidualRefitting::storage_trackExtrap& storeTemp);
276 
279  const edm::EventSetup& eventSetup);
280  void StoreTrackerRecHits(DetId detid, const TrackerTopology* tTopo, int iTrack, int iRec);
284  int MatchTrackWithRecHits(reco::TrackCollection::const_iterator trackIt, edm::Handle<reco::TrackCollection> ref);
285 
286  bool IsSameHit(TrackingRecHit const& hit1, TrackingRecHit const& hit2);
287 
288  void trkExtrap(const DetId& detid,
289  int iTrkLink,
290  int iTrk,
291  int iRec,
292  const FreeTrajectoryState& freeTrajState,
293  const LocalPoint& recPoint,
294  storage_trackExtrap& storeTemp);
295 
297 
298  //Simplifiying functions
299  FreeTrajectoryState freeTrajStateMuon(reco::TrackRef muon); //Returns a Free Trajectory State
300  //Debug Data Dumps
301  // void dumpRecoMuonColl(reco::MuonCollection::const_iterator muon); //
302  // void dumpRecoTrack(reco::TrackCollection::const_iterator muon);
307 
308  int ReturnSector(DetId detid);
309  int ReturnStation(DetId detid);
310 
311  // Deprecated Functions
317  int omitStation);
322  int omitSystem);
323 
328 
329  // output histogram file name
331  //edm::InputTag PropagatorSource_;
333 
334  // names of product labels
336  muonsNoStation4_, //Global Muon Collections
340  // tjTag;
341 
342  bool debug_;
343 
344  // output ROOT file
345  TFile* outputFile_;
346 
347  TTree* outputTree_;
348  TBranch* outputBranch_;
349 
350  // unsigned int nBins_;
351 
356 };
357 
358 #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
static const int N_MAX_STORED_HIT
ResidualRefitting::storage_trackExtrap storageTrackNoTIBLayer4
ResidualRefitting::storage_muon storageTrkNoTIBLayer2
int sector_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageGmrNoTOBLayer2
void endJob() override
struct ResidualRefitting::StorageTrackHit storage_trackHit
void NewTrackMeasurements(edm::Handle< reco::TrackCollection > trackCollOrig, edm::Handle< reco::TrackCollection > trackColl, ResidualRefitting::storage_trackExtrap &trackExtrap)
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]
edm::InputTag tracks_
ResidualRefitting::storage_muon storageTrkNoTID
ResidualRefitting::storage_trackExtrap storageTrackExtrapTracker_
ResidualRefitting::storage_trackExtrap storageTrackExtrapRec_
static const int TID
ResidualRefitting::storage_muon storageGmrNoTOBLayer4
ResidualRefitting::storage_muon storageGmrNoSt4_
edm::InputTag muonsNoStation2_
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)
edm::InputTag muonsNoTIBLayer1_
edm::InputTag muonsNoTOBLayer6_
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_
ResidualRefitting::storage_muon storageTrkNoPXBLayer2
edm::InputTag muonsNoStation1_
edm::InputTag muonsNoTIBLayer4_
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
edm::InputTag muonsNoTIBLayer3_
edm::InputTag muonsNoTOBLayer3_
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_
edm::InputTag muonsNoTOBLayer5_
ResidualRefitting::storage_muon storageTrkNoPXF
ResidualRefitting::storage_muon storageGmrNoTEC
ResidualRefitting::storage_trackExtrap trackExtrap120_
const edm::ESHandle< GlobalTrackingGeometry > trackingGeometry
edm::InputTag muonsNoStation3_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
Definition: DetId.h:17
edm::InputTag muonsNoTOBLayer2_
ResidualRefitting::storage_muon storageGmrNoTIBLayer3
ResidualRefitting::storage_muon storageGmrNew_
float gpX_[N_MAX_STORED_HIT]
edm::InputTag muonsNoPXF_
std::string outputFileName_
ResidualRefitting::storage_muon storageGmrNoTIBLayer2
int station_[N_MAX_STORED_HIT]
edm::InputTag muonsRemake_
void cylExtrapTrkSam(int recNum, reco::TrackRef track, ResidualRefitting::storage_trackExtrap &storage, double rho)
float gpPhi_[N_MAX_STORED_HIT]
edm::InputTag muonsNoTID_
static const int PXF
ResidualRefitting::storage_muon storageTrkNoTIBLayer3
int ring_[N_MAX_STORED_HIT]
edm::InputTag muons_
ResidualRefitting::storage_trackExtrap storageTrackNoTID
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > trackingGeometryToken_
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)
edm::InputTag muonsNoPXBLayer2_
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]
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::InputTag muonsNoPXBLayer1_
edm::ESHandle< Propagator > thePropagator
edm::InputTag muonsNoPXBLayer3_
void StoreTrackerRecHits(DetId detid, const TrackerTopology *tTopo, int iTrack, int iRec)
edm::InputTag muonsNoTIBLayer2_
ResidualRefitting::storage_muon storageTrkNew_
ResidualRefitting::storage_trackExtrap storageTrackNoPXF
ResidualRefitting::storage_muon storageSamNoSt1_
#define str(s)
ResidualRefitting::storage_muon storageGmrNoTOBLayer5
ResidualRefitting::storage_trackExtrap storageTrackNoTIBLayer3
edm::InputTag muonsNoStation4_
void beginJob() override
int system_[N_MAX_STORED_HIT]
edm::InputTag muonsNoTOBLayer4_
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer1
void branchTrackExtrap(ResidualRefitting::storage_trackExtrap &storageTmp, std::string branchName)
ResidualRefitting::storage_muon storageGmrNoPXF
ResidualRefitting::storage_trackExtrap storageTrackNoPXBLayer2
ResidualRefitting::storage_muon storageTrkNoPXBLayer3
edm::InputTag muonsNoTOBLayer1_
edm::InputTag muonsNoTEC_
ResidualRefitting::storage_muon storageTrkNoTIBLayer4
ResidualRefitting::storage_trackExtrap samExtrap120_