CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
popcon::EcalPulseSymmCovariancesHandler Class Reference

#include <EcalPulseSymmCovariancesHandler.h>

Inheritance diagram for popcon::EcalPulseSymmCovariancesHandler:
popcon::PopConSourceHandler< EcalPulseSymmCovariances >

Public Member Functions

bool checkPulseSymmCovariance (EcalPulseSymmCovariances::Item *item)
 
 EcalPulseSymmCovariancesHandler (edm::ParameterSet const &)
 
void fillSimPulseSymmCovariance (EcalPulseSymmCovariances::Item *item, bool isbarrel)
 
void getNewObjects () override
 
std::string id () const override
 
 ~EcalPulseSymmCovariancesHandler () override
 
- Public Member Functions inherited from popcon::PopConSourceHandler< EcalPulseSymmCovariances >
void convertFromOld ()
 
SummarydummySummary (typename OldContainer::value_type const &) const
 
void initialize (const cond::persistency::Session &dbSession, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry)
 
Ref lastPayload () const
 
cond::LogDBEntry_t const & logDBEntry () const
 
std::pair< Container const *, std::string const > operator() (const cond::persistency::Session &session, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry) const
 
 PopConSourceHandler ()
 
Container const & returnData ()
 
void sort ()
 
cond::TagInfo_t const & tagInfo () const
 
std::string const & userTextLog () const
 
virtual ~PopConSourceHandler ()
 

Private Attributes

std::vector< double > m_EBPulseShapeCovariance
 
std::vector< double > m_EEPulseShapeCovariance
 
std::string m_filename
 
unsigned int m_firstRun
 
std::string m_gentag
 
unsigned int m_lastRun
 
std::string m_name
 
const EcalPulseSymmCovariancesmypulseshapes
 

Additional Inherited Members

- Public Types inherited from popcon::PopConSourceHandler< EcalPulseSymmCovariances >
typedef std::vector< Triplet > Container
 
typedef std::vector< std::pair< EcalPulseSymmCovariances *, cond::Time_t > > OldContainer
 
typedef PopConSourceHandler< EcalPulseSymmCovariancesself
 
typedef cond::Summary Summary
 
typedef cond::Time_t Time_t
 
typedef EcalPulseSymmCovariances value_type
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< EcalPulseSymmCovariances >
int add (value_type *payload, Summary *summary, Time_t time)
 
cond::persistency::SessiondbSession () const
 
- Protected Attributes inherited from popcon::PopConSourceHandler< EcalPulseSymmCovariances >
OldContainer m_to_transfer
 
std::string m_userTextLog
 

Detailed Description

Definition at line 40 of file EcalPulseSymmCovariancesHandler.h.

Constructor & Destructor Documentation

◆ EcalPulseSymmCovariancesHandler()

popcon::EcalPulseSymmCovariancesHandler::EcalPulseSymmCovariancesHandler ( edm::ParameterSet const &  ps)

Definition at line 6 of file EcalPulseSymmCovariancesHandler.cc.

7  : m_name(ps.getUntrackedParameter<std::string>("name", "EcalPulseSymmCovariancesHandler")) {
8  std::cout << "EcalPulseSymmCovariance Source handler constructor\n" << std::endl;
9  m_firstRun = static_cast<unsigned int>(atoi(ps.getParameter<std::string>("firstRun").c_str()));
10  m_filename = ps.getParameter<std::string>("inputFileName");
11  m_EBPulseShapeCovariance = ps.getParameter<std::vector<double> >("EBPulseShapeCovariance");
12  m_EEPulseShapeCovariance = ps.getParameter<std::vector<double> >("EEPulseShapeCovariance");
13 }

References gather_cfg::cout, edm::ParameterSet::getParameter(), m_EBPulseShapeCovariance, m_EEPulseShapeCovariance, m_filename, m_firstRun, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~EcalPulseSymmCovariancesHandler()

popcon::EcalPulseSymmCovariancesHandler::~EcalPulseSymmCovariancesHandler ( )
override

Definition at line 15 of file EcalPulseSymmCovariancesHandler.cc.

15 {}

Member Function Documentation

◆ checkPulseSymmCovariance()

bool popcon::EcalPulseSymmCovariancesHandler::checkPulseSymmCovariance ( EcalPulseSymmCovariances::Item item)

