Skip to content

Commit

Permalink
Merge pull request #33349 from CMS-ECAL-Trigger-Group/ecal_double_wei…
Browse files Browse the repository at this point in the history
…ght_emulator_11_3_latest

ECAL Emulator Update: Full Configuration Flexibility including L1 Double Weights
  • Loading branch information
cmsbuild authored Apr 13, 2021
2 parents 5980dee + dc1dd85 commit 6d2f660
Show file tree
Hide file tree
Showing 59 changed files with 5,382 additions and 441 deletions.
95 changes: 95 additions & 0 deletions CondTools/Ecal/interface/EcalTPGOddWeightGroupHandler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#ifndef CONDTOOLS_ECAL_ECALTPGODDWEIGHTGROUPHANDLER_H
#define CONDTOOLS_ECAL_ECALTPGODDWEIGHTGROUPHANDLER_H

#include <ctime>
#include <iostream>
#include <map>
#include <string>
#include <typeinfo>
#include <vector>

#include "CondCore/PopCon/interface/PopConSourceHandler.h"
#include "FWCore/ParameterSet/interface/ParameterSetfwd.h"

#include "FWCore/ServiceRegistry/interface/Service.h"
#include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/EventSetupRecordKey.h"

#include "CondFormats/EcalObjects/interface/EcalTPGOddWeightGroup.h"
#include "CondFormats/DataRecord/interface/EcalTPGOddWeightGroupRcd.h"

#include "OnlineDB/EcalCondDB/interface/all_monitoring_types.h"
#include "OnlineDB/Oracle/interface/Oracle.h"
#include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h"

#include "DataFormats/EcalDetId/interface/EEDetId.h"
#include "DataFormats/EcalDetId/interface/EBDetId.h"
#include "DataFormats/Provenance/interface/Timestamp.h"

class EcalElectronicsMapping;

namespace edm {
class ParameterSet;
class Event;
class EventSetup;
} // namespace edm

namespace popcon {

class EcalTPGOddWeightGroupHandler : public popcon::PopConSourceHandler<EcalTPGOddWeightGroup> {
public:
EcalTPGOddWeightGroupHandler(edm::ParameterSet const&);
~EcalTPGOddWeightGroupHandler() override;

std::map<std::string, int> makeStripId();

void getNewObjects() override;

std::string id() const override { return m_name; }

void readtxtFile();
void readxmlFile();

void readFromFile(const char* inputFile);
void writeFile(const char* inputFile);

EcalCondDBInterface* econn;

private:
std::string to_string(char value[]) {
std::ostringstream streamOut;
streamOut << value;
return streamOut.str();
}

unsigned int m_firstRun;
unsigned int m_lastRun;

std::map<std::string, int> correspId;

const EcalElectronicsMapping* ecalMapping_;
std::string m_location;
std::string m_gentag;
std::string m_sid;
std::string m_user;
std::string m_pass;
std::string m_locationsource;
std::string m_name;
unsigned int m_runnr;
std::string m_runtype;
std::string m_i_tag;
std::string m_file_type;
std::string m_file_name;
int m_i_version;
unsigned int m_i_run_number;
int m_i_oddweightGroup;
};
} // namespace popcon
#endif
90 changes: 90 additions & 0 deletions CondTools/Ecal/interface/EcalTPGOddWeightIdMapHandler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#ifndef CONDTOOLS_ECAL_ECALTPGODDWEIGHTIDMAPHANDLER_H
#define CONDTOOLS_ECAL_ECALTPGODDWEIGHTIDMAPHANDLER_H

#include <ctime>
#include <iostream>
#include <map>
#include <string>
#include <typeinfo>
#include <vector>

#include "CondCore/PopCon/interface/PopConSourceHandler.h"
#include "FWCore/ParameterSet/interface/ParameterSetfwd.h"

#include "FWCore/ServiceRegistry/interface/Service.h"
#include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/EventSetupRecordKey.h"

#include "CondFormats/EcalObjects/interface/EcalTPGOddWeightIdMap.h"
#include "CondFormats/DataRecord/interface/EcalTPGOddWeightIdMapRcd.h"

#include "OnlineDB/EcalCondDB/interface/all_monitoring_types.h"
#include "OnlineDB/Oracle/interface/Oracle.h"
#include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h"

