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