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 edm::EDConsumerBase

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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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 (const CLHEP::HepMatrix &sp, const 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::array< const float, 4 > &layerBounds, int station, int ring, float shiftFromEdge, float shiftFromDeadZone)
 

Private Attributes

edm::EDGetTokenT
< CSCALCTDigiCollection
al_token
 
std::multimap< CSCDetId,
CSCRecHit2D
AllRechits
 
edm::EDGetTokenT
< CSCComparatorDigiCollection
cd_token
 
double chisqMax
 
edm::EDGetTokenT
< CSCCLCTDigiCollection
cl_token
 
bool cleanEvent
 
edm::EDGetTokenT
< CSCCorrelatedLCTDigiCollection
co_token
 
double deltaPhiMax
 
bool detailedAnalysis
 
std::map< CSCRecHit2D, float,
ltrh
distRHmap
 
bool firstEvent
 
TH2F * hEffDenominator
 
CSCValHistshistos
 
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::EDGetTokenT
< L1MuGMTReadoutCollection
l1_token
 
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
 
edm::EDGetTokenT
< FEDRawDataCollection
rd_token
 
std::string refRootFile
 
edm::EDGetTokenT
< CSCRecHit2DCollection
rh_token
 
int rhTreeCount
 
std::string rootFileName
 
edm::EDGetTokenT
< reco::TrackCollection
sa_token
 
edm::EDGetTokenT
< CSCStripDigiCollection
sd_token
 
edm::EDGetTokenT
< CSCSegmentCollection
se_token
 
std::multimap< CSCDetId,
CSCRecHit2D
SegRechits
 
int segTreeCount
 
edm::EDGetTokenT
< edm::PSimHitContainer
sh_token
 
TFile * theFile
 
edm::EDGetTokenT
< edm::TriggerResults
tr_token
 
bool useDigis
 
bool useQualityFilter
 
bool useTriggerFilter
 
edm::EDGetTokenT
< CSCWireDigiCollection
wd_token
 
