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::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 ()
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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::InputTag alctDigiTag_
 
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::InputTag clctDigiTag_
 
TH1F * CLCTPerEvent
 
edm::InputTag corrlctDigiTag_
 
TH1F * DataFlow
 
double distanceFromDeadZone
 
bool emptyChambers [2][4][4][NumCh]
 
bool getAbsoluteEfficiency
 
edm::InputTag hlTriggerResults_
 
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
 
edm::InputTag rechitDigiTag_
 
TH1F * recHitsPerEvent
 
std::string rootFileName
 
edm::InputTag segmentDigiTag_
 
TH1F * segmentsPerEvent
 
edm::InputTag simHitTag
 
struct CSCEfficiency::StationHistos StHist [2][4]
 
edm::InputTag stripDigiTag_
 
TFile * theFile
 
MuonServiceProxytheService
 
edm::InputTag tracksTag
 
TH1F * TriggersFired
 
bool useDigis
 
bool useTrigger
 
edm::InputTag wireDigiTag_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
typedef WorkerT< EDFilterWorkerType
 
- 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::EDFilter
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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 1629 of file CSCEfficiency.cc.

References CommPDSkim_cfg::andOr, FirstCh, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), alignBH_cfg::minP, MuonServiceProxy_cff::MuonServiceProxy, NumCh, dtTPAnalyzer_cfg::rootFileName, and interactiveExample::theFile.

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

Destructor.

Definition at line 1936 of file CSCEfficiency.cc.

References combineCards::bins, gather_cfg::cout, interpolateCardsSimple::eff, FirstCh, NumCh, and interactiveExample::theFile.

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

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

1548  {
1549  bool triggerPassed = true;
1550  std::vector<std::string> hlNames=triggerNames.triggerNames();
1551  pointToTriggers.clear();
1552  for(size_t imyT = 0;imyT<myTriggers.size();++imyT){
1553  for (size_t iT=0; iT<hlNames.size(); ++iT) {
1554  //std::cout<<" iT = "<<iT<<" hlNames[iT] = "<<hlNames[iT]<<
1555  //" : wasrun = "<<hltR->wasrun(iT)<<" accept = "<<
1556  // hltR->accept(iT)<<" !error = "<<
1557  // !hltR->error(iT)<<std::endl;
1558  if(!imyT){
1559  if(hltR->wasrun(iT) &&
1560  hltR->accept(iT) &&
1561  !hltR->error(iT) ){
1562  TriggersFired->Fill(iT);
1563  }
1564  }
1565  if(hlNames[iT]==myTriggers[imyT]){
1566  pointToTriggers.push_back(iT);
1567  if(imyT){
1568  break;
1569  }
1570  }
1571  }
1572  }
1573  if(pointToTriggers.size()!=myTriggers.size()){
1574  pointToTriggers.clear();
1575  if(printalot){
1576  std::cout<<" Not all trigger names found - all trigger specifications will be ignored. Check your cfg file!"<<std::endl;
1577  }
1578  }
1579  else{
1580  if(pointToTriggers.size()){
1581  if(printalot){
1582  std::cout<<"The following triggers will be required in the event: "<<std::endl;
1583  for(size_t imyT =0; imyT <pointToTriggers.size();++imyT){
1584  std::cout<<" "<<hlNames[pointToTriggers[imyT]];
1585  }
1586  std::cout<<std::endl;
1587  std::cout<<" in condition (AND/OR) : "<<!andOr<<"/"<<andOr<<std::endl;
1588  }
1589  }
1590  }
1591 
1592  if (hltR.isValid()) {
1593  if(!pointToTriggers.size()){
1594  if(printalot){
1595  std::cout<<" No triggers specified in the configuration or all ignored - no trigger information will be considered"<<std::endl;
1596  }
1597  }
1598  for(size_t imyT =0; imyT <pointToTriggers.size();++imyT){
1599  if(hltR->wasrun(pointToTriggers[imyT]) &&
1600  hltR->accept(pointToTriggers[imyT]) &&
1601  !hltR->error(pointToTriggers[imyT]) ){
1602  triggerPassed = true;
1603  if(andOr){
1604  break;
1605  }
1606  }
1607  else{
1608  triggerPassed = false;
1609  if(!andOr){
1610  triggerPassed = false;
1611  break;
1612  }
1613  }
1614  }
1615  }
1616  else{
1617  if(printalot){
1618  std::cout<<" TriggerResults handle returns invalid state?! No trigger information will be considered"<<std::endl;
1619  }
1620  }
1621  if(printalot){
1622  std::cout<<" Trigger passed: "<<triggerPassed<<std::endl;
1623  }
1624  return triggerPassed;
1625 }
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 2038 of file CSCEfficiency.cc.

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

