00001
00010 #include "Validation/GlobalHits/interface/GlobalHitsProdHist.h"
00011 #include "Geometry/Records/interface/CaloGeometryRecord.h"
00012
00013 GlobalHitsProdHist::GlobalHitsProdHist(const edm::ParameterSet& iPSet) :
00014 fName(""), verbosity(0), frequency(0), vtxunit(0),
00015 getAllProvenances(false), printProvenanceInfo(false),
00016 G4VtxSrc_(iPSet.getParameter<edm::InputTag>("G4VtxSrc")),
00017 G4TrkSrc_(iPSet.getParameter<edm::InputTag>("G4TrkSrc")),
00018 count(0)
00019 {
00020 std::string MsgLoggerCat = "GlobalHitsProdHist_GlobalHitsProdHist";
00021
00022
00023 fName = iPSet.getUntrackedParameter<std::string>("Name");
00024 verbosity = iPSet.getUntrackedParameter<int>("Verbosity");
00025 frequency = iPSet.getUntrackedParameter<int>("Frequency");
00026 vtxunit = iPSet.getUntrackedParameter<int>("VtxUnit");
00027 edm::ParameterSet m_Prov =
00028 iPSet.getParameter<edm::ParameterSet>("ProvenanceLookup");
00029 getAllProvenances =
00030 m_Prov.getUntrackedParameter<bool>("GetAllProvenances");
00031 printProvenanceInfo =
00032 m_Prov.getUntrackedParameter<bool>("PrintProvenanceInfo");
00033
00034
00035 PxlBrlLowSrc_ = iPSet.getParameter<edm::InputTag>("PxlBrlLowSrc");
00036 PxlBrlHighSrc_ = iPSet.getParameter<edm::InputTag>("PxlBrlHighSrc");
00037 PxlFwdLowSrc_ = iPSet.getParameter<edm::InputTag>("PxlFwdLowSrc");
00038 PxlFwdHighSrc_ = iPSet.getParameter<edm::InputTag>("PxlFwdHighSrc");
00039
00040 SiTIBLowSrc_ = iPSet.getParameter<edm::InputTag>("SiTIBLowSrc");
00041 SiTIBHighSrc_ = iPSet.getParameter<edm::InputTag>("SiTIBHighSrc");
00042 SiTOBLowSrc_ = iPSet.getParameter<edm::InputTag>("SiTOBLowSrc");
00043 SiTOBHighSrc_ = iPSet.getParameter<edm::InputTag>("SiTOBHighSrc");
00044 SiTIDLowSrc_ = iPSet.getParameter<edm::InputTag>("SiTIDLowSrc");
00045 SiTIDHighSrc_ = iPSet.getParameter<edm::InputTag>("SiTIDHighSrc");
00046 SiTECLowSrc_ = iPSet.getParameter<edm::InputTag>("SiTECLowSrc");
00047 SiTECHighSrc_ = iPSet.getParameter<edm::InputTag>("SiTECHighSrc");
00048
00049 MuonCscSrc_ = iPSet.getParameter<edm::InputTag>("MuonCscSrc");
00050 MuonDtSrc_ = iPSet.getParameter<edm::InputTag>("MuonDtSrc");
00051 MuonRpcSrc_ = iPSet.getParameter<edm::InputTag>("MuonRpcSrc");
00052
00053 ECalEBSrc_ = iPSet.getParameter<edm::InputTag>("ECalEBSrc");
00054 ECalEESrc_ = iPSet.getParameter<edm::InputTag>("ECalEESrc");
00055 ECalESSrc_ = iPSet.getParameter<edm::InputTag>("ECalESSrc");
00056
00057 HCalSrc_ = iPSet.getParameter<edm::InputTag>("HCalSrc");
00058
00059
00060
00061 verbosity %= 10;
00062
00063
00064 if (verbosity >= 0) {
00065 edm::LogInfo(MsgLoggerCat)
00066 << "\n===============================\n"
00067 << "Initialized as EDProducer with parameter values:\n"
00068 << " Name = " << fName << "\n"
00069 << " Verbosity = " << verbosity << "\n"
00070 << " Frequency = " << frequency << "\n"
00071 << " VtxUnit = " << vtxunit << "\n"
00072 << " GetProv = " << getAllProvenances << "\n"
00073 << " PrintProv = " << printProvenanceInfo << "\n"
00074 << " PxlBrlLowSrc = " << PxlBrlLowSrc_.label()
00075 << ":" << PxlBrlLowSrc_.instance() << "\n"
00076 << " PxlBrlHighSrc = " << PxlBrlHighSrc_.label()
00077 << ":" << PxlBrlHighSrc_.instance() << "\n"
00078 << " PxlFwdLowSrc = " << PxlFwdLowSrc_.label()
00079 << ":" << PxlBrlLowSrc_.instance() << "\n"
00080 << " PxlFwdHighSrc = " << PxlFwdHighSrc_.label()
00081 << ":" << PxlBrlHighSrc_.instance() << "\n"
00082 << " SiTIBLowSrc = " << SiTIBLowSrc_.label()
00083 << ":" << SiTIBLowSrc_.instance() << "\n"
00084 << " SiTIBHighSrc = " << SiTIBHighSrc_.label()
00085 << ":" << SiTIBHighSrc_.instance() << "\n"
00086 << " SiTOBLowSrc = " << SiTOBLowSrc_.label()
00087 << ":" << SiTOBLowSrc_.instance() << "\n"
00088 << " SiTOBHighSrc = " << SiTOBHighSrc_.label()
00089 << ":" << SiTOBHighSrc_.instance() << "\n"
00090 << " SiTIDLowSrc = " << SiTIDLowSrc_.label()
00091 << ":" << SiTIDLowSrc_.instance() << "\n"
00092 << " SiTIDHighSrc = " << SiTIDHighSrc_.label()
00093 << ":" << SiTIDHighSrc_.instance() << "\n"
00094 << " SiTECLowSrc = " << SiTECLowSrc_.label()
00095 << ":" << SiTECLowSrc_.instance() << "\n"
00096 << " SiTECHighSrc = " << SiTECHighSrc_.label()
00097 << ":" << SiTECHighSrc_.instance() << "\n"
00098 << " MuonCscSrc = " << MuonCscSrc_.label()
00099 << ":" << MuonCscSrc_.instance() << "\n"
00100 << " MuonDtSrc = " << MuonDtSrc_.label()
00101 << ":" << MuonDtSrc_.instance() << "\n"
00102 << " MuonRpcSrc = " << MuonRpcSrc_.label()
00103 << ":" << MuonRpcSrc_.instance() << "\n"
00104 << " ECalEBSrc = " << ECalEBSrc_.label()
00105 << ":" << ECalEBSrc_.instance() << "\n"
00106 << " ECalEESrc = " << ECalEESrc_.label()
00107 << ":" << ECalEESrc_.instance() << "\n"
00108 << " ECalESSrc = " << ECalESSrc_.label()
00109 << ":" << ECalESSrc_.instance() << "\n"
00110 << " HCalSrc = " << HCalSrc_.label()
00111 << ":" << HCalSrc_.instance() << "\n"
00112 << "===============================\n";
00113 }
00114
00115
00116 Char_t hname[200];
00117 Char_t htitle[200];
00118
00119
00120 sprintf(hname,"hMCRGP1");
00121 histName_.push_back(hname);
00122 sprintf(htitle,"RawGenParticles");
00123 hMCRGP[0] = new TH1F(hname,htitle,100,0.,5000.);
00124 sprintf(hname,"hMCRGP2");
00125 histName_.push_back(hname);
00126 hMCRGP[1] = new TH1F(hname,htitle,100,0.,500.);
00127 for (Int_t i = 0; i < 2; ++i) {
00128 hMCRGP[i]->GetXaxis()->SetTitle("Number of Raw Generated Particles");
00129 hMCRGP[i]->GetYaxis()->SetTitle("Count");
00130 histMap_[hMCRGP[i]->GetName()] = hMCRGP[i];
00131 }
00132
00133 sprintf(hname,"hMCG4Vtx1");
00134 histName_.push_back(hname);
00135 sprintf(htitle,"G4 Vertices");
00136 hMCG4Vtx[0] = new TH1F(hname,htitle,100,0.,50000.);
00137 sprintf(hname,"hMCG4Vtx2");
00138 histName_.push_back(hname);
00139 hMCG4Vtx[1] = new TH1F(hname,htitle,100,-0.5,99.5);
00140 for (Int_t i = 0; i < 2; ++i) {
00141 hMCG4Vtx[i]->GetXaxis()->SetTitle("Number of Vertices");
00142 hMCG4Vtx[i]->GetYaxis()->SetTitle("Count");
00143 histMap_[hMCG4Vtx[i]->GetName()] = hMCG4Vtx[i];
00144 }
00145
00146 sprintf(hname,"hMCG4Trk1");
00147 histName_.push_back(hname);
00148 sprintf(htitle,"G4 Tracks");
00149 hMCG4Trk[0] = new TH1F(hname,htitle,150,0.,15000.);
00150 sprintf(hname,"hMCG4Trk2");
00151 histName_.push_back(hname);
00152 hMCG4Trk[1] = new TH1F(hname,htitle,150,-0.5,99.5);
00153 for (Int_t i = 0; i < 2; ++i) {
00154 hMCG4Trk[i]->GetXaxis()->SetTitle("Number of Tracks");
00155 hMCG4Trk[i]->GetYaxis()->SetTitle("Count");
00156 histMap_[hMCG4Trk[i]->GetName()] = hMCG4Trk[i];
00157 }
00158
00159 sprintf(hname,"hGeantVtxX1");
00160 histName_.push_back(hname);
00161 sprintf(htitle,"Geant vertex x/micrometer");
00162 hGeantVtxX[0] = new TH1F(hname,htitle,100,-8000000.,8000000.);
00163 sprintf(hname,"hGeantVtxX2");
00164 histName_.push_back(hname);
00165 hGeantVtxX[1] = new TH1F(hname,htitle,100,-50.,50.);
00166 for (Int_t i = 0; i < 2; ++i) {
00167 hGeantVtxX[i]->GetXaxis()->SetTitle("x of Vertex (um)");
00168 hGeantVtxX[i]->GetYaxis()->SetTitle("Count");
00169 histMap_[hGeantVtxX[i]->GetName()] = hGeantVtxX[i];
00170 }
00171
00172 sprintf(hname,"hGeantVtxY1");
00173 histName_.push_back(hname);
00174 sprintf(htitle,"Geant vertex y/micrometer");
00175 hGeantVtxY[0] = new TH1F(hname,htitle,100,-8000000,8000000.);
00176 sprintf(hname,"hGeantVtxY2");
00177 histName_.push_back(hname);
00178 hGeantVtxY[1] = new TH1F(hname,htitle,100,-50.,50.);
00179 for (Int_t i = 0; i < 2; ++i) {
00180 hGeantVtxY[i]->GetXaxis()->SetTitle("y of Vertex (um)");
00181 hGeantVtxY[i]->GetYaxis()->SetTitle("Count");
00182 histMap_[hGeantVtxY[i]->GetName()] = hGeantVtxY[i];
00183 }
00184
00185 sprintf(hname,"hGeantVtxZ1");
00186 histName_.push_back(hname);
00187 sprintf(htitle,"Geant vertex z/millimeter");
00188 hGeantVtxZ[0] = new TH1F(hname,htitle,100,-11000.,11000.);
00189 sprintf(hname,"hGeantVtxZ2");
00190 histName_.push_back(hname);
00191 hGeantVtxZ[1] = new TH1F(hname,htitle,100,-250.,250.);
00192 for (Int_t i = 0; i < 2; ++i) {
00193 hGeantVtxZ[i]->GetXaxis()->SetTitle("z of Vertex (mm)");
00194 hGeantVtxZ[i]->GetYaxis()->SetTitle("Count");
00195 histMap_[hGeantVtxZ[i]->GetName()] = hGeantVtxZ[i];
00196 }
00197
00198 sprintf(hname,"hGeantTrkPt");
00199 histName_.push_back(hname);
00200 sprintf(htitle,"Geant track pt/GeV");
00201 hGeantTrkPt = new TH1F(hname,htitle,100,0.,200.);
00202 hGeantTrkPt->GetXaxis()->SetTitle("pT of Track (GeV)");
00203 hGeantTrkPt->GetYaxis()->SetTitle("Count");
00204 histMap_[hGeantTrkPt->GetName()] = hGeantTrkPt;
00205
00206 sprintf(hname,"hGeantTrkE");
00207 histName_.push_back(hname);
00208 sprintf(htitle,"Geant track E/GeV");
00209 hGeantTrkE = new TH1F(hname,htitle,100,0.,5000.);
00210 hGeantTrkE->GetXaxis()->SetTitle("E of Track (GeV)");
00211 hGeantTrkE->GetYaxis()->SetTitle("Count");
00212 histMap_[hGeantTrkE->GetName()] = hGeantTrkE;
00213
00214
00215 sprintf(hname,"hCaloEcal1");
00216 histName_.push_back(hname);
00217 sprintf(htitle,"Ecal hits");
00218 hCaloEcal[0] = new TH1F(hname,htitle,100,0.,10000.);
00219 sprintf(hname,"hCaloEcal2");
00220 histName_.push_back(hname);
00221 hCaloEcal[1] = new TH1F(hname,htitle,100,-0.5,99.5);
00222
00223 sprintf(hname,"hCaloEcalE1");
00224 histName_.push_back(hname);
00225 sprintf(htitle,"Ecal hits, energy/GeV");
00226 hCaloEcalE[0] = new TH1F(hname,htitle,100,0.,10.);
00227 sprintf(hname,"hCaloEcalE2");
00228 histName_.push_back(hname);
00229 hCaloEcalE[1] = new TH1F(hname,htitle,100,0.,0.1);
00230
00231 sprintf(hname,"hCaloEcalToF1");
00232 histName_.push_back(hname);
00233 sprintf(htitle,"Ecal hits, ToF/ns");
00234 hCaloEcalToF[0] = new TH1F(hname,htitle,100,0.,1000.);
00235 sprintf(hname,"hCaloEcalToF2");
00236 histName_.push_back(hname);
00237 hCaloEcalToF[1] = new TH1F(hname,htitle,100,0.,100.);
00238
00239 for (Int_t i = 0; i < 2; ++i) {
00240 hCaloEcal[i]->GetXaxis()->SetTitle("Number of Hits");
00241 hCaloEcal[i]->GetYaxis()->SetTitle("Count");
00242 histMap_[hCaloEcal[i]->GetName()] = hCaloEcal[i];
00243 hCaloEcalE[i]->GetXaxis()->SetTitle("Energy of Hits (GeV)");
00244 hCaloEcalE[i]->GetYaxis()->SetTitle("Count");
00245 histMap_[hCaloEcalE[i]->GetName()] = hCaloEcalE[i];
00246 hCaloEcalToF[i]->GetXaxis()->SetTitle("Time of Flight of Hits (ns)");
00247 hCaloEcalToF[i]->GetYaxis()->SetTitle("Count");
00248 histMap_[hCaloEcalToF[i]->GetName()] = hCaloEcalToF[i];
00249 }
00250
00251 sprintf(hname,"hCaloEcalPhi");
00252 histName_.push_back(hname);
00253 sprintf(htitle,"Ecal hits, phi/rad");
00254 hCaloEcalPhi = new TH1F(hname,htitle,100,-3.2,3.2);
00255 hCaloEcalPhi->GetXaxis()->SetTitle("Phi of Hits (rad)");
00256 hCaloEcalPhi->GetYaxis()->SetTitle("Count");
00257 histMap_[hCaloEcalPhi->GetName()] = hCaloEcalPhi;
00258
00259 sprintf(hname,"hCaloEcalEta");
00260 histName_.push_back(hname);
00261 sprintf(htitle,"Ecal hits, eta");
00262 hCaloEcalEta = new TH1F(hname,htitle,100,-5.5,5.5);
00263 hCaloEcalEta->GetXaxis()->SetTitle("Eta of Hits");
00264 hCaloEcalEta->GetYaxis()->SetTitle("Count");
00265 histMap_[hCaloEcalEta->GetName()] = hCaloEcalEta;
00266
00267 sprintf(hname,"hCaloPreSh1");
00268 histName_.push_back(hname);
00269 sprintf(htitle,"PreSh hits");
00270 hCaloPreSh[0] = new TH1F(hname,htitle,100,0.,10000.);
00271 sprintf(hname,"hCaloPreSh2");
00272 histName_.push_back(hname);
00273 hCaloPreSh[1] = new TH1F(hname,htitle,100,-0.5,99.5);
00274
00275 sprintf(hname,"hCaloPreShE1");
00276 histName_.push_back(hname);
00277 sprintf(htitle,"PreSh hits, energy/GeV");
00278 hCaloPreShE[0] = new TH1F(hname,htitle,100,0.,10.);
00279 sprintf(hname,"hCaloPreShE2");
00280 histName_.push_back(hname);
00281 hCaloPreShE[1] = new TH1F(hname,htitle,100,0.,0.1);
00282
00283 sprintf(hname,"hCaloPreShToF1");
00284 histName_.push_back(hname);
00285 sprintf(htitle,"PreSh hits, ToF/ns");
00286 hCaloPreShToF[0] = new TH1F(hname,htitle,100,0.,1000.);
00287 sprintf(hname,"hCaloPreShToF2");
00288 histName_.push_back(hname);
00289 hCaloPreShToF[1] = new TH1F(hname,htitle,100,0.,100.);
00290
00291 for (Int_t i = 0; i < 2; ++i) {
00292 hCaloPreSh[i]->GetXaxis()->SetTitle("Number of Hits");
00293 hCaloPreSh[i]->GetYaxis()->SetTitle("Count");
00294 histMap_[hCaloPreSh[i]->GetName()] = hCaloPreSh[i];
00295 hCaloPreShE[i]->GetXaxis()->SetTitle("Energy of Hits (GeV)");
00296 hCaloPreShE[i]->GetYaxis()->SetTitle("Count");
00297 histMap_[hCaloPreShE[i]->GetName()] = hCaloPreShE[i];
00298 hCaloPreShToF[i]->GetXaxis()->SetTitle("Time of Flight of Hits (ns)");
00299 hCaloPreShToF[i]->GetYaxis()->SetTitle("Count");
00300 histMap_[hCaloPreShToF[i]->GetName()] = hCaloPreShToF[i];
00301 }
00302
00303 sprintf(hname,"hCaloPreShPhi");
00304 histName_.push_back(hname);
00305 sprintf(htitle,"PreSh hits, phi/rad");
00306 hCaloPreShPhi = new TH1F(hname,htitle,100,-3.2,3.2);
00307 hCaloPreShPhi->GetXaxis()->SetTitle("Phi of Hits (rad)");
00308 hCaloPreShPhi->GetYaxis()->SetTitle("Count");
00309 histMap_[hCaloPreShPhi->GetName()] = hCaloPreShPhi;
00310
00311 sprintf(hname,"hCaloPreShEta");
00312 histName_.push_back(hname);
00313 sprintf(htitle,"PreSh hits, eta");
00314 hCaloPreShEta = new TH1F(hname,htitle,100,-5.5,5.5);
00315 hCaloPreShEta->GetXaxis()->SetTitle("Eta of Hits");
00316 hCaloPreShEta->GetYaxis()->SetTitle("Count");
00317 histMap_[hCaloPreShEta->GetName()] = hCaloPreShEta;
00318
00319
00320 sprintf(hname,"hCaloHcal1");
00321 histName_.push_back(hname);
00322 sprintf(htitle,"Hcal hits");
00323 hCaloHcal[0] = new TH1F(hname,htitle,100,0.,10000.);
00324 sprintf(hname,"hCaloHcal2");
00325 histName_.push_back(hname);
00326 hCaloHcal[1] = new TH1F(hname,htitle,100,-0.5,99.5);
00327
00328 sprintf(hname,"hCaloHcalE1");
00329 histName_.push_back(hname);
00330 sprintf(htitle,"Hcal hits, energy/GeV");
00331 hCaloHcalE[0] = new TH1F(hname,htitle,100,0.,10.);
00332 sprintf(hname,"hCaloHcalE2");
00333 histName_.push_back(hname);
00334 hCaloHcalE[1] = new TH1F(hname,htitle,100,0.,0.1);
00335
00336 sprintf(hname,"hCaloHcalToF1");
00337 histName_.push_back(hname);
00338 sprintf(htitle,"Hcal hits, ToF/ns");
00339 hCaloHcalToF[0] = new TH1F(hname,htitle,100,0.,1000.);
00340 sprintf(hname,"hCaloHcalToF2");
00341 histName_.push_back(hname);
00342 hCaloHcalToF[1] = new TH1F(hname,htitle,100,0.,100.);
00343
00344 for (Int_t i = 0; i < 2; ++i) {
00345 hCaloHcal[i]->GetXaxis()->SetTitle("Number of Hits");
00346 hCaloHcal[i]->GetYaxis()->SetTitle("Count");
00347 histMap_[hCaloHcal[i]->GetName()] = hCaloHcal[i];
00348 hCaloHcalE[i]->GetXaxis()->SetTitle("Energy of Hits (GeV)");
00349 hCaloHcalE[i]->GetYaxis()->SetTitle("Count");
00350 histMap_[hCaloHcalE[i]->GetName()] = hCaloHcalE[i];
00351 hCaloHcalToF[i]->GetXaxis()->SetTitle("Time of Flight of Hits (ns)");
00352 hCaloHcalToF[i]->GetYaxis()->SetTitle("Count");
00353 histMap_[hCaloHcalToF[i]->GetName()] = hCaloHcalToF[i];
00354 }
00355
00356 sprintf(hname,"hCaloHcalPhi");
00357 histName_.push_back(hname);
00358 sprintf(htitle,"Hcal hits, phi/rad");
00359 hCaloHcalPhi = new TH1F(hname,htitle,100,-3.2,3.2);
00360 hCaloHcalPhi->GetXaxis()->SetTitle("Phi of Hits (rad)");
00361 hCaloHcalPhi->GetYaxis()->SetTitle("Count");
00362 histMap_[hCaloHcalPhi->GetName()] = hCaloHcalPhi;
00363
00364 sprintf(hname,"hCaloHcalEta");
00365 histName_.push_back(hname);
00366 sprintf(htitle,"Hcal hits, eta");
00367 hCaloHcalEta = new TH1F(hname,htitle,100,-5.5,5.5);
00368 hCaloHcalEta->GetXaxis()->SetTitle("Eta of Hits");
00369 hCaloHcalEta->GetYaxis()->SetTitle("Count");
00370 histMap_[hCaloHcalEta->GetName()] = hCaloHcalEta;
00371
00372
00373 sprintf(hname,"hTrackerPx1");
00374 histName_.push_back(hname);
00375 sprintf(htitle,"Pixel hits");
00376 hTrackerPx[0] = new TH1F(hname,htitle,100,0.,10000.);
00377 sprintf(hname,"hTrackerPx2");
00378 histName_.push_back(hname);
00379 hTrackerPx[1] = new TH1F(hname,htitle,100,-0.5,99.5);
00380 for (Int_t i = 0; i < 2; ++i) {
00381 hTrackerPx[i]->GetXaxis()->SetTitle("Number of Pixel Hits");
00382 hTrackerPx[i]->GetYaxis()->SetTitle("Count");
00383 histMap_[hTrackerPx[i]->GetName()] = hTrackerPx[i];
00384 }
00385
00386 sprintf(hname,"hTrackerPxPhi");
00387 histName_.push_back(hname);
00388 sprintf(htitle,"Pixel hits phi/rad");
00389 hTrackerPxPhi = new TH1F(hname,htitle,100,-3.2,3.2);
00390 hTrackerPxPhi->GetXaxis()->SetTitle("Phi of Hits (rad)");
00391 hTrackerPxPhi->GetYaxis()->SetTitle("Count");
00392 histMap_[hTrackerPxPhi->GetName()] = hTrackerPxPhi;
00393
00394 sprintf(hname,"hTrackerPxEta");
00395 histName_.push_back(hname);
00396 sprintf(htitle,"Pixel hits eta");
00397 hTrackerPxEta = new TH1F(hname,htitle,100,-3.5,3.5);
00398 hTrackerPxEta->GetXaxis()->SetTitle("Eta of Hits");
00399 hTrackerPxEta->GetYaxis()->SetTitle("Count");
00400 histMap_[hTrackerPxEta->GetName()] = hTrackerPxEta;
00401
00402 sprintf(hname,"hTrackerPxBToF");
00403 histName_.push_back(hname);
00404 sprintf(htitle,"Pixel barrel hits, ToF/ns");
00405 hTrackerPxBToF = new TH1F(hname,htitle,100,0.,40.);
00406 hTrackerPxBToF->GetXaxis()->SetTitle("Time of Flight of Hits (ns)");
00407 hTrackerPxBToF->GetYaxis()->SetTitle("Count");
00408 histMap_[hTrackerPxBToF->GetName()] = hTrackerPxBToF;
00409
00410 sprintf(hname,"hTrackerPxBR");
00411 histName_.push_back(hname);
00412 sprintf(htitle,"Pixel barrel hits, R/cm");
00413 hTrackerPxBR = new TH1F(hname,htitle,100,0.,50.);
00414 hTrackerPxBR->GetXaxis()->SetTitle("R of Hits (cm)");
00415 hTrackerPxBR->GetYaxis()->SetTitle("Count");
00416 histMap_[hTrackerPxBR->GetName()] = hTrackerPxBR;
00417
00418 sprintf(hname,"hTrackerPxFToF");
00419 histName_.push_back(hname);
00420 sprintf(htitle,"Pixel forward hits, ToF/ns");
00421 hTrackerPxFToF = new TH1F(hname,htitle,100,0.,50.);
00422 hTrackerPxFToF->GetXaxis()->SetTitle("Time of Flight of Hits (ns)");
00423 hTrackerPxFToF->GetYaxis()->SetTitle("Count");
00424 histMap_[hTrackerPxFToF->GetName()] = hTrackerPxFToF;
00425
00426 sprintf(hname,"hTrackerPxFZ");
00427 histName_.push_back(hname);
00428 sprintf(htitle,"Pixel forward hits, Z/cm");
00429 hTrackerPxFZ = new TH1F(hname,htitle,200,-100.,100.);
00430 hTrackerPxFZ->GetXaxis()->SetTitle("Z of Hits (cm)");
00431 hTrackerPxFZ->GetYaxis()->SetTitle("Count");
00432 histMap_[hTrackerPxFZ->GetName()] = hTrackerPxFZ;
00433
00434 sprintf(hname,"hTrackerSi1");
00435 histName_.push_back(hname);
00436 sprintf(htitle,"Silicon hits");
00437 hTrackerSi[0] = new TH1F(hname,htitle,100,0.,10000.);
00438 sprintf(hname,"hTrackerSi2");
00439 histName_.push_back(hname);
00440 hTrackerSi[1] = new TH1F(hname,htitle,100,-0.5,99.5);
00441 for (Int_t i = 0; i < 2; ++i) {
00442 hTrackerSi[i]->GetXaxis()->SetTitle("Number of Silicon Hits");
00443 hTrackerSi[i]->GetYaxis()->SetTitle("Count");
00444 histMap_[hTrackerSi[i]->GetName()] = hTrackerSi[i];
00445 }
00446
00447 sprintf(hname,"hTrackerSiPhi");
00448 histName_.push_back(hname);
00449 sprintf(htitle,"Silicon hits phi/rad");
00450 hTrackerSiPhi = new TH1F(hname,htitle,100,-3.2,3.2);
00451 hTrackerSiPhi->GetXaxis()->SetTitle("Phi of Hits (rad)");
00452 hTrackerSiPhi->GetYaxis()->SetTitle("Count");
00453 histMap_[hTrackerSiPhi->GetName()] = hTrackerSiPhi;
00454
00455 sprintf(hname,"hTrackerSiEta");
00456 histName_.push_back(hname);
00457 sprintf(htitle,"Silicon hits eta");
00458 hTrackerSiEta = new TH1F(hname,htitle,100,-3.5,3.5);
00459 hTrackerSiEta->GetXaxis()->SetTitle("Eta of Hits");
00460 hTrackerSiEta->GetYaxis()->SetTitle("Count");
00461 histMap_[hTrackerSiEta->GetName()] = hTrackerSiEta;
00462
00463 sprintf(hname,"hTrackerSiBToF");
00464 histName_.push_back(hname);
00465 sprintf(htitle,"Silicon barrel hits, ToF/ns");
00466 hTrackerSiBToF = new TH1F(hname,htitle,100,0.,50.);
00467 hTrackerSiBToF->GetXaxis()->SetTitle("Time of Flight of Hits (ns)");
00468 hTrackerSiBToF->GetYaxis()->SetTitle("Count");
00469 histMap_[hTrackerSiBToF->GetName()] = hTrackerSiBToF;
00470
00471 sprintf(hname,"hTrackerSiBR");
00472 histName_.push_back(hname);
00473 sprintf(htitle,"Silicon barrel hits, R/cm");
00474 hTrackerSiBR = new TH1F(hname,htitle,100,0.,200.);
00475 hTrackerSiBR->GetXaxis()->SetTitle("R of Hits (cm)");
00476 hTrackerSiBR->GetYaxis()->SetTitle("Count");
00477 histMap_[hTrackerSiBR->GetName()] = hTrackerSiBR;
00478
00479 sprintf(hname,"hTrackerSiFToF");
00480 histName_.push_back(hname);
00481 sprintf(htitle,"Silicon forward hits, ToF/ns");
00482 hTrackerSiFToF = new TH1F(hname,htitle,100,0.,75.);
00483 hTrackerSiFToF->GetXaxis()->SetTitle("Time of Flight of Hits (ns)");
00484 hTrackerSiFToF->GetYaxis()->SetTitle("Count");
00485 histMap_[hTrackerSiFToF->GetName()] = hTrackerSiFToF;
00486
00487 sprintf(hname,"hTrackerSiFZ");
00488 histName_.push_back(hname);
00489 sprintf(htitle,"Silicon forward hits, Z/cm");
00490 hTrackerSiFZ = new TH1F(hname,htitle,200,-300.,300.);
00491 hTrackerSiFZ->GetXaxis()->SetTitle("Z of Hits (cm)");
00492 hTrackerSiFZ->GetYaxis()->SetTitle("Count");
00493 histMap_[hTrackerSiFZ->GetName()] = hTrackerSiFZ;
00494
00495
00496 sprintf(hname,"hMuon1");
00497 histName_.push_back(hname);
00498 sprintf(htitle,"Muon hits");
00499 hMuon[0] = new TH1F(hname,htitle,100,0.,10000.);
00500 sprintf(hname,"hMuon2");
00501 histName_.push_back(hname);
00502 hMuon[1] = new TH1F(hname,htitle,100,-0.5,99.5);
00503 for (Int_t i = 0; i < 2; ++i) {
00504 hMuon[i]->GetXaxis()->SetTitle("Number of Muon Hits");
00505 hMuon[i]->GetYaxis()->SetTitle("Count");
00506 histMap_[hMuon[i]->GetName()] = hMuon[i];
00507 }
00508
00509 sprintf(hname,"hMuonPhi");
00510 histName_.push_back(hname);
00511 sprintf(htitle,"Muon hits phi/rad");
00512 hMuonPhi = new TH1F(hname,htitle,100,-3.2,3.2);
00513 hMuonPhi->GetXaxis()->SetTitle("Phi of Hits (rad)");
00514 hMuonPhi->GetYaxis()->SetTitle("Count");
00515 histMap_[hMuonPhi->GetName()] = hMuonPhi;
00516
00517 sprintf(hname,"hMuonEta");
00518 histName_.push_back(hname);
00519 sprintf(htitle,"Muon hits eta");
00520 hMuonEta = new TH1F(hname,htitle,100,-3.5,3.5);
00521 hMuonEta->GetXaxis()->SetTitle("Eta of Hits");
00522 hMuonEta->GetYaxis()->SetTitle("Count");
00523 histMap_[hMuonEta->GetName()] = hMuonEta;
00524
00525 sprintf(hname,"hMuonCscToF1");
00526 histName_.push_back(hname);
00527 sprintf(htitle,"Muon CSC hits, ToF/ns");
00528 hMuonCscToF[0] = new TH1F(hname,htitle,100,0.,250.);
00529 sprintf(hname,"hMuonCscToF2");
00530 histName_.push_back(hname);
00531 hMuonCscToF[1] = new TH1F(hname,htitle,100,0.,50.);
00532 for (Int_t i = 0; i < 2; ++i) {
00533 hMuonCscToF[i]->GetXaxis()->SetTitle("Time of Flight of Hits (ns)");
00534 hMuonCscToF[i]->GetYaxis()->SetTitle("Count");
00535 histMap_[hMuonCscToF[i]->GetName()] = hMuonCscToF[i];
00536 }
00537
00538 sprintf(hname,"hMuonCscZ");
00539 histName_.push_back(hname);
00540 sprintf(htitle,"Muon CSC hits, Z/cm");
00541 hMuonCscZ = new TH1F(hname,htitle,200,-1500.,1500.);
00542 hMuonCscZ->GetXaxis()->SetTitle("Z of Hits (cm)");
00543 hMuonCscZ->GetYaxis()->SetTitle("Count");
00544 histMap_[hMuonCscZ->GetName()] = hMuonCscZ;
00545
00546 sprintf(hname,"hMuonDtToF1");
00547 histName_.push_back(hname);
00548 sprintf(htitle,"Muon DT hits, ToF/ns");
00549 hMuonDtToF[0] = new TH1F(hname,htitle,100,0.,250.);
00550 sprintf(hname,"hMuonDtToF2");
00551 histName_.push_back(hname);
00552 hMuonDtToF[1] = new TH1F(hname,htitle,100,0.,50.);
00553 for (Int_t i = 0; i < 2; ++i) {
00554 hMuonDtToF[i]->GetXaxis()->SetTitle("Time of Flight of Hits (ns)");
00555 hMuonDtToF[i]->GetYaxis()->SetTitle("Count");
00556 histMap_[hMuonDtToF[i]->GetName()] = hMuonDtToF[i];
00557 }
00558
00559 sprintf(hname,"hMuonDtR");
00560 histName_.push_back(hname);
00561 sprintf(htitle,"Muon DT hits, R/cm");
00562 hMuonDtR = new TH1F(hname,htitle,100,0.,1500.);
00563 hMuonDtR->GetXaxis()->SetTitle("R of Hits (cm)");
00564 hMuonDtR->GetYaxis()->SetTitle("Count");
00565 histMap_[hMuonDtR->GetName()] = hMuonDtR;
00566
00567 sprintf(hname,"hMuonRpcFToF1");
00568 histName_.push_back(hname);
00569 sprintf(htitle,"Muon RPC forward hits, ToF/ns");
00570 hMuonRpcFToF[0] = new TH1F(hname,htitle,100,0.,250.);
00571 sprintf(hname,"hMuonRpcFToF2");
00572 histName_.push_back(hname);
00573 hMuonRpcFToF[1] = new TH1F(hname,htitle,100,0.,50.);
00574 for (Int_t i = 0; i < 2; ++i) {
00575 hMuonRpcFToF[i]->GetXaxis()->SetTitle("Time of Flight of Hits (ns)");
00576 hMuonRpcFToF[i]->GetYaxis()->SetTitle("Count");
00577 histMap_[hMuonRpcFToF[i]->GetName()] = hMuonRpcFToF[i];
00578 }
00579
00580 sprintf(hname,"hMuonRpcFZ");
00581 histName_.push_back(hname);
00582 sprintf(htitle,"Muon RPC forward hits, Z/cm");
00583 hMuonRpcFZ = new TH1F(hname,htitle,201,-1500.,1500.);
00584 hMuonRpcFZ->GetXaxis()->SetTitle("Z of Hits (cm)");
00585 hMuonRpcFZ->GetYaxis()->SetTitle("Count");
00586 histMap_[hMuonRpcFZ->GetName()] = hMuonRpcFZ;
00587
00588 sprintf(hname,"hMuonRpcBToF1");
00589 histName_.push_back(hname);
00590 sprintf(htitle,"Muon RPC barrel hits, ToF/ns");
00591 hMuonRpcBToF[0] = new TH1F(hname,htitle,100,0.,250.);
00592 sprintf(hname,"hMuonRpcBToF2");
00593 histName_.push_back(hname);
00594 hMuonRpcBToF[1] = new TH1F(hname,htitle,100,0.,50.);
00595 for (Int_t i = 0; i < 2; ++i) {
00596 hMuonRpcBToF[i]->GetXaxis()->SetTitle("Time of Flight of Hits (ns)");
00597 hMuonRpcBToF[i]->GetYaxis()->SetTitle("Count");
00598 histMap_[hMuonRpcBToF[i]->GetName()] = hMuonRpcBToF[i];
00599 }
00600
00601 sprintf(hname,"hMuonRpcBR");
00602 histName_.push_back(hname);
00603 sprintf(htitle,"Muon RPC barrel hits, R/cm");
00604 hMuonRpcBR = new TH1F(hname,htitle,100,0.,1500.);
00605 hMuonRpcBR->GetXaxis()->SetTitle("R of Hits (cm)");
00606 hMuonRpcBR->GetYaxis()->SetTitle("Count");
00607 histMap_[hMuonRpcBR->GetName()] = hMuonRpcBR;
00608
00609
00610 for (std::size_t i = 0; i < histName_.size(); ++i) {
00611 produces<TH1F, edm::InRun>(histName_[i]).setBranchAlias(histName_[i]);
00612 }
00613 }
00614
00615 GlobalHitsProdHist::~GlobalHitsProdHist()
00616 {
00617 }
00618
00619 void GlobalHitsProdHist::beginJob()
00620 {
00621 return;
00622 }
00623
00624 void GlobalHitsProdHist::endJob()
00625 {
00626 std::string MsgLoggerCat = "GlobalHitsProdHist_endJob";
00627 if (verbosity >= 0)
00628 edm::LogInfo(MsgLoggerCat)
00629 << "Terminating having processed " << count << " events.";
00630 return;
00631 }
00632
00633 void GlobalHitsProdHist::produce(edm::Event& iEvent,
00634 const edm::EventSetup& iSetup)
00635 {
00636 std::string MsgLoggerCat = "GlobalHitsProdHist_produce";
00637
00638
00639 ++count;
00640
00641
00642 int nrun = iEvent.id().run();
00643 int nevt = iEvent.id().event();
00644
00645 if (verbosity > 0) {
00646 edm::LogInfo(MsgLoggerCat)
00647 << "Processing run " << nrun << ", event " << nevt
00648 << " (" << count << " events total)";
00649 } else if (verbosity == 0) {
00650 if (nevt%frequency == 0 || nevt == 1) {
00651 edm::LogInfo(MsgLoggerCat)
00652 << "Processing run " << nrun << ", event " << nevt
00653 << " (" << count << " events total)";
00654 }
00655 }
00656
00657
00658 if (getAllProvenances) {
00659
00660 std::vector<const edm::Provenance*> AllProv;
00661 iEvent.getAllProvenance(AllProv);
00662
00663 if (verbosity >= 0)
00664 edm::LogInfo(MsgLoggerCat)
00665 << "Number of Provenances = " << AllProv.size();
00666
00667 if (printProvenanceInfo && (verbosity >= 0)) {
00668 TString eventout("\nProvenance info:\n");
00669
00670 for (unsigned int i = 0; i < AllProv.size(); ++i) {
00671 eventout += "\n ******************************";
00672 eventout += "\n Module : ";
00673 eventout += AllProv[i]->moduleLabel();
00674 eventout += "\n ProductID : ";
00675 eventout += AllProv[i]->productID().id();
00676 eventout += "\n ClassName : ";
00677 eventout += AllProv[i]->className();
00678 eventout += "\n InstanceName : ";
00679 eventout += AllProv[i]->productInstanceName();
00680 eventout += "\n BranchName : ";
00681 eventout += AllProv[i]->branchName();
00682 }
00683 eventout += "\n ******************************\n";
00684 edm::LogInfo(MsgLoggerCat) << eventout << "\n";
00685 printProvenanceInfo = false;
00686 }
00687 getAllProvenances = false;
00688 }
00689
00690
00691
00692 fillG4MC(iEvent);
00693
00694 fillTrk(iEvent,iSetup);
00695
00696 fillMuon(iEvent, iSetup);
00697
00698 fillECal(iEvent, iSetup);
00699
00700 fillHCal(iEvent, iSetup);
00701
00702 if (verbosity > 0)
00703 edm::LogInfo (MsgLoggerCat)
00704 << "Done gathering data from event.";
00705
00706 return;
00707 }
00708
00709 void GlobalHitsProdHist::endRunProduce(edm::Run& iRun, const edm::EventSetup& iSetup)
00710 {
00711
00712 std::string MsgLoggerCat = "GlobalHitsProdHist_endRun";
00713
00714 TString eventout;
00715 TString eventoutw;
00716 bool warning = false;
00717
00718 if (verbosity > 0)
00719 edm::LogInfo (MsgLoggerCat)
00720 << "\nStoring histograms.";
00721
00722
00723 std::map<std::string, TH1F*>::iterator iter;
00724 for (std::size_t i = 0; i < histName_.size(); ++i) {
00725 iter = histMap_.find(histName_[i]);
00726 if (iter != histMap_.end()) {
00727 std::auto_ptr<TH1F> hist1D(iter->second);
00728 eventout += "\n Storing histogram " + histName_[i];
00729 iRun.put(hist1D, histName_[i]);
00730 } else {
00731 warning = true;
00732 eventoutw += "\n Unable to find histogram with name " + histName_[i];
00733 }
00734 }
00735
00736 if (verbosity > 0) {
00737 edm::LogInfo(MsgLoggerCat) << eventout << "\n";
00738 if (warning)
00739 edm::LogWarning(MsgLoggerCat) << eventoutw << "\n";
00740 }
00741 return;
00742 }
00743
00744
00745 void GlobalHitsProdHist::fillG4MC(edm::Event& iEvent)
00746 {
00747
00748 std::string MsgLoggerCat = "GlobalHitsProdHist_fillG4MC";
00749
00750 TString eventout;
00751 if (verbosity > 0)
00752 eventout = "\nGathering info:";
00753
00755
00757 edm::Handle<edm::HepMCProduct> HepMCEvt;
00758 std::vector<edm::Handle<edm::HepMCProduct> > AllHepMCEvt;
00759 iEvent.getManyByType(AllHepMCEvt);
00760
00761
00762
00763 for (unsigned int i = 0; i < AllHepMCEvt.size(); ++i) {
00764 HepMCEvt = AllHepMCEvt[i];
00765 if ((HepMCEvt.provenance()->product()).moduleLabel() == "VtxSmeared")
00766 break;
00767 }
00768
00769 if (!HepMCEvt.isValid()) {
00770 edm::LogWarning(MsgLoggerCat)
00771 << "Unable to find HepMCProduct in event!";
00772 return;
00773 } else {
00774 eventout += "\n Using HepMCProduct: ";
00775 eventout += (HepMCEvt.provenance()->product()).moduleLabel();
00776 }
00777 const HepMC::GenEvent* MCEvt = HepMCEvt->GetEvent();
00778 nRawGenPart = MCEvt->particles_size();
00779
00780 if (verbosity > 1) {
00781 eventout += "\n Number of Raw Particles collected:......... ";
00782 eventout += nRawGenPart;
00783 }
00784
00785 if (hMCRGP[0]) hMCRGP[0]->Fill((float)nRawGenPart);
00786 if (hMCRGP[1]) hMCRGP[1]->Fill((float)nRawGenPart);
00787
00789
00791
00792 float unit = 0.;
00793 if (vtxunit == 0) unit = 1.;
00794 if (vtxunit == 1) unit = 10.;
00795
00796 edm::Handle<edm::SimVertexContainer> G4VtxContainer;
00797 iEvent.getByLabel(G4VtxSrc_, G4VtxContainer);
00798 if (!G4VtxContainer.isValid()) {
00799 edm::LogWarning(MsgLoggerCat)
00800 << "Unable to find SimVertex in event!";
00801 return;
00802 }
00803 int i = 0;
00804 edm::SimVertexContainer::const_iterator itVtx;
00805 for (itVtx = G4VtxContainer->begin(); itVtx != G4VtxContainer->end();
00806 ++itVtx) {
00807
00808 ++i;
00809
00810 const math::XYZTLorentzVector G4Vtx1(itVtx->position().x(),
00811 itVtx->position().y(),
00812 itVtx->position().z(),
00813 itVtx->position().e());
00814
00815 double G4Vtx[4];
00816 G4Vtx1.GetCoordinates(G4Vtx);
00817
00818 if (hGeantVtxX[0]) hGeantVtxX[0]->Fill((G4Vtx[0]*unit)/micrometer);
00819 if (hGeantVtxX[1]) hGeantVtxX[1]->Fill((G4Vtx[0]*unit)/micrometer);
00820
00821 if (hGeantVtxY[0]) hGeantVtxY[0]->Fill((G4Vtx[1]*unit)/micrometer);
00822 if (hGeantVtxY[1]) hGeantVtxY[1]->Fill((G4Vtx[1]*unit)/micrometer);
00823
00824 if (hGeantVtxZ[0]) hGeantVtxZ[0]->Fill((G4Vtx[2]*unit)/millimeter);
00825 if (hGeantVtxZ[1]) hGeantVtxZ[1]->Fill((G4Vtx[2]*unit)/millimeter);
00826
00827 }
00828
00829 if (verbosity > 1) {
00830 eventout += "\n Number of G4Vertices collected:............ ";
00831 eventout += i;
00832 }
00833
00834 if (hMCG4Vtx[0]) hMCG4Vtx[0]->Fill((float)i);
00835 if (hMCG4Vtx[1]) hMCG4Vtx[1]->Fill((float)i);
00836
00838
00840 edm::Handle<edm::SimTrackContainer> G4TrkContainer;
00841 iEvent.getByLabel(G4TrkSrc_, G4TrkContainer);
00842 if (!G4TrkContainer.isValid()) {
00843 edm::LogWarning(MsgLoggerCat)
00844 << "Unable to find SimTrack in event!";
00845 return;
00846 }
00847 i = 0;
00848 edm::SimTrackContainer::const_iterator itTrk;
00849 for (itTrk = G4TrkContainer->begin(); itTrk != G4TrkContainer->end();
00850 ++itTrk) {
00851
00852 ++i;
00853
00854 const math::XYZTLorentzVector G4Trk1(itTrk->momentum().x(),
00855 itTrk->momentum().y(),
00856 itTrk->momentum().z(),
00857 itTrk->momentum().e());
00858 double G4Trk[4];
00859 G4Trk1.GetCoordinates(G4Trk);
00860
00861 if (hGeantTrkPt) hGeantTrkPt->
00862 Fill(sqrt(G4Trk[0]*G4Trk[0]+G4Trk[1]*G4Trk[1]));
00863 if (hGeantTrkE) hGeantTrkE->Fill(G4Trk[3]);
00864 }
00865
00866 if (verbosity > 1) {
00867 eventout += "\n Number of G4Tracks collected:.............. ";
00868 eventout += i;
00869 }
00870
00871 if (hMCG4Trk[0]) hMCG4Trk[0]->Fill((float)i);
00872 if (hMCG4Trk[1]) hMCG4Trk[1]->Fill((float)i);
00873
00874 if (verbosity > 0)
00875 edm::LogInfo(MsgLoggerCat) << eventout << "\n";
00876
00877 return;
00878 }
00879
00880 void GlobalHitsProdHist::fillTrk(edm::Event& iEvent,
00881 const edm::EventSetup& iSetup)
00882 {
00883
00884 nPxlHits = 0;
00885 std::string MsgLoggerCat = "GlobalHitsProdHist_fillTrk";
00886
00887 TString eventout;
00888 if (verbosity > 0)
00889 eventout = "\nGathering info:";
00890
00891
00892 edm::ESHandle<TrackerGeometry> theTrackerGeometry;
00893 iSetup.get<TrackerDigiGeometryRecord>().get(theTrackerGeometry);
00894 if (!theTrackerGeometry.isValid()) {
00895 edm::LogWarning(MsgLoggerCat)
00896 << "Unable to find TrackerDigiGeometryRecord in event!";
00897 return;
00898 }
00899 const TrackerGeometry& theTracker(*theTrackerGeometry);
00900
00901
00902 edm::PSimHitContainer::const_iterator itHit;
00903
00905
00907 edm::PSimHitContainer thePxlBrlHits;
00908
00909 edm::Handle<edm::PSimHitContainer> PxlBrlLowContainer;
00910 iEvent.getByLabel(PxlBrlLowSrc_,PxlBrlLowContainer);
00911 if (!PxlBrlLowContainer.isValid()) {
00912 edm::LogWarning(MsgLoggerCat)
00913 << "Unable to find TrackerHitsPixelBarrelLowTof in event!";
00914 return;
00915 }
00916
00917 edm::Handle<edm::PSimHitContainer> PxlBrlHighContainer;
00918 iEvent.getByLabel(PxlBrlHighSrc_,PxlBrlHighContainer);
00919 if (!PxlBrlHighContainer.isValid()) {
00920 edm::LogWarning(MsgLoggerCat)
00921 << "Unable to find TrackerHitsPixelBarrelHighTof in event!";
00922 return;
00923 }
00924
00925 thePxlBrlHits.insert(thePxlBrlHits.end(),PxlBrlLowContainer->begin(),
00926 PxlBrlLowContainer->end());
00927 thePxlBrlHits.insert(thePxlBrlHits.end(),PxlBrlHighContainer->begin(),
00928 PxlBrlHighContainer->end());
00929
00930
00931 int i = 0, j = 0;
00932 for (itHit = thePxlBrlHits.begin(); itHit != thePxlBrlHits.end(); ++itHit) {
00933
00934 ++i;
00935
00936
00937 DetId theDetUnitId(itHit->detUnitId());
00938 int detector = theDetUnitId.det();
00939 int subdetector = theDetUnitId.subdetId();
00940
00941
00942 if ((detector == dTrk) && (subdetector == sdPxlBrl)) {
00943
00944
00945 const GeomDetUnit *theDet = theTracker.idToDetUnit(theDetUnitId);
00946
00947 if (!theDet) {
00948 edm::LogWarning(MsgLoggerCat)
00949 << "Unable to get GeomDetUnit from PxlBrlHits for Hit " << i;
00950 continue;
00951 }
00952
00953 ++j;
00954
00955
00956 const BoundPlane& bSurface = theDet->surface();
00957
00958 if(hTrackerPxBToF) hTrackerPxBToF->Fill(itHit->tof());
00959 if(hTrackerPxBR)
00960 hTrackerPxBR->Fill(bSurface.toGlobal(itHit->localPosition()).perp());
00961 if(hTrackerPxPhi)
00962 hTrackerPxPhi->Fill(bSurface.toGlobal(itHit->localPosition()).phi());
00963 if(hTrackerPxEta)
00964 hTrackerPxEta->Fill(bSurface.toGlobal(itHit->localPosition()).eta());
00965
00966 } else {
00967 edm::LogWarning(MsgLoggerCat)
00968 << "PxlBrl PSimHit " << i
00969 << " is expected to be (det,subdet) = ("
00970 << dTrk << "," << sdPxlBrl
00971 << "); value returned is: ("
00972 << detector << "," << subdetector << ")";
00973 continue;
00974 }
00975 }
00976
00977 if (verbosity > 1) {
00978 eventout += "\n Number of Pixel Barrel Hits collected:..... ";
00979 eventout += j;
00980 }
00981
00982 nPxlHits += j;
00983
00985
00987 edm::PSimHitContainer thePxlFwdHits;
00988
00989 edm::Handle<edm::PSimHitContainer> PxlFwdLowContainer;
00990 iEvent.getByLabel(PxlFwdLowSrc_,PxlFwdLowContainer);
00991 if (!PxlFwdLowContainer.isValid()) {
00992 edm::LogWarning(MsgLoggerCat)
00993 << "Unable to find TrackerHitsPixelEndcapLowTof in event!";
00994 return;
00995 }
00996
00997 edm::Handle<edm::PSimHitContainer> PxlFwdHighContainer;
00998 iEvent.getByLabel(PxlFwdHighSrc_,PxlFwdHighContainer);
00999 if (!PxlFwdHighContainer.isValid()) {
01000 edm::LogWarning("GlobalHitsProdHist_fillTrk")
01001 << "Unable to find TrackerHitsPixelEndcapHighTof in event!";
01002 return;
01003 }
01004
01005 thePxlFwdHits.insert(thePxlFwdHits.end(),PxlFwdLowContainer->begin(),
01006 PxlFwdLowContainer->end());
01007 thePxlFwdHits.insert(thePxlFwdHits.end(),PxlFwdHighContainer->begin(),
01008 PxlFwdHighContainer->end());
01009
01010
01011 i = 0; j = 0;
01012 for (itHit = thePxlFwdHits.begin(); itHit != thePxlFwdHits.end(); ++itHit) {
01013
01014 ++i;
01015
01016
01017 DetId theDetUnitId(itHit->detUnitId());
01018 int detector = theDetUnitId.det();
01019 int subdetector = theDetUnitId.subdetId();
01020
01021
01022 if ((detector == dTrk) && (subdetector == sdPxlFwd)) {
01023
01024
01025 const GeomDetUnit *theDet = theTracker.idToDetUnit(theDetUnitId);
01026
01027 if (!theDet) {
01028 edm::LogWarning(MsgLoggerCat)
01029 << "Unable to get GeomDetUnit from PxlFwdHits for Hit " << i;;
01030 continue;
01031 }
01032
01033 ++j;
01034
01035
01036 const BoundPlane& bSurface = theDet->surface();
01037
01038 if(hTrackerPxFToF) hTrackerPxFToF->Fill(itHit->tof());
01039 if(hTrackerPxFZ)
01040 hTrackerPxFZ->Fill(bSurface.toGlobal(itHit->localPosition()).z());
01041 if(hTrackerPxPhi)
01042 hTrackerPxPhi->Fill(bSurface.toGlobal(itHit->localPosition()).phi());
01043 if(hTrackerPxEta)
01044 hTrackerPxEta->Fill(bSurface.toGlobal(itHit->localPosition()).eta());
01045
01046 } else {
01047 edm::LogWarning(MsgLoggerCat)
01048 << "PxlFwd PSimHit " << i
01049 << " is expected to be (det,subdet) = ("
01050 << dTrk << "," << sdPxlFwd
01051 << "); value returned is: ("
01052 << detector << "," << subdetector << ")";
01053 continue;
01054 }
01055 }
01056
01057 if (verbosity > 1) {
01058 eventout += "\n Number of Pixel Forward Hits collected:.... ";
01059 eventout += j;
01060 }
01061
01062 nPxlHits += j;
01063
01064 if (hTrackerPx[0]) hTrackerPx[0]->Fill((float)nPxlHits);
01065 if (hTrackerPx[1]) hTrackerPx[1]->Fill((float)nPxlHits);
01066
01068
01070 nSiHits = 0;
01071 edm::PSimHitContainer theSiBrlHits;
01072
01073 edm::Handle<edm::PSimHitContainer> SiTIBLowContainer;
01074 iEvent.getByLabel(SiTIBLowSrc_,SiTIBLowContainer);
01075 if (!SiTIBLowContainer.isValid()) {
01076 edm::LogWarning(MsgLoggerCat)
01077 << "Unable to find TrackerHitsTIBLowTof in event!";
01078 return;
01079 }
01080
01081 edm::Handle<edm::PSimHitContainer> SiTIBHighContainer;
01082 iEvent.getByLabel(SiTIBHighSrc_,SiTIBHighContainer);
01083 if (!SiTIBHighContainer.isValid()) {
01084 edm::LogWarning(MsgLoggerCat)
01085 << "Unable to find TrackerHitsTIBHighTof in event!";
01086 return;
01087 }
01088
01089 edm::Handle<edm::PSimHitContainer> SiTOBLowContainer;
01090 iEvent.getByLabel(SiTOBLowSrc_,SiTOBLowContainer);
01091 if (!SiTOBLowContainer.isValid()) {
01092 edm::LogWarning(MsgLoggerCat)
01093 << "Unable to find TrackerHitsTOBLowTof in event!";
01094 return;
01095 }
01096
01097 edm::Handle<edm::PSimHitContainer> SiTOBHighContainer;
01098 iEvent.getByLabel(SiTOBHighSrc_,SiTOBHighContainer);
01099 if (!SiTOBHighContainer.isValid()) {
01100 edm::LogWarning(MsgLoggerCat)
01101 << "Unable to find TrackerHitsTOBHighTof in event!";
01102 return;
01103 }
01104
01105 theSiBrlHits.insert(theSiBrlHits.end(),SiTIBLowContainer->begin(),
01106 SiTIBLowContainer->end());
01107 theSiBrlHits.insert(theSiBrlHits.end(),SiTIBHighContainer->begin(),
01108 SiTIBHighContainer->end());
01109 theSiBrlHits.insert(theSiBrlHits.end(),SiTOBLowContainer->begin(),
01110 SiTOBLowContainer->end());
01111 theSiBrlHits.insert(theSiBrlHits.end(),SiTOBHighContainer->begin(),
01112 SiTOBHighContainer->end());
01113
01114
01115 i = 0; j = 0;
01116 for (itHit = theSiBrlHits.begin(); itHit != theSiBrlHits.end(); ++itHit) {
01117
01118 ++i;
01119
01120
01121 DetId theDetUnitId(itHit->detUnitId());
01122 int detector = theDetUnitId.det();
01123 int subdetector = theDetUnitId.subdetId();
01124
01125
01126 if ((detector == dTrk) &&
01127 ((subdetector == sdSiTIB) ||
01128 (subdetector == sdSiTOB))) {
01129
01130
01131 const GeomDetUnit *theDet = theTracker.idToDetUnit(theDetUnitId);
01132
01133 if (!theDet) {
01134 edm::LogWarning(MsgLoggerCat)
01135 << "Unable to get GeomDetUnit from SiBrlHits for Hit " << i;
01136 continue;
01137 }
01138
01139 ++j;
01140
01141
01142 const BoundPlane& bSurface = theDet->surface();
01143
01144 if(hTrackerSiBToF) hTrackerSiBToF->Fill(itHit->tof());
01145 if(hTrackerSiBR)
01146 hTrackerSiBR->Fill(bSurface.toGlobal(itHit->localPosition()).perp());
01147 if(hTrackerSiPhi)
01148 hTrackerSiPhi->Fill(bSurface.toGlobal(itHit->localPosition()).phi());
01149 if(hTrackerSiEta)
01150 hTrackerSiEta->Fill(bSurface.toGlobal(itHit->localPosition()).eta());
01151
01152 } else {
01153 edm::LogWarning(MsgLoggerCat)
01154 << "SiBrl PSimHit " << i
01155 << " is expected to be (det,subdet) = ("
01156 << dTrk << "," << sdSiTIB
01157 << " || " << sdSiTOB << "); value returned is: ("
01158 << detector << "," << subdetector << ")";
01159 continue;
01160 }
01161 }
01162
01163 if (verbosity > 1) {
01164 eventout += "\n Number of Silicon Barrel Hits collected:... ";
01165 eventout += j;
01166 }
01167
01168 nSiHits += j;
01169
01171
01173 edm::PSimHitContainer theSiFwdHits;
01174
01175 edm::Handle<edm::PSimHitContainer> SiTIDLowContainer;
01176 iEvent.getByLabel(SiTIDLowSrc_,SiTIDLowContainer);
01177 if (!SiTIDLowContainer.isValid()) {
01178 edm::LogWarning(MsgLoggerCat)
01179 << "Unable to find TrackerHitsTIDLowTof in event!";
01180 return;
01181 }
01182
01183 edm::Handle<edm::PSimHitContainer> SiTIDHighContainer;
01184 iEvent.getByLabel(SiTIDHighSrc_,SiTIDHighContainer);
01185 if (!SiTIDHighContainer.isValid()) {
01186 edm::LogWarning("GlobalHitsProdHist_fillTrk")
01187 << "Unable to find TrackerHitsTIDHighTof in event!";
01188 return;
01189 }
01190
01191 edm::Handle<edm::PSimHitContainer> SiTECLowContainer;
01192 iEvent.getByLabel(SiTECLowSrc_,SiTECLowContainer);
01193 if (!SiTECLowContainer.isValid()) {
01194 edm::LogWarning(MsgLoggerCat)
01195 << "Unable to find TrackerHitsTECLowTof in event!";
01196 return;
01197 }
01198
01199 edm::Handle<edm::PSimHitContainer> SiTECHighContainer;
01200 iEvent.getByLabel(SiTECHighSrc_,SiTECHighContainer);
01201 if (!SiTECHighContainer.isValid()) {
01202 edm::LogWarning(MsgLoggerCat)
01203 << "Unable to find TrackerHitsTECHighTof in event!";
01204 return;
01205 }
01206
01207 theSiFwdHits.insert(theSiFwdHits.end(),SiTIDLowContainer->begin(),
01208 SiTIDLowContainer->end());
01209 theSiFwdHits.insert(theSiFwdHits.end(),SiTIDHighContainer->begin(),
01210 SiTIDHighContainer->end());
01211 theSiFwdHits.insert(theSiFwdHits.end(),SiTECLowContainer->begin(),
01212 SiTECLowContainer->end());
01213 theSiFwdHits.insert(theSiFwdHits.end(),SiTECHighContainer->begin(),
01214 SiTECHighContainer->end());
01215
01216
01217 i = 0; j = 0;
01218 for (itHit = theSiFwdHits.begin(); itHit != theSiFwdHits.end(); ++itHit) {
01219
01220 ++i;
01221
01222
01223 DetId theDetUnitId(itHit->detUnitId());
01224 int detector = theDetUnitId.det();
01225 int subdetector = theDetUnitId.subdetId();
01226
01227
01228 if ((detector == dTrk) &&
01229 ((subdetector == sdSiTID) ||
01230 (subdetector == sdSiTEC))) {
01231
01232
01233 const GeomDetUnit *theDet = theTracker.idToDetUnit(theDetUnitId);
01234
01235 if (!theDet) {
01236 edm::LogWarning(MsgLoggerCat)
01237 << "Unable to get GeomDetUnit from SiFwdHits Hit " << i;
01238 return;
01239 }
01240
01241 ++j;
01242
01243
01244 const BoundPlane& bSurface = theDet->surface();
01245
01246 if(hTrackerSiFToF) hTrackerSiFToF->Fill(itHit->tof());
01247 if(hTrackerSiFZ)
01248 hTrackerSiFZ->Fill(bSurface.toGlobal(itHit->localPosition()).z());
01249 if(hTrackerSiPhi)
01250 hTrackerSiPhi->Fill(bSurface.toGlobal(itHit->localPosition()).phi());
01251 if(hTrackerSiEta)
01252 hTrackerSiEta->Fill(bSurface.toGlobal(itHit->localPosition()).eta());
01253
01254 } else {
01255 edm::LogWarning(MsgLoggerCat)
01256 << "SiFwd PSimHit " << i
01257 << " is expected to be (det,subdet) = ("
01258 << dTrk << "," << sdSiTOB
01259 << " || " << sdSiTEC << "); value returned is: ("
01260 << detector << "," << subdetector << ")";
01261 continue;
01262 }
01263 }
01264
01265 if (verbosity > 1) {
01266 eventout += "\n Number of Silicon Forward Hits collected:.. ";
01267 eventout += j;
01268 }
01269
01270 nSiHits +=j;
01271
01272 if (hTrackerSi[0]) hTrackerSi[0]->Fill((float)nSiHits);
01273 if (hTrackerSi[1]) hTrackerSi[1]->Fill((float)nSiHits);
01274
01275 if (verbosity > 0)
01276 edm::LogInfo(MsgLoggerCat) << eventout << "\n";
01277
01278 return;
01279 }
01280
01281 void GlobalHitsProdHist::fillMuon(edm::Event& iEvent,
01282 const edm::EventSetup& iSetup)
01283 {
01284 nMuonHits = 0;
01285 std::string MsgLoggerCat = "GlobalHitsProdHist_fillMuon";
01286
01287 TString eventout;
01288 if (verbosity > 0)
01289 eventout = "\nGathering info:";
01290
01291
01292 edm::PSimHitContainer::const_iterator itHit;
01293
01295
01297
01298 edm::ESHandle<CSCGeometry> theCSCGeometry;
01299 iSetup.get<MuonGeometryRecord>().get(theCSCGeometry);
01300 if (!theCSCGeometry.isValid()) {
01301 edm::LogWarning(MsgLoggerCat)
01302 << "Unable to find MuonGeometryRecord for the CSCGeometry in event!";
01303 return;
01304 }
01305 const CSCGeometry& theCSCMuon(*theCSCGeometry);
01306
01307
01308 edm::Handle<edm::PSimHitContainer> MuonCSCContainer;
01309 iEvent.getByLabel(MuonCscSrc_,MuonCSCContainer);
01310 if (!MuonCSCContainer.isValid()) {
01311 edm::LogWarning(MsgLoggerCat)
01312 << "Unable to find MuonCSCHits in event!";
01313 return;
01314 }
01315
01316
01317 int i = 0, j = 0;
01318 for (itHit = MuonCSCContainer->begin(); itHit != MuonCSCContainer->end();
01319 ++itHit) {
01320
01321 ++i;
01322
01323
01324 DetId theDetUnitId(itHit->detUnitId());
01325 int detector = theDetUnitId.det();
01326 int subdetector = theDetUnitId.subdetId();
01327
01328
01329 if ((detector == dMuon) &&
01330 (subdetector == sdMuonCSC)) {
01331
01332
01333 const GeomDetUnit *theDet = theCSCMuon.idToDetUnit(theDetUnitId);
01334
01335 if (!theDet) {
01336 edm::LogWarning(MsgLoggerCat)
01337 << "Unable to get GeomDetUnit from theCSCMuon for hit " << i;
01338 continue;
01339 }
01340
01341 ++j;
01342
01343
01344 const BoundPlane& bSurface = theDet->surface();
01345
01346 if (hMuonCscToF[0]) hMuonCscToF[0]->Fill(itHit->tof());
01347 if (hMuonCscToF[1]) hMuonCscToF[1]->Fill(itHit->tof());
01348 if (hMuonCscZ)
01349 hMuonCscZ->Fill(bSurface.toGlobal(itHit->localPosition()).z());
01350 if (hMuonPhi)
01351 hMuonPhi->Fill(bSurface.toGlobal(itHit->localPosition()).phi());
01352 if (hMuonEta)
01353 hMuonEta->Fill(bSurface.toGlobal(itHit->localPosition()).eta());
01354
01355 } else {
01356 edm::LogWarning(MsgLoggerCat)
01357 << "MuonCsc PSimHit " << i
01358 << " is expected to be (det,subdet) = ("
01359 << dMuon << "," << sdMuonCSC
01360 << "); value returned is: ("
01361 << detector << "," << subdetector << ")";
01362 continue;
01363 }
01364 }
01365
01366 if (verbosity > 1) {
01367 eventout += "\n Number of CSC muon Hits collected:......... ";
01368 eventout += j;
01369 }
01370
01371 nMuonHits += j;
01372
01374
01376
01377 edm::ESHandle<DTGeometry> theDTGeometry;
01378 iSetup.get<MuonGeometryRecord>().get(theDTGeometry);
01379 if (!theDTGeometry.isValid()) {
01380 edm::LogWarning(MsgLoggerCat)
01381 << "Unable to find MuonGeometryRecord for the DTGeometry in event!";
01382 return;
01383 }
01384 const DTGeometry& theDTMuon(*theDTGeometry);
01385
01386
01387 edm::Handle<edm::PSimHitContainer> MuonDtContainer;
01388 iEvent.getByLabel(MuonDtSrc_,MuonDtContainer);
01389 if (!MuonDtContainer.isValid()) {
01390 edm::LogWarning(MsgLoggerCat)
01391 << "Unable to find MuonDTHits in event!";
01392 return;
01393 }
01394
01395
01396 i = 0, j = 0;
01397 for (itHit = MuonDtContainer->begin(); itHit != MuonDtContainer->end();
01398 ++itHit) {
01399
01400 ++i;
01401
01402
01403 DetId theDetUnitId(itHit->detUnitId());
01404 int detector = theDetUnitId.det();
01405 int subdetector = theDetUnitId.subdetId();
01406
01407
01408 if ((detector == dMuon) &&
01409 (subdetector == sdMuonDT)) {
01410
01411
01412
01413 DTWireId wireId(itHit->detUnitId());
01414
01415
01416 const DTLayer *theDet = theDTMuon.layer(wireId.layerId());
01417
01418 if (!theDet) {
01419 edm::LogWarning(MsgLoggerCat)
01420 << "Unable to get GeomDetUnit from theDtMuon for hit " << i;
01421 continue;
01422 }
01423
01424 ++j;
01425
01426
01427 const BoundPlane& bSurface = theDet->surface();
01428
01429 if (hMuonDtToF[0]) hMuonDtToF[0]->Fill(itHit->tof());
01430 if (hMuonDtToF[1]) hMuonDtToF[1]->Fill(itHit->tof());
01431 if (hMuonDtR)
01432 hMuonDtR->Fill(bSurface.toGlobal(itHit->localPosition()).perp());
01433 if (hMuonPhi)
01434 hMuonPhi->Fill(bSurface.toGlobal(itHit->localPosition()).phi());
01435 if (hMuonEta)
01436 hMuonEta->Fill(bSurface.toGlobal(itHit->localPosition()).eta());
01437
01438 } else {
01439 edm::LogWarning(MsgLoggerCat)
01440 << "MuonDt PSimHit " << i
01441 << " is expected to be (det,subdet) = ("
01442 << dMuon << "," << sdMuonDT
01443 << "); value returned is: ("
01444 << detector << "," << subdetector << ")";
01445 continue;
01446 }
01447 }
01448
01449 if (verbosity > 1) {
01450 eventout += "\n Number of DT muon Hits collected:.......... ";
01451 eventout += j;
01452 }
01453
01454 nMuonHits += j;
01455
01456
01458
01460
01461 edm::ESHandle<RPCGeometry> theRPCGeometry;
01462 iSetup.get<MuonGeometryRecord>().get(theRPCGeometry);
01463 if (!theRPCGeometry.isValid()) {
01464 edm::LogWarning(MsgLoggerCat)
01465 << "Unable to find MuonGeometryRecord for the RPCGeometry in event!";
01466 return;
01467 }
01468 const RPCGeometry& theRPCMuon(*theRPCGeometry);
01469
01470
01471 edm::Handle<edm::PSimHitContainer> MuonRPCContainer;
01472 iEvent.getByLabel(MuonRpcSrc_,MuonRPCContainer);
01473 if (!MuonRPCContainer.isValid()) {
01474 edm::LogWarning(MsgLoggerCat)
01475 << "Unable to find MuonRPCHits in event!";
01476 return;
01477 }
01478
01479
01480 i = 0, j = 0;
01481 int RPCBrl =0, RPCFwd = 0;
01482 for (itHit = MuonRPCContainer->begin(); itHit != MuonRPCContainer->end();
01483 ++itHit) {
01484
01485 ++i;
01486
01487
01488 DetId theDetUnitId(itHit->detUnitId());
01489 int detector = theDetUnitId.det();
01490 int subdetector = theDetUnitId.subdetId();
01491
01492
01493 if ((detector == dMuon) &&
01494 (subdetector == sdMuonRPC)) {
01495
01496
01497 RPCDetId RPCId(itHit->detUnitId());
01498
01499
01500 int region = RPCId.region();
01501
01502
01503 const GeomDetUnit *theDet = theRPCMuon.idToDetUnit(theDetUnitId);
01504
01505 if (!theDet) {
01506 edm::LogWarning(MsgLoggerCat)
01507 << "Unable to get GeomDetUnit from theRPCMuon for hit " << i;
01508 continue;
01509 }
01510
01511 ++j;
01512
01513
01514 const BoundPlane& bSurface = theDet->surface();
01515
01516
01517 if ((region == sdMuonRPCRgnFwdp) || (region == sdMuonRPCRgnFwdn)) {
01518 ++RPCFwd;
01519
01520 if (hMuonRpcFToF[0]) hMuonRpcFToF[0]->Fill(itHit->tof());
01521 if (hMuonRpcFToF[1]) hMuonRpcFToF[1]->Fill(itHit->tof());
01522 if (hMuonRpcFZ)
01523 hMuonRpcFZ->Fill(bSurface.toGlobal(itHit->localPosition()).z());
01524 if (hMuonPhi)
01525 hMuonPhi->Fill(bSurface.toGlobal(itHit->localPosition()).phi());
01526 if (hMuonEta)
01527 hMuonEta->Fill(bSurface.toGlobal(itHit->localPosition()).eta());
01528
01529 } else if (region == sdMuonRPCRgnBrl) {
01530 ++RPCBrl;
01531
01532 if (hMuonRpcBToF[0]) hMuonRpcBToF[0]->Fill(itHit->tof());
01533 if (hMuonRpcBToF[1]) hMuonRpcBToF[1]->Fill(itHit->tof());
01534 if (hMuonRpcBR)
01535 hMuonRpcBR->Fill(bSurface.toGlobal(itHit->localPosition()).perp());
01536 if (hMuonPhi)
01537 hMuonPhi->Fill(bSurface.toGlobal(itHit->localPosition()).phi());
01538 if (hMuonEta)
01539 hMuonEta->Fill(bSurface.toGlobal(itHit->localPosition()).eta());
01540
01541 } else {
01542 edm::LogWarning(MsgLoggerCat)
01543 << "Invalid region for RPC Muon hit" << i;
01544 continue;
01545 }
01546 } else {
01547 edm::LogWarning(MsgLoggerCat)
01548 << "MuonRpc PSimHit " << i
01549 << " is expected to be (det,subdet) = ("
01550 << dMuon << "," << sdMuonRPC
01551 << "); value returned is: ("
01552 << detector << "," << subdetector << ")";
01553 continue;
01554 }
01555 }
01556
01557 if (verbosity > 1) {
01558 eventout += "\n Number of RPC muon Hits collected:......... ";
01559 eventout += j;
01560 eventout += "\n RPC Barrel muon Hits:............ ";
01561 eventout += RPCBrl;
01562 eventout += "\n RPC Forward muon Hits:........... ";
01563 eventout += RPCFwd;
01564 }
01565
01566 nMuonHits += j;
01567
01568 if (hMuon[0]) hMuon[0]->Fill((float)nMuonHits);
01569 if (hMuon[1]) hMuon[1]->Fill((float)nMuonHits);
01570
01571 if (verbosity > 0)
01572 edm::LogInfo(MsgLoggerCat) << eventout << "\n";
01573
01574 return;
01575 }
01576
01577 void GlobalHitsProdHist::fillECal(edm::Event& iEvent,
01578 const edm::EventSetup& iSetup)
01579 {
01580 std::string MsgLoggerCat = "GlobalHitsProdHist_fillECal";
01581
01582 TString eventout;
01583 if (verbosity > 0)
01584 eventout = "\nGathering info:";
01585
01586
01587 edm::ESHandle<CaloGeometry> theCaloGeometry;
01588 iSetup.get<CaloGeometryRecord>().get(theCaloGeometry);
01589 if (!theCaloGeometry.isValid()) {
01590 edm::LogWarning(MsgLoggerCat)
01591 << "Unable to find CaloGeometryRecord in event!";
01592 return;
01593 }
01594 const CaloGeometry& theCalo(*theCaloGeometry);
01595
01596
01597 edm::PCaloHitContainer::const_iterator itHit;
01598
01600
01602 edm::PCaloHitContainer theECalHits;
01603
01604 edm::Handle<edm::PCaloHitContainer> EBContainer;
01605 iEvent.getByLabel(ECalEBSrc_,EBContainer);
01606 if (!EBContainer.isValid()) {
01607 edm::LogWarning(MsgLoggerCat)
01608 << "Unable to find EcalHitsEB in event!";
01609 return;
01610 }
01611
01612 edm::Handle<edm::PCaloHitContainer> EEContainer;
01613 iEvent.getByLabel(ECalEESrc_,EEContainer);
01614 if (!EEContainer.isValid()) {
01615 edm::LogWarning(MsgLoggerCat)
01616 << "Unable to find EcalHitsEE in event!";
01617 return;
01618 }
01619
01620 theECalHits.insert(theECalHits.end(),EBContainer->begin(),
01621 EBContainer->end());
01622 theECalHits.insert(theECalHits.end(),EEContainer->begin(),
01623 EEContainer->end());
01624
01625
01626 int i = 0, j = 0;
01627 for (itHit = theECalHits.begin(); itHit != theECalHits.end(); ++itHit) {
01628
01629 ++i;
01630
01631
01632 DetId theDetUnitId(itHit->id());
01633 int detector = theDetUnitId.det();
01634 int subdetector = theDetUnitId.subdetId();
01635
01636
01637 if ((detector == dEcal) &&
01638 ((subdetector == sdEcalBrl) ||
01639 (subdetector == sdEcalFwd))) {
01640
01641
01642 const CaloCellGeometry *theDet = theCalo.
01643 getSubdetectorGeometry(theDetUnitId)->getGeometry(theDetUnitId);
01644
01645 if (!theDet) {
01646 edm::LogWarning(MsgLoggerCat)
01647 << "Unable to get CaloCellGeometry from ECalHits for Hit " << i;
01648 continue;
01649 }
01650
01651 ++j;
01652
01653
01654 const GlobalPoint& globalposition = theDet->getPosition();
01655
01656 if (hCaloEcalE[0]) hCaloEcalE[0]->Fill(itHit->energy());
01657 if (hCaloEcalE[1]) hCaloEcalE[1]->Fill(itHit->energy());
01658 if (hCaloEcalToF[0]) hCaloEcalToF[0]->Fill(itHit->time());
01659 if (hCaloEcalToF[1]) hCaloEcalToF[1]->Fill(itHit->time());
01660 if (hCaloEcalPhi) hCaloEcalPhi->Fill(globalposition.phi());
01661 if (hCaloEcalEta) hCaloEcalEta->Fill(globalposition.eta());
01662
01663 } else {
01664 edm::LogWarning(MsgLoggerCat)
01665 << "ECal PCaloHit " << i
01666 << " is expected to be (det,subdet) = ("
01667 << dEcal << "," << sdEcalBrl
01668 << " || " << sdEcalFwd << "); value returned is: ("
01669 << detector << "," << subdetector << ")";
01670 continue;
01671 }
01672 }
01673
01674 if (verbosity > 1) {
01675 eventout += "\n Number of ECal Hits collected:............. ";
01676 eventout += j;
01677 }
01678
01679 if (hCaloEcal[0]) hCaloEcal[0]->Fill((float)j);
01680 if (hCaloEcal[1]) hCaloEcal[1]->Fill((float)j);
01681
01683
01685
01686 edm::Handle<edm::PCaloHitContainer> PreShContainer;
01687 iEvent.getByLabel(ECalESSrc_,PreShContainer);
01688 if (!PreShContainer.isValid()) {
01689 edm::LogWarning(MsgLoggerCat)
01690 << "Unable to find EcalHitsES in event!";
01691 return;
01692 }
01693
01694
01695 i = 0, j = 0;
01696 for (itHit = PreShContainer->begin();
01697 itHit != PreShContainer->end(); ++itHit) {
01698
01699 ++i;
01700
01701
01702 DetId theDetUnitId(itHit->id());
01703 int detector = theDetUnitId.det();
01704 int subdetector = theDetUnitId.subdetId();
01705
01706
01707 if ((detector == dEcal) &&
01708 (subdetector == sdEcalPS)) {
01709
01710
01711 const CaloCellGeometry *theDet = theCalo.
01712 getSubdetectorGeometry(theDetUnitId)->getGeometry(theDetUnitId);
01713
01714 if (!theDet) {
01715 edm::LogWarning(MsgLoggerCat)
01716 << "Unable to get CaloCellGeometry from PreShContainer for Hit "
01717 << i;
01718 continue;
01719 }
01720
01721 ++j;
01722
01723
01724 const GlobalPoint& globalposition = theDet->getPosition();
01725
01726 if (hCaloPreShE[0]) hCaloPreShE[0]->Fill(itHit->energy());
01727 if (hCaloPreShE[1]) hCaloPreShE[1]->Fill(itHit->energy());
01728 if (hCaloPreShToF[0]) hCaloPreShToF[0]->Fill(itHit->time());
01729 if (hCaloPreShToF[1]) hCaloPreShToF[1]->Fill(itHit->time());
01730 if (hCaloPreShPhi) hCaloPreShPhi->Fill(globalposition.phi());
01731 if (hCaloPreShEta) hCaloPreShEta->Fill(globalposition.eta());
01732
01733 } else {
01734 edm::LogWarning(MsgLoggerCat)
01735 << "PreSh PCaloHit " << i
01736 << " is expected to be (det,subdet) = ("
01737 << dEcal << "," << sdEcalPS
01738 << "); value returned is: ("
01739 << detector << "," << subdetector << ")";
01740 continue;
01741 }
01742 }
01743
01744 if (verbosity > 1) {
01745 eventout += "\n Number of PreSh Hits collected:............ ";
01746 eventout += j;
01747 }
01748
01749 if (hCaloPreSh[0]) hCaloPreSh[0]->Fill((float)j);
01750 if (hCaloPreSh[1]) hCaloPreSh[1]->Fill((float)j);
01751
01752 if (verbosity > 0)
01753 edm::LogInfo(MsgLoggerCat) << eventout << "\n";
01754
01755 return;
01756 }
01757
01758 void GlobalHitsProdHist::fillHCal(edm::Event& iEvent,
01759 const edm::EventSetup& iSetup)
01760 {
01761 std::string MsgLoggerCat = "GlobalHitsProdHist_fillHCal";
01762
01763 TString eventout;
01764 if (verbosity > 0)
01765 eventout = "\nGathering info:";
01766
01767
01768 edm::ESHandle<CaloGeometry> theCaloGeometry;
01769 iSetup.get<CaloGeometryRecord>().get(theCaloGeometry);
01770 if (!theCaloGeometry.isValid()) {
01771 edm::LogWarning(MsgLoggerCat)
01772 << "Unable to find CaloGeometryRecord in event!";
01773 return;
01774 }
01775 const CaloGeometry& theCalo(*theCaloGeometry);
01776
01777
01778 edm::PCaloHitContainer::const_iterator itHit;
01779
01781
01783
01784 edm::Handle<edm::PCaloHitContainer> HCalContainer;
01785 iEvent.getByLabel(HCalSrc_,HCalContainer);
01786 if (!HCalContainer.isValid()) {
01787 edm::LogWarning(MsgLoggerCat)
01788 << "Unable to find HCalHits in event!";
01789 return;
01790 }
01791
01792
01793 int i = 0, j = 0;
01794 for (itHit = HCalContainer->begin();
01795 itHit != HCalContainer->end(); ++itHit) {
01796
01797 ++i;
01798
01799
01800 DetId theDetUnitId(itHit->id());
01801 int detector = theDetUnitId.det();
01802 int subdetector = theDetUnitId.subdetId();
01803
01804
01805 if ((detector == dHcal) &&
01806 ((subdetector == sdHcalBrl) ||
01807 (subdetector == sdHcalEC) ||
01808 (subdetector == sdHcalOut) ||
01809 (subdetector == sdHcalFwd))) {
01810
01811
01812 const CaloCellGeometry *theDet = theCalo.
01813 getSubdetectorGeometry(theDetUnitId)->getGeometry(theDetUnitId);
01814
01815 if (!theDet) {
01816 edm::LogWarning(MsgLoggerCat)
01817 << "Unable to get CaloCellGeometry from HCalContainer for Hit " << i;
01818 continue;
01819 }
01820
01821 ++j;
01822
01823
01824 const GlobalPoint& globalposition = theDet->getPosition();
01825
01826 if (hCaloHcalE[0]) hCaloHcalE[0]->Fill(itHit->energy());
01827 if (hCaloHcalE[1]) hCaloHcalE[1]->Fill(itHit->energy());
01828 if (hCaloHcalToF[0]) hCaloHcalToF[0]->Fill(itHit->time());
01829 if (hCaloHcalToF[1]) hCaloHcalToF[1]->Fill(itHit->time());
01830 if (hCaloHcalPhi) hCaloHcalPhi->Fill(globalposition.phi());
01831 if (hCaloHcalEta) hCaloHcalEta->Fill(globalposition.eta());
01832
01833 } else {
01834 edm::LogWarning(MsgLoggerCat)
01835 << "HCal PCaloHit " << i
01836 << " is expected to be (det,subdet) = ("
01837 << dHcal << "," << sdHcalBrl
01838 << " || " << sdHcalEC << " || " << sdHcalOut << " || " << sdHcalFwd
01839 << "); value returned is: ("
01840 << detector << "," << subdetector << ")";
01841 continue;
01842 }
01843 }
01844
01845 if (verbosity > 1) {
01846 eventout += "\n Number of HCal Hits collected:............. ";
01847 eventout += j;
01848 }
01849
01850 if (hCaloHcal[0]) hCaloHcal[0]->Fill((float)j);
01851 if (hCaloHcal[1]) hCaloHcal[1]->Fill((float)j);
01852
01853 if (verbosity > 0)
01854 edm::LogInfo(MsgLoggerCat) << eventout << "\n";
01855
01856 return;
01857 }