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 } // namespace edm
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  //---- The muon service
174  //---- The root file for the histograms
175  TFile *theFile;
176  //---- printalot debug output
177  bool printalot;
178  //---- counter
180  //---- magnetic field
181  bool magField;
182  //---- track direction
183  bool alongZ;
184  //---- filter variable
186 
187  //---- Variables
188  //---- LCTs
189  bool allCLCT[2][4][4][NumCh]; //endcap/station/ring/chamber
190  bool allALCT[2][4][4][NumCh]; //endcap/station/ring/chamber
191  bool allCorrLCT[2][4][4][NumCh]; //endcap/station/ring/chamber
192 
193  //---- Strips: strip number and ADCPeak
194  std::vector<std::pair<int, float> > allStrips[2][4][4][NumCh][6]; //endcap/station/ring/chamber/layer
195 
196  //----Wires: WG number and Y-position, time bin
197  std::vector<std::pair<std::pair<int, float>, int> > allWG[2][4][4][NumCh][6]; //endcap/station/ring/chamber/layer
198 
199  //SetOfSimHits (*all_SimHits)[2][4][4][ NumCh];
200  //---- Simhits
201  std::vector<std::pair<LocalPoint, int> > allSimhits[2][4][4][NumCh][6]; //endcap/station/ring/chamber/layer
202 
203  //rechits
204  //SetOfRecHits (*all_RecHits)[2][4][4][ NumCh];
205  std::vector<std::pair<LocalPoint, bool> > allRechits[2][4][4][NumCh][6]; //endcap/station/ring/chamber/layer
206 
207  // segments
208  std::vector<std::pair<LocalPoint, LocalVector> > allSegments[2][4][4][NumCh]; //endcap/station/ring/chamber
209 
210  // empty chambers
211  bool emptyChambers[2][4][4][NumCh]; //endcap/station/ring/chamber
212 
213  //---- Functions
214  void fillDigiInfo(edm::Handle<CSCALCTDigiCollection> &alcts,
222  edm::ESHandle<CSCGeometry> &cscGeom);
223  void fillLCT_info(edm::Handle<CSCALCTDigiCollection> &alcts,
227  void fillStrips_info(edm::Handle<CSCStripDigiCollection> &strips);
228  void fillRechitsSegments_info(edm::Handle<CSCRecHit2DCollection> &rechits,
230  edm::ESHandle<CSCGeometry> &cscGeom);
231  void fillSimhit_info(edm::Handle<edm::PSimHitContainer> &simHits);
232 
233  void ringCandidates(int station, float absEta, std::map<std::string, bool> &chamberTypes);
234  void chamberCandidates(int station, int ring, float phi, std::vector<int> &coupleOfChambers);
235 
236  bool efficienciesPerChamber(CSCDetId &id, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber);
237  bool stripWire_Efficiencies(CSCDetId &cscDetId, FreeTrajectoryState &ftsChamber);
238  bool recHitSegment_Efficiencies(CSCDetId &cscDetId, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber);
239  bool recSimHitEfficiency(CSCDetId &id, FreeTrajectoryState &ftsChamber);
240  //
241  void returnTypes(CSCDetId &id, int &ec, int &st, int &rg, int &ch, int &secondRing);
242  //
243  void getFromFTS(const FreeTrajectoryState &fts,
244  CLHEP::Hep3Vector &p3,
245  CLHEP::Hep3Vector &r3,
246  int &charge,
247  AlgebraicSymMatrix66 &cov);
248 
249  FreeTrajectoryState getFromCLHEP(const CLHEP::Hep3Vector &p3,
250  const CLHEP::Hep3Vector &r3,
251  int charge,
252  const AlgebraicSymMatrix66 &cov,
253  const MagneticField *field);
254 
255  void linearExtrapolation(GlobalPoint initialPosition,
256  GlobalVector initialDirection,
257  float zSurface,
258  std::vector<float> &posZY);
259  double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine);
260  double lineParameter(double initZPosition, double destZPosition, double initZDirection);
261  bool inSensitiveLocalRegion(double xLocal, double yLocal, int station, int ring);
262  bool checkLocal(double yLocal, double yBoundary, int station, int ring);
263  void chooseDirection(CLHEP::Hep3Vector &innerPosition, CLHEP::Hep3Vector &outerPosition);
265  TrajectoryStateOnSurface propagate(FreeTrajectoryState &ftsStart, const BoundPlane &bp);
266  bool applyTrigger(edm::Handle<edm::TriggerResults> &hltR, const edm::TriggerNames &triggerNames);
267  //bool applyTrigger(void);
268 
269  //---- Histograms
270  TH1F *DataFlow;
272  //
277  //---- Histogram set (stations)...
278  struct StationHistos {
290  } StHist[2][4];
291  //---- Histogram set (chambers)...
292  struct ChamberHistos {
307  std::vector<TH1F *> Y_InefficientRecHits_inSegment;
308  std::vector<TH1F *> Y_EfficientRecHits_inSegment;
309  std::vector<TH1F *> Phi_InefficientRecHits_inSegment;
310  std::vector<TH1F *> Phi_EfficientRecHits_inSegment;
311  //
312  TH1F *SimRechits;
313  TH1F *SimSimhits;
314  /*
315  TH1F * SimRechits_each;
316  TH1F * SimSimhits_each;
317  */
318  } ChHist[2][4][3][LastCh - FirstCh + 1];
319 };
320 
321 #endif
std::string rootFileName
edm::EDGetTokenT< CSCStripDigiCollection > sd_token
TH1F * CLCTPerEvent
std::vector< TH1F * > Y_InefficientRecHits_inSegment
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > co_token
edm::EDGetTokenT< CSCCLCTDigiCollection > cl_token
double local_DX_DZ_Max
bool getAbsoluteEfficiency
void beginJob()
Definition: Breakpoints.cc:14
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
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
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
strips
#turn off noise in all subdetectors simHcalUnsuppressedDigis.doNoise = False mix.digitizers.hcal.doNoise = False simEcalUnsuppressedDigis.doNoise = False mix.digitizers.ecal.doNoise = False simEcalUnsuppressedDigis.doESNoise = False simSiPixelDigis.AddNoise = False mix.digitizers.pixel.AddNoise = False simSiStripDigis.Noise = False mix.digitizers.strip.AddNoise = False
Definition: DigiDM_cff.py:32
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