46 #include "TObjString.h" 47 #include "TObjArray.h" 49 #include "TProfile2D.h" 84 void endJob()
override;
86 void readVertices(
double& minx,
double& maxx,
double& miny,
double& maxy);
88 void prepareStripNames();
89 void preparePixelNames();
97 void fillStripRemap();
129 TH2Poly* trackerMap{
nullptr};
144 if (!
input.isValid()) {
145 edm::LogError(
"TrackerRemapper") <<
"<GENERIC> not found... Aborting...\n";
149 typename T::const_iterator it;
150 for (it =
input->begin(); it !=
input->end(); ++it) {
151 auto id =
DetId(it->detId());
152 trackerMap->Fill(TString::Format(
"%ld", (
long)
id.rawId()), it->size());
170 m_opMode(iConfig.getParameter<
int>(
"opMode")),
171 m_analyzeMode(iConfig.getParameter<
int>(
"analyzeMode")) {
172 usesResource(
"TFileService");
205 edm::LogError(
"LogicError") <<
"Unrecognized analyze mode!" << std::endl;
208 throw cms::Exception(
"TrackerRemapper") <<
"Unrecognized operations mode!" << std::endl;
328 case AnalyzeData::RECHITS:
331 case AnalyzeData::DIGIS:
334 case AnalyzeData::CLUSTERS:
338 edm::LogError(
"LogicError") <<
"Unrecognized Analyze mode!" << std::endl;
354 LogInfo(
"Analyzer") <<
"reco::TrackCollection not found... Aborting...\n";
359 auto recHitsBegin =
track.recHitsBegin();
360 for (
unsigned i = 0;
i <
track.recHitsSize(); ++
i) {
361 auto recHit = *(recHitsBegin +
i);
366 unsigned subdetId =
id.subdetId();
373 trackerMap->Fill(TString::Format(
"%ld", (
long)
id.rawId()), 1);
383 double minx = 0xFFFFFF, maxx = -0xFFFFFF, miny = 0xFFFFFF, maxy = -0xFFFFFFF;
386 TObject* ghostObj =
fs->
make<TH2Poly>(
"ghost",
"ghost", -1, 1, -1, 1);
407 for (
auto pair :
m_bins) {
428 throw cms::Exception(
"TrackerRemapper") <<
"Error Reading File" << std::endl;
439 TObjArray*
array =
string.Tokenize(
" ");
442 for (
int i = 0;
i <
array->GetEntries(); ++
i) {
444 detid =
static_cast<TObjString*
>(
array->At(
i))->String().Atoll();
454 x[ix] =
static_cast<TObjString*
>(
array->At(
i))->String().Atof();
463 y[iy] =
static_cast<TObjString*
>(
array->At(
i))->String().Atof();
479 m_bins[detid] =
new TGraph(ix,
x,
y);
480 m_bins[detid]->SetName(TString::Format(
"%ld", detid));
481 m_bins[detid]->SetTitle(TString::Format(
"Module ID=%ld", detid));
496 for (
int layer = TkLayerMap::TkLayerEnum::TIB_L1;
layer <= TkLayerMap::TkLayerEnum::TECP_W9; ++
layer) {
506 for (
unsigned binx = 1; binx <= (unsigned)nchX; ++binx) {
507 for (
unsigned biny = 1; biny <= (unsigned)nchY; ++biny) {
512 double val = histHandle->GetBinContent(binx, biny);
522 rootFileHandle->Close();
531 if (!rootFileHandle) {
538 rootFileHandle->Close();
549 for (
auto&
i : pxb) {
553 long rawid =
id.
rawId();
558 int signedOnlineModule =
module - 4;
559 if (signedOnlineModule <= 0)
560 --signedOnlineModule;
563 int onlineShell = pixelBarrelName.
shell();
565 int signedOnlineLadder = ((onlineShell & 1) ? -pixelBarrelName.
ladderName() : pixelBarrelName.
ladderName());
569 unsigned nx = histHandle->GetNbinsX();
570 unsigned ny = histHandle->GetNbinsY();
572 unsigned binX = signedOnlineModule + ((nx + 1) >> 1);
573 unsigned binY = (signedOnlineLadder) + ((ny + 1) >> 1);
575 double val = histHandle->GetBinContent(binX, binY);
589 for (
auto&
i : pxf) {
594 int side =
tt->side(
id);
595 int disk =
tt->layer(
id);
597 long rawid =
id.rawId();
601 unsigned layer = pixelEndcapName.
ringName() - 1 + PixelLayerEnum::PXF_R1;
605 unsigned nx = histHandle->GetNbinsX();
606 unsigned ny = histHandle->GetNbinsY();
608 int onlineBlade = pixelEndcapName.
bladeName();
609 bool isInnerOnlineBlade = !(pixelEndcapName.
halfCylinder() & 1);
611 int signedOnlineBlade = (isInnerOnlineBlade) ? onlineBlade : -onlineBlade;
612 int signedDisk = (side == 2) ? disk : -disk;
613 int pannel = pixelEndcapName.
pannelName() - 1;
615 unsigned binX = signedDisk + ((nx + 1) >> 1);
616 unsigned binY = (signedOnlineBlade * 2) + (ny >> 1);
618 double val = histHandle->GetBinContent(binX, binY + pannel);
634 "Creates TH2Poly Strip Tracker maps by either analyzing the event or remapping exising DQM historams");
641 ->setComment(
"0 for Analyze, 1 for Remap");
644 ->setComment(
"1=Rechits, 2=Digis, 3=Clusters");
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T getParameter(std::string const &) const
std::string m_stripBaseDir
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
int ringName() const
ring Id
edm::EDGetTokenT< reco::TrackCollection > rechitSrcToken
std::string m_stripRemapFile
const DetContainer & detsPXB() const
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusterSrcToken
int bladeName() const
blade id
std::string m_pixelRemapFile
void analyzeGeneric(const edm::Event &iEvent, const edm::EDGetTokenT< T > &src)
std::map< unsigned, std::string > m_stripHistnameMap
const DetContainer & detsPXF() const
TrackerRemapper(const edm::ParameterSet &)
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
Log< level::Error, false > LogError
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
std::map< unsigned, std::string > m_pixelHistnameMap
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
static std::string const input
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
std::vector< const GeomDet * > DetContainer
void fillEndcapRemap(TFile *rootFileHandle, const TrackerGeometry *theTrackerGeometry, const TrackerTopology *tt)
std::string m_pixelDesiredHistogramDisk
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
HalfCylinder halfCylinder() const
DetId getDetFromBin(int layer, int ix, int iy) const
std::string m_stripDesiredHistogram
#define DEFINE_FWK_MODULE(type)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
void fillPixelRemap(const TrackerGeometry *theTrackerGeometry, const TrackerTopology *tt)
~TrackerRemapper() override
TDirectory * getBareDirectory(const std::string &subdir="") const
DetId geographicalId() const
The label of this GeomDet.
const TkDetMap * m_tkdetmap
edm::EDGetTokenT< edmNew::DetSetVector< SiStripDigi > > digiSrcToken
Log< level::Info, false > LogInfo
const edm::ParameterSet & iConfig
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::ESGetToken< TkDetMap, TrackerTopologyRcd > tkDetMapToken_
void getComponents(int layer, int &nchX, double &lowX, double &highX, int &nchY, double &lowY, double &highY) const
void analyzeRechits(const edm::Event &iEvent, const edm::EDGetTokenT< reco::TrackCollection > &src)
constexpr uint32_t rawId() const
get the raw id
void fillBarrelRemap(TFile *rootFileHandle, const TrackerGeometry *theTrackerGeometry, const TrackerTopology *tt)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::Service< TFileService > fs
void analyze(const edm::Event &, const edm::EventSetup &) override
bool isPixel(HitType hitType)
int ladderName() const
ladder id (index in phi)
T * make(const Args &...args) const
make new ROOT object
void readVertices(double &minx, double &maxx, double &miny, double &maxy)
std::map< unsigned, std::string > m_analyzeModeNameMap
std::map< long, TGraph * > m_bins
std::string m_pixelDesiredHistogramBarrel
int pannelName() const
pannel id
std::string m_pixelBaseDir
std::vector< unsigned > m_detIdVector