Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-24 09:52:43

0001 //
0002 // F.Ratnikov (UMd), Jul. 19, 2005
0003 //
0004 #ifndef HcalDbASCIIIO_h
0005 #define HcalDbASCIIIO_h
0006 
0007 #include <iostream>
0008 #include <memory>
0009 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
0010 #include "CondFormats/HcalObjects/interface/AllObjects.h"
0011 #include "CalibFormats/HcalObjects/interface/HcalCalibrationsSet.h"
0012 #include "CalibFormats/HcalObjects/interface/HcalCalibrationWidthsSet.h"
0013 
0014 /**
0015    \class HcalDbASCIIIO
0016    \brief IO for ASCII instances of Hcal Calibrations
0017    \author Fedor Ratnikov Oct. 28, 2005
0018    
0019 Text file formats for different data types is as following:
0020 - # in first column comments the line
0021 - HcalPedestals, HcalGains, HcalGainWidths have identical formats:
0022   eta(int)  phi(int) depth(int) det(HB,HE,HF) cap1_value(float) cap2_value(float) cap3_value(float) cap4_value(float)  HcalDetId(int,optional)
0023 - HcalPedestalWidths:
0024   eta(int)  phi(int) depth(int) det(HB,HE,HF) sigma_1_1(float) sigma_2_1 sigma_2_2 sigma_3_1 sigma_3_2 sigma_3_3 sigma_4_1 sigma_4_2 sigma_4_3 sigma_4_4
0025 - HcalQIEShape:
0026   33 x floats - low edges for first 33 channels of ideal QIE
0027 - HcalQIEData:
0028   eta phi depth det 4x offsets_cap1 4x offsets_cap2 4x offsets_cap3 4x offsets_cap4 4x slopes_cap1 4x slopes_cap2 4x slopes_cap3 4x slopes_cap4
0029 - HcalChannelQuality:
0030   eta phi depth det status(GOOD/BAD/HOT/DEAD)
0031 - HcalElectronicsMap:
0032   line#  crate HTR_slot top_bottom(t/b) dcc# dcc_spigot fiber fiberchan subdet(HB/HE/HF/HO/HT) eta phi depth
0033   line#  crate HTR_slot top_bottom(t/b) dcc# dcc_spigot fiber fiberchan "CBOX" 
0034                                  sector(HBM/HBP/HEM/HEP/HO0/HO1P/HO1M/HO2P/HO2M/HFP/HFM) rbx#(wage) channel
0035   calibration channel type association see HcalCalibDetId.h
0036   if electronics channel is known to be unconnected, either "subdet" or "eta" should be NA
0037 - HcalDcsMap:
0038   line# Ring Slice Subchannel Type Subdetector Eta Phi Depth
0039 - HcalFrontEndMap:
0040   eta(int)  phi(int) depth(int) det(HB,HE,HF) RM# RBX#
0041 - HcalSiPMParameters:
0042  eta phi depth det fcByPE darkCurrent auxi1 auxi2
0043 - HcalSiPMCharacteristics:
0044  type pixels non-linearityParameters(3) auxi1 auxi2 
0045 - HcalTPParameters
0046  HBHE-FGAlgorithm HF-ADCThreshold HF-TDCMask HF-SelfTriggerBits auxi1 auxi2
0047 - HcalTPChannelParameters
0048  eta(int)  phi(int) depth(int) det(HB,HE,HF) Mask FGBitInfo auxi1 auxi2
0049 - HcalCalibrationsSet (dump-only)
0050   eta(int)  phi(int) depth(int) det(HB,HE,HF) cap1_ped(float) cap2_ped(float) cap3_ped(float) cap4_ped(float) cap1_respcorrgain(float) cap2_respcorrgain(float) cap3_respcorrgain(float) cap4_respcorrgain(float) HcalDetId(int,optional)
0051 - HcalCalibrationWidthsSet (dump-only)
0052   eta(int)  phi(int) depth(int) det(HB,HE,HF) cap1_pedw(float) cap2_pedw(float) cap3_pedw(float) cap4_pedw(float) cap1_gainw(float) cap2_gainw(float) cap3_gainw(float) cap4_gainw(float) HcalDetId(int,optional)
0053 */
0054 namespace HcalDbASCIIIO {
0055   //alternate function for creating certain objects
0056   template <class T>
0057   std::unique_ptr<T> createObject(std::istream& fInput) {
0058     assert(0);  //no general case, relies on specializations defined in cc file
0059     return std::make_unique<T>();
0060   }
0061 
0062   bool getObject(std::istream& fInput, HcalPedestals* fObject);
0063   bool dumpObject(std::ostream& fOutput, const HcalPedestals& fObject);
0064   bool getObject(std::istream& fInput, HcalPedestalWidths* fObject);
0065   bool dumpObject(std::ostream& fOutput, const HcalPedestalWidths& fObject);
0066   bool getObject(std::istream& fInput, HcalGains* fObject);
0067   bool dumpObject(std::ostream& fOutput, const HcalGains& fObject);
0068   bool getObject(std::istream& fInput, HcalGainWidths* fObject);
0069   bool dumpObject(std::ostream& fOutput, const HcalGainWidths& fObject);
0070   bool getObject(std::istream& fInput, HcalQIEData* fObject);
0071   bool dumpObject(std::ostream& fOutput, const HcalQIEData& fObject);
0072   bool getObject(std::istream& fInput, HcalCalibrationQIEData* fObject);
0073   bool dumpObject(std::ostream& fOutput, const HcalCalibrationQIEData& fObject);
0074   bool getObject(std::istream& fInput, HcalQIETypes* fObject);
0075   bool dumpObject(std::ostream& fOutput, const HcalQIETypes& fObject);
0076   template <>
0077   std::unique_ptr<HcalElectronicsMap> createObject<HcalElectronicsMap>(std::istream& fInput);
0078   bool dumpObject(std::ostream& fOutput, const HcalElectronicsMap& fObject);
0079   bool getObject(std::istream& fInput, HcalChannelQuality* fObject);
0080   bool dumpObject(std::ostream& fOutput, const HcalChannelQuality& fObject);
0081   bool getObject(std::istream& fInput, HcalRespCorrs* fObject);
0082   bool dumpObject(std::ostream& fOutput, const HcalRespCorrs& fObject);
0083   bool getObject(std::istream& fInput, HcalLUTCorrs* fObject);
0084   bool dumpObject(std::ostream& fOutput, const HcalLUTCorrs& fObject);
0085   bool getObject(std::istream& fInput, HcalPFCorrs* fObject);
0086   bool dumpObject(std::ostream& fOutput, const HcalPFCorrs& fObject);
0087   bool getObject(std::istream& fInput, HcalTimeCorrs* fObject);
0088   bool dumpObject(std::ostream& fOutput, const HcalTimeCorrs& fObject);
0089   bool getObject(std::istream& fInput, HcalZSThresholds* fObject);
0090   bool dumpObject(std::ostream& fOutput, const HcalZSThresholds& fObject);
0091   bool getObject(std::istream& fInput, HcalL1TriggerObjects* fObject);
0092   bool dumpObject(std::ostream& fOutput, const HcalL1TriggerObjects& fObject);
0093   template <>
0094   std::unique_ptr<HcalFrontEndMap> createObject<HcalFrontEndMap>(std::istream& fInput);
0095   bool dumpObject(std::ostream& fOutput, const HcalFrontEndMap& fObject);
0096 
0097   bool getObject(std::istream& fInput, HcalValidationCorrs* fObject);
0098   bool dumpObject(std::ostream& fOutput, const HcalValidationCorrs& fObject);
0099   bool getObject(std::istream& fInput, HcalLutMetadata* fObject);
0100   bool dumpObject(std::ostream& fOutput, const HcalLutMetadata& fObject);
0101   bool getObject(std::istream& fInput, HcalDcsValues* fObject);
0102   bool dumpObject(std::ostream& fOutput, const HcalDcsValues& fObject);
0103   template <>
0104   std::unique_ptr<HcalDcsMap> createObject<HcalDcsMap>(std::istream& fInput);
0105   bool dumpObject(std::ostream& fOutput, const HcalDcsMap& fObject);
0106 
0107   bool getObject(std::istream& fInput, HcalRecoParams* fObject);
0108   bool dumpObject(std::ostream& fOutput, const HcalRecoParams& fObject);
0109   bool getObject(std::istream& fInput, HcalLongRecoParams* fObject);
0110   bool dumpObject(std::ostream& fOutput, const HcalLongRecoParams& fObject);
0111 
0112   bool getObject(std::istream& fInput, HcalZDCLowGainFractions* fObject);
0113   bool dumpObject(std::ostream& fOutput, const HcalZDCLowGainFractions& fObject);
0114 
0115   bool getObject(std::istream& fInput, HcalTimingParams* fObject);
0116   bool dumpObject(std::ostream& fOutput, const HcalTimingParams& fObject);
0117 
0118   bool getObject(std::istream& fInput, HcalMCParams* fObject);
0119   bool dumpObject(std::ostream& fOutput, const HcalMCParams& fObject);
0120 
0121   // Getting/Dumping Hcal Flag information
0122   bool getObject(std::istream& fInput, HcalFlagHFDigiTimeParams* fObject);
0123   bool dumpObject(std::ostream& fOutput, const HcalFlagHFDigiTimeParams& fObject);
0124 
0125   bool getObject(std::istream& fInput, HcalSiPMParameters* fObject);
0126   bool dumpObject(std::ostream& fOutput, const HcalSiPMParameters& fObject);
0127   template <>
0128   std::unique_ptr<HcalSiPMCharacteristics> createObject<HcalSiPMCharacteristics>(std::istream& fInput);
0129   bool dumpObject(std::ostream& fOutput, const HcalSiPMCharacteristics& fObject);
0130 
0131   bool getObject(std::istream& fInput, HcalTPParameters* fObject);
0132   bool dumpObject(std::ostream& fOutput, const HcalTPParameters& fObject);
0133   bool getObject(std::istream& fInput, HcalTPChannelParameters* fObject);
0134   bool dumpObject(std::ostream& fOutput, const HcalTPChannelParameters& fObject);
0135 
0136   bool dumpObject(std::ostream& fOutput, const HcalCalibrationsSet& fObject);
0137   bool dumpObject(std::ostream& fOutput, const HcalCalibrationWidthsSet& fObject);
0138 
0139   DetId getId(const std::vector<std::string>& items);
0140   void dumpId(std::ostream& fOutput, DetId id);
0141   void dumpIdShort(std::ostream& fOutput, DetId id);
0142 }  // namespace HcalDbASCIIIO
0143 #endif