51 <<
" (pox,posy,posz) = (" <<
posX_ <<
"," <<
posY_ <<
"," <<
posZ_ <<
")" 135 overlapAM_(iConfig.getParameter<
edm::
InputTag>(
"OverlapAssoMap")),
136 keepTrackStats_(iConfig.getParameter<
bool>(
"keepTrackStats")),
137 keepHitPopulation_(iConfig.getParameter<
bool>(
"keepHitStats")),
138 statsTreeName_(iConfig.getParameter<
string>(
"TrkStatsFileName")),
139 hitsTreeName_(iConfig.getParameter<
string>(
"HitStatsFileName")),
140 prescale_(iConfig.getParameter<uint32_t>(
"TrkStatsPrescale")),
154 desc.add<
bool>(
"keepTrackStats",
false);
155 desc.add<
bool>(
"keepHitStats",
false);
158 desc.add<
unsigned int>(
"TrkStatsPrescale", 1);
159 descriptions.
add(
"AlignmentStats",
desc);
167 outtree_ =
new TTree(
"AlignmentTrackStats",
"Statistics of Tracks used for Alignment");
175 outtree_->Branch(
"P", &
P,
"P[Ntracks]/F");
194 hitstree_ =
new TTree(
"AlignmentHitMap",
"Maps of Hits used for Alignment");
215 auto theAliTracker = std::make_unique<AlignableTracker>(trackerGeometry_,
trackerTopology_.get());
218 for (
const auto &detUnit : theAliTracker->deepComponents()) {
220 detUnitInfo.
id_ =
static_cast<uint32_t
>(detUnit->id());
225 detUnitInfo.
posX_ = detUnit->globalPosition().x();
226 detUnitInfo.
posY_ = detUnit->globalPosition().y();
227 detUnitInfo.
posZ_ = detUnit->globalPosition().z();
238 detUnitInfo.
is2D_ =
true;
242 detUnitInfo.
is2D_ =
true;
262 <<
"Detector not belonging neither to pixels nor to strips! Skipping it. SubDet= " << detUnitInfo.
subdet_;
265 LogDebug(
"AlignmentStats") <<
"id " << detUnitInfo.
id_ <<
" detid.rawId()" << detid.
rawId() <<
" subdet " 274 <<
" Number of DetUnits in the AlignableTracker: " << ndetunits;
297 unsigned int trk_cnt = 0;
305 for (
int k = 0;
k < 7;
k++) {
313 for (
const auto &ittrk : *
Tracks) {
314 Eta[trk_cnt] = ittrk.eta();
315 Phi[trk_cnt] = ittrk.phi();
316 Chi2n[trk_cnt] = ittrk.normalizedChi2();
317 P[trk_cnt] = ittrk.p();
318 Pt[trk_cnt] = ittrk.pt();
319 Nhits[trk_cnt][0] = ittrk.numberOfValidHits();
322 edm::LogVerbatim(
"AlignmenStats") <<
"Track #" << trk_cnt + 1 <<
" params: Eta=" <<
Eta[trk_cnt]
323 <<
" Phi=" <<
Phi[trk_cnt] <<
" P=" <<
P[trk_cnt]
324 <<
" Nhits=" <<
Nhits[trk_cnt][0];
328 for (
auto const &
hit : ittrk.recHits()) {
331 DetId detid =
hit->geographicalId();
333 uint32_t
rawId =
hit->geographicalId().rawId();
338 DetHitMap::iterator mapiter;
340 if (mapiter !=
hitmap_.end()) {
353 if (!(hitInPixel || hitInStrip)) {
355 edm::LogError(
"AlignmentStats") <<
"Hit not belonging neither to pixels nor to strips! Skipping it. SubDet= " 362 const std::type_info &
type =
typeid(*hit);
367 if (striphit !=
nullptr) {
369 inval = OverlapMap[stripclust];
373 <<
"ERROR in <AlignmentStats::analyze>: Dynamic cast of Strip RecHit1D failed! TypeId of the RecHit: " 379 if (striphit !=
nullptr) {
381 inval = OverlapMap[stripclust];
385 <<
"ERROR in <AlignmentStats::analyze>: Dynamic cast of Strip RecHit2D failed! TypeId of the RecHit: " 396 inval = OverlapMap[pixclust];
400 <<
"ERROR in <AlignmentStats::analyze>: Dynamic cast of Pixel RecHit failed! TypeId of the RecHit: " 409 DetHitMap::iterator overlapiter;
420 int subdethit =
static_cast<int>(
hit->geographicalId().subdetId());
423 Nhits[trk_cnt][subdethit] =
Nhits[trk_cnt][subdethit] + 1;
444 edm::LogInfo(
"AlignmentStats") <<
"Writing out the TrackStatistics in " << gDirectory->GetPath();
449 edm::LogInfo(
"AlignmentStats") << __PRETTY_FUNCTION__ <<
"Number of DetUnits in the AlignableTracker: " << ndetunits
455 detUnitInfo.printAll();
458 id_ = detUnitInfo.id_;
459 posX_ = detUnitInfo.posX_;
460 posY_ = detUnitInfo.posY_;
461 posZ_ = detUnitInfo.posZ_;
464 posR_ = detUnitInfo.posR_;
466 layer_ = detUnitInfo.layer_;
467 is2D_ = detUnitInfo.is2D_;
476 hitmap_.insert(pair<uint32_t, uint32_t>(
id_, 0));
Log< level::Info, true > LogVerbatim
const std::string hitsTreeName_
void beginRun(edm::Run const &, edm::EventSetup const &) override
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
~AlignmentStats() override=default
static constexpr auto TID
const bool keepHitPopulation_
Geom::Phi< T > phi() const
std::vector< Track > TrackCollection
collection of Tracks
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > esTokenTkGeoER_
std::vector< aliStats::GeoInfo > geomInfoList_
Log< level::Error, false > LogError
ClusterRef cluster() const
const edm::EDGetTokenT< reco::TrackCollection > trackToken_
const edm::InputTag overlapAM_
std::map< uint32_t, uint32_t > DetHitMap
#define DEFINE_FWK_MODULE(type)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
static constexpr auto TOB
void endRun(edm::Run const &iRun, edm::EventSetup const &iSetup) override
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > esTokenTTopoER_
Log< level::Info, false > LogInfo
const std::string statsTreeName_
const edm::EDGetTokenT< AliClusterValueMap > mapToken_
constexpr uint32_t rawId() const
get the raw id
AlignmentStats(const edm::ParameterSet &iConfig)
static const int MAXTRKS_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::pair< OmniClusterRef, TrackingParticleRef > P
static constexpr auto TIB
const bool keepTrackStats_
ClusterRef cluster() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::unique_ptr< TrackerTopology > trackerTopology_
static constexpr auto TEC
std::string className(const T &t)
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override