Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:59:53

0001 // -*- C++ -*-
0002 //
0003 // Package:    CheckPhase2Cabling
0004 // Class:      CheckPhase2Cabling
0005 //
0006 /**\class CheckPhase2Cabling CheckPhase2Cabling.cc CalibTracker/CheckPhase2Cabling/src/CheckPhase2Cabling.cc
0007 
0008  Description: simple check of the phase2 cabling
0009 
0010  Implementation:
0011      Just dump the cabling information
0012 */
0013 //
0014 // Original Author:  Christophe Delaere
0015 //         Created:  Fri Dec 20 19:37:34 CET 2013
0016 //
0017 
0018 // system include files
0019 #include <memory>
0020 #include <iostream>
0021 #include <algorithm>
0022 
0023 // user include files
0024 #include "FWCore/Framework/interface/Frameworkfwd.h"
0025 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0026 #include "FWCore/Framework/interface/Event.h"
0027 #include "FWCore/Framework/interface/EventSetup.h"
0028 #include "FWCore/Framework/interface/ESHandle.h"
0029 
0030 #include "FWCore/Framework/interface/Event.h"
0031 #include "FWCore/Framework/interface/MakerMacros.h"
0032 
0033 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0034 
0035 #include "CondFormats/SiStripObjects/interface/Phase2TrackerModule.h"
0036 #include "CondFormats/SiStripObjects/interface/Phase2TrackerCabling.h"
0037 #include "CondFormats/DataRecord/interface/Phase2TrackerCablingRcd.h"
0038 
0039 //
0040 // class declaration
0041 //
0042 
0043 class CheckPhase2Cabling : public edm::one::EDAnalyzer<> {
0044 public:
0045   explicit CheckPhase2Cabling(const edm::ParameterSet&);
0046   ~CheckPhase2Cabling();
0047 
0048   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0049 
0050 private:
0051   virtual void analyze(const edm::Event&, const edm::EventSetup&);
0052 
0053   // ----------member data ---------------------------
0054   const edm::ESGetToken<Phase2TrackerCabling, Phase2TrackerCablingRcd> cablingToken_;
0055 };
0056 
0057 //
0058 // constructors and destructor
0059 //
0060 CheckPhase2Cabling::CheckPhase2Cabling(const edm::ParameterSet& iConfig) : cablingToken_(esConsumes()) {}
0061 
0062 CheckPhase2Cabling::~CheckPhase2Cabling() = default;
0063 //
0064 // member functions
0065 //
0066 
0067 // ------------ method called for each event  ------------
0068 void CheckPhase2Cabling::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0069   using namespace edm;
0070 
0071   ESHandle<Phase2TrackerCabling> cablingHandle = iSetup.getHandle(cablingToken_);
0072 
0073   // print general information about the cabling
0074   std::cout << cablingHandle->summaryDescription() << std::endl;
0075   // print detailed information
0076   std::cout << cablingHandle->description() << std::endl;
0077 
0078   // search information about one module
0079   Phase2TrackerModule module = cablingHandle->findFedCh(std::make_pair(0, 1));
0080 
0081   // print information about that module
0082   std::cout << "Information about the module connected to FED 0.1:" << std::endl;
0083   std::cout << module.description() << std::endl;
0084 
0085   // look at one subset (based on cooling)
0086   Phase2TrackerCabling coolingLoop = cablingHandle->filterByCoolingLine(0);
0087   std::cout << "Subset in cooling line 0:" << std::endl;
0088   std::cout << coolingLoop.description(1) << std::endl;
0089 
0090   // look at one subset (based on power)
0091   Phase2TrackerCabling powerGroup = cablingHandle->filterByPowerGroup(1);
0092   std::cout << "Subset in power group 1:" << std::endl;
0093   std::cout << powerGroup.description(1) << std::endl;
0094 }
0095 
0096 // ------------ method fills 'descriptions' with the allowed parameters for the module  ------------
0097 void CheckPhase2Cabling::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0098   //The following says we do not know what parameters are allowed so do no validation
0099   // Please change this to state exactly what you do use, even if it is no parameters
0100   edm::ParameterSetDescription desc;
0101   desc.setUnknown();
0102   descriptions.addDefault(desc);
0103 }
0104 
0105 //define this as a plug-in
0106 DEFINE_FWK_MODULE(CheckPhase2Cabling);