CMS 3D CMS Logo

LA_Filler.cc
Go to the documentation of this file.
2 #include "CalibTracker/SiStripCommon/interface/TTREE_FOREACH_ENTRY.hh"
3 
4 #include <cmath>
5 #include <boost/lexical_cast.hpp>
6 
7 
9 fill(TTree* tree, Book& book) const {
10  TTREE_FOREACH_ENTRY(tree) {
11  TFE_MAX(maxEvents_);
12  TFE_PRINTSTATUS;
13  std::vector<unsigned> PLEAF( tsostrackmulti , tree );
14  std::vector<unsigned> PLEAF( clusterdetid , tree );
15  std::vector<unsigned> PLEAF( clusterwidth , tree );
16  std::vector<float> PLEAF( clustervariance , tree );
17  std::vector<float> PLEAF( tsosdriftx , tree );
18  std::vector<float> PLEAF( tsosdriftz , tree );
19  std::vector<float> PLEAF( tsoslocaltheta , tree );
20  std::vector<float> PLEAF( tsoslocalphi , tree );
21  std::vector<float> PLEAF( tsosglobalZofunitlocalY , tree );
22 
23  const unsigned N(clusterdetid.size());
24  std::vector<float> BdotY(N,0); if(!ensembleBins_) { std::vector<float> PLEAF( tsosBdotY , tree ); swap(BdotY, tsosBdotY); }
25  std::vector<float> localy(N,0); if(localYbin_) { std::vector<float> PLEAF( tsoslocaly , tree ); swap(localy, tsoslocaly);}
26  std::vector<unsigned> seedstrip(N,0); if(stripsPerBin_) { std::vector<unsigned> PLEAF( clusterseedstrip , tree ); swap(seedstrip, clusterseedstrip);}
27 
28  for(unsigned i=0; i<N ; i++) {
29 
30  const SiStripDetId detid(clusterdetid[i]);
31  if( tsostrackmulti[i] != 1 || ( detid.subDetector()!=SiStripDetId::TIB &&
32  detid.subDetector()!=SiStripDetId::TOB) ) continue;
33 
34  const int sign = tsosglobalZofunitlocalY[i] < 0 ? -1 : 1;
35  const float tthetaL = sign * tsosdriftx[i] / tsosdriftz[i];
36  const float tthetaT = sign * tan(tsoslocaltheta[i]) * cos(tsoslocalphi[i]);
37 
38  fill_one_cluster( book,
39  granularity(detid, tthetaL, TFE_index, localy[i], seedstrip[i]%128),
40  clusterwidth[i], clustervariance[i], tthetaL, tthetaT, fabs(BdotY[i]) );
41  }
42  }
43 }
44 
47  const poly<std::string>& gran,
48  const unsigned width, const float variance, const float tthetaL, const float tthetaT, const float BdotY ) const
49 {
50  book.fill( tthetaL, gran+"_reconstruction", 360,-1.0,1.0 );
51  book.fill( tthetaT-tthetaL, gran+ allAndOne(width), 360,-1.0,1.0 );
52  book.fill( tthetaT-tthetaL, variance, gran+ varWidth(width), 360,-1.0,1.0 );
53  if(methods_ & WIDTH) book.fill( tthetaT, width, gran+method(WIDTH), 81,-0.6,0.6 );
54  if(!ensembleBins_) {
55  book.fill( BdotY, gran+"_field", 101,1,5);
56  book.fill( width, gran+"_width", 10,0,10);
57  }
58 }
59 
61 allAndOne(const unsigned width) const
62 { poly<std::string> a1("_all"); if(width==1) a1*="_w1"; return a1;}
63 
65 varWidth(const unsigned width) const {
66  poly<std::string> vw; vw++;
67  if(width==2 && methods_ & (AVGV2|RMSV2) ) vw*=method(AVGV2,false);
68  if(width==3 && methods_ & (AVGV3|RMSV3) ) vw*=method(AVGV3,false);
69  return vw;
70 }
71 
73 granularity(const SiStripDetId detid, const float tthetaL, const Long64_t TFE_index, const float localy, const unsigned apvstrip) const {
74  poly<std::string> gran;
75  gran += subdetLabel(detid);
76  if(byLayer_) gran *= layerLabel(detid);
77  if(byModule_) gran *= moduleLabel(detid);
78  if(localYbin_) gran += (localy < 0 ? "_yM":"_yP") + std::to_string(abs((int)(localy/localYbin_+(localy<0?-1:0))));
79  if(stripsPerBin_) gran += "_strip"+std::to_string((unsigned)((0.5+((apvstrip/64)?(127-apvstrip):apvstrip)/stripsPerBin_)*stripsPerBin_) );
80  if(ensembleBins_) {
81  gran+= "_ensembleBin"+std::to_string((int)(ensembleBins_*(tthetaL-ensembleLow_)/(ensembleUp_-ensembleLow_)));
82  gran+= "";
83  if(ensembleSize_) gran*= "_sample"+std::to_string(TFE_index % ensembleSize_);
84  }
85  return gran;
86 }
87 
89 subdetLabel(const SiStripDetId detid) { return detid.subDetector()==SiStripDetId::TOB ? "TOB" : "TIB";}
91 moduleLabel(const SiStripDetId detid) { return subdetLabel(detid) + "_module"+std::to_string(detid());}
93 layerLabel(const SiStripDetId detid) const {
94  const bool isTIB = detid.subdetId() == StripSubdetector::TIB;
95  unsigned layer = isTIB ? tTopo_->tibLayer(detid) : tTopo_->tobLayer(detid);
96  bool stereo = isTIB ? tTopo_->tibStereo(detid) : tTopo_->tobStereo(detid);
97 
98  return subdetLabel(detid)+"_layer"+std::to_string(layer)+(stereo?"s":"a");
99 }
std::string layerLabel(const SiStripDetId) const
Definition: LA_Filler.cc:93
unsigned int tibLayer(const DetId &id) const
uint32_t tobStereo(const DetId &id) const
const Long64_t maxEvents_
poly< std::string > granularity(const SiStripDetId, const float, const Long64_t, const float, const unsigned) const
Definition: LA_Filler.cc:73
void fill(TTree *, Book &) const
Definition: LA_Filler.cc:9
static std::string moduleLabel(const SiStripDetId)
Definition: LA_Filler.cc:91
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:116
const float localYbin_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
poly< std::string > varWidth(const unsigned width) const
Definition: LA_Filler.cc:65
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: poly.h:10
static std::string method(Method m, bool fit=true)
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
SubDetector subDetector() const
Definition: SiStripDetId.h:114
#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:60
const TrackerTopology * tTopo_
const double ensembleUp_
static std::string subdetLabel(const SiStripDetId)
Definition: LA_Filler.cc:89
const unsigned stripsPerBin_
Definition: Book.h:16
void fill_one_cluster(Book &, const poly< std::string > &, const unsigned, const float, const float, const float, const float) const
Definition: LA_Filler.cc:46
Definition: tree.py:1
uint32_t tibStereo(const DetId &id) const
const double ensembleLow_
poly< std::string > allAndOne(const unsigned width) const
Definition: LA_Filler.cc:61
unsigned int tobLayer(const DetId &id) const