Definition at line 17 of file EcalPulseSymmCovariancesHandler.cc.

17  {
18  // true means all is standard and OK
19  bool result = true;
21  for (int k = 0; k < N; ++k) {
22  if (fabs(item->covval[k]) > 1)
23  result = false;
24  }
25  return result;
26 }

References B2GTnPMonitor_cfi::item, dqmdumpme::k, N, mps_fire::result, and EcalPulseShape::TEMPLATESAMPLES.

◆ fillSimPulseSymmCovariance()

void popcon::EcalPulseSymmCovariancesHandler::fillSimPulseSymmCovariance ( EcalPulseSymmCovariances::Item item,
bool  isbarrel 
)

Definition at line 28 of file EcalPulseSymmCovariancesHandler.cc.

29  {
30  for (int k = 0; k < std::pow(EcalPulseShape::TEMPLATESAMPLES, 2); ++k) {
33  if (j >= i) {
34  int linK = j + (EcalPulseShape::TEMPLATESAMPLES - 1) * i;
35  item->covval[linK] = isbarrel ? m_EBPulseShapeCovariance[k] : m_EEPulseShapeCovariance[k];
36  }
37  }
38 }

References mps_fire::i, B2GTnPMonitor_cfi::item, dqmiolumiharvest::j, dqmdumpme::k, funct::pow(), and EcalPulseShape::TEMPLATESAMPLES.

◆ getNewObjects()

void popcon::EcalPulseSymmCovariancesHandler::getNewObjects ( )
overridevirtual

Implements popcon::PopConSourceHandler< EcalPulseSymmCovariances >.

Definition at line 40 of file EcalPulseSymmCovariancesHandler.cc.

40  {
41  std::cout << "------- Ecal - > getNewObjects\n";
42 
43  // create the object pukse shapes
45 
46  // read the templates from a text file
47  std::ifstream inputfile;
48  inputfile.open(m_filename.c_str());
50  unsigned int rawId;
51  int isbarrel;
53 
54  // keep track of bad crystals
55  int nEBbad(0), nEEbad(0);
56  int nEBgood(0), nEEgood(0);
57  std::vector<EBDetId> ebgood;
58  std::vector<EEDetId> eegood;
59 
60  // fill with the measured shapes only for data
61  if (m_firstRun > 1) {
62  while (std::getline(inputfile, line)) {
63  std::istringstream linereader(line);
64  linereader >> isbarrel >> rawId;
65  // std::cout << "Inserting template for crystal with rawId = " << rawId << " (isbarrel = " << isbarrel << ") " << std::endl;
66  for (int k = 0; k < std::pow(EcalPulseShape::TEMPLATESAMPLES, 2); ++k) {
69  linereader >> covvals[i][j];
70  }
71 
72  if (!linereader) {
73  std::cout << "Wrong format of the text file. Exit." << std::endl;
74  return;
75  }
77  for (int i = 0; i < EcalPulseShape::TEMPLATESAMPLES; ++i)
78  for (int j = 0; j < EcalPulseShape::TEMPLATESAMPLES; ++j) {
79  int k = -1;
80  if (j >= i)
82  else
84  item.covval[k] = covvals[i][j];
85  }
86 
87  if (isbarrel) {
88  EBDetId ebdetid(rawId);
90  nEBbad++;
91  else {
92  nEBgood++;
93  ebgood.push_back(ebdetid);
94  pulsecovs->insert(std::make_pair(ebdetid.rawId(), item));
95  }
96  } else {
97  EEDetId eedetid(rawId);
99  nEEbad++;
100  else {
101  nEEgood++;
102  eegood.push_back(eedetid);
103  pulsecovs->insert(std::make_pair(eedetid.rawId(), item));
104  }
105  }
106  }
107  }
108 
109  // now fill the bad crystals and simulation with the simulation values (from TB)
110  std::cout << "Filled the DB with the good measured ECAL templates. Now filling the others with the TB values"
111  << std::endl;
112  for (int iEta = -EBDetId::MAX_IETA; iEta <= EBDetId::MAX_IETA; ++iEta) {
113  if (iEta == 0)
114  continue;
115  for (int iPhi = EBDetId::MIN_IPHI; iPhi <= EBDetId::MAX_IPHI; ++iPhi) {
116  if (EBDetId::validDetId(iEta, iPhi)) {
117  EBDetId ebdetid(iEta, iPhi, EBDetId::ETAPHIMODE);
118 
119  std::vector<EBDetId>::iterator it = find(ebgood.begin(), ebgood.end(), ebdetid);
120  if (it == ebgood.end()) {
123  pulsecovs->insert(std::make_pair(ebdetid.rawId(), item));
124  }
125  }
126  }
127  }
128 
129  for (int iZ = -1; iZ < 2; iZ += 2) {
130  for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) {
131  for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) {
132  if (EEDetId::validDetId(iX, iY, iZ)) {
133  EEDetId eedetid(iX, iY, iZ);
134 
135  std::vector<EEDetId>::iterator it = find(eegood.begin(), eegood.end(), eedetid);
136  if (it == eegood.end()) {
139  pulsecovs->insert(std::make_pair(eedetid.rawId(), item));
140  }
141  }
142  }
143  }
144  }
145 
146  std::cout << "Inserted the pulse covariances into the new item object" << std::endl;
147 
148  unsigned int irun = m_firstRun;
149  Time_t snc = (Time_t)irun;
150 
151  m_to_transfer.push_back(std::make_pair((EcalPulseSymmCovariances*)pulsecovs, snc));
152 
153  std::cout << "Ecal - > end of getNewObjects -----------" << std::endl;
154  std::cout << "N. bad shapes for EB = " << nEBbad << std::endl;
155  std::cout << "N. bad shapes for EE = " << nEEbad << std::endl;
156  std::cout << "Written the object" << std::endl;
157 }

