CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
CSCValidation Class Reference

#include <CSCValidation.h>

Inheritance diagram for CSCValidation:
edm::EDAnalyzer

Classes

struct  ltrh
 

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup)
 Perform the analysis. More...
 
 CSCValidation (const edm::ParameterSet &pset)
 Constructor. More...
 
void endJob ()
 
virtual ~CSCValidation ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

int chamberSerial (CSCDetId id)
 
void doADCTiming (const CSCRecHit2DCollection &)
 
void doAFEBTiming (const CSCWireDigiCollection &)
 
void doCalibrations (const edm::EventSetup &eventSetup)
 
void doCompTiming (const CSCComparatorDigiCollection &)
 
void doEfficiencies (edm::Handle< CSCWireDigiCollection > wires, edm::Handle< CSCStripDigiCollection > strips, edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCSegmentCollection > cscSegments, edm::ESHandle< CSCGeometry > cscGeom)
 
void doGasGain (const CSCWireDigiCollection &, const CSCStripDigiCollection &, const CSCRecHit2DCollection &)
 
bool doHLT (edm::Handle< edm::TriggerResults > hltResults)
 
void doNoiseHits (edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCSegmentCollection > cscSegments, edm::ESHandle< CSCGeometry > cscGeom, edm::Handle< CSCStripDigiCollection > strips)
 
void doOccupancies (edm::Handle< CSCStripDigiCollection > strips, edm::Handle< CSCWireDigiCollection > wires, edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCSegmentCollection > cscSegments)
 
void doPedestalNoise (edm::Handle< CSCStripDigiCollection > strips)
 
void doRecHits (edm::Handle< CSCRecHit2DCollection > recHits, edm::ESHandle< CSCGeometry > cscGeom)
 
void doResolution (edm::Handle< CSCSegmentCollection > cscSegments, edm::ESHandle< CSCGeometry > cscGeom)
 
void doSegments (edm::Handle< CSCSegmentCollection > cscSegments, edm::ESHandle< CSCGeometry > cscGeom)
 
void doSimHits (edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< edm::PSimHitContainer > simHits)
 
void doStandalone (edm::Handle< reco::TrackCollection > saMuons)
 
void doStripDigis (edm::Handle< CSCStripDigiCollection > strips)
 
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 doTrigger (edm::Handle< L1MuGMTReadoutCollection > pCollection)
 
void doWireDigis (edm::Handle< CSCWireDigiCollection > wires)
 
double extrapolate1D (double initPosition, double initDirection, double parameterOfTheLine)
 
void fillEfficiencyHistos (int bin, int flag)
 
bool filterEvents (edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCSegmentCollection > cscSegments, edm::Handle< reco::TrackCollection > saMuons)
 
void findNonAssociatedRecHits (edm::ESHandle< CSCGeometry > cscGeom, edm::Handle< CSCStripDigiCollection > strips)
 
float fitX (CLHEP::HepMatrix sp, CLHEP::HepMatrix ep)
 
void getEfficiency (float bin, float Norm, std::vector< float > &eff)
 
float getSignal (const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip)
 
float getthisSignal (const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip)
 
int getWidth (const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip)
 
void histoEfficiency (TH1F *readHisto, TH1F *writeHisto)
 
double lineParametrization (double z1Position, double z2Position, double z1Direction)
 
int ringSerial (CSCDetId id)
 
int typeIndex (CSCDetId id)
 
bool withinSensitiveRegion (LocalPoint localPos, const std::vector< float > layerBounds, int station, int ring, float shiftFromEdge, float shiftFromDeadZone)
 

Private Attributes

edm::InputTag alctDigiTag
 
std::multimap< CSCDetId,
CSCRecHit2D
AllRechits
 
double chisqMax
 
edm::InputTag clctDigiTag
 
bool cleanEvent
 
edm::InputTag compDigiTag
 
edm::InputTag corrlctDigiTag
 
edm::InputTag cscRecHitTag
 
edm::InputTag cscSegTag
 
double deltaPhiMax
 
bool detailedAnalysis
 
std::map< CSCRecHit2D, float,
ltrh
distRHmap
 
bool firstEvent
 
TH2F * hEffDenominator
 
CSCValHistshistos
 
edm::InputTag hltTag
 
TH2I * hORecHits
 
TH2I * hOSegments
 
TH2I * hOStrips
 
TH2I * hOWires
 
TH1F * hRHEff
 
TH2F * hRHEff2
 
TH1F * hRHSTE
 
TH2F * hRHSTE2
 
TH1F * hSEff
 
TH2F * hSEff2
 
TH2F * hSensitiveAreaEvt
 
TH1F * hSSTE
 
TH2F * hSSTE2
 
TH2F * hStripEff2
 
TH2F * hStripSTE2
 
TH2F * hWireEff2
 
TH2F * hWireSTE2
 
bool isSimulation
 
edm::InputTag l1aTag
 
double lengthMax
 
double lengthMin
 
std::map< int, int > m_single_wire_layer
 
std::map< int, std::vector< int > > m_wire_hvsegm
 
bool makeADCTimingPlots
 
bool makeAFEBTimingPlots
 
bool makeCalibPlots
 
bool makeComparisonPlots
 
bool makeCompTimingPlots
 
bool makeEfficiencyPlots
 
bool makeGasGainPlots
 
bool makeHLTPlots
 
bool makeOccupancyPlots
 
bool makePedNoisePlots
 
bool makePlots
 
bool makeRecHitPlots
 
bool makeResolutionPlots
 
bool makeRHNoisePlots
 
bool makeSegmentPlots
 
bool makeSimHitPlots
 
bool makeStandalonePlots
 
bool makeStripPlots
 
bool makeTimeMonitorPlots
 
bool makeTriggerPlots
 
bool makeWirePlots
 
int nCSCHitsMax
 
int nCSCHitsMin
 
int nEventsAnalyzed
 
std::vector< int > nmbhvsegm
 Maps and vectors for module doGasGain() More...
 
std::multimap< CSCDetId,
CSCRecHit2D
NonAssociatedRechits
 
double pMin
 
double polarMax
 
double polarMin
 
std::string refRootFile
 
int rhTreeCount
 
std::string rootFileName
 
edm::InputTag saMuonTag
 
std::multimap< CSCDetId,
CSCRecHit2D
SegRechits
 
int segTreeCount
 
edm::InputTag simHitTag
 
edm::InputTag stripDigiTag
 
TFile * theFile
 
bool useDigis
 
bool useQualityFilter
 
bool useTriggerFilter
 
edm::InputTag wireDigiTag
 
bool writeTreeToFile
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Package to validate local CSC reconstruction: DIGIS recHits segments L1 trigger CSC STA muons Various efficiencies

Responsible: Andy Kubik, Northwestern University

Definition at line 119 of file CSCValidation.h.

Constructor & Destructor Documentation

CSCValidation::CSCValidation ( const edm::ParameterSet pset)

Constructor.

Definition at line 17 of file CSCValidation.cc.

References jptDQMConfig_cff::deltaPhiMax, create_complex_test_file0_cfg::firstEvent, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), mergeVDriftHistosByStation::histos, patRefSel_triggerSelection_cff::hltTag, dtTPAnalyzer_cfg::rootFileName, and interactiveExample::theFile.