Definition at line 1011 of file CSCEfficiency.cc.

References gather_cfg::cout, and M_PI.

1011  {
1012  coupleOfChambers.clear();
1013  // -pi< phi<+pi
1014  float phi_zero = 0.;// check! the phi at the "edge" of Ch 1
1015  float phi_const = 2.*M_PI/36.;
1016  int last_chamber = 36;
1017  int first_chamber = 1;
1018  if(1 != station && 1==ring){ // 18 chambers in the ring
1019  phi_const*=2;
1020  last_chamber /= 2;
1021  }
1022  if(phi<0.){
1023  if (printalot) std::cout<<" info: negative phi = "<<phi<<std::endl;
1024  phi += 2*M_PI;
1025  }
1026  float chamber_float = (phi - phi_zero)/phi_const;
1027  int chamber_int = int(chamber_float);
1028  if (chamber_float - float(chamber_int) -0.5 <0.){
1029  if(0!=chamber_int ){
1030  coupleOfChambers.push_back(chamber_int);
1031  }
1032  else{
1033  coupleOfChambers.push_back(last_chamber);
1034  }
1035  coupleOfChambers.push_back(chamber_int+1);
1036 
1037  }
1038  else{
1039  coupleOfChambers.push_back(chamber_int+1);
1040  if(last_chamber!=chamber_int+1){
1041  coupleOfChambers.push_back(chamber_int+2);
1042  }
1043  else{
1044  coupleOfChambers.push_back(first_chamber);
1045  }
1046  }
1047  if (printalot) std::cout<<" phi = "<<phi<<" phi_zero = "<<phi_zero<<" phi_const = "<<phi_const<<
1048  " candidate chambers: first ch = "<<coupleOfChambers[0]<<" second ch = "<<coupleOfChambers[1]<<std::endl;
1049 }
#define M_PI
Definition: BFit3D.cc:3
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 605 of file CSCEfficiency.cc.

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

Definition at line 1489 of file CSCEfficiency.cc.

1489  {
1490 
1491  //---- Be careful with trigger conditions too
1492  if(!isIPdata){
1493  float dy = outerPosition.y() - innerPosition.y();
1494  float dz = outerPosition.z() - innerPosition.z();
1495  if(isBeamdata){
1496  if(dz>0){
1497  alongZ = true;
1498  }
1499  else{
1500  alongZ = false;
1501  }
1502  }
1503  else{//cosmics
1504  if(dy/dz>0){
1505  alongZ = false;
1506  }
1507  else{
1508  alongZ = true;
1509  }
1510  }
1511  }
1512 }
bool CSCEfficiency::efficienciesPerChamber ( CSCDetId id,
const CSCChamber cscChamber,
FreeTrajectoryState ftsChamber 
)
private

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

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

Reimplemented from edm::EDFilter.

Definition at line 2044 of file CSCEfficiency.cc.

2044  {
2045 }
double CSCEfficiency::extrapolate1D ( double  initPosition,
double  initDirection,
double  parameterOfTheLine 
)
private

Definition at line 1479 of file CSCEfficiency.cc.

1479  {
1480  double extrapolatedPosition = initPosition + initDirection*parameterOfTheLine;
1481  return extrapolatedPosition;
1482 }
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 694 of file CSCEfficiency.cc.

References NumCh.

