CMS 3D CMS Logo

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

#include <CSCEfficiency.h>

Inheritance diagram for CSCEfficiency:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  ChamberHistos
 
struct  StationHistos
 

Public Member Functions

 CSCEfficiency (const edm::ParameterSet &pset)
 Constructor. More...
 
virtual ~CSCEfficiency ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

bool applyTrigger (edm::Handle< edm::TriggerResults > &hltR, const edm::TriggerNames &triggerNames)
 
virtual void beginJob ()
 
void chamberCandidates (int station, int ring, float phi, std::vector< int > &coupleOfChambers)
 
bool checkLocal (double yLocal, double yBoundary, int station, int ring)
 
void chooseDirection (CLHEP::Hep3Vector &innerPosition, CLHEP::Hep3Vector &outerPosition)
 
bool efficienciesPerChamber (CSCDetId &id, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber)
 
virtual void endJob ()
 
double extrapolate1D (double initPosition, double initDirection, double parameterOfTheLine)
 
void fillDigiInfo (edm::Handle< CSCALCTDigiCollection > &alcts, edm::Handle< CSCCLCTDigiCollection > &clcts, edm::Handle< CSCCorrelatedLCTDigiCollection > &correlatedlcts, edm::Handle< CSCWireDigiCollection > &wires, edm::Handle< CSCStripDigiCollection > &strips, edm::Handle< edm::PSimHitContainer > &simhits, edm::Handle< CSCRecHit2DCollection > &rechits, edm::Handle< CSCSegmentCollection > &segments, edm::ESHandle< CSCGeometry > &cscGeom)
 
void fillLCT_info (edm::Handle< CSCALCTDigiCollection > &alcts, edm::Handle< CSCCLCTDigiCollection > &clcts, edm::Handle< CSCCorrelatedLCTDigiCollection > &correlatedlcts)
 
void fillRechitsSegments_info (edm::Handle< CSCRecHit2DCollection > &rechits, edm::Handle< CSCSegmentCollection > &segments, edm::ESHandle< CSCGeometry > &cscGeom)
 
void fillSimhit_info (edm::Handle< edm::PSimHitContainer > &simHits)
 
void fillStrips_info (edm::Handle< CSCStripDigiCollection > &strips)
 
void fillWG_info (edm::Handle< CSCWireDigiCollection > &wires, edm::ESHandle< CSCGeometry > &cscGeom)
 
virtual bool filter (edm::Event &event, const edm::EventSetup &eventSetup)
 
FreeTrajectoryState getFromCLHEP (const CLHEP::Hep3Vector &p3, const CLHEP::Hep3Vector &r3, int charge, const AlgebraicSymMatrix66 &cov, const MagneticField *field)
 
void getFromFTS (const FreeTrajectoryState &fts, CLHEP::Hep3Vector &p3, CLHEP::Hep3Vector &r3, int &charge, AlgebraicSymMatrix66 &cov)
 
bool inSensitiveLocalRegion (double xLocal, double yLocal, int station, int ring)
 
void linearExtrapolation (GlobalPoint initialPosition, GlobalVector initialDirection, float zSurface, std::vector< float > &posZY)
 
double lineParameter (double initZPosition, double destZPosition, double initZDirection)
 
TrajectoryStateOnSurface propagate (FreeTrajectoryState &ftsStart, const BoundPlane &bp)
 
const Propagatorpropagator (std::string propagatorName) const
 
bool recHitSegment_Efficiencies (CSCDetId &cscDetId, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber)
 
bool recSimHitEfficiency (CSCDetId &id, FreeTrajectoryState &ftsChamber)
 
void returnTypes (CSCDetId &id, int &ec, int &st, int &rg, int &ch, int &secondRing)
 
void ringCandidates (int station, float absEta, std::map< std::string, bool > &chamberTypes)
 
bool stripWire_Efficiencies (CSCDetId &cscDetId, FreeTrajectoryState &ftsChamber)
 

Private Attributes

edm::EDGetTokenT
< CSCALCTDigiCollection
al_token
 
TH1F * ALCTPerEvent
 
bool allALCT [2][4][4][NumCh]
 
bool allCLCT [2][4][4][NumCh]
 
bool allCorrLCT [2][4][4][NumCh]
 
std::vector< std::pair
< LocalPoint, bool > > 
allRechits [2][4][4][NumCh][6]
 
std::vector< std::pair
< LocalPoint, LocalVector > > 
allSegments [2][4][4][NumCh]
 
std::vector< std::pair
< LocalPoint, int > > 
allSimhits [2][4][4][NumCh][6]
 
std::vector< std::pair< int,
float > > 
allStrips [2][4][4][NumCh][6]
 
std::vector< std::pair
< std::pair< int, float >, int > > 
allWG [2][4][4][NumCh][6]
 
bool alongZ
 
bool andOr
 
bool applyIPangleCuts
 
struct CSCEfficiency::ChamberHistos ChHist [2][4][3][LastCh-FirstCh+1]
 
edm::EDGetTokenT
< CSCCLCTDigiCollection
cl_token
 
TH1F * CLCTPerEvent
 
edm::EDGetTokenT
< CSCCorrelatedLCTDigiCollection
co_token
 
TH1F * DataFlow
 
double distanceFromDeadZone
 
bool emptyChambers [2][4][4][NumCh]
 
bool getAbsoluteEfficiency
 
edm::EDGetTokenT
< edm::TriggerResults
ht_token
 
bool isBeamdata
 
bool isData
 
bool isIPdata
 
double local_DX_DZ_Max
 
double local_DY_DZ_Max
 
double local_DY_DZ_Min
 
bool magField
 
double maxNormChi2
 
double maxP
 
double minP
 
unsigned int minTrackHits
 
std::vector< std::string > myTriggers
 
int nEventsAnalyzed
 
bool passTheEvent
 
std::vector< int > pointToTriggers
 
bool printalot
 
unsigned int printout_NEvents
 
TH1F * recHitsPerEvent
 
edm::EDGetTokenT
< CSCRecHit2DCollection
rh_token
 
std::string rootFileName
 
edm::EDGetTokenT
< CSCStripDigiCollection
sd_token
 
edm::EDGetTokenT
< CSCSegmentCollection
se_token
 
TH1F * segmentsPerEvent
 
edm::EDGetTokenT
< edm::PSimHitContainer
sh_token
 
struct CSCEfficiency::StationHistos StHist [2][4]
 
TFile * theFile
 
MuonServiceProxytheService
 
edm::EDGetTokenT< edm::View
< reco::Track > > 
tk_token
 
TH1F * TriggersFired
 
bool useDigis
 
bool useTrigger
 
edm::EDGetTokenT
< CSCWireDigiCollection
wd_token
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Efficiency calculations Stoyan Stoynev, Northwestern University

Definition at line 116 of file CSCEfficiency.h.

Constructor & Destructor Documentation

CSCEfficiency::CSCEfficiency ( const edm::ParameterSet pset)

Constructor.

Definition at line 1621 of file CSCEfficiency.cc.

References CommPDSkim_cfg::andOr, FirstCh, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), getDQMSummary::iter, alignBH_cfg::minP, MuonServiceProxy_cff::MuonServiceProxy, NumCh, CSCOverlapsAlignmentAlgorithm_cff::Path, dtT0Analyzer_cfg::rootFileName, AlCaHLTBitMon_QueryRunRegistry::string, and interactiveExample::theFile.

