CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

EDMtoMEConverter Class Reference

#include <EDMtoMEConverter.h>

Inheritance diagram for EDMtoMEConverter:
edm::EDAnalyzer

List of all members.

Public Types

typedef std::vector< uint32_t > TagList

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
virtual void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
 EDMtoMEConverter (const edm::ParameterSet &)
virtual void endJob ()
virtual void endLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
virtual void endRun (const edm::Run &, const edm::EventSetup &)
template<class T >
void getData (T &iGetFrom, bool iEndRun)
virtual void respondToOpenInputFile (const edm::FileBlock &)
virtual ~EDMtoMEConverter ()

Private Attributes

std::vector< std::string > classtypes
bool convertOnEndLumi
bool convertOnEndRun
DQMStoredbe
int frequency
std::map< int, int > iCount
unsigned int iCountf
edm::InputTag lumiInputTag_
std::vector< MonitorElement * > me1
std::vector< MonitorElement * > me2
std::vector< MonitorElement * > me3
std::vector< MonitorElement * > me4
std::vector< MonitorElement * > me5
std::vector< MonitorElement * > me6
std::vector< MonitorElement * > me7
std::vector< MonitorElement * > me8
std::string name
edm::InputTag runInputTag_
int verbosity

Detailed Description

Class to take dqm monitor elements and convert into a ROOT dataformat stored in Run tree of edm file

Date:
2012/10/10 16:01:57
Revision:
1.19
Author:
M. Strang SUNY-Buffalo

Definition at line 51 of file EDMtoMEConverter.h.


Member Typedef Documentation

typedef std::vector<uint32_t> EDMtoMEConverter::TagList

Definition at line 70 of file EDMtoMEConverter.h.


Constructor & Destructor Documentation

EDMtoMEConverter::EDMtoMEConverter ( const edm::ParameterSet iPSet) [explicit]

Definition at line 16 of file EDMtoMEConverter.cc.

References classtypes, convertOnEndLumi, convertOnEndRun, dbe, frequency, edm::ParameterSet::getUntrackedParameter(), iCount, iCountf, name, cppFunctionSkipper::operator, and verbosity.

                                                                :
  verbosity(0), frequency(0),
  runInputTag_(iPSet.getParameter<edm::InputTag>("runInputTag")),
  lumiInputTag_(iPSet.getParameter<edm::InputTag>("lumiInputTag"))
{
  std::string MsgLoggerCat = "EDMtoMEConverter_EDMtoMEConverter";

  // get information from parameter set
  name = iPSet.getUntrackedParameter<std::string>("Name");
  verbosity = iPSet.getUntrackedParameter<int>("Verbosity");
  frequency = iPSet.getUntrackedParameter<int>("Frequency");

  convertOnEndLumi = iPSet.getUntrackedParameter<bool>("convertOnEndLumi",true);
  convertOnEndRun = iPSet.getUntrackedParameter<bool>("convertOnEndRun",true);

  // use value of first digit to determine default output level (inclusive)
  // 0 is none, 1 is basic, 2 is fill output, 3 is gather output
  verbosity %= 10;

  // get dqm info
  dbe = 0;
  dbe = edm::Service<DQMStore>().operator->();

  // print out Parameter Set information being used
  if (verbosity >= 0) {
    edm::LogInfo(MsgLoggerCat)
      << "\n===============================\n"
      << "Initialized as EDAnalyzer with parameter values:\n"
      << "    Name          = " << name << "\n"
      << "    Verbosity     = " << verbosity << "\n"
      << "    Frequency     = " << frequency << "\n"
      << "===============================\n";
  }

  classtypes.clear();
  classtypes.push_back("TH1F");
  classtypes.push_back("TH1S");
  classtypes.push_back("TH1D");
  classtypes.push_back("TH2F");
  classtypes.push_back("TH2S");
  classtypes.push_back("TH2D");
  classtypes.push_back("TH3F");
  classtypes.push_back("TProfile");
  classtypes.push_back("TProfile2D");
  classtypes.push_back("Double");
  classtypes.push_back("Int");
  classtypes.push_back("Int64");
  classtypes.push_back("String");

  iCountf = 0;
  iCount.clear();

  assert(sizeof(int64_t) == sizeof(long long));

} // end constructor
EDMtoMEConverter::~EDMtoMEConverter ( ) [virtual]

Definition at line 72 of file EDMtoMEConverter.cc.

{}

Member Function Documentation

void EDMtoMEConverter::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 133 of file EDMtoMEConverter.cc.

{
}
void EDMtoMEConverter::beginJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 74 of file EDMtoMEConverter.cc.

