CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/RecoTracker/DeDx/plugins/DeDxDiscriminatorLearnerFromCalibTree.h

Go to the documentation of this file.
00001 #ifndef TrackRecoDeDx_DeDxDiscriminatorLearnerFromCalibTree_H
00002 #define TrackRecoDeDx_DeDxDiscriminatorLearnerFromCalibTree_H
00003 
00004 #include "FWCore/Framework/interface/Frameworkfwd.h"
00005 #include "FWCore/Framework/interface/Event.h"
00006 #include "FWCore/Framework/interface/MakerMacros.h"
00007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00008 
00009 #include "CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h"
00010 #include "CondFormats/PhysicsToolsObjects/interface/Histogram3D.h"
00011 
00012 #include "TrackingTools/PatternTools/interface/Trajectory.h"
00013 #include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
00014 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00015 
00016 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit1D.h"
00017 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h"
00018 #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h"
00019 
00020 #include "RecoTracker/DeDx/interface/DeDxDiscriminatorTools.h"
00021 
00022 #include "TFile.h"
00023 #include "TH3F.h"
00024 #include "TTree.h"
00025 #include "TChain.h"
00026 #include <ext/hash_map>
00027 
00028 //using namespace edm;
00029 //using namespace reco;
00030 //using namespace std;
00031 //using namespace __gnu_cxx;
00032 
00033 
00034 class DeDxDiscriminatorLearnerFromCalibTree : public ConditionDBWriter<PhysicsTools::Calibration::HistogramD3D> {
00035 
00036 public:
00037 
00038   explicit DeDxDiscriminatorLearnerFromCalibTree(const edm::ParameterSet&);
00039   ~DeDxDiscriminatorLearnerFromCalibTree();
00040 
00041 private:
00042   virtual void algoBeginJob(const edm::EventSetup&) ;
00043   virtual void algoAnalyze(const edm::Event&, const edm::EventSetup&);
00044   virtual void algoEndJob();
00045 
00046           void algoAnalyzeTheTree();
00047   void         MakeCalibrationMap();
00048 
00049   PhysicsTools::Calibration::HistogramD3D * getNewObject();
00050 
00051 
00052   // ----------member data ---------------------------
00053   edm::InputTag                     m_trajTrackAssociationTag;
00054   edm::InputTag                     m_tracksTag;
00055 
00056   bool   usePixel;
00057   bool   useStrip;
00058   double MeVperADCPixel;
00059   double MeVperADCStrip;
00060 
00061   const TrackerGeometry* m_tracker;
00062 
00063   double       MinTrackTMomentum;
00064   double       MaxTrackTMomentum;
00065   double       MinTrackEta;
00066   double       MaxTrackEta;
00067   unsigned int MaxNrStrips;
00068   unsigned int MinTrackHits;
00069   double       MaxTrackChiOverNdf;
00070 
00071   bool         useCalibration;
00072   std::string  m_calibrationPath;
00073 
00074   std::vector<std::string> VInputFiles;
00075 
00076 
00077   double P_Min;
00078   double P_Max;
00079   int    P_NBins; 
00080   double Path_Min;
00081   double Path_Max;
00082   int    Path_NBins;
00083   double Charge_Min;
00084   double Charge_Max;
00085   int    Charge_NBins;
00086 
00087 
00088   std::string       algoMode;
00089   std::string       HistoFile;
00090 
00091   TH3F*        Charge_Vs_Path;
00092 
00093 private :
00094   struct stAPVInfo{int DetId; int SubDet; float Eta; float R; float Thickness; int APVId; double CalibGain;};
00095 
00096   class isEqual{
00097   public:
00098     template <class T> bool operator () (const T& PseudoDetId1, const T& PseudoDetId2) { return PseudoDetId1==PseudoDetId2; }
00099   };
00100 
00101   __gnu_cxx::hash_map<unsigned int, stAPVInfo*,  __gnu_cxx::hash<unsigned int>, isEqual > APVsColl;
00102 };
00103 
00104 #endif
00105