1621  {
1622 
1623  // const float Xmin = -70;
1624  //const float Xmax = 70;
1625  //const int nXbins = int(4.*(Xmax - Xmin));
1626  const float Ymin = -165;
1627  const float Ymax = 165;
1628  const int nYbins = int((Ymax - Ymin)/2);
1629  const float Layer_min = -0.5;
1630  const float Layer_max = 9.5;
1631  const int nLayer_bins = int(Layer_max - Layer_min);
1632  //
1633 
1634  //---- Get the input parameters
1635  printout_NEvents = pset.getUntrackedParameter<unsigned int>("printout_NEvents",0);
1636  rootFileName = pset.getUntrackedParameter<string>("rootFileName","cscHists.root");
1637 
1638  isData = pset.getUntrackedParameter<bool>("runOnData",true);//
1639  isIPdata = pset.getUntrackedParameter<bool>("IPdata",false);//
1640  isBeamdata = pset.getUntrackedParameter<bool>("Beamdata",false);//
1641  getAbsoluteEfficiency = pset.getUntrackedParameter<bool>("getAbsoluteEfficiency",true);//
1642  useDigis = pset.getUntrackedParameter<bool>("useDigis", true);//
1643  distanceFromDeadZone = pset.getUntrackedParameter<double>("distanceFromDeadZone", 10.);//
1644  minP = pset.getUntrackedParameter<double>("minP",20.);//
1645  maxP = pset.getUntrackedParameter<double>("maxP",100.);//
1646  maxNormChi2 = pset.getUntrackedParameter<double>("maxNormChi2", 3.);//
1647  minTrackHits = pset.getUntrackedParameter<unsigned int>("minTrackHits",10);//
1648 
1649  applyIPangleCuts = pset.getUntrackedParameter<bool>("applyIPangleCuts", false);//
1650  local_DY_DZ_Max = pset.getUntrackedParameter<double>("local_DY_DZ_Max",-0.1);//
1651  local_DY_DZ_Min = pset.getUntrackedParameter<double>("local_DY_DZ_Min",-0.8);//
1652  local_DX_DZ_Max = pset.getUntrackedParameter<double>("local_DX_DZ_Max",0.2);//
1653 
1654  sd_token = consumes<CSCStripDigiCollection>( pset.getParameter<edm::InputTag>("stripDigiTag") );
1655  wd_token = consumes<CSCWireDigiCollection>( pset.getParameter<edm::InputTag>("wireDigiTag") );
1656  al_token = consumes<CSCALCTDigiCollection>( pset.getParameter<edm::InputTag>("alctDigiTag") );
1657  cl_token = consumes<CSCCLCTDigiCollection>( pset.getParameter<edm::InputTag>("clctDigiTag") );
1658  co_token = consumes<CSCCorrelatedLCTDigiCollection>( pset.getParameter<edm::InputTag>("corrlctDigiTag") );
1659  rh_token = consumes<CSCRecHit2DCollection>( pset.getParameter<edm::InputTag>("rechitTag") );
1660  se_token = consumes<CSCSegmentCollection>( pset.getParameter<edm::InputTag>("segmentTag") );
1661  tk_token = consumes<edm::View<reco::Track> >( pset.getParameter<edm::InputTag>("tracksTag") );
1662  sh_token = consumes<edm::PSimHitContainer>( pset.getParameter<edm::InputTag>("simHitTag") );
1663 
1664 
1665  edm::ParameterSet serviceParameters = pset.getParameter<edm::ParameterSet>("ServiceParameters");
1666  // maybe use the service for getting magnetic field, propagators, etc. ...
1667  theService = new MuonServiceProxy(serviceParameters);
1668 
1669  // Trigger
1670  useTrigger = pset.getUntrackedParameter<bool>("useTrigger", false);
1671 
1672  ht_token = consumes<edm::TriggerResults>( pset.getParameter<edm::InputTag>("HLTriggerResults") );
1673 
1674  myTriggers = pset.getParameter<std::vector <std::string> >("myTriggers");
1675  andOr = pset.getUntrackedParameter<bool>("andOr");
1676  pointToTriggers.clear();
1677 
1678 
1679  //---- set counter to zero
1680  nEventsAnalyzed = 0;
1681  //---- set presence of magnetic field
1682  magField = true;
1683  //
1684  std::string Path = "AllChambers/";
1685  std::string FullName;
1686  //---- File with output histograms
1687  theFile = new TFile(rootFileName.c_str(), "RECREATE");
1688  theFile->cd();
1689  //---- Book histograms for the analysis
1690  char SpecName[50];
1691 
1692  sprintf(SpecName,"DataFlow");
1693  DataFlow =
1694  new TH1F(SpecName,"Data flow;condition number;entries",40,-0.5,39.5);
1695  //
1696  sprintf(SpecName,"TriggersFired");
1697  TriggersFired =
1698  new TH1F(SpecName,"Triggers fired;trigger number;entries",140,-0.5,139.5);
1699  //
1700  int Chan = 50;
1701  float minChan = -0.5;
1702  float maxChan = 49.5;
1703  //
1704  sprintf(SpecName,"ALCTPerEvent");
1705  ALCTPerEvent = new TH1F(SpecName,"ALCTs per event;N digis;entries",Chan,minChan,maxChan);
1706  //
1707  sprintf(SpecName,"CLCTPerEvent");
1708  CLCTPerEvent = new TH1F(SpecName,"CLCTs per event;N digis;entries",Chan,minChan,maxChan);
1709  //
1710  sprintf(SpecName,"recHitsPerEvent");
1711  recHitsPerEvent = new TH1F(SpecName,"RecHits per event;N digis;entries",150,-0.5,149.5);
1712  //
1713  sprintf(SpecName,"segmentsPerEvent");
1714  segmentsPerEvent = new TH1F(SpecName,"segments per event;N digis;entries",Chan,minChan,maxChan);
1715  //
1716  //---- Book groups of histograms (for any chamber)
1717 
1718  map<std::string,bool>::iterator iter;
1719  for(int ec = 0;ec<2;++ec){
1720  for(int st = 0;st<4;++st){
1721  theFile->cd();
1722  sprintf(SpecName,"Stations__E%d_S%d",ec+1, st+1);
1723  theFile->mkdir(SpecName);
1724  theFile->cd(SpecName);
1725 
1726  //
1727  sprintf(SpecName,"segmentChi2_ndf_St%d",st+1);
1728  StHist[ec][st].segmentChi2_ndf =
1729  new TH1F(SpecName,"Chi2/ndf of a segment;chi2/ndf;entries",100,0.,20.);
1730  //
1731  sprintf(SpecName,"hitsInSegment_St%d",st+1);
1732  StHist[ec][st].hitsInSegment =
1733  new TH1F(SpecName,"Number of hits in a segment;nHits;entries",7,-0.5,6.5);
1734  //
1735  Chan = 170;
1736  minChan = 0.85;
1737  maxChan = 2.55;
1738  //
1739  sprintf(SpecName,"AllSegments_eta_St%d",st+1);
1740  StHist[ec][st].AllSegments_eta =
1741  new TH1F(SpecName,"All segments in eta;eta;entries",Chan,minChan,maxChan);
1742  //
1743  sprintf(SpecName,"EfficientSegments_eta_St%d",st+1);
1744  StHist[ec][st].EfficientSegments_eta =
1745  new TH1F(SpecName,"Efficient segments in eta;eta;entries",Chan,minChan,maxChan);
1746  //
1747  sprintf(SpecName,"ResidualSegments_St%d",st+1);
1748  StHist[ec][st].ResidualSegments =
1749  new TH1F(SpecName,"Residual (segments);residual,cm;entries",75,0.,15.);
1750  //
1751  Chan = 200;
1752  minChan = -800.;
1753  maxChan = 800.;
1754  int Chan2 = 200;
1755  float minChan2 = -800.;
1756  float maxChan2 = 800.;
1757 
1758  sprintf(SpecName,"EfficientSegments_XY_St%d",st+1);
1759  StHist[ec][st].EfficientSegments_XY = new TH2F(SpecName,"Efficient segments in XY;X;Y",
1760  Chan,minChan,maxChan,Chan2,minChan2,maxChan2);
1761  sprintf(SpecName,"InefficientSegments_XY_St%d",st+1);
1762  StHist[ec][st].InefficientSegments_XY = new TH2F(SpecName,"Inefficient segments in XY;X;Y",
1763  Chan,minChan,maxChan,Chan2,minChan2,maxChan2);
1764  //
1765  Chan = 80;
1766  minChan = 0;
1767  maxChan = 3.2;
1768  sprintf(SpecName,"EfficientALCT_momTheta_St%d",st+1);
1769  StHist[ec][st].EfficientALCT_momTheta = new TH1F(SpecName,"Efficient ALCT in theta (momentum);theta, rad;entries",
1770  Chan,minChan,maxChan);
1771  //
1772  sprintf(SpecName,"InefficientALCT_momTheta_St%d",st+1);
1773  StHist[ec][st].InefficientALCT_momTheta = new TH1F(SpecName,"Inefficient ALCT in theta (momentum);theta, rad;entries",
1774  Chan,minChan,maxChan);
1775  //
1776  Chan = 160;
1777  minChan = -3.2;
1778  maxChan = 3.2;
1779  sprintf(SpecName,"EfficientCLCT_momPhi_St%d",st+1);
1780  StHist[ec][st].EfficientCLCT_momPhi = new TH1F(SpecName,"Efficient CLCT in phi (momentum);phi, rad;entries",
1781  Chan,minChan,maxChan);
1782  //
1783  sprintf(SpecName,"InefficientCLCT_momPhi_St%d",st+1);
1784  StHist[ec][st].InefficientCLCT_momPhi = new TH1F(SpecName,"Inefficient CLCT in phi (momentum);phi, rad;entries",
1785  Chan,minChan,maxChan);
1786  //
1787  theFile->cd();
1788  for(int rg = 0;rg<3;++rg){
1789  if(0!=st && rg>1){
1790  continue;
1791  }
1792  else if(1==rg && 3==st){
1793  continue;
1794  }
1795  for(int iChamber=FirstCh;iChamber<FirstCh+NumCh;iChamber++){
1796  if(0!=st && 0==rg && iChamber >18){
1797  continue;
1798  }
1799  theFile->cd();
1800  sprintf(SpecName,"Chambers__E%d_S%d_R%d_Chamber_%d",ec+1, st+1, rg+1,iChamber);
1801  theFile->mkdir(SpecName);
1802  theFile->cd(SpecName);
1803  //
1804 
1805  sprintf(SpecName,"EfficientRechits_inSegment_Ch%d",iChamber);
1806  ChHist[ec][st][rg][iChamber-FirstCh].EfficientRechits_inSegment =
1807  new TH1F(SpecName,"Existing RecHit given a segment;layers (1-6);entries",nLayer_bins,Layer_min,Layer_max);
1808  //
1809  sprintf(SpecName,"InefficientSingleHits_Ch%d",iChamber);
1810  ChHist[ec][st][rg][iChamber-FirstCh].InefficientSingleHits =
1811  new TH1F(SpecName,"Single RecHits not in the segment;layers (1-6);entries ",nLayer_bins,Layer_min,Layer_max);
1812  //
1813  sprintf(SpecName,"AllSingleHits_Ch%d",iChamber);
1814  ChHist[ec][st][rg][iChamber-FirstCh].AllSingleHits =
1815  new TH1F(SpecName,"Single RecHits given a segment; layers (1-6);entries",nLayer_bins,Layer_min,Layer_max);
1816  //
1817  sprintf(SpecName,"digiAppearanceCount_Ch%d",iChamber);
1818  ChHist[ec][st][rg][iChamber-FirstCh].digiAppearanceCount =
1819  new TH1F(SpecName,"Digi appearance (no-yes): segment(0,1), ALCT(2,3), CLCT(4,5), CorrLCT(6,7); digi type;entries",
1820  8,-0.5,7.5);
1821  //
1822  Chan = 100;
1823  minChan = -1.1;
1824  maxChan = 0.9;
1825  sprintf(SpecName,"EfficientALCT_dydz_Ch%d",iChamber);
1826  ChHist[ec][st][rg][iChamber-FirstCh].EfficientALCT_dydz =
1827  new TH1F(SpecName,"Efficient ALCT; local dy/dz (ME 3 and 4 flipped);entries",
1828  Chan, minChan, maxChan);
1829  //
1830  sprintf(SpecName,"InefficientALCT_dydz_Ch%d",iChamber);
1831  ChHist[ec][st][rg][iChamber-FirstCh].InefficientALCT_dydz =
1832  new TH1F(SpecName,"Inefficient ALCT; local dy/dz (ME 3 and 4 flipped);entries",
1833  Chan, minChan, maxChan);
1834  //
1835  Chan = 100;
1836  minChan = -1.;
1837  maxChan = 1.0;
1838  sprintf(SpecName,"EfficientCLCT_dxdz_Ch%d",iChamber);
1839  ChHist[ec][st][rg][iChamber-FirstCh].EfficientCLCT_dxdz =
1840  new TH1F(SpecName,"Efficient CLCT; local dxdz;entries",
1841  Chan, minChan, maxChan);
1842  //
1843  sprintf(SpecName,"InefficientCLCT_dxdz_Ch%d",iChamber);
1844  ChHist[ec][st][rg][iChamber-FirstCh].InefficientCLCT_dxdz =
1845  new TH1F(SpecName,"Inefficient CLCT; local dxdz;entries",
1846  Chan, minChan, maxChan);
1847  //
1848  sprintf(SpecName,"EfficientRechits_good_Ch%d",iChamber);
1849  ChHist[ec][st][rg][iChamber-FirstCh].EfficientRechits_good =
1850  new TH1F(SpecName,"Existing RecHit - sensitive area only;layers (1-6);entries",nLayer_bins,Layer_min,Layer_max);
1851  //
1852  sprintf(SpecName,"EfficientStrips_Ch%d",iChamber);
1853  ChHist[ec][st][rg][iChamber-FirstCh].EfficientStrips =
1854  new TH1F(SpecName,"Existing strip;layer (1-6); entries",nLayer_bins,Layer_min,Layer_max);
1855  //
1856  sprintf(SpecName,"EfficientWireGroups_Ch%d",iChamber);
1857  ChHist[ec][st][rg][iChamber-FirstCh].EfficientWireGroups =
1858  new TH1F(SpecName,"Existing WireGroups;layer (1-6); entries ",nLayer_bins,Layer_min,Layer_max);
1859  //
1860  sprintf(SpecName,"StripWiresCorrelations_Ch%d",iChamber);
1861  ChHist[ec][st][rg][iChamber-FirstCh].StripWiresCorrelations =
1862  new TH1F(SpecName,"StripWire correlations;; entries ",5,0.5,5.5);
1863  //
1864  Chan = 80;
1865  minChan = 0;
1866  maxChan = 3.2;
1867  sprintf(SpecName,"NoWires_momTheta_Ch%d",iChamber);
1868  ChHist[ec][st][rg][iChamber-FirstCh].NoWires_momTheta =
1869  new TH1F(SpecName,"No wires (all strips present) - in theta (momentum);theta, rad;entries",
1870  Chan,minChan,maxChan);
1871  //
1872  Chan = 160;
1873  minChan = -3.2;
1874  maxChan = 3.2;
1875  sprintf(SpecName,"NoStrips_momPhi_Ch%d",iChamber);
1876  ChHist[ec][st][rg][iChamber-FirstCh].NoStrips_momPhi =
1877  new TH1F(SpecName,"No strips (all wires present) - in phi (momentum);phi, rad;entries",
1878  Chan,minChan,maxChan);
1879  //
1880  for(int iLayer=0; iLayer<6;iLayer++){
1881  sprintf(SpecName,"Y_InefficientRecHits_inSegment_Ch%d_L%d",iChamber,iLayer);
1882  ChHist[ec][st][rg][iChamber-FirstCh].Y_InefficientRecHits_inSegment.push_back
1883  (new TH1F(SpecName,"Missing RecHit/layer in a segment (local system, whole chamber);Y, cm; entries",
1884  nYbins,Ymin, Ymax));
1885  //
1886  sprintf(SpecName,"Y_EfficientRecHits_inSegment_Ch%d_L%d",iChamber,iLayer);
1887  ChHist[ec][st][rg][iChamber-FirstCh].Y_EfficientRecHits_inSegment.push_back
1888  (new TH1F(SpecName,"Efficient (extrapolated from the segment) RecHit/layer in a segment (local system, whole chamber);Y, cm; entries",
1889  nYbins,Ymin, Ymax));
1890  //
1891  Chan = 200;
1892  minChan = -0.2;
1893  maxChan = 0.2;
1894  sprintf(SpecName,"Phi_InefficientRecHits_inSegment_Ch%d_L%d",iChamber,iLayer);
1895  ChHist[ec][st][rg][iChamber-FirstCh].Phi_InefficientRecHits_inSegment.push_back
1896  (new TH1F(SpecName,"Missing RecHit/layer in a segment (local system, whole chamber);Phi, rad; entries",
1897  Chan, minChan, maxChan));
1898  //
1899  sprintf(SpecName,"Phi_EfficientRecHits_inSegment_Ch%d_L%d",iChamber,iLayer);
1900  ChHist[ec][st][rg][iChamber-FirstCh].Phi_EfficientRecHits_inSegment.push_back
1901  (new TH1F(SpecName,"Efficient (extrapolated from the segment) in a segment (local system, whole chamber);Phi, rad; entries",
1902  Chan, minChan, maxChan));
1903 
1904  }
1905  //
1906  sprintf(SpecName,"Sim_Rechits_Ch%d",iChamber);
1907  ChHist[ec][st][rg][iChamber-FirstCh].SimRechits =
1908  new TH1F(SpecName,"Existing RecHit (Sim);layers (1-6);entries",nLayer_bins,Layer_min,Layer_max);
1909  //
1910  sprintf(SpecName,"Sim_Simhits_Ch%d",iChamber);
1911  ChHist[ec][st][rg][iChamber-FirstCh].SimSimhits =
1912  new TH1F(SpecName,"Existing SimHit (Sim);layers (1-6);entries",nLayer_bins,Layer_min,Layer_max);
1913  //
1914  /*
1915  sprintf(SpecName,"Sim_Rechits_each_Ch%d",iChamber);
1916  ChHist[ec][st][rg][iChamber-FirstCh].SimRechits_each =
1917  new TH1F(SpecName,"Existing RecHit (Sim), each;layers (1-6);entries",nLayer_bins,Layer_min,Layer_max);
1918  //
1919  sprintf(SpecName,"Sim_Simhits_each_Ch%d",iChamber);
1920  ChHist[ec][st][rg][iChamber-FirstCh].SimSimhits_each =
1921  new TH1F(SpecName,"Existing SimHit (Sim), each;layers (1-6);entries",nLayer_bins,Layer_min,Layer_max);
1922  */
1923  theFile->cd();
1924  }
1925  }
1926  }
1927  }
1928 }
T getParameter(std::string const &) const
struct CSCEfficiency::StationHistos StHist[2][4]
T getUntrackedParameter(std::string const &, T const &) const
std::string rootFileName
edm::EDGetTokenT< CSCStripDigiCollection > sd_token
struct CSCEfficiency::ChamberHistos ChHist[2][4][3][LastCh-FirstCh+1]
TH1F * CLCTPerEvent
std::vector< TH1F * > Y_InefficientRecHits_inSegment
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > co_token
edm::EDGetTokenT< CSCCLCTDigiCollection > cl_token
double local_DX_DZ_Max
bool getAbsoluteEfficiency
edm::EDGetTokenT< CSCSegmentCollection > se_token
std::vector< std::string > myTriggers
std::vector< TH1F * > Phi_InefficientRecHits_inSegment
double local_DY_DZ_Max
std::vector< TH1F * > Y_EfficientRecHits_inSegment
edm::EDGetTokenT< edm::PSimHitContainer > sh_token
MuonServiceProxy * theService
edm::EDGetTokenT< CSCWireDigiCollection > wd_token
double distanceFromDeadZone
std::vector< TH1F * > Phi_EfficientRecHits_inSegment
double maxNormChi2
double local_DY_DZ_Min
edm::EDGetTokenT< CSCRecHit2DCollection > rh_token
#define FirstCh
unsigned int printout_NEvents
TH1F * TriggersFired
TH1F * segmentsPerEvent
TH1F * recHitsPerEvent
std::vector< int > pointToTriggers
TH1F * ALCTPerEvent
#define NumCh
unsigned int minTrackHits
edm::EDGetTokenT< CSCALCTDigiCollection > al_token
edm::EDGetTokenT< edm::TriggerResults > ht_token
edm::EDGetTokenT< edm::View< reco::Track > > tk_token
CSCEfficiency::~CSCEfficiency ( )
virtual

Destructor.

Definition at line 1931 of file CSCEfficiency.cc.

References gather_cfg::cout, FirstCh, getDQMSummary::iter, NumCh, and interactiveExample::theFile.

1931  {
1932  if (theService) delete theService;
1933  // Write the histos to a file
1934  theFile->cd();
1935  //
1936  char SpecName[20];
1937  std::vector<float> bins, Efficiency, EffError;
1938  std::vector<float> eff(2);
1939 
1940  //---- loop over chambers
1941  std::map <std::string, bool> chamberTypes;
1942  chamberTypes["ME11"] = false;
1943  chamberTypes["ME12"] = false;
1944  chamberTypes["ME13"] = false;
1945  chamberTypes["ME21"] = false;
1946  chamberTypes["ME22"] = false;
1947  chamberTypes["ME31"] = false;
1948  chamberTypes["ME32"] = false;
1949  chamberTypes["ME41"] = false;
1950 
1951  map<std::string,bool>::iterator iter;
1952  std::cout<<" Writing proper histogram structure (patience)..."<<std::endl;
1953  for(int ec = 0;ec<2;++ec){
1954  for(int st = 0;st<4;++st){
1955  sprintf(SpecName,"Stations__E%d_S%d",ec+1, st+1);
1956  theFile->cd(SpecName);
1957  StHist[ec][st].segmentChi2_ndf->Write();
1958  StHist[ec][st].hitsInSegment->Write();
1959  StHist[ec][st].AllSegments_eta->Write();
1960  StHist[ec][st].EfficientSegments_eta->Write();
1961  StHist[ec][st].ResidualSegments->Write();
1962  StHist[ec][st].EfficientSegments_XY->Write();
1963  StHist[ec][st].InefficientSegments_XY->Write();
1964  StHist[ec][st].EfficientALCT_momTheta->Write();
1965  StHist[ec][st].InefficientALCT_momTheta->Write();
1966  StHist[ec][st].EfficientCLCT_momPhi->Write();
1967  StHist[ec][st].InefficientCLCT_momPhi->Write();
1968  for(int rg = 0;rg<3;++rg){
1969  if(0!=st && rg>1){
1970  continue;
1971  }
1972  else if(1==rg && 3==st){
1973  continue;
1974  }
1975  for(int iChamber=FirstCh;iChamber<FirstCh+NumCh;iChamber++){
1976  if(0!=st && 0==rg && iChamber >18){
1977  continue;
1978  }
1979  sprintf(SpecName,"Chambers__E%d_S%d_R%d_Chamber_%d",ec+1, st+1, rg+1,iChamber);
1980  theFile->cd(SpecName);
1981 
1982  ChHist[ec][st][rg][iChamber-FirstCh].EfficientRechits_inSegment->Write();
1983  ChHist[ec][st][rg][iChamber-FirstCh].AllSingleHits->Write();
1984  ChHist[ec][st][rg][iChamber-FirstCh].digiAppearanceCount->Write();
1985  ChHist[ec][st][rg][iChamber-FirstCh].EfficientALCT_dydz->Write();
1986  ChHist[ec][st][rg][iChamber-FirstCh].InefficientALCT_dydz->Write();
1987  ChHist[ec][st][rg][iChamber-FirstCh].EfficientCLCT_dxdz->Write();
1988  ChHist[ec][st][rg][iChamber-FirstCh].InefficientCLCT_dxdz->Write();
1989  ChHist[ec][st][rg][iChamber-FirstCh].InefficientSingleHits->Write();
1990  ChHist[ec][st][rg][iChamber-FirstCh].EfficientRechits_good->Write();
1991  ChHist[ec][st][rg][iChamber-FirstCh].EfficientStrips->Write();
1992  ChHist[ec][st][rg][iChamber-FirstCh].StripWiresCorrelations->Write();
1993  ChHist[ec][st][rg][iChamber-FirstCh].NoWires_momTheta->Write();
1994  ChHist[ec][st][rg][iChamber-FirstCh].NoStrips_momPhi->Write();
1995  ChHist[ec][st][rg][iChamber-FirstCh].EfficientWireGroups->Write();
1996  for(unsigned int iLayer = 0; iLayer< 6; iLayer++){
1997  ChHist[ec][st][rg][iChamber-FirstCh].Y_InefficientRecHits_inSegment[iLayer]->Write();
1998  ChHist[ec][st][rg][iChamber-FirstCh].Y_EfficientRecHits_inSegment[iLayer]->Write();
1999  ChHist[ec][st][rg][iChamber-FirstCh].Phi_InefficientRecHits_inSegment[iLayer]->Write();
2000  ChHist[ec][st][rg][iChamber-FirstCh].Phi_EfficientRecHits_inSegment[iLayer]->Write();
2001  }
2002  ChHist[ec][st][rg][iChamber-FirstCh].SimRechits->Write();
2003  ChHist[ec][st][rg][iChamber-FirstCh].SimSimhits->Write();
2004  /*
2005  ChHist[ec][st][rg][iChamber-FirstCh].SimRechits_each->Write();
2006  ChHist[ec][st][rg][iChamber-FirstCh].SimSimhits_each->Write();
2007  */
2008  //
2009  theFile->cd(SpecName);
2010  theFile->cd();
2011  }
2012  }
2013  }
2014  }
2015  //
2016  sprintf(SpecName,"AllChambers");
2017  theFile->mkdir(SpecName);
2018  theFile->cd(SpecName);
2019  DataFlow->Write();
2020  TriggersFired->Write();
2021  ALCTPerEvent->Write();
2022  CLCTPerEvent->Write();
2023  recHitsPerEvent->Write();
2024  segmentsPerEvent->Write();
2025  //
2026  theFile->cd(SpecName);
2027  //---- Close the file
2028  theFile->Close();
2029 }
struct CSCEfficiency::StationHistos StHist[2][4]
struct CSCEfficiency::ChamberHistos ChHist[2][4][3][LastCh-FirstCh+1]
TH1F * CLCTPerEvent
std::vector< TH1F * > Y_InefficientRecHits_inSegment
std::vector< TH1F * > Phi_InefficientRecHits_inSegment
std::vector< TH1F * > Y_EfficientRecHits_inSegment
MuonServiceProxy * theService
std::vector< TH1F * > Phi_EfficientRecHits_inSegment
#define FirstCh
TH1F * TriggersFired
TH1F * segmentsPerEvent
TH1F * recHitsPerEvent
tuple cout
Definition: gather_cfg.py:121
TH1F * ALCTPerEvent
#define NumCh

