CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
SiPixelVCalReader Class Reference
Inheritance diagram for SiPixelVCalReader:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 SiPixelVCalReader (const edm::ParameterSet &)
 
 ~SiPixelVCalReader () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

TH1F * offsetBPix_
 
TH1F * offsetFPix_
 
const bool printdebug_
 
const edm::ESGetToken< SiPixelVCal, SiPixelVCalSimRcdsiPixelVCalSimToken_
 
const edm::ESGetToken< SiPixelVCal, SiPixelVCalRcdsiPixelVCalToken_
 
TH1F * slopeBPix_
 
TH1F * slopeFPix_
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtkGeomToken_
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtkTopoToken_
 
const bool useSimRcd_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 36 of file SiPixelVCalReader.cc.

Constructor & Destructor Documentation

◆ SiPixelVCalReader()

SiPixelVCalReader::SiPixelVCalReader ( const edm::ParameterSet iConfig)
explicit

Definition at line 60 of file SiPixelVCalReader.cc.

References TFileService::kSharedResource.

65  printdebug_(iConfig.getUntrackedParameter<bool>("printDebug", false)),
66  useSimRcd_(iConfig.getParameter<bool>("useSimRcd")) {
67  usesResource(TFileService::kSharedResource);
68 }
static const std::string kSharedResource
Definition: TFileService.h:76
const edm::ESGetToken< SiPixelVCal, SiPixelVCalRcd > siPixelVCalToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
T getUntrackedParameter(std::string const &, T const &) const
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tkTopoToken_
const edm::ESGetToken< SiPixelVCal, SiPixelVCalSimRcd > siPixelVCalSimToken_

◆ ~SiPixelVCalReader()

SiPixelVCalReader::~SiPixelVCalReader ( )
overridedefault

Member Function Documentation

◆ analyze()

