CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
EcalDccWeightBuilder Class Reference

#include <EcalDccWeightBuilder.h>

Inheritance diagram for EcalDccWeightBuilder:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &es) override
 
 EcalDccWeightBuilder (edm::ParameterSet const &ps)
 
 ~EcalDccWeightBuilder () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

enum  mode_t { WEIGHTS_FROM_CONFIG, COMPUTE_WEIGHTS }
 

Private Member Functions

void computeAllWeights (bool withIntercalib, const edm::EventSetup &es)
 
void computeWeights (const EcalShapeBase &shape, int binOfMax, double timePhase, int iFirst0, int nWeights, int iSkip0, std::vector< double > &result)
 
void dbId (const DetId &detId, int &fedId, int &smId, int &ruId, int &xtalId) const
 
double decodeWeight (int W)
 
int encodeWeight (double w)
 
double intercalib (const DetId &detId)
 
template<class T >
void sort (const std::vector< T > &a, std::vector< int > &s, bool decreasingOrder=false)
 
void unbiasWeights (std::vector< double > &weights, std::vector< int32_t > *encodedWeigths)
 
void writeWeightToAsciiFile ()
 
void writeWeightToDB ()
 
void writeWeightToRootFile ()
 

Private Attributes

std::string asciiOutputFileName_
 
EcalIntercalibConstantMapcalibMap_
 
std::string dbPassword_
 
std::string dbSid_
 
std::string dbTag_
 
std::string dbUser_
 
int dbVersion_
 
int dcc1stSample_
 
bool dccWeightsWithIntercalib_
 
const EcalElectronicsMappingecalElectronicsMap_
 
EcalIntercalibConstantMap emptyCalibMap_
 
std::map< DetId, std::vector< int > > encodedWeights_
 
edm::ESHandle< CaloGeometrygeom_
 
mode_t imode_
 
std::vector< double > inputWeights_
 
std::string mode_
 
int nDccWeights_
 
std::string rootOutputFileName_
 
int sampleToSkip_
 
bool sqlMode_
 
bool writeToAsciiFile_
 
bool writeToDB_
 
bool writeToRootFile_
 

Static Private Attributes

static const int ecalDccFedIdMax = 654
 
static const int ecalDccFedIdMin = 601
 
static const int nDccs = ecalDccFedIdMax - ecalDccFedIdMin + 1
 
static const double weightScale_ = 1024.
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 26 of file EcalDccWeightBuilder.h.

Member Enumeration Documentation

◆ mode_t

Enumerator
WEIGHTS_FROM_CONFIG 
COMPUTE_WEIGHTS 

Definition at line 28 of file EcalDccWeightBuilder.h.

Constructor & Destructor Documentation

◆ EcalDccWeightBuilder()

EcalDccWeightBuilder::EcalDccWeightBuilder ( edm::ParameterSet const &  ps)

Constructs an EcalDccWeightBuilder

Parameters
psCMSSW mondule configuration

Definition at line 44 of file EcalDccWeightBuilder.cc.

45  : dcc1stSample_(ps.getParameter<int>("dcc1stSample")),
46  sampleToSkip_(ps.getParameter<int>("sampleToSkip")),
47  nDccWeights_(ps.getParameter<int>("nDccWeights")),
48  inputWeights_(ps.getParameter<vector<double> >("inputWeights")),
49  mode_(ps.getParameter<string>("mode")),
50  dccWeightsWithIntercalib_(ps.getParameter<bool>("dccWeightsWithIntercalib")),
51  writeToDB_(ps.getParameter<bool>("writeToDB")),
52  writeToAsciiFile_(ps.getParameter<bool>("writeToAsciiFile")),
53  writeToRootFile_(ps.getParameter<bool>("writeToRootFile")),
54  asciiOutputFileName_(ps.getParameter<string>("asciiOutputFileName")),
55  rootOutputFileName_(ps.getParameter<string>("rootOutputFileName")),
56  dbSid_(ps.getParameter<string>("dbSid")),
57  dbUser_(ps.getParameter<string>("dbUser")),
58  dbPassword_(ps.getUntrackedParameter<string>("dbPassword", "")),
59  dbTag_(ps.getParameter<string>("dbTag")),
60  dbVersion_(ps.getParameter<int>("dbVersion")),
61  sqlMode_(ps.getParameter<bool>("sqlMode")),
63  if (mode_ == "weightsFromConfig") {
65  if (inputWeights_.size() != (unsigned)nDccWeights_) {
66  throw cms::Exception("Config") << "Inconsistent configuration. 'nDccWeights' parameters indicated "
67  << nDccWeights_ << " weights while parameter 'inputWeights_' contains "
68  << inputWeights_.size() << " weight values!\n";
69  }
70  } else if (mode_ == "computeWeights") {
72  } else {
73  throw cms::Exception("Config") << "Invalid value ('" << mode_ << "') for parameter mode. "
74  << "Valid values are: 'weightsFromConfig' and 'computeWeights'\n";
75  }
76 }

References COMPUTE_WEIGHTS, Exception, imode_, inputWeights_, mode_, nDccWeights_, and WEIGHTS_FROM_CONFIG.

◆ ~EcalDccWeightBuilder()

EcalDccWeightBuilder::~EcalDccWeightBuilder ( )
inlineoverride

Destructor

Definition at line 39 of file EcalDccWeightBuilder.h.

39 {};

Member Function Documentation

◆ analyze()

void EcalDccWeightBuilder::analyze ( const edm::Event event,
const edm::EventSetup es 
)
overridevirtual

Analyze method called by the event loop.

Parameters
eventCMSSW event
esevent setup

Implements edm::EDAnalyzer.

Definition at line 78 of file EcalDccWeightBuilder.cc.

78  {
81  ecalElectronicsMap_ = handle.product();
82 
83  // Retrieval of intercalib constants
86  es.get<EcalIntercalibConstantsRcd>().get(hIntercalib);
87  const EcalIntercalibConstants* intercalib = hIntercalib.product();
88  calibMap_ = intercalib->getMap();
89  }
90 
91  //gets geometry
93 
94  //computes the weights:
96 
97  //Writing out weights.
100  if (writeToRootFile_)
102  if (writeToDB_)
103  writeWeightToDB();
104 }

References calibMap_, computeAllWeights(), dccWeightsWithIntercalib_, ecalElectronicsMap_, geom_, edm::EventSetup::get(), get, patZpeak::handle, intercalib(), edm::ESHandle< T >::product(), writeToAsciiFile_, writeToDB_, writeToRootFile_, writeWeightToAsciiFile(), writeWeightToDB(), and writeWeightToRootFile().