References gather_cfg::cout, EBDetId::ETAPHIMODE, spr::find(), mps_fire::i, L1TowerCalibrationProducer_cfi::iEta, EcalCondObjectContainer< T >::insert(), B2GTnPMonitor_cfi::item, EEDetId::IX_MAX, EEDetId::IX_MIN, EEDetId::IY_MAX, EEDetId::IY_MIN, dqmiolumiharvest::j, dqmdumpme::k, mps_splice::line, EBDetId::MAX_IETA, EBDetId::MAX_IPHI, EBDetId::MIN_IPHI, funct::pow(), DetId::rawId(), AlCaHLTBitMon_QueryRunRegistry::string, EcalPulseShape::TEMPLATESAMPLES, EBDetId::validDetId(), and EEDetId::validDetId().

◆ id()

std::string popcon::EcalPulseSymmCovariancesHandler::id ( ) const
inlineoverridevirtual

Implements popcon::PopConSourceHandler< EcalPulseSymmCovariances >.

Definition at line 47 of file EcalPulseSymmCovariancesHandler.h.

47 { return m_name; }

References m_name.

Member Data Documentation

◆ m_EBPulseShapeCovariance

std::vector<double> popcon::EcalPulseSymmCovariancesHandler::m_EBPulseShapeCovariance
private

Definition at line 58 of file EcalPulseSymmCovariancesHandler.h.

Referenced by EcalPulseSymmCovariancesHandler().

◆ m_EEPulseShapeCovariance

std::vector<double> popcon::EcalPulseSymmCovariancesHandler::m_EEPulseShapeCovariance
private

Definition at line 58 of file EcalPulseSymmCovariancesHandler.h.

Referenced by EcalPulseSymmCovariancesHandler().

◆ m_filename

std::string popcon::EcalPulseSymmCovariancesHandler::m_filename
private

Definition at line 56 of file EcalPulseSymmCovariancesHandler.h.

Referenced by EcalPulseSymmCovariancesHandler().

◆ m_firstRun

unsigned int popcon::EcalPulseSymmCovariancesHandler::m_firstRun
private

Definition at line 52 of file EcalPulseSymmCovariancesHandler.h.

Referenced by EcalPulseSymmCovariancesHandler().

◆ m_gentag

std::string popcon::EcalPulseSymmCovariancesHandler::m_gentag
private

Definition at line 55 of file EcalPulseSymmCovariancesHandler.h.

◆ m_lastRun

unsigned int popcon::EcalPulseSymmCovariancesHandler::m_lastRun
private

Definition at line 53 of file EcalPulseSymmCovariancesHandler.h.

◆ m_name

std::string popcon::EcalPulseSymmCovariancesHandler::m_name
private