#include "DataFormats/EcalDetId/interface/EEDetId.h"
#include "DataFormats/EcalDetId/interface/EBDetId.h"
#include "DataFormats/Provenance/interface/Timestamp.h"

namespace edm {
class ParameterSet;
class Event;
class EventSetup;
} // namespace edm

namespace popcon {

class EcalTPGOddWeightIdMapHandler : public popcon::PopConSourceHandler<EcalTPGOddWeightIdMap> {
public:
EcalTPGOddWeightIdMapHandler(edm::ParameterSet const&);
~EcalTPGOddWeightIdMapHandler() override;

void getNewObjects() override;

std::string id() const override { return m_name; }

void readtxtFile();
void readxmlFile();

void readFromFile(const char* inputFile);
void writeFile(const char* inputFile);

EcalCondDBInterface* econn;

private:
std::string to_string(char value[]) {
std::ostringstream streamOut;
streamOut << value;
return streamOut.str();
}

const EcalTPGOddWeightIdMap* myweightIdMap;

unsigned int m_firstRun;
unsigned int m_lastRun;

std::string m_location;
std::string m_gentag;
std::string m_sid;
std::string m_user;
std::string m_pass;
std::string m_locationsource;
std::string m_name;
unsigned int m_runnr;
std::string m_runtype;
std::string m_i_tag;
std::string m_file_type;
std::string m_file_name;
int m_i_version;
unsigned int m_i_run_number;
int m_i_oddweightIdMap;
};
} // namespace popcon
#endif
88 changes: 88 additions & 0 deletions CondTools/Ecal/interface/EcalTPGTPModeHandler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#ifndef CONDTOOLS_ECAL_ECALTPGTPMODEHANDLER_H
#define CONDTOOLS_ECAL_ECALTPGTPMODEHANDLER_H

#include <vector>
#include <typeinfo>
#include <string>
#include <map>
#include <iostream>
#include <ctime>

#include "CondCore/PopCon/interface/PopConSourceHandler.h"
#include "FWCore/ParameterSet/interface/ParameterSetfwd.h"

#include "FWCore/ServiceRegistry/interface/Service.h"
#include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/EventSetupRecordKey.h"

#include "CondFormats/EcalObjects/interface/EcalTPGTPMode.h"
#include "CondFormats/DataRecord/interface/EcalTPGTPModeRcd.h"

#include "OnlineDB/EcalCondDB/interface/all_monitoring_types.h"
#include "OnlineDB/Oracle/interface/Oracle.h"
#include "OnlineDB/EcalCondDB/interface/EcalCondDBInterface.h"

#include "DataFormats/Provenance/interface/Timestamp.h"

class EcalElectronicsMapping;

namespace edm {
class ParameterSet;
class Event;
class EventSetup;
} // namespace edm

namespace popcon {

class EcalTPGTPModeHandler : public popcon::PopConSourceHandler<EcalTPGTPMode> {
public:
EcalTPGTPModeHandler(edm::ParameterSet const&);
~EcalTPGTPModeHandler() override;

void getNewObjects() override;

std::string id() const override { return m_name; }

void readtxtFile();
// void readxmlFile();

void readFromFile(const char* inputFile);
void writeFile(const char* inputFile);

EcalCondDBInterface* econn;

private:
std::string to_string(char value[]) {
std::ostringstream streamOut;
streamOut << value;
return streamOut.str();
}

unsigned int m_firstRun;
unsigned int m_lastRun;

std::string m_location;
std::string m_gentag;
std::string m_sid;
std::string m_user;
std::string m_pass;
std::string m_locationsource;
std::string m_name;
unsigned int m_runnr;
std::string m_runtype;
std::string m_i_tag;
std::string m_file_type;
std::string m_file_name;
int m_i_version;
unsigned int m_i_run_number;
int m_i_TPMode;
};
} // namespace popcon
#endif
59 changes: 59 additions & 0 deletions CondTools/Ecal/python/copyTPMode_cfg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import FWCore.ParameterSet.Config as cms
import CondTools.Ecal.conddb_init as conddb_init
import CondTools.Ecal.db_credentials as auth

process = cms.Process("ProcessOne")