◆ computeAllWeights()

void EcalDccWeightBuilder::computeAllWeights ( bool  withIntercalib,
const edm::EventSetup es 
)
private

Definition at line 106 of file EcalDccWeightBuilder.cc.

106  {
107  const int nw = nDccWeights_;
108  int iSkip0_ = sampleToSkip_ >= 0 ? (sampleToSkip_ - dcc1stSample_) : -1;
109 
110  EcalSimParameterMap parameterMap;
111  const vector<DetId>& ebDetIds = geom_->getValidDetIds(DetId::Ecal, EcalBarrel);
112 
113  // cout << __FILE__ << ":" << __LINE__ << ": "
114  // << "Number of EB det IDs: " << ebDetIds.size() << "\n";
115 
116  const vector<DetId>& eeDetIds = geom_->getValidDetIds(DetId::Ecal, EcalEndcap);
117 
118  // cout << __FILE__ << ":" << __LINE__ << ": "
119  // << "Number of EE det IDs: " << eeDetIds.size() << "\n";
120 
121  vector<DetId> detIds(ebDetIds.size() + eeDetIds.size());
122  copy(ebDetIds.begin(), ebDetIds.end(), detIds.begin());
123  copy(eeDetIds.begin(), eeDetIds.end(), detIds.begin() + ebDetIds.size());
124 
125  vector<double> baseWeights(nw); //weight obtained from signal shape
126  vector<double> w(nw); //weight*intercalib
127  vector<int> W(nw); //weight in hw encoding (integrer)
128  double prevPhase = numeric_limits<double>::min();
129 
130  if (imode_ == WEIGHTS_FROM_CONFIG) {
131  assert(inputWeights_.size() == baseWeights.size());
132  copy(inputWeights_.begin(), inputWeights_.end(), baseWeights.begin());
133  }
134 
135  for (vector<DetId>::const_iterator it = detIds.begin(); it != detIds.end(); ++it) {
136  double phase = parameterMap.simParameters(*it).timePhase();
137  int binOfMax = parameterMap.simParameters(*it).binOfMaximum();
138 
139 #if 0
140  //for debugging...
141  cout << __FILE__ << ":" << __LINE__ << ": ";
142  if(it->subdetId()==EcalBarrel){
143  cout << "ieta = " << setw(4) << ((EBDetId)(*it)).ieta()
144  << " iphi = " << setw(4) << ((EBDetId)(*it)).iphi() << " ";
145  } else if(it->subdetId()==EcalEndcap){
146  cout << "ix = " << setw(3) << ((EEDetId)(*it)).ix()
147  << " iy = " << setw(3) << ((EEDetId)(*it)).iy()
148  << " iz = " << setw(1) << ((EEDetId)(*it)).iy() << " ";
149  } else{
150  throw cms::Exception("EcalDccWeightBuilder")
151  << "Bug found in " << __FILE__ << ":" << __LINE__ << ": "
152  << "Got a detId which is neither tagged as ECAL Barrel "
153  << "not ECAL endcap while looping on ECAL cell detIds\n";
154  }
155  cout << " -> phase: " << phase << "\n";
156  cout << " -> binOfMax: " << binOfMax << "\n";
157 #endif
158 
159  try {
160  bool useDBShape = true;
161  EBShape ebShape(useDBShape);
162  EEShape eeShape(useDBShape);
163  EcalShapeBase* pShape;
164 
165  if (it->subdetId() == EcalBarrel) {
166  pShape = &ebShape;
167  } else if (it->subdetId() == EcalEndcap) {
168  pShape = &eeShape;
169  } else {
170  throw cms::Exception("EcalDccWeightBuilder") << "Bug found in " << __FILE__ << ":" << __LINE__ << ": "
171  << "Got a detId which is neither tagged as ECAL Barrel "
172  << "not ECAL endcap while looping on ECAL cell detIds\n";
173  }
174 
175  if (phase != prevPhase) {
176  if (imode_ == COMPUTE_WEIGHTS) {
177  if (it->subdetId() == EcalBarrel) {
178  computeWeights(*pShape, binOfMax, phase, dcc1stSample_ - 1, nDccWeights_, iSkip0_, baseWeights);
179  }
180  prevPhase = phase;
181  }
182  }
183  for (int i = 0; i < nw; ++i) {
184  w[i] = baseWeights[i];
185  if (withIntercalib)
186  w[i] *= intercalib(*it);
187  }
188  unbiasWeights(w, &W);
189  encodedWeights_[*it] = W;
190  } catch (std::exception& e) {
191  cout << __FILE__ << ":" << __LINE__ << ": ";
192  if (it->subdetId() == EcalBarrel) {
193  cout << "ieta = " << setw(4) << ((EBDetId)(*it)).ieta() << " iphi = " << setw(4) << ((EBDetId)(*it)).iphi()
194  << " ";
195  } else if (it->subdetId() == EcalEndcap) {
196  cout << "ix = " << setw(3) << ((EEDetId)(*it)).ix() << " iy = " << setw(3) << ((EEDetId)(*it)).iy()
197  << " iz = " << setw(1) << ((EEDetId)(*it)).iy() << " ";
198  } else {
199  cout << "DetId " << (uint32_t)(*it);
200  }
201  cout << "phase: " << phase << "\n";
202  throw;
203  }
204  }
205 }

References cms::cuda::assert(), CaloSimParameters::binOfMaximum(), COMPUTE_WEIGHTS, computeWeights(), filterCSVwithJSON::copy, gather_cfg::cout, dcc1stSample_, MillePedeFileConverter_cfg::e, DetId::Ecal, EcalBarrel, EcalEndcap, encodedWeights_, cppFunctionSkipper::exception, Exception, geom_, CaloGeometry::getValidDetIds(), mps_fire::i, LEDCalibrationChannels::ieta, imode_, inputWeights_, intercalib(), LEDCalibrationChannels::iphi, min(), nDccWeights_, sampleToSkip_, EcalSimParameterMap::simParameters(), CaloSimParameters::timePhase(), unbiasWeights(), w, and WEIGHTS_FROM_CONFIG.

Referenced by analyze().

◆ computeWeights()

void EcalDccWeightBuilder::computeWeights ( const EcalShapeBase shape,
int  binOfMax,
double  timePhase,
int  iFirst0,
int  nWeights,
int  iSkip0,
std::vector< double > &  result 
)
private

Weight computation

