CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
95 class CSCEfficiency : public edm::EDFilter {
96 public:
99 
101  ~CSCEfficiency() override;
102 
103 private:
104  void beginJob() override;
105  //---- analysis + filter
106  bool filter(edm::Event &event, const edm::EventSetup &eventSetup) override;
107 
108  void endJob() override;
109 
110  //---- (input) parameters
111  //---- Root file name
113 
114  //---- digi/object tokens
115 
123 
126 
128 
130 
131  //
132  unsigned int printout_NEvents;
133  bool isData;
134  bool isIPdata;
137  bool useDigis;
139  double minP;
140  double maxP;
141  double maxNormChi2;
142  unsigned int minTrackHits;
143 
148 
149  // trigger
151  std::vector<std::string> myTriggers;
152  std::vector<int> pointToTriggers;
153  bool andOr;
154 
155  //---- The muon service
157  //---- The root file for the histograms
158  TFile *theFile;
159  //---- printalot debug output
160  bool printalot;
161  //---- counter
163  //---- magnetic field
164  bool magField;
165  //---- track direction
166  bool alongZ;
167  //---- filter variable
169 
170  //---- Variables
171  //---- LCTs
172  bool allCLCT[2][4][4][NumCh]; //endcap/station/ring/chamber
173  bool allALCT[2][4][4][NumCh]; //endcap/station/ring/chamber
174  bool allCorrLCT[2][4][4][NumCh]; //endcap/station/ring/chamber
175 
176  //---- Strips: strip number and ADCPeak
177  std::vector<std::pair<int, float> > allStrips[2][4][4][NumCh][6]; //endcap/station/ring/chamber/layer
178 
179  //----Wires: WG number and Y-position, time bin
180  std::vector<std::pair<std::pair<int, float>, int> > allWG[2][4][4][NumCh][6]; //endcap/station/ring/chamber/layer
181 
182  //SetOfSimHits (*all_SimHits)[2][4][4][ NumCh];
183  //---- Simhits
184  std::vector<std::pair<LocalPoint, int> > allSimhits[2][4][4][NumCh][6]; //endcap/station/ring/chamber/layer
185 
186  //rechits
187  //SetOfRecHits (*all_RecHits)[2][4][4][ NumCh];
188  std::vector<std::pair<LocalPoint, bool> > allRechits[2][4][4][NumCh][6]; //endcap/station/ring/chamber/layer
189 
190  // segments
191  std::vector<std::pair<LocalPoint, LocalVector> > allSegments[2][4][4][NumCh]; //endcap/station/ring/chamber
192 
193  // empty chambers
194  bool emptyChambers[2][4][4][NumCh]; //endcap/station/ring/chamber
195 
196  //---- Functions
205  edm::ESHandle<CSCGeometry> &cscGeom);
213  edm::ESHandle<CSCGeometry> &cscGeom);
215 
216  void ringCandidates(int station, float absEta, std::map<std::string, bool> &chamberTypes);
217  void chamberCandidates(int station, int ring, float phi, std::vector<int> &coupleOfChambers);
218 
219  bool efficienciesPerChamber(CSCDetId &id, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber);
220  bool stripWire_Efficiencies(CSCDetId &cscDetId, FreeTrajectoryState &ftsChamber);
221  bool recHitSegment_Efficiencies(CSCDetId &cscDetId, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber);
222  bool recSimHitEfficiency(CSCDetId &id, FreeTrajectoryState &ftsChamber);
223  //
224  void returnTypes(CSCDetId &id, int &ec, int &st, int &rg, int &ch, int &secondRing);
225  //
226  void getFromFTS(const FreeTrajectoryState &fts,
227  CLHEP::Hep3Vector &p3,
228  CLHEP::Hep3Vector &r3,
229  int &charge,
230  AlgebraicSymMatrix66 &cov);
231 
232  FreeTrajectoryState getFromCLHEP(const CLHEP::Hep3Vector &p3,
233  const CLHEP::Hep3Vector &r3,
234  int charge,
235  const AlgebraicSymMatrix66 &cov,
236  const MagneticField *field);
237 
238  void linearExtrapolation(GlobalPoint initialPosition,
239  GlobalVector initialDirection,
240  float zSurface,
241  std::vector<float> &posZY);
242  double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine);
243  double lineParameter(double initZPosition, double destZPosition, double initZDirection);
244  bool inSensitiveLocalRegion(double xLocal, double yLocal, int station, int ring);
245  bool checkLocal(double yLocal, double yBoundary, int station, int ring);
246  void chooseDirection(CLHEP::Hep3Vector &innerPosition, CLHEP::Hep3Vector &outerPosition);
250  //bool applyTrigger(void);
251 
252  //---- Histograms
253  TH1F *DataFlow;
255  //
260  //---- Histogram set (stations)...
261  struct StationHistos {
273  } StHist[2][4];
274  //---- Histogram set (chambers)...
275  struct ChamberHistos {
290  std::vector<TH1F *> Y_InefficientRecHits_inSegment;
291  std::vector<TH1F *> Y_EfficientRecHits_inSegment;
292  std::vector<TH1F *> Phi_InefficientRecHits_inSegment;
293  std::vector<TH1F *> Phi_EfficientRecHits_inSegment;
294  //
295  TH1F *SimRechits;
296  TH1F *SimSimhits;
297  /*
298  TH1F * SimRechits_each;
299  TH1F * SimSimhits_each;
300  */
301  } ChHist[2][4][3][LastCh - FirstCh + 1];
302 };
303 
304 #endif
std::string rootFileName
bool applyTrigger(edm::Handle< edm::TriggerResults > &hltR, const edm::TriggerNames &triggerNames)
bool allALCT[2][4][4][(36-1+1)]
edm::EDGetTokenT< CSCStripDigiCollection > sd_token
tuple propagatorName
std::vector< std::pair< int, float > > allStrips[2][4][4][(36-1+1)][6]
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
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > co_token
bool recSimHitEfficiency(CSCDetId &id, FreeTrajectoryState &ftsChamber)
CSCEfficiency(const edm::ParameterSet &pset)
Constructor.
void endJob() override
edm::EDGetTokenT< CSCCLCTDigiCollection > cl_token
struct CSCEfficiency::ChamberHistos ChHist[2][4][3][36-1+1]
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
bool allCorrLCT[2][4][4][(36-1+1)]
double local_DY_DZ_Max
std::vector< TH1F * > Y_EfficientRecHits_inSegment
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > geomToken_
edm::EDGetTokenT< edm::PSimHitContainer > sh_token
MuonServiceProxy * theService
void beginJob() override
edm::EDGetTokenT< CSCWireDigiCollection > wd_token
tuple 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
void linearExtrapolation(GlobalPoint initialPosition, GlobalVector initialDirection, float zSurface, std::vector< float > &posZY)
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)
std::vector< std::pair< LocalPoint, bool > > allRechits[2][4][4][(36-1+1)][6]
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
const Propagator * propagator(std::string propagatorName) const
bool recHitSegment_Efficiencies(CSCDetId &cscDetId, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber)
tuple simHits
Definition: trackerHits.py:16
unsigned int printout_NEvents
TH1F * TriggersFired
std::vector< std::pair< LocalPoint, LocalVector > > allSegments[2][4][4][(36-1+1)]
~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]
std::vector< std::pair< LocalPoint, int > > allSimhits[2][4][4][(36-1+1)][6]
TH1F * recHitsPerEvent
bool emptyChambers[2][4][4][(36-1+1)]
#define LastCh
Definition: CSCEfficiency.h:80
std::vector< int > pointToTriggers
void fillSimhit_info(edm::Handle< edm::PSimHitContainer > &simHits)
TH1F * ALCTPerEvent
tuple wires
Definition: DigiDM_cff.py:33
#define NumCh
Definition: CSCEfficiency.h:82
unsigned int minTrackHits
bool allCLCT[2][4][4][(36-1+1)]
std::vector< std::pair< std::pair< int, float >, int > > allWG[2][4][4][(36-1+1)][6]
edm::EDGetTokenT< CSCALCTDigiCollection > al_token
edm::EDGetTokenT< edm::TriggerResults > ht_token
TrajectoryStateOnSurface propagate(FreeTrajectoryState &ftsStart, const BoundPlane &bp)
edm::EDGetTokenT< edm::View< reco::Track > > tk_token
void fillStrips_info(edm::Handle< CSCStripDigiCollection > &strips)