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 #include <boost/lexical_cast.hpp>
7 
8 void LA_Filler_Fitter::fill(TTree* tree, Book& book) const {
9  TTREE_FOREACH_ENTRY(tree) {
10  TFE_MAX(maxEvents_);
11  TFE_PRINTSTATUS;
12  std::vector<unsigned> PLEAF(tsostrackmulti, tree);
13  std::vector<unsigned> PLEAF(clusterdetid, tree);
14  std::vector<unsigned> PLEAF(clusterwidth, tree);
15  std::vector<float> PLEAF(clustervariance, tree);
16  std::vector<float> PLEAF(tsosdriftx, tree);
17  std::vector<float> PLEAF(tsosdriftz, tree);
18  std::vector<float> PLEAF(tsoslocaltheta, tree);
19  std::vector<float> PLEAF(tsoslocalphi, tree);
20  std::vector<float> PLEAF(tsosglobalZofunitlocalY, tree);
21 
22  const unsigned N(clusterdetid.size());
23  std::vector<float> BdotY(N, 0);
24  if (!ensembleBins_) {
25  std::vector<float> PLEAF(tsosBdotY, tree);
26  swap(BdotY, tsosBdotY);
27  }
28  std::vector<float> localy(N, 0);
29  if (localYbin_) {
30  std::vector<float> PLEAF(tsoslocaly, tree);
31  swap(localy, tsoslocaly);
32  }
33  std::vector<unsigned> seedstrip(N, 0);
34  if (stripsPerBin_) {
35  std::vector<unsigned> PLEAF(clusterseedstrip, tree);
36  swap(seedstrip, clusterseedstrip);
37  }
38 
39  for (unsigned i = 0; i < N; i++) {
40  const SiStripDetId detid(clusterdetid[i]);
41  if (tsostrackmulti[i] != 1 ||
43  continue;
44 
45  const int sign = tsosglobalZofunitlocalY[i] < 0 ? -1 : 1;
46  const float tthetaL = sign * tsosdriftx[i] / tsosdriftz[i];
47  const float tthetaT = sign * tan(tsoslocaltheta[i]) * cos(tsoslocalphi[i]);
48 
49  fill_one_cluster(book,
50  granularity(detid, tthetaL, TFE_index, localy[i], seedstrip[i] % 128),
51  clusterwidth[i],
52  clustervariance[i],
53  tthetaL,
54  tthetaT,
55  fabs(BdotY[i]));
56  }
57  }
58 }
59 
61  const poly<std::string>& gran,
62  const unsigned width,
63  const float variance,
64  const float tthetaL,
65  const float tthetaT,
66  const float BdotY) const {
67  book.fill(tthetaL, gran + "_reconstruction", 360, -1.0, 1.0);
68  book.fill(tthetaT - tthetaL, gran + allAndOne(width), 360, -1.0, 1.0);
69  book.fill(tthetaT - tthetaL, variance, gran + varWidth(width), 360, -1.0, 1.0);
70  if (methods_ & WIDTH)
71  book.fill(tthetaT, width, gran + method(WIDTH), 81, -0.6, 0.6);
72  if (!ensembleBins_) {
73  book.fill(BdotY, gran + "_field", 101, 1, 5);
74  book.fill(width, gran + "_width", 10, 0, 10);
75  }
76 }
77 
79  poly<std::string> a1("_all");
80  if (width == 1)
81  a1 *= "_w1";
82  return a1;
83 }
84 
87  vw++;
88  if (width == 2 && methods_ & (AVGV2 | RMSV2))
89  vw *= method(AVGV2, false);
90  if (width == 3 && methods_ & (AVGV3 | RMSV3))
91  vw *= method(AVGV3, false);
92  return vw;
93 }
94 
96  const float tthetaL,
97  const Long64_t TFE_index,
98  const float localy,
99  const unsigned apvstrip) const {
100  poly<std::string> gran;
101  gran += subdetLabel(detid);
102  if (byLayer_)
103  gran *= layerLabel(detid);
104  if (byModule_)
105  gran *= moduleLabel(detid);
106  if (localYbin_)
107  gran += (localy < 0 ? "_yM" : "_yP") + std::to_string(abs((int)(localy / localYbin_ + (localy < 0 ? -1 : 0))));
108  if (stripsPerBin_)
109  gran += "_strip" +
110  std::to_string(
111  (unsigned)((0.5 + ((apvstrip / 64) ? (127 - apvstrip) : apvstrip) / stripsPerBin_) * stripsPerBin_));
112  if (ensembleBins_) {
113  gran +=
114  "_ensembleBin" + std::to_string((int)(ensembleBins_ * (tthetaL - ensembleLow_) / (ensembleUp_ - ensembleLow_)));
115  gran += "";
116  if (ensembleSize_)
117  gran *= "_sample" + std::to_string(TFE_index % ensembleSize_);
118  }
119  return gran;
120 }
121 
123  return detid.subDetector() == SiStripDetId::TOB ? "TOB" : "TIB";
124 }
126  return subdetLabel(detid) + "_module" + std::to_string(detid());
127 }
129  const bool isTIB = detid.subdetId() == StripSubdetector::TIB;
130  unsigned layer = isTIB ? tTopo_->tibLayer(detid) : tTopo_->tobLayer(detid);
131  bool stereo = isTIB ? tTopo_->tibStereo(detid) : tTopo_->tobStereo(detid);
132 
133  return subdetLabel(detid) + "_layer" + std::to_string(layer) + (stereo ? "s" : "a");
134 }
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:355
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:78
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:122
LA_Filler_Fitter::layerLabel
std::string layerLabel(const SiStripDetId) const
Definition: LA_Filler.cc:128
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:60
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:85
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:125
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
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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:95
LA_Filler_Fitter::AVGV3
Definition: LA_Filler_Fitter.h:55
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:8
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