Parameters
shapesignal shape to use for weight computation
binOfMaxtime bin which shall contain the pulse peak
timePhasesignal phase. First sample corresponds to t = ((binOfMax-1)*25+timePhase) ns in the time reference of EcalShapeBase.
iFirstfirst sample the weights must be applied to
nWeightsnumber of weights
iSkip0if greater than 0, the corresponding sample will not be used (weights forced to 0).
result[out] vector filled with computed weights. The vector is resized to the number of weights

Definition at line 207 of file EcalDccWeightBuilder.cc.

213  {
214  double sum2 = 0.;
215  double sum = 0;
216  result.resize(nWeights);
217 
218  int nActualWeights = 0;
219 
220  const double tzero = -(binOfMax - 1) * 25 + timePhase + shape.timeToRise(); //ns
221 
222  for (int i = 0; i < nWeights; ++i) {
223  double t_ns = tzero + (iFirst + i) * 25;
224  double s = shape(t_ns);
225  if (i == iSkip) {
226  continue;
227  }
228  result[i] = s;
229  sum += s;
230  sum2 += s * s;
231  ++nActualWeights;
232  }
233  for (int i = 0; i < nWeights; ++i) {
234  if (i == iSkip) {
235  result[i] = 0;
236  } else {
237  result[i] = (result[i] - sum / nActualWeights) / (sum2 - sum * sum / nActualWeights);
238  }
239  }
240 }

References mps_fire::i, mps_fire::result, alignCSCRings::s, combinedConstraintHelpers::sum2(), ecalSimParameterMap_cff::timePhase, EcalShapeBase::timeToRise(), and tzero.

Referenced by computeAllWeights().

◆ dbId()

void EcalDccWeightBuilder::dbId ( const DetId detId,
int &  fedId,
int &  smId,
int &  ruId,
int &  xtalId 
) const
private

Definition at line 605 of file EcalDccWeightBuilder.cc.

605  {
607 
608  fedId = 600 + elecId.dccId();
610 
611  if (detId.subdetId() == EcalBarrel) {
612  smId = ((EBDetId)detId).ism();
613  } else {
614  smId = 10000 - fedId; //no SM in EE. Use some unique value to satisfy
615  // current DB PK constraints.
616  }
617  const int stripLength = 5; //1 strip = 5 crystals in a row
618  xtalId = (elecId.stripId() - 1) * stripLength + elecId.xtalId();
619 
620 #if 0
621  cout << __FILE__ << ":" << __LINE__ << ": FED ID "
622  << fedId << "\n";
623 
624  cout << __FILE__ << ":" << __LINE__ << ": SM logical ID "
625  << smId << "\n";
626 
627  cout << __FILE__ << ":" << __LINE__ << ": RU ID (TT or SC): "
628  << ruId << "\n";
629 
630  cout << __FILE__ << ":" << __LINE__ << ": strip:"
631  << elecId.stripId() << "\n";
632 
633  cout << __FILE__ << ":" << __LINE__ << ": xtal in strip: "
634  << elecId.xtalId() << "\n";
635 
636  cout << __FILE__ << ":" << __LINE__ << ": xtalId in RU: "
637  << xtalId << "\n";
638 #endif
639 }

References gather_cfg::cout, EcalElectronicsId::dccId(), EcalBarrel, ecalElectronicsMap_, l1tstage2_dqm_sourceclient-live_cfg::fedId, EcalElectronicsMapping::getElectronicsId(), EcalElectronicsId::stripId(), DetId::subdetId(), EcalElectronicsId::towerId(), and EcalElectronicsId::xtalId().

Referenced by writeWeightToAsciiFile(), writeWeightToDB(), and writeWeightToRootFile().

◆ decodeWeight()

double EcalDccWeightBuilder::decodeWeight ( int  W)
private

Definition at line 244 of file EcalDccWeightBuilder.cc.

244 { return ((double)W) / weightScale_; }

References weightScale_.

Referenced by unbiasWeights().

◆ encodeWeight()

int EcalDccWeightBuilder::encodeWeight ( double  w)
private

Definition at line 242 of file EcalDccWeightBuilder.cc.

242 { return lround(w * weightScale_); }

References w, and weightScale_.

Referenced by unbiasWeights().

◆ intercalib()

double EcalDccWeightBuilder::intercalib ( const DetId detId)
private

Retrieve intercalibration coefficent for channel detId.

Parameters
detIdID of the channel the intercalibration coef. must be retrieved for.

Definition at line 351 of file EcalDccWeightBuilder.cc.

351  {
352  // get current intercalibration coeff
353  double coef;
355  if (itCalib != calibMap_.end()) {
356  coef = (*itCalib);
357  } else {
358  coef = 1.;
359  std::cout << (uint32_t)detId << " not found in EcalIntercalibConstantMap" << std::endl;
360  }
361 #if 0
362  cout << __FILE__ << ":" << __LINE__ << ": ";
363  if(detId.subdetId()==EcalBarrel){
364  cout << "ieta = " << ((EBDetId)detId).ieta()
365  << " iphi = " << ((EBDetId)detId).iphi();
366  } else{
367  cout << "ix = " << ((EEDetId)detId).ix()
368  << " iy = " << ((EEDetId)detId).iy()
369  << " iz = " << ((EEDetId)detId).zside();
370  }
371  cout << " coef = " << coef << "\n";
372 #endif
373  return coef;
374 }

References calibMap_, gather_cfg::cout, EcalBarrel, EcalCondObjectContainer< T >::end(), EcalCondObjectContainer< T >::find(), DetId::rawId(), and DetId::subdetId().

Referenced by analyze(), and computeAllWeights().

◆ sort()

template<class T >
void EcalDccWeightBuilder::sort ( const std::vector< T > &  a,
std::vector< int > &  s,
bool  decreasingOrder = false 
)
private

Vector index sorting.

Parameters
vectorof values
[out]sortedindex of the vector
decreasingOrderswitch to use decreasing order instead of default increasing order

Definition at line 247 of file EcalDccWeightBuilder.cc.

