test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
8 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); if(!ensembleBins_) { std::vector<float> PLEAF( tsosBdotY , tree ); swap(BdotY, tsosBdotY); }
24  std::vector<float> localy(N,0); if(localYbin_) { std::vector<float> PLEAF( tsoslocaly , tree ); swap(localy, tsoslocaly);}
25  std::vector<unsigned> seedstrip(N,0); if(stripsPerBin_) { std::vector<unsigned> PLEAF( clusterseedstrip , tree ); swap(seedstrip, clusterseedstrip);}
26 
27  for(unsigned i=0; i<N ; i++) {
28 
29  const SiStripDetId detid(clusterdetid[i]);
30  if( tsostrackmulti[i] != 1 || ( detid.subDetector()!=SiStripDetId::TIB &&
31  detid.subDetector()!=SiStripDetId::TOB) ) continue;
32 
33  const int sign = tsosglobalZofunitlocalY[i] < 0 ? -1 : 1;
34  const float tthetaL = sign * tsosdriftx[i] / tsosdriftz[i];
35  const float tthetaT = sign * tan(tsoslocaltheta[i]) * cos(tsoslocalphi[i]);
36 
37  fill_one_cluster( book,
38  granularity(detid, tthetaL, TFE_index, localy[i], seedstrip[i]%128),
39  clusterwidth[i], clustervariance[i], tthetaL, tthetaT, fabs(BdotY[i]) );
40  }
41  }
42 }
43 
46  const poly<std::string>& gran,
47  const unsigned width, const float variance, const float tthetaL, const float tthetaT, const float BdotY ) const
48 {
49  book.fill( tthetaL, gran+"_reconstruction", 360,-1.0,1.0 );
50  book.fill( tthetaT-tthetaL, gran+ allAndOne(width), 360,-1.0,1.0 );
51  book.fill( tthetaT-tthetaL, variance, gran+ varWidth(width), 360,-1.0,1.0 );
52  if(methods_ & WIDTH) book.fill( tthetaT, width, gran+method(WIDTH), 81,-0.6,0.6 );
53  if(!ensembleBins_) {
54  book.fill( BdotY, gran+"_field", 101,1,5);
55  book.fill( width, gran+"_width", 10,0,10);
56  }
57 }
58 
60 allAndOne(const unsigned width) const
61 { poly<std::string> a1("_all"); if(width==1) a1*="_w1"; return a1;}
62 
64 varWidth(const unsigned width) const {
65  poly<std::string> vw; vw++;
66  if(width==2 && methods_ & (AVGV2|RMSV2) ) vw*=method(AVGV2,0);
67  if(width==3 && methods_ & (AVGV3|RMSV3) ) vw*=method(AVGV3,0);
68  return vw;
69 }
70 
72 granularity(const SiStripDetId detid, const float tthetaL, const Long64_t TFE_index, const float localy, const unsigned apvstrip) const {
73  poly<std::string> gran;
74  gran += subdetLabel(detid);
75  if(byLayer_) gran *= layerLabel(detid);
76  if(byModule_) gran *= moduleLabel(detid);
77  if(localYbin_) gran += (localy < 0 ? "_yM":"_yP") + boost::lexical_cast<std::string>(abs((int)(localy/localYbin_+(localy<0?-1:0))));
78  if(stripsPerBin_) gran += "_strip"+boost::lexical_cast<std::string>((unsigned)((0.5+((apvstrip/64)?(127-apvstrip):apvstrip)/stripsPerBin_)*stripsPerBin_) );
79  if(ensembleBins_) {
80  gran+= "_ensembleBin"+boost::lexical_cast<std::string>((int)(ensembleBins_*(tthetaL-ensembleLow_)/(ensembleUp_-ensembleLow_)));
81  gran+= "";
82  if(ensembleSize_) gran*= "_sample"+boost::lexical_cast<std::string>(TFE_index % ensembleSize_);
83  }
84  return gran;
85 }
86 
88 subdetLabel(const SiStripDetId detid) { return detid.subDetector()==SiStripDetId::TOB? "TOB" : "TIB";}
90 moduleLabel(const SiStripDetId detid) { return subdetLabel(detid) + "_module"+boost::lexical_cast<std::string>(detid());}
92 layerLabel(const SiStripDetId detid) {
93  unsigned layer = detid.subDetector() == SiStripDetId::TOB ? TOBDetId(detid()).layer() : TIBDetId(detid()).layer();
94  return subdetLabel(detid)+"_layer"+boost::lexical_cast<std::string>(layer)+(detid.stereo()?"s":"a");
95 }
void swap(ora::Record &rh, ora::Record &lh)
Definition: Record.h:70
int i
Definition: DBlmapReader.cc:9
unsigned int layer() const
layer id
Definition: TOBDetId.h:39
uint32_t stereo() const
Definition: SiStripDetId.h:160
double sign(double x)
const Long64_t maxEvents_
poly< std::string > granularity(const SiStripDetId, const float, const Long64_t, const float, const unsigned) const
Definition: LA_Filler.cc:72
void fill(TTree *, Book &) const
Definition: LA_Filler.cc:8
static std::string moduleLabel(const SiStripDetId)
Definition: LA_Filler.cc:90
static std::string layerLabel(const SiStripDetId)
Definition: LA_Filler.cc:92
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:64
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:11
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 double ensembleUp_
static std::string subdetLabel(const SiStripDetId)
Definition: LA_Filler.cc:88
unsigned int layer() const
layer id
Definition: TIBDetId.h:41
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:45
const double ensembleLow_
poly< std::string > allAndOne(const unsigned width) const
Definition: LA_Filler.cc:60