CMS 3D CMS Logo

CSCValidation Class Reference

Simple package to validate local CSC reconstruction: DIGIS recHits segments. More...

#include <RecoLocalMuon/CSCValidation/src/CSCValidation.h>

Inheritance diagram for CSCValidation:

edm::EDAnalyzer

List of all members.

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup)
 Perform the analysis.
 CSCValidation (const edm::ParameterSet &pset)
 Constructor.
void endJob ()
virtual ~CSCValidation ()
 Destructor.

Private Member Functions

int chamberSerial (CSCDetId id)
void doADCTiming (const CSCStripDigiCollection &, 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 &)
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::Handle< CSCStripDigiCollection > strips, 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)
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)
void findNonAssociatedRecHits (edm::ESHandle< CSCGeometry > cscGeom, edm::Handle< CSCStripDigiCollection > strips)
float fitX (HepMatrix sp, 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)
float getTiming (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 typeIndex (CSCDetId id)
bool withinSensitiveRegion (LocalPoint localPos, const std::vector< float > layerBounds, int station, int ring, float shiftFromEdge, float shiftFromDeadZone)

Private Attributes

std::multimap< CSCDetId,
CSCRecHit2D
AllRechits
edm::InputTag compDigiTag
edm::InputTag cscRecHitTag
edm::InputTag cscSegTag
bool detailedAnalysis
std::map< CSCRecHit2D, float,
ltrh
distRHmap
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::InputTag l1aTag
std::map< int, intm_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 makeOccupancyPlots
bool makePedNoisePlots
bool makePlots
bool makeRecHitPlots
bool makeRHNoisePlots
bool makeSegmentPlots
bool makeSimHitPlots
bool makeStandalonePlots
bool makeStripPlots
bool makeTriggerPlots
bool makeWirePlots
int nEventsAnalyzed
std::vector< intnmbhvsegm
 Maps and vectors for module doGasGain().
std::multimap< CSCDetId,
CSCRecHit2D
NonAssociatedRechits
std::string refRootFile
int rhTreeCount
std::string rootFileName
edm::InputTag saMuonTag
std::multimap< CSCDetId,
CSCRecHit2D
SegRechits
int segTreeCount
edm::InputTag simHitTag
edm::InputTag stripDigiTag
TFile * theFile
bool useDigis
bool useTrigger
edm::InputTag wireDigiTag
bool writeTreeToFile

Classes

struct  ltrh


Detailed Description

Simple package to validate local CSC reconstruction: DIGIS recHits segments.

This program merely unpacks collections and fills a few simple histograms. The idea is to compare the histograms for one offline release and another and look for unexpected differences.

Michael Schmitt, Northwestern University, July 2007

Definition at line 86 of file CSCValidation.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 17 of file CSCValidation.cc.

References compDigiTag, cscRecHitTag, cscSegTag, detailedAnalysis, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hEffDenominator, histos, hORecHits, hOSegments, hOStrips, hOWires, hRHEff, hRHEff2, hRHSTE, hRHSTE2, hSEff, hSEff2, hSensitiveAreaEvt, hSSTE, hSSTE2, hStripEff2, hStripSTE2, hWireEff2, hWireSTE2, isSimulation, l1aTag, makeADCTimingPlots, makeAFEBTimingPlots, makeCalibPlots, makeCompTimingPlots, makeEfficiencyPlots, makeGasGainPlots, makeOccupancyPlots, makePedNoisePlots, makeRecHitPlots, makeRHNoisePlots, makeSegmentPlots, makeSimHitPlots, makeStandalonePlots, makeStripPlots, makeTriggerPlots, makeWirePlots, nEventsAnalyzed, rhTreeCount, rootFileName, saMuonTag, segTreeCount, CSCValHists::setupTrees(), simHitTag, stripDigiTag, theFile, useDigis, useTrigger, wireDigiTag, and writeTreeToFile.

00017                                                     {
00018 
00019   // Get the various input parameters
00020   rootFileName         = pset.getUntrackedParameter<string>("rootFileName","valHists.root");
00021   isSimulation         = pset.getUntrackedParameter<bool>("isSimulation",false);
00022   writeTreeToFile      = pset.getUntrackedParameter<bool>("writeTreeToFile",true);
00023   detailedAnalysis     = pset.getUntrackedParameter<bool>("detailedAnalysis",false);
00024   useDigis             = pset.getUntrackedParameter<bool>("useDigis",true);
00025   useTrigger           = pset.getUntrackedParameter<bool>("useTrigger",false);
00026 
00027   // input tags for collections
00028   stripDigiTag  = pset.getParameter<edm::InputTag>("stripDigiTag");
00029   wireDigiTag   = pset.getParameter<edm::InputTag>("wireDigiTag"); 
00030   compDigiTag   = pset.getParameter<edm::InputTag>("compDigiTag");
00031   cscRecHitTag  = pset.getParameter<edm::InputTag>("cscRecHitTag");
00032   cscSegTag     = pset.getParameter<edm::InputTag>("cscSegTag");
00033   saMuonTag     = pset.getParameter<edm::InputTag>("saMuonTag");
00034   l1aTag        = pset.getParameter<edm::InputTag>("l1aTag");
00035   simHitTag     = pset.getParameter<edm::InputTag>("simHitTag");
00036 
00037   // flags to switch on/off individual modules
00038   makeOccupancyPlots   = pset.getUntrackedParameter<bool>("makeOccupancyPlots",true);
00039   makeStripPlots       = pset.getUntrackedParameter<bool>("makeStripPlots",true);
00040   makeWirePlots        = pset.getUntrackedParameter<bool>("makeWirePlots",true);
00041   makeRecHitPlots      = pset.getUntrackedParameter<bool>("makeRecHitPlots",true);
00042   makeSimHitPlots      = pset.getUntrackedParameter<bool>("makeSimHitPlots",true);
00043   makeSegmentPlots     = pset.getUntrackedParameter<bool>("makeSegmentPlots",true);
00044   makePedNoisePlots    = pset.getUntrackedParameter<bool>("makePedNoisePlots",true);
00045   makeEfficiencyPlots  = pset.getUntrackedParameter<bool>("makeEfficiencyPlots",true);
00046   makeGasGainPlots     = pset.getUntrackedParameter<bool>("makeGasGainPlots",true);
00047   makeAFEBTimingPlots  = pset.getUntrackedParameter<bool>("makeAFEBTimingPlots",true);
00048   makeCompTimingPlots  = pset.getUntrackedParameter<bool>("makeCompTimingPlots",true);
00049   makeADCTimingPlots   = pset.getUntrackedParameter<bool>("makeADCTimingPlots",true);
00050   makeRHNoisePlots     = pset.getUntrackedParameter<bool>("makeRHNoisePlots",false);
00051   makeCalibPlots       = pset.getUntrackedParameter<bool>("makeCalibPlots",false);
00052   makeTriggerPlots     = pset.getUntrackedParameter<bool>("makeTriggerPlots",false);
00053   makeStandalonePlots  = pset.getUntrackedParameter<bool>("makeStandalonePlots",false);
00054 
00055   // set counters to zero
00056   nEventsAnalyzed = 0;
00057   rhTreeCount = 0;
00058   segTreeCount = 0;
00059   
00060   // Create the root file for the histograms
00061   theFile = new TFile(rootFileName.c_str(), "RECREATE");
00062   theFile->cd();
00063 
00064   // Create object of class CSCValHists to manage histograms
00065   histos = new CSCValHists();
00066 
00067   // book Occupancy Histos
00068   hOWires    = new TH2I("hOWires","Wire Digi Occupancy",36,0.5,36.5,20,0.5,20.5);
00069   hOStrips   = new TH2I("hOStrips","Strip Digi Occupancy",36,0.5,36.5,20,0.5,20.5);
00070   hORecHits  = new TH2I("hORecHits","RecHit Occupancy",36,0.5,36.5,20,0.5,20.5);
00071   hOSegments = new TH2I("hOSegments","Segments Occupancy",36,0.5,36.5,20,0.5,20.5);
00072 
00073   // book Eff histos
00074   hSSTE = new TH1F("hSSTE","hSSTE",40,0,40);
00075   hRHSTE = new TH1F("hRHSTE","hRHSTE",40,0,40);
00076   hSEff = new TH1F("hSEff","Segment Efficiency",20,0.5,20.5);
00077   hRHEff = new TH1F("hRHEff","recHit Efficiency",20,0.5,20.5);
00078 
00079   const int nChambers = 36; 
00080   const int nTypes = 18;
00081   float nCH_min = 0.5;
00082   float nCh_max = float(nChambers) + 0.5;
00083   float nT_min = 0.5;
00084   float nT_max = float(nTypes) + 0.5;
00085 
00086   hSSTE2 = new TH2F("hSSTE2","hSSTE2",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
00087   hRHSTE2 = new TH2F("hRHSTE2","hRHSTE2",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
00088   hStripSTE2 = new TH2F("hStripSTE2","hStripSTE2",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
00089   hWireSTE2 = new TH2F("hWireSTE2","hWireSTE2",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
00090   
00091 
00092   hEffDenominator = new TH2F("hEffDenominator","hEffDenominator",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
00093   hSEff2 = new TH2F("hSEff2","Segment Efficiency 2D",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
00094   hRHEff2 = new TH2F("hRHEff2","recHit Efficiency 2D",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
00095 
00096   hStripEff2 = new TH2F("hStripEff2","strip Efficiency 2D",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
00097   hWireEff2 = new TH2F("hWireEff2","wire Efficiency 2D",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
00098 
00099   hSensitiveAreaEvt = new TH2F("hSensitiveAreaEvt","events in sensitive area",nChambers,nCH_min,nCh_max, nTypes, nT_min, nT_max);
00100  
00101   // setup trees to hold global position data for rechits and segments
00102   if (writeTreeToFile) histos->setupTrees();
00103 
00104 
00105 }

CSCValidation::~CSCValidation (  )  [virtual]

Destructor.

Definition at line 110 of file CSCValidation.cc.

References hEffDenominator, histoEfficiency(), histos, hORecHits, hOSegments, hOStrips, hOWires, hRHEff, hRHEff2, hRHSTE, hRHSTE2, hSEff, hSEff2, hSensitiveAreaEvt, hSSTE, hSSTE2, hStripEff2, hStripSTE2, hWireEff2, hWireSTE2, CSCValHists::insertPlot(), theFile, CSCValHists::writeHists(), CSCValHists::writeTrees(), and writeTreeToFile.

00110                              {
00111 
00112   // produce final efficiency histograms
00113   histoEfficiency(hRHSTE,hRHEff);
00114   histoEfficiency(hSSTE,hSEff);
00115   hSEff2->Divide(hSSTE2,hEffDenominator,1.,1.,"B");
00116   hRHEff2->Divide(hRHSTE2,hEffDenominator,1.,1.,"B");
00117   hStripEff2->Divide(hStripSTE2,hEffDenominator,1.,1.,"B");
00118   hWireEff2->Divide(hWireSTE2,hEffDenominator,1.,1.,"B");
00119 
00120   histos->insertPlot(hSEff,"hSEff","Efficiency");
00121   histos->insertPlot(hRHEff,"hRHEff","Efficiency");
00122 
00123   histos->insertPlot(hSEff2,"hSEff2","Efficiency");
00124   histos->insertPlot(hRHEff2,"hRHEff2","Efficiency");
00125   histos->insertPlot(hStripEff2,"hStripff2","Efficiency");
00126   histos->insertPlot(hWireEff2,"hWireff2","Efficiency");
00127   
00128   histos->insertPlot(hSensitiveAreaEvt,"","Efficiency");
00129 
00130   // throw in occupancy plots so they're saved
00131   histos->insertPlot(hOWires,"hOWires","Digis");
00132   histos->insertPlot(hOStrips,"hOStrips","Digis");
00133   histos->insertPlot(hORecHits,"hORecHits","recHits");
00134   histos->insertPlot(hOSegments,"hOSegments","Segments");
00135 
00136   
00137   // write histos to the specified file
00138   histos->writeHists(theFile);
00139   if (writeTreeToFile) histos->writeTrees(theFile);
00140   theFile->Close();
00141 
00142 }


Member Function Documentation

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

Perform the analysis.

Implements edm::EDAnalyzer.

Definition at line 147 of file CSCValidation.cc.

References compDigiTag, cscRecHitTag, cscSegments_cfi::cscSegments, cscSegTag, doADCTiming(), doAFEBTiming(), doCalibrations(), doCompTiming(), doEfficiencies(), doGasGain(), doNoiseHits(), doOccupancies(), doPedestalNoise(), doRecHits(), doSegments(), doSimHits(), doStandalone(), doStripDigis(), doTrigger(), doWireDigis(), edm::EventSetup::get(), isSimulation, l1aTag, makeADCTimingPlots, makeAFEBTimingPlots, makeCalibPlots, makeCompTimingPlots, makeEfficiencyPlots, makeGasGainPlots, makeOccupancyPlots, makePedNoisePlots, makeRecHitPlots, makeRHNoisePlots, makeSegmentPlots, makeSimHitPlots, makeStandalonePlots, makeStripPlots, makeTriggerPlots, makeWirePlots, nEventsAnalyzed, saMuonTag, trackerHits::simHits, simHitTag, stripDigiTag, useDigis, and wireDigiTag.

00147                                                                             {
00148   
00149   // increment counter
00150   nEventsAnalyzed++;
00151 
00152   //int iRun   = event.id().run();
00153   //int iEvent = event.id().event();
00154 
00155   // Get the Digis
00156   edm::Handle<CSCWireDigiCollection> wires;
00157   edm::Handle<CSCStripDigiCollection> strips;
00158   edm::Handle<CSCComparatorDigiCollection> compars;
00159   if (useDigis){
00160     event.getByLabel(stripDigiTag,strips);
00161     event.getByLabel(wireDigiTag,wires);
00162     event.getByLabel(compDigiTag,compars);
00163   }
00164 
00165   // Get the CSC Geometry :
00166   ESHandle<CSCGeometry> cscGeom;
00167   eventSetup.get<MuonGeometryRecord>().get(cscGeom);
00168 
00169   // Get the RecHits collection :
00170   Handle<CSCRecHit2DCollection> recHits;
00171   event.getByLabel(cscRecHitTag,recHits);
00172 
00173   // Get the SimHits (if applicable)
00174   Handle<PSimHitContainer> simHits;
00175   if (isSimulation) event.getByLabel(simHitTag, simHits);
00176 
00177   // get CSC segment collection
00178   Handle<CSCSegmentCollection> cscSegments;
00179   event.getByLabel(cscSegTag, cscSegments);
00180 
00181   // get the trigger collection
00182   edm::Handle<L1MuGMTReadoutCollection> pCollection;
00183   if (makeTriggerPlots){
00184     event.getByLabel(l1aTag,pCollection);
00185   }
00186 
00187   // get the standalone muon collection
00188   Handle<reco::TrackCollection> saMuons;
00189   if (makeStandalonePlots) event.getByLabel(saMuonTag,saMuons);
00190 
00191 
00192 
00194   // Run the modules //
00196 
00197   // Only do this for the first event
00198   if (nEventsAnalyzed == 1 && makeCalibPlots) doCalibrations(eventSetup);
00199 
00200   // Look at the l1a trigger info (returns true if csc L1A present)
00201   bool CSCL1A = false;
00202   if (makeTriggerPlots) CSCL1A = doTrigger(pCollection);
00203   
00204   // look at various chamber occupancies
00205   if (makeOccupancyPlots) doOccupancies(strips,wires,recHits,cscSegments);
00206 
00207   // general look at strip digis
00208   if (makeStripPlots && useDigis) doStripDigis(strips);
00209 
00210   // general look at wire digis
00211   if (makeWirePlots && useDigis) doWireDigis(wires);
00212 
00213   // general look at rechits
00214   if (makeRecHitPlots) doRecHits(recHits,strips,cscGeom);
00215 
00216   // look at simHits
00217   if (isSimulation && makeSimHitPlots) doSimHits(recHits,simHits);
00218 
00219   // general look at Segments
00220   if (makeSegmentPlots) doSegments(cscSegments,cscGeom);
00221 
00222   // look at Pedestal Noise
00223   if (makePedNoisePlots && useDigis) doPedestalNoise(strips);
00224   
00225   // look at recHit and segment efficiencies
00226   if (makeEfficiencyPlots) doEfficiencies(wires,strips, recHits, cscSegments,cscGeom);
00227 
00228   // gas gain
00229   if (makeGasGainPlots && useDigis) doGasGain(*wires,*strips,*recHits);
00230 
00231   // AFEB timing
00232   if (makeAFEBTimingPlots && useDigis) doAFEBTiming(*wires);
00233 
00234   // Comparators timing
00235   if (makeCompTimingPlots && useDigis) doCompTiming(*compars);
00236 
00237   // strip ADC timing
00238   if (makeADCTimingPlots && useDigis) doADCTiming(*strips,*recHits);
00239 
00240   // recHit Noise
00241   if (makeRHNoisePlots && useDigis) doNoiseHits(recHits,cscSegments,cscGeom,strips);
00242 
00243   // look at standalone muons (not implemented yet)
00244   if (makeStandalonePlots) doStandalone(saMuons);
00245 
00246 }

int CSCValidation::chamberSerial ( CSCDetId  id  )  [private]

Definition at line 996 of file CSCValidation.cc.

References st.

Referenced by doOccupancies(), doPedestalNoise(), doRecHits(), doSegments(), doWireDigis(), and getTiming().

00996                                               {
00997   int st = id.station();
00998   int ri = id.ring();
00999   int ch = id.chamber();
01000   int ec = id.endcap();
01001   int kSerial = ch;
01002   if (st == 1 && ri == 1) kSerial = ch;
01003   if (st == 1 && ri == 2) kSerial = ch + 36;
01004   if (st == 1 && ri == 3) kSerial = ch + 72;
01005   if (st == 1 && ri == 4) kSerial = ch;
01006   if (st == 2 && ri == 1) kSerial = ch + 108;
01007   if (st == 2 && ri == 2) kSerial = ch + 126;
01008   if (st == 3 && ri == 1) kSerial = ch + 162;
01009   if (st == 3 && ri == 2) kSerial = ch + 180;
01010   if (st == 4 && ri == 1) kSerial = ch + 216;
01011   if (st == 4 && ri == 2) kSerial = ch + 234;  // one day...
01012   if (ec == 2) kSerial = kSerial + 300;
01013   return kSerial;
01014 }

void CSCValidation::doADCTiming ( const CSCStripDigiCollection strpcltn,
const CSCRecHit2DCollection rechitcltn 
) [private]

Definition at line 2393 of file CSCValidation.cc.

References CSCIndexer::dbIndex(), GeomDetEnumerators::endcap, CSCValHists::fill2DHist(), getTiming(), histos, i, j, k, name, ss, indexGen::title, x, and y.

Referenced by analyze().

02394                                                                          {
02395      float  adc_3_3_sum,adc_3_3_wtbin,x,y;
02396      int cfeb,idchamber,ring;
02397 
02398      string name,title,endcapstr;
02399      ostringstream ss;
02400      std::vector<float> zer(6,0.0);
02401 
02402      CSCIndexer indexer;
02403      std::map<int,int>::iterator intIt;
02404 
02405      if(rechitcltn.begin() != rechitcltn.end()) {
02406 
02407   //   std::cout<<"Event "<<nEventsAnalyzed <<std::endl;
02408 
02409        // Looping thru rechit collection
02410        CSCRecHit2DCollection::const_iterator recIt;
02411        CSCRecHit2D::ADCContainer m_adc;
02412        CSCRecHit2D::ChannelContainer m_strip;
02413        for(recIt = rechitcltn.begin(); recIt != rechitcltn.end(); ++recIt) {
02414           CSCDetId id = (CSCDetId)(*recIt).cscDetId();
02415           // getting strips comprising rechit
02416           m_strip=(CSCRecHit2D::ChannelContainer)(*recIt).channels();
02417           if(m_strip.size()==3) {
02418             // get 3X3 ADC Sum
02419             m_adc=(CSCRecHit2D::ADCContainer)(*recIt).adcs();
02420             std::vector<float> adc_left,adc_center,adc_right;
02421             int binmx=0;
02422             float adcmax=0.0;
02423             unsigned k=0;
02424               
02425             for(int i=0;i<3;i++)
02426                for(int j=0;j<4;j++){
02427                   if(m_adc[k]>adcmax) {adcmax=m_adc[k]; binmx=j;}
02428                   if(i==0) adc_left.push_back(m_adc[k]);
02429                   if(i==1) adc_center.push_back(m_adc[k]);
02430                   if(i==2) adc_right.push_back(m_adc[k]);
02431                   k=k+1;
02432                }
02433 
02434                adc_3_3_sum=0.0;
02435                for(int j=binmx-1;j<=binmx+1;j++) { 
02436                   adc_3_3_sum=adc_3_3_sum+adc_left[j]
02437                                           +adc_center[j]
02438                                           +adc_right[j];
02439                }
02440 
02441                 // ADC weighted time bin
02442                 if(adc_3_3_sum > 100.0) {
02443                   
02444                   int centerStrip=m_strip[1]; //take central from 3 strips;
02445                 // temporary fix
02446                   int flag=0;
02447                   if(id.station()==1 && id.ring()==4 &&  centerStrip>16) flag=1;
02448                 // end of temporary fix
02449                   if(flag==0) {
02450                   adc_3_3_wtbin=getTiming(strpcltn, id, centerStrip);
02451                   idchamber=indexer.dbIndex(id, centerStrip)/10; //strips 1-16 ME1/1a
02452                                               // become strips 65-80 ME1/1 !!!
02453                   /*
02454                   if(id.station()==1 && (id.ring()==1 || id.ring()==4))
02455                   std::cout<<idchamber<<" "<<id.station()<<" "<<id.ring()<<" "<<m_strip[1]<<" "<<
02456                       "      "<<centerStrip<<
02457                          " "<<adc_3_3_wtbin<<"     "<<adc_3_3_sum<<std::endl;    
02458                   */      
02459                  ss<<"adc_3_3_weight_time_bin_vs_cfeb_occupancy_ME_"<<idchamber;
02460                  name=ss.str(); ss.str("");
02461 
02462                  string endcapstr;
02463                  if(id.endcap() == 1) endcapstr = "+";
02464                  if(id.endcap() == 2) endcapstr = "-";
02465                  ring=id.ring(); if(id.ring()==4) ring=1;
02466                  ss<<"ADC 3X3 Weighted Time Bin vs CFEB Occupancy ME"
02467                    <<endcapstr<<id.station()<<"/"<<ring<<"/"<<id.chamber();
02468                  title=ss.str(); ss.str("");
02469 
02470                  cfeb=(centerStrip-1)/16+1;
02471                  x=cfeb; y=adc_3_3_wtbin;
02472                  histos->fill2DHist(x,y,name.c_str(),title.c_str(),5,1.,6.,40,0.,8.,"ADCTiming");                                     
02473                  } // end of if flag==0
02474                 } // end of if (adc_3_3_sum > 100.0)
02475             } // end of if if(m_strip.size()==3
02476        } // end of the  pass thru CSCRecHit2DCollection
02477      }  // end of if (rechitcltn.begin() != rechitcltn.end())
02478 }

void CSCValidation::doAFEBTiming ( const CSCWireDigiCollection wirecltn  )  [private]

Definition at line 2266 of file CSCValidation.cc.

References CSCIndexer::dbIndex(), GeomDetEnumerators::endcap, CSCValHists::fill2DHist(), histos, name, range, ss, indexGen::title, x, and y.

Referenced by analyze().

02266                                                                       {
02267      ostringstream ss;
02268      string name,title,endcapstr;
02269      float x,y;
02270      int wire,wiretbin,nmbwiretbin,layer,afeb,idlayer,idchamber;
02271      int channel=0; // for  CSCIndexer::dbIndex(id, channel); irrelevant here
02272      CSCIndexer indexer;
02273 
02274      if(wirecltn.begin() != wirecltn.end())  {
02275 
02276        //std::cout<<std::endl;
02277        //std::cout<<"Event "<<nEventsAnalyzed<<std::endl;
02278        //std::cout<<std::endl;
02279 
02280        // cycle on wire collection for all CSC
02281        CSCWireDigiCollection::DigiRangeIterator wiredetUnitIt;
02282        for(wiredetUnitIt=wirecltn.begin();wiredetUnitIt!=wirecltn.end();
02283           ++wiredetUnitIt) {
02284           const CSCDetId id = (*wiredetUnitIt).first;
02285           idlayer=indexer.dbIndex(id, channel);
02286           idchamber=idlayer/10;
02287           layer=id.layer();
02288 
02289           if (id.endcap() == 1) endcapstr = "+";
02290           if (id.endcap() == 2) endcapstr = "-";
02291 
02292           // looping in the layer of given CSC
02293  
02294           const CSCWireDigiCollection::Range& range = (*wiredetUnitIt).second;
02295           for(CSCWireDigiCollection::const_iterator digiIt =
02296              range.first; digiIt!=range.second; ++digiIt){
02297              wire=(*digiIt).getWireGroup();
02298              wiretbin=(*digiIt).getTimeBin();
02299              nmbwiretbin=(*digiIt).getTimeBinsOn().size();
02300              afeb=3*((wire-1)/8)+(layer+1)/2;
02301              
02302              // Anode wire group time bin vs afeb for each CSC
02303              x=afeb;
02304              y=wiretbin;
02305              ss<<"afeb_time_bin_vs_afeb_occupancy_ME_"<<idchamber;
02306              name=ss.str(); ss.str("");
02307              ss<<"Time Bin vs AFEB Occupancy ME"<<endcapstr<<id.station()<<"/"<<id.ring()<<"/"<< id.chamber();
02308              title=ss.str(); ss.str("");
02309              histos->fill2DHist(x,y,name.c_str(),title.c_str(),42,1.,43.,16,0.,16.,"AFEBTiming");
02310 
02311              // Number of anode wire group time bin vs afeb for each CSC
02312              x=afeb;
02313              y=nmbwiretbin;
02314              ss<<"nmb_afeb_time_bins_vs_afeb_ME_"<<idchamber;
02315              name=ss.str(); ss.str("");
02316              ss<<"Number of Time Bins vs AFEB ME"<<endcapstr<<id.station()<<"/"<<id.ring()<<"/"<< id.chamber();
02317              title=ss.str(); 
02318              ss.str("");
02319              histos->fill2DHist(x,y,name.c_str(),title.c_str(),42,1.,43.,16,0.,16.,"AFEBTiming");
02320              
02321           }     // end of digis loop in layer
02322        } // end of wire collection loop
02323      } // end of      if(wirecltn.begin() != wirecltn.end())
02324 }

void CSCValidation::doCalibrations ( const edm::EventSetup eventSetup  )  [private]

Definition at line 478 of file CSCValidation.cc.

References CSCDBCrosstalk::crosstalk, CSCValHists::fillCalibHist(), CSCDBGains::gains, edm::EventSetup::get(), histos, i, LogDebug, CSCDBNoiseMatrix::matrix, nEventsAnalyzed, CSCDBPedestals::pedestals, and edm::ESHandle< T >::product().

Referenced by analyze().

00478                                                                  {
00479 
00480   // Only do this for the first event
00481   if (nEventsAnalyzed == 1){
00482 
00483     LogDebug("Calibrations") << "Loading Calibrations...";
00484 
00485     // get the gains
00486     edm::ESHandle<CSCDBGains> hGains;
00487     eventSetup.get<CSCDBGainsRcd>().get( hGains );
00488     const CSCDBGains* pGains = hGains.product();
00489     // get the crosstalks
00490     edm::ESHandle<CSCDBCrosstalk> hCrosstalk;
00491     eventSetup.get<CSCDBCrosstalkRcd>().get( hCrosstalk );
00492     const CSCDBCrosstalk* pCrosstalk = hCrosstalk.product();
00493     // get the noise matrix
00494     edm::ESHandle<CSCDBNoiseMatrix> hNoiseMatrix;
00495     eventSetup.get<CSCDBNoiseMatrixRcd>().get( hNoiseMatrix );
00496     const CSCDBNoiseMatrix* pNoiseMatrix = hNoiseMatrix.product();
00497     // get pedestals
00498     edm::ESHandle<CSCDBPedestals> hPedestals;
00499     eventSetup.get<CSCDBPedestalsRcd>().get( hPedestals );
00500     const CSCDBPedestals* pPedestals = hPedestals.product();
00501 
00502     LogDebug("Calibrations") << "Calibrations Loaded!";
00503 
00504     for (int i = 0; i < 400; i++){
00505       int bin = i+1;
00506       histos->fillCalibHist(pGains->gains[i].gain_slope,"hCalibGainsS","Gains Slope",400,0,400,bin,"Calib");
00507       histos->fillCalibHist(pCrosstalk->crosstalk[i].xtalk_slope_left,"hCalibXtalkSL","Xtalk Slope Left",400,0,400,bin,"Calib");
00508       histos->fillCalibHist(pCrosstalk->crosstalk[i].xtalk_slope_right,"hCalibXtalkSR","Xtalk Slope Right",400,0,400,bin,"Calib");
00509       histos->fillCalibHist(pCrosstalk->crosstalk[i].xtalk_intercept_left,"hCalibXtalkIL","Xtalk Intercept Left",400,0,400,bin,"Calib");
00510       histos->fillCalibHist(pCrosstalk->crosstalk[i].xtalk_intercept_right,"hCalibXtalkIR","Xtalk Intercept Right",400,0,400,bin,"Calib");
00511       histos->fillCalibHist(pPedestals->pedestals[i].ped,"hCalibPedsP","Peds",400,0,400,bin,"Calib");
00512       histos->fillCalibHist(pPedestals->pedestals[i].rms,"hCalibPedsR","Peds RMS",400,0,400,bin,"Calib");
00513       histos->fillCalibHist(pNoiseMatrix->matrix[i].elem33,"hCalibNoise33","Noise Matrix 33",400,0,400,bin,"Calib");
00514       histos->fillCalibHist(pNoiseMatrix->matrix[i].elem34,"hCalibNoise34","Noise Matrix 34",400,0,400,bin,"Calib");
00515       histos->fillCalibHist(pNoiseMatrix->matrix[i].elem35,"hCalibNoise35","Noise Matrix 35",400,0,400,bin,"Calib");
00516       histos->fillCalibHist(pNoiseMatrix->matrix[i].elem44,"hCalibNoise44","Noise Matrix 44",400,0,400,bin,"Calib");
00517       histos->fillCalibHist(pNoiseMatrix->matrix[i].elem45,"hCalibNoise45","Noise Matrix 45",400,0,400,bin,"Calib");
00518       histos->fillCalibHist(pNoiseMatrix->matrix[i].elem46,"hCalibNoise46","Noise Matrix 46",400,0,400,bin,"Calib");
00519       histos->fillCalibHist(pNoiseMatrix->matrix[i].elem55,"hCalibNoise55","Noise Matrix 55",400,0,400,bin,"Calib");
00520       histos->fillCalibHist(pNoiseMatrix->matrix[i].elem56,"hCalibNoise56","Noise Matrix 56",400,0,400,bin,"Calib");
00521       histos->fillCalibHist(pNoiseMatrix->matrix[i].elem57,"hCalibNoise57","Noise Matrix 57",400,0,400,bin,"Calib");
00522       histos->fillCalibHist(pNoiseMatrix->matrix[i].elem66,"hCalibNoise66","Noise Matrix 66",400,0,400,bin,"Calib");
00523       histos->fillCalibHist(pNoiseMatrix->matrix[i].elem67,"hCalibNoise67","Noise Matrix 67",400,0,400,bin,"Calib");
00524       histos->fillCalibHist(pNoiseMatrix->matrix[i].elem77,"hCalibNoise77","Noise Matrix 77",400,0,400,bin,"Calib");
00525 
00526  
00527     }
00528 
00529   }
00530 
00531 
00532 }

void CSCValidation::doCompTiming ( const CSCComparatorDigiCollection compars  )  [private]

Definition at line 2331 of file CSCValidation.cc.

References CSCIndexer::dbIndex(), GeomDetEnumerators::endcap, CSCValHists::fill2DHist(), histos, name, range, ss, strip(), indexGen::title, x, and y.

Referenced by analyze().

02331                                                                            {
02332 
02333      ostringstream ss;      string name,title,endcap;
02334      float x,y;
02335      int strip,tbin,layer,cfeb,idlayer,idchamber,idum;
02336      int channel=0; // for  CSCIndexer::dbIndex(id, channel); irrelevant here
02337      CSCIndexer indexer;
02338                                                                                 
02339      if(compars.begin() != compars.end())  {
02340                                                                                 
02341        //std::cout<<std::endl;
02342        //std::cout<<"Event "<<nEventsAnalyzed<<std::endl;
02343        //std::cout<<std::endl;
02344                                                                                 
02345        // cycle on comparators collection for all CSC
02346        CSCComparatorDigiCollection::DigiRangeIterator compdetUnitIt;
02347        for(compdetUnitIt=compars.begin();compdetUnitIt!=compars.end();
02348           ++compdetUnitIt) {
02349           const CSCDetId id = (*compdetUnitIt).first;
02350           idlayer=indexer.dbIndex(id, channel); // channel irrelevant here
02351           idchamber=idlayer/10;
02352           layer=id.layer();
02353                                                                                 
02354           if (id.endcap() == 1) endcap = "+";
02355           if (id.endcap() == 2) endcap = "-";
02356           // looping in the layer of given CSC
02357           const CSCComparatorDigiCollection::Range& range = 
02358           (*compdetUnitIt).second;
02359           for(CSCComparatorDigiCollection::const_iterator digiIt =
02360              range.first; digiIt!=range.second; ++digiIt){
02361              strip=(*digiIt).getStrip();
02362           /*
02363           if(id.station()==1 && (id.ring()==1 || id.ring()==4))
02364              std::cout<<idchamber<<" "<<id.station()<<" "<<id.ring()<<" "
02365                       <<strip <<std::endl;  
02366           */
02367              idum=indexer.dbIndex(id, strip); // strips 1-16 of ME1/1a 
02368                                               // become strips 65-80 of ME1/1 
02369              tbin=(*digiIt).getTimeBin();
02370              cfeb=(strip-1)/16+1;
02371                                                                                 
02372              // time bin vs cfeb for each CSC
02373 
02374              x=cfeb;
02375              y=tbin;
02376              ss<<"comp_time_bin_vs_cfeb_occupancy_ME_"<<idchamber;
02377              name=ss.str(); ss.str("");
02378              ss<<"Comparator Time Bin vs CFEB Occupancy ME"<<endcap<<
02379                  id.station()<<"/"<< id.ring()<<"/"<< id.chamber();             
02380              title=ss.str(); ss.str("");
02381              histos->fill2DHist(x,y,name.c_str(),title.c_str(),5,1.,6.,16,0.,16.,"CompTiming");
02382 
02383          }     // end of digis loop in layer
02384        } // end of collection loop
02385      } // end of      if(compars.begin() !=compars.end())
02386 }

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 1131 of file CSCValidation.cc.

References CSCDetId::chamber(), CSCChamberSpecs::chamberTypeName(), diff, CSCDetId::endcap(), extrapolate1D(), first, CSCLayer::geometry(), hEffDenominator, hRHSTE, hRHSTE2, hSensitiveAreaEvt, hSSTE, hSSTE2, hStripSTE2, hWireSTE2, CSCChamber::id(), int, it, CSCDetId::layer(), CSCChamber::layer(), lineParametrization(), CSCSegment::localDirection(), CSCSegment::localPosition(), TrapezoidalPlaneBounds::parameters(), CSCDetId::ring(), seg, CSCChamber::specs(), CSCDetId::station(), dimuonsSequences_cff::threshold, GeomDet::toGlobal(), GeomDet::toLocal(), useDigis, weight, withinSensitiveRegion(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by analyze().

01133                                                                     {
01134 
01135   bool allWires[2][4][4][36][6];
01136   bool allStrips[2][4][4][36][6];
01137   bool AllRecHits[2][4][4][36][6];
01138   bool AllSegments[2][4][4][36];
01139   
01140   //bool MultiSegments[2][4][4][36];
01141   for(int iE = 0;iE<2;iE++){
01142     for(int iS = 0;iS<4;iS++){
01143       for(int iR = 0; iR<4;iR++){
01144         for(int iC =0;iC<36;iC++){
01145           AllSegments[iE][iS][iR][iC] = false;
01146           //MultiSegments[iE][iS][iR][iC] = false;
01147           for(int iL=0;iL<6;iL++){
01148             allWires[iE][iS][iR][iC][iL] = false;
01149             allStrips[iE][iS][iR][iC][iL] = false;
01150             AllRecHits[iE][iS][iR][iC][iL] = false;
01151           }
01152         }
01153       }
01154     }
01155   }
01156   
01157   if (useDigis){
01158     // Wires
01159     for (CSCWireDigiCollection::DigiRangeIterator dWDiter=wires->begin(); dWDiter!=wires->end(); dWDiter++) {
01160       CSCDetId idrec = (CSCDetId)(*dWDiter).first;
01161       std::vector<CSCWireDigi>::const_iterator wireIter = (*dWDiter).second.first;
01162       std::vector<CSCWireDigi>::const_iterator lWire = (*dWDiter).second.second;
01163       for( ; wireIter != lWire; ++wireIter) {
01164         allWires[idrec.endcap() -1][idrec.station() -1][idrec.ring() -1][idrec.chamber() -1][idrec.layer() -1] = true;
01165         break;
01166       }
01167     }
01168 
01169     //---- STRIPS
01170     for (CSCStripDigiCollection::DigiRangeIterator dSDiter=strips->begin(); dSDiter!=strips->end(); dSDiter++) {
01171       CSCDetId idrec = (CSCDetId)(*dSDiter).first;
01172       std::vector<CSCStripDigi>::const_iterator stripIter = (*dSDiter).second.first;
01173       std::vector<CSCStripDigi>::const_iterator lStrip = (*dSDiter).second.second;
01174       for( ; stripIter != lStrip; ++stripIter) {
01175         std::vector<int> myADCVals = stripIter->getADCCounts();
01176         bool thisStripFired = false;
01177         float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
01178         float threshold = 13.3 ;
01179         float diff = 0.;
01180         for (unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
01181           diff = (float)myADCVals[iCount]-thisPedestal;
01182           if (diff > threshold) {
01183             thisStripFired = true;
01184             break;
01185           }
01186         }
01187         if(thisStripFired){
01188           allStrips[idrec.endcap() -1][idrec.station() -1][idrec.ring() -1][idrec.chamber() -1][idrec.layer() -1] = true;
01189           break;
01190         }
01191       }
01192     }
01193   }
01194 
01195   // Rechits
01196   for (CSCRecHit2DCollection::const_iterator recEffIt = recHits->begin(); recEffIt != recHits->end(); recEffIt++) {
01197     //CSCDetId idrec = (CSCDetId)(*recIt).cscDetId();
01198     CSCDetId  idrec = (CSCDetId)(*recEffIt).cscDetId();
01199     AllRecHits[idrec.endcap() -1][idrec.station() -1][idrec.ring() -1][idrec.chamber() -1][idrec.layer() -1] = true;
01200 
01201   }
01202 
01203   std::vector <uint> seg_ME2(2,0) ;
01204   std::vector <uint> seg_ME3(2,0) ;
01205   std::vector < pair <CSCDetId, CSCSegment> > theSegments(4);
01206   // Segments
01207   for(CSCSegmentCollection::const_iterator segEffIt=cscSegments->begin(); segEffIt != cscSegments->end(); segEffIt++) {
01208     CSCDetId idseg  = (CSCDetId)(*segEffIt).cscDetId();
01209     //if(AllSegments[idrec.endcap() -1][idrec.station() -1][idrec.ring() -1][idrec.chamber()]){
01210     //MultiSegments[idrec.endcap() -1][idrec.station() -1][idrec.ring() -1][idrec.chamber()] = true;
01211     //}
01212     AllSegments[idseg.endcap() -1][idseg.station() -1][idseg.ring() -1][idseg.chamber() -1] = true;
01213     // "Intrinsic" efficiency measurement relies on "good" segment extrapolation - we need the pre-selection below
01214     // station 2 "good" segment will be used for testing efficiencies in ME1 and ME3
01215     // station 3 "good" segment will be used for testing efficiencies in ME2 and ME4
01216     if(2==idseg.station() || 3==idseg.station()){
01217       uint seg_tmp ; 
01218       if(2==idseg.station()){
01219         ++seg_ME2[idseg.endcap() -1];
01220         seg_tmp = seg_ME2[idseg.endcap() -1];
01221       }
01222       else{
01223         ++seg_ME3[idseg.endcap() -1];
01224         seg_tmp = seg_ME3[idseg.endcap() -1];
01225       }
01226       // is the segment good
01227       if(1== seg_tmp&& 6==(*segEffIt).nRecHits() && (*segEffIt).chi2()/(*segEffIt).degreesOfFreedom()<3.){
01228         pair <CSCDetId, CSCSegment> specSeg = make_pair( (CSCDetId)(*segEffIt).cscDetId(),*segEffIt);
01229         theSegments[2*(idseg.endcap()-1)+(idseg.station() -2)] = specSeg;
01230       }
01231     }
01232     /*
01233     if(2==idseg.station()){
01234         ++seg_ME2[idseg.endcap() -1];
01235        if(1==seg_ME2[idseg.endcap() -1] && 6==(*segEffIt).nRecHits() && (*segEffIt).chi2()/(*segEffIt).degreesOfFreedom()<3.){
01236            pair <CSCDetId, CSCSegment> specSeg = make_pair( (CSCDetId)(*segEffIt).cscDetId(),*segEffIt);
01237            theSegments[2*(idseg.endcap()-1)+(idseg.station() -2)] = specSeg;
01238        }
01239     }
01240     else if(3==idseg.station()){
01241         ++seg_ME3[idseg.endcap() -1];
01242         if(1==seg_ME3[idseg.endcap() -1] && 6==(*segEffIt).nRecHits() && (*segEffIt).chi2()/(*segEffIt).degreesOfFreedom()<3.){
01243          pair <CSCDetId, CSCSegment> specSeg = make_pair( (CSCDetId)(*segEffIt).cscDetId(),*segEffIt);
01244          theSegments[2*(idseg.endcap()-1)+(idseg.station() -2)] = specSeg;
01245        }
01246     }
01247     */
01248     
01249   }
01250   // Simple efficiency calculations
01251   for(int iE = 0;iE<2;iE++){
01252     for(int iS = 0;iS<4;iS++){
01253       for(int iR = 0; iR<4;iR++){
01254         for(int iC =0;iC<36;iC++){
01255           int NumberOfLayers = 0;
01256           for(int iL=0;iL<6;iL++){
01257             if(AllRecHits[iE][iS][iR][iC][iL]){
01258               NumberOfLayers++;
01259             }
01260           }
01261           int bin = 0;
01262           if (iS==0) bin = iR+1+(iE*10);
01263           else bin = (iS+1)*2 + (iR+1) + (iE*10);
01264           if(NumberOfLayers>1){
01265             //if(!(MultiSegments[iE][iS][iR][iC])){
01266             if(AllSegments[iE][iS][iR][iC]){
01267               //---- Efficient segment evenents
01268               hSSTE->AddBinContent(bin);
01269             }
01270             //---- All segment events (normalization)
01271             hSSTE->AddBinContent(20+bin);
01272             //}
01273           }
01274           if(AllSegments[iE][iS][iR][iC]){
01275             if(NumberOfLayers==6){
01276               //---- Efficient rechit events
01277               hRHSTE->AddBinContent(bin);;
01278             }
01279             //---- All rechit events (normalization)
01280             hRHSTE->AddBinContent(20+bin);;
01281           }
01282         }
01283       }
01284     }
01285   }
01286 
01287 // pick a segment only if there are no others in the station
01288   std::vector < pair <CSCDetId, CSCSegment> * > theSeg;
01289   if(1==seg_ME2[0]) theSeg.push_back(&theSegments[0]);
01290   if(1==seg_ME3[0]) theSeg.push_back(&theSegments[1]);
01291   if(1==seg_ME2[1]) theSeg.push_back(&theSegments[2]);
01292   if(1==seg_ME3[1]) theSeg.push_back(&theSegments[3]);
01293 
01294   // Needed for plots
01295   // at the end the chamber types will be numbered as 1 to 18 
01296   // (ME-4/1, -ME3/2, -ME3/1, ..., +ME3/1, +ME3/2, ME+4/1 ) 
01297   std::map <std::string, float> chamberTypes;
01298   chamberTypes["ME1/a"] = 0.5;
01299   chamberTypes["ME1/b"] = 1.5;
01300   chamberTypes["ME1/2"] = 2.5;
01301   chamberTypes["ME1/3"] = 3.5;
01302   chamberTypes["ME2/1"] = 4.5;
01303   chamberTypes["ME2/2"] = 5.5;
01304   chamberTypes["ME3/1"] = 6.5;
01305   chamberTypes["ME3/2"] = 7.5;
01306   chamberTypes["ME4/1"] = 8.5;
01307 
01308   if(theSeg.size()){
01309     std::map <int , GlobalPoint> extrapolatedPoint;
01310     std::map <int , GlobalPoint>::iterator it;
01311     const std::vector<CSCChamber*> ChamberContainer = cscGeom->chambers();
01312     // Pick which chamber with which segment to test
01313     for(unsigned int nCh=0;nCh<ChamberContainer.size();nCh++){
01314       const CSCChamber *cscchamber = ChamberContainer[nCh];
01315       pair <CSCDetId, CSCSegment> * thisSegment = 0;
01316       for(uint iSeg =0;iSeg<theSeg.size();++iSeg ){
01317         if(cscchamber->id().endcap() == theSeg[iSeg]->first.endcap()){ 
01318           if(1==cscchamber->id().station() || 3==cscchamber->id().station() ){
01319             if(2==theSeg[iSeg]->first.station()){
01320               thisSegment = theSeg[iSeg];
01321             }
01322           }
01323           else if (2==cscchamber->id().station() || 4==cscchamber->id().station()){
01324             if(3==theSeg[iSeg]->first.station()){
01325               thisSegment = theSeg[iSeg];
01326             }
01327           }
01328         }
01329       }
01330       // this chamber is to be tested with thisSegment
01331       if(thisSegment){
01332         CSCSegment * seg = &(thisSegment->second);
01333         const CSCChamber *segChamber = cscGeom->chamber(thisSegment->first);
01334         LocalPoint localCenter(0.,0.,0);
01335         GlobalPoint cscchamberCenter =  cscchamber->toGlobal(localCenter);
01336         // try to save some time (extrapolate a segment to a certain position only once)
01337         it = extrapolatedPoint.find(int(cscchamberCenter.z()));
01338         if(it==extrapolatedPoint.end()){
01339           GlobalPoint segPos = segChamber->toGlobal(seg->localPosition());
01340           GlobalVector segDir = segChamber->toGlobal(seg->localDirection());
01341           double paramaterLine = lineParametrization(segPos.z(),cscchamberCenter.z() , segDir.z());
01342           double xExtrapolated = extrapolate1D(segPos.x(),segDir.x(), paramaterLine);
01343           double yExtrapolated = extrapolate1D(segPos.y(),segDir.y(), paramaterLine);
01344           GlobalPoint globP (xExtrapolated, yExtrapolated, cscchamberCenter.z());
01345           extrapolatedPoint[int(cscchamberCenter.z())] = globP;
01346         }
01347         // Where does the extrapolated point lie in the (tested) chamber local frame? Here: 
01348         LocalPoint extrapolatedPointLocal = cscchamber->toLocal(extrapolatedPoint[int(cscchamberCenter.z())]);
01349         const CSCLayer *layer_p = cscchamber->layer(1);//layer 1
01350         const CSCLayerGeometry *layerGeom = layer_p->geometry ();
01351         const std::vector<float> layerBounds = layerGeom->parameters ();
01352         float shiftFromEdge = 15.;//cm
01353         float shiftFromDeadZone = 10.;
01354         // is the extrapolated point within a sensitive region
01355         bool pass = withinSensitiveRegion(extrapolatedPointLocal, layerBounds, 
01356                                           cscchamber->id().station(), cscchamber->id().ring(), 
01357                                           shiftFromEdge, shiftFromDeadZone);
01358         if(pass){// the extrapolation point of the segment lies within sensitive region of that chamber
01359           // how many rechit layers are there in the chamber?
01360           // 0 - maybe the muon died or is deflected at large angle? do not use that case
01361           // 1 - could be noise...
01362           // 2 or more - this is promissing; this is our definition of a reliable signal; use it below
01363           // is other definition better? 
01364           int nRHLayers = 0;
01365           for(int iL =0;iL<6;++iL){
01366             if(AllRecHits[cscchamber->id().endcap()-1]
01367                [cscchamber->id().station()-1]
01368                [cscchamber->id().ring()-1][cscchamber->id().chamber()-1][iL]){
01369               ++nRHLayers;
01370             }
01371           }
01372           //std::cout<<" nRHLayers = "<<nRHLayers<<std::endl;
01373           float verticalScale = chamberTypes[cscchamber->specs()->chamberTypeName()];
01374           if(cscchamberCenter.z()<0){
01375             verticalScale = - verticalScale;
01376           } 
01377           verticalScale +=9.5;
01378           hSensitiveAreaEvt->Fill(float(cscchamber->id().chamber()),verticalScale);
01379           if(nRHLayers>1){// this chamber contains a reliable signal
01380             //chamberTypes[cscchamber->specs()->chamberTypeName()];
01381             // "intrinsic" efficiencies
01382             //std::cout<<" verticalScale = "<<verticalScale<<" chType = "<<cscchamber->specs()->chamberTypeName()<<std::endl;
01383             // this is the denominator forr all efficiencies
01384             hEffDenominator->Fill(float(cscchamber->id().chamber()),verticalScale);
01385             // Segment efficiency
01386             if(AllSegments[cscchamber->id().endcap()-1]
01387                [cscchamber->id().station()-1]
01388                [cscchamber->id().ring()-1][cscchamber->id().chamber()-1]){
01389               hSSTE2->Fill(float(cscchamber->id().chamber()),float(verticalScale));
01390             }
01391           
01392             for(int iL =0;iL<6;++iL){
01393               float weight = 1./6.;
01394               // one shold account for the weight in the efficiency...
01395               // Rechit efficiency
01396               if(AllRecHits[cscchamber->id().endcap()-1]
01397                  [cscchamber->id().station()-1]
01398                  [cscchamber->id().ring()-1][cscchamber->id().chamber()-1][iL]){
01399                 hRHSTE2->Fill(float(cscchamber->id().chamber()),float(verticalScale),weight);
01400               }
01401               if (useDigis){
01402                 // Wire efficiency
01403                 if(allWires[cscchamber->id().endcap()-1]
01404                   [cscchamber->id().station()-1]
01405                   [cscchamber->id().ring()-1][cscchamber->id().chamber()-1][iL]){
01406                   // one shold account for the weight in the efficiency...
01407                   hWireSTE2->Fill(float(cscchamber->id().chamber()),float(verticalScale),weight);
01408                 }
01409                 // Strip efficiency
01410                 if(allStrips[cscchamber->id().endcap()-1]
01411                   [cscchamber->id().station()-1]
01412                   [cscchamber->id().ring()-1][cscchamber->id().chamber()-1][iL]){
01413                   // one shold account for the weight in the efficiency...
01414                   hStripSTE2->Fill(float(cscchamber->id().chamber()),float(verticalScale),weight);
01415                 }
01416               }
01417             }
01418           }
01419         }
01420       }
01421     }
01422   }
01423   //
01424   
01425   
01426 }

void CSCValidation::doGasGain ( const CSCWireDigiCollection wirecltn,
const CSCStripDigiCollection strpcltn,
const CSCRecHit2DCollection rechitcltn 
) [private]

Definition at line 2023 of file CSCValidation.cc.

References CSCIndexer::dbIndex(), GeomDetEnumerators::endcap, CSCValHists::fill2DHist(), histos, i, id, j, k, m_single_wire_layer, m_wire_hvsegm, VarParsing::mult, name, nEventsAnalyzed, nmbhvsegm, range, ss, indexGen::title, x, and y.

Referenced by analyze().

02025                                                                        {
02026      float y;
02027      int channel=0,mult,wire,layer,idlayer,idchamber,ring;
02028      int wire_strip_rechit_present;
02029      string name,title,endcapstr;
02030      ostringstream ss;
02031      CSCIndexer indexer;
02032      std::map<int,int>::iterator intIt;
02033 
02034      m_single_wire_layer.clear();
02035 
02036   if(nEventsAnalyzed==1) {
02037 
02038   // HV segments, their # and location in terms of wire groups
02039 
02040   m_wire_hvsegm.clear();
02041   std::map<int,std::vector<int> >::iterator intvecIt;
02042   //                    ME1a ME1b ME1/2 ME1/3 ME2/1 ME2/2 ME3/1 ME3/2 ME4/1 ME4/2 
02043   int csctype[10]=     {1,   2,   3,    4,    5,    6,    7,    8,    9,    10};
02044   int hvsegm_layer[10]={1,   1,   3,    3,    3,    5,    3,    5,    3,    5};
02045   int id;
02046   nmbhvsegm.clear();
02047   for(int i=0;i<10;i++) nmbhvsegm.push_back(hvsegm_layer[i]);
02048   // For ME1/1a
02049   std::vector<int> zer_1_1a(49,0);
02050   id=csctype[0];
02051   if(m_wire_hvsegm.find(id) == m_wire_hvsegm.end()) m_wire_hvsegm[id]=zer_1_1a;
02052   intvecIt=m_wire_hvsegm.find(id);
02053   for(int wire=1;wire<=48;wire++)  intvecIt->second[wire]=1;  // Segment 1
02054 
02055   // For ME1/1b
02056   std::vector<int> zer_1_1b(49,0);
02057   id=csctype[1];
02058   if(m_wire_hvsegm.find(id) == m_wire_hvsegm.end()) m_wire_hvsegm[id]=zer_1_1b;
02059   intvecIt=m_wire_hvsegm.find(id);
02060   for(int wire=1;wire<=48;wire++)  intvecIt->second[wire]=1;  // Segment 1
02061  
02062   // For ME1/2
02063   std::vector<int> zer_1_2(65,0);
02064   id=csctype[2];
02065   if(m_wire_hvsegm.find(id) == m_wire_hvsegm.end()) m_wire_hvsegm[id]=zer_1_2;
02066   intvecIt=m_wire_hvsegm.find(id);
02067   for(int wire=1;wire<=24;wire++)  intvecIt->second[wire]=1;  // Segment 1
02068   for(int wire=25;wire<=48;wire++) intvecIt->second[wire]=2;  // Segment 2
02069   for(int wire=49;wire<=64;wire++) intvecIt->second[wire]=3;  // Segment 3
02070  
02071   // For ME1/3
02072   std::vector<int> zer_1_3(33,0);
02073   id=csctype[3];
02074   if(m_wire_hvsegm.find(id) == m_wire_hvsegm.end()) m_wire_hvsegm[id]=zer_1_3;
02075   intvecIt=m_wire_hvsegm.find(id);
02076   for(int wire=1;wire<=12;wire++)  intvecIt->second[wire]=1;  // Segment 1
02077   for(int wire=13;wire<=22;wire++) intvecIt->second[wire]=2;  // Segment 2
02078   for(int wire=23;wire<=32;wire++) intvecIt->second[wire]=3;  // Segment 3
02079  
02080   // For ME2/1
02081   std::vector<int> zer_2_1(113,0);
02082   id=csctype[4];
02083   if(m_wire_hvsegm.find(id) == m_wire_hvsegm.end()) m_wire_hvsegm[id]=zer_2_1;
02084   intvecIt=m_wire_hvsegm.find(id);
02085   for(int wire=1;wire<=44;wire++)   intvecIt->second[wire]=1;  // Segment 1
02086   for(int wire=45;wire<=80;wire++)  intvecIt->second[wire]=2;  // Segment 2
02087   for(int wire=81;wire<=112;wire++) intvecIt->second[wire]=3;  // Segment 3
02088  
02089   // For ME2/2
02090   std::vector<int> zer_2_2(65,0);
02091   id=csctype[5];
02092   if(m_wire_hvsegm.find(id) == m_wire_hvsegm.end()) m_wire_hvsegm[id]=zer_2_2;
02093   intvecIt=m_wire_hvsegm.find(id);
02094   for(int wire=1;wire<=16;wire++)  intvecIt->second[wire]=1;  // Segment 1
02095   for(int wire=17;wire<=28;wire++) intvecIt->second[wire]=2;  // Segment 2
02096   for(int wire=29;wire<=40;wire++) intvecIt->second[wire]=3;  // Segment 3
02097   for(int wire=41;wire<=52;wire++) intvecIt->second[wire]=4;  // Segment 4
02098   for(int wire=53;wire<=64;wire++) intvecIt->second[wire]=5;  // Segment 5
02099 
02100   // For ME3/1
02101   std::vector<int> zer_3_1(97,0);
02102   id=csctype[6];
02103   if(m_wire_hvsegm.find(id) == m_wire_hvsegm.end()) m_wire_hvsegm[id]=zer_3_1;
02104   intvecIt=m_wire_hvsegm.find(id);
02105   for(int wire=1;wire<=32;wire++)  intvecIt->second[wire]=1;  // Segment 1
02106   for(int wire=33;wire<=64;wire++) intvecIt->second[wire]=2;  // Segment 2
02107   for(int wire=65;wire<=96;wire++) intvecIt->second[wire]=3;  // Segment 3
02108  
02109   // For ME3/2
02110   std::vector<int> zer_3_2(65,0);
02111   id=csctype[7];
02112   if(m_wire_hvsegm.find(id) == m_wire_hvsegm.end()) m_wire_hvsegm[id]=zer_3_2;
02113   intvecIt=m_wire_hvsegm.find(id);
02114   for(int wire=1;wire<=16;wire++)  intvecIt->second[wire]=1;  // Segment 1
02115   for(int wire=17;wire<=28;wire++) intvecIt->second[wire]=2;  // Segment 2
02116   for(int wire=29;wire<=40;wire++) intvecIt->second[wire]=3;  // Segment 3
02117   for(int wire=41;wire<=52;wire++) intvecIt->second[wire]=4;  // Segment 4
02118   for(int wire=53;wire<=64;wire++) intvecIt->second[wire]=5;  // Segment 5
02119 
02120   // For ME4/1
02121   std::vector<int> zer_4_1(97,0);
02122   id=csctype[8];
02123   if(m_wire_hvsegm.find(id) == m_wire_hvsegm.end()) m_wire_hvsegm[id]=zer_4_1;
02124   intvecIt=m_wire_hvsegm.find(id);
02125   for(int wire=1;wire<=32;wire++)  intvecIt->second[wire]=1;  // Segment 1
02126   for(int wire=33;wire<=64;wire++) intvecIt->second[wire]=2;  // Segment 2
02127   for(int wire=65;wire<=96;wire++) intvecIt->second[wire]=3;  // Segment 3
02128 
02129   // For ME4/2
02130   std::vector<int> zer_4_2(65,0);
02131   id=csctype[9];
02132   if(m_wire_hvsegm.find(id) == m_wire_hvsegm.end()) m_wire_hvsegm[id]=zer_4_2;
02133   intvecIt=m_wire_hvsegm.find(id);
02134   for(int wire=1;wire<=16;wire++)  intvecIt->second[wire]=1;  // Segment 1
02135   for(int wire=17;wire<=28;wire++) intvecIt->second[wire]=2;  // Segment 2
02136   for(int wire=29;wire<=40;wire++) intvecIt->second[wire]=3;  // Segment 3
02137   for(int wire=41;wire<=52;wire++) intvecIt->second[wire]=4;  // Segment 4
02138   for(int wire=53;wire<=64;wire++) intvecIt->second[wire]=5;  // Segment 5
02139 
02140   } // end of if(nEventsAnalyzed==1)
02141 
02142 
02143      // do wires, strips and rechits present?
02144      wire_strip_rechit_present=0;
02145      if(wirecltn.begin() != wirecltn.end())  
02146        wire_strip_rechit_present= wire_strip_rechit_present+1;
02147      if(strpcltn.begin() != strpcltn.end())    
02148        wire_strip_rechit_present= wire_strip_rechit_present+2;
02149      if(rechitcltn.begin() != rechitcltn.end())
02150        wire_strip_rechit_present= wire_strip_rechit_present+4;
02151 
02152      if(wire_strip_rechit_present==7) {
02153 
02154 //       std::cout<<"Event "<<nEventsAnalyzed<<std::endl;
02155 //       std::cout<<std::endl;
02156 
02157        // cycle on wire collection for all CSC to select single wire hit layers
02158        CSCWireDigiCollection::DigiRangeIterator wiredetUnitIt;
02159  
02160        for(wiredetUnitIt=wirecltn.begin();wiredetUnitIt!=wirecltn.end();
02161           ++wiredetUnitIt) {
02162           const CSCDetId id = (*wiredetUnitIt).first;
02163           idlayer=indexer.dbIndex(id, channel);
02164           idchamber=idlayer/10;
02165           layer=id.layer();
02166           // looping in the layer of given CSC
02167           mult=0; wire=0; 
02168           const CSCWireDigiCollection::Range& range = (*wiredetUnitIt).second;
02169           for(CSCWireDigiCollection::const_iterator digiIt =
02170              range.first; digiIt!=range.second; ++digiIt){
02171              wire=(*digiIt).getWireGroup();
02172              mult++;
02173           }     // end of digis loop in layer
02174 
02175           // select layers with single wire hit
02176           if(mult==1) {
02177             if(m_single_wire_layer.find(idlayer) == m_single_wire_layer.end())
02178               m_single_wire_layer[idlayer]=wire;
02179           } // end of if(mult==1)
02180        }   // end of cycle on detUnit
02181 
02182        // Looping thru rechit collection
02183        CSCRecHit2DCollection::const_iterator recIt;
02184        CSCRecHit2D::ADCContainer m_adc;
02185        CSCRecHit2D::ChannelContainer m_strip;
02186        for(recIt = rechitcltn.begin(); recIt != rechitcltn.end(); ++recIt) {
02187           CSCDetId id = (CSCDetId)(*recIt).cscDetId();
02188           idlayer=indexer.dbIndex(id, channel);
02189           idchamber=idlayer/10;
02190           layer=id.layer();
02191           // select layer with single wire rechit
02192           if(m_single_wire_layer.find(idlayer) != m_single_wire_layer.end()) {
02193 
02194             // getting strips comprising rechit
02195             m_strip=(CSCRecHit2D::ChannelContainer)(*recIt).channels(); 
02196             if(m_strip.size()==3)  {        
02197               // get 3X3 ADC Sum
02198               m_adc=(CSCRecHit2D::ADCContainer)(*recIt).adcs();
02199               std::vector<float> adc_left,adc_center,adc_right;
02200               int binmx=0;
02201               float adcmax=0.0;
02202               unsigned k=0;
02203  
02204               for(int i=0;i<3;i++) 
02205                  for(int j=0;j<4;j++){
02206                     if(m_adc[k]>adcmax) {adcmax=m_adc[k]; binmx=j;}
02207                     if(i==0) adc_left.push_back(m_adc[k]);
02208                     if(i==1) adc_center.push_back(m_adc[k]);
02209                     if(i==2) adc_right.push_back(m_adc[k]);
02210                     k=k+1;
02211                  }
02212                 float adc_3_3_sum=0.0;
02213                 for(int j=binmx-1;j<=binmx+1;j++) {
02214                    adc_3_3_sum=adc_3_3_sum+adc_left[j]
02215                                           +adc_center[j]
02216                                           +adc_right[j];
02217                 }
02218 
02219                if(adc_3_3_sum > 0.0 &&  adc_3_3_sum < 2000.0) {
02220 
02221                  // temporary fix for ME1/1a to avoid triple entries
02222                  int flag=0;
02223                  if(id.station()==1 && id.ring()==4 &&  m_strip[1]>16)  flag=1;
02224                  // end of temporary fix
02225                  if(flag==0) {
02226 
02227                  wire= m_single_wire_layer[idlayer];
02228                  int chambertype=id.iChamberType(id.station(),id.ring());
02229                  int hvsgmtnmb=m_wire_hvsegm[chambertype][wire];
02230                  int nmbofhvsegm=nmbhvsegm[chambertype-1];
02231                  int location= (layer-1)*nmbofhvsegm+hvsgmtnmb;
02232                  float x=location;
02233                 
02234                  ss<<"gas_gain_rechit_adc_3_3_sum_location_ME_"<<idchamber;
02235                  name=ss.str(); ss.str("");
02236                  if(id.endcap()==1) endcapstr = "+";
02237                  ring=id.ring();
02238                  if(id.station()==1 && id.ring()==4) ring=1;
02239                  if(id.endcap()==2) endcapstr = "-"; 
02240                  ss<<"Gas Gain Rechit ADC3X3 Sum ME"<<endcapstr<<
02241                    id.station()<<"/"<<ring<<"/"<<id.chamber();
02242                  title=ss.str(); ss.str("");
02243                  x=location;
02244                  y=adc_3_3_sum;
02245                  histos->fill2DHist(x,y,name.c_str(),title.c_str(),30,1.0,31.0,50,0.0,2000.0,"GasGain");
02246 
02247                  /*
02248                    std::cout<<idchamber<<"   "<<id.station()<<" "<<id.ring()<<" "
02249                    <<id.chamber()<<"    "<<layer<<" "<< wire<<" "<<m_strip[1]<<" "<<
02250                    chambertype<<" "<< hvsgmtnmb<<" "<< nmbofhvsegm<<" "<< 
02251                    location<<"   "<<adc_3_3_sum<<std::endl;
02252                  */
02253                } // end of if flag==0
02254                } // end if(adcsum>0.0 && adcsum<2000.0)
02255             } // end of if if(m_strip.size()==3
02256           } // end of if single wire
02257         } // end of looping thru rechit collection
02258      }   // end of if wire and strip and rechit present 
02259 }

void CSCValidation::doNoiseHits ( edm::Handle< CSCRecHit2DCollection recHits,
edm::Handle< CSCSegmentCollection cscSegments,
edm::ESHandle< CSCGeometry cscGeom,
edm::Handle< CSCStripDigiCollection strips 
) [private]

Definition at line 1635 of file CSCValidation.cc.

References AllRechits, CSCValHists::fill1DHist(), findNonAssociatedRecHits(), getthisSignal(), histos, it, SegRechits, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by analyze().

01636                                                                                                             {
01637 
01638   CSCRecHit2DCollection::const_iterator recIt;
01639   for (recIt = recHits->begin(); recIt != recHits->end(); recIt++) {
01640 
01641     CSCDetId idrec = (CSCDetId)(*recIt).cscDetId();
01642 
01643     //Store the Rechits into a Map
01644     AllRechits.insert(pair<CSCDetId , CSCRecHit2D>(idrec,*recIt));
01645 
01646     // Find the strip containing this hit
01647     CSCRecHit2D::ChannelContainer hitstrips = (*recIt).channels();
01648     int nStrips     =  hitstrips.size();
01649     //std::cout << " no of strips in Rec Hit " << nStrips << std::endl;
01650     int centerid    =  nStrips/2 + 1;
01651     int centerStrip =  hitstrips[centerid - 1];
01652 
01653     float  rHsignal = getthisSignal(*strips, idrec, centerStrip);
01654     histos->fill1DHist(rHsignal,"hrHSignal", "Signal in the 4th time bin for centre strip",1100,-99,1000,"recHits");
01655 
01656   }
01657 
01658   for(CSCSegmentCollection::const_iterator it=cscSegments->begin(); it != cscSegments->end(); it++) {
01659 
01660     std::vector<CSCRecHit2D> theseRecHits = (*it).specificRecHits();
01661     for ( vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
01662       CSCDetId idRH = (CSCDetId)(*iRH).cscDetId();
01663       LocalPoint lpRH = (*iRH).localPosition();
01664       float xrec = lpRH.x();
01665       float yrec = lpRH.y();
01666       float zrec = lpRH.z();
01667       bool RHalreadyinMap = false;
01668       //Store the rechits associated with segments into a Map
01669       multimap<CSCDetId , CSCRecHit2D>::iterator segRHit;
01670       segRHit = SegRechits.find(idRH);
01671       if (segRHit != SegRechits.end()){
01672         for( ; segRHit != SegRechits.upper_bound(idRH); ++segRHit){
01673           //for( segRHit = SegRechits.begin(); segRHit != SegRechits.end() ;++segRHit){
01674           LocalPoint lposRH = (segRHit->second).localPosition();
01675           float xpos = lposRH.x();
01676           float ypos = lposRH.y();
01677           float zpos = lposRH.z();
01678           if ( xrec == xpos && yrec == ypos && zrec == zpos){
01679           RHalreadyinMap = true;
01680           //std::cout << " Already exists " <<std ::endl;
01681           break;}
01682         }
01683       }
01684       if(!RHalreadyinMap){ SegRechits.insert(pair<CSCDetId , CSCRecHit2D>(idRH,*iRH));}
01685     }
01686   }
01687 
01688   findNonAssociatedRecHits(cscGeom,strips);
01689 
01690 }

void CSCValidation::doOccupancies ( edm::Handle< CSCStripDigiCollection strips,
edm::Handle< CSCWireDigiCollection wires,
edm::Handle< CSCRecHit2DCollection recHits,
edm::Handle< CSCSegmentCollection cscSegments 
) [private]

Definition at line 254 of file CSCValidation.cc.

References c, CSCDetId::chamber(), chamberSerial(), diff, e, CSCDetId::endcap(), CSCValHists::fill1DHist(), histos, hORecHits, hOSegments, hOStrips, hOWires, r, CSCDetId::ring(), s, CSCDetId::station(), dimuonsSequences_cff::threshold, typeIndex(), and useDigis.

Referenced by analyze().

00255                                                                                                                         {
00256 
00257   bool wireo[2][4][4][36];
00258   bool stripo[2][4][4][36];
00259   bool rechito[2][4][4][36];
00260   bool segmento[2][4][4][36];
00261 
00262   bool hasWires = false;
00263   bool hasStrips = false;
00264   bool hasRecHits = false;
00265   bool hasSegments = false;
00266 
00267   for (int e = 0; e < 2; e++){
00268     for (int s = 0; s < 4; s++){
00269       for (int r = 0; r < 4; r++){
00270         for (int c = 0; c < 36; c++){
00271           wireo[e][s][r][c] = false;
00272           stripo[e][s][r][c] = false;
00273           rechito[e][s][r][c] = false;
00274           segmento[e][s][r][c] = false;
00275         }
00276       }
00277     }
00278   }
00279 
00280   if (useDigis){
00281     //wires
00282     for (CSCWireDigiCollection::DigiRangeIterator wi=wires->begin(); wi!=wires->end(); wi++) {
00283       CSCDetId id = (CSCDetId)(*wi).first;
00284       int kEndcap  = id.endcap();
00285       int kRing    = id.ring();
00286       int kStation = id.station();
00287       int kChamber = id.chamber();
00288       std::vector<CSCWireDigi>::const_iterator wireIt = (*wi).second.first;
00289       std::vector<CSCWireDigi>::const_iterator lastWire = (*wi).second.second;
00290       for( ; wireIt != lastWire; ++wireIt){
00291         if (!wireo[kEndcap-1][kStation-1][kRing-1][kChamber-1]){
00292           wireo[kEndcap-1][kStation-1][kRing-1][kChamber-1] = true;
00293           hOWires->Fill(kChamber,typeIndex(id));
00294           histos->fill1DHist(chamberSerial(id),"hOWireSerial","Wire Occupancy by Chamber Serial",601,-0.5,600.5,"Digis");
00295           hasWires = true;
00296         }
00297       }
00298     }
00299   
00300     //strips
00301     for (CSCStripDigiCollection::DigiRangeIterator si=strips->begin(); si!=strips->end(); si++) {
00302       CSCDetId id = (CSCDetId)(*si).first;
00303       int kEndcap  = id.endcap();
00304       int kRing    = id.ring();
00305       int kStation = id.station();
00306       int kChamber = id.chamber();
00307       std::vector<CSCStripDigi>::const_iterator stripIt = (*si).second.first;
00308       std::vector<CSCStripDigi>::const_iterator lastStrip = (*si).second.second;
00309       for( ; stripIt != lastStrip; ++stripIt) {
00310         std::vector<int> myADCVals = stripIt->getADCCounts();
00311         bool thisStripFired = false;
00312         float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
00313         float threshold = 13.3 ;
00314         float diff = 0.;
00315         for (unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
00316           diff = (float)myADCVals[iCount]-thisPedestal;
00317           if (diff > threshold) { thisStripFired = true; }
00318         }
00319         if (thisStripFired) {
00320           if (!stripo[kEndcap-1][kStation-1][kRing-1][kChamber-1]){
00321             stripo[kEndcap-1][kStation-1][kRing-1][kChamber-1] = true;
00322             hOStrips->Fill(kChamber,typeIndex(id));
00323             histos->fill1DHist(chamberSerial(id),"hOStripSerial","Strip Occupancy by Chamber Serial",601,-0.5,600.5,"Digis");
00324             hasStrips = true;
00325           }
00326         }
00327       }
00328     }
00329   }
00330 
00331   //rechits
00332   CSCRecHit2DCollection::const_iterator recIt;
00333   for (recIt = recHits->begin(); recIt != recHits->end(); recIt++) {
00334     CSCDetId idrec = (CSCDetId)(*recIt).cscDetId();
00335     int kEndcap  = idrec.endcap();
00336     int kRing    = idrec.ring();
00337     int kStation = idrec.station();
00338     int kChamber = idrec.chamber();
00339     if (!rechito[kEndcap-1][kStation-1][kRing-1][kChamber-1]){
00340       rechito[kEndcap-1][kStation-1][kRing-1][kChamber-1] = true;
00341       histos->fill1DHist(chamberSerial(idrec),"hORecHitsSerial","RecHit Occupancy by Chamber Serial",601,-0.5,600.5,"recHits");
00342       hORecHits->Fill(kChamber,typeIndex(idrec));
00343       hasRecHits = true;
00344     }
00345   }
00346 
00347   //segments
00348   for(CSCSegmentCollection::const_iterator segIt=cscSegments->begin(); segIt != cscSegments->end(); segIt++) {
00349     CSCDetId id  = (CSCDetId)(*segIt).cscDetId();
00350     int kEndcap  = id.endcap();
00351     int kRing    = id.ring();
00352     int kStation = id.station();
00353     int kChamber = id.chamber();
00354     if (!segmento[kEndcap-1][kStation-1][kRing-1][kChamber-1]){
00355       segmento[kEndcap-1][kStation-1][kRing-1][kChamber-1] = true;
00356       histos->fill1DHist(chamberSerial(id),"hOSegmentsSerial","Segment Occupancy by Chamber Serial",601,-0.5,600.5,"Segments");
00357       hOSegments->Fill(kChamber,typeIndex(id));
00358       hasSegments = true;
00359     }
00360   }
00361 
00362   // overall CSC occupancy (events with CSC data compared to total)
00363   histos->fill1DHist(0,"hCSCOccupancy","overall CSC occupancy",6,-0.5,5.5,"GeneralHists");
00364   if (hasWires) histos->fill1DHist(1,"hCSCOccupancy","overall CSC occupancy",6,-0.5,5.5,"GeneralHists");
00365   if (hasStrips) histos->fill1DHist(2,"hCSCOccupancy","overall CSC occupancy",6,-0.5,5.5,"GeneralHists");
00366   if (hasWires && hasStrips) histos->fill1DHist(3,"hCSCOccupancy","overall CSC occupancy",6,-0.5,5.5,"GeneralHists");
00367   if (hasRecHits) histos->fill1DHist(4,"hCSCOccupancy","overall CSC occupancy",6,-0.5,5.5,"GeneralHists");
00368   if (hasSegments) histos->fill1DHist(5,"hCSCOccupancy","overall CSC occupancy",6,-0.5,5.5,"GeneralHists");
00369 
00370 }

void CSCValidation::doPedestalNoise ( edm::Handle< CSCStripDigiCollection strips  )  [private]

Definition at line 616 of file CSCValidation.cc.

References chamberSerial(), detailedAnalysis, CSCValHists::fill1DHist(), CSCValHists::fill1DHistByLayer(), CSCValHists::fill1DHistByType(), CSCValHists::fillProfile(), getSignal(), histos, and dimuonsSequences_cff::threshold.

Referenced by analyze().

00616                                                                            {
00617 
00618   for (CSCStripDigiCollection::DigiRangeIterator dPNiter=strips->begin(); dPNiter!=strips->end(); dPNiter++) {
00619     CSCDetId id = (CSCDetId)(*dPNiter).first;
00620     std::vector<CSCStripDigi>::const_iterator pedIt = (*dPNiter).second.first;
00621     std::vector<CSCStripDigi>::const_iterator lStrip = (*dPNiter).second.second;
00622     for( ; pedIt != lStrip; ++pedIt) {
00623       int myStrip = pedIt->getStrip();
00624       std::vector<int> myADCVals = pedIt->getADCCounts();
00625       float TotalADC = getSignal(*strips, id, myStrip);
00626       bool thisStripFired = false;
00627       float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
00628       float thisSignal = (1./6)*(myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
00629       float threshold = 13.3;
00630       if(id.station() == 1 && id.ring() == 4)
00631         {
00632           if(myStrip <= 16) myStrip += 64; // no trapping for any bizarreness
00633         }
00634       if (TotalADC > threshold) { thisStripFired = true;}
00635       if (!thisStripFired){
00636         float ADC = thisSignal - thisPedestal;
00637         histos->fill1DHist(ADC,"hStripPed","Pedestal Noise Distribution",50,-25.,25.,"PedestalNoise");
00638         histos->fill1DHistByType(ADC,"hStripPedME","Pedestal Noise Distribution",id,50,-25.,25.,"PedestalNoise");
00639         histos->fillProfile(chamberSerial(id),ADC,"hStripPedMEProfile","Wire TimeBin Fired",601,-0.5,600.5,-25,25,"PedestalNoise");
00640         if (detailedAnalysis){
00641           histos->fill1DHistByLayer(ADC,"hStripPedME","Pedestal Noise Distribution",id,50,-25.,25.,"PedestalNoiseByLayer");
00642         }
00643       }
00644     }
00645   }
00646 
00647 }

void CSCValidation::doRecHits ( edm::Handle< CSCRecHit2DCollection recHits,
edm::Handle< CSCStripDigiCollection strips,
edm::ESHandle< CSCGeometry cscGeom 
) [private]

Definition at line 656 of file CSCValidation.cc.

References CSCDetId::chamber(), chamberSerial(), detailedAnalysis, CSCDetId::endcap(), CSCValHists::fill1DHist(), CSCValHists::fill1DHistByLayer(), CSCValHists::fill1DHistByType(), CSCValHists::fill2DHistByLayer(), CSCValHists::fill2DHistByStation(), CSCValHists::fillProfile(), CSCValHists::fillRechitTree(), getTiming(), histos, i, CSCDetId::layer(), rhTreeCount, CSCDetId::ring(), edm::RangeMap< ID, C, P >::size(), funct::sqrt(), CSCDetId::station(), GeomDet::toGlobal(), useDigis, writeTreeToFile, PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), LocalError::xy(), PV3DBase< T, PVType, FrameType >::y(), and LocalError::yy().

Referenced by analyze().

00656                                                                                                                                                  {
00657 
00658   // Get the RecHits collection :
00659   int nRecHits = recHits->size();
00660  
00661   // ---------------------
00662   // Loop over rechits 
00663   // ---------------------
00664   int iHit = 0;
00665 
00666   // Build iterator for rechits and loop :
00667   CSCRecHit2DCollection::const_iterator dRHIter;
00668   for (dRHIter = recHits->begin(); dRHIter != recHits->end(); dRHIter++) {
00669     iHit++;
00670 
00671     // Find chamber with rechits in CSC 
00672     CSCDetId idrec = (CSCDetId)(*dRHIter).cscDetId();
00673     int kEndcap  = idrec.endcap();
00674     int kRing    = idrec.ring();
00675     int kStation = idrec.station();
00676     int kChamber = idrec.chamber();
00677     int kLayer   = idrec.layer();
00678 
00679     // Store rechit as a Local Point:
00680     LocalPoint rhitlocal = (*dRHIter).localPosition();  
00681     float xreco = rhitlocal.x();
00682     float yreco = rhitlocal.y();
00683     LocalError rerrlocal = (*dRHIter).localPositionError();  
00684     //these errors are squared!
00685     float xxerr = rerrlocal.xx();
00686     float yyerr = rerrlocal.yy();
00687     float xyerr = rerrlocal.xy();
00688     // errors in strip units
00689     float stpos = (*dRHIter).positionWithinStrip();
00690     float sterr = (*dRHIter).errorWithinStrip();
00691 
00692     // Find the strip containing this hit
00693     CSCRecHit2D::ChannelContainer hitstrips = (*dRHIter).channels();
00694     int nStrips     =  hitstrips.size();
00695     int centerid    =  nStrips/2 + 1;
00696     int centerStrip =  hitstrips[centerid - 1];
00697 
00698     // Find the charge associated with this hit
00699     CSCRecHit2D::ADCContainer adcs = (*dRHIter).adcs();
00700     int adcsize = adcs.size();
00701     float rHSumQ = 0;
00702     float sumsides = 0;
00703     for (int i = 0; i < adcsize; i++){
00704       if (i != 3 && i != 7 && i != 11){
00705         rHSumQ = rHSumQ + adcs[i]; 
00706       }
00707       if (adcsize == 12 && (i < 3 || i > 7) && i < 12){
00708         sumsides = sumsides + adcs[i];
00709       }
00710     }
00711     float rHratioQ = sumsides/rHSumQ;
00712     if (adcsize != 12) rHratioQ = -99;
00713 
00714     // Get the signal timing of this hit
00715     float rHtime = 0;
00716     if (useDigis){
00717       rHtime = getTiming(*strips, idrec, centerStrip);
00718     }
00719     else{
00720       rHtime = (*dRHIter).tpeak()/50.;
00721     }
00722 
00723     // Get pointer to the layer:
00724     const CSCLayer* csclayer = cscGeom->layer( idrec );
00725 
00726     // Transform hit position from local chamber geometry to global CMS geom
00727     GlobalPoint rhitglobal= csclayer->toGlobal(rhitlocal);
00728     float grecx   =  rhitglobal.x();
00729     float grecy   =  rhitglobal.y();
00730 
00731     // Fill the rechit position branch
00732     if (writeTreeToFile && rhTreeCount < 1500000){
00733       histos->fillRechitTree(xreco, yreco, grecx, grecy, kEndcap, kStation, kRing, kChamber, kLayer);
00734       rhTreeCount++;
00735     }    
00736 
00737     // Fill some histograms
00738     if (kStation == 1 && (kRing == 1 || kRing == 4)) histos->fill1DHistByType(rHSumQ,"hRHSumQ","Sum 3x3 recHit Charge",idrec,125,0,4000,"recHits");
00739     else histos->fill1DHistByType(rHSumQ,"hRHSumQ","Sum 3x3 recHit Charge",idrec,125,0,2000,"recHits");
00740     histos->fill1DHistByType(rHratioQ,"hRHRatioQ","Charge Ratio (Ql+Qr)/Qt",idrec,120,-0.1,1.1,"recHits");
00741     histos->fill1DHistByType(rHtime,"hRHTiming","recHit Timing",idrec,100,0,10,"recHits");
00742     histos->fill2DHistByStation(grecx,grecy,"hRHGlobal","recHit Global Position",idrec,100,-800.,800.,100,-800.,800.,"recHits");
00743     histos->fill1DHistByType(sqrt(xxerr),"hRHxerr","RecHit Error on Local X",idrec,100,-0.1,2,"recHits");
00744     histos->fill1DHistByType(sqrt(yyerr),"hRHyerr","RecHit Error on Local Y",idrec,100,-0.1,2,"recHits");
00745     histos->fill1DHistByType(xyerr,"hRHxyerr","Corr. RecHit XY Error",idrec,100,-1,2,"recHits");
00746     histos->fill1DHistByType(stpos,"hRHstpos","Reconstructed Position on Strip",idrec,120,-0.6,0.6,"recHits");
00747     histos->fill1DHistByType(sterr,"hRHsterr","Estimated Error on Strip Measurement",idrec,120,-0.05,0.25,"recHits");
00748     histos->fillProfile(chamberSerial(idrec),rHSumQ,"hRHSumQProfile","Sum 3x3 recHit Charge",601,-0.5,600.5,0,4000,"recHits");
00749     histos->fillProfile(chamberSerial(idrec),rHtime,"hRHTimingProfile","recHit Timing",601,-0.5,600.5,-1,11,"recHits");
00750     if (detailedAnalysis){
00751       if (kStation == 1 && (kRing == 1 || kRing == 4)) histos->fill1DHistByLayer(rHSumQ,"hRHSumQ","Sum 3x3 recHit Charge",idrec,125,0,4000,"RHQByLayer");
00752       else histos->fill1DHistByLayer(rHSumQ,"hRHSumQ","Sum 3x3 recHit Charge",idrec,125,0,2000,"RHQByLayer");
00753       histos->fill1DHistByLayer(rHratioQ,"hRHRatioQ","Charge Ratio (Ql+Qr)/Qt",idrec,120,-0.1,1.1,"RHQByLayer");
00754       histos->fill1DHistByLayer(rHtime,"hRHTiming","recHit Timing",idrec,100,0,10,"RHTimingByLayer");
00755       histos->fill2DHistByLayer(xreco,yreco,"hRHLocalXY","recHit Local Position",idrec,50,-100.,100.,75,-150.,150.,"RHLocalXYByLayer");
00756       histos->fill1DHistByLayer(sqrt(xxerr),"hRHxerr","RecHit Error on Local X",idrec,100,-0.1,2,"RHErrorsByLayer");
00757       histos->fill1DHistByLayer(sqrt(yyerr),"hRHyerr","RecHit Error on Local Y",idrec,100,-0.1,2,"RHErrorsByLayer");
00758       histos->fill1DHistByType(stpos,"hRHstpos","Reconstructed Position on Strip",idrec,120,-0.6,0.6,"RHStripPosByLayer");
00759       histos->fill1DHistByType(sterr,"hRHsterr","Estimated Error on Strip Measurement",idrec,120,-0.05,0.25,"RHStripPosByLayer");
00760     }
00761 
00762   } //end rechit loop
00763 
00764   if (nRecHits == 0) nRecHits = -1;
00765 
00766   histos->fill1DHist(nRecHits,"hRHnrechits","recHits per Event (all chambers)",41,-0.5,40.5,"recHits");
00767 
00768 }

void CSCValidation::doSegments ( edm::Handle< CSCSegmentCollection cscSegments,
edm::ESHandle< CSCGeometry cscGeom 
) [private]

Definition at line 820 of file CSCValidation.cc.

References chamberSerial(), ChiSquaredProbability(), detailedAnalysis, CSCValHists::fill1DHist(), CSCValHists::fill1DHistByChamber(), CSCValHists::fill1DHistByType(), CSCValHists::fill2DHistByStation(), CSCValHists::fillProfile(), CSCValHists::fillSegmentTree(), fitX(), histos, CSCDetId::layer(), PV3DBase< T, PVType, FrameType >::phi(), CSCDetId::ring(), segTreeCount, funct::sqrt(), CSCDetId::station(), theta, PV3DBase< T, PVType, FrameType >::theta(), GeomDet::toGlobal(), writeTreeToFile, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by analyze().

00820                                                                                                            {
00821 
00822   // get CSC segment collection
00823   int nSegments = cscSegments->size();
00824 
00825   // -----------------------
00826   // loop over segments
00827   // -----------------------
00828   int iSegment = 0;
00829   for(CSCSegmentCollection::const_iterator dSiter=cscSegments->begin(); dSiter != cscSegments->end(); dSiter++) {
00830     iSegment++;
00831     //
00832     CSCDetId id  = (CSCDetId)(*dSiter).cscDetId();
00833     int kEndcap  = id.endcap();
00834     int kRing    = id.ring();
00835     int kStation = id.station();
00836     int kChamber = id.chamber();
00837 
00838     //
00839     float chisq    = (*dSiter).chi2();
00840     int nhits      = (*dSiter).nRecHits();
00841     int nDOF       = 2*nhits-4;
00842     double chisqProb = ChiSquaredProbability( (double)chisq, nDOF );
00843     LocalPoint localPos = (*dSiter).localPosition();
00844     float segX     = localPos.x();
00845     float segY     = localPos.y();
00846     LocalVector segDir = (*dSiter).localDirection();
00847     double theta   = segDir.theta();
00848 
00849     //
00850     // try to get the CSC recHits that contribute to this segment.
00851     std::vector<CSCRecHit2D> theseRecHits = (*dSiter).specificRecHits();
00852     int nRH = (*dSiter).nRecHits();
00853     int jRH = 0;
00854     HepMatrix sp(6,1);
00855     HepMatrix se(6,1);
00856     for ( vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
00857       jRH++;
00858       CSCDetId idRH = (CSCDetId)(*iRH).cscDetId();
00859       int kRing    = idRH.ring();
00860       int kStation = idRH.station();
00861       int kLayer   = idRH.layer();
00862 
00863       // Find the strip containing this hit
00864       CSCRecHit2D::ChannelContainer hitstrips = (*iRH).channels();
00865       int nStrips     =  hitstrips.size();
00866       int centerid    =  nStrips/2 + 1;
00867       int centerStrip =  hitstrips[centerid - 1];
00868 
00869       // If this segment has 6 hits, find the position of each hit on the strip in units of stripwidth and store values
00870       if (nRH == 6){
00871         float stpos = (*iRH).positionWithinStrip();
00872         se(kLayer,1) = (*iRH).errorWithinStrip();
00873         // Take into account half-strip staggering of layers (ME1/1 has no staggering)
00874         if (kStation == 1 && (kRing == 1 || kRing == 4)) sp(kLayer,1) = stpos + centerStrip;
00875         else{
00876           if (kLayer == 1 || kLayer == 3 || kLayer == 5) sp(kLayer,1) = stpos + centerStrip;
00877           if (kLayer == 2 || kLayer == 4 || kLayer == 6) sp(kLayer,1) = stpos - 0.5 + centerStrip;
00878         }
00879       }
00880 
00881     }
00882 
00883     float residual = -99;
00884     // Fit all points except layer 3, then compare expected value for layer 3 to reconstructed value
00885     if (nRH == 6){
00886       float expected = fitX(sp,se);
00887       residual = expected - sp(3,1);
00888     }
00889 
00890     // global transformation
00891     float globX = 0.;
00892     float globY = 0.;
00893     float globZ = 0.;
00894     float globpPhi = 0.;
00895     float globR = 0.;
00896     float globTheta = 0.;
00897     float globPhi   = 0.;
00898     const CSCChamber* cscchamber = cscGeom->chamber(id);
00899     if (cscchamber) {
00900       GlobalPoint globalPosition = cscchamber->toGlobal(localPos);
00901       globX = globalPosition.x();
00902       globY = globalPosition.y();
00903       globZ = globalPosition.z();
00904       globpPhi =  globalPosition.phi();
00905       globR   =  sqrt(globX*globX + globY*globY);
00906       GlobalVector globalDirection = cscchamber->toGlobal(segDir);
00907       globTheta = globalDirection.theta();
00908       globPhi   = globalDirection.phi();
00909     }
00910 
00911 
00912     // Fill segment position branch
00913     if (writeTreeToFile && segTreeCount < 1500000){
00914       histos->fillSegmentTree(segX, segY, globX, globY, kEndcap, kStation, kRing, kChamber);
00915       segTreeCount++;
00916     }
00917 
00918     // Fill histos
00919     histos->fill2DHistByStation(globX,globY,"hSGlobal","Segment Global Positions;global x (cm)",id,100,-800.,800.,100,-800.,800.,"Segments");
00920     histos->fill1DHistByType(nhits,"hSnHits","N hits on Segments",id,8,-0.5,7.5,"Segments");
00921     histos->fill1DHistByType(theta,"hSTheta","local theta segments",id,128,-3.2,3.2,"Segments");
00922     histos->fill1DHistByType(residual,"hSResid","Fitted Position on Strip - Reconstructed for Layer 3",id,100,-0.5,0.5,"Resolution");
00923     histos->fill1DHistByType((chisq/nDOF),"hSChiSq","segments chi-squared/ndof",id,110,-0.05,1.05,"Segments");
00924     histos->fill1DHistByType(chisqProb,"hSChiSqProb","segments chi-squared probability",id,110,-0.05,1.05,"Segments");
00925     histos->fill1DHist(globTheta,"hSGlobalTheta","segment global theta",64,0,1.6,"Segments");
00926     histos->fill1DHist(globPhi,"hSGlobalPhi","segment global phi",128,-3.2,3.2,"Segments");
00927     histos->fillProfile(chamberSerial(id),nhits,"hSnHitsProfile","N hits on Segments",601,-0.5,600.5,-0.5,7.5,"Segments");
00928     histos->fillProfile(chamberSerial(id),residual,"hSResidProfile","Fitted Position on Strip - Reconstructed for Layer 3",601,-0.5,600.5,-0.5,0.5,"Resolution");
00929     if (detailedAnalysis){
00930       histos->fill1DHistByChamber(nhits,"hSnHits","N hits on Segments",id,8,-0.5,7.5,"HitsOnSegmentByChamber");
00931       histos->fill1DHistByChamber(theta,"hSTheta","local theta segments",id,128,-3.2,3.2,"DetailedSegments");
00932       histos->fill1DHistByChamber(residual,"hSResid","Fitted Position on Strip - Reconstructed for Layer 3",id,100,-0.5,0.5,"DetailedResolution");
00933       histos->fill1DHistByChamber((chisq/nDOF),"hSChiSq","segments chi-squared probability",id,110,-0.05,1.05,"SegChi2ByChamber");
00934       histos->fill1DHistByChamber(chisqProb,"hSChiSqProb","segments chi-squared probability",id,110,-0.05,1.05,"SegChi2ByChamber");
00935     }
00936 
00937   } // end segment loop
00938 
00939   if (nSegments == 0) nSegments = -1;
00940 
00941   histos->fill1DHist(nSegments,"hSnSegments","Segments per Event",11,-0.5,10.5,"Segments");
00942 
00943 }

void CSCValidation::doSimHits ( edm::Handle< CSCRecHit2DCollection recHits,
edm::Handle< edm::PSimHitContainer simHits 
) [private]

Definition at line 776 of file CSCValidation.cc.

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

Referenced by analyze().

00776                                                                                                           {
00777 
00778   CSCRecHit2DCollection::const_iterator dSHrecIter;
00779   for (dSHrecIter = recHits->begin(); dSHrecIter != recHits->end(); dSHrecIter++) {
00780 
00781     CSCDetId idrec = (CSCDetId)(*dSHrecIter).cscDetId();
00782     LocalPoint rhitlocal = (*dSHrecIter).localPosition();
00783     float xreco = rhitlocal.x();
00784     float yreco = rhitlocal.y();
00785     float simHitXres = -99;
00786     float simHitYres = -99;
00787     float mindiffX   = 99;
00788     float mindiffY   = 10;
00789     // If MC, find closest muon simHit to check resolution:
00790     PSimHitContainer::const_iterator dSHsimIter;
00791     for (dSHsimIter = simHits->begin(); dSHsimIter != simHits->end(); dSHsimIter++){
00792       // Get DetID for this simHit:
00793       CSCDetId sId = (CSCDetId)(*dSHsimIter).detUnitId();
00794       // Check if the simHit detID matches that of current recHit
00795       // and make sure it is a muon hit:
00796       if (sId == idrec && abs((*dSHsimIter).particleType()) == 13){
00797         // Get the position of this simHit in local coordinate system:
00798         LocalPoint sHitlocal = (*dSHsimIter).localPosition();
00799         // Now we need to make reasonably sure that this simHit is
00800         // responsible for this recHit:
00801         if ((sHitlocal.x() - xreco) < mindiffX && (sHitlocal.y() - yreco) < mindiffY){
00802           simHitXres = (sHitlocal.x() - xreco);
00803           simHitYres = (sHitlocal.y() - yreco);
00804           mindiffX = (sHitlocal.x() - xreco);
00805         }
00806       }
00807     }
00808 
00809     histos->fill1DHistByType(simHitXres,"hRHResid","SimHitX - Reconstructed X",idrec,100,-1.0,1.0,"Resolution");
00810   }
00811 
00812 }

void CSCValidation::doStandalone ( edm::Handle< reco::TrackCollection saMuons  )  [private]

Definition at line 951 of file CSCValidation.cc.

References MuonSubdetId::CSC, DetId::det(), detId, MuonSubdetId::DT, CSCValHists::fill1DHist(), histos, metsig::muon, DetId::Muon, n, and DetId::subdetId().

Referenced by analyze().

00951                                                                    {
00952 
00953   int nSAMuons = saMuons->size();
00954   histos->fill1DHist(nSAMuons,"trNSAMuons","N Standalone Muons per Event",6,-0.5,5.5,"STAMuons");
00955 
00956   for(reco::TrackCollection::const_iterator muon = saMuons->begin(); muon != saMuons->end(); ++ muon ) {
00957     float preco  = muon->p();
00958     float ptreco = muon->pt();
00959     int   n = muon->recHitsSize();
00960 
00961     // loop over hits
00962     int nDTHits = 0;
00963     int nCSCHits = 0;
00964     for (trackingRecHit_iterator hit = muon->recHitsBegin(); hit != muon->recHitsEnd(); ++hit ) {
00965       const DetId detId( (*hit)->geographicalId() );
00966       if (detId.det() == DetId::Muon) {
00967         if (detId.subdetId() == MuonSubdetId::DT) {
00968           //DTChamberId dtId(detId.rawId());
00969           //int chamberId = dtId.sector();
00970           nDTHits++;
00971         }
00972         else if (detId.subdetId() == MuonSubdetId::CSC) {
00973           //CSCDetId cscId(detId.rawId());
00974           //int chamberId = cscId.chamber();
00975           nCSCHits++;
00976         }
00977       }
00978     }
00979 
00980     // fill histograms
00981     histos->fill1DHist(n,"trN","N hits on a STA Muon Track",51,-0.5,50.5,"STAMuons");
00982     histos->fill1DHist(nDTHits,"trNDT","N DT hits on a STA Muon Track",51,-0.5,50.5,"STAMuons");
00983     histos->fill1DHist(nCSCHits,"trNCSC","N CSC hits on a STA Muon Track",51,-0.5,50.5,"STAMuons");
00984     histos->fill1DHist(preco,"trP","STA Muon Momentum",100,0,1000,"STAMuons");
00985     histos->fill1DHist(ptreco,"trPT","STA Muon pT",100,0,20,"STAMuons");
00986 
00987   }
00988 
00989 }

void CSCValidation::doStripDigis ( edm::Handle< CSCStripDigiCollection strips  )  [private]

Definition at line 575 of file CSCValidation.cc.

References detailedAnalysis, diff, CSCValHists::fill1DHist(), CSCValHists::fill1DHistByLayer(), CSCValHists::fill1DHistByType(), histos, and dimuonsSequences_cff::threshold.

Referenced by analyze().

00575                                                                         {
00576 
00577   int nStripsFired = 0;
00578   for (CSCStripDigiCollection::DigiRangeIterator dSDiter=strips->begin(); dSDiter!=strips->end(); dSDiter++) {
00579     CSCDetId id = (CSCDetId)(*dSDiter).first;
00580     std::vector<CSCStripDigi>::const_iterator stripIter = (*dSDiter).second.first;
00581     std::vector<CSCStripDigi>::const_iterator lStrip = (*dSDiter).second.second;
00582     for( ; stripIter != lStrip; ++stripIter) {
00583       int myStrip = stripIter->getStrip();
00584       std::vector<int> myADCVals = stripIter->getADCCounts();
00585       bool thisStripFired = false;
00586       float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
00587       float threshold = 13.3 ;
00588       float diff = 0.;
00589       for (unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
00590         diff = (float)myADCVals[iCount]-thisPedestal;
00591         if (diff > threshold) { thisStripFired = true; }
00592       } 
00593       if (thisStripFired) {
00594         nStripsFired++;
00595         // fill strip histos
00596         histos->fill1DHistByType(myStrip,"hStripStrip","Strip Number",id,81,-0.5,80.5,"Digis");
00597         if (detailedAnalysis){
00598           histos->fill1DHistByLayer(myStrip,"hStripStrip","Strip Number",id,81,-0.5,80.5,"StripNumberByLayer");
00599         }
00600       }
00601     }
00602   } // end strip loop
00603 
00604   if (nStripsFired == 0) nStripsFired = -1;
00605 
00606   histos->fill1DHist(nStripsFired,"hStripNFired","Fired Strips per Event",101,-0.5,100.5,"Digis");
00607 
00608 }

bool CSCValidation::doTrigger ( edm::Handle< L1MuGMTReadoutCollection pCollection  )  [private]

Definition at line 378 of file CSCValidation.cc.

References CSCValHists::fill1DHist(), and histos.

Referenced by analyze().

00378                                                                             {
00379 
00380   vector<L1MuGMTReadoutRecord> L1Mrec = pCollection->getRecords();
00381   vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
00382 
00383   bool csc_l1a  = false;
00384   bool dt_l1a   = false;
00385   bool rpcf_l1a = false;
00386   bool rpcb_l1a = false;
00387   bool beamHaloTrigger = false;
00388 
00389   int myBXNumber = -1000;
00390 
00391   for(igmtrr=L1Mrec.begin(); igmtrr!=L1Mrec.end(); igmtrr++) {
00392     std::vector<L1MuRegionalCand>::const_iterator iter1;
00393     std::vector<L1MuRegionalCand> rmc;
00394 
00395     // CSC
00396     int icsc = 0;
00397     rmc = igmtrr->getCSCCands();
00398     for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
00399       if ( !(*iter1).empty() ) {
00400         icsc++;
00401         int kQuality = (*iter1).quality();   // kQuality = 1 means beam halo
00402         if (kQuality == 1) beamHaloTrigger = true;
00403       }
00404     }
00405     if (igmtrr->getBxInEvent() == 0 && icsc>0) csc_l1a = true;
00406     if (igmtrr->getBxInEvent() == 0 ) { myBXNumber = igmtrr->getBxNr(); }
00407 
00408     // DT
00409     int idt = 0;
00410     rmc = igmtrr->getDTBXCands();
00411     for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
00412       if ( !(*iter1).empty() ) {
00413         idt++;
00414       }
00415     }
00416     if(igmtrr->getBxInEvent()==0 && idt>0) dt_l1a = true;
00417 
00418     // RPC Barrel
00419     int irpcb = 0;
00420     rmc = igmtrr->getBrlRPCCands();
00421     for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
00422       if ( !(*iter1).empty() ) {
00423         irpcb++;
00424       }
00425     }
00426     if(igmtrr->getBxInEvent()==0 && irpcb>0) rpcb_l1a = true;
00427 
00428     // RPC Forward
00429     int irpcf = 0;
00430     rmc = igmtrr->getFwdRPCCands();
00431     for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
00432       if ( !(*iter1).empty() ) {
00433         irpcf++;
00434       }
00435     }
00436     if(igmtrr->getBxInEvent()==0 && irpcf>0) rpcf_l1a = true;
00437 
00438   }
00439 
00440   // Fill some histograms with L1A info
00441   if (csc_l1a)          histos->fill1DHist(myBXNumber,"vtBXNumber","BX Number",4001,-0.5,4000.5,"Trigger");
00442   if (csc_l1a)          histos->fill1DHist(1,"vtBits","trigger bits",11,-0.5,10.5,"Trigger");
00443   if (dt_l1a)           histos->fill1DHist(2,"vtBits","trigger bits",11,-0.5,10.5,"Trigger");
00444   if (rpcb_l1a)         histos->fill1DHist(3,"vtBits","trigger bits",11,-0.5,10.5,"Trigger");
00445   if (rpcf_l1a)         histos->fill1DHist(4,"vtBits","trigger bits",11,-0.5,10.5,"Trigger");
00446   if (beamHaloTrigger)  histos->fill1DHist(8,"vtBits","trigger bits",11,-0.5,10.5,"Trigger");
00447 
00448   if (csc_l1a) {
00449     histos->fill1DHist(1,"vtCSCY","trigger bits",11,-0.5,10.5,"Trigger");
00450     if (dt_l1a)   histos->fill1DHist(2,"vtCSCY","trigger bits",11,-0.5,10.5,"Trigger");
00451     if (rpcb_l1a) histos->fill1DHist(3,"vtCSCY","trigger bits",11,-0.5,10.5,"Trigger");
00452     if (rpcf_l1a) histos->fill1DHist(4,"vtCSCY","trigger bits",11,-0.5,10.5,"Trigger");
00453     if (  dt_l1a || rpcb_l1a || rpcf_l1a)  histos->fill1DHist(5,"vtCSCY","trigger bits",11,-0.5,10.5,"Trigger");
00454     if (!(dt_l1a || rpcb_l1a || rpcf_l1a)) histos->fill1DHist(6,"vtCSCY","trigger bits",11,-0.5,10.5,"Trigger");
00455   } else {
00456     histos->fill1DHist(1,"vtCSCN","trigger bits",11,-0.5,10.5,"Trigger");
00457     if (dt_l1a)   histos->fill1DHist(2,"vtCSCN","trigger bits",11,-0.5,10.5,"Trigger");
00458     if (rpcb_l1a) histos->fill1DHist(3,"vtCSCN","trigger bits",11,-0.5,10.5,"Trigger");
00459     if (rpcf_l1a) histos->fill1DHist(4,"vtCSCN","trigger bits",11,-0.5,10.5,"Trigger");
00460     if (  dt_l1a || rpcb_l1a || rpcf_l1a)  histos->fill1DHist(5,"vtCSCN","trigger bits",11,-0.5,10.5,"Trigger");
00461     if (!(dt_l1a || rpcb_l1a || rpcf_l1a)) histos->fill1DHist(6,"vtCSCN","trigger bits",11,-0.5,10.5,"Trigger");
00462   }
00463 
00464   // if valid CSC L1A then return true for possible use elsewhere
00465 
00466   if (csc_l1a) return true;
00467   
00468   return false;
00469 
00470 }

void CSCValidation::doWireDigis ( edm::Handle< CSCWireDigiCollection wires  )  [private]

Definition at line 541 of file CSCValidation.cc.

References chamberSerial(), detailedAnalysis, CSCValHists::fill1DHist(), CSCValHists::fill1DHistByLayer(), CSCValHists::fill1DHistByType(), CSCValHists::fillProfile(), and histos.

Referenced by analyze().

00541                                                                      {
00542 
00543   int nWireGroupsTotal = 0;
00544   for (CSCWireDigiCollection::DigiRangeIterator dWDiter=wires->begin(); dWDiter!=wires->end(); dWDiter++) {
00545     CSCDetId id = (CSCDetId)(*dWDiter).first;
00546     std::vector<CSCWireDigi>::const_iterator wireIter = (*dWDiter).second.first;
00547     std::vector<CSCWireDigi>::const_iterator lWire = (*dWDiter).second.second;
00548     for( ; wireIter != lWire; ++wireIter) {
00549       int myWire = wireIter->getWireGroup();
00550       int myTBin = wireIter->getTimeBin();
00551       nWireGroupsTotal++;
00552       histos->fill1DHistByType(myWire,"hWireWire","Wiregroup Numbers Fired",id,113,-0.5,112.5,"Digis");
00553       histos->fill1DHistByType(myTBin,"hWireTBin","Wire TimeBin Fired",id,17,-0.5,16.5,"Digis");
00554       histos->fillProfile(chamberSerial(id),myTBin,"hWireTBinProfile","Wire TimeBin Fired",601,-0.5,600.5,-0.5,16.5,"Digis");
00555       if (detailedAnalysis){
00556         histos->fill1DHistByLayer(myWire,"hWireWire","Wiregroup Numbers Fired",id,113,-0.5,112.5,"WireNumberByLayer");
00557         histos->fill1DHistByLayer(myTBin,"hWireTBin","Wire TimeBin Fired",id,17,-0.5,16.5,"WireTimeByLayer");
00558       }
00559     }
00560   } // end wire loop
00561 
00562   // this way you can zero suppress but still store info on # events with no digis
00563   if (nWireGroupsTotal == 0) nWireGroupsTotal = -1;
00564 
00565   histos->fill1DHist(nWireGroupsTotal,"hWirenGroupsTotal","Wires Fired Per Event",41,-0.5,40.5,"Digis");
00566   
00567 }

void CSCValidation::endJob ( void   )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 2481 of file CSCValidation.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and nEventsAnalyzed.

02481                            {
02482 
02483      std::cout<<"Events in "<<nEventsAnalyzed<<std::endl;
02484 }

double CSCValidation::extrapolate1D ( double  initPosition,
double  initDirection,
double  parameterOfTheLine 
) [inline, private]

Definition at line 154 of file CSCValidation.h.

Referenced by doEfficiencies().

00154                                                                                             {
00155     double extrapolatedPosition = initPosition + initDirection*parameterOfTheLine;
00156     return extrapolatedPosition; 
00157   }

void CSCValidation::fillEfficiencyHistos ( int  bin,
int  flag 
) [private]

void CSCValidation::findNonAssociatedRecHits ( edm::ESHandle< CSCGeometry cscGeom,
edm::Handle< CSCStripDigiCollection strips 
) [private]

Definition at line 1698 of file CSCValidation.cc.

References AllRechits, CSCDetId::chamber(), d, distRHmap, CSCDetId::endcap(), CSCValHists::fill1DHist(), CSCValHists::fill1DHistByType(), CSCValHists::fill2DHistByStation(), getTiming(), getWidth(), histos, i, iter, CSCDetId::layer(), NonAssociatedRechits, funct::pow(), CSCDetId::ring(), SegRechits, edm::RangeMap< ID, C, P >::size(), funct::sqrt(), CSCDetId::station(), GeomDet::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by doNoiseHits().

01698                                                                                                                        {
01699  
01700   for(multimap<CSCDetId , CSCRecHit2D>::iterator allRHiter =  AllRechits.begin();allRHiter != AllRechits.end(); ++allRHiter){
01701         CSCDetId idRH = allRHiter->first;
01702     LocalPoint lpRH = (allRHiter->second).localPosition();
01703     float xrec = lpRH.x();
01704     float yrec = lpRH.y();
01705     float zrec = lpRH.z();
01706     
01707     bool foundmatch = false;
01708     multimap<CSCDetId , CSCRecHit2D>::iterator segRHit;
01709     segRHit = SegRechits.find(idRH);
01710     if (segRHit != SegRechits.end()){
01711                 for( ; segRHit != SegRechits.upper_bound(idRH); ++segRHit){
01712                         
01713                         LocalPoint lposRH = (segRHit->second).localPosition();
01714                         float xpos = lposRH.x();
01715                         float ypos = lposRH.y();
01716                         float zpos = lposRH.z();
01717 
01718                         if ( xrec == xpos && yrec == ypos && zrec == zpos){
01719                                 foundmatch = true;}
01720           
01721                         float d      = 0.;
01722                         float dclose =1000.;
01723 
01724                         if ( !foundmatch) {
01725                                 
01726                                 d = sqrt(pow(xrec-xpos,2)+pow(yrec-ypos,2)+pow(zrec-zpos,2));
01727                                 if (d < dclose) {
01728                                         dclose = d;
01729                                         if( distRHmap.find((allRHiter->second)) ==  distRHmap.end() ) { // entry for rechit does not yet exist, create one
01730                                                 distRHmap.insert(make_pair(allRHiter->second,dclose) );
01731                                         }
01732                                         else {
01733                                                 // we already have an entry for the detid.
01734                                                 distRHmap.erase(allRHiter->second);
01735                                                 distRHmap.insert(make_pair(allRHiter->second,dclose)); // fill rechits for the segment with the given detid
01736                                         }
01737                                 }
01738                         }           
01739                 }
01740     }
01741     if(!foundmatch){NonAssociatedRechits.insert(pair<CSCDetId , CSCRecHit2D>(idRH,allRHiter->second));}
01742   }
01743 
01744   for(map<CSCRecHit2D,float,ltrh>::iterator iter =  distRHmap.begin();iter != distRHmap.end(); ++iter){
01745     histos->fill1DHist(iter->second,"hdistRH","Distance of Non Associated RecHit from closest Segment RecHit",500,0.,100.,"NonAssociatedRechits");
01746   }
01747 
01748   for(multimap<CSCDetId , CSCRecHit2D>::iterator iter =  NonAssociatedRechits.begin();iter != NonAssociatedRechits.end(); ++iter){
01749     CSCDetId idrec = iter->first;
01750     int kEndcap  = idrec.endcap();
01751     int cEndcap  = idrec.endcap();
01752     if (kEndcap == 2)cEndcap = -1;
01753     int kRing    = idrec.ring();
01754     int kStation = idrec.station();
01755     int kChamber = idrec.chamber();
01756     int kLayer   = idrec.layer();
01757 
01758     // Store rechit as a Local Point:
01759     LocalPoint rhitlocal = (iter->second).localPosition();  
01760     float xreco = rhitlocal.x();
01761     float yreco = rhitlocal.y();
01762 
01763     // Find the strip containing this hit
01764     CSCRecHit2D::ChannelContainer hitstrips = (iter->second).channels();
01765     int nStrips     =  hitstrips.size();
01766     int centerid    =  nStrips/2 + 1;
01767     int centerStrip =  hitstrips[centerid - 1];
01768 
01769 
01770     // Find the charge associated with this hit
01771 
01772     CSCRecHit2D::ADCContainer adcs = (iter->second).adcs();
01773     int adcsize = adcs.size();
01774     float rHSumQ = 0;
01775     float sumsides = 0;
01776     for (int i = 0; i < adcsize; i++){
01777       if (i != 3 && i != 7 && i != 11){
01778         rHSumQ = rHSumQ + adcs[i]; 
01779       }
01780       if (adcsize == 12 && (i < 3 || i > 7) && i < 12){
01781         sumsides = sumsides + adcs[i];
01782       }
01783     }
01784     float rHratioQ = sumsides/rHSumQ;
01785     if (adcsize != 12) rHratioQ = -99;
01786 
01787     // Get the signal timing of this hit
01788     //float rHtime = (iter->second).tpeak();
01789     float rHtime = getTiming(*strips, idrec, centerStrip);
01790 
01791     // Get the width of this hit
01792     int rHwidth = getWidth(*strips, idrec, centerStrip);
01793 
01794 
01795     // Get pointer to the layer:
01796     const CSCLayer* csclayer = cscGeom->layer( idrec );
01797 
01798     // Transform hit position from local chamber geometry to global CMS geom
01799     GlobalPoint rhitglobal= csclayer->toGlobal(rhitlocal);
01800     float grecx   =  rhitglobal.x();
01801     float grecy   =  rhitglobal.y();
01802 
01803 
01804 
01805    // Simple occupancy variables
01806     int kCodeBroad  = cEndcap * ( 4*(kStation-1) + kRing) ;
01807     int kCodeNarrow = cEndcap * ( 100*(kRing-1) + kChamber) ;
01808 
01809     //Fill the non-associated rechits parameters in histogram
01810     histos->fill1DHist(kCodeBroad,"hNARHCodeBroad","broad scope code for recHits",33,-16.5,16.5,"NonAssociatedRechits");
01811     if (kStation == 1) histos->fill1DHist(kCodeNarrow,"hNARHCodeNarrow1","narrow scope recHit code station 1",801,-400.5,400.5,"NonAssociatedRechits");
01812     if (kStation == 2) histos->fill1DHist(kCodeNarrow,"hNARHCodeNarrow2","narrow scope recHit code station 2",801,-400.5,400.5,"NonAssociatedRechits");
01813     if (kStation == 3) histos->fill1DHist(kCodeNarrow,"hNARHCodeNarrow3","narrow scope recHit code station 3",801,-400.5,400.5,"NonAssociatedRechits");
01814     if (kStation == 4) histos->fill1DHist(kCodeNarrow,"hNARHCodeNarrow4","narrow scope recHit code station 4",801,-400.5,400.5,"NonAssociatedRechits");
01815     histos->fill1DHistByType(kLayer,"hNARHLayer","RecHits per Layer",idrec,8,-0.5,7.5,"NonAssociatedRechits");
01816     histos->fill1DHistByType(xreco,"hNARHX","Local X of recHit",idrec,160,-80.,80.,"NonAssociatedRechits");
01817     histos->fill1DHistByType(yreco,"hNARHY","Local Y of recHit",idrec,60,-180.,180.,"NonAssociatedRechits");
01818     if (kStation == 1 && (kRing == 1 || kRing == 4)) histos->fill1DHistByType(rHSumQ,"hNARHSumQ","Sum 3x3 recHit Charge",idrec,250,0,4000,"NonAssociatedRechits");
01819     else histos->fill1DHistByType(rHSumQ,"hNARHSumQ","Sum 3x3 recHit Charge",idrec,250,0,2000,"NonAssociatedRechits");
01820     histos->fill1DHistByType(rHratioQ,"hNARHRatioQ","Ratio (Ql+Qr)/Qt)",idrec,120,-0.1,1.1,"NonAssociatedRechits");
01821     histos->fill1DHistByType(rHtime,"hNARHTiming","recHit Timing",idrec,100,0,10,"NonAssociatedRechits");
01822     histos->fill2DHistByStation(grecx,grecy,"hNARHGlobal","recHit Global Position",idrec,400,-800.,800.,400,-800.,800.,"NonAssociatedRechits");
01823     histos->fill1DHistByType(rHwidth,"hNARHwidth","width for Non associated recHit",idrec,21,-0.5,20.5,"NonAssociatedRechits");
01824     
01825   }
01826 
01827    for(multimap<CSCDetId , CSCRecHit2D>::iterator iter =  SegRechits.begin();iter != SegRechits.end(); ++iter){
01828            CSCDetId idrec = iter->first;
01829            int kEndcap  = idrec.endcap();
01830            int cEndcap  = idrec.endcap();
01831            if (kEndcap == 2)cEndcap = -1;
01832            int kRing    = idrec.ring();
01833            int kStation = idrec.station();
01834            int kChamber = idrec.chamber();
01835            int kLayer   = idrec.layer();
01836 
01837            // Store rechit as a Local Point:
01838            LocalPoint rhitlocal = (iter->second).localPosition();  
01839            float xreco = rhitlocal.x();
01840            float yreco = rhitlocal.y();
01841 
01842            // Find the strip containing this hit
01843            CSCRecHit2D::ChannelContainer hitstrips = (iter->second).channels();
01844            int nStrips     =  hitstrips.size();
01845            int centerid    =  nStrips/2 + 1;
01846            int centerStrip =  hitstrips[centerid - 1];
01847 
01848 
01849            // Find the charge associated with this hit
01850            
01851            CSCRecHit2D::ADCContainer adcs = (iter->second).adcs();
01852            int adcsize = adcs.size();
01853            float rHSumQ = 0;
01854            float sumsides = 0;
01855            for (int i = 0; i < adcsize; i++){
01856                    if (i != 3 && i != 7 && i != 11){
01857                            rHSumQ = rHSumQ + adcs[i]; 
01858                    }
01859                    if (adcsize == 12 && (i < 3 || i > 7) && i < 12){
01860                            sumsides = sumsides + adcs[i];
01861                    }
01862            }
01863            float rHratioQ = sumsides/rHSumQ;
01864            if (adcsize != 12) rHratioQ = -99;
01865            
01866            // Get the signal timing of this hit
01867            //float rHtime = (iter->second).tpeak();
01868            float rHtime = getTiming(*strips, idrec, centerStrip);
01869 
01870            // Get the width of this hit
01871            int rHwidth = getWidth(*strips, idrec, centerStrip);
01872 
01873 
01874            // Get pointer to the layer:
01875            const CSCLayer* csclayer = cscGeom->layer( idrec );
01876            
01877            // Transform hit position from local chamber geometry to global CMS geom
01878            GlobalPoint rhitglobal= csclayer->toGlobal(rhitlocal);
01879            float grecx   =  rhitglobal.x();
01880            float grecy   =  rhitglobal.y();
01881 
01882            // Simple occupancy variables
01883            int kCodeBroad  = cEndcap * ( 4*(kStation-1) + kRing) ;
01884            int kCodeNarrow = cEndcap * ( 100*(kRing-1) + kChamber) ;
01885 
01886            //Fill the non-associated rechits global position in histogram
01887            histos->fill1DHist(kCodeBroad,"hSegRHCodeBroad","broad scope code for recHits",33,-16.5,16.5,"AssociatedRechits");
01888            if (kStation == 1) histos->fill1DHist(kCodeNarrow,"hSegRHCodeNarrow1","narrow scope recHit code station 1",801,-400.5,400.5,"AssociatedRechits");
01889            if (kStation == 2) histos->fill1DHist(kCodeNarrow,"hSegRHCodeNarrow2","narrow scope recHit code station 2",801,-400.5,400.5,"AssociatedRechits");
01890            if (kStation == 3) histos->fill1DHist(kCodeNarrow,"hSegRHCodeNarrow3","narrow scope recHit code station 3",801,-400.5,400.5,"AssociatedRechits");
01891            if (kStation == 4) histos->fill1DHist(kCodeNarrow,"hSegRHCodeNarrow4","narrow scope recHit code station 4",801,-400.5,400.5,"AssociatedRechits");
01892            histos->fill1DHistByType(kLayer,"hSegRHLayer","RecHits per Layer",idrec,8,-0.5,7.5,"AssociatedRechits");
01893            histos->fill1DHistByType(xreco,"hSegRHX","Local X of recHit",idrec,160,-80.,80.,"AssociatedRechits");
01894            histos->fill1DHistByType(yreco,"hSegRHY","Local Y of recHit",idrec,60,-180.,180.,"AssociatedRechits");
01895            if (kStation == 1 && (kRing == 1 || kRing == 4)) histos->fill1DHistByType(rHSumQ,"hSegRHSumQ","Sum 3x3 recHit Charge",idrec,250,0,4000,"AssociatedRechits");
01896            else histos->fill1DHistByType(rHSumQ,"hSegRHSumQ","Sum 3x3 recHit Charge",idrec,250,0,2000,"AssociatedRechits");
01897            histos->fill1DHistByType(rHratioQ,"hSegRHRatioQ","Ratio (Ql+Qr)/Qt)",idrec,120,-0.1,1.1,"AssociatedRechits");
01898            histos->fill1DHistByType(rHtime,"hSegRHTiming","recHit Timing",idrec,100,0,10,"AssociatedRechits");
01899            histos->fill2DHistByStation(grecx,grecy,"hSegRHGlobal","recHit Global Position",idrec,400,-800.,800.,400,-800.,800.,"AssociatedRechits");
01900            histos->fill1DHistByType(rHwidth,"hSegRHwidth","width for Non associated recHit",idrec,21,-0.5,20.5,"AssociatedRechits");
01901            
01902    }
01903 
01904    distRHmap.clear();
01905    AllRechits.clear();
01906    SegRechits.clear();
01907    NonAssociatedRechits.clear();
01908 }

float CSCValidation::fitX ( HepMatrix  sp,
HepMatrix  ep 
) [private]

Definition at line 1023 of file CSCValidation.cc.

References HLT_VtxMuL3::errors, i, and slope.

Referenced by doSegments().

01023                                                            {
01024 
01025   float S   = 0;
01026   float Sx  = 0;
01027   float Sy  = 0;
01028   float Sxx = 0;
01029   float Sxy = 0;
01030   float sigma2 = 0;
01031 
01032   for (int i=1;i<7;i++){
01033     if (i != 3){
01034       sigma2 = errors(i,1)*errors(i,1);
01035       S = S + (1/sigma2);
01036       Sy = Sy + (points(i,1)/sigma2);
01037       Sx = Sx + ((i)/sigma2);
01038       Sxx = Sxx + (i*i)/sigma2;
01039       Sxy = Sxy + (((i)*points(i,1))/sigma2);
01040     }
01041   }
01042 
01043   float delta = S*Sxx - Sx*Sx;
01044   float intercept = (Sxx*Sy - Sx*Sxy)/delta;
01045   float slope = (S*Sxy - Sx*Sy)/delta;
01046 
01047   //float chi = 0;
01048   //float chi2 = 0;
01049 
01050   // calculate chi2 (not currently used)
01051   //for (int i=1;i<7;i++){
01052   //  chi = (points(i,1) - intercept - slope*i)/(errors(i,1));
01053   //  chi2 = chi2 + chi*chi;
01054   //}
01055 
01056   return (intercept + slope*3);
01057 
01058 }

void CSCValidation::getEfficiency ( float  bin,
float  Norm,
std::vector< float > &  eff 
) [private]

Definition at line 1428 of file CSCValidation.cc.

References funct::sqrt().

Referenced by histoEfficiency().

01428                                                                              {
01429   //---- Efficiency with binomial error
01430   float Efficiency = 0.;
01431   float EffError = 0.;
01432   if(fabs(Norm)>0.000000001){
01433     Efficiency = bin/Norm;
01434     if(bin<Norm){
01435       EffError = sqrt( (1.-Efficiency)*Efficiency/Norm );
01436     }
01437   }
01438   eff[0] = Efficiency;
01439   eff[1] = EffError;
01440 }

float CSCValidation::getSignal ( const CSCStripDigiCollection stripdigis,
CSCDetId  idRH,
int  centerStrip 
) [private]

Definition at line 1569 of file CSCValidation.cc.

References if(), and prof2calltree::last.

Referenced by doPedestalNoise().

01569                                                                                                       {
01570 
01571   float SigADC[5];
01572   float TotalADC = 0;
01573   SigADC[0] = 0;
01574   SigADC[1] = 0;
01575   SigADC[2] = 0;
01576   SigADC[3] = 0;
01577   SigADC[4] = 0;
01578 
01579  
01580   // Loop over strip digis 
01581   CSCStripDigiCollection::DigiRangeIterator sIt;
01582   
01583   for (sIt = stripdigis.begin(); sIt != stripdigis.end(); sIt++){
01584     CSCDetId id = (CSCDetId)(*sIt).first;
01585     if (id == idCS){
01586 
01587       // First, find the Signal-Pedestal for center strip
01588       vector<CSCStripDigi>::const_iterator digiItr = (*sIt).second.first;
01589       vector<CSCStripDigi>::const_iterator last = (*sIt).second.second;
01590       for ( ; digiItr != last; ++digiItr ) {
01591         int thisStrip = digiItr->getStrip();
01592         if (thisStrip == (centerStrip)){
01593           std::vector<int> myADCVals = digiItr->getADCCounts();
01594           float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
01595           float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
01596           SigADC[0] = thisSignal - 6*thisPedestal;
01597         }
01598      // Now,find the Signal-Pedestal for neighbouring 4 strips
01599         if (thisStrip == (centerStrip+1)){
01600           std::vector<int> myADCVals = digiItr->getADCCounts();
01601           float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
01602           float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
01603           SigADC[1] = thisSignal - 6*thisPedestal;
01604         }
01605         if (thisStrip == (centerStrip+2)){
01606           std::vector<int> myADCVals = digiItr->getADCCounts();
01607           float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
01608           float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
01609           SigADC[2] = thisSignal - 6*thisPedestal;
01610         }
01611         if (thisStrip == (centerStrip-1)){
01612           std::vector<int> myADCVals = digiItr->getADCCounts();
01613           float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
01614           float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
01615           SigADC[3] = thisSignal - 6*thisPedestal;
01616         }
01617         if (thisStrip == (centerStrip-2)){
01618           std::vector<int> myADCVals = digiItr->getADCCounts();
01619           float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
01620           float thisSignal = (myADCVals[2]+myADCVals[3]+myADCVals[4]+myADCVals[5]+myADCVals[6]+myADCVals[7]);
01621           SigADC[4] = thisSignal - 6*thisPedestal;
01622         }
01623       }
01624       TotalADC = 0.2*(SigADC[0]+SigADC[1]+SigADC[2]+SigADC[3]+SigADC[4]);
01625     }
01626   }
01627   return TotalADC;
01628 }

float CSCValidation::getthisSignal ( const CSCStripDigiCollection stripdigis,
CSCDetId  idRH,
int  centerStrip 
) [private]

Definition at line 1912 of file CSCValidation.cc.

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

Referenced by doNoiseHits().

01912                                                                                                           {
01913         // Loop over strip digis responsible for this recHit
01914         CSCStripDigiCollection::DigiRangeIterator sIt;
01915         float thisADC = 0.;
01916         bool foundRHid = false;
01917         // std::cout<<"iD   S/R/C/L = "<<idRH<<"    "<<idRH.station()<<"/"<<idRH.ring()<<"/"<<idRH.chamber()<<"/"<<idRH.layer()<<std::endl;
01918         for (sIt = stripdigis.begin(); sIt != stripdigis.end(); sIt++){
01919                 CSCDetId id = (CSCDetId)(*sIt).first;
01920                 //std::cout<<"STRIPS: id    S/R/C/L = "<<id<<"     "<<id.station()<<"/"<<id.ring()<<"/"<<id.chamber()<<"/"<<id.layer()<<std::endl;
01921                 if (id == idRH){
01922                         foundRHid = true;
01923                         vector<CSCStripDigi>::const_iterator digiItr = (*sIt).second.first;
01924                         vector<CSCStripDigi>::const_iterator last = (*sIt).second.second;
01925                         //if(digiItr == last ) {std::cout << " Attention1 :: Size of digi collection is zero " << std::endl;}
01926                         int St = idRH.station();
01927                         int Rg    = idRH.ring();
01928                         if (St == 1 && Rg == 4){
01929                                 while(centerStrip> 16) centerStrip -= 16;
01930                         }
01931                         for ( ; digiItr != last; ++digiItr ) {
01932                                 int thisStrip = digiItr->getStrip();
01933                                 //std::cout<<" thisStrip = "<<thisStrip<<" centerStrip = "<<centerStrip<<std::endl;
01934                                 std::vector<int> myADCVals = digiItr->getADCCounts();
01935                                 float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
01936                                 float Signal = (float) myADCVals[3];
01937                                 if (thisStrip == (centerStrip)){
01938                                         thisADC = Signal-thisPedestal;
01939                                         //if(thisADC >= 0. && thisADC <2.) {std::cout << " Attention2 :: The Signal is equal to the pedestal " << std::endl;
01940                                         //}
01941                                         //if(thisADC < 0.) {std::cout << " Attention3 :: The Signal is less than the pedestal " << std::endl;
01942                                         //}
01943                                 }
01944                                 if (thisStrip == (centerStrip+1)){
01945                                         std::vector<int> myADCVals = digiItr->getADCCounts();
01946                                 }
01947                                 if (thisStrip == (centerStrip-1)){
01948                                         std::vector<int> myADCVals = digiItr->getADCCounts();
01949                                 }
01950                         }
01951                 }
01952         }
01953         //if(!foundRHid){std::cout << " Attention4 :: Did not find a matching RH id in the Strip Digi collection " << std::endl;}
01954         return thisADC;
01955 }

float CSCValidation::getTiming ( const CSCStripDigiCollection stripdigis,
CSCDetId  idRH,
int  centerStrip 
) [private]

Definition at line 1066 of file CSCValidation.cc.

References chamberSerial(), detailedAnalysis, diff, CSCValHists::fill1DHistByLayer(), CSCValHists::fillProfile(), CSCValHists::fillProfileByChamber(), histos, i, if(), CSCDetId::ring(), and CSCDetId::station().

Referenced by doADCTiming(), doRecHits(), and findNonAssociatedRecHits().

01066                                                                                                       {
01067 
01068   float ADC[8];
01069   for (int i = 0; i < 8; i++){
01070     ADC[i] = 0;
01071   }
01072   float timing = 0;
01073   float peakADC = 0;
01074   int peakTime = 0;
01075 
01076   if (idRH.station() == 1 && idRH.ring() == 4){
01077     while(centerStrip> 16) centerStrip -= 16;
01078   }
01079 
01080   // Loop over strip digis responsible for this recHit and sum charge
01081   CSCStripDigiCollection::DigiRangeIterator gTstripIter;
01082 
01083   for (gTstripIter = stripdigis.begin(); gTstripIter != stripdigis.end(); gTstripIter++){
01084     CSCDetId id = (CSCDetId)(*gTstripIter).first;
01085     if (id == idRH){
01086       vector<CSCStripDigi>::const_iterator STiter = (*gTstripIter).second.first;
01087       vector<CSCStripDigi>::const_iterator lastS = (*gTstripIter).second.second;
01088       for ( ; STiter != lastS; ++STiter ) {
01089         int thisStrip = STiter->getStrip();
01090         if (thisStrip == (centerStrip)){
01091           float diff = 0;
01092           vector<int> myADCVals = STiter->getADCCounts();
01093           float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
01094           for (unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
01095             diff = (float)myADCVals[iCount]-thisPedestal;
01096             ADC[iCount] = diff;
01097             if (diff > peakADC){
01098               peakADC = diff;
01099               peakTime = iCount;
01100             }
01101           }
01102         }
01103       }
01104 
01105     }
01106 
01107   }
01108 
01109   if (detailedAnalysis){
01110     float normADC;
01111     for (int i = 0; i < 8; i++){
01112       normADC = ADC[i]/ADC[peakTime];
01113       histos->fillProfileByChamber(i,normADC,"hSignalProfile","Normalized Signal Profile",idRH,8,-0.5,7.5,-0.1,1.1,"StripSignalProfile");
01114     }
01115     histos->fill1DHistByLayer(ADC[0],"hSigProPed","ADC in first time bin",idRH,400,-300,100,"StripSignalProfile");
01116     histos->fillProfile(chamberSerial(idRH),ADC[0],"hSigProPedProfile","ADC in first time bin",601,-0.5,600.5,-150,100,"StripSignalProfile");
01117   }
01118 
01119 
01120   timing = (ADC[2]*2 + ADC[3]*3 + ADC[4]*4 + ADC[5]*5 + ADC[6]*6)/(ADC[2] + ADC[3] + ADC[4] + ADC[5] + ADC[6]);
01121 
01122   return timing;
01123 
01124 }

int CSCValidation::getWidth ( const CSCStripDigiCollection stripdigis,
CSCDetId  idRH,
int  centerStrip 
) [private]

Definition at line 1963 of file CSCValidation.cc.

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

Referenced by findNonAssociatedRecHits().

01963                                                                                                    {
01964 
01965   int width = 1;
01966   int widthpos = 0;
01967   int widthneg = 0;
01968 
01969   // Loop over strip digis responsible for this recHit and sum charge
01970   CSCStripDigiCollection::DigiRangeIterator sIt;
01971 
01972   for (sIt = stripdigis.begin(); sIt != stripdigis.end(); sIt++){
01973           CSCDetId id = (CSCDetId)(*sIt).first;
01974           if (id == idRH){
01975                   vector<CSCStripDigi>::const_iterator digiItr = (*sIt).second.first;
01976                   vector<CSCStripDigi>::const_iterator first = (*sIt).second.first;
01977                   vector<CSCStripDigi>::const_iterator last = (*sIt).second.second;
01978                   vector<CSCStripDigi>::const_iterator it = (*sIt).second.first;
01979                   vector<CSCStripDigi>::const_iterator itr = (*sIt).second.first;
01980                   //std::cout << " IDRH " << id <<std::endl;
01981                   int St = idRH.station();
01982                   int Rg    = idRH.ring();
01983                   if (St == 1 && Rg == 4){
01984                           while(centerStrip> 16) centerStrip -= 16;
01985                   }
01986                   for ( ; digiItr != last; ++digiItr ) {
01987                           int thisStrip = digiItr->getStrip();
01988                           if (thisStrip == (centerStrip)){
01989                                   it = digiItr;
01990                                   for( ; it != last; ++it ) {
01991                                           int strip = it->getStrip();
01992                                           std::vector<int> myADCVals = it->getADCCounts();
01993                                           float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
01994                                           if(((float)myADCVals[3]-thisPedestal) < 6 || widthpos == 10 || it==last){break;}
01995                                            if(strip != centerStrip){ widthpos += 1;
01996                                            }
01997                                   }
01998                                   itr = digiItr;
01999                                   for( ; itr != first; --itr) {
02000                                           int strip = itr->getStrip();
02001                                           std::vector<int> myADCVals = itr->getADCCounts();
02002                                           float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
02003                                           if(((float)myADCVals[3]-thisPedestal) < 6 || widthneg == 10 || itr==first){break;}     
02004                                           if(strip != centerStrip) {widthneg += 1 ; 
02005                                           }
02006                                   }
02007                           }
02008                   }
02009           }
02010   }
02011   //std::cout << "Widthneg - " <<  widthneg << "Widthpos + " <<  widthpos << std::endl;
02012   width =  width + widthneg +  widthpos ;
02013   //std::cout << "Width " <<  width << std::endl;
02014   return width;
02015 }

void CSCValidation::histoEfficiency ( TH1F *  readHisto,
TH1F *  writeHisto 
) [private]

Definition at line 1442 of file CSCValidation.cc.

References getEfficiency(), and i.

Referenced by ~CSCValidation().

01442                                                                     {
01443   std::vector<float> eff(2);
01444   int Nbins =  readHisto->GetSize()-2;//without underflows and overflows
01445   std::vector<float> bins(Nbins);
01446   std::vector<float> Efficiency(Nbins);
01447   std::vector<float> EffError(Nbins);
01448   float Num = 1;
01449   float Den = 1;
01450   for (int i=0;i<20;i++){
01451     Num = readHisto->GetBinContent(i+1);
01452     Den = readHisto->GetBinContent(i+21);
01453     getEfficiency(Num, Den, eff);
01454     Efficiency[i] = eff[0];
01455     EffError[i] = eff[1];
01456     writeHisto->SetBinContent(i+1, Efficiency[i]);
01457     writeHisto->SetBinError(i+1, EffError[i]);
01458   }
01459 }

double CSCValidation::lineParametrization ( double  z1Position,
double  z2Position,
double  z1Direction 
) [inline, private]

Definition at line 150 of file CSCValidation.h.

Referenced by doEfficiencies().

00150                                                                                       {
00151     double parameterLine = (z2Position-z1Position)/z1Direction;
00152     return parameterLine;
00153   }

int CSCValidation::typeIndex ( CSCDetId  id  )  [inline, private]

Definition at line 246 of file CSCValidation.h.

References GeomDetEnumerators::endcap, and index.

Referenced by doOccupancies().

00246                             {
00247     // linearlized index bases on endcap, station, and ring
00248     int index = 0;
00249     if (id.station() == 1){
00250       index = id.ring() + 1;
00251       if (id.ring() == 4) index = 1;
00252     }
00253     else index = id.station()*2 + id.ring();
00254     if (id.endcap() == 1) index = index + 10;
00255     if (id.endcap() == 2) index = 11 - index;
00256     return index;
00257   }

bool CSCValidation::withinSensitiveRegion ( LocalPoint  localPos,
const std::vector< float >  layerBounds,
int  station,
int  ring,
float  shiftFromEdge,
float  shiftFromDeadZone 
) [private]

Definition at line 1461 of file CSCValidation.cc.

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

Referenced by doEfficiencies().

01461                                                                                                                                                                      {
01462 //---- check if it is in a good local region (sensitive area - geometrical and HV boundaries excluded) 
01463   bool pass = false;
01464 
01465   float y_center = 0.;
01466   double yUp = layerBounds[3] + y_center;
01467   double yDown = - layerBounds[3] + y_center;
01468   double xBound1Shifted = layerBounds[0] - shiftFromEdge;//
01469   double xBound2Shifted = layerBounds[1] - shiftFromEdge;//
01470   double lineSlope = (yUp - yDown)/(xBound2Shifted-xBound1Shifted);
01471   double lineConst = yUp - lineSlope*xBound2Shifted;
01472   double yBorder =  lineSlope*abs(localPos.x()) + lineConst;
01473       
01474   //bool withinChamberOnly = false;// false = "good region"; true - boundaries only
01475   std::vector <float> deadZoneCenter(6);
01476   float cutZone = shiftFromDeadZone;//cm
01477   //---- hardcoded... not good
01478   if(station>1 && station<5){
01479     if(2==ring){
01480       deadZoneCenter[0]= -162.48 ;
01481       deadZoneCenter[1] = -81.8744;
01482       deadZoneCenter[2] = -21.18165;
01483       deadZoneCenter[3] = 39.51105;
01484       deadZoneCenter[4] = 100.2939;
01485       deadZoneCenter[5] = 160.58;
01486       
01487       if(localPos.y() >yBorder &&
01488          ((localPos.y()> deadZoneCenter[0] + cutZone && localPos.y()< deadZoneCenter[1] - cutZone) ||
01489           (localPos.y()> deadZoneCenter[1] + cutZone && localPos.y()< deadZoneCenter[2] - cutZone) ||
01490           (localPos.y()> deadZoneCenter[2] + cutZone && localPos.y()< deadZoneCenter[3] - cutZone) ||
01491           (localPos.y()> deadZoneCenter[3] + cutZone && localPos.y()< deadZoneCenter[4] - cutZone) ||
01492           (localPos.y()> deadZoneCenter[4] + cutZone && localPos.y()< deadZoneCenter[5] - cutZone))){
01493         pass = true;
01494       }
01495     }
01496     else if(1==ring){
01497       if(2==station){
01498         deadZoneCenter[0]= -95.80 ;
01499         deadZoneCenter[1] = -27.47;
01500         deadZoneCenter[2] = 33.67;
01501         deadZoneCenter[3] = 90.85;
01502         }
01503       else if(3==station){
01504         deadZoneCenter[0]= -89.305 ;
01505         deadZoneCenter[1] = -39.705;
01506         deadZoneCenter[2] = 20.195;
01507         deadZoneCenter[3] = 77.395;
01508       }
01509       else if(4==station){
01510         deadZoneCenter[0]= -75.645;
01511         deadZoneCenter[1] = -26.055;
01512         deadZoneCenter[2] = 23.855;
01513         deadZoneCenter[3] = 70.575;
01514       }
01515       if(localPos.y() >yBorder &&
01516          ((localPos.y()> deadZoneCenter[0] + cutZone && localPos.y()< deadZoneCenter[1] - cutZone) ||
01517           (localPos.y()> deadZoneCenter[1] + cutZone && localPos.y()< deadZoneCenter[2] - cutZone) ||
01518           (localPos.y()> deadZoneCenter[2] + cutZone && localPos.y()< deadZoneCenter[3] - cutZone))){
01519         pass = true;
01520       }
01521     }
01522   }
01523   else if(1==station){
01524     if(3==ring){
01525       deadZoneCenter[0]= -83.155 ;
01526       deadZoneCenter[1] = -22.7401;
01527       deadZoneCenter[2] = 27.86665;
01528       deadZoneCenter[3] = 81.005;
01529       if(localPos.y() > yBorder &&
01530          ((localPos.y()> deadZoneCenter[0] + cutZone && localPos.y()< deadZoneCenter[1] - cutZone) ||
01531           (localPos.y()> deadZoneCenter[1] + cutZone && localPos.y()< deadZoneCenter[2] - cutZone) ||
01532           (localPos.y()> deadZoneCenter[2] + cutZone && localPos.y()< deadZoneCenter[3] - cutZone))){
01533         pass = true;
01534       }
01535     }
01536     else if(2==ring){
01537       deadZoneCenter[0]= -86.285 ;
01538       deadZoneCenter[1] = -32.88305;
01539       deadZoneCenter[2] = 32.867423;
01540       deadZoneCenter[3] = 88.205;
01541       if(localPos.y() > (yBorder) &&
01542          ((localPos.y()> deadZoneCenter[0] + cutZone && localPos.y()< deadZoneCenter[1] - cutZone) ||
01543           (localPos.y()> deadZoneCenter[1] + cutZone && localPos.y()< deadZoneCenter[2] - cutZone) ||
01544           (localPos.y()> deadZoneCenter[2] + cutZone && localPos.y()< deadZoneCenter[3] - cutZone))){
01545         pass = true;
01546       }
01547     }
01548     else{
01549       deadZoneCenter[0]= -81.0;
01550       deadZoneCenter[1] = 81.0;
01551       if(localPos.y() > (yBorder) &&
01552          (localPos.y()> deadZoneCenter[0] + cutZone && localPos.y()< deadZoneCenter[1] - cutZone )){
01553         pass = true;
01554       }
01555     }
01556   }
01557   return pass;
01558 }


Member Data Documentation

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

Definition at line 241 of file CSCValidation.h.

Referenced by doNoiseHits(), and findNonAssociatedRecHits().

edm::InputTag CSCValidation::compDigiTag [private]

Definition at line 186 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

edm::InputTag CSCValidation::cscRecHitTag [private]

Definition at line 187 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

edm::InputTag CSCValidation::cscSegTag [private]

Definition at line 188 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

bool CSCValidation::detailedAnalysis [private]

Definition at line 180 of file CSCValidation.h.

Referenced by CSCValidation(), doPedestalNoise(), doRecHits(), doSegments(), doStripDigis(), doWireDigis(), and getTiming().

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

Definition at line 244 of file CSCValidation.h.

Referenced by findNonAssociatedRecHits().

TH2F* CSCValidation::hEffDenominator [private]

Definition at line 226 of file CSCValidation.h.

Referenced by CSCValidation(), doEfficiencies(), and ~CSCValidation().

CSCValHists* CSCValidation::histos [private]

Definition at line 211 of file CSCValidation.h.

Referenced by CSCValidation(), doADCTiming(), doAFEBTiming(), doCalibrations(), doCompTiming(), doGasGain(), doNoiseHits(), doOccupancies(), doPedestalNoise(), doRecHits(), doSegments(), doSimHits(), doStandalone(), doStripDigis(), doTrigger(), doWireDigis(), findNonAssociatedRecHits(), getTiming(), and ~CSCValidation().

TH2I* CSCValidation::hORecHits [private]

Definition at line 232 of file CSCValidation.h.

Referenced by CSCValidation(), doOccupancies(), and ~CSCValidation().

TH2I* CSCValidation::hOSegments [private]

Definition at line 233 of file CSCValidation.h.

Referenced by CSCValidation(), doOccupancies(), and ~CSCValidation().

TH2I* CSCValidation::hOStrips [private]

Definition at line 231 of file CSCValidation.h.

Referenced by CSCValidation(), doOccupancies(), and ~CSCValidation().

TH2I* CSCValidation::hOWires [private]

Definition at line 230 of file CSCValidation.h.

Referenced by CSCValidation(), doOccupancies(), and ~CSCValidation().

TH1F* CSCValidation::hRHEff [private]

Definition at line 217 of file CSCValidation.h.

Referenced by CSCValidation(), and ~CSCValidation().

TH2F* CSCValidation::hRHEff2 [private]

Definition at line 223 of file CSCValidation.h.

Referenced by CSCValidation(), and ~CSCValidation().

TH1F* CSCValidation::hRHSTE [private]

Definition at line 215 of file CSCValidation.h.

Referenced by CSCValidation(), doEfficiencies(), and ~CSCValidation().

TH2F* CSCValidation::hRHSTE2 [private]

Definition at line 219 of file CSCValidation.h.

Referenced by CSCValidation(), doEfficiencies(), and ~CSCValidation().

TH1F* CSCValidation::hSEff [private]

Definition at line 216 of file CSCValidation.h.

Referenced by CSCValidation(), and ~CSCValidation().

TH2F* CSCValidation::hSEff2 [private]

Definition at line 222 of file CSCValidation.h.

Referenced by CSCValidation(), and ~CSCValidation().

TH2F* CSCValidation::hSensitiveAreaEvt [private]

Definition at line 227 of file CSCValidation.h.

Referenced by CSCValidation(), doEfficiencies(), and ~CSCValidation().

TH1F* CSCValidation::hSSTE [private]

Definition at line 214 of file CSCValidation.h.

Referenced by CSCValidation(), doEfficiencies(), and ~CSCValidation().

TH2F* CSCValidation::hSSTE2 [private]

Definition at line 218 of file CSCValidation.h.

Referenced by CSCValidation(), doEfficiencies(), and ~CSCValidation().

TH2F* CSCValidation::hStripEff2 [private]

Definition at line 224 of file CSCValidation.h.

Referenced by CSCValidation(), and ~CSCValidation().

TH2F* CSCValidation::hStripSTE2 [private]

Definition at line 220 of file CSCValidation.h.

Referenced by CSCValidation(), doEfficiencies(), and ~CSCValidation().

TH2F* CSCValidation::hWireEff2 [private]

Definition at line 225 of file CSCValidation.h.

Referenced by CSCValidation(), and ~CSCValidation().

TH2F* CSCValidation::hWireSTE2 [private]

Definition at line 221 of file CSCValidation.h.

Referenced by CSCValidation(), doEfficiencies(), and ~CSCValidation().

bool CSCValidation::isSimulation [private]

Definition at line 178 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

edm::InputTag CSCValidation::l1aTag [private]

Definition at line 190 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

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

Definition at line 238 of file CSCValidation.h.

Referenced by doGasGain().

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

Definition at line 237 of file CSCValidation.h.

Referenced by doGasGain().

bool CSCValidation::makeADCTimingPlots [private]

Definition at line 204 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

bool CSCValidation::makeAFEBTimingPlots [private]

Definition at line 202 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

bool CSCValidation::makeCalibPlots [private]

Definition at line 206 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

bool CSCValidation::makeComparisonPlots [private]

Definition at line 175 of file CSCValidation.h.

bool CSCValidation::makeCompTimingPlots [private]

Definition at line 203 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

bool CSCValidation::makeEfficiencyPlots [private]

Definition at line 200 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

bool CSCValidation::makeGasGainPlots [private]

Definition at line 201 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

bool CSCValidation::makeOccupancyPlots [private]

Definition at line 193 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

bool CSCValidation::makePedNoisePlots [private]

Definition at line 199 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

bool CSCValidation::makePlots [private]

Definition at line 174 of file CSCValidation.h.

bool CSCValidation::makeRecHitPlots [private]

Definition at line 196 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

bool CSCValidation::makeRHNoisePlots [private]

Definition at line 205 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

bool CSCValidation::makeSegmentPlots [private]

Definition at line 198 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

bool CSCValidation::makeSimHitPlots [private]

Definition at line 197 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

bool CSCValidation::makeStandalonePlots [private]

Definition at line 207 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

bool CSCValidation::makeStripPlots [private]

Definition at line 194 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

bool CSCValidation::makeTriggerPlots [private]

Definition at line 208 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

bool CSCValidation::makeWirePlots [private]

Definition at line 195 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

int CSCValidation::nEventsAnalyzed [private]

Definition at line 162 of file CSCValidation.h.

Referenced by analyze(), CSCValidation(), doCalibrations(), doGasGain(), and endJob().

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

Maps and vectors for module doGasGain().

Definition at line 236 of file CSCValidation.h.

Referenced by doGasGain().

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

Definition at line 243 of file CSCValidation.h.

Referenced by findNonAssociatedRecHits().

std::string CSCValidation::refRootFile [private]

Definition at line 176 of file CSCValidation.h.

int CSCValidation::rhTreeCount [private]

Definition at line 163 of file CSCValidation.h.

Referenced by CSCValidation(), and doRecHits().

std::string CSCValidation::rootFileName [private]

Definition at line 179 of file CSCValidation.h.

Referenced by CSCValidation().

edm::InputTag CSCValidation::saMuonTag [private]

Definition at line 189 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

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

Definition at line 242 of file CSCValidation.h.

Referenced by doNoiseHits(), and findNonAssociatedRecHits().

int CSCValidation::segTreeCount [private]

Definition at line 164 of file CSCValidation.h.

Referenced by CSCValidation(), and doSegments().

edm::InputTag CSCValidation::simHitTag [private]

Definition at line 191 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

edm::InputTag CSCValidation::stripDigiTag [private]

Definition at line 184 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

TFile* CSCValidation::theFile [private]

Definition at line 169 of file CSCValidation.h.

Referenced by CSCValidation(), and ~CSCValidation().

bool CSCValidation::useDigis [private]

Definition at line 181 of file CSCValidation.h.

Referenced by analyze(), CSCValidation(), doEfficiencies(), doOccupancies(), and doRecHits().

bool CSCValidation::useTrigger [private]

Definition at line 182 of file CSCValidation.h.

Referenced by CSCValidation().

edm::InputTag CSCValidation::wireDigiTag [private]

Definition at line 185 of file CSCValidation.h.

Referenced by analyze(), and CSCValidation().

bool CSCValidation::writeTreeToFile [private]

Definition at line 177 of file CSCValidation.h.

Referenced by CSCValidation(), doRecHits(), doSegments(), and ~CSCValidation().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:17:32 2009 for CMSSW by  doxygen 1.5.4