-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created Strip Tracker Map Remapper/Analyzer
- Loading branch information
1 parent
709f4c8
commit 2666f38
Showing
6 changed files
with
815 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Tracker Remapper Tool | ||
|
||
The tool to either remap existing DQM histograms onto Strip Detector layout or to analyze event files and put eveents into the right detector parts. | ||
|
||
## Running basics | ||
|
||
Should you need to run this tool use: `cmsRun ConfFile_cfg.py [option=value]` | ||
|
||
Options can be either adjusted in the configuration file (`ConfFile_cfg.py`) or passed as a list of `key=value` pairs. In the latter case unspecified options are taken directly from `ConfFile_cfg.py`. | ||
|
||
## Options | ||
|
||
1. `opMode` - mode of operation, allowed values: | ||
1. `0` or `MODE_ANALYZE` (in configuration) | ||
2. `1` or `MODE_REMAP` (in configuration) | ||
2. `analyzeMode` - option used to choose what do you want to put inside the map if `MODE_ANALYZE` was chosen: | ||
1. `1` or `RECHITS` (in configuration) for TRACKS | ||
2. `2` or `DIGIS` (in configuration) for DIGIS | ||
3. `3` or `CLUSTERS` (in configuration) for CLUSTERS | ||
3. `eventLimit` - only relevant for `MODE_ANALYZE` controls how many events from the input should be processed; default value is `100`, put `-1` to process all events from the input | ||
4. `inputRootFile` - relative path to the file to process, it should be different type of file depending on the `opMode` set: | ||
1. `MODE_ANALYZE` - DQM root file containing regular SiStrip plots | ||
2. `MODE_REMAP` - root file with events to process | ||
4. `stripHistogram` - histogram name to look for when `opMode=MODE_REMAP` is set, default is `TkHMap_NumberValidHits` | ||
5. `src` - automaticly set based on your settings, change at your own risk | ||
6. `globalTag` - global tag (GT) to use, default is `92X_upgrade2017_realistic_v11` | ||
|
||
## The output | ||
|
||
Your output will be saved by default as `outputStrip.root` in your current working directory. This can be tuned in the `ConfFile_cfg.py` file. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
// | ||
// Original Author: Pawel Jurgielewicz | ||
// Created: Tue, 21 Nov 2017 13:38:45 GMT | ||
// | ||
// | ||
|
||
// system include files | ||
#include <memory> | ||
|
||
// user include files | ||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Framework/interface/one/EDAnalyzer.h" | ||
|
||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
|
||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
|
||
#include "FWCore/Framework/interface/ESHandle.h" | ||
|
||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
|
||
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" | ||
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" | ||
|
||
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" | ||
#include "DataFormats/SiPixelDetId/interface/PXBDetId.h" | ||
#include "DataFormats/SiPixelDetId/interface/PXFDetId.h" | ||
#include "DataFormats/SiPixelDetId/interface/PixelEndcapName.h" | ||
#include "DataFormats/SiPixelDetId/interface/PixelBarrelName.h" | ||
#include "DataFormats/TrackReco/interface/Track.h" | ||
#include "DataFormats/TrackReco/interface/TrackFwd.h" | ||
#include "DataFormats/SiStripDigi/interface/SiStripDigi.h" | ||
#include "DataFormats/Common/interface/DetSetVectorNew.h" | ||
#include "DataFormats/SiStripCluster/interface/SiStripCluster.h" | ||
|
||
#include "FWCore/ServiceRegistry/interface/Service.h" | ||
#include "CommonTools/UtilAlgos/interface/TFileService.h" | ||
|
||
#include "CalibTracker/SiStripCommon/interface/TkDetMap.h" | ||
|
||
#include "TGraph.h" | ||
#include "TObjString.h" | ||
#include "TObjArray.h" | ||
#include "TH2Poly.h" | ||
#include "TProfile2D.h" | ||
#include "TColor.h" | ||
|
||
#include <iostream> | ||
#include <vector> | ||
#include <map> | ||
#include <string> | ||
|
||
using namespace edm; | ||
using namespace std; | ||
|
||
class TrackerRemapper : public edm::one::EDAnalyzer<edm::one::SharedResources> { | ||
public: | ||
explicit TrackerRemapper(const edm::ParameterSet&); | ||
~TrackerRemapper() override; | ||
|
||
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); | ||
|
||
enum PixelLayerEnum { | ||
INVALID = 0, | ||
|
||
PXB_L1, | ||
PXB_L2, | ||
PXB_L3, | ||
PXB_L4, | ||
|
||
PXF_R1, | ||
PXF_R2 | ||
}; | ||
|
||
enum AnalyzeData { | ||
RECHITS = 1, | ||
DIGIS, | ||
CLUSTERS, | ||
}; | ||
|
||
enum OpMode { MODE_ANALYZE = 0, MODE_REMAP = 1 }; | ||
|
||
private: | ||
void beginJob() override; | ||
void analyze(const edm::Event&, const edm::EventSetup&) override; | ||
void endJob() override; | ||
|
||
void ReadVertices(double& minx, double& maxx, double& miny, double& maxy); | ||
|
||
void PrepareStripNames(); | ||
void PreparePixelNames(); | ||
|
||
void BookBins(ESHandle<TrackerGeometry>& theTrackerGeometry, const TrackerTopology* tt); | ||
|
||
template <class T> | ||
void AnalyzeGeneric(const edm::Event& iEvent, const edm::EDGetTokenT<T>& src); | ||
void AnalyzeRechits(const edm::Event& iEvent, const edm::EDGetTokenT<reco::TrackCollection>& src); | ||
// void AnalyzeDigis(const edm::Event& iEvent); | ||
void AnalyzeClusters(const edm::Event& iEvent); | ||
|
||
void FillStripRemap(); | ||
void FillPixelRemap(ESHandle<TrackerGeometry>& theTrackerGeometry, const TrackerTopology* tt); | ||
void FillBarrelRemap(TFile* rootFileHandle, ESHandle<TrackerGeometry>& theTrackerGeometry, const TrackerTopology* tt); | ||
void FillEndcapRemap(TFile* rootFileHandle, ESHandle<TrackerGeometry>& theTrackerGeometry, const TrackerTopology* tt); | ||
|
||
edm::Service<TFileService> fs; | ||
const edm::ParameterSet& iConfig; | ||
|
||
unsigned opMode; | ||
unsigned analyzeMode; | ||
|
||
std::map<long, TGraph*> bins; | ||
std::vector<unsigned> detIdVector; | ||
|
||
const TkDetMap* tkdetmap; | ||
|
||
map<unsigned, string> stripHistnameMap; | ||
map<unsigned, string> pixelHistnameMap; | ||
map<unsigned, string> analyzeModeNameMap; | ||
|
||
string stripRemapFile; | ||
string pixelRemapFile; | ||
|
||
string stripBaseDir, stripDesiredHistogram; | ||
string pixelBaseDir, pixelDesiredHistogramBarrel, pixelDesiredHistogramDisk; | ||
|
||
string runString; | ||
|
||
TH2Poly* trackerMap{nullptr}; | ||
|
||
edm::EDGetTokenT<reco::TrackCollection> rechitSrcToken; | ||
edm::EDGetTokenT<edmNew::DetSetVector<SiStripDigi>> digiSrcToken; | ||
edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster>> clusterSrcToken; | ||
}; | ||
|
||
template <class T> | ||
void TrackerRemapper::AnalyzeGeneric(const edm::Event& iEvent, const edm::EDGetTokenT<T>& src) { | ||
edm::Handle<T> input; | ||
iEvent.getByToken(src, input); | ||
|
||
if (!input.isValid()) { | ||
cout << "<GENERIC> not found... Aborting...\n"; | ||
return; | ||
} | ||
|
||
typename T::const_iterator it; | ||
for (it = input->begin(); it != input->end(); ++it) { | ||
auto id = DetId(it->detId()); | ||
trackerMap->Fill(TString::Format("%ld", (long)id.rawId()), it->size()); | ||
} | ||
} | ||
|
||
template <> | ||
void TrackerRemapper::AnalyzeGeneric(const edm::Event& iEvent, const edm::EDGetTokenT<reco::TrackCollection>& t) { | ||
AnalyzeRechits(iEvent, t); | ||
} | ||
|
||
//define this as a plug-in | ||
DEFINE_FWK_MODULE(TrackerRemapper); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<use name="FWCore/Framework"/> | ||
<use name="FWCore/PluginManager"/> | ||
<use name="FWCore/ParameterSet"/> | ||
|
||
< use name="Geometry/Records"/> | ||
< use name="Geometry/TrackerGeometryBuilder"/> | ||
< use name="Geometry/CommonTopologies"/> | ||
|
||
< use name="CommonTools/UtilAlgos"/> | ||
< use name="DataFormats/GeometrySurface"/> | ||
< use name="RecoTracker/TkDetLayers"/> | ||
|
||
< use name="DataFormats/TrackerCommon"/> | ||
< use name="DataFormats/TrackerRecHit2D"/> | ||
< use name="DataFormats/TrackReco"/> | ||
|
||
< use name="CalibTracker/SiStripCommon"/> | ||
|
||
<flags EDM_PLUGIN="1"/> |
Oops, something went wrong.