CMS 3D CMS Logo

CSCValidation.h
Go to the documentation of this file.
1 #ifndef RecoLocalMuon_CSCValidation_H
2 #define RecoLocalMuon_CSCValidation_H
3 
29 
42 
62 //FEDRawData
66 
71 
76 
82 
87 
90 
97 
106 
108 
110 #include "TVector3.h"
111 #include "TH1F.h"
112 #include "TH2F.h"
113 #include "TFile.h"
114 #include "TString.h"
115 #include "TTree.h"
116 #include "TProfile2D.h"
117 
119 public:
122 
124  ~CSCValidation() override;
125 
127  void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override;
128  void endJob() override;
129 
130  // for noise module
131  struct ltrh {
132  bool operator()(const CSCRecHit2D &rh1, const CSCRecHit2D &rh2) const {
133  return ((rh1.localPosition()).x() - (rh2.localPosition()).x()) < 0;
134  }
135  };
136 
137 protected:
138 private:
139  // these are the "modules"
140  // if you would like to add code to CSCValidation, please do so by adding an
141  // extra module in the form of an additional private member function
159  void doCalibrations(const edm::EventSetup &eventSetup);
160  void doAFEBTiming(const CSCWireDigiCollection &);
162  void doADCTiming(const CSCRecHit2DCollection &);
176  const edm::EventSetup &eventSetup,
177  const edm::Event &event);
179 
180  // some useful functions
184  float fitX(const CLHEP::HepMatrix &sp, const CLHEP::HepMatrix &ep);
185  float getSignal(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip);
186  float getthisSignal(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip);
187  int getWidth(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip);
189  int chamberSerial(CSCDetId id);
190  int ringSerial(CSCDetId id);
191 
192  // these functions handle Stoyan's efficiency code
193  void fillEfficiencyHistos(int bin, int flag);
194  void getEfficiency(float bin, float Norm, std::vector<float> &eff);
195  void histoEfficiency(TH1F *readHisto, TH1F *writeHisto);
196  double lineParametrization(double z1Position, double z2Position, double z1Direction) {
197  double parameterLine = (z2Position - z1Position) / z1Direction;
198  return parameterLine;
199  }
200  double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine) {
201  double extrapolatedPosition = initPosition + initDirection * parameterOfTheLine;
202  return extrapolatedPosition;
203  }
204  bool withinSensitiveRegion(LocalPoint localPos,
205  const std::array<const float, 4> &layerBounds,
206  int station,
207  int ring,
208  float shiftFromEdge,
209  float shiftFromDeadZone);
210 
211  // counters
217 
218  //
219  //
220  // The root file for the histograms.
221  TFile *theFile;
222 
223  //
224  //
225  // input parameters for this module
226  bool makePlots;
233  bool useDigis;
235 
236  // filters
239 
240  // quality filter parameters
241  double pMin;
242  double chisqMax;
245  double deltaPhiMax;
247 
261 
262  // module on/off switches
281 
282  // The histo managing object
284 
285  // tmp histos for Efficiency
286  TH1F *hSSTE;
287  TH1F *hRHSTE;
288  TH1F *hSEff;
289  TH1F *hRHEff;
290  TH2F *hSSTE2;
291  TH2F *hRHSTE2;
292  TH2F *hStripSTE2;
293  TH2F *hWireSTE2;
294  TH2F *hSEff2;
295  TH2F *hRHEff2;
296  TH2F *hStripEff2;
297  TH2F *hWireEff2;
300 
301  // occupancy
302  TH2I *hOWires;
303  TH2I *hOStrips;
304  TH2I *hORecHits;
305  TH2I *hOSegments;
306 
308  std::vector<int> nmbhvsegm;
309  std::map<int, std::vector<int> > m_wire_hvsegm;
310  std::map<int, int> m_single_wire_layer;
311 
312  //maps to store the DetId and associated RecHits
313  std::multimap<CSCDetId, CSCRecHit2D> AllRechits;
314  std::multimap<CSCDetId, CSCRecHit2D> SegRechits;
315  std::multimap<CSCDetId, CSCRecHit2D> NonAssociatedRechits;
316  std::map<CSCRecHit2D, float, ltrh> distRHmap;
317 
318  int typeIndex(CSCDetId id) {
319  // linearlized index bases on endcap, station, and ring
320  int index = 0;
321  if (id.station() == 1) {
322  index = id.ring() + 1;
323  if (id.ring() == 4)
324  index = 1;
325  } else
326  index = id.station() * 2 + id.ring();
327  if (id.endcap() == 1)
328  index = index + 10;
329  if (id.endcap() == 2)
330  index = 11 - index;
331  return index;
332  }
333 };
334 #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
LocalPoint localPosition() const override
Definition: CSCRecHit2D.h:56
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)
int ringSerial(CSCDetId id)
~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 &)
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()
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
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 doADCTiming(const CSCRecHit2DCollection &)
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
Definition: event.py:1
void doCalibrations(const edm::EventSetup &eventSetup)