bool writeTreeToFile
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 create_complex_test_file0_cfg::firstEvent, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), mergeVDriftHistosByStation::histos, HLT_25ns10e33_v2_cff::pMin, dtT0Analyzer_cfg::rootFileName, AlCaHLTBitMon_QueryRunRegistry::string, 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  rd_token = consumes<FEDRawDataCollection>( pset.getParameter<edm::InputTag>("rawDataTag") );
43  sd_token = consumes<CSCStripDigiCollection>( pset.getParameter<edm::InputTag>("stripDigiTag") );
44  wd_token = consumes<CSCWireDigiCollection>( pset.getParameter<edm::InputTag>("wireDigiTag") );
45  cd_token = consumes<CSCComparatorDigiCollection>( pset.getParameter<edm::InputTag>("compDigiTag") );
46  al_token = consumes<CSCALCTDigiCollection>( pset.getParameter<edm::InputTag>("alctDigiTag") );
47  cl_token = consumes<CSCCLCTDigiCollection>( pset.getParameter<edm::InputTag>("clctDigiTag") );
48  co_token = consumes<CSCCorrelatedLCTDigiCollection>( pset.getParameter<edm::InputTag>("corrlctDigiTag") );
49  rh_token = consumes<CSCRecHit2DCollection>( pset.getParameter<edm::InputTag>("cscRecHitTag") );
50  se_token = consumes<CSCSegmentCollection>( pset.getParameter<edm::InputTag>("cscSegTag") );
51  sa_token = consumes<reco::TrackCollection>( pset.getParameter<edm::InputTag>("saMuonTag") );
52  l1_token = consumes<L1MuGMTReadoutCollection>( pset.getParameter<edm::InputTag>("l1aTag") );
53  tr_token = consumes<TriggerResults>( pset.getParameter<edm::InputTag>("hltTag") );
54  sh_token = consumes<PSimHitContainer>( pset.getParameter<edm::InputTag>("simHitTag") );
55 
56  // flags to switch on/off individual modules
57  makeOccupancyPlots = pset.getUntrackedParameter<bool>("makeOccupancyPlots",true);
58  makeTriggerPlots = pset.getUntrackedParameter<bool>("makeTriggerPlots",false);
59  makeStripPlots = pset.getUntrackedParameter<bool>("makeStripPlots",true);
60  makeWirePlots = pset.getUntrackedParameter<bool>("makeWirePlots",true);
61  makeRecHitPlots = pset.getUntrackedParameter<bool>("makeRecHitPlots",true);
62  makeSimHitPlots = pset.getUntrackedParameter<bool>("makeSimHitPlots",true);
63  makeSegmentPlots = pset.getUntrackedParameter<bool>("makeSegmentPlots",true);
64  makeResolutionPlots = pset.getUntrackedParameter<bool>("makeResolutionPlots",true);
65  makePedNoisePlots = pset.getUntrackedParameter<bool>("makePedNoisePlots",true);
66  makeEfficiencyPlots = pset.getUntrackedParameter<bool>("makeEfficiencyPlots",true);
67  makeGasGainPlots = pset.getUntrackedParameter<bool>("makeGasGainPlots",true);
68  makeAFEBTimingPlots = pset.getUntrackedParameter<bool>("makeAFEBTimingPlots",true);
69  makeCompTimingPlots = pset.getUntrackedParameter<bool>("makeCompTimingPlots",true);
70  makeADCTimingPlots = pset.getUntrackedParameter<bool>("makeADCTimingPlots",true);
71  makeRHNoisePlots = pset.getUntrackedParameter<bool>("makeRHNoisePlots",false);
72  makeCalibPlots = pset.getUntrackedParameter<bool>("makeCalibPlots",false);
73  makeStandalonePlots = pset.getUntrackedParameter<bool>("makeStandalonePlots",false);
74  makeTimeMonitorPlots = pset.getUntrackedParameter<bool>("makeTimeMonitorPlots",false);
75  makeHLTPlots = pset.getUntrackedParameter<bool>("makeHLTPlots",false);
76 
77  // set counters to zero
78  nEventsAnalyzed = 0;
79  rhTreeCount = 0;
80  segTreeCount = 0;
81  firstEvent = true;
82 
83  // Create the root file for the histograms
84  theFile = new TFile(rootFileName.c_str(), "RECREATE");
85  theFile->cd();
86 
87  // Create object of class CSCValHists to manage histograms
88  histos = new CSCValHists();
89 
90  // book Occupancy Histos
91  hOWires = new TH2I("hOWires","Wire Digi Occupancy",36,0.5,36.5,20,0.5,20.5);
92  hOStrips = new TH2I("hOStrips","Strip Digi Occupancy",36,0.5,36.5,20,0.5,20.5);
93  hORecHits = new TH2I("hORecHits","RecHit Occupancy",36,0.5,36.5,20,0.5,20.5);
94  hOSegments = new TH2I("hOSegments","Segments Occupancy",36,0.5,36.5,20,0.5,20.5);
95 
96  // book Eff histos
97  hSSTE = new TH1F("hSSTE","hSSTE",40,0,40);
98  hRHSTE = new TH1F("hRHSTE","hRHSTE",40,0,40);
99  hSEff = new TH1F("hSEff","Segment Efficiency",20,0.5,20.5);
100  hRHEff = new TH1F("hRHEff","recHit Efficiency",20,0.5,20.5);
101 
102  const int nChambers = 36;
103  const int nTypes = 18;
104  float nCH_min = 0.5;
105  float nCh_max = float(nChambers) + 0.5;
106  float nT_min = 0.5;
107  float nT_max = float(nTypes) + 0.5;
108 
109  hSSTE2 = new TH2F("hSSTE2","hSSTE2",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
110  hRHSTE2 = new TH2F("hRHSTE2","hRHSTE2",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
111  hStripSTE2 = new TH2F("hStripSTE2","hStripSTE2",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
112  hWireSTE2 = new TH2F("hWireSTE2","hWireSTE2",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
113 
114 
115  hEffDenominator = new TH2F("hEffDenominator","hEffDenominator",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
116  hSEff2 = new TH2F("hSEff2","Segment Efficiency 2D",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
117  hRHEff2 = new TH2F("hRHEff2","recHit Efficiency 2D",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
118 
119  hStripEff2 = new TH2F("hStripEff2","strip Efficiency 2D",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
120  hWireEff2 = new TH2F("hWireEff2","wire Efficiency 2D",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
121 
122  hSensitiveAreaEvt = new TH2F("hSensitiveAreaEvt","events in sensitive area",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
123 
124  // setup trees to hold global position data for rechits and segments
126 
127 
128 }
edm::EDGetTokenT< CSCCLCTDigiCollection > cl_token
bool makeADCTimingPlots
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< CSCComparatorDigiCollection > cd_token
TH2F * hSensitiveAreaEvt
void setupTrees()
Definition: CSCValHists.cc:55
bool makeResolutionPlots
edm::EDGetTokenT< CSCWireDigiCollection > wd_token
bool makeAFEBTimingPlots
bool makeEfficiencyPlots
edm::EDGetTokenT< edm::TriggerResults > tr_token
bool makeStandalonePlots
edm::EDGetTokenT< CSCSegmentCollection > se_token
bool makePedNoisePlots
edm::EDGetTokenT< CSCStripDigiCollection > sd_token
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > co_token
TH2F * hEffDenominator
edm::EDGetTokenT< edm::PSimHitContainer > sh_token
edm::EDGetTokenT< reco::TrackCollection > sa_token
bool makeCompTimingPlots
bool makeOccupancyPlots
edm::EDGetTokenT< L1MuGMTReadoutCollection > l1_token
bool makeTimeMonitorPlots
std::string rootFileName
double deltaPhiMax
edm::EDGetTokenT< FEDRawDataCollection > rd_token
edm::EDGetTokenT< CSCRecHit2DCollection > rh_token
CSCValHists * histos
edm::EDGetTokenT< CSCALCTDigiCollection > al_token
CSCValidation::~CSCValidation ( )
virtual

Destructor.

Definition at line 133 of file CSCValidation.cc.

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

133  {
134 
135  // produce final efficiency histograms
138  hSEff2->Divide(hSSTE2,hEffDenominator,1.,1.,"B");
139  hRHEff2->Divide(hRHSTE2,hEffDenominator,1.,1.,"B");
140  hStripEff2->Divide(hStripSTE2,hEffDenominator,1.,1.,"B");
141  hWireEff2->Divide(hWireSTE2,hEffDenominator,1.,1.,"B");
142 
143  histos->insertPlot(hRHSTE,"hRHSTE","Efficiency");
144  histos->insertPlot(hSSTE,"hSSTE","Efficiency");
145  histos->insertPlot(hSSTE2,"hSSTE2","Efficiency");
146  histos->insertPlot(hEffDenominator,"hEffDenominator","Efficiency");
147  histos->insertPlot(hRHSTE2,"hRHSTE2","Efficiency");
148  histos->insertPlot(hStripSTE2,"hStripSTE2","Efficiency");
149  histos->insertPlot(hWireSTE2,"hWireSTE2","Efficiency");
150 
151  //moving this to post job macros
152  histos->insertPlot(hSEff,"hSEff","Efficiency");
153  histos->insertPlot(hRHEff,"hRHEff","Efficiency");
154 
155  histos->insertPlot(hSEff2,"hSEff2","Efficiency");
156  histos->insertPlot(hRHEff2,"hRHEff2","Efficiency");
157  histos->insertPlot(hStripEff2,"hStripff2","Efficiency");
158  histos->insertPlot(hWireEff2,"hWireff2","Efficiency");
159 
160  histos->insertPlot(hSensitiveAreaEvt,"","Efficiency");
161 
162  // throw in occupancy plots so they're saved
163  histos->insertPlot(hOWires,"hOWires","Digis");
164  histos->insertPlot(hOStrips,"hOStrips","Digis");
165  histos->insertPlot(hORecHits,"hORecHits","recHits");
166  histos->insertPlot(hOSegments,"hOSegments","Segments");
167 
168 
169  // write histos to the specified file
172  theFile->Close();
173 
174 }
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 179 of file CSCValidation.cc.

References HLT_25ns10e33_v2_cff::cscSegments, create_complex_test_file0_cfg::firstEvent, edm::EventSetup::get(), runregparse::hlt, HLT_25ns10e33_v2_cff::recHits, trackerHits::simHits, and RecoTauPiZeroBuilderPlugins_cfi::strips.

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

Definition at line 1231 of file CSCValidation.cc.

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

Definition at line 2558 of file CSCValidation.cc.

References CSCDetId, CSCIndexer::dbIndex(), Reference_intrackfit_cff::endcap, mergeVDriftHistosByStation::histos, i, j, mergeVDriftHistosByStation::name, relativeConstraints::ring, contentValuesCheck::ss, relativeConstraints::station, AlCaHLTBitMon_QueryRunRegistry::string, indexGen::title, and x().

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

Definition at line 2432 of file CSCValidation.cc.

References CSCIndexer::dbIndex(), Reference_intrackfit_cff::endcap, mergeVDriftHistosByStation::histos, mergeVDriftHistosByStation::name, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, indexGen::title, and x().

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

Definition at line 655 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().

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

References CSCIndexer::dbIndex(), Reference_intrackfit_cff::endcap, mergeVDriftHistosByStation::histos, mergeVDriftHistosByStation::name, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, indexGen::title, and x().

2497  {
2498 
2499  ostringstream ss; std::string name,title,endcap;
2500  float x,y;
2501  int strip,tbin,cfeb,idlayer,idchamber;
2502  int channel=0; // for CSCIndexer::dbIndex(id, channel); irrelevant here
2503  CSCIndexer indexer;
2504 
2505  if(compars.begin() != compars.end()) {
2506 
2507  //std::cout<<std::endl;
2508  //std::cout<<"Event "<<nEventsAnalyzed<<std::endl;
2509  //std::cout<<std::endl;
2510 
2511  // cycle on comparators collection for all CSC
2513  for(compdetUnitIt=compars.begin();compdetUnitIt!=compars.end();
2514  ++compdetUnitIt) {
2515  const CSCDetId id = (*compdetUnitIt).first;
2516  idlayer=indexer.dbIndex(id, channel); // channel irrelevant here
2517  idchamber=idlayer/10;
2518 
2519  if (id.endcap() == 1) endcap = "+";
2520  if (id.endcap() == 2) endcap = "-";
2521  // looping in the layer of given CSC
2522  const CSCComparatorDigiCollection::Range& range =
2523  (*compdetUnitIt).second;
2525  range.first; digiIt!=range.second; ++digiIt){
2526  strip=(*digiIt).getStrip();
2527  /*
2528  if(id.station()==1 && (id.ring()==1 || id.ring()==4))
2529  std::cout<<idchamber<<" "<<id.station()<<" "<<id.ring()<<" "
2530  <<strip <<std::endl;
2531  */
2532  indexer.dbIndex(id, strip); // strips 1-16 of ME1/1a
2533  // become strips 65-80 of ME1/1
2534  tbin=(*digiIt).getTimeBin();
2535  cfeb=(strip-1)/16+1;
2536 
2537  // time bin vs cfeb for each CSC
2538 
2539  x=cfeb;
2540  y=tbin;
2541  ss<<"comp_time_bin_vs_cfeb_occupancy_ME_"<<idchamber;
2542  name=ss.str(); ss.str("");
2543  ss<<"Comparator Time Bin vs CFEB Occupancy ME"<<endcap<<
2544  id.station()<<"/"<< id.ring()<<"/"<< id.chamber();
2545  title=ss.str(); ss.str("");
2546  histos->fill2DHist(x,y,name.c_str(),title.c_str(),5,1.,6.,16,0.,16.,"CompTiming");
2547 
2548  } // end of digis loop in layer
2549  } // end of collection loop
2550  } // end of if(compars.begin() !=compars.end())
2551 }
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< CSCComparatorDigi >::const_iterator const_iterator
std::pair< const_iterator, const_iterator > Range
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 1319 of file CSCValidation.cc.

References newFWLiteAna::bin, CSCDetId::chamber(), CSCChamberSpecs::chamberTypeName(), CSCDetId, mps_update::diff, CSCDetId::endcap(), plotBeamSpotDB::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(), puppiForMET_cff::weight, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

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

References CSCDetId, CSCIndexer::dbIndex(), Reference_intrackfit_cff::endcap, create_complex_test_file0_cfg::firstEvent, mergeVDriftHistosByStation::histos, i, j, VarParsing::mult, mergeVDriftHistosByStation::name, relativeConstraints::ring, contentValuesCheck::ss, relativeConstraints::station, AlCaHLTBitMon_QueryRunRegistry::string, indexGen::title, and x().

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

Definition at line 637 of file CSCValidation.cc.

References mergeVDriftHistosByStation::histos, and i.

637  {
638 
639  // HLT stuff
640  int hltSize = hlt->size();
641  for (int i = 0; i < hltSize; ++i){
642  if (hlt->accept(i)) histos->fill1DHist(i,"hltBits","HLT Trigger Bits",hltSize+1,-0.5,(float)hltSize+0.5,"Trigger");
643  }
644 
645  return true;
646 }
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 1823 of file CSCValidation.cc.

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

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

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

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

Definition at line 793 of file CSCValidation.cc.

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

793  {
794 
795  for (CSCStripDigiCollection::DigiRangeIterator dPNiter=strips->begin(); dPNiter!=strips->end(); dPNiter++) {
796  CSCDetId id = (CSCDetId)(*dPNiter).first;
797  std::vector<CSCStripDigi>::const_iterator pedIt = (*dPNiter).second.first;
798  std::vector<CSCStripDigi>::const_iterator lStrip = (*dPNiter).second.second;
799  for( ; pedIt != lStrip; ++pedIt) {
800  int myStrip = pedIt->getStrip();
801  std::vector<int> myADCVals = pedIt->getADCCounts();
802  float TotalADC = getSignal(*strips, id, myStrip);
803  bool thisStripFired = false;
804  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
805  float thisSignal = (1./6)*(myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
806  float threshold = 13.3;
807  if(id.station() == 1 && id.ring() == 4)
808  {
809  if(myStrip <= 16) myStrip += 64; // no trapping for any bizarreness
810  }
811  if (TotalADC > threshold) { thisStripFired = true;}
812  if (!thisStripFired){
813  float ADC = thisSignal - thisPedestal;
814  histos->fill1DHist(ADC,"hStripPed","Pedestal Noise Distribution",50,-25.,25.,"PedestalNoise");
815  histos->fill1DHistByType(ADC,"hStripPedME","Pedestal Noise Distribution",id,50,-25.,25.,"PedestalNoise");
816  histos->fillProfile(chamberSerial(id),ADC,"hStripPedMEProfile","Wire TimeBin Fired",601,-0.5,600.5,-25,25,"PedestalNoise");
817  if (detailedAnalysis){
818  histos->fill1DHistByLayer(ADC,"hStripPedME","Pedestal Noise Distribution",id,50,-25.,25.,"PedestalNoiseByLayer");
819  }
820  }
821  }
822  }
823 
824 }
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 833 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().

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

Definition at line 1076 of file CSCValidation.cc.

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

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

Definition at line 995 of file CSCValidation.cc.

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

995  {
996 
997  // get CSC segment collection
998  int nSegments = cscSegments->size();
999 
1000  // -----------------------
1001  // loop over segments
1002  // -----------------------
1003  int iSegment = 0;
1004  for(CSCSegmentCollection::const_iterator dSiter=cscSegments->begin(); dSiter != cscSegments->end(); dSiter++) {
1005  iSegment++;
1006  //
1007  CSCDetId id = (CSCDetId)(*dSiter).cscDetId();
1008  int kEndcap = id.endcap();
1009  int kRing = id.ring();
1010  int kStation = id.station();
1011  int kChamber = id.chamber();
1012 
1013  //
1014  float chisq = (*dSiter).chi2();
1015  int nhits = (*dSiter).nRecHits();
1016  int nDOF = 2*nhits-4;
1017  double chisqProb = ChiSquaredProbability( (double)chisq, nDOF );
1018  LocalPoint localPos = (*dSiter).localPosition();
1019  float segX = localPos.x();
1020  float segY = localPos.y();
1021  LocalVector segDir = (*dSiter).localDirection();
1022  double theta = segDir.theta();
1023 
1024  // global transformation
1025  float globX = 0.;
1026  float globY = 0.;
1027  float globTheta = 0.;
1028  float globPhi = 0.;
1029  const CSCChamber* cscchamber = cscGeom->chamber(id);
1030  if (cscchamber) {
1031  GlobalPoint globalPosition = cscchamber->toGlobal(localPos);
1032  globX = globalPosition.x();
1033  globY = globalPosition.y();
1034  GlobalVector globalDirection = cscchamber->toGlobal(segDir);
1035  globTheta = globalDirection.theta();
1036  globPhi = globalDirection.phi();
1037  }
1038 
1039 
1040  // Fill segment position branch
1041  if (writeTreeToFile && segTreeCount < 1500000){
1042  histos->fillSegmentTree(segX, segY, globX, globY, kEndcap, kStation, kRing, kChamber);
1043  segTreeCount++;
1044  }
1045 
1046  // Fill histos
1047  histos->fill2DHistByStation(globX,globY,"hSGlobal","Segment Global Positions;global x (cm)",id,100,-800.,800.,100,-800.,800.,"Segments");
1048  histos->fill1DHistByType(nhits,"hSnHits","N hits on Segments",id,8,-0.5,7.5,"Segments");
1049  histos->fill1DHistByType(theta,"hSTheta","local theta segments",id,128,-3.2,3.2,"Segments");
1050  histos->fill1DHistByType((chisq/nDOF),"hSChiSq","segments chi-squared/ndof",id,110,-0.05,10.5,"Segments");
1051  histos->fill1DHistByType(chisqProb,"hSChiSqProb","segments chi-squared probability",id,110,-0.05,1.05,"Segments");
1052  histos->fill1DHist(globTheta,"hSGlobalTheta","segment global theta",128,0,3.2,"Segments");
1053  histos->fill1DHist(globPhi,"hSGlobalPhi","segment global phi",128,-3.2,3.2,"Segments");
1054  histos->fillProfile(chamberSerial(id),nhits,"hSnHitsProfile","N hits on Segments",601,-0.5,600.5,-0.5,7.5,"Segments");
1055  if (detailedAnalysis){
1056  histos->fill1DHistByChamber(nhits,"hSnHits","N hits on Segments",id,8,-0.5,7.5,"HitsOnSegmentByChamber");
1057  histos->fill1DHistByChamber(theta,"hSTheta","local theta segments",id,128,-3.2,3.2,"DetailedSegments");
1058  histos->fill1DHistByChamber((chisq/nDOF),"hSChiSq","segments chi-squared/ndof",id,110,-0.05,10.5,"SegChi2ByChamber");
1059  histos->fill1DHistByChamber(chisqProb,"hSChiSqProb","segments chi-squared probability",id,110,-0.05,1.05,"SegChi2ByChamber");
1060  }
1061 
1062  } // end segment loop
1063 
1064  if (nSegments == 0) nSegments = -1;
1065 
1066  histos->fill1DHist(nSegments,"hSnSegments","Segments per Event",31,-0.5,30.5,"Segments");
1067 
1068 }
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:52
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
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:63
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:75
int endcap() const
Definition: CSCDetId.h:93
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:62
CSCValHists * histos
void CSCValidation::doSimHits ( edm::Handle< CSCRecHit2DCollection recHits,
edm::Handle< edm::PSimHitContainer simHits 
)
private

Definition at line 941 of file CSCValidation.cc.

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

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

Definition at line 1144 of file CSCValidation.cc.

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

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

Definition at line 752 of file CSCValidation.cc.

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

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

References CSCTMBHeader::ALCTMatchTime(), CSCTMBHeader::BXNCount(), CSCDetId::chamber(), CSCDetId::chamberId(), DDVectorGetter::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, j, LogTrace, FEDNumbering::MAXCSCFEDID, FEDNumbering::MINCSCFEDID, NULL, edm::ESHandle< class >::product(), lumiPlot::rawdata, CSCDetId::ring(), CSCDCCExaminer::setMask(), FEDRawData::size(), mathSSE::sqrt(), CSCDetId::station(), GeomDet::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

2648  {
2649 
2650  map<CSCDetId, float > segment_median_map; //structure for storing the median time for segments in a chamber
2651  map<CSCDetId, GlobalPoint > segment_position_map; //structure for storing the global position for segments in a chamber
2652 
2653  // -----------------------
2654  // loop over segments
2655  // -----------------------
2656  int iSegment = 0;
2657  for(CSCSegmentCollection::const_iterator dSiter=cscSegments->begin(); dSiter != cscSegments->end(); dSiter++) {
2658  iSegment++;
2659 
2660  CSCDetId id = (CSCDetId)(*dSiter).cscDetId();
2661  LocalPoint localPos = (*dSiter).localPosition();
2662  GlobalPoint globalPosition = GlobalPoint(0.0, 0.0, 0.0);
2663  const CSCChamber* cscchamber = cscGeom->chamber(id);
2664  if (cscchamber) {
2665  globalPosition = cscchamber->toGlobal(localPos);
2666  }
2667 
2668  // try to get the CSC recHits that contribute to this segment.
2669  std::vector<CSCRecHit2D> theseRecHits = (*dSiter).specificRecHits();
2670  int nRH = (*dSiter).nRecHits();
2671  if (nRH < 4 ) continue;
2672 
2673  //Store the recHit times of a segment in a vector for later sorting
2674  vector<float> non_zero;
2675 
2676  for ( vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
2677  non_zero.push_back( iRH->tpeak());
2678 
2679  }// end rechit loop
2680 
2681  //Sort the vector of hit times for this segment and average the center two
2682  sort(non_zero.begin(),non_zero.end());
2683  int middle_index = non_zero.size()/2;
2684  float average_two = (non_zero.at(middle_index-1) + non_zero.at(middle_index))/2.;
2685  if(non_zero.size()%2)
2686  average_two = non_zero.at(middle_index);
2687 
2688  //If we've vetoed events with multiple segments per chamber, this should never overwrite informations
2689  segment_median_map[id]=average_two;
2690  segment_position_map[id]=globalPosition;
2691 
2692  double distToIP = sqrt(globalPosition.x()*globalPosition.x()+globalPosition.y()*globalPosition.y()+globalPosition.z()*globalPosition.z());
2693 
2694  histos->fillProfile(chamberSerial(id),average_two,"timeChamber","Segment mean time",601,-0.5,600.5,-400.,400.,"TimeMonitoring");
2695  histos->fillProfileByType(id.chamber(),average_two,"timeChamberByType","Segment mean time by chamber",id,36,0.5,36.5,-400,400.,"TimeMonitoring");
2696  histos->fill2DHist(distToIP,average_two,"seg_time_vs_distToIP","Segment time vs. Distance to IP",80,600.,1400.,800,-400,400.,"TimeMonitoring");
2697  histos->fill2DHist(globalPosition.z(),average_two,"seg_time_vs_globZ","Segment time vs. z position",240,-1200,1200,800,-400.,400.,"TimeMonitoring");
2698  histos->fill2DHist(fabs(globalPosition.z()),average_two,"seg_time_vs_absglobZ","Segment time vs. abs(z position)",120,0.,1200.,800,-400.,400.,"TimeMonitoring");
2699 
2700  }//end segment loop
2701 
2702  //Now that the information for each segment we're interest in is stored, it is time to go through the pairs and make plots
2703  map<CSCDetId, float >::const_iterator it_outer; //for the outer loop
2704  map<CSCDetId, float >::const_iterator it_inner; //for the nested inner loop
2705  for (it_outer = segment_median_map.begin(); it_outer != segment_median_map.end(); it_outer++){
2706 
2707  CSCDetId id_outer = it_outer->first;
2708  float t_outer = it_outer->second;
2709 
2710  //begin the inner loop
2711  for (it_inner = segment_median_map.begin(); it_inner != segment_median_map.end(); it_inner++){
2712 
2713  CSCDetId id_inner = it_inner->first;
2714  float t_inner = it_inner->second;
2715 
2716  // we're looking at ordered pairs, so combinations will be double counted
2717  // (chamber a, chamber b) will be counted as well as (chamber b, chamber a)
2718  // We will avoid (chamber a, chamber a) with the following line
2719  if (chamberSerial(id_outer) == chamberSerial(id_inner)) continue;
2720 
2721  // Calculate expected TOF (in ns units)
2722  // GlobalPoint gp_outer = segment_position_map.find(id_outer)->second;
2723  // GlobalPoint gp_inner = segment_position_map.find(id_inner)->second;
2724  // GlobalVector flight = gp_outer - gp_inner; //in cm
2725  // float TOF = flight.mag()/30.0; //to ns
2726 
2727  //Plot t(ME+) - t(ME-) for chamber pairs in the same stations and rings but opposite endcaps
2728  if (id_outer.endcap() ==1 && id_inner.endcap() == 2 && id_outer.station() == id_inner.station() && id_outer.ring() == id_inner.ring() ){
2729  histos->fill1DHist(t_outer-t_inner,"diff_opposite_endcaps","#Delta t [ME+]-[ME-] for chambers in same station and ring",800,-400.,400.,"TimeMonitoring");
2730  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");
2731  }
2732 
2733  }//end inner loop of segment pairs
2734  }//end outer loop of segment pairs
2735 
2736  //if the digis, return here
2737  if( !useDigis ) return;
2738 
2739  //looking for the global trigger number
2740  vector<L1MuGMTReadoutRecord> L1Mrec = pCollection->getRecords();
2741  vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
2742  int L1GMT_BXN = -100;
2743  bool has_CSCTrigger = false;
2744  bool has_beamHaloTrigger = false;
2745  for(igmtrr=L1Mrec.begin(); igmtrr!=L1Mrec.end(); igmtrr++) {
2746  std::vector<L1MuRegionalCand>::const_iterator iter1;
2747  std::vector<L1MuRegionalCand> rmc;
2748  // CSC
2749  int icsc = 0;
2750  rmc = igmtrr->getCSCCands();
2751  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
2752  if ( !(*iter1).empty() ) {
2753  icsc++;
2754  int kQuality = (*iter1).quality(); // kQuality = 1 means beam halo
2755  if (kQuality == 1) has_beamHaloTrigger = true;
2756  }
2757  }
2758  if (igmtrr->getBxInEvent() == 0 && icsc>0){
2759  //printf("L1 CSCCands exist. L1MuGMTReadoutRecord BXN = %d \n", igmtrr->getBxNr());
2760  L1GMT_BXN = igmtrr->getBxNr();
2761  has_CSCTrigger = true;
2762  }
2763  else if (igmtrr->getBxInEvent() == 0 ) {
2764  //printf("L1 CSCCands do not exist. L1MuGMTReadoutRecord BXN = %d \n", igmtrr->getBxNr());
2765  L1GMT_BXN = igmtrr->getBxNr();
2766  }
2767  }
2768 
2769  // *************************************************
2770  // *** ALCT Digis **********************************
2771  // *************************************************
2772 
2773  int n_alcts = 0;
2774  map<CSCDetId, int > ALCT_KeyWG_map; //structure for storing the key wire group for the first ALCT for each chamber
2775  for (CSCALCTDigiCollection::DigiRangeIterator j=alcts->begin(); j!=alcts->end(); j++) {
2776  const CSCALCTDigiCollection::Range& range =(*j).second;
2777  const CSCDetId& idALCT = (*j).first;
2778  for (CSCALCTDigiCollection::const_iterator digiIt = range.first; digiIt!=range.second; ++digiIt){
2779  // Valid digi in the chamber (or in neighbouring chamber)
2780  if((*digiIt).isValid()){
2781  n_alcts++;
2782  histos->fill1DHist( (*digiIt).getBX(), "ALCT_getBX","ALCT.getBX()",11,-0.5,10.5,"TimeMonitoring");
2783  histos->fill1DHist( (*digiIt).getFullBX(), "ALCT_getFullBX","ALCT.getFullBX()",3601,-0.5,3600.5,"TimeMonitoring");
2784  //if we don't already have digi information stored for this chamber, then we fill it
2785  if (ALCT_KeyWG_map.find(idALCT.chamberId()) == ALCT_KeyWG_map.end()){
2786  ALCT_KeyWG_map[idALCT.chamberId()] = (*digiIt).getKeyWG();
2787  //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());
2788  }
2789 
2790  }
2791  }
2792  }
2793 
2794  // *************************************************
2795  // *** CLCT Digis **********************************
2796  // *************************************************
2797  int n_clcts = 0;
2798  map<CSCDetId, int > CLCT_getFullBx_map; //structure for storing the pretrigger bxn for the first CLCT for each chamber
2799  for (CSCCLCTDigiCollection::DigiRangeIterator j=clcts->begin(); j!=clcts->end(); j++) {
2800  const CSCCLCTDigiCollection::Range& range =(*j).second;
2801  const CSCDetId& idCLCT = (*j).first;
2802  for (CSCCLCTDigiCollection::const_iterator digiIt = range.first; digiIt!=range.second; ++digiIt){
2803  // Valid digi in the chamber (or in neighbouring chamber)
2804  if((*digiIt).isValid()){
2805  n_clcts++;
2806  histos->fill1DHist( (*digiIt).getBX(), "CLCT_getBX","CLCT.getBX()",11,-0.5,10.5,"TimeMonitoring");
2807  histos->fill1DHist( (*digiIt).getFullBX(), "CLCT_getFullBX","CLCT.getFullBX()",3601,-0.5,3600.5,"TimeMonitoring");
2808  //if we don't already have digi information stored for this chamber, then we fill it
2809  if (CLCT_getFullBx_map.find(idCLCT.chamberId()) == CLCT_getFullBx_map.end()){
2810  CLCT_getFullBx_map[idCLCT.chamberId()] = (*digiIt).getFullBX();
2811  //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());
2812  }
2813  }
2814  }
2815  }
2816 
2817  // *************************************************
2818  // *** CorrelatedLCT Digis *************************
2819  // *************************************************
2820  int n_correlatedlcts = 0;
2821  for (CSCCorrelatedLCTDigiCollection::DigiRangeIterator j=correlatedlcts->begin(); j!=correlatedlcts->end(); j++) {
2822  const CSCCorrelatedLCTDigiCollection::Range& range =(*j).second;
2823  for (CSCCorrelatedLCTDigiCollection::const_iterator digiIt = range.first; digiIt!=range.second; ++digiIt){
2824  if((*digiIt).isValid()){
2825  n_correlatedlcts++;
2826  histos->fill1DHist( (*digiIt).getBX(), "CorrelatedLCTS_getBX","CorrelatedLCT.getBX()",11,-0.5,10.5,"TimeMonitoring");
2827  }
2828  }
2829  }
2830 
2831 
2832  int nRecHits = recHits->size();
2833  int nSegments = cscSegments->size();
2834  if (has_CSCTrigger){
2835  histos->fill1DHist(L1GMT_BXN,"BX_L1CSCCand","BX of L1 CSC Cand",4001,-0.5,4000.5,"TimeMonitoring");
2836  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");
2837  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");
2838  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");
2839  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");
2840  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");
2841  }
2842  if (has_CSCTrigger && has_beamHaloTrigger){
2843  histos->fill1DHist(L1GMT_BXN,"BX_L1CSCCand_w_beamHalo","BX of L1 CSC (w beamHalo bit)",4001,-0.5,4000.5,"TimeMonitoring");
2844  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");
2845  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");
2846  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");
2847  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");
2848  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");
2849  }
2850 
2851  // *******************************************************************
2852  // Get information from the TMB header.
2853  // Can this eventually come out of the digis?
2854  // Taking code from EventFilter/CSCRawToDigis/CSCDCCUnpacker.cc
2855  // *******************************************************************
2856 
2858  eventSetup.get<CSCCrateMapRcd>().get(hcrate);
2859  const CSCCrateMap* pcrate = hcrate.product();
2860 
2863  event.getByToken( rd_token, rawdata);
2864  bool goodEvent = false;
2865  // If set selective unpacking mode
2866  // hardcoded examiner mask below to check for DCC and DDU level errors will be used first
2867  // then examinerMask for CSC level errors will be used during unpacking of each CSC block
2868  unsigned long dccBinCheckMask = 0x06080016;
2869  unsigned int examinerMask = 0x1FEBF3F6;
2870  unsigned int errorMask = 0x0;
2871 
2872  for (int id=FEDNumbering::MINCSCFEDID; id<=FEDNumbering::MAXCSCFEDID; ++id) {
2873  // loop over DCCs
2876 
2878  const FEDRawData& fedData = rawdata->FEDData(id);
2879  unsigned long length = fedData.size();
2880 
2881  if (length>=32){
2882  CSCDCCExaminer* examiner = NULL;
2883  std::stringstream examiner_out, examiner_err;
2884  goodEvent = true;
2886  //CSCDCCExaminer examiner;
2887  examiner = new CSCDCCExaminer();
2888  if( examinerMask&0x40000 ) examiner->crcCFEB(1);
2889  if( examinerMask&0x8000 ) examiner->crcTMB (1);
2890  if( examinerMask&0x0400 ) examiner->crcALCT(1);
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:42
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
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:52
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:63
#define NULL
Definition: scimark2.h:8
ExaminerStatusType errors(void) const
void crcALCT(bool enable)
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:47
int endcap() const
Definition: CSCDetId.h:93
bool check(const std::string &)
T sqrt(T t)
Definition: SSEVec.h:18
int ringSerial(CSCDetId id)
T z() const
Definition: PV3DBase.h:64
void crcTMB(bool enable)
int j
Definition: DBlmapReader.cc:9
CSCDetId chamberId() const
Definition: CSCDetId.h:53
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:45
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:75
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:56
T const * product() const
Definition: ESHandle.h:86
std::vector< CSCALCTDigi >::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:28
int station() const
Definition: CSCDetId.h:86
std::pair< const_iterator, const_iterator > Range
dictionary rawdata
Definition: lumiPlot.py:393
T x() const
Definition: PV3DBase.h:62
edm::EDGetTokenT< FEDRawDataCollection > rd_token
void setMask(ExaminerMaskType mask)
CSCValHists * histos
bool CSCValidation::doTrigger ( edm::Handle< L1MuGMTReadoutCollection pCollection)
private

Definition at line 537 of file CSCValidation.cc.

References mergeVDriftHistosByStation::histos.

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

References CSCDetId, and mergeVDriftHistosByStation::histos.

718  {
719 
720  int nWireGroupsTotal = 0;
721  for (CSCWireDigiCollection::DigiRangeIterator dWDiter=wires->begin(); dWDiter!=wires->end(); dWDiter++) {
722  CSCDetId id = (CSCDetId)(*dWDiter).first;
723  std::vector<CSCWireDigi>::const_iterator wireIter = (*dWDiter).second.first;
724  std::vector<CSCWireDigi>::const_iterator lWire = (*dWDiter).second.second;
725  for( ; wireIter != lWire; ++wireIter) {
726  int myWire = wireIter->getWireGroup();
727  int myTBin = wireIter->getTimeBin();
728  nWireGroupsTotal++;
729  histos->fill1DHistByType(myWire,"hWireWire","Wiregroup Numbers Fired",id,113,-0.5,112.5,"Digis");
730  histos->fill1DHistByType(myTBin,"hWireTBin","Wire TimeBin Fired",id,17,-0.5,16.5,"Digis");
731  histos->fillProfile(chamberSerial(id),myTBin,"hWireTBinProfile","Wire TimeBin Fired",601,-0.5,600.5,-0.5,16.5,"Digis");
732  if (detailedAnalysis){
733  histos->fill1DHistByLayer(myWire,"hWireWire","Wiregroup Numbers Fired",id,113,-0.5,112.5,"WireNumberByLayer");
734  histos->fill1DHistByLayer(myTBin,"hWireTBin","Wire TimeBin Fired",id,17,-0.5,16.5,"WireTimeByLayer");
735  }
736  }
737  } // end wire loop
738 
739  // this way you can zero suppress but still store info on # events with no digis
740  if (nWireGroupsTotal == 0) nWireGroupsTotal = -1;
741 
742  histos->fill1DHist(nWireGroupsTotal,"hWirenGroupsTotal","Wires Fired Per Event",151,-0.5,150.5,"Digis");
743 
744 }
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:145
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 333 of file CSCValidation.cc.

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

Definition at line 1883 of file CSCValidation.cc.

References CSCDetId::chamber(), ztail::d, 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().

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

Definition at line 1276 of file CSCValidation.cc.

References delta, benchmark_cfg::errors, i, S(), and slope.

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

Definition at line 1616 of file CSCValidation.cc.

References mathSSE::sqrt().

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

Definition at line 1757 of file CSCValidation.cc.

References CSCDetId, reco::if(), and plotBeamSpotDB::last.

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

Definition at line 2084 of file CSCValidation.cc.

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

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

Definition at line 2135 of file CSCValidation.cc.

References CSCDetId, plotBeamSpotDB::first, reco::if(), plotBeamSpotDB::last, CSCDetId::ring(), CSCDetId::station(), and create_public_lumi_plots::width.

2135  {
2136 
2137  int width = 1;
2138  int widthpos = 0;
2139  int widthneg = 0;
2140 
2141  // Loop over strip digis responsible for this recHit and sum charge
2143 
2144  for (sIt = stripdigis.begin(); sIt != stripdigis.end(); sIt++){
2145  CSCDetId id = (CSCDetId)(*sIt).first;
2146  if (id == idRH){
2147  std::vector<CSCStripDigi>::const_iterator digiItr = (*sIt).second.first;
2148  std::vector<CSCStripDigi>::const_iterator first = (*sIt).second.first;
2149  std::vector<CSCStripDigi>::const_iterator last = (*sIt).second.second;
2150  std::vector<CSCStripDigi>::const_iterator it = (*sIt).second.first;
2151  std::vector<CSCStripDigi>::const_iterator itr = (*sIt).second.first;
2152  //std::cout << " IDRH " << id <<std::endl;
2153  int St = idRH.station();
2154  int Rg = idRH.ring();
2155  if (St == 1 && Rg == 4){
2156  while(centerStrip> 16) centerStrip -= 16;
2157  }
2158  for ( ; digiItr != last; ++digiItr ) {
2159  int thisStrip = digiItr->getStrip();
2160  if (thisStrip == (centerStrip)){
2161  it = digiItr;
2162  for( ; it != last; ++it ) {
2163  int strip = it->getStrip();
2164  std::vector<int> myADCVals = it->getADCCounts();
2165  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
2166  if(((float)myADCVals[3]-thisPedestal) < 6 || widthpos == 10 || it==last){break;}
2167  if(strip != centerStrip){ widthpos += 1;
2168  }
2169  }
2170  itr = digiItr;
2171  for( ; itr != first; --itr) {
2172  int strip = itr->getStrip();
2173  std::vector<int> myADCVals = itr->getADCCounts();
2174  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
2175  if(((float)myADCVals[3]-thisPedestal) < 6 || widthneg == 10 || itr==first){break;}
2176  if(strip != centerStrip) {widthneg += 1 ;
2177  }
2178  }
2179  }
2180  }
2181  }
2182  }
2183  //std::cout << "Widthneg - " << widthneg << "Widthpos + " << widthpos << std::endl;
2184  width = width + widthneg + widthpos ;
2185  //std::cout << "Width " << width << std::endl;
2186  return width;
2187 }
int ring() const
Definition: CSCDetId.h:75
if(dp >Float(M_PI)) dp-
int station() const
Definition: CSCDetId.h:86
void CSCValidation::histoEfficiency ( TH1F *  readHisto,
TH1F *  writeHisto 
)
private

Definition at line 1630 of file CSCValidation.cc.

References i, and SiStripMonitorClusterAlca_cfi::Nbins.

1630  {
1631  std::vector<float> eff(2);
1632  int Nbins = readHisto->GetSize()-2;//without underflows and overflows
1633  std::vector<float> bins(Nbins);
1634  std::vector<float> Efficiency(Nbins);
1635  std::vector<float> EffError(Nbins);
1636  float Num = 1;
1637  float Den = 1;
1638  for (int i=0;i<20;i++){
1639  Num = readHisto->GetBinContent(i+1);
1640  Den = readHisto->GetBinContent(i+21);
1641  getEfficiency(Num, Den, eff);
1642  Efficiency[i] = eff[0];
1643  EffError[i] = eff[1];
1644  writeHisto->SetBinContent(i+1, Efficiency[i]);
1645  writeHisto->SetBinError(i+1, EffError[i]);
1646  }
1647 }
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 1255 of file CSCValidation.cc.

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

Definition at line 310 of file CSCValidation.h.

References Reference_intrackfit_cff::endcap, cmsHarvester::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::array< const float, 4 > &  layerBounds,
int  station,
int  ring,
float  shiftFromEdge,
float  shiftFromDeadZone 
)
private

Definition at line 1649 of file CSCValidation.cc.

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

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

Member Data Documentation

edm::EDGetTokenT<CSCALCTDigiCollection> CSCValidation::al_token
private

Definition at line 244 of file CSCValidation.h.

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

Definition at line 305 of file CSCValidation.h.

edm::EDGetTokenT<CSCComparatorDigiCollection> CSCValidation::cd_token
private

Definition at line 243 of file CSCValidation.h.

double CSCValidation::chisqMax
private

Definition at line 234 of file CSCValidation.h.

edm::EDGetTokenT<CSCCLCTDigiCollection> CSCValidation::cl_token
private

Definition at line 245 of file CSCValidation.h.

bool CSCValidation::cleanEvent
private

Definition at line 208 of file CSCValidation.h.

edm::EDGetTokenT<CSCCorrelatedLCTDigiCollection> CSCValidation::co_token
private

Definition at line 246 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
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::EDGetTokenT<L1MuGMTReadoutCollection> CSCValidation::l1_token
private

Definition at line 249 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.

edm::EDGetTokenT<FEDRawDataCollection> CSCValidation::rd_token
private

Definition at line 240 of file CSCValidation.h.

std::string CSCValidation::refRootFile
private

Definition at line 220 of file CSCValidation.h.

edm::EDGetTokenT<CSCRecHit2DCollection> CSCValidation::rh_token
private

Definition at line 247 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::EDGetTokenT<reco::TrackCollection> CSCValidation::sa_token
private

Definition at line 251 of file CSCValidation.h.

edm::EDGetTokenT<CSCStripDigiCollection> CSCValidation::sd_token
private

Definition at line 242 of file CSCValidation.h.

edm::EDGetTokenT<CSCSegmentCollection> CSCValidation::se_token
private

Definition at line 248 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::EDGetTokenT<edm::PSimHitContainer> CSCValidation::sh_token
private

Definition at line 252 of file CSCValidation.h.

TFile* CSCValidation::theFile
private

Definition at line 213 of file CSCValidation.h.

edm::EDGetTokenT<edm::TriggerResults> CSCValidation::tr_token
private

Definition at line 250 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::EDGetTokenT<CSCWireDigiCollection> CSCValidation::wd_token
private

Definition at line 241 of file CSCValidation.h.

bool CSCValidation::writeTreeToFile
private

Definition at line 221 of file CSCValidation.h.