69 : tracksToken_(consumes(iConfig.getParameter<edm::
InputTag>(
"src"))),
70 aliClusterToken_(consumes(iConfig.getParameter<edm::
InputTag>(
"assomap"))),
71 prescfilename_(iConfig.getParameter<std::
string>(
"PrescFileName")),
72 presctreename_(iConfig.getParameter<std::
string>(
"PrescTreeName")) {
74 produces<AliClusterValueMap>();
75 produces<AliTrackTakenClusterValueMap>();
82 edm::LogPrint(
"AlignmentPrescaler") <<
"in AlignmentPrescaler::beginJob" << std::flush;
85 tpresc_->BuildIndex(
"DetId");
86 tpresc_->SetBranchStatus(
"*",
false);
87 tpresc_->SetBranchStatus(
"DetId",
true);
88 tpresc_->SetBranchStatus(
"PrescaleFactor",
true);
89 tpresc_->SetBranchStatus(
"PrescaleFactorOverlap",
true);
90 edm::LogPrint(
"AlignmentPrescaler") <<
" Branches activated " << std::flush;
95 tpresc_->SetBranchAddress(
"DetId", &
detid_);
98 edm::LogPrint(
"AlignmentPrescaler") <<
" addressed " << std::flush;
112 LogDebug(
"AlignmentPrescaler") <<
"\n\n#################\n### Starting the AlignmentPrescaler::produce ; Event: "
113 << iEvent.
id().
run() <<
", " << iEvent.
id().
event() << std::endl;
122 std::vector<int> trackflags(Tracks->size(), 0);
127 for (std::vector<reco::Track>::const_iterator ittrk = Tracks->begin(), edtrk = Tracks->end(); ittrk != edtrk;
130 LogDebug(
"AlignmentPrescaler") <<
"Loop on hits of track #" << (ittrk - Tracks->begin()) << std::endl;
133 bool firstTakenHit =
false;
135 for (
auto const&
hit : ittrk->recHits()) {
136 if (!
hit->isValid()) {
140 uint32_t tmpdetid =
hit->geographicalId().rawId();
141 tpresc_->GetEntryWithIndex(tmpdetid);
146 int subdetId =
hit->geographicalId().subdetId();
149 bool isOverlapHit =
false;
159 const std::type_info&
type =
typeid(*hit);
167 if (stripType == 1) {
170 if (stripHit1D !=
nullptr) {
172 tmpflag = InValMap[stripclust];
173 tmpflag.SetDetId(
hit->geographicalId());
174 if (tmpflag.isOverlap())
177 <<
"~*~*~* Prescale (1D) for module " << tmpflag.detId().rawId() <<
"("
178 << InValMap[stripclust].detId().rawId() <<
") is " <<
hitPrescFactor_ << std::flush;
179 if (tmpflag.isOverlap())
180 LogDebug(
"AlignmentPrescaler") <<
" (it is Overlap)";
182 }
else if (stripType == 2) {
184 if (stripHit2D !=
nullptr) {
186 tmpflag = InValMap[stripclust];
187 tmpflag.SetDetId(
hit->geographicalId());
188 if (tmpflag.isOverlap())
191 <<
"~*~*~* Prescale (2D) for module " << tmpflag.detId().rawId() <<
"("
192 << InValMap[stripclust].detId().rawId() <<
") is " <<
hitPrescFactor_ << std::flush;
193 if (tmpflag.isOverlap())
194 LogDebug(
"AlignmentPrescaler") <<
" (it is Overlap)" << endl;
200 if (pixelhit !=
nullptr) {
203 tmpflag = InValMap[pixclust];
204 tmpflag.SetDetId(
hit->geographicalId());
205 if (tmpflag.isOverlap())
212 LogDebug(
"AlignmentPrescaler") <<
" DetId=" << tmpdetid <<
" is Overlap! " << flush;
220 LogDebug(
"AlignmentPrescaler") <<
" DetId=" << tmpdetid <<
" taken!" << flush;
221 tmpflag.SetTakenFlag();
224 if (stripType == 1) {
226 InValMap[stripclust] = tmpflag;
227 }
else if (stripType == 2) {
229 InValMap[stripclust] = tmpflag;
231 std::cout <<
"Unknown type of strip hit" << std::endl;
234 InValMap[pixclust] = tmpflag;
237 if (!firstTakenHit) {
238 firstTakenHit =
true;
239 LogDebug(
"AlignmentPrescaler") <<
"Index of the track iterator is " << ittrk - Tracks->begin();
245 trackflags[ittrk - Tracks->begin()] = ntakenhits;
250 auto OutVM = std::make_unique<AliClusterValueMap>();
255 auto trkVM = std::make_unique<AliTrackTakenClusterValueMap>();
257 trkmapfiller.insert(Tracks, trackflags.begin(), trackflags.end());
282 desc.
setComment(
"Prescale Tracker Alignment hits for alignment procedures");
ClusterRef cluster() const
EventNumber_t event() const
static constexpr auto TEC
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
unsigned int tibLayer(const DetId &id) const
AlignmentPrescaler(const edm::ParameterSet &iConfig)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
unsigned int pxfDisk(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
~AlignmentPrescaler() override
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
void setComment(std::string const &value)
unsigned int tidSide(const DetId &id) const
float overlapPrescFactor_
bool get(ProductID const &oid, Handle< PROD > &result) const
ClusterRef cluster() const
std::string prescfilename_
static constexpr auto TOB
std::string presctreename_
edm::EDGetTokenT< AliClusterValueMap > aliClusterToken_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void fillDescriptions(edm::ConfigurationDescriptions &)
Log< level::Warning, true > LogPrint
edm::EDGetTokenT< reco::TrackCollection > tracksToken_
unsigned int pxbLayer(const DetId &id) const
static constexpr auto TIB
ClusterRef cluster() const
unsigned int pxfSide(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
static constexpr auto TID
int layerFromId(const DetId &id, const TrackerTopology *tTopo) const
unsigned int tobLayer(const DetId &id) const