CMS 3D CMS Logo

GlobalRecHitsProducer.h
Go to the documentation of this file.
1 #ifndef GlobalRecHitsProducer_h
2 #define GlobalRecHitsProducer_h
3 
13 // framework & common header files
20 
21 //DQM services
24 
25 
26 
27 //#include "DataFormats/Common/interface/Provenance.h"
32 
33 // ecal calorimeter info
42 
43 // hcal calorimeter info
61 
62 // silicon strip info
81 
82 // silicon pixel info
91 
92 // muon DT info
101 //#include "Validation/GlobalRecHits/interface/DTHitQualityUtils.h"
103 
104 // muon CSC info
113 
114 // muon RPC info
120 
121 // event info
128 
129 // general info
133 
134 // helper files
135 //#include <CLHEP/Vector/LorentzVector.h>
136 //#include <CLHEP/Units/SystemOfUnits.h>
137 
138 #include <iostream>
139 #include <stdlib.h>
140 #include <string>
141 #include <memory>
142 #include <vector>
143 #include <map>
144 #include <math.h>
145 
146 #include "TString.h"
147 
148 class PGlobalRecHit;
149 
151 {
152 
153  public:
154 
155  typedef std::vector<float> FloatVector;
156  typedef std::vector<double> DoubleVector;
157  typedef std::vector<int> IntVector;
158  typedef std::map<uint32_t,float,std::less<uint32_t> > MapType;
159 
160  explicit GlobalRecHitsProducer(const edm::ParameterSet&);
161  virtual ~GlobalRecHitsProducer();
162  virtual void beginJob();
163  virtual void endJob();
164  virtual void produce(edm::Event&, const edm::EventSetup&);
165 
166  private:
167 
168  // production related methods
169  void fillECal(edm::Event&, const edm::EventSetup&);
170  void storeECal(PGlobalRecHit&);
171  void fillHCal(edm::Event&, const edm::EventSetup&);
172  void storeHCal(PGlobalRecHit&);
173  void fillTrk(edm::Event&, const edm::EventSetup&);
174  void storeTrk(PGlobalRecHit&);
175  void fillMuon(edm::Event&, const edm::EventSetup&);
176  void storeMuon(PGlobalRecHit&);
177 
178  void clear();
179 
180  private:
181 
182  // parameter information
189 
190  // Electromagnetic info
191  // ECal info
192 
193  FloatVector EBRE;
194  FloatVector EBSHE;
195 
196  FloatVector EERE;
197  FloatVector EESHE;
198 
199  FloatVector ESRE;
200  FloatVector ESSHE;
201 
215 
216  // HCal info
217 
218  FloatVector HBCalREC;
219  FloatVector HBCalR;
220  FloatVector HBCalSHE;
221 
222  FloatVector HECalREC;
223  FloatVector HECalR;
224  FloatVector HECalSHE;
225 
226  FloatVector HOCalREC;
227  FloatVector HOCalR;
228  FloatVector HOCalSHE;
229 
230  FloatVector HFCalREC;
231  FloatVector HFCalR;
232  FloatVector HFCalSHE;
233 
236 
237  // Tracker info
238  // SiStrip
239 
240  FloatVector TIBL1RX, TIBL2RX, TIBL3RX, TIBL4RX;
241  FloatVector TIBL1RY, TIBL2RY, TIBL3RY, TIBL4RY;
242  FloatVector TIBL1SX, TIBL2SX, TIBL3SX, TIBL4SX;
243  FloatVector TIBL1SY, TIBL2SY, TIBL3SY, TIBL4SY;
244 
245  FloatVector TOBL1RX, TOBL2RX, TOBL3RX, TOBL4RX;
246  FloatVector TOBL1RY, TOBL2RY, TOBL3RY, TOBL4RY;
247  FloatVector TOBL1SX, TOBL2SX, TOBL3SX, TOBL4SX;
248  FloatVector TOBL1SY, TOBL2SY, TOBL3SY, TOBL4SY;
249 
250  FloatVector TIDW1RX, TIDW2RX, TIDW3RX;
251  FloatVector TIDW1RY, TIDW2RY, TIDW3RY;
252  FloatVector TIDW1SX, TIDW2SX, TIDW3SX;
253  FloatVector TIDW1SY, TIDW2SY, TIDW3SY;
254 
256  TECW8RX;
258  TECW8RY;
260  TECW8SX;
262  TECW8SY;
263 
266 
267  std::vector<PSimHit> matched;
268  std::pair<LocalPoint,LocalVector>
269  projectHit( const PSimHit& hit,
270  const StripGeomDetUnit* stripDet,
271  const BoundPlane& plane);
273 
274  // SiPxl
275 
276  FloatVector BRL1RX, BRL2RX, BRL3RX;
277  FloatVector BRL1RY, BRL2RY, BRL3RY;
278  FloatVector BRL1SX, BRL2SX, BRL3SX;
279  FloatVector BRL1SY, BRL2SY, BRL3SY;
280 
281  FloatVector FWD1pRX, FWD1nRX, FWD2pRX, FWD2nRX;
282  FloatVector FWD1pRY, FWD1nRY, FWD2pRY, FWD2nRY;
283  FloatVector FWD1pSX, FWD1nSX, FWD2pSX, FWD2nSX;
284  FloatVector FWD1pSY, FWD1nSY, FWD2pSY, FWD2nSY;
285 
288 
289  // Muon info
290  // DT
291 
292  FloatVector DTRHD;
293  FloatVector DTSHD;
294 
299 
300  // Return a map between DTRecHit1DPair and wireId
301  std::map<DTWireId, std::vector<DTRecHit1DPair> >
302  map1DRecHitsPerWire(const DTRecHitCollection* dt1DRecHitPairs);
303 
304  // Compute SimHit distance from wire (cm)
305  float simHitDistFromWire(const DTLayer* layer,
306  DTWireId wireId,
307  const PSimHit& hit);
308 
309  // Find the RecHit closest to the muon SimHit
310  template <typename type>
311  const type*
312  findBestRecHit(const DTLayer* layer,
313  DTWireId wireId,
314  const std::vector<type>& recHits,
315  const float simHitDist);
316 
317  // Compute the distance from wire (cm) of a hits in a DTRecHit1DPair
318  float recHitDistFromWire(const DTRecHit1DPair& hitPair,
319  const DTLayer* layer);
320  // Compute the distance from wire (cm) of a hits in a DTRecHit1D
321  float recHitDistFromWire(const DTRecHit1D& recHit, const DTLayer* layer);
322 
323  // Does the real job
324  template <typename type>
325  int compute(const DTGeometry *dtGeom,
326  const std::map<DTWireId, std::vector<PSimHit> >& simHitsPerWire,
327  const std::map<DTWireId, std::vector<type> >& recHitsPerWire,
328  int step);
329 
330  // CSC
331 
332  FloatVector CSCRHPHI;
333  FloatVector CSCRHPERP;
334  FloatVector CSCSHPHI;
335 
339 
340  std::map<int, edm::PSimHitContainer> theMap;
341  void plotResolution(const PSimHit &simHit, const CSCRecHit2D &recHit,
342  const CSCLayer *layer, int chamberType);
343 
344  // RPC
345 
346  FloatVector RPCRHX;
347  FloatVector RPCSHX;
348 
353 
354  // private statistics information
355  unsigned int count;
356 
357 }; // end class declaration
358 
359 #endif
360 
361 #ifndef GlobalHitMap
362 #define GlobalHitMap
363 
364 // geometry mapping
365 static const int dTrk = 1;
366 static const int sdPxlBrl = 1;
367 static const int sdPxlFwd = 2;
368 static const int sdSiTIB = 3;
369 static const int sdSiTID = 4;
370 static const int sdSiTOB = 5;
371 static const int sdSiTEC = 6;
372 
373 static const int dMuon = 2;
374 static const int sdMuonDT = 1;
375 static const int sdMuonCSC = 2;
376 static const int sdMuonRPC = 3;
377 static const int sdMuonRPCRgnBrl = 0;
378 static const int sdMuonRPCRgnFwdp = 1;
379 static const int sdMuonRPCRgnFwdn = -1;
380 
381 static const int dEcal = 3;
382 static const int sdEcalBrl = 1;
383 static const int sdEcalFwd = 2;
384 static const int sdEcalPS = 3;
385 static const int sdEcalTT = 4;
386 static const int sdEcalLPnD = 5;
387 
388 static const int dHcal = 4;
389 static const int sdHcalEmpty = 0;
390 static const int sdHcalBrl = 1;
391 static const int sdHcalEC = 2;
392 static const int sdHcalOut = 3;
393 static const int sdHcalFwd = 4;
394 static const int sdHcalTT = 5;
395 static const int sdHcalCalib = 6;
396 static const int sdHcalCompst = 7;
397 
398 #endif //PGlobalRecHitsProducer_h
GlobalRecHitsProducer(const edm::ParameterSet &)
type
Definition: HCALResponse.h:21
edm::EDGetTokenT< edm::PSimHitContainer > MuDTSimSrc_Token_
edm::EDGetTokenT< edm::PCaloHitContainer > HCalSrc_Token_
static const int sdMuonRPCRgnFwdn
std::vector< int > IntVector
const type * findBestRecHit(const DTLayer *layer, DTWireId wireId, const std::vector< type > &recHits, const float simHitDist)
float simHitDistFromWire(const DTLayer *layer, DTWireId wireId, const PSimHit &hit)
TrackerHitAssociator::Config trackerHitAssociatorConfig_
static const int sdHcalCompst
edm::EDGetTokenT< CrossingFrame< PCaloHit > > EEHits_Token_
static const int sdPxlBrl
static const int sdEcalPS
edm::EDGetTokenT< EBUncalibratedRecHitCollection > ECalUncalEBSrc_Token_
static const int sdHcalBrl
float recHitDistFromWire(const DTRecHit1DPair &hitPair, const DTLayer *layer)
std::pair< LocalPoint, LocalVector > projectHit(const PSimHit &hit, const StripGeomDetUnit *stripDet, const BoundPlane &plane)
std::vector< PSimHit > matched
void fillHCal(edm::Event &, const edm::EventSetup &)
edm::EDGetTokenT< EEUncalibratedRecHitCollection > ECalUncalEESrc_Token_
edm::EDGetTokenT< EERecHitCollection > ECalEESrc_Token_
static const int dTrk
static const int sdMuonRPCRgnFwdp
static const int sdMuonCSC
static const int dHcal
static const int sdHcalEC
void storeMuon(PGlobalRecHit &)
static const int sdEcalLPnD
edm::EDGetTokenT< CrossingFrame< PCaloHit > > EBHits_Token_
void storeECal(PGlobalRecHit &)
std::map< int, edm::PSimHitContainer > theMap
virtual void produce(edm::Event &, const edm::EventSetup &)
static const int sdHcalTT
edm::EDGetTokenT< CrossingFrame< PSimHit > > MuCSCHits_Token_
static const int sdMuonRPC
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > SiStripSrc_Token_
edm::EDGetTokenT< CrossingFrame< PCaloHit > > ESHits_Token_
std::map< uint32_t, float, std::less< uint32_t > > MapType
void plotResolution(const PSimHit &simHit, const CSCRecHit2D &recHit, const CSCLayer *layer, int chamberType)
static const int sdSiTIB
static const int sdHcalEmpty
static const int sdSiTID
static const int sdPxlFwd
edm::EDGetTokenT< CSCRecHit2DCollection > MuCSCSrc_Token_
edm::EDGetTokenT< ESRecHitCollection > ECalESSrc_Token_
static const int sdEcalFwd
edm::EDGetTokenT< DTRecHitCollection > MuDTSrc_Token_
void storeTrk(PGlobalRecHit &)
edm::EDGetTokenT< RPCRecHitCollection > MuRPCSrc_Token_
static const int dEcal
static const int sdMuonDT
void fillMuon(edm::Event &, const edm::EventSetup &)
static const int dMuon
static const int sdEcalTT
static const int sdSiTEC
static const int sdHcalCalib
static const int sdSiTOB
std::vector< double > DoubleVector
void storeHCal(PGlobalRecHit &)
std::vector< float > FloatVector
static const int sdHcalFwd
edm::EDGetTokenT< SiPixelRecHitCollection > SiPxlSrc_Token_
static const int sdMuonRPCRgnBrl
step
static const int sdEcalBrl
void fillTrk(edm::Event &, const edm::EventSetup &)
int compute(const DTGeometry *dtGeom, const std::map< DTWireId, std::vector< PSimHit > > &simHitsPerWire, const std::map< DTWireId, std::vector< type > > &recHitsPerWire, int step)
edm::EDGetTokenT< edm::PSimHitContainer > MuRPCSimSrc_Token_
edm::EDGetTokenT< EBRecHitCollection > ECalEBSrc_Token_
void fillECal(edm::Event &, const edm::EventSetup &)
static const int sdHcalOut
std::map< DTWireId, std::vector< DTRecHit1DPair > > map1DRecHitsPerWire(const DTRecHitCollection *dt1DRecHitPairs)