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