CMS 3D CMS Logo

TrackerDpgAnalysis.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: DPGAnalysis
4 // Class: TrackerDpgAnalysis
5 //
13 //
14 // Original Author: Christophe DELAERE
15 // Created: Tue Sep 23 02:11:44 CEST 2008
16 // Revised: Thu Nov 26 10:00:00 CEST 2009
17 // part of the code was inspired by http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/UserCode/YGao/LhcTrackAnalyzer/
18 // part of the code was inspired by
19 // other inputs from Andrea Giammanco, Gaelle Boudoul, Andrea Venturi, Steven Lowette, Gavril Giurgiu
20 // $Id: TrackerDpgAnalysis.cc,v 1.14 2013/02/27 19:49:47 wmtan Exp $
21 //
22 //
23 
24 // system include files
25 #include <memory>
26 #include <iostream>
27 #include <limits>
28 #include <utility>
29 #include <vector>
30 #include <algorithm>
31 #include <functional>
32 #include <cstring>
33 #include <sstream>
34 #include <fstream>
35 
36 // root include files
37 #include "TTree.h"
38 #include "TFile.h"
39 
40 // user include files
99 
100 // topology
102 
103 //
104 // class decleration
105 //
107 
108 class TrackerDpgAnalysis : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one::SharedResources> {
109 public:
110  explicit TrackerDpgAnalysis(const edm::ParameterSet&);
111  ~TrackerDpgAnalysis() override;
112 
113 protected:
115  const std::vector<Trajectory>&);
116  void insertMeasurement(std::multimap<const uint32_t, std::pair<LocalPoint, double> >&,
118  double);
119  std::vector<int> onTrack(edm::Handle<edmNew::DetSetVector<SiStripCluster> >&, const reco::TrackCollection&, uint32_t);
120  void insertMeasurement(std::multimap<const uint32_t, std::pair<int, int> >&, const TrackingRecHit*, int);
121  std::map<size_t, int> inVertex(const reco::TrackCollection&, const reco::VertexCollection&, uint32_t);
122  std::vector<std::pair<double, double> > onTrackAngles(edm::Handle<edmNew::DetSetVector<SiPixelCluster> >&,
123  const std::vector<Trajectory>&);
124  void insertMeasurement(std::multimap<const uint32_t, std::pair<LocalPoint, std::pair<double, double> > >&,
126  double,
127  double);
128  std::vector<int> onTrack(edm::Handle<edmNew::DetSetVector<SiPixelCluster> >&, const reco::TrackCollection&, uint32_t);
129  void insertMeasurement(std::multimap<const uint32_t, std::pair<std::pair<float, float>, int> >&,
130  const TrackingRecHit*,
131  int);
132  std::string toStringName(uint32_t, const TrackerTopology&);
133  std::string toStringId(uint32_t);
134  double sumPtSquared(const reco::Vertex&);
135  float delay(const SiStripEventSummary&);
136  std::map<uint32_t, float> delay(const std::vector<std::string>&);
137 
138 private:
139  void beginRun(const edm::Run&, const edm::EventSetup&) override;
140  void endRun(const edm::Run&, const edm::EventSetup&) override {}
141  void analyze(const edm::Event&, const edm::EventSetup&) override;
142  void endJob() override;
143 
144  // ----------member data ---------------------------
145  static const int nMaxPVs_ = 50;
159  std::vector<edm::InputTag> trackLabels_;
160  std::vector<edm::EDGetTokenT<reco::TrackCollection> > trackTokens_;
161  std::vector<edm::EDGetTokenT<std::vector<Trajectory> > > trajectoryTokens_;
162  std::vector<edm::EDGetTokenT<TrajTrackAssociationCollection> > trajTrackAssoTokens_;
168  std::multimap<const uint32_t, const FedChannelConnection*> connections_;
172  TTree* clusters_;
173  TTree* pixclusters_;
174  std::vector<TTree*> tracks_;
175  std::vector<TTree*> missingHits_;
176  TTree* vertices_;
178  TTree* event_;
179  TTree* psumap_;
180  TTree* readoutmap_;
181  bool onTrack_;
182  uint32_t vertexid_;
184  uint32_t runid_;
185  uint32_t globalvertexid_;
194  float eta_, phi_, chi2_;
196  uint32_t detid_, dcuId_, type_;
199  lostHits_, ndof_;
200  uint32_t *ntracks_, *ntrajs_;
203  uint32_t nTracks_pvtx_;
211  float charge_, p_, pt_;
219  std::vector<std::string> delayFileNames_;
221  std::vector<std::string> hlNames_; // name of each HLT algorithm
222  HLTConfigProvider hltConfig_; // to get configuration for L1s/Pre
223 };
224 
225 //
226 // constructors and destructor
227 //
229  : siStripClusterInfo_(consumesCollector(), std::string("")),
230  magFieldToken_(esConsumes()),
231  tTopoToken_(esConsumes<edm::Transition::BeginRun>()),
232  tkGeomToken_(esConsumes<edm::Transition::BeginRun>()),
233  fedCablingToken_(esConsumes<edm::Transition::BeginRun>()),
234  hltConfig_() {
235  // members
236  moduleName_ = new char[256];
237  moduleId_ = new char[256];
238  PSUname_ = new char[256];
239  pset_ = iConfig;
240 
241  usesResource(TFileService::kSharedResource);
242 
243  // enable/disable functionalities
244  functionality_offtrackClusters_ = iConfig.getUntrackedParameter<bool>("keepOfftrackClusters", true);
245  functionality_ontrackClusters_ = iConfig.getUntrackedParameter<bool>("keepOntrackClusters", true);
246  functionality_pixclusters_ = iConfig.getUntrackedParameter<bool>("keepPixelClusters", true);
247  functionality_pixvertices_ = iConfig.getUntrackedParameter<bool>("keepPixelVertices", true);
248  functionality_missingHits_ = iConfig.getUntrackedParameter<bool>("keepMissingHits", true);
249  functionality_tracks_ = iConfig.getUntrackedParameter<bool>("keepTracks", true);
250  functionality_vertices_ = iConfig.getUntrackedParameter<bool>("keepVertices", true);
251  functionality_events_ = iConfig.getUntrackedParameter<bool>("keepEvents", true);
252 
253  // parameters
254  summaryToken_ = consumes<SiStripEventSummary>(edm::InputTag("siStripDigis"));
255  clusterToken_ = consumes<edmNew::DetSetVector<SiStripCluster> >(iConfig.getParameter<edm::InputTag>("ClustersLabel"));
257  consumes<edmNew::DetSetVector<SiPixelCluster> >(iConfig.getParameter<edm::InputTag>("PixelClustersLabel"));
258  trackLabels_ = iConfig.getParameter<std::vector<edm::InputTag> >("TracksLabel");
260  trackLabels_, [this](edm::InputTag const& tag) { return consumes<reco::TrackCollection>(tag); });
262  trackLabels_, [this](edm::InputTag const& tag) { return consumes<std::vector<Trajectory> >(tag); });
264  trackLabels_, [this](edm::InputTag const& tag) { return consumes<TrajTrackAssociationCollection>(tag); });
265  dedx1Token_ = consumes<edm::ValueMap<reco::DeDxData> >(iConfig.getParameter<edm::InputTag>("DeDx1Label"));
266  dedx2Token_ = consumes<edm::ValueMap<reco::DeDxData> >(iConfig.getParameter<edm::InputTag>("DeDx2Label"));
267  dedx3Token_ = consumes<edm::ValueMap<reco::DeDxData> >(iConfig.getParameter<edm::InputTag>("DeDx3Label"));
268  vertexToken_ = consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertexLabel"));
269  pixelVertexToken_ = consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("pixelVertexLabel"));
270  bsToken_ = consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpotLabel"));
271  L1Token_ = consumes<L1GlobalTriggerReadoutRecord>(iConfig.getParameter<edm::InputTag>("L1Label"));
272  HLTTag_ = iConfig.getParameter<edm::InputTag>("HLTLabel");
273  HLTToken_ = consumes<edm::TriggerResults>(HLTTag_);
274 
275  // initialize arrays
276  size_t trackSize(trackLabels_.size());
277  ntracks_ = new uint32_t[trackSize];
278  ntrajs_ = new uint32_t[trackSize];
279  globaltrackid_ = new uint32_t[trackSize];
280  trackid_ = new uint32_t[trackSize];
281  lowPixelProbabilityFraction_ = new float[trackSize];
282  globalvertexid_ = iConfig.getParameter<uint32_t>("InitalCounter");
283  for (size_t i = 0; i < trackSize; ++i) {
284  ntracks_[i] = 0;
285  ntrajs_[i] = 0;
286  globaltrackid_[i] = iConfig.getParameter<uint32_t>("InitalCounter");
287  trackid_[i] = 0;
289  }
290 
291  // create output
292  edm::Service<TFileService> fileService;
293  TFileDirectory* dir = new TFileDirectory(fileService->mkdir("trackerDPG"));
294 
295  // create a TTree for clusters
296  clusters_ = dir->make<TTree>("clusters", "cluster information");
297  clusters_->Branch("eventid", &eventid_, "eventid/i");
298  clusters_->Branch("runid", &runid_, "runid/i");
299  for (size_t i = 0; i < trackSize; ++i) {
300  char buffer1[256];
301  char buffer2[256];
302  sprintf(buffer1, "trackid%lu", (unsigned long)i);
303  sprintf(buffer2, "trackid%lu/i", (unsigned long)i);
304  clusters_->Branch(buffer1, trackid_ + i, buffer2);
305  }
306  clusters_->Branch("onTrack", &onTrack_, "onTrack/O");
307  clusters_->Branch("clWidth", &clWidth_, "clWidth/F");
308  clusters_->Branch("clPosition", &clPosition_, "clPosition/F");
309  clusters_->Branch("clglobalX", &globalX_, "clglobalX/F");
310  clusters_->Branch("clglobalY", &globalY_, "clglobalY/F");
311  clusters_->Branch("clglobalZ", &globalZ_, "clglobalZ/F");
312  clusters_->Branch("angle", &angle_, "angle/F");
313  clusters_->Branch("thickness", &thickness_, "thickness/F");
314  clusters_->Branch("maxCharge", &maxCharge_, "maxCharge/F");
315  clusters_->Branch("clNormalizedCharge", &clNormalizedCharge_, "clNormalizedCharge/F");
316  clusters_->Branch("clNormalizedNoise", &clNormalizedNoise_, "clNormalizedNoise/F");
317  clusters_->Branch("clSignalOverNoise", &clSignalOverNoise_, "clSignalOverNoise/F");
318  clusters_->Branch("clCorrectedCharge", &clCorrectedCharge_, "clCorrectedCharge/F");
319  clusters_->Branch("clCorrectedSignalOverNoise", &clCorrectedSignalOverNoise_, "clCorrectedSignalOverNoise/F");
320  clusters_->Branch("clBareCharge", &clBareCharge_, "clBareCharge/F");
321  clusters_->Branch("clBareNoise", &clBareNoise_, "clBareNoise/F");
322  clusters_->Branch("stripLength", &stripLength_, "stripLength/F");
323  clusters_->Branch("detid", &detid_, "detid/i");
324  clusters_->Branch("lldChannel", &lldChannel_, "lldChannel/s");
325 
326  // create a TTree for pixel clusters
327  pixclusters_ = dir->make<TTree>("pixclusters", "pixel cluster information");
328  pixclusters_->Branch("eventid", &eventid_, "eventid/i");
329  pixclusters_->Branch("runid", &runid_, "runid/i");
330  for (size_t i = 0; i < trackSize; ++i) {
331  char buffer1[256];
332  char buffer2[256];
333  sprintf(buffer1, "trackid%lu", (unsigned long)i);
334  sprintf(buffer2, "trackid%lu/i", (unsigned long)i);
335  pixclusters_->Branch(buffer1, trackid_ + i, buffer2);
336  }
337  pixclusters_->Branch("onTrack", &onTrack_, "onTrack/O");
338  pixclusters_->Branch("clPositionX", &clPositionX_, "clPositionX/F");
339  pixclusters_->Branch("clPositionY", &clPositionY_, "clPositionY/F");
340  pixclusters_->Branch("clSize", &clSize_, "clSize/i");
341  pixclusters_->Branch("clSizeX", &clSizeX_, "clSizeX/i");
342  pixclusters_->Branch("clSizeY", &clSizeY_, "clSizeY/i");
343  pixclusters_->Branch("alpha", &alpha_, "alpha/F");
344  pixclusters_->Branch("beta", &beta_, "beta/F");
345  pixclusters_->Branch("charge", &charge_, "charge/F");
346  pixclusters_->Branch("chargeCorr", &chargeCorr_, "chargeCorr/F");
347  pixclusters_->Branch("clglobalX", &globalX_, "clglobalX/F");
348  pixclusters_->Branch("clglobalY", &globalY_, "clglobalY/F");
349  pixclusters_->Branch("clglobalZ", &globalZ_, "clglobalZ/F");
350  pixclusters_->Branch("detid", &detid_, "detid/i");
351 
352  // create a tree for tracks
353  for (size_t i = 0; i < trackSize; ++i) {
354  char buffer1[256];
355  char buffer2[256];
356  sprintf(buffer1, "tracks%lu", (unsigned long)i);
357  sprintf(buffer2, "track%lu information", (unsigned long)i);
358  TTree* thetracks_ = dir->make<TTree>(buffer1, buffer2);
359  sprintf(buffer1, "trackid%lu", (unsigned long)i);
360  sprintf(buffer2, "trackid%lu/i", (unsigned long)i);
361  thetracks_->Branch(buffer1, globaltrackid_ + i, buffer2);
362  thetracks_->Branch("eventid", &eventid_, "eventid/i");
363  thetracks_->Branch("runid", &runid_, "runid/i");
364  thetracks_->Branch("chi2", &chi2_, "chi2/F");
365  thetracks_->Branch("eta", &eta_, "eta/F");
366  thetracks_->Branch("etaerr", &etaerr_, "etaerr/F");
367  thetracks_->Branch("phi", &phi_, "phi/F");
368  thetracks_->Branch("phierr", &phierr_, "phierr/F");
369  thetracks_->Branch("dedx1", &dedx1_, "dedx1/F");
370  thetracks_->Branch("dedx2", &dedx2_, "dedx2/F");
371  thetracks_->Branch("dedx3", &dedx3_, "dedx3/F");
372  thetracks_->Branch("dedxNoM", &dedxNoM_, "dedxNoM/i");
373  thetracks_->Branch("charge", &charge_, "charge/F");
374  thetracks_->Branch("quality", &quality_, "quality/i");
375  thetracks_->Branch("foundhits", &foundhits_, "foundhits/i");
376  thetracks_->Branch("lostHits", &lostHits_, "lostHits/i");
377  thetracks_->Branch("foundhitsStrips", &foundhitsStrips_, "foundhitsStrips/i");
378  thetracks_->Branch("foundhitsPixels", &foundhitsPixels_, "foundhitsPixels/i");
379  thetracks_->Branch("losthitsStrips", &losthitsStrips_, "losthitsStrips/i");
380  thetracks_->Branch("losthitsPixels", &losthitsPixels_, "losthitsPixels/i");
381  thetracks_->Branch("p", &p_, "p/F");
382  thetracks_->Branch("pt", &pt_, "pt/F");
383  thetracks_->Branch("pterr", &pterr_, "pterr/F");
384  thetracks_->Branch("ndof", &ndof_, "ndof/i");
385  thetracks_->Branch("dz", &dz_, "dz/F");
386  thetracks_->Branch("dzerr", &dzerr_, "dzerr/F");
387  thetracks_->Branch("dzCorr", &dzCorr_, "dzCorr/F");
388  thetracks_->Branch("dxy", &dxy_, "dxy/F");
389  thetracks_->Branch("dxyerr", &dxyerr_, "dxyerr/F");
390  thetracks_->Branch("dxyCorr", &dxyCorr_, "dxyCorr/F");
391  thetracks_->Branch("qoverp", &qoverp_, "qoverp/F");
392  thetracks_->Branch("xPCA", &xPCA_, "xPCA/F");
393  thetracks_->Branch("yPCA", &yPCA_, "yPCA/F");
394  thetracks_->Branch("zPCA", &zPCA_, "zPCA/F");
395  thetracks_->Branch("nLayers", &nLayers_, "nLayers/i");
396  thetracks_->Branch("trkWeightpvtx", &trkWeightpvtx_, "trkWeightpvtx/F");
397  thetracks_->Branch("vertexid", &vertexid_, "vertexid/i");
398  tracks_.push_back(thetracks_);
399  }
400 
401  // create a tree for missing hits
402  for (size_t i = 0; i < trackSize; ++i) {
403  char buffer1[256];
404  char buffer2[256];
405  sprintf(buffer1, "misingHits%lu", (unsigned long)i);
406  sprintf(buffer2, "missing hits from track collection %lu", (unsigned long)i);
407  TTree* themissingHits_ = dir->make<TTree>(buffer1, buffer2);
408  sprintf(buffer1, "trackid%lu", (unsigned long)i);
409  sprintf(buffer2, "trackid%lu/i", (unsigned long)i);
410  themissingHits_->Branch(buffer1, globaltrackid_ + i, buffer2);
411  themissingHits_->Branch("eventid", &eventid_, "eventid/i");
412  themissingHits_->Branch("runid", &runid_, "runid/i");
413  themissingHits_->Branch("detid", &detid_, "detid/i");
414  themissingHits_->Branch("type", &type_, "type/i");
415  themissingHits_->Branch("localX", &clPositionX_, "localX/F");
416  themissingHits_->Branch("localY", &clPositionY_, "localY/F");
417  themissingHits_->Branch("globalX", &globalX_, "globalX/F");
418  themissingHits_->Branch("globalY", &globalY_, "globalY/F");
419  themissingHits_->Branch("globalZ", &globalZ_, "globalZ/F");
420  themissingHits_->Branch("measX", &measX_, "measX/F");
421  themissingHits_->Branch("measY", &measY_, "measY/F");
422  themissingHits_->Branch("errorX", &errorX_, "errorX/F");
423  themissingHits_->Branch("errorY", &errorY_, "errorY/F");
424  missingHits_.push_back(themissingHits_);
425  }
426 
427  // create a tree for the vertices
428  vertices_ = dir->make<TTree>("vertices", "vertex information");
429  vertices_->Branch("vertexid", &globalvertexid_, "vertexid/i");
430  vertices_->Branch("eventid", &eventid_, "eventid/i");
431  vertices_->Branch("runid", &runid_, "runid/i");
432  vertices_->Branch("nTracks", &nTracks_pvtx_, "nTracks/i");
433  vertices_->Branch("sumptsq", &sumptsq_pvtx_, "sumptsq/F");
434  vertices_->Branch("isValid", &isValid_pvtx_, "isValid/O");
435  vertices_->Branch("isFake", &isFake_pvtx_, "isFake/O");
436  vertices_->Branch("recx", &recx_pvtx_, "recx/F");
437  vertices_->Branch("recy", &recy_pvtx_, "recy/F");
438  vertices_->Branch("recz", &recz_pvtx_, "recz/F");
439  vertices_->Branch("recx_err", &recx_err_pvtx_, "recx_err/F");
440  vertices_->Branch("recy_err", &recy_err_pvtx_, "recy_err/F");
441  vertices_->Branch("recz_err", &recz_err_pvtx_, "recz_err/F");
442 
443  // create a tree for the vertices
444  pixelVertices_ = dir->make<TTree>("pixelVertices", "pixel vertex information");
445  pixelVertices_->Branch("eventid", &eventid_, "eventid/i");
446  pixelVertices_->Branch("runid", &runid_, "runid/i");
447  pixelVertices_->Branch("nTracks", &nTracks_pvtx_, "nTracks/i");
448  pixelVertices_->Branch("sumptsq", &sumptsq_pvtx_, "sumptsq/F");
449  pixelVertices_->Branch("isValid", &isValid_pvtx_, "isValid/O");
450  pixelVertices_->Branch("isFake", &isFake_pvtx_, "isFake/O");
451  pixelVertices_->Branch("recx", &recx_pvtx_, "recx/F");
452  pixelVertices_->Branch("recy", &recy_pvtx_, "recy/F");
453  pixelVertices_->Branch("recz", &recz_pvtx_, "recz/F");
454  pixelVertices_->Branch("recx_err", &recx_err_pvtx_, "recx_err/F");
455  pixelVertices_->Branch("recy_err", &recy_err_pvtx_, "recy_err/F");
456  pixelVertices_->Branch("recz_err", &recz_err_pvtx_, "recz_err/F");
457 
458  // create a tree for the events
459  event_ = dir->make<TTree>("events", "event information");
460  event_->Branch("eventid", &eventid_, "eventid/i");
461  event_->Branch("runid", &runid_, "runid/i");
462  event_->Branch("L1DecisionBits", L1DecisionBits_, "L1DecisionBits[192]/O");
463  event_->Branch("L1TechnicalBits", L1TechnicalBits_, "L1TechnicalBits[64]/O");
464  event_->Branch("orbit", &orbit_, "orbit/i");
465  event_->Branch("orbitL1", &orbitL1_, "orbitL1/i");
466  event_->Branch("bx", &bx_, "bx/i");
467  event_->Branch("store", &store_, "store/i");
468  event_->Branch("time", &time_, "time/i");
469  event_->Branch("delay", &delay_, "delay/F");
470  event_->Branch("lumiSegment", &lumiSegment_, "lumiSegment/s");
471  event_->Branch("physicsDeclared", &physicsDeclared_, "physicsDeclared/s");
472  event_->Branch("HLTDecisionBits", HLTDecisionBits_, "HLTDecisionBits[256]/O");
473  char buffer[256];
474  sprintf(buffer, "ntracks[%lu]/i", (unsigned long)trackSize);
475  event_->Branch("ntracks", ntracks_, buffer);
476  sprintf(buffer, "ntrajs[%lu]/i", (unsigned long)trackSize);
477  event_->Branch("ntrajs", ntrajs_, buffer);
478  sprintf(buffer, "lowPixelProbabilityFraction[%lu]/F", (unsigned long)trackSize);
479  event_->Branch("lowPixelProbabilityFraction", lowPixelProbabilityFraction_, buffer);
480  event_->Branch("nclusters", &nclusters_, "nclusters/i");
481  event_->Branch("npixClusters", &npixClusters_, "npixClusters/i");
482  event_->Branch("nclustersOntrack", &nclustersOntrack_, "nclustersOntrack/i");
483  event_->Branch("npixClustersOntrack", &npixClustersOntrack_, "npixClustersOntrack/i");
484  event_->Branch("bsX0", &bsX0_, "bsX0/F");
485  event_->Branch("bsY0", &bsY0_, "bsY0/F");
486  event_->Branch("bsZ0", &bsZ0_, "bsZ0/F");
487  event_->Branch("bsSigmaZ", &bsSigmaZ_, "bsSigmaZ/F");
488  event_->Branch("bsDxdz", &bsDxdz_, "bsDxdz/F");
489  event_->Branch("bsDydz", &bsDydz_, "bsDydz/F");
490  event_->Branch("nVertices", &nVertices_, "nVertices/i");
491  event_->Branch("thrustValue", &thrustValue_, "thrustValue/F");
492  event_->Branch("thrustX", &thrustX_, "thrustX/F");
493  event_->Branch("thrustY", &thrustY_, "thrustY/F");
494  event_->Branch("thrustZ", &thrustZ_, "thrustZ/F");
495  event_->Branch("sphericity", &sphericity_, "sphericity/F");
496  event_->Branch("planarity", &planarity_, "planarity/F");
497  event_->Branch("aplanarity", &aplanarity_, "aplanarity/F");
498  event_->Branch("MagneticField", &fBz_, "MagneticField/F");
499 
500  // cabling
501  cablingFileName_ = iConfig.getUntrackedParameter<std::string>("PSUFileName", "PSUmapping.csv");
503  iConfig.getUntrackedParameter<std::vector<std::string> >("DelayFileNames", std::vector<std::string>(0));
504  psumap_ = dir->make<TTree>("psumap", "PSU map");
505  psumap_->Branch("PSUname", PSUname_, "PSUname/C");
506  psumap_->Branch("dcuId", &dcuId_, "dcuId/i");
507  readoutmap_ = dir->make<TTree>("readoutMap", "cabling map");
508  readoutmap_->Branch("detid", &detid_, "detid/i");
509  readoutmap_->Branch("dcuId", &dcuId_, "dcuId/i");
510  readoutmap_->Branch("fecCrate", &fecCrate_, "fecCrate/s");
511  readoutmap_->Branch("fecSlot", &fecSlot_, "fecSlot/s");
512  readoutmap_->Branch("fecRing", &fecRing_, "fecRing/s");
513  readoutmap_->Branch("ccuAdd", &ccuAdd_, "ccuAdd/s");
514  readoutmap_->Branch("ccuChan", &ccuChan_, "ccuChan/s");
515  readoutmap_->Branch("lldChannel", &lldChannel_, "lldChannel/s");
516  readoutmap_->Branch("fedId", &fedId_, "fedId/s");
517  readoutmap_->Branch("fedCh", &fedCh_, "fedCh/s");
518  readoutmap_->Branch("fiberLength", &fiberLength_, "fiberLength/s");
519  readoutmap_->Branch("moduleName", moduleName_, "moduleName/C");
520  readoutmap_->Branch("moduleId", moduleId_, "moduleId/C");
521  readoutmap_->Branch("delay", &delay_, "delay/F");
522  readoutmap_->Branch("globalX", &globalX_, "globalX/F");
523  readoutmap_->Branch("globalY", &globalY_, "globalY/F");
524  readoutmap_->Branch("globalZ", &globalZ_, "globalZ/F");
525 }
526 
528  delete[] moduleName_;
529  delete[] moduleId_;
530 }
531 
532 //
533 // member functions
534 //
535 
536 // ------------ method called to for each event ------------
538  using namespace edm;
539  using namespace reco;
540  using namespace std;
541  using reco::TrackCollection;
542 
543  // load event info
544  eventid_ = iEvent.id().event();
545  runid_ = iEvent.id().run();
546  bx_ = iEvent.eventAuxiliary().bunchCrossing();
547  orbit_ = iEvent.eventAuxiliary().orbitNumber();
548  store_ = iEvent.eventAuxiliary().storeNumber();
549  time_ = iEvent.eventAuxiliary().time().value();
550  lumiSegment_ = iEvent.eventAuxiliary().luminosityBlock();
551 
552  // Retrieve commissioning information from "event summary", when available (for standard fine delay)
554  iEvent.getByToken(summaryToken_, summary);
555  if (summary.isValid())
556  delay_ = delay(*summary.product());
557  else
558  delay_ = 0.;
559 
560  // -- Magnetic field
561  fBz_ = fabs(iSetup.getData(magFieldToken_).inTesla(GlobalPoint(0, 0, 0)).z());
562 
564 
565  // load trigger info
567  iEvent.getByToken(L1Token_, gtrr_handle);
568  L1GlobalTriggerReadoutRecord const* gtrr = gtrr_handle.product();
569  L1GtFdlWord fdlWord = gtrr->gtFdlWord();
570  DecisionWord L1decision = fdlWord.gtDecisionWord();
571  for (int bit = 0; bit < 128; ++bit) {
572  L1DecisionBits_[bit] = L1decision[bit];
573  }
574  DecisionWordExtended L1decisionE = fdlWord.gtDecisionWordExtended();
575  for (int bit = 0; bit < 64; ++bit) {
576  L1DecisionBits_[bit + 128] = L1decisionE[bit];
577  }
578  TechnicalTriggerWord L1technical = fdlWord.gtTechnicalTriggerWord();
579  for (int bit = 0; bit < 64; ++bit) {
580  L1TechnicalBits_[bit] = L1technical[bit];
581  }
582  orbitL1_ = fdlWord.orbitNr();
583  physicsDeclared_ = fdlWord.physicsDeclared();
585  iEvent.getByToken(HLTToken_, trh);
586  size_t ntrh = trh->size();
587  for (size_t bit = 0; bit < 256; ++bit)
588  HLTDecisionBits_[bit] = bit < ntrh ? (bool)(trh->accept(bit)) : false;
589 
590  // load beamspot
591  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
592  iEvent.getByToken(bsToken_, recoBeamSpotHandle);
593  reco::BeamSpot bs = *recoBeamSpotHandle;
594  const Point beamSpot = recoBeamSpotHandle.isValid()
595  ? Point(recoBeamSpotHandle->x0(), recoBeamSpotHandle->y0(), recoBeamSpotHandle->z0())
596  : Point(0, 0, 0);
597  if (recoBeamSpotHandle.isValid()) {
598  bsX0_ = bs.x0();
599  bsY0_ = bs.y0();
600  bsZ0_ = bs.z0();
601  bsSigmaZ_ = bs.sigmaZ();
602  bsDxdz_ = bs.dxdz();
603  bsDydz_ = bs.dydz();
604  } else {
605  bsX0_ = 0.;
606  bsY0_ = 0.;
607  bsZ0_ = 0.;
608  bsSigmaZ_ = 0.;
609  bsDxdz_ = 0.;
610  bsDydz_ = 0.;
611  }
612 
613  // load primary vertex
614  static const reco::VertexCollection s_empty_vertexColl;
615  edm::Handle<reco::VertexCollection> vertexCollectionHandle;
616  iEvent.getByToken(vertexToken_, vertexCollectionHandle);
617  const reco::VertexCollection vertexColl = *(vertexCollectionHandle.product());
618  nVertices_ = 0;
619  for (reco::VertexCollection::const_iterator v = vertexColl.begin(); v != vertexColl.end(); ++v) {
620  if (v->isValid() && !v->isFake())
621  ++nVertices_;
622  }
623 
624  // load pixel vertices
625  // Pixel vertices are handled as primary vertices, but not linked to tracks.
626  edm::Handle<reco::VertexCollection> pixelVertexCollectionHandle;
627  iEvent.getByToken(pixelVertexToken_, pixelVertexCollectionHandle);
628  const reco::VertexCollection pixelVertexColl = *(pixelVertexCollectionHandle.product());
629  nPixelVertices_ = pixelVertexColl.size();
630 
631  // load the clusters
633  iEvent.getByToken(clusterToken_, clusters);
635  iEvent.getByToken(pixelclusterToken_, pixelclusters);
636 
637  // load dedx info
638  Handle<ValueMap<DeDxData> > dEdx1Handle;
639  Handle<ValueMap<DeDxData> > dEdx2Handle;
640  Handle<ValueMap<DeDxData> > dEdx3Handle;
641  try {
642  iEvent.getByToken(dedx1Token_, dEdx1Handle);
643  } catch (cms::Exception&) {
644  ;
645  }
646  try {
647  iEvent.getByToken(dedx2Token_, dEdx2Handle);
648  } catch (cms::Exception&) {
649  ;
650  }
651  try {
652  iEvent.getByToken(dedx3Token_, dEdx3Handle);
653  } catch (cms::Exception&) {
654  ;
655  }
656  const ValueMap<DeDxData> dEdxTrack1 = *dEdx1Handle.product();
657  const ValueMap<DeDxData> dEdxTrack2 = *dEdx2Handle.product();
658  const ValueMap<DeDxData> dEdxTrack3 = *dEdx3Handle.product();
659 
660  // load track collections
661  const size_t trackSize(trackLabels_.size());
662  std::vector<reco::TrackCollection> trackCollection;
663  std::vector<edm::Handle<reco::TrackCollection> > trackCollectionHandle;
664  trackCollectionHandle.resize(trackSize);
665  size_t index = 0;
667  token != trackTokens_.end();
668  ++token, ++index) {
669  try {
670  iEvent.getByToken(*token, trackCollectionHandle[index]);
671  } catch (cms::Exception&) {
672  ;
673  }
674  trackCollection.push_back(*trackCollectionHandle[index].product());
675  ntracks_[index] = trackCollection[index].size();
676  }
677 
678  // load the trajectory collections
679  std::vector<std::vector<Trajectory> > trajectoryCollection;
680  std::vector<edm::Handle<std::vector<Trajectory> > > trajectoryCollectionHandle;
681  trajectoryCollectionHandle.resize(trackSize);
682  index = 0;
683  for (std::vector<edm::EDGetTokenT<std::vector<Trajectory> > >::const_iterator token = trajectoryTokens_.begin();
684  token != trajectoryTokens_.end();
685  ++token, ++index) {
686  try {
687  iEvent.getByToken(*token, trajectoryCollectionHandle[index]);
688  } catch (cms::Exception&) {
689  ;
690  }
691  trajectoryCollection.push_back(*trajectoryCollectionHandle[index].product());
692  ntrajs_[index] = trajectoryCollection[index].size();
693  }
694 
695  // load the tracks/traj association maps
696  std::vector<TrajTrackAssociationCollection> TrajToTrackMap;
697  Handle<TrajTrackAssociationCollection> trajTrackAssociationHandle;
699  trajTrackAssoTokens_.begin();
700  token != trajTrackAssoTokens_.end();
701  ++token) {
702  try {
703  iEvent.getByToken(*token, trajTrackAssociationHandle);
704  } catch (cms::Exception&) {
705  ;
706  }
707  TrajToTrackMap.push_back(*trajTrackAssociationHandle.product());
708  }
709 
710  // sanity check
711  if (!(!trackCollection.empty() && !trajectoryCollection.empty()))
712  return;
713 
714  // build the reverse map tracks -> vertex
715  std::vector<std::map<size_t, int> > trackVertices;
716  for (size_t i = 0; i < trackSize; ++i) {
717  trackVertices.push_back(inVertex(trackCollection[0], vertexColl, globalvertexid_ + 1));
718  }
719 
720  // iterate over vertices
722  for (reco::VertexCollection::const_iterator v = vertexColl.begin(); v != vertexColl.end(); ++v) {
723  nTracks_pvtx_ = v->tracksSize();
725  isValid_pvtx_ = int(v->isValid());
726  isFake_pvtx_ = int(v->isFake());
727  recx_pvtx_ = v->x();
728  recy_pvtx_ = v->y();
729  recz_pvtx_ = v->z();
730  recx_err_pvtx_ = v->xError();
731  recy_err_pvtx_ = v->yError();
732  recz_err_pvtx_ = v->zError();
733  globalvertexid_++;
734  vertices_->Fill();
735  }
736  }
737 
738  // iterate over pixel vertices
740  for (reco::VertexCollection::const_iterator v = pixelVertexColl.begin(); v != pixelVertexColl.end(); ++v) {
741  nTracks_pvtx_ = v->tracksSize();
743  isValid_pvtx_ = int(v->isValid());
744  isFake_pvtx_ = int(v->isFake());
745  recx_pvtx_ = v->x();
746  recy_pvtx_ = v->y();
747  recz_pvtx_ = v->z();
748  recx_err_pvtx_ = v->xError();
749  recy_err_pvtx_ = v->yError();
750  recz_err_pvtx_ = v->zError();
751  pixelVertices_->Fill();
752  }
753  }
754 
755  // determine if each cluster is on a track or not, and record the local angle
756  // to do this, we use the first track/traj collection
757  std::vector<double> clusterOntrackAngles = onTrackAngles(clusters, trajectoryCollection[0]);
758  std::vector<std::pair<double, double> > pixclusterOntrackAngles =
759  onTrackAngles(pixelclusters, trajectoryCollection[0]);
760 
761  /*
762  // iterate over trajectories
763  // note: when iterating over trajectories, it might be simpler to use the tracks/trajectories association map
764  for(std::vector<Trajectory>::const_iterator traj = trajVec.begin(); traj< trajVec.end(); ++traj) {
765  }
766  // loop over all rechits from trajectories
767  //iterate over trajectories
768  for(std::vector<Trajectory>::const_iterator traj = trajVec.begin(); traj< trajVec.end(); ++traj) {
769  Trajectory::DataContainer measurements = traj->measurements();
770  // iterate over measurements
771  for(Trajectory::DataContainer::iterator meas = measurements.begin(); meas!= measurements.end(); ++meas) {
772  }
773  }
774 */
775 
776  // determine if each cluster is on a track or not, and record the trackid
777  std::vector<std::vector<int> > stripClusterOntrackIndices;
778  for (size_t i = 0; i < trackSize; ++i) {
779  stripClusterOntrackIndices.push_back(onTrack(clusters, trackCollection[i], globaltrackid_[i] + 1));
780  }
781  std::vector<std::vector<int> > pixelClusterOntrackIndices;
782  for (size_t i = 0; i < trackSize; ++i) {
783  pixelClusterOntrackIndices.push_back(onTrack(pixelclusters, trackCollection[i], globaltrackid_[i] + 1));
784  }
785  nclustersOntrack_ = count_if(
786  stripClusterOntrackIndices[0].begin(), stripClusterOntrackIndices[0].end(), [](auto c) { return c != -1; });
787  npixClustersOntrack_ = count_if(
788  pixelClusterOntrackIndices[0].begin(), pixelClusterOntrackIndices[0].end(), [](auto c) { return c != -1; });
789 
790  // iterate over tracks
791  for (size_t coll = 0; coll < trackCollection.size(); ++coll) {
792  uint32_t n_hits_barrel = 0;
793  uint32_t n_hits_lowprob = 0;
794  for (TrajTrackAssociationCollection::const_iterator it = TrajToTrackMap[coll].begin();
795  it != TrajToTrackMap[coll].end();
796  ++it) {
797  reco::TrackRef itTrack = it->val;
798  edm::Ref<std::vector<Trajectory> > traj = it->key; // bug to find type of the key
799  eta_ = itTrack->eta();
800  phi_ = itTrack->phi();
801  try { // not all track collections have the dedx info... indeed at best one.
802  dedxNoM_ = dEdxTrack1[itTrack].numberOfMeasurements();
803  dedx1_ = dEdxTrack1[itTrack].dEdx();
804  dedx2_ = dEdxTrack2[itTrack].dEdx();
805  dedx3_ = dEdxTrack3[itTrack].dEdx();
806  } catch (cms::Exception&) {
807  dedxNoM_ = 0;
808  dedx1_ = 0.;
809  dedx2_ = 0.;
810  dedx3_ = 0.;
811  }
812  charge_ = itTrack->charge();
813  quality_ = itTrack->qualityMask();
814  foundhits_ = itTrack->found();
815  lostHits_ = itTrack->lost();
816  foundhitsStrips_ = itTrack->hitPattern().numberOfValidStripHits();
817  foundhitsPixels_ = itTrack->hitPattern().numberOfValidPixelHits();
818  losthitsStrips_ = itTrack->hitPattern().numberOfLostStripHits(reco::HitPattern::TRACK_HITS);
819  losthitsPixels_ = itTrack->hitPattern().numberOfLostPixelHits(reco::HitPattern::TRACK_HITS);
820  nLayers_ = uint32_t(itTrack->hitPattern().trackerLayersWithMeasurement());
821  p_ = itTrack->p();
822  pt_ = itTrack->pt();
823  chi2_ = itTrack->chi2();
824  ndof_ = (uint32_t)itTrack->ndof();
825  dz_ = itTrack->dz();
826  dzerr_ = itTrack->dzError();
827  dzCorr_ = itTrack->dz(beamSpot);
828  dxy_ = itTrack->dxy();
829  dxyerr_ = itTrack->dxyError();
830  dxyCorr_ = itTrack->dxy(beamSpot);
831  pterr_ = itTrack->ptError();
832  etaerr_ = itTrack->etaError();
833  phierr_ = itTrack->phiError();
834  qoverp_ = itTrack->qoverp();
835  xPCA_ = itTrack->vertex().x();
836  yPCA_ = itTrack->vertex().y();
837  zPCA_ = itTrack->vertex().z();
838  try { // only one track collection (at best) is connected to the main vertex
839  if (!vertexColl.empty() && !vertexColl.begin()->isFake()) {
840  trkWeightpvtx_ = vertexColl.begin()->trackWeight(itTrack);
841  } else
842  trkWeightpvtx_ = 0.;
843  } catch (cms::Exception&) {
844  trkWeightpvtx_ = 0.;
845  }
846  globaltrackid_[coll]++;
847  std::map<size_t, int>::const_iterator theV = trackVertices[coll].find(itTrack.key());
848  vertexid_ = (theV != trackVertices[coll].end()) ? theV->second : 0;
849  // add missing hits (separate tree, common strip + pixel)
850  Trajectory::DataContainer const& measurements = traj->measurements();
852  for (Trajectory::DataContainer::const_iterator it = measurements.begin(); it != measurements.end(); ++it) {
853  TrajectoryMeasurement::ConstRecHitPointer rechit = it->recHit();
854  if (!rechit->isValid()) {
855  // detid
856  detid_ = rechit->geographicalId();
857  // status
858  type_ = rechit->getType();
859  // position
860  LocalPoint local = it->predictedState().localPosition();
861  clPositionX_ = local.x();
862  clPositionY_ = local.y();
863  // global position
864  GlobalPoint global = it->predictedState().globalPosition();
865  globalX_ = global.x();
866  globalY_ = global.y();
867  globalZ_ = global.z();
868  // position in the measurement frame
869  measX_ = 0;
870  measY_ = 0;
872  const GeomDetUnit* gdu = static_cast<const GeomDetUnit*>(tracker_->idToDetUnit(detid_));
873  if (gdu && gdu->type().isTracker()) {
874  const Topology& topo = gdu->topology();
876  measX_ = meas.x();
877  measY_ = meas.y();
878  }
879  }
880  // local error
881  LocalError error = it->predictedState().localError().positionError();
882  errorX_ = error.xx();
883  errorY_ = error.yy();
884  // fill
885  missingHits_[coll]->Fill();
886  }
887  }
888  }
889  // compute the fraction of low probability pixels... will be added to the event tree
890  for (trackingRecHit_iterator it = itTrack->recHitsBegin(); it != itTrack->recHitsEnd(); ++it) {
891  const TrackingRecHit* hit = &(**it);
892  const SiPixelRecHit* pixhit = dynamic_cast<const SiPixelRecHit*>(hit);
893  if (pixhit) {
894  DetId detId = pixhit->geographicalId();
895  if (detId.subdetId() == PixelSubdetector::PixelBarrel) {
896  ++n_hits_barrel;
897  double proba = pixhit->clusterProbability(0);
898  if (proba <= 0.0)
899  ++n_hits_lowprob;
900  }
901  }
902  }
903  // fill the track tree
905  tracks_[coll]->Fill();
906  }
907  lowPixelProbabilityFraction_[coll] = n_hits_barrel > 0 ? (float)n_hits_lowprob / n_hits_barrel : -1.;
908  }
909 
910  // iterate over clusters
911  nclusters_ = 0;
912  std::vector<double>::const_iterator angleIt = clusterOntrackAngles.begin();
913  uint32_t localCounter = 0;
914  for (edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter = clusters->begin(); DSViter != clusters->end();
915  DSViter++) {
916  edmNew::DetSet<SiStripCluster>::const_iterator begin = DSViter->begin();
918  uint32_t detid = DSViter->id();
919  nclusters_ += DSViter->size();
921  for (edmNew::DetSet<SiStripCluster>::const_iterator iter = begin; iter != end;
922  ++iter, ++angleIt, ++localCounter) {
923  siStripClusterInfo_.setCluster(*iter, detid);
924  // general quantities
925  for (size_t i = 0; i < trackSize; ++i) {
926  trackid_[i] = stripClusterOntrackIndices[i][localCounter];
927  }
928  onTrack_ = (trackid_[0] != (uint32_t)-1);
931  angle_ = *angleIt;
932  thickness_ = ((((DSViter->id() >> 25) & 0x7f) == 0xd) ||
933  ((((DSViter->id() >> 25) & 0x7f) == 0xe) && (((DSViter->id() >> 5) & 0x7) > 4)))
934  ? 500
935  : 300;
936  stripLength_ = static_cast<const StripGeomDetUnit*>(tracker_->idToDet(detid))->specificTopology().stripLength();
937  int nstrips = static_cast<const StripGeomDetUnit*>(tracker_->idToDet(detid))->specificTopology().nstrips();
939  // signal and noise with gain corrections
943  // signal and noise with gain corrections and angle corrections
944  clCorrectedCharge_ = clNormalizedCharge_ * fabs(cos(angle_)); // corrected for track angle
945  clCorrectedSignalOverNoise_ = clSignalOverNoise_ * fabs(cos(angle_)); // corrected for track angle
946  // signal and noise without gain corrections
949  // global position
950  const StripGeomDetUnit* sgdu = static_cast<const StripGeomDetUnit*>(tracker_->idToDet(detid));
953  globalX_ = gp.x();
954  globalY_ = gp.y();
955  globalZ_ = gp.z();
956  // cabling
957  detid_ = detid;
958  lldChannel_ = 1 + (int(floor(iter->barycenter())) / 256);
959  if (lldChannel_ == 2 && nstrips == 512)
960  lldChannel_ = 3;
962  clusters_->Fill();
963  }
964  }
965  }
966 
967  // iterate over pixel clusters
968  npixClusters_ = 0;
969  std::vector<std::pair<double, double> >::const_iterator pixAngleIt = pixclusterOntrackAngles.begin();
970  localCounter = 0;
971  for (edmNew::DetSetVector<SiPixelCluster>::const_iterator DSViter = pixelclusters->begin();
972  DSViter != pixelclusters->end();
973  DSViter++) {
974  edmNew::DetSet<SiPixelCluster>::const_iterator begin = DSViter->begin();
976  uint32_t detid = DSViter->id();
977  npixClusters_ += DSViter->size();
979  for (edmNew::DetSet<SiPixelCluster>::const_iterator iter = begin; iter != end;
980  ++iter, ++pixAngleIt, ++localCounter) {
981  // general quantities
982  for (size_t i = 0; i < trackSize; ++i) {
983  trackid_[i] = pixelClusterOntrackIndices[i][localCounter];
984  }
985  onTrack_ = (trackid_[0] != (uint32_t)-1);
986  clPositionX_ = iter->x();
987  clPositionY_ = iter->y();
988  clSize_ = iter->size();
989  clSizeX_ = iter->sizeX();
990  clSizeY_ = iter->sizeY();
991  alpha_ = pixAngleIt->first;
992  beta_ = pixAngleIt->second;
993  charge_ = (iter->charge()) / 1000.;
994  chargeCorr_ = charge_ * sqrt(1.0 / (1.0 / pow(tan(alpha_), 2) + 1.0 / pow(tan(beta_), 2) + 1.0)) / 1000.;
995  // global position
996  const PixelGeomDetUnit* pgdu = static_cast<const PixelGeomDetUnit*>(tracker_->idToDet(detid));
999  globalX_ = gp.x();
1000  globalY_ = gp.y();
1001  globalZ_ = gp.z();
1002  // cabling
1003  detid_ = detid;
1004  // fill
1005  pixclusters_->Fill();
1006  }
1007  }
1008  }
1009 
1010  // topological quantities - uses the first track collection
1011  EventShape shape(trackCollection[0]);
1012  math::XYZTLorentzVectorF thrust = shape.thrust();
1013  thrustValue_ = thrust.t();
1014  thrustX_ = thrust.x();
1015  thrustY_ = thrust.y();
1016  thrustZ_ = thrust.z();
1017  sphericity_ = shape.sphericity();
1018  planarity_ = shape.planarity();
1019  aplanarity_ = shape.aplanarity();
1020 
1021  // fill event tree
1023  event_->Fill();
1024 }
1025 
1026 // ------------ method called once each job just before starting event loop ------------
1027 void TrackerDpgAnalysis::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) {
1028  const auto& tTopo = iSetup.getData(tTopoToken_);
1029  tracker_ = &iSetup.getData(tkGeomToken_);
1030 
1031  //HLT names
1032  bool changed(true);
1033  if (hltConfig_.init(iRun, iSetup, HLTTag_.process(), changed)) {
1034  if (changed) {
1036  }
1037  }
1038  int i = 0;
1039  for (std::vector<std::string>::const_iterator it = hlNames_.begin(); it < hlNames_.end(); ++it) {
1040  std::cout << (i++) << " = " << (*it) << std::endl;
1041  }
1042 
1043  // read the delay offsets for each device from input files
1044  // this is only for the so-called "random delay" run
1045  std::map<uint32_t, float> delayMap = delay(delayFileNames_);
1046  TrackerMap tmap("Delays");
1047 
1048  // cabling I (readout)
1049  const auto& cabling = iSetup.getData(fedCablingToken_);
1050  auto feds = cabling.fedIds();
1051  for (auto fedid = feds.begin(); fedid < feds.end(); ++fedid) {
1052  auto connections = cabling.fedConnections(*fedid);
1053  for (auto conn = connections.begin(); conn < connections.end(); ++conn) {
1054  // Fill the "old" map to be used for lookup during analysis
1055  if (conn->isConnected())
1056  connections_.insert(std::make_pair(conn->detId(), new FedChannelConnection(*conn)));
1057  // Fill the standalone tree (once for all)
1058  if (conn->isConnected()) {
1059  detid_ = conn->detId();
1060  strncpy(moduleName_, toStringName(detid_, tTopo).c_str(), 256);
1061  strncpy(moduleId_, toStringId(detid_).c_str(), 256);
1062  lldChannel_ = conn->lldChannel();
1063  dcuId_ = conn->dcuId();
1064  fecCrate_ = conn->fecCrate();
1065  fecSlot_ = conn->fecSlot();
1066  fecRing_ = conn->fecRing();
1067  ccuAdd_ = conn->ccuAddr();
1068  ccuChan_ = conn->ccuChan();
1069  fedId_ = conn->fedId();
1070  fedCh_ = conn->fedCh();
1071  fiberLength_ = conn->fiberLength();
1072  delay_ = delayMap[dcuId_];
1073  const StripGeomDetUnit* sgdu = static_cast<const StripGeomDetUnit*>(tracker_->idToDet(detid_));
1075  globalX_ = gp.x();
1076  globalY_ = gp.y();
1077  globalZ_ = gp.z();
1078  readoutmap_->Fill();
1080  }
1081  }
1082  }
1083  if (!delayMap.empty())
1084  tmap.save(true, 0, 0, "delaymap.png");
1085 
1086  // cabling II (DCU map)
1087  std::ifstream cablingFile(cablingFileName_.c_str());
1088  if (cablingFile.is_open()) {
1089  char buffer[1024];
1090  cablingFile.getline(buffer, 1024);
1091  while (!cablingFile.eof()) {
1092  std::istringstream line(buffer);
1093  std::string name;
1094  // one line contains the PSU name + all dcuids connected to it.
1095  line >> name;
1096  strncpy(PSUname_, name.c_str(), 256);
1097  while (!line.eof()) {
1098  line >> dcuId_;
1099  psumap_->Fill();
1100  }
1101  cablingFile.getline(buffer, 1024);
1102  }
1103  } else {
1104  edm::LogWarning("BadConfig") << " The PSU file does not exist. The psumap tree will not be filled." << std::endl
1105  << " Looking for " << cablingFileName_.c_str() << "." << std::endl
1106  << " Please specify a valid filename through the PSUFileName untracked parameter.";
1107  }
1108 }
1109 
1110 // ------------ method called once each job just after ending the event loop ------------
1112  for (size_t i = 0; i < tracks_.size(); ++i) {
1113  char buffer[256];
1114  sprintf(buffer, "trackid%lu", (unsigned long)i);
1115  if (tracks_[i]->GetEntries())
1116  tracks_[i]->BuildIndex(buffer, "eventid");
1117  }
1118  /* not needed: missing hits is a high-level quantity
1119  for(size_t i = 0; i<missingHits_.size();++i) {
1120  char buffer[256];
1121  sprintf(buffer,"trackid%lu",(unsigned long)i);
1122  if(missingHits_[i]->GetEntries()) missingHits_[i]->BuildIndex(buffer);
1123  }
1124  */
1125  if (vertices_->GetEntries())
1126  vertices_->BuildIndex("vertexid", "eventid");
1127  if (event_->GetEntries())
1128  event_->BuildIndex("runid", "eventid");
1129  if (psumap_->GetEntries())
1130  psumap_->BuildIndex("dcuId");
1131  if (readoutmap_->GetEntries())
1132  readoutmap_->BuildIndex("detid", "lldChannel");
1133 }
1134 
1136  const std::vector<Trajectory>& trajVec) {
1137  std::vector<double> result;
1138  // first, build a list of positions and angles on trajectories
1139  std::multimap<const uint32_t, std::pair<LocalPoint, double> > onTrackPositions;
1140  for (std::vector<Trajectory>::const_iterator traj = trajVec.begin(); traj < trajVec.end(); ++traj) {
1141  Trajectory::DataContainer measurements = traj->measurements();
1142  for (Trajectory::DataContainer::iterator meas = measurements.begin(); meas != measurements.end(); ++meas) {
1143  double tla = meas->updatedState().localDirection().theta();
1144  insertMeasurement(onTrackPositions, &(*(meas->recHit())), tla);
1145  }
1146  }
1147  // then loop over the clusters to check
1148  double angle = 0.;
1149  for (edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter = clusters->begin(); DSViter != clusters->end();
1150  DSViter++) {
1151  edmNew::DetSet<SiStripCluster>::const_iterator begin = DSViter->begin();
1153  std::pair<std::multimap<uint32_t, std::pair<LocalPoint, double> >::const_iterator,
1154  std::multimap<uint32_t, std::pair<LocalPoint, double> >::const_iterator>
1155  range = onTrackPositions.equal_range(DSViter->id());
1156  const GeomDetUnit* gdu = static_cast<const GeomDetUnit*>(tracker_->idToDet(DSViter->id()));
1157  for (edmNew::DetSet<SiStripCluster>::const_iterator iter = begin; iter != end; ++iter) {
1158  angle = 0.;
1159  for (std::multimap<uint32_t, std::pair<LocalPoint, double> >::const_iterator cl = range.first; cl != range.second;
1160  ++cl) {
1161  if (fabs(gdu->topology().measurementPosition(cl->second.first).x() - iter->barycenter()) < 2) {
1162  angle = cl->second.second;
1163  }
1164  }
1165  result.push_back(angle);
1166  }
1167  }
1168  return result;
1169 }
1170 
1171 void TrackerDpgAnalysis::insertMeasurement(std::multimap<const uint32_t, std::pair<LocalPoint, double> >& collection,
1173  double tla) {
1174  if (!hit)
1175  return;
1176  const SiTrackerMultiRecHit* multihit = dynamic_cast<const SiTrackerMultiRecHit*>(hit);
1177  const SiStripRecHit2D* singlehit = dynamic_cast<const SiStripRecHit2D*>(hit);
1178  const SiStripRecHit1D* hit1d = dynamic_cast<const SiStripRecHit1D*>(hit);
1179  if (hit1d) { //...->33X
1180  collection.insert(std::make_pair(hit1d->geographicalId().rawId(), std::make_pair(hit1d->localPosition(), tla)));
1181  } else if (singlehit) { // 41X->...
1182  collection.insert(
1183  std::make_pair(singlehit->geographicalId().rawId(), std::make_pair(singlehit->localPosition(), tla)));
1184  } else if (multihit) {
1185  std::vector<const TrackingRecHit*> childs = multihit->recHits();
1186  for (std::vector<const TrackingRecHit*>::const_iterator it = childs.begin(); it != childs.end(); ++it) {
1187  insertMeasurement(collection, dynamic_cast<const TrackingRecHit*>(*it), tla);
1188  }
1189  }
1190 }
1191 
1193  const reco::TrackCollection& trackVec,
1194  uint32_t firstTrack) {
1195  std::vector<int> result;
1196  // first, build a list of positions and trackid on tracks
1197  std::multimap<const uint32_t, std::pair<int, int> > onTrackPositions;
1198  uint32_t trackid = firstTrack;
1199  for (reco::TrackCollection::const_iterator itTrack = trackVec.begin(); itTrack != trackVec.end();
1200  ++itTrack, ++trackid) {
1201  for (trackingRecHit_iterator it = itTrack->recHitsBegin(); it != itTrack->recHitsEnd(); ++it) {
1202  const TrackingRecHit* hit = &(**it);
1203  insertMeasurement(onTrackPositions, hit, trackid);
1204  }
1205  }
1206  // then loop over the clusters to check
1207  int thetrackid = -1;
1208  for (edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter = clusters->begin(); DSViter != clusters->end();
1209  DSViter++) {
1210  edmNew::DetSet<SiStripCluster>::const_iterator begin = DSViter->begin();
1212  std::pair<std::multimap<uint32_t, std::pair<int, int> >::const_iterator,
1213  std::multimap<uint32_t, std::pair<int, int> >::const_iterator>
1214  range = onTrackPositions.equal_range(DSViter->id());
1215  for (edmNew::DetSet<SiStripCluster>::const_iterator iter = begin; iter != end; ++iter) {
1216  thetrackid = -1;
1217  for (std::multimap<uint32_t, std::pair<int, int> >::const_iterator cl = range.first; cl != range.second; ++cl) {
1218  if (fabs(cl->second.first - iter->barycenter()) < 2) {
1219  thetrackid = cl->second.second;
1220  }
1221  }
1222  result.push_back(thetrackid);
1223  }
1224  }
1225  return result;
1226 }
1227 
1228 void TrackerDpgAnalysis::insertMeasurement(std::multimap<const uint32_t, std::pair<int, int> >& collection,
1229  const TrackingRecHit* hit,
1230  int trackid) {
1231  if (!hit)
1232  return;
1233  const SiTrackerMultiRecHit* multihit = dynamic_cast<const SiTrackerMultiRecHit*>(hit);
1234  const SiStripRecHit2D* singlehit = dynamic_cast<const SiStripRecHit2D*>(hit);
1235  const SiStripRecHit1D* hit1d = dynamic_cast<const SiStripRecHit1D*>(hit);
1236  if (hit1d) { // 41X->...
1237  collection.insert(
1238  std::make_pair(hit1d->geographicalId().rawId(), std::make_pair(int(hit1d->cluster()->barycenter()), trackid)));
1239  } else if (singlehit) { //...->33X
1240  collection.insert(std::make_pair(singlehit->geographicalId().rawId(),
1241  std::make_pair(int(singlehit->cluster()->barycenter()), trackid)));
1242  } else if (multihit) {
1243  std::vector<const TrackingRecHit*> childs = multihit->recHits();
1244  for (std::vector<const TrackingRecHit*>::const_iterator it = childs.begin(); it != childs.end(); ++it) {
1245  insertMeasurement(collection, *it, trackid);
1246  }
1247  }
1248 }
1249 
1252  uint32_t firstVertex) {
1253  // build reverse map track -> vertex
1254  std::map<size_t, int> output;
1255  uint32_t vertexid = firstVertex;
1256  for (reco::VertexCollection::const_iterator v = vertices.begin(); v != vertices.end(); ++v, ++vertexid) {
1257  reco::Vertex::trackRef_iterator it = v->tracks_begin();
1258  reco::Vertex::trackRef_iterator lastTrack = v->tracks_end();
1259  for (; it != lastTrack; ++it) {
1260  output[it->key()] = vertexid;
1261  }
1262  }
1263  return output;
1264 }
1265 
1266 std::vector<std::pair<double, double> > TrackerDpgAnalysis::onTrackAngles(
1267  edm::Handle<edmNew::DetSetVector<SiPixelCluster> >& clusters, const std::vector<Trajectory>& trajVec) {
1268  std::vector<std::pair<double, double> > result;
1269  // first, build a list of positions and angles on trajectories
1270  std::multimap<const uint32_t, std::pair<LocalPoint, std::pair<double, double> > > onTrackPositions;
1271  for (std::vector<Trajectory>::const_iterator traj = trajVec.begin(); traj < trajVec.end(); ++traj) {
1272  Trajectory::DataContainer measurements = traj->measurements();
1273  for (Trajectory::DataContainer::iterator meas = measurements.begin(); meas != measurements.end(); ++meas) {
1274  LocalVector localDir = meas->updatedState().localDirection();
1275  double alpha = atan2(localDir.z(), localDir.x());
1276  double beta = atan2(localDir.z(), localDir.y());
1277  insertMeasurement(onTrackPositions, &(*(meas->recHit())), alpha, beta);
1278  }
1279  }
1280  // then loop over the clusters to check
1281  double alpha = 0.;
1282  double beta = 0.;
1283  for (edmNew::DetSetVector<SiPixelCluster>::const_iterator DSViter = clusters->begin(); DSViter != clusters->end();
1284  DSViter++) {
1285  edmNew::DetSet<SiPixelCluster>::const_iterator begin = DSViter->begin();
1287  for (edmNew::DetSet<SiPixelCluster>::const_iterator iter = begin; iter != end; ++iter) {
1288  alpha = 0.;
1289  beta = 0.;
1290  std::pair<std::multimap<uint32_t, std::pair<LocalPoint, std::pair<double, double> > >::const_iterator,
1291  std::multimap<uint32_t, std::pair<LocalPoint, std::pair<double, double> > >::const_iterator>
1292  range = onTrackPositions.equal_range(DSViter->id());
1293  const GeomDetUnit* gdu = static_cast<const GeomDetUnit*>(tracker_->idToDet(DSViter->id()));
1294  for (std::multimap<uint32_t, std::pair<LocalPoint, std::pair<double, double> > >::const_iterator cl = range.first;
1295  cl != range.second;
1296  ++cl) {
1297  if (fabs(gdu->topology().measurementPosition(cl->second.first).x() - iter->x()) < 2 &&
1298  fabs(gdu->topology().measurementPosition(cl->second.first).y() - iter->y()) < 2) {
1299  alpha = cl->second.second.first;
1300  beta = cl->second.second.second;
1301  }
1302  }
1303  result.push_back(std::make_pair(alpha, beta));
1304  }
1305  }
1306  return result;
1307 }
1308 
1310  std::multimap<const uint32_t, std::pair<LocalPoint, std::pair<double, double> > >& collection,
1312  double alpha,
1313  double beta) {
1314  if (!hit)
1315  return;
1316  const SiPixelRecHit* pixhit = dynamic_cast<const SiPixelRecHit*>(hit);
1317  if (pixhit) {
1318  collection.insert(std::make_pair(pixhit->geographicalId().rawId(),
1319  std::make_pair(pixhit->localPosition(), std::make_pair(alpha, beta))));
1320  }
1321 }
1322 
1324  const reco::TrackCollection& trackVec,
1325  uint32_t firstTrack) {
1326  std::vector<int> result;
1327  // first, build a list of positions and trackid on tracks
1328  std::multimap<const uint32_t, std::pair<std::pair<float, float>, int> > onTrackPositions;
1329  uint32_t trackid = firstTrack;
1330  for (reco::TrackCollection::const_iterator itTrack = trackVec.begin(); itTrack != trackVec.end();
1331  ++itTrack, ++trackid) {
1332  for (trackingRecHit_iterator it = itTrack->recHitsBegin(); it != itTrack->recHitsEnd(); ++it) {
1333  const TrackingRecHit* hit = &(**it);
1334  insertMeasurement(onTrackPositions, hit, trackid);
1335  }
1336  }
1337  // then loop over the clusters to check
1338  int thetrackid = -1;
1339  for (edmNew::DetSetVector<SiPixelCluster>::const_iterator DSViter = clusters->begin(); DSViter != clusters->end();
1340  DSViter++) {
1341  edmNew::DetSet<SiPixelCluster>::const_iterator begin = DSViter->begin();
1343  for (edmNew::DetSet<SiPixelCluster>::const_iterator iter = begin; iter != end; ++iter) {
1344  thetrackid = -1;
1345  std::pair<std::multimap<uint32_t, std::pair<std::pair<float, float>, int> >::const_iterator,
1346  std::multimap<uint32_t, std::pair<std::pair<float, float>, int> >::const_iterator>
1347  range = onTrackPositions.equal_range(DSViter->id());
1348  for (std::multimap<uint32_t, std::pair<std::pair<float, float>, int> >::const_iterator cl = range.first;
1349  cl != range.second;
1350  ++cl) {
1351  if ((fabs(cl->second.first.first - iter->x()) < 2) && (fabs(cl->second.first.second - iter->y()) < 2)) {
1352  thetrackid = cl->second.second;
1353  }
1354  }
1355  result.push_back(thetrackid);
1356  }
1357  }
1358  return result;
1359 }
1360 
1362  std::multimap<const uint32_t, std::pair<std::pair<float, float>, int> >& collection,
1363  const TrackingRecHit* hit,
1364  int trackid) {
1365  if (!hit)
1366  return;
1367  const SiPixelRecHit* pixhit = dynamic_cast<const SiPixelRecHit*>(hit);
1368  if (pixhit) {
1369  collection.insert(
1370  std::make_pair(pixhit->geographicalId().rawId(),
1371  std::make_pair(std::make_pair(pixhit->cluster()->x(), pixhit->cluster()->y()), trackid)));
1372  }
1373 }
1374 
1376  SiStripDetId detid(rawid);
1377  std::string out;
1378  std::stringstream output;
1379  switch (detid.subDetector()) {
1380  case 3: {
1381  output << "TIB";
1382 
1383  output << (tTopo.tibIsZPlusSide(rawid) ? "+" : "-");
1384  output << " layer ";
1385  output << tTopo.tibLayer(rawid);
1386  output << ", string ";
1387  output << tTopo.tibString(rawid);
1388  output << (tTopo.tibIsExternalString(rawid) ? " external" : " internal");
1389  output << ", module ";
1390  output << tTopo.tibModule(rawid);
1391  if (tTopo.tibIsDoubleSide(rawid)) {
1392  output << " (double)";
1393  } else {
1394  output << (tTopo.tibIsRPhi(rawid) ? " (rphi)" : " (stereo)");
1395  }
1396  break;
1397  }
1398  case 4: {
1399  output << "TID";
1400 
1401  output << (tTopo.tidIsZPlusSide(rawid) ? "+" : "-");
1402  output << " disk ";
1403  output << tTopo.tidWheel(rawid);
1404  output << ", ring ";
1405  output << tTopo.tidRing(rawid);
1406  output << (tTopo.tidIsFrontRing(rawid) ? " front" : " back");
1407  output << ", module ";
1408  output << tTopo.tidModule(rawid);
1409  if (tTopo.tidIsDoubleSide(rawid)) {
1410  output << " (double)";
1411  } else {
1412  output << (tTopo.tidIsRPhi(rawid) ? " (rphi)" : " (stereo)");
1413  }
1414  break;
1415  }
1416  case 5: {
1417  output << "TOB";
1418 
1419  output << (tTopo.tobIsZPlusSide(rawid) ? "+" : "-");
1420  output << " layer ";
1421  output << tTopo.tobLayer(rawid);
1422  output << ", rod ";
1423  output << tTopo.tobRod(rawid);
1424  output << ", module ";
1425  output << tTopo.tobModule(rawid);
1426  if (tTopo.tobIsDoubleSide(rawid)) {
1427  output << " (double)";
1428  } else {
1429  output << (tTopo.tobIsRPhi(rawid) ? " (rphi)" : " (stereo)");
1430  }
1431  break;
1432  }
1433  case 6: {
1434  output << "TEC";
1435 
1436  output << (tTopo.tecIsZPlusSide(rawid) ? "+" : "-");
1437  output << " disk ";
1438  output << tTopo.tecWheel(rawid);
1439  output << " sector ";
1440  output << tTopo.tecPetalNumber(rawid);
1441  output << (tTopo.tecIsFrontPetal(rawid) ? " Front Petal" : " Back Petal");
1442  output << ", module ";
1443  output << tTopo.tecRing(rawid);
1444  output << tTopo.tecModule(rawid);
1445  if (tTopo.tecIsDoubleSide(rawid)) {
1446  output << " (double)";
1447  } else {
1448  output << (tTopo.tecIsRPhi(rawid) ? " (rphi)" : " (stereo)");
1449  }
1450  break;
1451  }
1452  default: {
1453  output << "UNKNOWN";
1454  }
1455  }
1456  out = output.str();
1457  return out;
1458 }
1459 
1461  std::string out;
1462  std::stringstream output;
1463  output << rawid << " (0x" << std::hex << rawid << std::dec << ")";
1464  out = output.str();
1465  return out;
1466 }
1467 
1469  double sum = 0.;
1470  double pT;
1471  for (reco::Vertex::trackRef_iterator it = v.tracks_begin(); it != v.tracks_end(); it++) {
1472  pT = (**it).pt();
1473  sum += pT * pT;
1474  }
1475  return sum;
1476 }
1477 
1479  float delay = const_cast<SiStripEventSummary&>(summary).ttcrx();
1480  uint32_t latencyCode = (const_cast<SiStripEventSummary&>(summary).layerScanned() >> 24) & 0xff;
1481  int latencyShift =
1482  latencyCode & 0x3f; // number of bunch crossings between current value and start of scan... must be positive
1483  if (latencyShift > 32)
1484  latencyShift -= 64; // allow negative values: we cover [-32,32].. should not be needed.
1485  if ((latencyCode >> 6) == 2)
1486  latencyShift -= 3; // layer in deconv, rest in peak
1487  if ((latencyCode >> 6) == 1)
1488  latencyShift += 3; // layer in peak, rest in deconv
1489  float correctedDelay =
1490  delay - (latencyShift * 25.); // shifts the delay so that 0 corresponds to the current settings.
1491  return correctedDelay;
1492 }
1493 
1494 std::map<uint32_t, float> TrackerDpgAnalysis::delay(const std::vector<std::string>& files) {
1495  // prepare output
1496  uint32_t dcuid;
1497  float delay;
1498  std::map<uint32_t, float> delayMap;
1499  //iterator over input files
1500  for (std::vector<std::string>::const_iterator file = files.begin(); file < files.end(); ++file) {
1501  // open the file
1502  std::ifstream cablingFile(file->c_str());
1503  if (cablingFile.is_open()) {
1504  char buffer[1024];
1505  // read one line
1506  cablingFile.getline(buffer, 1024);
1507  while (!cablingFile.eof()) {
1509  size_t pos = line.find("dcuid");
1510  // one line containing dcuid
1511  if (pos != std::string::npos) {
1512  // decode dcuid
1513  std::string dcuids = line.substr(pos + 7, line.find(' ', pos) - pos - 8);
1514  std::istringstream dcuidstr(dcuids);
1515  dcuidstr >> std::hex >> dcuid;
1516  // decode delay
1517  pos = line.find("difpll");
1518  std::string diffs = line.substr(pos + 8, line.find(' ', pos) - pos - 9);
1519  std::istringstream diffstr(diffs);
1520  diffstr >> delay;
1521  // fill the map
1522  delayMap[dcuid] = delay;
1523  }
1524  // iterate
1525  cablingFile.getline(buffer, 1024);
1526  }
1527  } else {
1528  edm::LogWarning("BadConfig") << " The delay file does not exist. The delay map will not be filled properly."
1529  << std::endl
1530  << " Looking for " << file->c_str() << "." << std::endl
1531  << " Please specify valid filenames through the DelayFileNames untracked parameter.";
1532  }
1533  }
1534  return delayMap;
1535 }
1536 
1537 //define this as a plug-in
ClusterRef cluster() const
Definition: SiPixelRecHit.h:47
const cms_uint32_t orbitNr() const
get/set orbit number
Definition: L1GtFdlWord.h:235
unsigned int tecPetalNumber(const DetId &id) const
static const std::string kSharedResource
Definition: TFileService.h:76
bool accept() const
Has at least one path accepted the event?
bool tibIsDoubleSide(const DetId &id) const
bool tecIsDoubleSide(const DetId &id) const
std::vector< TTree * > tracks_
bool tidIsDoubleSide(const DetId &id) const
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
float alpha
Definition: AMPTWrapper.h:105
bool tidIsZPlusSide(const DetId &id) const
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
unsigned int tobLayer(const DetId &id) const
void beginRun(const edm::Run &, const edm::EventSetup &) override
const cms_uint16_t physicsDeclared() const
get/set "physics declared" bit
Definition: L1GtFdlWord.h:169
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
bool tibIsZPlusSide(const DetId &id) const
void setCluster(const SiStripCluster &cluster, int detId)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
edm::ParameterSet pset_
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
bool isTracker() const
Definition: GeomDetType.cc:21
std::vector< int > onTrack(edm::Handle< edmNew::DetSetVector< SiStripCluster > > &, const reco::TrackCollection &, uint32_t)
const DecisionWordExtended & gtDecisionWordExtended() const
get/set extended algorithms bits (extended decision word)
Definition: L1GtFdlWord.h:153
bool tecIsFrontPetal(const DetId &id) const
double sumPtSquared(const reco::Vertex &)
static float planarity(const reco::TrackCollection &)
Definition: EventShape.cc:275
T z() const
Definition: PV3DBase.h:61
unsigned int tibModule(const DetId &id) const
virtual const Topology & topology() const
Definition: GeomDet.cc:67
bool tibIsExternalString(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
edm::EDGetTokenT< edm::TriggerResults > HLTToken_
T const * product() const
Definition: Handle.h:70
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::multimap< const uint32_t, const FedChannelConnection * > connections_
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
unsigned int tibString(const DetId &id) const
unsigned long long EventNumber_t
const TrackerGeometry * tracker_
SubDetector subDetector() const
Definition: SiStripDetId.h:105
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
SiStripClusterInfo siStripClusterInfo_
data_type const * const_iterator
Definition: DetSetNew.h:31
static math::XYZTLorentzVectorF thrust(const reco::TrackCollection &)
Definition: EventShape.cc:124
T x() const
Definition: PV2DBase.h:43
std::string toStringId(uint32_t)
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
virtual const GeomDetType & type() const
Definition: GeomDet.cc:69
void analyze(const edm::Event &, const edm::EventSetup &) override
const L1GtFdlWord gtFdlWord(int bxInEventValue) const
get / set FDL word (record) in the GT readout record
unsigned int tecRing(const DetId &id) const
ring id
ClusterRef cluster() const
key_type key() const
Accessor for product key.
Definition: Ref.h:250
bool tobIsDoubleSide(const DetId &id) const
static float sphericity(const reco::TrackCollection &)
Definition: EventShape.cc:215
edm::EDGetTokenT< reco::BeamSpot > bsToken_
float signalOverNoise() const
T getUntrackedParameter(std::string const &, T const &) const
T y() const
Definition: PV2DBase.h:44
bool tibIsRPhi(const DetId &id) const
double x0() const
x coordinate
Definition: BeamSpot.h:61
T x() const
Definition: PV3DBase.h:59
unsigned int tidModule(const DetId &id) const
T y() const
Definition: PV3DBase.h:60
std::vector< bool > DecisionWordExtended
unsigned int tecModule(const DetId &id) const
unsigned int size() const
Get number of paths stored.
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
int iEvent
Definition: GenABIO.cc:224
std::vector< TrajectoryMeasurement > DataContainer
Definition: Trajectory.h:40
std::vector< std::string > delayFileNames_
Class containning control, module, detector and connection information, at the level of a FED channel...
std::vector< bool > DecisionWord
typedefs
edm::EventNumber_t eventid_
T sqrt(T t)
Definition: SSEVec.h:19
void save(bool print_total=true, float minval=0., float maxval=0., std::string s="svgmap.svg", int width=1500, int height=800)
Definition: TrackerMap.cc:811
static const int nMaxPVs_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
math::XYZPoint Point
uint8_t maxCharge() const
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > L1Token_
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
static float aplanarity(const reco::TrackCollection &)
Definition: EventShape.cc:246
Transition
Definition: Transition.h:12
std::vector< bool > TechnicalTriggerWord
technical trigger bits (64 bits)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
double y0() const
y coordinate
Definition: BeamSpot.h:63
std::vector< double > onTrackAngles(edm::Handle< edmNew::DetSetVector< SiStripCluster > > &, const std::vector< Trajectory > &)
bool tobIsZPlusSide(const DetId &id) const
float clusterProbability(unsigned int flags=0) const
Definition: SiPixelRecHit.cc:9
trackCollection
Definition: JetHT_cfg.py:51
const TrackerGeomDet * idToDet(DetId) const override
const DecisionWord & gtDecisionWord() const
get/set/print algorithms bits (decision word)
Definition: L1GtFdlWord.h:128
std::vector< edm::InputTag > trackLabels_
edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcd > fedCablingToken_
float noiseRescaledByGain() const
HLTConfigProvider hltConfig_
bool tobIsRPhi(const DetId &id) const
bool tidIsRPhi(const DetId &id) const
bool tecIsRPhi(const DetId &id) const
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
bool tidIsFrontRing(const DetId &id) const
void insertMeasurement(std::multimap< const uint32_t, std::pair< LocalPoint, double > > &, const TransientTrackingRecHit *, double)
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
edm::EDGetTokenT< SiStripEventSummary > summaryToken_
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
Definition: DetId.h:17
std::vector< edm::EDGetTokenT< reco::TrackCollection > > trackTokens_
void endRun(const edm::Run &, const edm::EventSetup &) override
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > dedx2Token_
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
TrackerDpgAnalysis(const edm::ParameterSet &)
DetId geographicalId() const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
const TechnicalTriggerWord & gtTechnicalTriggerWord() const
get/set technical trigger bits
Definition: L1GtFdlWord.h:112
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
TrackingRecHit::ConstRecHitPointer ConstRecHitPointer
bool tecIsZPlusSide(const DetId &id) const
uint16_t width() const
std::map< size_t, int > inVertex(const reco::TrackCollection &, const reco::VertexCollection &, uint32_t)
unsigned int tobRod(const DetId &id) const
const std::vector< std::string > & triggerNames() const
names of trigger paths
bool isValid() const
Definition: HandleBase.h:70
double z0() const
z coordinate
Definition: BeamSpot.h:65
fixed size matrix
float delay(const SiStripEventSummary &)
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > dedx1Token_
HLT enums.
Structure Point Contains parameters of Gaussian fits to DMRs.
std::vector< TTree * > missingHits_
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelclusterToken_
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
std::vector< edm::EDGetTokenT< TrajTrackAssociationCollection > > trajTrackAssoTokens_
LocalPoint localPosition() const override
conn
Definition: getInfo.py:9
edm::EDGetTokenT< edm::ValueMap< reco::DeDxData > > dedx3Token_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusterToken_
unsigned int tidRing(const DetId &id) const
virtual LocalPoint localPosition(float strip) const =0
void fill_current_val(int idmod, float current_val)
Definition: TrackerMap.cc:3259
unsigned int tibLayer(const DetId &id) const
unsigned int tobModule(const DetId &id) const
uint16_t charge() const
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< float > > XYZTLorentzVectorF
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:22
Log< level::Warning, false > LogWarning
void initEvent(const edm::EventSetup &iSetup)
std::string const & process() const
Definition: InputTag.h:40
float baryStrip() const
ClusterRef cluster() const
std::vector< edm::EDGetTokenT< std::vector< Trajectory > > > trajectoryTokens_
edm::EDGetTokenT< reco::VertexCollection > pixelVertexToken_
std::string toStringName(uint32_t, const TrackerTopology &)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition: Vertex.h:38
std::vector< std::string > hlNames_
std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)
Definition: Run.h:45
Our base class.
Definition: SiPixelRecHit.h:23
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11