Member Function Documentation

bool CSCEfficiency::applyTrigger ( edm::Handle< edm::TriggerResults > &  hltR,
const edm::TriggerNames triggerNames 
)
private

Definition at line 1539 of file CSCEfficiency.cc.

References CommPDSkim_cfg::andOr, gather_cfg::cout, edm::HandleBase::isValid(), and edm::TriggerNames::triggerNames().

1540  {
1541  bool triggerPassed = true;
1542  std::vector<std::string> hlNames=triggerNames.triggerNames();
1543  pointToTriggers.clear();
1544  for(size_t imyT = 0;imyT<myTriggers.size();++imyT){
1545  for (size_t iT=0; iT<hlNames.size(); ++iT) {
1546  //std::cout<<" iT = "<<iT<<" hlNames[iT] = "<<hlNames[iT]<<
1547  //" : wasrun = "<<hltR->wasrun(iT)<<" accept = "<<
1548  // hltR->accept(iT)<<" !error = "<<
1549  // !hltR->error(iT)<<std::endl;
1550  if(!imyT){
1551  if(hltR->wasrun(iT) &&
1552  hltR->accept(iT) &&
1553  !hltR->error(iT) ){
1554  TriggersFired->Fill(iT);
1555  }
1556  }
1557  if(hlNames[iT]==myTriggers[imyT]){
1558  pointToTriggers.push_back(iT);
1559  if(imyT){
1560  break;
1561  }
1562  }
1563  }
1564  }
1565  if(pointToTriggers.size()!=myTriggers.size()){
1566  pointToTriggers.clear();
1567  if(printalot){
1568  std::cout<<" Not all trigger names found - all trigger specifications will be ignored. Check your cfg file!"<<std::endl;
1569  }
1570  }
1571  else{
1572  if(pointToTriggers.size()){
1573  if(printalot){
1574  std::cout<<"The following triggers will be required in the event: "<<std::endl;
1575  for(size_t imyT =0; imyT <pointToTriggers.size();++imyT){
1576  std::cout<<" "<<hlNames[pointToTriggers[imyT]];
1577  }
1578  std::cout<<std::endl;
1579  std::cout<<" in condition (AND/OR) : "<<!andOr<<"/"<<andOr<<std::endl;
1580  }
1581  }
1582  }
1583 
1584  if (hltR.isValid()) {
1585  if(!pointToTriggers.size()){
1586  if(printalot){
1587  std::cout<<" No triggers specified in the configuration or all ignored - no trigger information will be considered"<<std::endl;
1588  }
1589  }
1590  for(size_t imyT =0; imyT <pointToTriggers.size();++imyT){
1591  if(hltR->wasrun(pointToTriggers[imyT]) &&
1592  hltR->accept(pointToTriggers[imyT]) &&
1593  !hltR->error(pointToTriggers[imyT]) ){
1594  triggerPassed = true;
1595  if(andOr){
1596  break;
1597  }
1598  }
1599  else{
1600  triggerPassed = false;
1601  if(!andOr){
1602  triggerPassed = false;
1603  break;
1604  }
1605  }
1606  }
1607  }
1608  else{
1609  if(printalot){
1610  std::cout<<" TriggerResults handle returns invalid state?! No trigger information will be considered"<<std::endl;
1611  }
1612  }
1613  if(printalot){
1614  std::cout<<" Trigger passed: "<<triggerPassed<<std::endl;
1615  }
1616  return triggerPassed;
1617 }
Strings const & triggerNames() const
Definition: TriggerNames.cc:24
std::vector< std::string > myTriggers
bool isValid() const
Definition: HandleBase.h:76
TH1F * TriggersFired
std::vector< int > pointToTriggers
tuple cout
Definition: gather_cfg.py:121
void CSCEfficiency::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDFilter.

Definition at line 2033 of file CSCEfficiency.cc.

2034 {
2035 }
void CSCEfficiency::chamberCandidates ( int  station,
int  ring,
float  phi,
std::vector< int > &  coupleOfChambers 
)
private

Definition at line 1003 of file CSCEfficiency.cc.

References gather_cfg::cout, and M_PI.

1003  {
1004  coupleOfChambers.clear();
1005  // -pi< phi<+pi
1006  float phi_zero = 0.;// check! the phi at the "edge" of Ch 1
1007  float phi_const = 2.*M_PI/36.;
1008  int last_chamber = 36;
1009  int first_chamber = 1;
1010  if(1 != station && 1==ring){ // 18 chambers in the ring
1011  phi_const*=2;
1012  last_chamber /= 2;
1013  }
1014  if(phi<0.){
1015  if (printalot) std::cout<<" info: negative phi = "<<phi<<std::endl;
1016  phi += 2*M_PI;
1017  }
1018  float chamber_float = (phi - phi_zero)/phi_const;
1019  int chamber_int = int(chamber_float);
1020  if (chamber_float - float(chamber_int) -0.5 <0.){
1021  if(0!=chamber_int ){
1022  coupleOfChambers.push_back(chamber_int);
1023  }
1024  else{
1025  coupleOfChambers.push_back(last_chamber);
1026  }
1027  coupleOfChambers.push_back(chamber_int+1);
1028 
1029  }
1030  else{
1031  coupleOfChambers.push_back(chamber_int+1);
1032  if(last_chamber!=chamber_int+1){
1033  coupleOfChambers.push_back(chamber_int+2);
1034  }
1035  else{
1036  coupleOfChambers.push_back(first_chamber);
1037  }
1038  }
1039  if (printalot) std::cout<<" phi = "<<phi<<" phi_zero = "<<phi_zero<<" phi_const = "<<phi_const<<
1040  " candidate chambers: first ch = "<<coupleOfChambers[0]<<" second ch = "<<coupleOfChambers[1]<<std::endl;
1041 }
#define M_PI
tuple cout
Definition: gather_cfg.py:121
Definition: DDAxes.h:10
bool CSCEfficiency::checkLocal ( double  yLocal,
double  yBoundary,
int  station,
int  ring 
)
private

Definition at line 600 of file CSCEfficiency.cc.

600  {
601 //---- check if it is in a good local region (sensitive area - geometrical and HV boundaries excluded)
602  bool pass = false;
603  std::vector <float> deadZoneCenter(6);
604  const float deadZoneHalf = 0.32*7/2;// wire spacing * (wires missing + 1)/2
605  float cutZone = deadZoneHalf + distanceFromDeadZone;//cm
606  //---- hardcoded... not good
607  if(station>1 && station<5){
608  if(2==ring){
609  deadZoneCenter[0]= -162.48 ;
610  deadZoneCenter[1] = -81.8744;
611  deadZoneCenter[2] = -21.18165;
612  deadZoneCenter[3] = 39.51105;
613  deadZoneCenter[4] = 100.2939;
614  deadZoneCenter[5] = 160.58;
615 
616  if(yLocal >yBoundary &&
617  ((yLocal> deadZoneCenter[0] + cutZone && yLocal< deadZoneCenter[1] - cutZone) ||
618  (yLocal> deadZoneCenter[1] + cutZone && yLocal< deadZoneCenter[2] - cutZone) ||
619  (yLocal> deadZoneCenter[2] + cutZone && yLocal< deadZoneCenter[3] - cutZone) ||
620  (yLocal> deadZoneCenter[3] + cutZone && yLocal< deadZoneCenter[4] - cutZone) ||
621  (yLocal> deadZoneCenter[4] + cutZone && yLocal< deadZoneCenter[5] - cutZone))){
622  pass = true;
623  }
624  }
625  else if(1==ring){
626  if(2==station){
627  deadZoneCenter[0]= -95.94 ;
628  deadZoneCenter[1] = -27.47;
629  deadZoneCenter[2] = 33.67;
630  deadZoneCenter[3] = 93.72;
631  }
632  else if(3==station){
633  deadZoneCenter[0]= -85.97 ;
634  deadZoneCenter[1] = -36.21;
635  deadZoneCenter[2] = 23.68;
636  deadZoneCenter[3] = 84.04;
637  }
638  else if(4==station){
639  deadZoneCenter[0]= -75.82;
640  deadZoneCenter[1] = -26.14;
641  deadZoneCenter[2] = 23.85;
642  deadZoneCenter[3] = 73.91;
643  }
644  if(yLocal >yBoundary &&
645  ((yLocal> deadZoneCenter[0] + cutZone && yLocal< deadZoneCenter[1] - cutZone) ||
646  (yLocal> deadZoneCenter[1] + cutZone && yLocal< deadZoneCenter[2] - cutZone) ||
647  (yLocal> deadZoneCenter[2] + cutZone && yLocal< deadZoneCenter[3] - cutZone))){
648  pass = true;
649  }
650  }
651  }
652  else if(1==station){
653  if(3==ring){
654  deadZoneCenter[0]= -83.155 ;
655  deadZoneCenter[1] = -22.7401;
656  deadZoneCenter[2] = 27.86665;
657  deadZoneCenter[3] = 81.005;
658  if(yLocal > yBoundary &&
659  ((yLocal> deadZoneCenter[0] + cutZone && yLocal< deadZoneCenter[1] - cutZone) ||
660  (yLocal> deadZoneCenter[1] + cutZone && yLocal< deadZoneCenter[2] - cutZone) ||
661  (yLocal> deadZoneCenter[2] + cutZone && yLocal< deadZoneCenter[3] - cutZone))){
662  pass = true;
663  }
664  }
665  else if(2==ring){
666  deadZoneCenter[0]= -86.285 ;
667  deadZoneCenter[1] = -32.88305;
668  deadZoneCenter[2] = 32.867423;
669  deadZoneCenter[3] = 88.205;
670  if(yLocal > (yBoundary) &&
671  ((yLocal> deadZoneCenter[0] + cutZone && yLocal< deadZoneCenter[1] - cutZone) ||
672  (yLocal> deadZoneCenter[1] + cutZone && yLocal< deadZoneCenter[2] - cutZone) ||
673  (yLocal> deadZoneCenter[2] + cutZone && yLocal< deadZoneCenter[3] - cutZone))){
674  pass = true;
675  }
676  }
677  else{
678  deadZoneCenter[0]= -81.0;
679  deadZoneCenter[1] = 81.0;
680  if(yLocal > (yBoundary) &&
681  ((yLocal> deadZoneCenter[0] + cutZone && yLocal< deadZoneCenter[1] - cutZone) )){
682  pass = true;
683  }
684  }
685  }
686  return pass;
687 }
double distanceFromDeadZone
void CSCEfficiency::chooseDirection ( CLHEP::Hep3Vector &  innerPosition,
CLHEP::Hep3Vector &  outerPosition 
)
private

Definition at line 1481 of file CSCEfficiency.cc.

1481  {
1482 
1483  //---- Be careful with trigger conditions too
1484  if(!isIPdata){
1485  float dy = outerPosition.y() - innerPosition.y();
1486  float dz = outerPosition.z() - innerPosition.z();
1487  if(isBeamdata){
1488  if(dz>0){
1489  alongZ = true;
1490  }
1491  else{
1492  alongZ = false;
1493  }
1494  }
1495  else{//cosmics
1496  if(dy/dz>0){
1497  alongZ = false;
1498  }
1499  else{
1500  alongZ = true;
1501  }
1502  }
1503  }
1504 }
bool CSCEfficiency::efficienciesPerChamber ( CSCDetId id,
const CSCChamber cscChamber,
FreeTrajectoryState ftsChamber 
)
private

Definition at line 1044 of file CSCEfficiency.cc.

References gather_cfg::cout, FreeTrajectoryState::momentum(), dbtoconf::out, PV3DBase< T, PVType, FrameType >::phi(), PV3DBase< T, PVType, FrameType >::theta(), GeomDet::toLocal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

1044  {
1045  int ec, st, rg, ch, secondRing;
1046  returnTypes(id, ec, st, rg, ch, secondRing);
1047 
1048  LocalVector localDir = cscChamber->toLocal(ftsChamber.momentum());
1049  if(printalot){
1050  std::cout<<" global dir = "<<ftsChamber.momentum()<<std::endl;
1051  std::cout<<" local dir = "<<localDir<<std::endl;
1052  std::cout<<" local theta = "<<localDir.theta()<<std::endl;
1053  }
1054  float dxdz = localDir.x()/localDir.z();
1055  float dydz = localDir.y()/localDir.z();
1056  if(2==st || 3==st){
1057  if(printalot){
1058  std::cout<<"st 3 or 4 ... flip dy/dz"<<std::endl;
1059  }
1060  dydz = - dydz;
1061  }
1062  if(printalot){
1063  std::cout<<"dy/dz = "<<dydz<<std::endl;
1064  }
1065  // Apply angle cut
1066  bool out = true;
1067  if(applyIPangleCuts){
1068  if(dydz>local_DY_DZ_Max || dydz<local_DY_DZ_Min || fabs(dxdz)>local_DX_DZ_Max){
1069  out = false;
1070  }
1071  }
1072 
1073  // Segments
1074  bool firstCondition = allSegments[ec][st][rg][ch].size() ? true : false;
1075  bool secondCondition = false;
1076  //---- ME1 is special as usual - ME1a and ME1b are actually one chamber
1077  if(secondRing>-1){
1078  secondCondition = allSegments[ec][st][secondRing][ch].size() ? true : false;
1079  }
1080  if(firstCondition || secondCondition){
1081  if(out){
1082  ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(1);
1083  }
1084  }
1085  else{
1086  if(out){
1087  ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(0);
1088  }
1089  }
1090 
1091  if(useDigis){
1092  // ALCTs
1093  firstCondition = allALCT[ec][st][rg][ch];
1094  secondCondition = false;
1095  if(secondRing>-1){
1096  secondCondition = allALCT[ec][st][secondRing][ch];
1097  }
1098  if(firstCondition || secondCondition){
1099  if(out){
1100  ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(3);
1101  }
1102  // always apply partial angle cuts for this kind of histos
1103  if(fabs(dxdz)<local_DX_DZ_Max){
1104  StHist[ec][st].EfficientALCT_momTheta->Fill(ftsChamber.momentum().theta());
1105  ChHist[ec][st][rg][ch].EfficientALCT_dydz->Fill(dydz);
1106  }
1107  }
1108  else{
1109  if(out){
1110  ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(2);
1111  }
1112  if(fabs(dxdz)<local_DX_DZ_Max){
1113  StHist[ec][st].InefficientALCT_momTheta->Fill(ftsChamber.momentum().theta());
1114  ChHist[ec][st][rg][ch].InefficientALCT_dydz->Fill(dydz);
1115  }
1116  if(printalot){
1117  std::cout<<" missing ALCT (dy/dz = "<<dydz<<")";
1118  printf("\t\tendcap/station/ring/chamber: %i/%i/%i/%i\n",ec+1,st+1,rg+1,ch+1);
1119  }
1120  }
1121 
1122  // CLCTs
1123  firstCondition = allCLCT[ec][st][rg][ch];
1124  secondCondition = false;
1125  if(secondRing>-1){
1126  secondCondition = allCLCT[ec][st][secondRing][ch];
1127  }
1128  if(firstCondition || secondCondition){
1129  if(out){
1130  ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(5);
1131  }
1132  if(dydz<local_DY_DZ_Max && dydz>local_DY_DZ_Min){
1133  StHist[ec][st].EfficientCLCT_momPhi->Fill(ftsChamber.momentum().phi() );// - phi chamber...
1134  ChHist[ec][st][rg][ch].EfficientCLCT_dxdz->Fill(dxdz);
1135  }
1136  }
1137  else{
1138  if(out){
1139  ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(4);
1140  }
1141  if(dydz<local_DY_DZ_Max && dydz>local_DY_DZ_Min){
1142  StHist[ec][st].InefficientCLCT_momPhi->Fill(ftsChamber.momentum().phi());// - phi chamber...
1143  ChHist[ec][st][rg][ch].InefficientCLCT_dxdz->Fill(dxdz);
1144  }
1145  if(printalot){
1146  std::cout<<" missing CLCT (dx/dz = "<<dxdz<<")";
1147  printf("\t\tendcap/station/ring/chamber: %i/%i/%i/%i\n",ec+1,st+1,rg+1,ch+1);
1148  }
1149  }
1150  if(out){
1151  // CorrLCTs
1152  firstCondition = allCorrLCT[ec][st][rg][ch];
1153  secondCondition = false;
1154  if(secondRing>-1){
1155  secondCondition = allCorrLCT[ec][st][secondRing][ch];
1156  }
1157  if(firstCondition || secondCondition){
1158  ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(7);
1159  }
1160  else{
1161  ChHist[ec][st][rg][ch].digiAppearanceCount->Fill(6);
1162  }
1163  }
1164  }
1165  return out;
1166 }
struct CSCEfficiency::StationHistos StHist[2][4]
struct CSCEfficiency::ChamberHistos ChHist[2][4][3][LastCh-FirstCh+1]
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
bool allCLCT[2][4][4][NumCh]
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:62
double local_DX_DZ_Max
void returnTypes(CSCDetId &id, int &ec, int &st, int &rg, int &ch, int &secondRing)
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
double local_DY_DZ_Max
T z() const
Definition: PV3DBase.h:64
bool allALCT[2][4][4][NumCh]
GlobalVector momentum() const
double local_DY_DZ_Min
tuple out
Definition: dbtoconf.py:99
std::vector< std::pair< LocalPoint, LocalVector > > allSegments[2][4][4][NumCh]
tuple cout
Definition: gather_cfg.py:121
T x() const
Definition: PV3DBase.h:62
bool allCorrLCT[2][4][4][NumCh]
void CSCEfficiency::endJob ( void  )
privatevirtual

