Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "Validation/HGCalValidation/interface/HGCalValidator.h"
0002 
0003 #include "SimCalorimetry/HGCalAssociatorProducers/interface/AssociatorTools.h"
0004 
0005 #include "FWCore/Framework/interface/MakerMacros.h"
0006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0007 
0008 using namespace std;
0009 using namespace edm;
0010 
0011 HGCalValidator::HGCalValidator(const edm::ParameterSet& pset)
0012     : caloGeomToken_(esConsumes<CaloGeometry, CaloGeometryRecord>()),
0013       label_lcl(pset.getParameter<edm::InputTag>("label_lcl")),
0014       label_tst(pset.getParameter<std::vector<edm::InputTag>>("label_tst")),
0015       label_simTS(pset.getParameter<edm::InputTag>("label_simTS")),
0016       label_simTSFromCP(pset.getParameter<edm::InputTag>("label_simTSFromCP")),
0017       associator_(pset.getUntrackedParameter<edm::InputTag>("associator")),
0018       associatorSim_(pset.getUntrackedParameter<edm::InputTag>("associatorSim")),
0019       SaveGeneralInfo_(pset.getUntrackedParameter<bool>("SaveGeneralInfo")),
0020       doCaloParticlePlots_(pset.getUntrackedParameter<bool>("doCaloParticlePlots")),
0021       doCaloParticleSelection_(pset.getUntrackedParameter<bool>("doCaloParticleSelection")),
0022       doSimClustersPlots_(pset.getUntrackedParameter<bool>("doSimClustersPlots")),
0023       label_SimClustersPlots_(pset.getParameter<edm::InputTag>("label_SimClusters")),
0024       label_SimClustersLevel_(pset.getParameter<edm::InputTag>("label_SimClustersLevel")),
0025       doLayerClustersPlots_(pset.getUntrackedParameter<bool>("doLayerClustersPlots")),
0026       label_layerClustersPlots_(pset.getParameter<edm::InputTag>("label_layerClusterPlots")),
0027       label_LCToCPLinking_(pset.getParameter<edm::InputTag>("label_LCToCPLinking")),
0028       doTrackstersPlots_(pset.getUntrackedParameter<bool>("doTrackstersPlots")),
0029       label_TS_(pset.getParameter<std::string>("label_TS")),
0030       label_TSToCPLinking_(pset.getParameter<std::string>("label_TSToCPLinking")),
0031       label_TSToSTSPR_(pset.getParameter<std::string>("label_TSToSTSPR")),
0032       label_clustersmask(pset.getParameter<std::vector<edm::InputTag>>("LayerClustersInputMask")),
0033       doCandidatesPlots_(pset.getUntrackedParameter<bool>("doCandidatesPlots")),
0034       label_candidates_(pset.getParameter<std::string>("ticlCandidates")),
0035       cummatbudinxo_(pset.getParameter<edm::FileInPath>("cummatbudinxo")),
0036       isTICLv5_(pset.getUntrackedParameter<bool>("isticlv5")),
0037       hits_label_(pset.getParameter<std::vector<edm::InputTag>>("hits")) {
0038   //In this way we can easily generalize to associations between other objects also.
0039   const edm::InputTag& label_cp_effic_tag = pset.getParameter<edm::InputTag>("label_cp_effic");
0040   const edm::InputTag& label_cp_fake_tag = pset.getParameter<edm::InputTag>("label_cp_fake");
0041 
0042   for (auto& label : hits_label_) {
0043     hits_token_.push_back(consumes<HGCRecHitCollection>(label));
0044   }
0045   label_cp_effic = consumes<std::vector<CaloParticle>>(label_cp_effic_tag);
0046   label_cp_fake = consumes<std::vector<CaloParticle>>(label_cp_fake_tag);
0047 
0048   simVertices_ = consumes<std::vector<SimVertex>>(pset.getParameter<edm::InputTag>("simVertices"));
0049 
0050   for (auto& itag : label_clustersmask) {
0051     clustersMaskTokens_.push_back(consumes<std::vector<float>>(itag));
0052   }
0053 
0054   associatorMapSimtR = consumes<ticl::SimToRecoCollectionWithSimClusters>(associatorSim_);
0055   associatorMapRtSim = consumes<ticl::RecoToSimCollectionWithSimClusters>(associatorSim_);
0056 
0057   simTrackstersMap_ = consumes<std::map<uint, std::vector<uint>>>(edm::InputTag("ticlSimTracksters"));
0058 
0059   hitMap_ =
0060       consumes<std::unordered_map<DetId, const unsigned int>>(edm::InputTag("recHitMapProducer", "hgcalRecHitMap"));
0061 
0062   simClusters_ = consumes<std::vector<SimCluster>>(pset.getParameter<edm::InputTag>("label_scl"));
0063 
0064   layerclusters_ = consumes<reco::CaloClusterCollection>(label_lcl);
0065 
0066   if (doCandidatesPlots_) {
0067     edm::EDGetTokenT<std::vector<TICLCandidate>> TICLCandidatesToken =
0068         consumes<std::vector<TICLCandidate>>(pset.getParameter<edm::InputTag>("ticlTrackstersMerge"));
0069     edm::EDGetTokenT<std::vector<TICLCandidate>> simTICLCandidatesToken =
0070         consumes<std::vector<TICLCandidate>>(pset.getParameter<edm::InputTag>("simTiclCandidates"));
0071     edm::EDGetTokenT<std::vector<reco::Track>> recoTracksToken =
0072         consumes<std::vector<reco::Track>>(pset.getParameter<edm::InputTag>("recoTracks"));
0073     edm::EDGetTokenT<std::vector<ticl::Trackster>> trackstersToken =
0074         consumes<std::vector<ticl::Trackster>>(pset.getParameter<edm::InputTag>("ticlTrackstersMerge"));
0075     edm::EDGetTokenT<ticl::RecoToSimCollectionSimTracksters> associatorMapRtSToken =
0076         consumes<ticl::SimToRecoCollectionSimTracksters>(pset.getParameter<edm::InputTag>("mergeRecoToSimAssociator"));
0077     edm::EDGetTokenT<ticl::SimToRecoCollectionSimTracksters> associatorMapStRToken =
0078         consumes<ticl::SimToRecoCollectionSimTracksters>(pset.getParameter<edm::InputTag>("mergeSimToRecoAssociator"));
0079     edm::EDGetTokenT<ticl::RecoToSimCollectionSimTracksters> associatorMapRtSPUToken =
0080         consumes<ticl::SimToRecoCollectionSimTracksters>(
0081             pset.getParameter<edm::InputTag>("mergeRecoToSimAssociatorPU"));
0082 
0083     candidateVal_ = std::make_unique<TICLCandidateValidator>(TICLCandidatesToken,
0084                                                              simTICLCandidatesToken,
0085                                                              recoTracksToken,
0086                                                              trackstersToken,
0087                                                              associatorMapRtSToken,
0088                                                              associatorMapStRToken,
0089                                                              associatorMapRtSPUToken,
0090                                                              isTICLv5_);
0091   }
0092 
0093   for (auto& itag : label_tst) {
0094     label_tstTokens.push_back(consumes<ticl::TracksterCollection>(itag));
0095   }
0096 
0097   simTracksters_ = consumes<ticl::TracksterCollection>(label_simTS);
0098   simTracksters_fromCPs_ = consumes<ticl::TracksterCollection>(label_simTSFromCP);
0099 
0100   associatorMapRtS = consumes<ticl::RecoToSimCollection>(associator_);
0101   associatorMapStR = consumes<ticl::SimToRecoCollection>(associator_);
0102 
0103   cpSelector = CaloParticleSelector(pset.getParameter<double>("ptMinCP"),
0104                                     pset.getParameter<double>("ptMaxCP"),
0105                                     pset.getParameter<double>("minRapidityCP"),
0106                                     pset.getParameter<double>("maxRapidityCP"),
0107                                     pset.getParameter<double>("lipCP"),
0108                                     pset.getParameter<double>("tipCP"),
0109                                     pset.getParameter<int>("minHitCP"),
0110                                     pset.getParameter<int>("maxSimClustersCP"),
0111                                     pset.getParameter<bool>("signalOnlyCP"),
0112                                     pset.getParameter<bool>("intimeOnlyCP"),
0113                                     pset.getParameter<bool>("chargedOnlyCP"),
0114                                     pset.getParameter<bool>("stableOnlyCP"),
0115                                     pset.getParameter<bool>("notConvertedOnlyCP"),
0116                                     pset.getParameter<std::vector<int>>("pdgIdCP"));
0117 
0118   tools_.reset(new hgcal::RecHitTools());
0119 
0120   particles_to_monitor_ = pset.getParameter<std::vector<int>>("pdgIdCP");
0121   totallayers_to_monitor_ = pset.getParameter<int>("totallayers_to_monitor");
0122   thicknesses_to_monitor_ = pset.getParameter<std::vector<int>>("thicknesses_to_monitor");
0123 
0124   //For the material budget file here
0125   std::ifstream fmb(cummatbudinxo_.fullPath().c_str());
0126   double thelay = 0.;
0127   double mbg = 0.;
0128   for (unsigned ilayer = 1; ilayer <= totallayers_to_monitor_; ++ilayer) {
0129     fmb >> thelay >> mbg;
0130     cumulative_material_budget.insert(std::pair<double, double>(thelay, mbg));
0131   }
0132 
0133   fmb.close();
0134 
0135   ParameterSet psetForHistoProducerAlgo = pset.getParameter<ParameterSet>("histoProducerAlgoBlock");
0136   histoProducerAlgo_ = std::make_unique<HGVHistoProducerAlgo>(psetForHistoProducerAlgo);
0137 
0138   dirName_ = pset.getParameter<std::string>("dirName");
0139 }
0140 
0141 HGCalValidator::~HGCalValidator() {}
0142 
0143 void HGCalValidator::bookHistograms(DQMStore::IBooker& ibook,
0144                                     edm::Run const&,
0145                                     edm::EventSetup const& setup,
0146                                     Histograms& histograms) const {
0147   if (SaveGeneralInfo_) {
0148     ibook.cd();
0149     ibook.setCurrentFolder(dirName_ + "GeneralInfo");
0150     histoProducerAlgo_->bookInfo(ibook, histograms.histoProducerAlgo);
0151   }
0152 
0153   if (doCaloParticlePlots_) {
0154     ibook.cd();
0155 
0156     for (auto const particle : particles_to_monitor_) {
0157       ibook.setCurrentFolder(dirName_ + "SelectedCaloParticles/" + std::to_string(particle));
0158       histoProducerAlgo_->bookCaloParticleHistos(
0159           ibook, histograms.histoProducerAlgo, particle, totallayers_to_monitor_);
0160     }
0161     ibook.cd();
0162     ibook.setCurrentFolder(dirName_);
0163   }
0164 
0165   //Booking histograms concerning with simClusters
0166   if (doSimClustersPlots_) {
0167     ibook.cd();
0168     ibook.setCurrentFolder(dirName_ + label_SimClustersPlots_.label() + "/" + label_SimClustersLevel_.label());
0169     histoProducerAlgo_->bookSimClusterHistos(
0170         ibook, histograms.histoProducerAlgo, totallayers_to_monitor_, thicknesses_to_monitor_);
0171 
0172     for (unsigned int ws = 0; ws < label_clustersmask.size(); ws++) {
0173       ibook.cd();
0174       InputTag algo = label_clustersmask[ws];
0175       string dirName = dirName_ + label_SimClustersPlots_.label() + "/";
0176       if (!algo.process().empty())
0177         dirName += algo.process() + "_";
0178       LogDebug("HGCalValidator") << dirName << "\n";
0179       if (!algo.label().empty())
0180         dirName += algo.label() + "_";
0181       LogDebug("HGCalValidator") << dirName << "\n";
0182       if (!algo.instance().empty())
0183         dirName += algo.instance() + "_";
0184       LogDebug("HGCalValidator") << dirName << "\n";
0185 
0186       if (!dirName.empty()) {
0187         dirName.resize(dirName.size() - 1);
0188       }
0189 
0190       LogDebug("HGCalValidator") << dirName << "\n";
0191 
0192       ibook.setCurrentFolder(dirName);
0193 
0194       histoProducerAlgo_->bookSimClusterAssociationHistos(
0195           ibook, histograms.histoProducerAlgo, totallayers_to_monitor_, thicknesses_to_monitor_);
0196     }  //end of loop over masks
0197   }    //if for simCluster plots
0198 
0199   //Booking histograms concerning with hgcal layer clusters
0200   if (doLayerClustersPlots_) {
0201     ibook.cd();
0202     ibook.setCurrentFolder(dirName_ + label_layerClustersPlots_.label() + "/ClusterLevel");
0203     histoProducerAlgo_->bookClusterHistos_ClusterLevel(ibook,
0204                                                        histograms.histoProducerAlgo,
0205                                                        totallayers_to_monitor_,
0206                                                        thicknesses_to_monitor_,
0207                                                        cummatbudinxo_.fullPath());
0208     ibook.cd();
0209     ibook.setCurrentFolder(dirName_ + label_layerClustersPlots_.label() + "/" + label_LCToCPLinking_.label());
0210     histoProducerAlgo_->bookClusterHistos_LCtoCP_association(
0211         ibook, histograms.histoProducerAlgo, totallayers_to_monitor_);
0212 
0213     ibook.cd();
0214     ibook.setCurrentFolder(dirName_ + label_layerClustersPlots_.label() + "/CellLevel");
0215     histoProducerAlgo_->bookClusterHistos_CellLevel(
0216         ibook, histograms.histoProducerAlgo, totallayers_to_monitor_, thicknesses_to_monitor_);
0217   }
0218 
0219   //Booking histograms for Tracksters
0220   for (unsigned int www = 0; www < label_tst.size(); www++) {
0221     ibook.cd();
0222     InputTag algo = label_tst[www];
0223     string dirName = dirName_;
0224     if (!algo.process().empty())
0225       dirName += algo.process() + "_";
0226     LogDebug("HGCalValidator") << dirName << "\n";
0227     if (!algo.label().empty())
0228       dirName += algo.label() + "_";
0229     LogDebug("HGCalValidator") << dirName << "\n";
0230     if (!algo.instance().empty())
0231       dirName += algo.instance() + "_";
0232     LogDebug("HGCalValidator") << dirName << "\n";
0233 
0234     if (!dirName.empty()) {
0235       dirName.resize(dirName.size() - 1);
0236     }
0237 
0238     LogDebug("HGCalValidator") << dirName << "\n";
0239 
0240     ibook.setCurrentFolder(dirName);
0241 
0242     // Booking histograms concerning HGCal tracksters
0243     if (doTrackstersPlots_) {
0244       // Generic histos
0245       ibook.setCurrentFolder(dirName + "/" + label_TS_);
0246       histoProducerAlgo_->bookTracksterHistos(ibook, histograms.histoProducerAlgo, totallayers_to_monitor_);
0247       // CP Linking
0248       ibook.setCurrentFolder(dirName + "/" + label_TSToCPLinking_);
0249       histoProducerAlgo_->bookTracksterSTSHistos(
0250           ibook, histograms.histoProducerAlgo, HGVHistoProducerAlgo::validationType::Linking);
0251       // SimTracksters Pattern Recognition
0252       ibook.setCurrentFolder(dirName + "/" + label_TSToSTSPR_);
0253       histoProducerAlgo_->bookTracksterSTSHistos(
0254           ibook, histograms.histoProducerAlgo, HGVHistoProducerAlgo::validationType::PatternRecognition);
0255     }
0256   }  //end of booking Tracksters loop
0257 
0258   // Booking histograms concerning TICL candidates
0259   if (doCandidatesPlots_) {
0260     ibook.cd();
0261     ibook.setCurrentFolder(dirName_ + label_candidates_);
0262     candidateVal_->bookCandidatesHistos(ibook, histograms.histoTICLCandidates, dirName_ + label_candidates_);
0263   }
0264 }
0265 
0266 void HGCalValidator::cpParametersAndSelection(const Histograms& histograms,
0267                                               std::vector<CaloParticle> const& cPeff,
0268                                               std::vector<SimVertex> const& simVertices,
0269                                               std::vector<size_t>& selected_cPeff,
0270                                               unsigned int layers,
0271                                               std::unordered_map<DetId, const unsigned int> const& hitMap,
0272                                               std::vector<HGCRecHit> const& hits) const {
0273   selected_cPeff.reserve(cPeff.size());
0274 
0275   size_t j = 0;
0276   for (auto const& caloParticle : cPeff) {
0277     int id = caloParticle.pdgId();
0278 
0279     if (!doCaloParticleSelection_ || (doCaloParticleSelection_ && cpSelector(caloParticle, simVertices))) {
0280       selected_cPeff.push_back(j);
0281       if (doCaloParticlePlots_) {
0282         histoProducerAlgo_->fill_caloparticle_histos(
0283             histograms.histoProducerAlgo, id, caloParticle, simVertices, layers, hitMap, hits);
0284       }
0285     }
0286     ++j;
0287   }  //end of loop over caloparticles
0288 }
0289 
0290 void HGCalValidator::dqmAnalyze(const edm::Event& event,
0291                                 const edm::EventSetup& setup,
0292                                 const Histograms& histograms) const {
0293   using namespace reco;
0294 
0295   LogDebug("HGCalValidator") << "\n===================================================="
0296                              << "\n"
0297                              << "Analyzing new event"
0298                              << "\n"
0299                              << "====================================================\n"
0300                              << "\n";
0301 
0302   edm::Handle<std::vector<SimVertex>> simVerticesHandle;
0303   event.getByToken(simVertices_, simVerticesHandle);
0304   std::vector<SimVertex> const& simVertices = *simVerticesHandle;
0305 
0306   edm::Handle<std::vector<CaloParticle>> caloParticleHandle;
0307   event.getByToken(label_cp_effic, caloParticleHandle);
0308   std::vector<CaloParticle> const& caloParticles = *caloParticleHandle;
0309 
0310   edm::Handle<ticl::TracksterCollection> simTracksterHandle;
0311   event.getByToken(simTracksters_, simTracksterHandle);
0312   ticl::TracksterCollection const& simTracksters = *simTracksterHandle;
0313 
0314   edm::Handle<ticl::TracksterCollection> simTracksterFromCPHandle;
0315   event.getByToken(simTracksters_fromCPs_, simTracksterFromCPHandle);
0316   ticl::TracksterCollection const& simTrackstersFromCPs = *simTracksterFromCPHandle;
0317 
0318   edm::Handle<std::map<uint, std::vector<uint>>> simTrackstersMapHandle;
0319   event.getByToken(simTrackstersMap_, simTrackstersMapHandle);
0320   const std::map<uint, std::vector<uint>> cpToSc_SimTrackstersMap = *simTrackstersMapHandle;
0321 
0322   edm::ESHandle<CaloGeometry> geom = setup.getHandle(caloGeomToken_);
0323   tools_->setGeometry(*geom);
0324   histoProducerAlgo_->setRecHitTools(tools_);
0325 
0326   edm::Handle<ticl::SimToRecoCollection> simtorecoCollectionH;
0327   event.getByToken(associatorMapStR, simtorecoCollectionH);
0328   auto simRecColl = *simtorecoCollectionH;
0329   edm::Handle<ticl::RecoToSimCollection> recotosimCollectionH;
0330   event.getByToken(associatorMapRtS, recotosimCollectionH);
0331   auto recSimColl = *recotosimCollectionH;
0332 
0333   edm::Handle<std::unordered_map<DetId, const unsigned int>> hitMapHandle;
0334   event.getByToken(hitMap_, hitMapHandle);
0335   const std::unordered_map<DetId, const unsigned int>* hitMap = &*hitMapHandle;
0336 
0337   std::vector<HGCRecHit> hits;
0338   for (auto& token : hits_token_) {
0339     edm::Handle<HGCRecHitCollection> hitsHandle;
0340     event.getByToken(token, hitsHandle);
0341     hits.insert(hits.end(), (*hitsHandle).begin(), (*hitsHandle).end());
0342   }
0343 
0344   //Some general info on layers etc.
0345   if (SaveGeneralInfo_) {
0346     histoProducerAlgo_->fill_info_histos(histograms.histoProducerAlgo, totallayers_to_monitor_);
0347   }
0348 
0349   std::vector<size_t> cPIndices;
0350   //Consider CaloParticles coming from the hard scatterer
0351   //excluding the PU contribution and save the indices.
0352   removeCPFromPU(caloParticles, cPIndices);
0353 
0354   // ##############################################
0355   // Fill caloparticles histograms
0356   // ##############################################
0357   // HGCRecHit are given to select the SimHits which are also reconstructed
0358   LogTrace("HGCalValidator") << "\n# of CaloParticles: " << caloParticles.size() << "\n" << std::endl;
0359   std::vector<size_t> selected_cPeff;
0360   cpParametersAndSelection(
0361       histograms, caloParticles, simVertices, selected_cPeff, totallayers_to_monitor_, *hitMap, hits);
0362 
0363   //get collections from the event
0364   //simClusters
0365   edm::Handle<std::vector<SimCluster>> simClustersHandle;
0366   event.getByToken(simClusters_, simClustersHandle);
0367   std::vector<SimCluster> const& simClusters = *simClustersHandle;
0368 
0369   //Layer clusters
0370   edm::Handle<reco::CaloClusterCollection> clusterHandle;
0371   event.getByToken(layerclusters_, clusterHandle);
0372   const reco::CaloClusterCollection& clusters = *clusterHandle;
0373 
0374   auto nSimClusters = simClusters.size();
0375   std::vector<size_t> sCIndices;
0376   //There shouldn't be any SimTracks from different crossings, but maybe they will be added later.
0377   //At the moment there should be one SimTrack in each SimCluster.
0378   for (unsigned int scId = 0; scId < nSimClusters; ++scId) {
0379     if (simClusters[scId].g4Tracks()[0].eventId().event() != 0 or
0380         simClusters[scId].g4Tracks()[0].eventId().bunchCrossing() != 0) {
0381       LogDebug("HGCalValidator") << "Excluding SimClusters from event: "
0382                                  << simClusters[scId].g4Tracks()[0].eventId().event()
0383                                  << " with BX: " << simClusters[scId].g4Tracks()[0].eventId().bunchCrossing()
0384                                  << std::endl;
0385       continue;
0386     }
0387     sCIndices.emplace_back(scId);
0388   }
0389 
0390   // ##############################################
0391   // Fill simCluster histograms
0392   // ##############################################
0393   if (doSimClustersPlots_) {
0394     histoProducerAlgo_->fill_simCluster_histos(
0395         histograms.histoProducerAlgo, simClusters, totallayers_to_monitor_, thicknesses_to_monitor_);
0396 
0397     for (unsigned int ws = 0; ws < label_clustersmask.size(); ws++) {
0398       const auto& inputClusterMask = event.get(clustersMaskTokens_[ws]);
0399 
0400       edm::Handle<ticl::SimToRecoCollectionWithSimClusters> simtorecoCollectionH;
0401       event.getByToken(associatorMapSimtR, simtorecoCollectionH);
0402       auto simRecColl = *simtorecoCollectionH;
0403       edm::Handle<ticl::RecoToSimCollectionWithSimClusters> recotosimCollectionH;
0404       event.getByToken(associatorMapRtSim, recotosimCollectionH);
0405       auto recSimColl = *recotosimCollectionH;
0406 
0407       histoProducerAlgo_->fill_simClusterAssociation_histos(histograms.histoProducerAlgo,
0408                                                             ws,
0409                                                             clusterHandle,
0410                                                             clusters,
0411                                                             simClustersHandle,
0412                                                             simClusters,
0413                                                             sCIndices,
0414                                                             inputClusterMask,
0415                                                             *hitMap,
0416                                                             totallayers_to_monitor_,
0417                                                             recSimColl,
0418                                                             simRecColl,
0419                                                             hits);
0420 
0421       //General Info on simClusters
0422       LogTrace("HGCalValidator") << "\n# of SimClusters: " << nSimClusters
0423                                  << ", layerClusters mask label: " << label_clustersmask[ws].label() << "\n";
0424     }  //end of loop overs masks
0425   }
0426 
0427   // ##############################################
0428   // Fill layercluster histograms
0429   // ##############################################
0430   int w = 0;  //counter counting the number of sets of histograms
0431   if (doLayerClustersPlots_) {
0432     histoProducerAlgo_->fill_generic_cluster_histos(histograms.histoProducerAlgo,
0433                                                     w,
0434                                                     clusterHandle,
0435                                                     clusters,
0436                                                     caloParticleHandle,
0437                                                     caloParticles,
0438                                                     cPIndices,
0439                                                     selected_cPeff,
0440                                                     *hitMap,
0441                                                     cumulative_material_budget,
0442                                                     totallayers_to_monitor_,
0443                                                     thicknesses_to_monitor_,
0444                                                     recSimColl,
0445                                                     simRecColl,
0446                                                     hits);
0447 
0448     for (unsigned int layerclusterIndex = 0; layerclusterIndex < clusters.size(); layerclusterIndex++) {
0449       histoProducerAlgo_->fill_cluster_histos(histograms.histoProducerAlgo, w, clusters[layerclusterIndex]);
0450     }
0451 
0452     //General Info on hgcalLayerClusters
0453     LogTrace("HGCalValidator") << "\n# of layer clusters with " << label_lcl.process() << ":" << label_lcl.label()
0454                                << ":" << label_lcl.instance() << ": " << clusters.size() << "\n";
0455   }
0456 
0457   // ##############################################
0458   // Fill Trackster histograms
0459   // ##############################################
0460   for (unsigned int wml = 0; wml < label_tstTokens.size(); wml++) {
0461     if (doTrackstersPlots_) {
0462       edm::Handle<ticl::TracksterCollection> tracksterHandle;
0463       event.getByToken(label_tstTokens[wml], tracksterHandle);
0464       const ticl::TracksterCollection& tracksters = *tracksterHandle;
0465 
0466       //General Info on Tracksters
0467       LogTrace("HGCalValidator") << "\n# of Tracksters from " << label_tst[wml].process() << ":"
0468                                  << label_tst[wml].label() << ":" << label_tst[wml].instance() << ": "
0469                                  << tracksters.size() << "\n"
0470                                  << std::endl;
0471 
0472       histoProducerAlgo_->fill_trackster_histos(histograms.histoProducerAlgo,
0473                                                 wml,
0474                                                 tracksters,
0475                                                 clusters,
0476                                                 simTracksters,
0477                                                 simTrackstersFromCPs,
0478                                                 cpToSc_SimTrackstersMap,
0479                                                 simClusters,
0480                                                 caloParticleHandle.id(),
0481                                                 caloParticles,
0482                                                 cPIndices,
0483                                                 selected_cPeff,
0484                                                 *hitMap,
0485                                                 totallayers_to_monitor_,
0486                                                 hits);
0487     }
0488   }  //end of loop over Trackster input labels
0489 
0490   // tracksters histograms
0491   if (doCandidatesPlots_) {
0492     candidateVal_->fillCandidateHistos(event, histograms.histoTICLCandidates, simTracksterFromCPHandle);
0493   }
0494 }