247  {
248  // cout << __FILE__ << ":" << __LINE__ << ": "
249  // << "sort input array:" ;
250  // for(unsigned i=0; i<a.size(); ++i){
251  // cout << "\t" << a[i];
252  // }
253  // cout << "\n";
254 
255  //performs a bubble sort: adjacent elements are successively swapped 2 by 2
256  //until the list is finally sorted.
257  bool changed = false;
258  s.resize(a.size());
259  for (unsigned i = 0; i < a.size(); ++i)
260  s[i] = i;
261  if (a.empty())
262  return;
263  do {
264  changed = false;
265  for (unsigned i = 0; i < a.size() - 1; ++i) {
266  const int j = s[i];
267  const int nextj = s[i + 1];
268  if ((decreasingOrder && (a[j] < a[nextj])) || (!decreasingOrder && (a[j] > a[nextj]))) {
269  std::swap(s[i], s[i + 1]);
270  changed = true;
271  }
272  }
273  } while (changed);
274 
275  // cout << __FILE__ << ":" << __LINE__ << ": "
276  // << "sorted list of indices:" ;
277  // for(unsigned i=0; i < s.size(); ++i){
278  // cout << "\t" << s[i];
279  // }
280  // cout << "\n";
281 }

References a, mps_fire::i, dqmiolumiharvest::j, alignCSCRings::s, and std::swap().

Referenced by unbiasWeights().

◆ unbiasWeights()

void EcalDccWeightBuilder::unbiasWeights ( std::vector< double > &  weights,
std::vector< int32_t > *  encodedWeigths 
)
private

Definition at line 283 of file EcalDccWeightBuilder.cc.

283  {
284  const unsigned nw = weights.size();
285 
286  //computes integer weights, weights residuals and weight sum residual:
287  vector<double> dw(nw); //weight residuals due to interger encoding
288  vector<int> W(nw); //integer weights
289  int wsum = 0;
290  for (unsigned i = 0; i < nw; ++i) {
291  W[i] = encodeWeight(weights[i]);
292  dw[i] = decodeWeight(W[i]) - weights[i];
293  wsum += W[i];
294  }
295 
296  // cout << __FILE__ << ":" << __LINE__ << ": "
297  // << "weights before bias correction: ";
298  // for(unsigned i=0; i<weights.size(); ++i){
299  // const double w = weights[i];
300  // cout << "\t" << encodeWeight(w) << "(" << w << ", dw = " << dw[i] << ")";
301  // }
302  // cout << "\t sum: " << wsum << "\n";
303 
304  //sorts weight residuals in decreasing order:
305  vector<int> iw(nw);
306  sort(dw, iw, true);
307 
308  //compensates weight sum residual by adding or substracting 1 to weights
309  //starting from:
310  // 1) the weight with the minimal signed residual if the correction
311  // is positive (wsum<0)
312  // 2) the weight with the maximal signed residual if the correction
313  // is negative (wsum>0)
314  int wsumSign = wsum > 0 ? 1 : -1;
315  int i = wsum > 0 ? 0 : (nw - 1);
316  while (wsum != 0) {
317  W[iw[i]] -= wsumSign;
318  wsum -= wsumSign;
319  i += wsumSign;
320  if (i < 0 || i >= (int)nw) { //recompute the residuals if a second iteration is
321  // needed (in principle, it is not expected with usual input weights), :
322  for (unsigned i = 0; i < nw; ++i) {
323  dw[i] = decodeWeight(W[i]) - weights[i];
324  sort(dw, iw, true);
325  }
326  }
327  if (i < 0)
328  i = nw - 1;
329  if (i >= (int)nw)
330  i = 0;
331  }
332 
333  // cout << __FILE__ << ":" << __LINE__ << ": "
334  // << "weights after bias correction: ";
335  // for(unsigned i=0; i<weights.size(); ++i){
336  // cout << "\t" << W[i] << "(" << decodeWeight(W[i]) << ", dw = "
337  // << (decodeWeight(W[i])-weights[i]) << ")";
338  // }
339  // cout << "\n";
340 
341  //copy result
342  if (encodedWeights != nullptr)
343  encodedWeights->resize(nw);
344  for (unsigned i = 0; i < nw; ++i) {
345  weights[i] = decodeWeight(W[i]);
346  if (encodedWeights)
347  (*encodedWeights)[i] = W[i];
348  }
349 }

References decodeWeight(), encodeWeight(), mps_fire::i, sort(), and HLT_FULL_cff::weights.

Referenced by computeAllWeights().

◆ writeWeightToAsciiFile()

void EcalDccWeightBuilder::writeWeightToAsciiFile ( )
private

Definition at line 376 of file EcalDccWeightBuilder.cc.

376  {
377  string fName = !asciiOutputFileName_.empty() ? asciiOutputFileName_.c_str() : "dccWeights.txt";
378  ofstream file(fName.c_str());
379  if (!file.good()) {
380  throw cms::Exception("Output") << "Failed to open file '" << fName << "'for writing DCC weights\n";
381  }
382 
383  const char* comment = sqlMode_ ? "-- " : "# ";
384 
385  file << comment << "List of weights for amplitude estimation to be used in DCC for\n"
386  << comment << "zero suppresssion.\n\n";
387  if (!sqlMode_) {
388  file << comment << "Note: RU: trigger tower in EB, supercrystal in EE\n"
389  << comment << " xtl: crystal electronic channel id in RU, from 1 to 25\n\n"
390  << comment << " DetId SM FED RU xtl weights[0..5]...\n";
391  }
392 
393  if (sqlMode_) {
394  file << "variable recid number;\n"
395  "exec select COND2CONF_INFO_SQ.NextVal into :recid from DUAL;\n"
396  "insert into weights_info (rec_id,tag,version) values (:recid,'"
397  << dbTag_ << "'," << dbVersion_ << ");\n";
398  file << "\n"
399  << comment
400  << "index of first sample used in the weighting sum\n"
401  "begin\n"
402  " for fedid in "
403  << ecalDccFedIdMin << ".." << ecalDccFedIdMax
404  << " loop\n"
405  " insert into dcc_weightsample_dat (rec_id, logic_id, sample_id, \n"
406  " weight_number)\n"
407  " values(:recid,fedid,"
408  << dcc1stSample_
409  << ",1);\n"
410  " end loop;\n"
411  "end;\n"
412  "/\n";
413  } else {
414  file << "1st DCC sample: " << dcc1stSample_ << "\n";
415  }
416 
417  file << "\n" << comment << "list of weights per crystal channel\n";
418 
419  for (map<DetId, std::vector<int32_t> >::const_iterator it = encodedWeights_.begin(); it != encodedWeights_.end();
420  ++it) {
421  const DetId& detId = it->first;
422 
423  int fedId;
424  int smId;
425  int ruId;
426  int xtalId;
427 
428  //detId -> fedId, smId, ruId, xtalId
429  dbId(detId, fedId, smId, ruId, xtalId);
430 
431  char delim = sqlMode_ ? ',' : ' ';
432 
433  if (sqlMode_)
434  file << "-- detId " << detId.rawId() << "\n"
435  << "insert into dcc_weights_dat(rec_id,sm_id,fed_id,"
436  "tt_id, cry_id,\n"
437  "weight_0,weight_1,weight_2,weight_3,weight_4,weight_5) \n"
438  "values ("
439  ":recid";
440 
441  const vector<int>& weights = it->second;
442  if (!sqlMode_)
443  file << setw(10) << detId.rawId();
444  file << delim << setw(2) << smId;
445  file << delim << setw(3) << fedId;
446  file << delim << setw(2) << ruId;
447  file << delim << setw(2) << xtalId;
448 
449  for (unsigned i = 0; i < weights.size(); ++i) {
450  file << delim << setw(5) << weights[i];
451  }
452  if (sqlMode_)
453  file << ");";
454  file << "\n";
455  }
456  if (!file.good()) {
457  throw cms::Exception("Output") << "Error while writing DCC weights to '" << fName << "' file.";
458  }
459 }

