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  * \author G. Cerminara - CERN
6  */
7 
9 
11 
19 
20 
21 using namespace std;
22 using namespace edm;
23 
25 
26  readFromDB = pSet.getParameter<bool>("readFromDB");
27 
28 
29  vector<ParameterSet> recordsToMap = pSet.getParameter<vector<ParameterSet> >("recordsToMap");
30  for(vector<ParameterSet>::const_iterator recordPset = recordsToMap.begin();
31  recordPset != recordsToMap.end();
32  ++recordPset) {
33 
34  string record = (*recordPset).getUntrackedParameter<string>("record");
35  map<string, string> jrInfo;
36  if(!readFromDB) {
37  vector<string> paramKeys = (*recordPset).getParameterNames();
38  for(vector<string>::const_iterator key = paramKeys.begin();
39  key != paramKeys.end();
40  ++key) {
41  jrInfo["Source"] = "AlcaHarvesting";
42  jrInfo["FileClass"] = "ALCA";
43  if(*key != "record") {
44  jrInfo[*key] = (*recordPset).getUntrackedParameter<string>(*key);
45  }
46  }
47  }
48  recordMap[record] = jrInfo;
49 
50  }
51 
52 }
53 
55 
56 
58 
59 
61 
63 
64  const DropBoxMetadata *metadata = 0;
65 
66  if(readFromDB) {
67  // Read the objects
69  eSetup.get<DropBoxMetadataRcd>().get(mdPayload);
70 
71  metadata = mdPayload.product();
72  }
73 
74  // get the PoolDBOutputService
76  if(poolDbService.isAvailable() ) {
78  if (jr.isAvailable()) {
79  // the filename is unique for all records
80  string filename = poolDbService->session().connectionString();
81 
82  // loop over all records
83  for(map<string, map<string, string> >::const_iterator recordAndMap = recordMap.begin();
84  recordAndMap != recordMap.end();
85  ++recordAndMap) {
86 
87  string record = (*recordAndMap).first;
88  // this is the map of metadata that we write in the JR
89  map<string, string> jrInfo = (*recordAndMap).second;
90  if(readFromDB) {
91  if(metadata->knowsRecord(record)) {
92  jrInfo = metadata->getRecordParameters(record).getParameterMap();
93  }
94  }
95  jrInfo["inputtag"] = poolDbService->tag(record);
96 
97 
98  // actually write in the job report
99  jr->reportAnalysisFile(filename, jrInfo);
100  }
101  }
102  }
103 }
104 
105 
T getParameter(std::string const &) const
PCLMetadataWriter(const edm::ParameterSet &)
Constructor.
JetCorrectorParameters::Record record
Definition: classes.h:7
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
bool knowsRecord(const std::string &record) const
cond::persistency::Session session() const
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:46
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
std::string connectionString()
Definition: Session.cc:203
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
virtual ~PCLMetadataWriter()
Destructor.
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
void reportAnalysisFile(std::string const &fileName, std::map< std::string, std::string > const &fileData)
Definition: JobReport.cc:559
tuple filename
Definition: lut2db_cfg.py:20
const Parameters & getRecordParameters(const std::string &record) const
Definition: Run.h:43