Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:14:26

0001 // user include files
0002 #include "FWCore/Framework/interface/Frameworkfwd.h"
0003 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0004 #include "FWCore/Framework/interface/Event.h"
0005 #include "FWCore/Framework/interface/EventSetup.h"
0006 #include "FWCore/Framework/interface/MakerMacros.h"
0007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0009 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0010 
0011 #include "Geometry/CSCGeometry/interface/CSCGeometry.h"
0012 #include "Geometry/CSCGeometry/interface/CSCChamber.h"
0013 #include "Geometry/CommonTopologies/interface/StripTopology.h"
0014 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0015 
0016 //STL headers
0017 #include <vector>
0018 #include <sstream>
0019 #include <fstream>
0020 #include <string>
0021 #include <iomanip>
0022 
0023 class CSCGeometryDump : public edm::one::EDAnalyzer<> {
0024 public:
0025   explicit CSCGeometryDump(const edm::ParameterSet&);
0026   static void fillDescriptions(edm::ConfigurationDescriptions&);
0027 
0028 private:
0029   void analyze(const edm::Event&, const edm::EventSetup&) override;
0030 
0031   const bool verbose_;
0032   const edm::ESGetToken<CSCGeometry, MuonGeometryRecord> tokCSC_;
0033   const CSCGeometry* cscGeometry_;
0034 };
0035 
0036 CSCGeometryDump::CSCGeometryDump(const edm::ParameterSet& iC)
0037     : verbose_(iC.getParameter<bool>("verbose")),
0038       tokCSC_{esConsumes<CSCGeometry, MuonGeometryRecord>(edm::ESInputTag{})} {}
0039 
0040 void CSCGeometryDump::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0041   edm::ParameterSetDescription desc;
0042   desc.add<bool>("verbose", false);
0043   descriptions.add("cscGeometryDump", desc);
0044 }
0045 
0046 void CSCGeometryDump::analyze(const edm::Event& event, const edm::EventSetup& eventSetup) {
0047   cscGeometry_ = &eventSetup.getData(tokCSC_);
0048   auto const& chambers = cscGeometry_->chambers();
0049   edm::LogVerbatim("CSCGeometry") << "CSCGeometry found with " << chambers.size() << " chambers\n";
0050   for (unsigned int k1 = 0; k1 < chambers.size(); ++k1) {
0051     auto const& layers = chambers[k1]->layers();
0052     auto spec = chambers[k1]->specs();
0053     auto const& id = chambers[k1]->id();
0054     edm::LogVerbatim("CSCGeometry") << "\nChamber " << k1 << ":" << spec->chamberType() << ":"
0055                                     << spec->chamberTypeName() << ": (E:" << id.endcap() << " S:" << id.station()
0056                                     << " R:" << id.ring() << " C:" << id.chamber() << " L:" << id.layer() << ") with "
0057                                     << layers.size() << " layers ";
0058 
0059     if (verbose_)
0060       edm::LogVerbatim("CSCGeometry") << "\nStrip Resolution " << spec->stripResolution() << "\nWire resolution "
0061                                       << spec->wireResolution() << "\nEfficiency " << spec->efficiency()
0062                                       << "\nTime Window " << spec->timeWindow()
0063                                       << "\nNeutron hit rate per CSC layer per event " << spec->neutronRate()
0064                                       << "\nNumber of strips in one chamber " << spec->nStrips()
0065                                       << "\nNumber of strips nodes " << spec->nNodes() << "\nNumber of wires per group "
0066                                       << spec->nWiresPerGroup() << "\nNumber of floating strips "
0067                                       << spec->nFloatingStrips() << "\nStrip pitch in phi, in radians "
0068                                       << spec->stripPhiPitch() << "\nOffset to centre to intersection, in cm "
0069                                       << spec->ctiOffset() << "\nWire spacing, in cm " << spec->wireSpacing()
0070                                       << "\nDistance from anode to cathode, in cm " << spec->anodeCathodeSpacing()
0071                                       << "\nGas gain " << spec->gasGain() << "\nVoltage " << spec->voltage()
0072                                       << "\nCalibration uncertainty " << spec->calibrationError()
0073                                       << "\nElectron attraction " << spec->electronAttraction()
0074                                       << "\nFraction of the charge that survives to reach the cathode "
0075                                       << spec->fractionQS() << "\nADC calibration, in fC " << spec->chargePerCount()
0076                                       << "\nAnode wire radius, in cm " << spec->wireRadius()
0077                                       << "\nFast shaper peaking time (ns) " << spec->shaperPeakingTime()
0078                                       << "\nThe constant term in the electronics noise, in # of electrons "
0079                                       << spec->constantNoise()
0080                                       << "\nThe # of noise electrons per picofarad of capacitance " << spec->e_pF();
0081 
0082     for (unsigned int k2 = 0; k2 < layers.size(); ++k2) {
0083       auto const& id = layers[k2]->id();
0084       edm::LogVerbatim("CSCGeometry") << "\nLayer " << k2 << ":" << layers[k2]->type().name() << ": (E:" << id.endcap()
0085                                       << " S:" << id.station() << " R:" << id.ring() << " C:" << id.chamber()
0086                                       << " L:" << id.layer() << ")";
0087 
0088       if (verbose_)
0089         edm::LogVerbatim("CSCGeometry") << "\nLayer Geometry:\n" << *(layers[k2]->geometry());
0090     }
0091   }
0092 }
0093 
0094 DEFINE_FWK_MODULE(CSCGeometryDump);