702  {
703  for(int iE=0;iE<2;iE++){
704  for(int iS=0;iS<4;iS++){
705  for(int iR=0;iR<4;iR++){
706  for(int iC=0;iC<NumCh;iC++){
707  allSegments[iE][iS][iR][iC].clear();
708  allCLCT[iE][iS][iR][iC] = allALCT[iE][iS][iR][iC] = allCorrLCT[iE][iS][iR][iC] = false;
709  for(int iL=0;iL<6;iL++){
710  allStrips[iE][iS][iR][iC][iL].clear();
711  allWG[iE][iS][iR][iC][iL].clear();
712  allRechits[iE][iS][iR][iC][iL].clear();
713  allSimhits[iE][iS][iR][iC][iL].clear();
714  }
715  }
716  }
717  }
718  }
719  //
720  if(useDigis){
721  fillLCT_info(alcts, clcts, correlatedlcts);
722  fillWG_info(wires, cscGeom);
723  fillStrips_info(strips);
724  }
725  fillRechitsSegments_info(rechits, segments, cscGeom);
726  if(!isData){
727  fillSimhit_info(simhits);
728  }
729 }
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 732 of file CSCEfficiency.cc.

References FirstCh, j, and prof2calltree::last.

734  {
735  //---- ALCTDigis
736  int nSize = 0;
737  for (CSCALCTDigiCollection::DigiRangeIterator j=alcts->begin(); j!=alcts->end(); j++) {
738  ++nSize;
739  const CSCDetId& id = (*j).first;
740  const CSCALCTDigiCollection::Range& range =(*j).second;
742  range.first; digiIt!=range.second;
743  ++digiIt){
744  // Valid digi in the chamber (or in neighbouring chamber)
745  if((*digiIt).isValid()){
746  allALCT[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-FirstCh] = true;
747  }
748  }// for digis in layer
749  }// end of for (j=...
750  ALCTPerEvent->Fill(nSize);
751  //---- CLCTDigis
752  nSize = 0;
753  for (CSCCLCTDigiCollection::DigiRangeIterator j=clcts->begin(); j!=clcts->end(); j++) {
754  ++nSize;
755  const CSCDetId& id = (*j).first;
756  std::vector<CSCCLCTDigi>::const_iterator digiIt = (*j).second.first;
757  std::vector<CSCCLCTDigi>::const_iterator last = (*j).second.second;
758  for( ; digiIt != last; ++digiIt) {
759  // Valid digi in the chamber (or in neighbouring chamber)
760  if((*digiIt).isValid()){
761  allCLCT[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-FirstCh] = true;
762  }
763  }
764  }
765  CLCTPerEvent->Fill(nSize);
766  //---- CorrLCTDigis
767  for (CSCCorrelatedLCTDigiCollection::DigiRangeIterator j=correlatedlcts->begin(); j!=correlatedlcts->end(); j++) {
768  const CSCDetId& id = (*j).first;
769  std::vector<CSCCorrelatedLCTDigi>::const_iterator digiIt = (*j).second.first;
770  std::vector<CSCCorrelatedLCTDigi>::const_iterator last = (*j).second.second;
771  for( ; digiIt != last; ++digiIt) {
772  // Valid digi in the chamber (or in neighbouring chamber)
773  if((*digiIt).isValid()){
774  allCorrLCT[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-FirstCh] = true;
775  }
776  }
777  }
778 }
TH1F * CLCTPerEvent
bool allCLCT[2][4][4][NumCh]
bool allALCT[2][4][4][NumCh]
int j
Definition: DBlmapReader.cc:9
#define FirstCh
std::vector< DigiType >::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 857 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().

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

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