References asciiOutputFileName_, dbId(), dbTag_, dbVersion_, dcc1stSample_, ecalDccFedIdMax, ecalDccFedIdMin, encodedWeights_, Exception, l1tstage2_dqm_sourceclient-live_cfg::fedId, FrontierConditions_GlobalTag_cff::file, MainPageGenerator::fName, mps_fire::i, genParticles_cff::map, DetId::rawId(), sqlMode_, and HLT_FULL_cff::weights.

Referenced by analyze().

◆ writeWeightToDB()

void EcalDccWeightBuilder::writeWeightToDB ( )
private

Definition at line 513 of file EcalDccWeightBuilder.cc.

513  {
514  cout << "going to write to the online DB " << dbSid_ << " user " << dbUser_ << endl;
515  ;
517 
518  try {
519  cout << "Making connection..." << flush;
520  const string& filePrefix = string("file:");
521  if (dbPassword_.find(filePrefix) == 0) { //password must be read for a file
522  string fileName = dbPassword_.substr(filePrefix.size());
523  //substitute dbPassword_ value by the password read from the file
525  pr.readPassword(fileName, dbUser_, dbPassword_);
526  }
527 
528  // cout << __FILE__ << ":" << __LINE__ << ": "
529  // << "Password: " << dbPassword_ << "\n";
530 
532  cout << "Done." << endl;
533  } catch (runtime_error& e) {
534  cerr << e.what() << endl;
535  exit(-1);
536  }
537 
538  ODFEWeightsInfo weight_info;
539  weight_info.setConfigTag(dbTag_);
540  weight_info.setVersion(dbVersion_);
541  cout << "Inserting in DB..." << endl;
542 
543  econn->insertConfigSet(&weight_info);
544 
545  int weight_id = weight_info.getId();
546  cout << "WeightInfo inserted with ID " << weight_id << endl;
547 
548  vector<ODWeightsDat> datadel;
549  datadel.reserve(encodedWeights_.size());
550 
551  vector<ODWeightsSamplesDat> dcc1stSampleConfig(nDccs);
552  for (int i = ecalDccFedIdMin; i <= ecalDccFedIdMax; ++i) {
553  dcc1stSampleConfig[i].setId(weight_id);
554  dcc1stSampleConfig[i].setFedId(601 + i);
555  dcc1stSampleConfig[i].setSampleId(dcc1stSample_);
556  dcc1stSampleConfig[i].setWeightNumber(-1); //not used.
557  }
558  econn->insertConfigDataArraySet(dcc1stSampleConfig, &weight_info);
559 
560  for (map<DetId, std::vector<int32_t> >::const_iterator it = encodedWeights_.begin(); it != encodedWeights_.end();
561  ++it) {
562  const DetId& detId = it->first;
563  const unsigned nWeights = 6;
564  vector<int> weights(nWeights);
565 
566  for (unsigned i = 0; i < weights.size(); ++i) {
567  //completing the weight vector with zeros in case it has
568  //less than 6 elements:
569  const vector<int>& w = it->second;
570  weights[i] = i < w.size() ? w[i] : 0;
571  }
572 
573  ODWeightsDat one_dat;
574  one_dat.setId(weight_id);
575 
576  int fedId;
577  int smId;
578  int ruId;
579  int xtalId;
580 
581  //detId -> fedId, smId, ruId, xtalId
582  dbId(detId, fedId, smId, ruId, xtalId);
583 
584  one_dat.setSMId(smId);
585  one_dat.setFedId(fedId);
586  one_dat.setTTId(ruId);
587  one_dat.setCrystalId(xtalId);
588 
589  one_dat.setWeight0(weights[0]);
590  one_dat.setWeight1(weights[1]);
591  one_dat.setWeight2(weights[2]);
592  one_dat.setWeight3(weights[3]);
593  one_dat.setWeight4(weights[4]);
594  one_dat.setWeight5(weights[5]);
595 
596  datadel.push_back(one_dat);
597  }
598  econn->insertConfigDataArraySet(datadel, &weight_info);
599  std::cout << " .. done insertion in DB " << endl;
600  delete econn;
601  cout << "closed DB connection ... done" << endl;
602 }

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, gather_cfg::cout, dbId(), dbPassword_, dbSid_, dbTag_, dbUser_, dbVersion_, dcc1stSample_, MillePedeFileConverter_cfg::e, ecalDccFedIdMax, ecalDccFedIdMin, test_db_connect::econn, encodedWeights_, beamvalidation::exit(), l1tstage2_dqm_sourceclient-live_cfg::fedId, MillePedeFileConverter_cfg::fileName, ODFEWeightsInfo::getId(), mps_fire::i, genParticles_cff::map, nDccs, IODConfig::setConfigTag(), ODWeightsDat::setCrystalId(), ODWeightsDat::setFedId(), ODWeightsDat::setId(), ODWeightsDat::setSMId(), ODWeightsDat::setTTId(), ODFEWeightsInfo::setVersion(), ODWeightsDat::setWeight0(), ODWeightsDat::setWeight1(), ODWeightsDat::setWeight2(), ODWeightsDat::setWeight3(), ODWeightsDat::setWeight4(), ODWeightsDat::setWeight5(), AlCaHLTBitMon_QueryRunRegistry::string, w, and HLT_FULL_cff::weights.

Referenced by analyze().

◆ writeWeightToRootFile()

void EcalDccWeightBuilder::writeWeightToRootFile ( )
private

