Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:44:40

0001 /**
0002  * \file AlignmentUserVariablesIO
0003  *
0004  *  $Revision: 1.3 $
0005  *  $Date: 2006/12/12 08:55:45 $
0006  *  $Author: flucke $ (at least last update...)
0007  */
0008 
0009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0010 
0011 // this class's header
0012 #include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentUserVariablesIO.h"
0013 #include "Alignment/CommonAlignment/interface/Alignable.h"
0014 #include "Alignment/CommonAlignment/interface/AlignmentParameters.h"
0015 
0016 //-----------------------------------------------------------------------------
0017 // write many user variables
0018 
0019 int AlignmentUserVariablesIO::write(const align::Alignables& alivec, bool validCheck) {
0020   int icount = 0;
0021   for (align::Alignables::const_iterator it = alivec.begin(); it != alivec.end(); ++it) {
0022     if ((*it)->alignmentParameters()->isValid() || !(validCheck)) {
0023       icount++;
0024       int iret = writeOne(*it);
0025       if (iret != 0)
0026         return iret;
0027     }
0028   }
0029   edm::LogInfo("Alignment") << "@SUB=AlignmentUserVariablesIO::write"
0030                             << "Write variables all,written: " << alivec.size() << "," << icount;
0031   return 0;
0032 }
0033 
0034 //-----------------------------------------------------------------------------
0035 // read many user variables
0036 
0037 std::vector<AlignmentUserVariables*> AlignmentUserVariablesIO::read(const align::Alignables& alivec, int& ierr) {
0038   std::vector<AlignmentUserVariables*> retvec;
0039   ierr = 0;
0040   int ierr2;
0041   int icount = 0;
0042   int icount2 = 0;
0043   for (align::Alignables::const_iterator it = alivec.begin(); it != alivec.end(); ++it) {
0044     AlignmentUserVariables* ad = readOne(*it, ierr2);  // should create with new!
0045     if (ierr2 == 0) {
0046       retvec.push_back(ad);
0047       icount++;
0048       if (ad != nullptr)
0049         icount2++;
0050     }
0051   }
0052   edm::LogInfo("Alignment") << "@SUB=AlignmentUserVariablesIO::read"
0053                             << "Read variables all,read,valid: " << alivec.size() << "," << icount << "," << icount2;
0054   return retvec;
0055 }