Reimplemented from edm::EDFilter.

Definition at line 2039 of file CSCEfficiency.cc.

2039  {
2040 }
double CSCEfficiency::extrapolate1D ( double  initPosition,
double  initDirection,
double  parameterOfTheLine 
)
private

Definition at line 1471 of file CSCEfficiency.cc.

1471  {
1472  double extrapolatedPosition = initPosition + initDirection*parameterOfTheLine;
1473  return extrapolatedPosition;
1474 }
void CSCEfficiency::fillDigiInfo ( edm::Handle< CSCALCTDigiCollection > &  alcts,
edm::Handle< CSCCLCTDigiCollection > &  clcts,
edm::Handle< CSCCorrelatedLCTDigiCollection > &  correlatedlcts,
edm::Handle< CSCWireDigiCollection > &  wires,
edm::Handle< CSCStripDigiCollection > &  strips,
edm::Handle< edm::PSimHitContainer > &  simhits,
edm::Handle< CSCRecHit2DCollection > &  rechits,
edm::Handle< CSCSegmentCollection > &  segments,
edm::ESHandle< CSCGeometry > &  cscGeom 
)
private

Definition at line 689 of file CSCEfficiency.cc.

References NumCh.

697  {
698  for(int iE=0;iE<2;iE++){
699  for(int iS=0;iS<4;iS++){
700  for(int iR=0;iR<4;iR++){
701  for(int iC=0;iC<NumCh;iC++){
702  allSegments[iE][iS][iR][iC].clear();
703  allCLCT[iE][iS][iR][iC] = allALCT[iE][iS][iR][iC] = allCorrLCT[iE][iS][iR][iC] = false;
704  for(int iL=0;iL<6;iL++){
705  allStrips[iE][iS][iR][iC][iL].clear();
706  allWG[iE][iS][iR][iC][iL].clear();
707  allRechits[iE][iS][iR][iC][iL].clear();
708  allSimhits[iE][iS][iR][iC][iL].clear();
709  }
710  }
711  }
712  }
713  }
714  //
715  if(useDigis){
716  fillLCT_info(alcts, clcts, correlatedlcts);
717  fillWG_info(wires, cscGeom);
718  fillStrips_info(strips);
719  }
720  fillRechitsSegments_info(rechits, segments, cscGeom);
721  if(!isData){
722  fillSimhit_info(simhits);
723  }
724 }
void fillWG_info(edm::Handle< CSCWireDigiCollection > &wires, edm::ESHandle< CSCGeometry > &cscGeom)
std::vector< std::pair< LocalPoint, int > > allSimhits[2][4][4][NumCh][6]
bool allCLCT[2][4][4][NumCh]
bool allALCT[2][4][4][NumCh]
std::vector< std::pair< std::pair< int, float >, int > > allWG[2][4][4][NumCh][6]
void fillLCT_info(edm::Handle< CSCALCTDigiCollection > &alcts, edm::Handle< CSCCLCTDigiCollection > &clcts, edm::Handle< CSCCorrelatedLCTDigiCollection > &correlatedlcts)
void fillRechitsSegments_info(edm::Handle< CSCRecHit2DCollection > &rechits, edm::Handle< CSCSegmentCollection > &segments, edm::ESHandle< CSCGeometry > &cscGeom)
std::vector< std::pair< int, float > > allStrips[2][4][4][NumCh][6]
std::vector< std::pair< LocalPoint, LocalVector > > allSegments[2][4][4][NumCh]
void fillSimhit_info(edm::Handle< edm::PSimHitContainer > &simHits)
#define NumCh
std::vector< std::pair< LocalPoint, bool > > allRechits[2][4][4][NumCh][6]
bool allCorrLCT[2][4][4][NumCh]
void fillStrips_info(edm::Handle< CSCStripDigiCollection > &strips)
void CSCEfficiency::fillLCT_info ( edm::Handle< CSCALCTDigiCollection > &  alcts,
edm::Handle< CSCCLCTDigiCollection > &  clcts,
edm::Handle< CSCCorrelatedLCTDigiCollection > &  correlatedlcts 
)
private

Definition at line 727 of file CSCEfficiency.cc.

References FirstCh, j, and prof2calltree::last.

729  {
730  //---- ALCTDigis
731  int nSize = 0;
732  for (CSCALCTDigiCollection::DigiRangeIterator j=alcts->begin(); j!=alcts->end(); j++) {
733  ++nSize;
734  const CSCDetId& id = (*j).first;
735  const CSCALCTDigiCollection::Range& range =(*j).second;
737  range.first; digiIt!=range.second;
738  ++digiIt){
739  // Valid digi in the chamber (or in neighbouring chamber)
740  if((*digiIt).isValid()){
741  allALCT[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-FirstCh] = true;
742  }
743  }// for digis in layer
744  }// end of for (j=...
745  ALCTPerEvent->Fill(nSize);
746  //---- CLCTDigis
747  nSize = 0;
748  for (CSCCLCTDigiCollection::DigiRangeIterator j=clcts->begin(); j!=clcts->end(); j++) {
749  ++nSize;
750  const CSCDetId& id = (*j).first;
751  std::vector<CSCCLCTDigi>::const_iterator digiIt = (*j).second.first;
752  std::vector<CSCCLCTDigi>::const_iterator last = (*j).second.second;
753  for( ; digiIt != last; ++digiIt) {
754  // Valid digi in the chamber (or in neighbouring chamber)
755  if((*digiIt).isValid()){
756  allCLCT[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-FirstCh] = true;
757  }
758  }
759  }
760  CLCTPerEvent->Fill(nSize);
761  //---- CorrLCTDigis
762  for (CSCCorrelatedLCTDigiCollection::DigiRangeIterator j=correlatedlcts->begin(); j!=correlatedlcts->end(); j++) {
763  const CSCDetId& id = (*j).first;
764  std::vector<CSCCorrelatedLCTDigi>::const_iterator digiIt = (*j).second.first;
765  std::vector<CSCCorrelatedLCTDigi>::const_iterator last = (*j).second.second;
766  for( ; digiIt != last; ++digiIt) {
767  // Valid digi in the chamber (or in neighbouring chamber)
768  if((*digiIt).isValid()){
769  allCorrLCT[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-FirstCh] = true;
770  }
771  }
772  }
773 }
TH1F * CLCTPerEvent
bool allCLCT[2][4][4][NumCh]
bool allALCT[2][4][4][NumCh]
int j
Definition: DBlmapReader.cc:9
#define FirstCh
std::vector< CSCALCTDigi >::const_iterator const_iterator
std::pair< const_iterator, const_iterator > Range
TH1F * ALCTPerEvent
bool allCorrLCT[2][4][4][NumCh]
void CSCEfficiency::fillRechitsSegments_info ( edm::Handle< CSCRecHit2DCollection > &  rechits,
edm::Handle< CSCSegmentCollection > &  segments,
edm::ESHandle< CSCGeometry > &  cscGeom 
)
private

Definition at line 850 of file CSCEfficiency.cc.

References CSCDetId::chamber(), gather_cfg::cout, CSCDetId, Reference_intrackfit_cff::endcap, CSCDetId::endcap(), FirstCh, CSCDetId::layer(), NumCh, relativeConstraints::ring, CSCDetId::ring(), findQualityFiles::size, relativeConstraints::station, CSCDetId::station(), GeomDet::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), LocalError::xy(), PV3DBase< T, PVType, FrameType >::y(), LocalError::yy(), and PV3DBase< T, PVType, FrameType >::z().

853  {
854  //---- RECHITS AND SEGMENTS
855  //---- Loop over rechits
856  if (printalot){
857  //printf("\tGet the recHits collection.\t ");
858  printf(" The size of the rechit collection is %i\n",int(rechits->size()));
859  //printf("\t...start loop over rechits...\n");
860  }
861  recHitsPerEvent->Fill(rechits->size());
862  //---- Build iterator for rechits and loop :
864  for (recIt = rechits->begin(); recIt != rechits->end(); recIt++) {
865  //---- Find chamber with rechits in CSC
866  CSCDetId id = (CSCDetId)(*recIt).cscDetId();
867  if (printalot){
868  const CSCLayer* csclayer = cscGeom->layer( id);
869  LocalPoint rhitlocal = (*recIt).localPosition();
870  LocalError rerrlocal = (*recIt).localPositionError();
871  GlobalPoint rhitglobal= csclayer->toGlobal(rhitlocal);
872  printf("\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",id.endcap(),id.station(),id.ring(),id.chamber(),id.layer());
873  printf("\t\tx,y,z: %f, %f, %f\texx,eey,exy: %f, %f, %f\tglobal x,y,z: %f, %f, %f \n",
874  rhitlocal.x(), rhitlocal.y(), rhitlocal.z(), rerrlocal.xx(), rerrlocal.yy(), rerrlocal.xy(),
875  rhitglobal.x(), rhitglobal.y(), rhitglobal.z());
876  }
877  std::pair <LocalPoint, bool> recHitPos((*recIt).localPosition(), false);
878  allRechits[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-FirstCh][id.layer()-1].push_back(recHitPos);
879  }
880  //---- "Empty" chambers
881  for(int iE=0;iE<2;iE++){
882  for(int iS=0;iS<4;iS++){
883  for(int iR=0;iR<4;iR++){
884  for(int iC=0;iC<NumCh;iC++){
885  int numLayers = 0;
886  for(int iL=0;iL<6;iL++){
887  if(allRechits[iE][iS][iR][iC][iL].size()){
888  ++numLayers;
889  }
890  }
891  if(numLayers>1){
892  emptyChambers[iE][iS][iR][iC] = false;
893  }
894  else{
895  emptyChambers[iE][iS][iR][iC] = true;
896  }
897  }
898  }
899  }
900  }
901 
902  //
903  if (printalot){
904  printf(" The size of the segment collection is %i\n", int(segments->size()));
905  //printf("\t...start loop over segments...\n");
906  }
907  segmentsPerEvent->Fill(segments->size());
908  for(CSCSegmentCollection::const_iterator it = segments->begin(); it != segments->end(); it++) {
909  CSCDetId id = (CSCDetId)(*it).cscDetId();
910  StHist[id.endcap()-1][id.station()-1].segmentChi2_ndf->Fill((*it).chi2()/(*it).degreesOfFreedom());
911  StHist[id.endcap()-1][id.station()-1].hitsInSegment->Fill((*it).nRecHits());
912  if (printalot){
913  printf("\tendcap/station/ring/chamber: %i %i %i %i\n",
914  id.endcap(),id.station(),id.ring(),id.chamber());
915  std::cout<<"\tposition(loc) = "<<(*it).localPosition()<<" error(loc) = "<<(*it).localPositionError()<<std::endl;
916  std::cout<<"\t chi2/ndf = "<<(*it).chi2()/(*it).degreesOfFreedom()<<" nhits = "<<(*it).nRecHits() <<std::endl;
917 
918  }
919  allSegments[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-FirstCh].push_back
920  (make_pair((*it).localPosition(), (*it).localDirection()));
921 
922 
923  //---- try to get the CSC recHits that contribute to this segment.
924  //if (printalot) printf("\tGet the recHits for this segment.\t");
925  std::vector<CSCRecHit2D> theseRecHits = (*it).specificRecHits();
926  int nRH = (*it).nRecHits();
927  if (printalot){
928  printf("\tGet the recHits for this segment.\t");
929  printf(" nRH = %i\n",nRH);
930  }
931  //---- Find which of the rechits in the chamber is in the segment
932  int layerRH = 0;
933  for ( vector<CSCRecHit2D>::const_iterator iRH = theseRecHits.begin(); iRH != theseRecHits.end(); iRH++) {
934  ++layerRH;
935  CSCDetId idRH = (CSCDetId)(*iRH).cscDetId();
936  if(printalot){
937  printf("\t%i RH\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
938  layerRH,idRH.endcap(),idRH.station(),idRH.ring(),idRH.chamber(),idRH.layer());
939  }
940  for(size_t jRH = 0;
941  jRH<allRechits[idRH.endcap()-1][idRH.station()-1][idRH.ring()-1][idRH.chamber()-FirstCh][idRH.layer()-1].size();
942  ++jRH){
943  float xDiff = iRH->localPosition().x() -
944  allRechits[idRH.endcap()-1][idRH.station()-1][idRH.ring()-1][idRH.chamber()-FirstCh][idRH.layer()-1][jRH].first.x();
945  float yDiff = iRH->localPosition().y() -
946  allRechits[idRH.endcap()-1][idRH.station()-1][idRH.ring()-1][idRH.chamber()-FirstCh][idRH.layer()-1][jRH].first.y();
947  if(fabs(xDiff)<0.0001 && fabs(yDiff)<0.0001){
948  std::pair <LocalPoint, bool>
949  recHitPos(allRechits[idRH.endcap()-1][idRH.station()-1][idRH.ring()-1][idRH.chamber()-FirstCh][idRH.layer()-1][jRH].first, true);
950  allRechits[idRH.endcap()-1][idRH.station()-1][idRH.ring()-1][idRH.chamber()-FirstCh][idRH.layer()-1][jRH] = recHitPos;
951  if(printalot){
952  std::cout<<" number of the rechit (from zero) in the segment = "<< jRH<<std::endl;
953  }
954  }
955  }
956  }
957  }
958 }
int chamber() const
Definition: CSCDetId.h:81
struct CSCEfficiency::StationHistos StHist[2][4]
float xx() const
Definition: LocalError.h:24
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
T y() const
Definition: PV3DBase.h:63
int layer() const
Definition: CSCDetId.h:74
int endcap() const
Definition: CSCDetId.h:106
float xy() const
Definition: LocalError.h:25
float yy() const
Definition: LocalError.h:26
T z() const
Definition: PV3DBase.h:64
int ring() const
Definition: CSCDetId.h:88
#define FirstCh
std::vector< std::pair< LocalPoint, LocalVector > > allSegments[2][4][4][NumCh]
TH1F * segmentsPerEvent
TH1F * recHitsPerEvent
bool emptyChambers[2][4][4][NumCh]
int station() const
Definition: CSCDetId.h:99
tuple cout
Definition: gather_cfg.py:121
#define NumCh
T x() const
Definition: PV3DBase.h:62
std::vector< std::pair< LocalPoint, bool > > allRechits[2][4][4][NumCh][6]
tuple size
Write out results.
void CSCEfficiency::fillSimhit_info ( edm::Handle< edm::PSimHitContainer > &  simHits)
private

Definition at line 839 of file CSCEfficiency.cc.

References CSCDetId::chamber(), CSCDetId, CSCDetId::endcap(), FirstCh, CSCDetId::layer(), CSCDetId::ring(), and CSCDetId::station().

839  {
840  //---- SIMHITS
841  edm::PSimHitContainer::const_iterator dSHsimIter;
842  for (dSHsimIter = simhits->begin(); dSHsimIter != simhits->end(); dSHsimIter++){
843  // Get DetID for this simHit:
844  CSCDetId sId = (CSCDetId)(*dSHsimIter).detUnitId();
845  std::pair <LocalPoint, int> simHitPos((*dSHsimIter).localPosition(), (*dSHsimIter).particleType());
846  allSimhits[sId.endcap()-1][sId.station()-1][sId.ring()-1][sId.chamber()-FirstCh][sId.layer()-1].push_back(simHitPos);
847  }
848 }
int chamber() const
Definition: CSCDetId.h:81
std::vector< std::pair< LocalPoint, int > > allSimhits[2][4][4][NumCh][6]
int layer() const
Definition: CSCDetId.h:74
int endcap() const
Definition: CSCDetId.h:106
int ring() const
Definition: CSCDetId.h:88
#define FirstCh
int station() const
Definition: CSCDetId.h:99
void CSCEfficiency::fillStrips_info ( edm::Handle< CSCStripDigiCollection > &  strips)
private