Definition at line 460 of file EcalDccWeightBuilder.cc.

460  {
461  string fName = !rootOutputFileName_.empty() ? rootOutputFileName_.c_str() : "dccWeights.root";
462  TFile file(fName.c_str(), "RECREATE");
463  if (file.IsZombie()) {
464  throw cms::Exception("Output") << "Failed to open file '" << fName << "'for writing DCC weights\n";
465  }
466  TTree t("dccWeights", "Weights for DCC ZS filter");
467  const int nWeightMax = 20; //normally n_weights = 6. A different might be used
468  // used for test purposes.
469  struct {
470  Int_t detId;
471  Int_t fedId;
472  Int_t smId;
473  Int_t ruId;
474  Int_t xtalId;
475  Int_t n_weights;
476  Int_t weights[nWeightMax];
477  } buf;
478  t.Branch("weights",
479  &buf,
480  "rawDetId/I:"
481  "feId/I:"
482  "smSlotId/I:"
483  "ruId/I:"
484  "xtalInRuId/I:"
485  "n_weights/I:"
486  "weights[n_weights]/I");
487  for (map<DetId, std::vector<int32_t> >::const_iterator it = encodedWeights_.begin(); it != encodedWeights_.end();
488  ++it) {
489  buf.detId = it->first.rawId();
490  buf.n_weights = it->second.size();
491 
492  //detId -> fedId, smId, ruId, xtalId
493  dbId(buf.detId, buf.fedId, buf.smId, buf.ruId, buf.xtalId);
494 
495  if (buf.n_weights > nWeightMax) {
496  throw cms::Exception("EcalDccWeight") << "Number of weights (" << buf.n_weights << ") for DetId " << buf.detId
497  << " exceeded maximum limit (" << nWeightMax << ") of root output format. ";
498  }
499  copy(it->second.begin(), it->second.end(), buf.weights);
500  t.Fill();
501  }
502  t.Write();
503  file.Close();
504 }

References visDQMUpload::buf, filterCSVwithJSON::copy, dbId(), encodedWeights_, Exception, l1tstage2_dqm_sourceclient-live_cfg::fedId, FrontierConditions_GlobalTag_cff::file, MainPageGenerator::fName, genParticles_cff::map, rootOutputFileName_, submitPVValidationJobs::t, and HLT_FULL_cff::weights.

Referenced by analyze().

Member Data Documentation

◆ asciiOutputFileName_

std::string EcalDccWeightBuilder::asciiOutputFileName_
private

Definition at line 116 of file EcalDccWeightBuilder.h.

Referenced by writeWeightToAsciiFile().

◆ calibMap_

EcalIntercalibConstantMap& EcalDccWeightBuilder::calibMap_
private

Definition at line 127 of file EcalDccWeightBuilder.h.

Referenced by analyze(), and intercalib().

◆ dbPassword_

std::string EcalDccWeightBuilder::dbPassword_
private

Definition at line 120 of file EcalDccWeightBuilder.h.

Referenced by writeWeightToDB().

◆ dbSid_

std::string EcalDccWeightBuilder::dbSid_
private

Definition at line 118 of file EcalDccWeightBuilder.h.

Referenced by writeWeightToDB().

◆ dbTag_

std::string EcalDccWeightBuilder::dbTag_
private

Definition at line 121 of file EcalDccWeightBuilder.h.

Referenced by writeWeightToAsciiFile(), and writeWeightToDB().

◆ dbUser_

std::string EcalDccWeightBuilder::dbUser_
private

Definition at line 119 of file EcalDccWeightBuilder.h.

Referenced by writeWeightToDB().

◆ dbVersion_

int EcalDccWeightBuilder::dbVersion_
private

Definition at line 122 of file EcalDccWeightBuilder.h.

Referenced by writeWeightToAsciiFile(), and writeWeightToDB().

◆ dcc1stSample_

int EcalDccWeightBuilder::dcc1stSample_
private

◆ dccWeightsWithIntercalib_

bool EcalDccWeightBuilder::dccWeightsWithIntercalib_
private

Definition at line 112 of file EcalDccWeightBuilder.h.

Referenced by analyze().

◆ ecalDccFedIdMax

const int EcalDccWeightBuilder::ecalDccFedIdMax = 654
staticprivate

Definition at line 135 of file EcalDccWeightBuilder.h.

Referenced by writeWeightToAsciiFile(), and writeWeightToDB().

◆ ecalDccFedIdMin

const int EcalDccWeightBuilder::ecalDccFedIdMin = 601
staticprivate

Definition at line 134 of file EcalDccWeightBuilder.h.

Referenced by writeWeightToAsciiFile(), and writeWeightToDB().

◆ ecalElectronicsMap_

const EcalElectronicsMapping* EcalDccWeightBuilder::ecalElectronicsMap_
private

Definition at line 132 of file EcalDccWeightBuilder.h.

Referenced by analyze(), and dbId().

◆ emptyCalibMap_

EcalIntercalibConstantMap EcalDccWeightBuilder::emptyCalibMap_
private

Definition at line 128 of file EcalDccWeightBuilder.h.

◆ encodedWeights_

std::map<DetId, std::vector<int> > EcalDccWeightBuilder::encodedWeights_
private

◆ geom_

edm::ESHandle<CaloGeometry> EcalDccWeightBuilder::geom_
private

Definition at line 125 of file EcalDccWeightBuilder.h.

Referenced by analyze(), and computeAllWeights().

◆ imode_

mode_t EcalDccWeightBuilder::imode_
private

Definition at line 111 of file EcalDccWeightBuilder.h.

Referenced by computeAllWeights(), and EcalDccWeightBuilder().

◆ inputWeights_

std::vector<double> EcalDccWeightBuilder::inputWeights_
private

weights used in weightFromConfig mode.

Definition at line 109 of file EcalDccWeightBuilder.h.

Referenced by computeAllWeights(), and EcalDccWeightBuilder().

◆ mode_

std::string EcalDccWeightBuilder::mode_
private

Definition at line 110 of file EcalDccWeightBuilder.h.

Referenced by EcalDccWeightBuilder().

◆ nDccs

const int EcalDccWeightBuilder::nDccs = ecalDccFedIdMax - ecalDccFedIdMin + 1
staticprivate

Definition at line 136 of file EcalDccWeightBuilder.h.

Referenced by writeWeightToDB().

◆ nDccWeights_

int EcalDccWeightBuilder::nDccWeights_
private

Definition at line 106 of file EcalDccWeightBuilder.h.

