CMS 3D CMS Logo

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

Public Member Functions

 HGCalTestGuardRing (const edm::ParameterSet &ps)
 
 ~HGCalTestGuardRing () override=default
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- 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

void analyze (edm::Event const &, edm::EventSetup const &) override
 
void beginJob () override
 
void endJob () override
 
- 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)
 

Private Attributes

const edm::ESGetToken< HGCalGeometry, IdealGeometryRecordgeomToken_
 
const double guardRingOffset_
 
const std::string nameSense_
 
const std::string waferFile_
 
std::map< HGCSiliconDetId, int > waferID_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Detailed Description

Definition at line 37 of file HGCalTestGuardRing.cc.

Constructor & Destructor Documentation

◆ HGCalTestGuardRing()

HGCalTestGuardRing::HGCalTestGuardRing ( const edm::ParameterSet ps)

Definition at line 55 of file HGCalTestGuardRing.cc.

References nameSense_.

56  : nameSense_(ps.getParameter<std::string>("nameSense")),
57  waferFile_(ps.getParameter<std::string>("waferFile")),
58  guardRingOffset_(ps.getParameter<double>("guardRingOffset")),
59  geomToken_(esConsumes<HGCalGeometry, IdealGeometryRecord>(edm::ESInputTag{"", nameSense_})) {
60  DetId::Detector det = (nameSense_ != "HGCalHESiliconSensitive") ? DetId::HGCalEE : DetId::HGCalHSi;
61  edm::LogVerbatim("HGCalSim") << "Test Guard Ring Offset " << guardRingOffset_ << " for " << nameSense_ << ":" << det
62  << " for wafers read from file " << waferFile_;
63  if (!waferFile_.empty()) {
64  std::string thick[4] = {"h120", "l200", "l300", "h200"};
65  int addType[4] = {HGCalTypes::WaferFineThin,
69  const int partTypeH[6] = {HGCalTypes::WaferFull,
75  const int partTypeL[7] = {HGCalTypes::WaferFull,
82  edm::FileInPath filetmp("SimG4CMS/Calo/data/" + waferFile_);
83  std::string fileName = filetmp.fullPath();
84  std::ifstream fInput(fileName.c_str());
85  if (!fInput.good()) {
86  edm::LogVerbatim("HGCalSim") << "Cannot open file " << fileName;
87  } else {
88  char buffer[80];
89  while (fInput.getline(buffer, 80)) {
90  std::vector<std::string> items = CaloSimUtils::splitString(std::string(buffer));
91  if (items.size() > 6) {
92  int layer = std::atoi(items[0].c_str());
93  int waferU = std::atoi(items[4].c_str());
94  int waferV = std::atoi(items[5].c_str());
95  int thck = static_cast<int>(std::find(thick, thick + 4, items[2]) - thick);
96  int type = (thck < 4) ? addType[thck] : 0;
97  HGCSiliconDetId id(det, -1, type, layer, waferU, waferV, 0, 0);
98  int orient = std::atoi(items[5].c_str());
99  int part = std::atoi(items[1].c_str());
100  if (part >= 0) {
102  part = partTypeH[part];
103  else
104  part = partTypeL[part];
105  }
106  waferID_[id] = orient * 100 + part;
107 #ifdef EDM_ML_DEBUG
108  edm::LogVerbatim("HGCalSim") << "HGCalTestGuardRing::Reads " << id << " Orientation:Partial " << orient << ":"
109  << part;
110 #endif
111  }
112  }
113  edm::LogVerbatim("HGCalSim") << "HGCalTestGuardRing::Reads in " << waferID_.size() << " wafer information from "
114  << fileName;
115  fInput.close();
116  }
117  }
118 }
Log< level::Info, true > LogVerbatim
static constexpr int32_t WaferHalf2
Definition: HGCalTypes.h:43
static constexpr int32_t WaferFive2
Definition: HGCalTypes.h:44
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
int32_t waferU(const int32_t index)
std::map< HGCSiliconDetId, int > waferID_
const double guardRingOffset_
static constexpr int32_t WaferThree
Definition: HGCalTypes.h:42
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
static constexpr int32_t WaferSemi2
Definition: HGCalTypes.h:41
const edm::ESGetToken< HGCalGeometry, IdealGeometryRecord > geomToken_
static constexpr int32_t WaferFull
Definition: HGCalTypes.h:35
static constexpr int32_t WaferHalf
Definition: HGCalTypes.h:39
std::vector< std::string > splitString(const std::string &)
Definition: CaloSimUtils.cc:3
static constexpr int32_t WaferCoarseThin
Definition: HGCalTypes.h:31
const std::string nameSense_
const std::string waferFile_
static constexpr int32_t WaferChopTwoM
Definition: HGCalTypes.h:38
part
Definition: HCALResponse.h:20
Detector
Definition: DetId.h:24
int32_t waferV(const int32_t index)
static constexpr int32_t WaferCoarseThick
Definition: HGCalTypes.h:32
static constexpr int32_t WaferFive
Definition: HGCalTypes.h:36
static constexpr int32_t WaferFineThick
Definition: HGCalTypes.h:33
static constexpr int32_t WaferFineThin
Definition: HGCalTypes.h:30
static constexpr int32_t WaferSemi
Definition: HGCalTypes.h:40

◆ ~HGCalTestGuardRing()

HGCalTestGuardRing::~HGCalTestGuardRing ( )
overridedefault

Member Function Documentation

◆ analyze()

void HGCalTestGuardRing::analyze ( edm::Event const &  e,
edm::EventSetup const &  iS 
)
overrideprotectedvirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 128 of file HGCalTestGuardRing.cc.

References python.cmstools::all(), dqmdumpme::first, relativeConstraints::geom, geomToken_, edm::EventSetup::getData(), caHitNtupletGeneratorKernels::good, guardRingOffset_, DetId::HGCalEE, DetId::HGCalHSi, HGCGuardRing::insidePolygon(), nano_mu_digi_cff::layer, nameSense_, caHitNtupletGeneratorKernels::nCells, hgcalPerformanceValidation::orient, edm::second(), findQualityFiles::v, validateGeometry_cfg::valid, HGCalTypes::waferFrontBack(), waferID_, HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), HGCalWaferMask::waferXY(), geometryCSVtoXML::xy, and ecaldqm::zside().

128  {
129  // get HGCalGeometry
130  const HGCalGeometry* geom = &iS.getData(geomToken_);
131  const HGCalDDDConstants& hgc = geom->topology().dddConstants();
132  double waferSize = hgc.waferSize(false);
133  HGCalCell wafer(waferSize, hgc.getUVMax(0), hgc.getUVMax(1));
134  const bool v17OrLess = hgc.v17OrLess();
135 
136  // get the hit collection
137  edm::LogVerbatim("HGCalSim") << "HGCalTestGuardRing: Wafer Szie " << waferSize << " v17OrLess " << v17OrLess;
138 
139  // Loop over all IDs
140  int all(0), allSi(0), good(0);
141  for (std::map<HGCSiliconDetId, int>::const_iterator itr = waferID_.begin(); itr != waferID_.end(); ++itr) {
142  HGCSiliconDetId id = itr->first;
143  ++all;
144  if ((id.det() == DetId::HGCalEE) || (id.det() == DetId::HGCalHSi)) {
145  ++allSi;
146  if (((id.det() == DetId::HGCalEE) && (nameSense_ == "HGCalEESensitive")) ||
147  ((id.det() == DetId::HGCalHSi) && (nameSense_ == "HGCalHESiliconSensitive"))) {
148  int partial = ((itr->second) % 100);
149  int orient = (((itr->second) / 100) % 100);
150  int type = id.type();
151  int nCells = hgc.getUVMax(type);
152  for (int u = 0; u < 2 * nCells; ++u) {
153  for (int v = 0; v < 2 * nCells; ++v) {
154  if (((v - u) < nCells) && ((u - v) <= nCells)) {
155  HGCSiliconDetId hid(id.det(), id.zside(), id.type(), id.layer(), id.waferU(), id.waferV(), u, v);
156  bool valid = (geom->topology()).valid(static_cast<DetId>(hid));
157  if (valid) {
158  ++good;
159  int placeIndex = wafer.cellPlacementIndex(1, HGCalTypes::waferFrontBack(0), orient);
160  std::pair<double, double> xy = wafer.cellUV2XY1(u, v, placeIndex, type);
161  std::vector<std::pair<double, double> > wxy1 =
162  HGCalWaferMask::waferXY(partial, orient, -1, waferSize, 0.0, 0.0, 0.0, v17OrLess);
163  bool check1 = HGCGuardRing::insidePolygon(xy.first, xy.second, wxy1);
164  std::ostringstream st1;
165  for (unsigned int k1 = 0; k1 < wxy1.size(); ++k1)
166  st1 << " (" << wxy1[k1].first << ", " << wxy1[k1].second << ")";
167  edm::LogVerbatim("HGCSim")
168  << "First " << hid << " Type:Partial:Orient:Place " << type << ":" << partial << ":" << orient
169  << ":" << placeIndex << " Boundary with " << wxy1.size() << " points: " << st1.str() << " check "
170  << check1 << " for (" << xy.first << ", " << xy.second << ")";
171 
172  std::vector<std::pair<double, double> > wxy2 =
173  HGCalWaferMask::waferXY(partial, orient, -1, waferSize, guardRingOffset_, 0.0, 0.0, v17OrLess);
174  bool check2 = HGCGuardRing::insidePolygon(xy.first, xy.second, wxy2);
175  std::ostringstream st2;
176  for (unsigned int k1 = 0; k1 < wxy2.size(); ++k1)
177  st2 << " (" << wxy2[k1].first << ", " << wxy2[k1].second << ")";
178  edm::LogVerbatim("HGCSim") << "Second Offset " << guardRingOffset_ << " Boundary with " << wxy2.size()
179  << " points: " << st2.str() << " check " << check2 << " for (" << xy.first
180  << ", " << xy.second << ")";
181  }
182  }
183  }
184  }
185  }
186  }
187  }
188  edm::LogVerbatim("HGCalSim") << "Total hits = " << all << " Good Silicon DetIds = " << allSi << ":" << good;
189 }
Log< level::Info, true > LogVerbatim
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:25
static constexpr int32_t waferFrontBack(int32_t index)
Definition: HGCalTypes.h:131
int32_t waferU(const int32_t index)
std::map< HGCSiliconDetId, int > waferID_
const double guardRingOffset_
int zside(DetId const &)
const edm::ESGetToken< HGCalGeometry, IdealGeometryRecord > geomToken_
static std::vector< std::pair< double, double > > waferXY(const int &part, const int &orient, const int &zside, const double &waferSize, const double &offset, const double &xpos, const double &ypos, const bool &v17)
U second(std::pair< T, U > const &p)
const std::string nameSense_
TupleMultiplicity< TrackerTraits > const HitToTuple< TrackerTraits > const cms::cuda::AtomicPairCounter GPUCACellT< TrackerTraits > const *__restrict__ uint32_t const *__restrict__ nCells
static bool insidePolygon(double x, double y, const std::vector< std::pair< double, double > > &xyv)
Definition: HGCGuardRing.cc:81
int32_t waferV(const int32_t index)

◆ beginJob()

void HGCalTestGuardRing::beginJob ( void  )
inlineoverrideprotectedvirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 45 of file HGCalTestGuardRing.cc.

45 {}

◆ endJob()

void HGCalTestGuardRing::endJob ( void  )
inlineoverrideprotectedvirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 46 of file HGCalTestGuardRing.cc.

46 {}

◆ fillDescriptions()

void HGCalTestGuardRing::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 120 of file HGCalTestGuardRing.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

120  {
122  desc.add<std::string>("nameSense", "HGCalEESensitive");
123  desc.add<std::string>("waferFile", "testWafersEE.txt");
124  desc.add<double>("guardRingOffset", 1.0);
125  descriptions.add("hgcalTestGuardRingEE", desc);
126 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ geomToken_

const edm::ESGetToken<HGCalGeometry, IdealGeometryRecord> HGCalTestGuardRing::geomToken_
private

Definition at line 51 of file HGCalTestGuardRing.cc.

Referenced by analyze().

◆ guardRingOffset_

const double HGCalTestGuardRing::guardRingOffset_
private

Definition at line 50 of file HGCalTestGuardRing.cc.

Referenced by analyze().

◆ nameSense_

const std::string HGCalTestGuardRing::nameSense_
private

Definition at line 49 of file HGCalTestGuardRing.cc.

Referenced by analyze(), and HGCalTestGuardRing().

◆ waferFile_

const std::string HGCalTestGuardRing::waferFile_
private

Definition at line 49 of file HGCalTestGuardRing.cc.

◆ waferID_

std::map<HGCSiliconDetId, int> HGCalTestGuardRing::waferID_
private

Definition at line 52 of file HGCalTestGuardRing.cc.

Referenced by analyze().