CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PCLMetadataWriter.cc
Go to the documentation of this file.
1 
2 /*
3  * See header file for a description of this class.
4  *
5  * $Date: 2011/03/03 09:32:46 $
6  * $Revision: 1.2 $
7  * \author G. Cerminara - CERN
8  */
9 
11 
13 
21 
22 
23 using namespace std;
24 using namespace edm;
25 
27 
28  readFromDB = pSet.getParameter<bool>("readFromDB");
29 
30 
31  vector<ParameterSet> recordsToMap = pSet.getParameter<vector<ParameterSet> >("recordsToMap");
32  for(vector<ParameterSet>::const_iterator recordPset = recordsToMap.begin();
33  recordPset != recordsToMap.end();
34  ++recordPset) {
35 
36  string record = (*recordPset).getUntrackedParameter<string>("record");
37  map<string, string> jrInfo;
38  if(!readFromDB) {
39  vector<string> paramKeys = (*recordPset).getParameterNames();
40  for(vector<string>::const_iterator key = paramKeys.begin();
41  key != paramKeys.end();
42  ++key) {
43  jrInfo["Source"] = "AlcaHarvesting";
44  jrInfo["FileClass"] = "ALCA";
45  if(*key != "record") {
46  jrInfo[*key] = (*recordPset).getUntrackedParameter<string>(*key);
47  }
48  }
49  }
50  recordMap[record] = jrInfo;
51 
52  }
53 
54 }
55 
57 
58 
60 
61 
63 
65 
66  const DropBoxMetadata *metadata = 0;
67 
68  if(readFromDB) {
69  // Read the objects
71  eSetup.get<DropBoxMetadataRcd>().get(mdPayload);
72 
73  metadata = mdPayload.product();
74  }
75 
76  // get the PoolDBOutputService
78  if(poolDbService.isAvailable() ) {
80  if (jr.isAvailable()) {
81  // the filename is unique for all records
82  string filename = poolDbService->session().connectionString();
83 
84  // loop over all records
85  for(map<string, map<string, string> >::const_iterator recordAndMap = recordMap.begin();
86  recordAndMap != recordMap.end();
87  ++recordAndMap) {
88 
89  string record = (*recordAndMap).first;
90  // this is the map of metadata that we write in the JR
91  map<string, string> jrInfo = (*recordAndMap).second;
92  if(readFromDB) {
93  if(metadata->knowsRecord(record)) {
94  jrInfo = metadata->getRecordParameters(record).getParameterMap();
95  }
96  }
97  jrInfo["inputtag"] = poolDbService->tag(record);
98 
99 
100  // actually write in the job report
101  jr->reportAnalysisFile(filename, jrInfo);
102  }
103  }
104  }
105 }
106 
107 
T getParameter(std::string const &) const
const std::string & connectionString() const
Definition: DbSession.cc:169
PCLMetadataWriter(const edm::ParameterSet &)
Constructor.
JetCorrectorParameters::Record record
Definition: classes.h:11
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
bool knowsRecord(const std::string &record) const
void reportAnalysisFile(std::string const &fileName, std::map< std::string, std::string > const &fileData)
Definition: JobReport.cc:685
std::string tag(const std::string &recordName)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
const std::map< std::string, std::string > & getParameterMap() const
virtual void endRun(const edm::Run &, const edm::EventSetup &)
bool isAvailable() const
Definition: Service.h:47
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
virtual ~PCLMetadataWriter()
Destructor.
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
list key
Definition: combine.py:13
tuple filename
Definition: lut2db_cfg.py:20
const Parameters & getRecordParameters(const std::string &record) const
Definition: Run.h:33