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 
67 
72 
77 
83 
88 
91 
98 
107 
109 
111 #include "TVector3.h"
112 #include "TH1F.h"
113 #include "TH2F.h"
114 #include "TFile.h"
115 #include "TString.h"
116 #include "TTree.h"
117 #include "TProfile2D.h"
118 
120 public:
123 
125  ~CSCValidation() override;
126 
128  void analyze(const edm::Event & event, const edm::EventSetup& eventSetup) override;
129  void endJob() override;
130 
131  // for noise module
132  struct ltrh
133  {
134  bool operator()(const CSCRecHit2D& rh1, const CSCRecHit2D& rh2) const
135  {
136  return ((rh1.localPosition()).x()-(rh2.localPosition()).x()) < 0;
137  }
138  };
139 
140 
141 protected:
142 
143 private:
144 
145  // these are the "modules"
146  // if you would like to add code to CSCValidation, please do so by adding an
147  // extra module in the form of an additional private member function
161  void doCalibrations(const edm::EventSetup& eventSetup);
162  void doAFEBTiming(const CSCWireDigiCollection &);
164  void doADCTiming(const CSCRecHit2DCollection &);
173  const edm::EventSetup& eventSetup, const edm::Event &event);
175 
176 
177  // some useful functions
180  float fitX(const CLHEP::HepMatrix& sp, const CLHEP::HepMatrix& ep);
181  float getSignal(const CSCStripDigiCollection& stripdigis, CSCDetId idRH, int centerStrip);
182  float getthisSignal(const CSCStripDigiCollection& stripdigis, CSCDetId idRH, int centerStrip);
183  int getWidth(const CSCStripDigiCollection& stripdigis, CSCDetId idRH, int centerStrip);
185  int chamberSerial( CSCDetId id );
186  int ringSerial( CSCDetId id );
187 
188  // these functions handle Stoyan's efficiency code
189  void fillEfficiencyHistos(int bin, int flag);
190  void getEfficiency(float bin, float Norm, std::vector<float> &eff);
191  void histoEfficiency(TH1F *readHisto, TH1F *writeHisto);
192  double lineParametrization(double z1Position, double z2Position, double z1Direction){
193  double parameterLine = (z2Position-z1Position)/z1Direction;
194  return parameterLine;
195  }
196  double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine){
197  double extrapolatedPosition = initPosition + initDirection*parameterOfTheLine;
198  return extrapolatedPosition;
199  }
200  bool withinSensitiveRegion(LocalPoint localPos, const std::array<const float, 4> & layerBounds, int station, int ring, float shiftFromEdge, float shiftFromDeadZone);
201 
202 
203  // counters
209 
210  //
211  //
212  // The root file for the histograms.
213  TFile *theFile;
214 
215  //
216  //
217  // input parameters for this module
218  bool makePlots;
225  bool useDigis;
227 
228  // filters
231 
232  // quality filter parameters
233  double pMin;
234  double chisqMax;
237  double deltaPhiMax;
239 
253 
254  // module on/off switches
273 
274  // The histo managing object
276 
277  // tmp histos for Efficiency
278  TH1F *hSSTE;
279  TH1F *hRHSTE;
280  TH1F *hSEff;
281  TH1F *hRHEff;
282  TH2F *hSSTE2;
283  TH2F *hRHSTE2;
284  TH2F *hStripSTE2;
285  TH2F *hWireSTE2;
286  TH2F *hSEff2;
287  TH2F *hRHEff2;
288  TH2F *hStripEff2;
289  TH2F *hWireEff2;
292 
293  // occupancy
294  TH2I *hOWires;
295  TH2I *hOStrips;
296  TH2I *hORecHits;
297  TH2I *hOSegments;
298 
300  std::vector<int> nmbhvsegm;
301  std::map<int, std::vector<int> > m_wire_hvsegm;
302  std::map<int, int> m_single_wire_layer;
303 
304  //maps to store the DetId and associated RecHits
305  std::multimap<CSCDetId , CSCRecHit2D> AllRechits;
306  std::multimap<CSCDetId , CSCRecHit2D> SegRechits;
307  std::multimap<CSCDetId , CSCRecHit2D> NonAssociatedRechits;
308  std::map<CSCRecHit2D,float,ltrh> distRHmap;
309 
311  // linearlized index bases on endcap, station, and ring
312  int index = 0;
313  if (id.station() == 1){
314  index = id.ring() + 1;
315  if (id.ring() == 4) index = 1;
316  }
317  else index = id.station()*2 + id.ring();
318  if (id.endcap() == 1) index = index + 10;
319  if (id.endcap() == 2) index = 11 - index;
320  return index;
321  }
322 
323 
324 
325 
326 };
327 #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
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:50
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)
std::multimap< CSCDetId, CSCRecHit2D > NonAssociatedRechits
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 &)
std::multimap< CSCDetId, CSCRecHit2D > AllRechits
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
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
bin
set the eta bin as selection string.
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
std::multimap< CSCDetId, CSCRecHit2D > SegRechits
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::string rootFileName
void doWireDigis(edm::Handle< CSCWireDigiCollection > wires)
double deltaPhiMax
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)
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
std::map< CSCRecHit2D, float, ltrh > distRHmap
CSCValHists * histos
edm::EDGetTokenT< CSCALCTDigiCollection > al_token
Definition: event.py:1
void doCalibrations(const edm::EventSetup &eventSetup)