Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-30 22:37:55

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 - HcalPFCuts:
0024   eta(int)  phi(int) depth(int) det(HB,HE,HF) noiseThreshold(float) seedThreshold(float)
0025 - HcalPedestalWidths:
0026   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
0027 - HcalQIEShape:
0028   33 x floats - low edges for first 33 channels of ideal QIE
0029 - HcalQIEData:
0030   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
0031 - HcalChannelQuality:
0032   eta phi depth det status(GOOD/BAD/HOT/DEAD)
0033 - HcalElectronicsMap:
0034   line#  crate HTR_slot top_bottom(t/b) dcc# dcc_spigot fiber fiberchan subdet(HB/HE/HF/HO/HT) eta phi depth
0035   line#  crate HTR_slot top_bottom(t/b) dcc# dcc_spigot fiber fiberchan "CBOX" 
0036                                  sector(HBM/HBP/HEM/HEP/HO0/HO1P/HO1M/HO2P/HO2M/HFP/HFM) rbx#(wage) channel
0037   calibration channel type association see HcalCalibDetId.h
0038   if electronics channel is known to be unconnected, either "subdet" or "eta" should be NA
0039 - HcalDcsMap:
0040   line# Ring Slice Subchannel Type Subdetector Eta Phi Depth
0041 - HcalFrontEndMap:
0042   eta(int)  phi(int) depth(int) det(HB,HE,HF) RM# RBX#
0043 - HcalSiPMParameters:
0044  eta phi depth det fcByPE darkCurrent auxi1 auxi2
0045 - HcalSiPMCharacteristics:
0046  type pixels non-linearityParameters(3) auxi1 auxi2 
0047 - HcalTPParameters
0048  HBHE-FGAlgorithm HF-ADCThreshold HF-TDCMask HF-SelfTriggerBits auxi1 auxi2
0049 - HcalTPChannelParameters
0050  eta(int)  phi(int) depth(int) det(HB,HE,HF) Mask FGBitInfo auxi1 auxi2
0051 - HcalCalibrationsSet (dump-only)
0052   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)
0053 - HcalCalibrationWidthsSet (dump-only)
0054   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)
0055 */
0056 namespace HcalDbASCIIIO {
0057   //alternate function for creating certain objects
0058   template <class T>
0059   std::unique_ptr<T> createObject(std::istream& fInput) {
0060     assert(0);  //no general case, relies on specializations defined in cc file
0061     return std::make_unique<T>();
0062   }
0063 
0064   bool getObject(std::istream& fInput, HcalPedestals* fObject);
0065   bool dumpObject(std::ostream& fOutput, const HcalPedestals& fObject);
0066   bool getObject(std::istream& fInput, HcalPedestalWidths* fObject);
0067   bool dumpObject(std::ostream& fOutput, const HcalPedestalWidths& fObject);
0068   bool getObject(std::istream& fInput, HcalGains* fObject);
0069   bool dumpObject(std::ostream& fOutput, const HcalGains& fObject);
0070   bool getObject(std::istream& fInput, HcalGainWidths* fObject);
0071   bool dumpObject(std::ostream& fOutput, const HcalGainWidths& fObject);
0072   bool getObject(std::istream& fInput, HcalPFCuts* fObject);
0073   bool dumpObject(std::ostream& fOutput, const HcalPFCuts& fObject);
0074   bool getObject(std::istream& fInput, HcalQIEData* fObject);
0075   bool dumpObject(std::ostream& fOutput, const HcalQIEData& fObject);
0076   bool getObject(std::istream& fInput, HcalCalibrationQIEData* fObject);
0077   bool dumpObject(std::ostream& fOutput, const HcalCalibrationQIEData& fObject);
0078   bool getObject(std::istream& fInput, HcalQIETypes* fObject);
0079   bool dumpObject(std::ostream& fOutput, const HcalQIETypes& fObject);
0080   template <>
0081   std::unique_ptr<HcalElectronicsMap> createObject<HcalElectronicsMap>(std::istream& fInput);
0082   bool dumpObject(std::ostream& fOutput, const HcalElectronicsMap& fObject);
0083   bool getObject(std::istream& fInput, HcalChannelQuality* fObject);
0084   bool dumpObject(std::ostream& fOutput, const HcalChannelQuality& fObject);
0085   bool getObject(std::istream& fInput, HcalRespCorrs* fObject);
0086   bool dumpObject(std::ostream& fOutput, const HcalRespCorrs& fObject);
0087   bool getObject(std::istream& fInput, HcalLUTCorrs* fObject);
0088   bool dumpObject(std::ostream& fOutput, const HcalLUTCorrs& fObject);
0089   bool getObject(std::istream& fInput, HcalPFCorrs* fObject);
0090   bool dumpObject(std::ostream& fOutput, const HcalPFCorrs& fObject);
0091   bool getObject(std::istream& fInput, HcalTimeCorrs* fObject);
0092   bool dumpObject(std::ostream& fOutput, const HcalTimeCorrs& fObject);
0093   bool getObject(std::istream& fInput, HcalZSThresholds* fObject);
0094   bool dumpObject(std::ostream& fOutput, const HcalZSThresholds& fObject);
0095   bool getObject(std::istream& fInput, HcalL1TriggerObjects* fObject);
0096   bool dumpObject(std::ostream& fOutput, const HcalL1TriggerObjects& fObject);
0097   template <>
0098   std::unique_ptr<HcalFrontEndMap> createObject<HcalFrontEndMap>(std::istream& fInput);
0099   bool dumpObject(std::ostream& fOutput, const HcalFrontEndMap& fObject);
0100 
0101   bool getObject(std::istream& fInput, HcalValidationCorrs* fObject);
0102   bool dumpObject(std::ostream& fOutput, const HcalValidationCorrs& fObject);
0103   bool getObject(std::istream& fInput, HcalLutMetadata* fObject);
0104   bool dumpObject(std::ostream& fOutput, const HcalLutMetadata& fObject);
0105   bool getObject(std::istream& fInput, HcalDcsValues* fObject);
0106   bool dumpObject(std::ostream& fOutput, const HcalDcsValues& fObject);
0107   template <>
0108   std::unique_ptr<HcalDcsMap> createObject<HcalDcsMap>(std::istream& fInput);
0109   bool dumpObject(std::ostream& fOutput, const HcalDcsMap& fObject);
0110 
0111   bool getObject(std::istream& fInput, HcalRecoParams* fObject);
0112   bool dumpObject(std::ostream& fOutput, const HcalRecoParams& fObject);
0113   bool getObject(std::istream& fInput, HcalLongRecoParams* fObject);
0114   bool dumpObject(std::ostream& fOutput, const HcalLongRecoParams& fObject);
0115 
0116   bool getObject(std::istream& fInput, HcalZDCLowGainFractions* fObject);
0117   bool dumpObject(std::ostream& fOutput, const HcalZDCLowGainFractions& fObject);
0118 
0119   bool getObject(std::istream& fInput, HcalTimingParams* fObject);
0120   bool dumpObject(std::ostream& fOutput, const HcalTimingParams& fObject);
0121 
0122   bool getObject(std::istream& fInput, HcalMCParams* fObject);
0123   bool dumpObject(std::ostream& fOutput, const HcalMCParams& fObject);
0124 
0125   // Getting/Dumping Hcal Flag information
0126   bool getObject(std::istream& fInput, HcalFlagHFDigiTimeParams* fObject);
0127   bool dumpObject(std::ostream& fOutput, const HcalFlagHFDigiTimeParams& fObject);
0128 
0129   bool getObject(std::istream& fInput, HcalSiPMParameters* fObject);
0130   bool dumpObject(std::ostream& fOutput, const HcalSiPMParameters& fObject);
0131   template <>
0132   std::unique_ptr<HcalSiPMCharacteristics> createObject<HcalSiPMCharacteristics>(std::istream& fInput);
0133   bool dumpObject(std::ostream& fOutput, const HcalSiPMCharacteristics& fObject);
0134 
0135   bool getObject(std::istream& fInput, HcalTPParameters* fObject);
0136   bool dumpObject(std::ostream& fOutput, const HcalTPParameters& fObject);
0137   bool getObject(std::istream& fInput, HcalTPChannelParameters* fObject);
0138   bool dumpObject(std::ostream& fOutput, const HcalTPChannelParameters& fObject);
0139 
0140   bool dumpObject(std::ostream& fOutput, const HcalCalibrationsSet& fObject);
0141   bool dumpObject(std::ostream& fOutput, const HcalCalibrationWidthsSet& fObject);
0142 
0143   DetId getId(const std::vector<std::string>& items);
0144   void dumpId(std::ostream& fOutput, DetId id);
0145   void dumpIdShort(std::ostream& fOutput, DetId id);
0146 }  // namespace HcalDbASCIIIO
0147 #endif