CMS 3D CMS Logo

HLTCTPPSLocalTrackFilter.cc
Go to the documentation of this file.
1 // <author>Cristovao Beirao da Cruz e Silva</author>
2 // <email>cbeiraod@cern.ch</email>
3 // <created>2017-10-26</created>
4 // <description>
5 // HLT filter module to select events with tracks in the CTPPS detector
6 // </description>
7 
8 // system include files
9 
10 // user include files
12 
15 
17 
19 
22 
26 
27 //
28 // fill discriptions
29 //
31 {
33 
34  desc.add<edm::InputTag>("pixelLocalTrackInputTag", edm::InputTag("ctppsPixelLocalTracks"))
35  ->setComment("input tag of the pixel local track collection");
36  desc.add<edm::InputTag>("stripLocalTrackInputTag", edm::InputTag("totemRPLocalTrackFitter"))
37  ->setComment("input tag of the strip local track collection");
38  desc.add<edm::InputTag>("diamondLocalTrackInputTag", edm::InputTag("ctppsDiamondLocalTracks"))
39  ->setComment("input tag of the diamond local track collection");
40 
41  desc.add<bool>("usePixel", true)
42  ->setComment("whether to consider the pixel detectors");
43  desc.add<bool>("useStrip", false)
44  ->setComment("whether to consider the strip detectors");
45  desc.add<bool>("useDiamond", false)
46  ->setComment("whether to consider the diamond detectors");
47 
48  desc.add<int>("minTracks", 2)
49  ->setComment("minimum number of tracks");
50  desc.add<int>("minTracksPerArm", 1)
51  ->setComment("minimum number of tracks per arm of the CTPPS detector");
52 
53  desc.add<int>("maxTracks", -1)
54  ->setComment("maximum number of tracks, if smaller than minTracks it will be ignored");
55  desc.add<int>("maxTracksPerArm", -1)
56  ->setComment("maximum number of tracks per arm of the CTPPS detector, if smaller than minTrackPerArm it will be ignored");
57  desc.add<int>("maxTracksPerPot", -1)
58  ->setComment("maximum number of tracks per roman pot of the CTPPS detector, if negative it will be ignored");
59 
60  desc.add<int>("triggerType", trigger::TriggerTrack);
61 
62  descriptions.add("hltCTPPSLocalTrackFilter", desc);
63  return;
64 }
65 
66 //
67 // destructor and constructor
68 //
70 
72  pixelLocalTrackInputTag_ (iConfig.getParameter< edm::InputTag > ("pixelLocalTrackInputTag")),
73  stripLocalTrackInputTag_ (iConfig.getParameter< edm::InputTag > ("stripLocalTrackInputTag")),
74  diamondLocalTrackInputTag_ (iConfig.getParameter< edm::InputTag > ("diamondLocalTrackInputTag")),
75  usePixel_ (iConfig.getParameter< bool > ("usePixel")),
76  useStrip_ (iConfig.getParameter< bool > ("useStrip")),
77  useDiamond_ (iConfig.getParameter< bool > ("useDiamond")),
78  minTracks_ (iConfig.getParameter< int > ("minTracks")),
79  minTracksPerArm_ (iConfig.getParameter< int > ("minTracksPerArm")),
80  maxTracks_ (iConfig.getParameter< int > ("maxTracks")),
81  maxTracksPerArm_ (iConfig.getParameter< int > ("maxTracksPerArm")),
82  maxTracksPerPot_ (iConfig.getParameter< int > ("maxTracksPerPot"))
83 {
84  if(usePixel_)
85  pixelLocalTrackToken_ = consumes<edm::DetSetVector<CTPPSPixelLocalTrack>>(pixelLocalTrackInputTag_);
86  if(useStrip_)
87  stripLocalTrackToken_ = consumes<edm::DetSetVector<TotemRPLocalTrack>>(stripLocalTrackInputTag_);
88  if(useDiamond_)
89  diamondLocalTrackToken_ = consumes<edm::DetSetVector<CTPPSDiamondLocalTrack>>(diamondLocalTrackInputTag_);
90 
91  LogDebug("") << "HLTCTPPSLocalTrackFilter: pixelTag/stripTag/diamondTag/usePixel/useStrip/useDiamond/minTracks/minTracksPerArm/maxTracks/maxTracksPerArm/maxTracksPerPot : "
95  << usePixel_ << " "
96  << useStrip_ << " "
97  << useDiamond_ << " "
98  << minTracks_ << " "
99  << minTracksPerArm_ << " "
100  << maxTracks_ << " "
101  << maxTracksPerArm_ << " "
102  << maxTracksPerPot_;
103 }
104 
105 //
106 // member functions
107 //
109 {
110  int arm45Tracks = 0;
111  int arm56Tracks = 0;
112  std::map<uint32_t, int> tracksPerPot;
113 
114  // Note that there is no matching between the tracks from the several roman pots
115  // so tracks from separate pots might correspond to the same particle.
116  // When the pixels are used in more than one RP (in 2018), then the same situation can
117  // happen within the pixels themselves.
118  if(usePixel_) // Pixels correspond to RP 220 in 2017 data
119  {
121  iEvent.getByToken(pixelLocalTrackToken_, pixelTracks);
122 
123  for(const auto &rpv : (*pixelTracks))
124  {
125  const CTPPSPixelDetId id(rpv.id);
126  if(tracksPerPot.count(rpv.id) == 0)
127  tracksPerPot[rpv.id] = 0;
128 
129  for(auto & track : rpv)
130  {
131  if(track.isValid())
132  {
133  if(id.arm() == 0) ++arm45Tracks;
134  if(id.arm() == 1) ++arm56Tracks;
135  ++tracksPerPot[rpv.id];
136  }
137  }
138  }
139  }
140 
141  if(useStrip_) // Strips correspond to RP 210 in 2017 data
142  {
144  iEvent.getByToken(stripLocalTrackToken_, stripTracks);
145 
146  for(const auto &rpv : (*stripTracks))
147  {
148  const TotemRPDetId id(rpv.id);
149  if(tracksPerPot.count(rpv.id) == 0)
150  tracksPerPot[rpv.id] = 0;
151 
152  for(auto & track : rpv)
153  {
154  if(track.isValid())
155  {
156  if(id.arm() == 0) ++arm45Tracks;
157  if(id.arm() == 1) ++arm56Tracks;
158  ++tracksPerPot[rpv.id];
159  }
160  }
161  }
162  }
163 
164  if(useDiamond_)
165  {
167  iEvent.getByToken(diamondLocalTrackToken_, diamondTracks);
168 
169  for(const auto &rpv : (*diamondTracks))
170  {
171  const CTPPSDiamondDetId id(rpv.id);
172  if(tracksPerPot.count(rpv.id) == 0)
173  tracksPerPot[rpv.id] = 0;
174 
175  for(auto & track : rpv)
176  {
177  if(track.isValid())
178  {
179  if(id.arm() == 0) ++arm45Tracks;
180  if(id.arm() == 1) ++arm56Tracks;
181  ++tracksPerPot[rpv.id];
182  }
183  }
184  }
185  }
186 
187 
188  if(arm45Tracks + arm56Tracks < minTracks_ || arm45Tracks < minTracksPerArm_ || arm56Tracks < minTracksPerArm_)
189  return false;
190 
191  if(maxTracks_ >= minTracks_ && arm45Tracks + arm56Tracks > maxTracks_)
192  return false;
193 
194  if(maxTracksPerArm_ >= minTracksPerArm_ && (arm45Tracks > maxTracksPerArm_ || arm56Tracks > maxTracksPerArm_))
195  return false;
196 
197  if(maxTracksPerPot_ >= 0)
198  {
199  for(auto& pot : tracksPerPot)
200  {
201  if(pot.second > maxTracksPerPot_)
202  {
203  return false;
204  }
205  }
206  }
207 
208  return true;
209 }
210 
211 // define as a framework module
#define LogDebug(id)
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:30
HLTCTPPSLocalTrackFilter(const edm::ParameterSet &)
~HLTCTPPSLocalTrackFilter() override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::EDGetTokenT< edm::DetSetVector< CTPPSDiamondLocalTrack > > diamondLocalTrackToken_
std::string encode() const
Definition: InputTag.cc:159
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool filter(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
edm::EDGetTokenT< edm::DetSetVector< TotemRPLocalTrack > > stripLocalTrackToken_
static void fillDescriptions(edm::ConfigurationDescriptions &)
edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelLocalTrack > > pixelLocalTrackToken_