Referenced by computeAllWeights(), and EcalDccWeightBuilder().

◆ rootOutputFileName_

std::string EcalDccWeightBuilder::rootOutputFileName_
private

Definition at line 117 of file EcalDccWeightBuilder.h.

Referenced by writeWeightToRootFile().

◆ sampleToSkip_

int EcalDccWeightBuilder::sampleToSkip_
private

Definition at line 105 of file EcalDccWeightBuilder.h.

Referenced by computeAllWeights().

◆ sqlMode_

bool EcalDccWeightBuilder::sqlMode_
private

Definition at line 123 of file EcalDccWeightBuilder.h.

Referenced by writeWeightToAsciiFile().

◆ weightScale_

const double EcalDccWeightBuilder::weightScale_ = 1024.
staticprivate

Definition at line 131 of file EcalDccWeightBuilder.h.

Referenced by decodeWeight(), and encodeWeight().

◆ writeToAsciiFile_

bool EcalDccWeightBuilder::writeToAsciiFile_
private

Definition at line 114 of file EcalDccWeightBuilder.h.

Referenced by analyze().

◆ writeToDB_

bool EcalDccWeightBuilder::writeToDB_
private

Definition at line 113 of file EcalDccWeightBuilder.h.

Referenced by analyze().

◆ writeToRootFile_

bool EcalDccWeightBuilder::writeToRootFile_
private

Definition at line 115 of file EcalDccWeightBuilder.h.