Definition at line 801 of file CSCEfficiency.cc.

References CSCDetId, diffTreeTool::diff, j, prof2calltree::last, and dtDQMClient_cfg::threshold.

801  {
802  //---- STRIPS
803  for (CSCStripDigiCollection::DigiRangeIterator j=strips->begin(); j!=strips->end(); j++) {
804  CSCDetId id = (CSCDetId)(*j).first;
805  int largestADCValue = -1;
806  std::vector<CSCStripDigi>::const_iterator digiItr = (*j).second.first;
807  std::vector<CSCStripDigi>::const_iterator last = (*j).second.second;
808  for( ; digiItr != last; ++digiItr) {
809  int maxADC=largestADCValue;
810  int myStrip = digiItr->getStrip();
811  std::vector<int> myADCVals = digiItr->getADCCounts();
812  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
813  float threshold = 13.3 ;
814  float diff = 0.;
815  float peakADC = -1000.;
816  for (unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
817  diff = (float)myADCVals[iCount]-thisPedestal;
818  if (diff > threshold) {
819  if (myADCVals[iCount] > largestADCValue) {
820  largestADCValue = myADCVals[iCount];
821  }
822  }
823  if (diff > threshold && diff > peakADC) {
824  peakADC = diff;
825  }
826  }
827  if(largestADCValue>maxADC){// FIX IT!!!
828  maxADC = largestADCValue;
829  std::pair <int, float> LayerSignal (myStrip, peakADC);
830 
831  //---- AllStrips contains basic information about strips
832  //---- (strip number and peak signal for most significant strip in the layer)
833  allStrips[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-1][id.layer()-1].clear();
834  allStrips[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-1][id.layer()-1].push_back(LayerSignal);
835  }
836  }
837  }
838 }
int j
Definition: DBlmapReader.cc:9
std::vector< std::pair< int, float > > allStrips[2][4][4][NumCh][6]
void CSCEfficiency::fillWG_info ( edm::Handle< CSCWireDigiCollection > &  wires,
edm::ESHandle< CSCGeometry > &  cscGeom 
)
private

Definition at line 775 of file CSCEfficiency.cc.

References CSCDetId, FirstCh, j, prof2calltree::last, and CSCLayerGeometry::yOfWireGroup().

775  {
776  //---- WIRE GROUPS
777  for (CSCWireDigiCollection::DigiRangeIterator j=wires->begin(); j!=wires->end(); j++) {
778  CSCDetId id = (CSCDetId)(*j).first;
779  const CSCLayer *layer_p = cscGeom->layer (id);
780  const CSCLayerGeometry *layerGeom = layer_p->geometry ();
781  //
782  std::vector<CSCWireDigi>::const_iterator digiItr = (*j).second.first;
783  std::vector<CSCWireDigi>::const_iterator last = (*j).second.second;
784  //
785  for( ; digiItr != last; ++digiItr) {
786  std::pair < int, float > WG_pos(digiItr->getWireGroup(), layerGeom->yOfWireGroup(digiItr->getWireGroup()));
787  std::pair <std::pair < int, float >, int > LayerSignal(WG_pos, digiItr->getTimeBin());
788 
789  //---- AllWG contains basic information about WG (WG number and Y-position, time bin)
790  allWG[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-FirstCh]
791  [id.layer()-1].push_back(LayerSignal);
792  if(printalot){
793  //std::cout<<" WG check : "<<std::endl;
794  //printf("\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",id.endcap(),id.station(),id.ring(),id.chamber(),id.layer());
795  //std::cout<<" WG size = "<<allWG[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-FirstCh]
796  //[id.layer()-1].size()<<std::endl;
797  }
798  }
799  }
800 }
float yOfWireGroup(int wireGroup, float x=0.) const
int j
Definition: DBlmapReader.cc:9
std::vector< std::pair< std::pair< int, float >, int > > allWG[2][4][4][NumCh][6]
#define FirstCh
bool CSCEfficiency::filter ( edm::Event event,
const edm::EventSetup eventSetup 
)
privatevirtual

Implements edm::EDFilter.

Definition at line 19 of file CSCEfficiency.cc.

References muon::caloCompatibility(), DeDxDiscriminatorTools::charge(), reco::TrackBase::charge(), reco::TrackBase::confirmed, gather_cfg::cout, CSCDetId, debug, deltaR(), MuonPatternRecoDumper::dumpFTS(), MuonPatternRecoDumper::dumpMuonId(), alignCSCRings::e, Reference_intrackfit_cff::endcap, reco::TrackBase::eta(), FirstCh, reco::Track::found(), TrajectoryStateOnSurface::freeState(), GeomDet::geographicalId(), edm::EventSetup::get(), reco::TrackBase::goodIterative, reco::TrackBase::highPurity, i, iEvent, reco::Track::innerDetId(), reco::Track::innerPosition(), TrajectoryStateOnSurface::isValid(), getDQMSummary::iter, reco::TrackBase::loose, alignBH_cfg::minP, metsig::muon, patZpeak::muons, reco::TrackBase::normalizedChi2(), reco::Track::outerDetId(), reco::Track::outerMomentum(), reco::Track::outerPosition(), reco::TrackBase::p(), phi, reco::TrackBase::phi(), reco::BeamSpot::position(), FreeTrajectoryState::position(), funct::pow(), edm::Handle< T >::product(), reco::TrackBase::pt(), reco::TrackBase::ptError(), reco::TrackBase::qoverp(), reco::TrackBase::qoverpError(), reco::TrackBase::quality(), reco::TrackBase::qualitySize, HI_PhotonSkim_cff::rechits, relativeConstraints::ring, reco::Muon::SegmentAndTrackArbitration, edm::View< T >::size(), mathSSE::sqrt(), relativeConstraints::station, RecoTauPiZeroBuilderPlugins_cfi::strips, reco::TrackBase::tight, edm::TriggerNames::triggerNames(), reco::TrackBase::undefQuality, and PV3DBase< T, PVType, FrameType >::z().

