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

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void endJob ()
 
 PhysicsPerformanceDBWriterFromFile_WPandPayload (const edm::ParameterSet &)
 
 ~PhysicsPerformanceDBWriterFromFile_WPandPayload ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

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  
)
inlinevirtual

Implements edm::EDAnalyzer.

Definition at line 22 of file PhysicsPerformanceDBWriterFromFile_WPandPayload.cc.

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

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(), recoMuon::in, inputTxtFile, edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), rec1, rec2, alignCSCRings::s, 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;
62  std::string comment;
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 
86  int number=0;
87 
88  std::vector<PerformanceResult::ResultType> res;
89  std::vector<BinningVariables::BinningVariablesType> bin;
90 
91  while (number<nres && !in.eof()) {
92  int tmp;
93  in>> tmp;
94  res.push_back((PerformanceResult::ResultType)(tmp));
95  number++;
96  }
97  if (number != nres){
98  std::cout <<" Table not well formed"<<std::endl;
99  }
100  number=0;
101  while (number<nbin && !in.eof()) {
102  int tmp;
103  in>> tmp;
104  bin.push_back((BinningVariables::BinningVariablesType)(tmp));
105  number++;
106  }
107  if (number != nbin){
108  std::cout <<" Table not well formed"<<std::endl;
109  }
110 
111  number=0;
112  while (!in.eof()){
113  float temp;
114  in >> temp;
115  std::cout <<" Intersing "<<temp<< " in position "<<number<<std::endl;
116  number++;
117  pl.push_back(temp);
118  }
119 
120  //
121  // CHECKS
122  //
123  if (stride != nbin*2+nres){
124  std::cout <<" Table not well formed"<<std::endl;
125  }
126  if ((number % stride) != 0){
127  std::cout <<" Table not well formed"<<std::endl;
128  }
129 
130  std::cout <<" CLOSING "<<std::endl;
131  in.close();
132 
133 
134  /* for (int k=0;k<(number/stride); k++){
135  for (int j=0; j<stride; j++){
136  std::cout << "Pos["<<k<<","<<j<<"] = "<<pl[k*stride+j]<<std::endl;
137  }
138  }
139  */
140 
141  //
142  // now create pl etc etc
143  //
144 
145  PerformanceWorkingPoint * wp = new PerformanceWorkingPoint(cut, tagger);
146 
147  PerformancePayloadFromTable * btagpl = 0;
148 
149  if (concreteType == "PerformancePayloadFromTable"){
150  btagpl = new PerformancePayloadFromTable(res, bin, stride, pl);
151  }else{
152  std::cout <<" Non existing request: " <<concreteType<<std::endl;
153  }
154 
155  std::cout <<" Created the "<<concreteType <<" object"<<std::endl;
156 
158  if (s.isAvailable())
159  {
160  if (s->isNewTagRequest(rec1))
161  {
162  s->createNewIOV<PerformancePayload>(btagpl,
163  s->beginOfTime(),
164  s->endOfTime(),
165  rec1);
166  }
167  else
168  {
169 
171  // JUST A STUPID PATCH
172  111,
173  rec1);
174  }
175  }
176 
177  // write also the WP
178 
179  if (s.isAvailable())
180  {
181  if (s->isNewTagRequest(rec2))
182  {
184  s->beginOfTime(),
185  s->endOfTime(),
186  rec2);
187  }
188  else
189  {
190 
193  111,
194  rec2);
195  }
196  }
197 
198 
199 
200 }
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:47
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:162
virtual void PhysicsPerformanceDBWriterFromFile_WPandPayload::endJob ( void  )
inlinevirtual

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().