void SiPixelVCalReader::analyze ( const edm::Event e,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 72 of file SiPixelVCalReader.cc.

References TrackerGeometry::detUnits(), compareTotals::fs, edm::EventSetup::getData(), SiPixelVCal::getSlopeAndOffset(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, PVValHelper::ladder, nano_mu_digi_cff::layer, hltrates_dqm_sourceclient-live_cfg::offset, offsetBPix_, offsetFPix_, PVValHelper::phase1, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, TrackerTopology::pxbLadder(), TrackerTopology::pxbLayer(), TrackerTopology::pxfDisk(), TrackerTopology::pxfSide(), relativeConstraints::ring, PixelEndcapName::ringName(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::side(), siPixelVCalSimToken_, siPixelVCalToken_, slope, slopeBPix_, slopeFPix_, DetId::subdetId(), tkGeomToken_, tkTopoToken_, and useSimRcd_.

72  {
73  const SiPixelVCal* siPixelVCal;
74 
75  // Get record & file service
76  if (useSimRcd_) {
77  siPixelVCal = &iSetup.getData(siPixelVCalSimToken_);
78  } else {
79  siPixelVCal = &iSetup.getData(siPixelVCalToken_);
80  }
81  edm::LogInfo("SiPixelVCalReader") << "[SiPixelVCalReader::analyze] End Reading SiPixelVCal" << std::endl;
83 
84  // Retrieve tracker topology from geometry
85  const TrackerTopology* const tTopo = &iSetup.getData(tkTopoToken_);
86 
87  // Retrieve old style tracker geometry from geometry
88  const TrackerGeometry* pDD = &iSetup.getData(tkGeomToken_);
89  edm::LogPrint("SiPixelVCalReader") << " There are " << pDD->detUnits().size() << " modules" << std::endl;
90 
91  // Phase
92  bool phase1 = true;
93 
94  // Prepare tree
95  TTree* tree = new TTree("tree", "tree");
96  uint32_t detid, subdet, layer, ladder, side, disk, ring;
97  double slope, offset;
98  tree->Branch("detid", &detid, "detid/I");
99  tree->Branch("subdet", &subdet, "subdet/I");
100  tree->Branch("layer", &layer, "layer/I");
101  tree->Branch("ladder", &ladder, "ladder/I");
102  tree->Branch("side", &side, "side/I");
103  tree->Branch("disk", &disk, "disk/I");
104  tree->Branch("ring", &ring, "ring/I");
105  tree->Branch("slope", &slope, "slope/D");
106  tree->Branch("offset", &offset, "offset/D");
107 
108  // Prepare histograms
109  slopeBPix_ = fs->make<TH1F>("VCalSlopeBarrelPixel", "VCalSlopeBarrelPixel", 150, 0, 100);
110  slopeFPix_ = fs->make<TH1F>("VCalSlopeForwardPixel", "VCalSlopeForwardPixel", 150, 0, 100);
111  offsetBPix_ = fs->make<TH1F>("VCalOffsetBarrelPixel", "VCalOffsetBarrelPixel", 200, -900, 100);
112  offsetFPix_ = fs->make<TH1F>("VCalOffsetForwardPixel", "VCalOffsetForwardPixel", 200, -900, 100);
113  std::map<unsigned int, SiPixelVCal::VCal> vcal = siPixelVCal->getSlopeAndOffset();
114  std::map<unsigned int, SiPixelVCal::VCal>::const_iterator it;
115 
116  // Fill histograms
117  edm::LogPrint("SiPixelVCalReader") << std::setw(12) << "detid" << std::setw(8) << "subdet" << std::setw(8) << "layer"
118  << std::setw(8) << "disk" << std::setw(14) << "VCal slope" << std::setw(8)
119  << "offset" << std::endl;
120  for (it = vcal.begin(); it != vcal.end(); it++) {
121  detid = it->first;
122  slope = it->second.slope;
123  offset = it->second.offset;
124  const DetId detIdObj(detid);
125  PixelEndcapName fpix(detid, tTopo, phase1);
126  subdet = detIdObj.subdetId();
127  layer = tTopo->pxbLayer(detIdObj); // 1, 2, 3, 4
128  ladder = tTopo->pxbLadder(detIdObj); // 1-12/28/44/64
129  side = tTopo->pxfSide(detIdObj); // 1, 2
130  disk = tTopo->pxfDisk(detIdObj); // 1, 2, 3
131  ring = fpix.ringName(); // 1 (lower), 2 (upper)
132  edm::LogPrint("SiPixelVCalReader") << std::setw(12) << detid << std::setw(8) << subdet << std::setw(8) << layer
133  << std::setw(8) << disk << std::setw(14) << slope << std::setw(8) << offset
134  << std::endl;
135  // edm::LogPrint("SiPixelVCalReader") << "detid " << detid << ", subdet " << subdet << ", layer " <<
136  // layer << ", disk " << disk
137  // << ", VCal slope " << slope << ", offset " << offset <<
138  // std::endl;
139  // edm::LogInfo("SiPixelVCalReader") << "detid " << detid << ", subdet " <<
140  // subdet << ", layer " << layer
141  // << ", VCal slope " << slope << ", offset
142  // " << offset;
143  if (subdet == static_cast<int>(PixelSubdetector::PixelBarrel)) {
144  slopeBPix_->Fill(slope);
145  offsetBPix_->Fill(offset);
146  } else if (subdet == static_cast<int>(PixelSubdetector::PixelEndcap)) {
147  slopeFPix_->Fill(slope);
148  offsetFPix_->Fill(offset);
149  }
150  tree->Fill();
151  }
152 }
const edm::ESGetToken< SiPixelVCal, SiPixelVCalRcd > siPixelVCalToken_
unsigned int pxbLayer(const DetId &id) const
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
static const double slope[3]
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
unsigned int pxbLadder(const DetId &id) const
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tkTopoToken_
const edm::ESGetToken< SiPixelVCal, SiPixelVCalSimRcd > siPixelVCalSimToken_
unsigned int pxfDisk(const DetId &id) const
Log< level::Warning, true > LogPrint
Log< level::Info, false > LogInfo
Definition: DetId.h:17
unsigned int pxfSide(const DetId &id) const
const std::map< unsigned int, VCal > & getSlopeAndOffset() const
Definition: SiPixelVCal.h:23
Definition: tree.py:1

Member Data Documentation

◆ offsetBPix_

TH1F* SiPixelVCalReader::offsetBPix_
private

Definition at line 54 of file SiPixelVCalReader.cc.

Referenced by analyze().

◆ offsetFPix_

TH1F* SiPixelVCalReader::offsetFPix_
private

Definition at line 55 of file SiPixelVCalReader.cc.

Referenced by analyze().

◆ printdebug_

const bool SiPixelVCalReader::printdebug_
private

Definition at line 49 of file SiPixelVCalReader.cc.

◆ siPixelVCalSimToken_

const edm::ESGetToken<SiPixelVCal, SiPixelVCalSimRcd> SiPixelVCalReader::siPixelVCalSimToken_
private

Definition at line 44 of file SiPixelVCalReader.cc.

Referenced by analyze().

◆ siPixelVCalToken_

const edm::ESGetToken<SiPixelVCal, SiPixelVCalRcd> SiPixelVCalReader::siPixelVCalToken_
private

Definition at line 45 of file SiPixelVCalReader.cc.

Referenced by analyze().

◆ slopeBPix_

TH1F* SiPixelVCalReader::slopeBPix_
private

Definition at line 52 of file SiPixelVCalReader.cc.

Referenced by analyze().

◆ slopeFPix_

TH1F* SiPixelVCalReader::slopeFPix_
private

Definition at line 53 of file SiPixelVCalReader.cc.

Referenced by analyze().

◆ tkGeomToken_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiPixelVCalReader::tkGeomToken_
private

Definition at line 46 of file SiPixelVCalReader.cc.

Referenced by analyze().

◆ tkTopoToken_

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SiPixelVCalReader::tkTopoToken_
private

Definition at line 47 of file SiPixelVCalReader.cc.

Referenced by analyze().

◆ useSimRcd_

const bool SiPixelVCalReader::useSimRcd_
private

Definition at line 50 of file SiPixelVCalReader.cc.

Referenced by analyze().