Definition at line 57 of file EcalPulseSymmCovariancesHandler.h.

Referenced by id().

◆ mypulseshapes

const EcalPulseSymmCovariances* popcon::EcalPulseSymmCovariancesHandler::mypulseshapes
private

Definition at line 50 of file EcalPulseSymmCovariancesHandler.h.

mps_fire.i
i
Definition: mps_fire.py:355
popcon::PopConSourceHandler< EcalPulseSymmCovariances >::m_to_transfer
OldContainer m_to_transfer
Definition: PopConSourceHandler.h:162
popcon::EcalPulseSymmCovariancesHandler::m_EEPulseShapeCovariance
std::vector< double > m_EEPulseShapeCovariance
Definition: EcalPulseSymmCovariancesHandler.h:58
EBDetId
Definition: EBDetId.h:17
popcon::EcalPulseSymmCovariancesHandler::fillSimPulseSymmCovariance
void fillSimPulseSymmCovariance(EcalPulseSymmCovariances::Item *item, bool isbarrel)
Definition: EcalPulseSymmCovariancesHandler.cc:28
gather_cfg.cout
cout
Definition: gather_cfg.py:144
popcon::EcalPulseSymmCovariancesHandler::m_firstRun
unsigned int m_firstRun
Definition: EcalPulseSymmCovariancesHandler.h:52
popcon::PopConSourceHandler< EcalPulseSymmCovariances >::Time_t
cond::Time_t Time_t
Definition: PopConSourceHandler.h:34
EEDetId::IX_MIN
static const int IX_MIN
Definition: EEDetId.h:290
EEDetId::IY_MIN
static const int IY_MIN
Definition: EEDetId.h:294
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
EcalCondObjectContainer< EcalPulseSymmCovariance >
N
#define N
Definition: blowfish.cc:9
EcalPulseSymmCovariance
Definition: EcalPulseSymmCovariances.h:9
EBDetId::MAX_IPHI
static const int MAX_IPHI
Definition: EBDetId.h:137
EEDetId::IY_MAX
static const int IY_MAX
Definition: EEDetId.h:302
dqmdumpme.k
k
Definition: dqmdumpme.py:60
popcon::EcalPulseSymmCovariancesHandler::m_filename
std::string m_filename
Definition: EcalPulseSymmCovariancesHandler.h:56
EEDetId
Definition: EEDetId.h:14
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EBDetId::ETAPHIMODE
static const int ETAPHIMODE
Definition: EBDetId.h:158
EEDetId::IX_MAX
static const int IX_MAX
Definition: EEDetId.h:298
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
EBDetId::validDetId
static bool validDetId(int i, int j)
check if a valid index combination
Definition: EBDetId.h:118
EcalPulseSymmCovariances
EcalPulseSymmCovariancesMap EcalPulseSymmCovariances
Definition: EcalPulseSymmCovariances.h:29
popcon::EcalPulseSymmCovariancesHandler::m_EBPulseShapeCovariance
std::vector< double > m_EBPulseShapeCovariance
Definition: EcalPulseSymmCovariancesHandler.h:58
popcon::EcalPulseSymmCovariancesHandler::checkPulseSymmCovariance
bool checkPulseSymmCovariance(EcalPulseSymmCovariances::Item *item)
Definition: EcalPulseSymmCovariancesHandler.cc:17
EcalCondObjectContainer::insert
void insert(std::pair< uint32_t, Item > const &a)
Definition: EcalCondObjectContainer.h:38
EcalPulseShape::TEMPLATESAMPLES
static const int TEMPLATESAMPLES
Definition: EcalPulseShapes.h:10
EEDetId::validDetId
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
L1TowerCalibrationProducer_cfi.iEta
iEta
Definition: L1TowerCalibrationProducer_cfi.py:60
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
mps_fire.result
result
Definition: mps_fire.py:303
popcon::EcalPulseSymmCovariancesHandler::m_name
std::string m_name
Definition: EcalPulseSymmCovariancesHandler.h:57
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
mps_splice.line
line
Definition: mps_splice.py:76
EBDetId::MAX_IETA
static const int MAX_IETA
Definition: EBDetId.h:136
EBDetId::MIN_IPHI
static const int MIN_IPHI
Definition: EBDetId.h:135