{
}
void EDMtoMEConverter::beginLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup iSetup 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 122 of file EDMtoMEConverter.cc.

{
}
void EDMtoMEConverter::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 94 of file EDMtoMEConverter.cc.

References frequency, iCount, edm::RunBase::run(), and verbosity.

{
  std::string MsgLoggerCat = "EDMtoMEConverter_beginRun";

  int nrun = iRun.run();

  // keep track of number of unique runs processed
  ++iCount[nrun];

  if (verbosity > 0) {
    edm::LogInfo(MsgLoggerCat)
      << "Processing run " << nrun << " (" << iCount.size() << " runs total)";
  } else if (verbosity == 0) {
    if (nrun%frequency == 0 || iCount.size() == 1) {
      edm::LogInfo(MsgLoggerCat)
        << "Processing run " << nrun << " (" << iCount.size() << " runs total)";
    }
  }

}
void EDMtoMEConverter::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 78 of file EDMtoMEConverter.cc.

References iCount, iCountf, and verbosity.

{
  std::string MsgLoggerCat = "EDMtoMEConverter_endJob";
  if (verbosity >= 0)
    edm::LogInfo(MsgLoggerCat)
      << "Terminating having processed " << iCount.size() << " runs across "
      << iCountf << " files.";
  return;
}
void EDMtoMEConverter::endLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup iSetup 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 126 of file EDMtoMEConverter.cc.

References convertOnEndLumi, and getData().

{
  if (convertOnEndLumi) {
    getData(iLumi, false);
  }
}
void EDMtoMEConverter::endRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 115 of file EDMtoMEConverter.cc.

References convertOnEndRun, and getData().

{
  if (convertOnEndRun) {
    getData(iRun, true);
  }
}
template<class T >
void EDMtoMEConverter::getData ( T iGetFrom,
bool  iEndRun 
)

Definition at line 139 of file EDMtoMEConverter.cc.

References DQMStore::book1D(), DQMStore::book1DD(), DQMStore::book1S(), DQMStore::book2D(), DQMStore::book2DD(), DQMStore::book2S(), DQMStore::book3D(), DQMStore::bookFloat(), DQMStore::bookInt(), DQMStore::bookProfile(), DQMStore::bookProfile2D(), DQMStore::bookString(), classtypes, gather_cfg::cout, dbe, dir, DQMStore::get(), DQMStore::getAllTags(), getTH1F(), getTH2F(), getTH3F(), getTProfile(), getTProfile2D(), i, edm::HandleBase::isValid(), j, list(), lumiInputTag_, me1, me2, me3, me4, me5, me6, me7, me8, name, timingPdfMaker::pathname, runInputTag_, DQMStore::setCurrentFolder(), split, DQMStore::tag(), o2o::tags, and verbosity.

Referenced by endLuminosityBlock(), and endRun().

