CMS 3D CMS Logo

MillePedeFileConverter.cc
Go to the documentation of this file.
1 // Original Author: Broen van Besien
2 // Created: Thu, 19 Mar 2015 18:12:35 GMT
3 
6 
9 
10 #include <memory>
11 #include <fstream>
12 
14  : inputDir_(iConfig.getParameter<std::string>("fileDir")),
15  inputFileName_(iConfig.getParameter<std::string>("inputBinaryFile")),
16  fileBlobLabel_(iConfig.getParameter<std::string>("fileBlobLabel")) {
17  // We define what this producer produces: A FileBlobCollection
18  produces<FileBlobCollection, edm::Transition::EndLuminosityBlock>(fileBlobLabel_);
19 }
20 
22 
24  edm::LogInfo("MillePedeFileActions") << "Inserting all data from file " << inputDir_ + inputFileName_
25  << " as a FileBlob to the lumi, using label \"" << fileBlobLabel_ << "\".";
26  // Preparing the FileBlobCollection:
27  auto fileBlobCollection = std::make_unique<FileBlobCollection>();
28 
29  // Creating the FileBlob:
30  // (The FileBlob will signal problems with the file itself.)
31  FileBlob fileBlob{inputDir_ + inputFileName_, true};
32 
33  if (fileBlob.size() > 0) { // skip if no data or FileBlob file not found
34  // Adding the FileBlob to the lumi:
35  fileBlobCollection->addFileBlob(fileBlob);
36  }
37  iLumi.put(std::move(fileBlobCollection), fileBlobLabel_);
38 }
39 
40 // Manage the parameters for the module:
41 // (Note that this will autogenerate the _cfi.py file.)
44 
45  desc.add<std::string>("fileDir", "")
46  ->setComment(
47  "Keep the fileDir empty if you want to write to the current "
48  "directory. If you use it, it should end with a slash.");
49 
50  desc.add<std::string>("inputBinaryFile", "milleBinary.dat")
51  ->setComment("Filename of the file created by Mille in the AlignmentProducer");
52 
53  desc.add<std::string>("fileBlobLabel", "milleBinary.dat")
54  ->setComment(
55  "It's probably a good idea to keep the label the same as the "
56  "original filename(s). See configuration of "
57  "MillePedeFileExtractor, it should be the same there.");
58 
59  descriptions.add("millePedeFileConverter", desc);
60  descriptions.setComment(
61  "This is the generic cfi file for the "
62  "MillePedeFileConverter");
63 }
const std::string fileBlobLabel_
MillePedeFileConverter(const edm::ParameterSet &)
void endLuminosityBlockProduce(edm::LuminosityBlock &, const edm::EventSetup &) final
void put(std::unique_ptr< PROD > product)
Put a new product.
const std::string inputFileName_
Log< level::Info, false > LogInfo
void setComment(std::string const &value)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
def move(src, dest)
Definition: eostools.py:511