CMS 3D CMS Logo

CSCEfficiency.h
Go to the documentation of this file.
1 #ifndef RecoLocalMuon_CSCEfficiency_H
2 #define RecoLocalMuon_CSCEfficiency_H
3 
10 // how many of the headers below are not needed?...
19 
26 
29 
32 
38 
43 
48 
51 
58 
63 
70 
73 
75 
77 #include "CLHEP/Matrix/Vector.h"
78 #include "CLHEP/Vector/ThreeVector.h"
79 
80 #include "TFile.h"
81 #include "TVector3.h"
82 #include "TProfile.h"
83 #include "TMath.h"
84 #include "TH1F.h"
85 #include "TH2F.h"
86 #include "TString.h"
87 
88 #include <iostream>
89 #include <iomanip>
90 #include <fstream>
91 //#include "Math/Interpolator.h"
92 
93 #include <vector>
94 #include <map>
95 #include <string>
96 
97 #define SQR(x) ((x)*(x))
98 
99 #define LastCh 36
100 #define FirstCh 1
101 #define NumCh (LastCh-FirstCh+1)
102 
103 namespace edm {
104  class ParameterSet;
105  class Event;
106  class EventSetup;
107  class TriggerNames;
108 }
109 
110 class TFile;
111 class CSCLayer;
112 class CSCDetId;
113 
114 class CSCEfficiency : public edm::EDFilter {
115 public:
118 
120  ~CSCEfficiency() override;
121 
122  private:
123  void beginJob() override ;
124  //---- analysis + filter
125  bool filter(edm::Event & event, const edm::EventSetup& eventSetup) override;
126 
127  void endJob() override ;
128 
129  //---- (input) parameters
130  //---- Root file name
132 
133  //---- digi/object tokens
134 
142 
145 
147 
148  //
149  unsigned int printout_NEvents;
150  bool isData;
151  bool isIPdata;
154  bool useDigis;
156  double minP;
157  double maxP;
158  double maxNormChi2;
159  unsigned int minTrackHits;
160 
165 
166  // trigger
168  std::vector<std::string> myTriggers;
169  std::vector <int> pointToTriggers;
170  bool andOr;
171 
172 
173  //---- The muon service
175  //---- The root file for the histograms
176  TFile *theFile;
177  //---- printalot debug output
178  bool printalot;
179  //---- counter
181  //---- magnetic field
182  bool magField;
183  //---- track direction
184  bool alongZ;
185  //---- filter variable
187 
188  //---- Variables
189  //---- LCTs
190  bool allCLCT[2][4][4][NumCh];//endcap/station/ring/chamber
191  bool allALCT[2][4][4][NumCh];//endcap/station/ring/chamber
192  bool allCorrLCT[2][4][4][NumCh];//endcap/station/ring/chamber
193 
194  //---- Strips: strip number and ADCPeak
195  std::vector <std::pair <int, float> > allStrips[2][4][4][NumCh][6];//endcap/station/ring/chamber/layer
196 
197  //----Wires: WG number and Y-position, time bin
198  std::vector <std::pair <std::pair <int, float>, int> > allWG[2][4][4][NumCh][6];//endcap/station/ring/chamber/layer
199 
200  //SetOfSimHits (*all_SimHits)[2][4][4][ NumCh];
201  //---- Simhits
202  std::vector <std::pair <LocalPoint, int> > allSimhits[2][4][4][NumCh][6];//endcap/station/ring/chamber/layer
203 
204  //rechits
205  //SetOfRecHits (*all_RecHits)[2][4][4][ NumCh];
206  std::vector <std::pair <LocalPoint, bool> > allRechits[2][4][4][NumCh][6];//endcap/station/ring/chamber/layer
207 
208  // segments
209  std::vector <std::pair <LocalPoint, LocalVector> > allSegments[2][4][4][NumCh];//endcap/station/ring/chamber
210 
211  // empty chambers
212  bool emptyChambers[2][4][4][NumCh];//endcap/station/ring/chamber
213 
214  //---- Functions
215  void fillDigiInfo(edm::Handle<CSCALCTDigiCollection> &alcts,
223  edm::ESHandle<CSCGeometry> &cscGeom);
224  void fillLCT_info(edm::Handle<CSCALCTDigiCollection> &alcts,
228  void fillStrips_info(edm::Handle<CSCStripDigiCollection> &strips);
229  void fillRechitsSegments_info(edm::Handle<CSCRecHit2DCollection> &rechits,
231  edm::ESHandle<CSCGeometry> &cscGeom);
232  void fillSimhit_info(edm::Handle<edm::PSimHitContainer> &simHits);
233 
234  void ringCandidates(int station, float absEta, std::map <std::string, bool> & chamberTypes);
235  void chamberCandidates(int station, int ring, float phi, std::vector <int> &coupleOfChambers);
236 
237  bool efficienciesPerChamber(CSCDetId & id, const CSCChamber* cscChamber, FreeTrajectoryState &ftsChamber);
238  bool stripWire_Efficiencies(CSCDetId & cscDetId, FreeTrajectoryState &ftsChamber);
239  bool recHitSegment_Efficiencies(CSCDetId & cscDetId, const CSCChamber* cscChamber, FreeTrajectoryState &ftsChamber);
240  bool recSimHitEfficiency(CSCDetId & id, FreeTrajectoryState &ftsChamber);
241  //
242  void returnTypes(CSCDetId & id, int &ec, int &st, int &rg, int &ch, int &secondRing);
243  //
244  void getFromFTS(const FreeTrajectoryState& fts,
245  CLHEP::Hep3Vector& p3, CLHEP::Hep3Vector& r3,
246  int& charge, AlgebraicSymMatrix66& cov);
247 
248  FreeTrajectoryState getFromCLHEP(const CLHEP::Hep3Vector& p3, const CLHEP::Hep3Vector& r3,
249  int charge, const AlgebraicSymMatrix66& cov,
250  const MagneticField* field);
251 
252  void linearExtrapolation(GlobalPoint initialPosition ,GlobalVector initialDirection,
253  float zSurface, std::vector <float> &posZY);
254  double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine);
255  double lineParameter(double initZPosition, double destZPosition, double initZDirection);
256  bool inSensitiveLocalRegion(double xLocal, double yLocal, int station, int ring);
257  bool checkLocal(double yLocal, double yBoundary, int station, int ring);
258  void chooseDirection(CLHEP::Hep3Vector & innerPosition, CLHEP::Hep3Vector & outerPosition);
260  TrajectoryStateOnSurface propagate(FreeTrajectoryState & ftsStart, const BoundPlane &bp);
261  bool applyTrigger(edm::Handle<edm::TriggerResults> &hltR, const edm::TriggerNames & triggerNames);
262  //bool applyTrigger(void);
263 
264 
265  //---- Histograms
266  TH1F * DataFlow;
268  //
269  TH1F * ALCTPerEvent;
270  TH1F * CLCTPerEvent;
273 //---- Histogram set (stations)...
286  }StHist[2][4];
287 //---- Histogram set (chambers)...
303  std::vector<TH1F *> Y_InefficientRecHits_inSegment;
304  std::vector<TH1F *> Y_EfficientRecHits_inSegment;
305  std::vector<TH1F *> Phi_InefficientRecHits_inSegment;
306  std::vector<TH1F *> Phi_EfficientRecHits_inSegment;
307  //
308  TH1F * SimRechits;
309  TH1F * SimSimhits;
310  /*
311  TH1F * SimRechits_each;
312  TH1F * SimSimhits_each;
313  */
314  }ChHist[2][4][3][LastCh-FirstCh+1];
315 };
316 
317 #endif
318 
319 
320 
321 
std::string rootFileName
edm::EDGetTokenT< CSCStripDigiCollection > sd_token
TH1F * CLCTPerEvent
std::vector< TH1F * > Y_InefficientRecHits_inSegment
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > co_token
edm::EDGetTokenT< CSCCLCTDigiCollection > cl_token
double local_DX_DZ_Max
bool getAbsoluteEfficiency
void beginJob()
Definition: Breakpoints.cc:15
edm::EDGetTokenT< CSCSegmentCollection > se_token
std::vector< std::string > myTriggers
std::vector< TH1F * > Phi_InefficientRecHits_inSegment
double local_DY_DZ_Max
std::vector< TH1F * > Y_EfficientRecHits_inSegment
edm::EDGetTokenT< edm::PSimHitContainer > sh_token
MuonServiceProxy * theService
edm::EDGetTokenT< CSCWireDigiCollection > wd_token
double distanceFromDeadZone
std::vector< TH1F * > Phi_EfficientRecHits_inSegment
double maxNormChi2
double local_DY_DZ_Min
edm::EDGetTokenT< CSCRecHit2DCollection > rh_token
#define FirstCh
unsigned int printout_NEvents
TH1F * TriggersFired
TH1F * segmentsPerEvent
TH1F * recHitsPerEvent
HLT enums.
#define LastCh
Definition: CSCEfficiency.h:99
std::vector< int > pointToTriggers
TH1F * ALCTPerEvent
#define NumCh
unsigned int minTrackHits
edm::EDGetTokenT< CSCALCTDigiCollection > al_token
edm::EDGetTokenT< edm::TriggerResults > ht_token
Definition: event.py:1
edm::EDGetTokenT< edm::View< reco::Track > > tk_token
double p3[4]
Definition: TauolaWrapper.h:91