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