|
||||
File indexing completed on 2024-09-10 02:59:03
0001 #ifndef SimCalorimetry_EcalElectronicsEmulationEcalSimpleProducer_h 0002 #define SimCalorimetry_EcalElectronicsEmulationEcalSimpleProducer_h 0003 0004 #include "FWCore/Framework/interface/one/EDProducer.h" 0005 #include <TFormula.h> 0006 #include <memory> 0007 #include <string> 0008 0009 /** This edm producer generates Ecal Digis (data frames and TPGs) 0010 * according to a given pattern. The pattern is defined 0011 * as function of event id, crystal/TT, and time sample. Only barrel 0012 * is currently supported for the crystal channel data. 0013 * <P>Module parameters (in addition to standard source parameters): 0014 * <UL><LI>string formula: formula of crystal channel time sample encoded ADC 0015 * counts.</LI> 0016 * <LI>string tpFormula: formula of trigger primitives.</LI> 0017 * <LI>untracked bool verbose: verbosity switch</LI> 0018 * </UL> 0019 * The crystal ADC formula is parametrized with the following variables: 0020 * <UL><LI>ieta0: crystal eta index starting from 0 at eta- end of barrel</LI> 0021 * <LI>iphi0: crystal phi index starting at Phi=0deg. in std CMS 0022 * coordinates</LI> <LI>ievt0 event sequence number within the job run starting 0023 * from 0</LI> <LI>isample0 sample time position starting from 0</LI> 0024 * </UL> 0025 * The trigger primitive formula is parametrized with the following variables: 0026 * <UL><LI>ieta0: trigger tower eta index starting from 0 at eta- end of 0027 * barrel</LI> <LI>iphi0: trigger tower index starting at Phi=0deg. in std CMS 0028 * coordinates</LI> <LI>ievt0 event sequence number within the job run starting 0029 * from 0</LI> <LI>isample0 sample time position starting from 0</LI> 0030 * </UL> 0031 * In both formulae 'itt0' shortcut can be used for the trigger tower index 0032 * within the SM starting at 0 from lowest relative eta and lowest phi and 0033 * increasing first with phi then with eta. The syntax for the formula is the 0034 * syntax defined in ROOT <A href=http://root.cern.ch/root/html/TFormula.html> 0035 * TFormula</A> 0036 * 0037 */ 0038 class EcalSimpleProducer : public edm::one::EDProducer<> { 0039 // constructor(s) and destructor(s) 0040 public: 0041 /** Constructs an EcalSimpleProducer 0042 * @param pset CMSSW configuration 0043 * @param sdesc description of this input source 0044 */ 0045 EcalSimpleProducer(const edm::ParameterSet &pset); 0046 0047 /**Destructor 0048 */ 0049 ~EcalSimpleProducer() override {} 0050 0051 /** Called at start of job. 0052 * @param es the event setup 0053 */ 0054 void beginJob() override {} 0055 0056 /** The main method. It produces the event. 0057 * @param evt [out] produced event. 0058 */ 0059 void produce(edm::Event &evt, const edm::EventSetup &) override; 0060 0061 // method(s) 0062 public: 0063 private: 0064 /** Help function to replace a pattern within a string. Every occurance 0065 * of the pattern is replaced. An exact match is performed: no wild card. 0066 * @param s string to operate on 0067 * @param pattern to replace. 0068 * @param string to substitute to the pattern 0069 */ 0070 void replaceAll(std::string &s, const std::string &from, const std::string &to) const; 0071 0072 /** Converts c-array index (contiguous integer starting from 0) to 0073 * std CMSSW ECAL crystal eta index. 0074 * @param iEta0 c-array index. '0' postfix reminds the index starts from 0 0075 * @return std CMSSW ECAL crystal index. 0076 */ 0077 int cIndex2iEta(int iEta0) const { return (iEta0 < 85) ? iEta0 - 85 : iEta0 - 84; } 0078 0079 /** Converts c-array index (contiguous integer starting from 0) to 0080 * std CMSSW ECAL crystal phi index. 0081 * @param iPhi0 c-array index. '0' postfix reminds the index starts from 0 0082 * @return std CMSSW ECAL crystal index. 0083 */ 0084 int cIndex2iPhi(int iPhi0) const { return (iPhi0 + 10) % 360 + 1; } 0085 0086 /** Converts c-array index (contiguous integer starting from 0) to 0087 * std CMSSW ECAL trigger tower eta index. 0088 * @param iEta0 c-array index. '0' postfix reminds the index starts from 0 0089 * @return std CMSSW ECAL trigger tower index. 0090 */ 0091 int cIndex2iTtEta(int iEta0) const { return (iEta0 < 28) ? iEta0 - 28 : iEta0 - 27; } 0092 0093 /** Converts c-array index (contiguous integer starting from 0) to 0094 * std CMSSW ECAL trigger tower phi index. 0095 * @param iPhi0 c-array index. '0' postfix reminds the index starts from 0 0096 * @return std CMSSW ECAL trigger tower index. 0097 */ 0098 int cIndex2iTtPhi(int iPhi0) const { return iPhi0 + 1; } 0099 0100 // attribute(s) 0101 protected: 0102 private: 0103 /** Formula defining the data frame samples 0104 */ 0105 std::unique_ptr<TFormula> formula_; 0106 0107 /** Formula defining the trigger primitives 0108 */ 0109 std::unique_ptr<TFormula> tpFormula_; 0110 0111 /** Formula defining the sim hits 0112 */ 0113 std::unique_ptr<TFormula> simHitFormula_; 0114 0115 /** Verbosity switch 0116 */ 0117 bool verbose_; 0118 }; 0119 0120 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.2.1 LXR engine. The LXR team |