19  {
20  passTheEvent = false;
21  DataFlow->Fill(0.);
23 
24  //---- increment counter
26  // printalot debug output
28  int iRun = event.id().run();
29  int iEvent = event.id().event();
30  if(0==fmod(double (nEventsAnalyzed) ,double(1000) )){
31  if(printalot){
32  printf("\n==enter==CSCEfficiency===== run %i\tevent %i\tn Analyzed %i\n",iRun,iEvent,nEventsAnalyzed);
33  }
34  }
35  theService->update(eventSetup);
36  //---- These declarations create handles to the types of records that you want
37  //---- to retrieve from event "e".
38  if (printalot) printf("\tget handles for digi collections\n");
39 
40  //---- Pass the handle to the method "getByType", which is used to retrieve
41  //---- one and only one instance of the type in question out of event "e". If
42  //---- zero or more than one instance exists in the event an exception is thrown.
43  if (printalot) printf("\tpass handles\n");
51  edm::Handle<edm::View<reco::Track> > trackCollectionH;
53 
54  if(useDigis){
55  event.getByToken( wd_token, wires );
56  event.getByToken( sd_token, strips );
57  event.getByToken( al_token, alcts );
58  event.getByToken( cl_token, clcts );
59  event.getByToken( co_token, correlatedlcts );
60  }
61  if(!isData){
62  event.getByToken( sh_token, simhits );
63  }
64  event.getByToken( rh_token, rechits );
65  event.getByToken( se_token, segments );
66  event.getByToken( tk_token, trackCollectionH );
67  const edm::View<reco::Track> trackCollection = *(trackCollectionH.product());
68 
69  //---- Get the CSC Geometry :
70  if (printalot) printf("\tget the CSC geometry.\n");
72  eventSetup.get<MuonGeometryRecord>().get(cscGeom);
73 
74  // use theTrackingGeometry instead of cscGeom?
75  edm::ESHandle<GlobalTrackingGeometry> theTrackingGeometry;
76  eventSetup.get<GlobalTrackingGeometryRecord>().get(theTrackingGeometry);
77 
78  bool triggerPassed = true;
79  if(useTrigger){
80  // access the trigger information
81  // trigger names can be find in HLTrigger/Configuration/python/HLT_2E30_cff.py (or?)
82  // get hold of TriggerResults
84  event.getByToken( ht_token, hltR );
85  const edm::TriggerNames & triggerNames = event.triggerNames(*hltR);
86  triggerPassed = applyTrigger(hltR, triggerNames);
87  }
88  if(!triggerPassed){
89  return triggerPassed;
90  }
91  DataFlow->Fill(1.);
92  GlobalPoint gpZero(0.,0.,0.);
93  if(theService->magneticField()->inTesla(gpZero).mag2()<0.1){
94  magField = false;
95  }
96  else{
97  magField = true;
98  }
99 
100  //---- store info from digis
101  fillDigiInfo(alcts, clcts, correlatedlcts, wires, strips, simhits, rechits, segments, cscGeom);
102  //
104  edm::InputTag muonTag_("muons");
105  event.getByLabel(muonTag_,muons);
106 
107  edm::Handle<reco::BeamSpot> beamSpotHandle;
108  event.getByLabel("offlineBeamSpot", beamSpotHandle);
109  reco::BeamSpot vertexBeamSpot = *beamSpotHandle;
110  //
111  std::vector <reco::MuonCollection::const_iterator> goodMuons_it;
112  unsigned int nPositiveZ = 0;
113  unsigned int nNegativeZ = 0;
114  float muonOuterZPosition = -99999.;
115  if(isIPdata){
116  if (printalot)std::cout<<" muons.size() = "<<muons->size() <<std::endl;
117  for ( reco::MuonCollection::const_iterator muon = muons->begin(); muon != muons->end(); ++muon ) {
118  DataFlow->Fill(31.);
119  if (printalot) {
120  std::cout<<" iMuon = "<<muon-muons->begin()<<" charge = "<<muon->charge()<<" p = "<<muon->p()<<" pt = "<<muon->pt()<<
121  " eta = "<<muon->eta()<<" phi = "<<muon->phi()<<
122  " matches = "<<
123  muon->matches().size()<<" matched Seg = "<<muon->numberOfMatches(reco::Muon::SegmentAndTrackArbitration)<<" GLB/TR/STA = "<<
124  muon->isGlobalMuon()<<"/"<<muon->isTrackerMuon()<<"/"<<muon->isStandAloneMuon()<<std::endl;
125  }
126  if(!(muon->isTrackerMuon() && muon->isGlobalMuon())){
127  continue;
128  }
129  DataFlow->Fill(32.);
130  double relISO = ( muon->isolationR03().sumPt +
131  muon->isolationR03().emEt +
132  muon->isolationR03().hadEt)/muon->track()->pt();
133  if (printalot) {
134  std::cout<<" relISO = "<<relISO<<" emVetoEt = "<<muon->isolationR03().emVetoEt<<" caloComp = "<<
135  muon::caloCompatibility(*(muon))<<" dxy = "<<fabs(muon->track()->dxy(vertexBeamSpot.position()))<<std::endl;
136  }
137  if(
138  //relISO>0.1 || muon::caloCompatibility(*(muon))<.90 ||
139  fabs(muon->track()->dxy(vertexBeamSpot.position()))>0.2 || muon->pt()<6.){
140  continue;
141  }
142  DataFlow->Fill(33.);
143  if(muon->track()->hitPattern().numberOfValidPixelHits()<1 ||
144  muon->track()->hitPattern().numberOfValidTrackerHits()<11 ||
145  muon->combinedMuon()->hitPattern().numberOfValidMuonHits()<1 ||
146  muon->combinedMuon()->normalizedChi2()>10. ||
147  muon->numberOfMatches()<2){
148  continue;
149  }
150  DataFlow->Fill(34.);
151  float zOuter = muon->combinedMuon()->outerPosition().z();
152  float rhoOuter = muon->combinedMuon()->outerPosition().rho();
153  bool passDepth = true;
154  // barrel region
155  //if ( fabs(zOuter) < 660. && rhoOuter > 400. && rhoOuter < 480.){
156  if ( fabs(zOuter) < 660. && rhoOuter > 400. && rhoOuter < 540.){
157  passDepth = false;
158  }
159  // endcap region
160  //else if( fabs(zOuter) > 550. && fabs(zOuter) < 650. && rhoOuter < 300.){
161  else if( fabs(zOuter) > 550. && fabs(zOuter) < 650. && rhoOuter < 300.){
162  passDepth = false;
163  }
164  // overlap region
165  //else if ( fabs(zOuter) > 680. && fabs(zOuter) < 730. && rhoOuter < 480.){
166  else if ( fabs(zOuter) > 680. && fabs(zOuter) < 880. && rhoOuter < 540.){
167  passDepth = false;
168  }
169  if(!passDepth){
170  continue;
171  }
172  DataFlow->Fill(35.);
173  goodMuons_it.push_back(muon);
174  if(muon->track()->momentum().z()>0.){
175  ++nPositiveZ;
176  }
177  if(muon->track()->momentum().z()<0.){
178  ++nNegativeZ;
179  }
180  }
181  }
182 
183  //
184 
185 
186  if (printalot) std::cout<<"Start track loop over "<<trackCollection.size()<<" tracks"<<std::endl;
187  for(edm::View<reco::Track>::size_type i=0; i<trackCollection.size(); ++i) {
188  DataFlow->Fill(2.);
189  edm::RefToBase<reco::Track> track(trackCollectionH, i);
190  //std::cout<<" iTR = "<<i<<" eta = "<<track->eta()<<" phi = "<<track->phi()<<std::cout<<" pt = "<<track->pt()<<std::endl;
191  if(isIPdata){
192  if (printalot){
193  std::cout<<" nNegativeZ = "<<nNegativeZ<<" nPositiveZ = "<<nPositiveZ<<std::endl;
194  }
195  if(nNegativeZ>1 || nPositiveZ>1){
196  break;
197  }
198  bool trackOK = false;
199  if (printalot){
200  std::cout<<" goodMuons_it.size() = "<<goodMuons_it.size()<<std::endl;
201  }
202  for(size_t iM=0;iM<goodMuons_it.size();++iM){
203  //std::cout<<" iM = "<<iM<<" eta = "<<goodMuons_it[iM]->track()->eta()<<
204  //" phi = "<<goodMuons_it[iM]->track()->phi()<<
205  //" pt = "<<goodMuons_it[iM]->track()->pt()<<std::endl;
206  float deltaR = pow(track->phi()-goodMuons_it[iM]->track()->phi(),2) +
207  pow(track->eta()-goodMuons_it[iM]->track()->eta(),2);
208  deltaR = sqrt(deltaR);
209  if (printalot){
210  std::cout<<" TR mu match to a tr: deltaR = "<<deltaR<<" dPt = "<<
211  track->pt()-goodMuons_it[iM]->track()->pt()<<std::endl;
212  }
213  if(deltaR>0.01 || fabs(track->pt()-goodMuons_it[iM]->track()->pt())>0.1 ){
214  continue;
215  }
216  else{
217  trackOK = true;
218  if (printalot){
219  std::cout<<" trackOK "<<std::endl;
220  }
221  muonOuterZPosition = goodMuons_it[iM]->combinedMuon()->outerPosition().z();
222  break;
223  //++nChosenTracks;
224  }
225  }
226  if(!trackOK){
227  if (printalot){
228  std::cout<<" failed: trackOK "<<std::endl;
229  }
230  continue;
231  }
232  }
233  else{
234  //---- Do we need a better "clean track" definition?
235  if(trackCollection.size()>2){
236  break;
237  }
238  DataFlow->Fill(3.);
239  if(!i && 2==trackCollection.size()){
241  edm::RefToBase<reco::Track> trackTwo(trackCollectionH, tType);
242  if(track->outerPosition().z()*trackTwo->outerPosition().z()>0){// in one and the same "endcap"
243  break;
244  }
245  }
246  }
247  DataFlow->Fill(4.);
248  if (printalot){
249  std::cout<<"i track = "<<i<<" P = "<<track->p()<<" chi2/ndf = "<<track->normalizedChi2()<<" nSeg = "<<segments->size()<<std::endl;
250  std::cout<<"quality undef/loose/tight/high/confirmed/goodIt/size "<<
251  track->quality(reco::Track::undefQuality)<<"/"<<
252  track->quality(reco::Track::loose)<<"/"<<
253  track->quality(reco::Track::tight)<<"/"<<
254  track->quality(reco::Track::highPurity)<<"/"<<
255  track->quality(reco::Track::confirmed)<<"/"<<
256  track->quality(reco::Track::goodIterative)<<"/"<<
257  track->quality(reco::Track::qualitySize)<<
258  std::endl;
259  std::cout<<" pt = "<< track->pt()<<" +-"<<track->ptError()<<" q/pt = "<<track->qoverp()<<" +- "<<track->qoverpError()<<std::endl;
260  //std::cout<<" const Pmin = "<<minTrackMomentum<<" pMax = "<<maxTrackMomentum<<" maxNormChi2 = "<<maxNormChi2<<std::endl;
261  std::cout<<" track inner position = "<<track->innerPosition()<<" outer position = "<<track->outerPosition()<<std::endl;
262  std::cout<<"track eta (outer) = "<<track->outerPosition().eta()<<" phi (outer) = "<<
263  track->outerPosition().phi()<<std::endl;
264  if(fabs(track->innerPosition().z())>500.){
265  DetId innerDetId(track->innerDetId());
266  std::cout<<" dump inner state MUON detid = "<<debug.dumpMuonId(innerDetId)<<std::endl;
267  }
268  if(fabs(track->outerPosition().z())>500.){
269  DetId outerDetId(track->outerDetId());
270  std::cout<<" dump outer state MUON detid = "<<debug.dumpMuonId(outerDetId)<<std::endl;
271  }
272 
273  std::cout<<" nHits = "<<track->found()<<std::endl;
274  /*
275  trackingRecHit_iterator rhbegin = track->recHitsBegin();
276  trackingRecHit_iterator rhend = track->recHitsEnd();
277  int iRH = 0;
278  for(trackingRecHit_iterator recHit = rhbegin; recHit != rhend; ++recHit){
279  const GeomDet* geomDet = theTrackingGeometry->idToDet((*recHit)->geographicalId());
280  std::cout<<"hit "<<iRH<<" loc pos = " <<(*recHit)->localPosition()<<
281  " glob pos = " <<geomDet->toGlobal((*recHit)->localPosition())<<std::endl;
282  ++iRH;
283  }
284  */
285  }
286  float dpT_ov_pT = 0.;
287  if(fabs(track->pt())>0.001){
288  dpT_ov_pT = track->ptError()/ track->pt();
289  }
290  //---- These define a "good" track
291  if(track->normalizedChi2()>maxNormChi2){// quality
292  break;
293  }
294  DataFlow->Fill(5.);
295  if(track->found()<minTrackHits){// enough data points
296  break;
297  }
298  DataFlow->Fill(6.);
299  if(!segments->size()){// better have something in the CSC
300  break;
301  }
302  DataFlow->Fill(7.);
303  if(magField && (track->p()<minP || track->p()>maxP)){// proper energy range
304  break;
305  }
306  DataFlow->Fill(8.);
307  if(magField && (dpT_ov_pT >0.5) ){// not too crazy uncertainty
308  break;
309  }
310  DataFlow->Fill(9.);
311 
312  passTheEvent = true;
313  if (printalot) std::cout<<"good Track"<<std::endl;
314  CLHEP::Hep3Vector r3T_inner(track->innerPosition().x(),track->innerPosition().y(),track->innerPosition().z());
315  CLHEP::Hep3Vector r3T(track->outerPosition().x(),track->outerPosition().y(),track->outerPosition().z());
316  chooseDirection(r3T_inner, r3T);// for non-IP
317 
318  CLHEP::Hep3Vector p3T(track->outerMomentum().x(),track->outerMomentum().y(),track->outerMomentum().z());
319  CLHEP::Hep3Vector p3_propagated, r3_propagated;
320  AlgebraicSymMatrix66 cov_propagated, covT;
321  covT *= 1e-20;
322  cov_propagated *= 1e-20;
323  int charge = track->charge();
324  FreeTrajectoryState ftsStart = getFromCLHEP(p3T, r3T, charge, covT, &*(theService->magneticField()));
325  if (printalot){
326  std::cout<<" p = "<<track->p()<<" norm chi2 = "<<track->normalizedChi2()<<std::endl;
327  std::cout<<" dump the very first FTS = "<<debug.dumpFTS(ftsStart)<<std::endl;
328  }
329  TrajectoryStateOnSurface tSOSDest;
330  int endcap = 0;
331  //---- which endcap to look at
332  if(track->outerPosition().z()>0){
333  endcap = 1;
334  }
335  else{
336  endcap = 2;
337  }
338  int chamber = 1;
339  //---- a "refference" CSCDetId for each ring
340  std::vector< CSCDetId > refME;
341  for(int iS=1;iS<5;++iS){
342  for(int iR=1;iR<4;++iR){
343  if(1!=iS && iR>2){
344  continue;
345  }
346  else if(4==iS && iR>1){
347  continue;
348  }
349  refME.push_back( CSCDetId(endcap, iS, iR, chamber));
350  }
351  }
352  //---- loop over the "refference" CSCDetIds
353  for(size_t iSt = 0; iSt<refME.size();++iSt){
354  if (printalot){
355  std::cout<<"loop iStatation = "<<iSt<<std::endl;
356  std::cout<<"refME[iSt]: st = "<<refME[iSt].station()<<" rg = "<<refME[iSt].ring()<<std::endl;
357  }
358  std::map <std::string, bool> chamberTypes;
359  chamberTypes["ME11"] = false;
360  chamberTypes["ME12"] = false;
361  chamberTypes["ME13"] = false;
362  chamberTypes["ME21"] = false;
363  chamberTypes["ME22"] = false;
364  chamberTypes["ME31"] = false;
365  chamberTypes["ME32"] = false;
366  chamberTypes["ME41"] = false;
367  const CSCChamber* cscChamber_base = cscGeom->chamber(refME[iSt].chamberId());
368  DetId detId = cscChamber_base->geographicalId();
369  if (printalot){
370  std::cout<<" base iStation : eta = "<<cscGeom->idToDet(detId)->surface().position().eta()<<" phi = "<<
371  cscGeom->idToDet(detId)->surface().position().phi() << " y = " <<cscGeom->idToDet(detId)->surface().position().y()<<std::endl;
372  std::cout<<" dump base iStation detid = "<<debug.dumpMuonId(detId)<<std::endl;
373  std::cout<<" dump FTS start = "<<debug.dumpFTS(ftsStart)<<std::endl;
374  }
375  //---- propagate to this ME
376  tSOSDest = propagate(ftsStart, cscGeom->idToDet(detId)->surface());
377  if(tSOSDest.isValid()){
378  ftsStart = *tSOSDest.freeState();
379  if (printalot) std::cout<<" dump FTS end = "<<debug.dumpFTS(ftsStart)<<std::endl;
380  getFromFTS(ftsStart, p3_propagated, r3_propagated, charge, cov_propagated);
381  float feta = fabs(r3_propagated.eta());
382  float phi = r3_propagated.phi();
383  //---- which rings are (possibly) penetrated
384  ringCandidates(refME[iSt].station(), feta, chamberTypes);
385 
386  map<std::string,bool>::iterator iter;
387  int iterations = 0;
388  //---- loop over ring candidates
389  for( iter = chamberTypes.begin(); iter != chamberTypes.end(); iter++ ) {
390  ++iterations;
391  //---- is this ME a machinig candidate station
392  if(iter->second && (iterations-1)==int(iSt)){
393  if (printalot){
394  std::cout<<" Chamber type "<< iter->first<<" is a candidate..."<<std::endl;
395  std::cout<<" station() = "<< refME[iSt].station()<<" ring() = "<<refME[iSt].ring()<<" iSt = "<<iSt<<std::endl;
396  }
397  std::vector <int> coupleOfChambers;
398  //---- which chamber (and its closes neighbor) is penetrated by the track - candidates
399  chamberCandidates(refME[iSt].station(), refME[iSt].ring(), phi, coupleOfChambers);
400  //---- loop over the two chamber candidates
401  for(size_t iCh =0;iCh<coupleOfChambers.size();++iCh){
402  DataFlow->Fill(11.);
403  if (printalot) std::cout<<" Check chamber N = "<<coupleOfChambers.at(iCh)<<std::endl;;
404  if((!getAbsoluteEfficiency) && (true == emptyChambers
405  [refME[iSt].endcap()-1]
406  [refME[iSt].station()-1]
407  [refME[iSt].ring()-1]
408  [coupleOfChambers.at(iCh)-FirstCh])){
409  continue;
410  }
411  CSCDetId theCSCId(refME[iSt].endcap(), refME[iSt].station(), refME[iSt].ring(), coupleOfChambers.at(iCh));
412  const CSCChamber* cscChamber = cscGeom->chamber(theCSCId.chamberId());
413  const BoundPlane bpCh = cscGeom->idToDet(cscChamber->geographicalId())->surface();
414  float zFTS = ftsStart.position().z();
415  float dz = fabs(bpCh.position().z() - zFTS);
416  float zDistInner = track->innerPosition().z() - bpCh.position().z();
417  float zDistOuter = track->outerPosition().z() - bpCh.position().z();
418  //---- only detectors between the inner and outer points of the track are considered for non IP-data
419  if(printalot){
420  std::cout<<" zIn = "<<track->innerPosition().z()<<" zOut = "<<track->outerPosition().z()<<" zSurf = "<<bpCh.position().z()<<std::endl;
421  }
422  if(!isIPdata && (zDistInner*zDistOuter>0. || fabs(zDistInner)<15. || fabs(zDistOuter)<15.)){ // for non IP-data
423  if(printalot){
424  std::cout<<" Not an intermediate (as defined) point... Skip."<<std::endl;
425  }
426  continue;
427  }
428  if(isIPdata && fabs(track->eta())<1.8){
429  if(fabs(muonOuterZPosition) - fabs(bpCh.position().z())<0 ||
430  fabs(muonOuterZPosition-bpCh.position().z())<15.){
431  continue;
432  }
433  }
434  DataFlow->Fill(13.);
435  //---- propagate to the chamber (from this ME) if it is a different surface (odd/even chambers)
436  if(dz>0.1){// i.e. non-zero (float 0 check is bad)
437  //if(fabs(zChanmber - zFTS ) > 0.1){
438  tSOSDest = propagate(ftsStart, cscGeom->idToDet(cscChamber->geographicalId())->surface());
439  if(tSOSDest.isValid()){
440  ftsStart = *tSOSDest.freeState();
441  }
442  else{
443  if(printalot) std::cout<<"TSOS not valid! Break."<<std::endl;
444  break;
445  }
446  }
447  else{
448  if(printalot) std::cout<<" info: dz<0.1"<<std::endl;
449  }
450  DataFlow->Fill(15.);
451  FreeTrajectoryState ftsInit = ftsStart;
452  bool inDeadZone = false;
453  //---- loop over the 6 layers
454  for(int iLayer = 0;iLayer<6;++iLayer){
455  bool extrapolationPassed = true;
456  if (printalot){
457  std::cout<<" iLayer = "<<iLayer<<" dump FTS init = "<<debug.dumpFTS(ftsInit)<<std::endl;
458  std::cout<<" dump detid = "<<debug.dumpMuonId(cscChamber->geographicalId())<<std::endl;
459  std::cout<<"Surface to propagate to: pos = "<<cscChamber->layer(iLayer+1)->surface().position()<<" eta = "
460  <<cscChamber->layer(iLayer+1)->surface().position().eta()<<" phi = "
461  <<cscChamber->layer(iLayer+1)->surface().position().phi()<<std::endl;
462  }
463  //---- propagate to this layer
464  tSOSDest = propagate(ftsInit, cscChamber->layer(iLayer+1)->surface());
465  if(tSOSDest.isValid()){
466  ftsInit = *tSOSDest.freeState();
467  if (printalot) std::cout<<" Propagation between layers successful: dump FTS end = "<<debug.dumpFTS(ftsInit)<<std::endl;
468  getFromFTS(ftsInit, p3_propagated, r3_propagated, charge, cov_propagated);
469  }
470  else{
471  if (printalot) std::cout<<"Propagation between layers not successful - notValid TSOS"<<std::endl;
472  extrapolationPassed = false;
473  inDeadZone = true;
474  }
475  //}
476  //---- Extrapolation passed? For each layer?
477  if(extrapolationPassed){
478  GlobalPoint theExtrapolationPoint(r3_propagated.x(),r3_propagated.y(),r3_propagated.z());
479  LocalPoint theLocalPoint = cscChamber->layer(iLayer+1)->toLocal(theExtrapolationPoint);
480  //std::cout<<" Candidate chamber: extrapolated LocalPoint = "<<theLocalPoint<<std::endl;
481  inDeadZone = ( inDeadZone ||
482  !inSensitiveLocalRegion(theLocalPoint.x(), theLocalPoint.y(),
483  refME[iSt].station(), refME[iSt].ring()));
484  if (printalot){
485  std::cout<<" Candidate chamber: extrapolated LocalPoint = "<<theLocalPoint<<"inDeadZone = "<<inDeadZone<<std::endl;
486  }
487  //---- break if in dead zone for any layer ("clean" tracks)
488  if(inDeadZone){
489  break;
490  }
491  }
492  else{
493  break;
494  }
495  }
496  DataFlow->Fill(17.);
497  //---- Is a track in a sensitive area for each layer?
498  if(!inDeadZone){//---- for any layer
499  DataFlow->Fill(19.);
500  if (printalot) std::cout<<"Do efficiencies..."<<std::endl;
501  //---- Do efficiencies
502  // angle cuts applied (if configured)
503  bool angle_flag = true; angle_flag = efficienciesPerChamber(theCSCId, cscChamber, ftsStart);
504  if(useDigis && angle_flag){
505  stripWire_Efficiencies(theCSCId, ftsStart);
506  }
507  if(angle_flag){
508  recHitSegment_Efficiencies(theCSCId, cscChamber, ftsStart);
509  if(!isData){
510  recSimHitEfficiency(theCSCId, ftsStart);
511  }
512  }
513  }
514  else{
515  if(printalot) std::cout<<" Not in active area for all layers"<<std::endl;
516  }
517  }
518  if(tSOSDest.isValid()){
519  ftsStart = *tSOSDest.freeState();
520  }
521  }
522  }
523  }
524  else{
525  if (printalot) std::cout<<" TSOS not valid..."<<std::endl;
526  }
527  }
528  }
529  //---- End
530  if (printalot) printf("==exit===CSCEfficiency===== run %i\tevent %i\n\n",iRun,iEvent);
531  return passTheEvent;
532 }
int i
Definition: DBlmapReader.cc:9
bool applyTrigger(edm::Handle< edm::TriggerResults > &hltR, const edm::TriggerNames &triggerNames)
edm::EDGetTokenT< CSCStripDigiCollection > sd_token
void chooseDirection(CLHEP::Hep3Vector &innerPosition, CLHEP::Hep3Vector &outerPosition)
void ringCandidates(int station, float absEta, std::map< std::string, bool > &chamberTypes)
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > co_token
bool recSimHitEfficiency(CSCDetId &id, FreeTrajectoryState &ftsChamber)
edm::EDGetTokenT< CSCCLCTDigiCollection > cl_token
double charge(const std::vector< uint8_t > &Ampls)
Strings const & triggerNames() const
Definition: TriggerNames.cc:24
bool getAbsoluteEfficiency
float caloCompatibility(const reco::Muon &muon)
edm::EDGetTokenT< CSCSegmentCollection > se_token
FreeTrajectoryState getFromCLHEP(const CLHEP::Hep3Vector &p3, const CLHEP::Hep3Vector &r3, int charge, const AlgebraicSymMatrix66 &cov, const MagneticField *field)
std::string dumpMuonId(const DetId &id) const
std::string dumpFTS(const FreeTrajectoryState &fts) const
int iEvent
Definition: GenABIO.cc:230
edm::EDGetTokenT< edm::PSimHitContainer > sh_token
MuonServiceProxy * theService
edm::EDGetTokenT< CSCWireDigiCollection > wd_token
T sqrt(T t)
Definition: SSEVec.h:48
FreeTrajectoryState const * freeState(bool withErrors=true) const
T z() const
Definition: PV3DBase.h:64
unsigned int size_type
Definition: View.h:85
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:72
void getFromFTS(const FreeTrajectoryState &fts, CLHEP::Hep3Vector &p3, CLHEP::Hep3Vector &r3, int &charge, AlgebraicSymMatrix66 &cov)
bool efficienciesPerChamber(CSCDetId &id, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber)
void chamberCandidates(int station, int ring, float phi, std::vector< int > &coupleOfChambers)
double maxNormChi2
bool stripWire_Efficiencies(CSCDetId &cscDetId, FreeTrajectoryState &ftsChamber)
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
edm::EDGetTokenT< CSCRecHit2DCollection > rh_token
Definition: DetId.h:18
GlobalPoint position() const
#define debug
Definition: HDRShower.cc:19
void fillDigiInfo(edm::Handle< CSCALCTDigiCollection > &alcts, edm::Handle< CSCCLCTDigiCollection > &clcts, edm::Handle< CSCCorrelatedLCTDigiCollection > &correlatedlcts, edm::Handle< CSCWireDigiCollection > &wires, edm::Handle< CSCStripDigiCollection > &strips, edm::Handle< edm::PSimHitContainer > &simhits, edm::Handle< CSCRecHit2DCollection > &rechits, edm::Handle< CSCSegmentCollection > &segments, edm::ESHandle< CSCGeometry > &cscGeom)
#define FirstCh
const T & get() const
Definition: EventSetup.h:55
size_type size() const
bool recHitSegment_Efficiencies(CSCDetId &cscDetId, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber)
unsigned int printout_NEvents
T const * product() const
Definition: Handle.h:81
bool inSensitiveLocalRegion(double xLocal, double yLocal, int station, int ring)
bool emptyChambers[2][4][4][NumCh]
tuple muons
Definition: patZpeak.py:38
tuple cout
Definition: gather_cfg.py:121
const Point & position() const
position
Definition: BeamSpot.h:62
unsigned int minTrackHits
edm::EDGetTokenT< CSCALCTDigiCollection > al_token
edm::EDGetTokenT< edm::TriggerResults > ht_token
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
TrajectoryStateOnSurface propagate(FreeTrajectoryState &ftsStart, const BoundPlane &bp)
edm::EDGetTokenT< edm::View< reco::Track > > tk_token
Definition: DDAxes.h:10
FreeTrajectoryState CSCEfficiency::getFromCLHEP ( const CLHEP::Hep3Vector &  p3,
const CLHEP::Hep3Vector &  r3,
int  charge,
const AlgebraicSymMatrix66 cov,
const MagneticField field 
)
private

