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::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 
 PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL (const edm::ParameterSet &)
 
 ~PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL () 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
 
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
 
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 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
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>
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)
 
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 15 of file PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL.cc.

Constructor & Destructor Documentation

◆ PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL()

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

Definition at line 28 of file PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL.cc.

29  {
30  inputTxtFile = p.getUntrackedParameter<std::string>("inputTxtFile");
31  rec1 = p.getUntrackedParameter<std::string>("RecordPayload");
32  rec2 = p.getUntrackedParameter<std::string>("RecordWP");
33 }

References inputTxtFile, AlCaHLTBitMon_ParallelJobs::p, rec1, rec2, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~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 ( const edm::Event ,
const edm::EventSetup  
)
inlineoverridevirtual

Implements edm::EDAnalyzer.

Definition at line 19 of file PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL.cc.

19 {}

◆ beginJob()

void PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL::beginJob ( void  )
overridevirtual

JUST A STUPID PATCH

Reimplemented from edm::EDAnalyzer.

Definition at line 35 of file PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL.cc.

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  std::cout << "WP Tagger is " << tagger << std::endl;
63 
64  in >> cut;
65  std::cout << "WP Cut is " << cut << std::endl;
66 
67  in >> concreteType;
68  std::cout << "concrete Type is " << concreteType << std::endl;
69 
70  int nres = 0, nvar = 0;
71 
72  in >> nres;
73  in >> nvar;
74 
75  std::cout << "Using " << nres << " results and " << nvar << " variables" << std::endl;
76 
77  unsigned int bins = 0; //temporary for now!!!!!!
78 
79  in >> bins;
80 
81  std::cout << "Using " << bins << " bins" << std::endl;
82 
83  int number = 0;
84  ;
85 
86  std::vector<PerformanceResult::ResultType> res;
87  std::vector<BinningVariables::BinningVariablesType> bin;
88  //
89  // read results
90  //
91  number = 0;
92  while (number < nres && !in.eof()) {
93  int tmp;
94  in >> tmp;
96  std::cout << " Result #" << number << " is " << tmp << std::endl;
97  ;
98  number++;
99  }
100  if (number != nres) {
101  std::cout << " Table not well formed" << std::endl;
102  }
103 
104  //
105  // read the variables
106  //
107 
109  PerformancePayloadFromBinnedTFormula* btagpl = nullptr;
110 
111  std::vector<PhysicsTFormulaPayload> v_ppl;
112 
113  number = 0;
114  while (number < nvar && !in.eof()) {
115  int tmp;
116  in >> tmp;
118  std::cout << " Variable #" << number << " is " << tmp << std::endl;
119  ;
120  number++;
121  }
122  if (number != nvar) {
123  std::cout << " Table not well formed" << std::endl;
124  }
125 
126  //
127  // now read the formulas
128  //
129 
130  for (unsigned int recregion = 0; recregion < bins; ++recregion) {
131  std::vector<std::pair<float, float> > limits;
132  std::vector<std::string> formulas;
133 
134  number = 0;
135 
136  while (number < nres && (!in.eof())) {
138  in >> temp;
139  std::cout << " Inserting " << temp << " as formula in position " << number << std::endl;
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  std::cout << " Inserting " << temp1 << "," << temp2 << " as limits in position " << number << std::endl;
156  number++;
157  limits.push_back(std::pair<float, float>(temp1, temp2));
158  }
159  /*
160  if (nvar != number ){
161  std::cout <<" NOT OK, this is not what I would expect"<<std::endl;
162  abort();
163  }
164  */
165 
166  //
167  // push it
168  //
169 
170  PhysicsTFormulaPayload ppl(limits, formulas);
171  v_ppl.push_back(ppl);
172  }
173  in.close();
174 
175  if (concreteType == "PerformancePayloadFromBinnedTFormula") {
176  btagpl = new PerformancePayloadFromBinnedTFormula(res, bin, v_ppl);
177  std::cout << " CHECK: " << btagpl->formulaPayloads().size() << std::endl;
178  } else {
179  std::cout << " Non existing request: " << concreteType << std::endl;
180  }
181 
182  std::cout << " Created the " << concreteType << " object" << std::endl;
183 
184  std::cout << "Start writing the payload" << std::endl;
186  if (s.isAvailable()) {
187  if (s->isNewTagRequest(rec1)) {
188  s->createNewIOV<PerformancePayload>(btagpl, s->beginOfTime(), s->endOfTime(), rec1);
189  } else {
190  s->appendSinceTime<PerformancePayload>(btagpl,
191  // JUST A STUPID PATCH
192  111,
193  rec1);
194  }
195  }
196  std::cout << "Finised writing the payload" << std::endl;
197 
198  // write also the WP
199  std::cout << "Start writing the WP" << std::endl;
200  if (s.isAvailable()) {
201  if (s->isNewTagRequest(rec2)) {
202  s->createNewIOV<PerformanceWorkingPoint>(wp, s->beginOfTime(), s->endOfTime(), rec2);
203  } else {
204  s->appendSinceTime<PerformanceWorkingPoint>(wp,
206  111,
207  rec2);
208  }
209  }
210  std::cout << "Finished writing the WP" << std::endl;
211 }

References newFWLiteAna::bin, trigObjTnPSource_cfi::bins, gather_cfg::cout, TkAlMuonSelectors_cfi::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.

◆ endJob()

void PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL::endJob ( void  )
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

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
PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL::rec2
std::string rec2
Definition: PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL.cc:25
PerformancePayloadFromBinnedTFormula::formulaPayloads
const std::vector< PhysicsTFormulaPayload > & formulaPayloads() const
Definition: PerformancePayloadFromBinnedTFormula.h:43
TkAlMuonSelectors_cfi.cut
cut
Definition: TkAlMuonSelectors_cfi.py:5
PerformanceWorkingPoint
Definition: PerformanceWorkingPoint.h:8
pfClustersFromHGC3DClusters_cfi.wp
wp
Definition: pfClustersFromHGC3DClusters_cfi.py:30
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
gather_cfg.cout
cout
Definition: gather_cfg.py:144
PhysicsTFormulaPayload
Definition: PhysicsTFormulaPayload.h:9
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
alignCSCRings.s
s
Definition: alignCSCRings.py:92
contentValuesFiles.number
number
Definition: contentValuesFiles.py:53
PerformancePayload
Definition: PerformancePayload.h:14
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PerformanceResult::ResultType
ResultType
Definition: PerformanceResult.h:8
PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL::rec1
std::string rec1
Definition: PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL.cc:25
recoMuon::in
Definition: RecoMuonEnumerators.h:6
edm::Service< cond::service::PoolDBOutputService >
res
Definition: Electron.h:6
PerformancePayloadFromBinnedTFormula
Definition: PerformancePayloadFromBinnedTFormula.h:17
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
TH2PolyOfflineMaps.limits
limits
Definition: TH2PolyOfflineMaps.py:45
PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL::inputTxtFile
std::string inputTxtFile
Definition: PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL.cc:24
trigObjTnPSource_cfi.bins
bins
Definition: trigObjTnPSource_cfi.py:20
BinningVariables::BinningVariablesType
BinningVariablesType
Definition: BinningVariables.h:10