CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/CondFormats/EcalObjects/src/EcalSRSettings.cc

Go to the documentation of this file.
00001 #include "CondFormats/EcalObjects/interface/EcalSRSettings.h"
00002 #include "FWCore/Utilities/interface/Exception.h"
00003 
00004 #include <sstream>
00005 #include <iostream>
00006 #include <stdlib.h>
00007 #include <cassert>
00008 #include <algorithm>
00009 
00010 using namespace std;
00011 
00012 EcalSRSettings::EcalSRSettings():
00013   ebDccAdcToGeV_(0.),
00014   eeDccAdcToGeV_(0.),
00015   bxGlobalOffset_(0),
00016   automaticMasks_(0),
00017   automaticSrpSelect_(0)
00018 {}
00019 
00020 
00021 #define SR_PRINT(a) o << #a ": " << val.a ## _ << "\n";
00022 #define SR_VPRINT(a) o << #a ; \
00023   if(val.a ## _.size()) o << "[0.." << (val.a ## _.size() - 1) << "]:"; \
00024   else o << "[]: <empty>"; \
00025   for(size_t i = 0; i < val.a ## _.size(); ++i) o << "\t" << val.a ## _[i]; \
00026   o << "\n";
00027 #define SR_VVPRINT(a) \
00028   if(val.a ## _.size() == 0) o << #a "[][]: <empty>\n"; \
00029   for(size_t i = 0; i < val.a ## _.size(); ++i){ \
00030     o << #a "[" << i << "]"; \
00031     if(val.a ## _.size()) o << "[0.." << (val.a ## _[i].size() -1 ) << "]:"; \
00032     else o << "[]: <empty>"; \
00033     for(size_t j = 0; j < val.a ## _[i].size(); ++j) o << "\t" << val.a ## _[i][j]; \
00034     o << "\n";                                                          \
00035   }
00036 
00037 std::ostream& operator<< (std::ostream& o, const EcalSRSettings& val){
00038   o << "# Neighbour eta range, neighborhood: (2*deltaEta+1)*(2*deltaPhi+1)\n"
00039     "# In the vector contains:\n"
00040     "#   - 1 element, then value applies to whole ECAL\n"
00041     "#   - 2 elements, then element 0 applies to EB, element 1 to EE\n"
00042     "#   - 12 elements, then element i applied to SRP (i+1)\n"
00043     "# SRP emulation (see SimCalorimetry/EcalSelectiveReadoutProcuders) supports\n"
00044     "# only 1 element mode.\n";
00045   SR_VPRINT(deltaEta);
00046     
00047   o << "\n# Neighbouring eta range, neighborhood: (2*deltaEta+1)*(2*deltaPhi+1)\n"
00048     "# If the vector contains...\n"
00049     "#   ... 1 element, then value applies to whole ECAL\n"
00050     "#   ... 2 elements, then element 0 applies to EB, element 1 to EE\n"
00051     "#   ... 12 elements, then element i applied to SRP (i+1)\n"
00052     "# If the vector contains...\n"
00053     "#   ... 1 element, then value applies to whole ECAL\n"
00054     "#   ... 2 elements, then element 0 applies to EB, element 1 to EE\n"
00055     "#   ... 12 elements, then element i applied to SRP (i+1)\n"
00056     "# SRP emulation (see SimCalorimetry/EcalSelectiveReadoutProcuders) supports\n"
00057     "# only the single-element mode.\n";
00058   SR_VPRINT(deltaPhi);
00059     
00060   o << "\n# Index of time sample (staring from 1) the first DCC weights is implied\n"
00061     "# If the vector contains:\n"
00062     "#   ... 1 element, then value applies to whole ECAL\n"
00063     "#   ... 2 elements, then element 0 applies to EB, element 1 to EE\n"
00064     "#   ... 54 elements, then element i applied to DCC (i+1) (FED ID 651+i)\n"
00065     "# SRP emulation (see SimCalorimetry/EcalSelectiveReadoutProcuders) supports\n"
00066     "# only the single-element mode.\n";
00067   SR_VPRINT(ecalDccZs1stSample);
00068 
00069   o << "\n# ADC to GeV conversion factor used in ZS filter for EB\n";
00070   SR_PRINT(ebDccAdcToGeV);
00071   
00072   o << "\n# ADC to GeV conversion factor used in ZS filter for EE\n";
00073   SR_PRINT(eeDccAdcToGeV);
00074 
00075   o << "\n# DCC ZS FIR weights: weights are rounded in such way that in Hw\n"
00076     "# representation (weigth*1024 rounded to nearest integer) the sum is null:\n"
00077     "# Each element is a vector of 6 values, the 6 weights\n"
00078     "# If the vector contains...\n"
00079     "#   ... 1 element, then the weight set applies to whole ECAL\n"
00080     "#   ... 2 elements, then element 0 applies to EB, element 1 to EE\n"
00081     "#   ... 54 elements, then element i applied to DCC (i+1) (FED ID 651+i)\n";
00082   SR_VVPRINT(dccNormalizedWeights);
00083   
00084   o << "\n# Switch to use a symetric zero suppression (cut on absolute value). For\n"
00085     "# studies only, for time being it is not supported by the hardware.\n"
00086     "# having troubles for vector<bool> with coral (3.8.0pre1), using vector<int> instead,\n"
00087     "# 0 means false, a value different than 0 means true.\n"
00088     "# If the vector contains...\n"
00089     "#   ... 1 element, then the weight set applies to whole ECAL\n"
00090     "#   ... 2 elements, then element 0 applies to EB, element 1 to EE\n"
00091     "#   ... 54 elements, then element i applied to DCC (i+1) (FED ID 651+i)\n"
00092     "#   ... 75848 elements, then:\n"
00093     "#          for i < 61200, element i applies to EB crystal with denseIndex i\n"
00094     "#                         (see EBDetId::denseIndex())\n"
00095     "#          for i >= 61200, element i applies to EE crystal with denseIndex (i+61200)\n"
00096     "#                         (see EBDetId::denseIndex())\n"
00097     "# SRP emulation supports only 1 element mode. Hardware does not support\n"
00098     "# the symetric ZS, so symetricZS = 0 for real data.\n";
00099   SR_VPRINT(symetricZS);
00100 
00101   o << "\n# ZS energy threshold in GeV to apply to low interest channels of barrel\n"
00102     "# If the vector contains...\n"
00103     "#   ... 1 element, then the weight set applies to whole ECAL\n"
00104     "#   ... 2 elements, then element 0 applies to EB, element 1 to EE\n"
00105     "#   ... 54 elements, then element i applied to DCC (i+1) (FED ID 651+i)\n"
00106     "# SRP emulation supports only the 2-element mode.\n"
00107     "# Corresponds to srpBarrelLowInterestChannelZS and srpEndcapLowInterestChannelZS\n"
00108     "# of python configuration file parameters\n";
00109   SR_VPRINT(srpLowInterestChannelZS);
00110     
00111   o << "\n# ZS energy threshold in GeV to apply to high interest channels of endcap\n"
00112     "# If the vector contains...\n"
00113     "#   ... 1 element, then the weight set applies to whole ECAL\n"
00114     "#   ... 2 elements, then element 0 applies to EB, element 1 to EE\n"
00115     "#   ... 54 elements, then element i applied to DCC (i+1) (FED ID 651+i)\n"
00116     "# SRP emulation supports only the 2-element mode.\n"
00117     "# Corresponds to srpBarrelLowInterestChannelZS and srpEndcapLowInterestChannelZS\n"
00118     "# of python configuration file parameters\n";
00119   SR_VPRINT(srpHighInterestChannelZS);
00120   
00121   //  o << "\n# Switch to run w/o trigger primitive. For debug use only\n"
00122   //  "# having troubles for vector<bool> with coral (3.8.0pre1), using vector<int> instead\n"
00123   //  "# Parameter only relevant for emulation. For real data, must be contains 1 element with\n"
00124   //  "# value 0.\n"
00125   //  "#   ... 1 element, then the weight set applies to whole ECAL\n"
00126   //  "#   ... 2 elements, then element 0 applies to EB, element 1 to EE\n"
00127   //  "#   ... 54 elements, then element i applied to DCC (i+1) (FED ID 651+i)\n"
00128   //  "# SRP emulation supports only the single-element mode.\n";
00129   //  SR_VPRINT(trigPrimBypass);\n"
00130   //  
00131   //  o << "\n# Mode selection for "# Trig bypass" mode\n"
00132   //  "# 0: TT thresholds applied on sum of crystal Et's\n"
00133   //  "# 1: TT thresholds applies on compressed Et from Trigger primitive\n"
00134   //  "# @see trigPrimByPass switch\n"
00135   //  "# Parameter only relevant for \n";
00136   //  SR_VPRINT(trigPrimBypassMode);
00137   // 
00138   //  o << "\n# for debug mode only:\n";
00139   //  SR_VPRINT( trigPrimBypassLTH);
00140   //
00141   //  o << "\n# for debug mode only:\n";
00142   //  SR_VPRINT(trigPrimBypassHTH);
00143   //
00144   //  o << "\n# for debug mode only\n"
00145   //  "# having troubles for vector<bool> with coral (3.8.0pre1), using vector<int> instead\n";
00146   //  SR_VPRINT( trigPrimBypassWithPeakFinder);
00147   //
00148   //  o << "\n# Trigger Tower Flag to use when a flag is not found from the input\n"
00149   //  "# Trigger Primitive collection. Must be one of the following values:\n"
00150   //  "# 0: low interest, 1: mid interest, 3: high interest\n"
00151   //  "# 4: forced low interest, 5: forced mid interest, 7: forced high interest\n";
00152   //  SR_VPRINT(defaultTtf);\n"
00153 
00154   o << "\n# SR->action flag map. 4 elements\n"
00155     "# action_[i]: action for flag value i\n";
00156   SR_VPRINT(actions);
00157 
00158   o << "\n# Masks for TTC inputs of SRP cards\n"
00159     "# One element per TCC, that is 108 elements: element i applies to TCC (i+1)\n";
00160   SR_VPRINT(tccMasksFromConfig);
00161 
00162   o << "\n# Masks for SRP-SRP inputs of SRP cards\n"
00163     "# One element per SRP, that is 12 elements: element i applies to SRP (i+1)\n"
00164     "# indices: [iSrp][iCh]\n";
00165   SR_VVPRINT(srpMasksFromConfig);
00166 
00167   o << "\n# Masks for DCC output of SRP cards\n"
00168     "# One element per DCC, that is 54 elements: element i applies to DCC (i+1)\n";
00169   SR_VPRINT(dccMasks);
00170 
00171   o << "\n# Mask to enable pattern test. Typical value: 0.\n"
00172     "# One element per SRP, that is 12 elements: element i applies to SRP (i+1)\n";
00173   SR_VPRINT(srfMasks);
00174 
00175   o << "\n# Substitution flags used in patterm mode\n"
00176     "# indices: [iSrp][iFlag]\n";
00177   SR_VVPRINT(substitutionSrfs);
00178   
00179   o << "\n# Tester mode configuration\n";
00180   SR_VPRINT(testerTccEmuSrpIds);
00181   SR_VPRINT(testerSrpEmuSrpIds);
00182   SR_VPRINT(testerDccTestSrpIds);
00183   SR_VPRINT(testerSrpTestSrpIds);
00185   
00186   o << "\n# Per SRP card bunch crossing counter offset.\n"
00187     "# This offset is added to the bxGlobalOffset\n";
00188   SR_VPRINT(bxOffsets);
00189 
00190   o << "\n# SRP system bunch crossing counter offset.\n"
00191     "# For each card the bxOffset[i]\n"
00192     "# is added to this one.\n";
00193   SR_PRINT(bxGlobalOffset);
00194 
00195   o << "\n# Switch for automatic channel masking. 0: disabled; 1: enabled. Standard  configuration: 1.\n"
00196     "# When enabled, if a FED is excluded from the run, the corresponding TCC inputs is automatically\n"
00197     "# masked (overwrites the tccInputMasks).\n";
00198   SR_PRINT(automaticMasks);
00199   
00200   o << "\n# Switch for automatic SRP card selection. 0: disabled; 1 : enabled..\n"
00201     "# When enabled, if all the FEDs corresponding to a given SRP is excluded from the run,\n"
00202     "# Then the corresponding SRP card is automatically excluded.\n";
00203   SR_PRINT(automaticSrpSelect);
00204 
00205   return o;
00206 }