Definition at line 1448 of file CSCEfficiency.cc.

1450  {
1451 
1452  GlobalVector p3GV(p3.x(), p3.y(), p3.z());
1453  GlobalPoint r3GP(r3.x(), r3.y(), r3.z());
1454  GlobalTrajectoryParameters tPars(r3GP, p3GV, charge, field);
1455 
1456  CartesianTrajectoryError tCov(cov);
1457 
1458  return cov.kRows == 6 ? FreeTrajectoryState(tPars, tCov) : FreeTrajectoryState(tPars) ;
1459 }
double charge(const std::vector< uint8_t > &Ampls)
double p3[4]
Definition: TauolaWrapper.h:91
void CSCEfficiency::getFromFTS ( const FreeTrajectoryState fts,
CLHEP::Hep3Vector &  p3,
CLHEP::Hep3Vector &  r3,
int &  charge,
AlgebraicSymMatrix66 cov 
)
private

Definition at line 1433 of file CSCEfficiency.cc.

References FreeTrajectoryState::cartesianError(), FreeTrajectoryState::charge(), FreeTrajectoryState::hasError(), CartesianTrajectoryError::matrix(), FreeTrajectoryState::momentum(), FreeTrajectoryState::position(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

1435  {
1436 
1437  GlobalVector p3GV = fts.momentum();
1438  GlobalPoint r3GP = fts.position();
1439 
1440  p3.set(p3GV.x(), p3GV.y(), p3GV.z());
1441  r3.set(r3GP.x(), r3GP.y(), r3GP.z());
1442 
1443  charge = fts.charge();
1444  cov = fts.hasError() ? fts.cartesianError().matrix() : AlgebraicSymMatrix66();
1445 
1446 }
CartesianTrajectoryError cartesianError() const
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
T y() const
Definition: PV3DBase.h:63
TrackCharge charge() const
double charge(const std::vector< uint8_t > &Ampls)
T z() const
Definition: PV3DBase.h:64
GlobalVector momentum() const
const AlgebraicSymMatrix66 & matrix() const
GlobalPoint position() const
T x() const
Definition: PV3DBase.h:62
double p3[4]
Definition: TauolaWrapper.h:91
bool CSCEfficiency::inSensitiveLocalRegion ( double  xLocal,
double  yLocal,
int  station,
int  ring 
)
private

Definition at line 535 of file CSCEfficiency.cc.

References funct::abs().

535  {
536  //---- Good region means sensitive area of a chamber. "Local" stands for the local system
537  bool pass = false;
538  std::vector <double> chamberBounds(3);// the sensitive area
539  float y_center = 99999.;
540  //---- hardcoded... not good
541  if(station>1 && station<5){
542  if(2==ring){
543  chamberBounds[0] = 66.46/2; // (+-)x1 shorter
544  chamberBounds[1] = 127.15/2; // (+-)x2 longer
545  chamberBounds[2] = 323.06/2;
546  y_center = -0.95;
547  }
548  else{
549  if(2==station){
550  chamberBounds[0] = 54.00/2; // (+-)x1 shorter
551  chamberBounds[1] = 125.71/2; // (+-)x2 longer
552  chamberBounds[2] = 189.66/2;
553  y_center = -0.955;
554  }
555  else if(3==station){
556  chamberBounds[0] = 61.40/2; // (+-)x1 shorter
557  chamberBounds[1] = 125.71/2; // (+-)x2 longer
558  chamberBounds[2] = 169.70/2;
559  y_center = -0.97;
560  }
561  else if(4==station){
562  chamberBounds[0] = 69.01/2; // (+-)x1 shorter
563  chamberBounds[1] = 125.65/2; // (+-)x2 longer
564  chamberBounds[2] = 149.42/2;
565  y_center = -0.94;
566  }
567  }
568  }
569  else if(1==station){
570  if(3==ring){
571  chamberBounds[0] = 63.40/2; // (+-)x1 shorter
572  chamberBounds[1] = 92.10/2; // (+-)x2 longer
573  chamberBounds[2] = 164.16/2;
574  y_center = -1.075;
575  }
576  else if(2==ring){
577  chamberBounds[0] = 51.00/2; // (+-)x1 shorter
578  chamberBounds[1] = 83.74/2; // (+-)x2 longer
579  chamberBounds[2] = 174.49/2;
580  y_center = -0.96;
581  }
582  else{// to be investigated
583  chamberBounds[0] = 30./2;//40./2; // (+-)x1 shorter
584  chamberBounds[1] = 60./2;//100./2; // (+-)x2 longer
585  chamberBounds[2] = 160./2;//142./2;
586  y_center = 0.;
587  }
588  }
589  double yUp = chamberBounds[2] + y_center;
590  double yDown = - chamberBounds[2] + y_center;
591  double xBound1Shifted = chamberBounds[0]-distanceFromDeadZone;//
592  double xBound2Shifted = chamberBounds[1]-distanceFromDeadZone;//
593  double lineSlope = (yUp - yDown)/(xBound2Shifted-xBound1Shifted);
594  double lineConst = yUp - lineSlope*xBound2Shifted;
595  double yBoundary = lineSlope*abs(xLocal) + lineConst;
596  pass = checkLocal(yLocal, yBoundary, station, ring);
597  return pass;
598 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double distanceFromDeadZone
bool checkLocal(double yLocal, double yBoundary, int station, int ring)
void CSCEfficiency::linearExtrapolation ( GlobalPoint  initialPosition,
GlobalVector  initialDirection,
float  zSurface,
std::vector< float > &  posZY 
)
private

Definition at line 1461 of file CSCEfficiency.cc.

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

1462  {
1463  double paramLine = lineParameter(initialPosition.z(), zSurface, initialDirection.z());
1464  double xPosition = extrapolate1D(initialPosition.x(), initialDirection.x(),paramLine);
1465  double yPosition = extrapolate1D(initialPosition.y(), initialDirection.y(),paramLine);
1466  posZY.clear();
1467  posZY.push_back(xPosition);
1468  posZY.push_back(yPosition);
1469 }
double lineParameter(double initZPosition, double destZPosition, double initZDirection)
T y() const
Definition: PV3DBase.h:63
T z() const
Definition: PV3DBase.h:64
double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine)
T x() const
Definition: PV3DBase.h:62
double CSCEfficiency::lineParameter ( double  initZPosition,
double  destZPosition,
double  initZDirection 
)
private

Definition at line 1476 of file CSCEfficiency.cc.

1476  {
1477  double paramLine = (destZPosition-initZPosition)/initZDirection;
1478  return paramLine;
1479 }
TrajectoryStateOnSurface CSCEfficiency::propagate ( FreeTrajectoryState ftsStart,
const BoundPlane bp 
)
private

Definition at line 1511 of file CSCEfficiency.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

1511  {
1512  TrajectoryStateOnSurface tSOSDest;
1513  std::string propagatorName;
1514 /*
1515 // it would work if cosmic muons had properly assigned direction...
1516  bool dzPositive = bpDest.position().z() - ftsStart.position().z() > 0 ? true : false;
1517  //---- Be careful with trigger conditions too
1518  if(!isIPdata){
1519  bool rightDirection = !(alongZ^dzPositive);
1520  if(rightDirection){
1521  if(printalot) std::cout<<" propagate along momentum"<<std::endl;
1522  propagatorName = "SteppingHelixPropagatorAlong";
1523  }
1524  else{
1525  if(printalot) std::cout<<" propagate opposite momentum"<<std::endl;
1526  propagatorName = "SteppingHelixPropagatorOpposite";
1527  }
1528  }
1529  else{
1530  if(printalot) std::cout<<" propagate any (momentum)"<<std::endl;
1531  propagatorName = "SteppingHelixPropagatorAny";
1532  }
1533 */
1534  propagatorName = "SteppingHelixPropagatorAny";
1535  tSOSDest = propagator(propagatorName)->propagate(ftsStart, bpDest);
1536  return tSOSDest;
1537 }
const Propagator * propagator(std::string propagatorName) const
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:56
const Propagator * CSCEfficiency::propagator ( std::string  propagatorName) const
private

Definition at line 1506 of file CSCEfficiency.cc.

1506  {
1507  return &*theService->propagator(propagatorName);
1508 }
MuonServiceProxy * theService
bool CSCEfficiency::recHitSegment_Efficiencies ( CSCDetId cscDetId,
const CSCChamber cscChamber,
FreeTrajectoryState ftsChamber 
)
private

Definition at line 1292 of file CSCEfficiency.cc.

References gather_cfg::cout, Reference_intrackfit_cff::endcap, PV3DBase< T, PVType, FrameType >::eta(), first, FirstCh, CSCLayer::geometry(), CSCChamber::layer(), M_PI, CSCLayerGeometry::nearestStrip(), FreeTrajectoryState::position(), funct::pow(), relativeConstraints::ring, edm::second(), findQualityFiles::size, mathSSE::sqrt(), relativeConstraints::station, CSCLayerGeometry::stripAngle(), GeomDet::surface(), GeomDet::toGlobal(), GeomDet::toLocal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

1292  {
1293  int ec, st, rg, ch, secondRing;
1294  returnTypes(id, ec, st, rg, ch, secondRing);
1295  bool firstCondition, secondCondition;
1296 
1297  std::vector <bool> missingLayers_rh(6);
1298  std::vector <int> usedInSegment(6);
1299  // Rechits
1300  if(printalot) std::cout<<"RecHits eff"<<std::endl;
1301  for(int iLayer=0;iLayer<6;++iLayer){
1302  firstCondition = allRechits[ec][st][rg][ch][iLayer].size() ? true : false;
1303  secondCondition = false;
1304  int thisRing = rg;
1305  if(secondRing>-1){
1306  secondCondition = allRechits[ec][st][secondRing][ch][iLayer].size() ? true : false;
1307  if(secondCondition){
1308  thisRing = secondRing;
1309  }
1310  }
1311  if(firstCondition || secondCondition){
1312  ChHist[ec][st][rg][ch].EfficientRechits_good->Fill(iLayer+1);
1313  for(size_t iR=0;
1314  iR<allRechits[ec][st][thisRing][ch][iLayer].size();
1315  ++iR){
1316  if(allRechits[ec][st][thisRing][ch][iLayer][iR].second){
1317  usedInSegment[iLayer] = 1;
1318  break;
1319  }
1320  else{
1321  usedInSegment[iLayer] = -1;
1322  }
1323  }
1324  }
1325  else{
1326  missingLayers_rh[iLayer] = true;
1327  if(printalot){
1328  std::cout<<"missing rechits ";
1329  printf("\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",id.endcap(),id.station(),id.ring(),id.chamber(),iLayer+1);
1330  }
1331  }
1332  }
1333  GlobalVector globalDir;
1334  GlobalPoint globalPos;
1335  // Segments
1336  firstCondition = allSegments[ec][st][rg][ch].size() ? true : false;
1337  secondCondition = false;
1338  int secondSize = 0;
1339  int thisRing = rg;
1340  if(secondRing>-1){
1341  secondCondition = allSegments[ec][st][secondRing][ch].size() ? true : false;
1342  secondSize = allSegments[ec][st][secondRing][ch].size();
1343  if(secondCondition){
1344  thisRing = secondRing;
1345  }
1346  }
1347  if(firstCondition || secondCondition){
1348  if (printalot) std::cout<<"segments - start ec = "<<ec<<" st = "<<st<<" rg = "<<rg<<" ch = "<<ch<<std::endl;
1349  StHist[ec][st].EfficientSegments_XY->Fill(ftsChamber.position().x(),ftsChamber.position().y());
1350  if(1==allSegments[ec][st][rg][ch].size() + secondSize){
1351  globalDir = cscChamber->toGlobal(allSegments[ec][st][thisRing][ch][0].second);
1352  globalPos = cscChamber->toGlobal(allSegments[ec][st][thisRing][ch][0].first);
1353  StHist[ec][st].EfficientSegments_eta->Fill(fabs(ftsChamber.position().eta()));
1354  double residual = sqrt(pow(ftsChamber.position().x() - globalPos.x(),2)+
1355  pow(ftsChamber.position().y() - globalPos.y(),2)+
1356  pow(ftsChamber.position().z() - globalPos.z(),2));
1357  if (printalot) std::cout<<" fts.position() = "<<ftsChamber.position()<<" segPos = "<<globalPos<<" res = "<<residual<< std::endl;
1358  StHist[ec][st].ResidualSegments->Fill(residual);
1359  }
1360  for(int iLayer=0;iLayer<6;++iLayer){
1361  if(printalot) std::cout<<" iLayer = "<<iLayer<<" usedInSegment = "<<usedInSegment[iLayer]<<std::endl;
1362  if(0!=usedInSegment[iLayer]){
1363  if(-1==usedInSegment[iLayer]){
1364  ChHist[ec][st][rg][ch].InefficientSingleHits->Fill(iLayer+1);
1365  }
1366  ChHist[ec][st][rg][ch].AllSingleHits->Fill(iLayer+1);
1367  }
1368  firstCondition = allRechits[ec][st][rg][ch][iLayer].size() ? true : false;
1369  secondCondition = false;
1370  if(secondRing>-1){
1371  secondCondition = allRechits[ec][st][secondRing][ch][iLayer].size() ? true : false;
1372  }
1373  float stripAngle = 99999.;
1374  std::vector<float> posXY(2);
1375  bool oneSegment = false;
1376  if(1==allSegments[ec][st][rg][ch].size() + secondSize){
1377  oneSegment = true;
1378  const BoundPlane bp = cscChamber->layer(iLayer+1)->surface();
1379  linearExtrapolation(globalPos,globalDir, bp.position().z(), posXY);
1380  GlobalPoint gp_extrapol( posXY.at(0), posXY.at(1),bp.position().z());
1381  const LocalPoint lp_extrapol = cscChamber->layer(iLayer+1)->toLocal(gp_extrapol);
1382  posXY.at(0) = lp_extrapol.x();
1383  posXY.at(1) = lp_extrapol.y();
1384  int nearestStrip = cscChamber->layer(iLayer+1)->geometry()->nearestStrip(lp_extrapol);
1385  stripAngle = cscChamber->layer(iLayer+1)->geometry()->stripAngle(nearestStrip) - M_PI/2. ;
1386  }
1387  if(firstCondition || secondCondition){
1388  ChHist[ec][st][rg][ch].EfficientRechits_inSegment->Fill(iLayer+1);
1389  if(oneSegment){
1390  ChHist[ec][st][rg][ch].Y_EfficientRecHits_inSegment[iLayer]->Fill(posXY.at(1));
1391  ChHist[ec][st][rg][ch].Phi_EfficientRecHits_inSegment[iLayer]->Fill(stripAngle);
1392  }
1393  }
1394  else{
1395  if(oneSegment){
1396  ChHist[ec][st][rg][ch].Y_InefficientRecHits_inSegment[iLayer]->Fill(posXY.at(1));
1397  ChHist[ec][st][rg][ch].Phi_InefficientRecHits_inSegment[iLayer]->Fill(stripAngle);
1398  }
1399  }
1400  }
1401  }
1402  else{
1403  StHist[ec][st].InefficientSegments_XY->Fill(ftsChamber.position().x(),ftsChamber.position().y());
1404  if(printalot){
1405  std::cout<<"missing segment "<<std::endl;
1406  printf("\t\tendcap/station/ring/chamber: %i/%i/%i/%i\n",id.endcap(),id.station(),id.ring(),id.chamber());
1407  std::cout<<" fts.position() = "<<ftsChamber.position()<<std::endl;
1408  }
1409  }
1410  // Normalization
1411  ChHist[ec][st][rg][ch].EfficientRechits_good->Fill(8);
1412  if(allSegments[ec][st][rg][ch].size()+secondSize<2){
1413  StHist[ec][st].AllSegments_eta->Fill(fabs(ftsChamber.position().eta()));
1414  }
1415  ChHist[ec][st][rg][id.chamber()-FirstCh].EfficientRechits_inSegment->Fill(9);
1416 
1417  return true;
1418 }
struct CSCEfficiency::StationHistos StHist[2][4]
struct CSCEfficiency::ChamberHistos ChHist[2][4][3][LastCh-FirstCh+1]
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
std::vector< TH1F * > Y_InefficientRecHits_inSegment
T y() const
Definition: PV3DBase.h:63
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:62
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
void returnTypes(CSCDetId &id, int &ec, int &st, int &rg, int &ch, int &secondRing)
U second(std::pair< T, U > const &p)
std::vector< TH1F * > Phi_InefficientRecHits_inSegment
std::vector< TH1F * > Y_EfficientRecHits_inSegment
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
Definition: CSCChamber.cc:39
void linearExtrapolation(GlobalPoint initialPosition, GlobalVector initialDirection, float zSurface, std::vector< float > &posZY)
bool first
Definition: L1TdeRCT.cc:75
#define M_PI
std::vector< TH1F * > Phi_EfficientRecHits_inSegment
int nearestStrip(const LocalPoint &lp) const
GlobalPoint position() const
#define FirstCh
std::vector< std::pair< LocalPoint, LocalVector > > allSegments[2][4][4][NumCh]
T eta() const
Definition: PV3DBase.h:76
tuple cout
Definition: gather_cfg.py:121
T x() const
Definition: PV3DBase.h:62
std::vector< std::pair< LocalPoint, bool > > allRechits[2][4][4][NumCh][6]
float stripAngle(int strip) const
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:47
tuple size
Write out results.
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
bool CSCEfficiency::recSimHitEfficiency ( CSCDetId id,
FreeTrajectoryState ftsChamber 
)
private

Definition at line 1245 of file CSCEfficiency.cc.

References edm::second(), and findQualityFiles::size.

1245  {
1246  int ec, st, rg, ch, secondRing;
1247  returnTypes(id, ec, st, rg, ch, secondRing);
1248  bool firstCondition, secondCondition;
1249  for(int iLayer=0; iLayer<6;iLayer++){
1250  firstCondition = allSimhits[ec][st][rg][ch][iLayer].size() ? true : false;
1251  secondCondition = false;
1252  int thisRing = rg;
1253  if(secondRing>-1){
1254  secondCondition = allSimhits[ec][st][secondRing][ch][iLayer].size() ? true : false;
1255  if(secondCondition){
1256  thisRing = secondRing;
1257  }
1258  }
1259  if(firstCondition || secondCondition){
1260  for(size_t iSH=0;
1261  iSH<allSimhits[ec][st][thisRing][ch][iLayer].size();
1262  ++iSH){
1263  if(13 ==
1264  fabs(allSimhits[ec][st][thisRing][ch][iLayer][iSH].second)){
1265  ChHist[ec][st][rg][ch].SimSimhits->Fill(iLayer+1);
1266  if(allRechits[ec][st][thisRing][ch][iLayer].size()){
1267  ChHist[ec][st][rg][ch].SimRechits->Fill(iLayer+1);
1268  }
1269  break;
1270  }
1271  }
1272  //---- Next is not too usefull...
1273  /*
1274  for(unsigned int iSimHits=0;
1275  iSimHits<allSimhits[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-FirstCh][iLayer].size();
1276  iSimHits++){
1277  ChHist[ec][st][rg][id.chamber()-FirstCh].SimSimhits_each->Fill(iLayer+1);
1278  }
1279  for(unsigned int iRecHits=0;
1280  iRecHits<allRechits[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-FirstCh][iLayer].size();
1281  iRecHits++){
1282  ChHist[ec][st][rg][id.chamber()-FirstCh].SimRechits_each->Fill(iLayer+1);
1283  }
1284  */
1285  //
1286  }
1287  }
1288  return true;
1289 }
struct CSCEfficiency::ChamberHistos ChHist[2][4][3][LastCh-FirstCh+1]
std::vector< std::pair< LocalPoint, int > > allSimhits[2][4][4][NumCh][6]
void returnTypes(CSCDetId &id, int &ec, int &st, int &rg, int &ch, int &secondRing)
U second(std::pair< T, U > const &p)
std::vector< std::pair< LocalPoint, bool > > allRechits[2][4][4][NumCh][6]
tuple size
Write out results.
void CSCEfficiency::returnTypes ( CSCDetId id,
int &  ec,
int &  st,
int &  rg,
int &  ch,
int &  secondRing 
)
private

Definition at line 1420 of file CSCEfficiency.cc.

References FirstCh, relativeConstraints::ring, and relativeConstraints::station.

1420  {
1421  ec = id.endcap()-1;
1422  st = id.station()-1;
1423  rg = id.ring()-1;
1424  secondRing = -1;
1425  if(1==id.station() && (4==id.ring() || 1==id.ring()) ){
1426  rg = 0;
1427  secondRing = 3;
1428  }
1429  ch = id.chamber()-FirstCh;
1430 }
#define FirstCh
void CSCEfficiency::ringCandidates ( int  station,
float  absEta,
std::map< std::string, bool > &  chamberTypes 
)
private

Definition at line 961 of file CSCEfficiency.cc.

961  {
962  // yeah, hardcoded again...
963  switch (station){
964  case 1:
965  if(feta>0.85 && feta<1.18){//ME13
966  chamberTypes["ME13"] = true;
967  }
968  if(feta>1.18 && feta<1.7){//ME12
969  chamberTypes["ME12"] = true;
970  }
971  if(feta>1.5 && feta<2.45){//ME11
972  chamberTypes["ME11"] = true;
973  }
974  break;
975  case 2:
976  if(feta>0.95 && feta<1.6){//ME22
977  chamberTypes["ME22"] = true;
978 
979  }
980  if(feta>1.55 && feta<2.45){//ME21
981  chamberTypes["ME21"] = true;
982  }
983  break;
984  case 3:
985  if(feta>1.08 && feta<1.72){//ME32
986  chamberTypes["ME32"] = true;
987 
988  }
989  if(feta>1.69 && feta<2.45){//ME31
990  chamberTypes["ME31"] = true;
991  }
992  break;
993  case 4:
994  if(feta>1.78 && feta<2.45){//ME41
995  chamberTypes["ME41"] = true;
996  }
997  break;
998  default:
999  break;
1000  }
1001 }
bool CSCEfficiency::stripWire_Efficiencies ( CSCDetId cscDetId,
FreeTrajectoryState ftsChamber 
)
private

Definition at line 1169 of file CSCEfficiency.cc.

References gather_cfg::cout, Reference_intrackfit_cff::endcap, FirstCh, FreeTrajectoryState::momentum(), relativeConstraints::ring, relativeConstraints::station, and PV3DBase< T, PVType, FrameType >::theta().

1169  {
1170  int ec, st, rg, ch, secondRing;
1171  returnTypes(id, ec, st, rg, ch, secondRing);
1172 
1173  bool firstCondition, secondCondition;
1174  int missingLayers_s = 0;
1175  int missingLayers_wg = 0;
1176  for(int iLayer=0;iLayer<6;iLayer++){
1177  //----Strips
1178  if(printalot){
1179  printf("\t%i swEff: \tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
1180  iLayer + 1,id.endcap(),id.station(),id.ring(),id.chamber(),iLayer+1);
1181  std::cout<<" size S = "<<allStrips[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-FirstCh][iLayer].size()<<
1182  "size W = "<<allWG[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-FirstCh][iLayer].size()<<std::endl;
1183 
1184  }
1185  firstCondition = allStrips[ec][st][rg][ch][iLayer].size() ? true : false;
1186  //allSegments[ec][st][rg][ch].size() ? true : false;
1187  secondCondition = false;
1188  if(secondRing>-1){
1189  secondCondition = allStrips[ec][st][secondRing][ch][iLayer].size() ? true : false;
1190  }
1191  if(firstCondition || secondCondition){
1192  ChHist[ec][st][rg][ch].EfficientStrips->Fill(iLayer+1);
1193  }
1194  else{
1195  if(printalot){
1196  std::cout<<"missing strips ";
1197  printf("\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",id.endcap(),id.station(),id.ring(),id.chamber(),iLayer+1);
1198  }
1199  }
1200  // Wires
1201  firstCondition = allWG[ec][st][rg][ch][iLayer].size() ? true : false;
1202  secondCondition = false;
1203  if(secondRing>-1){
1204  secondCondition = allWG[ec][st][secondRing][ch][iLayer].size() ? true : false;
1205  }
1206  if(firstCondition || secondCondition){
1207  ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(iLayer+1);
1208  }
1209  else{
1210  if(printalot){
1211  std::cout<<"missing wires ";
1212  printf("\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",id.endcap(),id.station(),id.ring(),id.chamber(),iLayer+1);
1213  }
1214  }
1215  }
1216  // Normalization
1217  if(6!=missingLayers_s){
1218  ChHist[ec][st][rg][ch].EfficientStrips->Fill(8);
1219  }
1220  if(6!=missingLayers_wg){
1221  ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(8);
1222  }
1223  ChHist[ec][st][rg][ch].EfficientStrips->Fill(9);
1224  ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(9);
1225 //
1226  ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(1);
1227  if(missingLayers_s!=missingLayers_wg){
1228  ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(2);
1229  if(6==missingLayers_wg){
1230  ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(3);
1231  ChHist[ec][st][rg][ch].NoWires_momTheta->Fill(ftsChamber.momentum().theta());
1232  }
1233  if(6==missingLayers_s){
1234  ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(4);
1235  ChHist[ec][st][rg][ch].NoStrips_momPhi->Fill(ftsChamber.momentum().theta());
1236  }
1237  }
1238  else if(6==missingLayers_s){
1239  ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(5);
1240  }
1241 
1242  return true;
1243 }
struct CSCEfficiency::ChamberHistos ChHist[2][4][3][LastCh-FirstCh+1]
void returnTypes(CSCDetId &id, int &ec, int &st, int &rg, int &ch, int &secondRing)
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
std::vector< std::pair< std::pair< int, float >, int > > allWG[2][4][4][NumCh][6]
GlobalVector momentum() const
std::vector< std::pair< int, float > > allStrips[2][4][4][NumCh][6]
#define FirstCh
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

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

Definition at line 139 of file CSCEfficiency.h.

TH1F* CSCEfficiency::ALCTPerEvent
private

Definition at line 271 of file CSCEfficiency.h.

bool CSCEfficiency::allALCT[2][4][4][NumCh]
private

Definition at line 193 of file CSCEfficiency.h.

bool CSCEfficiency::allCLCT[2][4][4][NumCh]
private

Definition at line 192 of file CSCEfficiency.h.

bool CSCEfficiency::allCorrLCT[2][4][4][NumCh]
private

Definition at line 194 of file CSCEfficiency.h.

std::vector<std::pair <LocalPoint, bool> > CSCEfficiency::allRechits[2][4][4][NumCh][6]
private

Definition at line 208 of file CSCEfficiency.h.

std::vector<std::pair <LocalPoint, LocalVector> > CSCEfficiency::allSegments[2][4][4][NumCh]
private

Definition at line 211 of file CSCEfficiency.h.

std::vector<std::pair <LocalPoint, int> > CSCEfficiency::allSimhits[2][4][4][NumCh][6]
private

Definition at line 204 of file CSCEfficiency.h.

std::vector<std::pair <int, float> > CSCEfficiency::allStrips[2][4][4][NumCh][6]
private

Definition at line 197 of file CSCEfficiency.h.

std::vector<std::pair <std::pair <int, float>, int> > CSCEfficiency::allWG[2][4][4][NumCh][6]
private

Definition at line 200 of file CSCEfficiency.h.

bool CSCEfficiency::alongZ
private

Definition at line 186 of file CSCEfficiency.h.

bool CSCEfficiency::andOr
private

Definition at line 172 of file CSCEfficiency.h.

bool CSCEfficiency::applyIPangleCuts
private

Definition at line 163 of file CSCEfficiency.h.

struct CSCEfficiency::ChamberHistos CSCEfficiency::ChHist[2][4][3][LastCh-FirstCh+1]
private
edm::EDGetTokenT<CSCCLCTDigiCollection> CSCEfficiency::cl_token
private

Definition at line 140 of file CSCEfficiency.h.

TH1F* CSCEfficiency::CLCTPerEvent
private

Definition at line 272 of file CSCEfficiency.h.

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

Definition at line 141 of file CSCEfficiency.h.

TH1F* CSCEfficiency::DataFlow
private

Definition at line 268 of file CSCEfficiency.h.

double CSCEfficiency::distanceFromDeadZone
private

Definition at line 157 of file CSCEfficiency.h.

bool CSCEfficiency::emptyChambers[2][4][4][NumCh]
private

Definition at line 214 of file CSCEfficiency.h.

bool CSCEfficiency::getAbsoluteEfficiency
private

Definition at line 155 of file CSCEfficiency.h.

edm::EDGetTokenT<edm::TriggerResults> CSCEfficiency::ht_token
private

Definition at line 148 of file CSCEfficiency.h.

bool CSCEfficiency::isBeamdata
private

Definition at line 154 of file CSCEfficiency.h.

bool CSCEfficiency::isData
private

Definition at line 152 of file CSCEfficiency.h.

bool CSCEfficiency::isIPdata
private

Definition at line 153 of file CSCEfficiency.h.

double CSCEfficiency::local_DX_DZ_Max
private

Definition at line 166 of file CSCEfficiency.h.

double CSCEfficiency::local_DY_DZ_Max
private

Definition at line 164 of file CSCEfficiency.h.

double CSCEfficiency::local_DY_DZ_Min
private

Definition at line 165 of file CSCEfficiency.h.

bool CSCEfficiency::magField
private

Definition at line 184 of file CSCEfficiency.h.

double CSCEfficiency::maxNormChi2
private

Definition at line 160 of file CSCEfficiency.h.

double CSCEfficiency::maxP
private

Definition at line 159 of file CSCEfficiency.h.

double CSCEfficiency::minP
private

Definition at line 158 of file CSCEfficiency.h.

unsigned int CSCEfficiency::minTrackHits
private

Definition at line 161 of file CSCEfficiency.h.

std::vector<std::string> CSCEfficiency::myTriggers
private

Definition at line 170 of file CSCEfficiency.h.

int CSCEfficiency::nEventsAnalyzed
private

Definition at line 182 of file CSCEfficiency.h.

bool CSCEfficiency::passTheEvent
private

Definition at line 188 of file CSCEfficiency.h.

std::vector<int> CSCEfficiency::pointToTriggers
private

Definition at line 171 of file CSCEfficiency.h.

bool CSCEfficiency::printalot
private

Definition at line 180 of file CSCEfficiency.h.

unsigned int CSCEfficiency::printout_NEvents
private

Definition at line 151 of file CSCEfficiency.h.

TH1F* CSCEfficiency::recHitsPerEvent
private

Definition at line 273 of file CSCEfficiency.h.

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

Definition at line 142 of file CSCEfficiency.h.

std::string CSCEfficiency::rootFileName
private

Definition at line 133 of file CSCEfficiency.h.

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

Definition at line 138 of file CSCEfficiency.h.

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

Definition at line 143 of file CSCEfficiency.h.

TH1F* CSCEfficiency::segmentsPerEvent
private

Definition at line 274 of file CSCEfficiency.h.

edm::EDGetTokenT<edm::PSimHitContainer> CSCEfficiency::sh_token
private

Definition at line 146 of file CSCEfficiency.h.

struct CSCEfficiency::StationHistos CSCEfficiency::StHist[2][4]
private
TFile* CSCEfficiency::theFile
private

Definition at line 178 of file CSCEfficiency.h.

MuonServiceProxy* CSCEfficiency::theService
private

Definition at line 176 of file CSCEfficiency.h.

edm::EDGetTokenT<edm::View<reco::Track> > CSCEfficiency::tk_token
private

Definition at line 145 of file CSCEfficiency.h.

TH1F* CSCEfficiency::TriggersFired
private

Definition at line 269 of file CSCEfficiency.h.

bool CSCEfficiency::useDigis
private

Definition at line 156 of file CSCEfficiency.h.

bool CSCEfficiency::useTrigger
private

Definition at line 169 of file CSCEfficiency.h.

edm::EDGetTokenT<CSCWireDigiCollection> CSCEfficiency::wd_token
private

Definition at line 137 of file CSCEfficiency.h.