CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/CalibTracker/SiStripCommon/interface/ShallowTree.h

Go to the documentation of this file.
00001 #ifndef Shallow_Tree_h
00002 #define Shallow_Tree_h
00003 
00023 #include "FWCore/Framework/interface/Frameworkfwd.h"
00024 #include "FWCore/Framework/interface/EDAnalyzer.h"
00025 #include "FWCore/Framework/interface/Event.h"
00026 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00027 #include "FWCore/ServiceRegistry/interface/Service.h"
00028 #include "CommonTools/UtilAlgos/interface/TFileService.h"
00029 
00030 #include <string>
00031 #include <vector>
00032 #include <TTree.h>
00033 
00034 class ShallowTree : public edm::EDAnalyzer {
00035 private:    
00036   virtual void beginJob();
00037   virtual void analyze(const edm::Event&, const edm::EventSetup&);
00038   virtual void endJob(){}
00039 
00040   class BranchConnector {
00041   public:
00042     virtual ~BranchConnector() {};
00043     virtual void connect(const edm::Event&) = 0;
00044   };
00045   
00046   template <class T>
00047   class TypedBranchConnector : public BranchConnector {
00048   private:
00049     std::string ml;   //module label
00050     std::string pin;  //product instance name
00051     T object_;
00052     T* object_ptr_;
00053   public:
00054     TypedBranchConnector(edm::BranchDescription const*, std::string, TTree*);
00055     void connect(const edm::Event&);
00056   };
00057 
00058   edm::Service<TFileService> fs;
00059   TTree * tree;
00060   std::vector<BranchConnector*> connectors;
00061   edm::ParameterSet pset;
00062 
00063 public:
00064   explicit ShallowTree(const edm::ParameterSet& iConfig) : pset(iConfig) {}
00065   
00066   enum LEAFTYPE {BOOL=1,  BOOL_V,          
00067                  SHORT,   SHORT_V,           U_SHORT, U_SHORT_V,       
00068                  INT,     INT_V,             U_INT,   U_INT_V,
00069                  FLOAT,   FLOAT_V,           DOUBLE,  DOUBLE_V,
00070                  LONG,    LONG_V,            U_LONG,  U_LONG_V, 
00071                  CHAR,    CHAR_V,            U_CHAR,  U_CHAR_V};
00072 };
00073 
00074 #endif