CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TSOSHistogramMaker.cc
Go to the documentation of this file.
2 #include <iostream>
3 #include "TH1F.h"
4 #include "TH2F.h"
10 
12  m_2dhistos(false),
13  m_detsels(), m_selnames(), m_seltitles(), m_histocluslenangle(),
14  m_tsosy(), m_tsosx(), m_tsosxy(),
15  m_ttrhy(), m_ttrhx(), m_ttrhxy(),
16  m_tsosdy(), m_tsosdx(), m_tsosdxdy()
17 {}
18 
20  m_2dhistos(iConfig.getUntrackedParameter<bool>("wanted2DHistos",false)),
21  m_detsels(), m_selnames(), m_seltitles(), m_histocluslenangle(),
22  m_tsosy(), m_tsosx(), m_tsosxy(),
23  m_ttrhy(), m_ttrhx(), m_ttrhxy(),
24  m_tsosdy(), m_tsosdx(), m_tsosdxdy()
25 {
26 
28 
29  std::vector<edm::ParameterSet> wantedsubds(iConfig.getParameter<std::vector<edm::ParameterSet> >("wantedSubDets"));
30 
31  std::cout << "selections found: " << wantedsubds.size() << std::endl;
32 
33  for(std::vector<edm::ParameterSet>::iterator ps=wantedsubds.begin();ps!=wantedsubds.end();++ps) {
34  m_selnames.push_back(ps->getParameter<std::string>("detLabel"));
35  if(ps->existsAs<std::string>("title")) {
36  m_seltitles.push_back(ps->getParameter<std::string>("title"));
37  }
38  else {
39  m_seltitles.push_back(ps->getParameter<std::string>("detLabel"));
40  }
41  m_detsels.push_back(DetIdSelector(ps->getUntrackedParameter<std::vector<std::string> >("selection")));
42  }
43 
44  for(unsigned int isel=0;isel<m_detsels.size();++isel) {
45 
46  TFileDirectory subdir = tfserv->mkdir(m_selnames[isel]);
47 
48  std::string name = "tsosy_" + m_selnames[isel];
49  std::string title = "TSOS y " + m_seltitles[isel];
50  m_tsosy.push_back(subdir.make<TH1F>(name.c_str(),title.c_str(),200,-20.,20.));
51  name = "tsosx_" + m_selnames[isel];
52  title = "TSOS x " + m_seltitles[isel];
53  m_tsosx.push_back(subdir.make<TH1F>(name.c_str(),title.c_str(),200,-20.,20.));
54  if(m_2dhistos) {
55  name = "tsosxy_" + m_selnames[isel];
56  title = "TSOS y vs x " + m_seltitles[isel];
57  m_tsosxy.push_back(subdir.make<TH2F>(name.c_str(),title.c_str(),200,-20.,20.,200,-20.,20.));
58  }
59 
60  name = "tsosprojx_" + m_selnames[isel];
61  title = "TSOS x projection " + m_seltitles[isel];
62  m_tsosprojx.push_back(subdir.make<TH1F>(name.c_str(),title.c_str(),400,-2.,2.));
63  name = "tsosprojy_" + m_selnames[isel];
64  title = "TSOS y projection " + m_seltitles[isel];
65  m_tsosprojy.push_back(subdir.make<TH1F>(name.c_str(),title.c_str(),400,-2.,2.));
66 
67  name = "ttrhy_" + m_selnames[isel];
68  title = "TT RecHit y " + m_seltitles[isel];
69  m_ttrhy.push_back(subdir.make<TH1F>(name.c_str(),title.c_str(),200,-20.,20.));
70  name = "ttrhx_" + m_selnames[isel];
71  title = "TT RecHit x " + m_seltitles[isel];
72  m_ttrhx.push_back(subdir.make<TH1F>(name.c_str(),title.c_str(),200,-20.,20.));
73  if(m_2dhistos) {
74  name = "ttrhxy_" + m_selnames[isel];
75  title = "TT RecHit y vs x " + m_seltitles[isel];
76  m_ttrhxy.push_back(subdir.make<TH2F>(name.c_str(),title.c_str(),200,-20.,20.,200,-20.,20.));
77  }
78 
79  name = "tsosdy_" + m_selnames[isel];
80  title = "TSOS-TTRH y " + m_seltitles[isel];
81  m_tsosdy.push_back(subdir.make<TH1F>(name.c_str(),title.c_str(),200,-5.,5.));
82  name = "tsosdx_" + m_selnames[isel];
83  title = "TSOS-TTRH x " + m_seltitles[isel];
84  m_tsosdx.push_back(subdir.make<TH1F>(name.c_str(),title.c_str(),200,-0.1,0.1));
85  if(m_2dhistos) {
86  name = "tsosdxdy_" + m_selnames[isel];
87  title = "TSOS-TTRH dy vs dy " + m_seltitles[isel];
88  m_tsosdxdy.push_back(subdir.make<TH2F>(name.c_str(),title.c_str(),200,-0.1,0.1,200,-5.,5.));
89  }
90 
91  name = "cluslenangle_" + m_selnames[isel];
92  title = "Cluster Length vs Track Angle " + m_seltitles[isel];
93  m_histocluslenangle.push_back(subdir.make<TH2F>(name.c_str(),title.c_str(),200,-1.,1.,40,-0.5,39.5));
94 
95  }
96 }
97 
99 
100  if(hit==0 || !hit->isValid()) return;
101 
102  for(unsigned int i=0; i<m_detsels.size() ; ++i) {
103 
104  if(m_detsels[i].isSelected(hit->geographicalId())) {
105 
106  m_tsosy[i]->Fill(tsos.localPosition().y());
107  m_tsosx[i]->Fill(tsos.localPosition().x());
108  if(m_2dhistos) m_tsosxy[i]->Fill(tsos.localPosition().x(),tsos.localPosition().y());
109  m_ttrhy[i]->Fill(hit->localPosition().y());
110  m_ttrhx[i]->Fill(hit->localPosition().x());
111  if(m_2dhistos) m_ttrhxy[i]->Fill(hit->localPosition().x(),hit->localPosition().y());
112  m_tsosdy[i]->Fill(tsos.localPosition().y()-hit->localPosition().y());
113  m_tsosdx[i]->Fill(tsos.localPosition().x()-hit->localPosition().x());
114  if(m_2dhistos) m_tsosdxdy[i]->Fill(tsos.localPosition().x()-hit->localPosition().x(),tsos.localPosition().y()-hit->localPosition().y());
115 
116  if(tsos.localDirection().z() != 0) {
117  m_tsosprojx[i]->Fill(tsos.localDirection().x()/tsos.localDirection().z());
118  m_tsosprojy[i]->Fill(tsos.localDirection().y()/tsos.localDirection().z());
119  }
120 
121  }
122 
123  }
124 
125 
126 }
127 
128 
129 
T getParameter(std::string const &) const
std::vector< std::string > m_selnames
int i
Definition: DBlmapReader.cc:9
std::vector< TH1F * > m_tsosprojy
std::vector< TH1F * > m_tsosdx
std::vector< TH2F * > m_tsosdxdy
LocalVector localDirection() const
void fill(const TrajectoryStateOnSurface &tsos, TransientTrackingRecHit::ConstRecHitPointer hit) const
std::vector< TH1F * > m_tsosdy
T y() const
Definition: PV3DBase.h:63
std::vector< TH1F * > m_tsosprojx
std::vector< TH1F * > m_tsosy
std::vector< std::string > m_seltitles
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
T z() const
Definition: PV3DBase.h:64
T * make(const Args &...args) const
make new ROOT object
std::vector< TH1F * > m_tsosx
std::vector< TH1F * > m_ttrhx
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
std::vector< DetIdSelector > m_detsels
std::vector< TH2F * > m_tsosxy
std::vector< TH2F * > m_histocluslenangle
std::vector< TH2F * > m_ttrhxy
std::vector< TH1F * > m_ttrhy
tuple cout
Definition: gather_cfg.py:145
volatile std::atomic< bool > shutdown_flag false
T x() const
Definition: PV3DBase.h:62