45 constexpr
int rocMask = 0xE000;
46 constexpr
int rocOffset = 13;
47 constexpr
int rocSizeInPixels = 4160;
83 maxHitPerRomanPot_(
parameterSet.getParameter<
int>(
"maxHitPerRomanPot")),
84 maxTrackPerRomanPot_(
parameterSet.getParameter<
int>(
"maxTrackPerRomanPot")),
85 maxTrackPerPattern_(
parameterSet.getParameter<
int>(
"maxTrackPerPattern")),
86 tokenCTPPSPixelRecHit_(
90 numberOfPlanesPerPot_(
parameterSet.getParameter<
int>(
"numberOfPlanesPerPot")) {
102 std::vector<uint32_t> listOfAllPlanes;
104 listOfAllPlanes.push_back(
i);
108 if (trackFitterAlgorithm ==
"RPixPlaneCombinatoryTracking") {
112 <<
"Tracking fitter algorithm" << trackFitterAlgorithm <<
" does not exist";
116 produces<edm::DetSetVector<CTPPSPixelLocalTrack>>();
129 ->setComment(
"inputTag of the RecHits input for the tracking algorithm");
130 desc.add<
std::string>(
"patternFinderAlgorithm",
"RPixRoadFinder")->setComment(
"algorithm type for pattern finder");
131 desc.add<
std::string>(
"trackFinderAlgorithm",
"RPixPlaneCombinatoryTracking")
132 ->setComment(
"algorithm type for track finder");
133 desc.add<
uint>(
"trackMinNumberOfPoints", 3)->setComment(
"minimum number of planes to produce a track");
134 desc.addUntracked<
int>(
"verbosity", 0)->setComment(
"verbosity for track producer");
135 desc.add<
double>(
"maximumChi2OverNDF", 5.)->setComment(
"maximum Chi2OverNDF for accepting the track");
136 desc.add<
double>(
"maximumXLocalDistanceFromTrack", 0.2)
137 ->setComment(
"maximum x distance in mm to associate a point not used for fit to the track");
138 desc.add<
double>(
"maximumYLocalDistanceFromTrack", 0.3)
139 ->setComment(
"maximum y distance in mm to associate a point not used for fit to the track");
140 desc.add<
int>(
"maxHitPerPlane", 20)
141 ->setComment(
"maximum hits per plane, events with higher number will not be fitted");
142 desc.add<
int>(
"maxHitPerRomanPot", 60)
143 ->setComment(
"maximum hits per roman pot, events with higher number will not be fitted");
144 desc.add<
int>(
"maxTrackPerRomanPot", 10)
145 ->setComment(
"maximum tracks per roman pot, events with higher track will not be saved");
146 desc.add<
int>(
"maxTrackPerPattern", 5)
147 ->setComment(
"maximum tracks per pattern, events with higher track will not be saved");
148 desc.add<
int>(
"numberOfPlanesPerPot", 6)->setComment(
"number of planes per pot");
149 desc.add<
double>(
"roadRadius", 1.0)->setComment(
"radius of pattern search window");
150 desc.add<
int>(
"minRoadSize", 3)->setComment(
"minimum number of points in a pattern");
151 desc.add<
int>(
"maxRoadSize", 20)->setComment(
"maximum number of points in a pattern");
153 desc.add<
double>(
"roadRadiusBadPot", 0.5)->setComment(
"radius of pattern search window for 2 plane pot");
155 descriptions.
add(
"ctppsPixelLocalTracks",
desc);
175 bool is2PlanePotV[4] = {
false};
181 std::map<uint32_t, CTPPSPixelROCAnalysisMask>
const &maschera =
mask.analysisMask;
184 bool maskV[4][6][6] = {{{
false}}};
186 for (
auto const &det : maschera) {
188 unsigned int rocNum = (det.first & rocMask) >> rocOffset;
189 if (rocNum > 5 ||
detId.plane() > 5)
190 throw cms::Exception(
"InvalidRocOrPlaneNumber") <<
"roc number from mask: " << rocNum;
193 if (
detId.station() == 2) {
194 if (det.second.maskedPixels.size() == rocSizeInPixels || det.second.fullMask ==
true) {
195 maskV[0][
detId.plane()][rocNum] =
true;
197 }
else if (
detId.station() == 0) {
198 if (det.second.maskedPixels.size() == rocSizeInPixels || det.second.fullMask ==
true) {
199 maskV[1][
detId.plane()][rocNum] =
true;
202 }
else if (
detId.arm() == 1 &&
detId.rp() == 3) {
203 if (
detId.station() == 0) {
204 if (det.second.maskedPixels.size() == rocSizeInPixels || det.second.fullMask ==
true) {
205 maskV[2][
detId.plane()][rocNum] =
true;
207 }
else if (
detId.station() == 2) {
208 if (det.second.maskedPixels.size() == rocSizeInPixels || det.second.fullMask ==
true) {
209 maskV[3][
detId.plane()][rocNum] =
true;
216 for (
unsigned int i = 0;
i < 4;
i++) {
217 unsigned int numberOfMaskedPlanes = 0;
218 for (
unsigned int j = 0;
j < 6;
j++) {
219 if (maskV[
i][
j][0] && maskV[
i][
j][1] && maskV[
i][
j][4] && maskV[
i][
j][5])
220 numberOfMaskedPlanes++;
222 if (numberOfMaskedPlanes == 4)
223 is2PlanePotV[
i] =
true;
224 edm::LogInfo(
"CTPPSPixelLocalTrackProducer") <<
" Masked planes in Pot #" <<
i <<
" = " << numberOfMaskedPlanes;
227 <<
" Enabling 2 plane track reconstruction for pot #" <<
i <<
" (0=45-220, 1=45-210, 2=56-210, 3=56-220) ";
230 std::vector<CTPPSPixelDetId> listOfPotWithHighOccupancyPlanes;
231 std::map<CTPPSPixelDetId, uint32_t> mapHitPerPot;
233 for (
const auto &recHitSet : recHitVector) {
236 <<
"Hits found in plane = " << recHitSet.detId() <<
" number = " << recHitSet.size();
238 uint32_t hitOnPlane = recHitSet.size();
241 if (mapHitPerPot.find(tmpRomanPotId) == mapHitPerPot.end()) {
242 mapHitPerPot[tmpRomanPotId] = hitOnPlane;
244 mapHitPerPot[tmpRomanPotId] += hitOnPlane;
250 <<
" ---> Too many hits in the plane, pot will be excluded from tracking cleared";
251 listOfPotWithHighOccupancyPlanes.push_back(tmpRomanPotId);
256 for (
const auto &recHitSet : recHitVector) {
258 const auto tmpRomanPotId = tmpDetectorId.
rpId();
261 find(listOfPotWithHighOccupancyPlanes.begin(), listOfPotWithHighOccupancyPlanes.end(), tmpRomanPotId) !=
262 listOfPotWithHighOccupancyPlanes.end()) {
276 std::vector<RPixDetPatternFinder::Road> patternVector =
patternFinder_->getPatterns();
279 int numberOfTracks = 0;
281 for (
const auto &
pattern : patternVector) {
285 std::map<CTPPSPixelDetId, std::vector<RPixDetPatternFinder::PointInPlane>>
293 if (tmpRomanPotId != romanPotId) {
295 <<
"Hits in the pattern must belong to the same tracking station";
298 if (hitOnPlaneMap.find(hitDetId) ==
299 hitOnPlaneMap.end()) {
300 std::vector<RPixDetPatternFinder::PointInPlane> hitOnPlane;
301 hitOnPlane.push_back(
hit);
302 hitOnPlaneMap[hitDetId] = hitOnPlane;
304 hitOnPlaneMap[hitDetId].push_back(
hit);
313 std::vector<CTPPSPixelLocalTrack> tmpTracksVector =
trackFinder_->getLocalTracks();
316 edm::LogInfo(
"CTPPSPixelLocalTrackProducer") <<
"tmpTracksVector = " << tmpTracksVector.size();
319 edm::LogInfo(
"CTPPSPixelLocalTrackProducer") <<
" ---> To many tracks in the pattern, cleared";
323 for (
const auto &
track : tmpTracksVector) {
331 edm::LogInfo(
"CTPPSPixelLocalTrackProducer") <<
"Number of tracks will be saved = " << numberOfTracks;
333 for (
const auto &
track : foundTracks) {
336 <<
"Track found in detId = " <<
track.detId() <<
" number = " <<
track.size();
339 edm::LogInfo(
"CTPPSPixelLocalTrackProducer") <<
" ---> Too many tracks in the pot, cleared";
edm::ESWatcher< VeryForwardRealGeometryRecord > geometryWatcher_
const int maxTrackPerPattern_
T getParameter(std::string const &) const
const edm::ESGetToken< CTPPSPixelAnalysisMask, CTPPSPixelAnalysisMaskRcd > tokenCTPPSPixelAnalysisMask_
void push_back(const T &t)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
const edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelRecHit > > tokenCTPPSPixelRecHit_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
~CTPPSPixelLocalTrackProducer() override
void produce(edm::Event &, const edm::EventSetup &) override
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Event setup record containing the real (actual) geometry information.
reference find_or_insert(det_id_type id)
std::unique_ptr< RPixDetTrackFinder > trackFinder_
const int maxHitPerRomanPot_
#define DEFINE_FWK_MODULE(type)
const edm::ESGetToken< CTPPSGeometry, VeryForwardRealGeometryRecord > tokenCTPPSGeometry_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
The manager class for TOTEM RP geometry.
Log< level::Info, false > LogInfo
const uint32_t numberOfPlanesPerPot_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const int maxTrackPerRomanPot_
bool check(const edm::EventSetup &iSetup)
std::unique_ptr< RPixDetPatternFinder > patternFinder_
CTPPSPixelLocalTrackProducer(const edm::ParameterSet ¶meterSet)
const int maxHitPerPlane_