CMS 3D CMS Logo

TotemTimingLocalTrackFitter.cc
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * This is a part of CTPPS offline software.
4  * Authors:
5  * Laurent Forthomme (laurent.forthomme@cern.ch)
6  * Nicola Minafra (nicola.minafra@cern.ch)
7  * Mateusz Szpyrka (mateusz.szpyrka@cern.ch)
8  *
9  ****************************************************************************/
10 
11 #include <memory>
12 #include <utility>
13 
18 
21 
23 
27 
29 
31 public:
33 
35 
36 private:
37  void produce(edm::Event&, const edm::EventSetup&) override;
38 
40  const int maxPlaneActiveChannels_;
41  std::map<TotemTimingDetId, TotemTimingTrackRecognition> trk_algo_map_;
42 };
43 
45  : recHitsToken_(consumes<edm::DetSetVector<TotemTimingRecHit> >(iConfig.getParameter<edm::InputTag>("recHitsTag"))),
46  maxPlaneActiveChannels_(iConfig.getParameter<int>("maxPlaneActiveChannels")) {
47  produces<edm::DetSetVector<TotemTimingLocalTrack> >();
48 
49  for (unsigned short armNo = 0; armNo < 2; armNo++)
50  for (unsigned short rpNo = 0; rpNo < 2; rpNo++) {
51  TotemTimingDetId id(armNo, 1, rpNo, 0, 0);
52  TotemTimingTrackRecognition trk_algo(iConfig.getParameter<edm::ParameterSet>("trackingAlgorithmParams"));
53  trk_algo_map_.insert(std::make_pair(id, trk_algo));
54  }
55 }
56 
58  auto pOut = std::make_unique<edm::DetSetVector<TotemTimingLocalTrack> >();
59 
61  iEvent.getByToken(recHitsToken_, recHits);
62 
63  for (const auto& trk_algo_entry : trk_algo_map_)
64  pOut->find_or_insert(trk_algo_entry.first);
65 
66  std::map<TotemTimingDetId, int> planeActivityMap;
67 
68  auto motherId = [](const edm::det_id_type& detid) {
69  TotemTimingDetId out(detid);
70  out.setStation(1);
71  out.setChannel(0);
72  return out;
73  };
74 
75  for (const auto& vec : *recHits)
76  planeActivityMap[motherId(vec.detId())] += vec.size();
77 
78  // feed hits to the track producers
79  for (const auto& vec : *recHits) {
80  auto detId = motherId(vec.detId());
81  if (planeActivityMap[detId] > maxPlaneActiveChannels_)
82  continue;
83 
84  detId.setPlane(0);
85  for (const auto& hit : vec) {
86  if (trk_algo_map_.find(detId) == trk_algo_map_.end())
87  throw cms::Exception("TotemTimingLocalTrackFitter")
88  << "Invalid detId for rechit: arm=" << detId.arm() << ", rp=" << detId.rp();
89  trk_algo_map_.find(detId)->second.addHit(hit);
90  }
91  }
92 
93  // retrieves tracks for all hit sets
94  for (auto& trk_algo_entry : trk_algo_map_)
95  trk_algo_entry.second.produceTracks(pOut->operator[](trk_algo_entry.first));
96 
97  iEvent.put(std::move(pOut));
98 
99  // remove all hits from the track producers to prepare for the next event
100  for (auto& trk_algo_entry : trk_algo_map_)
101  trk_algo_entry.second.clear();
102 }
103 
106  desc.add<edm::InputTag>("recHitsTag", edm::InputTag("totemTimingRecHits"))
107  ->setComment("input rechits collection to retrieve");
108  desc.add<int>("maxPlaneActiveChannels", 2)->setComment("threshold for discriminating noisy planes");
109 
110  edm::ParameterSetDescription trackingAlgoParams;
111  trackingAlgoParams.add<double>("threshold", 1.5)
112  ->setComment("minimal number of rechits to be observed before launching the track recognition algorithm");
113  trackingAlgoParams.add<double>("thresholdFromMaximum", 0.5)
114  ->setComment("threshold relative to hit profile function local maximum for determining the width of the track");
115  trackingAlgoParams.add<double>("resolution", 0.01 /* mm */)
116  ->setComment("spatial resolution on the horizontal coordinate (in mm)");
117  trackingAlgoParams.add<double>("sigma", 0.)
118  ->setComment("pixel efficiency function parameter determining the smoothness of the step");
119  trackingAlgoParams.add<double>("tolerance", 0.1 /* mm */)
120  ->setComment("tolerance used for checking if the track contains certain hit");
121 
122  trackingAlgoParams.add<std::string>("pixelEfficiencyFunction", "(x>[0]-0.5*[1]-0.05)*(x<[0]+0.5*[1]-0.05)+0*[2]")
123  ->setComment(
124  "efficiency function for single pixel\n"
125  "can be defined as:\n"
126  " * Precise: "
127  "(TMath::Erf((x-[0]+0.5*([1]-0.05))/([2]/4)+2)+1)*TMath::Erfc((x-[0]-0.5*([1]-0.05))/([2]/4)-2)/4\n"
128  " * Fast: "
129  "(x>[0]-0.5*([1]-0.05))*(x<[0]+0.5*([1]-0.05))+((x-[0]+0.5*([1]-0.05)+[2])/"
130  "[2])*(x>[0]-0.5*([1]-0.05)-[2])*(x<[0]-0.5*([1]-0.05))+(2-(x-[0]-0.5*([1]-0.05)+[2])/"
131  "[2])*(x>[0]+0.5*([1]-0.05))*(x<[0]+0.5*([1]-0.05)+[2])\n"
132  " * Legacy: (1/(1+exp(-(x-[0]+0.5*([1]-0.05))/[2])))*(1/(1+exp((x-[0]-0.5*([1]-0.05))/[2])))\n"
133  " * Default (sigma ignored): (x>[0]-0.5*[1]-0.05)*(x<[0]+0.5*[1]-0.05)+0*[2]\n"
134  "with:\n"
135  " [0]: centre of pad\n"
136  " [1]: width of pad\n"
137  " [2]: sigma: distance between efficiency ~100 -> 0 outside width");
138 
139  trackingAlgoParams.add<double>("yPosition", 0.0)->setComment("vertical offset of the outcoming track centre");
140  trackingAlgoParams.add<double>("yWidth", 0.0)->setComment("vertical track width");
141  desc.add<edm::ParameterSetDescription>("trackingAlgorithmParams", trackingAlgoParams)
142  ->setComment("list of parameters associated to the track recognition algorithm");
143 
144  descr.add("totemTimingLocalTracks", desc);
145 }
146 
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
TotemTimingTrackRecognition
Definition: TotemTimingTrackRecognition.h:23
TotemTimingLocalTrackFitter::maxPlaneActiveChannels_
const int maxPlaneActiveChannels_
Definition: TotemTimingLocalTrackFitter.cc:47
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
TotemTimingLocalTrackFitter::TotemTimingLocalTrackFitter
TotemTimingLocalTrackFitter(const edm::ParameterSet &)
Definition: TotemTimingLocalTrackFitter.cc:44
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89281
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EDProducer.h
TotemTimingRecHit.h
edm::Handle
Definition: AssociativeIterator.h:50
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
TotemTimingDetId.h
TotemTimingLocalTrack.h
TotemTimingTrackRecognition.h
TotemTimingRecHit
Definition: TotemTimingRecHit.h:16
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
TotemTimingDetId
Detector ID class for CTPPS Totem Timing detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bits ...
Definition: TotemTimingDetId.h:26
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
TotemTimingLocalTrackFitter
Definition: TotemTimingLocalTrackFitter.cc:30
TotemTimingLocalTrackFitter::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: TotemTimingLocalTrackFitter.cc:57
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::stream::EDProducer
Definition: EDProducer.h:38
edm::EventSetup
Definition: EventSetup.h:58
DetSetVector.h
objects.autophobj.motherId
motherId
Definition: autophobj.py:237
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
Frameworkfwd.h
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
TotemTimingLocalTrackFitter::trk_algo_map_
std::map< TotemTimingDetId, TotemTimingTrackRecognition > trk_algo_map_
Definition: TotemTimingLocalTrackFitter.cc:48
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TotemTimingLocalTrackFitter::recHitsToken_
const edm::EDGetTokenT< edm::DetSetVector< TotemTimingRecHit > > recHitsToken_
Definition: TotemTimingLocalTrackFitter.cc:46
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
cms::Exception
Definition: Exception.h:70
edm::det_id_type
uint32_t det_id_type
Definition: DetSet.h:20
ParameterSet.h
edm::ParameterDescriptionNode::setComment
void setComment(std::string const &value)
Definition: ParameterDescriptionNode.cc:106
edm::Event
Definition: Event.h:73
StreamID.h
edm::InputTag
Definition: InputTag.h:15
hit
Definition: SiStripHitEffFromCalibTree.cc:88
TotemTimingLocalTrackFitter::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: TotemTimingLocalTrackFitter.cc:104