CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PixelForwardTemplateSmearerPlugin.cc
Go to the documentation of this file.
1 
14 // SiPixel Gaussian Smearing
18 
19 // Geometry
20 //#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
22 //#include "Geometry/CommonDetUnit/interface/GeomDetType.h"
26 
27 // Famos
30 
31 // STL
32 
33 // ROOT
34 #include <TFile.h>
35 #include <TH1F.h>
36 #include <TH2F.h>
37 //#include <TAxis.h>
38 
39 //#define FAMOS_DEBUG
40 
41 const double microntocm = 0.0001;
42 using namespace std;
43 
44 
47 {
48  public:
50  const std::string& name,
52  edm::ConsumesCollector& consumesCollector
53  );
55 
56  private:
57  void initializeForward();
58 };
59 
60 
62  const std::string& name,
64  edm::ConsumesCollector& consumesCollector
65 ):
66  PixelTemplateSmearerBase(name,config,consumesCollector)
67 {
68 
69  isForward = true;
70 
71  theEdgePixelResolutionFileName = config.getParameter<string>( "EdgePixelForwardResolutionFile" );
72  theEdgePixelResolutionFile = std::make_unique<TFile>( edm::FileInPath( theEdgePixelResolutionFileName ).fullPath().c_str() ,"READ");
73  theBigPixelResolutionFileName = config.getParameter<string>( "BigPixelForwardResolutionFile" );
74  theBigPixelResolutionFile = std::make_unique<TFile>( edm::FileInPath( theBigPixelResolutionFileName ).fullPath().c_str() ,"READ");
75  theRegularPixelResolutionFileName = config.getParameter<string>( "RegularPixelForwardResolutionFile" );
76  theRegularPixelResolutionFile = std::make_unique<TFile>( edm::FileInPath( theRegularPixelResolutionFileName ).fullPath().c_str() ,"READ");
77 
78  theMergingProbabilityFileName = config.getParameter<string>( "MergingProbabilityForwardFile" );
79  theMergingProbabilityFile =std::make_unique<TFile>( edm::FileInPath( theMergingProbabilityFileName ).fullPath().c_str() ,"READ");
80  theMergedPixelResolutionXFileName = config.getParameter<string>( "MergedPixelForwardResolutionXFile" );
81  theMergedPixelResolutionXFile = std::make_unique<TFile>( edm::FileInPath( theMergedPixelResolutionXFileName ).fullPath().c_str() ,"READ");
82  theMergedPixelResolutionYFileName = config.getParameter<string>( "MergedPixelForwardResolutionYFile" );
83  theMergedPixelResolutionYFile = std::make_unique<TFile>( edm::FileInPath( theMergedPixelResolutionYFileName ).fullPath().c_str() ,"READ");
84 
86 
87 
88 
90  {
91  throw cms::Exception("PixelForwardTemplateSmearerPlugin:") <<"SiPixel Forward Template Not Loaded Correctly!";
92  }
93 }
94 
95 
97 {
98 }
99 
100 
102 {
103  rescotAlpha_binMin = 0.1;
104  rescotAlpha_binWidth = 0.1;
105  rescotAlpha_binN = 4;
106  rescotBeta_binMin = 0.;
107  rescotBeta_binWidth = 0.15;
108  rescotBeta_binN = 4;
109  resqbin_binMin = 0;
110  resqbin_binWidth = 1;
111  resqbin_binN = 4;
112 
113  // Initialize the forward histos once and for all, and prepare the random generation
114  for ( unsigned cotalphaHistBin=1; cotalphaHistBin<=rescotAlpha_binN; ++cotalphaHistBin)
115  {
116  for ( unsigned cotbetaHistBin=1; cotbetaHistBin<=rescotBeta_binN; ++cotbetaHistBin)
117  {
118  for( unsigned qbinBin=1; qbinBin<=resqbin_binN; ++qbinBin )
119  {
120  unsigned int edgePixelHistN = cotalphaHistBin*1000 + cotbetaHistBin*10 + qbinBin;
121  theXHistos[edgePixelHistN] = new SimpleHistogramGenerator((TH1F*)theEdgePixelResolutionFile->Get(Form("DQMData/clustFPIX/fhx0%u",edgePixelHistN)));
122  theYHistos[edgePixelHistN] = new SimpleHistogramGenerator((TH1F*)theEdgePixelResolutionFile->Get(Form("DQMData/clustFPIX/fhy0%u",edgePixelHistN)));
123 
124  unsigned int PixelHistN = 10000 + cotbetaHistBin*100 + cotalphaHistBin*10 + qbinBin;
125  theXHistos[PixelHistN] = new SimpleHistogramGenerator((TH1F*) theRegularPixelResolutionFile->Get(Form("hx0%u",PixelHistN)));
126  theYHistos[PixelHistN] = new SimpleHistogramGenerator((TH1F*) theRegularPixelResolutionFile->Get(Form("hy0%u",PixelHistN)));
127  }
128  }
129  }
130 
131  for ( unsigned cotalphaHistBin=1; cotalphaHistBin<=rescotAlpha_binN; ++cotalphaHistBin)
132  {
133  for ( unsigned cotbetaHistBin=1; cotbetaHistBin<=rescotBeta_binN; ++cotbetaHistBin)
134  {
135  unsigned int SingleBigPixelHistN = 100000 + cotalphaHistBin*100 + cotbetaHistBin;
136  theXHistos[SingleBigPixelHistN] = new SimpleHistogramGenerator((TH1F*)theBigPixelResolutionFile->Get(Form("DQMData/clustFPIX/fhx%u",SingleBigPixelHistN)));
137  theYHistos[SingleBigPixelHistN] = new SimpleHistogramGenerator((TH1F*)theBigPixelResolutionFile->Get(Form("DQMData/clustFPIX/fhy%u",SingleBigPixelHistN)));
138 
139  unsigned int SinglePixelHistN = cotbetaHistBin*10 + cotalphaHistBin;
140  theXHistos[SinglePixelHistN] = new SimpleHistogramGenerator((TH1F*)theRegularPixelResolutionFile->Get(Form("hx000%u",SinglePixelHistN)));
141  theYHistos[SinglePixelHistN] = new SimpleHistogramGenerator((TH1F*)theRegularPixelResolutionFile->Get(Form("hy000%u",SinglePixelHistN)));
142  }
143  }
144 }
145 
149  "PixelForwardTemplateSmearerPlugin"
150 );
T getParameter(std::string const &) const
std::unique_ptr< TFile > theRegularPixelResolutionFile
std::unique_ptr< TFile > theEdgePixelResolutionFile
static bool pushfile(int filenum, std::vector< SiPixelTemplateStore > &thePixelTemp_)
Definition: config.py:1
PixelForwardTemplateSmearerPlugin(const std::string &name, const edm::ParameterSet &config, edm::ConsumesCollector &consumesCollector)
std::unique_ptr< TFile > theMergingProbabilityFile
std::unique_ptr< TFile > theMergedPixelResolutionXFile
const double microntocm
std::map< unsigned int, const SimpleHistogramGenerator * > theYHistos
std::map< unsigned int, const SimpleHistogramGenerator * > theXHistos
std::unique_ptr< TFile > theBigPixelResolutionFile
std::vector< SiPixelTemplateStore > thePixelTemp_
std::unique_ptr< TFile > theMergedPixelResolutionYFile
std::string fullPath() const
Definition: FileInPath.cc:197
#define DEFINE_EDM_PLUGIN(factory, type, name)