CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL Class Reference
Inheritance diagram for PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL:
edm::global::EDAnalyzer<> edm::global::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (edm::StreamID, const edm::Event &, const edm::EventSetup &) const override
 
void beginJob () override
 
void endJob () override
 
 PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL (const edm::ParameterSet &)
 
 ~PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL () override
 
- Public Member Functions inherited from edm::global::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDAnalyzerBase () 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
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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::global::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 15 of file PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL.cc.

Constructor & Destructor Documentation

◆ PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL()

PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL::PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL ( const edm::ParameterSet p)

◆ ~PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL()

PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL::~PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL ( )
inlineoverride

Definition at line 21 of file PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL.cc.

21 {}

Member Function Documentation

◆ analyze()

void PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL::analyze ( edm::StreamID  ,
const edm::Event ,
const edm::EventSetup  
) const
inlineoverridevirtual

◆ beginJob()

void PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL::beginJob ( void  )
overridevirtual

Reimplemented from edm::global::EDAnalyzerBase.

Definition at line 35 of file PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL.cc.

References newFWLiteAna::bin, trigObjTnPSource_cfi::bins, DMR_cfg::cut, PerformancePayloadFromBinnedTFormula::formulaPayloads(), recoMuon::in, inputTxtFile, TH2PolyOfflineMaps::limits, contentValuesFiles::number, rec1, rec2, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, createJobs::tmp, and pfClustersFromHGC3DClusters_cfi::wp.

35  {
36  //
37  // read object from file
38  //
39 
40  //
41  // File Format is
42  // - tagger name
43  // - cut
44  // - concrete class name
45  // number of results (btageff, btagSF....)
46  // number of binning variables in the parameterization (eta, pt ...)
47  // number of bins
48  // - results (as ints)
49  // - variables (as ints)
50  // - formulas
51  // - the limits
52  //
53 
54  std::ifstream in;
55  in.open(inputTxtFile.c_str());
56  std::string tagger;
57  float cut;
58 
59  std::string concreteType;
60 
61  in >> tagger;
62  edm::LogInfo("PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL") << "WP Tagger is " << tagger;
63 
64  in >> cut;
65  edm::LogInfo("PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL") << "WP Cut is " << cut;
66 
67  in >> concreteType;
68  edm::LogInfo("PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL") << "concrete Type is " << concreteType;
69 
70  int nres = 0, nvar = 0;
71 
72  in >> nres;
73  in >> nvar;
74 
75  edm::LogInfo("PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL")
76  << "Using " << nres << " results and " << nvar << " variables";
77 
78  unsigned int bins = 0; //temporary for now!!!!!!
79 
80  in >> bins;
81 
82  edm::LogInfo("PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL") << "Using " << bins << " bins";
83 
84  int number = 0;
85  ;
86 
87  std::vector<PerformanceResult::ResultType> res;
88  std::vector<BinningVariables::BinningVariablesType> bin;
89  //
90  // read results
91  //
92  number = 0;
93  while (number < nres && !in.eof()) {
94  int tmp;
95  in >> tmp;
97  edm::LogInfo("PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL") << " Result #" << number << " is " << tmp;
98  number++;
99  }
100  if (number != nres) {
101  edm::LogInfo("PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL") << " Table not well formed";
102  }
103 
104  //
105  // read the variables
106  //
107 
108  PerformanceWorkingPoint wp(cut, tagger);
110 
111  std::vector<PhysicsTFormulaPayload> v_ppl;
112 
113  number = 0;
114  while (number < nvar && !in.eof()) {
115  int tmp;
116  in >> tmp;
118  edm::LogInfo("PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL") << " Variable #" << number << " is " << tmp;
119  number++;
120  }
121  if (number != nvar) {
122  edm::LogInfo("PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL") << " Table not well formed";
123  }
124 
125  //
126  // now read the formulas
127  //
128 
129  for (unsigned int recregion = 0; recregion < bins; ++recregion) {
130  std::vector<std::pair<float, float> > limits;
131  std::vector<std::string> formulas;
132 
133  number = 0;
134 
135  while (number < nres && (!in.eof())) {
137  in >> temp;
138  edm::LogInfo("PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL")
139  << " Inserting " << temp << " as formula in position " << number;
140  number++;
141  formulas.push_back(temp);
142  }
143  /*
144  if (nres!= number ){
145  std::cout <<" NOT OK, this is not what I would expect"<<std::endl;
146  abort();
147  }
148  */
149 
150  number = 0;
151  while (number < nvar && (!in.eof())) {
152  float temp1, temp2;
153  in >> temp1;
154  in >> temp2;
155  edm::LogInfo("PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL")
156  << " Inserting " << temp1 << "," << temp2 << " as limits in position " << number;
157  number++;
158  limits.push_back(std::pair<float, float>(temp1, temp2));
159  }
160  /*
161  if (nvar != number ){
162  std::cout <<" NOT OK, this is not what I would expect"<<std::endl;
163  abort();
164  }
165  */
166 
167  //
168  // push it
169  //
170 
171  PhysicsTFormulaPayload ppl(limits, formulas);
172  v_ppl.push_back(ppl);
173  }
174  in.close();
175 
176  if (concreteType == "PerformancePayloadFromBinnedTFormula") {
177  btagpl = PerformancePayloadFromBinnedTFormula(res, bin, v_ppl);
178  edm::LogInfo("PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL")
179  << " CHECK: " << btagpl.formulaPayloads().size();
180  } else {
181  edm::LogInfo("PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL") << " Non existing request: " << concreteType;
182  }
183 
184  edm::LogInfo("PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL") << " Created the " << concreteType << " object";
185 
186  edm::LogInfo("PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL") << "Start writing the payload and WP";
188  if (s.isAvailable()) {
189  s->writeOneIOV(btagpl, s->beginOfTime(), rec1);
190  // write also the WP
191  s->writeOneIOV(wp, s->beginOfTime(), rec2);
192  }
193 
194  edm::LogInfo("PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL") << "Finised writing the payload and WP";
195 }
Definition: Electron.h:6
const std::vector< PhysicsTFormulaPayload > & formulaPayloads() const
Log< level::Info, false > LogInfo
tmp
align.sh
Definition: createJobs.py:716

◆ endJob()

void PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL::endJob ( void  )
inlineoverridevirtual

Reimplemented from edm::global::EDAnalyzerBase.

Definition at line 20 of file PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL.cc.

20 {}

Member Data Documentation

◆ inputTxtFile

std::string PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL::inputTxtFile
private

◆ rec1

std::string PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL::rec1
private

◆ rec2

std::string PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL::rec2
private