CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob () override
 
virtual void endJob () override
 
 PhysicsPerformanceDBWriterFromFile_WPandPayload (const edm::ParameterSet &)
 
 ~PhysicsPerformanceDBWriterFromFile_WPandPayload ()
 
- 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
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- 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.cc.

Constructor & Destructor Documentation

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

Definition at line 24 of file PhysicsPerformanceDBWriterFromFile_WPandPayload.cc.

24 {}

Member Function Documentation

virtual void PhysicsPerformanceDBWriterFromFile_WPandPayload::analyze ( const edm::Event ,
const edm::EventSetup  
)
inlineoverridevirtual

Implements edm::EDAnalyzer.

Definition at line 22 of file PhysicsPerformanceDBWriterFromFile_WPandPayload.cc.

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

JUST A STUPID PATCH

Reimplemented from edm::EDAnalyzer.

Definition at line 39 of file PhysicsPerformanceDBWriterFromFile_WPandPayload.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 23 of file PhysicsPerformanceDBWriterFromFile_WPandPayload.cc.

23 {}

Member Data Documentation

std::string PhysicsPerformanceDBWriterFromFile_WPandPayload::inputTxtFile
private

Definition at line 27 of file PhysicsPerformanceDBWriterFromFile_WPandPayload.cc.

Referenced by beginJob().

std::string PhysicsPerformanceDBWriterFromFile_WPandPayload::rec1
private

Definition at line 28 of file PhysicsPerformanceDBWriterFromFile_WPandPayload.cc.

Referenced by beginJob().

std::string PhysicsPerformanceDBWriterFromFile_WPandPayload::rec2
private

Definition at line 28 of file PhysicsPerformanceDBWriterFromFile_WPandPayload.cc.

Referenced by beginJob().