{
  edm::InputTag* inputTag = 0;
  if (iEndRun) {
    inputTag = &runInputTag_;
  } else {
    inputTag = &lumiInputTag_;
  }

  std::string MsgLoggerCat = "EDMtoMEConverter_getData";

  if (verbosity >= 0)
    edm::LogInfo (MsgLoggerCat) << "\nRestoring MonitorElements.";

  for (unsigned int ii = 0; ii < classtypes.size(); ++ii) {

    if (classtypes[ii] == "TH1F") {
      edm::Handle<MEtoEDM<TH1F> > metoedm;
      iGetFrom.getByLabel(*inputTag, metoedm);

      if (!metoedm.isValid()) {
        //edm::LogWarning(MsgLoggerCat)
        //  << "MEtoEDM<TH1F> doesn't exist in run";
        continue;
      }

      std::vector<MEtoEDM<TH1F>::MEtoEDMObject> metoedmobject =
        metoedm->getMEtoEdmObject();

      me1.resize(metoedmobject.size());

      for (unsigned int i = 0; i < metoedmobject.size(); ++i) {

        me1[i] = 0;

        // get full path of monitor element
        std::string pathname = metoedmobject[i].name;
        if (verbosity > 0) std::cout << pathname << std::endl;

        std::string dir;

        // deconstruct path from fullpath
        StringList fulldir = StringOps::split(pathname,"/");

        for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
          dir += fulldir[j];
          if (j != fulldir.size() - 2) dir += "/";
        }

        // define new monitor element
        if (dbe) {
          me1[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
          if (me1[i] && me1[i]->getTH1F() && me1[i]->getTH1F()->TestBit(TH1::kCanRebin) == true) {
            TList list;
            list.Add(&metoedmobject[i].object);
            if (me1[i]->getTH1F()->Merge(&list) == -1)
              std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
                        << metoedmobject[i].object.GetName() << "'" <<  std::endl;
          } else {
            dbe->setCurrentFolder(dir);
            me1[i] = dbe->book1D(metoedmobject[i].object.GetName(),
                                 &metoedmobject[i].object);
          }
          if (!iEndRun) me1[i]->setLumiFlag();
        } // end define new monitor elements

        // attach taglist
        TagList tags = metoedmobject[i].tags;

        for (unsigned int j = 0; j < tags.size(); ++j) {
          dbe->tag(me1[i]->getFullname(),tags[j]);
        }
      } // end loop thorugh metoedmobject
    } // end TH1F creation

    if (classtypes[ii] == "TH1S") {
      edm::Handle<MEtoEDM<TH1S> > metoedm;
      iGetFrom.getByLabel(*inputTag, metoedm);

      if (!metoedm.isValid()) {
        //edm::LogWarning(MsgLoggerCat)
        //  << "MEtoEDM<TH1S> doesn't exist in run";
        continue;
      }

      std::vector<MEtoEDM<TH1S>::MEtoEDMObject> metoedmobject =
        metoedm->getMEtoEdmObject();

      me1.resize(metoedmobject.size());

      for (unsigned int i = 0; i < metoedmobject.size(); ++i) {

        me1[i] = 0;

        // get full path of monitor element
        std::string pathname = metoedmobject[i].name;
        if (verbosity > 0) std::cout << pathname << std::endl;

        std::string dir;

        // deconstruct path from fullpath
        StringList fulldir = StringOps::split(pathname,"/");

        for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
          dir += fulldir[j];
          if (j != fulldir.size() - 2) dir += "/";
        }

        // define new monitor element
        if (dbe) {
          me1[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
          if (me1[i] && me1[i]->getTH1S() && me1[i]->getTH1S()->TestBit(TH1::kCanRebin) == true) {
            TList list;
            list.Add(&metoedmobject[i].object);
            if (me1[i]->getTH1S()->Merge(&list) == -1)
              std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
                        << metoedmobject[i].object.GetName() << "'" <<  std::endl;
          } else {
            dbe->setCurrentFolder(dir);
            me1[i] = dbe->book1S(metoedmobject[i].object.GetName(),
                                 &metoedmobject[i].object);
          }
          if (!iEndRun) me1[i]->setLumiFlag();
        } // end define new monitor elements

        // attach taglist
        TagList tags = metoedmobject[i].tags;

        for (unsigned int j = 0; j < tags.size(); ++j) {
          dbe->tag(me1[i]->getFullname(),tags[j]);
        }
      } // end loop thorugh metoedmobject
    } // end TH1S creation

    if (classtypes[ii] == "TH1D") {
      edm::Handle<MEtoEDM<TH1D> > metoedm;
      iGetFrom.getByLabel(*inputTag, metoedm);

      if (!metoedm.isValid()) {
        //edm::LogWarning(MsgLoggerCat)
        //  << "MEtoEDM<TH1D> doesn't exist in run";
        continue;
      }

      std::vector<MEtoEDM<TH1D>::MEtoEDMObject> metoedmobject =
        metoedm->getMEtoEdmObject();

      me1.resize(metoedmobject.size());

      for (unsigned int i = 0; i < metoedmobject.size(); ++i) {

        me1[i] = 0;

        // get full path of monitor element
        std::string pathname = metoedmobject[i].name;
        if (verbosity > 0) std::cout << pathname << std::endl;

        std::string dir;

        // deconstruct path from fullpath
        StringList fulldir = StringOps::split(pathname,"/");

        for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
          dir += fulldir[j];
          if (j != fulldir.size() - 2) dir += "/";
        }

        // define new monitor element
        if (dbe) {
          me1[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
          if (me1[i] && me1[i]->getTH1D() && me1[i]->getTH1D()->TestBit(TH1::kCanRebin) == true) {
            TList list;
            list.Add(&metoedmobject[i].object);
            if (me1[i]->getTH1D()->Merge(&list) == -1)
              std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
                        << metoedmobject[i].object.GetName() << "'" <<  std::endl;
          } else {
            dbe->setCurrentFolder(dir);
            me1[i] = dbe->book1DD(metoedmobject[i].object.GetName(),
                                  &metoedmobject[i].object);
          }
          if (!iEndRun) me1[i]->setLumiFlag();
        } // end define new monitor elements

        // attach taglist
        TagList tags = metoedmobject[i].tags;

        for (unsigned int j = 0; j < tags.size(); ++j) {
          dbe->tag(me1[i]->getFullname(),tags[j]);
        }
      } // end loop thorugh metoedmobject
    } // end TH1D creation

    if (classtypes[ii] == "TH2F") {
      edm::Handle<MEtoEDM<TH2F> > metoedm;
      iGetFrom.getByLabel(*inputTag, metoedm);

      if (!metoedm.isValid()) {
        //edm::LogWarning(MsgLoggerCat)
        //  << "MEtoEDM<TH2F> doesn't exist in run";
        continue;
      }

      std::vector<MEtoEDM<TH2F>::MEtoEDMObject> metoedmobject =
        metoedm->getMEtoEdmObject();

      me2.resize(metoedmobject.size());

      for (unsigned int i = 0; i < metoedmobject.size(); ++i) {

        me2[i] = 0;

        // get full path of monitor element
        std::string pathname = metoedmobject[i].name;
        if (verbosity > 0) std::cout << pathname << std::endl;

        std::string dir;

        // deconstruct path from fullpath
        StringList fulldir = StringOps::split(pathname,"/");

        for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
          dir += fulldir[j];
          if (j != fulldir.size() - 2) dir += "/";
        }

        // define new monitor element
        if (dbe) {
          me2[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
          if (me2[i] && me2[i]->getTH2F() && me2[i]->getTH2F()->TestBit(TH1::kCanRebin) == true) {
            TList list;
            list.Add(&metoedmobject[i].object);
            if (me2[i]->getTH2F()->Merge(&list) == -1)
              std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
                        << metoedmobject[i].object.GetName() << "'" <<  std::endl;
          } else {
            dbe->setCurrentFolder(dir);
            me2[i] = dbe->book2D(metoedmobject[i].object.GetName(),
                                 &metoedmobject[i].object);
          }
          if (!iEndRun) me2[i]->setLumiFlag();
        } // end define new monitor elements

        // attach taglist
        TagList tags = metoedmobject[i].tags;

        for (unsigned int j = 0; j < tags.size(); ++j) {
          dbe->tag(me2[i]->getFullname(),tags[j]);
        }
      } // end loop thorugh metoedmobject
    } // end TH2F creation

    if (classtypes[ii] == "TH2S") {
      edm::Handle<MEtoEDM<TH2S> > metoedm;
      iGetFrom.getByLabel(*inputTag, metoedm);

      if (!metoedm.isValid()) {
        //edm::LogWarning(MsgLoggerCat)
        //  << "MEtoEDM<TH2S> doesn't exist in run";
        continue;
      }

      std::vector<MEtoEDM<TH2S>::MEtoEDMObject> metoedmobject =
        metoedm->getMEtoEdmObject();

      me2.resize(metoedmobject.size());

      for (unsigned int i = 0; i < metoedmobject.size(); ++i) {

        me2[i] = 0;

        // get full path of monitor element
        std::string pathname = metoedmobject[i].name;
        if (verbosity > 0) std::cout << pathname << std::endl;

        std::string dir;

        // deconstruct path from fullpath
        StringList fulldir = StringOps::split(pathname,"/");

        for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
          dir += fulldir[j];
          if (j != fulldir.size() - 2) dir += "/";
        }

        // define new monitor element
        if (dbe) {
          me2[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
          if (me2[i] && me2[i]->getTH2S() && me2[i]->getTH2S()->TestBit(TH1::kCanRebin) == true) {
            TList list;
            list.Add(&metoedmobject[i].object);
            if (me2[i]->getTH2S()->Merge(&list) == -1)
              std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
                        << metoedmobject[i].object.GetName() << "'" <<  std::endl;
          } else {
            dbe->setCurrentFolder(dir);
            me2[i] = dbe->book2S(metoedmobject[i].object.GetName(),
                                 &metoedmobject[i].object);
          }
          if (!iEndRun) me2[i]->setLumiFlag();
        } // end define new monitor elements

        // attach taglist
        TagList tags = metoedmobject[i].tags;

        for (unsigned int j = 0; j < tags.size(); ++j) {
          dbe->tag(me2[i]->getFullname(),tags[j]);
        }
      } // end loop thorugh metoedmobject
    } // end TH2S creation

    if (classtypes[ii] == "TH2D") {
      edm::Handle<MEtoEDM<TH2D> > metoedm;
      iGetFrom.getByLabel(*inputTag, metoedm);

      if (!metoedm.isValid()) {
        //edm::LogWarning(MsgLoggerCat)
        //  << "MEtoEDM<TH2D> doesn't exist in run";
        continue;
      }

      std::vector<MEtoEDM<TH2D>::MEtoEDMObject> metoedmobject =
        metoedm->getMEtoEdmObject();

      me2.resize(metoedmobject.size());

      for (unsigned int i = 0; i < metoedmobject.size(); ++i) {

        me2[i] = 0;

        // get full path of monitor element
        std::string pathname = metoedmobject[i].name;
        if (verbosity > 0) std::cout << pathname << std::endl;

        std::string dir;

        // deconstruct path from fullpath
        StringList fulldir = StringOps::split(pathname,"/");

        for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
          dir += fulldir[j];
          if (j != fulldir.size() - 2) dir += "/";
        }

        // define new monitor element
        if (dbe) {
          me2[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
          if (me2[i] && me2[i]->getTH2D() && me2[i]->getTH2D()->TestBit(TH1::kCanRebin) == true) {
            TList list;
            list.Add(&metoedmobject[i].object);
            if (me2[i]->getTH2D()->Merge(&list) == -1)
              std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
                        << metoedmobject[i].object.GetName() << "'" <<  std::endl;
          } else {
            dbe->setCurrentFolder(dir);
            me2[i] = dbe->book2DD(metoedmobject[i].object.GetName(),
                                  &metoedmobject[i].object);
          }
          if (!iEndRun) me2[i]->setLumiFlag();
        } // end define new monitor elements

        // attach taglist
        TagList tags = metoedmobject[i].tags;

        for (unsigned int j = 0; j < tags.size(); ++j) {
          dbe->tag(me2[i]->getFullname(),tags[j]);
        }
      } // end loop thorugh metoedmobject
    } // end TH2D creation

    if (classtypes[ii] == "TH3F") {
      edm::Handle<MEtoEDM<TH3F> > metoedm;
      iGetFrom.getByLabel(*inputTag, metoedm);

      if (!metoedm.isValid()) {
        //edm::LogWarning(MsgLoggerCat)
        //  << "MEtoEDM<TH3F> doesn't exist in run";
        continue;
      }

      std::vector<MEtoEDM<TH3F>::MEtoEDMObject> metoedmobject =
        metoedm->getMEtoEdmObject();

      me3.resize(metoedmobject.size());

      for (unsigned int i = 0; i < metoedmobject.size(); ++i) {

        me3[i] = 0;

        // get full path of monitor element
        std::string pathname = metoedmobject[i].name;
        if (verbosity > 0) std::cout << pathname << std::endl;

        std::string dir;

        // deconstruct path from fullpath
        StringList fulldir = StringOps::split(pathname,"/");

        for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
          dir += fulldir[j];
          if (j != fulldir.size() - 2) dir += "/";
        }

        // define new monitor element
        if (dbe) {
          me3[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
          if (me3[i] && me3[i]->getTH3F() && me3[i]->getTH3F()->TestBit(TH1::kCanRebin) == true) {
            TList list;
            list.Add(&metoedmobject[i].object);
            if (me3[i]->getTH3F()->Merge(&list) == -1)
              std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
                        << metoedmobject[i].object.GetName() << "'" <<  std::endl;
          } else {
            dbe->setCurrentFolder(dir);
            me3[i] = dbe->book3D(metoedmobject[i].object.GetName(),
                                 &metoedmobject[i].object);
          }
          if (!iEndRun) me3[i]->setLumiFlag();
        } // end define new monitor elements

        // attach taglist
        TagList tags = metoedmobject[i].tags;

        for (unsigned int j = 0; j < tags.size(); ++j) {
          dbe->tag(me3[i]->getFullname(),tags[j]);
        }
      } // end loop thorugh metoedmobject
    } // end TH3F creation

    if (classtypes[ii] == "TProfile") {
      edm::Handle<MEtoEDM<TProfile> > metoedm;
      iGetFrom.getByLabel(*inputTag, metoedm);

      if (!metoedm.isValid()) {
        //edm::LogWarning(MsgLoggerCat)
        //  << "MEtoEDM<TProfile> doesn't exist in run";
        continue;
      }

      std::vector<MEtoEDM<TProfile>::MEtoEDMObject> metoedmobject =
        metoedm->getMEtoEdmObject();

      me4.resize(metoedmobject.size());

      for (unsigned int i = 0; i < metoedmobject.size(); ++i) {

        me4[i] = 0;

        // get full path of monitor element
        std::string pathname = metoedmobject[i].name;
        if (verbosity > 0) std::cout << pathname << std::endl;

        std::string dir;

        // deconstruct path from fullpath
        StringList fulldir = StringOps::split(pathname,"/");

        for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
          dir += fulldir[j];
          if (j != fulldir.size() - 2) dir += "/";
        }

        std::string name = metoedmobject[i].object.GetName();
        // define new monitor element
        if (dbe) {
          me4[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
          if (me4[i] && me4[i]->getTProfile() && me4[i]->getTProfile()->TestBit(TH1::kCanRebin) == true) {
            TList list;
            list.Add(&metoedmobject[i].object);
            if (me4[i]->getTProfile()->Merge(&list) == -1)
              std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
                      << metoedmobject[i].object.GetName() << "'" <<  std::endl;
          } else {
            dbe->setCurrentFolder(dir);
            me4[i] = dbe->bookProfile(metoedmobject[i].object.GetName(),
                                    &metoedmobject[i].object);
          }
          if (!iEndRun) me4[i]->setLumiFlag();
        } // end define new monitor elements

        // attach taglist
        TagList tags = metoedmobject[i].tags;

        for (unsigned int j = 0; j < tags.size(); ++j) {
          dbe->tag(me4[i]->getFullname(),tags[j]);
        }
      } // end loop thorugh metoedmobject
    } // end TProfile creation

    if (classtypes[ii] == "TProfile2D") {
      edm::Handle<MEtoEDM<TProfile2D> > metoedm;
      iGetFrom.getByLabel(*inputTag, metoedm);

      if (!metoedm.isValid()) {
        //edm::LogWarning(MsgLoggerCat)
        //  << "MEtoEDM<TProfile2D> doesn't exist in run";
        continue;
      }

      std::vector<MEtoEDM<TProfile2D>::MEtoEDMObject> metoedmobject =
        metoedm->getMEtoEdmObject();

      me5.resize(metoedmobject.size());

      for (unsigned int i = 0; i < metoedmobject.size(); ++i) {

        me5[i] = 0;

        // get full path of monitor element
        std::string pathname = metoedmobject[i].name;
        if (verbosity > 0) std::cout << pathname << std::endl;

        std::string dir;

        // deconstruct path from fullpath
        StringList fulldir = StringOps::split(pathname,"/");

        for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
          dir += fulldir[j];
          if (j != fulldir.size() - 2) dir += "/";
        }

        // define new monitor element
        if (dbe) {
          me5[i] = dbe->get(dir+"/"+metoedmobject[i].object.GetName());
          if (me5[i] && me5[i]->getTProfile2D() && me5[i]->getTProfile2D()->TestBit(TH1::kCanRebin) == true) {
            TList list;
            list.Add(&metoedmobject[i].object);
            if (me5[i]->getTProfile2D()->Merge(&list) == -1)
              std::cout << "ERROR EDMtoMEConverter::getData(): merge failed for '"
                        << metoedmobject[i].object.GetName() << "'" <<  std::endl;
          } else {
            dbe->setCurrentFolder(dir);
            me5[i] = dbe->bookProfile2D(metoedmobject[i].object.GetName(),
                                        &metoedmobject[i].object);
          }
          if (!iEndRun) me5[i]->setLumiFlag();
        } // end define new monitor elements

        // attach taglist
        TagList tags = metoedmobject[i].tags;

        for (unsigned int j = 0; j < tags.size(); ++j) {
          dbe->tag(me5[i]->getFullname(),tags[j]);
        }
      } // end loop thorugh metoedmobject
    } // end TProfile2D creation

    if (classtypes[ii] == "Double") {
      edm::Handle<MEtoEDM<double> > metoedm;
      iGetFrom.getByLabel(*inputTag, metoedm);

      if (!metoedm.isValid()) {
        //edm::LogWarning(MsgLoggerCat)
        //  << "MEtoEDM<double> doesn't exist in run";
        continue;
      }

      std::vector<MEtoEDM<double>::MEtoEDMObject> metoedmobject =
        metoedm->getMEtoEdmObject();

      me6.resize(metoedmobject.size());

      for (unsigned int i = 0; i < metoedmobject.size(); ++i) {

        me6[i] = 0;

        // get full path of monitor element
        std::string pathname = metoedmobject[i].name;
        if (verbosity > 0) std::cout << pathname << std::endl;

        std::string dir;
        std::string name;

        // deconstruct path from fullpath

        StringList fulldir = StringOps::split(pathname,"/");
        name = *(fulldir.end() - 1);

        for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
          dir += fulldir[j];
          if (j != fulldir.size() - 2) dir += "/";
        }

        // define new monitor element
        if (dbe) {
          dbe->setCurrentFolder(dir);
          me6[i] = dbe->bookFloat(name);
          me6[i]->Fill(metoedmobject[i].object);
          if (!iEndRun) me6[i]->setLumiFlag();
        } // end define new monitor elements

        // attach taglist
        TagList tags = metoedmobject[i].tags;

        for (unsigned int j = 0; j < tags.size(); ++j) {
          dbe->tag(me6[i]->getFullname(),tags[j]);
        }
      } // end loop thorugh metoedmobject
    } // end Float creation

    if (classtypes[ii] == "Int64") {
      edm::Handle<MEtoEDM<long long> > metoedm;
      iGetFrom.getByLabel(*inputTag, metoedm);

      if (!metoedm.isValid()) {
        //edm::LogWarning(MsgLoggerCat)
        //  << "MEtoEDM<long long> doesn't exist in run";
        continue;
      }

      std::vector<MEtoEDM<long long>::MEtoEDMObject> metoedmobject =
        metoedm->getMEtoEdmObject();

      me7.resize(metoedmobject.size());

      for (unsigned int i = 0; i < metoedmobject.size(); ++i) {

        me7[i] = 0;

        // get full path of monitor element
        std::string pathname = metoedmobject[i].name;
        if (verbosity > 0) std::cout << pathname << std::endl;

        std::string dir;
        std::string name;

        // deconstruct path from fullpath
        StringList fulldir = StringOps::split(pathname,"/");
        name = *(fulldir.end() - 1);

        for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
          dir += fulldir[j];
          if (j != fulldir.size() - 2) dir += "/";
        }

        // define new monitor element
        if (dbe) {
          dbe->setCurrentFolder(dir);
          long long ival = 0;
          if ( iEndRun ) {
            if (name.find("processedEvents") != std::string::npos) {
              if (MonitorElement* me = dbe->get(dir+"/"+name)) {
                ival = me->getIntValue();
              }
            }
          }
          me7[i] = dbe->bookInt(name);
          me7[i]->Fill(metoedmobject[i].object+ival);
          if (!iEndRun) me7[i]->setLumiFlag();
        } // end define new monitor elements

        // attach taglist
        TagList tags = metoedmobject[i].tags;

        for (unsigned int j = 0; j < tags.size(); ++j) {
          dbe->tag(me7[i]->getFullname(),tags[j]);
        }
      } // end loop thorugh metoedmobject
    } // end Int creation

    if (classtypes[ii] == "Int") {
      edm::Handle<MEtoEDM<int> > metoedm;
      iGetFrom.getByLabel(*inputTag, metoedm);

      if (!metoedm.isValid()) {
        //edm::LogWarning(MsgLoggerCat)
        //  << "MEtoEDM<int> doesn't exist in run";
        continue;
      }

      std::vector<MEtoEDM<int>::MEtoEDMObject> metoedmobject =
        metoedm->getMEtoEdmObject();

      me7.resize(metoedmobject.size());

      for (unsigned int i = 0; i < metoedmobject.size(); ++i) {

        me7[i] = 0;

        // get full path of monitor element
        std::string pathname = metoedmobject[i].name;
        if (verbosity > 0) std::cout << pathname << std::endl;

        std::string dir;
        std::string name;

        // deconstruct path from fullpath
        StringList fulldir = StringOps::split(pathname,"/");
        name = *(fulldir.end() - 1);

        for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
          dir += fulldir[j];
          if (j != fulldir.size() - 2) dir += "/";
        }

        // define new monitor element
        if (dbe) {
          dbe->setCurrentFolder(dir);
          int ival = 0;
          if ( iEndRun ) {
            if (name.find("processedEvents") != std::string::npos) {
              if (MonitorElement* me = dbe->get(dir+"/"+name)) {
                ival = me->getIntValue();
              }
            }
          }
          me7[i] = dbe->bookInt(name);
          me7[i]->Fill(metoedmobject[i].object+ival);
          if (!iEndRun) me7[i]->setLumiFlag();
        } // end define new monitor elements

        // attach taglist
        TagList tags = metoedmobject[i].tags;

        for (unsigned int j = 0; j < tags.size(); ++j) {
          dbe->tag(me7[i]->getFullname(),tags[j]);
        }
      } // end loop thorugh metoedmobject
    } // end Int creation

    if (classtypes[ii] == "String") {
      edm::Handle<MEtoEDM<TString> > metoedm;
      iGetFrom.getByLabel(*inputTag, metoedm);

      if (!metoedm.isValid()) {
        //edm::LogWarning(MsgLoggerCat)
        //  << "MEtoEDM<TString> doesn't exist in run";
        continue;
      }

      std::vector<MEtoEDM<TString>::MEtoEDMObject> metoedmobject =
        metoedm->getMEtoEdmObject();

      me8.resize(metoedmobject.size());

      for (unsigned int i = 0; i < metoedmobject.size(); ++i) {

        me8[i] = 0;

        // get full path of monitor element
        std::string pathname = metoedmobject[i].name;
        if (verbosity > 0) std::cout << pathname << std::endl;

        std::string dir;
        std::string name;

        // deconstruct path from fullpath
        StringList fulldir = StringOps::split(pathname,"/");
        name = *(fulldir.end() - 1);

        for (unsigned j = 0; j < fulldir.size() - 1; ++j) {
          dir += fulldir[j];
          if (j != fulldir.size() - 2) dir += "/";
        }

        // define new monitor element
        if (dbe) {
          dbe->setCurrentFolder(dir);
          std::string scont = metoedmobject[i].object.Data();
          me8[i] = dbe->bookString(name,scont);
          if (!iEndRun) me8[i]->setLumiFlag();
        } // end define new monitor elements

        // attach taglist
        TagList tags = metoedmobject[i].tags;

        for (unsigned int j = 0; j < tags.size(); ++j) {
          dbe->tag(me8[i]->getFullname(),tags[j]);
        }
      } // end loop thorugh metoedmobject
    } // end String creation
  }

  // verify tags stored properly
  if (verbosity > 0) {
    std::vector<std::string> stags;
    dbe->getAllTags(stags);
    for (unsigned int i = 0; i < stags.size(); ++i) {
      std::cout << "Tags: " << stags[i] << std::endl;
    }
  }

}
void EDMtoMEConverter::respondToOpenInputFile ( const edm::FileBlock iFb) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 88 of file EDMtoMEConverter.cc.