17  {
18 
19  // Get the various input parameters
20  rootFileName = pset.getUntrackedParameter<std::string>("rootFileName","valHists.root");
21  isSimulation = pset.getUntrackedParameter<bool>("isSimulation",false);
22  writeTreeToFile = pset.getUntrackedParameter<bool>("writeTreeToFile",true);
23  detailedAnalysis = pset.getUntrackedParameter<bool>("detailedAnalysis",false);
24  useDigis = pset.getUntrackedParameter<bool>("useDigis",true);
25 
26  // event quality filter
27  useQualityFilter = pset.getUntrackedParameter<bool>("useQualityFilter",false);
28  pMin = pset.getUntrackedParameter<double>("pMin",4.);
29  chisqMax = pset.getUntrackedParameter<double>("chisqMax",20.);
30  nCSCHitsMin = pset.getUntrackedParameter<int>("nCSCHitsMin",10);
31  nCSCHitsMax = pset.getUntrackedParameter<int>("nCSCHitsMax",25);
32  lengthMin = pset.getUntrackedParameter<double>("lengthMin",140.);
33  lengthMax = pset.getUntrackedParameter<double>("lengthMax",600.);
34  deltaPhiMax = pset.getUntrackedParameter<double>("deltaPhiMax",0.2);
35  polarMax = pset.getUntrackedParameter<double>("polarMax",0.7);
36  polarMin = pset.getUntrackedParameter<double>("polarMin",0.3);
37 
38  // trigger filter
39  useTriggerFilter = pset.getUntrackedParameter<bool>("useTriggerFilter",false);
40 
41  // input tags for collections
42  stripDigiTag = pset.getParameter<edm::InputTag>("stripDigiTag");
43  wireDigiTag = pset.getParameter<edm::InputTag>("wireDigiTag");
44  compDigiTag = pset.getParameter<edm::InputTag>("compDigiTag");
45  alctDigiTag = pset.getParameter<edm::InputTag>("alctDigiTag") ;
46  clctDigiTag = pset.getParameter<edm::InputTag>("clctDigiTag") ;
47  corrlctDigiTag= pset.getParameter<edm::InputTag>("corrlctDigiTag") ;
48  cscRecHitTag = pset.getParameter<edm::InputTag>("cscRecHitTag");
49  cscSegTag = pset.getParameter<edm::InputTag>("cscSegTag");
50  saMuonTag = pset.getParameter<edm::InputTag>("saMuonTag");
51  l1aTag = pset.getParameter<edm::InputTag>("l1aTag");
52  simHitTag = pset.getParameter<edm::InputTag>("simHitTag");
53  hltTag = pset.getParameter<edm::InputTag>("hltTag");
54 
55  // flags to switch on/off individual modules
56  makeOccupancyPlots = pset.getUntrackedParameter<bool>("makeOccupancyPlots",true);
57  makeTriggerPlots = pset.getUntrackedParameter<bool>("makeTriggerPlots",false);
58  makeStripPlots = pset.getUntrackedParameter<bool>("makeStripPlots",true);
59  makeWirePlots = pset.getUntrackedParameter<bool>("makeWirePlots",true);
60  makeRecHitPlots = pset.getUntrackedParameter<bool>("makeRecHitPlots",true);
61  makeSimHitPlots = pset.getUntrackedParameter<bool>("makeSimHitPlots",true);
62  makeSegmentPlots = pset.getUntrackedParameter<bool>("makeSegmentPlots",true);
63  makeResolutionPlots = pset.getUntrackedParameter<bool>("makeResolutionPlots",true);
64  makePedNoisePlots = pset.getUntrackedParameter<bool>("makePedNoisePlots",true);
65  makeEfficiencyPlots = pset.getUntrackedParameter<bool>("makeEfficiencyPlots",true);
66  makeGasGainPlots = pset.getUntrackedParameter<bool>("makeGasGainPlots",true);
67  makeAFEBTimingPlots = pset.getUntrackedParameter<bool>("makeAFEBTimingPlots",true);
68  makeCompTimingPlots = pset.getUntrackedParameter<bool>("makeCompTimingPlots",true);
69  makeADCTimingPlots = pset.getUntrackedParameter<bool>("makeADCTimingPlots",true);
70  makeRHNoisePlots = pset.getUntrackedParameter<bool>("makeRHNoisePlots",false);
71  makeCalibPlots = pset.getUntrackedParameter<bool>("makeCalibPlots",false);
72  makeStandalonePlots = pset.getUntrackedParameter<bool>("makeStandalonePlots",false);
73  makeTimeMonitorPlots = pset.getUntrackedParameter<bool>("makeTimeMonitorPlots",false);
74  makeHLTPlots = pset.getUntrackedParameter<bool>("makeHLTPlots",false);
75 
76  // set counters to zero
77  nEventsAnalyzed = 0;
78  rhTreeCount = 0;
79  segTreeCount = 0;
80  firstEvent = true;
81 
82  // Create the root file for the histograms
83  theFile = new TFile(rootFileName.c_str(), "RECREATE");
84  theFile->cd();
85 
86  // Create object of class CSCValHists to manage histograms
87  histos = new CSCValHists();
88 
89  // book Occupancy Histos
90  hOWires = new TH2I("hOWires","Wire Digi Occupancy",36,0.5,36.5,20,0.5,20.5);
91  hOStrips = new TH2I("hOStrips","Strip Digi Occupancy",36,0.5,36.5,20,0.5,20.5);
92  hORecHits = new TH2I("hORecHits","RecHit Occupancy",36,0.5,36.5,20,0.5,20.5);
93  hOSegments = new TH2I("hOSegments","Segments Occupancy",36,0.5,36.5,20,0.5,20.5);
94 
95  // book Eff histos
96  hSSTE = new TH1F("hSSTE","hSSTE",40,0,40);
97  hRHSTE = new TH1F("hRHSTE","hRHSTE",40,0,40);
98  hSEff = new TH1F("hSEff","Segment Efficiency",20,0.5,20.5);
99  hRHEff = new TH1F("hRHEff","recHit Efficiency",20,0.5,20.5);
100 
101  const int nChambers = 36;
102  const int nTypes = 18;
103  float nCH_min = 0.5;
104  float nCh_max = float(nChambers) + 0.5;
105  float nT_min = 0.5;
106  float nT_max = float(nTypes) + 0.5;
107 
108  hSSTE2 = new TH2F("hSSTE2","hSSTE2",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
109  hRHSTE2 = new TH2F("hRHSTE2","hRHSTE2",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
110  hStripSTE2 = new TH2F("hStripSTE2","hStripSTE2",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
111  hWireSTE2 = new TH2F("hWireSTE2","hWireSTE2",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
112 
113 
114  hEffDenominator = new TH2F("hEffDenominator","hEffDenominator",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
115  hSEff2 = new TH2F("hSEff2","Segment Efficiency 2D",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
116  hRHEff2 = new TH2F("hRHEff2","recHit Efficiency 2D",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
117 
118  hStripEff2 = new TH2F("hStripEff2","strip Efficiency 2D",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
119  hWireEff2 = new TH2F("hWireEff2","wire Efficiency 2D",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
120 
121  hSensitiveAreaEvt = new TH2F("hSensitiveAreaEvt","events in sensitive area",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
122 
123  // setup trees to hold global position data for rechits and segments
125 
126 
127 }
bool makeADCTimingPlots
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
TH2F * hSensitiveAreaEvt
edm::InputTag saMuonTag
void setupTrees()
Definition: CSCValHists.cc:55
edm::InputTag l1aTag
bool makeResolutionPlots
bool makeAFEBTimingPlots
edm::InputTag clctDigiTag
bool makeEfficiencyPlots
bool makeStandalonePlots
bool makePedNoisePlots
edm::InputTag corrlctDigiTag
edm::InputTag wireDigiTag
TH2F * hEffDenominator
edm::InputTag stripDigiTag
bool makeCompTimingPlots
bool makeOccupancyPlots
edm::InputTag alctDigiTag
bool makeTimeMonitorPlots
edm::InputTag simHitTag
std::string rootFileName
double deltaPhiMax
edm::InputTag cscSegTag
edm::InputTag hltTag
edm::InputTag compDigiTag
edm::InputTag cscRecHitTag
CSCValHists * histos
CSCValidation::~CSCValidation ( )
virtual

Destructor.

Definition at line 132 of file CSCValidation.cc.

References mergeVDriftHistosByStation::histos, and interactiveExample::theFile.

132  {
133 
134  // produce final efficiency histograms
137  hSEff2->Divide(hSSTE2,hEffDenominator,1.,1.,"B");
138  hRHEff2->Divide(hRHSTE2,hEffDenominator,1.,1.,"B");
139  hStripEff2->Divide(hStripSTE2,hEffDenominator,1.,1.,"B");
140  hWireEff2->Divide(hWireSTE2,hEffDenominator,1.,1.,"B");
141 
142  histos->insertPlot(hRHSTE,"hRHSTE","Efficiency");
143  histos->insertPlot(hSSTE,"hSSTE","Efficiency");
144  histos->insertPlot(hSSTE2,"hSSTE2","Efficiency");
145  histos->insertPlot(hEffDenominator,"hEffDenominator","Efficiency");
146  histos->insertPlot(hRHSTE2,"hRHSTE2","Efficiency");
147  histos->insertPlot(hStripSTE2,"hStripSTE2","Efficiency");
148  histos->insertPlot(hWireSTE2,"hWireSTE2","Efficiency");
149 
150  //moving this to post job macros
151  histos->insertPlot(hSEff,"hSEff","Efficiency");
152  histos->insertPlot(hRHEff,"hRHEff","Efficiency");
153 
154  histos->insertPlot(hSEff2,"hSEff2","Efficiency");
155  histos->insertPlot(hRHEff2,"hRHEff2","Efficiency");
156  histos->insertPlot(hStripEff2,"hStripff2","Efficiency");
157  histos->insertPlot(hWireEff2,"hWireff2","Efficiency");
158 
159  histos->insertPlot(hSensitiveAreaEvt,"","Efficiency");
160 
161  // throw in occupancy plots so they're saved
162  histos->insertPlot(hOWires,"hOWires","Digis");
163  histos->insertPlot(hOStrips,"hOStrips","Digis");
164  histos->insertPlot(hORecHits,"hORecHits","recHits");
165  histos->insertPlot(hOSegments,"hOSegments","Segments");
166 
167 
168  // write histos to the specified file
171  theFile->Close();
172 
173 }
TH2F * hSensitiveAreaEvt
void writeTrees(TFile *theFile)
Definition: CSCValHists.cc:41
void writeHists(TFile *theFile)
Definition: CSCValHists.cc:19
void insertPlot(TH1 *thePlot, std::string name, std::string folder)
Definition: CSCValHists.cc:100
void histoEfficiency(TH1F *readHisto, TH1F *writeHisto)
TH2F * hEffDenominator
CSCValHists * histos

Member Function Documentation

void CSCValidation::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)
virtual

Perform the analysis.

Implements edm::EDAnalyzer.

Definition at line 178 of file CSCValidation.cc.

References cscSegments_cfi::cscSegments, create_complex_test_file0_cfg::firstEvent, edm::EventSetup::get(), runregparse::hlt, patRefSel_triggerSelection_cff::hltTag, trackerHits::simHits, and RecoTauPiZeroBuilderPlugins_cfi::strips.

178  {
179  // increment counter
180  nEventsAnalyzed++;
181 
182  //int iRun = event.id().run();
183  //int iEvent = event.id().event();
184 
185  // Get the Digis
192  if (useDigis){
193  event.getByLabel(stripDigiTag,strips);
194  event.getByLabel(wireDigiTag,wires);
195  event.getByLabel(compDigiTag,compars);
196  event.getByLabel(alctDigiTag, alcts);
197  event.getByLabel(clctDigiTag, clcts);
198  event.getByLabel(corrlctDigiTag, correlatedlcts);
199  }
200 
201  // Get the CSC Geometry :
202  ESHandle<CSCGeometry> cscGeom;
203  eventSetup.get<MuonGeometryRecord>().get(cscGeom);
204 
205  // Get the RecHits collection :
207  event.getByLabel(cscRecHitTag,recHits);
208 
209  //CSCRecHit2DCollection::const_iterator recIt;
210  //for (recIt = recHits->begin(); recIt != recHits->end(); recIt++) {
211  // recIt->print();
212  // }
213 
214 
215  // Get the SimHits (if applicable)
217  if (isSimulation) event.getByLabel(simHitTag, simHits);
218 
219  // get CSC segment collection
221  event.getByLabel(cscSegTag, cscSegments);
222 
223  // get the trigger collection
226  event.getByLabel(l1aTag,pCollection);
227  }
229  if (makeHLTPlots) event.getByLabel(hltTag,hlt);
230 
231  // get the standalone muon collection
233  if (makeStandalonePlots || useQualityFilter) event.getByLabel(saMuonTag,saMuons);
234 
235 
236 
238  // Run the modules //
240 
241  // Only do this for the first event
242  // this is probably outdated and needs to be looked at
243  if (nEventsAnalyzed == 1 && makeCalibPlots) doCalibrations(eventSetup);
244 
245 
246  // Look at the l1a trigger info (returns true if csc L1A present)
247  bool CSCL1A = false;
248  if (makeTriggerPlots || useTriggerFilter) CSCL1A = doTrigger(pCollection);
249  if (!useTriggerFilter) CSCL1A = true; // always true if not filtering on trigger
250 
251 
252  cleanEvent = false;
253  if (makeStandalonePlots || useQualityFilter) cleanEvent = filterEvents(recHits,cscSegments,saMuons);
254  if (!useQualityFilter) cleanEvent = true; // always true if not filtering on event quality
255 
256 
257  // look at various chamber occupancies
258  // keep this outside of filter for diagnostics???
259  if (makeOccupancyPlots && CSCL1A) doOccupancies(strips,wires,recHits,cscSegments);
260 
261 
262  if (makeHLTPlots) doHLT(hlt);
263 
264 
265  if (cleanEvent && CSCL1A){
266 
267  // general look at strip digis
268  if (makeStripPlots && useDigis) doStripDigis(strips);
269 
270  // general look at wire digis
271  if (makeWirePlots && useDigis) doWireDigis(wires);
272 
273 
274  // general look at rechits
275  if (makeRecHitPlots) doRecHits(recHits,cscGeom);
276 
277  // look at simHits
278  if (isSimulation && makeSimHitPlots) doSimHits(recHits,simHits);
279 
280  // general look at Segments
281  if (makeSegmentPlots) doSegments(cscSegments,cscGeom);
282 
283  // look at hit resolution
284  if (makeResolutionPlots) doResolution(cscSegments,cscGeom);
285 
286 
287  // look at Pedestal Noise
289 
290  // look at recHit and segment efficiencies
291  if (makeEfficiencyPlots) doEfficiencies(wires,strips, recHits, cscSegments,cscGeom);
292 
293  // gas gain
294  if (makeGasGainPlots && useDigis) doGasGain(*wires,*strips,*recHits);
295 
296 
297  // AFEB timing
298  if (makeAFEBTimingPlots && useDigis) doAFEBTiming(*wires);
299 
300  // Comparators timing
301  if (makeCompTimingPlots && useDigis) doCompTiming(*compars);
302 
303  // strip ADC timing
304  if (makeADCTimingPlots) doADCTiming(*recHits);
305 
306 
307 
308  // recHit Noise
309  if (makeRHNoisePlots && useDigis) doNoiseHits(recHits,cscSegments,cscGeom,strips);
310 
311  // look at standalone muons (not implemented yet)
312  if (makeStandalonePlots) doStandalone(saMuons);
313 
314  // make plots for monitoring the trigger and offline timing
315  if (makeTimeMonitorPlots) doTimeMonitoring(recHits,cscSegments, alcts, clcts, correlatedlcts, pCollection,cscGeom, eventSetup, event);
316 
317  firstEvent = false;
318 
319  }
320 
321 }
bool makeADCTimingPlots
edm::InputTag saMuonTag
edm::InputTag l1aTag
bool makeResolutionPlots
void doNoiseHits(edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCSegmentCollection > cscSegments, edm::ESHandle< CSCGeometry > cscGeom, edm::Handle< CSCStripDigiCollection > strips)
bool makeAFEBTimingPlots
void doRecHits(edm::Handle< CSCRecHit2DCollection > recHits, edm::ESHandle< CSCGeometry > cscGeom)
void doEfficiencies(edm::Handle< CSCWireDigiCollection > wires, edm::Handle< CSCStripDigiCollection > strips, edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCSegmentCollection > cscSegments, edm::ESHandle< CSCGeometry > cscGeom)
edm::InputTag clctDigiTag
bool doTrigger(edm::Handle< L1MuGMTReadoutCollection > pCollection)
bool makeEfficiencyPlots
bool makeStandalonePlots
void doCompTiming(const CSCComparatorDigiCollection &)
void doPedestalNoise(edm::Handle< CSCStripDigiCollection > strips)
bool makePedNoisePlots
void doStripDigis(edm::Handle< CSCStripDigiCollection > strips)
edm::InputTag corrlctDigiTag
bool filterEvents(edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCSegmentCollection > cscSegments, edm::Handle< reco::TrackCollection > saMuons)
bool doHLT(edm::Handle< edm::TriggerResults > hltResults)
edm::InputTag wireDigiTag
edm::InputTag stripDigiTag
void doSimHits(edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< edm::PSimHitContainer > simHits)
bool makeCompTimingPlots
void doGasGain(const CSCWireDigiCollection &, const CSCStripDigiCollection &, const CSCRecHit2DCollection &)
bool makeOccupancyPlots
void doResolution(edm::Handle< CSCSegmentCollection > cscSegments, edm::ESHandle< CSCGeometry > cscGeom)
edm::InputTag alctDigiTag
const T & get() const
Definition: EventSetup.h:55
tuple simHits
Definition: trackerHits.py:16
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
edm::InputTag simHitTag
void doStandalone(edm::Handle< reco::TrackCollection > saMuons)
void doWireDigis(edm::Handle< CSCWireDigiCollection > wires)
edm::InputTag cscSegTag
void doADCTiming(const CSCRecHit2DCollection &)
edm::InputTag hltTag
void doSegments(edm::Handle< CSCSegmentCollection > cscSegments, edm::ESHandle< CSCGeometry > cscGeom)
edm::InputTag compDigiTag
edm::InputTag cscRecHitTag
void doOccupancies(edm::Handle< CSCStripDigiCollection > strips, edm::Handle< CSCWireDigiCollection > wires, edm::Handle< CSCRecHit2DCollection > recHits, edm::Handle< CSCSegmentCollection > cscSegments)
void doCalibrations(const edm::EventSetup &eventSetup)
int CSCValidation::chamberSerial ( CSCDetId  id)
private

Definition at line 1227 of file CSCValidation.cc.

1227  {
1228  int st = id.station();
1229  int ri = id.ring();
1230  int ch = id.chamber();
1231  int ec = id.endcap();
1232  int kSerial = ch;
1233  if (st == 1 && ri == 1) kSerial = ch;
1234  if (st == 1 && ri == 2) kSerial = ch + 36;
1235  if (st == 1 && ri == 3) kSerial = ch + 72;
1236  if (st == 1 && ri == 4) kSerial = ch;
1237  if (st == 2 && ri == 1) kSerial = ch + 108;
1238  if (st == 2 && ri == 2) kSerial = ch + 126;
1239  if (st == 3 && ri == 1) kSerial = ch + 162;
1240  if (st == 3 && ri == 2) kSerial = ch + 180;
1241  if (st == 4 && ri == 1) kSerial = ch + 216;
1242  if (st == 4 && ri == 2) kSerial = ch + 234; // one day...
1243  if (ec == 2) kSerial = kSerial + 300;
1244  return kSerial;
1245 }
void CSCValidation::doADCTiming ( const CSCRecHit2DCollection rechitcltn)
private

Definition at line 2554 of file CSCValidation.cc.

References CSCDetId, CSCIndexer::dbIndex(), Reference_intrackfit_cff::endcap, mergeVDriftHistosByStation::histos, i, j, mergeVDriftHistosByStation::name, relativeConstraints::ring, relativeConstraints::station, indexGen::title, vdt::x, and detailsBasic3DVector::y.

2554  {
2555  float adc_3_3_sum,adc_3_3_wtbin,x,y;
2556  int cfeb,idchamber,ring;
2557 
2558  std::string name,title,endcapstr;
2559  ostringstream ss;
2560  std::vector<float> zer(6,0.0);
2561 
2562  CSCIndexer indexer;
2563  std::map<int,int>::iterator intIt;
2564 
2565  if(rechitcltn.begin() != rechitcltn.end()) {
2566 
2567  // std::cout<<"Event "<<nEventsAnalyzed <<std::endl;
2568 
2569  // Looping thru rechit collection
2572  for(recIt = rechitcltn.begin(); recIt != rechitcltn.end(); ++recIt) {
2573  CSCDetId id = (CSCDetId)(*recIt).cscDetId();
2574  // getting strips comprising rechit
2575  if(recIt->nStrips()==3) {
2576  // get 3X3 ADC Sum
2577  // get 3X3 ADC Sum
2578  unsigned int binmx=0;
2579  float adcmax=0.0;
2580 
2581  for(unsigned int i=0;i<recIt->nStrips();i++)
2582  for(unsigned int j=0;j<recIt->nTimeBins();j++)
2583  if(recIt->adcs(i,j)>adcmax) {
2584  adcmax=recIt->adcs(i,j);
2585  binmx=j;
2586  }
2587 
2588  adc_3_3_sum=0.0;
2589  //well, this really only works for 3 strips in readout - not sure the right fix for general case
2590  for(unsigned int i=0;i<recIt->nStrips();i++)
2591  for(unsigned int j=binmx-1;j<=binmx+1;j++)
2592  adc_3_3_sum+=recIt->adcs(i,j);
2593 
2594 
2595  // ADC weighted time bin
2596  if(adc_3_3_sum > 100.0) {
2597 
2598 
2599  int centerStrip=recIt->channels(1); //take central from 3 strips;
2600  // temporary fix
2601  int flag=0;
2602  if(id.station()==1 && id.ring()==4 && centerStrip>16) flag=1;
2603  // end of temporary fix
2604  if(flag==0) {
2605  adc_3_3_wtbin=(*recIt).tpeak()/50; //getTiming(strpcltn, id, centerStrip);
2606  idchamber=indexer.dbIndex(id, centerStrip)/10; //strips 1-16 ME1/1a
2607  // become strips 65-80 ME1/1 !!!
2608  /*
2609  if(id.station()==1 && (id.ring()==1 || id.ring()==4))
2610  std::cout<<idchamber<<" "<<id.station()<<" "<<id.ring()<<" "<<m_strip[1]<<" "<<
2611  " "<<centerStrip<<
2612  " "<<adc_3_3_wtbin<<" "<<adc_3_3_sum<<std::endl;
2613  */
2614  ss<<"adc_3_3_weight_time_bin_vs_cfeb_occupancy_ME_"<<idchamber;
2615  name=ss.str(); ss.str("");
2616 
2617  std::string endcapstr;
2618  if(id.endcap() == 1) endcapstr = "+";
2619  if(id.endcap() == 2) endcapstr = "-";
2620  ring=id.ring(); if(id.ring()==4) ring=1;
2621  ss<<"ADC 3X3 Weighted Time Bin vs CFEB Occupancy ME"
2622  <<endcapstr<<id.station()<<"/"<<ring<<"/"<<id.chamber();
2623  title=ss.str(); ss.str("");
2624 
2625  cfeb=(centerStrip-1)/16+1;
2626  x=cfeb; y=adc_3_3_wtbin;
2627  histos->fill2DHist(x,y,name.c_str(),title.c_str(),5,1.,6.,80,-8.,8.,"ADCTiming");
2628  } // end of if flag==0
2629  } // end of if (adc_3_3_sum > 100.0)
2630  } // end of if if(m_strip.size()==3
2631  } // end of the pass thru CSCRecHit2DCollection
2632  } // end of if (rechitcltn.begin() != rechitcltn.end())
2633 }
int i
Definition: DBlmapReader.cc:9
long int flag
Definition: mlp_lapack.h:47
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:45
int dbIndex(const CSCDetId &id, int &channel)
Definition: CSCIndexer.cc:240
int j
Definition: DBlmapReader.cc:9
void fill2DHist(float x, float y, std::string name, std::string title, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:136
x
Definition: VDTMath.h:216
CSCValHists * histos
void CSCValidation::doAFEBTiming ( const CSCWireDigiCollection wirecltn)
private

Definition at line 2428 of file CSCValidation.cc.

References CSCIndexer::dbIndex(), Reference_intrackfit_cff::endcap, mergeVDriftHistosByStation::histos, mergeVDriftHistosByStation::name, indexGen::title, vdt::x, and detailsBasic3DVector::y.

2428  {
2429  ostringstream ss;
2430  std::string name,title,endcapstr;
2431  float x,y;
2432  int wire,wiretbin,nmbwiretbin,layer,afeb,idlayer,idchamber;
2433  int channel=0; // for CSCIndexer::dbIndex(id, channel); irrelevant here
2434  CSCIndexer indexer;
2435 
2436  if(wirecltn.begin() != wirecltn.end()) {
2437 
2438  //std::cout<<std::endl;
2439  //std::cout<<"Event "<<nEventsAnalyzed<<std::endl;
2440  //std::cout<<std::endl;
2441 
2442  // cycle on wire collection for all CSC
2444  for(wiredetUnitIt=wirecltn.begin();wiredetUnitIt!=wirecltn.end();
2445  ++wiredetUnitIt) {
2446  const CSCDetId id = (*wiredetUnitIt).first;
2447  idlayer=indexer.dbIndex(id, channel);
2448  idchamber=idlayer/10;
2449  layer=id.layer();
2450 
2451  if (id.endcap() == 1) endcapstr = "+";
2452  if (id.endcap() == 2) endcapstr = "-";
2453 
2454  // looping in the layer of given CSC
2455 
2456  const CSCWireDigiCollection::Range& range = (*wiredetUnitIt).second;
2458  range.first; digiIt!=range.second; ++digiIt){
2459  wire=(*digiIt).getWireGroup();
2460  wiretbin=(*digiIt).getTimeBin();
2461  nmbwiretbin=(*digiIt).getTimeBinsOn().size();
2462  afeb=3*((wire-1)/8)+(layer+1)/2;
2463 
2464  // Anode wire group time bin vs afeb for each CSC
2465  x=afeb;
2466  y=wiretbin;
2467  ss<<"afeb_time_bin_vs_afeb_occupancy_ME_"<<idchamber;
2468  name=ss.str(); ss.str("");
2469  ss<<"Time Bin vs AFEB Occupancy ME"<<endcapstr<<id.station()<<"/"<<id.ring()<<"/"<< id.chamber();
2470  title=ss.str(); ss.str("");
2471  histos->fill2DHist(x,y,name.c_str(),title.c_str(),42,1.,43.,16,0.,16.,"AFEBTiming");
2472 
2473  // Number of anode wire group time bin vs afeb for each CSC
2474  x=afeb;
2475  y=nmbwiretbin;
2476  ss<<"nmb_afeb_time_bins_vs_afeb_ME_"<<idchamber;
2477  name=ss.str(); ss.str("");
2478  ss<<"Number of Time Bins vs AFEB ME"<<endcapstr<<id.station()<<"/"<<id.ring()<<"/"<< id.chamber();
2479  title=ss.str();
2480  ss.str("");
2481  histos->fill2DHist(x,y,name.c_str(),title.c_str(),42,1.,43.,16,0.,16.,"AFEBTiming");
2482 
2483  } // end of digis loop in layer
2484  } // end of wire collection loop
2485  } // end of if(wirecltn.begin() != wirecltn.end())
2486 }
int dbIndex(const CSCDetId &id, int &channel)
Definition: CSCIndexer.cc:240
void fill2DHist(float x, float y, std::string name, std::string title, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:136
std::vector< DigiType >::const_iterator const_iterator
std::pair< const_iterator, const_iterator > Range
x
Definition: VDTMath.h:216
CSCValHists * histos
void CSCValidation::doCalibrations ( const edm::EventSetup eventSetup)
private

Definition at line 651 of file CSCValidation.cc.

References newFWLiteAna::bin, CSCDBCrosstalk::crosstalk, CSCDBGains::gains, edm::EventSetup::get(), mergeVDriftHistosByStation::histos, i, LogDebug, CSCDBNoiseMatrix::matrix, CSCDBPedestals::pedestals, and edm::ESHandle< class >::product().

651  {
652 
653  // Only do this for the first event
654  if (nEventsAnalyzed == 1){
655 
656  LogDebug("Calibrations") << "Loading Calibrations...";
657 
658  // get the gains
660  eventSetup.get<CSCDBGainsRcd>().get( hGains );
661  const CSCDBGains* pGains = hGains.product();
662  // get the crosstalks
664  eventSetup.get<CSCDBCrosstalkRcd>().get( hCrosstalk );
665  const CSCDBCrosstalk* pCrosstalk = hCrosstalk.product();
666  // get the noise matrix
667  edm::ESHandle<CSCDBNoiseMatrix> hNoiseMatrix;
668  eventSetup.get<CSCDBNoiseMatrixRcd>().get( hNoiseMatrix );
669  const CSCDBNoiseMatrix* pNoiseMatrix = hNoiseMatrix.product();
670  // get pedestals
672  eventSetup.get<CSCDBPedestalsRcd>().get( hPedestals );
673  const CSCDBPedestals* pPedestals = hPedestals.product();
674 
675  LogDebug("Calibrations") << "Calibrations Loaded!";
676 
677  for (int i = 0; i < 400; i++){
678  int bin = i+1;
679  histos->fillCalibHist(pGains->gains[i].gain_slope,"hCalibGainsS","Gains Slope",400,0,400,bin,"Calib");
680  histos->fillCalibHist(pCrosstalk->crosstalk[i].xtalk_slope_left,"hCalibXtalkSL","Xtalk Slope Left",400,0,400,bin,"Calib");
681  histos->fillCalibHist(pCrosstalk->crosstalk[i].xtalk_slope_right,"hCalibXtalkSR","Xtalk Slope Right",400,0,400,bin,"Calib");
682  histos->fillCalibHist(pCrosstalk->crosstalk[i].xtalk_intercept_left,"hCalibXtalkIL","Xtalk Intercept Left",400,0,400,bin,"Calib");
683  histos->fillCalibHist(pCrosstalk->crosstalk[i].xtalk_intercept_right,"hCalibXtalkIR","Xtalk Intercept Right",400,0,400,bin,"Calib");
684  histos->fillCalibHist(pPedestals->pedestals[i].ped,"hCalibPedsP","Peds",400,0,400,bin,"Calib");
685  histos->fillCalibHist(pPedestals->pedestals[i].rms,"hCalibPedsR","Peds RMS",400,0,400,bin,"Calib");
686  histos->fillCalibHist(pNoiseMatrix->matrix[i].elem33,"hCalibNoise33","Noise Matrix 33",400,0,400,bin,"Calib");
687  histos->fillCalibHist(pNoiseMatrix->matrix[i].elem34,"hCalibNoise34","Noise Matrix 34",400,0,400,bin,"Calib");
688  histos->fillCalibHist(pNoiseMatrix->matrix[i].elem35,"hCalibNoise35","Noise Matrix 35",400,0,400,bin,"Calib");
689  histos->fillCalibHist(pNoiseMatrix->matrix[i].elem44,"hCalibNoise44","Noise Matrix 44",400,0,400,bin,"Calib");
690  histos->fillCalibHist(pNoiseMatrix->matrix[i].elem45,"hCalibNoise45","Noise Matrix 45",400,0,400,bin,"Calib");
691  histos->fillCalibHist(pNoiseMatrix->matrix[i].elem46,"hCalibNoise46","Noise Matrix 46",400,0,400,bin,"Calib");
692  histos->fillCalibHist(pNoiseMatrix->matrix[i].elem55,"hCalibNoise55","Noise Matrix 55",400,0,400,bin,"Calib");
693  histos->fillCalibHist(pNoiseMatrix->matrix[i].elem56,"hCalibNoise56","Noise Matrix 56",400,0,400,bin,"Calib");
694  histos->fillCalibHist(pNoiseMatrix->matrix[i].elem57,"hCalibNoise57","Noise Matrix 57",400,0,400,bin,"Calib");
695  histos->fillCalibHist(pNoiseMatrix->matrix[i].elem66,"hCalibNoise66","Noise Matrix 66",400,0,400,bin,"Calib");
696  histos->fillCalibHist(pNoiseMatrix->matrix[i].elem67,"hCalibNoise67","Noise Matrix 67",400,0,400,bin,"Calib");
697  histos->fillCalibHist(pNoiseMatrix->matrix[i].elem77,"hCalibNoise77","Noise Matrix 77",400,0,400,bin,"Calib");
698 
699 
700  }
701 
702  }
703 
704 
705 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
GainContainer gains
Definition: CSCDBGains.h:27
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
PedestalContainer pedestals
void fillCalibHist(float x, std::string name, std::string title, int bins, float xmin, float xmax, int bin, std::string folder)
Definition: CSCValHists.cc:107
CrosstalkContainer crosstalk
NoiseMatrixContainer matrix
CSCValHists * histos
void CSCValidation::doCompTiming ( const CSCComparatorDigiCollection compars)
private

Definition at line 2493 of file CSCValidation.cc.

References CSCIndexer::dbIndex(), Reference_intrackfit_cff::endcap, mergeVDriftHistosByStation::histos, mergeVDriftHistosByStation::name, strip(), indexGen::title, vdt::x, and detailsBasic3DVector::y.

2493  {
2494 
2495  ostringstream ss; std::string name,title,endcap;
2496  float x,y;
2497  int strip,tbin,cfeb,idlayer,idchamber;
2498  int channel=0; // for CSCIndexer::dbIndex(id, channel); irrelevant here
2499  CSCIndexer indexer;
2500 
2501  if(compars.begin() != compars.end()) {
2502 
2503  //std::cout<<std::endl;
2504  //std::cout<<"Event "<<nEventsAnalyzed<<std::endl;
2505  //std::cout<<std::endl;
2506 
2507  // cycle on comparators collection for all CSC
2509  for(compdetUnitIt=compars.begin();compdetUnitIt!=compars.end();
2510  ++compdetUnitIt) {
2511  const CSCDetId id = (*compdetUnitIt).first;
2512  idlayer=indexer.dbIndex(id, channel); // channel irrelevant here
2513  idchamber=idlayer/10;
2514 
2515  if (id.endcap() == 1) endcap = "+";
2516  if (id.endcap() == 2) endcap = "-";
2517  // looping in the layer of given CSC
2518  const CSCComparatorDigiCollection::Range& range =
2519  (*compdetUnitIt).second;
2521  range.first; digiIt!=range.second; ++digiIt){
2522  strip=(*digiIt).getStrip();
2523  /*
2524  if(id.station()==1 && (id.ring()==1 || id.ring()==4))
2525  std::cout<<idchamber<<" "<<id.station()<<" "<<id.ring()<<" "
2526  <<strip <<std::endl;
2527  */
2528  indexer.dbIndex(id, strip); // strips 1-16 of ME1/1a
2529  // become strips 65-80 of ME1/1
2530  tbin=(*digiIt).getTimeBin();
2531  cfeb=(strip-1)/16+1;
2532 
2533  // time bin vs cfeb for each CSC
2534 
2535  x=cfeb;
2536  y=tbin;
2537  ss<<"comp_time_bin_vs_cfeb_occupancy_ME_"<<idchamber;
2538  name=ss.str(); ss.str("");
2539  ss<<"Comparator Time Bin vs CFEB Occupancy ME"<<endcap<<
2540  id.station()<<"/"<< id.ring()<<"/"<< id.chamber();
2541  title=ss.str(); ss.str("");
2542  histos->fill2DHist(x,y,name.c_str(),title.c_str(),5,1.,6.,16,0.,16.,"CompTiming");
2543 
2544  } // end of digis loop in layer
2545  } // end of collection loop
2546  } // end of if(compars.begin() !=compars.end())
2547 }
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
int dbIndex(const CSCDetId &id, int &channel)
Definition: CSCIndexer.cc:240
void fill2DHist(float x, float y, std::string name, std::string title, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:136
std::vector< DigiType >::const_iterator const_iterator
std::pair< const_iterator, const_iterator > Range
x
Definition: VDTMath.h:216
CSCValHists * histos
void CSCValidation::doEfficiencies ( edm::Handle< CSCWireDigiCollection wires,
edm::Handle< CSCStripDigiCollection strips,
edm::Handle< CSCRecHit2DCollection recHits,
edm::Handle< CSCSegmentCollection cscSegments,
edm::ESHandle< CSCGeometry cscGeom 
)
private

Definition at line 1315 of file CSCValidation.cc.

References newFWLiteAna::bin, CSCDetId::chamber(), CSCChamberSpecs::chamberTypeName(), CSCDetId, diffTreeTool::diff, CSCDetId::endcap(), first, CSCLayer::geometry(), CSCChamber::id(), CSCChamber::layer(), CSCDetId::layer(), CSCSegment::localDirection(), CSCSegment::localPosition(), TrapezoidalPlaneBounds::parameters(), CSCDetId::ring(), CSCChamber::specs(), CSCDetId::station(), dtDQMClient_cfg::threshold, GeomDet::toGlobal(), GeomDet::toLocal(), CommonMethods::weight(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

1317  {
1318 
1319  bool allWires[2][4][4][36][6];
1320  bool allStrips[2][4][4][36][6];
1321  bool AllRecHits[2][4][4][36][6];
1322  bool AllSegments[2][4][4][36];
1323 
1324  //bool MultiSegments[2][4][4][36];
1325  for(int iE = 0;iE<2;iE++){
1326  for(int iS = 0;iS<4;iS++){
1327  for(int iR = 0; iR<4;iR++){
1328  for(int iC =0;iC<36;iC++){
1329  AllSegments[iE][iS][iR][iC] = false;
1330  //MultiSegments[iE][iS][iR][iC] = false;
1331  for(int iL=0;iL<6;iL++){
1332  allWires[iE][iS][iR][iC][iL] = false;
1333  allStrips[iE][iS][iR][iC][iL] = false;
1334  AllRecHits[iE][iS][iR][iC][iL] = false;
1335  }
1336  }
1337  }
1338  }
1339  }
1340 
1341  if (useDigis){
1342  // Wires
1343  for (CSCWireDigiCollection::DigiRangeIterator dWDiter=wires->begin(); dWDiter!=wires->end(); dWDiter++) {
1344  CSCDetId idrec = (CSCDetId)(*dWDiter).first;
1345  std::vector<CSCWireDigi>::const_iterator wireIter = (*dWDiter).second.first;
1346  std::vector<CSCWireDigi>::const_iterator lWire = (*dWDiter).second.second;
1347  for( ; wireIter != lWire; ++wireIter) {
1348  allWires[idrec.endcap() -1][idrec.station() -1][idrec.ring() -1][idrec.chamber() -1][idrec.layer() -1] = true;
1349  break;
1350  }
1351  }
1352 
1353  //---- STRIPS
1354  for (CSCStripDigiCollection::DigiRangeIterator dSDiter=strips->begin(); dSDiter!=strips->end(); dSDiter++) {
1355  CSCDetId idrec = (CSCDetId)(*dSDiter).first;
1356  std::vector<CSCStripDigi>::const_iterator stripIter = (*dSDiter).second.first;
1357  std::vector<CSCStripDigi>::const_iterator lStrip = (*dSDiter).second.second;
1358  for( ; stripIter != lStrip; ++stripIter) {
1359  std::vector<int> myADCVals = stripIter->getADCCounts();
1360  bool thisStripFired = false;
1361  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1362  float threshold = 13.3 ;
1363  float diff = 0.;
1364  for (unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
1365  diff = (float)myADCVals[iCount]-thisPedestal;
1366  if (diff > threshold) {
1367  thisStripFired = true;
1368  break;
1369  }
1370  }
1371  if(thisStripFired){
1372  allStrips[idrec.endcap() -1][idrec.station() -1][idrec.ring() -1][idrec.chamber() -1][idrec.layer() -1] = true;
1373  break;
1374  }
1375  }
1376  }
1377  }
1378 
1379  // Rechits
1380  for (CSCRecHit2DCollection::const_iterator recEffIt = recHits->begin(); recEffIt != recHits->end(); recEffIt++) {
1381  //CSCDetId idrec = (CSCDetId)(*recIt).cscDetId();
1382  CSCDetId idrec = (CSCDetId)(*recEffIt).cscDetId();
1383  AllRecHits[idrec.endcap() -1][idrec.station() -1][idrec.ring() -1][idrec.chamber() -1][idrec.layer() -1] = true;
1384 
1385  }
1386 
1387  std::vector <unsigned int> seg_ME2(2,0) ;
1388  std::vector <unsigned int> seg_ME3(2,0) ;
1389  std::vector < std::pair <CSCDetId, CSCSegment> > theSegments(4);
1390  // Segments
1391  for(CSCSegmentCollection::const_iterator segEffIt=cscSegments->begin(); segEffIt != cscSegments->end(); segEffIt++) {
1392  CSCDetId idseg = (CSCDetId)(*segEffIt).cscDetId();
1393  //if(AllSegments[idrec.endcap() -1][idrec.station() -1][idrec.ring() -1][idrec.chamber()]){
1394  //MultiSegments[idrec.endcap() -1][idrec.station() -1][idrec.ring() -1][idrec.chamber()] = true;
1395  //}
1396  AllSegments[idseg.endcap() -1][idseg.station() -1][idseg.ring() -1][idseg.chamber() -1] = true;
1397  // "Intrinsic" efficiency measurement relies on "good" segment extrapolation - we need the pre-selection below
1398  // station 2 "good" segment will be used for testing efficiencies in ME1 and ME3
1399  // station 3 "good" segment will be used for testing efficiencies in ME2 and ME4
1400  if(2==idseg.station() || 3==idseg.station()){
1401  unsigned int seg_tmp ;
1402  if(2==idseg.station()){
1403  ++seg_ME2[idseg.endcap() -1];
1404  seg_tmp = seg_ME2[idseg.endcap() -1];
1405  }
1406  else{
1407  ++seg_ME3[idseg.endcap() -1];
1408  seg_tmp = seg_ME3[idseg.endcap() -1];
1409  }
1410  // is the segment good
1411  if(1== seg_tmp&& 6==(*segEffIt).nRecHits() && (*segEffIt).chi2()/(*segEffIt).degreesOfFreedom()<3.){
1412  std::pair <CSCDetId, CSCSegment> specSeg = make_pair( (CSCDetId)(*segEffIt).cscDetId(),*segEffIt);
1413  theSegments[2*(idseg.endcap()-1)+(idseg.station() -2)] = specSeg;
1414  }
1415  }
1416  /*
1417  if(2==idseg.station()){
1418  ++seg_ME2[idseg.endcap() -1];
1419  if(1==seg_ME2[idseg.endcap() -1] && 6==(*segEffIt).nRecHits() && (*segEffIt).chi2()/(*segEffIt).degreesOfFreedom()<3.){
1420  std::pair <CSCDetId, CSCSegment> specSeg = make_pair( (CSCDetId)(*segEffIt).cscDetId(),*segEffIt);
1421  theSegments[2*(idseg.endcap()-1)+(idseg.station() -2)] = specSeg;
1422  }
1423  }
1424  else if(3==idseg.station()){
1425  ++seg_ME3[idseg.endcap() -1];
1426  if(1==seg_ME3[idseg.endcap() -1] && 6==(*segEffIt).nRecHits() && (*segEffIt).chi2()/(*segEffIt).degreesOfFreedom()<3.){
1427  std::pair <CSCDetId, CSCSegment> specSeg = make_pair( (CSCDetId)(*segEffIt).cscDetId(),*segEffIt);
1428  theSegments[2*(idseg.endcap()-1)+(idseg.station() -2)] = specSeg;
1429  }
1430  }
1431  */
1432 
1433  }
1434  // Simple efficiency calculations
1435  for(int iE = 0;iE<2;iE++){
1436  for(int iS = 0;iS<4;iS++){
1437  for(int iR = 0; iR<4;iR++){
1438  for(int iC =0;iC<36;iC++){
1439  int NumberOfLayers = 0;
1440  for(int iL=0;iL<6;iL++){
1441  if(AllRecHits[iE][iS][iR][iC][iL]){
1442  NumberOfLayers++;
1443  }
1444  }
1445  int bin = 0;
1446  if (iS==0) bin = iR+1+(iE*10);
1447  else bin = (iS+1)*2 + (iR+1) + (iE*10);
1448  if(NumberOfLayers>1){
1449  //if(!(MultiSegments[iE][iS][iR][iC])){
1450  if(AllSegments[iE][iS][iR][iC]){
1451  //---- Efficient segment evenents
1452  hSSTE->AddBinContent(bin);
1453  }
1454  //---- All segment events (normalization)
1455  hSSTE->AddBinContent(20+bin);
1456  //}
1457  }
1458  if(AllSegments[iE][iS][iR][iC]){
1459  if(NumberOfLayers==6){
1460  //---- Efficient rechit events
1461  hRHSTE->AddBinContent(bin);;
1462  }
1463  //---- All rechit events (normalization)
1464  hRHSTE->AddBinContent(20+bin);;
1465  }
1466  }
1467  }
1468  }
1469  }
1470 
1471 // pick a segment only if there are no others in the station
1472  std::vector < std::pair <CSCDetId, CSCSegment> * > theSeg;
1473  if(1==seg_ME2[0]) theSeg.push_back(&theSegments[0]);
1474  if(1==seg_ME3[0]) theSeg.push_back(&theSegments[1]);
1475  if(1==seg_ME2[1]) theSeg.push_back(&theSegments[2]);
1476  if(1==seg_ME3[1]) theSeg.push_back(&theSegments[3]);
1477 
1478  // Needed for plots
1479  // at the end the chamber types will be numbered as 1 to 18
1480  // (ME-4/1, -ME3/2, -ME3/1, ..., +ME3/1, +ME3/2, ME+4/1 )
1481  std::map <std::string, float> chamberTypes;
1482  chamberTypes["ME1/a"] = 0.5;
1483  chamberTypes["ME1/b"] = 1.5;
1484  chamberTypes["ME1/2"] = 2.5;
1485  chamberTypes["ME1/3"] = 3.5;
1486  chamberTypes["ME2/1"] = 4.5;
1487  chamberTypes["ME2/2"] = 5.5;
1488  chamberTypes["ME3/1"] = 6.5;
1489  chamberTypes["ME3/2"] = 7.5;
1490  chamberTypes["ME4/1"] = 8.5;
1491 
1492  if(theSeg.size()){
1493  std::map <int , GlobalPoint> extrapolatedPoint;
1494  std::map <int , GlobalPoint>::iterator it;
1495  const std::vector<CSCChamber*> ChamberContainer = cscGeom->chambers();
1496  // Pick which chamber with which segment to test
1497  for(size_t nCh=0;nCh<ChamberContainer.size();nCh++){
1498  const CSCChamber *cscchamber = ChamberContainer[nCh];
1499  std::pair <CSCDetId, CSCSegment> * thisSegment = 0;
1500  for(size_t iSeg =0;iSeg<theSeg.size();++iSeg ){
1501  if(cscchamber->id().endcap() == theSeg[iSeg]->first.endcap()){
1502  if(1==cscchamber->id().station() || 3==cscchamber->id().station() ){
1503  if(2==theSeg[iSeg]->first.station()){
1504  thisSegment = theSeg[iSeg];
1505  }
1506  }
1507  else if (2==cscchamber->id().station() || 4==cscchamber->id().station()){
1508  if(3==theSeg[iSeg]->first.station()){
1509  thisSegment = theSeg[iSeg];
1510  }
1511  }
1512  }
1513  }
1514  // this chamber is to be tested with thisSegment
1515  if(thisSegment){
1516  CSCSegment * seg = &(thisSegment->second);
1517  const CSCChamber *segChamber = cscGeom->chamber(thisSegment->first);
1518  LocalPoint localCenter(0.,0.,0);
1519  GlobalPoint cscchamberCenter = cscchamber->toGlobal(localCenter);
1520  // try to save some time (extrapolate a segment to a certain position only once)
1521  it = extrapolatedPoint.find(int(cscchamberCenter.z()));
1522  if(it==extrapolatedPoint.end()){
1523  GlobalPoint segPos = segChamber->toGlobal(seg->localPosition());
1524  GlobalVector segDir = segChamber->toGlobal(seg->localDirection());
1525  double paramaterLine = lineParametrization(segPos.z(),cscchamberCenter.z() , segDir.z());
1526  double xExtrapolated = extrapolate1D(segPos.x(),segDir.x(), paramaterLine);
1527  double yExtrapolated = extrapolate1D(segPos.y(),segDir.y(), paramaterLine);
1528  GlobalPoint globP (xExtrapolated, yExtrapolated, cscchamberCenter.z());
1529  extrapolatedPoint[int(cscchamberCenter.z())] = globP;
1530  }
1531  // Where does the extrapolated point lie in the (tested) chamber local frame? Here:
1532  LocalPoint extrapolatedPointLocal = cscchamber->toLocal(extrapolatedPoint[int(cscchamberCenter.z())]);
1533  const CSCLayer *layer_p = cscchamber->layer(1);//layer 1
1534  const CSCLayerGeometry *layerGeom = layer_p->geometry ();
1535  const std::vector<float> layerBounds = layerGeom->parameters ();
1536  float shiftFromEdge = 15.;//cm
1537  float shiftFromDeadZone = 10.;
1538  // is the extrapolated point within a sensitive region
1539  bool pass = withinSensitiveRegion(extrapolatedPointLocal, layerBounds,
1540  cscchamber->id().station(), cscchamber->id().ring(),
1541  shiftFromEdge, shiftFromDeadZone);
1542  if(pass){// the extrapolation point of the segment lies within sensitive region of that chamber
1543  // how many rechit layers are there in the chamber?
1544  // 0 - maybe the muon died or is deflected at large angle? do not use that case
1545  // 1 - could be noise...
1546  // 2 or more - this is promissing; this is our definition of a reliable signal; use it below
1547  // is other definition better?
1548  int nRHLayers = 0;
1549  for(int iL =0;iL<6;++iL){
1550  if(AllRecHits[cscchamber->id().endcap()-1]
1551  [cscchamber->id().station()-1]
1552  [cscchamber->id().ring()-1][cscchamber->id().chamber()-1][iL]){
1553  ++nRHLayers;
1554  }
1555  }
1556  //std::cout<<" nRHLayers = "<<nRHLayers<<std::endl;
1557  float verticalScale = chamberTypes[cscchamber->specs()->chamberTypeName()];
1558  if(cscchamberCenter.z()<0){
1559  verticalScale = - verticalScale;
1560  }
1561  verticalScale +=9.5;
1562  hSensitiveAreaEvt->Fill(float(cscchamber->id().chamber()),verticalScale);
1563  if(nRHLayers>1){// this chamber contains a reliable signal
1564  //chamberTypes[cscchamber->specs()->chamberTypeName()];
1565  // "intrinsic" efficiencies
1566  //std::cout<<" verticalScale = "<<verticalScale<<" chType = "<<cscchamber->specs()->chamberTypeName()<<std::endl;
1567  // this is the denominator forr all efficiencies
1568  hEffDenominator->Fill(float(cscchamber->id().chamber()),verticalScale);
1569  // Segment efficiency
1570  if(AllSegments[cscchamber->id().endcap()-1]
1571  [cscchamber->id().station()-1]
1572  [cscchamber->id().ring()-1][cscchamber->id().chamber()-1]){
1573  hSSTE2->Fill(float(cscchamber->id().chamber()),float(verticalScale));
1574  }
1575 
1576  for(int iL =0;iL<6;++iL){
1577  float weight = 1./6.;
1578  // one shold account for the weight in the efficiency...
1579  // Rechit efficiency
1580  if(AllRecHits[cscchamber->id().endcap()-1]
1581  [cscchamber->id().station()-1]
1582  [cscchamber->id().ring()-1][cscchamber->id().chamber()-1][iL]){
1583  hRHSTE2->Fill(float(cscchamber->id().chamber()),float(verticalScale),weight);
1584  }
1585  if (useDigis){
1586  // Wire efficiency
1587  if(allWires[cscchamber->id().endcap()-1]
1588  [cscchamber->id().station()-1]
1589  [cscchamber->id().ring()-1][cscchamber->id().chamber()-1][iL]){
1590  // one shold account for the weight in the efficiency...
1591  hWireSTE2->Fill(float(cscchamber->id().chamber()),float(verticalScale),weight);
1592  }
1593  // Strip efficiency
1594  if(allStrips[cscchamber->id().endcap()-1]
1595  [cscchamber->id().station()-1]
1596  [cscchamber->id().ring()-1][cscchamber->id().chamber()-1][iL]){
1597  // one shold account for the weight in the efficiency...
1598  hStripSTE2->Fill(float(cscchamber->id().chamber()),float(verticalScale),weight);
1599  }
1600  }
1601  }
1602  }
1603  }
1604  }
1605  }
1606  }
1607  //
1608 
1609 
1610 }
int chamber() const
Definition: CSCDetId.h:70
TH2F * hSensitiveAreaEvt
bool withinSensitiveRegion(LocalPoint localPos, const std::vector< float > layerBounds, int station, int ring, float shiftFromEdge, float shiftFromDeadZone)
CSCDetId id() const
Get the (concrete) DetId.
Definition: CSCChamber.h:37
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
T y() const
Definition: PV3DBase.h:62
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:62
int layer() const
Definition: CSCDetId.h:63
double lineParametrization(double z1Position, double z2Position, double z1Direction)
std::string chamberTypeName() const
int endcap() const
Definition: CSCDetId.h:95
virtual const std::vector< float > parameters() const
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:45
LocalPoint localPosition() const
Definition: CSCSegment.h:39
LocalVector localDirection() const
Local direction.
Definition: CSCSegment.h:42
const CSCChamberSpecs * specs() const
Definition: CSCChamber.h:42
T z() const
Definition: PV3DBase.h:63
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
Definition: CSCChamber.cc:41
TH2F * hEffDenominator
bool first
Definition: L1TdeRCT.cc:94
int ring() const
Definition: CSCDetId.h:77
int station() const
Definition: CSCDetId.h:88
T x() const
Definition: PV3DBase.h:61
double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine)
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:47
void CSCValidation::doGasGain ( const CSCWireDigiCollection wirecltn,
const CSCStripDigiCollection strpcltn,
const CSCRecHit2DCollection rechitcltn 
)
private

Definition at line 2191 of file CSCValidation.cc.

References CSCDetId, CSCIndexer::dbIndex(), Reference_intrackfit_cff::endcap, create_complex_test_file0_cfg::firstEvent, mergeVDriftHistosByStation::histos, i, errorMatrix2Lands_multiChannel::id, j, VarParsing::mult, mergeVDriftHistosByStation::name, relativeConstraints::ring, relativeConstraints::station, indexGen::title, vdt::x, and detailsBasic3DVector::y.

2193  {
2194  float y;
2195  int channel=0,mult,wire,layer,idlayer,idchamber,ring;
2196  int wire_strip_rechit_present;
2197  std::string name,title,endcapstr;
2198  ostringstream ss;
2199  CSCIndexer indexer;
2200  std::map<int,int>::iterator intIt;
2201 
2202  m_single_wire_layer.clear();
2203 
2204  if(firstEvent) {
2205 
2206  // HV segments, their # and location in terms of wire groups
2207 
2208  m_wire_hvsegm.clear();
2209  std::map<int,std::vector<int> >::iterator intvecIt;
2210  // ME1a ME1b ME1/2 ME1/3 ME2/1 ME2/2 ME3/1 ME3/2 ME4/1 ME4/2
2211  int csctype[10]= {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
2212  int hvsegm_layer[10]={1, 1, 3, 3, 3, 5, 3, 5, 3, 5};
2213  int id;
2214  nmbhvsegm.clear();
2215  for(int i=0;i<10;i++) nmbhvsegm.push_back(hvsegm_layer[i]);
2216  // For ME1/1a
2217  std::vector<int> zer_1_1a(49,0);
2218  id=csctype[0];
2219  if(m_wire_hvsegm.find(id) == m_wire_hvsegm.end()) m_wire_hvsegm[id]=zer_1_1a;
2220  intvecIt=m_wire_hvsegm.find(id);
2221  for(int wire=1;wire<=48;wire++) intvecIt->second[wire]=1; // Segment 1
2222 
2223  // For ME1/1b
2224  std::vector<int> zer_1_1b(49,0);
2225  id=csctype[1];
2226  if(m_wire_hvsegm.find(id) == m_wire_hvsegm.end()) m_wire_hvsegm[id]=zer_1_1b;
2227  intvecIt=m_wire_hvsegm.find(id);
2228  for(int wire=1;wire<=48;wire++) intvecIt->second[wire]=1; // Segment 1
2229 
2230  // For ME1/2
2231  std::vector<int> zer_1_2(65,0);
2232  id=csctype[2];
2233  if(m_wire_hvsegm.find(id) == m_wire_hvsegm.end()) m_wire_hvsegm[id]=zer_1_2;
2234  intvecIt=m_wire_hvsegm.find(id);
2235  for(int wire=1;wire<=24;wire++) intvecIt->second[wire]=1; // Segment 1
2236  for(int wire=25;wire<=48;wire++) intvecIt->second[wire]=2; // Segment 2
2237  for(int wire=49;wire<=64;wire++) intvecIt->second[wire]=3; // Segment 3
2238 
2239  // For ME1/3
2240  std::vector<int> zer_1_3(33,0);
2241  id=csctype[3];
2242  if(m_wire_hvsegm.find(id) == m_wire_hvsegm.end()) m_wire_hvsegm[id]=zer_1_3;
2243  intvecIt=m_wire_hvsegm.find(id);
2244  for(int wire=1;wire<=12;wire++) intvecIt->second[wire]=1; // Segment 1
2245  for(int wire=13;wire<=22;wire++) intvecIt->second[wire]=2; // Segment 2
2246  for(int wire=23;wire<=32;wire++) intvecIt->second[wire]=3; // Segment 3
2247 
2248  // For ME2/1
2249  std::vector<int> zer_2_1(113,0);
2250  id=csctype[4];
2251  if(m_wire_hvsegm.find(id) == m_wire_hvsegm.end()) m_wire_hvsegm[id]=zer_2_1;
2252  intvecIt=m_wire_hvsegm.find(id);
2253  for(int wire=1;wire<=44;wire++) intvecIt->second[wire]=1; // Segment 1
2254  for(int wire=45;wire<=80;wire++) intvecIt->second[wire]=2; // Segment 2
2255  for(int wire=81;wire<=112;wire++) intvecIt->second[wire]=3; // Segment 3
2256 
2257  // For ME2/2
2258  std::vector<int> zer_2_2(65,0);
2259  id=csctype[5];
2260  if(m_wire_hvsegm.find(id) == m_wire_hvsegm.end()) m_wire_hvsegm[id]=zer_2_2;
2261  intvecIt=m_wire_hvsegm.find(id);
2262  for(int wire=1;wire<=16;wire++) intvecIt->second[wire]=1; // Segment 1
2263  for(int wire=17;wire<=28;wire++) intvecIt->second[wire]=2; // Segment 2
2264  for(int wire=29;wire<=40;wire++) intvecIt->second[wire]=3; // Segment 3
2265  for(int wire=41;wire<=52;wire++) intvecIt->second[wire]=4; // Segment 4
2266  for(int wire=53;wire<=64;wire++) intvecIt->second[wire]=5; // Segment 5
2267 
2268  // For ME3/1
2269  std::vector<int> zer_3_1(97,0);
2270  id=csctype[6];
2271  if(m_wire_hvsegm.find(id) == m_wire_hvsegm.end()) m_wire_hvsegm[id]=zer_3_1;
2272  intvecIt=m_wire_hvsegm.find(id);
2273  for(int wire=1;wire<=32;wire++) intvecIt->second[wire]=1; // Segment 1
2274  for(int wire=33;wire<=64;wire++) intvecIt->second[wire]=2; // Segment 2
2275  for(int wire=65;wire<=96;wire++) intvecIt->second[wire]=3; // Segment 3
2276 
2277  // For ME3/2
2278  std::vector<int> zer_3_2(65,0);
2279  id=csctype[7];
2280  if(m_wire_hvsegm.find(id) == m_wire_hvsegm.end()) m_wire_hvsegm[id]=zer_3_2;
2281  intvecIt=m_wire_hvsegm.find(id);
2282  for(int wire=1;wire<=16;wire++) intvecIt->second[wire]=1; // Segment 1
2283  for(int wire=17;wire<=28;wire++) intvecIt->second[wire]=2; // Segment 2
2284  for(int wire=29;wire<=40;wire++) intvecIt->second[wire]=3; // Segment 3
2285  for(int wire=41;wire<=52;wire++) intvecIt->second[wire]=4; // Segment 4
2286  for(int wire=53;wire<=64;wire++) intvecIt->second[wire]=5; // Segment 5
2287 
2288  // For ME4/1
2289  std::vector<int> zer_4_1(97,0);
2290  id=csctype[8];
2291  if(m_wire_hvsegm.find(id) == m_wire_hvsegm.end()) m_wire_hvsegm[id]=zer_4_1;
2292  intvecIt=m_wire_hvsegm.find(id);
2293  for(int wire=1;wire<=32;wire++) intvecIt->second[wire]=1; // Segment 1
2294  for(int wire=33;wire<=64;wire++) intvecIt->second[wire]=2; // Segment 2
2295  for(int wire=65;wire<=96;wire++) intvecIt->second[wire]=3; // Segment 3
2296 
2297  // For ME4/2
2298  std::vector<int> zer_4_2(65,0);
2299  id=csctype[9];
2300  if(m_wire_hvsegm.find(id) == m_wire_hvsegm.end()) m_wire_hvsegm[id]=zer_4_2;
2301  intvecIt=m_wire_hvsegm.find(id);
2302  for(int wire=1;wire<=16;wire++) intvecIt->second[wire]=1; // Segment 1
2303  for(int wire=17;wire<=28;wire++) intvecIt->second[wire]=2; // Segment 2
2304  for(int wire=29;wire<=40;wire++) intvecIt->second[wire]=3; // Segment 3
2305  for(int wire=41;wire<=52;wire++) intvecIt->second[wire]=4; // Segment 4
2306  for(int wire=53;wire<=64;wire++) intvecIt->second[wire]=5; // Segment 5
2307 
2308  } // end of if(nEventsAnalyzed==1)
2309 
2310 
2311  // do wires, strips and rechits present?
2312  wire_strip_rechit_present=0;
2313  if(wirecltn.begin() != wirecltn.end())
2314  wire_strip_rechit_present= wire_strip_rechit_present+1;
2315  if(strpcltn.begin() != strpcltn.end())
2316  wire_strip_rechit_present= wire_strip_rechit_present+2;
2317  if(rechitcltn.begin() != rechitcltn.end())
2318  wire_strip_rechit_present= wire_strip_rechit_present+4;
2319 
2320  if(wire_strip_rechit_present==7) {
2321 
2322 // std::cout<<"Event "<<nEventsAnalyzed<<std::endl;
2323 // std::cout<<std::endl;
2324 
2325  // cycle on wire collection for all CSC to select single wire hit layers
2327 
2328  for(wiredetUnitIt=wirecltn.begin();wiredetUnitIt!=wirecltn.end();
2329  ++wiredetUnitIt) {
2330  const CSCDetId id = (*wiredetUnitIt).first;
2331  idlayer=indexer.dbIndex(id, channel);
2332  idchamber=idlayer/10;
2333  layer=id.layer();
2334  // looping in the layer of given CSC
2335  mult=0; wire=0;
2336  const CSCWireDigiCollection::Range& range = (*wiredetUnitIt).second;
2338  range.first; digiIt!=range.second; ++digiIt){
2339  wire=(*digiIt).getWireGroup();
2340  mult++;
2341  } // end of digis loop in layer
2342 
2343  // select layers with single wire hit
2344  if(mult==1) {
2345  if(m_single_wire_layer.find(idlayer) == m_single_wire_layer.end())
2346  m_single_wire_layer[idlayer]=wire;
2347  } // end of if(mult==1)
2348  } // end of cycle on detUnit
2349 
2350  // Looping thru rechit collection
2353 
2354  for(recIt = rechitcltn.begin(); recIt != rechitcltn.end(); ++recIt) {
2355  CSCDetId id = (CSCDetId)(*recIt).cscDetId();
2356  idlayer=indexer.dbIndex(id, channel);
2357  idchamber=idlayer/10;
2358  layer=id.layer();
2359  // select layer with single wire rechit
2360  if(m_single_wire_layer.find(idlayer) != m_single_wire_layer.end()) {
2361 
2362  if(recIt->nStrips()==3) {
2363  // get 3X3 ADC Sum
2364  unsigned int binmx=0;
2365  float adcmax=0.0;
2366 
2367  for(unsigned int i=0;i<recIt->nStrips();i++)
2368  for(unsigned int j=0;j<recIt->nTimeBins();j++)
2369  if(recIt->adcs(i,j)>adcmax) {
2370  adcmax=recIt->adcs(i,j);
2371  binmx=j;
2372  }
2373 
2374  float adc_3_3_sum=0.0;
2375  //well, this really only works for 3 strips in readout - not sure the right fix for general case
2376  for(unsigned int i=0;i<recIt->nStrips();i++)
2377  for(unsigned int j=binmx-1;j<=binmx+1;j++)
2378  adc_3_3_sum+=recIt->adcs(i,j);
2379 
2380 
2381  if(adc_3_3_sum > 0.0 && adc_3_3_sum < 2000.0) {
2382 
2383  // temporary fix for ME1/1a to avoid triple entries
2384  int flag=0;
2385  if(id.station()==1 && id.ring()==4 && recIt->channels(1)>16) flag=1;
2386  // end of temporary fix
2387  if(flag==0) {
2388 
2389  wire= m_single_wire_layer[idlayer];
2390  int chambertype=id.iChamberType(id.station(),id.ring());
2391  int hvsgmtnmb=m_wire_hvsegm[chambertype][wire];
2392  int nmbofhvsegm=nmbhvsegm[chambertype-1];
2393  int location= (layer-1)*nmbofhvsegm+hvsgmtnmb;
2394  float x=location;
2395 
2396  ss<<"gas_gain_rechit_adc_3_3_sum_location_ME_"<<idchamber;
2397  name=ss.str(); ss.str("");
2398  if(id.endcap()==1) endcapstr = "+";
2399  ring=id.ring();
2400  if(id.station()==1 && id.ring()==4) ring=1;
2401  if(id.endcap()==2) endcapstr = "-";
2402  ss<<"Gas Gain Rechit ADC3X3 Sum ME"<<endcapstr<<
2403  id.station()<<"/"<<ring<<"/"<<id.chamber();
2404  title=ss.str(); ss.str("");
2405  x=location;
2406  y=adc_3_3_sum;
2407  histos->fill2DHist(x,y,name.c_str(),title.c_str(),30,1.0,31.0,50,0.0,2000.0,"GasGain");
2408 
2409  /*
2410  std::cout<<idchamber<<" "<<id.station()<<" "<<id.ring()<<" "
2411  <<id.chamber()<<" "<<layer<<" "<< wire<<" "<<m_strip[1]<<" "<<
2412  chambertype<<" "<< hvsgmtnmb<<" "<< nmbofhvsegm<<" "<<
2413  location<<" "<<adc_3_3_sum<<std::endl;
2414  */
2415  } // end of if flag==0
2416  } // end if(adcsum>0.0 && adcsum<2000.0)
2417  } // end of if if(m_strip.size()==3
2418  } // end of if single wire
2419  } // end of looping thru rechit collection
2420  } // end of if wire and strip and rechit present
2421 }
int i
Definition: DBlmapReader.cc:9
long int flag
Definition: mlp_lapack.h:47
std::map< int, std::vector< int > > m_wire_hvsegm
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:45
int dbIndex(const CSCDetId &id, int &channel)
Definition: CSCIndexer.cc:240
int j
Definition: DBlmapReader.cc:9
void fill2DHist(float x, float y, std::string name, std::string title, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:136
std::vector< int > nmbhvsegm
Maps and vectors for module doGasGain()
std::vector< DigiType >::const_iterator const_iterator
std::pair< const_iterator, const_iterator > Range
std::map< int, int > m_single_wire_layer
x
Definition: VDTMath.h:216
CSCValHists * histos
bool CSCValidation::doHLT ( edm::Handle< edm::TriggerResults hltResults)
private

Definition at line 633 of file CSCValidation.cc.

References mergeVDriftHistosByStation::histos, and i.

633  {
634 
635  // HLT stuff
636  int hltSize = hlt->size();
637  for (int i = 0; i < hltSize; ++i){
638  if (hlt->accept(i)) histos->fill1DHist(i,"hltBits","HLT Trigger Bits",hltSize+1,-0.5,(float)hltSize+0.5,"Trigger");
639  }
640 
641  return true;
642 }
int i
Definition: DBlmapReader.cc:9
void fill1DHist(float x, std::string name, std::string title, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:121
CSCValHists * histos
void CSCValidation::doNoiseHits ( edm::Handle< CSCRecHit2DCollection recHits,
edm::Handle< CSCSegmentCollection cscSegments,
edm::ESHandle< CSCGeometry cscGeom,
edm::Handle< CSCStripDigiCollection strips 
)
private

Definition at line 1819 of file CSCValidation.cc.

References CSCDetId, mergeVDriftHistosByStation::histos, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

1820  {
1821 
1823  for (recIt = recHits->begin(); recIt != recHits->end(); recIt++) {
1824 
1825  CSCDetId idrec = (CSCDetId)(*recIt).cscDetId();
1826 
1827  //Store the Rechits into a Map
1828  AllRechits.insert(std::pair<CSCDetId , CSCRecHit2D>(idrec,*recIt));
1829 
1830  // Find the strip containing this hit
1831  int centerid = recIt->nStrips()/2;
1832  int centerStrip = recIt->channels(centerid);
1833 
1834  float rHsignal = getthisSignal(*strips, idrec, centerStrip);
1835  histos->fill1DHist(rHsignal,"hrHSignal", "Signal in the 4th time bin for centre strip",1100,-99,1000,"recHits");
1836 
1837  }
1838 
1839  for(CSCSegmentCollection::const_iterator it=cscSegments->begin(); it != cscSegments->end(); it++) {
1840 
1841  std::vector<CSCRecHit2D> theseRecHits = (*it).specificRecHits();
1842  for ( std::vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
1843  CSCDetId idRH = (CSCDetId)(*iRH).cscDetId();
1844  LocalPoint lpRH = (*iRH).localPosition();
1845  float xrec = lpRH.x();
1846  float yrec = lpRH.y();
1847  float zrec = lpRH.z();
1848  bool RHalreadyinMap = false;
1849  //Store the rechits associated with segments into a Map
1850  multimap<CSCDetId , CSCRecHit2D>::iterator segRHit;
1851  segRHit = SegRechits.find(idRH);
1852  if (segRHit != SegRechits.end()){
1853  for( ; segRHit != SegRechits.upper_bound(idRH); ++segRHit){
1854  //for( segRHit = SegRechits.begin(); segRHit != SegRechits.end() ;++segRHit){
1855  LocalPoint lposRH = (segRHit->second).localPosition();
1856  float xpos = lposRH.x();
1857  float ypos = lposRH.y();
1858  float zpos = lposRH.z();
1859  if ( xrec == xpos && yrec == ypos && zrec == zpos){
1860  RHalreadyinMap = true;
1861  //std::cout << " Already exists " <<std ::endl;
1862  break;}
1863  }
1864  }
1865  if(!RHalreadyinMap){ SegRechits.insert(std::pair<CSCDetId , CSCRecHit2D>(idRH,*iRH));}
1866  }
1867  }
1868 
1869  findNonAssociatedRecHits(cscGeom,strips);
1870 
1871 }
float getthisSignal(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip)
T y() const
Definition: PV3DBase.h:62
void fill1DHist(float x, std::string name, std::string title, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:121
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:45
std::multimap< CSCDetId, CSCRecHit2D > AllRechits
T z() const
Definition: PV3DBase.h:63
void findNonAssociatedRecHits(edm::ESHandle< CSCGeometry > cscGeom, edm::Handle< CSCStripDigiCollection > strips)
std::multimap< CSCDetId, CSCRecHit2D > SegRechits
T x() const
Definition: PV3DBase.h:61
CSCValHists * histos
void CSCValidation::doOccupancies ( edm::Handle< CSCStripDigiCollection strips,
edm::Handle< CSCWireDigiCollection wires,
edm::Handle< CSCRecHit2DCollection recHits,
edm::Handle< CSCSegmentCollection cscSegments 
)
private

Definition at line 408 of file CSCValidation.cc.

References trackerHits::c, CSCDetId::chamber(), CSCDetId, diffTreeTool::diff, alignCSCRings::e, CSCDetId::endcap(), mergeVDriftHistosByStation::histos, alignCSCRings::r, CSCDetId::ring(), alignCSCRings::s, CSCDetId::station(), and dtDQMClient_cfg::threshold.

409  {
410 
411  bool wireo[2][4][4][36];
412  bool stripo[2][4][4][36];
413  bool rechito[2][4][4][36];
414  bool segmento[2][4][4][36];
415 
416  bool hasWires = false;
417  bool hasStrips = false;
418  bool hasRecHits = false;
419  bool hasSegments = false;
420 
421  for (int e = 0; e < 2; e++){
422  for (int s = 0; s < 4; s++){
423  for (int r = 0; r < 4; r++){
424  for (int c = 0; c < 36; c++){
425  wireo[e][s][r][c] = false;
426  stripo[e][s][r][c] = false;
427  rechito[e][s][r][c] = false;
428  segmento[e][s][r][c] = false;
429  }
430  }
431  }
432  }
433 
434  if (useDigis){
435  //wires
436  for (CSCWireDigiCollection::DigiRangeIterator wi=wires->begin(); wi!=wires->end(); wi++) {
437  CSCDetId id = (CSCDetId)(*wi).first;
438  int kEndcap = id.endcap();
439  int kRing = id.ring();
440  int kStation = id.station();
441  int kChamber = id.chamber();
442  std::vector<CSCWireDigi>::const_iterator wireIt = (*wi).second.first;
443  std::vector<CSCWireDigi>::const_iterator lastWire = (*wi).second.second;
444  for( ; wireIt != lastWire; ++wireIt){
445  if (!wireo[kEndcap-1][kStation-1][kRing-1][kChamber-1]){
446  wireo[kEndcap-1][kStation-1][kRing-1][kChamber-1] = true;
447  hOWires->Fill(kChamber,typeIndex(id));
448  histos->fill1DHist(chamberSerial(id),"hOWireSerial","Wire Occupancy by Chamber Serial",601,-0.5,600.5,"Digis");
449  hasWires = true;
450  }
451  }
452  }
453 
454  //strips
455  for (CSCStripDigiCollection::DigiRangeIterator si=strips->begin(); si!=strips->end(); si++) {
456  CSCDetId id = (CSCDetId)(*si).first;
457  int kEndcap = id.endcap();
458  int kRing = id.ring();
459  int kStation = id.station();
460  int kChamber = id.chamber();
461  std::vector<CSCStripDigi>::const_iterator stripIt = (*si).second.first;
462  std::vector<CSCStripDigi>::const_iterator lastStrip = (*si).second.second;
463  for( ; stripIt != lastStrip; ++stripIt) {
464  std::vector<int> myADCVals = stripIt->getADCCounts();
465  bool thisStripFired = false;
466  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
467  float threshold = 13.3 ;
468  float diff = 0.;
469  for (unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
470  diff = (float)myADCVals[iCount]-thisPedestal;
471  if (diff > threshold) { thisStripFired = true; }
472  }
473  if (thisStripFired) {
474  if (!stripo[kEndcap-1][kStation-1][kRing-1][kChamber-1]){
475  stripo[kEndcap-1][kStation-1][kRing-1][kChamber-1] = true;
476  hOStrips->Fill(kChamber,typeIndex(id));
477  histos->fill1DHist(chamberSerial(id),"hOStripSerial","Strip Occupancy by Chamber Serial",601,-0.5,600.5,"Digis");
478  hasStrips = true;
479  }
480  }
481  }
482  }
483  }
484 
485  //rechits
487  for (recIt = recHits->begin(); recIt != recHits->end(); recIt++) {
488  CSCDetId idrec = (CSCDetId)(*recIt).cscDetId();
489  int kEndcap = idrec.endcap();
490  int kRing = idrec.ring();
491  int kStation = idrec.station();
492  int kChamber = idrec.chamber();
493  if (!rechito[kEndcap-1][kStation-1][kRing-1][kChamber-1]){
494  rechito[kEndcap-1][kStation-1][kRing-1][kChamber-1] = true;
495  histos->fill1DHist(chamberSerial(idrec),"hORecHitsSerial","RecHit Occupancy by Chamber Serial",601,-0.5,600.5,"recHits");
496  hORecHits->Fill(kChamber,typeIndex(idrec));
497  hasRecHits = true;
498  }
499  }
500 
501  //segments
502  for(CSCSegmentCollection::const_iterator segIt=cscSegments->begin(); segIt != cscSegments->end(); segIt++) {
503  CSCDetId id = (CSCDetId)(*segIt).cscDetId();
504  int kEndcap = id.endcap();
505  int kRing = id.ring();
506  int kStation = id.station();
507  int kChamber = id.chamber();
508  if (!segmento[kEndcap-1][kStation-1][kRing-1][kChamber-1]){
509  segmento[kEndcap-1][kStation-1][kRing-1][kChamber-1] = true;
510  histos->fill1DHist(chamberSerial(id),"hOSegmentsSerial","Segment Occupancy by Chamber Serial",601,-0.5,600.5,"Segments");
511  hOSegments->Fill(kChamber,typeIndex(id));
512  hasSegments = true;
513  }
514  }
515 
516  // overall CSC occupancy (events with CSC data compared to total)
517  histos->fill1DHist(1,"hCSCOccupancy","overall CSC occupancy",15,-0.5,14.5,"GeneralHists");
518  if (hasWires) histos->fill1DHist(3,"hCSCOccupancy","overall CSC occupancy",15,-0.5,14.5,"GeneralHists");
519  if (hasStrips) histos->fill1DHist(5,"hCSCOccupancy","overall CSC occupancy",15,-0.5,14.5,"GeneralHists");
520  if (hasWires && hasStrips) histos->fill1DHist(7,"hCSCOccupancy","overall CSC occupancy",15,-0.5,14.5,"GeneralHists");
521  if (hasRecHits) histos->fill1DHist(9,"hCSCOccupancy","overall CSC occupancy",15,-0.5,14.5,"GeneralHists");
522  if (hasSegments) histos->fill1DHist(11,"hCSCOccupancy","overall CSC occupancy",15,-0.5,14.5,"GeneralHists");
523  if (!cleanEvent) histos->fill1DHist(13,"hCSCOccupancy","overall CSC occupancy",15,-0.5,14.5,"GeneralHists");
524 
525 }
int chamber() const
Definition: CSCDetId.h:70
int typeIndex(CSCDetId id)
void fill1DHist(float x, std::string name, std::string title, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:121
int endcap() const
Definition: CSCDetId.h:95
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:45
int ring() const
Definition: CSCDetId.h:77
int chamberSerial(CSCDetId id)
int station() const
Definition: CSCDetId.h:88
CSCValHists * histos
void CSCValidation::doPedestalNoise ( edm::Handle< CSCStripDigiCollection strips)
private

Definition at line 789 of file CSCValidation.cc.

References CSCDetId, mergeVDriftHistosByStation::histos, relativeConstraints::station, and dtDQMClient_cfg::threshold.

789  {
790 
791  for (CSCStripDigiCollection::DigiRangeIterator dPNiter=strips->begin(); dPNiter!=strips->end(); dPNiter++) {
792  CSCDetId id = (CSCDetId)(*dPNiter).first;
793  std::vector<CSCStripDigi>::const_iterator pedIt = (*dPNiter).second.first;
794  std::vector<CSCStripDigi>::const_iterator lStrip = (*dPNiter).second.second;
795  for( ; pedIt != lStrip; ++pedIt) {
796  int myStrip = pedIt->getStrip();
797  std::vector<int> myADCVals = pedIt->getADCCounts();
798  float TotalADC = getSignal(*strips, id, myStrip);
799  bool thisStripFired = false;
800  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
801  float thisSignal = (1./6)*(myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
802  float threshold = 13.3;
803  if(id.station() == 1 && id.ring() == 4)
804  {
805  if(myStrip <= 16) myStrip += 64; // no trapping for any bizarreness
806  }
807  if (TotalADC > threshold) { thisStripFired = true;}
808  if (!thisStripFired){
809  float ADC = thisSignal - thisPedestal;
810  histos->fill1DHist(ADC,"hStripPed","Pedestal Noise Distribution",50,-25.,25.,"PedestalNoise");
811  histos->fill1DHistByType(ADC,"hStripPedME","Pedestal Noise Distribution",id,50,-25.,25.,"PedestalNoise");
812  histos->fillProfile(chamberSerial(id),ADC,"hStripPedMEProfile","Wire TimeBin Fired",601,-0.5,600.5,-25,25,"PedestalNoise");
813  if (detailedAnalysis){
814  histos->fill1DHistByLayer(ADC,"hStripPedME","Pedestal Noise Distribution",id,50,-25.,25.,"PedestalNoiseByLayer");
815  }
816  }
817  }
818  }
819 
820 }
void fillProfile(float x, float y, std::string name, std::string title, int binsx, float xmin, float xmax, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:446
void fill1DHist(float x, std::string name, std::string title, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:121
void fill1DHistByLayer(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:397
void fill1DHistByType(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:151
float getSignal(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip)
int chamberSerial(CSCDetId id)
CSCValHists * histos
void CSCValidation::doRecHits ( edm::Handle< CSCRecHit2DCollection recHits,
edm::ESHandle< CSCGeometry cscGeom 
)
private

Definition at line 829 of file CSCValidation.cc.

References CSCDetId::chamber(), CSCDetId, CSCDetId::endcap(), mergeVDriftHistosByStation::histos, i, j, kLayer(), CSCDetId::layer(), CSCDetId::ring(), mathSSE::sqrt(), CSCDetId::station(), GeomDet::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), LocalError::xy(), PV3DBase< T, PVType, FrameType >::y(), and LocalError::yy().

829  {
830 
831  // Get the RecHits collection :
832  int nRecHits = recHits->size();
833 
834  // ---------------------
835  // Loop over rechits
836  // ---------------------
837  int iHit = 0;
838 
839  // Build iterator for rechits and loop :
841  for (dRHIter = recHits->begin(); dRHIter != recHits->end(); dRHIter++) {
842  iHit++;
843 
844  // Find chamber with rechits in CSC
845  CSCDetId idrec = (CSCDetId)(*dRHIter).cscDetId();
846  int kEndcap = idrec.endcap();
847  int kRing = idrec.ring();
848  int kStation = idrec.station();
849  int kChamber = idrec.chamber();
850  int kLayer = idrec.layer();
851 
852  // Store rechit as a Local Point:
853  LocalPoint rhitlocal = (*dRHIter).localPosition();
854  float xreco = rhitlocal.x();
855  float yreco = rhitlocal.y();
856  LocalError rerrlocal = (*dRHIter).localPositionError();
857  //these errors are squared!
858  float xxerr = rerrlocal.xx();
859  float yyerr = rerrlocal.yy();
860  float xyerr = rerrlocal.xy();
861  // errors in strip units
862  float stpos = (*dRHIter).positionWithinStrip();
863  float sterr = (*dRHIter).errorWithinStrip();
864 
865  // Find the charge associated with this hit
866  float rHSumQ = 0;
867  float sumsides=0.;
868  int adcsize=dRHIter->nStrips()*dRHIter->nTimeBins();
869  for ( unsigned int i=0; i< dRHIter->nStrips(); i++) {
870  for ( unsigned int j=0; j< dRHIter->nTimeBins()-1; j++) {
871  rHSumQ+=dRHIter->adcs(i,j);
872  if (i!=1) sumsides+=dRHIter->adcs(i,j);
873  }
874  }
875 
876  float rHratioQ = sumsides/rHSumQ;
877  if (adcsize != 12) rHratioQ = -99;
878 
879  // Get the signal timing of this hit
880  float rHtime = 0;
881  rHtime = (*dRHIter).tpeak()/50.;
882 
883  // Get pointer to the layer:
884  const CSCLayer* csclayer = cscGeom->layer( idrec );
885 
886  // Transform hit position from local chamber geometry to global CMS geom
887  GlobalPoint rhitglobal= csclayer->toGlobal(rhitlocal);
888  float grecx = rhitglobal.x();
889  float grecy = rhitglobal.y();
890 
891  // Fill the rechit position branch
892  if (writeTreeToFile && rhTreeCount < 1500000){
893  histos->fillRechitTree(xreco, yreco, grecx, grecy, kEndcap, kStation, kRing, kChamber, kLayer);
894  rhTreeCount++;
895  }
896 
897  // Fill some histograms
898  // only fill if 3 strips were used in the hit
899  histos->fill2DHistByStation(grecx,grecy,"hRHGlobal","recHit Global Position",idrec,100,-800.,800.,100,-800.,800.,"recHits");
900  if (kStation == 1 && (kRing == 1 || kRing == 4)) histos->fill1DHistByType(rHSumQ,"hRHSumQ","Sum 3x3 recHit Charge",idrec,125,0,4000,"recHits");
901  else histos->fill1DHistByType(rHSumQ,"hRHSumQ","Sum 3x3 recHit Charge",idrec,125,0,2000,"recHits");
902  histos->fill1DHistByType(rHratioQ,"hRHRatioQ","Charge Ratio (Ql+Qr)/Qt",idrec,120,-0.1,1.1,"recHits");
903  histos->fill1DHistByType(rHtime,"hRHTiming","recHit Timing",idrec,200,-10,10,"recHits");
904  histos->fill1DHistByType(sqrt(xxerr),"hRHxerr","RecHit Error on Local X",idrec,100,-0.1,2,"recHits");
905  histos->fill1DHistByType(sqrt(yyerr),"hRHyerr","RecHit Error on Local Y",idrec,100,-0.1,2,"recHits");
906  histos->fill1DHistByType(xyerr,"hRHxyerr","Corr. RecHit XY Error",idrec,100,-1,2,"recHits");
907  if (adcsize == 12) histos->fill1DHistByType(stpos,"hRHstpos","Reconstructed Position on Strip",idrec,120,-0.6,0.6,"recHits");
908  histos->fill1DHistByType(sterr,"hRHsterr","Estimated Error on Strip Measurement",idrec,120,-0.05,0.25,"recHits");
909  histos->fillProfile(chamberSerial(idrec),rHSumQ,"hRHSumQProfile","Sum 3x3 recHit Charge",601,-0.5,600.5,0,4000,"recHits");
910  histos->fillProfile(chamberSerial(idrec),rHtime,"hRHTimingProfile","recHit Timing",601,-0.5,600.5,-11,11,"recHits");
911  if (detailedAnalysis){
912  if (kStation == 1 && (kRing == 1 || kRing == 4)) histos->fill1DHistByLayer(rHSumQ,"hRHSumQ","Sum 3x3 recHit Charge",idrec,125,0,4000,"RHQByLayer");
913  else histos->fill1DHistByLayer(rHSumQ,"hRHSumQ","Sum 3x3 recHit Charge",idrec,125,0,2000,"RHQByLayer");
914  histos->fill1DHistByLayer(rHratioQ,"hRHRatioQ","Charge Ratio (Ql+Qr)/Qt",idrec,120,-0.1,1.1,"RHQByLayer");
915  histos->fill1DHistByLayer(rHtime,"hRHTiming","recHit Timing",idrec,200,-10,10,"RHTimingByLayer");
916  histos->fill2DHistByLayer(xreco,yreco,"hRHLocalXY","recHit Local Position",idrec,50,-100.,100.,75,-150.,150.,"RHLocalXYByLayer");
917  histos->fill1DHistByLayer(sqrt(xxerr),"hRHxerr","RecHit Error on Local X",idrec,100,-0.1,2,"RHErrorsByLayer");
918  histos->fill1DHistByLayer(sqrt(yyerr),"hRHyerr","RecHit Error on Local Y",idrec,100,-0.1,2,"RHErrorsByLayer");
919  histos->fill1DHistByType(stpos,"hRHstpos","Reconstructed Position on Strip",idrec,120,-0.6,0.6,"RHStripPosByLayer");
920  histos->fill1DHistByType(sterr,"hRHsterr","Estimated Error on Strip Measurement",idrec,120,-0.05,0.25,"RHStripPosByLayer");
921  }
922 
923  } //end rechit loop
924 
925  if (nRecHits == 0) nRecHits = -1;
926 
927  histos->fill1DHist(nRecHits,"hRHnrechits","recHits per Event (all chambers)",151,-0.5,150.5,"recHits");
928 
929 }
int chamber() const
Definition: CSCDetId.h:70
int i
Definition: DBlmapReader.cc:9
void fill2DHistByStation(float x, float y, std::string name, std::string title, CSCDetId id, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:268
float xx() const
Definition: LocalError.h:24
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
void fillProfile(float x, float y, std::string name, std::string title, int binsx, float xmin, float xmax, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:446
T y() const
Definition: PV3DBase.h:62
int layer() const
Definition: CSCDetId.h:63
void fill1DHist(float x, std::string name, std::string title, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:121
void fill1DHistByLayer(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:397
int endcap() const
Definition: CSCDetId.h:95
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:45
float xy() const
Definition: LocalError.h:25
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:46
int j
Definition: DBlmapReader.cc:9
void fill1DHistByType(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:151
static const std::string kLayer("layer")
void fillRechitTree(float x, float y, float gx, float gy, int en, int st, int ri, int ch, int la)
Definition: CSCValHists.cc:68
void fill2DHistByLayer(float x, float y, std::string name, std::string title, CSCDetId id, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:421
int ring() const
Definition: CSCDetId.h:77
int chamberSerial(CSCDetId id)
int station() const
Definition: CSCDetId.h:88
T x() const
Definition: PV3DBase.h:61
CSCValHists * histos
void CSCValidation::doResolution ( edm::Handle< CSCSegmentCollection cscSegments,
edm::ESHandle< CSCGeometry cscGeom 
)
private

Definition at line 1072 of file CSCValidation.cc.

References CSCDetId, mergeVDriftHistosByStation::histos, kLayer(), CSCDetId::layer(), CSCDetId::ring(), and CSCDetId::station().

1072  {
1073 
1074 
1075  for(CSCSegmentCollection::const_iterator dSiter=cscSegments->begin(); dSiter != cscSegments->end(); dSiter++) {
1076 
1077  CSCDetId id = (CSCDetId)(*dSiter).cscDetId();
1078 
1079  //
1080  // try to get the CSC recHits that contribute to this segment.
1081  std::vector<CSCRecHit2D> theseRecHits = (*dSiter).specificRecHits();
1082  int nRH = (*dSiter).nRecHits();
1083  int jRH = 0;
1084  CLHEP::HepMatrix sp(6,1);
1085  CLHEP::HepMatrix se(6,1);
1086  for ( std::vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
1087  jRH++;
1088  CSCDetId idRH = (CSCDetId)(*iRH).cscDetId();
1089  int kRing = idRH.ring();
1090  int kStation = idRH.station();
1091  int kLayer = idRH.layer();
1092 
1093  // Find the strip containing this hit
1094  int centerid = iRH->nStrips()/2;
1095  int centerStrip = iRH->channels(centerid);
1096 
1097  // If this segment has 6 hits, find the position of each hit on the strip in units of stripwidth and store values
1098  if (nRH == 6){
1099  float stpos = (*iRH).positionWithinStrip();
1100  se(kLayer,1) = (*iRH).errorWithinStrip();
1101  // Take into account half-strip staggering of layers (ME1/1 has no staggering)
1102  if (kStation == 1 && (kRing == 1 || kRing == 4)) sp(kLayer,1) = stpos + centerStrip;
1103  else{
1104  if (kLayer == 1 || kLayer == 3 || kLayer == 5) sp(kLayer,1) = stpos + centerStrip;
1105  if (kLayer == 2 || kLayer == 4 || kLayer == 6) sp(kLayer,1) = stpos - 0.5 + centerStrip;
1106  }
1107  }
1108 
1109  }
1110 
1111  float residual = -99;
1112  float pull = -99;
1113  // Fit all points except layer 3, then compare expected value for layer 3 to reconstructed value
1114  if (nRH == 6){
1115  float expected = fitX(sp,se);
1116  residual = expected - sp(3,1);
1117  pull = residual/se(3,1);
1118  }
1119 
1120  // Fill histos
1121  histos->fill1DHistByType(residual,"hSResid","Fitted Position on Strip - Reconstructed for Layer 3",id,100,-0.5,0.5,"Resolution");
1122  histos->fill1DHistByType(pull,"hSStripPosPull","Strip Measurement Pulls",id,100,-5.0,5.0,"Resolution");
1123  histos->fillProfile(chamberSerial(id),residual,"hSResidProfile","Fitted Position on Strip - Reconstructed for Layer 3",601,-0.5,600.5,-0.5,0.5,"Resolution");
1124  if (detailedAnalysis){
1125  histos->fill1DHistByChamber(residual,"hSResid","Fitted Position on Strip - Reconstructed for Layer 3",id,100,-0.5,0.5,"DetailedResolution");
1126  histos->fill1DHistByChamber(pull,"hSStripPosPull","Strip Measurement Pulls",id,100,-5.0,5.0,"Resolution");
1127  }
1128 
1129 
1130  }
1131 
1132 }
void fillProfile(float x, float y, std::string name, std::string title, int binsx, float xmin, float xmax, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:446
int layer() const
Definition: CSCDetId.h:63
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:45
float fitX(CLHEP::HepMatrix sp, CLHEP::HepMatrix ep)
void fill1DHistByType(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:151
static const std::string kLayer("layer")
int ring() const
Definition: CSCDetId.h:77
void fill1DHistByChamber(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:293
int chamberSerial(CSCDetId id)
int station() const
Definition: CSCDetId.h:88
CSCValHists * histos
void CSCValidation::doSegments ( edm::Handle< CSCSegmentCollection cscSegments,
edm::ESHandle< CSCGeometry cscGeom 
)
private

Definition at line 991 of file CSCValidation.cc.

References ChiSquaredProbability(), CSCDetId, CSCDetId::endcap(), mergeVDriftHistosByStation::histos, PV3DBase< T, PVType, FrameType >::phi(), PV3DBase< T, PVType, FrameType >::theta(), theta(), GeomDet::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

991  {
992 
993  // get CSC segment collection
994  int nSegments = cscSegments->size();
995 
996  // -----------------------
997  // loop over segments
998  // -----------------------
999  int iSegment = 0;
1000  for(CSCSegmentCollection::const_iterator dSiter=cscSegments->begin(); dSiter != cscSegments->end(); dSiter++) {
1001  iSegment++;
1002  //
1003  CSCDetId id = (CSCDetId)(*dSiter).cscDetId();
1004  int kEndcap = id.endcap();
1005  int kRing = id.ring();
1006  int kStation = id.station();
1007  int kChamber = id.chamber();
1008 
1009  //
1010  float chisq = (*dSiter).chi2();
1011  int nhits = (*dSiter).nRecHits();
1012  int nDOF = 2*nhits-4;
1013  double chisqProb = ChiSquaredProbability( (double)chisq, nDOF );
1014  LocalPoint localPos = (*dSiter).localPosition();
1015  float segX = localPos.x();
1016  float segY = localPos.y();
1017  LocalVector segDir = (*dSiter).localDirection();
1018  double theta = segDir.theta();
1019 
1020  // global transformation
1021  float globX = 0.;
1022  float globY = 0.;
1023  float globTheta = 0.;
1024  float globPhi = 0.;
1025  const CSCChamber* cscchamber = cscGeom->chamber(id);
1026  if (cscchamber) {
1027  GlobalPoint globalPosition = cscchamber->toGlobal(localPos);
1028  globX = globalPosition.x();
1029  globY = globalPosition.y();
1030  GlobalVector globalDirection = cscchamber->toGlobal(segDir);
1031  globTheta = globalDirection.theta();
1032  globPhi = globalDirection.phi();
1033  }
1034 
1035 
1036  // Fill segment position branch
1037  if (writeTreeToFile && segTreeCount < 1500000){
1038  histos->fillSegmentTree(segX, segY, globX, globY, kEndcap, kStation, kRing, kChamber);
1039  segTreeCount++;
1040  }
1041 
1042  // Fill histos
1043  histos->fill2DHistByStation(globX,globY,"hSGlobal","Segment Global Positions;global x (cm)",id,100,-800.,800.,100,-800.,800.,"Segments");
1044  histos->fill1DHistByType(nhits,"hSnHits","N hits on Segments",id,8,-0.5,7.5,"Segments");
1045  histos->fill1DHistByType(theta,"hSTheta","local theta segments",id,128,-3.2,3.2,"Segments");
1046  histos->fill1DHistByType((chisq/nDOF),"hSChiSq","segments chi-squared/ndof",id,110,-0.05,10.5,"Segments");
1047  histos->fill1DHistByType(chisqProb,"hSChiSqProb","segments chi-squared probability",id,110,-0.05,1.05,"Segments");
1048  histos->fill1DHist(globTheta,"hSGlobalTheta","segment global theta",128,0,3.2,"Segments");
1049  histos->fill1DHist(globPhi,"hSGlobalPhi","segment global phi",128,-3.2,3.2,"Segments");
1050  histos->fillProfile(chamberSerial(id),nhits,"hSnHitsProfile","N hits on Segments",601,-0.5,600.5,-0.5,7.5,"Segments");
1051  if (detailedAnalysis){
1052  histos->fill1DHistByChamber(nhits,"hSnHits","N hits on Segments",id,8,-0.5,7.5,"HitsOnSegmentByChamber");
1053  histos->fill1DHistByChamber(theta,"hSTheta","local theta segments",id,128,-3.2,3.2,"DetailedSegments");
1054  histos->fill1DHistByChamber((chisq/nDOF),"hSChiSq","segments chi-squared/ndof",id,110,-0.05,10.5,"SegChi2ByChamber");
1055  histos->fill1DHistByChamber(chisqProb,"hSChiSqProb","segments chi-squared probability",id,110,-0.05,1.05,"SegChi2ByChamber");
1056  }
1057 
1058  } // end segment loop
1059 
1060  if (nSegments == 0) nSegments = -1;
1061 
1062  histos->fill1DHist(nSegments,"hSnSegments","Segments per Event",31,-0.5,30.5,"Segments");
1063 
1064 }
void fill2DHistByStation(float x, float y, std::string name, std::string title, CSCDetId id, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:268
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
void fillProfile(float x, float y, std::string name, std::string title, int binsx, float xmin, float xmax, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:446
Geom::Theta< T > theta() const
T y() const
Definition: PV3DBase.h:62
void fill1DHist(float x, std::string name, std::string title, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:121
Geom::Theta< T > theta() const
Definition: PV3DBase.h:74
int endcap() const
Definition: CSCDetId.h:95
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:45
float ChiSquaredProbability(double chiSquared, double nrDOF)
void fill1DHistByType(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:151
void fill1DHistByChamber(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:293
int chamberSerial(CSCDetId id)
void fillSegmentTree(float x, float y, float gx, float gy, int en, int st, int ri, int ch)
Definition: CSCValHists.cc:84
T x() const
Definition: PV3DBase.h:61
CSCValHists * histos
void CSCValidation::doSimHits ( edm::Handle< CSCRecHit2DCollection recHits,
edm::Handle< edm::PSimHitContainer simHits 
)
private

Definition at line 937 of file CSCValidation.cc.

References abs, CSCDetId, mergeVDriftHistosByStation::histos, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

937  {
938 
940  for (dSHrecIter = recHits->begin(); dSHrecIter != recHits->end(); dSHrecIter++) {
941 
942  CSCDetId idrec = (CSCDetId)(*dSHrecIter).cscDetId();
943  LocalPoint rhitlocal = (*dSHrecIter).localPosition();
944  float xreco = rhitlocal.x();
945  float yreco = rhitlocal.y();
946  float xError = sqrt((*dSHrecIter).localPositionError().xx());
947  float yError = sqrt((*dSHrecIter).localPositionError().yy());
948  float simHitXres = -99;
949  float simHitYres = -99;
950  float xPull = -99;
951  float yPull = -99;
952  float mindiffX = 99;
953  float mindiffY = 10;
954  // If MC, find closest muon simHit to check resolution:
955  PSimHitContainer::const_iterator dSHsimIter;
956  for (dSHsimIter = simHits->begin(); dSHsimIter != simHits->end(); dSHsimIter++){
957  // Get DetID for this simHit:
958  CSCDetId sId = (CSCDetId)(*dSHsimIter).detUnitId();
959  // Check if the simHit detID matches that of current recHit
960  // and make sure it is a muon hit:
961  if (sId == idrec && abs((*dSHsimIter).particleType()) == 13){
962  // Get the position of this simHit in local coordinate system:
963  LocalPoint sHitlocal = (*dSHsimIter).localPosition();
964  // Now we need to make reasonably sure that this simHit is
965  // responsible for this recHit:
966  if ((sHitlocal.x() - xreco) < mindiffX && (sHitlocal.y() - yreco) < mindiffY){
967  simHitXres = (sHitlocal.x() - xreco);
968  simHitYres = (sHitlocal.y() - yreco);
969  mindiffX = (sHitlocal.x() - xreco);
970  xPull = simHitXres/xError;
971  yPull = simHitYres/yError;
972  }
973  }
974  }
975 
976  histos->fill1DHistByType(simHitXres,"hSimXResid","SimHitX - Reconstructed X",idrec,100,-1.0,1.0,"Resolution");
977  histos->fill1DHistByType(simHitYres,"hSimYResid","SimHitY - Reconstructed Y",idrec,100,-5.0,5.0,"Resolution");
978  histos->fill1DHistByType(xPull,"hSimXPull","Local X Pulls",idrec,100,-5.0,5.0,"Resolution");
979  histos->fill1DHistByType(yPull,"hSimYPull","Local Y Pulls",idrec,100,-5.0,5.0,"Resolution");
980 
981  }
982 
983 }
T y() const
Definition: PV3DBase.h:62
#define abs(x)
Definition: mlp_lapack.h:159
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:45
T sqrt(T t)
Definition: SSEVec.h:46
void fill1DHistByType(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:151
T x() const
Definition: PV3DBase.h:61
CSCValHists * histos
void CSCValidation::doStandalone ( edm::Handle< reco::TrackCollection saMuons)
private

Definition at line 1140 of file CSCValidation.cc.

References MuonSubdetId::CSC, SiPixelRawToDigiRegional_cfi::deltaPhi, MuonSubdetId::DT, mergeVDriftHistosByStation::histos, PV3DBase< T, PVType, FrameType >::mag(), DetId::Muon, metsig::muon, n, np, and MuonSubdetId::RPC.

1140  {
1141 
1142  int nSAMuons = saMuons->size();
1143  histos->fill1DHist(nSAMuons,"trNSAMuons","N Standalone Muons per Event",6,-0.5,5.5,"STAMuons");
1144 
1145  for(reco::TrackCollection::const_iterator muon = saMuons->begin(); muon != saMuons->end(); ++ muon ) {
1146  float preco = muon->p();
1147  float ptreco = muon->pt();
1148  int n = muon->recHitsSize();
1149  float chi2 = muon->chi2();
1150  float normchi2 = muon->normalizedChi2();
1151 
1152  // loop over hits
1153  int nDTHits = 0;
1154  int nCSCHits = 0;
1155  int nCSCHitsp = 0;
1156  int nCSCHitsm = 0;
1157  int nRPCHits = 0;
1158  int nRPCHitsp = 0;
1159  int nRPCHitsm = 0;
1160  int np = 0;
1161  int nm = 0;
1162  std::vector<CSCDetId> staChambers;
1163  for (trackingRecHit_iterator hit = muon->recHitsBegin(); hit != muon->recHitsEnd(); ++hit ) {
1164  const DetId detId( (*hit)->geographicalId() );
1165  if (detId.det() == DetId::Muon) {
1166  if (detId.subdetId() == MuonSubdetId::RPC) {
1167  RPCDetId rpcId(detId.rawId());
1168  nRPCHits++;
1169  if (rpcId.region() == 1){ nRPCHitsp++; np++;}
1170  if (rpcId.region() == -1){ nRPCHitsm++; nm++;}
1171  }
1172  if (detId.subdetId() == MuonSubdetId::DT) {
1173  nDTHits++;
1174  }
1175  else if (detId.subdetId() == MuonSubdetId::CSC) {
1176  CSCDetId cscId(detId.rawId());
1177  staChambers.push_back(detId.rawId());
1178  nCSCHits++;
1179  if (cscId.endcap() == 1){ nCSCHitsp++; np++;}
1180  if (cscId.endcap() == 2){ nCSCHitsm++; nm++;}
1181  }
1182  }
1183  }
1184 
1185  GlobalPoint innerPnt(muon->innerPosition().x(),muon->innerPosition().y(),muon->innerPosition().z());
1186  GlobalPoint outerPnt(muon->outerPosition().x(),muon->outerPosition().y(),muon->outerPosition().z());
1187  GlobalVector innerKin(muon->innerMomentum().x(),muon->innerMomentum().y(),muon->innerMomentum().z());
1188  GlobalVector outerKin(muon->outerMomentum().x(),muon->outerMomentum().y(),muon->outerMomentum().z());
1189  GlobalVector deltaPnt = innerPnt - outerPnt;
1190  double crudeLength = deltaPnt.mag();
1191  double deltaPhi = innerPnt.phi() - outerPnt.phi();
1192  double innerGlobalPolarAngle = innerKin.theta();
1193  double outerGlobalPolarAngle = outerKin.theta();
1194 
1195 
1196  // fill histograms
1197  histos->fill1DHist(n,"trN","N hits on a STA Muon Track",51,-0.5,50.5,"STAMuons");
1198  if (np != 0) histos->fill1DHist(np,"trNp","N hits on a STA Muon Track (plus endcap)",51,-0.5,50.5,"STAMuons");
1199  if (nm != 0) histos->fill1DHist(nm,"trNm","N hits on a STA Muon Track (minus endcap)",51,-0.5,50.5,"STAMuons");
1200  histos->fill1DHist(nDTHits,"trNDT","N DT hits on a STA Muon Track",51,-0.5,50.5,"STAMuons");
1201  histos->fill1DHist(nCSCHits,"trNCSC","N CSC hits on a STA Muon Track",51,-0.5,50.5,"STAMuons");
1202  if (nCSCHitsp != 0) histos->fill1DHist(nCSCHitsp,"trNCSCp","N CSC hits on a STA Muon Track (+ endcap)",51,-0.5,50.5,"STAMuons");
1203  if (nCSCHitsm != 0) histos->fill1DHist(nCSCHitsm,"trNCSCm","N CSC hits on a STA Muon Track (- endcap)",51,-0.5,50.5,"STAMuons");
1204  histos->fill1DHist(nRPCHits,"trNRPC","N RPC hits on a STA Muon Track",51,-0.5,50.5,"STAMuons");
1205  if (nRPCHitsp != 0) histos->fill1DHist(nRPCHitsp,"trNRPCp","N RPC hits on a STA Muon Track (+ endcap)",51,-0.5,50.5,"STAMuons");
1206  if (nRPCHitsm != 0) histos->fill1DHist(nRPCHitsm,"trNRPCm","N RPC hits on a STA Muon Track (- endcap)",51,-0.5,50.5,"STAMuons");
1207  histos->fill1DHist(preco,"trP","STA Muon Momentum",100,0,300,"STAMuons");
1208  histos->fill1DHist(ptreco,"trPT","STA Muon pT",100,0,40,"STAMuons");
1209  histos->fill1DHist(chi2,"trChi2","STA Muon Chi2",100,0,200,"STAMuons");
1210  histos->fill1DHist(normchi2,"trNormChi2","STA Muon Normalized Chi2",100,0,10,"STAMuons");
1211  histos->fill1DHist(crudeLength,"trLength","Straight Line Length of STA Muon",120,0.,2400.,"STAMuons");
1212  histos->fill1DHist(deltaPhi,"trDeltaPhi","Delta-Phi Between Inner and Outer STA Muon Pos.",100,-0.5,0.5,"STAMuons");
1213  histos->fill1DHist(innerGlobalPolarAngle,"trInnerPolar","Polar Angle of Inner P Vector (STA muons)",128,0,3.2,"STAMuons");
1214  histos->fill1DHist(outerGlobalPolarAngle,"trOuterPolar","Polar Angle of Outer P Vector (STA muons)",128,0,3.2,"STAMuons");
1215  histos->fill1DHist(innerPnt.phi(),"trInnerPhi","Phi of Inner Position (STA muons)",256,-3.2,3.2,"STAMuons");
1216  histos->fill1DHist(outerPnt.phi(),"trOuterPhi","Phi of Outer Position (STA muons)",256,-3.2,3.2,"STAMuons");
1217 
1218  }
1219 
1220 }
void fill1DHist(float x, std::string name, std::string title, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:121
static const int CSC
Definition: MuonSubdetId.h:15
T mag() const
Definition: PV3DBase.h:66
int np
Definition: AMPTWrapper.h:33
Definition: DetId.h:20
static const int RPC
Definition: MuonSubdetId.h:16
static const int DT
Definition: MuonSubdetId.h:14
CSCValHists * histos
void CSCValidation::doStripDigis ( edm::Handle< CSCStripDigiCollection strips)
private

Definition at line 748 of file CSCValidation.cc.

References CSCDetId, diffTreeTool::diff, mergeVDriftHistosByStation::histos, and dtDQMClient_cfg::threshold.

748  {
749 
750  int nStripsFired = 0;
751  for (CSCStripDigiCollection::DigiRangeIterator dSDiter=strips->begin(); dSDiter!=strips->end(); dSDiter++) {
752  CSCDetId id = (CSCDetId)(*dSDiter).first;
753  std::vector<CSCStripDigi>::const_iterator stripIter = (*dSDiter).second.first;
754  std::vector<CSCStripDigi>::const_iterator lStrip = (*dSDiter).second.second;
755  for( ; stripIter != lStrip; ++stripIter) {
756  int myStrip = stripIter->getStrip();
757  std::vector<int> myADCVals = stripIter->getADCCounts();
758  bool thisStripFired = false;
759  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
760  float threshold = 13.3 ;
761  float diff = 0.;
762  for (unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
763  diff = (float)myADCVals[iCount]-thisPedestal;
764  if (diff > threshold) { thisStripFired = true; }
765  }
766  if (thisStripFired) {
767  nStripsFired++;
768  // fill strip histos
769  histos->fill1DHistByType(myStrip,"hStripStrip","Strip Number",id,81,-0.5,80.5,"Digis");
770  if (detailedAnalysis){
771  histos->fill1DHistByLayer(myStrip,"hStripStrip","Strip Number",id,81,-0.5,80.5,"StripNumberByLayer");
772  }
773  }
774  }
775  } // end strip loop
776 
777  if (nStripsFired == 0) nStripsFired = -1;
778 
779  histos->fill1DHist(nStripsFired,"hStripNFired","Fired Strips per Event",251,-0.5,250.5,"Digis");
780 
781 }
void fill1DHist(float x, std::string name, std::string title, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:121
void fill1DHistByLayer(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:397
void fill1DHistByType(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:151
CSCValHists * histos
void CSCValidation::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 
)
private

Get a handle to the FED data collection

uncomment this for regional unpacking if (id!=SOME_ID) continue;

Take a reference to this FED's data

if fed has data then unpack it

examine event for integrity

get a pointer to data and pass it to constructor for unpacking

get a reference to dduData

set default detid to that for E=+z, S=1, R=1, C=1, L=1

skip the DDU if its data has serious errors define a mask for serious errors

get a reference to chamber data

adjust crate numbers for MTCC data

default value for all digis not related to cfebs

layer=0 flags entire chamber

check alct data integrity

check tmb data integrity

Definition at line 2640 of file CSCValidation.cc.

References CSCTMBHeader::ALCTMatchTime(), CSCTMBHeader::BXNCount(), CSCDetId::chamber(), CSCDetId::chamberId(), CastorDataFrameFilter_impl::check(), CSCDCCExaminer::check(), CSCDCCExaminer::crcALCT(), CSCDCCExaminer::crcCFEB(), CSCDCCExaminer::crcTMB(), CSCDetId, FEDRawData::data(), data, CSCDCCEventData::dduData(), CSCCrateMap::detId(), CSCDetId::endcap(), CSCDCCExaminer::errors(), edm::EventSetup::get(), mergeVDriftHistosByStation::histos, errorMatrix2Lands_multiChannel::id, j, LogTrace, FEDNumbering::MAXCSCFEDID, FEDNumbering::MINCSCFEDID, NULL, CSCDCCExaminer::output1(), CSCDCCExaminer::output2(), edm::ESHandle< class >::product(), lumiPlot::rawdata, CSCDCCExaminer::OStream::redirect(), CSCDetId::ring(), CSCDCCExaminer::setMask(), CSCDCCExaminer::OStream::show(), FEDRawData::size(), python.multivaluedict::sort(), mathSSE::sqrt(), CSCDetId::station(), GeomDet::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

2644  {
2645 
2646  map<CSCDetId, float > segment_median_map; //structure for storing the median time for segments in a chamber
2647  map<CSCDetId, GlobalPoint > segment_position_map; //structure for storing the global position for segments in a chamber
2648 
2649  // -----------------------
2650  // loop over segments
2651  // -----------------------
2652  int iSegment = 0;
2653  for(CSCSegmentCollection::const_iterator dSiter=cscSegments->begin(); dSiter != cscSegments->end(); dSiter++) {
2654  iSegment++;
2655 
2656  CSCDetId id = (CSCDetId)(*dSiter).cscDetId();
2657  LocalPoint localPos = (*dSiter).localPosition();
2658  GlobalPoint globalPosition = GlobalPoint(0.0, 0.0, 0.0);
2659  const CSCChamber* cscchamber = cscGeom->chamber(id);
2660  if (cscchamber) {
2661  globalPosition = cscchamber->toGlobal(localPos);
2662  }
2663 
2664  // try to get the CSC recHits that contribute to this segment.
2665  std::vector<CSCRecHit2D> theseRecHits = (*dSiter).specificRecHits();
2666  int nRH = (*dSiter).nRecHits();
2667  if (nRH < 4 ) continue;
2668 
2669  //Store the recHit times of a segment in a vector for later sorting
2670  vector<float> non_zero;
2671 
2672  for ( vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
2673  non_zero.push_back( iRH->tpeak());
2674 
2675  }// end rechit loop
2676 
2677  //Sort the vector of hit times for this segment and average the center two
2678  sort(non_zero.begin(),non_zero.end());
2679  int middle_index = non_zero.size()/2;
2680  float average_two = (non_zero.at(middle_index-1) + non_zero.at(middle_index))/2.;
2681  if(non_zero.size()%2)
2682  average_two = non_zero.at(middle_index);
2683 
2684  //If we've vetoed events with multiple segments per chamber, this should never overwrite informations
2685  segment_median_map[id]=average_two;
2686  segment_position_map[id]=globalPosition;
2687 
2688  double distToIP = sqrt(globalPosition.x()*globalPosition.x()+globalPosition.y()*globalPosition.y()+globalPosition.z()*globalPosition.z());
2689 
2690  histos->fillProfile(chamberSerial(id),average_two,"timeChamber","Segment mean time",601,-0.5,600.5,-400.,400.,"TimeMonitoring");
2691  histos->fillProfileByType(id.chamber(),average_two,"timeChamberByType","Segment mean time by chamber",id,36,0.5,36.5,-400,400.,"TimeMonitoring");
2692  histos->fill2DHist(distToIP,average_two,"seg_time_vs_distToIP","Segment time vs. Distance to IP",80,600.,1400.,800,-400,400.,"TimeMonitoring");
2693  histos->fill2DHist(globalPosition.z(),average_two,"seg_time_vs_globZ","Segment time vs. z position",240,-1200,1200,800,-400.,400.,"TimeMonitoring");
2694  histos->fill2DHist(fabs(globalPosition.z()),average_two,"seg_time_vs_absglobZ","Segment time vs. abs(z position)",120,0.,1200.,800,-400.,400.,"TimeMonitoring");
2695 
2696  }//end segment loop
2697 
2698  //Now that the information for each segment we're interest in is stored, it is time to go through the pairs and make plots
2699  map<CSCDetId, float >::const_iterator it_outer; //for the outer loop
2700  map<CSCDetId, float >::const_iterator it_inner; //for the nested inner loop
2701  for (it_outer = segment_median_map.begin(); it_outer != segment_median_map.end(); it_outer++){
2702 
2703  CSCDetId id_outer = it_outer->first;
2704  float t_outer = it_outer->second;
2705 
2706  //begin the inner loop
2707  for (it_inner = segment_median_map.begin(); it_inner != segment_median_map.end(); it_inner++){
2708 
2709  CSCDetId id_inner = it_inner->first;
2710  float t_inner = it_inner->second;
2711 
2712  // we're looking at ordered pairs, so combinations will be double counted
2713  // (chamber a, chamber b) will be counted as well as (chamber b, chamber a)
2714  // We will avoid (chamber a, chamber a) with the following line
2715  if (chamberSerial(id_outer) == chamberSerial(id_inner)) continue;
2716 
2717  // Calculate expected TOF (in ns units)
2718  // GlobalPoint gp_outer = segment_position_map.find(id_outer)->second;
2719  // GlobalPoint gp_inner = segment_position_map.find(id_inner)->second;
2720  // GlobalVector flight = gp_outer - gp_inner; //in cm
2721  // float TOF = flight.mag()/30.0; //to ns
2722 
2723  //Plot t(ME+) - t(ME-) for chamber pairs in the same stations and rings but opposite endcaps
2724  if (id_outer.endcap() ==1 && id_inner.endcap() == 2 && id_outer.station() == id_inner.station() && id_outer.ring() == id_inner.ring() ){
2725  histos->fill1DHist(t_outer-t_inner,"diff_opposite_endcaps","#Delta t [ME+]-[ME-] for chambers in same station and ring",800,-400.,400.,"TimeMonitoring");
2726  histos->fill1DHistByType(t_outer-t_inner,"diff_opposite_endcaps_byType","#Delta t [ME+]-[ME-] for chambers in same station and ring",id_outer,800,-400.,400.,"TimeMonitoring");
2727  }
2728 
2729  }//end inner loop of segment pairs
2730  }//end outer loop of segment pairs
2731 
2732  //if the digis, return here
2733  if( !useDigis ) return;
2734 
2735  //looking for the global trigger number
2736  vector<L1MuGMTReadoutRecord> L1Mrec = pCollection->getRecords();
2737  vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
2738  int L1GMT_BXN = -100;
2739  bool has_CSCTrigger = false;
2740  bool has_beamHaloTrigger = false;
2741  for(igmtrr=L1Mrec.begin(); igmtrr!=L1Mrec.end(); igmtrr++) {
2742  std::vector<L1MuRegionalCand>::const_iterator iter1;
2743  std::vector<L1MuRegionalCand> rmc;
2744  // CSC
2745  int icsc = 0;
2746  rmc = igmtrr->getCSCCands();
2747  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
2748  if ( !(*iter1).empty() ) {
2749  icsc++;
2750  int kQuality = (*iter1).quality(); // kQuality = 1 means beam halo
2751  if (kQuality == 1) has_beamHaloTrigger = true;
2752  }
2753  }
2754  if (igmtrr->getBxInEvent() == 0 && icsc>0){
2755  //printf("L1 CSCCands exist. L1MuGMTReadoutRecord BXN = %d \n", igmtrr->getBxNr());
2756  L1GMT_BXN = igmtrr->getBxNr();
2757  has_CSCTrigger = true;
2758  }
2759  else if (igmtrr->getBxInEvent() == 0 ) {
2760  //printf("L1 CSCCands do not exist. L1MuGMTReadoutRecord BXN = %d \n", igmtrr->getBxNr());
2761  L1GMT_BXN = igmtrr->getBxNr();
2762  }
2763  }
2764 
2765  // *************************************************
2766  // *** ALCT Digis **********************************
2767  // *************************************************
2768 
2769  int n_alcts = 0;
2770  map<CSCDetId, int > ALCT_KeyWG_map; //structure for storing the key wire group for the first ALCT for each chamber
2771  for (CSCALCTDigiCollection::DigiRangeIterator j=alcts->begin(); j!=alcts->end(); j++) {
2772  const CSCALCTDigiCollection::Range& range =(*j).second;
2773  const CSCDetId& idALCT = (*j).first;
2774  for (CSCALCTDigiCollection::const_iterator digiIt = range.first; digiIt!=range.second; ++digiIt){
2775  // Valid digi in the chamber (or in neighbouring chamber)
2776  if((*digiIt).isValid()){
2777  n_alcts++;
2778  histos->fill1DHist( (*digiIt).getBX(), "ALCT_getBX","ALCT.getBX()",11,-0.5,10.5,"TimeMonitoring");
2779  histos->fill1DHist( (*digiIt).getFullBX(), "ALCT_getFullBX","ALCT.getFullBX()",3601,-0.5,3600.5,"TimeMonitoring");
2780  //if we don't already have digi information stored for this chamber, then we fill it
2781  if (ALCT_KeyWG_map.find(idALCT.chamberId()) == ALCT_KeyWG_map.end()){
2782  ALCT_KeyWG_map[idALCT.chamberId()] = (*digiIt).getKeyWG();
2783  //printf("I did fill ALCT info for Chamber %d %d %d %d \n",idALCT.chamberId().endcap(), idALCT.chamberId().station(), idALCT.chamberId().ring(), idALCT.chamberId().chamber());
2784  }
2785 
2786  }
2787  }
2788  }
2789 
2790  // *************************************************
2791  // *** CLCT Digis **********************************
2792  // *************************************************
2793  int n_clcts = 0;
2794  map<CSCDetId, int > CLCT_getFullBx_map; //structure for storing the pretrigger bxn for the first CLCT for each chamber
2795  for (CSCCLCTDigiCollection::DigiRangeIterator j=clcts->begin(); j!=clcts->end(); j++) {
2796  const CSCCLCTDigiCollection::Range& range =(*j).second;
2797  const CSCDetId& idCLCT = (*j).first;
2798  for (CSCCLCTDigiCollection::const_iterator digiIt = range.first; digiIt!=range.second; ++digiIt){
2799  // Valid digi in the chamber (or in neighbouring chamber)
2800  if((*digiIt).isValid()){
2801  n_clcts++;
2802  histos->fill1DHist( (*digiIt).getBX(), "CLCT_getBX","CLCT.getBX()",11,-0.5,10.5,"TimeMonitoring");
2803  histos->fill1DHist( (*digiIt).getFullBX(), "CLCT_getFullBX","CLCT.getFullBX()",3601,-0.5,3600.5,"TimeMonitoring");
2804  //if we don't already have digi information stored for this chamber, then we fill it
2805  if (CLCT_getFullBx_map.find(idCLCT.chamberId()) == CLCT_getFullBx_map.end()){
2806  CLCT_getFullBx_map[idCLCT.chamberId()] = (*digiIt).getFullBX();
2807  //printf("I did fill CLCT info for Chamber %d %d %d %d \n",idCLCT.chamberId().endcap(), idCLCT.chamberId().station(), idCLCT.chamberId().ring(), idCLCT.chamberId().chamber());
2808  }
2809  }
2810  }
2811  }
2812 
2813  // *************************************************
2814  // *** CorrelatedLCT Digis *************************
2815  // *************************************************
2816  int n_correlatedlcts = 0;
2817  for (CSCCorrelatedLCTDigiCollection::DigiRangeIterator j=correlatedlcts->begin(); j!=correlatedlcts->end(); j++) {
2818  const CSCCorrelatedLCTDigiCollection::Range& range =(*j).second;
2819  for (CSCCorrelatedLCTDigiCollection::const_iterator digiIt = range.first; digiIt!=range.second; ++digiIt){
2820  if((*digiIt).isValid()){
2821  n_correlatedlcts++;
2822  histos->fill1DHist( (*digiIt).getBX(), "CorrelatedLCTS_getBX","CorrelatedLCT.getBX()",11,-0.5,10.5,"TimeMonitoring");
2823  }
2824  }
2825  }
2826 
2827 
2828  int nRecHits = recHits->size();
2829  int nSegments = cscSegments->size();
2830  if (has_CSCTrigger){
2831  histos->fill1DHist(L1GMT_BXN,"BX_L1CSCCand","BX of L1 CSC Cand",4001,-0.5,4000.5,"TimeMonitoring");
2832  histos->fill2DHist(L1GMT_BXN,n_alcts,"n_ALCTs_v_BX_L1CSCCand","Number of ALCTs vs. BX of L1 CSC Cand",4001,-0.5,4000.5,51,-0.5,50.5,"TimeMonitoring");
2833  histos->fill2DHist(L1GMT_BXN,n_clcts,"n_CLCTs_v_BX_L1CSCCand","Number of CLCTs vs. BX of L1 CSC Cand",4001,-0.5,4000.5,51,-0.5,50.5,"TimeMonitoring");
2834  histos->fill2DHist(L1GMT_BXN,n_correlatedlcts,"n_CorrelatedLCTs_v_BX_L1CSCCand","Number of CorrelatedLCTs vs. BX of L1 CSC Cand",4001,-0.5,4000.5,51,-0.5,50.5,"TimeMonitoring");
2835  histos->fill2DHist(L1GMT_BXN,nRecHits,"n_RecHits_v_BX_L1CSCCand","Number of RecHits vs. BX of L1 CSC Cand",4001,-0.5,4000.5,101,-0.5,100.5,"TimeMonitoring");
2836  histos->fill2DHist(L1GMT_BXN,nSegments,"n_Segments_v_BX_L1CSCCand","Number of Segments vs. BX of L1 CSC Cand",4001,-0.5,4000.5,51,-0.5,50.5,"TimeMonitoring");
2837  }
2838  if (has_CSCTrigger && has_beamHaloTrigger){
2839  histos->fill1DHist(L1GMT_BXN,"BX_L1CSCCand_w_beamHalo","BX of L1 CSC (w beamHalo bit)",4001,-0.5,4000.5,"TimeMonitoring");
2840  histos->fill2DHist(L1GMT_BXN,n_alcts,"n_ALCTs_v_BX_L1CSCCand_w_beamHalo","Number of ALCTs vs. BX of L1 CSC Cand (w beamHalo bit)",4001,-0.5,4000.5,51,-0.5,50.5,"TimeMonitoring");
2841  histos->fill2DHist(L1GMT_BXN,n_clcts,"n_CLCTs_v_BX_L1CSCCand_w_beamHalo","Number of CLCTs vs. BX of L1 CSC Cand (w beamHalo bit)",4001,-0.5,4000.5,51,-0.5,50.5,"TimeMonitoring");
2842  histos->fill2DHist(L1GMT_BXN,n_correlatedlcts,"n_CorrelatedLCTs_v_BX_L1CSCCand_w_beamHalo","Number of CorrelatedLCTs vs. BX of L1 CSC Cand (w beamHalo bit)",4001,-0.5,4000.5,51,-0.5,50.5,"TimeMonitoring");
2843  histos->fill2DHist(L1GMT_BXN,nRecHits,"n_RecHits_v_BX_L1CSCCand_w_beamHalo","Number of RecHits vs. BX of L1 CSC Cand (w beamHalo bit)",4001,-0.5,4000.5,101,-0.5,100.5,"TimeMonitoring");
2844  histos->fill2DHist(L1GMT_BXN,nSegments,"n_Segments_v_BX_L1CSCCand_w_beamHalo","Number of Segments vs. BX of L1 CSC Cand (w beamHalo bit)",4001,-0.5,4000.5,51,-0.5,50.5,"TimeMonitoring");
2845  }
2846 
2847  // *******************************************************************
2848  // Get information from the TMB header.
2849  // Can this eventually come out of the digis?
2850  // Taking code from EventFilter/CSCRawToDigis/CSCDCCUnpacker.cc
2851  // *******************************************************************
2852 
2854  eventSetup.get<CSCCrateMapRcd>().get(hcrate);
2855  const CSCCrateMap* pcrate = hcrate.product();
2856 
2859  event.getByLabel("source", rawdata);
2860  bool goodEvent = false;
2861  // If set selective unpacking mode
2862  // hardcoded examiner mask below to check for DCC and DDU level errors will be used first
2863  // then examinerMask for CSC level errors will be used during unpacking of each CSC block
2864  unsigned long dccBinCheckMask = 0x06080016;
2865  unsigned int examinerMask = 0x1FEBF3F6;
2866  unsigned int errorMask = 0x0;
2867 
2869  // loop over DCCs
2872 
2874  const FEDRawData& fedData = rawdata->FEDData(id);
2875  unsigned long length = fedData.size();
2876 
2877  if (length>=32){
2878  CSCDCCExaminer* examiner = NULL;
2879  std::stringstream examiner_out, examiner_err;
2880  goodEvent = true;
2882  //CSCDCCExaminer examiner;
2883  examiner = new CSCDCCExaminer();
2884  examiner->output1().redirect(examiner_out);
2885  examiner->output2().redirect(examiner_err);
2886  if( examinerMask&0x40000 ) examiner->crcCFEB(1);
2887  if( examinerMask&0x8000 ) examiner->crcTMB (1);
2888  if( examinerMask&0x0400 ) examiner->crcALCT(1);
2889  examiner->output1().show();
2890  examiner->output2().show();
2891  examiner->setMask(examinerMask);
2892  const short unsigned int *data = (short unsigned int *)fedData.data();
2893 
2894  if( examiner->check(data,long(fedData.size()/2)) < 0 ) {
2895  goodEvent=false;
2896  }
2897  else {
2898  goodEvent=!(examiner->errors()&dccBinCheckMask);
2899  }
2900 
2901  if (goodEvent) {
2903  CSCDCCExaminer * ptrExaminer = examiner;
2904  CSCDCCEventData dccData((short unsigned int *) fedData.data(),ptrExaminer);
2905 
2907  const std::vector<CSCDDUEventData> & dduData = dccData.dduData();
2908 
2910  CSCDetId layer(1, 1, 1, 1, 1);
2911 
2912  for (unsigned int iDDU=0; iDDU<dduData.size(); ++iDDU) { // loop over DDUs
2915  if (dduData[iDDU].trailer().errorstat()&errorMask) {
2916  LogTrace("CSCDCCUnpacker|CSCRawToDigi") << "DDU# " << iDDU << " has serious error - no digis unpacked! " <<
2917  std::hex << dduData[iDDU].trailer().errorstat();
2918  continue; // to next iteration of DDU loop
2919  }
2920 
2922  const std::vector<CSCEventData> & cscData = dduData[iDDU].cscData();
2923  for (unsigned int iCSC=0; iCSC<cscData.size(); ++iCSC) { // loop over CSCs
2924 
2925  int vmecrate = cscData[iCSC].dmbHeader()->crateID();
2926  int dmb = cscData[iCSC].dmbHeader()->dmbID();
2927 
2929  // SKIPPING MTCC redefinition of vmecrate
2930 
2931  int icfeb = 0;
2932  int ilayer = 0;
2933 
2934  if ((vmecrate>=1)&&(vmecrate<=60) && (dmb>=1)&&(dmb<=10)&&(dmb!=6)) {
2935  layer = pcrate->detId(vmecrate, dmb,icfeb,ilayer );
2936  }
2937  else{
2938  LogTrace ("CSCTimingAlignment|CSCDCCUnpacker|CSCRawToDigi") << " detID input out of range!!! ";
2939  LogTrace ("CSCTimingAlignment|CSCDCCUnpacker|CSCRawToDigi")
2940  << " skipping chamber vme= " << vmecrate << " dmb= " << dmb;
2941  continue; // to next iteration of iCSC loop
2942  }
2943 
2945  int nalct = cscData[iCSC].dmbHeader()->nalct();
2946  bool goodALCT=false;
2947  //if (nalct&&(cscData[iCSC].dataPresent>>6&0x1)==1) {
2948  if (nalct&&cscData[iCSC].alctHeader()) {
2949  if (cscData[iCSC].alctHeader()->check()){
2950  goodALCT=true;
2951  }
2952  }
2953 
2955  int nclct = cscData[iCSC].dmbHeader()->nclct();
2956  bool goodTMB=false;
2957  if (nclct&&cscData[iCSC].tmbData()) {
2958  if (cscData[iCSC].tmbHeader()->check()){
2959  if (cscData[iCSC].clctData()->check()) goodTMB=true;
2960  }
2961  }
2962 
2963  if (goodTMB && goodALCT) {
2964 
2965  if (ALCT_KeyWG_map.find(layer) == ALCT_KeyWG_map.end()) {
2966  printf("no ALCT info for Chamber %d %d %d %d \n",layer.endcap(), layer.station(), layer.ring(), layer.chamber());
2967  continue;
2968  }
2969  if (CLCT_getFullBx_map.find(layer) == CLCT_getFullBx_map.end()) {
2970  printf("no CLCT info for Chamber %d %d %d %d \n",layer.endcap(), layer.station(), layer.ring(), layer.chamber());
2971  continue;
2972  }
2973  int ALCT0Key = ALCT_KeyWG_map.find(layer)->second;
2974  int CLCTPretrigger = CLCT_getFullBx_map.find(layer)->second;
2975 
2976 
2977 
2978  const CSCTMBHeader *tmbHead = cscData[iCSC].tmbHeader();
2979 
2980  histos->fill1DHistByStation(tmbHead->BXNCount(), "TMB_BXNCount" ,"TMB_BXNCount" , layer.chamberId(),3601,-0.5,3600.5,"TimeMonitoring");
2981  histos->fill1DHistByStation(tmbHead->ALCTMatchTime(),"TMB_ALCTMatchTime","TMB_ALCTMatchTime", layer.chamberId(),7,-0.5,6.5,"TimeMonitoring");
2982 
2983  histos->fill1DHist(tmbHead->BXNCount(), "TMB_BXNCount" ,"TMB_BXNCount" , 3601,-0.5,3600.5,"TimeMonitoring");
2984  histos->fill1DHist(tmbHead->ALCTMatchTime(),"TMB_ALCTMatchTime","TMB_ALCTMatchTime", 7,-0.5,6.5,"TimeMonitoring");
2985 
2986  histos->fill1DHistByType(tmbHead->ALCTMatchTime(),"TMB_ALCTMatchTime","TMB_ALCTMatchTime",layer.chamberId(), 7,-0.5,6.5,"TimeMonitoring");
2987 
2988  histos->fillProfile( chamberSerial(layer.chamberId()),tmbHead->ALCTMatchTime(),"prof_TMB_ALCTMatchTime","prof_TMB_ALCTMatchTime", 601,-0.5,600.5,-0.5,7.5,"TimeMonitoring");
2989  histos->fillProfile(ALCT0Key,tmbHead->ALCTMatchTime(),"prof_TMB_ALCTMatchTime_v_ALCT0KeyWG","prof_TMB_ALCTMatchTime_v_ALCT0KeyWG",128,-0.5,127.5,0,7,"TimeMonitoring");
2990  histos->fillProfileByType(ALCT0Key,tmbHead->ALCTMatchTime(),"prf_TMB_ALCTMatchTime_v_ALCT0KeyWG","prf_TMB_ALCTMatchTime_v_ALCT0KeyWG",layer.chamberId(),128,-0.5,127.5,0,7,"TimeMonitoring");
2991 
2992  //Attempt to make a few sum plots
2993 
2994  int TMB_ALCT_rel_L1A = tmbHead->BXNCount()-(CLCTPretrigger+2+tmbHead->ALCTMatchTime());
2995  if (TMB_ALCT_rel_L1A > 3563)
2996  TMB_ALCT_rel_L1A = TMB_ALCT_rel_L1A - 3564;
2997  if (TMB_ALCT_rel_L1A < 0)
2998  TMB_ALCT_rel_L1A = TMB_ALCT_rel_L1A + 3564;
2999 
3000  //Plot TMB_ALCT_rel_L1A
3001  histos->fill1DHist(TMB_ALCT_rel_L1A,"h1D_TMB_ALCT_rel_L1A","h1D_TMB_ALCT_rel_L1A",11,144.5,155.5,"TimeMonitoring");
3002  histos->fill2DHist( chamberSerial(layer.chamberId()),TMB_ALCT_rel_L1A,"h2D_TMB_ALCT_rel_L1A","h2D_TMB_ALCT_rel_L1A", 601,-0.5,600.5,11,144.5,155.5,"TimeMonitoring");
3003  histos->fill2DHist( ringSerial(layer.chamberId()),TMB_ALCT_rel_L1A,"h2D_TMB_ALCT_rel_L1A_by_ring","h2D_TMB_ALCT_rel_L1A_by_ring",19,-9.5,9.5,11,144.5,155.5,"TimeMonitoring");
3004  histos->fillProfile( chamberSerial(layer.chamberId()),TMB_ALCT_rel_L1A,"prof_TMB_ALCT_rel_L1A","prof_TMB_ALCT_rel_L1A", 601,-0.5,600.5,145,155,"TimeMonitoring");
3005  histos->fillProfile( ringSerial(layer.chamberId()),TMB_ALCT_rel_L1A,"prof_TMB_ALCT_rel_L1A_by_ring","prof_TMB_ALCT_rel_L1A_by_ring",19,-9.5,9.5,145,155,"TimeMonitoring");
3006 
3007  histos->fill2DHist (ALCT0Key,TMB_ALCT_rel_L1A,"h2D_TMB_ALCT_rel_L1A_v_ALCT0KeyWG","h2D_TMB_ALCT_rel_L1A_v_ALCT0KeyWG", 128,-0.5,127.5,11,144.5,155.5,"TimeMonitoring");
3008  histos->fillProfile(ALCT0Key,TMB_ALCT_rel_L1A,"prof_TMB_ALCT_rel_L1A_v_ALCT0KeyWG","prof_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",128,-0.5,127.5,145,155,"TimeMonitoring");
3009  histos->fillProfileByType(ALCT0Key,TMB_ALCT_rel_L1A,"prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG","prf_TMB_ALCT_rel_L1A_v_ALCT0KeyWG",layer.chamberId(),128,-0.5,127.5,145,155,"TimeMonitoring");
3010  }
3011 
3012  } // end CSCData loop
3013  } // end ddu data loop
3014  } // end if goodEvent
3015  if (examiner!=NULL) delete examiner;
3016  }// end if non-zero fed data
3017  } // end DCC loop for NON-REFERENCE
3018 
3019 }
uint16_t BXNCount() const
Definition: CSCTMBHeader.h:36
01/20/05 A.Tumanov
void crcCFEB(bool enable)
void fillProfileByType(float x, float y, std::string name, std::string title, CSCDetId id, int binsx, float xmin, float xmax, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:461
OStream & output1(void)
CSCDetId detId(int vme, int dmb, int cfeb, int layer=0) const
Definition: CSCCrateMap.cc:11
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
void fillProfile(float x, float y, std::string name, std::string title, int binsx, float xmin, float xmax, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:446
const std::vector< CSCDDUEventData > & dduData() const
accessor to dduData
T y() const
Definition: PV3DBase.h:62
#define NULL
Definition: scimark2.h:8
void redirect(std::ostream &str)
ExaminerStatusType errors(void) const
void crcALCT(bool enable)
OStream & output2(void)
void fill1DHist(float x, std::string name, std::string title, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:121
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:49
int endcap() const
Definition: CSCDetId.h:95
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:45
T sqrt(T t)
Definition: SSEVec.h:46
bool check(const DataFrame &df, bool capcheck, bool dvercheck)
int ringSerial(CSCDetId id)
T z() const
Definition: PV3DBase.h:63
void crcTMB(bool enable)
int j
Definition: DBlmapReader.cc:9
CSCDetId chamberId() const
Definition: CSCDetId.h:55
void fill1DHistByType(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:151
#define LogTrace(id)
uint16_t ALCTMatchTime() const
Definition: CSCTMBHeader.h:39
void fill1DHistByStation(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:244
int ring() const
Definition: CSCDetId.h:77
void fill2DHist(float x, float y, std::string name, std::string title, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:136
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
std::vector< DigiType >::const_iterator const_iterator
int32_t check(const uint16_t *&buffer, int32_t length)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
int chamberSerial(CSCDetId id)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:29
int station() const
Definition: CSCDetId.h:88
std::pair< const_iterator, const_iterator > Range
dictionary rawdata
Definition: lumiPlot.py:393
T x() const
Definition: PV3DBase.h:61
void setMask(ExaminerMaskType mask)
CSCValHists * histos
bool CSCValidation::doTrigger ( edm::Handle< L1MuGMTReadoutCollection pCollection)
private

Definition at line 533 of file CSCValidation.cc.

References mergeVDriftHistosByStation::histos.

533  {
534 
535  std::vector<L1MuGMTReadoutRecord> L1Mrec = pCollection->getRecords();
536  std::vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
537 
538  bool csc_l1a = false;
539  bool dt_l1a = false;
540  bool rpcf_l1a = false;
541  bool rpcb_l1a = false;
542  bool beamHaloTrigger = false;
543 
544  int myBXNumber = -1000;
545 
546  for(igmtrr=L1Mrec.begin(); igmtrr!=L1Mrec.end(); igmtrr++) {
547  std::vector<L1MuRegionalCand>::const_iterator iter1;
548  std::vector<L1MuRegionalCand> rmc;
549 
550  // CSC
551  int icsc = 0;
552  rmc = igmtrr->getCSCCands();
553  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
554  if ( !(*iter1).empty() ) {
555  icsc++;
556  int kQuality = (*iter1).quality(); // kQuality = 1 means beam halo
557  if (kQuality == 1) beamHaloTrigger = true;
558  }
559  }
560  if (igmtrr->getBxInEvent() == 0 && icsc>0) csc_l1a = true;
561  if (igmtrr->getBxInEvent() == 0 ) { myBXNumber = igmtrr->getBxNr(); }
562 
563  // DT
564  int idt = 0;
565  rmc = igmtrr->getDTBXCands();
566  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
567  if ( !(*iter1).empty() ) {
568  idt++;
569  }
570  }
571  if(igmtrr->getBxInEvent()==0 && idt>0) dt_l1a = true;
572 
573  // RPC Barrel
574  int irpcb = 0;
575  rmc = igmtrr->getBrlRPCCands();
576  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
577  if ( !(*iter1).empty() ) {
578  irpcb++;
579  }
580  }
581  if(igmtrr->getBxInEvent()==0 && irpcb>0) rpcb_l1a = true;
582 
583  // RPC Forward
584  int irpcf = 0;
585  rmc = igmtrr->getFwdRPCCands();
586  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
587  if ( !(*iter1).empty() ) {
588  irpcf++;
589  }
590  }
591  if(igmtrr->getBxInEvent()==0 && irpcf>0) rpcf_l1a = true;
592 
593  }
594 
595  // Fill some histograms with L1A info
596  if (csc_l1a) histos->fill1DHist(myBXNumber,"vtBXNumber","BX Number",4001,-0.5,4000.5,"Trigger");
597  if (csc_l1a) histos->fill1DHist(1,"vtBits","trigger bits",11,-0.5,10.5,"Trigger");
598  if (dt_l1a) histos->fill1DHist(2,"vtBits","trigger bits",11,-0.5,10.5,"Trigger");
599  if (rpcb_l1a) histos->fill1DHist(3,"vtBits","trigger bits",11,-0.5,10.5,"Trigger");
600  if (rpcf_l1a) histos->fill1DHist(4,"vtBits","trigger bits",11,-0.5,10.5,"Trigger");
601  if (beamHaloTrigger) histos->fill1DHist(8,"vtBits","trigger bits",11,-0.5,10.5,"Trigger");
602 
603  if (csc_l1a) {
604  histos->fill1DHist(1,"vtCSCY","trigger bits",11,-0.5,10.5,"Trigger");
605  if (dt_l1a) histos->fill1DHist(2,"vtCSCY","trigger bits",11,-0.5,10.5,"Trigger");
606  if (rpcb_l1a) histos->fill1DHist(3,"vtCSCY","trigger bits",11,-0.5,10.5,"Trigger");
607  if (rpcf_l1a) histos->fill1DHist(4,"vtCSCY","trigger bits",11,-0.5,10.5,"Trigger");
608  if ( dt_l1a || rpcb_l1a || rpcf_l1a) histos->fill1DHist(5,"vtCSCY","trigger bits",11,-0.5,10.5,"Trigger");
609  if (!(dt_l1a || rpcb_l1a || rpcf_l1a)) histos->fill1DHist(6,"vtCSCY","trigger bits",11,-0.5,10.5,"Trigger");
610  } else {
611  histos->fill1DHist(1,"vtCSCN","trigger bits",11,-0.5,10.5,"Trigger");
612  if (dt_l1a) histos->fill1DHist(2,"vtCSCN","trigger bits",11,-0.5,10.5,"Trigger");
613  if (rpcb_l1a) histos->fill1DHist(3,"vtCSCN","trigger bits",11,-0.5,10.5,"Trigger");
614  if (rpcf_l1a) histos->fill1DHist(4,"vtCSCN","trigger bits",11,-0.5,10.5,"Trigger");
615  if ( dt_l1a || rpcb_l1a || rpcf_l1a) histos->fill1DHist(5,"vtCSCN","trigger bits",11,-0.5,10.5,"Trigger");
616  if (!(dt_l1a || rpcb_l1a || rpcf_l1a)) histos->fill1DHist(6,"vtCSCN","trigger bits",11,-0.5,10.5,"Trigger");
617  }
618 
619  // if valid CSC L1A then return true for possible use elsewhere
620 
621  if (csc_l1a) return true;
622 
623  return false;
624 
625 }
void fill1DHist(float x, std::string name, std::string title, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:121
CSCValHists * histos
void CSCValidation::doWireDigis ( edm::Handle< CSCWireDigiCollection wires)
private

Definition at line 714 of file CSCValidation.cc.

References CSCDetId, and mergeVDriftHistosByStation::histos.

714  {
715 
716  int nWireGroupsTotal = 0;
717  for (CSCWireDigiCollection::DigiRangeIterator dWDiter=wires->begin(); dWDiter!=wires->end(); dWDiter++) {
718  CSCDetId id = (CSCDetId)(*dWDiter).first;
719  std::vector<CSCWireDigi>::const_iterator wireIter = (*dWDiter).second.first;
720  std::vector<CSCWireDigi>::const_iterator lWire = (*dWDiter).second.second;
721  for( ; wireIter != lWire; ++wireIter) {
722  int myWire = wireIter->getWireGroup();
723  int myTBin = wireIter->getTimeBin();
724  nWireGroupsTotal++;
725  histos->fill1DHistByType(myWire,"hWireWire","Wiregroup Numbers Fired",id,113,-0.5,112.5,"Digis");
726  histos->fill1DHistByType(myTBin,"hWireTBin","Wire TimeBin Fired",id,17,-0.5,16.5,"Digis");
727  histos->fillProfile(chamberSerial(id),myTBin,"hWireTBinProfile","Wire TimeBin Fired",601,-0.5,600.5,-0.5,16.5,"Digis");
728  if (detailedAnalysis){
729  histos->fill1DHistByLayer(myWire,"hWireWire","Wiregroup Numbers Fired",id,113,-0.5,112.5,"WireNumberByLayer");
730  histos->fill1DHistByLayer(myTBin,"hWireTBin","Wire TimeBin Fired",id,17,-0.5,16.5,"WireTimeByLayer");
731  }
732  }
733  } // end wire loop
734 
735  // this way you can zero suppress but still store info on # events with no digis
736  if (nWireGroupsTotal == 0) nWireGroupsTotal = -1;
737 
738  histos->fill1DHist(nWireGroupsTotal,"hWirenGroupsTotal","Wires Fired Per Event",151,-0.5,150.5,"Digis");
739 
740 }
void fillProfile(float x, float y, std::string name, std::string title, int binsx, float xmin, float xmax, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:446
void fill1DHist(float x, std::string name, std::string title, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:121
void fill1DHistByLayer(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:397
void fill1DHistByType(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:151
int chamberSerial(CSCDetId id)
CSCValHists * histos
void CSCValidation::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 3022 of file CSCValidation.cc.

References gather_cfg::cout.

3022  {
3023 
3024  std::cout<<"Events in "<<nEventsAnalyzed<<std::endl;
3025 }
tuple cout
Definition: gather_cfg.py:121
double CSCValidation::extrapolate1D ( double  initPosition,
double  initDirection,
double  parameterOfTheLine 
)
inlineprivate

Definition at line 196 of file CSCValidation.h.

196  {
197  double extrapolatedPosition = initPosition + initDirection*parameterOfTheLine;
198  return extrapolatedPosition;
199  }
void CSCValidation::fillEfficiencyHistos ( int  bin,
int  flag 
)
private
bool CSCValidation::filterEvents ( edm::Handle< CSCRecHit2DCollection recHits,
edm::Handle< CSCSegmentCollection cscSegments,
edm::Handle< reco::TrackCollection saMuons 
)
private

Definition at line 329 of file CSCValidation.cc.

330  {
331 
332  //int nGoodSAMuons = 0;
333 
334  if (recHits->size() < 4 || recHits->size() > 100) return false;
335  if (cscSegments->size() < 1 || cscSegments->size() > 15) return false;
336  return true;
337  //if (saMuons->size() != 1) return false;
338  /*
339  for(reco::TrackCollection::const_iterator muon = saMuons->begin(); muon != saMuons->end(); ++ muon ) {
340  double p = muon->p();
341  double reducedChisq = muon->normalizedChi2();
342 
343  GlobalPoint innerPnt(muon->innerPosition().x(),muon->innerPosition().y(),muon->innerPosition().z());
344  GlobalPoint outerPnt(muon->outerPosition().x(),muon->outerPosition().y(),muon->outerPosition().z());
345  GlobalVector innerKin(muon->innerMomentum().x(),muon->innerMomentum().y(),muon->innerMomentum().z());
346  GlobalVector outerKin(muon->outerMomentum().x(),muon->outerMomentum().y(),muon->outerMomentum().z());
347  GlobalVector deltaPnt = innerPnt - outerPnt;
348  double crudeLength = deltaPnt.mag();
349  double deltaPhi = innerPnt.phi() - outerPnt.phi();
350  double innerGlobalPolarAngle = innerKin.theta();
351  double outerGlobalPolarAngle = outerKin.theta();
352 
353  int nCSCHits = 0;
354  for (trackingRecHit_iterator hit = muon->recHitsBegin(); hit != muon->recHitsEnd(); ++hit ) {
355  if ( (*hit)->isValid() ) {
356  const DetId detId( (*hit)->geographicalId() );
357  if (detId.det() == DetId::Muon) {
358  if (detId.subdetId() == MuonSubdetId::CSC) {
359  nCSCHits++;
360  } // this is a CSC hit
361  } // this is a muon hit
362  } // hit is valid
363  } // end loop over rechits
364 
365  bool goodSAMuon = (p > pMin)
366  && ( reducedChisq < chisqMax )
367  && ( nCSCHits >= nCSCHitsMin )
368  && ( nCSCHits <= nCSCHitsMax )
369  && ( crudeLength > lengthMin )
370  && ( crudeLength < lengthMax );
371 
372 
373  goodSAMuon = goodSAMuon && ( fabs(deltaPhi) < deltaPhiMax );
374  goodSAMuon = goodSAMuon &&
375  (
376  ( ( innerGlobalPolarAngle > polarMin) && ( innerGlobalPolarAngle < polarMax) ) ||
377  ( (M_PI-innerGlobalPolarAngle > polarMin) && (M_PI-innerGlobalPolarAngle < polarMax) )
378  );
379  goodSAMuon = goodSAMuon &&
380  (
381  ( ( outerGlobalPolarAngle > polarMin) && ( outerGlobalPolarAngle < polarMax) ) ||
382  ( (M_PI-outerGlobalPolarAngle > polarMin) && (M_PI-outerGlobalPolarAngle < polarMax) )
383  );
384 
385  //goodSAMuon = goodSAMuon && (nCSCHits > nCSCHitsMin) && (nCSCHits < 13);
386  //goodSAMuon = goodSAMuon && (nCSCHits > 13) && (nCSCHits < 19);
387  //goodSAMuon = goodSAMuon && (nCSCHits > 19) && (nCSCHits < nCSCHitsMax);
388 
389 
390  if (goodSAMuon) nGoodSAMuons++;
391 
392  } // end loop over stand-alone muon collection
393 
394 
395  histos->fill1DHist(nGoodSAMuons,"hNGoodMuons", "Number of Good STA Muons per Event",11,-0.5,10.5,"STAMuons");
396 
397  if (nGoodSAMuons == 1) return true;
398  return false;
399  */
400 }
void CSCValidation::findNonAssociatedRecHits ( edm::ESHandle< CSCGeometry cscGeom,
edm::Handle< CSCStripDigiCollection strips 
)
private

Definition at line 1879 of file CSCValidation.cc.

References CSCDetId::chamber(), CSCDetId::endcap(), mergeVDriftHistosByStation::histos, i, j, kLayer(), CSCDetId::layer(), funct::pow(), CSCDetId::ring(), mathSSE::sqrt(), CSCDetId::station(), GeomDet::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

1879  {
1880 
1881  for(std::multimap<CSCDetId , CSCRecHit2D>::iterator allRHiter = AllRechits.begin();allRHiter != AllRechits.end(); ++allRHiter){
1882  CSCDetId idRH = allRHiter->first;
1883  LocalPoint lpRH = (allRHiter->second).localPosition();
1884  float xrec = lpRH.x();
1885  float yrec = lpRH.y();
1886  float zrec = lpRH.z();
1887 
1888  bool foundmatch = false;
1889  multimap<CSCDetId , CSCRecHit2D>::iterator segRHit;
1890  segRHit = SegRechits.find(idRH);
1891  if (segRHit != SegRechits.end()){
1892  for( ; segRHit != SegRechits.upper_bound(idRH); ++segRHit){
1893 
1894  LocalPoint lposRH = (segRHit->second).localPosition();
1895  float xpos = lposRH.x();
1896  float ypos = lposRH.y();
1897  float zpos = lposRH.z();
1898 
1899  if ( xrec == xpos && yrec == ypos && zrec == zpos){
1900  foundmatch = true;}
1901 
1902  float d = 0.;
1903  float dclose =1000.;
1904 
1905  if ( !foundmatch) {
1906 
1907  d = sqrt(pow(xrec-xpos,2)+pow(yrec-ypos,2)+pow(zrec-zpos,2));
1908  if (d < dclose) {
1909  dclose = d;
1910  if( distRHmap.find((allRHiter->second)) == distRHmap.end() ) { // entry for rechit does not yet exist, create one
1911  distRHmap.insert(make_pair(allRHiter->second,dclose) );
1912  }
1913  else {
1914  // we already have an entry for the detid.
1915  distRHmap.erase(allRHiter->second);
1916  distRHmap.insert(make_pair(allRHiter->second,dclose)); // fill rechits for the segment with the given detid
1917  }
1918  }
1919  }
1920  }
1921  }
1922  if(!foundmatch){NonAssociatedRechits.insert(std::pair<CSCDetId , CSCRecHit2D>(idRH,allRHiter->second));}
1923  }
1924 
1925  for(std::map<CSCRecHit2D,float,ltrh>::iterator iter = distRHmap.begin();iter != distRHmap.end(); ++iter){
1926  histos->fill1DHist(iter->second,"hdistRH","Distance of Non Associated RecHit from closest Segment RecHit",500,0.,100.,"NonAssociatedRechits");
1927  }
1928 
1929  for(std::multimap<CSCDetId , CSCRecHit2D>::iterator iter = NonAssociatedRechits.begin();iter != NonAssociatedRechits.end(); ++iter){
1930  CSCDetId idrec = iter->first;
1931  int kEndcap = idrec.endcap();
1932  int cEndcap = idrec.endcap();
1933  if (kEndcap == 2)cEndcap = -1;
1934  int kRing = idrec.ring();
1935  int kStation = idrec.station();
1936  int kChamber = idrec.chamber();
1937  int kLayer = idrec.layer();
1938 
1939  // Store rechit as a Local Point:
1940  LocalPoint rhitlocal = (iter->second).localPosition();
1941  float xreco = rhitlocal.x();
1942  float yreco = rhitlocal.y();
1943 
1944  // Find the strip containing this hit
1945  int centerid = (iter->second).nStrips()/2;
1946  int centerStrip = (iter->second).channels(centerid);
1947 
1948  // Find the charge associated with this hit
1949  float rHSumQ = 0;
1950  float sumsides=0.;
1951  int adcsize=(iter->second).nStrips()*(iter->second).nTimeBins();
1952  for ( unsigned int i=0; i< (iter->second).nStrips(); i++) {
1953  for ( unsigned int j=0; j< (iter->second).nTimeBins()-1; j++) {
1954  rHSumQ+=(iter->second).adcs(i,j);
1955  if (i!=1) sumsides+=(iter->second).adcs(i,j);
1956  }
1957  }
1958 
1959  float rHratioQ = sumsides/rHSumQ;
1960  if (adcsize != 12) rHratioQ = -99;
1961 
1962  // Get the signal timing of this hit
1963  float rHtime = (iter->second).tpeak()/50;
1964 
1965  // Get the width of this hit
1966  int rHwidth = getWidth(*strips, idrec, centerStrip);
1967 
1968 
1969  // Get pointer to the layer:
1970  const CSCLayer* csclayer = cscGeom->layer( idrec );
1971 
1972  // Transform hit position from local chamber geometry to global CMS geom
1973  GlobalPoint rhitglobal= csclayer->toGlobal(rhitlocal);
1974  float grecx = rhitglobal.x();
1975  float grecy = rhitglobal.y();
1976 
1977 
1978 
1979  // Simple occupancy variables
1980  int kCodeBroad = cEndcap * ( 4*(kStation-1) + kRing) ;
1981  int kCodeNarrow = cEndcap * ( 100*(kRing-1) + kChamber) ;
1982 
1983  //Fill the non-associated rechits parameters in histogram
1984  histos->fill1DHist(kCodeBroad,"hNARHCodeBroad","broad scope code for recHits",33,-16.5,16.5,"NonAssociatedRechits");
1985  if (kStation == 1) histos->fill1DHist(kCodeNarrow,"hNARHCodeNarrow1","narrow scope recHit code station 1",801,-400.5,400.5,"NonAssociatedRechits");
1986  if (kStation == 2) histos->fill1DHist(kCodeNarrow,"hNARHCodeNarrow2","narrow scope recHit code station 2",801,-400.5,400.5,"NonAssociatedRechits");
1987  if (kStation == 3) histos->fill1DHist(kCodeNarrow,"hNARHCodeNarrow3","narrow scope recHit code station 3",801,-400.5,400.5,"NonAssociatedRechits");
1988  if (kStation == 4) histos->fill1DHist(kCodeNarrow,"hNARHCodeNarrow4","narrow scope recHit code station 4",801,-400.5,400.5,"NonAssociatedRechits");
1989  histos->fill1DHistByType(kLayer,"hNARHLayer","RecHits per Layer",idrec,8,-0.5,7.5,"NonAssociatedRechits");
1990  histos->fill1DHistByType(xreco,"hNARHX","Local X of recHit",idrec,160,-80.,80.,"NonAssociatedRechits");
1991  histos->fill1DHistByType(yreco,"hNARHY","Local Y of recHit",idrec,60,-180.,180.,"NonAssociatedRechits");
1992  if (kStation == 1 && (kRing == 1 || kRing == 4)) histos->fill1DHistByType(rHSumQ,"hNARHSumQ","Sum 3x3 recHit Charge",idrec,250,0,4000,"NonAssociatedRechits");
1993  else histos->fill1DHistByType(rHSumQ,"hNARHSumQ","Sum 3x3 recHit Charge",idrec,250,0,2000,"NonAssociatedRechits");
1994  histos->fill1DHistByType(rHratioQ,"hNARHRatioQ","Ratio (Ql+Qr)/Qt)",idrec,120,-0.1,1.1,"NonAssociatedRechits");
1995  histos->fill1DHistByType(rHtime,"hNARHTiming","recHit Timing",idrec,200,-10,10,"NonAssociatedRechits");
1996  histos->fill2DHistByStation(grecx,grecy,"hNARHGlobal","recHit Global Position",idrec,400,-800.,800.,400,-800.,800.,"NonAssociatedRechits");
1997  histos->fill1DHistByType(rHwidth,"hNARHwidth","width for Non associated recHit",idrec,21,-0.5,20.5,"NonAssociatedRechits");
1998 
1999  }
2000 
2001  for(std::multimap<CSCDetId , CSCRecHit2D>::iterator iter = SegRechits.begin();iter != SegRechits.end(); ++iter){
2002  CSCDetId idrec = iter->first;
2003  int kEndcap = idrec.endcap();
2004  int cEndcap = idrec.endcap();
2005  if (kEndcap == 2)cEndcap = -1;
2006  int kRing = idrec.ring();
2007  int kStation = idrec.station();
2008  int kChamber = idrec.chamber();
2009  int kLayer = idrec.layer();
2010 
2011  // Store rechit as a Local Point:
2012  LocalPoint rhitlocal = (iter->second).localPosition();
2013  float xreco = rhitlocal.x();
2014  float yreco = rhitlocal.y();
2015 
2016  // Find the strip containing this hit
2017  int centerid = (iter->second).nStrips()/2;
2018  int centerStrip = (iter->second).channels(centerid);
2019 
2020  // Find the charge associated with this hit
2021 
2022  float rHSumQ = 0;
2023  float sumsides=0.;
2024  int adcsize=(iter->second).nStrips()*(iter->second).nTimeBins();
2025  for ( unsigned int i=0; i< (iter->second).nStrips(); i++) {
2026  for ( unsigned int j=0; j< (iter->second).nTimeBins()-1; j++) {
2027  rHSumQ+=(iter->second).adcs(i,j);
2028  if (i!=1) sumsides+=(iter->second).adcs(i,j);
2029  }
2030  }
2031 
2032  float rHratioQ = sumsides/rHSumQ;
2033  if (adcsize != 12) rHratioQ = -99;
2034 
2035  // Get the signal timing of this hit
2036  float rHtime = (iter->second).tpeak()/50;
2037 
2038  // Get the width of this hit
2039  int rHwidth = getWidth(*strips, idrec, centerStrip);
2040 
2041 
2042  // Get pointer to the layer:
2043  const CSCLayer* csclayer = cscGeom->layer( idrec );
2044 
2045  // Transform hit position from local chamber geometry to global CMS geom
2046  GlobalPoint rhitglobal= csclayer->toGlobal(rhitlocal);
2047  float grecx = rhitglobal.x();
2048  float grecy = rhitglobal.y();
2049 
2050  // Simple occupancy variables
2051  int kCodeBroad = cEndcap * ( 4*(kStation-1) + kRing) ;
2052  int kCodeNarrow = cEndcap * ( 100*(kRing-1) + kChamber) ;
2053 
2054  //Fill the non-associated rechits global position in histogram
2055  histos->fill1DHist(kCodeBroad,"hSegRHCodeBroad","broad scope code for recHits",33,-16.5,16.5,"AssociatedRechits");
2056  if (kStation == 1) histos->fill1DHist(kCodeNarrow,"hSegRHCodeNarrow1","narrow scope recHit code station 1",801,-400.5,400.5,"AssociatedRechits");
2057  if (kStation == 2) histos->fill1DHist(kCodeNarrow,"hSegRHCodeNarrow2","narrow scope recHit code station 2",801,-400.5,400.5,"AssociatedRechits");
2058  if (kStation == 3) histos->fill1DHist(kCodeNarrow,"hSegRHCodeNarrow3","narrow scope recHit code station 3",801,-400.5,400.5,"AssociatedRechits");
2059  if (kStation == 4) histos->fill1DHist(kCodeNarrow,"hSegRHCodeNarrow4","narrow scope recHit code station 4",801,-400.5,400.5,"AssociatedRechits");
2060  histos->fill1DHistByType(kLayer,"hSegRHLayer","RecHits per Layer",idrec,8,-0.5,7.5,"AssociatedRechits");
2061  histos->fill1DHistByType(xreco,"hSegRHX","Local X of recHit",idrec,160,-80.,80.,"AssociatedRechits");
2062  histos->fill1DHistByType(yreco,"hSegRHY","Local Y of recHit",idrec,60,-180.,180.,"AssociatedRechits");
2063  if (kStation == 1 && (kRing == 1 || kRing == 4)) histos->fill1DHistByType(rHSumQ,"hSegRHSumQ","Sum 3x3 recHit Charge",idrec,250,0,4000,"AssociatedRechits");
2064  else histos->fill1DHistByType(rHSumQ,"hSegRHSumQ","Sum 3x3 recHit Charge",idrec,250,0,2000,"AssociatedRechits");
2065  histos->fill1DHistByType(rHratioQ,"hSegRHRatioQ","Ratio (Ql+Qr)/Qt)",idrec,120,-0.1,1.1,"AssociatedRechits");
2066  histos->fill1DHistByType(rHtime,"hSegRHTiming","recHit Timing",idrec,200,-10,10,"AssociatedRechits");
2067  histos->fill2DHistByStation(grecx,grecy,"hSegRHGlobal","recHit Global Position",idrec,400,-800.,800.,400,-800.,800.,"AssociatedRechits");
2068  histos->fill1DHistByType(rHwidth,"hSegRHwidth","width for Non associated recHit",idrec,21,-0.5,20.5,"AssociatedRechits");
2069 
2070  }
2071 
2072  distRHmap.clear();
2073  AllRechits.clear();
2074  SegRechits.clear();
2075  NonAssociatedRechits.clear();
2076 }
int chamber() const
Definition: CSCDetId.h:70
int i
Definition: DBlmapReader.cc:9
void fill2DHistByStation(float x, float y, std::string name, std::string title, CSCDetId id, int binsx, float xmin, float xmax, int binsy, float ymin, float ymax, std::string folder)
Definition: CSCValHists.cc:268
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
T y() const
Definition: PV3DBase.h:62
int layer() const
Definition: CSCDetId.h:63
void fill1DHist(float x, std::string name, std::string title, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:121
std::multimap< CSCDetId, CSCRecHit2D > NonAssociatedRechits
int endcap() const
Definition: CSCDetId.h:95
std::multimap< CSCDetId, CSCRecHit2D > AllRechits
T sqrt(T t)
Definition: SSEVec.h:46
int getWidth(const CSCStripDigiCollection &stripdigis, CSCDetId idRH, int centerStrip)
T z() const
Definition: PV3DBase.h:63
int j
Definition: DBlmapReader.cc:9
void fill1DHistByType(float x, std::string name, std::string title, CSCDetId id, int bins, float xmin, float xmax, std::string folder)
Definition: CSCValHists.cc:151
static const std::string kLayer("layer")
int ring() const
Definition: CSCDetId.h:77
std::multimap< CSCDetId, CSCRecHit2D > SegRechits
int station() const
Definition: CSCDetId.h:88
T x() const
Definition: PV3DBase.h:61
std::map< CSCRecHit2D, float, ltrh > distRHmap
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
CSCValHists * histos
float CSCValidation::fitX ( CLHEP::HepMatrix  sp,
CLHEP::HepMatrix  ep 
)
private

Definition at line 1272 of file CSCValidation.cc.

References delta, benchmark_cfg::errors, i, and slope.

1272  {
1273 
1274  float S = 0;
1275  float Sx = 0;
1276  float Sy = 0;
1277  float Sxx = 0;
1278  float Sxy = 0;
1279  float sigma2 = 0;
1280 
1281  for (int i=1;i<7;i++){
1282  if (i != 3){
1283  sigma2 = errors(i,1)*errors(i,1);
1284  S = S + (1/sigma2);
1285  Sy = Sy + (points(i,1)/sigma2);
1286  Sx = Sx + ((i)/sigma2);
1287  Sxx = Sxx + (i*i)/sigma2;
1288  Sxy = Sxy + (((i)*points(i,1))/sigma2);
1289  }
1290  }
1291 
1292  float delta = S*Sxx - Sx*Sx;
1293  float intercept = (Sxx*Sy - Sx*Sxy)/delta;
1294  float slope = (S*Sxy - Sx*Sy)/delta;
1295 
1296  //float chi = 0;
1297  //float chi2 = 0;
1298 
1299  // calculate chi2 (not currently used)
1300  //for (int i=1;i<7;i++){
1301  // chi = (points(i,1) - intercept - slope*i)/(errors(i,1));
1302  // chi2 = chi2 + chi*chi;
1303  //}
1304 
1305  return (intercept + slope*3);
1306 
1307 }
dbl * delta
Definition: mlp_gen.cc:36
int i
Definition: DBlmapReader.cc:9
static const double slope[3]
void CSCValidation::getEfficiency ( float  bin,
float  Norm,
std::vector< float > &  eff 
)
private

Definition at line 1612 of file CSCValidation.cc.

References mathSSE::sqrt().

1612  {
1613  //---- Efficiency with binomial error
1614  float Efficiency = 0.;
1615  float EffError = 0.;
1616  if(fabs(Norm)>0.000000001){
1617  Efficiency = bin/Norm;
1618  if(bin<Norm){
1619  EffError = sqrt( (1.-Efficiency)*Efficiency/Norm );
1620  }
1621  }
1622  eff[0] = Efficiency;
1623  eff[1] = EffError;
1624 }
T sqrt(T t)
Definition: SSEVec.h:46
float CSCValidation::getSignal ( const CSCStripDigiCollection stripdigis,
CSCDetId  idRH,
int  centerStrip 
)
private

Definition at line 1753 of file CSCValidation.cc.

References CSCDetId, if(), and prof2calltree::last.

1753  {
1754 
1755  float SigADC[5];
1756  float TotalADC = 0;
1757  SigADC[0] = 0;
1758  SigADC[1] = 0;
1759  SigADC[2] = 0;
1760  SigADC[3] = 0;
1761  SigADC[4] = 0;
1762 
1763 
1764  // Loop over strip digis
1766 
1767  for (sIt = stripdigis.begin(); sIt != stripdigis.end(); sIt++){
1768  CSCDetId id = (CSCDetId)(*sIt).first;
1769  if (id == idCS){
1770 
1771  // First, find the Signal-Pedestal for center strip
1772  std::vector<CSCStripDigi>::const_iterator digiItr = (*sIt).second.first;
1773  std::vector<CSCStripDigi>::const_iterator last = (*sIt).second.second;
1774  for ( ; digiItr != last; ++digiItr ) {
1775  int thisStrip = digiItr->getStrip();
1776  if (thisStrip == (centerStrip)){
1777  std::vector<int> myADCVals = digiItr->getADCCounts();
1778  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1779  float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
1780  SigADC[0] = thisSignal - 6*thisPedestal;
1781  }
1782  // Now,find the Signal-Pedestal for neighbouring 4 strips
1783  if (thisStrip == (centerStrip+1)){
1784  std::vector<int> myADCVals = digiItr->getADCCounts();
1785  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1786  float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
1787  SigADC[1] = thisSignal - 6*thisPedestal;
1788  }
1789  if (thisStrip == (centerStrip+2)){
1790  std::vector<int> myADCVals = digiItr->getADCCounts();
1791  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1792  float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
1793  SigADC[2] = thisSignal - 6*thisPedestal;
1794  }
1795  if (thisStrip == (centerStrip-1)){
1796  std::vector<int> myADCVals = digiItr->getADCCounts();
1797  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1798  float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
1799  SigADC[3] = thisSignal - 6*thisPedestal;
1800  }
1801  if (thisStrip == (centerStrip-2)){
1802  std::vector<int> myADCVals = digiItr->getADCCounts();
1803  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
1804  float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
1805  SigADC[4] = thisSignal - 6*thisPedestal;
1806  }
1807  }
1808  TotalADC = 0.2*(SigADC[0]+SigADC[1]+SigADC[2]+SigADC[3]+SigADC[4]);
1809  }
1810  }
1811  return TotalADC;
1812 }
perl if(1 lt scalar(@::datatypes))
Definition: edlooper.cc:31
float CSCValidation::getthisSignal ( const CSCStripDigiCollection stripdigis,
CSCDetId  idRH,
int  centerStrip 
)
private

Definition at line 2080 of file CSCValidation.cc.

References CSCDetId, if(), prof2calltree::last, CSCDetId::ring(), and CSCDetId::station().

2080  {
2081  // Loop over strip digis responsible for this recHit
2083  float thisADC = 0.;
2084  //bool foundRHid = false;
2085  // std::cout<<"iD S/R/C/L = "<<idRH<<" "<<idRH.station()<<"/"<<idRH.ring()<<"/"<<idRH.chamber()<<"/"<<idRH.layer()<<std::endl;
2086  for (sIt = stripdigis.begin(); sIt != stripdigis.end(); sIt++){
2087  CSCDetId id = (CSCDetId)(*sIt).first;
2088  //std::cout<<"STRIPS: id S/R/C/L = "<<id<<" "<<id.station()<<"/"<<id.ring()<<"/"<<id.chamber()<<"/"<<id.layer()<<std::endl;
2089  if (id == idRH){
2090  //foundRHid = true;
2091  vector<CSCStripDigi>::const_iterator digiItr = (*sIt).second.first;
2092  vector<CSCStripDigi>::const_iterator last = (*sIt).second.second;
2093  //if(digiItr == last ) {std::cout << " Attention1 :: Size of digi collection is zero " << std::endl;}
2094  int St = idRH.station();
2095  int Rg = idRH.ring();
2096  if (St == 1 && Rg == 4){
2097  while(centerStrip> 16) centerStrip -= 16;
2098  }
2099  for ( ; digiItr != last; ++digiItr ) {
2100  int thisStrip = digiItr->getStrip();
2101  //std::cout<<" thisStrip = "<<thisStrip<<" centerStrip = "<<centerStrip<<std::endl;
2102  std::vector<int> myADCVals = digiItr->getADCCounts();
2103  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
2104  float Signal = (float) myADCVals[3];
2105  if (thisStrip == (centerStrip)){
2106  thisADC = Signal-thisPedestal;
2107  //if(thisADC >= 0. && thisADC <2.) {std::cout << " Attention2 :: The Signal is equal to the pedestal " << std::endl;
2108  //}
2109  //if(thisADC < 0.) {std::cout << " Attention3 :: The Signal is less than the pedestal " << std::endl;
2110  //}
2111  }
2112  if (thisStrip == (centerStrip+1)){
2113  std::vector<int> myADCVals = digiItr->getADCCounts();
2114  }
2115  if (thisStrip == (centerStrip-1)){
2116  std::vector<int> myADCVals = digiItr->getADCCounts();
2117  }
2118  }
2119  }
2120  }
2121  //if(!foundRHid){std::cout << " Attention4 :: Did not find a matching RH id in the Strip Digi collection " << std::endl;}
2122  return thisADC;
2123 }
int ring() const
Definition: CSCDetId.h:77
perl if(1 lt scalar(@::datatypes))
Definition: edlooper.cc:31
int station() const
Definition: CSCDetId.h:88
Definition: vlib.h:40
int CSCValidation::getWidth ( const CSCStripDigiCollection stripdigis,
CSCDetId  idRH,
int  centerStrip 
)
private

Definition at line 2131 of file CSCValidation.cc.

References CSCDetId, first, if(), prof2calltree::last, CSCDetId::ring(), CSCDetId::station(), strip(), and tablePrinter::width.

2131  {
2132 
2133  int width = 1;
2134  int widthpos = 0;
2135  int widthneg = 0;
2136 
2137  // Loop over strip digis responsible for this recHit and sum charge
2139 
2140  for (sIt = stripdigis.begin(); sIt != stripdigis.end(); sIt++){
2141  CSCDetId id = (CSCDetId)(*sIt).first;
2142  if (id == idRH){
2143  std::vector<CSCStripDigi>::const_iterator digiItr = (*sIt).second.first;
2144  std::vector<CSCStripDigi>::const_iterator first = (*sIt).second.first;
2145  std::vector<CSCStripDigi>::const_iterator last = (*sIt).second.second;
2146  std::vector<CSCStripDigi>::const_iterator it = (*sIt).second.first;
2147  std::vector<CSCStripDigi>::const_iterator itr = (*sIt).second.first;
2148  //std::cout << " IDRH " << id <<std::endl;
2149  int St = idRH.station();
2150  int Rg = idRH.ring();
2151  if (St == 1 && Rg == 4){
2152  while(centerStrip> 16) centerStrip -= 16;
2153  }
2154  for ( ; digiItr != last; ++digiItr ) {
2155  int thisStrip = digiItr->getStrip();
2156  if (thisStrip == (centerStrip)){
2157  it = digiItr;
2158  for( ; it != last; ++it ) {
2159  int strip = it->getStrip();
2160  std::vector<int> myADCVals = it->getADCCounts();
2161  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
2162  if(((float)myADCVals[3]-thisPedestal) < 6 || widthpos == 10 || it==last){break;}
2163  if(strip != centerStrip){ widthpos += 1;
2164  }
2165  }
2166  itr = digiItr;
2167  for( ; itr != first; --itr) {
2168  int strip = itr->getStrip();
2169  std::vector<int> myADCVals = itr->getADCCounts();
2170  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
2171  if(((float)myADCVals[3]-thisPedestal) < 6 || widthneg == 10 || itr==first){break;}
2172  if(strip != centerStrip) {widthneg += 1 ;
2173  }
2174  }
2175  }
2176  }
2177  }
2178  }
2179  //std::cout << "Widthneg - " << widthneg << "Widthpos + " << widthpos << std::endl;
2180  width = width + widthneg + widthpos ;
2181  //std::cout << "Width " << width << std::endl;
2182  return width;
2183 }
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
bool first
Definition: L1TdeRCT.cc:94
int ring() const
Definition: CSCDetId.h:77
perl if(1 lt scalar(@::datatypes))
Definition: edlooper.cc:31
int station() const
Definition: CSCDetId.h:88
void CSCValidation::histoEfficiency ( TH1F *  readHisto,
TH1F *  writeHisto 
)
private

Definition at line 1626 of file CSCValidation.cc.

References combineCards::bins, interpolateCardsSimple::eff, and i.

1626  {
1627  std::vector<float> eff(2);
1628  int Nbins = readHisto->GetSize()-2;//without underflows and overflows
1629  std::vector<float> bins(Nbins);
1630  std::vector<float> Efficiency(Nbins);
1631  std::vector<float> EffError(Nbins);
1632  float Num = 1;
1633  float Den = 1;
1634  for (int i=0;i<20;i++){
1635  Num = readHisto->GetBinContent(i+1);
1636  Den = readHisto->GetBinContent(i+21);
1637  getEfficiency(Num, Den, eff);
1638  Efficiency[i] = eff[0];
1639  EffError[i] = eff[1];
1640  writeHisto->SetBinContent(i+1, Efficiency[i]);
1641  writeHisto->SetBinError(i+1, EffError[i]);
1642  }
1643 }
int i
Definition: DBlmapReader.cc:9
void getEfficiency(float bin, float Norm, std::vector< float > &eff)
double CSCValidation::lineParametrization ( double  z1Position,
double  z2Position,
double  z1Direction 
)
inlineprivate

Definition at line 192 of file CSCValidation.h.

192  {
193  double parameterLine = (z2Position-z1Position)/z1Direction;
194  return parameterLine;
195  }
int CSCValidation::ringSerial ( CSCDetId  id)
private

Definition at line 1251 of file CSCValidation.cc.

1251  {
1252  int st = id.station();
1253  int ri = id.ring();
1254  int ec = id.endcap();
1255  int kSerial = 0 ;
1256  if (st == 1 && ri == 1) kSerial = ri;
1257  if (st == 1 && ri == 2) kSerial = ri ;
1258  if (st == 1 && ri == 3) kSerial = ri ;
1259  if (st == 1 && ri == 4) kSerial = 1;
1260  if (st == 2 ) kSerial = ri + 3;
1261  if (st == 3 ) kSerial = ri + 5;
1262  if (st == 4 ) kSerial = ri + 7;
1263  if (ec == 2) kSerial = kSerial * (-1);
1264  return kSerial;
1265 }
int CSCValidation::typeIndex ( CSCDetId  id)
inlineprivate

Definition at line 310 of file CSCValidation.h.

References Reference_intrackfit_cff::endcap, getHLTprescales::index, relativeConstraints::ring, and relativeConstraints::station.

310  {
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  }
bool CSCValidation::withinSensitiveRegion ( LocalPoint  localPos,
const std::vector< float >  layerBounds,
int  station,
int  ring,
float  shiftFromEdge,
float  shiftFromDeadZone 
)
private

Definition at line 1645 of file CSCValidation.cc.

References abs, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

1645  {
1646 //---- check if it is in a good local region (sensitive area - geometrical and HV boundaries excluded)
1647  bool pass = false;
1648 
1649  float y_center = 0.;
1650  double yUp = layerBounds[3] + y_center;
1651  double yDown = - layerBounds[3] + y_center;
1652  double xBound1Shifted = layerBounds[0] - shiftFromEdge;//
1653  double xBound2Shifted = layerBounds[1] - shiftFromEdge;//
1654  double lineSlope = (yUp - yDown)/(xBound2Shifted-xBound1Shifted);
1655  double lineConst = yUp - lineSlope*xBound2Shifted;
1656  double yBorder = lineSlope*abs(localPos.x()) + lineConst;
1657 
1658  //bool withinChamberOnly = false;// false = "good region"; true - boundaries only
1659  std::vector <float> deadZoneCenter(6);
1660  float cutZone = shiftFromDeadZone;//cm
1661  //---- hardcoded... not good
1662  if(station>1 && station<5){
1663  if(2==ring){
1664  deadZoneCenter[0]= -162.48 ;
1665  deadZoneCenter[1] = -81.8744;
1666  deadZoneCenter[2] = -21.18165;
1667  deadZoneCenter[3] = 39.51105;
1668  deadZoneCenter[4] = 100.2939;
1669  deadZoneCenter[5] = 160.58;
1670 
1671  if(localPos.y() >yBorder &&
1672  ((localPos.y()> deadZoneCenter[0] + cutZone && localPos.y()< deadZoneCenter[1] - cutZone) ||
1673  (localPos.y()> deadZoneCenter[1] + cutZone && localPos.y()< deadZoneCenter[2] - cutZone) ||
1674  (localPos.y()> deadZoneCenter[2] + cutZone && localPos.y()< deadZoneCenter[3] - cutZone) ||
1675  (localPos.y()> deadZoneCenter[3] + cutZone && localPos.y()< deadZoneCenter[4] - cutZone) ||
1676  (localPos.y()> deadZoneCenter[4] + cutZone && localPos.y()< deadZoneCenter[5] - cutZone))){
1677  pass = true;
1678  }
1679  }
1680  else if(1==ring){
1681  if(2==station){
1682  deadZoneCenter[0]= -95.80 ;
1683  deadZoneCenter[1] = -27.47;
1684  deadZoneCenter[2] = 33.67;
1685  deadZoneCenter[3] = 90.85;
1686  }
1687  else if(3==station){
1688  deadZoneCenter[0]= -89.305 ;
1689  deadZoneCenter[1] = -39.705;
1690  deadZoneCenter[2] = 20.195;
1691  deadZoneCenter[3] = 77.395;
1692  }
1693  else if(4==station){
1694  deadZoneCenter[0]= -75.645;
1695  deadZoneCenter[1] = -26.055;
1696  deadZoneCenter[2] = 23.855;
1697  deadZoneCenter[3] = 70.575;
1698  }
1699  if(localPos.y() >yBorder &&
1700  ((localPos.y()> deadZoneCenter[0] + cutZone && localPos.y()< deadZoneCenter[1] - cutZone) ||
1701  (localPos.y()> deadZoneCenter[1] + cutZone && localPos.y()< deadZoneCenter[2] - cutZone) ||
1702  (localPos.y()> deadZoneCenter[2] + cutZone && localPos.y()< deadZoneCenter[3] - cutZone))){
1703  pass = true;
1704  }
1705  }
1706  }
1707  else if(1==station){
1708  if(3==ring){
1709  deadZoneCenter[0]= -83.155 ;
1710  deadZoneCenter[1] = -22.7401;
1711  deadZoneCenter[2] = 27.86665;
1712  deadZoneCenter[3] = 81.005;
1713  if(localPos.y() > yBorder &&
1714  ((localPos.y()> deadZoneCenter[0] + cutZone && localPos.y()< deadZoneCenter[1] - cutZone) ||
1715  (localPos.y()> deadZoneCenter[1] + cutZone && localPos.y()< deadZoneCenter[2] - cutZone) ||
1716  (localPos.y()> deadZoneCenter[2] + cutZone && localPos.y()< deadZoneCenter[3] - cutZone))){
1717  pass = true;
1718  }
1719  }
1720  else if(2==ring){
1721  deadZoneCenter[0]= -86.285 ;
1722  deadZoneCenter[1] = -32.88305;
1723  deadZoneCenter[2] = 32.867423;
1724  deadZoneCenter[3] = 88.205;
1725  if(localPos.y() > (yBorder) &&
1726  ((localPos.y()> deadZoneCenter[0] + cutZone && localPos.y()< deadZoneCenter[1] - cutZone) ||
1727  (localPos.y()> deadZoneCenter[1] + cutZone && localPos.y()< deadZoneCenter[2] - cutZone) ||
1728  (localPos.y()> deadZoneCenter[2] + cutZone && localPos.y()< deadZoneCenter[3] - cutZone))){
1729  pass = true;
1730  }
1731  }
1732  else{
1733  deadZoneCenter[0]= -81.0;
1734  deadZoneCenter[1] = 81.0;
1735  if(localPos.y() > (yBorder) &&
1736  (localPos.y()> deadZoneCenter[0] + cutZone && localPos.y()< deadZoneCenter[1] - cutZone )){
1737  pass = true;
1738  }
1739  }
1740  }
1741  return pass;
1742 }
T y() const
Definition: PV3DBase.h:62
#define abs(x)
Definition: mlp_lapack.h:159
T x() const
Definition: PV3DBase.h:61

Member Data Documentation

edm::InputTag CSCValidation::alctDigiTag
private

Definition at line 249 of file CSCValidation.h.

std::multimap<CSCDetId , CSCRecHit2D> CSCValidation::AllRechits
private

Definition at line 305 of file CSCValidation.h.

double CSCValidation::chisqMax
private

Definition at line 234 of file CSCValidation.h.

edm::InputTag CSCValidation::clctDigiTag
private

Definition at line 250 of file CSCValidation.h.

bool CSCValidation::cleanEvent
private

Definition at line 208 of file CSCValidation.h.

edm::InputTag CSCValidation::compDigiTag
private

Definition at line 243 of file CSCValidation.h.

edm::InputTag CSCValidation::corrlctDigiTag
private

Definition at line 251 of file CSCValidation.h.

edm::InputTag CSCValidation::cscRecHitTag
private

Definition at line 244 of file CSCValidation.h.

edm::InputTag CSCValidation::cscSegTag
private

Definition at line 245 of file CSCValidation.h.

double CSCValidation::deltaPhiMax
private

Definition at line 237 of file CSCValidation.h.

bool CSCValidation::detailedAnalysis
private

Definition at line 224 of file CSCValidation.h.

std::map<CSCRecHit2D,float,ltrh> CSCValidation::distRHmap
private

Definition at line 308 of file CSCValidation.h.

bool CSCValidation::firstEvent
private

Definition at line 207 of file CSCValidation.h.

TH2F* CSCValidation::hEffDenominator
private

Definition at line 290 of file CSCValidation.h.

CSCValHists* CSCValidation::histos
private

Definition at line 275 of file CSCValidation.h.

edm::InputTag CSCValidation::hltTag
private

Definition at line 252 of file CSCValidation.h.

TH2I* CSCValidation::hORecHits
private

Definition at line 296 of file CSCValidation.h.

TH2I* CSCValidation::hOSegments
private

Definition at line 297 of file CSCValidation.h.

TH2I* CSCValidation::hOStrips
private

Definition at line 295 of file CSCValidation.h.

TH2I* CSCValidation::hOWires
private

Definition at line 294 of file CSCValidation.h.

TH1F* CSCValidation::hRHEff
private

Definition at line 281 of file CSCValidation.h.

TH2F* CSCValidation::hRHEff2
private

Definition at line 287 of file CSCValidation.h.

TH1F* CSCValidation::hRHSTE
private

Definition at line 279 of file CSCValidation.h.

TH2F* CSCValidation::hRHSTE2
private

Definition at line 283 of file CSCValidation.h.

TH1F* CSCValidation::hSEff
private

Definition at line 280 of file CSCValidation.h.

TH2F* CSCValidation::hSEff2
private

Definition at line 286 of file CSCValidation.h.

TH2F* CSCValidation::hSensitiveAreaEvt
private

Definition at line 291 of file CSCValidation.h.

TH1F* CSCValidation::hSSTE
private

Definition at line 278 of file CSCValidation.h.

TH2F* CSCValidation::hSSTE2
private

Definition at line 282 of file CSCValidation.h.

TH2F* CSCValidation::hStripEff2
private

Definition at line 288 of file CSCValidation.h.

TH2F* CSCValidation::hStripSTE2
private

Definition at line 284 of file CSCValidation.h.

TH2F* CSCValidation::hWireEff2
private

Definition at line 289 of file CSCValidation.h.

TH2F* CSCValidation::hWireSTE2
private

Definition at line 285 of file CSCValidation.h.

bool CSCValidation::isSimulation
private

Definition at line 222 of file CSCValidation.h.

edm::InputTag CSCValidation::l1aTag
private

Definition at line 247 of file CSCValidation.h.

double CSCValidation::lengthMax
private

Definition at line 236 of file CSCValidation.h.

double CSCValidation::lengthMin
private

Definition at line 236 of file CSCValidation.h.

std::map<int, int> CSCValidation::m_single_wire_layer
private

Definition at line 302 of file CSCValidation.h.

std::map<int, std::vector<int> > CSCValidation::m_wire_hvsegm
private

Definition at line 301 of file CSCValidation.h.

bool CSCValidation::makeADCTimingPlots
private

Definition at line 268 of file CSCValidation.h.

bool CSCValidation::makeAFEBTimingPlots
private

Definition at line 266 of file CSCValidation.h.

bool CSCValidation::makeCalibPlots
private

Definition at line 270 of file CSCValidation.h.

bool CSCValidation::makeComparisonPlots
private

Definition at line 219 of file CSCValidation.h.

bool CSCValidation::makeCompTimingPlots
private

Definition at line 267 of file CSCValidation.h.

bool CSCValidation::makeEfficiencyPlots
private

Definition at line 264 of file CSCValidation.h.

bool CSCValidation::makeGasGainPlots
private

Definition at line 265 of file CSCValidation.h.

bool CSCValidation::makeHLTPlots
private

Definition at line 226 of file CSCValidation.h.

bool CSCValidation::makeOccupancyPlots
private

Definition at line 255 of file CSCValidation.h.

bool CSCValidation::makePedNoisePlots
private

Definition at line 263 of file CSCValidation.h.

bool CSCValidation::makePlots
private

Definition at line 218 of file CSCValidation.h.

bool CSCValidation::makeRecHitPlots
private

Definition at line 259 of file CSCValidation.h.

bool CSCValidation::makeResolutionPlots
private

Definition at line 262 of file CSCValidation.h.

bool CSCValidation::makeRHNoisePlots
private

Definition at line 269 of file CSCValidation.h.

bool CSCValidation::makeSegmentPlots
private

Definition at line 261 of file CSCValidation.h.

bool CSCValidation::makeSimHitPlots
private

Definition at line 260 of file CSCValidation.h.

bool CSCValidation::makeStandalonePlots
private

Definition at line 271 of file CSCValidation.h.

bool CSCValidation::makeStripPlots
private

Definition at line 257 of file CSCValidation.h.

bool CSCValidation::makeTimeMonitorPlots
private

Definition at line 272 of file CSCValidation.h.

bool CSCValidation::makeTriggerPlots
private

Definition at line 256 of file CSCValidation.h.

bool CSCValidation::makeWirePlots
private

Definition at line 258 of file CSCValidation.h.

int CSCValidation::nCSCHitsMax
private

Definition at line 235 of file CSCValidation.h.

int CSCValidation::nCSCHitsMin
private

Definition at line 235 of file CSCValidation.h.

int CSCValidation::nEventsAnalyzed
private

Definition at line 204 of file CSCValidation.h.

std::vector<int> CSCValidation::nmbhvsegm
private

Maps and vectors for module doGasGain()

Definition at line 300 of file CSCValidation.h.

std::multimap<CSCDetId , CSCRecHit2D> CSCValidation::NonAssociatedRechits
private

Definition at line 307 of file CSCValidation.h.

double CSCValidation::pMin
private

Definition at line 233 of file CSCValidation.h.

double CSCValidation::polarMax
private

Definition at line 238 of file CSCValidation.h.

double CSCValidation::polarMin
private

Definition at line 238 of file CSCValidation.h.

std::string CSCValidation::refRootFile
private

Definition at line 220 of file CSCValidation.h.

int CSCValidation::rhTreeCount
private

Definition at line 205 of file CSCValidation.h.

std::string CSCValidation::rootFileName
private

Definition at line 223 of file CSCValidation.h.

edm::InputTag CSCValidation::saMuonTag
private

Definition at line 246 of file CSCValidation.h.

std::multimap<CSCDetId , CSCRecHit2D> CSCValidation::SegRechits
private

Definition at line 306 of file CSCValidation.h.

int CSCValidation::segTreeCount
private

Definition at line 206 of file CSCValidation.h.

edm::InputTag CSCValidation::simHitTag
private

Definition at line 248 of file CSCValidation.h.

edm::InputTag CSCValidation::stripDigiTag
private

Definition at line 241 of file CSCValidation.h.

TFile* CSCValidation::theFile
private

Definition at line 213 of file CSCValidation.h.

bool CSCValidation::useDigis
private

Definition at line 225 of file CSCValidation.h.

bool CSCValidation::useQualityFilter
private

Definition at line 229 of file CSCValidation.h.

bool CSCValidation::useTriggerFilter
private

Definition at line 230 of file CSCValidation.h.

edm::InputTag CSCValidation::wireDigiTag
private

Definition at line 242 of file CSCValidation.h.

bool CSCValidation::writeTreeToFile
private

Definition at line 221 of file CSCValidation.h.