CMS 3D CMS Logo

TICLDumper.cc
Go to the documentation of this file.
1 // Original Authors: Philipp Zehetner, Wahid Redjeb
2 
3 #include "TTree.h"
4 #include "TFile.h"
5 
6 #include <iostream>
7 #include <fstream>
8 #include <sstream>
9 #include <variant>
10 
11 #include <memory> // unique_ptr
23 
35 
40 
43 
47 
51 
54 
55 // TFileService
58 
59 class TICLDumper : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one::SharedResources> {
60 public:
61  explicit TICLDumper(const edm::ParameterSet&);
62  ~TICLDumper() override;
63  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
65  typedef std::vector<double> Vec;
66 
67 private:
68  void beginJob() override;
69  void beginRun(const edm::Run&, const edm::EventSetup&) override;
70 
71  void initialize(const HGCalDDDConstants* hgcons,
72  const hgcal::RecHitTools rhtools,
73  const edm::ESHandle<MagneticField> bfieldH,
74  const edm::ESHandle<Propagator> propH);
75  void buildLayers();
76 
77  void analyze(const edm::Event&, const edm::EventSetup&) override;
78  void endRun(edm::Run const& iEvent, edm::EventSetup const&) override{};
79  void endJob() override;
80 
81  // Define Tokens
118 
127  std::unique_ptr<GeomDet> firstDisk_[2];
128  std::unique_ptr<GeomDet> interfaceDisk_[2];
131  bool saveLCs_;
140 
141  // Output tree
142  TTree* tree_;
143 
144  void clearVariables();
145 
146  // Variables for branches
147  unsigned int ev_event_;
148  unsigned int ntracksters_;
149  unsigned int nclusters_;
150  unsigned int stsSC_ntracksters_;
151  unsigned int stsCP_ntracksters_;
154 
155  std::vector<float> trackster_time;
156  std::vector<float> trackster_timeError;
157  std::vector<float> trackster_regressed_energy;
158  std::vector<float> trackster_raw_energy;
159  std::vector<float> trackster_raw_em_energy;
160  std::vector<float> trackster_raw_pt;
161  std::vector<float> trackster_raw_em_pt;
162  std::vector<float> trackster_barycenter_x;
163  std::vector<float> trackster_barycenter_y;
164  std::vector<float> trackster_barycenter_z;
165  std::vector<float> trackster_EV1;
166  std::vector<float> trackster_EV2;
167  std::vector<float> trackster_EV3;
168  std::vector<float> trackster_eVector0_x;
169  std::vector<float> trackster_eVector0_y;
170  std::vector<float> trackster_eVector0_z;
171  std::vector<float> trackster_sigmaPCA1;
172  std::vector<float> trackster_sigmaPCA2;
173  std::vector<float> trackster_sigmaPCA3;
174  std::vector<float> trackster_barycenter_eta;
175  std::vector<float> trackster_barycenter_phi;
176  std::vector<std::vector<float>> trackster_id_probabilities;
177  std::vector<std::vector<uint32_t>> trackster_vertices_indexes;
178  std::vector<std::vector<float>> trackster_vertices_x;
179  std::vector<std::vector<float>> trackster_vertices_y;
180  std::vector<std::vector<float>> trackster_vertices_z;
181  std::vector<std::vector<float>> trackster_vertices_time;
182  std::vector<std::vector<float>> trackster_vertices_timeErr;
183  std::vector<std::vector<float>> trackster_vertices_energy;
184  std::vector<std::vector<float>> trackster_vertices_correctedEnergy;
185  std::vector<std::vector<float>> trackster_vertices_correctedEnergyUncertainty;
186  std::vector<std::vector<float>> trackster_vertices_multiplicity;
187 
188  std::vector<float> stsSC_trackster_time;
189  std::vector<float> stsSC_trackster_timeError;
191  std::vector<float> stsSC_trackster_regressed_pt;
192  std::vector<float> stsSC_trackster_raw_energy;
193  std::vector<float> stsSC_trackster_raw_em_energy;
194  std::vector<float> stsSC_trackster_raw_pt;
195  std::vector<float> stsSC_trackster_raw_em_pt;
196  std::vector<float> stsSC_trackster_barycenter_x;
197  std::vector<float> stsSC_trackster_barycenter_y;
198  std::vector<float> stsSC_trackster_barycenter_z;
199  std::vector<float> stsSC_trackster_barycenter_eta;
200  std::vector<float> stsSC_trackster_barycenter_phi;
201  std::vector<float> stsSC_trackster_EV1;
202  std::vector<float> stsSC_trackster_EV2;
203  std::vector<float> stsSC_trackster_EV3;
204  std::vector<float> stsSC_trackster_eVector0_x;
205  std::vector<float> stsSC_trackster_eVector0_y;
206  std::vector<float> stsSC_trackster_eVector0_z;
207  std::vector<float> stsSC_trackster_sigmaPCA1;
208  std::vector<float> stsSC_trackster_sigmaPCA2;
209  std::vector<float> stsSC_trackster_sigmaPCA3;
210  std::vector<int> stsSC_pdgID;
211  std::vector<int> stsSC_trackIdx;
212  std::vector<float> stsSC_trackTime;
213  std::vector<float> stsSC_boundaryX;
214  std::vector<float> stsSC_boundaryY;
215  std::vector<float> stsSC_boundaryZ;
216  std::vector<float> stsSC_boundaryEta;
217  std::vector<float> stsSC_boundaryPhi;
218  std::vector<float> stsSC_boundaryPx;
219  std::vector<float> stsSC_boundaryPy;
220  std::vector<float> stsSC_boundaryPz;
221  std::vector<float> stsSC_track_boundaryX;
222  std::vector<float> stsSC_track_boundaryY;
223  std::vector<float> stsSC_track_boundaryZ;
224  std::vector<float> stsSC_track_boundaryEta;
225  std::vector<float> stsSC_track_boundaryPhi;
226  std::vector<float> stsSC_track_boundaryPx;
227  std::vector<float> stsSC_track_boundaryPy;
228  std::vector<float> stsSC_track_boundaryPz;
229  std::vector<std::vector<float>> stsSC_trackster_id_probabilities;
230  std::vector<std::vector<uint32_t>> stsSC_trackster_vertices_indexes;
231  std::vector<std::vector<float>> stsSC_trackster_vertices_x;
232  std::vector<std::vector<float>> stsSC_trackster_vertices_y;
233  std::vector<std::vector<float>> stsSC_trackster_vertices_z;
234  std::vector<std::vector<float>> stsSC_trackster_vertices_time;
235  std::vector<std::vector<float>> stsSC_trackster_vertices_timeErr;
236  std::vector<std::vector<float>> stsSC_trackster_vertices_energy;
237  std::vector<std::vector<float>> stsSC_trackster_vertices_correctedEnergy;
239  std::vector<std::vector<float>> stsSC_trackster_vertices_multiplicity;
240  std::vector<float> stsCP_trackster_time;
241  std::vector<float> stsCP_trackster_timeError;
243  std::vector<float> stsCP_trackster_regressed_pt;
244  std::vector<float> stsCP_trackster_raw_energy;
245  std::vector<float> stsCP_trackster_raw_em_energy;
246  std::vector<float> stsCP_trackster_raw_pt;
247  std::vector<float> stsCP_trackster_raw_em_pt;
248  std::vector<float> stsCP_trackster_barycenter_x;
249  std::vector<float> stsCP_trackster_barycenter_y;
250  std::vector<float> stsCP_trackster_barycenter_z;
251  std::vector<float> stsCP_trackster_barycenter_eta;
252  std::vector<float> stsCP_trackster_barycenter_phi;
253  std::vector<float> stsCP_trackster_EV1;
254  std::vector<float> stsCP_trackster_EV2;
255  std::vector<float> stsCP_trackster_EV3;
256  std::vector<float> stsCP_trackster_eVector0_x;
257  std::vector<float> stsCP_trackster_eVector0_y;
258  std::vector<float> stsCP_trackster_eVector0_z;
259  std::vector<float> stsCP_trackster_sigmaPCA1;
260  std::vector<float> stsCP_trackster_sigmaPCA2;
261  std::vector<float> stsCP_trackster_sigmaPCA3;
262  std::vector<int> stsCP_pdgID;
263  std::vector<int> stsCP_trackIdx;
264  std::vector<float> stsCP_trackTime;
265  std::vector<float> stsCP_boundaryX;
266  std::vector<float> stsCP_boundaryY;
267  std::vector<float> stsCP_boundaryZ;
268  std::vector<float> stsCP_boundaryEta;
269  std::vector<float> stsCP_boundaryPhi;
270  std::vector<float> stsCP_boundaryPx;
271  std::vector<float> stsCP_boundaryPy;
272  std::vector<float> stsCP_boundaryPz;
273  std::vector<float> stsCP_track_boundaryX;
274  std::vector<float> stsCP_track_boundaryY;
275  std::vector<float> stsCP_track_boundaryZ;
276  std::vector<float> stsCP_track_boundaryEta;
277  std::vector<float> stsCP_track_boundaryPhi;
278  std::vector<float> stsCP_track_boundaryPx;
279  std::vector<float> stsCP_track_boundaryPy;
280  std::vector<float> stsCP_track_boundaryPz;
281  std::vector<std::vector<float>> stsCP_trackster_id_probabilities;
282  std::vector<std::vector<uint32_t>> stsCP_trackster_vertices_indexes;
283  std::vector<std::vector<float>> stsCP_trackster_vertices_x;
284  std::vector<std::vector<float>> stsCP_trackster_vertices_y;
285  std::vector<std::vector<float>> stsCP_trackster_vertices_z;
286  std::vector<std::vector<float>> stsCP_trackster_vertices_time;
287  std::vector<std::vector<float>> stsCP_trackster_vertices_timeErr;
288  std::vector<std::vector<float>> stsCP_trackster_vertices_energy;
289  std::vector<std::vector<float>> stsCP_trackster_vertices_correctedEnergy;
291  std::vector<std::vector<float>> stsCP_trackster_vertices_multiplicity;
292 
293  std::vector<float> simTICLCandidate_raw_energy;
295  std::vector<std::vector<int>> simTICLCandidate_simTracksterCPIndex;
296  std::vector<float> simTICLCandidate_boundaryX;
297  std::vector<float> simTICLCandidate_boundaryY;
298  std::vector<float> simTICLCandidate_boundaryZ;
299  std::vector<float> simTICLCandidate_boundaryPx;
300  std::vector<float> simTICLCandidate_boundaryPy;
301  std::vector<float> simTICLCandidate_boundaryPz;
302  std::vector<float> simTICLCandidate_trackTime;
303  std::vector<float> simTICLCandidate_trackBeta;
305  std::vector<int> simTICLCandidate_pdgId;
306  std::vector<int> simTICLCandidate_charge;
308 
309  // from TICLCandidate, product of linking
310  size_t nCandidates;
311  std::vector<int> candidate_charge;
312  std::vector<int> candidate_pdgId;
313  std::vector<float> candidate_energy;
314  std::vector<double> candidate_px;
315  std::vector<double> candidate_py;
316  std::vector<double> candidate_pz;
317  std::vector<float> candidate_time;
318  std::vector<float> candidate_time_err;
319  std::vector<std::vector<float>> candidate_id_probabilities;
320  std::vector<std::vector<uint32_t>> tracksters_in_candidate;
321  std::vector<int> track_in_candidate;
322 
323  // merged tracksters
325  std::vector<float> tracksters_merged_time;
326  std::vector<float> tracksters_merged_timeError;
328  std::vector<float> tracksters_merged_raw_energy;
330  std::vector<float> tracksters_merged_raw_pt;
331  std::vector<float> tracksters_merged_raw_em_pt;
332  std::vector<float> tracksters_merged_barycenter_x;
333  std::vector<float> tracksters_merged_barycenter_y;
334  std::vector<float> tracksters_merged_barycenter_z;
337  std::vector<float> tracksters_merged_EV1;
338  std::vector<float> tracksters_merged_EV2;
339  std::vector<float> tracksters_merged_EV3;
340  std::vector<float> tracksters_merged_eVector0_x;
341  std::vector<float> tracksters_merged_eVector0_y;
342  std::vector<float> tracksters_merged_eVector0_z;
343  std::vector<float> tracksters_merged_sigmaPCA1;
344  std::vector<float> tracksters_merged_sigmaPCA2;
345  std::vector<float> tracksters_merged_sigmaPCA3;
346  std::vector<std::vector<uint32_t>> tracksters_merged_vertices_indexes;
347  std::vector<std::vector<float>> tracksters_merged_vertices_x;
348  std::vector<std::vector<float>> tracksters_merged_vertices_y;
349  std::vector<std::vector<float>> tracksters_merged_vertices_z;
350  std::vector<std::vector<float>> tracksters_merged_vertices_time;
351  std::vector<std::vector<float>> tracksters_merged_vertices_timeErr;
352  std::vector<std::vector<float>> tracksters_merged_vertices_energy;
353  std::vector<std::vector<float>> tracksters_merged_vertices_correctedEnergy;
355  std::vector<std::vector<float>> tracksters_merged_vertices_multiplicity;
356  std::vector<std::vector<float>> tracksters_merged_id_probabilities;
357 
358  // associations
359  std::vector<std::vector<uint32_t>> trackstersCLUE3D_recoToSim_SC;
360  std::vector<std::vector<float>> trackstersCLUE3D_recoToSim_SC_score;
361  std::vector<std::vector<float>> trackstersCLUE3D_recoToSim_SC_sharedE;
362  std::vector<std::vector<uint32_t>> trackstersCLUE3D_simToReco_SC;
363  std::vector<std::vector<float>> trackstersCLUE3D_simToReco_SC_score;
364  std::vector<std::vector<float>> trackstersCLUE3D_simToReco_SC_sharedE;
365 
366  std::vector<std::vector<uint32_t>> trackstersCLUE3D_recoToSim_CP;
367  std::vector<std::vector<float>> trackstersCLUE3D_recoToSim_CP_score;
368  std::vector<std::vector<float>> trackstersCLUE3D_recoToSim_CP_sharedE;
369  std::vector<std::vector<uint32_t>> trackstersCLUE3D_simToReco_CP;
370  std::vector<std::vector<float>> trackstersCLUE3D_simToReco_CP_score;
371  std::vector<std::vector<float>> trackstersCLUE3D_simToReco_CP_sharedE;
372 
373  std::vector<std::vector<uint32_t>> MergeTracksters_recoToSim_SC;
374  std::vector<std::vector<float>> MergeTracksters_recoToSim_SC_score;
375  std::vector<std::vector<float>> MergeTracksters_recoToSim_SC_sharedE;
376  std::vector<std::vector<uint32_t>> MergeTracksters_simToReco_SC;
377  std::vector<std::vector<float>> MergeTracksters_simToReco_SC_score;
378  std::vector<std::vector<float>> MergeTracksters_simToReco_SC_sharedE;
379 
380  std::vector<std::vector<uint32_t>> MergeTracksters_recoToSim_CP;
381  std::vector<std::vector<float>> MergeTracksters_recoToSim_CP_score;
382  std::vector<std::vector<float>> MergeTracksters_recoToSim_CP_sharedE;
383  std::vector<std::vector<uint32_t>> MergeTracksters_simToReco_CP;
384  std::vector<std::vector<float>> MergeTracksters_simToReco_CP_score;
385  std::vector<std::vector<float>> MergeTracksters_simToReco_CP_sharedE;
386 
387  std::vector<std::vector<uint32_t>> MergeTracksters_recoToSim_PU;
388  std::vector<std::vector<float>> MergeTracksters_recoToSim_PU_score;
389  std::vector<std::vector<float>> MergeTracksters_recoToSim_PU_sharedE;
390  std::vector<std::vector<uint32_t>> MergeTracksters_simToReco_PU;
391  std::vector<std::vector<float>> MergeTracksters_simToReco_PU_score;
392  std::vector<std::vector<float>> MergeTracksters_simToReco_PU_sharedE;
393 
394  std::vector<uint32_t> cluster_seedID;
395  std::vector<float> cluster_energy;
396  std::vector<float> cluster_correctedEnergy;
398  std::vector<float> cluster_position_x;
399  std::vector<float> cluster_position_y;
400  std::vector<float> cluster_position_z;
401  std::vector<float> cluster_position_eta;
402  std::vector<float> cluster_position_phi;
403  std::vector<unsigned int> cluster_layer_id;
404  std::vector<int> cluster_type;
405  std::vector<float> cluster_time;
406  std::vector<float> cluster_timeErr;
407  std::vector<uint32_t> cluster_number_of_hits;
408 
409  std::vector<unsigned int> track_id;
410  std::vector<float> track_hgcal_x;
411  std::vector<float> track_hgcal_y;
412  std::vector<float> track_hgcal_z;
413  std::vector<float> track_hgcal_px;
414  std::vector<float> track_hgcal_py;
415  std::vector<float> track_hgcal_pz;
416  std::vector<float> track_hgcal_eta;
417  std::vector<float> track_hgcal_phi;
418  std::vector<float> track_hgcal_pt;
419  std::vector<float> track_pt;
420  std::vector<int> track_quality;
421  std::vector<int> track_missing_outer_hits;
422  std::vector<int> track_charge;
423  std::vector<double> track_time;
424  std::vector<float> track_time_quality;
425  std::vector<float> track_time_err;
426  std::vector<int> track_nhits;
427 
435  TTree* tracks_tree_;
437 };
438 
440  // event info
441  ntracksters_ = 0;
442  nclusters_ = 0;
443 
444  trackster_time.clear();
445  trackster_timeError.clear();
447  trackster_raw_energy.clear();
448  trackster_raw_em_energy.clear();
449  trackster_raw_pt.clear();
450  trackster_raw_em_pt.clear();
451  trackster_barycenter_x.clear();
452  trackster_barycenter_y.clear();
453  trackster_barycenter_z.clear();
454  trackster_EV1.clear();
455  trackster_EV2.clear();
456  trackster_EV3.clear();
457  trackster_eVector0_x.clear();
458  trackster_eVector0_y.clear();
459  trackster_eVector0_z.clear();
460  trackster_sigmaPCA1.clear();
461  trackster_sigmaPCA2.clear();
462  trackster_sigmaPCA3.clear();
463  trackster_barycenter_eta.clear();
464  trackster_barycenter_phi.clear();
467  trackster_vertices_x.clear();
468  trackster_vertices_y.clear();
469  trackster_vertices_z.clear();
470  trackster_vertices_time.clear();
476 
477  stsSC_trackster_time.clear();
483  stsSC_trackster_raw_pt.clear();
488  stsSC_trackster_EV1.clear();
489  stsSC_trackster_EV2.clear();
490  stsSC_trackster_EV3.clear();
499  stsSC_pdgID.clear();
500  stsSC_trackIdx.clear();
501  stsSC_trackTime.clear();
502  stsSC_boundaryX.clear();
503  stsSC_boundaryY.clear();
504  stsSC_boundaryZ.clear();
505  stsSC_boundaryEta.clear();
506  stsSC_boundaryPhi.clear();
507  stsSC_boundaryPx.clear();
508  stsSC_boundaryPy.clear();
509  stsSC_boundaryPz.clear();
510  stsSC_track_boundaryX.clear();
511  stsSC_track_boundaryY.clear();
512  stsSC_track_boundaryZ.clear();
513  stsSC_track_boundaryEta.clear();
514  stsSC_track_boundaryPhi.clear();
515  stsSC_track_boundaryPx.clear();
516  stsSC_track_boundaryPy.clear();
517  stsSC_track_boundaryPz.clear();
529 
530  stsCP_trackster_time.clear();
536  stsCP_trackster_raw_pt.clear();
546  stsCP_pdgID.clear();
547  stsCP_trackIdx.clear();
548  stsCP_trackTime.clear();
549  stsCP_boundaryX.clear();
550  stsCP_boundaryY.clear();
551  stsCP_boundaryZ.clear();
552  stsCP_boundaryEta.clear();
553  stsCP_boundaryPhi.clear();
554  stsCP_boundaryPx.clear();
555  stsCP_boundaryPy.clear();
556  stsCP_boundaryPz.clear();
557  stsCP_track_boundaryX.clear();
558  stsCP_track_boundaryY.clear();
559  stsCP_track_boundaryZ.clear();
560  stsCP_track_boundaryEta.clear();
561  stsCP_track_boundaryPhi.clear();
562  stsCP_track_boundaryPx.clear();
563  stsCP_track_boundaryPy.clear();
564  stsCP_track_boundaryPz.clear();
576 
589  simTICLCandidate_pdgId.clear();
590  simTICLCandidate_charge.clear();
592 
593  nCandidates = 0;
594  candidate_charge.clear();
595  candidate_pdgId.clear();
596  candidate_energy.clear();
597  candidate_px.clear();
598  candidate_py.clear();
599  candidate_pz.clear();
600  candidate_time.clear();
601  candidate_time_err.clear();
603  tracksters_in_candidate.clear();
604  track_in_candidate.clear();
605 
606  nTrackstersMerged = 0;
607  tracksters_merged_time.clear();
612  tracksters_merged_raw_pt.clear();
619  tracksters_merged_EV1.clear();
620  tracksters_merged_EV2.clear();
621  tracksters_merged_EV3.clear();
629  tracksters_merged_time.clear();
634  tracksters_merged_raw_pt.clear();
636 
647 
654 
661 
668 
675 
682 
683  nsimTrackstersSC = 0;
684 
685  cluster_seedID.clear();
686  cluster_energy.clear();
687  cluster_correctedEnergy.clear();
689  cluster_position_x.clear();
690  cluster_position_y.clear();
691  cluster_position_z.clear();
692  cluster_position_eta.clear();
693  cluster_position_phi.clear();
694  cluster_layer_id.clear();
695  cluster_type.clear();
696  cluster_time.clear();
697  cluster_timeErr.clear();
698  cluster_number_of_hits.clear();
699 
700  track_id.clear();
701  track_hgcal_x.clear();
702  track_hgcal_y.clear();
703  track_hgcal_z.clear();
704  track_hgcal_eta.clear();
705  track_hgcal_phi.clear();
706  track_hgcal_px.clear();
707  track_hgcal_py.clear();
708  track_hgcal_pz.clear();
709  track_hgcal_pt.clear();
710  track_quality.clear();
711  track_pt.clear();
712  track_missing_outer_hits.clear();
713  track_charge.clear();
714  track_time.clear();
715  track_time_quality.clear();
716  track_time_err.clear();
717  track_nhits.clear();
718 };
719 
721  : tracksters_token_(consumes<std::vector<ticl::Trackster>>(ps.getParameter<edm::InputTag>("trackstersclue3d"))),
722  layer_clusters_token_(consumes<std::vector<reco::CaloCluster>>(ps.getParameter<edm::InputTag>("layerClusters"))),
723  ticl_candidates_token_(consumes<std::vector<TICLCandidate>>(ps.getParameter<edm::InputTag>("ticlcandidates"))),
724  tracks_token_(consumes<std::vector<reco::Track>>(ps.getParameter<edm::InputTag>("tracks"))),
725  tracks_time_token_(consumes<edm::ValueMap<float>>(ps.getParameter<edm::InputTag>("tracksTime"))),
726  tracks_time_quality_token_(consumes<edm::ValueMap<float>>(ps.getParameter<edm::InputTag>("tracksTimeQual"))),
727  tracks_time_err_token_(consumes<edm::ValueMap<float>>(ps.getParameter<edm::InputTag>("tracksTimeErr"))),
728  tracksters_merged_token_(
729  consumes<std::vector<ticl::Trackster>>(ps.getParameter<edm::InputTag>("trackstersmerged"))),
730  clustersTime_token_(
731  consumes<edm::ValueMap<std::pair<float, float>>>(ps.getParameter<edm::InputTag>("layer_clustersTime"))),
732  caloGeometry_token_(esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>()),
733  simTracksters_SC_token_(
734  consumes<std::vector<ticl::Trackster>>(ps.getParameter<edm::InputTag>("simtrackstersSC"))),
735  simTracksters_CP_token_(
736  consumes<std::vector<ticl::Trackster>>(ps.getParameter<edm::InputTag>("simtrackstersCP"))),
737  simTracksters_PU_token_(
738  consumes<std::vector<ticl::Trackster>>(ps.getParameter<edm::InputTag>("simtrackstersPU"))),
739  simTICLCandidate_token_(
740  consumes<std::vector<TICLCandidate>>(ps.getParameter<edm::InputTag>("simTICLCandidates"))),
741  tsRecoToSimSC_token_(
742  consumes<hgcal::RecoToSimCollectionSimTracksters>(ps.getParameter<edm::InputTag>("recoToSimAssociatorSC"))),
743  tsSimToRecoSC_token_(
744  consumes<hgcal::SimToRecoCollectionSimTracksters>(ps.getParameter<edm::InputTag>("simToRecoAssociatorSC"))),
745  tsRecoToSimCP_token_(
746  consumes<hgcal::RecoToSimCollectionSimTracksters>(ps.getParameter<edm::InputTag>("recoToSimAssociatorCP"))),
747  tsSimToRecoCP_token_(
748  consumes<hgcal::SimToRecoCollectionSimTracksters>(ps.getParameter<edm::InputTag>("simToRecoAssociatorCP"))),
749  MergeRecoToSimSC_token_(consumes<hgcal::RecoToSimCollectionSimTracksters>(
750  ps.getParameter<edm::InputTag>("MergerecoToSimAssociatorSC"))),
751  MergeSimToRecoSC_token_(consumes<hgcal::SimToRecoCollectionSimTracksters>(
752  ps.getParameter<edm::InputTag>("MergesimToRecoAssociatorSC"))),
753  MergeRecoToSimCP_token_(consumes<hgcal::RecoToSimCollectionSimTracksters>(
754  ps.getParameter<edm::InputTag>("MergerecoToSimAssociatorCP"))),
755  MergeSimToRecoCP_token_(consumes<hgcal::SimToRecoCollectionSimTracksters>(
756  ps.getParameter<edm::InputTag>("MergesimToRecoAssociatorCP"))),
757  MergeRecoToSimPU_token_(consumes<hgcal::RecoToSimCollectionSimTracksters>(
758  ps.getParameter<edm::InputTag>("MergerecoToSimAssociatorPU"))),
759  MergeSimToRecoPU_token_(consumes<hgcal::SimToRecoCollectionSimTracksters>(
760  ps.getParameter<edm::InputTag>("MergesimToRecoAssociatorPU"))),
761  simclusters_token_(consumes(ps.getParameter<edm::InputTag>("simclusters"))),
762  caloparticles_token_(consumes(ps.getParameter<edm::InputTag>("caloparticles"))),
763  geometry_token_(esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>()),
764  detector_(ps.getParameter<std::string>("detector")),
765  propName_(ps.getParameter<std::string>("propagator")),
766  bfield_token_(esConsumes<MagneticField, IdealMagneticFieldRecord, edm::Transition::BeginRun>()),
767  propagator_token_(
769  saveLCs_(ps.getParameter<bool>("saveLCs")),
770  saveCLUE3DTracksters_(ps.getParameter<bool>("saveCLUE3DTracksters")),
771  saveTrackstersMerged_(ps.getParameter<bool>("saveTrackstersMerged")),
772  saveSimTrackstersSC_(ps.getParameter<bool>("saveSimTrackstersSC")),
773  saveSimTrackstersCP_(ps.getParameter<bool>("saveSimTrackstersCP")),
774  saveTICLCandidate_(ps.getParameter<bool>("saveSimTICLCandidate")),
775  saveSimTICLCandidate_(ps.getParameter<bool>("saveSimTICLCandidate")),
776  saveTracks_(ps.getParameter<bool>("saveTracks")),
777  saveAssociations_(ps.getParameter<bool>("saveAssociations")) {
778  std::string detectorName_ = (detector_ == "HFNose") ? "HGCalHFNoseSensitive" : "HGCalEESensitive";
779  hdc_token_ =
780  esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag("", detectorName_));
781 };
782 
784 
788 
790  hgcons_ = hdc.product();
794 }
795 
796 // Define tree and branches
799  if (saveCLUE3DTracksters_) {
800  trackster_tree_ = fs->make<TTree>("tracksters", "TICL tracksters");
801  trackster_tree_->Branch("event", &ev_event_);
802  trackster_tree_->Branch("NClusters", &nclusters_);
803  trackster_tree_->Branch("NTracksters", &ntracksters_);
804  trackster_tree_->Branch("time", &trackster_time);
805  trackster_tree_->Branch("timeError", &trackster_timeError);
806  trackster_tree_->Branch("regressed_energy", &trackster_regressed_energy);
807  trackster_tree_->Branch("raw_energy", &trackster_raw_energy);
808  trackster_tree_->Branch("raw_em_energy", &trackster_raw_em_energy);
809  trackster_tree_->Branch("raw_pt", &trackster_raw_pt);
810  trackster_tree_->Branch("raw_em_pt", &trackster_raw_em_pt);
811  trackster_tree_->Branch("barycenter_x", &trackster_barycenter_x);
812  trackster_tree_->Branch("barycenter_y", &trackster_barycenter_y);
813  trackster_tree_->Branch("barycenter_z", &trackster_barycenter_z);
814  trackster_tree_->Branch("barycenter_eta", &trackster_barycenter_eta);
815  trackster_tree_->Branch("barycenter_phi", &trackster_barycenter_phi);
816  trackster_tree_->Branch("EV1", &trackster_EV1);
817  trackster_tree_->Branch("EV2", &trackster_EV2);
818  trackster_tree_->Branch("EV3", &trackster_EV3);
819  trackster_tree_->Branch("eVector0_x", &trackster_eVector0_x);
820  trackster_tree_->Branch("eVector0_y", &trackster_eVector0_y);
821  trackster_tree_->Branch("eVector0_z", &trackster_eVector0_z);
822  trackster_tree_->Branch("sigmaPCA1", &trackster_sigmaPCA1);
823  trackster_tree_->Branch("sigmaPCA2", &trackster_sigmaPCA2);
824  trackster_tree_->Branch("sigmaPCA3", &trackster_sigmaPCA3);
825  trackster_tree_->Branch("id_probabilities", &trackster_id_probabilities);
826  trackster_tree_->Branch("vertices_indexes", &trackster_vertices_indexes);
827  trackster_tree_->Branch("vertices_x", &trackster_vertices_x);
828  trackster_tree_->Branch("vertices_y", &trackster_vertices_y);
829  trackster_tree_->Branch("vertices_z", &trackster_vertices_z);
830  trackster_tree_->Branch("vertices_time", &trackster_vertices_time);
831  trackster_tree_->Branch("vertices_timeErr", &trackster_vertices_timeErr);
832  trackster_tree_->Branch("vertices_energy", &trackster_vertices_energy);
833  trackster_tree_->Branch("vertices_correctedEnergy", &trackster_vertices_correctedEnergy);
834  trackster_tree_->Branch("vertices_correctedEnergyUncertainty", &trackster_vertices_correctedEnergyUncertainty);
835  trackster_tree_->Branch("vertices_multiplicity", &trackster_vertices_multiplicity);
836  }
837  if (saveLCs_) {
838  cluster_tree_ = fs->make<TTree>("clusters", "TICL tracksters");
839  cluster_tree_->Branch("seedID", &cluster_seedID);
840  cluster_tree_->Branch("energy", &cluster_energy);
841  cluster_tree_->Branch("correctedEnergy", &cluster_correctedEnergy);
842  cluster_tree_->Branch("correctedEnergyUncertainty", &cluster_correctedEnergyUncertainty);
843  cluster_tree_->Branch("position_x", &cluster_position_x);
844  cluster_tree_->Branch("position_y", &cluster_position_y);
845  cluster_tree_->Branch("position_z", &cluster_position_z);
846  cluster_tree_->Branch("position_eta", &cluster_position_eta);
847  cluster_tree_->Branch("position_phi", &cluster_position_phi);
848  cluster_tree_->Branch("cluster_layer_id", &cluster_layer_id);
849  cluster_tree_->Branch("cluster_type", &cluster_type);
850  cluster_tree_->Branch("cluster_time", &cluster_time);
851  cluster_tree_->Branch("cluster_timeErr", &cluster_timeErr);
852  cluster_tree_->Branch("cluster_number_of_hits", &cluster_number_of_hits);
853  }
854  if (saveTICLCandidate_) {
855  candidate_tree_ = fs->make<TTree>("candidates", "TICL candidates");
856  candidate_tree_->Branch("NCandidates", &nCandidates);
857  candidate_tree_->Branch("candidate_charge", &candidate_charge);
858  candidate_tree_->Branch("candidate_pdgId", &candidate_pdgId);
859  candidate_tree_->Branch("candidate_id_probabilities", &candidate_id_probabilities);
860  candidate_tree_->Branch("candidate_time", &candidate_time);
861  candidate_tree_->Branch("candidate_timeErr", &candidate_time_err);
862  candidate_tree_->Branch("candidate_energy", &candidate_energy);
863  candidate_tree_->Branch("candidate_px", &candidate_px);
864  candidate_tree_->Branch("candidate_py", &candidate_py);
865  candidate_tree_->Branch("candidate_pz", &candidate_pz);
866  candidate_tree_->Branch("track_in_candidate", &track_in_candidate);
867  candidate_tree_->Branch("tracksters_in_candidate", &tracksters_in_candidate);
868  }
869  if (saveTrackstersMerged_) {
870  tracksters_merged_tree_ = fs->make<TTree>("trackstersMerged", "TICL tracksters merged");
871  tracksters_merged_tree_->Branch("event", &ev_event_);
874  tracksters_merged_tree_->Branch("regressed_energy", &tracksters_merged_regressed_energy);
876  tracksters_merged_tree_->Branch("raw_em_energy", &tracksters_merged_raw_em_energy);
879  tracksters_merged_tree_->Branch("NTrackstersMerged", &nTrackstersMerged);
883  tracksters_merged_tree_->Branch("barycenter_eta", &tracksters_merged_barycenter_eta);
884  tracksters_merged_tree_->Branch("barycenter_phi", &tracksters_merged_barycenter_phi);
894  tracksters_merged_tree_->Branch("id_probabilities", &tracksters_merged_id_probabilities);
895  tracksters_merged_tree_->Branch("vertices_indexes", &tracksters_merged_vertices_indexes);
899  tracksters_merged_tree_->Branch("vertices_time", &tracksters_merged_vertices_time);
900  tracksters_merged_tree_->Branch("vertices_timeErr", &tracksters_merged_vertices_timeErr);
901  tracksters_merged_tree_->Branch("vertices_energy", &tracksters_merged_vertices_energy);
902  tracksters_merged_tree_->Branch("vertices_correctedEnergy", &tracksters_merged_vertices_correctedEnergy);
903  tracksters_merged_tree_->Branch("vertices_correctedEnergyUncertainty",
905  tracksters_merged_tree_->Branch("vertices_multiplicity", &tracksters_merged_vertices_multiplicity);
906  }
907  if (saveAssociations_) {
908  associations_tree_ = fs->make<TTree>("associations", "Associations");
909  associations_tree_->Branch("tsCLUE3D_recoToSim_SC", &trackstersCLUE3D_recoToSim_SC);
910  associations_tree_->Branch("tsCLUE3D_recoToSim_SC_score", &trackstersCLUE3D_recoToSim_SC_score);
911  associations_tree_->Branch("tsCLUE3D_recoToSim_SC_sharedE", &trackstersCLUE3D_recoToSim_SC_sharedE);
912  associations_tree_->Branch("tsCLUE3D_simToReco_SC", &trackstersCLUE3D_simToReco_SC);
913  associations_tree_->Branch("tsCLUE3D_simToReco_SC_score", &trackstersCLUE3D_simToReco_SC_score);
914  associations_tree_->Branch("tsCLUE3D_simToReco_SC_sharedE", &trackstersCLUE3D_simToReco_SC_sharedE);
915 
916  associations_tree_->Branch("tsCLUE3D_recoToSim_CP", &trackstersCLUE3D_recoToSim_CP);
917  associations_tree_->Branch("tsCLUE3D_recoToSim_CP_score", &trackstersCLUE3D_recoToSim_CP_score);
918  associations_tree_->Branch("tsCLUE3D_recoToSim_CP_sharedE", &trackstersCLUE3D_recoToSim_CP_sharedE);
919  associations_tree_->Branch("tsCLUE3D_simToReco_CP", &trackstersCLUE3D_simToReco_CP);
920  associations_tree_->Branch("tsCLUE3D_simToReco_CP_score", &trackstersCLUE3D_simToReco_CP_score);
921  associations_tree_->Branch("tsCLUE3D_simToReco_CP_sharedE", &trackstersCLUE3D_simToReco_CP_sharedE);
922 
923  associations_tree_->Branch("Mergetstracksters_recoToSim_SC", &MergeTracksters_recoToSim_SC);
924  associations_tree_->Branch("Mergetstracksters_recoToSim_SC_score", &MergeTracksters_recoToSim_SC_score);
925  associations_tree_->Branch("Mergetstracksters_recoToSim_SC_sharedE", &MergeTracksters_recoToSim_SC_sharedE);
926  associations_tree_->Branch("Mergetstracksters_simToReco_SC", &MergeTracksters_simToReco_SC);
927  associations_tree_->Branch("Mergetstracksters_simToReco_SC_score", &MergeTracksters_simToReco_SC_score);
928  associations_tree_->Branch("Mergetstracksters_simToReco_SC_sharedE", &MergeTracksters_simToReco_SC_sharedE);
929 
930  associations_tree_->Branch("Mergetracksters_recoToSim_CP", &MergeTracksters_recoToSim_CP);
931  associations_tree_->Branch("Mergetracksters_recoToSim_CP_score", &MergeTracksters_recoToSim_CP_score);
932  associations_tree_->Branch("Mergetracksters_recoToSim_CP_sharedE", &MergeTracksters_recoToSim_CP_sharedE);
933  associations_tree_->Branch("Mergetracksters_simToReco_CP", &MergeTracksters_simToReco_CP);
934  associations_tree_->Branch("Mergetracksters_simToReco_CP_score", &MergeTracksters_simToReco_CP_score);
935  associations_tree_->Branch("Mergetracksters_simToReco_CP_sharedE", &MergeTracksters_simToReco_CP_sharedE);
936 
937  associations_tree_->Branch("Mergetracksters_recoToSim_PU", &MergeTracksters_recoToSim_PU);
938  associations_tree_->Branch("Mergetracksters_recoToSim_PU_score", &MergeTracksters_recoToSim_PU_score);
939  associations_tree_->Branch("Mergetracksters_recoToSim_PU_sharedE", &MergeTracksters_recoToSim_PU_sharedE);
940  associations_tree_->Branch("Mergetracksters_simToReco_PU", &MergeTracksters_simToReco_PU);
941  associations_tree_->Branch("Mergetracksters_simToReco_PU_score", &MergeTracksters_simToReco_PU_score);
942  associations_tree_->Branch("Mergetracksters_simToReco_PU_sharedE", &MergeTracksters_simToReco_PU_sharedE);
943  }
944 
945  if (saveSimTrackstersSC_) {
946  simtrackstersSC_tree_ = fs->make<TTree>("simtrackstersSC", "TICL simTracksters SC");
947  simtrackstersSC_tree_->Branch("event", &ev_event_);
948  simtrackstersSC_tree_->Branch("NTracksters", &stsSC_ntracksters_);
950  simtrackstersSC_tree_->Branch("timeError", &stsSC_trackster_timeError);
951  simtrackstersSC_tree_->Branch("regressed_energy", &stsSC_trackster_regressed_energy);
952  simtrackstersSC_tree_->Branch("regressed_pt", &stsSC_trackster_regressed_pt);
953  simtrackstersSC_tree_->Branch("raw_energy", &stsSC_trackster_raw_energy);
954  simtrackstersSC_tree_->Branch("raw_em_energy", &stsSC_trackster_raw_em_energy);
955  simtrackstersSC_tree_->Branch("raw_pt", &stsSC_trackster_raw_pt);
956  simtrackstersSC_tree_->Branch("raw_em_pt", &stsSC_trackster_raw_em_pt);
957  simtrackstersSC_tree_->Branch("barycenter_x", &stsSC_trackster_barycenter_x);
958  simtrackstersSC_tree_->Branch("barycenter_y", &stsSC_trackster_barycenter_y);
959  simtrackstersSC_tree_->Branch("barycenter_z", &stsSC_trackster_barycenter_z);
960  simtrackstersSC_tree_->Branch("barycenter_eta", &stsSC_trackster_barycenter_eta);
961  simtrackstersSC_tree_->Branch("barycenter_phi", &stsSC_trackster_barycenter_phi);
965  simtrackstersSC_tree_->Branch("eVector0_x", &stsSC_trackster_eVector0_x);
966  simtrackstersSC_tree_->Branch("eVector0_y", &stsSC_trackster_eVector0_y);
967  simtrackstersSC_tree_->Branch("eVector0_z", &stsSC_trackster_eVector0_z);
968  simtrackstersSC_tree_->Branch("sigmaPCA1", &stsSC_trackster_sigmaPCA1);
969  simtrackstersSC_tree_->Branch("sigmaPCA2", &stsSC_trackster_sigmaPCA2);
970  simtrackstersSC_tree_->Branch("sigmaPCA3", &stsSC_trackster_sigmaPCA3);
971  simtrackstersSC_tree_->Branch("pdgID", &stsSC_pdgID);
972  simtrackstersSC_tree_->Branch("trackIdx", &stsSC_trackIdx);
973  simtrackstersSC_tree_->Branch("trackTime", &stsSC_trackTime);
974  simtrackstersSC_tree_->Branch("boundaryX", &stsSC_boundaryX);
975  simtrackstersSC_tree_->Branch("boundaryY", &stsSC_boundaryY);
976  simtrackstersSC_tree_->Branch("boundaryZ", &stsSC_boundaryZ);
977  simtrackstersSC_tree_->Branch("boundaryEta", &stsSC_boundaryEta);
978  simtrackstersSC_tree_->Branch("boundaryPhi", &stsSC_boundaryPhi);
979  simtrackstersSC_tree_->Branch("boundaryPx", &stsSC_boundaryPx);
980  simtrackstersSC_tree_->Branch("boundaryPy", &stsSC_boundaryPy);
981  simtrackstersSC_tree_->Branch("boundaryPz", &stsSC_boundaryPz);
982  simtrackstersSC_tree_->Branch("track_boundaryX", &stsSC_track_boundaryX);
983  simtrackstersSC_tree_->Branch("track_boundaryY", &stsSC_track_boundaryY);
984  simtrackstersSC_tree_->Branch("track_boundaryZ", &stsSC_track_boundaryZ);
985  simtrackstersSC_tree_->Branch("track_boundaryEta", &stsSC_track_boundaryEta);
986  simtrackstersSC_tree_->Branch("track_boundaryPhi", &stsSC_track_boundaryPhi);
987  simtrackstersSC_tree_->Branch("track_boundaryPx", &stsSC_track_boundaryPx);
988  simtrackstersSC_tree_->Branch("track_boundaryPy", &stsSC_track_boundaryPy);
989  simtrackstersSC_tree_->Branch("track_boundaryPz", &stsSC_track_boundaryPz);
990  simtrackstersSC_tree_->Branch("id_probabilities", &stsSC_trackster_id_probabilities);
991  simtrackstersSC_tree_->Branch("vertices_indexes", &stsSC_trackster_vertices_indexes);
992  simtrackstersSC_tree_->Branch("vertices_x", &stsSC_trackster_vertices_x);
993  simtrackstersSC_tree_->Branch("vertices_y", &stsSC_trackster_vertices_y);
994  simtrackstersSC_tree_->Branch("vertices_z", &stsSC_trackster_vertices_z);
995  simtrackstersSC_tree_->Branch("vertices_time", &stsSC_trackster_vertices_time);
996  simtrackstersSC_tree_->Branch("vertices_timeErr", &stsSC_trackster_vertices_timeErr);
997  simtrackstersSC_tree_->Branch("vertices_energy", &stsSC_trackster_vertices_energy);
998  simtrackstersSC_tree_->Branch("vertices_correctedEnergy", &stsSC_trackster_vertices_correctedEnergy);
999  simtrackstersSC_tree_->Branch("vertices_correctedEnergyUncertainty",
1001  simtrackstersSC_tree_->Branch("vertices_multiplicity", &stsSC_trackster_vertices_multiplicity);
1002  simtrackstersSC_tree_->Branch("NsimTrackstersSC", &nsimTrackstersSC);
1003  }
1004  if (saveSimTrackstersCP_) {
1005  simtrackstersCP_tree_ = fs->make<TTree>("simtrackstersCP", "TICL simTracksters CP");
1006  simtrackstersCP_tree_->Branch("event", &ev_event_);
1007  simtrackstersCP_tree_->Branch("NTracksters", &stsCP_ntracksters_);
1008  simtrackstersCP_tree_->Branch("time", &stsCP_trackster_time);
1009  simtrackstersCP_tree_->Branch("timeError", &stsCP_trackster_timeError);
1010  simtrackstersCP_tree_->Branch("regressed_energy", &stsCP_trackster_regressed_energy);
1011  simtrackstersCP_tree_->Branch("regressed_pt", &stsCP_trackster_regressed_pt);
1012  simtrackstersCP_tree_->Branch("raw_energy", &stsCP_trackster_raw_energy);
1013  simtrackstersCP_tree_->Branch("raw_em_energy", &stsCP_trackster_raw_em_energy);
1014  simtrackstersCP_tree_->Branch("raw_pt", &stsCP_trackster_raw_pt);
1015  simtrackstersCP_tree_->Branch("raw_em_pt", &stsCP_trackster_raw_em_pt);
1016  simtrackstersCP_tree_->Branch("barycenter_x", &stsCP_trackster_barycenter_x);
1017  simtrackstersCP_tree_->Branch("barycenter_y", &stsCP_trackster_barycenter_y);
1018  simtrackstersCP_tree_->Branch("barycenter_z", &stsCP_trackster_barycenter_z);
1019  simtrackstersCP_tree_->Branch("barycenter_eta", &stsCP_trackster_barycenter_eta);
1020  simtrackstersCP_tree_->Branch("barycenter_phi", &stsCP_trackster_barycenter_phi);
1021  simtrackstersCP_tree_->Branch("pdgID", &stsCP_pdgID);
1022  simtrackstersCP_tree_->Branch("trackIdx", &stsCP_trackIdx);
1023  simtrackstersCP_tree_->Branch("trackTime", &stsCP_trackTime);
1024  simtrackstersCP_tree_->Branch("boundaryX", &stsCP_boundaryX);
1025  simtrackstersCP_tree_->Branch("boundaryY", &stsCP_boundaryY);
1026  simtrackstersCP_tree_->Branch("boundaryZ", &stsCP_boundaryZ);
1027  simtrackstersCP_tree_->Branch("boundaryEta", &stsCP_boundaryEta);
1028  simtrackstersCP_tree_->Branch("boundaryPhi", &stsCP_boundaryPhi);
1029  simtrackstersCP_tree_->Branch("boundaryPx", &stsCP_boundaryPx);
1030  simtrackstersCP_tree_->Branch("boundaryPy", &stsCP_boundaryPy);
1031  simtrackstersCP_tree_->Branch("boundaryPz", &stsCP_boundaryPz);
1032  simtrackstersCP_tree_->Branch("track_boundaryX", &stsCP_track_boundaryX);
1033  simtrackstersCP_tree_->Branch("track_boundaryY", &stsCP_track_boundaryY);
1034  simtrackstersCP_tree_->Branch("track_boundaryZ", &stsCP_track_boundaryZ);
1035  simtrackstersCP_tree_->Branch("track_boundaryEta", &stsCP_track_boundaryEta);
1036  simtrackstersCP_tree_->Branch("track_boundaryPhi", &stsCP_track_boundaryPhi);
1037  simtrackstersCP_tree_->Branch("track_boundaryPx", &stsCP_track_boundaryPx);
1038  simtrackstersCP_tree_->Branch("track_boundaryPy", &stsCP_track_boundaryPy);
1039  simtrackstersCP_tree_->Branch("track_boundaryPz", &stsCP_track_boundaryPz);
1040  simtrackstersCP_tree_->Branch("EV1", &stsCP_trackster_EV1);
1041  simtrackstersCP_tree_->Branch("EV2", &stsCP_trackster_EV2);
1042  simtrackstersCP_tree_->Branch("EV3", &stsCP_trackster_EV3);
1043  simtrackstersCP_tree_->Branch("eVector0_x", &stsCP_trackster_eVector0_x);
1044  simtrackstersCP_tree_->Branch("eVector0_y", &stsCP_trackster_eVector0_y);
1045  simtrackstersCP_tree_->Branch("eVector0_z", &stsCP_trackster_eVector0_z);
1046  simtrackstersCP_tree_->Branch("sigmaPCA1", &stsCP_trackster_sigmaPCA1);
1047  simtrackstersCP_tree_->Branch("sigmaPCA2", &stsCP_trackster_sigmaPCA2);
1048  simtrackstersCP_tree_->Branch("sigmaPCA3", &stsCP_trackster_sigmaPCA3);
1049  simtrackstersCP_tree_->Branch("id_probabilities", &stsCP_trackster_id_probabilities);
1050  simtrackstersCP_tree_->Branch("vertices_indexes", &stsCP_trackster_vertices_indexes);
1051  simtrackstersCP_tree_->Branch("vertices_x", &stsCP_trackster_vertices_x);
1052  simtrackstersCP_tree_->Branch("vertices_y", &stsCP_trackster_vertices_y);
1053  simtrackstersCP_tree_->Branch("vertices_z", &stsCP_trackster_vertices_z);
1054  simtrackstersCP_tree_->Branch("vertices_time", &stsCP_trackster_vertices_time);
1055  simtrackstersCP_tree_->Branch("vertices_timeErr", &stsCP_trackster_vertices_timeErr);
1056  simtrackstersCP_tree_->Branch("vertices_energy", &stsCP_trackster_vertices_energy);
1057  simtrackstersCP_tree_->Branch("vertices_correctedEnergy", &stsCP_trackster_vertices_correctedEnergy);
1058  simtrackstersCP_tree_->Branch("vertices_correctedEnergyUncertainty",
1060  simtrackstersCP_tree_->Branch("vertices_multiplicity", &stsCP_trackster_vertices_multiplicity);
1061  }
1062 
1063  if (saveTracks_) {
1064  tracks_tree_ = fs->make<TTree>("tracks", "Tracks");
1065  tracks_tree_->Branch("event", &ev_event_);
1066  tracks_tree_->Branch("track_id", &track_id);
1067  tracks_tree_->Branch("track_hgcal_pt", &track_hgcal_pt);
1068  tracks_tree_->Branch("track_pt", &track_pt);
1069  tracks_tree_->Branch("track_missing_outer_hits", &track_missing_outer_hits);
1070  tracks_tree_->Branch("track_quality", &track_quality);
1071  tracks_tree_->Branch("track_charge", &track_charge);
1072  tracks_tree_->Branch("track_time", &track_time);
1073  tracks_tree_->Branch("track_time_quality", &track_time_quality);
1074  tracks_tree_->Branch("track_time_err", &track_time_err);
1075  tracks_tree_->Branch("track_nhits", &track_nhits);
1076  }
1077 
1078  if (saveSimTICLCandidate_) {
1079  simTICLCandidate_tree = fs->make<TTree>("simTICLCandidate", "Sim TICL Candidate");
1080  simTICLCandidate_tree->Branch("simTICLCandidate_raw_energy", &simTICLCandidate_raw_energy);
1081  simTICLCandidate_tree->Branch("simTICLCandidate_regressed_energy", &simTICLCandidate_regressed_energy);
1082  simTICLCandidate_tree->Branch("simTICLCandidate_simTracksterCPIndex", &simTICLCandidate_simTracksterCPIndex);
1083  simTICLCandidate_tree->Branch("simTICLCandidate_boundaryX", &simTICLCandidate_boundaryX);
1084  simTICLCandidate_tree->Branch("simTICLCandidate_boundaryY", &simTICLCandidate_boundaryY);
1085  simTICLCandidate_tree->Branch("simTICLCandidate_boundaryZ", &simTICLCandidate_boundaryZ);
1086  simTICLCandidate_tree->Branch("simTICLCandidate_boundaryPx", &simTICLCandidate_boundaryPx);
1087  simTICLCandidate_tree->Branch("simTICLCandidate_boundaryPy", &simTICLCandidate_boundaryPy);
1088  simTICLCandidate_tree->Branch("simTICLCandidate_boundaryPz", &simTICLCandidate_boundaryPz);
1089  simTICLCandidate_tree->Branch("simTICLCandidate_trackTime", &simTICLCandidate_trackTime);
1090  simTICLCandidate_tree->Branch("simTICLCandidate_trackBeta", &simTICLCandidate_trackBeta);
1091  simTICLCandidate_tree->Branch("simTICLCandidate_caloParticleMass", &simTICLCandidate_caloParticleMass);
1092  simTICLCandidate_tree->Branch("simTICLCandidate_pdgId", &simTICLCandidate_pdgId);
1093  simTICLCandidate_tree->Branch("simTICLCandidate_charge", &simTICLCandidate_charge);
1094  simTICLCandidate_tree->Branch("simTICLCandidate_track_in_candidate", &simTICLCandidate_track_in_candidate);
1095  }
1096 }
1097 
1099  // build disks at HGCal front & EM-Had interface for track propagation
1100 
1101  float zVal = hgcons_->waferZ(1, true);
1102  std::pair<float, float> rMinMax = hgcons_->rangeR(zVal, true);
1103 
1104  float zVal_interface = rhtools_.getPositionLayer(rhtools_.lastLayerEE()).z();
1105  std::pair<float, float> rMinMax_interface = hgcons_->rangeR(zVal_interface, true);
1106 
1107  for (int iSide = 0; iSide < 2; ++iSide) {
1108  float zSide = (iSide == 0) ? (-1. * zVal) : zVal;
1109  firstDisk_[iSide] =
1110  std::make_unique<GeomDet>(Disk::build(Disk::PositionType(0, 0, zSide),
1112  SimpleDiskBounds(rMinMax.first, rMinMax.second, zSide - 0.5, zSide + 0.5))
1113  .get());
1114 
1115  zSide = (iSide == 0) ? (-1. * zVal_interface) : zVal_interface;
1116  interfaceDisk_[iSide] = std::make_unique<GeomDet>(
1117  Disk::build(Disk::PositionType(0, 0, zSide),
1119  SimpleDiskBounds(rMinMax_interface.first, rMinMax_interface.second, zSide - 0.5, zSide + 0.5))
1120  .get());
1121  }
1122 }
1123 
1125  const hgcal::RecHitTools rhtools,
1126  const edm::ESHandle<MagneticField> bfieldH,
1127  const edm::ESHandle<Propagator> propH) {
1128  hgcons_ = hgcons;
1129  rhtools_ = rhtools;
1130  buildLayers();
1131 
1132  bfield_ = bfieldH;
1133  propagator_ = propH;
1134 }
1136  ev_event_ += 1;
1137  clearVariables();
1138  auto bFieldProd = bfield_.product();
1139  const Propagator& prop = (*propagator_);
1140  //get all the tracksters
1141  edm::Handle<std::vector<ticl::Trackster>> tracksters_handle;
1142  event.getByToken(tracksters_token_, tracksters_handle);
1143  const auto& tracksters = *tracksters_handle;
1144 
1145  //get all the layer clusters
1147  event.getByToken(layer_clusters_token_, layer_clusters_h);
1148  const auto& clusters = *layer_clusters_h;
1149 
1151  event.getByToken(clustersTime_token_, clustersTime_h);
1152  const auto& layerClustersTimes = *clustersTime_h;
1153 
1154  //TICL Candidate
1156  event.getByToken(ticl_candidates_token_, candidates_h);
1157  const auto& ticlcandidates = *candidates_h;
1158 
1159  //Track
1161  event.getByToken(tracks_token_, tracks_h);
1162  const auto& tracks = *tracks_h;
1163 
1164  edm::Handle<edm::ValueMap<float>> trackTime_h;
1165  event.getByToken(tracks_time_token_, trackTime_h);
1166  const auto& trackTime = *trackTime_h;
1167 
1168  edm::Handle<edm::ValueMap<float>> trackTimeErr_h;
1169  event.getByToken(tracks_time_err_token_, trackTimeErr_h);
1170  const auto& trackTimeErr = *trackTimeErr_h;
1171 
1172  edm::Handle<edm::ValueMap<float>> trackTimeQual_h;
1173  event.getByToken(tracks_time_quality_token_, trackTimeQual_h);
1174  const auto& trackTimeQual = *trackTimeQual_h;
1175 
1176  //Tracksters merged
1177  edm::Handle<std::vector<ticl::Trackster>> tracksters_merged_h;
1178  event.getByToken(tracksters_merged_token_, tracksters_merged_h);
1179  const auto& trackstersmerged = *tracksters_merged_h;
1180 
1181  // simTracksters from SC
1182  edm::Handle<std::vector<ticl::Trackster>> simTrackstersSC_h;
1183  event.getByToken(simTracksters_SC_token_, simTrackstersSC_h);
1184  const auto& simTrackstersSC = *simTrackstersSC_h;
1185 
1186  // simTracksters from CP
1187  edm::Handle<std::vector<ticl::Trackster>> simTrackstersCP_h;
1188  event.getByToken(simTracksters_CP_token_, simTrackstersCP_h);
1189  const auto& simTrackstersCP = *simTrackstersCP_h;
1190 
1191  // simTracksters from PU
1192  edm::Handle<std::vector<ticl::Trackster>> simTrackstersPU_h;
1193  event.getByToken(simTracksters_PU_token_, simTrackstersPU_h);
1194  const auto& simTrackstersPU = *simTrackstersPU_h;
1195 
1196  edm::Handle<std::vector<TICLCandidate>> simTICLCandidates_h;
1197  event.getByToken(simTICLCandidate_token_, simTICLCandidates_h);
1198  const auto& simTICLCandidates = *simTICLCandidates_h;
1199 
1200  // trackster reco to sim SC
1202  event.getByToken(tsRecoToSimSC_token_, tsRecoToSimSC_h);
1203  auto const& tsRecoSimSCMap = *tsRecoToSimSC_h;
1204 
1205  // sim simTrackster SC to reco trackster
1207  event.getByToken(tsSimToRecoSC_token_, tsSimToRecoSC_h);
1208  auto const& tsSimToRecoSCMap = *tsSimToRecoSC_h;
1209 
1210  // trackster reco to sim CP
1212  event.getByToken(tsRecoToSimCP_token_, tsRecoToSimCP_h);
1213  auto const& tsRecoSimCPMap = *tsRecoToSimCP_h;
1214 
1215  // sim simTrackster CP to reco trackster
1217  event.getByToken(tsSimToRecoCP_token_, tsSimToRecoCP_h);
1218  auto const& tsSimToRecoCPMap = *tsSimToRecoCP_h;
1219 
1221  event.getByToken(MergeRecoToSimSC_token_, mergetsRecoToSimSC_h);
1222  auto const& MergetsRecoSimSCMap = *mergetsRecoToSimSC_h;
1223 
1224  // sim simTrackster SC to reco trackster
1226  event.getByToken(MergeSimToRecoSC_token_, mergetsSimToRecoSC_h);
1227  auto const& MergetsSimToRecoSCMap = *mergetsSimToRecoSC_h;
1228 
1229  // trackster reco to sim CP
1231  event.getByToken(MergeRecoToSimCP_token_, mergetsRecoToSimCP_h);
1232  auto const& MergetsRecoSimCPMap = *mergetsRecoToSimCP_h;
1233 
1234  // sim simTrackster CP to reco trackster
1236  event.getByToken(MergeSimToRecoCP_token_, mergetsSimToRecoCP_h);
1237  auto const& MergetsSimToRecoCPMap = *mergetsSimToRecoCP_h;
1238 
1239  // trackster reco to sim PU
1241  event.getByToken(MergeRecoToSimPU_token_, mergetsRecoToSimPU_h);
1242  auto const& MergetsRecoSimPUMap = *mergetsRecoToSimPU_h;
1243 
1244  // sim simTrackster PU to reco trackster
1246  event.getByToken(MergeSimToRecoPU_token_, mergetsSimToRecoPU_h);
1247  auto const& MergetsSimToRecoPUMap = *mergetsSimToRecoPU_h;
1248 
1249  edm::Handle<std::vector<CaloParticle>> caloparticles_h;
1250  event.getByToken(caloparticles_token_, caloparticles_h);
1251  const auto& caloparticles = *caloparticles_h;
1252 
1253  const auto& simclusters = event.get(simclusters_token_);
1254 
1255  ntracksters_ = tracksters.size();
1256  nclusters_ = clusters.size();
1257 
1258  for (auto trackster_iterator = tracksters.begin(); trackster_iterator != tracksters.end(); ++trackster_iterator) {
1259  //per-trackster analysis
1260  trackster_time.push_back(trackster_iterator->time());
1261  trackster_timeError.push_back(trackster_iterator->timeError());
1262  trackster_regressed_energy.push_back(trackster_iterator->regressed_energy());
1263  trackster_raw_energy.push_back(trackster_iterator->raw_energy());
1264  trackster_raw_em_energy.push_back(trackster_iterator->raw_em_energy());
1265  trackster_raw_pt.push_back(trackster_iterator->raw_pt());
1266  trackster_raw_em_pt.push_back(trackster_iterator->raw_em_pt());
1267  trackster_barycenter_x.push_back(trackster_iterator->barycenter().x());
1268  trackster_barycenter_y.push_back(trackster_iterator->barycenter().y());
1269  trackster_barycenter_z.push_back(trackster_iterator->barycenter().z());
1270  trackster_barycenter_eta.push_back(trackster_iterator->barycenter().eta());
1271  trackster_barycenter_phi.push_back(trackster_iterator->barycenter().phi());
1272  trackster_EV1.push_back(trackster_iterator->eigenvalues()[0]);
1273  trackster_EV2.push_back(trackster_iterator->eigenvalues()[1]);
1274  trackster_EV3.push_back(trackster_iterator->eigenvalues()[2]);
1275  trackster_eVector0_x.push_back((trackster_iterator->eigenvectors()[0]).x());
1276  trackster_eVector0_y.push_back((trackster_iterator->eigenvectors()[0]).y());
1277  trackster_eVector0_z.push_back((trackster_iterator->eigenvectors()[0]).z());
1278  trackster_sigmaPCA1.push_back(trackster_iterator->sigmasPCA()[0]);
1279  trackster_sigmaPCA2.push_back(trackster_iterator->sigmasPCA()[1]);
1280  trackster_sigmaPCA3.push_back(trackster_iterator->sigmasPCA()[2]);
1281  std::vector<float> id_probs;
1282  for (size_t i = 0; i < 8; i++)
1283  id_probs.push_back(trackster_iterator->id_probabilities(i));
1284  trackster_id_probabilities.push_back(id_probs);
1285 
1286  // Clusters
1287  std::vector<uint32_t> vertices_indexes;
1288  std::vector<float> vertices_x;
1289  std::vector<float> vertices_y;
1290  std::vector<float> vertices_z;
1291  std::vector<float> vertices_time;
1292  std::vector<float> vertices_timeErr;
1293  std::vector<float> vertices_energy;
1294  std::vector<float> vertices_correctedEnergy;
1295  std::vector<float> vertices_correctedEnergyUncertainty;
1296  for (auto idx : trackster_iterator->vertices()) {
1297  vertices_indexes.push_back(idx);
1298  auto associated_cluster = (*layer_clusters_h)[idx];
1299  vertices_x.push_back(associated_cluster.x());
1300  vertices_y.push_back(associated_cluster.y());
1301  vertices_z.push_back(associated_cluster.z());
1302  vertices_energy.push_back(associated_cluster.energy());
1303  vertices_correctedEnergy.push_back(associated_cluster.correctedEnergy());
1304  vertices_correctedEnergyUncertainty.push_back(associated_cluster.correctedEnergyUncertainty());
1305  vertices_time.push_back(layerClustersTimes.get(idx).first);
1306  vertices_timeErr.push_back(layerClustersTimes.get(idx).second);
1307  }
1308  trackster_vertices_indexes.push_back(vertices_indexes);
1309  trackster_vertices_x.push_back(vertices_x);
1310  trackster_vertices_y.push_back(vertices_y);
1311  trackster_vertices_z.push_back(vertices_z);
1312  trackster_vertices_time.push_back(vertices_time);
1313  trackster_vertices_timeErr.push_back(vertices_timeErr);
1314  trackster_vertices_energy.push_back(vertices_energy);
1315  trackster_vertices_correctedEnergy.push_back(vertices_correctedEnergy);
1316  trackster_vertices_correctedEnergyUncertainty.push_back(vertices_correctedEnergyUncertainty);
1317 
1318  // Multiplicity
1319  std::vector<float> vertices_multiplicity;
1320  for (auto multiplicity : trackster_iterator->vertex_multiplicity()) {
1321  vertices_multiplicity.push_back(multiplicity);
1322  }
1323  trackster_vertices_multiplicity.push_back(vertices_multiplicity);
1324  }
1325 
1326  stsSC_ntracksters_ = simTrackstersSC.size();
1327  using CaloObjectVariant = std::variant<CaloParticle, SimCluster>;
1328  for (auto trackster_iterator = simTrackstersSC.begin(); trackster_iterator != simTrackstersSC.end();
1329  ++trackster_iterator) {
1330  //per-trackster analysis
1331  stsSC_trackster_time.push_back(trackster_iterator->time());
1332  stsSC_trackster_timeError.push_back(trackster_iterator->timeError());
1333  stsSC_trackster_regressed_energy.push_back(trackster_iterator->regressed_energy());
1334  stsSC_trackster_raw_energy.push_back(trackster_iterator->raw_energy());
1335  stsSC_trackster_raw_em_energy.push_back(trackster_iterator->raw_em_energy());
1336  stsSC_trackster_raw_pt.push_back(trackster_iterator->raw_pt());
1337  stsSC_trackster_raw_em_pt.push_back(trackster_iterator->raw_em_pt());
1338  stsSC_trackster_barycenter_x.push_back(trackster_iterator->barycenter().x());
1339  stsSC_trackster_barycenter_y.push_back(trackster_iterator->barycenter().y());
1340  stsSC_trackster_barycenter_z.push_back(trackster_iterator->barycenter().z());
1341  stsSC_trackster_barycenter_eta.push_back(trackster_iterator->barycenter().eta());
1342  stsSC_trackster_barycenter_phi.push_back(trackster_iterator->barycenter().phi());
1343  stsSC_trackster_EV1.push_back(trackster_iterator->eigenvalues()[0]);
1344  stsSC_trackster_EV2.push_back(trackster_iterator->eigenvalues()[1]);
1345  stsSC_trackster_EV3.push_back(trackster_iterator->eigenvalues()[2]);
1346  stsSC_trackster_eVector0_x.push_back((trackster_iterator->eigenvectors()[0]).x());
1347  stsSC_trackster_eVector0_y.push_back((trackster_iterator->eigenvectors()[0]).y());
1348  stsSC_trackster_eVector0_z.push_back((trackster_iterator->eigenvectors()[0]).z());
1349  stsSC_trackster_sigmaPCA1.push_back(trackster_iterator->sigmasPCA()[0]);
1350  stsSC_trackster_sigmaPCA2.push_back(trackster_iterator->sigmasPCA()[1]);
1351  stsSC_trackster_sigmaPCA3.push_back(trackster_iterator->sigmasPCA()[2]);
1352  stsSC_pdgID.push_back(simclusters[trackster_iterator->seedIndex()].pdgId());
1353 
1354  CaloObjectVariant caloObj;
1355  if (trackster_iterator->seedID() == caloparticles_h.id()) {
1356  caloObj = caloparticles[trackster_iterator->seedIndex()];
1357  } else {
1358  caloObj = simclusters[trackster_iterator->seedIndex()];
1359  }
1360 
1361  auto const& simTrack = std::visit([](auto&& obj) { return obj.g4Tracks()[0]; }, caloObj);
1362  auto const& caloPt = std::visit([](auto&& obj) { return obj.pt(); }, caloObj);
1363  stsSC_trackster_regressed_pt.push_back(caloPt);
1364  if (simTrack.crossedBoundary()) {
1365  stsSC_boundaryX.push_back(simTrack.getPositionAtBoundary().x());
1366  stsSC_boundaryY.push_back(simTrack.getPositionAtBoundary().y());
1367  stsSC_boundaryZ.push_back(simTrack.getPositionAtBoundary().z());
1368  stsSC_boundaryEta.push_back(simTrack.getPositionAtBoundary().eta());
1369  stsSC_boundaryPhi.push_back(simTrack.getPositionAtBoundary().phi());
1370  stsSC_boundaryPx.push_back(simTrack.getMomentumAtBoundary().x());
1371  stsSC_boundaryPy.push_back(simTrack.getMomentumAtBoundary().y());
1372  stsSC_boundaryPz.push_back(simTrack.getMomentumAtBoundary().z());
1373  } else {
1374  stsSC_boundaryX.push_back(-999);
1375  stsSC_boundaryY.push_back(-999);
1376  stsSC_boundaryZ.push_back(-999);
1377  stsSC_boundaryEta.push_back(-999);
1378  stsSC_boundaryPhi.push_back(-999);
1379  stsSC_boundaryPx.push_back(-999);
1380  stsSC_boundaryPy.push_back(-999);
1381  stsSC_boundaryPz.push_back(-999);
1382  }
1383  auto const trackIdx = trackster_iterator->trackIdx();
1384  stsSC_trackIdx.push_back(trackIdx);
1385  if (trackIdx != -1) {
1386  const auto& track = tracks[trackIdx];
1387 
1388  int iSide = int(track.eta() > 0);
1389 
1390  const auto& fts = trajectoryStateTransform::outerFreeState((track), bFieldProd);
1391  // to the HGCal front
1392  const auto& tsos = prop.propagate(fts, firstDisk_[iSide]->surface());
1393  if (tsos.isValid()) {
1394  const auto& globalPos = tsos.globalPosition();
1395  const auto& globalMom = tsos.globalMomentum();
1396  stsSC_track_boundaryX.push_back(globalPos.x());
1397  stsSC_track_boundaryY.push_back(globalPos.y());
1398  stsSC_track_boundaryZ.push_back(globalPos.z());
1399  stsSC_track_boundaryEta.push_back(globalPos.eta());
1400  stsSC_track_boundaryPhi.push_back(globalPos.phi());
1401  stsSC_track_boundaryPx.push_back(globalMom.x());
1402  stsSC_track_boundaryPy.push_back(globalMom.y());
1403  stsSC_track_boundaryPz.push_back(globalMom.z());
1404  stsSC_trackTime.push_back(track.t0());
1405  } else {
1406  stsSC_track_boundaryX.push_back(-999);
1407  stsSC_track_boundaryY.push_back(-999);
1408  stsSC_track_boundaryZ.push_back(-999);
1409  stsSC_track_boundaryEta.push_back(-999);
1410  stsSC_track_boundaryPhi.push_back(-999);
1411  stsSC_track_boundaryPx.push_back(-999);
1412  stsSC_track_boundaryPy.push_back(-999);
1413  stsSC_track_boundaryPz.push_back(-999);
1414  }
1415  } else {
1416  stsSC_track_boundaryX.push_back(-999);
1417  stsSC_track_boundaryY.push_back(-999);
1418  stsSC_track_boundaryZ.push_back(-999);
1419  stsSC_track_boundaryEta.push_back(-999);
1420  stsSC_track_boundaryPhi.push_back(-999);
1421  stsSC_track_boundaryPx.push_back(-999);
1422  stsSC_track_boundaryPy.push_back(-999);
1423  stsSC_track_boundaryPz.push_back(-999);
1424  }
1425 
1426  std::vector<float> id_probs;
1427  for (size_t i = 0; i < 8; i++)
1428  id_probs.push_back(trackster_iterator->id_probabilities(i));
1429  stsSC_trackster_id_probabilities.push_back(id_probs);
1430 
1431  // Clusters
1432  std::vector<uint32_t> vertices_indexes;
1433  std::vector<float> vertices_x;
1434  std::vector<float> vertices_y;
1435  std::vector<float> vertices_z;
1436  std::vector<float> vertices_time;
1437  std::vector<float> vertices_timeErr;
1438  std::vector<float> vertices_energy;
1439  std::vector<float> vertices_correctedEnergy;
1440  std::vector<float> vertices_correctedEnergyUncertainty;
1441  for (auto idx : trackster_iterator->vertices()) {
1442  vertices_indexes.push_back(idx);
1443  auto associated_cluster = (*layer_clusters_h)[idx];
1444  vertices_x.push_back(associated_cluster.x());
1445  vertices_y.push_back(associated_cluster.y());
1446  vertices_z.push_back(associated_cluster.z());
1447  vertices_energy.push_back(associated_cluster.energy());
1448  vertices_correctedEnergy.push_back(associated_cluster.correctedEnergy());
1449  vertices_correctedEnergyUncertainty.push_back(associated_cluster.correctedEnergyUncertainty());
1450  vertices_time.push_back(layerClustersTimes.get(idx).first);
1451  vertices_timeErr.push_back(layerClustersTimes.get(idx).second);
1452  }
1453  stsSC_trackster_vertices_indexes.push_back(vertices_indexes);
1454  stsSC_trackster_vertices_x.push_back(vertices_x);
1455  stsSC_trackster_vertices_y.push_back(vertices_y);
1456  stsSC_trackster_vertices_z.push_back(vertices_z);
1457  stsSC_trackster_vertices_time.push_back(vertices_time);
1458  stsSC_trackster_vertices_timeErr.push_back(vertices_timeErr);
1459  stsSC_trackster_vertices_energy.push_back(vertices_energy);
1460  stsSC_trackster_vertices_correctedEnergy.push_back(vertices_correctedEnergy);
1461  stsSC_trackster_vertices_correctedEnergyUncertainty.push_back(vertices_correctedEnergyUncertainty);
1462 
1463  // Multiplicity
1464  std::vector<float> vertices_multiplicity;
1465  for (auto multiplicity : trackster_iterator->vertex_multiplicity()) {
1466  vertices_multiplicity.push_back(multiplicity);
1467  }
1468  stsSC_trackster_vertices_multiplicity.push_back(vertices_multiplicity);
1469  }
1470 
1471  stsCP_ntracksters_ = simTrackstersCP.size();
1472 
1473  for (auto trackster_iterator = simTrackstersCP.begin(); trackster_iterator != simTrackstersCP.end();
1474  ++trackster_iterator) {
1475  //per-trackster analysis
1476  stsCP_trackster_time.push_back(trackster_iterator->time());
1477  stsCP_trackster_timeError.push_back(trackster_iterator->timeError());
1478  stsCP_trackster_regressed_energy.push_back(trackster_iterator->regressed_energy());
1479  stsCP_trackster_raw_energy.push_back(trackster_iterator->raw_energy());
1480  stsCP_trackster_raw_em_energy.push_back(trackster_iterator->raw_em_energy());
1481  stsCP_trackster_raw_pt.push_back(trackster_iterator->raw_pt());
1482  stsCP_trackster_raw_em_pt.push_back(trackster_iterator->raw_em_pt());
1483  stsCP_trackster_barycenter_x.push_back(trackster_iterator->barycenter().x());
1484  stsCP_trackster_barycenter_y.push_back(trackster_iterator->barycenter().y());
1485  stsCP_trackster_barycenter_z.push_back(trackster_iterator->barycenter().z());
1486  stsCP_trackster_barycenter_eta.push_back(trackster_iterator->barycenter().eta());
1487  stsCP_trackster_barycenter_phi.push_back(trackster_iterator->barycenter().phi());
1488  stsCP_trackster_EV1.push_back(trackster_iterator->eigenvalues()[0]);
1489  stsCP_trackster_EV2.push_back(trackster_iterator->eigenvalues()[1]);
1490  stsCP_trackster_EV3.push_back(trackster_iterator->eigenvalues()[2]);
1491  stsCP_trackster_eVector0_x.push_back((trackster_iterator->eigenvectors()[0]).x());
1492  stsCP_trackster_eVector0_y.push_back((trackster_iterator->eigenvectors()[0]).y());
1493  stsCP_trackster_eVector0_z.push_back((trackster_iterator->eigenvectors()[0]).z());
1494  stsCP_trackster_sigmaPCA1.push_back(trackster_iterator->sigmasPCA()[0]);
1495  stsCP_trackster_sigmaPCA2.push_back(trackster_iterator->sigmasPCA()[1]);
1496  stsCP_trackster_sigmaPCA3.push_back(trackster_iterator->sigmasPCA()[2]);
1497  stsCP_pdgID.push_back(caloparticles[trackster_iterator->seedIndex()].pdgId());
1498  CaloObjectVariant caloObj;
1499  if (trackster_iterator->seedID() == caloparticles_h.id()) {
1500  caloObj = caloparticles[trackster_iterator->seedIndex()];
1501  } else {
1502  caloObj = simclusters[trackster_iterator->seedIndex()];
1503  }
1504 
1505  auto const& simTrack = std::visit([](auto&& obj) { return obj.g4Tracks()[0]; }, caloObj);
1506  auto const& caloPt = std::visit([](auto&& obj) { return obj.pt(); }, caloObj);
1507  stsCP_trackster_regressed_pt.push_back(caloPt);
1508 
1509  if (simTrack.crossedBoundary()) {
1510  stsCP_boundaryX.push_back(simTrack.getPositionAtBoundary().x());
1511  stsCP_boundaryY.push_back(simTrack.getPositionAtBoundary().y());
1512  stsCP_boundaryZ.push_back(simTrack.getPositionAtBoundary().z());
1513  stsCP_boundaryEta.push_back(simTrack.getPositionAtBoundary().eta());
1514  stsCP_boundaryPhi.push_back(simTrack.getPositionAtBoundary().phi());
1515  stsCP_boundaryPx.push_back(simTrack.getMomentumAtBoundary().x());
1516  stsCP_boundaryPy.push_back(simTrack.getMomentumAtBoundary().y());
1517  stsCP_boundaryPz.push_back(simTrack.getMomentumAtBoundary().z());
1518  } else {
1519  stsCP_boundaryX.push_back(-999);
1520  stsCP_boundaryY.push_back(-999);
1521  stsCP_boundaryZ.push_back(-999);
1522  stsCP_boundaryEta.push_back(-999);
1523  stsCP_boundaryPhi.push_back(-999);
1524  stsCP_boundaryPx.push_back(-999);
1525  stsCP_boundaryPy.push_back(-999);
1526  stsCP_boundaryPz.push_back(-999);
1527  }
1528  auto const trackIdx = trackster_iterator->trackIdx();
1529  stsCP_trackIdx.push_back(trackIdx);
1530  if (trackIdx != -1) {
1531  const auto& track = tracks[trackIdx];
1532 
1533  int iSide = int(track.eta() > 0);
1534 
1535  const auto& fts = trajectoryStateTransform::outerFreeState((track), bFieldProd);
1536  // to the HGCal front
1537  const auto& tsos = prop.propagate(fts, firstDisk_[iSide]->surface());
1538  if (tsos.isValid()) {
1539  const auto& globalPos = tsos.globalPosition();
1540  const auto& globalMom = tsos.globalMomentum();
1541  stsCP_track_boundaryX.push_back(globalPos.x());
1542  stsCP_track_boundaryY.push_back(globalPos.y());
1543  stsCP_track_boundaryZ.push_back(globalPos.z());
1544  stsCP_track_boundaryEta.push_back(globalPos.eta());
1545  stsCP_track_boundaryPhi.push_back(globalPos.phi());
1546  stsCP_track_boundaryPx.push_back(globalMom.x());
1547  stsCP_track_boundaryPy.push_back(globalMom.y());
1548  stsCP_track_boundaryPz.push_back(globalMom.z());
1549  stsCP_trackTime.push_back(track.t0());
1550  } else {
1551  stsCP_track_boundaryX.push_back(-999);
1552  stsCP_track_boundaryY.push_back(-999);
1553  stsCP_track_boundaryZ.push_back(-999);
1554  stsCP_track_boundaryEta.push_back(-999);
1555  stsCP_track_boundaryPhi.push_back(-999);
1556  stsCP_track_boundaryPx.push_back(-999);
1557  stsCP_track_boundaryPy.push_back(-999);
1558  stsCP_track_boundaryPz.push_back(-999);
1559  }
1560  } else {
1561  stsCP_track_boundaryX.push_back(-999);
1562  stsCP_track_boundaryY.push_back(-999);
1563  stsCP_track_boundaryZ.push_back(-999);
1564  stsCP_track_boundaryEta.push_back(-999);
1565  stsCP_track_boundaryPhi.push_back(-999);
1566  stsCP_track_boundaryPx.push_back(-999);
1567  stsCP_track_boundaryPy.push_back(-999);
1568  stsCP_track_boundaryPz.push_back(-999);
1569  }
1570  std::vector<float> id_probs;
1571  for (size_t i = 0; i < 8; i++)
1572  id_probs.push_back(trackster_iterator->id_probabilities(i));
1573  stsCP_trackster_id_probabilities.push_back(id_probs);
1574 
1575  // Clusters
1576  std::vector<uint32_t> vertices_indexes;
1577  std::vector<float> vertices_x;
1578  std::vector<float> vertices_y;
1579  std::vector<float> vertices_z;
1580  std::vector<float> vertices_time;
1581  std::vector<float> vertices_timeErr;
1582  std::vector<float> vertices_energy;
1583  std::vector<float> vertices_correctedEnergy;
1584  std::vector<float> vertices_correctedEnergyUncertainty;
1585  for (auto idx : trackster_iterator->vertices()) {
1586  vertices_indexes.push_back(idx);
1587  auto associated_cluster = (*layer_clusters_h)[idx];
1588  vertices_x.push_back(associated_cluster.x());
1589  vertices_y.push_back(associated_cluster.y());
1590  vertices_z.push_back(associated_cluster.z());
1591  vertices_energy.push_back(associated_cluster.energy());
1592  vertices_correctedEnergy.push_back(associated_cluster.correctedEnergy());
1593  vertices_correctedEnergyUncertainty.push_back(associated_cluster.correctedEnergyUncertainty());
1594  vertices_time.push_back(layerClustersTimes.get(idx).first);
1595  vertices_timeErr.push_back(layerClustersTimes.get(idx).second);
1596  }
1597  stsCP_trackster_vertices_indexes.push_back(vertices_indexes);
1598  stsCP_trackster_vertices_x.push_back(vertices_x);
1599  stsCP_trackster_vertices_y.push_back(vertices_y);
1600  stsCP_trackster_vertices_z.push_back(vertices_z);
1601  stsCP_trackster_vertices_time.push_back(vertices_time);
1602  stsCP_trackster_vertices_timeErr.push_back(vertices_timeErr);
1603  stsCP_trackster_vertices_energy.push_back(vertices_energy);
1604  stsCP_trackster_vertices_correctedEnergy.push_back(vertices_correctedEnergy);
1605  stsCP_trackster_vertices_correctedEnergyUncertainty.push_back(vertices_correctedEnergyUncertainty);
1606 
1607  // Multiplicity
1608  std::vector<float> vertices_multiplicity;
1609  for (auto multiplicity : trackster_iterator->vertex_multiplicity()) {
1610  vertices_multiplicity.push_back(multiplicity);
1611  }
1612  stsCP_trackster_vertices_multiplicity.push_back(vertices_multiplicity);
1613  }
1614 
1615  simTICLCandidate_track_in_candidate.resize(simTICLCandidates.size(), -1);
1616  for (size_t i = 0; i < simTICLCandidates.size(); ++i) {
1617  auto const& cand = simTICLCandidates[i];
1618 
1619  simTICLCandidate_raw_energy.push_back(cand.rawEnergy());
1620  simTICLCandidate_regressed_energy.push_back(cand.p4().energy());
1621  simTICLCandidate_pdgId.push_back(cand.pdgId());
1622  simTICLCandidate_charge.push_back(cand.charge());
1623  std::vector<int> tmpIdxVec;
1624  for (auto const& simTS : cand.tracksters()) {
1625  auto trackster_idx = simTS.get() - (edm::Ptr<ticl::Trackster>(simTrackstersSC_h, 0)).get();
1626  tmpIdxVec.push_back(trackster_idx);
1627  }
1628  simTICLCandidate_simTracksterCPIndex.push_back(tmpIdxVec);
1629  tmpIdxVec.clear();
1630  auto const& trackPtr = cand.trackPtr();
1631  if (!trackPtr.isNull()) {
1632  auto const& track = *trackPtr;
1633  int iSide = int(track.eta() > 0);
1634  int tk_idx = trackPtr.get() - (edm::Ptr<reco::Track>(tracks_h, 0)).get();
1636 
1637  const auto& fts = trajectoryStateTransform::outerFreeState((track), bFieldProd);
1638  // to the HGCal front
1639  const auto& tsos = prop.propagate(fts, firstDisk_[iSide]->surface());
1640  if (tsos.isValid()) {
1641  const auto& globalPos = tsos.globalPosition();
1642  const auto& globalMom = tsos.globalMomentum();
1643  simTICLCandidate_boundaryX.push_back(globalPos.x());
1644  simTICLCandidate_boundaryY.push_back(globalPos.y());
1645  simTICLCandidate_boundaryZ.push_back(globalPos.z());
1646  simTICLCandidate_boundaryPx.push_back(globalMom.x());
1647  simTICLCandidate_boundaryPy.push_back(globalMom.y());
1648  simTICLCandidate_boundaryPz.push_back(globalMom.z());
1649  simTICLCandidate_trackTime.push_back(track.t0());
1650  simTICLCandidate_trackBeta.push_back(track.beta());
1651  } else {
1652  simTICLCandidate_boundaryX.push_back(-999);
1653  simTICLCandidate_boundaryY.push_back(-999);
1654  simTICLCandidate_boundaryZ.push_back(-999);
1655  simTICLCandidate_boundaryPx.push_back(-999);
1656  simTICLCandidate_boundaryPy.push_back(-999);
1657  simTICLCandidate_boundaryPz.push_back(-999);
1658  simTICLCandidate_trackTime.push_back(-999);
1659  simTICLCandidate_trackBeta.push_back(-999);
1660  }
1661  } else {
1662  simTICLCandidate_boundaryX.push_back(-999);
1663  simTICLCandidate_boundaryY.push_back(-999);
1664  simTICLCandidate_boundaryZ.push_back(-999);
1665  simTICLCandidate_boundaryPx.push_back(-999);
1666  simTICLCandidate_boundaryPy.push_back(-999);
1667  simTICLCandidate_boundaryPz.push_back(-999);
1668  simTICLCandidate_trackTime.push_back(-999);
1669  simTICLCandidate_trackBeta.push_back(-999);
1670  }
1671  }
1672 
1673  int c_id = 0;
1674 
1675  for (auto cluster_iterator = clusters.begin(); cluster_iterator != clusters.end(); ++cluster_iterator) {
1676  auto lc_seed = cluster_iterator->seed();
1677  cluster_seedID.push_back(lc_seed);
1678  cluster_energy.push_back(cluster_iterator->energy());
1679  cluster_correctedEnergy.push_back(cluster_iterator->correctedEnergy());
1680  cluster_correctedEnergyUncertainty.push_back(cluster_iterator->correctedEnergyUncertainty());
1681  cluster_position_x.push_back(cluster_iterator->x());
1682  cluster_position_y.push_back(cluster_iterator->y());
1683  cluster_position_z.push_back(cluster_iterator->z());
1684  cluster_position_eta.push_back(cluster_iterator->eta());
1685  cluster_position_phi.push_back(cluster_iterator->phi());
1686  auto haf = cluster_iterator->hitsAndFractions();
1687  auto layerId = rhtools_.getLayerWithOffset(haf[0].first);
1688  cluster_layer_id.push_back(layerId);
1689  uint32_t number_of_hits = cluster_iterator->hitsAndFractions().size();
1690  cluster_number_of_hits.push_back(number_of_hits);
1691  cluster_type.push_back(rhtools_.getCellType(lc_seed));
1692  cluster_timeErr.push_back(layerClustersTimes.get(c_id).second);
1693  cluster_time.push_back(layerClustersTimes.get(c_id).first);
1694  c_id += 1;
1695  }
1696 
1697  tracksters_in_candidate.resize(ticlcandidates.size());
1698  track_in_candidate.resize(ticlcandidates.size(), -1);
1699  nCandidates = ticlcandidates.size();
1700  for (int i = 0; i < static_cast<int>(ticlcandidates.size()); ++i) {
1701  const auto& candidate = ticlcandidates[i];
1702  candidate_charge.push_back(candidate.charge());
1703  candidate_pdgId.push_back(candidate.pdgId());
1704  candidate_energy.push_back(candidate.energy());
1705  candidate_px.push_back(candidate.px());
1706  candidate_py.push_back(candidate.py());
1707  candidate_pz.push_back(candidate.pz());
1708  candidate_time.push_back(candidate.time());
1709  candidate_time_err.push_back(candidate.timeError());
1710  std::vector<float> id_probs;
1711  for (int j = 0; j < 8; j++) {
1713  id_probs.push_back(candidate.id_probability(type));
1714  }
1715  candidate_id_probabilities.push_back(id_probs);
1716 
1717  auto trackster_ptrs = candidate.tracksters();
1718  auto track_ptr = candidate.trackPtr();
1719  for (const auto& ts_ptr : trackster_ptrs) {
1720  auto ts_idx = ts_ptr.get() - (edm::Ptr<ticl::Trackster>(tracksters_handle, 0)).get();
1721  tracksters_in_candidate[i].push_back(ts_idx);
1722  }
1723  if (track_ptr.isNull())
1724  continue;
1725  int tk_idx = track_ptr.get() - (edm::Ptr<reco::Track>(tracks_h, 0)).get();
1726  track_in_candidate[i] = tk_idx;
1727  }
1728 
1729  nTrackstersMerged = trackstersmerged.size();
1730  for (auto trackster_iterator = trackstersmerged.begin(); trackster_iterator != trackstersmerged.end();
1731  ++trackster_iterator) {
1732  tracksters_merged_time.push_back(trackster_iterator->time());
1733  tracksters_merged_timeError.push_back(trackster_iterator->timeError());
1734  tracksters_merged_regressed_energy.push_back(trackster_iterator->regressed_energy());
1735  tracksters_merged_raw_energy.push_back(trackster_iterator->raw_energy());
1736  tracksters_merged_raw_em_energy.push_back(trackster_iterator->raw_em_energy());
1737  tracksters_merged_raw_pt.push_back(trackster_iterator->raw_pt());
1738  tracksters_merged_raw_em_pt.push_back(trackster_iterator->raw_em_pt());
1739  tracksters_merged_barycenter_x.push_back(trackster_iterator->barycenter().x());
1740  tracksters_merged_barycenter_y.push_back(trackster_iterator->barycenter().y());
1741  tracksters_merged_barycenter_z.push_back(trackster_iterator->barycenter().z());
1742  tracksters_merged_barycenter_eta.push_back(trackster_iterator->barycenter().eta());
1743  tracksters_merged_barycenter_phi.push_back(trackster_iterator->barycenter().phi());
1744  tracksters_merged_EV1.push_back(trackster_iterator->eigenvalues()[0]);
1745  tracksters_merged_EV2.push_back(trackster_iterator->eigenvalues()[1]);
1746  tracksters_merged_EV3.push_back(trackster_iterator->eigenvalues()[2]);
1747  tracksters_merged_eVector0_x.push_back((trackster_iterator->eigenvectors()[0]).x());
1748  tracksters_merged_eVector0_y.push_back((trackster_iterator->eigenvectors()[0]).y());
1749  tracksters_merged_eVector0_z.push_back((trackster_iterator->eigenvectors()[0]).z());
1750  tracksters_merged_sigmaPCA1.push_back(trackster_iterator->sigmasPCA()[0]);
1751  tracksters_merged_sigmaPCA2.push_back(trackster_iterator->sigmasPCA()[1]);
1752  tracksters_merged_sigmaPCA3.push_back(trackster_iterator->sigmasPCA()[2]);
1753 
1754  std::vector<float> id_probs;
1755  for (size_t i = 0; i < 8; i++)
1756  id_probs.push_back(trackster_iterator->id_probabilities(i));
1757  tracksters_merged_id_probabilities.push_back(id_probs);
1758 
1759  std::vector<uint32_t> vertices_indexes;
1760  std::vector<float> vertices_x;
1761  std::vector<float> vertices_y;
1762  std::vector<float> vertices_z;
1763  std::vector<float> vertices_time;
1764  std::vector<float> vertices_timeErr;
1765  std::vector<float> vertices_energy;
1766  std::vector<float> vertices_correctedEnergy;
1767  std::vector<float> vertices_correctedEnergyUncertainty;
1768  for (auto idx : trackster_iterator->vertices()) {
1769  vertices_indexes.push_back(idx);
1770  auto associated_cluster = (*layer_clusters_h)[idx];
1771  vertices_x.push_back(associated_cluster.x());
1772  vertices_y.push_back(associated_cluster.y());
1773  vertices_z.push_back(associated_cluster.z());
1774  vertices_energy.push_back(associated_cluster.energy());
1775  vertices_correctedEnergy.push_back(associated_cluster.correctedEnergy());
1776  vertices_correctedEnergyUncertainty.push_back(associated_cluster.correctedEnergyUncertainty());
1777  vertices_time.push_back(layerClustersTimes.get(idx).first);
1778  vertices_timeErr.push_back(layerClustersTimes.get(idx).second);
1779  }
1780  tracksters_merged_vertices_indexes.push_back(vertices_indexes);
1781  tracksters_merged_vertices_x.push_back(vertices_x);
1782  tracksters_merged_vertices_y.push_back(vertices_y);
1783  tracksters_merged_vertices_z.push_back(vertices_z);
1784  tracksters_merged_vertices_time.push_back(vertices_time);
1785  tracksters_merged_vertices_timeErr.push_back(vertices_timeErr);
1786  tracksters_merged_vertices_energy.push_back(vertices_energy);
1787  tracksters_merged_vertices_correctedEnergy.push_back(vertices_correctedEnergy);
1788  tracksters_merged_vertices_correctedEnergyUncertainty.push_back(vertices_correctedEnergyUncertainty);
1789  }
1790 
1791  // Tackster reco->sim associations
1792  trackstersCLUE3D_recoToSim_SC.resize(tracksters.size());
1793  trackstersCLUE3D_recoToSim_SC_score.resize(tracksters.size());
1794  trackstersCLUE3D_recoToSim_SC_sharedE.resize(tracksters.size());
1795  for (size_t i = 0; i < tracksters.size(); ++i) {
1796  const edm::Ref<ticl::TracksterCollection> tsRef(tracksters_handle, i);
1797 
1798  // CLUE3D -> STS-SC
1799  const auto stsSC_iter = tsRecoSimSCMap.find(tsRef);
1800  if (stsSC_iter != tsRecoSimSCMap.end()) {
1801  const auto& stsSCassociated = stsSC_iter->val;
1802  for (auto& sts : stsSCassociated) {
1803  auto sts_id = (sts.first).get() - (edm::Ref<ticl::TracksterCollection>(simTrackstersSC_h, 0)).get();
1804  trackstersCLUE3D_recoToSim_SC[i].push_back(sts_id);
1805  trackstersCLUE3D_recoToSim_SC_score[i].push_back(sts.second.second);
1806  trackstersCLUE3D_recoToSim_SC_sharedE[i].push_back(sts.second.first);
1807  }
1808  }
1809  }
1810 
1811  // SimTracksters
1812  nsimTrackstersSC = simTrackstersSC.size();
1816  for (size_t i = 0; i < nsimTrackstersSC; ++i) {
1817  const edm::Ref<ticl::TracksterCollection> stsSCRef(simTrackstersSC_h, i);
1818 
1819  // STS-SC -> CLUE3D
1820  const auto ts_iter = tsSimToRecoSCMap.find(stsSCRef);
1821  if (ts_iter != tsSimToRecoSCMap.end()) {
1822  const auto& tsAssociated = ts_iter->val;
1823  for (auto& ts : tsAssociated) {
1824  auto ts_idx = (ts.first).get() - (edm::Ref<ticl::TracksterCollection>(tracksters_handle, 0)).get();
1825  trackstersCLUE3D_simToReco_SC[i].push_back(ts_idx);
1826  trackstersCLUE3D_simToReco_SC_score[i].push_back(ts.second.second);
1827  trackstersCLUE3D_simToReco_SC_sharedE[i].push_back(ts.second.first);
1828  }
1829  }
1830  }
1831 
1832  // Tackster reco->sim associations
1833  trackstersCLUE3D_recoToSim_CP.resize(tracksters.size());
1834  trackstersCLUE3D_recoToSim_CP_score.resize(tracksters.size());
1835  trackstersCLUE3D_recoToSim_CP_sharedE.resize(tracksters.size());
1836  for (size_t i = 0; i < tracksters.size(); ++i) {
1837  const edm::Ref<ticl::TracksterCollection> tsRef(tracksters_handle, i);
1838 
1839  // CLUE3D -> STS-CP
1840  const auto stsCP_iter = tsRecoSimCPMap.find(tsRef);
1841  if (stsCP_iter != tsRecoSimCPMap.end()) {
1842  const auto& stsCPassociated = stsCP_iter->val;
1843  for (auto& sts : stsCPassociated) {
1844  auto sts_id = (sts.first).get() - (edm::Ref<ticl::TracksterCollection>(simTrackstersCP_h, 0)).get();
1845  trackstersCLUE3D_recoToSim_CP[i].push_back(sts_id);
1846  trackstersCLUE3D_recoToSim_CP_score[i].push_back(sts.second.second);
1847  trackstersCLUE3D_recoToSim_CP_sharedE[i].push_back(sts.second.first);
1848  }
1849  }
1850  }
1851 
1852  // SimTracksters
1853  nsimTrackstersCP = simTrackstersCP.size();
1857  for (size_t i = 0; i < nsimTrackstersCP; ++i) {
1858  const edm::Ref<ticl::TracksterCollection> stsCPRef(simTrackstersCP_h, i);
1859 
1860  // STS-CP -> CLUE3D
1861  const auto ts_iter = tsSimToRecoCPMap.find(stsCPRef);
1862  if (ts_iter != tsSimToRecoCPMap.end()) {
1863  const auto& tsAssociated = ts_iter->val;
1864  for (auto& ts : tsAssociated) {
1865  auto ts_idx = (ts.first).get() - (edm::Ref<ticl::TracksterCollection>(tracksters_handle, 0)).get();
1866  trackstersCLUE3D_simToReco_CP[i].push_back(ts_idx);
1867  trackstersCLUE3D_simToReco_CP_score[i].push_back(ts.second.second);
1868  trackstersCLUE3D_simToReco_CP_sharedE[i].push_back(ts.second.first);
1869  }
1870  }
1871  }
1872 
1873  // Tackster reco->sim associations
1874  MergeTracksters_recoToSim_SC.resize(trackstersmerged.size());
1875  MergeTracksters_recoToSim_SC_score.resize(trackstersmerged.size());
1876  MergeTracksters_recoToSim_SC_sharedE.resize(trackstersmerged.size());
1877  for (size_t i = 0; i < trackstersmerged.size(); ++i) {
1878  const edm::Ref<ticl::TracksterCollection> tsRef(tracksters_merged_h, i);
1879 
1880  // CLUE3D -> STS-SC
1881  const auto stsSC_iter = MergetsRecoSimSCMap.find(tsRef);
1882  if (stsSC_iter != MergetsRecoSimSCMap.end()) {
1883  const auto& stsSCassociated = stsSC_iter->val;
1884  for (auto& sts : stsSCassociated) {
1885  auto sts_id = (sts.first).get() - (edm::Ref<ticl::TracksterCollection>(simTrackstersSC_h, 0)).get();
1886  MergeTracksters_recoToSim_SC[i].push_back(sts_id);
1887  MergeTracksters_recoToSim_SC_score[i].push_back(sts.second.second);
1888  MergeTracksters_recoToSim_SC_sharedE[i].push_back(sts.second.first);
1889  }
1890  }
1891  }
1892 
1893  // SimTracksters
1894  nsimTrackstersSC = simTrackstersSC.size();
1898  for (size_t i = 0; i < nsimTrackstersSC; ++i) {
1899  const edm::Ref<ticl::TracksterCollection> stsSCRef(simTrackstersSC_h, i);
1900 
1901  // STS-SC -> CLUE3D
1902  const auto ts_iter = MergetsSimToRecoSCMap.find(stsSCRef);
1903  if (ts_iter != MergetsSimToRecoSCMap.end()) {
1904  const auto& tsAssociated = ts_iter->val;
1905  for (auto& ts : tsAssociated) {
1906  auto ts_idx = (ts.first).get() - (edm::Ref<ticl::TracksterCollection>(tracksters_merged_h, 0)).get();
1907  MergeTracksters_simToReco_SC[i].push_back(ts_idx);
1908  MergeTracksters_simToReco_SC_score[i].push_back(ts.second.second);
1909  MergeTracksters_simToReco_SC_sharedE[i].push_back(ts.second.first);
1910  }
1911  }
1912  }
1913 
1914  // Tackster reco->sim associations
1915  MergeTracksters_recoToSim_CP.resize(trackstersmerged.size());
1916  MergeTracksters_recoToSim_CP_score.resize(trackstersmerged.size());
1917  MergeTracksters_recoToSim_CP_sharedE.resize(trackstersmerged.size());
1918  for (size_t i = 0; i < trackstersmerged.size(); ++i) {
1919  const edm::Ref<ticl::TracksterCollection> tsRef(tracksters_merged_h, i);
1920 
1921  // CLUE3D -> STS-CP
1922  const auto stsCP_iter = MergetsRecoSimCPMap.find(tsRef);
1923  if (stsCP_iter != MergetsRecoSimCPMap.end()) {
1924  const auto& stsCPassociated = stsCP_iter->val;
1925  for (auto& sts : stsCPassociated) {
1926  auto sts_id = (sts.first).get() - (edm::Ref<ticl::TracksterCollection>(simTrackstersCP_h, 0)).get();
1927  MergeTracksters_recoToSim_CP[i].push_back(sts_id);
1928  MergeTracksters_recoToSim_CP_score[i].push_back(sts.second.second);
1929  MergeTracksters_recoToSim_CP_sharedE[i].push_back(sts.second.first);
1930  }
1931  }
1932  }
1933 
1934  // Tackster reco->sim associations
1935  MergeTracksters_recoToSim_PU.resize(trackstersmerged.size());
1936  MergeTracksters_recoToSim_PU_score.resize(trackstersmerged.size());
1937  MergeTracksters_recoToSim_PU_sharedE.resize(trackstersmerged.size());
1938  for (size_t i = 0; i < trackstersmerged.size(); ++i) {
1939  const edm::Ref<ticl::TracksterCollection> tsRef(tracksters_merged_h, i);
1940 
1941  // CLUE3D -> STS-PU
1942  const auto stsPU_iter = MergetsRecoSimPUMap.find(tsRef);
1943  if (stsPU_iter != MergetsRecoSimPUMap.end()) {
1944  const auto& stsPUassociated = stsPU_iter->val;
1945  for (auto& sts : stsPUassociated) {
1946  auto sts_id = (sts.first).get() - (edm::Ref<ticl::TracksterCollection>(simTrackstersPU_h, 0)).get();
1947  MergeTracksters_recoToSim_PU[i].push_back(sts_id);
1948  MergeTracksters_recoToSim_PU_score[i].push_back(sts.second.second);
1949  MergeTracksters_recoToSim_PU_sharedE[i].push_back(sts.second.first);
1950  }
1951  }
1952  }
1953 
1954  // SimTracksters
1955  nsimTrackstersCP = simTrackstersCP.size();
1959  for (size_t i = 0; i < nsimTrackstersCP; ++i) {
1960  const edm::Ref<ticl::TracksterCollection> stsCPRef(simTrackstersCP_h, i);
1961 
1962  // STS-CP -> TrackstersMerge
1963  const auto ts_iter = MergetsSimToRecoCPMap.find(stsCPRef);
1964  if (ts_iter != MergetsSimToRecoCPMap.end()) {
1965  const auto& tsAssociated = ts_iter->val;
1966  for (auto& ts : tsAssociated) {
1967  auto ts_idx = (ts.first).get() - (edm::Ref<ticl::TracksterCollection>(tracksters_merged_h, 0)).get();
1968  MergeTracksters_simToReco_CP[i].push_back(ts_idx);
1969  MergeTracksters_simToReco_CP_score[i].push_back(ts.second.second);
1970  MergeTracksters_simToReco_CP_sharedE[i].push_back(ts.second.first);
1971  }
1972  }
1973  }
1974 
1975  // SimTracksters
1976  auto nsimTrackstersPU = simTrackstersPU.size();
1977  MergeTracksters_simToReco_PU.resize(nsimTrackstersPU);
1978  MergeTracksters_simToReco_PU_score.resize(nsimTrackstersPU);
1979  MergeTracksters_simToReco_PU_sharedE.resize(nsimTrackstersPU);
1980  for (size_t i = 0; i < nsimTrackstersPU; ++i) {
1981  const edm::Ref<ticl::TracksterCollection> stsPURef(simTrackstersPU_h, i);
1982 
1983  // STS-PU -> Tracksters Merge
1984  const auto ts_iter = MergetsSimToRecoPUMap.find(stsPURef);
1985  if (ts_iter != MergetsSimToRecoPUMap.end()) {
1986  const auto& tsAssociated = ts_iter->val;
1987  for (auto& ts : tsAssociated) {
1988  auto ts_idx = (ts.first).get() - (edm::Ref<ticl::TracksterCollection>(tracksters_merged_h, 0)).get();
1989  MergeTracksters_simToReco_PU[i].push_back(ts_idx);
1990  MergeTracksters_simToReco_PU_score[i].push_back(ts.second.second);
1991  MergeTracksters_simToReco_PU_sharedE[i].push_back(ts.second.first);
1992  }
1993  }
1994  }
1995 
1996  //Tracks
1997  for (size_t i = 0; i < tracks.size(); i++) {
1998  const auto& track = tracks[i];
1999  reco::TrackRef trackref = reco::TrackRef(tracks_h, i);
2000  int iSide = int(track.eta() > 0);
2001  const auto& fts = trajectoryStateTransform::outerFreeState((track), bFieldProd);
2002  // to the HGCal front
2003  const auto& tsos = prop.propagate(fts, firstDisk_[iSide]->surface());
2004  if (tsos.isValid()) {
2005  const auto& globalPos = tsos.globalPosition();
2006  const auto& globalMom = tsos.globalMomentum();
2007  track_id.push_back(i);
2008  track_hgcal_x.push_back(globalPos.x());
2009  track_hgcal_y.push_back(globalPos.y());
2010  track_hgcal_z.push_back(globalPos.z());
2011  track_hgcal_eta.push_back(globalPos.eta());
2012  track_hgcal_phi.push_back(globalPos.phi());
2013  track_hgcal_px.push_back(globalMom.x());
2014  track_hgcal_py.push_back(globalMom.y());
2015  track_hgcal_pz.push_back(globalMom.z());
2016  track_hgcal_pt.push_back(globalMom.perp());
2017  track_pt.push_back(track.pt());
2018  track_quality.push_back(track.quality(reco::TrackBase::highPurity));
2019  track_missing_outer_hits.push_back(track.missingOuterHits());
2020  track_charge.push_back(track.charge());
2021  track_time.push_back(trackTime[trackref]);
2022  track_time_quality.push_back(trackTimeQual[trackref]);
2023  track_time_err.push_back(trackTimeErr[trackref]);
2024  track_nhits.push_back(tracks[i].recHitsSize());
2025  }
2026  }
2027 
2029  trackster_tree_->Fill();
2030  if (saveLCs_)
2031  cluster_tree_->Fill();
2032  if (saveTICLCandidate_)
2033  candidate_tree_->Fill();
2035  tracksters_merged_tree_->Fill();
2036  if (saveAssociations_)
2037  associations_tree_->Fill();
2039  simtrackstersSC_tree_->Fill();
2041  simtrackstersCP_tree_->Fill();
2042  if (saveTracks_)
2043  tracks_tree_->Fill();
2045  simTICLCandidate_tree->Fill();
2046 }
2047 
2049 
2052  desc.add<edm::InputTag>("trackstersclue3d", edm::InputTag("ticlTrackstersCLUE3DHigh"));
2053  desc.add<edm::InputTag>("layerClusters", edm::InputTag("hgcalMergeLayerClusters"));
2054  desc.add<edm::InputTag>("layer_clustersTime", edm::InputTag("hgcalMergeLayerClusters", "timeLayerCluster"));
2055  desc.add<edm::InputTag>("ticlcandidates", edm::InputTag("ticlTrackstersMerge"));
2056  desc.add<edm::InputTag>("tracks", edm::InputTag("generalTracks"));
2057  desc.add<edm::InputTag>("tracksTime", edm::InputTag("tofPID:t0"));
2058  desc.add<edm::InputTag>("tracksTimeQual", edm::InputTag("mtdTrackQualityMVA:mtdQualMVA"));
2059  desc.add<edm::InputTag>("tracksTimeErr", edm::InputTag("tofPID:sigmat0"));
2060  desc.add<edm::InputTag>("trackstersmerged", edm::InputTag("ticlTrackstersMerge"));
2061  desc.add<edm::InputTag>("simtrackstersSC", edm::InputTag("ticlSimTracksters"));
2062  desc.add<edm::InputTag>("simtrackstersCP", edm::InputTag("ticlSimTracksters", "fromCPs"));
2063  desc.add<edm::InputTag>("simtrackstersPU", edm::InputTag("ticlSimTracksters", "PU"));
2064  desc.add<edm::InputTag>("simTICLCandidates", edm::InputTag("ticlSimTracksters"));
2065  desc.add<edm::InputTag>("recoToSimAssociatorSC",
2066  edm::InputTag("tracksterSimTracksterAssociationPRbyCLUE3D", "recoToSim"));
2067  desc.add<edm::InputTag>("simToRecoAssociatorSC",
2068  edm::InputTag("tracksterSimTracksterAssociationPRbyCLUE3D", "simToReco"));
2069  desc.add<edm::InputTag>("recoToSimAssociatorCP",
2070  edm::InputTag("tracksterSimTracksterAssociationLinkingbyCLUE3D", "recoToSim"));
2071  desc.add<edm::InputTag>("simToRecoAssociatorCP",
2072  edm::InputTag("tracksterSimTracksterAssociationLinkingbyCLUE3D", "simToReco"));
2073  desc.add<edm::InputTag>("MergerecoToSimAssociatorSC",
2074  edm::InputTag("tracksterSimTracksterAssociationPR", "recoToSim"));
2075  desc.add<edm::InputTag>("MergesimToRecoAssociatorSC",
2076  edm::InputTag("tracksterSimTracksterAssociationPR", "simToReco"));
2077  desc.add<edm::InputTag>("MergerecoToSimAssociatorCP",
2078  edm::InputTag("tracksterSimTracksterAssociationLinking", "recoToSim"));
2079  desc.add<edm::InputTag>("MergesimToRecoAssociatorCP",
2080  edm::InputTag("tracksterSimTracksterAssociationLinking", "simToReco"));
2081  desc.add<edm::InputTag>("MergerecoToSimAssociatorPU",
2082  edm::InputTag("tracksterSimTracksterAssociationLinkingPU", "recoToSim"));
2083  desc.add<edm::InputTag>("MergesimToRecoAssociatorPU",
2084  edm::InputTag("tracksterSimTracksterAssociationLinkingPU", "simToReco"));
2085  desc.add<edm::InputTag>("simclusters", edm::InputTag("mix", "MergedCaloTruth"));
2086  desc.add<edm::InputTag>("caloparticles", edm::InputTag("mix", "MergedCaloTruth"));
2087  desc.add<std::string>("detector", "HGCAL");
2088  desc.add<std::string>("propagator", "PropagatorWithMaterial");
2089 
2090  desc.add<bool>("saveLCs", true);
2091  desc.add<bool>("saveCLUE3DTracksters", true);
2092  desc.add<bool>("saveTrackstersMerged", true);
2093  desc.add<bool>("saveSimTrackstersSC", true);
2094  desc.add<bool>("saveSimTrackstersCP", true);
2095  desc.add<bool>("saveTICLCandidate", true);
2096  desc.add<bool>("saveSimTICLCandidate", true);
2097  desc.add<bool>("saveTracks", true);
2098  desc.add<bool>("saveAssociations", true);
2099  descriptions.add("ticlDumper", desc);
2100 }
2101 
std::vector< float > stsSC_trackster_time
Definition: TICLDumper.cc:188
size_t nsimTrackstersCP
Definition: TICLDumper.cc:153
TTree * simtrackstersSC_tree_
Definition: TICLDumper.cc:433
std::vector< std::vector< float > > MergeTracksters_recoToSim_PU_score
Definition: TICLDumper.cc:388
std::vector< float > stsCP_trackster_EV3
Definition: TICLDumper.cc:255
double waferZ(int layer, bool reco) const
std::vector< float > stsSC_trackster_sigmaPCA1
Definition: TICLDumper.cc:207
const edm::EDGetTokenT< std::vector< ticl::Trackster > > simTracksters_PU_token_
Definition: TICLDumper.cc:104
std::vector< float > stsSC_trackster_barycenter_x
Definition: TICLDumper.cc:196
std::vector< float > stsCP_trackster_eVector0_x
Definition: TICLDumper.cc:256
std::vector< float > cluster_timeErr
Definition: TICLDumper.cc:406
static DiskPointer build(Args &&... args)
Definition: BoundDisk.h:38
const edm::EDGetTokenT< std::vector< double > > hgcaltracks_eta_token_
Definition: TICLDumper.cc:93
std::vector< std::vector< float > > MergeTracksters_simToReco_PU_score
Definition: TICLDumper.cc:391
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometry_token_
Definition: TICLDumper.cc:119
std::vector< float > cluster_position_x
Definition: TICLDumper.cc:398
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
std::vector< float > stsCP_track_boundaryPx
Definition: TICLDumper.cc:278
std::vector< int > simTICLCandidate_charge
Definition: TICLDumper.cc:306
std::vector< std::vector< float > > stsSC_trackster_vertices_correctedEnergy
Definition: TICLDumper.cc:237
math::XYZVector Vector
Definition: TICLDumper.cc:64
std::vector< std::vector< float > > tracksters_merged_vertices_energy
Definition: TICLDumper.cc:352
std::vector< float > stsCP_trackster_eVector0_z
Definition: TICLDumper.cc:258
TTree * cluster_tree_
Definition: TICLDumper.cc:429
std::vector< float > stsCP_trackster_barycenter_eta
Definition: TICLDumper.cc:251
std::vector< float > stsSC_track_boundaryPz
Definition: TICLDumper.cc:228
std::vector< float > trackster_EV1
Definition: TICLDumper.cc:165
std::vector< double > candidate_py
Definition: TICLDumper.cc:315
std::vector< float > stsSC_boundaryPx
Definition: TICLDumper.cc:218
std::vector< float > tracksters_merged_eVector0_x
Definition: TICLDumper.cc:340
ProductID id() const
Definition: HandleBase.cc:29
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const edm::EDGetTokenT< std::vector< double > > hgcaltracks_py_token_
Definition: TICLDumper.cc:96
std::vector< float > trackster_sigmaPCA1
Definition: TICLDumper.cc:171
bool saveTrackstersMerged_
Definition: TICLDumper.cc:133
std::vector< float > trackster_barycenter_y
Definition: TICLDumper.cc:163
unsigned int stsCP_ntracksters_
Definition: TICLDumper.cc:151
const edm::EDGetTokenT< hgcal::SimToRecoCollectionSimTracksters > MergeSimToRecoCP_token_
Definition: TICLDumper.cc:113
bool saveAssociations_
Definition: TICLDumper.cc:139
std::vector< float > simTICLCandidate_raw_energy
Definition: TICLDumper.cc:293
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition: TICLDumper.cc:78
std::vector< float > stsSC_trackster_barycenter_y
Definition: TICLDumper.cc:197
TTree * simtrackstersCP_tree_
Definition: TICLDumper.cc:434
std::vector< std::vector< float > > trackster_vertices_correctedEnergyUncertainty
Definition: TICLDumper.cc:185
std::vector< std::vector< float > > trackster_vertices_multiplicity
Definition: TICLDumper.cc:186
std::vector< float > stsSC_boundaryX
Definition: TICLDumper.cc:213
std::vector< float > stsSC_track_boundaryPhi
Definition: TICLDumper.cc:225
std::vector< float > stsSC_trackster_timeError
Definition: TICLDumper.cc:189
std::vector< std::vector< float > > trackster_vertices_y
Definition: TICLDumper.cc:179
bool saveSimTrackstersSC_
Definition: TICLDumper.cc:134
std::vector< float > stsCP_boundaryY
Definition: TICLDumper.cc:266
std::vector< std::vector< uint32_t > > tracksters_in_candidate
Definition: TICLDumper.cc:320
std::vector< float > cluster_position_y
Definition: TICLDumper.cc:399
std::vector< int > stsSC_pdgID
Definition: TICLDumper.cc:210
std::vector< float > stsCP_boundaryX
Definition: TICLDumper.cc:265
std::vector< std::vector< float > > stsCP_trackster_vertices_time
Definition: TICLDumper.cc:286
void endJob() override
Definition: TICLDumper.cc:2048
std::vector< float > cluster_correctedEnergy
Definition: TICLDumper.cc:396
std::vector< float > stsSC_trackster_regressed_pt
Definition: TICLDumper.cc:191
std::vector< float > trackster_raw_pt
Definition: TICLDumper.cc:160
std::vector< float > trackster_eVector0_z
Definition: TICLDumper.cc:170
std::vector< uint32_t > cluster_seedID
Definition: TICLDumper.cc:394
const edm::EDGetTokenT< hgcal::SimToRecoCollectionSimTracksters > tsSimToRecoCP_token_
Definition: TICLDumper.cc:109
void buildLayers()
Definition: TICLDumper.cc:1098
std::vector< std::vector< uint32_t > > MergeTracksters_recoToSim_SC
Definition: TICLDumper.cc:373
std::vector< double > Vec
Definition: TICLDumper.cc:65
std::vector< std::vector< float > > MergeTracksters_simToReco_SC_sharedE
Definition: TICLDumper.cc:378
int getCellType(const DetId &id) const
Definition: RecHitTools.cc:439
std::vector< float > cluster_position_z
Definition: TICLDumper.cc:400
std::vector< std::vector< float > > stsSC_trackster_vertices_z
Definition: TICLDumper.cc:233
std::vector< int > track_quality
Definition: TICLDumper.cc:420
std::vector< float > stsSC_trackster_eVector0_z
Definition: TICLDumper.cc:206
std::vector< float > track_hgcal_y
Definition: TICLDumper.cc:411
std::vector< std::vector< float > > MergeTracksters_recoToSim_SC_score
Definition: TICLDumper.cc:374
std::vector< std::vector< uint32_t > > stsSC_trackster_vertices_indexes
Definition: TICLDumper.cc:230
size_t nsimTrackstersSC
Definition: TICLDumper.cc:152
std::vector< unsigned int > track_id
Definition: TICLDumper.cc:409
const edm::EDGetTokenT< std::vector< TICLCandidate > > ticl_candidates_token_
Definition: TICLDumper.cc:84
std::vector< float > stsCP_trackster_barycenter_phi
Definition: TICLDumper.cc:252
std::vector< float > tracksters_merged_sigmaPCA3
Definition: TICLDumper.cc:345
std::vector< float > simTICLCandidate_boundaryY
Definition: TICLDumper.cc:297
std::vector< std::vector< float > > trackster_vertices_energy
Definition: TICLDumper.cc:183
std::vector< float > trackster_raw_em_energy
Definition: TICLDumper.cc:159
const edm::EDGetTokenT< std::vector< ticl::Trackster > > simTracksters_SC_token_
Definition: TICLDumper.cc:102
std::vector< std::vector< uint32_t > > trackstersCLUE3D_simToReco_CP
Definition: TICLDumper.cc:369
const edm::EDGetTokenT< edm::ValueMap< float > > tracks_time_quality_token_
Definition: TICLDumper.cc:88
std::vector< std::vector< float > > trackster_vertices_time
Definition: TICLDumper.cc:181
std::vector< float > stsSC_boundaryPz
Definition: TICLDumper.cc:220
std::vector< std::vector< float > > trackster_vertices_z
Definition: TICLDumper.cc:180
std::vector< float > stsCP_trackster_EV1
Definition: TICLDumper.cc:253
void clearVariables()
Definition: TICLDumper.cc:439
const HGCalDDDConstants * hgcons_
Definition: TICLDumper.cc:126
std::vector< float > cluster_energy
Definition: TICLDumper.cc:395
const edm::ESGetToken< Propagator, TrackingComponentsRecord > propagator_token_
Definition: TICLDumper.cc:123
std::vector< std::vector< float > > MergeTracksters_recoToSim_CP_sharedE
Definition: TICLDumper.cc:382
std::vector< int > candidate_charge
Definition: TICLDumper.cc:311
std::vector< float > track_hgcal_pz
Definition: TICLDumper.cc:415
std::vector< float > trackster_barycenter_x
Definition: TICLDumper.cc:162
std::unique_ptr< GeomDet > interfaceDisk_[2]
Definition: TICLDumper.cc:128
std::vector< std::vector< float > > stsSC_trackster_vertices_time
Definition: TICLDumper.cc:234
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
void beginJob() override
Definition: TICLDumper.cc:797
unsigned int stsSC_ntracksters_
Definition: TICLDumper.cc:150
std::vector< std::vector< float > > trackster_id_probabilities
Definition: TICLDumper.cc:176
std::vector< float > stsCP_trackTime
Definition: TICLDumper.cc:264
std::vector< float > stsCP_boundaryEta
Definition: TICLDumper.cc:268
std::vector< std::vector< float > > tracksters_merged_vertices_z
Definition: TICLDumper.cc:349
std::vector< std::vector< float > > stsCP_trackster_vertices_timeErr
Definition: TICLDumper.cc:287
std::vector< std::vector< uint32_t > > MergeTracksters_recoToSim_PU
Definition: TICLDumper.cc:387
std::vector< float > candidate_time
Definition: TICLDumper.cc:317
std::vector< float > stsSC_trackster_raw_pt
Definition: TICLDumper.cc:194
bool saveSimTrackstersCP_
Definition: TICLDumper.cc:135
std::vector< std::vector< uint32_t > > trackstersCLUE3D_recoToSim_SC
Definition: TICLDumper.cc:359
std::vector< float > tracksters_merged_time
Definition: TICLDumper.cc:325
std::vector< float > stsCP_boundaryPz
Definition: TICLDumper.cc:272
std::vector< float > tracksters_merged_sigmaPCA2
Definition: TICLDumper.cc:344
std::vector< float > track_hgcal_px
Definition: TICLDumper.cc:413
TTree * candidate_tree_
Definition: TICLDumper.cc:430
std::vector< std::vector< float > > MergeTracksters_recoToSim_SC_sharedE
Definition: TICLDumper.cc:375
std::vector< unsigned int > cluster_layer_id
Definition: TICLDumper.cc:403
std::vector< float > candidate_energy
Definition: TICLDumper.cc:313
std::vector< float > tracksters_merged_barycenter_phi
Definition: TICLDumper.cc:336
std::vector< int > track_charge
Definition: TICLDumper.cc:422
std::vector< float > stsSC_boundaryPhi
Definition: TICLDumper.cc:217
std::vector< float > tracksters_merged_eVector0_z
Definition: TICLDumper.cc:342
std::vector< float > stsCP_track_boundaryPy
Definition: TICLDumper.cc:279
std::vector< float > tracksters_merged_raw_pt
Definition: TICLDumper.cc:330
std::vector< float > tracksters_merged_raw_em_energy
Definition: TICLDumper.cc:329
std::vector< int > simTICLCandidate_track_in_candidate
Definition: TICLDumper.cc:307
std::vector< float > track_hgcal_eta
Definition: TICLDumper.cc:416
std::vector< float > tracksters_merged_raw_em_pt
Definition: TICLDumper.cc:331
std::vector< float > stsSC_track_boundaryPx
Definition: TICLDumper.cc:226
std::vector< int > cluster_type
Definition: TICLDumper.cc:404
std::vector< std::vector< float > > tracksters_merged_vertices_multiplicity
Definition: TICLDumper.cc:355
std::vector< std::vector< uint32_t > > stsCP_trackster_vertices_indexes
Definition: TICLDumper.cc:282
const edm::EDGetTokenT< std::vector< CaloParticle > > caloparticles_token_
Definition: TICLDumper.cc:117
std::vector< float > trackster_barycenter_z
Definition: TICLDumper.cc:164
std::vector< float > stsCP_trackster_sigmaPCA1
Definition: TICLDumper.cc:259
const edm::EDGetTokenT< edm::ValueMap< float > > tracks_time_token_
Definition: TICLDumper.cc:87
size_t nCandidates
Definition: TICLDumper.cc:310
int iEvent
Definition: GenABIO.cc:224
T const * product() const
Definition: ESHandle.h:86
std::vector< std::vector< float > > stsCP_trackster_vertices_y
Definition: TICLDumper.cc:284
std::vector< float > simTICLCandidate_boundaryZ
Definition: TICLDumper.cc:298
std::vector< float > stsCP_trackster_barycenter_z
Definition: TICLDumper.cc:250
const edm::EDGetTokenT< std::vector< ticl::Trackster > > tracksters_token_
Definition: TICLDumper.cc:82
GlobalPoint globalPosition() const
std::vector< std::vector< uint32_t > > MergeTracksters_simToReco_PU
Definition: TICLDumper.cc:390
std::vector< float > track_hgcal_z
Definition: TICLDumper.cc:412
std::vector< std::vector< float > > trackstersCLUE3D_simToReco_SC_sharedE
Definition: TICLDumper.cc:364
std::vector< std::vector< float > > stsCP_trackster_vertices_correctedEnergyUncertainty
Definition: TICLDumper.cc:290
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: TICLDumper.cc:1135
std::vector< float > stsCP_boundaryZ
Definition: TICLDumper.cc:267
std::vector< float > stsCP_track_boundaryPhi
Definition: TICLDumper.cc:277
std::vector< std::vector< float > > stsCP_trackster_vertices_z
Definition: TICLDumper.cc:285
std::vector< int > track_missing_outer_hits
Definition: TICLDumper.cc:421
const edm::EDGetTokenT< hgcal::RecoToSimCollectionSimTracksters > MergeRecoToSimPU_token_
Definition: TICLDumper.cc:114
const edm::EDGetTokenT< hgcal::SimToRecoCollectionSimTracksters > tsSimToRecoSC_token_
Definition: TICLDumper.cc:107
std::vector< float > stsSC_trackster_raw_em_energy
Definition: TICLDumper.cc:193
std::vector< float > tracksters_merged_barycenter_eta
Definition: TICLDumper.cc:335
std::vector< float > stsSC_track_boundaryX
Definition: TICLDumper.cc:221
std::vector< std::vector< float > > MergeTracksters_recoToSim_CP_score
Definition: TICLDumper.cc:381
const edm::EDGetTokenT< hgcal::SimToRecoCollectionSimTracksters > MergeSimToRecoPU_token_
Definition: TICLDumper.cc:115
std::vector< float > tracksters_merged_barycenter_y
Definition: TICLDumper.cc:333
std::vector< float > track_hgcal_phi
Definition: TICLDumper.cc:417
std::vector< std::vector< float > > tracksters_merged_vertices_timeErr
Definition: TICLDumper.cc:351
std::vector< float > cluster_time
Definition: TICLDumper.cc:405
std::vector< float > simTICLCandidate_boundaryPy
Definition: TICLDumper.cc:300
std::vector< double > track_time
Definition: TICLDumper.cc:423
TTree * tracksters_merged_tree_
Definition: TICLDumper.cc:431
std::vector< double > candidate_pz
Definition: TICLDumper.cc:316
std::vector< std::vector< float > > stsSC_trackster_vertices_y
Definition: TICLDumper.cc:232
std::vector< std::vector< float > > MergeTracksters_simToReco_CP_sharedE
Definition: TICLDumper.cc:385
TTree * associations_tree_
Definition: TICLDumper.cc:432
std::vector< float > trackster_barycenter_phi
Definition: TICLDumper.cc:175
std::vector< float > stsCP_trackster_timeError
Definition: TICLDumper.cc:241
std::vector< std::vector< float > > tracksters_merged_vertices_correctedEnergyUncertainty
Definition: TICLDumper.cc:354
std::vector< std::vector< float > > trackstersCLUE3D_recoToSim_SC_sharedE
Definition: TICLDumper.cc:361
std::vector< float > stsSC_trackTime
Definition: TICLDumper.cc:212
std::vector< std::vector< float > > stsCP_trackster_id_probabilities
Definition: TICLDumper.cc:281
Transition
Definition: Transition.h:12
bool saveTICLCandidate_
Definition: TICLDumper.cc:136
std::vector< float > stsSC_track_boundaryZ
Definition: TICLDumper.cc:223
std::vector< float > trackster_sigmaPCA2
Definition: TICLDumper.cc:172
std::vector< float > simTICLCandidate_trackTime
Definition: TICLDumper.cc:302
std::vector< float > tracksters_merged_sigmaPCA1
Definition: TICLDumper.cc:343
std::vector< std::vector< float > > MergeTracksters_recoToSim_PU_sharedE
Definition: TICLDumper.cc:389
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ESHandle< Propagator > propagator_
Definition: TICLDumper.cc:130
std::vector< float > simTICLCandidate_boundaryPx
Definition: TICLDumper.cc:299
std::vector< float > stsSC_trackster_raw_energy
Definition: TICLDumper.cc:192
std::vector< float > simTICLCandidate_boundaryX
Definition: TICLDumper.cc:296
std::vector< double > candidate_px
Definition: TICLDumper.cc:314
std::vector< float > stsCP_trackster_EV2
Definition: TICLDumper.cc:254
const edm::EDGetTokenT< std::vector< double > > hgcaltracks_x_token_
Definition: TICLDumper.cc:90
std::vector< float > tracksters_merged_EV1
Definition: TICLDumper.cc:337
std::vector< float > tracksters_merged_timeError
Definition: TICLDumper.cc:326
std::vector< float > stsSC_trackster_EV3
Definition: TICLDumper.cc:203
std::vector< float > stsCP_track_boundaryZ
Definition: TICLDumper.cc:275
std::vector< std::vector< uint32_t > > trackster_vertices_indexes
Definition: TICLDumper.cc:177
size_t nTrackstersMerged
Definition: TICLDumper.cc:324
const edm::EDGetTokenT< std::vector< double > > hgcaltracks_z_token_
Definition: TICLDumper.cc:92
std::vector< float > track_hgcal_pt
Definition: TICLDumper.cc:418
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
const edm::EDGetTokenT< hgcal::RecoToSimCollectionSimTracksters > MergeRecoToSimSC_token_
Definition: TICLDumper.cc:110
std::vector< int > simTICLCandidate_pdgId
Definition: TICLDumper.cc:305
TICLDumper(const edm::ParameterSet &)
Definition: TICLDumper.cc:720
const edm::EDGetTokenT< std::vector< double > > hgcaltracks_px_token_
Definition: TICLDumper.cc:95
std::vector< std::vector< float > > stsSC_trackster_vertices_x
Definition: TICLDumper.cc:231
std::vector< float > stsCP_boundaryPhi
Definition: TICLDumper.cc:269
std::vector< float > trackster_raw_em_pt
Definition: TICLDumper.cc:161
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: TICLDumper.cc:2050
std::vector< float > stsSC_track_boundaryPy
Definition: TICLDumper.cc:227
std::vector< std::vector< uint32_t > > MergeTracksters_simToReco_SC
Definition: TICLDumper.cc:376
std::vector< float > stsSC_boundaryPy
Definition: TICLDumper.cc:219
std::vector< float > stsCP_trackster_time
Definition: TICLDumper.cc:240
std::vector< std::vector< float > > trackstersCLUE3D_recoToSim_CP_sharedE
Definition: TICLDumper.cc:368
std::vector< float > track_time_quality
Definition: TICLDumper.cc:424
const std::string propName_
Definition: TICLDumper.cc:121
std::pair< double, double > rangeR(double z, bool reco) const
std::vector< float > tracksters_merged_regressed_energy
Definition: TICLDumper.cc:327
std::vector< std::vector< float > > tracksters_merged_vertices_y
Definition: TICLDumper.cc:348
bool saveLCs_
Definition: TICLDumper.cc:131
std::vector< float > trackster_eVector0_x
Definition: TICLDumper.cc:168
TTree * tracks_tree_
Definition: TICLDumper.cc:435
std::vector< float > trackster_eVector0_y
Definition: TICLDumper.cc:169
std::vector< float > trackster_EV3
Definition: TICLDumper.cc:167
std::vector< float > stsSC_trackster_barycenter_eta
Definition: TICLDumper.cc:199
std::vector< float > trackster_time
Definition: TICLDumper.cc:155
std::vector< std::vector< float > > stsCP_trackster_vertices_correctedEnergy
Definition: TICLDumper.cc:289
std::vector< float > simTICLCandidate_regressed_energy
Definition: TICLDumper.cc:294
const edm::EDGetTokenT< hgcal::SimToRecoCollectionSimTracksters > MergeSimToRecoSC_token_
Definition: TICLDumper.cc:111
std::vector< std::vector< float > > trackstersCLUE3D_simToReco_CP_score
Definition: TICLDumper.cc:370
const edm::EDGetTokenT< hgcal::RecoToSimCollectionSimTracksters > MergeRecoToSimCP_token_
Definition: TICLDumper.cc:112
std::vector< std::vector< float > > tracksters_merged_vertices_time
Definition: TICLDumper.cc:350
const edm::EDGetTokenT< std::vector< bool > > tracks_mask_token_
Definition: TICLDumper.cc:86
std::vector< std::vector< float > > stsSC_trackster_vertices_correctedEnergyUncertainty
Definition: TICLDumper.cc:238
std::vector< float > simTICLCandidate_caloParticleMass
Definition: TICLDumper.cc:304
std::vector< float > stsSC_trackster_barycenter_z
Definition: TICLDumper.cc:198
std::vector< std::vector< float > > stsSC_trackster_vertices_energy
Definition: TICLDumper.cc:236
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
std::vector< float > stsSC_track_boundaryY
Definition: TICLDumper.cc:222
std::vector< std::vector< float > > trackstersCLUE3D_simToReco_SC_score
Definition: TICLDumper.cc:363
const edm::EDGetTokenT< std::vector< int > > tracksterSeeds_token_
Definition: TICLDumper.cc:100
std::vector< std::vector< float > > tracksters_merged_id_probabilities
Definition: TICLDumper.cc:356
void beginRun(const edm::Run &, const edm::EventSetup &) override
Definition: TICLDumper.cc:785
edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > hdc_token_
Definition: TICLDumper.cc:125
std::vector< float > stsCP_trackster_sigmaPCA3
Definition: TICLDumper.cc:261
bool saveTracks_
Definition: TICLDumper.cc:138
const edm::EDGetTokenT< std::vector< double > > hgcaltracks_y_token_
Definition: TICLDumper.cc:91
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
std::vector< float > tracksters_merged_EV2
Definition: TICLDumper.cc:338
std::vector< std::vector< uint32_t > > MergeTracksters_recoToSim_CP
Definition: TICLDumper.cc:380
std::vector< float > stsSC_trackster_sigmaPCA3
Definition: TICLDumper.cc:209
const edm::EDGetTokenT< std::vector< ticl::Trackster > > simTracksters_CP_token_
Definition: TICLDumper.cc:103
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< std::vector< float > > stsSC_trackster_vertices_multiplicity
Definition: TICLDumper.cc:239
GlobalPoint getPositionLayer(int layer, bool nose=false) const
Definition: RecHitTools.cc:152
std::vector< float > stsSC_boundaryZ
Definition: TICLDumper.cc:215
std::vector< std::vector< float > > stsSC_trackster_id_probabilities
Definition: TICLDumper.cc:229
std::vector< float > stsSC_trackster_EV1
Definition: TICLDumper.cc:201
std::vector< float > cluster_position_eta
Definition: TICLDumper.cc:401
const edm::EDGetTokenT< std::vector< ticl::Trackster > > tracksters_merged_token_
Definition: TICLDumper.cc:98
hgcal::RecHitTools rhtools_
Definition: TICLDumper.cc:124
std::vector< float > track_pt
Definition: TICLDumper.cc:419
unsigned int nclusters_
Definition: TICLDumper.cc:149
std::vector< std::vector< float > > candidate_id_probabilities
Definition: TICLDumper.cc:319
std::vector< float > trackster_barycenter_eta
Definition: TICLDumper.cc:174
std::vector< float > stsCP_trackster_regressed_energy
Definition: TICLDumper.cc:242
std::vector< float > stsCP_trackster_sigmaPCA2
Definition: TICLDumper.cc:260
std::vector< float > stsCP_track_boundaryPz
Definition: TICLDumper.cc:280
void setGeometry(CaloGeometry const &)
Definition: RecHitTools.cc:79
std::vector< std::vector< float > > MergeTracksters_simToReco_PU_sharedE
Definition: TICLDumper.cc:392
std::vector< float > stsSC_trackster_regressed_energy
Definition: TICLDumper.cc:190
std::vector< std::vector< uint32_t > > MergeTracksters_simToReco_CP
Definition: TICLDumper.cc:383
std::vector< std::vector< int > > simTICLCandidate_simTracksterCPIndex
Definition: TICLDumper.cc:295
std::vector< float > tracksters_merged_EV3
Definition: TICLDumper.cc:339
std::vector< float > track_hgcal_py
Definition: TICLDumper.cc:414
bool saveSimTICLCandidate_
Definition: TICLDumper.cc:137
std::vector< int > track_in_candidate
Definition: TICLDumper.cc:321
std::vector< float > track_time_err
Definition: TICLDumper.cc:425
std::vector< std::vector< float > > trackster_vertices_correctedEnergy
Definition: TICLDumper.cc:184
fixed size matrix
std::vector< std::vector< uint32_t > > trackstersCLUE3D_simToReco_SC
Definition: TICLDumper.cc:362
HLT enums.
std::vector< float > stsSC_trackster_raw_em_pt
Definition: TICLDumper.cc:195
std::vector< std::vector< float > > trackstersCLUE3D_recoToSim_SC_score
Definition: TICLDumper.cc:360
std::vector< float > trackster_sigmaPCA3
Definition: TICLDumper.cc:173
std::vector< int > stsCP_trackIdx
Definition: TICLDumper.cc:263
std::vector< float > cluster_correctedEnergyUncertainty
Definition: TICLDumper.cc:397
std::vector< float > stsCP_trackster_barycenter_x
Definition: TICLDumper.cc:248
std::vector< int > candidate_pdgId
Definition: TICLDumper.cc:312
std::unique_ptr< GeomDet > firstDisk_[2]
Definition: TICLDumper.cc:127
std::vector< float > stsCP_trackster_regressed_pt
Definition: TICLDumper.cc:243
std::vector< std::vector< float > > MergeTracksters_simToReco_CP_score
Definition: TICLDumper.cc:384
std::vector< float > stsCP_trackster_raw_em_energy
Definition: TICLDumper.cc:245
std::vector< int > stsCP_pdgID
Definition: TICLDumper.cc:262
Definition: Common.h:8
std::vector< float > simTICLCandidate_trackBeta
Definition: TICLDumper.cc:303
std::vector< float > stsCP_track_boundaryX
Definition: TICLDumper.cc:273
std::vector< std::vector< float > > stsCP_trackster_vertices_x
Definition: TICLDumper.cc:283
std::vector< std::vector< float > > MergeTracksters_simToReco_SC_score
Definition: TICLDumper.cc:377
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTime_token_
Definition: TICLDumper.cc:99
const edm::EDGetTokenT< edm::ValueMap< float > > tracks_time_err_token_
Definition: TICLDumper.cc:89
std::vector< float > trackster_regressed_energy
Definition: TICLDumper.cc:157
std::vector< std::vector< uint32_t > > tracksters_merged_vertices_indexes
Definition: TICLDumper.cc:346
std::vector< std::vector< uint32_t > > trackstersCLUE3D_recoToSim_CP
Definition: TICLDumper.cc:366
std::vector< std::vector< float > > trackstersCLUE3D_simToReco_CP_sharedE
Definition: TICLDumper.cc:371
const edm::EDGetTokenT< std::vector< double > > hgcaltracks_phi_token_
Definition: TICLDumper.cc:94
std::vector< int > track_nhits
Definition: TICLDumper.cc:426
const edm::EDGetTokenT< std::vector< TICLCandidate > > simTICLCandidate_token_
Definition: TICLDumper.cc:105
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > bfield_token_
Definition: TICLDumper.cc:122
std::vector< std::vector< float > > trackster_vertices_x
Definition: TICLDumper.cc:178
std::vector< float > track_hgcal_x
Definition: TICLDumper.cc:410
std::vector< float > stsSC_boundaryY
Definition: TICLDumper.cc:214
std::vector< float > stsCP_trackster_barycenter_y
Definition: TICLDumper.cc:249
std::vector< float > stsCP_boundaryPx
Definition: TICLDumper.cc:270
std::vector< float > stsSC_trackster_eVector0_x
Definition: TICLDumper.cc:204
std::vector< float > stsCP_trackster_raw_energy
Definition: TICLDumper.cc:244
std::vector< float > tracksters_merged_raw_energy
Definition: TICLDumper.cc:328
std::vector< float > stsSC_track_boundaryEta
Definition: TICLDumper.cc:224
const edm::EDGetTokenT< hgcal::RecoToSimCollectionSimTracksters > tsRecoToSimSC_token_
Definition: TICLDumper.cc:106
edm::AssociationMap< edm::OneToManyWithQualityGeneric< ticl::TracksterCollection, ticl::TracksterCollection, std::pair< float, float > > > RecoToSimCollectionSimTracksters
std::vector< uint32_t > cluster_number_of_hits
Definition: TICLDumper.cc:407
std::vector< std::vector< float > > trackstersCLUE3D_recoToSim_CP_score
Definition: TICLDumper.cc:367
TTree * simTICLCandidate_tree
Definition: TICLDumper.cc:436
std::vector< std::vector< float > > trackster_vertices_timeErr
Definition: TICLDumper.cc:182
std::vector< float > stsCP_trackster_raw_em_pt
Definition: TICLDumper.cc:247
void initialize(const HGCalDDDConstants *hgcons, const hgcal::RecHitTools rhtools, const edm::ESHandle< MagneticField > bfieldH, const edm::ESHandle< Propagator > propH)
Definition: TICLDumper.cc:1124
std::vector< float > stsCP_trackster_eVector0_y
Definition: TICLDumper.cc:257
const edm::EDGetTokenT< std::vector< reco::CaloCluster > > layer_clusters_token_
Definition: TICLDumper.cc:83
std::vector< float > stsSC_trackster_EV2
Definition: TICLDumper.cc:202
std::vector< float > candidate_time_err
Definition: TICLDumper.cc:318
std::vector< float > trackster_raw_energy
Definition: TICLDumper.cc:158
std::vector< float > stsSC_trackster_eVector0_y
Definition: TICLDumper.cc:205
std::vector< float > trackster_EV2
Definition: TICLDumper.cc:166
std::vector< float > tracksters_merged_eVector0_y
Definition: TICLDumper.cc:341
std::vector< std::vector< float > > stsCP_trackster_vertices_multiplicity
Definition: TICLDumper.cc:291
const edm::EDGetTokenT< std::vector< double > > hgcaltracks_pz_token_
Definition: TICLDumper.cc:97
std::vector< std::vector< float > > stsSC_trackster_vertices_timeErr
Definition: TICLDumper.cc:235
FreeTrajectoryState outerFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
std::vector< float > stsSC_trackster_barycenter_phi
Definition: TICLDumper.cc:200
std::vector< std::vector< float > > stsCP_trackster_vertices_energy
Definition: TICLDumper.cc:288
std::vector< float > tracksters_merged_barycenter_z
Definition: TICLDumper.cc:334
unsigned int ntracksters_
Definition: TICLDumper.cc:148
const edm::EDGetTokenT< std::vector< reco::Track > > tracks_token_
Definition: TICLDumper.cc:85
edm::AssociationMap< edm::OneToManyWithQualityGeneric< ticl::TracksterCollection, ticl::TracksterCollection, std::pair< float, float > > > SimToRecoCollectionSimTracksters
std::vector< float > trackster_timeError
Definition: TICLDumper.cc:156
std::vector< std::vector< float > > tracksters_merged_vertices_x
Definition: TICLDumper.cc:347
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometry_token_
Definition: TICLDumper.cc:101
TTree * trackster_tree_
Definition: TICLDumper.cc:428
const edm::EDGetTokenT< hgcal::RecoToSimCollectionSimTracksters > tsRecoToSimCP_token_
Definition: TICLDumper.cc:108
edm::ESHandle< MagneticField > bfield_
Definition: TICLDumper.cc:129
~TICLDumper() override
Definition: TICLDumper.cc:783
std::vector< float > stsCP_track_boundaryY
Definition: TICLDumper.cc:274
unsigned int lastLayerEE(bool nose=false) const
Definition: RecHitTools.h:76
std::vector< float > stsCP_boundaryPy
Definition: TICLDumper.cc:271
std::vector< float > tracksters_merged_barycenter_x
Definition: TICLDumper.cc:332
std::vector< float > stsSC_boundaryEta
Definition: TICLDumper.cc:216
TTree * tree_
Definition: TICLDumper.cc:142
Definition: event.py:1
Definition: Run.h:45
unsigned int ev_event_
Definition: TICLDumper.cc:147
bool saveCLUE3DTracksters_
Definition: TICLDumper.cc:132
std::vector< int > stsSC_trackIdx
Definition: TICLDumper.cc:211
std::vector< float > cluster_position_phi
Definition: TICLDumper.cc:402
std::vector< float > stsCP_track_boundaryEta
Definition: TICLDumper.cc:276
std::vector< float > stsSC_trackster_sigmaPCA2
Definition: TICLDumper.cc:208
const edm::EDGetTokenT< std::vector< SimCluster > > simclusters_token_
Definition: TICLDumper.cc:116
const std::string detector_
Definition: TICLDumper.cc:120
unsigned int getLayerWithOffset(const DetId &) const
Definition: RecHitTools.cc:376
std::vector< float > stsCP_trackster_raw_pt
Definition: TICLDumper.cc:246
std::vector< std::vector< float > > tracksters_merged_vertices_correctedEnergy
Definition: TICLDumper.cc:353
std::vector< float > simTICLCandidate_boundaryPz
Definition: TICLDumper.cc:301