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;
192 if (detId.arm() == 0 && detId.rp() == 3) {
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_
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_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
reference find_or_insert(det_id_type id)
std::unique_ptr< RPixDetTrackFinder > trackFinder_
const int maxHitPerRomanPot_
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 int maxTrackPerRomanPot_
bool check(const edm::EventSetup &iSetup)
std::unique_ptr< RPixDetPatternFinder > patternFinder_
const int maxHitPerPlane_