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?...
20 
27 
31 
34 
39 
44 
51 
54 
56 
58 #include "CLHEP/Matrix/Vector.h"
59 #include "CLHEP/Vector/ThreeVector.h"
60 
61 #include "TFile.h"
62 #include "TVector3.h"
63 #include "TProfile.h"
64 #include "TMath.h"
65 #include "TH1F.h"
66 #include "TH2F.h"
67 #include "TString.h"
68 
69 #include <iostream>
70 #include <iomanip>
71 #include <fstream>
72 //#include "Math/Interpolator.h"
73 
74 #include <vector>
75 #include <map>
76 #include <string>
77 
78 #define SQR(x) ((x) * (x))
79 
80 #define LastCh 36
81 #define FirstCh 1
82 #define NumCh (LastCh - FirstCh + 1)
83 
84 namespace edm {
85  class ParameterSet;
86  class Event;
87  class EventSetup;
88  class TriggerNames;
89 } // namespace edm
90 
91 class TFile;
92 class CSCLayer;
93 class CSCDetId;
94 
96 public:
99 
101  ~CSCEfficiency() override;
102 
103 private:
104  //---- analysis + filter
105  bool filter(edm::Event &event, const edm::EventSetup &eventSetup) override;
106 
107  //---- (input) parameters
108  //---- Root file name
110 
111  //---- digi/object tokens
112 
120 
123 
125 
127 
128  //
129  unsigned int printout_NEvents;
130  bool isData;
131  bool isIPdata;
134  bool useDigis;
136  double minP;
137  double maxP;
138  double maxNormChi2;
139  unsigned int minTrackHits;
140 
145 
146  // trigger
148  std::vector<std::string> myTriggers;
149  std::vector<int> pointToTriggers;
150  bool andOr;
151 
152  //---- The muon service
154  //---- The root file for the histograms
155  TFile *theFile;
156  //---- printalot debug output
157  bool printalot;
158  //---- counter
160  //---- magnetic field
161  bool magField;
162  //---- track direction
163  bool alongZ;
164  //---- filter variable
166 
167  //---- Variables
168  //---- LCTs
169  bool allCLCT[2][4][4][NumCh]; //endcap/station/ring/chamber
170  bool allALCT[2][4][4][NumCh]; //endcap/station/ring/chamber
171  bool allCorrLCT[2][4][4][NumCh]; //endcap/station/ring/chamber
172 
173  //---- Strips: strip number and ADCPeak
174  std::vector<std::pair<int, float> > allStrips[2][4][4][NumCh][6]; //endcap/station/ring/chamber/layer
175 
176  //----Wires: WG number and Y-position, time bin
177  std::vector<std::pair<std::pair<int, float>, int> > allWG[2][4][4][NumCh][6]; //endcap/station/ring/chamber/layer
178 
179  //SetOfSimHits (*all_SimHits)[2][4][4][ NumCh];
180  //---- Simhits
181  std::vector<std::pair<LocalPoint, int> > allSimhits[2][4][4][NumCh][6]; //endcap/station/ring/chamber/layer
182 
183  //rechits
184  //SetOfRecHits (*all_RecHits)[2][4][4][ NumCh];
185  std::vector<std::pair<LocalPoint, bool> > allRechits[2][4][4][NumCh][6]; //endcap/station/ring/chamber/layer
186 
187  // segments
188  std::vector<std::pair<LocalPoint, LocalVector> > allSegments[2][4][4][NumCh]; //endcap/station/ring/chamber
189 
190  // empty chambers
191  bool emptyChambers[2][4][4][NumCh]; //endcap/station/ring/chamber
192 
193  //---- Functions
202  edm::ESHandle<CSCGeometry> &cscGeom);
210  edm::ESHandle<CSCGeometry> &cscGeom);
212 
213  void ringCandidates(int station, float absEta, std::map<std::string, bool> &chamberTypes);
214  void chamberCandidates(int station, int ring, float phi, std::vector<int> &coupleOfChambers);
215 
216  bool efficienciesPerChamber(CSCDetId &id, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber);
217  bool stripWire_Efficiencies(CSCDetId &cscDetId, FreeTrajectoryState &ftsChamber);
218  bool recHitSegment_Efficiencies(CSCDetId &cscDetId, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber);
219  bool recSimHitEfficiency(CSCDetId &id, FreeTrajectoryState &ftsChamber);
220  //
221  void returnTypes(CSCDetId &id, int &ec, int &st, int &rg, int &ch, int &secondRing);
222  //
223  void getFromFTS(const FreeTrajectoryState &fts,
224  CLHEP::Hep3Vector &p3,
225  CLHEP::Hep3Vector &r3,
226  int &charge,
227  AlgebraicSymMatrix66 &cov);
228 
229  FreeTrajectoryState getFromCLHEP(const CLHEP::Hep3Vector &p3,
230  const CLHEP::Hep3Vector &r3,
231  int charge,
232  const AlgebraicSymMatrix66 &cov,
233  const MagneticField *field);
234 
235  void linearExtrapolation(GlobalPoint initialPosition,
236  GlobalVector initialDirection,
237  float zSurface,
238  std::vector<float> &posZY);
239  double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine);
240  double lineParameter(double initZPosition, double destZPosition, double initZDirection);
241  bool inSensitiveLocalRegion(double xLocal, double yLocal, int station, int ring);
242  bool checkLocal(double yLocal, double yBoundary, int station, int ring);
243  void chooseDirection(CLHEP::Hep3Vector &innerPosition, CLHEP::Hep3Vector &outerPosition);
247  //bool applyTrigger(void);
248 
249  //---- Histograms
250  TH1F *DataFlow;
252  //
257  //---- Histogram set (stations)...
258  struct StationHistos {
270  } StHist[2][4];
271  //---- Histogram set (chambers)...
272  struct ChamberHistos {
287  std::vector<TH1F *> Y_InefficientRecHits_inSegment;
288  std::vector<TH1F *> Y_EfficientRecHits_inSegment;
289  std::vector<TH1F *> Phi_InefficientRecHits_inSegment;
290  std::vector<TH1F *> Phi_EfficientRecHits_inSegment;
291  //
292  TH1F *SimRechits;
293  TH1F *SimSimhits;
294  /*
295  TH1F * SimRechits_each;
296  TH1F * SimSimhits_each;
297  */
298  } ChHist[2][4][3][LastCh - FirstCh + 1];
299 };
300 
301 #endif
bool allCorrLCT[2][4][4][(36 - 1+1)]
bool allALCT[2][4][4][(36 - 1+1)]
std::string rootFileName
bool applyTrigger(edm::Handle< edm::TriggerResults > &hltR, const edm::TriggerNames &triggerNames)
edm::EDGetTokenT< CSCStripDigiCollection > sd_token
void fillWG_info(edm::Handle< CSCWireDigiCollection > &wires, edm::ESHandle< CSCGeometry > &cscGeom)
void chooseDirection(CLHEP::Hep3Vector &innerPosition, CLHEP::Hep3Vector &outerPosition)
TH1F * CLCTPerEvent
void ringCandidates(int station, float absEta, std::map< std::string, bool > &chamberTypes)
double lineParameter(double initZPosition, double destZPosition, double initZDirection)
std::vector< TH1F * > Y_InefficientRecHits_inSegment
bool allCLCT[2][4][4][(36 - 1+1)]
const Propagator * propagator(std::string propagatorName) const
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > co_token
bool recSimHitEfficiency(CSCDetId &id, FreeTrajectoryState &ftsChamber)
CSCEfficiency(const edm::ParameterSet &pset)
Constructor.
edm::EDGetTokenT< CSCCLCTDigiCollection > cl_token
bool emptyChambers[2][4][4][(36 - 1+1)]
std::vector< std::pair< LocalPoint, int > > allSimhits[2][4][4][(36 - 1+1)][6]
double local_DX_DZ_Max
void returnTypes(CSCDetId &id, int &ec, int &st, int &rg, int &ch, int &secondRing)
bool getAbsoluteEfficiency
edm::EDGetTokenT< CSCSegmentCollection > se_token
FreeTrajectoryState getFromCLHEP(const CLHEP::Hep3Vector &p3, const CLHEP::Hep3Vector &r3, int charge, const AlgebraicSymMatrix66 &cov, const MagneticField *field)
std::vector< std::string > myTriggers
std::vector< TH1F * > Phi_InefficientRecHits_inSegment
double local_DY_DZ_Max
std::vector< TH1F * > Y_EfficientRecHits_inSegment
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > geomToken_
edm::EDGetTokenT< edm::PSimHitContainer > sh_token
MuonServiceProxy * theService
edm::EDGetTokenT< CSCWireDigiCollection > wd_token
struct CSCEfficiency::ChamberHistos ChHist[2][4][3][36 - 1+1]
void linearExtrapolation(GlobalPoint initialPosition, GlobalVector initialDirection, float zSurface, std::vector< float > &posZY)
std::vector< std::pair< std::pair< int, float >, int > > allWG[2][4][4][(36 - 1+1)][6]
double distanceFromDeadZone
void getFromFTS(const FreeTrajectoryState &fts, CLHEP::Hep3Vector &p3, CLHEP::Hep3Vector &r3, int &charge, AlgebraicSymMatrix66 &cov)
bool efficienciesPerChamber(CSCDetId &id, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber)
void chamberCandidates(int station, int ring, float phi, std::vector< int > &coupleOfChambers)
std::vector< TH1F * > Phi_EfficientRecHits_inSegment
double maxNormChi2
void fillLCT_info(edm::Handle< CSCALCTDigiCollection > &alcts, edm::Handle< CSCCLCTDigiCollection > &clcts, edm::Handle< CSCCorrelatedLCTDigiCollection > &correlatedlcts)
void fillRechitsSegments_info(edm::Handle< CSCRecHit2DCollection > &rechits, edm::Handle< CSCSegmentCollection > &segments, edm::ESHandle< CSCGeometry > &cscGeom)
bool stripWire_Efficiencies(CSCDetId &cscDetId, FreeTrajectoryState &ftsChamber)
double local_DY_DZ_Min
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
edm::EDGetTokenT< CSCRecHit2DCollection > rh_token
double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine)
void fillDigiInfo(edm::Handle< CSCALCTDigiCollection > &alcts, edm::Handle< CSCCLCTDigiCollection > &clcts, edm::Handle< CSCCorrelatedLCTDigiCollection > &correlatedlcts, edm::Handle< CSCWireDigiCollection > &wires, edm::Handle< CSCStripDigiCollection > &strips, edm::Handle< edm::PSimHitContainer > &simhits, edm::Handle< CSCRecHit2DCollection > &rechits, edm::Handle< CSCSegmentCollection > &segments, edm::ESHandle< CSCGeometry > &cscGeom)
#define FirstCh
Definition: CSCEfficiency.h:81
bool filter(edm::Event &event, const edm::EventSetup &eventSetup) override
std::vector< std::pair< LocalPoint, LocalVector > > allSegments[2][4][4][(36 - 1+1)]
bool recHitSegment_Efficiencies(CSCDetId &cscDetId, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber)
unsigned int printout_NEvents
TH1F * TriggersFired
~CSCEfficiency() override
Destructor.
bool inSensitiveLocalRegion(double xLocal, double yLocal, int station, int ring)
bool checkLocal(double yLocal, double yBoundary, int station, int ring)
TH1F * segmentsPerEvent
struct CSCEfficiency::StationHistos StHist[2][4]
TH1F * recHitsPerEvent
HLT enums.
std::vector< std::pair< LocalPoint, bool > > allRechits[2][4][4][(36 - 1+1)][6]
#define LastCh
Definition: CSCEfficiency.h:80
std::vector< int > pointToTriggers
void fillSimhit_info(edm::Handle< edm::PSimHitContainer > &simHits)
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
Definition: CSCEfficiency.h:82
unsigned int minTrackHits
edm::EDGetTokenT< CSCALCTDigiCollection > al_token
edm::EDGetTokenT< edm::TriggerResults > ht_token
Definition: event.py:1
TrajectoryStateOnSurface propagate(FreeTrajectoryState &ftsStart, const BoundPlane &bp)
std::vector< std::pair< int, float > > allStrips[2][4][4][(36 - 1+1)][6]
edm::EDGetTokenT< edm::View< reco::Track > > tk_token
void fillStrips_info(edm::Handle< CSCStripDigiCollection > &strips)