846  {
847  //---- SIMHITS
848  edm::PSimHitContainer::const_iterator dSHsimIter;
849  for (dSHsimIter = simhits->begin(); dSHsimIter != simhits->end(); dSHsimIter++){
850  // Get DetID for this simHit:
851  CSCDetId sId = (CSCDetId)(*dSHsimIter).detUnitId();
852  std::pair <LocalPoint, int> simHitPos((*dSHsimIter).localPosition(), (*dSHsimIter).particleType());
853  allSimhits[sId.endcap()-1][sId.station()-1][sId.ring()-1][sId.chamber()-FirstCh][sId.layer()-1].push_back(simHitPos);
854  }
855 }
int chamber() const
Definition: CSCDetId.h:70
std::vector< std::pair< LocalPoint, int > > allSimhits[2][4][4][NumCh][6]
int layer() const
Definition: CSCDetId.h:63
int endcap() const
Definition: CSCDetId.h:95
int ring() const
Definition: CSCDetId.h:77
#define FirstCh
int station() const
Definition: CSCDetId.h:88
void CSCEfficiency::fillStrips_info ( edm::Handle< CSCStripDigiCollection > &  strips)
private

Definition at line 808 of file CSCEfficiency.cc.

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

808  {
809  //---- STRIPS
810  for (CSCStripDigiCollection::DigiRangeIterator j=strips->begin(); j!=strips->end(); j++) {
811  CSCDetId id = (CSCDetId)(*j).first;
812  int largestADCValue = -1;
813  std::vector<CSCStripDigi>::const_iterator digiItr = (*j).second.first;
814  std::vector<CSCStripDigi>::const_iterator last = (*j).second.second;
815  for( ; digiItr != last; ++digiItr) {
816  int maxADC=largestADCValue;
817  int myStrip = digiItr->getStrip();
818  std::vector<int> myADCVals = digiItr->getADCCounts();
819  float thisPedestal = 0.5*(float)(myADCVals[0]+myADCVals[1]);
820  float threshold = 13.3 ;
821  float diff = 0.;
822  float peakADC = -1000.;
823  for (unsigned int iCount = 0; iCount < myADCVals.size(); iCount++) {
824  diff = (float)myADCVals[iCount]-thisPedestal;
825  if (diff > threshold) {
826  if (myADCVals[iCount] > largestADCValue) {
827  largestADCValue = myADCVals[iCount];
828  }
829  }
830  if (diff > threshold && diff > peakADC) {
831  peakADC = diff;
832  }
833  }
834  if(largestADCValue>maxADC){// FIX IT!!!
835  maxADC = largestADCValue;
836  std::pair <int, float> LayerSignal (myStrip, peakADC);
837 
838  //---- AllStrips contains basic information about strips
839  //---- (strip number and peak signal for most significant strip in the layer)
840  allStrips[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-1][id.layer()-1].clear();
841  allStrips[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-1][id.layer()-1].push_back(LayerSignal);
842  }
843  }
844  }
845 }
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 780 of file CSCEfficiency.cc.

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

780  {
781  //---- WIRE GROUPS
782  for (CSCWireDigiCollection::DigiRangeIterator j=wires->begin(); j!=wires->end(); j++) {
783  CSCDetId id = (CSCDetId)(*j).first;
784  const CSCLayer *layer_p = cscGeom->layer (id);
785  const CSCLayerGeometry *layerGeom = layer_p->geometry ();
786  //
787 
788  const std::vector<float> LayerBounds = layerGeom->parameters ();
789  std::vector<CSCWireDigi>::const_iterator digiItr = (*j).second.first;
790  std::vector<CSCWireDigi>::const_iterator last = (*j).second.second;
791  //
792  for( ; digiItr != last; ++digiItr) {
793  std::pair < int, float > WG_pos(digiItr->getWireGroup(), layerGeom->yOfWireGroup(digiItr->getWireGroup()));
794  std::pair <std::pair < int, float >, int > LayerSignal(WG_pos, digiItr->getTimeBin());
795 
796  //---- AllWG contains basic information about WG (WG number and Y-position, time bin)
797  allWG[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-FirstCh]
798  [id.layer()-1].push_back(LayerSignal);
799  if(printalot){
800  //std::cout<<" WG check : "<<std::endl;
801  //printf("\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",id.endcap(),id.station(),id.ring(),id.chamber(),id.layer());
802  //std::cout<<" WG size = "<<allWG[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-FirstCh]
803  //[id.layer()-1].size()<<std::endl;
804  }
805  }
806  }
807 }
float yOfWireGroup(int wireGroup, float x=0.) const
virtual const std::vector< float > parameters() 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 21 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(), 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(), GloballyPositioned< T >::position(), 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().

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

