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 bad Pot");
155 descriptions.
add(
"ctppsPixelLocalTracks",
desc);
173 bool isBadPot_45_220 =
false;
178 std::map<uint32_t, CTPPSPixelROCAnalysisMask>
const &maschera =
mask.analysisMask;
180 bool mask_45_220[6][6] = {{
false}};
181 for (
auto const &det : maschera) {
183 unsigned int rocNum = (det.first & rocMask) >> rocOffset;
184 if (rocNum > 5 || detId.
plane() > 5)
185 throw cms::Exception(
"InvalidRocOrPlaneNumber") <<
"roc number from mask: " << rocNum;
187 if (detId.
arm() == 0 && detId.
station() == 2 && detId.
rp() == 3) {
188 if (det.second.maskedPixels.size() == rocSizeInPixels) {
189 mask_45_220[detId.
plane()][rocNum] =
true;
195 isBadPot_45_220 = mask_45_220[1][4] && mask_45_220[1][5] && mask_45_220[2][4] && mask_45_220[2][5] &&
196 mask_45_220[3][4] && mask_45_220[3][5] && mask_45_220[4][4] && mask_45_220[4][5];
198 std::vector<CTPPSPixelDetId> listOfPotWithHighOccupancyPlanes;
199 std::map<CTPPSPixelDetId, uint32_t> mapHitPerPot;
201 for (
const auto &recHitSet : recHitVector) {
204 <<
"Hits found in plane = " << recHitSet.detId() <<
" number = " << recHitSet.size();
206 uint32_t hitOnPlane = recHitSet.size();
209 if (mapHitPerPot.find(tmpRomanPotId) == mapHitPerPot.end()) {
210 mapHitPerPot[tmpRomanPotId] = hitOnPlane;
212 mapHitPerPot[tmpRomanPotId] += hitOnPlane;
218 <<
" ---> To many hits in the plane, pot will be excluded from tracking cleared";
219 listOfPotWithHighOccupancyPlanes.push_back(tmpRomanPotId);
224 for (
const auto &recHitSet : recHitVector) {
226 const auto tmpRomanPotId = tmpDetectorId.
rpId();
229 find(listOfPotWithHighOccupancyPlanes.begin(), listOfPotWithHighOccupancyPlanes.end(), tmpRomanPotId) !=
230 listOfPotWithHighOccupancyPlanes.end()) {
244 std::vector<RPixDetPatternFinder::Road> patternVector =
patternFinder_->getPatterns();
247 int numberOfTracks = 0;
249 for (
const auto &
pattern : patternVector) {
253 std::map<CTPPSPixelDetId, std::vector<RPixDetPatternFinder::PointInPlane>>
261 if (tmpRomanPotId != romanPotId) {
263 <<
"Hits in the pattern must belong to the same tracking station";
266 if (hitOnPlaneMap.find(hitDetId) ==
267 hitOnPlaneMap.end()) {
268 std::vector<RPixDetPatternFinder::PointInPlane> hitOnPlane;
269 hitOnPlane.push_back(
hit);
270 hitOnPlaneMap[hitDetId] = hitOnPlane;
272 hitOnPlaneMap[hitDetId].push_back(
hit);
281 std::vector<CTPPSPixelLocalTrack> tmpTracksVector =
trackFinder_->getLocalTracks();
284 edm::LogInfo(
"CTPPSPixelLocalTrackProducer") <<
"tmpTracksVector = " << tmpTracksVector.size();
287 edm::LogInfo(
"CTPPSPixelLocalTrackProducer") <<
" ---> To many tracks in the pattern, cleared";
291 for (
const auto &
track : tmpTracksVector) {
299 edm::LogInfo(
"CTPPSPixelLocalTrackProducer") <<
"Number of tracks will be saved = " << numberOfTracks;
301 for (
const auto &
track : foundTracks) {
304 <<
"Track found in detId = " <<
track.detId() <<
" number = " <<
track.size();
307 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)
const edm::EDGetTokenT< edm::DetSetVector< CTPPSPixelRecHit > > tokenCTPPSPixelRecHit_
#define DEFINE_FWK_MODULE(type)
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_
bool getData(T &iHolder) const
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_