CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AlignmentUserVariablesIO.cc
Go to the documentation of this file.
1 
10 
11 // this class's header
15 
16 //-----------------------------------------------------------------------------
17 // write many user variables
18 
19 int AlignmentUserVariablesIO::write(const align::Alignables& alivec, bool validCheck) {
20  int icount = 0;
21  for (align::Alignables::const_iterator it = alivec.begin(); it != alivec.end(); ++it) {
22  if ((*it)->alignmentParameters()->isValid() || !(validCheck)) {
23  icount++;
24  int iret = writeOne(*it);
25  if (iret != 0)
26  return iret;
27  }
28  }
29  edm::LogInfo("Alignment") << "@SUB=AlignmentUserVariablesIO::write"
30  << "Write variables all,written: " << alivec.size() << "," << icount;
31  return 0;
32 }
33 
34 //-----------------------------------------------------------------------------
35 // read many user variables
36 
37 std::vector<AlignmentUserVariables*> AlignmentUserVariablesIO::read(const align::Alignables& alivec, int& ierr) {
38  std::vector<AlignmentUserVariables*> retvec;
39  ierr = 0;
40  int ierr2;
41  int icount = 0;
42  int icount2 = 0;
43  for (align::Alignables::const_iterator it = alivec.begin(); it != alivec.end(); ++it) {
44  AlignmentUserVariables* ad = readOne(*it, ierr2); // should create with new!
45  if (ierr2 == 0) {
46  retvec.push_back(ad);
47  icount++;
48  if (ad != nullptr)
49  icount2++;
50  }
51  }
52  edm::LogInfo("Alignment") << "@SUB=AlignmentUserVariablesIO::read"
53  << "Read variables all,read,valid: " << alivec.size() << "," << icount << "," << icount2;
54  return retvec;
55 }
virtual AlignmentUserVariables * readOne(Alignable *ali, int &ierr)=0
(Abstract) Base class for alignment algorithm user variables
Log< level::Info, false > LogInfo
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
int write(const align::Alignables &alivec, bool validCheck)
std::vector< AlignmentUserVariables * > read(const align::Alignables &alivec, int &ierr)
virtual int writeOne(Alignable *ali)=0