CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ResidualRefitting.h
Go to the documentation of this file.
1 #ifndef _ResidualRefitting_h__
2 #define __ResidualRefitting_h_ (1)
3 
4 
5 #include <vector>
6 #include <string>
7 
8 #include "TFile.h"
9 #include "TBranch.h"
10 #include "TTree.h"
11 
17 
20 
23 
27 //#include "TrackingTools/GeomPropagators/interface/AnalyticalPropagator.h"
28 //#include "TrackPropagation/SteppingHelixPropagator/interface/SteppingHelixPropagator.h"
29 
30 //#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
31 
32 //#include "TrackPropagation/SteppingHelixPropagator/interface/SteppingHelixPropagator.h"
33 
35 //#include "TrackingTools/TransientTrack/interface/TransientTrack.h"
36 //#include "TrackingTools/TrackRefitter/interface/TrackTransformer.h"
37 
38 class TrackerTopology;
39 
41 
42  static const int N_MAX_STORED = 10;
43  static const int N_MAX_STORED_HIT = 1000;
44 
45  static const int PXB = 1;
46  static const int PXF = 2;
47  static const int TIB = 3;
48  static const int TID = 4;
49  static const int TOB = 5;
50  static const int TEC = 6;
51 
52 
53  public:
54 
55 // typedef std::pair<const Trajectory*, const reco::Track*> ConstTrajTrackPair;
56 // typedef std::vector< ConstTrajTrackPair > ConstTrajTrackPairCollection;
57 
58  typedef struct {
59  int evtNum_;
60  int runNum_;
61  } storage_event;
62 
64 
65 
66  typedef struct StorageMuon {
67 
68  int n_;
69 
71  float pt_ [N_MAX_STORED];
72  float eta_ [N_MAX_STORED];
73  float p_ [N_MAX_STORED];
74  float phi_ [N_MAX_STORED];
77  float ndf_ [N_MAX_STORED];
79 
81  n_(0) {
82  for (int i=0;i<N_MAX_STORED;++i) {
83  charge_[i] = 0;
84  pt_[i] = 0.;
85  eta_[i] = 0.;
86  p_[i] = 0.;
87  phi_[i] = 0.;
88  numRecHits_[i] = 0;
89  chiSq_[i] = 0.;
90  ndf_[i] = 0.;
91  chiSqOvrNdf_[i] = 0.;
92  }
93  }
94  } storage_muon; // Storage for standard muon information
95 
96  typedef struct StorageHit {
97 
98  int n_;
100 
110 
119 
121  n_(0) {
122  for (int i=0;i<N_MAX_STORED_HIT;++i) {
123  muonLink_[i] = 0;
124  system_[i] = 0;
125  endcap_[i] = 0;
126  station_[i] = 0;
127  ring_[i] = 0;
128  chamber_[i] = 0;
129  layer_[i] = 0;
130  superLayer_[i] = 0;
131  wheel_[i] = 0;
132  sector_[i] = 0;
133  gpX_[i] = 0.;
134  gpY_[i] = 0.;
135  gpZ_[i] = 0.;
136  gpEta_[i] = 0.;
137  gpPhi_[i] = 0.;
138  lpX_[i] = 0.;
139  lpY_[i] = 0.;
140  lpZ_[i] = 0.;
141  }
142  }
143  } storage_hit;
144 
145  typedef struct StorageTrackExtrap {
146 
147  int n_;
148 
162 
164  n_(0) {
165  for (int i=0;i<N_MAX_STORED_HIT;++i) {
166  muonLink_[i] = 0;
167  recLink_[i] = 0;
168  gpX_[i] = 0.;
169  gpY_[i] = 0.;
170  gpZ_[i] = 0.;
171  gpEta_[i] = 0.;
172  gpPhi_[i] = 0.;
173  lpX_[i] = 0.;
174  lpY_[i] = 0.;
175  lpZ_[i] = 0.;
176  resX_[i] = 0.;
177  resY_[i] = 0.;
178  resZ_[i] = 0.;
179  }
180  }
182 
183  typedef struct StorageTrackHit {
184 
185  int n_;
186 
199 
208 
210  n_(0) {
211  for (int i=0;i<N_MAX_STORED_HIT;++i) {
212  muonLink_[i] = 0;
213  detector_[i] = 0;
214  subdetector_[i] = 0;
215  blade_[i] = 0;
216  disk_[i] = 0;
217  ladder_[i] = 0;
218  layer_[i] = 0;
219  module_[i] = 0;
220  panel_[i] = 0;
221  ring_[i] = 0;
222  side_[i] = 0;
223  wheel_[i] = 0;
224  gpX_[i] = 0.;
225  gpY_[i] = 0.;
226  gpZ_[i] = 0.;
227  gpEta_[i] = 0.;
228  gpPhi_[i] = 0.;
229  lpX_[i] = 0.;
230  lpY_[i] = 0.;
231  lpZ_[i] = 0.;
232  }
233  }
235 
236 //Standard Muon info storage
244 
247 
249 
256 
257 
258 
259 //Rec hit storage
262 
263 //Track Extrapolation to Muon System
266 
267 //Track Extrapolation with Cylinder
269 
270 //Track Extrapolation to Tracker system
279 
280 //
281 // Start of the method declarations
282 //
283 
284  explicit ResidualRefitting( const edm::ParameterSet & );
286 
287  virtual void analyze(const edm::Event&, const edm::EventSetup&);
288  virtual void beginJob() ;
289  virtual void endJob() ;
290 //Zero Storage
291  void zero_storage();
294  void branchMuon(ResidualRefitting::storage_muon& storageTmp, std::string branchName);
296 
297 
298 
299 // void collectTrackRecExtrap(reco::MuonCollection::const_iterator muon, ResidualRefitting::storage_trackExtrap& storeTemp);
300  void muonInfo(ResidualRefitting::storage_muon& storeMuon, reco::TrackRef muon, int val);
301 
303  const edm::EventSetup& eventSetup);
304  void StoreTrackerRecHits(DetId detid, const TrackerTopology* tTopo, int iTrack, int iRec);
307  int MatchTrackWithRecHits(reco::TrackCollection::const_iterator trackIt, edm::Handle<reco::TrackCollection> ref);
308 
310 
311 
312  void trkExtrap(const DetId& detid, int iTrkLink, int iTrk, int iRec,
313  const FreeTrajectoryState& freeTrajState,
314  const LocalPoint& recPoint,
315  storage_trackExtrap& storeTemp);
316 
317  void cylExtrapTrkSam(int recNum, reco::TrackRef track, ResidualRefitting::storage_trackExtrap& storage, double rho);
318 
319 //Simplifiying functions
320  FreeTrajectoryState freeTrajStateMuon(reco::TrackRef muon);//Returns a Free Trajectory State
321 //Debug Data Dumps
322 // void dumpRecoMuonColl(reco::MuonCollection::const_iterator muon); //
323 // void dumpRecoTrack(reco::TrackCollection::const_iterator muon);
328 
329  int ReturnSector(DetId detid);
331 
332 
333 // Deprecated Functions
339  ResidualRefitting::storage_trackExtrap& storeExtrap, int omitSystem);
340 
341  // output histogram file name
343  //edm::InputTag PropagatorSource_;
345 
346  // names of product labels
351  muonsNoPXF_,
353  muonsNoTID_,
355  muonsNoTEC_;
356 // tjTag;
357 
358 
359  bool debug_;
360 
361  // output ROOT file
362  TFile * outputFile_ ;
363 
364  TTree *outputTree_;
365  TBranch *outputBranch_;
366 
367 // unsigned int nBins_;
368 
373 
374 };
375 
376 #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
int i
Definition: DBlmapReader.cc:9
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]
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)
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
struct ResidualRefitting::StorageTrackHit storage_trackHit
virtual void analyze(const edm::Event &, const edm::EventSetup &)
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
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::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_
Definition: DetId.h:18
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
edm::InputTag muons_
ResidualRefitting::storage_trackExtrap storageTrackNoTID
ResidualRefitting::storage_muon storageTrkNoTOBLayer2
bool IsSameHit(trackingRecHit_iterator hit1, trackingRecHit_iterator hit2)
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_
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_
ResidualRefitting::storage_muon storageGmrNoTOBLayer5
ResidualRefitting::storage_trackExtrap storageTrackNoTIBLayer3
virtual void beginJob()
edm::InputTag muonsNoStation4_
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
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
ResidualRefitting::storage_muon storageTrkNoPXBLayer3
edm::InputTag muonsNoTOBLayer1_
edm::InputTag muonsNoTEC_
ResidualRefitting::storage_muon storageTrkNoTIBLayer4
ResidualRefitting::storage_trackExtrap samExtrap120_