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 
53 
60 
65 
72 
75 
77 
79 #include "CLHEP/Matrix/Vector.h"
80 #include "CLHEP/Vector/ThreeVector.h"
81 
82 #include "TFile.h"
83 #include "TVector3.h"
84 #include "TProfile.h"
85 #include "TMath.h"
86 #include "TH1F.h"
87 #include "TH2F.h"
88 #include "TString.h"
89 
90 #include <iostream>
91 #include <iomanip>
92 #include <fstream>
93 //#include "Math/Interpolator.h"
94 
95 #include <vector>
96 #include <map>
97 #include <string>
98 
99 #define SQR(x) ((x)*(x))
100 
101 #define LastCh 36
102 #define FirstCh 1
103 #define NumCh (LastCh-FirstCh+1)
104 
105 namespace edm {
106  class ParameterSet;
107  class Event;
108  class EventSetup;
109  class TriggerNames;
110 }
111 
112 class TFile;
113 class CSCLayer;
114 class CSCDetId;
115 
116 class CSCEfficiency : public edm::EDFilter {
117 public:
119  CSCEfficiency(const edm::ParameterSet& pset);
120 
122  virtual ~CSCEfficiency();
123 
124  private:
125  virtual void beginJob() ;
126  //---- analysis + filter
127  virtual bool filter(edm::Event & event, const edm::EventSetup& eventSetup);
128 
129  virtual void endJob() ;
130 
131  //---- (input) parameters
132  //---- Root file name
134 
135  //---- digi/object tokens
136 
144 
147 
149 
150  //
151  unsigned int printout_NEvents;
152  bool isData;
153  bool isIPdata;
156  bool useDigis;
158  double minP;
159  double maxP;
160  double maxNormChi2;
161  unsigned int minTrackHits;
162 
167 
168  // trigger
170  std::vector<std::string> myTriggers;
171  std::vector <int> pointToTriggers;
172  bool andOr;
173 
174 
175  //---- The muon service
177  //---- The root file for the histograms
178  TFile *theFile;
179  //---- printalot debug output
180  bool printalot;
181  //---- counter
183  //---- magnetic field
184  bool magField;
185  //---- track direction
186  bool alongZ;
187  //---- filter variable
189 
190  //---- Variables
191  //---- LCTs
192  bool allCLCT[2][4][4][NumCh];//endcap/station/ring/chamber
193  bool allALCT[2][4][4][NumCh];//endcap/station/ring/chamber
194  bool allCorrLCT[2][4][4][NumCh];//endcap/station/ring/chamber
195 
196  //---- Strips: strip number and ADCPeak
197  std::vector <std::pair <int, float> > allStrips[2][4][4][NumCh][6];//endcap/station/ring/chamber/layer
198 
199  //----Wires: WG number and Y-position, time bin
200  std::vector <std::pair <std::pair <int, float>, int> > allWG[2][4][4][NumCh][6];//endcap/station/ring/chamber/layer
201 
202  //SetOfSimHits (*all_SimHits)[2][4][4][ NumCh];
203  //---- Simhits
204  std::vector <std::pair <LocalPoint, int> > allSimhits[2][4][4][NumCh][6];//endcap/station/ring/chamber/layer
205 
206  //rechits
207  //SetOfRecHits (*all_RecHits)[2][4][4][ NumCh];
208  std::vector <std::pair <LocalPoint, bool> > allRechits[2][4][4][NumCh][6];//endcap/station/ring/chamber/layer
209 
210  // segments
211  std::vector <std::pair <LocalPoint, LocalVector> > allSegments[2][4][4][NumCh];//endcap/station/ring/chamber
212 
213  // empty chambers
214  bool emptyChambers[2][4][4][NumCh];//endcap/station/ring/chamber
215 
216  //---- Functions
225  edm::ESHandle<CSCGeometry> &cscGeom);
233  edm::ESHandle<CSCGeometry> &cscGeom);
235 
236  void ringCandidates(int station, float absEta, std::map <std::string, bool> & chamberTypes);
237  void chamberCandidates(int station, int ring, float phi, std::vector <int> &coupleOfChambers);
238 
239  bool efficienciesPerChamber(CSCDetId & id, const CSCChamber* cscChamber, FreeTrajectoryState &ftsChamber);
240  bool stripWire_Efficiencies(CSCDetId & cscDetId, FreeTrajectoryState &ftsChamber);
241  bool recHitSegment_Efficiencies(CSCDetId & cscDetId, const CSCChamber* cscChamber, FreeTrajectoryState &ftsChamber);
242  bool recSimHitEfficiency(CSCDetId & id, FreeTrajectoryState &ftsChamber);
243  //
244  void returnTypes(CSCDetId & id, int &ec, int &st, int &rg, int &ch, int &secondRing);
245  //
246  void getFromFTS(const FreeTrajectoryState& fts,
247  CLHEP::Hep3Vector& p3, CLHEP::Hep3Vector& r3,
248  int& charge, AlgebraicSymMatrix66& cov);
249 
250  FreeTrajectoryState getFromCLHEP(const CLHEP::Hep3Vector& p3, const CLHEP::Hep3Vector& r3,
251  int charge, const AlgebraicSymMatrix66& cov,
252  const MagneticField* field);
253 
254  void linearExtrapolation(GlobalPoint initialPosition ,GlobalVector initialDirection,
255  float zSurface, std::vector <float> &posZY);
256  double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine);
257  double lineParameter(double initZPosition, double destZPosition, double initZDirection);
258  bool inSensitiveLocalRegion(double xLocal, double yLocal, int station, int ring);
259  bool checkLocal(double yLocal, double yBoundary, int station, int ring);
260  void chooseDirection(CLHEP::Hep3Vector & innerPosition, CLHEP::Hep3Vector & outerPosition);
261  const Propagator* propagator(std::string propagatorName) const ;
263  bool applyTrigger(edm::Handle<edm::TriggerResults> &hltR, const edm::TriggerNames & triggerNames);
264  //bool applyTrigger(void);
265 
266 
267  //---- Histograms
268  TH1F * DataFlow;
270  //
271  TH1F * ALCTPerEvent;
272  TH1F * CLCTPerEvent;
275 //---- Histogram set (stations)...
288  }StHist[2][4];
289 //---- Histogram set (chambers)...
305  std::vector<TH1F *> Y_InefficientRecHits_inSegment;
306  std::vector<TH1F *> Y_EfficientRecHits_inSegment;
307  std::vector<TH1F *> Phi_InefficientRecHits_inSegment;
308  std::vector<TH1F *> Phi_EfficientRecHits_inSegment;
309  //
310  TH1F * SimRechits;
311  TH1F * SimSimhits;
312  /*
313  TH1F * SimRechits_each;
314  TH1F * SimSimhits_each;
315  */
316  }ChHist[2][4][3][LastCh-FirstCh+1];
317 };
318 
319 #endif
320 
321 
322 
323 
struct CSCEfficiency::StationHistos StHist[2][4]
std::string rootFileName
bool applyTrigger(edm::Handle< edm::TriggerResults > &hltR, const edm::TriggerNames &triggerNames)
virtual void beginJob()
edm::EDGetTokenT< CSCStripDigiCollection > sd_token
struct CSCEfficiency::ChamberHistos ChHist[2][4][3][LastCh-FirstCh+1]
void fillWG_info(edm::Handle< CSCWireDigiCollection > &wires, edm::ESHandle< CSCGeometry > &cscGeom)
void chooseDirection(CLHEP::Hep3Vector &innerPosition, CLHEP::Hep3Vector &outerPosition)
TH1F * CLCTPerEvent
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
std::vector< std::pair< LocalPoint, int > > allSimhits[2][4][4][NumCh][6]
bool allCLCT[2][4][4][NumCh]
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > co_token
bool recSimHitEfficiency(CSCDetId &id, FreeTrajectoryState &ftsChamber)
CSCEfficiency(const edm::ParameterSet &pset)
Constructor.
edm::EDGetTokenT< CSCCLCTDigiCollection > cl_token
virtual bool filter(edm::Event &event, const edm::EventSetup &eventSetup)
double local_DX_DZ_Max
double charge(const std::vector< uint8_t > &Ampls)
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::string > myTriggers
std::vector< TH1F * > Phi_InefficientRecHits_inSegment
double local_DY_DZ_Max
std::vector< TH1F * > Y_EfficientRecHits_inSegment
edm::EDGetTokenT< edm::PSimHitContainer > sh_token
MuonServiceProxy * theService
edm::EDGetTokenT< CSCWireDigiCollection > wd_token
bool allALCT[2][4][4][NumCh]
std::vector< std::pair< std::pair< int, float >, int > > allWG[2][4][4][NumCh][6]
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< 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)
std::vector< std::pair< int, float > > allStrips[2][4][4][NumCh][6]
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
std::vector< std::pair< LocalPoint, LocalVector > > allSegments[2][4][4][NumCh]
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][NumCh]
#define LastCh
std::vector< int > pointToTriggers
void fillSimhit_info(edm::Handle< edm::PSimHitContainer > &simHits)
TH1F * ALCTPerEvent
#define NumCh
std::vector< std::pair< LocalPoint, bool > > allRechits[2][4][4][NumCh][6]
unsigned int minTrackHits
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
bool allCorrLCT[2][4][4][NumCh]
void fillStrips_info(edm::Handle< CSCStripDigiCollection > &strips)