CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/Alignment/CommonAlignmentAlgorithm/src/AlignmentUserVariablesIO.cc

Go to the documentation of this file.
00001 
00009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00010 
00011 // this class's header
00012 #include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentUserVariablesIO.h"
00013 #include "Alignment/CommonAlignment/interface/Alignable.h"
00014 #include "Alignment/CommonAlignment/interface/AlignmentParameters.h"
00015 
00016 //-----------------------------------------------------------------------------
00017 // write many user variables
00018 
00019 int 
00020 AlignmentUserVariablesIO::write(const align::Alignables& alivec, 
00021   bool validCheck) 
00022 {
00023   int icount=0;
00024   for(align::Alignables::const_iterator it=alivec.begin();
00025     it!=alivec.end(); it++) {
00026     if ((*it)->alignmentParameters()->isValid() || !(validCheck)) {
00027       icount++;
00028       int iret=writeOne(*it);
00029       if (iret!=0) return iret;
00030     }
00031   }
00032   edm::LogInfo("Alignment") << "@SUB=AlignmentUserVariablesIO::write"
00033                             << "Write variables all,written: " << alivec.size() <<","<< icount;
00034   return 0;
00035 }
00036 
00037 //-----------------------------------------------------------------------------
00038 // read many user variables
00039 
00040 std::vector<AlignmentUserVariables*> 
00041 AlignmentUserVariablesIO::read(const align::Alignables& alivec, int& ierr) 
00042 {
00043   std::vector<AlignmentUserVariables*> retvec;
00044   ierr=0;
00045   int ierr2;
00046   int icount=0;
00047   int icount2=0;
00048   for(align::Alignables::const_iterator it=alivec.begin();
00049     it!=alivec.end(); it++) {
00050     AlignmentUserVariables* ad=readOne(*it, ierr2); // should create with new!
00051     if (ierr2==0) { 
00052       retvec.push_back(ad); icount++; 
00053       if (ad!=0) icount2++;
00054     }
00055   }
00056   edm::LogInfo("Alignment") << "@SUB=AlignmentUserVariablesIO::read"
00057                             << "Read variables all,read,valid: " << alivec.size() <<","
00058                             << icount <<","<< icount2;
00059   return retvec;
00060 }