1458  {
1459 
1460  GlobalVector p3GV(p3.x(), p3.y(), p3.z());
1461  GlobalPoint r3GP(r3.x(), r3.y(), r3.z());
1462  GlobalTrajectoryParameters tPars(r3GP, p3GV, charge, field);
1463 
1464  CartesianTrajectoryError tCov(cov);
1465 
1466  return cov.kRows == 6 ? FreeTrajectoryState(tPars, tCov) : FreeTrajectoryState(tPars) ;
1467 }
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 1441 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().

1443  {
1444 
1445  GlobalVector p3GV = fts.momentum();
1446  GlobalPoint r3GP = fts.position();
1447 
1448  p3.set(p3GV.x(), p3GV.y(), p3GV.z());
1449  r3.set(r3GP.x(), r3GP.y(), r3GP.z());
1450 
1451  charge = fts.charge();
1452  cov = fts.hasError() ? fts.cartesianError().matrix() : AlgebraicSymMatrix66();
1453 
1454 }
CartesianTrajectoryError cartesianError() const
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
T y() const
Definition: PV3DBase.h:62
TrackCharge charge() const
double charge(const std::vector< uint8_t > &Ampls)
T z() const
Definition: PV3DBase.h:63
GlobalVector momentum() const
const AlgebraicSymMatrix66 & matrix() const
GlobalPoint position() const
T x() const
Definition: PV3DBase.h:61
double p3[4]
Definition: TauolaWrapper.h:91
bool CSCEfficiency::inSensitiveLocalRegion ( double  xLocal,
double  yLocal,
int  station,
int  ring 
)
private

Definition at line 540 of file CSCEfficiency.cc.

References abs.

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

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

1470  {
1471  double paramLine = lineParameter(initialPosition.z(), zSurface, initialDirection.z());
1472  double xPosition = extrapolate1D(initialPosition.x(), initialDirection.x(),paramLine);
1473  double yPosition = extrapolate1D(initialPosition.y(), initialDirection.y(),paramLine);
1474  posZY.clear();
1475  posZY.push_back(xPosition);
1476  posZY.push_back(yPosition);
1477 }
double lineParameter(double initZPosition, double destZPosition, double initZDirection)
T y() const
Definition: PV3DBase.h:62
T z() const
Definition: PV3DBase.h:63
double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine)
T x() const
Definition: PV3DBase.h:61
double CSCEfficiency::lineParameter ( double  initZPosition,
double  destZPosition,
double  initZDirection 
)
private

Definition at line 1484 of file CSCEfficiency.cc.

1484  {
1485  double paramLine = (destZPosition-initZPosition)/initZDirection;
1486  return paramLine;
1487 }
TrajectoryStateOnSurface CSCEfficiency::propagate ( FreeTrajectoryState ftsStart,
const BoundPlane bp 
)
private

Definition at line 1519 of file CSCEfficiency.cc.

References LargeD0_PixelPairStep_cff::propagator.

1519  {
1520  TrajectoryStateOnSurface tSOSDest;
1521  std::string propagatorName;
1522 /*
1523 // it would work if cosmic muons had properly assigned direction...
1524  bool dzPositive = bpDest.position().z() - ftsStart.position().z() > 0 ? true : false;
1525  //---- Be careful with trigger conditions too
1526  if(!isIPdata){
1527  bool rightDirection = !(alongZ^dzPositive);
1528  if(rightDirection){
1529  if(printalot) std::cout<<" propagate along momentum"<<std::endl;
1530  propagatorName = "SteppingHelixPropagatorAlong";
1531  }
1532  else{
1533  if(printalot) std::cout<<" propagate opposite momentum"<<std::endl;
1534  propagatorName = "SteppingHelixPropagatorOpposite";
1535  }
1536  }
1537  else{
1538  if(printalot) std::cout<<" propagate any (momentum)"<<std::endl;
1539  propagatorName = "SteppingHelixPropagatorAny";
1540  }
1541 */
1542  propagatorName = "SteppingHelixPropagatorAny";
1543  tSOSDest = propagator(propagatorName)->propagate(ftsStart, bpDest);
1544  return tSOSDest;
1545 }
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:12
const Propagator * propagator(std::string propagatorName) const
const Propagator * CSCEfficiency::propagator ( std::string  propagatorName) const
private

