CMS 3D CMS Logo

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

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 
 PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV (const edm::ParameterSet &)
 
 ~PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
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
 
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)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

std::string inputTxtFile
 
unsigned long long iovBegin
 
unsigned long long iovEnd
 
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 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 17 of file PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV.cc.

Constructor & Destructor Documentation

PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV::PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV ( const edm::ParameterSet p)

Definition at line 33 of file PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), inputTxtFile, iovBegin, iovEnd, rec1, rec2, and AlCaHLTBitMon_QueryRunRegistry::string.

PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV::~PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV ( )
inlineoverride

Definition at line 24 of file PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV.cc.

24 {}

Member Function Documentation

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

Definition at line 22 of file PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV.cc.

22 {}
void PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV::beginJob ( void  )
overridevirtual

JUST A STUPID PATCH

Reimplemented from edm::EDAnalyzer.

Definition at line 42 of file PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV.cc.

References cond::service::PoolDBOutputService::appendSinceTime(), stringResolutionProvider_cfi::bin, comment, gather_cfg::cout, cond::service::PoolDBOutputService::createNewIOV(), TkAlMuonSelectors_cfi::cut, DEFINE_FWK_MODULE, recoMuon::in, inputTxtFile, iovBegin, iovEnd, edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), rec1, rec2, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, and tmp.

43 {
44  //
45  // read object from file
46  //
47 
48  //
49  // File Format is
50  // - tagger name
51  // - cut
52  // - concrete class name
53  // - how many results and how many binning
54  // - their values
55  // - vector<float>
56  //
57 
58  std::ifstream in;
59  in.open(inputTxtFile.c_str());
60  std::string tagger;
61  float cut;
62 
63  std::string concreteType;
65  std::vector<float> pl;
66  int stride;
67 
68  in >> tagger;
69  std::cout << "WP Tagger is "<<tagger<<std::endl;
70 
71  in >> cut;
72  std::cout << "WP Cut is "<<cut<<std::endl;
73 
74  in >> concreteType;
75  std::cout << "concrete Type is "<<concreteType<<std::endl;
76 
77  // return ;
78 
79  // read # of results
80 
81  int nres, nbin;
82  in >> nres;
83  in >> nbin;
84  std::cout <<" Results: " << nres<<" Binning variables: "<<nbin<<std::endl;
85 
86  stride = nres+nbin*2;
87 
88  int number=0;
89 
90  std::vector<PerformanceResult::ResultType> res;
91  std::vector<BinningVariables::BinningVariablesType> bin;
92 
93  while (number<nres && !in.eof()) {
94  int tmp;
95  in>> tmp;
96  res.push_back((PerformanceResult::ResultType)(tmp));
97  number++;
98  }
99  if (number != nres){
100  std::cout <<" Table not well formed"<<std::endl;
101  }
102  number=0;
103  while (number<nbin && !in.eof()) {
104  int tmp;
105  in>> tmp;
106  bin.push_back((BinningVariables::BinningVariablesType)(tmp));
107  number++;
108  }
109  if (number != nbin){
110  std::cout <<" Table not well formed"<<std::endl;
111  }
112 
113  number=0;
114  while (!in.eof()){
115  float temp;
116  in >> temp;
117  std::cout <<" Inserting "<<temp<< " in position "<<number<<std::endl;
118  number++;
119  pl.push_back(temp);
120  }
121 
122  //
123  // CHECKS
124  //
125  if (stride != nbin*2+nres){
126  std::cout <<" Table not well formed"<<std::endl;
127  }
128  if (stride != 0 && (number % stride) != 0){
129  std::cout <<" Table not well formed"<<std::endl;
130  }
131 
132  in.close();
133 
134 
135  /* for (int k=0;k<(number/stride); k++){
136  for (int j=0; j<stride; j++){
137  std::cout << "Pos["<<k<<","<<j<<"] = "<<pl[k*stride+j]<<std::endl;
138  }
139  }
140  */
141 
142  //
143  // now create pl etc etc
144  //
145 
146  PerformanceWorkingPoint * wp = new PerformanceWorkingPoint(cut, tagger);
147 
148  PerformancePayloadFromTable * btagpl = nullptr;
149 
150  if (concreteType == "PerformancePayloadFromTable"){
151  btagpl = new PerformancePayloadFromTable(res, bin, stride, pl);
152  }else{
153  std::cout <<" Non existing request: " <<concreteType<<std::endl;
154  }
155 
156  std::cout <<" Created the "<<concreteType <<" object"<<std::endl;
157 
159  if (s.isAvailable())
160  {
161  if (s->isNewTagRequest(rec1))
162  {
163  s->createNewIOV<PerformancePayload>(btagpl,
164  // s->beginOfTime(),
165  // s->endOfTime(),
166  iovBegin,
167  iovEnd,
168  rec1);
169  }
170  else
171  {
172 
174  // JUST A STUPID PATCH
175  // 111,
176  iovBegin,
177  rec1);
178  }
179  }
180 
181  // write also the WP
182 
183  if (s.isAvailable())
184  {
185  if (s->isNewTagRequest(rec2))
186  {
188  // s->beginOfTime(),
189  // s->endOfTime(),
190  iovBegin,
191  iovEnd,
192  rec2);
193  }
194  else
195  {
196 
199  // 111,
200  iovBegin,
201  rec2);
202  }
203  }
204 
205 
206 
207 }
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:46
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
bin
set the eta bin as selection string.
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
#define comment(par)
Definition: vmac.h:163
void PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV::endJob ( void  )
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 23 of file PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV.cc.

23 {}

Member Data Documentation

std::string PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV::inputTxtFile
private
unsigned long long PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV::iovBegin
private
unsigned long long PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV::iovEnd
private
std::string PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV::rec1
private
std::string PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV::rec2
private