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" +
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 }
poly< std::string > varWidth(const unsigned width) const
Definition: LA_Filler.cc:84
unsigned int tobLayer(const DetId &id) const
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
const Long64_t maxEvents_
SubDetector subDetector() const
Definition: SiStripDetId.h:105
static std::string moduleLabel(const SiStripDetId)
Definition: LA_Filler.cc:124
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:117
static std::string to_string(const XMLCh *ch)
const float localYbin_
uint32_t tobStereo(const DetId &id) const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
poly< std::string > granularity(const SiStripDetId, const float, const Long64_t, const float, const unsigned) const
Definition: LA_Filler.cc:94
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Definition: poly.h:11
static constexpr auto TOB
Definition: SiStripDetId.h:39
static std::string method(Method m, bool fit=true)
poly< std::string > allAndOne(const unsigned width) const
Definition: LA_Filler.cc:77
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
static constexpr auto TIB
#define N
Definition: blowfish.cc:9
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
const TrackerTopology * tTopo_
const double ensembleUp_
static constexpr auto TIB
Definition: SiStripDetId.h:37
static std::string subdetLabel(const SiStripDetId)
Definition: LA_Filler.cc:121
void fill(TTree *, Book &) const
Definition: LA_Filler.cc:7
const unsigned stripsPerBin_
std::string layerLabel(const SiStripDetId) const
Definition: LA_Filler.cc:127
Definition: Book.h:16
unsigned int tibLayer(const DetId &id) const
Definition: tree.py:1
const double ensembleLow_
uint32_t tibStereo(const DetId &id) const