Definition at line 1514 of file CSCEfficiency.cc.

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

Definition at line 1300 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(), GloballyPositioned< T >::position(), 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().

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

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

1253  {
1254  int ec, st, rg, ch, secondRing;
1255  returnTypes(id, ec, st, rg, ch, secondRing);
1256  bool firstCondition, secondCondition;
1257  for(int iLayer=0; iLayer<6;iLayer++){
1258  firstCondition = allSimhits[ec][st][rg][ch][iLayer].size() ? true : false;
1259  secondCondition = false;
1260  int thisRing = rg;
1261  if(secondRing>-1){
1262  secondCondition = allSimhits[ec][st][secondRing][ch][iLayer].size() ? true : false;
1263  if(secondCondition){
1264  thisRing = secondRing;
1265  }
1266  }
1267  if(firstCondition || secondCondition){
1268  for(size_t iSH=0;
1269  iSH<allSimhits[ec][st][thisRing][ch][iLayer].size();
1270  ++iSH){
1271  if(13 ==
1272  fabs(allSimhits[ec][st][thisRing][ch][iLayer][iSH].second)){
1273  ChHist[ec][st][rg][ch].SimSimhits->Fill(iLayer+1);
1274  if(allRechits[ec][st][thisRing][ch][iLayer].size()){
1275  ChHist[ec][st][rg][ch].SimRechits->Fill(iLayer+1);
1276  }
1277  break;
1278  }
1279  }
1280  //---- Next is not too usefull...
1281  /*
1282  for(unsigned int iSimHits=0;
1283  iSimHits<allSimhits[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-FirstCh][iLayer].size();
1284  iSimHits++){
1285  ChHist[ec][st][rg][id.chamber()-FirstCh].SimSimhits_each->Fill(iLayer+1);
1286  }
1287  for(unsigned int iRecHits=0;
1288  iRecHits<allRechits[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-FirstCh][iLayer].size();
1289  iRecHits++){
1290  ChHist[ec][st][rg][id.chamber()-FirstCh].SimRechits_each->Fill(iLayer+1);
1291  }
1292  */
1293  //
1294  }
1295  }
1296  return true;
1297 }
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 1428 of file CSCEfficiency.cc.

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

1428  {
1429  ec = id.endcap()-1;
1430  st = id.station()-1;
1431  rg = id.ring()-1;
1432  secondRing = -1;
1433  if(1==id.station() && (4==id.ring() || 1==id.ring()) ){
1434  rg = 0;
1435  secondRing = 3;
1436  }
1437  ch = id.chamber()-FirstCh;
1438 }
#define FirstCh
void CSCEfficiency::ringCandidates ( int  station,
float  absEta,
std::map< std::string, bool > &  chamberTypes 
)
private

Definition at line 969 of file CSCEfficiency.cc.

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

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

