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 
91  iEvent.getByToken(hoCalibVariableCollectionTag, HOCalib);
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);
184 
185  sprintf(name, "hPedRing_%i", i - 2);
186  sprintf(title, "HO Pedestal in Ring_%i", i - 2);
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);
219  }
220  }
221 
222  Nevents = 0;
223  Nmuons = 0;
224 }
DQMHOAlCaRecoStream::theRootFileName
std::string theRootFileName
Definition: DQMHOAlCaRecoStream.h:43
DQMHOAlCaRecoStream::Nevents
int Nevents
Definition: DQMHOAlCaRecoStream.h:40
MonitorHOAlCaRecoStream_cfi.hoCalibVariableCollectionTag
hoCalibVariableCollectionTag
Definition: MonitorHOAlCaRecoStream_cfi.py:15
DQMHOAlCaRecoStream::hMuonMom
MonitorElement * hMuonMom
Definition: DQMHOAlCaRecoStream.h:19
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
mps_fire.i
i
Definition: mps_fire.py:428
DQMHOAlCaRecoStream::hPedRing
MonitorElement * hPedRing[5]
Definition: DQMHOAlCaRecoStream.h:32
MessageLogger.h
DQMHOAlCaRecoStream::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: DQMHOAlCaRecoStream.cc:83
ESHandle.h
DQMHOAlCaRecoStream::hDirCosine
MonitorElement * hDirCosine
Definition: DQMHOAlCaRecoStream.h:23
edm::Run
Definition: Run.h:45
HOCalibVariableCollection
std::vector< HOCalibVariables > HOCalibVariableCollection
collection of HOcalibration variabale
Definition: HOCalibVariableCollection.h:12
edm
HLT enums.
Definition: AlignableModifier.h:19
DQMHOAlCaRecoStream::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: DQMHOAlCaRecoStream.cc:153
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
DQMHOAlCaRecoStream::m_highRadPosInMuch
double m_highRadPosInMuch
Definition: DQMHOAlCaRecoStream.h:48
DQMStore.h
DQMHOAlCaRecoStream::hMuonPhi
MonitorElement * hMuonPhi
Definition: DQMHOAlCaRecoStream.h:21
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
EDAnalyzer.h
DQMHOAlCaRecoStream::m_sigmaValue
double m_sigmaValue
Definition: DQMHOAlCaRecoStream.h:45
edm::Handle
Definition: AssociativeIterator.h:50
MakerMacros.h
DQMHOAlCaRecoStream::m_lowEdge
double m_lowEdge
Definition: DQMHOAlCaRecoStream.h:51
Service.h
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
DQMHOAlCaRecoStream::folderName_
std::string folderName_
Definition: DQMHOAlCaRecoStream.h:44
DQMHOAlCaRecoStream::DQMHOAlCaRecoStream
DQMHOAlCaRecoStream(const edm::ParameterSet &)
Definition: DQMHOAlCaRecoStream.cc:57
DQMHOAlCaRecoStream::hHOTime
MonitorElement * hHOTime
Definition: DQMHOAlCaRecoStream.h:24
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
dqmdumpme.k
k
Definition: dqmdumpme.py:60
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
DQMHOAlCaRecoStream::~DQMHOAlCaRecoStream
~DQMHOAlCaRecoStream() override
Definition: DQMHOAlCaRecoStream.cc:73
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
DQMHOAlCaRecoStream::m_lowRadPosInMuch
double m_lowRadPosInMuch
Definition: DQMHOAlCaRecoStream.h:47
Event.h
DQMHOAlCaRecoStream.h
DQMHOAlCaRecoStream::saveToFile_
bool saveToFile_
Definition: DQMHOAlCaRecoStream.h:54
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
DQMHOAlCaRecoStream::hMuonEta
MonitorElement * hMuonEta
Definition: DQMHOAlCaRecoStream.h:20
DQMHOAlCaRecoStream::m_nbins
int m_nbins
Definition: DQMHOAlCaRecoStream.h:50
DQMHOAlCaRecoStream::hSignal3x3
MonitorElement * hSignal3x3[9]
Definition: DQMHOAlCaRecoStream.h:38
DQMHOAlCaRecoStream::m_highEdge
double m_highEdge
Definition: DQMHOAlCaRecoStream.h:52
std
Definition: JetResolutionObject.h:76
DQMHOAlCaRecoStream::hMuonMultipl
MonitorElement * hMuonMultipl
Definition: DQMHOAlCaRecoStream.h:18
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
DQMHOAlCaRecoStream::Nmuons
int Nmuons
Definition: DQMHOAlCaRecoStream.h:41
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
DQMHOAlCaRecoStream::hoCalibVariableCollectionTag
edm::EDGetTokenT< HOCalibVariableCollection > hoCalibVariableCollectionTag
Definition: DQMHOAlCaRecoStream.h:55
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
dqm::implementation::IBooker
Definition: DQMStore.h:43
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DQMHOAlCaRecoStream::hSigRing
MonitorElement * hSigRing[5]
Definition: DQMHOAlCaRecoStream.h:26
ParameterSet.h
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
dqm::impl::MonitorElement::setAxisTitle
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:800
edm::InputTag
Definition: InputTag.h:15
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98