CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PhysicsPerformanceDBWriterFromFile_WPandPayload Class Reference
Inheritance diagram for PhysicsPerformanceDBWriterFromFile_WPandPayload:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 
 PhysicsPerformanceDBWriterFromFile_WPandPayload (const edm::ParameterSet &)
 
 ~PhysicsPerformanceDBWriterFromFile_WPandPayload () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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 Attributes

std::string inputTxtFile
 
std::string rec1
 
std::string rec2
 

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 wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 16 of file PhysicsPerformanceDBWriterFromFile_WPandPayload.cc.

Constructor & Destructor Documentation

PhysicsPerformanceDBWriterFromFile_WPandPayload::PhysicsPerformanceDBWriterFromFile_WPandPayload ( const edm::ParameterSet p)
PhysicsPerformanceDBWriterFromFile_WPandPayload::~PhysicsPerformanceDBWriterFromFile_WPandPayload ( )
inlineoverride

Definition at line 22 of file PhysicsPerformanceDBWriterFromFile_WPandPayload.cc.

22 {}

Member Function Documentation

void PhysicsPerformanceDBWriterFromFile_WPandPayload::analyze ( const edm::Event ,
const edm::EventSetup  
)
inlineoverride

Definition at line 20 of file PhysicsPerformanceDBWriterFromFile_WPandPayload.cc.

20 {}
void PhysicsPerformanceDBWriterFromFile_WPandPayload::beginJob ( void  )
overridevirtual

JUST A STUPID PATCH

Reimplemented from edm::EDAnalyzer.

Definition at line 36 of file PhysicsPerformanceDBWriterFromFile_WPandPayload.cc.

References cond::service::PoolDBOutputService::appendSinceTime(), cond::service::PoolDBOutputService::beginOfTime(), newFWLiteAna::bin, comment, gather_cfg::cout, cond::service::PoolDBOutputService::createNewIOV(), TkAlMuonSelectors_cfi::cut, DEFINE_FWK_MODULE, cond::service::PoolDBOutputService::endOfTime(), beamvalidation::exit(), recoMuon::in, inputTxtFile, edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), ZMuMuCategoriesSequences_cff::nbin, contentValuesFiles::number, rec1, rec2, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, and createJobs::tmp.

36  {
37  //
38  // read object from file
39  //
40 
41  //
42  // File Format is
43  // - tagger name
44  // - cut
45  // - concrete class name
46  // - how many results and how many binning
47  // - their values
48  // - vector<float>
49  //
50 
51  std::ifstream in;
52  std::cout << "Opening " << inputTxtFile << std::endl;
53  in.open(inputTxtFile.c_str());
54  std::string tagger;
55  float cut;
56 
57  std::string concreteType;
59  std::vector<float> pl;
60  int stride;
61 
62  in >> tagger;
63  std::cout << "WP Tagger is " << tagger << std::endl;
64 
65  in >> cut;
66  std::cout << "WP Cut is " << cut << std::endl;
67 
68  in >> concreteType;
69  std::cout << "concrete Type is " << concreteType << std::endl;
70 
71  // return ;
72 
73  // read # of results
74 
75  int nres, nbin;
76  in >> nres;
77  in >> nbin;
78  std::cout << " Results: " << nres << " Binning variables: " << nbin << std::endl;
79 
80  stride = nres + nbin * 2;
81  if (!stride) {
82  std::cout << " Malformed input file" << std::endl;
83  exit(1);
84  }
85 
86  int number = 0;
87 
88  std::vector<PerformanceResult::ResultType> res;
89  std::vector<BinningVariables::BinningVariablesType> bin;
90 
91  while (number < nres && !in.eof()) {
92  int tmp;
93  in >> tmp;
94  res.push_back((PerformanceResult::ResultType)(tmp));
95  number++;
96  }
97  if (number != nres) {
98  std::cout << " Table not well formed" << std::endl;
99  }
100  number = 0;
101  while (number < nbin && !in.eof()) {
102  int tmp;
103  in >> tmp;
104  bin.push_back((BinningVariables::BinningVariablesType)(tmp));
105  number++;
106  }
107  if (number != nbin) {
108  std::cout << " Table not well formed" << std::endl;
109  }
110 
111  number = 0;
112  while (!in.eof()) {
113  float temp;
114  in >> temp;
115  std::cout << " Intersing " << temp << " in position " << number << std::endl;
116  number++;
117  pl.push_back(temp);
118  }
119 
120  //
121  // CHECKS
122  //
123  if (stride != nbin * 2 + nres) {
124  std::cout << " Table not well formed" << std::endl;
125  }
126  if ((number % stride) != 0) {
127  std::cout << " Table not well formed" << std::endl;
128  }
129 
130  std::cout << " CLOSING " << std::endl;
131  in.close();
132 
133  /* for (int k=0;k<(number/stride); k++){
134  for (int j=0; j<stride; j++){
135  std::cout << "Pos["<<k<<","<<j<<"] = "<<pl[k*stride+j]<<std::endl;
136  }
137  }
138  */
139 
140  //
141  // now create pl etc etc
142  //
143 
144  PerformanceWorkingPoint* wp = new PerformanceWorkingPoint(cut, tagger);
145 
146  PerformancePayloadFromTable* btagpl = nullptr;
147 
148  if (concreteType == "PerformancePayloadFromTable") {
149  btagpl = new PerformancePayloadFromTable(res, bin, stride, pl);
150  } else {
151  std::cout << " Non existing request: " << concreteType << std::endl;
152  }
153 
154  std::cout << " Created the " << concreteType << " object" << std::endl;
155 
157  if (s.isAvailable()) {
158  if (s->isNewTagRequest(rec1)) {
159  s->createNewIOV<PerformancePayload>(btagpl, s->beginOfTime(), s->endOfTime(), rec1);
160  } else {
162  // JUST A STUPID PATCH
163  111,
164  rec1);
165  }
166  }
167 
168  // write also the WP
169 
170  if (s.isAvailable()) {
171  if (s->isNewTagRequest(rec2)) {
173  } else {
176  111,
177  rec2);
178  }
179  }
180 }
Definition: Electron.h:6
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:40
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
tmp
align.sh
Definition: createJobs.py:716
def exit(msg="")
#define comment(par)
Definition: vmac.h:163
void PhysicsPerformanceDBWriterFromFile_WPandPayload::endJob ( void  )
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 21 of file PhysicsPerformanceDBWriterFromFile_WPandPayload.cc.

21 {}

Member Data Documentation

std::string PhysicsPerformanceDBWriterFromFile_WPandPayload::inputTxtFile
private
std::string PhysicsPerformanceDBWriterFromFile_WPandPayload::rec1
private
std::string PhysicsPerformanceDBWriterFromFile_WPandPayload::rec2
private