References iCountf.

{
  ++iCountf;
  return;
}

Member Data Documentation

std::vector<std::string> EDMtoMEConverter::classtypes [private]

Definition at line 88 of file EDMtoMEConverter.h.

Referenced by EDMtoMEConverter(), and getData().

Definition at line 78 of file EDMtoMEConverter.h.

Referenced by EDMtoMEConverter(), and endLuminosityBlock().

Definition at line 79 of file EDMtoMEConverter.h.

Referenced by EDMtoMEConverter(), and endRun().

Definition at line 81 of file EDMtoMEConverter.h.

Referenced by EDMtoMEConverter(), and getData().

Definition at line 76 of file EDMtoMEConverter.h.

Referenced by beginRun(), and EDMtoMEConverter().

std::map<int,int> EDMtoMEConverter::iCount [private]

Definition at line 86 of file EDMtoMEConverter.h.

Referenced by beginRun(), EDMtoMEConverter(), and endJob().

unsigned int EDMtoMEConverter::iCountf [private]

Definition at line 85 of file EDMtoMEConverter.h.

Referenced by EDMtoMEConverter(), endJob(), and respondToOpenInputFile().

Definition at line 91 of file EDMtoMEConverter.h.

Referenced by getData().

std::vector<MonitorElement*> EDMtoMEConverter::me1 [private]

