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 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 15 of file PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL.cc.

Constructor & Destructor Documentation

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

Definition at line 21 of file PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL.cc.

21 {}

Member Function Documentation

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

Definition at line 19 of file PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL.cc.

19 {}
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.

References cond::service::PoolDBOutputService::appendSinceTime(), cond::service::PoolDBOutputService::beginOfTime(), newFWLiteAna::bin, trigObjTnPSource_cfi::bins, gather_cfg::cout, cond::service::PoolDBOutputService::createNewIOV(), TkAlMuonSelectors_cfi::cut, DEFINE_FWK_MODULE, cond::service::PoolDBOutputService::endOfTime(), PerformancePayloadFromBinnedTFormula::formulaPayloads(), recoMuon::in, inputTxtFile, edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), TH2PolyOfflineMaps::limits, contentValuesFiles::number, rec1, rec2, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, and createJobs::tmp.

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;
95  res.push_back((PerformanceResult::ResultType)(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 
108  PerformanceWorkingPoint* wp = new PerformanceWorkingPoint(cut, tagger);
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;
117  bin.push_back((BinningVariables::BinningVariablesType)(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 {
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)) {
203  } else {
206  111,
207  rec2);
208  }
209  }
210  std::cout << "Finished writing the WP" << std::endl;
211 }
Definition: Electron.h:6
const std::vector< PhysicsTFormulaPayload > & formulaPayloads() const
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
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

std::string PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL::inputTxtFile
private
std::string PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL::rec1
private
std::string PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL::rec2
private