CMS 3D CMS Logo

LA_Filler.cc
Go to the documentation of this file.
2 #include "CalibTracker/SiStripCommon/interface/TTREE_FOREACH_ENTRY.hh"
4 
5 #include <cmath>
6 
7 void LA_Filler_Fitter::fill(TTree* tree, Book& book) const {
8  TTREE_FOREACH_ENTRY(tree) {
9  TFE_MAX(maxEvents_);
10  TFE_PRINTSTATUS;
11  std::vector<unsigned> PLEAF(tsostrackmulti, tree);
12  std::vector<unsigned> PLEAF(clusterdetid, tree);
13  std::vector<unsigned> PLEAF(clusterwidth, tree);
14  std::vector<float> PLEAF(clustervariance, tree);
15  std::vector<float> PLEAF(tsosdriftx, tree);
16  std::vector<float> PLEAF(tsosdriftz, tree);
17  std::vector<float> PLEAF(tsoslocaltheta, tree);
18  std::vector<float> PLEAF(tsoslocalphi, tree);
19  std::vector<float> PLEAF(tsosglobalZofunitlocalY, tree);
20 
21  const unsigned N(clusterdetid.size());
22  std::vector<float> BdotY(N, 0);
23  if (!ensembleBins_) {
24  std::vector<float> PLEAF(tsosBdotY, tree);
25  swap(BdotY, tsosBdotY);
26  }
27  std::vector<float> localy(N, 0);
28  if (localYbin_) {
29  std::vector<float> PLEAF(tsoslocaly, tree);
30  swap(localy, tsoslocaly);
31  }
32  std::vector<unsigned> seedstrip(N, 0);
33  if (stripsPerBin_) {
34  std::vector<unsigned> PLEAF(clusterseedstrip, tree);
35  swap(seedstrip, clusterseedstrip);
36  }
37 
38  for (unsigned i = 0; i < N; i++) {
39  const SiStripDetId detid(clusterdetid[i]);
40  if (tsostrackmulti[i] != 1 ||
42  continue;
43 
44  const int sign = tsosglobalZofunitlocalY[i] < 0 ? -1 : 1;
45  const float tthetaL = sign * tsosdriftx[i] / tsosdriftz[i];
46  const float tthetaT = sign * tan(tsoslocaltheta[i]) * cos(tsoslocalphi[i]);
47 
48  fill_one_cluster(book,
49  granularity(detid, tthetaL, TFE_index, localy[i], seedstrip[i] % 128),
50  clusterwidth[i],
51  clustervariance[i],
52  tthetaL,
53  tthetaT,
54  fabs(BdotY[i]));
55  }
56  }
57 }
58 
60  const poly<std::string>& gran,
61  const unsigned width,
62  const float variance,
63  const float tthetaL,
64  const float tthetaT,
65  const float BdotY) const {
66  book.fill(tthetaL, gran + "_reconstruction", 360, -1.0, 1.0);
67  book.fill(tthetaT - tthetaL, gran + allAndOne(width), 360, -1.0, 1.0);
68  book.fill(tthetaT - tthetaL, variance, gran + varWidth(width), 360, -1.0, 1.0);
69  if (methods_ & WIDTH)
70  book.fill(tthetaT, width, gran + method(WIDTH), 81, -0.6, 0.6);
71  if (!ensembleBins_) {
72  book.fill(BdotY, gran + "_field", 101, 1, 5);
73  book.fill(width, gran + "_width", 10, 0, 10);
74  }
75 }
76 
78  poly<std::string> a1("_all");
79  if (width == 1)
80  a1 *= "_w1";
81  return a1;
82 }
83 
86  vw++;
87  if (width == 2 && methods_ & (AVGV2 | RMSV2))
88  vw *= method(AVGV2, false);
89  if (width == 3 && methods_ & (AVGV3 | RMSV3))
90  vw *= method(AVGV3, false);
91  return vw;
92 }
93 
95  const float tthetaL,
96  const Long64_t TFE_index,
97  const float localy,
98  const unsigned apvstrip) const {
99  poly<std::string> gran;
100  gran += subdetLabel(detid);
101  if (byLayer_)
102  gran *= layerLabel(detid);
103  if (byModule_)
104  gran *= moduleLabel(detid);
105  if (localYbin_)
106  gran += (localy < 0 ? "_yM" : "_yP") + std::to_string(abs((int)(localy / localYbin_ + (localy < 0 ? -1 : 0))));
107  if (stripsPerBin_)
108  gran += "_strip" +
109  std::to_string(
110  (unsigned)((0.5 + ((apvstrip / 64) ? (127 - apvstrip) : apvstrip) / stripsPerBin_) * stripsPerBin_));
111  if (ensembleBins_) {
112  gran +=
113  "_ensembleBin" + std::to_string((int)(ensembleBins_ * (tthetaL - ensembleLow_) / (ensembleUp_ - ensembleLow_)));
114  gran += "";
115  if (ensembleSize_)
116  gran *= "_sample" + std::to_string(TFE_index % ensembleSize_);
117  }
118  return gran;
119 }
120 
122  return detid.subDetector() == SiStripDetId::TOB ? "TOB" : "TIB";
123 }
125  return subdetLabel(detid) + "_module" + std::to_string(detid());
126 }
128  const bool isTIB = detid.subdetId() == StripSubdetector::TIB;
129  unsigned layer = isTIB ? tTopo_->tibLayer(detid) : tTopo_->tobLayer(detid);
130  bool stereo = isTIB ? tTopo_->tibStereo(detid) : tTopo_->tobStereo(detid);
131 
132  return subdetLabel(detid) + "_layer" + std::to_string(layer) + (stereo ? "s" : "a");
133 }
LA_Filler_Fitter::ensembleSize_
const int ensembleSize_
Definition: LA_Filler_Fitter.h:131
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
mps_fire.i
i
Definition: mps_fire.py:428
LA_Filler_Fitter::methods_
const int methods_
Definition: LA_Filler_Fitter.h:137
LA_Filler_Fitter.h
LA_Filler_Fitter::byModule_
const bool byModule_
Definition: LA_Filler_Fitter.h:133
tree
Definition: tree.py:1
edm::swap
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:117
LA_Filler_Fitter::allAndOne
poly< std::string > allAndOne(const unsigned width) const
Definition: LA_Filler.cc:77
LA_Filler_Fitter::tTopo_
const TrackerTopology * tTopo_
Definition: LA_Filler_Fitter.h:138
Validation_hcalonly_cfi.sign
sign
Definition: Validation_hcalonly_cfi.py:32
TrackerTopology::tobStereo
uint32_t tobStereo(const DetId &id) const
Definition: TrackerTopology.h:275
Book
Definition: Book.h:16
LA_Filler_Fitter::AVGV2
Definition: LA_Filler_Fitter.h:54
LA_Filler_Fitter::subdetLabel
static std::string subdetLabel(const SiStripDetId)
Definition: LA_Filler.cc:121
LA_Filler_Fitter::layerLabel
std::string layerLabel(const SiStripDetId) const
Definition: LA_Filler.cc:127
LA_Filler_Fitter::fill_one_cluster
void fill_one_cluster(Book &, const poly< std::string > &, const unsigned, const float, const float, const float, const float) const
Definition: LA_Filler.cc:59
LA_Filler_Fitter::RMSV3
Definition: LA_Filler_Fitter.h:57
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
LA_Filler_Fitter::byLayer_
const bool byLayer_
Definition: LA_Filler_Fitter.h:133
LA_Filler_Fitter::method
static std::string method(Method m, bool fit=true)
Definition: LA_Filler_Fitter.h:61
N
#define N
Definition: blowfish.cc:9
LA_Filler_Fitter::varWidth
poly< std::string > varWidth(const unsigned width) const
Definition: LA_Filler.cc:84
LA_Filler_Fitter::ensembleBins_
const int ensembleBins_
Definition: LA_Filler_Fitter.h:131
StripSubdetector::TIB
static constexpr auto TIB
Definition: StripSubdetector.h:16
LA_Filler_Fitter::WIDTH
Definition: LA_Filler_Fitter.h:51
LA_Filler_Fitter::moduleLabel
static std::string moduleLabel(const SiStripDetId)
Definition: LA_Filler.cc:124
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
TrackerTopology::tibStereo
uint32_t tibStereo(const DetId &id) const
Definition: TrackerTopology.h:279
LA_Filler_Fitter::ensembleUp_
const double ensembleUp_
Definition: LA_Filler_Fitter.h:132
Book::fill
void fill(double_t X, const char *name, uint_t NbinsX, double_t Xlow, double_t Xup, double_t W=1)
Definition: Book.h:96
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
LA_Filler_Fitter::stripsPerBin_
const unsigned stripsPerBin_
Definition: LA_Filler_Fitter.h:135
SiStripDetId::TOB
static constexpr auto TOB
Definition: SiStripDetId.h:39
LA_Filler_Fitter::granularity
poly< std::string > granularity(const SiStripDetId, const float, const Long64_t, const float, const unsigned) const
Definition: LA_Filler.cc:94
LA_Filler_Fitter::AVGV3
Definition: LA_Filler_Fitter.h:55
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LA_Filler_Fitter::ensembleLow_
const double ensembleLow_
Definition: LA_Filler_Fitter.h:132
TrackerTopology::tobLayer
unsigned int tobLayer(const DetId &id) const
Definition: TrackerTopology.h:147
poly
Definition: poly.h:11
LA_Filler_Fitter::maxEvents_
const Long64_t maxEvents_
Definition: LA_Filler_Fitter.h:136
SiStripDetId::subDetector
SubDetector subDetector() const
Definition: SiStripDetId.h:105
SiStripDetId::TIB
static constexpr auto TIB
Definition: SiStripDetId.h:37
LA_Filler_Fitter::RMSV2
Definition: LA_Filler_Fitter.h:56
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
SiStripDetId
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
LA_Filler_Fitter::fill
void fill(TTree *, Book &) const
Definition: LA_Filler.cc:7
StripSubdetector.h
LA_Filler_Fitter::localYbin_
const float localYbin_
Definition: LA_Filler_Fitter.h:134
TrackerTopology::tibLayer
unsigned int tibLayer(const DetId &id) const
Definition: TrackerTopology.h:150