Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:27:40

0001 /****************************************************************************
0002 *
0003 * This is a part of PPS offline software.
0004 * Authors:
0005 *   Laurent Forthomme (laurent.forthomme@cern.ch)
0006 *
0007 ****************************************************************************/
0008 
0009 #include "RecoPPS/Local/interface/TotemT2RecHitProducerAlgorithm.h"
0010 
0011 #include "DataFormats/Common/interface/DetSetNew.h"
0012 #include "DataFormats/CTPPSDetId/interface/TotemT2DetId.h"
0013 
0014 void TotemT2RecHitProducerAlgorithm::build(const TotemGeometry& geom,
0015                                            const edmNew::DetSetVector<TotemT2Digi>& input,
0016                                            edmNew::DetSetVector<TotemT2RecHit>& output) {
0017   for (const auto& vec : input) {
0018     const TotemT2DetId detid(vec.detId());
0019 
0020     // prepare the output collection filler
0021     edmNew::DetSetVector<TotemT2RecHit>::FastFiller filler(output, detid);
0022 
0023     for (const auto& digi : vec) {
0024       const int t_lead = digi.leadingEdge(), t_trail = digi.trailingEdge();
0025       // don't skip no-edge digis
0026       double tot = 0.;
0027       if (digi.hasLE() && digi.hasTE()) {
0028         tot = (t_trail - t_lead) * ts_to_ns_;  // in ns
0029       }
0030       double ch_t_precis = ts_to_ns_ / 2.0;  //without a calibration, assume LE/TE precision is +-0.5
0031 
0032       // retrieve the geometry element associated to this DetID
0033       const auto& tile = geom.tile(detid);
0034 
0035       // store to the output collection
0036       filler.emplace_back(tile.centre(), t_lead * ts_to_ns_, ch_t_precis, tot);
0037     }
0038   }
0039 }