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