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?...
18 
25 
28 
31 
37 
42 
47 
50 
52 
59 
64 
71 
74 
76 
77 //#include "CLHEP/Matrix/DiagMatrix.h"
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
133  std::string rootFileName;
134  //---- digi/object tags
144  //
145  unsigned int printout_NEvents;
146  bool isData;
147  bool isIPdata;
150  bool useDigis;
152  double minP;
153  double maxP;
154  double maxNormChi2;
155  unsigned int minTrackHits;
156 
161 
162  // trigger
164  //edm::Handle<edm::TriggerResults> hltR
165  edm::InputTag hlTriggerResults_; // Input tag for TriggerResults
166  std::vector<std::string> myTriggers;
167  std::vector <int> pointToTriggers;
168  bool andOr;
169 
170 
171  //---- The muon service
173  //---- The root file for the histograms
174  TFile *theFile;
175  //---- printalot debug output
176  bool printalot;
177  //---- counter
179  //---- magnetic field
180  bool magField;
181  //---- track direction
182  bool alongZ;
183  //---- filter variable
185 
186  //---- Variables
187  //---- LCTs
188  bool allCLCT[2][4][4][NumCh];//endcap/station/ring/chamber
189  bool allALCT[2][4][4][NumCh];//endcap/station/ring/chamber
190  bool allCorrLCT[2][4][4][NumCh];//endcap/station/ring/chamber
191 
192  //---- Strips: strip number and ADCPeak
193  std::vector <std::pair <int, float> > allStrips[2][4][4][NumCh][6];//endcap/station/ring/chamber/layer
194 
195  //----Wires: WG number and Y-position, time bin
196  std::vector <std::pair <std::pair <int, float>, int> > allWG[2][4][4][NumCh][6];//endcap/station/ring/chamber/layer
197 
198  //SetOfSimHits (*all_SimHits)[2][4][4][ NumCh];
199  //---- Simhits
200  std::vector <std::pair <LocalPoint, int> > allSimhits[2][4][4][NumCh][6];//endcap/station/ring/chamber/layer
201 
202  //rechits
203  //SetOfRecHits (*all_RecHits)[2][4][4][ NumCh];
204  std::vector <std::pair <LocalPoint, bool> > allRechits[2][4][4][NumCh][6];//endcap/station/ring/chamber/layer
205 
206  // segments
207  std::vector <std::pair <LocalPoint, LocalVector> > allSegments[2][4][4][NumCh];//endcap/station/ring/chamber
208 
209  // empty chambers
210  bool emptyChambers[2][4][4][NumCh];//endcap/station/ring/chamber
211 
212  //---- Functions
221  edm::ESHandle<CSCGeometry> &cscGeom);
229  edm::ESHandle<CSCGeometry> &cscGeom);
231 
232  void ringCandidates(int station, float absEta, std::map <std::string, bool> & chamberTypes);
233  void chamberCandidates(int station, int ring, float phi, std::vector <int> &coupleOfChambers);
234 
235  bool efficienciesPerChamber(CSCDetId & id, const CSCChamber* cscChamber, FreeTrajectoryState &ftsChamber);
236  bool stripWire_Efficiencies(CSCDetId & cscDetId, FreeTrajectoryState &ftsChamber);
237  bool recHitSegment_Efficiencies(CSCDetId & cscDetId, const CSCChamber* cscChamber, FreeTrajectoryState &ftsChamber);
238  bool recSimHitEfficiency(CSCDetId & id, FreeTrajectoryState &ftsChamber);
239  //
240  void returnTypes(CSCDetId & id, int &ec, int &st, int &rg, int &ch, int &secondRing);
241  //
242  void getFromFTS(const FreeTrajectoryState& fts,
243  CLHEP::Hep3Vector& p3, CLHEP::Hep3Vector& r3,
244  int& charge, AlgebraicSymMatrix66& cov);
245 
246  FreeTrajectoryState getFromCLHEP(const CLHEP::Hep3Vector& p3, const CLHEP::Hep3Vector& r3,
247  int charge, const AlgebraicSymMatrix66& cov,
248  const MagneticField* field);
249 
250  void linearExtrapolation(GlobalPoint initialPosition ,GlobalVector initialDirection,
251  float zSurface, std::vector <float> &posZY);
252  double extrapolate1D(double initPosition, double initDirection, double parameterOfTheLine);
253  double lineParameter(double initZPosition, double destZPosition, double initZDirection);
254  bool inSensitiveLocalRegion(double xLocal, double yLocal, int station, int ring);
255  bool checkLocal(double yLocal, double yBoundary, int station, int ring);
256  void chooseDirection(CLHEP::Hep3Vector & innerPosition, CLHEP::Hep3Vector & outerPosition);
257  const Propagator* propagator(std::string propagatorName) const ;
259  bool applyTrigger(edm::Handle<edm::TriggerResults> &hltR, const edm::TriggerNames & triggerNames);
260  //bool applyTrigger(void);
261 
262 
263  //---- Histograms
264  TH1F * DataFlow;
266  //
267  TH1F * ALCTPerEvent;
268  TH1F * CLCTPerEvent;
271 //---- Histogram set (stations)...
284  }StHist[2][4];
285 //---- Histogram set (chambers)...
301  std::vector<TH1F *> Y_InefficientRecHits_inSegment;
302  std::vector<TH1F *> Y_EfficientRecHits_inSegment;
303  std::vector<TH1F *> Phi_InefficientRecHits_inSegment;
304  std::vector<TH1F *> Phi_EfficientRecHits_inSegment;
305  //
306  TH1F * SimRechits;
307  TH1F * SimSimhits;
308  /*
309  TH1F * SimRechits_each;
310  TH1F * SimSimhits_each;
311  */
312  }ChHist[2][4][3][LastCh-FirstCh+1];
313 };
314 
315 #endif
316 
317 
318 
319 
edm::InputTag corrlctDigiTag_
struct CSCEfficiency::StationHistos StHist[2][4]
std::string rootFileName
edm::InputTag segmentDigiTag_
bool applyTrigger(edm::Handle< edm::TriggerResults > &hltR, const edm::TriggerNames &triggerNames)
virtual void beginJob()
bool allALCT[2][4][4][(36-1+1)]
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
bool recSimHitEfficiency(CSCDetId &id, FreeTrajectoryState &ftsChamber)
CSCEfficiency(const edm::ParameterSet &pset)
Constructor.
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
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
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
MuonServiceProxy * theService
std::vector< std::pair< LocalPoint, LocalVector > > allSegments[2][4][4][(36-1+1)]
edm::InputTag rechitDigiTag_
void linearExtrapolation(GlobalPoint initialPosition, GlobalVector initialDirection, float zSurface, std::vector< float > &posZY)
edm::InputTag hlTriggerResults_
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
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
edm::InputTag tracksTag
bool recHitSegment_Efficiencies(CSCDetId &cscDetId, const CSCChamber *cscChamber, FreeTrajectoryState &ftsChamber)
tuple simHits
Definition: trackerHits.py:16
unsigned int printout_NEvents
TH1F * TriggersFired
edm::InputTag clctDigiTag_
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)]
edm::InputTag simHitTag
#define LastCh
std::vector< int > pointToTriggers
void fillSimhit_info(edm::Handle< edm::PSimHitContainer > &simHits)
TH1F * ALCTPerEvent
edm::InputTag stripDigiTag_
#define NumCh
edm::InputTag alctDigiTag_
edm::InputTag wireDigiTag_
unsigned int minTrackHits
bool allCLCT[2][4][4][(36-1+1)]
struct CSCEfficiency::ChamberHistos ChHist[2][4][3][36-1+1]
virtual void endJob()
TrajectoryStateOnSurface propagate(FreeTrajectoryState &ftsStart, const BoundPlane &bp)
double p3[4]
Definition: TauolaWrapper.h:91
Definition: DDAxes.h:10
void fillStrips_info(edm::Handle< CSCStripDigiCollection > &strips)