CMS 3D CMS Logo

DQMHOAlCaRecoStream.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: DQMHOAlCaRecoStream
4 // Class: DQMHOAlCaRecoStream
5 //
14 //
15 // Original Author: Gobinda Majumder
16 // Created: Mon Mar 2 12:33:08 CET 2009
17 //
18 //
19 
20 // system include files
21 #include <memory>
22 
23 // user include files
24 
26 
31 
33 
38 
39 #include <string>
40 
41 //
42 // class decleration
43 //
44 using namespace std;
45 using namespace edm;
46 
47 //
48 // constants, enums and typedefs
49 //
50 
51 //
52 // static data member definitions
53 //
54 
55 //
56 // constructors and destructor
57 //
59  : hoCalibVariableCollectionTag(
60  consumes<HOCalibVariableCollection>(iConfig.getParameter<edm::InputTag>("hoCalibVariableCollectionTag"))) {
61  // now do what ever initialization is needed
62 
63  theRootFileName = iConfig.getUntrackedParameter<string>("RootFileName", "tmp.root");
64  folderName_ = iConfig.getUntrackedParameter<string>("folderName");
65  m_sigmaValue = iConfig.getUntrackedParameter<double>("sigmaval", 0.2);
66  m_lowRadPosInMuch = iConfig.getUntrackedParameter<double>("lowradposinmuch", 400.0);
67  m_highRadPosInMuch = iConfig.getUntrackedParameter<double>("highradposinmuch", 480.0);
68  m_lowEdge = iConfig.getUntrackedParameter<double>("lowedge", -2.0);
69  m_highEdge = iConfig.getUntrackedParameter<double>("highedge", 6.0);
70  m_nbins = iConfig.getUntrackedParameter<int>("nbins", 40);
71  saveToFile_ = iConfig.getUntrackedParameter<bool>("saveToFile", false);
72 }
73 
75  // do anything here that needs to be done at desctruction time
76  // (e.g. close files, deallocate resources etc.)
77 }
78 
79 //
80 // member functions
81 //
82 
83 // ------------ method called to for each event ------------
85  using namespace edm;
86 
87  Nevents++;
88 
90  bool isCosMu = true;
91 
93 
94  if (!HOCalib.isValid()) {
95  LogDebug("") << "DQMHOAlCaRecoStream:: Error! can't get HOCalib product!" << std::endl;
96  return;
97  }
98 
99  if (isCosMu) {
100  hMuonMultipl->Fill((*HOCalib).size(), 1.);
101  if (!(*HOCalib).empty()) {
102  for (HOCalibVariableCollection::const_iterator hoC = (*HOCalib).begin(); hoC != (*HOCalib).end(); hoC++) {
103  // OK!!!!
104  float okt = 2.;
105  double okx = std::pow((*hoC).trkvx, okt) + std::pow((*hoC).trkvy, okt);
107  double dr = std::pow(okx, 0.5);
108  if (dr < m_lowRadPosInMuch || dr > m_highRadPosInMuch)
109  continue;
110 
111  if ((*hoC).isect < 0)
112  continue;
113  if (fabs((*hoC).trkth - acos(-1.) / 2) < 0.000001)
114  continue;
115  int ieta = int((std::abs((*hoC).isect) % 10000) / 100.) - 30;
116 
117  if (std::abs(ieta) >= 16)
118  continue;
119 
120  Nmuons++;
121 
122  hMuonMom->Fill((*hoC).trkmm, 1.0);
123  hMuonEta->Fill(-log(tan((*hoC).trkth / 2.0)), 1.0);
124  hMuonPhi->Fill((*hoC).trkph, 1.0);
125  hDirCosine->Fill((*hoC).hoang, 1.0);
126  hHOTime->Fill((*hoC).htime, 1.0);
127 
128  double energy = (*hoC).hosig[4];
129  double pedval = (*hoC).hocro;
130  int iring = 0;
131  if (ieta >= -15 && ieta <= -11) {
132  iring = -2;
133  } else if (ieta >= -10 && ieta <= -5) {
134  iring = -1;
135  } else if (ieta >= 5 && ieta <= 10) {
136  iring = 1;
137  } else if (ieta >= 11 && ieta <= 15) {
138  iring = 2;
139  }
140 
141  hSigRing[iring + 2]->Fill(energy, 1.0);
142  hPedRing[iring + 2]->Fill(pedval, 1.0);
143 
144  for (int k = 0; k < 9; k++) {
145  hSignal3x3[k]->Fill((*hoC).hosig[k]);
146  }
147  } // for (HOCalibVariableCollection::const_iterator hoC=(*HOCalib).begin()
148  } // if ((*HOCalib).size() >0 ) {
149  } // if (isCosMu) {
150 }
151 
152 // ------------ method called once each job just before starting event loop
153 // ------------
155  edm::Run const &irun,
156  edm::EventSetup const &isetup) {
157  ibooker.setCurrentFolder(folderName_);
158 
159  char title[200];
160  char name[200];
161 
162  hMuonMom = ibooker.book1D("hMuonMom", "Muon momentum (GeV)", 50, -100, 100);
163  hMuonMom->setAxisTitle("Muon momentum (GeV)", 1);
164 
165  hMuonEta = ibooker.book1D("hMuonEta", "Pseudo-rapidity of muon", 50, -1.5, 1.5);
166  hMuonEta->setAxisTitle("Pseudo-rapidity of muon", 1);
167 
168  hMuonPhi = ibooker.book1D("hMuonPhi", "Azimuthal angle of muon", 24, -acos(-1), acos(-1));
169  hMuonPhi->setAxisTitle("Azimuthal angle of muon", 1);
170 
171  hMuonMultipl = ibooker.book1D("hMuonMultipl", "Muon Multiplicity", 10, 0.5, 10.5);
172  hMuonMultipl->setAxisTitle("Muon Multiplicity", 1);
173 
174  hDirCosine = ibooker.book1D("hDirCosine", "Direction Cosine of muon at HO tower", 50, -1., 1.);
175  hDirCosine->setAxisTitle("Direction Cosine of muon at HO tower", 1);
176 
177  hHOTime = ibooker.book1D("hHOTime", "HO time distribution", 60, -20, 100.);
178  hHOTime->setAxisTitle("HO time distribution", 1);
179 
180  for (int i = 0; i < 5; i++) {
181  sprintf(name, "hSigRing_%i", i - 2);
182  sprintf(title, "HO signal in Ring_%i", i - 2);
183  hSigRing[i] = ibooker.book1D(name, title, m_nbins, m_lowEdge, m_highEdge);
184  hSigRing[i]->setAxisTitle(title, 1);
185 
186  sprintf(name, "hPedRing_%i", i - 2);
187  sprintf(title, "HO Pedestal in Ring_%i", i - 2);
188  hPedRing[i] = ibooker.book1D(name, title, m_nbins, m_lowEdge, m_highEdge);
189  hPedRing[i]->setAxisTitle(title, 1);
190  }
191 
192  // hSigRingm1 = ibooker.book1D("hSigRingm1", "HO signal in Ring-1", m_nbins,
193  // m_lowEdge, m_highEdge); hSigRingm1->setAxisTitle("HO signal in Ring-1",1);
194 
195  // hSigRing00 = ibooker.book1D("hSigRing00", "HO signal in Ring_0", m_nbins,
196  // m_lowEdge, m_highEdge); hSigRing00->setAxisTitle("HO signal in Ring_0",1);
197 
198  // hSigRingp1 = ibooker.book1D("hSigRingp1", "HO signal in Ring-1", m_nbins,
199  // m_lowEdge, m_highEdge); hSigRingp1->setAxisTitle("HO signal in Ring+1",1);
200 
201  // hSigRingp2 = ibooker.book1D("hSigRingp2", "HO signal in Ring-2", m_nbins,
202  // m_lowEdge, m_highEdge); hSigRingp2->setAxisTitle("HO signal in Ring+2",1);
203 
204  // hPedRingm2 = ibooker.book1D("hPedRingm2", "HO pedestal in Ring-2",
205  // m_nbins, m_lowEdge, m_highEdge); hPedRingm1 = ibooker.book1D("hPedRingm1",
206  // "HO pedestal in Ring-1", m_nbins, m_lowEdge, m_highEdge); hPedRing00 =
207  // ibooker.book1D("hPedRing00", "HO pedestal in Ring_0", m_nbins, m_lowEdge,
208  // m_highEdge); hPedRingp1 = ibooker.book1D("hPedRingp1", "HO pedestal in
209  // Ring-1", m_nbins, m_lowEdge, m_highEdge); hPedRingp2 =
210  // ibooker.book1D("hPedRingp2", "HO pedestal in Ring-2", m_nbins, m_lowEdge,
211  // m_highEdge);
212 
213  for (int i = -1; i <= 1; i++) {
214  for (int j = -1; j <= 1; j++) {
215  int k = 3 * (i + 1) + j + 1;
216 
217  sprintf(title, "hSignal3x3_deta%i_dphi%i", i, j);
218  hSignal3x3[k] = ibooker.book1D(title, title, m_nbins, m_lowEdge, m_highEdge);
219  hSignal3x3[k]->setAxisTitle(title, 1);
220  }
221  }
222 
223  Nevents = 0;
224  Nmuons = 0;
225 }
#define LogDebug(id)
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< HOCalibVariableCollection > hoCalibVariableCollectionTag
MonitorElement * hMuonMultipl
MonitorElement * hPedRing[5]
MonitorElement * hMuonEta
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
DQMHOAlCaRecoStream(const edm::ParameterSet &)
MonitorElement * hSigRing[5]
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:224
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MonitorElement * hHOTime
MonitorElement * hSignal3x3[9]
MonitorElement * hMuonMom
bool isValid() const
Definition: HandleBase.h:74
MonitorElement * hMuonPhi
int k[5][pyjets_maxn]
std::vector< HOCalibVariables > HOCalibVariableCollection
collection of HOcalibration variabale
void analyze(const edm::Event &, const edm::EventSetup &) override
HLT enums.
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
MonitorElement * hDirCosine
Definition: Run.h:45