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