Definition at line 82 of file EDMtoMEConverter.h.

Referenced by getData().

std::vector<MonitorElement*> EDMtoMEConverter::me2 [private]

Definition at line 82 of file EDMtoMEConverter.h.

Referenced by getData().

std::vector<MonitorElement*> EDMtoMEConverter::me3 [private]

Definition at line 82 of file EDMtoMEConverter.h.

Referenced by getData().

std::vector<MonitorElement*> EDMtoMEConverter::me4 [private]

Definition at line 82 of file EDMtoMEConverter.h.

Referenced by getData().

std::vector<MonitorElement*> EDMtoMEConverter::me5 [private]

Definition at line 82 of file EDMtoMEConverter.h.

Referenced by getData().

std::vector<MonitorElement*> EDMtoMEConverter::me6 [private]

Definition at line 82 of file EDMtoMEConverter.h.

Referenced by getData().

std::vector<MonitorElement*> EDMtoMEConverter::me7 [private]

Definition at line 82 of file EDMtoMEConverter.h.

Referenced by getData().

std::vector<MonitorElement*> EDMtoMEConverter::me8 [private]

Definition at line 82 of file EDMtoMEConverter.h.

Referenced by getData().

std::string EDMtoMEConverter::name [private]

Definition at line 74 of file EDMtoMEConverter.h.

Referenced by EDMtoMEConverter(), and getData().

Definition at line 90 of file EDMtoMEConverter.h.

Referenced by getData().

Definition at line 75 of file EDMtoMEConverter.h.

Referenced by beginRun(), EDMtoMEConverter(), endJob(), and getData().