CMS 3D CMS Logo

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