1177  {
1178  int ec, st, rg, ch, secondRing;
1179  returnTypes(id, ec, st, rg, ch, secondRing);
1180 
1181  bool firstCondition, secondCondition;
1182  int missingLayers_s = 0;
1183  int missingLayers_wg = 0;
1184  for(int iLayer=0;iLayer<6;iLayer++){
1185  //----Strips
1186  if(printalot){
1187  printf("\t%i swEff: \tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",
1188  iLayer + 1,id.endcap(),id.station(),id.ring(),id.chamber(),iLayer+1);
1189  std::cout<<" size S = "<<allStrips[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-FirstCh][iLayer].size()<<
1190  "size W = "<<allWG[id.endcap()-1][id.station()-1][id.ring()-1][id.chamber()-FirstCh][iLayer].size()<<std::endl;
1191 
1192  }
1193  firstCondition = allStrips[ec][st][rg][ch][iLayer].size() ? true : false;
1194  //allSegments[ec][st][rg][ch].size() ? true : false;
1195  secondCondition = false;
1196  if(secondRing>-1){
1197  secondCondition = allStrips[ec][st][secondRing][ch][iLayer].size() ? true : false;
1198  }
1199  if(firstCondition || secondCondition){
1200  ChHist[ec][st][rg][ch].EfficientStrips->Fill(iLayer+1);
1201  }
1202  else{
1203  if(printalot){
1204  std::cout<<"missing strips ";
1205  printf("\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",id.endcap(),id.station(),id.ring(),id.chamber(),iLayer+1);
1206  }
1207  }
1208  // Wires
1209  firstCondition = allWG[ec][st][rg][ch][iLayer].size() ? true : false;
1210  secondCondition = false;
1211  if(secondRing>-1){
1212  secondCondition = allWG[ec][st][secondRing][ch][iLayer].size() ? true : false;
1213  }
1214  if(firstCondition || secondCondition){
1215  ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(iLayer+1);
1216  }
1217  else{
1218  if(printalot){
1219  std::cout<<"missing wires ";
1220  printf("\t\tendcap/station/ring/chamber/layer: %i/%i/%i/%i/%i\n",id.endcap(),id.station(),id.ring(),id.chamber(),iLayer+1);
1221  }
1222  }
1223  }
1224  // Normalization
1225  if(6!=missingLayers_s){
1226  ChHist[ec][st][rg][ch].EfficientStrips->Fill(8);
1227  }
1228  if(6!=missingLayers_wg){
1229  ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(8);
1230  }
1231  ChHist[ec][st][rg][ch].EfficientStrips->Fill(9);
1232  ChHist[ec][st][rg][ch].EfficientWireGroups->Fill(9);
1233 //
1234  ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(1);
1235  if(missingLayers_s!=missingLayers_wg){
1236  ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(2);
1237  if(6==missingLayers_wg){
1238  ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(3);
1239  ChHist[ec][st][rg][ch].NoWires_momTheta->Fill(ftsChamber.momentum().theta());
1240  }
1241  if(6==missingLayers_s){
1242  ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(4);
1243  ChHist[ec][st][rg][ch].NoStrips_momPhi->Fill(ftsChamber.momentum().theta());
1244  }
1245  }
1246  else if(6==missingLayers_s){
1247  ChHist[ec][st][rg][ch].StripWiresCorrelations->Fill(5);
1248  }
1249 
1250  return true;
1251 }
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:74
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::InputTag CSCEfficiency::alctDigiTag_
private

Definition at line 135 of file CSCEfficiency.h.

TH1F* CSCEfficiency::ALCTPerEvent
private

Definition at line 267 of file CSCEfficiency.h.

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

Definition at line 189 of file CSCEfficiency.h.

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

Definition at line 188 of file CSCEfficiency.h.

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

Definition at line 190 of file CSCEfficiency.h.

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

Definition at line 204 of file CSCEfficiency.h.

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

Definition at line 207 of file CSCEfficiency.h.

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

Definition at line 200 of file CSCEfficiency.h.

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

Definition at line 193 of file CSCEfficiency.h.

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

Definition at line 196 of file CSCEfficiency.h.

bool CSCEfficiency::alongZ
private

Definition at line 182 of file CSCEfficiency.h.

bool CSCEfficiency::andOr
private

Definition at line 168 of file CSCEfficiency.h.

bool CSCEfficiency::applyIPangleCuts
private

Definition at line 157 of file CSCEfficiency.h.

struct CSCEfficiency::ChamberHistos CSCEfficiency::ChHist[2][4][3][LastCh-FirstCh+1]
private
edm::InputTag CSCEfficiency::clctDigiTag_
private

Definition at line 136 of file CSCEfficiency.h.

TH1F* CSCEfficiency::CLCTPerEvent
private

Definition at line 268 of file CSCEfficiency.h.

