CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CSCValidation.h
Go to the documentation of this file.
1 #ifndef RecoLocalMuon_CSCValidation_H
2 #define RecoLocalMuon_CSCValidation_H
3 
34 
54 //FEDRawData
58 
61 
66 
69 
74 
77 
84 
93 
95 
97 #include "TVector3.h"
98 #include "TH1F.h"
99 #include "TH2F.h"
100 #include "TFile.h"
101 #include "TString.h"
102 #include "TTree.h"
103 #include "TProfile2D.h"
104 
106 public:
109 
111  ~CSCValidation() override;
112 
114  void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override;
115  void endJob() override;
116 
117  // for noise module
118  struct ltrh {
119  bool operator()(const CSCRecHit2D &rh1, const CSCRecHit2D &rh2) const {
120  return ((rh1.localPosition()).x() - (rh2.localPosition()).x()) < 0;
121  }
122  };
123 
124 protected:
125 private:
126  // these are the "modules"
127  // if you would like to add code to CSCValidation, please do so by adding an
128  // extra module in the form of an additional private member function
146  void doCalibrations(const edm::EventSetup &eventSetup);
147  void doAFEBTiming(const CSCWireDigiCollection &);
149  void doADCTiming(const CSCRecHit2DCollection &);
163  const edm::EventSetup &eventSetup,
164  const edm::Event &event);
166 
167  // some useful functions
171  float fitX(const CLHEP::HepMatrix &sp, const CLHEP::HepMatrix &ep);
172  float getSignal(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip);
173  float getthisSignal(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip);
174  int getWidth(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip);
176  int chamberSerial(CSCDetId id);
177  int ringSerial(CSCDetId id);
178 
179  // these functions handle Stoyan's efficiency code
180  void fillEfficiencyHistos(int bin, int flag);
181  void getEfficiency(float bin, float Norm, std::vector<float> &eff);
182  void histoEfficiency(TH1F *readHisto, TH1F *writeHisto);
183  double lineParametrization(double z1Position, double z2Position, double z1Direction) {
184  double parameterLine = (z2Position - z1Position) / z1Direction;
185  return parameterLine;
186  }
187  double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine) {
188  double extrapolatedPosition = initPosition + initDirection * parameterOfTheLine;
189  return extrapolatedPosition;
190  }
191  bool withinSensitiveRegion(LocalPoint localPos,
192  const std::array<const float, 4> &layerBounds,
193  int station,
194  int ring,
195  float shiftFromEdge,
196  float shiftFromDeadZone);
197 
198  // counters
204 
205  //
206  //
207  // The root file for the histograms.
208  TFile *theFile;
209 
210  //
211  //
212  // input parameters for this module
213  bool makePlots;
220  bool useDigis;
222 
223  // filters
226 
227  // quality filter parameters
228  double pMin;
229  double chisqMax;
232  double deltaPhiMax;
234 
249 
250  // module on/off switches
269 
270  // The histo managing object
272 
273  // tmp histos for Efficiency
274  TH1F *hSSTE;
275  TH1F *hRHSTE;
276  TH1F *hSEff;
277  TH1F *hRHEff;
278  TH2F *hSSTE2;
279  TH2F *hRHSTE2;
280  TH2F *hStripSTE2;
281  TH2F *hWireSTE2;
282  TH2F *hSEff2;
283  TH2F *hRHEff2;
284  TH2F *hStripEff2;
285  TH2F *hWireEff2;
288 
289  // occupancy
290  TH2I *hOWires;
291  TH2I *hOStrips;
292  TH2I *hORecHits;
293  TH2I *hOSegments;
294 
296  std::vector<int> nmbhvsegm;
297  std::map<int, std::vector<int> > m_wire_hvsegm;
298  std::map<int, int> m_single_wire_layer;
299 
300  //maps to store the DetId and associated RecHits
301  std::multimap<CSCDetId, CSCRecHit2D> AllRechits;
302  std::multimap<CSCDetId, CSCRecHit2D> SegRechits;
303  std::multimap<CSCDetId, CSCRecHit2D> NonAssociatedRechits;
304  std::map<CSCRecHit2D, float, ltrh> distRHmap;
305 
306  int typeIndex(CSCDetId id) {
307  // linearlized index bases on endcap, station, and ring
308  int index = 0;
309  if (id.station() == 1) {
310  index = id.ring() + 1;
311  if (id.ring() == 4)
312  index = 1;
313  } else
314  index = id.station() * 2 + id.ring();
315  if (id.endcap() == 1)
316  index = index + 10;
317  if (id.endcap() == 2)
318  index = 11 - index;
319  return index;
320  }
321 };
322 #endif
edm::EDGetTokenT< CSCCLCTDigiCollection > cl_token
bool makeADCTimingPlots
float getthisSignal(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip)
bool operator()(const CSCRecHit2D &rh1, const CSCRecHit2D &rh2) const
edm::EDGetTokenT< CSCComparatorDigiCollection > cd_token
float fitX(const CLHEP::HepMatrix &sp, const CLHEP::HepMatrix &ep)
TH2F * hSensitiveAreaEvt
std::map< int, std::vector< int > > m_wire_hvsegm
std::multimap< CSCDetId, CSCRecHit2D > NonAssociatedRechits
int typeIndex(CSCDetId id)
bool makeResolutionPlots
void doNoiseHits(edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCSegmentCollection > cscSegments, edm::ESHandle< CSCGeometry > cscGeom, edm::Handle< CSCStripDigiCollection > strips)
void endJob() override
edm::EDGetTokenT< CSCWireDigiCollection > wd_token
bool makeAFEBTimingPlots
void doRecHits(edm::Handle< CSCRecHit2DCollection > recHits, edm::ESHandle< CSCGeometry > cscGeom)
std::string refRootFile
void doEfficiencies(edm::Handle< CSCWireDigiCollection > wires, edm::Handle< CSCStripDigiCollection > strips, edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCSegmentCollection > cscSegments, edm::ESHandle< CSCGeometry > cscGeom)
bool makeComparisonPlots
bool withinSensitiveRegion(LocalPoint localPos, const std::array< const float, 4 > &layerBounds, int station, int ring, float shiftFromEdge, float shiftFromDeadZone)
bool doTrigger(edm::Handle< L1MuGMTReadoutCollection > pCollection)
double lineParametrization(double z1Position, double z2Position, double z1Direction)
bool makeEfficiencyPlots
edm::EDGetTokenT< edm::TriggerResults > tr_token
bool makeStandalonePlots
void doCompTiming(const CSCComparatorDigiCollection &)
void doPedestalNoise(edm::Handle< CSCStripDigiCollection > strips)
edm::EDGetTokenT< CSCSegmentCollection > se_token
bool makePedNoisePlots
void doStripDigis(edm::Handle< CSCStripDigiCollection > strips)
edm::EDGetTokenT< CSCStripDigiCollection > sd_token
int getWidth(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip)
void histoEfficiency(TH1F *readHisto, TH1F *writeHisto)
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
int ringSerial(CSCDetId id)
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > geomToken_
~CSCValidation() override
Destructor.
bool filterEvents(edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCSegmentCollection > cscSegments, edm::Handle< reco::TrackCollection > saMuons)
bool doHLT(edm::Handle< edm::TriggerResults > hltResults)
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > co_token
TH2F * hEffDenominator
std::multimap< CSCDetId, CSCRecHit2D > SegRechits
edm::EDGetTokenT< edm::PSimHitContainer > sh_token
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override
Perform the analysis.
void doSimHits(edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< edm::PSimHitContainer > simHits)
edm::EDGetTokenT< reco::TrackCollection > sa_token
bool makeCompTimingPlots
void doGasGain(const CSCWireDigiCollection &, const CSCStripDigiCollection &, const CSCRecHit2DCollection &)
LocalPoint localPosition() const override
Definition: CSCRecHit2D.h:56
bool makeOccupancyPlots
void getEfficiency(float bin, float Norm, std::vector< float > &eff)
void doResolution(edm::Handle< CSCSegmentCollection > cscSegments, edm::ESHandle< CSCGeometry > cscGeom)
void findNonAssociatedRecHits(edm::ESHandle< CSCGeometry > cscGeom, edm::Handle< CSCStripDigiCollection > strips)
void fillEfficiencyHistos(int bin, int flag)
std::vector< int > nmbhvsegm
Maps and vectors for module doGasGain()
tuple simHits
Definition: trackerHits.py:16
edm::EDGetTokenT< L1MuGMTReadoutCollection > l1_token
void doAFEBTiming(const CSCWireDigiCollection &)
void doTimeMonitoring(edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCSegmentCollection > cscSegments, edm::Handle< CSCALCTDigiCollection > alcts, edm::Handle< CSCCLCTDigiCollection > clcts, edm::Handle< CSCCorrelatedLCTDigiCollection > correlatedlcts, edm::Handle< L1MuGMTReadoutCollection > pCollection, edm::ESHandle< CSCGeometry > cscGeom, const edm::EventSetup &eventSetup, const edm::Event &event)
bool makeTimeMonitorPlots
float getSignal(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip)
void doStandalone(edm::Handle< reco::TrackCollection > saMuons)
int chamberSerial(CSCDetId id)
std::map< CSCRecHit2D, float, ltrh > distRHmap
std::string rootFileName
void doWireDigis(edm::Handle< CSCWireDigiCollection > wires)
double deltaPhiMax
void doADCTiming(const CSCRecHit2DCollection &)
tuple wires
Definition: DigiDM_cff.py:33
std::map< int, int > m_single_wire_layer
CSCValidation(const edm::ParameterSet &pset)
Constructor.
void doSegments(edm::Handle< CSCSegmentCollection > cscSegments, edm::ESHandle< CSCGeometry > cscGeom)
double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine)
std::multimap< CSCDetId, CSCRecHit2D > AllRechits
void doOccupancies(edm::Handle< CSCStripDigiCollection > strips, edm::Handle< CSCWireDigiCollection > wires, edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCSegmentCollection > cscSegments)
edm::EDGetTokenT< FEDRawDataCollection > rd_token
edm::EDGetTokenT< CSCRecHit2DCollection > rh_token
CSCValHists * histos
edm::EDGetTokenT< CSCALCTDigiCollection > al_token
void doCalibrations(const edm::EventSetup &eventSetup)