CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CentralityDQM.cc
Go to the documentation of this file.
2 
3 #include <memory>
4 
5 // DQM
9 
10 // Framework
17 
18 // Centrality
21 
22 using namespace edm;
23 using namespace reco;
24 using namespace hi;
25 
26 //
27 // -- Constructor
28 //
30 
31  edm::LogInfo("CentralityDQM") << " Starting CentralityDQM "
32  << "\n";
33 
34  centralityTag_ = ps.getParameter<InputTag>("centralitycollection");
35  centralityToken = consumes<reco::Centrality>(centralityTag_);
36 
37  centralityBinTag_ = (ps.getParameter<edm::InputTag> ("centralitybincollection"));
38  centralityBinToken = consumes<int>(centralityBinTag_);
39 
40 
41  vertexTag_ = ps.getParameter<InputTag>("vertexcollection");
42  vertexToken = consumes<std::vector<reco::Vertex> >(vertexTag_);
43 
44  eventplaneTag_ = ps.getParameter<InputTag>("eventplanecollection");
45  eventplaneToken = consumes<reco::EvtPlaneCollection>(eventplaneTag_);
46 
47  // just to initialize
48 }
49 
50 //
51 // -- Destructor
52 //
54  edm::LogInfo("CentralityDQM") << " Deleting CentralityDQM "
55  << "\n";
56 }
57 
58 //
59 // -- Book histograms
60 //
62  edm::EventSetup const&) {
63  // void CentralityDQM::bookHistograms(DQMStore* bei){
64 
65  bei.setCurrentFolder("Physics/Centrality/");
66 
67  h_hiNpix = bei.book1D("h_hiNpix", "h_hiNpix", 750, 0, 75000);
68  h_hiNpixelTracks =
69  bei.book1D("h_hiNpixelTracks", "hiNpixelTracks", 500, 0, 5000);
70  h_hiNtracks = bei.book1D("h_hiNtracks", "h_hiNtracks", 500, 0, 5000);
71  h_hiNtracksPtCut =
72  bei.book1D("h_hiNtracksPtCut", "h_hiNtracksPtCut", 500, 0, 5000);
73  h_hiNtracksEtaCut =
74  bei.book1D("h_hiNtracksEtaCut", "h_hiNtracksEtaCut", 500, 0, 5000);
75  h_hiNtracksEtaPtCut =
76  bei.book1D("h_hiNtracksEtaPtCut", "h_hiNtracksEtaPtCut", 500, 0, 5000);
77 
78  h_hiHF = bei.book1D("h_hiHF", "h_hiHF", 900, 0, 9000);
79  h_hiHFplus = bei.book1D("h_hiHFplus", "h_hiHFplus", 900, 0, 9000);
80  h_hiHFminus = bei.book1D("h_hiHFminus", "h_hiHFminus", 900, 0, 9000);
81  h_hiHFplusEta4 = bei.book1D("h_hiHFplusEta4", "h_hiHFplusEta4", 900, 0, 9000);
82  h_hiHFminusEta4 =
83  bei.book1D("h_hiHFminusEta4", "h_hiHFminusEta4", 900, 0, 9000);
84 
85  h_hiHFhit = bei.book1D("h_hiHFhit", "h_hiHFhit", 3000, 0, 300000);
86  h_hiHFhitPlus = bei.book1D("h_hiHFhitPlus", "h_hiHFhitPlus", 2000, 0, 200000);
87  h_hiHFhitMinus =
88  bei.book1D("h_hiHFhitMinus", "h_hiHFhitMinus", 2000, 0, 200000);
89 
90  h_hiEB = bei.book1D("h_hiEB", "h_hiEB", 600, 0, 6000);
91  h_hiET = bei.book1D("h_hiET", "h_hiET", 600, 0, 6000);
92  h_hiEE = bei.book1D("h_hiEE", "h_hiEE", 600, 0, 6000);
93  h_hiEEplus = bei.book1D("h_hiEEplus", "h_hiEEplus", 600, 0, 6000);
94  h_hiEEminus = bei.book1D("h_hiEEminus", "h_hiEEminus", 600, 0, 6000);
95  h_hiZDC = bei.book1D("h_hiZDC", "h_hiZDC", 600, 0, 6000);
96  h_hiZDCplus = bei.book1D("h_hiZDCplus", "h_hiZDCplus", 600, 0, 6000);
97  h_hiZDCminus = bei.book1D("h_hiZDCminus", "h_hiZDCminus", 600, 0, 6000);
98 
99  h_vertex_x = bei.book1D("h_vertex_x", "h_vertex_x", 400, -4, 4);
100  h_vertex_y = bei.book1D("h_vertex_y", "h_vertex_y", 400, -4, 4);
101  h_vertex_z = bei.book1D("h_vertex_z", "h_vertex_z", 400, -40, 40);
102 
103  h_cent_bin = bei.book1D("h_cent_bin", "h_cent_bin", 200, 0, 200);
104 
105  Double_t psirange = 4;
106  bei.setCurrentFolder("Physics/Centrality/EventPlane/");
107  h_ep_HFm1 = bei.book1D("h_ep_HFm1", "h_ep_HFm1", 800,-psirange,psirange);
108  h_ep_HFp1 = bei.book1D("h_ep_HFp1", "h_ep_HFp1", 800,-psirange,psirange);
109  h_ep_trackm1 = bei.book1D("h_ep_trackm1", "h_ep_trackm1", 800,-psirange,psirange);
110  h_ep_trackp1 = bei.book1D("h_ep_trackp1", "h_ep_trackp1", 800,-psirange,psirange);
111  h_ep_castor1 = bei.book1D("h_ep_castor1", "h_ep_castor1", 800,-psirange,psirange);
112  h_ep_HFm2 = bei.book1D("h_ep_HFm2", "h_ep_HFm2", 800,-psirange,psirange);
113  h_ep_HFp2 = bei.book1D("h_ep_HFp2", "h_ep_HFp2", 800,-psirange,psirange);
114  h_ep_trackmid2 = bei.book1D("h_ep_trackmid2", "h_ep_trackmid2", 800,-psirange,psirange);
115  h_ep_trackm2 = bei.book1D("h_ep_trackm2", "h_ep_trackm2", 800,-psirange,psirange);
116  h_ep_trackp2 = bei.book1D("h_ep_trackp2", "h_ep_trackp2", 800,-psirange,psirange);
117  h_ep_castor2 = bei.book1D("h_ep_castor2", "h_ep_castor2", 800,-psirange,psirange);
118  h_ep_HFm3 = bei.book1D("h_ep_HFm3", "h_ep_HFm3", 800,-psirange,psirange);
119  h_ep_HFp3 = bei.book1D("h_ep_HFp3", "h_ep_HFp3", 800,-psirange,psirange);
120  h_ep_trackmid3 = bei.book1D("h_ep_trackmid3", "h_ep_trackmid3", 800,-psirange,psirange);
121 
122 }
123 
124 //
125 // -- Analyze
126 //
128  const edm::EventSetup& iSetup) {
129 
130  using namespace edm;
132  iEvent.getByToken(centralityToken, cent); //_centralitytag comes from the cfg
133 
134  edm::Handle<int> cbin;
135  iEvent.getByToken(centralityBinToken, cbin);
136 
137  // as an inputTag and is
138  //"hiCentrality"
140  iEvent.getByToken(eventplaneToken, ep);
141 
142  // if (!cent.isValid()) return;
143  if(cent.isValid()){
144  int hibin = *cbin;
145 
146  // std::cout<< " ------------------------------------- " << hibin << std::endl;
147 
148  h_cent_bin->Fill(hibin);
149  h_hiNpix->Fill(cent->multiplicityPixel());
150  h_hiNpixelTracks->Fill(cent->NpixelTracks());
151  h_hiNtracks->Fill(cent->Ntracks()); //
152 
153  h_hiNtracksPtCut->Fill(cent->NtracksPtCut());
154  h_hiNtracksEtaCut->Fill(cent->NtracksEtaCut());
155  h_hiNtracksEtaPtCut->Fill(cent->NtracksEtaPtCut());
156 
157  h_hiHF->Fill(cent->EtHFtowerSum());
158  h_hiHFplus->Fill(cent->EtHFtowerSumPlus());
159  h_hiHFminus->Fill(cent->EtHFtowerSumMinus());
160  h_hiHFplusEta4->Fill(cent->EtHFtruncatedPlus());
161  h_hiHFminusEta4->Fill(cent->EtHFtruncatedMinus());
162 
163  h_hiHFhit->Fill(cent->EtHFhitSum());
164  h_hiHFhitPlus->Fill(cent->EtHFhitSumPlus());
165  h_hiHFhitMinus->Fill(cent->EtHFhitSumMinus());
166 
167  h_hiZDC->Fill(cent->zdcSum());
168  h_hiZDCplus->Fill(cent->zdcSumPlus());
169  h_hiZDCminus->Fill(cent->zdcSumMinus());
170 
171  h_hiEEplus->Fill(cent->EtEESumPlus());
172  h_hiEEminus->Fill(cent->EtEESumMinus());
173  h_hiEE->Fill(cent->EtEESum());
174  h_hiEB->Fill(cent->EtEBSum());
175  h_hiET->Fill(cent->EtMidRapiditySum());
176 
177 
178 
180  iEvent.getByToken(vertexToken, vertex);
181  h_vertex_x->Fill(vertex->begin()->x());
182  h_vertex_y->Fill(vertex->begin()->y());
183  h_vertex_z->Fill(vertex->begin()->z());
184  }
185 
186  if (ep.isValid()){
187  EvtPlaneCollection::const_iterator rp = ep->begin();
188 
189  h_ep_HFm1->Fill(rp[HFm1].angle(0));
190  h_ep_HFp1->Fill(rp[HFp1].angle(0));
191  h_ep_trackm1->Fill(rp[trackm1].angle(0));
192  h_ep_trackp1->Fill(rp[trackp1].angle(0));
193  h_ep_castor1->Fill(rp[Castor1].angle(0));
194 
195 
196  h_ep_HFm2->Fill(rp[HFm2].angle(0));
197  h_ep_HFp2->Fill(rp[HFp2].angle(0));
198  h_ep_trackmid2->Fill(rp[trackmid2].angle(0));
199  h_ep_trackm2->Fill(rp[trackm2].angle(0));
200  h_ep_trackp2->Fill(rp[trackp2].angle(0));
201  h_ep_castor2->Fill(rp[Castor2].angle(0));
202 
203  h_ep_HFm3->Fill(rp[HFm3].angle(0));
204  h_ep_HFp3->Fill(rp[HFp3].angle(0));
205  h_ep_trackmid3->Fill(rp[trackmid3].angle(0));
206 
207  }
208 }
T getParameter(std::string const &) const
virtual void bookHistograms(DQMStore::IBooker &bei, edm::Run const &, edm::EventSetup const &) override
CentralityDQM(const edm::ParameterSet &ps)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
int iEvent
Definition: GenABIO.cc:230
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
virtual void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
virtual ~CentralityDQM()
Definition: Run.h:43
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11