Referenced by analyze().

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
EcalDccWeightBuilder::ecalElectronicsMap_
const EcalElectronicsMapping * ecalElectronicsMap_
Definition: EcalDccWeightBuilder.h:132
EcalCondObjectContainer::end
const_iterator end() const
Definition: EcalCondObjectContainer.h:74
EcalCondDBInterface
Definition: EcalCondDBInterface.h:37
EcalDccWeightBuilder::writeToAsciiFile_
bool writeToAsciiFile_
Definition: EcalDccWeightBuilder.h:114
mps_fire.i
i
Definition: mps_fire.py:428
ODWeightsDat::setTTId
void setTTId(int dac)
Definition: ODWeightsDat.h:30
ODFEWeightsInfo::setVersion
void setVersion(int id)
Definition: ODFEWeightsInfo.h:23
EcalDccWeightBuilder::inputWeights_
std::vector< double > inputWeights_
Definition: EcalDccWeightBuilder.h:109
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
EcalDccWeightBuilder::unbiasWeights
void unbiasWeights(std::vector< double > &weights, std::vector< int32_t > *encodedWeigths)
Definition: EcalDccWeightBuilder.cc:283
EBShape
Definition: EBShape.h:6
patZpeak.handle
handle
Definition: patZpeak.py:23
EcalDccWeightBuilder::writeToRootFile_
bool writeToRootFile_
Definition: EcalDccWeightBuilder.h:115
min
T min(T a, T b)
Definition: MathUtil.h:58
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
EcalDccWeightBuilder::computeWeights
void computeWeights(const EcalShapeBase &shape, int binOfMax, double timePhase, int iFirst0, int nWeights, int iSkip0, std::vector< double > &result)
Definition: EcalDccWeightBuilder.cc:207
ODWeightsDat::setId
void setId(int dac)
Definition: ODWeightsDat.h:21
EBDetId
Definition: EBDetId.h:17
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EcalDccWeightBuilder::sampleToSkip_
int sampleToSkip_
Definition: EcalDccWeightBuilder.h:105
EcalDccWeightBuilder::ecalDccFedIdMin
static const int ecalDccFedIdMin
Definition: EcalDccWeightBuilder.h:134
test_db_connect.econn
econn
Definition: test_db_connect.py:10
EcalDccWeightBuilder::dcc1stSample_
int dcc1stSample_
Definition: EcalDccWeightBuilder.h:104
EcalDccWeightBuilder::writeWeightToAsciiFile
void writeWeightToAsciiFile()
Definition: EcalDccWeightBuilder.cc:376
cms::cuda::assert
assert(be >=bs)
EcalDccWeightBuilder::mode_
std::string mode_
Definition: EcalDccWeightBuilder.h:110
EcalDccWeightBuilder::calibMap_
EcalIntercalibConstantMap & calibMap_
Definition: EcalDccWeightBuilder.h:127
ODWeightsDat::setWeight5
void setWeight5(float x)
Definition: ODWeightsDat.h:41
EcalDccWeightBuilder::weightScale_
static const double weightScale_
Definition: EcalDccWeightBuilder.h:131
EcalElectronicsId::dccId
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
Definition: EcalElectronicsId.h:31
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
EcalShapeBase::timeToRise
double timeToRise() const override
Definition: EcalShapeBase.cc:25
CaloSimParameters::timePhase
double timePhase() const
the adjustment you need to apply to get the signal where you want it
Definition: CaloSimParameters.h:42
ODWeightsDat
Definition: ODWeightsDat.h:12
EcalCondObjectContainer
Definition: EcalCondObjectContainer.h:13
EcalDccWeightBuilder::writeWeightToDB
void writeWeightToDB()
Definition: EcalDccWeightBuilder.cc:513
EcalBarrel
Definition: EcalSubdetector.h:10
PasswordReader
Definition: PasswordReader.h:6
EcalDccWeightBuilder::dccWeightsWithIntercalib_
bool dccWeightsWithIntercalib_
Definition: EcalDccWeightBuilder.h:112
MainPageGenerator.fName
fName
Definition: MainPageGenerator.py:301
EcalElectronicsId::towerId
int towerId() const
get the tower id
Definition: EcalElectronicsId.h:33
EcalDccWeightBuilder::dbId
void dbId(const DetId &detId, int &fedId, int &smId, int &ruId, int &xtalId) const
Definition: EcalDccWeightBuilder.cc:605
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
EcalDccWeightBuilder::asciiOutputFileName_
std::string asciiOutputFileName_
Definition: EcalDccWeightBuilder.h:116
EcalDccWeightBuilder::encodedWeights_
std::map< DetId, std::vector< int > > encodedWeights_
Definition: EcalDccWeightBuilder.h:129
DetId
Definition: DetId.h:17
ODWeightsDat::setFedId
void setFedId(int dac)
Definition: ODWeightsDat.h:27
alignCSCRings.s
s
Definition: alignCSCRings.py:92
EcalDccWeightBuilder::sqlMode_
bool sqlMode_
Definition: EcalDccWeightBuilder.h:123
EcalSimParameterMap
Definition: EcalSimParameterMap.h:11
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
EcalDccWeightBuilder::decodeWeight
double decodeWeight(int W)
Definition: EcalDccWeightBuilder.cc:244
EcalShapeBase
Definition: EcalShapeBase.h:24
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
w
const double w
Definition: UKUtility.cc:23
HLT_FULL_cff.weights
weights
Definition: HLT_FULL_cff.py:99166
ODFEWeightsInfo::getId
int getId() const
Definition: ODFEWeightsInfo.h:19
EcalDccWeightBuilder::intercalib
double intercalib(const DetId &detId)
Definition: EcalDccWeightBuilder.cc:351
edm::ESHandle< EcalElectronicsMapping >
EcalElectronicsMapping::getElectronicsId
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
Definition: EcalElectronicsMapping.cc:324
EcalDccWeightBuilder::dbTag_
std::string dbTag_
Definition: EcalDccWeightBuilder.h:121
ODFEWeightsInfo
Definition: ODFEWeightsInfo.h:9
EcalDccWeightBuilder::geom_
edm::ESHandle< CaloGeometry > geom_
Definition: EcalDccWeightBuilder.h:125
EcalDccWeightBuilder::writeToDB_
bool writeToDB_
Definition: EcalDccWeightBuilder.h:113
EcalCondObjectContainer::find
const_iterator find(uint32_t rawId) const
Definition: EcalCondObjectContainer.h:53
EcalDccWeightBuilder::rootOutputFileName_
std::string rootOutputFileName_
Definition: EcalDccWeightBuilder.h:117
ODWeightsDat::setWeight1
void setWeight1(float x)
Definition: ODWeightsDat.h:37
tzero
static const double tzero[3]
Definition: CastorTimeSlew.cc:5
EEShape
Definition: EEShape.h:6
EcalElectronicsId
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
Definition: EcalElectronicsId.h:18
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
EEDetId
Definition: EEDetId.h:14
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiPixelPI::phase
phase
Definition: SiPixelPayloadInspectorHelper.h:39
EcalEndcap
Definition: EcalSubdetector.h:10
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
EcalDccWeightBuilder::writeWeightToRootFile
void writeWeightToRootFile()
Definition: EcalDccWeightBuilder.cc:460
a
double a
Definition: hdecay.h:119
sipixeldigitoraw
Definition: SiPixelDigiToRaw.cc:39
ODWeightsDat::setSMId
void setSMId(int dac)
Definition: ODWeightsDat.h:24
ODWeightsDat::setWeight2
void setWeight2(float x)
Definition: ODWeightsDat.h:38
EcalDccWeightBuilder::sort
void sort(const std::vector< T > &a, std::vector< int > &s, bool decreasingOrder=false)
Definition: EcalDccWeightBuilder.cc:247
ODWeightsDat::setWeight0
void setWeight0(float x)
Definition: ODWeightsDat.h:36
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
EcalSimParameterMap::simParameters
const CaloSimParameters & simParameters(const DetId &id) const override
return the sim parameters relative to the right subdet
Definition: EcalSimParameterMap.cc:52
ecalSimParameterMap_cff.timePhase
timePhase
Definition: ecalSimParameterMap_cff.py:8
EcalDccWeightBuilder::nDccWeights_
int nDccWeights_
Definition: EcalDccWeightBuilder.h:106
combinedConstraintHelpers::sum2
void sum2(T &x, T y)
Definition: CombinedKinematicConstraintT.h:74
EcalDccWeightBuilder::dbUser_
std::string dbUser_
Definition: EcalDccWeightBuilder.h:119
EcalDccWeightBuilder::ecalDccFedIdMax
static const int ecalDccFedIdMax
Definition: EcalDccWeightBuilder.h:135
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:88
DetId::Ecal
Definition: DetId.h:27
get
#define get
ODWeightsDat::setWeight4
void setWeight4(float x)
Definition: ODWeightsDat.h:40
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
CaloGeometry::getValidDetIds
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
Definition: CaloGeometry.cc:75
EcalMappingRcd
Definition: EcalMappingRcd.h:15
EcalDccWeightBuilder::COMPUTE_WEIGHTS
Definition: EcalDccWeightBuilder.h:28
EcalDccWeightBuilder::WEIGHTS_FROM_CONFIG
Definition: EcalDccWeightBuilder.h:28
EcalDccWeightBuilder::encodeWeight
int encodeWeight(double w)
Definition: EcalDccWeightBuilder.cc:242
Exception
Definition: hltDiff.cc:245
EcalDccWeightBuilder::dbPassword_
std::string dbPassword_
Definition: EcalDccWeightBuilder.h:120
EcalDccWeightBuilder::imode_
mode_t imode_
Definition: EcalDccWeightBuilder.h:111
EcalDccWeightBuilder::nDccs
static const int nDccs
Definition: EcalDccWeightBuilder.h:136
EcalDccWeightBuilder::emptyCalibMap_
EcalIntercalibConstantMap emptyCalibMap_
Definition: EcalDccWeightBuilder.h:128
EcalCondObjectContainer::const_iterator
std::vector< Item >::const_iterator const_iterator
Definition: EcalCondObjectContainer.h:19
mps_fire.result
result
Definition: mps_fire.py:311
EcalElectronicsId::stripId
int stripId() const
get the tower id
Definition: EcalElectronicsId.h:35
genParticles_cff.map
map
Definition: genParticles_cff.py:11
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53
IODConfig::setConfigTag
void setConfigTag(std::string x)
Definition: IODConfig.h:29
EcalDccWeightBuilder::computeAllWeights
void computeAllWeights(bool withIntercalib, const edm::EventSetup &es)
Definition: EcalDccWeightBuilder.cc:106
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
ODWeightsDat::setWeight3
void setWeight3(float x)
Definition: ODWeightsDat.h:39
EcalDccWeightBuilder::dbSid_
std::string dbSid_
Definition: EcalDccWeightBuilder.h:118
EcalElectronicsId::xtalId
int xtalId() const
get the channel id
Definition: EcalElectronicsId.h:37
EcalIntercalibConstantsRcd
Definition: EcalIntercalibConstantsRcd.h:5
EcalDccWeightBuilder::dbVersion_
int dbVersion_
Definition: EcalDccWeightBuilder.h:122
ODWeightsDat::setCrystalId
void setCrystalId(int dac)
Definition: ODWeightsDat.h:33
CaloSimParameters::binOfMaximum
int binOfMaximum() const
Definition: CaloSimParameters.h:47
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37