Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-06-13 03:24:02

0001 // Author: Felice Pantaleo - felice.pantaleo@cern.ch
0002 // Date: 05/2024
0003 
0004 #include <vector>
0005 #include "DataFormats/Math/interface/deltaR.h"
0006 #include "FWCore/Framework/interface/Event.h"
0007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0008 #include "FWCore/Utilities/interface/Exception.h"
0009 #include "PatternRecognitionbyPassthrough.h"
0010 #include "DataFormats/HGCalReco/interface/Trackster.h"
0011 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0012 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0013 #include "FWCore/Framework/interface/EventSetup.h"
0014 #include "TrackstersPCA.h"
0015 
0016 using namespace ticl;
0017 
0018 template <typename TILES>
0019 PatternRecognitionbyPassthrough<TILES>::PatternRecognitionbyPassthrough(const edm::ParameterSet &conf,
0020                                                                         edm::ConsumesCollector iC)
0021     : PatternRecognitionAlgoBaseT<TILES>(conf, iC), caloGeomToken_(iC.esConsumes<CaloGeometry, CaloGeometryRecord>()) {}
0022 
0023 template <typename TILES>
0024 void PatternRecognitionbyPassthrough<TILES>::makeTracksters(
0025     const typename PatternRecognitionAlgoBaseT<TILES>::Inputs &input,
0026     std::vector<Trackster> &result,
0027     std::unordered_map<int, std::vector<int>> &seedToTracksterAssociation) {
0028   // Get the geometry setup
0029   edm::EventSetup const &es = input.es;
0030   const CaloGeometry &geom = es.getData(caloGeomToken_);
0031   rhtools_.setGeometry(geom);
0032 
0033   // Clear the result vector
0034   result.clear();
0035 
0036   // Iterate over all layer clusters
0037   for (size_t i = 0; i < input.layerClusters.size(); ++i) {
0038     if (input.mask[i] == 0.) {
0039       continue;  // Skip masked clusters
0040     }
0041 
0042     // Create a new trackster for each layer cluster
0043     Trackster trackster;
0044     trackster.vertices().push_back(i);
0045     trackster.vertex_multiplicity().push_back(1);
0046 
0047     // Add the trackster to the result vector
0048     result.push_back(trackster);
0049   }
0050 
0051   // Assign PCA to tracksters
0052   ticl::assignPCAtoTracksters(result,
0053                               input.layerClusters,
0054                               input.layerClustersTime,
0055                               rhtools_.getPositionLayer(rhtools_.lastLayerEE(false), false).z(),
0056                               false);
0057 
0058   // Log the number of tracksters created
0059   if (PatternRecognitionAlgoBaseT<TILES>::algo_verbosity_ > VerbosityLevel::Advanced) {
0060     edm::LogVerbatim("PatternRecognitionbyPassthrough") << "Created " << result.size() << " tracksters";
0061   }
0062 }
0063 
0064 template <typename TILES>
0065 void PatternRecognitionbyPassthrough<TILES>::fillPSetDescription(edm::ParameterSetDescription &iDesc) {
0066   iDesc.add<int>("algo_verbosity", 0);
0067 }
0068 
0069 // Explicitly instantiate the templates
0070 template class ticl::PatternRecognitionbyPassthrough<TICLLayerTiles>;
0071 template class ticl::PatternRecognitionbyPassthrough<TICLLayerTilesHFNose>;