edm::InputTag CSCEfficiency::corrlctDigiTag_
private

Definition at line 137 of file CSCEfficiency.h.

TH1F* CSCEfficiency::DataFlow
private

Definition at line 264 of file CSCEfficiency.h.

double CSCEfficiency::distanceFromDeadZone
private

Definition at line 151 of file CSCEfficiency.h.

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

Definition at line 210 of file CSCEfficiency.h.

bool CSCEfficiency::getAbsoluteEfficiency
private

Definition at line 149 of file CSCEfficiency.h.

edm::InputTag CSCEfficiency::hlTriggerResults_
private

Definition at line 165 of file CSCEfficiency.h.

bool CSCEfficiency::isBeamdata
private

Definition at line 148 of file CSCEfficiency.h.

bool CSCEfficiency::isData
private

Definition at line 146 of file CSCEfficiency.h.

bool CSCEfficiency::isIPdata
private

Definition at line 147 of file CSCEfficiency.h.

double CSCEfficiency::local_DX_DZ_Max
private

Definition at line 160 of file CSCEfficiency.h.

double CSCEfficiency::local_DY_DZ_Max
private

Definition at line 158 of file CSCEfficiency.h.

double CSCEfficiency::local_DY_DZ_Min
private

Definition at line 159 of file CSCEfficiency.h.

bool CSCEfficiency::magField
private

Definition at line 180 of file CSCEfficiency.h.

double CSCEfficiency::maxNormChi2
private

Definition at line 154 of file CSCEfficiency.h.

double CSCEfficiency::maxP
private

Definition at line 153 of file CSCEfficiency.h.

double CSCEfficiency::minP
private

Definition at line 152 of file CSCEfficiency.h.

unsigned int CSCEfficiency::minTrackHits
private

Definition at line 155 of file CSCEfficiency.h.

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

Definition at line 166 of file CSCEfficiency.h.

int CSCEfficiency::nEventsAnalyzed
private

Definition at line 178 of file CSCEfficiency.h.

bool CSCEfficiency::passTheEvent
private

Definition at line 184 of file CSCEfficiency.h.

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

Definition at line 167 of file CSCEfficiency.h.

bool CSCEfficiency::printalot
private

Definition at line 176 of file CSCEfficiency.h.

unsigned int CSCEfficiency::printout_NEvents
private

Definition at line 145 of file CSCEfficiency.h.

edm::InputTag CSCEfficiency::rechitDigiTag_
private

Definition at line 140 of file CSCEfficiency.h.

TH1F* CSCEfficiency::recHitsPerEvent
private

Definition at line 269 of file CSCEfficiency.h.

std::string CSCEfficiency::rootFileName
private

Definition at line 133 of file CSCEfficiency.h.

edm::InputTag CSCEfficiency::segmentDigiTag_
private

Definition at line 142 of file CSCEfficiency.h.

TH1F* CSCEfficiency::segmentsPerEvent
private

Definition at line 270 of file CSCEfficiency.h.

edm::InputTag CSCEfficiency::simHitTag
private

Definition at line 141 of file CSCEfficiency.h.

struct CSCEfficiency::StationHistos CSCEfficiency::StHist[2][4]
private
edm::InputTag CSCEfficiency::stripDigiTag_
private

Definition at line 138 of file CSCEfficiency.h.

TFile* CSCEfficiency::theFile
private

Definition at line 174 of file CSCEfficiency.h.

MuonServiceProxy* CSCEfficiency::theService
private

Definition at line 172 of file CSCEfficiency.h.

edm::InputTag CSCEfficiency::tracksTag
private

Definition at line 143 of file CSCEfficiency.h.

TH1F* CSCEfficiency::TriggersFired
private

Definition at line 265 of file CSCEfficiency.h.

bool CSCEfficiency::useDigis
private

Definition at line 150 of file CSCEfficiency.h.

bool CSCEfficiency::useTrigger
private

Definition at line 163 of file CSCEfficiency.h.

edm::InputTag CSCEfficiency::wireDigiTag_
private

Definition at line 139 of file CSCEfficiency.h.