CMS 3D CMS Logo

PixelBarrelTemplateSmearerPlugin.cc
Go to the documentation of this file.
1 
2 // SiPixel Gaussian Smearing
6 
7 // Geometry
8 //#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
10 //#include "Geometry/CommonDetUnit/interface/GeomDetType.h"
14 
15 // Famos
18 
19 // STL
20 
21 // ROOT
22 #include <TFile.h>
23 #include <TH1F.h>
24 #include <TH2F.h>
25 
26 
27 using namespace std;
28 
31 {
32  public:
34  const std::string& name,
36  edm::ConsumesCollector& consumesCollector
37  );
39 
40  private:
41  void initializeBarrel();
42 };
43 
44 
46  const std::string& name,
48  edm::ConsumesCollector& consumesCollector
49 ):
50  PixelTemplateSmearerBase(name,config,consumesCollector)
51 {
52  isForward = false;
53 
54  theBigPixelResolutionFileName = config.getParameter<string>( "BigPixelBarrelResolutionFile" );
55  theBigPixelResolutionFile = std::make_unique<TFile>( edm::FileInPath( theBigPixelResolutionFileName ).fullPath().c_str() ,"READ");
56  theEdgePixelResolutionFileName = config.getParameter<string>( "EdgePixelBarrelResolutionFile" );
57  theEdgePixelResolutionFile = std::make_unique<TFile>( edm::FileInPath( theEdgePixelResolutionFileName ).fullPath().c_str() ,"READ");
58  theRegularPixelResolutionFileName = config.getParameter<string>( "RegularPixelBarrelResolutionFile" );
59  theRegularPixelResolutionFile = std::make_unique<TFile>( edm::FileInPath( theRegularPixelResolutionFileName ).fullPath().c_str() ,"READ");
60 
61  theMergingProbabilityFileName = config.getParameter<string>( "MergingProbabilityBarrelFile" );
62  theMergingProbabilityFile = std::make_unique<TFile>( edm::FileInPath( theMergingProbabilityFileName ).fullPath().c_str() ,"READ");
63  theMergedPixelResolutionXFileName = config.getParameter<string>( "MergedPixelBarrelResolutionXFile" );
64  theMergedPixelResolutionXFile = std::make_unique<TFile>( edm::FileInPath( theMergedPixelResolutionXFileName ).fullPath().c_str() ,"READ");
65  theMergedPixelResolutionYFileName = config.getParameter<string>( "MergedPixelBarrelResolutionYFile" );
66  theMergedPixelResolutionYFile = std::make_unique<TFile>( edm::FileInPath( theMergedPixelResolutionYFileName ).fullPath().c_str() ,"READ");
67 
69 
71  {
72  throw cms::Exception("PixelBarrelTemplateSmearerPlugin:")<<"SiPixel Barrel Template Not Loaded Correctly!"<<endl;
73  }
74 
75 }
76 
77 
79 {
80 }
81 
82 
84 {
85  rescotAlpha_binMin = -0.2;
86  rescotAlpha_binWidth = 0.08 ;
87  rescotAlpha_binN = 5;
88  rescotBeta_binMin = -5.5;
89  rescotBeta_binWidth = 1.0;
90  rescotBeta_binN = 11;
91  resqbin_binMin = 0;
92  resqbin_binWidth = 1;
93  resqbin_binN = 4;
94 
95  for (unsigned cotalphaHistBin=1; cotalphaHistBin<=rescotAlpha_binN; ++cotalphaHistBin)
96  {
97  for (unsigned cotbetaHistBin=1; cotbetaHistBin<=rescotBeta_binN; ++cotbetaHistBin)
98  {
99  unsigned int singleBigPixelHistN = 1*100000 + cotalphaHistBin*100 + cotbetaHistBin;
100  theXHistos[singleBigPixelHistN] = new SimpleHistogramGenerator((TH1F*)theBigPixelResolutionFile->Get(Form("DQMData/clustBPIX/hx%u",singleBigPixelHistN)));
101  theYHistos[singleBigPixelHistN] = new SimpleHistogramGenerator((TH1F*)theBigPixelResolutionFile->Get(Form("DQMData/clustBPIX/hy%u",singleBigPixelHistN)));
102 
103  unsigned int singlePixelHistN = 1*10000 + cotbetaHistBin*10 + cotalphaHistBin;
104  theXHistos[singlePixelHistN] = new SimpleHistogramGenerator((TH1F*)theRegularPixelResolutionFile->Get(Form("hx%u",singlePixelHistN)));
105  theYHistos[singlePixelHistN] = new SimpleHistogramGenerator((TH1F*)theRegularPixelResolutionFile->Get(Form("hy%u",singlePixelHistN)));
106 
107  for(unsigned qbinBin=1; qbinBin<=resqbin_binN; ++qbinBin )
108  {
109  unsigned int edgePixelHistN = cotalphaHistBin*1000 + cotbetaHistBin*10 + qbinBin;
110  theXHistos[edgePixelHistN] = new SimpleHistogramGenerator((TH1F*)theEdgePixelResolutionFile->Get(Form("DQMData/clustBPIX/hx0%u",edgePixelHistN)));
111  theYHistos[edgePixelHistN] = new SimpleHistogramGenerator((TH1F*)theEdgePixelResolutionFile->Get(Form("DQMData/clustBPIX/hy0%u",edgePixelHistN)));
112 
113  unsigned int multiPixelBigHistN = 1*1000000 + 1*100000 + cotalphaHistBin*1000 + cotbetaHistBin * 10 + qbinBin;
114  theXHistos[multiPixelBigHistN] = new SimpleHistogramGenerator((TH1F*)theBigPixelResolutionFile->Get(Form("DQMData/clustBPIX/hx%u",multiPixelBigHistN)));
115  theYHistos[multiPixelBigHistN] = new SimpleHistogramGenerator((TH1F*)theBigPixelResolutionFile->Get(Form("DQMData/clustBPIX/hy%u",multiPixelBigHistN)));
116 
117  unsigned int multiPixelHistN = 1*100000 + 1*10000 + cotbetaHistBin*100 + cotalphaHistBin*10 + qbinBin;
118  theXHistos[multiPixelHistN] = new SimpleHistogramGenerator((TH1F*)theRegularPixelResolutionFile->Get(Form("hx%u",multiPixelHistN)));
119  theYHistos[multiPixelHistN] = new SimpleHistogramGenerator((TH1F*)theRegularPixelResolutionFile->Get(Form("hy%u",multiPixelHistN)));
120  }
121  }
122  }
123 }
124 
125 
129  "PixelBarrelTemplateSmearerPlugin"
130 );
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
PixelBarrelTemplateSmearerPlugin(const std::string &name, const edm::ParameterSet &config, edm::ConsumesCollector &consumesCollector)
std::unique_ptr< TFile > theMergingProbabilityFile
std::unique_ptr< TFile > theMergedPixelResolutionXFile
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
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::string fullPath() const
Definition: FileInPath.cc:184