CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCEfficiency.h
Go to the documentation of this file.
1 #ifndef RecoLocalMuon_CSCEfficiency_H
2 #define RecoLocalMuon_CSCEfficiency_H
3 
10 // how many of the headers below are not needed?...
19 
26 
29 
32 
38 
43 
48 
51 
58 
63 
70 
73 
75 
77 #include "CLHEP/Matrix/Vector.h"
78 #include "CLHEP/Vector/ThreeVector.h"
79 
80 #include "TFile.h"
81 #include "TVector3.h"
82 #include "TProfile.h"
83 #include "TMath.h"
84 #include "TH1F.h"
85 #include "TH2F.h"
86 #include "TString.h"
87 
88 #include <iostream>
89 #include <iomanip>
90 #include <fstream>
91 //#include "Math/Interpolator.h"
92 
93 #include <vector>
94 #include <map>
95 #include <string>
96 
97 #define SQR(x) ((x)*(x))
98 
99 #define LastCh 36
100 #define FirstCh 1
101 #define NumCh (LastCh-FirstCh+1)
102 
103 namespace edm {
104  class ParameterSet;
105  class Event;
106  class EventSetup;
107  class TriggerNames;
108 }
109 
110 class TFile;
111 class CSCLayer;
112 class CSCDetId;
113 
114 class CSCEfficiency : public edm::EDFilter {
115 public:
117  CSCEfficiency(const edm::ParameterSet& pset);
118 
120  virtual ~CSCEfficiency();
121 
122  private:
123  virtual void beginJob() ;
124  //---- analysis + filter
125  virtual bool filter(edm::Event & event, const edm::EventSetup& eventSetup);
126 
127  virtual void endJob() ;
128 
129  //---- (input) parameters
130  //---- Root file name
132 
133  //---- digi/object tokens
134 
142 
145 
147 
148  //
149  unsigned int printout_NEvents;
150  bool isData;
151  bool isIPdata;
154  bool useDigis;
156  double minP;
157  double maxP;
158  double maxNormChi2;
159  unsigned int minTrackHits;
160 
165 
166  // trigger
168  std::vector<std::string> myTriggers;
169  std::vector <int> pointToTriggers;
170  bool andOr;
171 
172 
173  //---- The muon service
175  //---- The root file for the histograms
176  TFile *theFile;
177  //---- printalot debug output
178  bool printalot;
179  //---- counter
181  //---- magnetic field
182  bool magField;
183  //---- track direction
184  bool alongZ;
185  //---- filter variable
187 
188  //---- Variables
189  //---- LCTs
190  bool allCLCT[2][4][4][NumCh];//endcap/station/ring/chamber
191  bool allALCT[2][4][4][NumCh];//endcap/station/ring/chamber
192  bool allCorrLCT[2][4][4][NumCh];//endcap/station/ring/chamber
193 
194  //---- Strips: strip number and ADCPeak
195  std::vector <std::pair <int, float> > allStrips[2][4][4][NumCh][6];//endcap/station/ring/chamber/layer
196 
197  //----Wires: WG number and Y-position, time bin
198  std::vector <std::pair <std::pair <int, float>, int> > allWG[2][4][4][NumCh][6];//endcap/station/ring/chamber/layer
199 
200  //SetOfSimHits (*all_SimHits)[2][4][4][ NumCh];
201  //---- Simhits
202  std::vector <std::pair <LocalPoint, int> > allSimhits[2][4][4][NumCh][6];//endcap/station/ring/chamber/layer
203 
204  //rechits
205  //SetOfRecHits (*all_RecHits)[2][4][4][ NumCh];
206  std::vector <std::pair <LocalPoint, bool> > allRechits[2][4][4][NumCh][6];//endcap/station/ring/chamber/layer
207 
208  // segments
209  std::vector <std::pair <LocalPoint, LocalVector> > allSegments[2][4][4][NumCh];//endcap/station/ring/chamber
210 
211  // empty chambers
212  bool emptyChambers[2][4][4][NumCh];//endcap/station/ring/chamber
213 
214  //---- Functions
223  edm::ESHandle<CSCGeometry> &cscGeom);
231  edm::ESHandle<CSCGeometry> &cscGeom);
233 
234  void ringCandidates(int station, float absEta, std::map <std::string, bool> & chamberTypes);
235  void chamberCandidates(int station, int ring, float phi, std::vector <int> &coupleOfChambers);
236 
237  bool efficienciesPerChamber(CSCDetId & id, const CSCChamber* cscChamber, FreeTrajectoryState &ftsChamber);
238  bool stripWire_Efficiencies(CSCDetId & cscDetId, FreeTrajectoryState &ftsChamber);
239  bool recHitSegment_Efficiencies(CSCDetId & cscDetId, const CSCChamber* cscChamber, FreeTrajectoryState &ftsChamber);
240  bool recSimHitEfficiency(CSCDetId & id, FreeTrajectoryState &ftsChamber);
241  //
242  void returnTypes(CSCDetId & id, int &ec, int &st, int &rg, int &ch, int &secondRing);
243  //
244  void getFromFTS(const FreeTrajectoryState& fts,
245  CLHEP::Hep3Vector& p3, CLHEP::Hep3Vector& r3,
246  int& charge, AlgebraicSymMatrix66& cov);
247 
248  FreeTrajectoryState getFromCLHEP(const CLHEP::Hep3Vector& p3, const CLHEP::Hep3Vector& r3,
249  int charge, const AlgebraicSymMatrix66& cov,
250  const MagneticField* field);
251 
252  void linearExtrapolation(GlobalPoint initialPosition ,GlobalVector initialDirection,
253  float zSurface, std::vector <float> &posZY);
254  double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine);
255  double lineParameter(double initZPosition, double destZPosition, double initZDirection);
256  bool inSensitiveLocalRegion(double xLocal, double yLocal, int station, int ring);
257  bool checkLocal(double yLocal, double yBoundary, int station, int ring);
258  void chooseDirection(CLHEP::Hep3Vector & innerPosition, CLHEP::Hep3Vector & outerPosition);
259  const Propagator* propagator(std::string propagatorName) const ;
261  bool applyTrigger(edm::Handle<edm::TriggerResults> &hltR, const edm::TriggerNames & triggerNames);
262  //bool applyTrigger(void);
263 
264 
265  //---- Histograms
266  TH1F * DataFlow;
268  //
269  TH1F * ALCTPerEvent;
270  TH1F * CLCTPerEvent;
273 //---- Histogram set (stations)...
286  }StHist[2][4];
287 //---- Histogram set (chambers)...
303  std::vector<TH1F *> Y_InefficientRecHits_inSegment;
304  std::vector<TH1F *> Y_EfficientRecHits_inSegment;
305  std::vector<TH1F *> Phi_InefficientRecHits_inSegment;
306  std::vector<TH1F *> Phi_EfficientRecHits_inSegment;
307  //
308  TH1F * SimRechits;
309  TH1F * SimSimhits;
310  /*
311  TH1F * SimRechits_each;
312  TH1F * SimSimhits_each;
313  */
314  }ChHist[2][4][3][LastCh-FirstCh+1];
315 };
316 
317 #endif
318 
319 
320 
321 
struct CSCEfficiency::StationHistos StHist[2][4]
std::string rootFileName
bool applyTrigger(edm::Handle< edm::TriggerResults > &hltR, const edm::TriggerNames &triggerNames)
virtual void beginJob()
bool allALCT[2][4][4][(36-1+1)]
edm::EDGetTokenT< CSCStripDigiCollection > sd_token
void fillWG_info(edm::Handle< CSCWireDigiCollection > &wires, edm::ESHandle< CSCGeometry > &cscGeom)
void chooseDirection(CLHEP::Hep3Vector &innerPosition, CLHEP::Hep3Vector &outerPosition)
TH1F * CLCTPerEvent
std::vector< std::pair< int, float > > allStrips[2][4][4][(36-1+1)][6]
void ringCandidates(int station, float absEta, std::map< std::string, bool > &chamberTypes)
double lineParameter(double initZPosition, double destZPosition, double initZDirection)
std::vector< TH1F * > Y_InefficientRecHits_inSegment
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > co_token
bool recSimHitEfficiency(CSCDetId &id, FreeTrajectoryState &ftsChamber)
CSCEfficiency(const edm::ParameterSet &pset)
Constructor.
edm::EDGetTokenT< CSCCLCTDigiCollection > cl_token
std::vector< std::pair< LocalPoint, int > > allSimhits[2][4][4][(36-1+1)][6]
virtual bool filter(edm::Event &event, const edm::EventSetup &eventSetup)
double local_DX_DZ_Max
virtual ~CSCEfficiency()
Destructor.
void returnTypes(CSCDetId &id, int &ec, int &st, int &rg, int &ch, int &secondRing)
bool getAbsoluteEfficiency
edm::EDGetTokenT< CSCSegmentCollection > se_token
FreeTrajectoryState getFromCLHEP(const CLHEP::Hep3Vector &p3, const CLHEP::Hep3Vector &r3, int charge, const AlgebraicSymMatrix66 &cov, const MagneticField *field)
std::vector< std::pair< std::pair< int, float >, int > > allWG[2][4][4][(36-1+1)][6]
std::vector< std::string > myTriggers
std::vector< TH1F * > Phi_InefficientRecHits_inSegment
bool allCorrLCT[2][4][4][(36-1+1)]
double local_DY_DZ_Max
std::vector< TH1F * > Y_EfficientRecHits_inSegment
edm::EDGetTokenT< edm::PSimHitContainer > sh_token
MuonServiceProxy * theService
edm::EDGetTokenT< CSCWireDigiCollection > wd_token
std::vector< std::pair< LocalPoint, LocalVector > > allSegments[2][4][4][(36-1+1)]
void linearExtrapolation(GlobalPoint initialPosition, GlobalVector initialDirection, float zSurface, std::vector< float > &posZY)
double distanceFromDeadZone
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
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)
std::vector< std::pair< LocalPoint, bool > > allRechits[2][4][4][(36-1+1)][6]
std::vector< TH1F * > Phi_EfficientRecHits_inSegment
double maxNormChi2
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)
bool stripWire_Efficiencies(CSCDetId &cscDetId, FreeTrajectoryState &ftsChamber)
double local_DY_DZ_Min
edm::EDGetTokenT< CSCRecHit2DCollection > rh_token
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)
#define FirstCh
const Propagator * propagator(std::string propagatorName) const
bool recHitSegment_Efficiencies(CSCDetId &cscDetId, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber)
tuple simHits
Definition: trackerHits.py:16
unsigned int printout_NEvents
TH1F * TriggersFired
bool inSensitiveLocalRegion(double xLocal, double yLocal, int station, int ring)
bool checkLocal(double yLocal, double yBoundary, int station, int ring)
TH1F * segmentsPerEvent
TH1F * recHitsPerEvent
bool emptyChambers[2][4][4][(36-1+1)]
#define LastCh
Definition: CSCEfficiency.h:99
std::vector< int > pointToTriggers
void fillSimhit_info(edm::Handle< edm::PSimHitContainer > &simHits)
TH1F * ALCTPerEvent
#define NumCh
unsigned int minTrackHits
bool allCLCT[2][4][4][(36-1+1)]
struct CSCEfficiency::ChamberHistos ChHist[2][4][3][36-1+1]
edm::EDGetTokenT< CSCALCTDigiCollection > al_token
edm::EDGetTokenT< edm::TriggerResults > ht_token
virtual void endJob()
TrajectoryStateOnSurface propagate(FreeTrajectoryState &ftsStart, const BoundPlane &bp)
edm::EDGetTokenT< edm::View< reco::Track > > tk_token
double p3[4]
Definition: TauolaWrapper.h:91
Definition: DDAxes.h:10
void fillStrips_info(edm::Handle< CSCStripDigiCollection > &strips)