Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-13 03:16:15

0001 #ifndef GlobalDigisProducer_h
0002 #define GlobalDigisProducer_h
0003 
0004 /** \class GlobalDigiProducer
0005  *
0006  *  Class to fill PGlobalDigi object to be inserted into data stream
0007  *  containing information about various sub-systems in global coordinates
0008  *  with full geometry
0009  *
0010  *  \author M. Strang SUNY-Buffalo
0011  */
0012 
0013 // framework & common header files
0014 #include "DataFormats/Common/interface/Handle.h"
0015 #include "FWCore/Framework/interface/one/EDProducer.h"
0016 #include "FWCore/Framework/interface/ESHandle.h"
0017 #include "FWCore/Framework/interface/Event.h"
0018 #include "FWCore/Framework/interface/EventSetup.h"
0019 #include "FWCore/Framework/interface/Frameworkfwd.h"
0020 //#include "DataFormats/Common/interface/Provenance.h"
0021 #include "DataFormats/Provenance/interface/Provenance.h"
0022 #include "FWCore/Framework/interface/MakerMacros.h"
0023 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0024 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0025 
0026 // DQM services
0027 #include "DQMServices/Core/interface/DQMStore.h"
0028 #include "FWCore/ServiceRegistry/interface/Service.h"
0029 
0030 // ecal calorimeter info
0031 #include "CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h"
0032 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0033 #include "DataFormats/EcalDetId/interface/EEDetId.h"
0034 #include "DataFormats/EcalDetId/interface/ESDetId.h"
0035 #include "DataFormats/EcalDigi/interface/EBDataFrame.h"
0036 #include "DataFormats/EcalDigi/interface/EEDataFrame.h"
0037 #include "DataFormats/EcalDigi/interface/ESDataFrame.h"
0038 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
0039 
0040 // hcal calorimeter info
0041 #include "CalibFormats/HcalObjects/interface/HcalCalibrations.h"
0042 #include "CalibFormats/HcalObjects/interface/HcalCoderDb.h"
0043 #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
0044 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
0045 #include "DataFormats/HcalDetId/interface/HcalElectronicsId.h"
0046 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
0047 #include "DataFormats/HcalDigi/interface/HBHEDataFrame.h"
0048 #include "DataFormats/HcalDigi/interface/HFDataFrame.h"
0049 #include "DataFormats/HcalDigi/interface/HODataFrame.h"
0050 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
0051 #include "DataFormats/HcalDigi/interface/HcalQIESample.h"
0052 //#include "Geometry/Records/interface/IdealGeometryRecord.h"
0053 //#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0054 //#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
0055 //#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0056 #include "CalibFormats/HcalObjects/interface/HcalDbService.h"
0057 
0058 // silicon strip info
0059 #include "DataFormats/Common/interface/DetSetVector.h"
0060 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
0061 #include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
0062 
0063 // silicon pixel info
0064 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
0065 #include "DataFormats/SiPixelDigi/interface/PixelDigi.h"
0066 
0067 // muon DT info
0068 #include "DataFormats/DTDigi/interface/DTDigi.h"
0069 #include "DataFormats/DTDigi/interface/DTDigiCollection.h"
0070 #include "DataFormats/MuonDetId/interface/DTLayerId.h"
0071 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0072 
0073 // muon CSC Strip info
0074 #include "DataFormats/CSCDigi/interface/CSCStripDigi.h"
0075 #include "DataFormats/CSCDigi/interface/CSCStripDigiCollection.h"
0076 
0077 // muon CSC Wire info
0078 #include "DataFormats/CSCDigi/interface/CSCWireDigi.h"
0079 #include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h"
0080 
0081 // event info
0082 #include "SimDataFormats/CaloHit/interface/PCaloHit.h"
0083 #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h"
0084 #include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h"
0085 #include "SimDataFormats/CrossingFrame/interface/MixCollection.h"
0086 #include "SimDataFormats/ValidationFormats/interface/PValidationFormats.h"
0087 
0088 // helper files
0089 //#include <CLHEP/Vector/LorentzVector.h>
0090 //#include <CLHEP/Units/SystemOfUnits.h>
0091 
0092 #include <cstdlib>
0093 #include <map>
0094 #include <memory>
0095 #include <string>
0096 #include <vector>
0097 
0098 #include "TString.h"
0099 
0100 class PGlobalDigi;
0101 class TrackerTopology;
0102 class TrackerTopologyRcd;
0103 class GlobalDigisProducer : public edm::one::EDProducer<> {
0104 public:
0105   typedef std::vector<float> FloatVector;
0106   typedef std::vector<double> DoubleVector;
0107   typedef std::vector<int> IntVector;
0108   typedef std::map<uint32_t, float, std::less<uint32_t>> MapType;
0109 
0110   explicit GlobalDigisProducer(const edm::ParameterSet &);
0111   ~GlobalDigisProducer() override;
0112   void beginJob(void) override;
0113   void endJob() override;
0114   void produce(edm::Event &, const edm::EventSetup &) override;
0115 
0116 private:
0117   // production related methods
0118   void fillECal(edm::Event &, const edm::EventSetup &);
0119   void storeECal(PGlobalDigi &);
0120   void fillHCal(edm::Event &, const edm::EventSetup &);
0121   void storeHCal(PGlobalDigi &);
0122   void fillTrk(edm::Event &, const edm::EventSetup &);
0123   void storeTrk(PGlobalDigi &);
0124   void fillMuon(edm::Event &, const edm::EventSetup &);
0125   void storeMuon(PGlobalDigi &);
0126 
0127   void clear();
0128 
0129 private:
0130   //  parameter information
0131   std::string fName;
0132   int verbosity;
0133   int frequency;
0134   std::string label;
0135   bool getAllProvenances;
0136   bool printProvenanceInfo;
0137 
0138   // Electromagnetic info
0139   // ECal info
0140 
0141   IntVector EBCalmaxPos;
0142   DoubleVector EBCalAEE;
0143   FloatVector EBCalSHE;
0144 
0145   IntVector EECalmaxPos;
0146   DoubleVector EECalAEE;
0147   FloatVector EECalSHE;
0148 
0149   FloatVector ESCalADC0, ESCalADC1, ESCalADC2;
0150   FloatVector ESCalSHE;
0151 
0152   edm::InputTag ECalEBSrc_;
0153   edm::InputTag ECalEESrc_;
0154   edm::InputTag ECalESSrc_;
0155 
0156   std::map<int, double, std::less<int>> ECalgainConv_;
0157   double ECalbarrelADCtoGeV_;
0158   double ECalendcapADCtoGeV_;
0159 
0160   // HCal info
0161 
0162   FloatVector HBCalAEE;
0163   FloatVector HBCalSHE;
0164 
0165   FloatVector HECalAEE;
0166   FloatVector HECalSHE;
0167 
0168   FloatVector HOCalAEE;
0169   FloatVector HOCalSHE;
0170 
0171   FloatVector HFCalAEE;
0172   FloatVector HFCalSHE;
0173 
0174   edm::InputTag HCalSrc_;
0175   edm::InputTag HCalDigi_;
0176 
0177   edm::ESGetToken<EcalADCToGeVConstant, EcalADCToGeVConstantRcd> ecalADCtoGevToken_;
0178   edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoToken_;
0179   edm::ESGetToken<HcalDbService, HcalDbRecord> hcaldbToken_;
0180   // Tracker info
0181   // SiStrip
0182 
0183   FloatVector TIBL1ADC, TIBL2ADC, TIBL3ADC, TIBL4ADC;
0184   IntVector TIBL1Strip, TIBL2Strip, TIBL3Strip, TIBL4Strip;
0185 
0186   FloatVector TOBL1ADC, TOBL2ADC, TOBL3ADC, TOBL4ADC;
0187   IntVector TOBL1Strip, TOBL2Strip, TOBL3Strip, TOBL4Strip;
0188 
0189   FloatVector TIDW1ADC, TIDW2ADC, TIDW3ADC;
0190   IntVector TIDW1Strip, TIDW2Strip, TIDW3Strip;
0191 
0192   FloatVector TECW1ADC, TECW2ADC, TECW3ADC, TECW4ADC, TECW5ADC, TECW6ADC, TECW7ADC, TECW8ADC;
0193   IntVector TECW1Strip, TECW2Strip, TECW3Strip, TECW4Strip, TECW5Strip, TECW6Strip, TECW7Strip, TECW8Strip;
0194 
0195   edm::InputTag SiStripSrc_;
0196 
0197   // SiPxl
0198 
0199   FloatVector BRL1ADC, BRL2ADC, BRL3ADC;
0200   IntVector BRL1Row, BRL2Row, BRL3Row;
0201   IntVector BRL1Col, BRL2Col, BRL3Col;
0202 
0203   FloatVector FWD1pADC, FWD1nADC, FWD2pADC, FWD2nADC;
0204   IntVector FWD1pRow, FWD1nRow, FWD2pRow, FWD2nRow;
0205   IntVector FWD1pCol, FWD1nCol, FWD2pCol, FWD2nCol;
0206 
0207   edm::InputTag SiPxlSrc_;
0208 
0209   // Muon info
0210   // DT
0211 
0212   IntVector MB1SLayer, MB2SLayer, MB3SLayer, MB4SLayer;
0213   FloatVector MB1Time, MB2Time, MB3Time, MB4Time;
0214   IntVector MB1Layer, MB2Layer, MB3Layer, MB4Layer;
0215 
0216   edm::InputTag MuDTSrc_;
0217 
0218   // CSC Strip
0219 
0220   float theCSCStripPedestalSum;
0221   int theCSCStripPedestalCount;
0222 
0223   FloatVector CSCStripADC;
0224 
0225   edm::InputTag MuCSCStripSrc_;
0226 
0227   // CSC Wire
0228 
0229   FloatVector CSCWireTime;
0230 
0231   edm::InputTag MuCSCWireSrc_;
0232 
0233   // private statistics information
0234   unsigned int count;
0235 
0236   // fix for consumes
0237   edm::EDGetTokenT<EBDigiCollection> ECalEBSrc_Token_;
0238   edm::EDGetTokenT<EEDigiCollection> ECalEESrc_Token_;
0239   edm::EDGetTokenT<ESDigiCollection> ECalESSrc_Token_;
0240   edm::EDGetTokenT<edm::PCaloHitContainer> HCalSrc_Token_;
0241   edm::EDGetTokenT<edm::SortedCollection<HBHEDataFrame>> HBHEDigi_Token_;
0242   edm::EDGetTokenT<edm::SortedCollection<HODataFrame>> HODigi_Token_;
0243   edm::EDGetTokenT<edm::SortedCollection<HFDataFrame>> HFDigi_Token_;
0244   edm::EDGetTokenT<edm::DetSetVector<SiStripDigi>> SiStripSrc_Token_;
0245   edm::EDGetTokenT<edm::DetSetVector<PixelDigi>> SiPxlSrc_Token_;
0246   edm::EDGetTokenT<DTDigiCollection> MuDTSrc_Token_;
0247   edm::EDGetTokenT<CSCStripDigiCollection> MuCSCStripSrc_Token_;
0248   edm::EDGetTokenT<CSCWireDigiCollection> MuCSCWireSrc_Token_;
0249   edm::EDGetTokenT<CrossingFrame<PCaloHit>> EBHits_Token_;
0250   edm::EDGetTokenT<CrossingFrame<PCaloHit>> EEHits_Token_;
0251   edm::EDGetTokenT<CrossingFrame<PCaloHit>> ESHits_Token_;
0252 
0253 };  // end class declaration
0254 
0255 #endif
0256 
0257 #ifndef GlobalHitMap
0258 #define GlobalHitMap
0259 
0260 // geometry mapping
0261 static const int dTrk = 1;
0262 static const int sdPxlBrl = 1;
0263 static const int sdPxlFwd = 2;
0264 static const int sdSiTIB = 3;
0265 static const int sdSiTID = 4;
0266 static const int sdSiTOB = 5;
0267 static const int sdSiTEC = 6;
0268 
0269 static const int dMuon = 2;
0270 static const int sdMuonDT = 1;
0271 static const int sdMuonCSC = 2;
0272 static const int sdMuonRPC = 3;
0273 static const int sdMuonRPCRgnBrl = 0;
0274 static const int sdMuonRPCRgnFwdp = 1;
0275 static const int sdMuonRPCRgnFwdn = -1;
0276 
0277 static const int dEcal = 3;
0278 static const int sdEcalBrl = 1;
0279 static const int sdEcalFwd = 2;
0280 static const int sdEcalPS = 3;
0281 static const int sdEcalTT = 4;
0282 static const int sdEcalLPnD = 5;
0283 
0284 static const int dHcal = 4;
0285 static const int sdHcalEmpty = 0;
0286 static const int sdHcalBrl = 1;
0287 static const int sdHcalEC = 2;
0288 static const int sdHcalOut = 3;
0289 static const int sdHcalFwd = 4;
0290 static const int sdHcalTT = 5;
0291 static const int sdHcalCalib = 6;
0292 static const int sdHcalCompst = 7;
0293 
0294 #endif  // PGlobalDigisProducer_h