process.MessageLogger = cms.Service("MessageLogger",
debugModules = cms.untracked.vstring('*'),
cout = cms.untracked.PSet(
threshold = cms.untracked.string('DEBUG')
),
destinations = cms.untracked.vstring('cout')
)


process.source = cms.Source("EmptyIOVSource",
lastValue = cms.uint64(100000000),
timetype = cms.string('runnumber'),
firstValue = cms.uint64(100000000),
interval = cms.uint64(1)
)

process.load("CondCore.CondDB.CondDB_cfi")

process.CondDB.connect = conddb_init.options.destinationDatabase
process.CondDB.DBParameters.authenticationPath = ''

process.PoolDBOutputService = cms.Service("PoolDBOutputService",
process.CondDB,
toPut = cms.VPSet(cms.PSet(
record = cms.string('EcalTPGTPModeRcd'),
tag = cms.string(conddb_init.options.destinationTag)
))
)

db_reader_account = 'CMS_ECAL_R'
db_service,db_user,db_pwd = auth.get_db_credentials( db_reader_account )

process.Test1 = cms.EDAnalyzer("ExTestEcalTPGTPModeAnalyzer",
record = cms.string('EcalTPGTPModeRcd'),
loggingOn= cms.untracked.bool(True),
IsDestDbCheckedInQueryLog=cms.untracked.bool(True),
SinceAppendMode=cms.bool(True),
Source=cms.PSet(
firstRun = cms.string('340400'),
lastRun = cms.string('10000000'),
OnlineDBSID = cms.string(db_service),
OnlineDBUser = cms.string(db_user),
OnlineDBPassword = cms.string( db_pwd ),
LocationSource = cms.string('P5'),
Location = cms.string('P5_Co'),
GenTag = cms.string('GLOBAL'),
RunType = cms.string('PHYSICS'),
fileType = cms.string(''),
fileName = cms.string('')
)
)

process.p = cms.Path(process.Test1)
59 changes: 59 additions & 0 deletions CondTools/Ecal/python/copyWOddGroup_cfg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import FWCore.ParameterSet.Config as cms
import CondTools.Ecal.conddb_init as conddb_init
import CondTools.Ecal.db_credentials as auth

process = cms.Process("ProcessOne")

process.MessageLogger = cms.Service("MessageLogger",
debugModules = cms.untracked.vstring('*'),
cout = cms.untracked.PSet(
threshold = cms.untracked.string('DEBUG')
),
destinations = cms.untracked.vstring('cout')
)


process.source = cms.Source("EmptyIOVSource",
lastValue = cms.uint64(100000000),
timetype = cms.string('runnumber'),
firstValue = cms.uint64(100000000),
interval = cms.uint64(1)
)

process.load("CondCore.CondDB.CondDB_cfi")

process.CondDB.connect = conddb_init.options.destinationDatabase
process.CondDB.DBParameters.authenticationPath = ''

process.PoolDBOutputService = cms.Service("PoolDBOutputService",
process.CondDB,
toPut = cms.VPSet(cms.PSet(
record = cms.string('EcalTPGOddWeightGroupRcd'),
tag = cms.string(conddb_init.options.destinationTag)
))
)

db_reader_account = 'CMS_ECAL_R'
db_service,db_user,db_pwd = auth.get_db_credentials( db_reader_account )

process.Test1 = cms.EDAnalyzer("ExTestEcalTPGOddWeightGroupAnalyzer",
record = cms.string('EcalTPGOddWeightGroupRcd'),
loggingOn= cms.untracked.bool(True),
IsDestDbCheckedInQueryLog=cms.untracked.bool(True),
SinceAppendMode=cms.bool(True),
Source=cms.PSet(
firstRun = cms.string('340400'),
lastRun = cms.string('10000000'),
OnlineDBSID = cms.string(db_service),
OnlineDBUser = cms.string(db_user),
OnlineDBPassword = cms.string( db_pwd ),
LocationSource = cms.string('P5'),
Location = cms.string('P5_Co'),
GenTag = cms.string('GLOBAL'),
RunType = cms.string('PHYSICS'),
fileType = cms.string(''),
fileName = cms.string('')
)
)

process.p = cms.Path(process.Test1)
Loading

0 comments on commit 6d2f660

Please sign in to comment.